Changeset 23892 in vbox for trunk/src/VBox/Runtime/r3/init.cpp
- Timestamp:
- Oct 20, 2009 8:55:51 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/init.cpp
r23871 r23892 42 42 # ifndef RT_OS_OS2 43 43 # include <pthread.h> 44 # include <signal.h>45 # include <errno.h>46 # define IPRT_USE_SIG_CHILD_DUMMY47 44 # endif 48 45 #endif … … 207 204 } 208 205 209 210 #ifdef IPRT_USE_SIG_CHILD_DUMMY211 /**212 * Dummy SIGCHILD handler.213 *214 * Assigned on rtR3Init only when SIGCHILD handler is set SIGIGN or SIGDEF to215 * ensure waitpid works properly for the terminated processes.216 */217 static void rtR3SigChildHandler(int iSignal)218 {219 NOREF(iSignal);220 }221 #endif /* IPRT_USE_SIG_CHILD_DUMMY */222 223 224 206 /** 225 207 * rtR3Init worker. … … 314 296 atexit(rtR3ExitCallback); 315 297 316 #ifdef IPRT_USE_SIG_CHILD_DUMMY317 /*318 * SIGCHLD must not be ignored (that's default), otherwise posix compliant waitpid319 * implementations won't work right.320 */321 for (;;)322 {323 struct sigaction saOld;324 rc = sigaction(SIGCHLD, 0, &saOld); AssertMsg(rc == 0, ("%d/%d\n", rc, errno));325 if ( rc != 0326 || (saOld.sa_flags & SA_SIGINFO)327 || ( saOld.sa_handler != SIG_IGN328 && saOld.sa_handler != SIG_DFL)329 )330 break;331 332 /* Try install dummy handler. */333 struct sigaction saNew = saOld;334 saNew.sa_flags = SA_NOCLDSTOP | SA_RESTART;335 saNew.sa_handler = rtR3SigChildHandler;336 rc = sigemptyset(&saNew.sa_mask); AssertMsg(rc == 0, ("%d/%d\n", rc, errno));337 struct sigaction saOld2;338 rc = sigaction(SIGCHLD, &saNew, &saOld2); AssertMsg(rc == 0, ("%d/%d\n", rc, errno));339 if ( rc != 0340 || ( saOld2.sa_handler == saOld.sa_handler341 && !(saOld2.sa_flags & SA_SIGINFO))342 )343 break;344 345 /* Race during dynamic load, restore and try again... */346 sigaction(SIGCHLD, &saOld2, NULL);347 RTThreadYield();348 }349 #endif /* IPRT_USE_SIG_CHILD_DUMMY */350 351 298 #ifdef IPRT_WITH_ALIGNMENT_CHECKS 352 299 /*
Note:
See TracChangeset
for help on using the changeset viewer.