1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

On Linux, use the SVR4 (now POSIX) signal and locking interfaces instead of the non-standard BSD equivalents.

This commit is contained in:
Lev Kujawski 2021-01-06 12:16:35 -07:00 committed by Jon Trulson
parent 5c801a07a0
commit 0e282a0ad7
2 changed files with 6 additions and 7 deletions

View file

@ -68,7 +68,7 @@
# include <varargs.h> # include <varargs.h>
#endif #endif
#if defined (SYSV) || defined (SVR4) #if defined(SYSV) || defined(SVR4) || defined(__linux__)
#ifndef F_TLOCK #ifndef F_TLOCK
# include <unistd.h> # include <unistd.h>
#endif #endif
@ -529,11 +529,10 @@ WaitForChild( void )
waitType status; waitType status;
int mask; int mask;
#if defined(SYSV) || defined(SVR4) || defined(hpux) #if defined(SYSV) || defined(SVR4) || defined(hpux) || defined(__linux__)
if (AnyWellKnownSockets()) { if (AnyWellKnownSockets()) {
while ( ChildReady ) { while ( ChildReady ) {
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
while ((pid = waitpid((pid_t) -1, &status, WNOHANG)) > 0 ) while ((pid = waitpid((pid_t) -1, &status, WNOHANG)) > 0 )
#else #else
while ((pid = wait3 (&status, WNOHANG, NULL)) > 0 ) while ((pid = wait3 (&status, WNOHANG, NULL)) > 0 )
@ -1337,7 +1336,7 @@ StorePid( void )
fseek (pidFilePtr, 0l, 0); fseek (pidFilePtr, 0l, 0);
if (lockPidFile) if (lockPidFile)
{ {
#if defined (SYSV) || defined (SVR4) #if defined(SYSV) || defined(SVR4) || defined(__linux__)
if (lockf (pidFd, F_TLOCK, 0) == -1) if (lockf (pidFd, F_TLOCK, 0) == -1)
{ {
if ((errno == EAGAIN) || (errno == EACCES)) if ((errno == EAGAIN) || (errno == EACCES))
@ -1374,7 +1373,7 @@ static void
UnlockPidFile( void ) UnlockPidFile( void )
{ {
if (lockPidFile) if (lockPidFile)
#if defined (SYSV) || defined (SVR4) #if defined(SYSV) || defined(SVR4) || defined(__linux__)
lockf (pidFd, F_ULOCK, 0); lockf (pidFd, F_ULOCK, 0);
#else #else
flock (pidFd, LOCK_UN); flock (pidFd, LOCK_UN);

View file

@ -1161,7 +1161,7 @@ ImmediateExit(
* Turn off SIGTERM so we don't catch one in the middle of shutting * Turn off SIGTERM so we don't catch one in the middle of shutting
* down * down
*/ */
#if !defined(SVR4) #if !defined(SVR4) && !defined(__linux__)
old = sigblock(sigmask(SIGTERM)); old = sigblock(sigmask(SIGTERM));
sigblock(sigmask(SIGHUP)); sigblock(sigmask(SIGHUP));
sigblock(sigmask(SIGPIPE)); sigblock(sigmask(SIGPIPE));