From 354aa400bb6e01fcddb0852c660d1b9100001495 Mon Sep 17 00:00:00 2001
From: Lev Kujawski <int21h@mailbox.org>
Date: Wed, 6 Jan 2021 12:16:35 -0700
Subject: [PATCH 05/14] On Linux, use the SVR4 (now POSIX) signal and locking
 interfaces instead of the non-standard BSD equivalents.

---
 cde/programs/dtlogin/dm.c     | 11 +++++------
 cde/programs/dtsession/SmUI.c |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/cde/programs/dtlogin/dm.c b/cde/programs/dtlogin/dm.c
index 54d1dbee..a5b800d7 100644
--- a/cde/programs/dtlogin/dm.c
+++ b/cde/programs/dtlogin/dm.c
@@ -68,7 +68,7 @@
 # include	<varargs.h>
 #endif
 
-#if defined (SYSV) || defined (SVR4)
+#if defined(SYSV) || defined(SVR4) || defined(__linux__)
 #ifndef F_TLOCK
 # include	<unistd.h>
 #endif
@@ -529,11 +529,10 @@ WaitForChild( void )
     waitType	status;
     int		mask;
 
-#if defined(SYSV) || defined(SVR4)  || defined(hpux)
-
+#if defined(SYSV) || defined(SVR4) || defined(hpux) || defined(__linux__)
     if (AnyWellKnownSockets()) {
 	while ( ChildReady ) {
-#ifdef SVR4
+#if defined(SVR4) || defined(__linux__)
 	   while ((pid = waitpid((pid_t) -1, &status, WNOHANG)) > 0 )
 #else
 	    while ((pid = wait3 (&status, WNOHANG, NULL)) > 0 )
@@ -1337,7 +1336,7 @@ StorePid( void )
 	fseek (pidFilePtr, 0l, 0);
 	if (lockPidFile)
 	{
-#if defined (SYSV) || defined (SVR4)
+#if defined(SYSV) || defined(SVR4) || defined(__linux__)
 	    if (lockf (pidFd, F_TLOCK, 0) == -1)
 	    {
 		if ((errno == EAGAIN) || (errno == EACCES))
@@ -1374,7 +1373,7 @@ static void
 UnlockPidFile( void )
 {
     if (lockPidFile)
-#if defined (SYSV) || defined (SVR4)
+#if defined(SYSV) || defined(SVR4) || defined(__linux__)
 	lockf (pidFd, F_ULOCK, 0);
 #else
 	flock (pidFd, LOCK_UN);
diff --git a/cde/programs/dtsession/SmUI.c b/cde/programs/dtsession/SmUI.c
index 9ea710de..263d8ff1 100644
--- a/cde/programs/dtsession/SmUI.c
+++ b/cde/programs/dtsession/SmUI.c
@@ -1161,7 +1161,7 @@ ImmediateExit(
      * Turn off SIGTERM so we don't catch one in the middle of shutting
      * down
      */
-#if !defined(SVR4)
+#if !defined(SVR4) && !defined(__linux__)
     old = sigblock(sigmask(SIGTERM));
     sigblock(sigmask(SIGHUP));
     sigblock(sigmask(SIGPIPE));
-- 
2.30.0

