[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kinit
From: Luboš Luňák <l.lunak () kde ! org>
Date: 2010-01-31 10:50:47
Message-ID: 1264935047.283485.23124.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1082803 by lunakl:
Do not close the OOM protection pipe at startup.
M +13 -4 kinit.cpp
--- trunk/KDE/kdelibs/kinit/kinit.cpp #1082802:1082803
@@ -160,6 +160,10 @@
#include <kio/authinfo.h>
extern "C" KIO::AuthInfo* _kioslave_init_kio() { return new KIO::AuthInfo(); }
+#ifdef KDEINIT_OOM_PROTECT
+static int oom_pipe = -1;
+#endif
+
/*
* Clean up the file descriptor table by closing all file descriptors
* that are still open.
@@ -174,7 +178,10 @@
if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
maxfd = rl.rlim_max;
for (int fd = 3; fd < maxfd; ++fd)
- close(fd);
+ {
+ if( fd != oom_pipe )
+ close(fd);
+ }
}
/*
@@ -419,8 +426,6 @@
}
#ifdef KDEINIT_OOM_PROTECT
-static int oom_pipe = -1;
-
static void oom_protect_sighandler( int ) {
}
@@ -439,7 +444,11 @@
pid_t pid = getpid();
if( write( oom_pipe, &pid, sizeof( pid_t )) > 0 ) {
sigsuspend( &oldsigs ); // wait for the signal to come
- }
+ } else {
+#ifndef NDEBUG
+ fprintf( stderr, "Failed to reset OOM protection: %d\n", pid );
+#endif
+ }
sigprocmask( SIG_SETMASK, &oldsigs, NULL );
sigaction( SIGUSR1, &oldact, NULL );
close( oom_pipe );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic