mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 18:49:03 -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]
|
||||
Focused=1
|
||||
Focused=2
|
||||
Order=7,3,2,6,25,24,-1,1,4,5,0
|
||||
|
||||
[Editor_0]
|
||||
@ -12,18 +12,18 @@ LeftChar=1
|
||||
|
||||
[Editor_1]
|
||||
Open=1
|
||||
Top=1
|
||||
CursorCol=1
|
||||
CursorRow=231
|
||||
TopLine=210
|
||||
Top=0
|
||||
CursorCol=3
|
||||
CursorRow=2915
|
||||
TopLine=2911
|
||||
LeftChar=1
|
||||
|
||||
[Editor_2]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=1
|
||||
CursorRow=31
|
||||
TopLine=278
|
||||
Top=1
|
||||
CursorCol=3
|
||||
CursorRow=17
|
||||
TopLine=1
|
||||
LeftChar=1
|
||||
|
||||
[Editor_3]
|
||||
|
@ -147,6 +147,8 @@ typedef std::deque<command_t> command_table;
|
||||
serverrec* me[32];
|
||||
serverrec* servers[255];
|
||||
|
||||
FILE *log_file;
|
||||
|
||||
user_hash clientlist;
|
||||
chan_hash chanlist;
|
||||
user_hash whowas;
|
||||
@ -310,7 +312,6 @@ void log(int level,char *text, ...)
|
||||
{
|
||||
char textbuffer[MAXBUF];
|
||||
va_list argsPtr;
|
||||
FILE *f;
|
||||
time_t rawtime;
|
||||
struct tm * timeinfo;
|
||||
if (level < LogLevel)
|
||||
@ -319,8 +320,7 @@ void log(int level,char *text, ...)
|
||||
time(&rawtime);
|
||||
timeinfo = localtime (&rawtime);
|
||||
|
||||
f = fopen("ircd.log","a+");
|
||||
if (f)
|
||||
if (log_file)
|
||||
{
|
||||
char b[MAXBUF];
|
||||
va_start (argsPtr, text);
|
||||
@ -328,19 +328,13 @@ void log(int level,char *text, ...)
|
||||
va_end(argsPtr);
|
||||
strcpy(b,asctime(timeinfo));
|
||||
b[strlen(b)-1] = ':';
|
||||
fprintf(f,"%s %s\n",b,textbuffer);
|
||||
fclose(f);
|
||||
fprintf(log_file,"%s %s\n",b,textbuffer);
|
||||
if (nofork)
|
||||
{
|
||||
// nofork enabled? display it on terminal too
|
||||
printf("%s %s\n",b,textbuffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Can't write log file, bailing!!!");
|
||||
Exit(ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
void handle_join(char **parameters, int pcnt, userrec *user)
|
||||
{
|
||||
chanrec* Ptr;
|
||||
@ -2941,7 +2936,6 @@ void kill_link(userrec *user,char* reason)
|
||||
|
||||
log(DEBUG,"kill_link: %s '%s'",user->nick,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);
|
||||
|
||||
/* bugfix, cant close() a nonblocking socket (sux!) */
|
||||
@ -3798,14 +3792,12 @@ void ConnectUser(userrec *user)
|
||||
if (strcmp(Passwd(user),"") && (!user->haspassed))
|
||||
{
|
||||
Write(user->fd,"ERROR :Closing link: Invalid password");
|
||||
fdatasync(user->fd);
|
||||
kill_link(user,"Invalid password");
|
||||
return;
|
||||
}
|
||||
if (IsDenied(user))
|
||||
{
|
||||
Write(user->fd,"ERROR :Closing link: Unauthorized connection");
|
||||
fdatasync(user->fd);
|
||||
kill_link(user,"Unauthorised connection");
|
||||
}
|
||||
|
||||
@ -4827,6 +4819,13 @@ int InspIRCd(void)
|
||||
fd_set selectFds;
|
||||
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,"$Id$");
|
||||
if (geteuid() == 0)
|
||||
|
@ -14,7 +14,10 @@
|
||||
* ---------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include "inspircd.h"
|
||||
@ -80,7 +83,11 @@ int DaemonSeed (void)
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
|
||||
#ifdef __linux__
|
||||
setpriority(PRIO_PROCESS,(int)getpid(),15); /* ircd sets to low process priority so it doesnt hog the box */
|
||||
#endif
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user