]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fixes for setpriority on freebsd
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 3 Apr 2004 22:34:38 +0000 (22:34 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 3 Apr 2004 22:34:38 +0000 (22:34 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@370 e03df62e-2008-0410-955e-edbf42e46eb7

src/InspIRCd.layout
src/inspircd.cpp
src/inspircd_io.cpp

index 71d2a46f923c508d0cb522928a349585767224f5..a8dc6851a151305698475685a02f69b0397b9ecf 100644 (file)
@@ -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]
index 409dd10abe54f1f7286e5694e4f747770e0c2d13..e825729f9dd3d7b91d24df0cb489fcebb765cd92 100644 (file)
@@ -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)
index 244316c504f1fa9bf0b9fd8ec48f68bbe21a6489..885954881292ca34332a9c10fe3a255768ea2561 100644 (file)
  * ---------------------------------------------------
  */
 
+#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);
 }