mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Fixes for setpriority on freebsd
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@370 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
5f30e68a76
commit
f319b4a3bc
@ -1,5 +1,5 @@
|
|||||||
[Editors]
|
[Editors]
|
||||||
Focused=1
|
Focused=2
|
||||||
Order=7,3,2,6,25,24,-1,1,4,5,0
|
Order=7,3,2,6,25,24,-1,1,4,5,0
|
||||||
|
|
||||||
[Editor_0]
|
[Editor_0]
|
||||||
@ -12,18 +12,18 @@ LeftChar=1
|
|||||||
|
|
||||||
[Editor_1]
|
[Editor_1]
|
||||||
Open=1
|
Open=1
|
||||||
Top=1
|
Top=0
|
||||||
CursorCol=1
|
CursorCol=3
|
||||||
CursorRow=231
|
CursorRow=2915
|
||||||
TopLine=210
|
TopLine=2911
|
||||||
LeftChar=1
|
LeftChar=1
|
||||||
|
|
||||||
[Editor_2]
|
[Editor_2]
|
||||||
Open=1
|
Open=1
|
||||||
Top=0
|
Top=1
|
||||||
CursorCol=1
|
CursorCol=3
|
||||||
CursorRow=31
|
CursorRow=17
|
||||||
TopLine=278
|
TopLine=1
|
||||||
LeftChar=1
|
LeftChar=1
|
||||||
|
|
||||||
[Editor_3]
|
[Editor_3]
|
||||||
|
@ -147,6 +147,8 @@ typedef std::deque<command_t> command_table;
|
|||||||
serverrec* me[32];
|
serverrec* me[32];
|
||||||
serverrec* servers[255];
|
serverrec* servers[255];
|
||||||
|
|
||||||
|
FILE *log_file;
|
||||||
|
|
||||||
user_hash clientlist;
|
user_hash clientlist;
|
||||||
chan_hash chanlist;
|
chan_hash chanlist;
|
||||||
user_hash whowas;
|
user_hash whowas;
|
||||||
@ -310,7 +312,6 @@ void log(int level,char *text, ...)
|
|||||||
{
|
{
|
||||||
char textbuffer[MAXBUF];
|
char textbuffer[MAXBUF];
|
||||||
va_list argsPtr;
|
va_list argsPtr;
|
||||||
FILE *f;
|
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
struct tm * timeinfo;
|
struct tm * timeinfo;
|
||||||
if (level < LogLevel)
|
if (level < LogLevel)
|
||||||
@ -319,8 +320,7 @@ void log(int level,char *text, ...)
|
|||||||
time(&rawtime);
|
time(&rawtime);
|
||||||
timeinfo = localtime (&rawtime);
|
timeinfo = localtime (&rawtime);
|
||||||
|
|
||||||
f = fopen("ircd.log","a+");
|
if (log_file)
|
||||||
if (f)
|
|
||||||
{
|
{
|
||||||
char b[MAXBUF];
|
char b[MAXBUF];
|
||||||
va_start (argsPtr, text);
|
va_start (argsPtr, text);
|
||||||
@ -328,19 +328,13 @@ void log(int level,char *text, ...)
|
|||||||
va_end(argsPtr);
|
va_end(argsPtr);
|
||||||
strcpy(b,asctime(timeinfo));
|
strcpy(b,asctime(timeinfo));
|
||||||
b[strlen(b)-1] = ':';
|
b[strlen(b)-1] = ':';
|
||||||
fprintf(f,"%s %s\n",b,textbuffer);
|
fprintf(log_file,"%s %s\n",b,textbuffer);
|
||||||
fclose(f);
|
|
||||||
if (nofork)
|
if (nofork)
|
||||||
{
|
{
|
||||||
// nofork enabled? display it on terminal too
|
// nofork enabled? display it on terminal too
|
||||||
printf("%s %s\n",b,textbuffer);
|
printf("%s %s\n",b,textbuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Can't write log file, bailing!!!");
|
|
||||||
Exit(ERROR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void readfile(file_cache &F, const char* fname)
|
void readfile(file_cache &F, const char* fname)
|
||||||
@ -2831,6 +2825,7 @@ int loop_call(handlerfunc fn, char **parameters, int pcnt, userrec *u, int start
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void handle_join(char **parameters, int pcnt, userrec *user)
|
void handle_join(char **parameters, int pcnt, userrec *user)
|
||||||
{
|
{
|
||||||
chanrec* Ptr;
|
chanrec* Ptr;
|
||||||
@ -2941,7 +2936,6 @@ void kill_link(userrec *user,char* reason)
|
|||||||
|
|
||||||
log(DEBUG,"kill_link: %s '%s'",user->nick,reason);
|
log(DEBUG,"kill_link: %s '%s'",user->nick,reason);
|
||||||
Write(user->fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,reason);
|
Write(user->fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,reason);
|
||||||
fdatasync(user->fd);
|
|
||||||
log(DEBUG,"closing fd %d",user->fd);
|
log(DEBUG,"closing fd %d",user->fd);
|
||||||
|
|
||||||
/* bugfix, cant close() a nonblocking socket (sux!) */
|
/* bugfix, cant close() a nonblocking socket (sux!) */
|
||||||
@ -3798,14 +3792,12 @@ void ConnectUser(userrec *user)
|
|||||||
if (strcmp(Passwd(user),"") && (!user->haspassed))
|
if (strcmp(Passwd(user),"") && (!user->haspassed))
|
||||||
{
|
{
|
||||||
Write(user->fd,"ERROR :Closing link: Invalid password");
|
Write(user->fd,"ERROR :Closing link: Invalid password");
|
||||||
fdatasync(user->fd);
|
|
||||||
kill_link(user,"Invalid password");
|
kill_link(user,"Invalid password");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (IsDenied(user))
|
if (IsDenied(user))
|
||||||
{
|
{
|
||||||
Write(user->fd,"ERROR :Closing link: Unauthorized connection");
|
Write(user->fd,"ERROR :Closing link: Unauthorized connection");
|
||||||
fdatasync(user->fd);
|
|
||||||
kill_link(user,"Unauthorised connection");
|
kill_link(user,"Unauthorised connection");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4827,6 +4819,13 @@ int InspIRCd(void)
|
|||||||
fd_set selectFds;
|
fd_set selectFds;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
|
log_file = fopen("ircd.log","a+");
|
||||||
|
if (!log_file)
|
||||||
|
{
|
||||||
|
printf("ERROR: Could not write to logfile ircd.log, bailing!\n\n");
|
||||||
|
Exit(ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
log(DEBUG,"InspIRCd: startup: begin");
|
log(DEBUG,"InspIRCd: startup: begin");
|
||||||
log(DEBUG,"$Id$");
|
log(DEBUG,"$Id$");
|
||||||
if (geteuid() == 0)
|
if (geteuid() == 0)
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
* ---------------------------------------------------
|
* ---------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "inspircd.h"
|
#include "inspircd.h"
|
||||||
@ -80,7 +83,11 @@ int DaemonSeed (void)
|
|||||||
close(0);
|
close(0);
|
||||||
close(1);
|
close(1);
|
||||||
close(2);
|
close(2);
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
setpriority(PRIO_PROCESS,(int)getpid(),15); /* ircd sets to low process priority so it doesnt hog the box */
|
setpriority(PRIO_PROCESS,(int)getpid(),15); /* ircd sets to low process priority so it doesnt hog the box */
|
||||||
|
#endif
|
||||||
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user