summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-03 22:34:38 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-03 22:34:38 +0000
commitf319b4a3bc4bf6509334679b25357f10dacae72b (patch)
tree571acceb56e026ad6f4b9d1e6f7d3915c0525a46
parent5f30e68a76f0b4e71884675adb59c931bdb19fb8 (diff)
Fixes for setpriority on freebsd
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@370 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/InspIRCd.layout18
-rw-r--r--src/inspircd.cpp25
-rw-r--r--src/inspircd_io.cpp7
3 files changed, 28 insertions, 22 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout
index 71d2a46f9..a8dc6851a 100644
--- a/src/InspIRCd.layout
+++ b/src/InspIRCd.layout
@@ -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]
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 409dd10ab..e825729f9 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -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)
diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp
index 244316c50..885954881 100644
--- a/src/inspircd_io.cpp
+++ b/src/inspircd_io.cpp
@@ -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);
}