mirror of
https://github.com/Interlisp/maiko.git
synced 2026-05-04 07:19:21 +00:00
Use waitpid, not wait3, etc. (#44)
This removes code that uses `union wait` status in favor of code that uses `int` status. This has been the correct way since SvR4, BSD 4.3, POSIX.
This commit is contained in:
@@ -255,7 +255,6 @@ typedef signed char s_char;
|
|||||||
#undef HAS_GETHOSTID
|
#undef HAS_GETHOSTID
|
||||||
#define BSD_COMP 1
|
#define BSD_COMP 1
|
||||||
#define SYSVSIGNALS 1
|
#define SYSVSIGNALS 1
|
||||||
#define WAITINT 1
|
|
||||||
#define L_SET SEEK_SET
|
#define L_SET SEEK_SET
|
||||||
#define NOFORN
|
#define NOFORN
|
||||||
#define LOCK_X_UPDATES 1
|
#define LOCK_X_UPDATES 1
|
||||||
@@ -297,7 +296,6 @@ typedef signed char s_char;
|
|||||||
/* MacOS X, FreeBSD - mostly POSIX-compliant Unix */
|
/* MacOS X, FreeBSD - mostly POSIX-compliant Unix */
|
||||||
#define NOETHER 1
|
#define NOETHER 1
|
||||||
#define XWINDOWS 1
|
#define XWINDOWS 1
|
||||||
#define WAITINT 1
|
|
||||||
|
|
||||||
#undef REGISTER
|
#undef REGISTER
|
||||||
#define REGISTER
|
#define REGISTER
|
||||||
|
|||||||
@@ -479,47 +479,26 @@ int fork_Unix() {
|
|||||||
|
|
||||||
case 'W': /* Wait for a process to die. */
|
case 'W': /* Wait for a process to die. */
|
||||||
{
|
{
|
||||||
#if defined(SYSVONLY) || defined(WAITINT)
|
|
||||||
int status;
|
int status;
|
||||||
#else
|
|
||||||
union wait status;
|
|
||||||
#endif /* SYSVONLY */
|
|
||||||
|
|
||||||
#ifdef OCR
|
#ifdef OCR
|
||||||
int slot;
|
int slot;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SYSVONLY) || defined(WAITINT)
|
|
||||||
status = 0;
|
status = 0;
|
||||||
#else
|
|
||||||
status.w_status = 0;
|
|
||||||
#endif /* SYSVONLY */
|
|
||||||
|
|
||||||
IOBuf[0] = 0;
|
IOBuf[0] = 0;
|
||||||
IOBuf[1] = 0;
|
IOBuf[1] = 0;
|
||||||
DBPRINT(("About to wait for processes.\n"));
|
DBPRINT(("About to wait for processes.\n"));
|
||||||
#ifdef SYSVONLY
|
|
||||||
retry1:
|
retry1:
|
||||||
pid = waitpid(-1, &status, WNOHANG);
|
pid = waitpid(-1, &status, WNOHANG);
|
||||||
if (pid == -1 && errno == EINTR) goto retry1;
|
if (pid == -1 && errno == EINTR) goto retry1;
|
||||||
#else
|
if (pid > 0) {
|
||||||
pid = wait3(&status, WNOHANG, 0);
|
/* Ignore processes which are suspended but haven't exited
|
||||||
#endif /* SYSVONLY */
|
(this shouldn't happen) */
|
||||||
if (pid > 0)
|
|
||||||
|
|
||||||
{
|
|
||||||
/* Ignore processes which are suspended but haven't exited
|
|
||||||
(this shouldn't happen) */
|
|
||||||
#if defined(SYSVONLY) || defined(WAITINT)
|
|
||||||
if (WIFSTOPPED(status)) break;
|
if (WIFSTOPPED(status)) break;
|
||||||
IOBuf[3] = status >> 8;
|
IOBuf[3] = status >> 8;
|
||||||
IOBuf[2] = status & 0xFF;
|
IOBuf[2] = status & 0xFF;
|
||||||
#else
|
|
||||||
if (status.w_stopval == WSTOPPED) break;
|
|
||||||
IOBuf[3] = status.w_T.w_Retcode;
|
|
||||||
IOBuf[2] = status.w_T.w_Termsig;
|
|
||||||
#endif /* SYSVONLY */
|
|
||||||
|
|
||||||
IOBuf[1] = pid & 0xFF;
|
IOBuf[1] = pid & 0xFF;
|
||||||
IOBuf[0] = (pid >> 8) & 0xFF;
|
IOBuf[0] = (pid >> 8) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -376,12 +376,7 @@ LispPTR uraid_commands() {
|
|||||||
LispPTR index;
|
LispPTR index;
|
||||||
DefCell *defcell68k;
|
DefCell *defcell68k;
|
||||||
#ifndef DOS
|
#ifndef DOS
|
||||||
#if defined(SYSVONLY) || defined(WAITINT)
|
|
||||||
int status;
|
int status;
|
||||||
#else
|
|
||||||
union wait status;
|
|
||||||
#endif /* SYSVONLY */
|
|
||||||
|
|
||||||
#endif /* DOS */
|
#endif /* DOS */
|
||||||
|
|
||||||
if (URaid_argnum == -1) {
|
if (URaid_argnum == -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user