Changeset 873


Ignore:
Timestamp:
Nov 23, 2003, 5:41:41 AM (21 years ago)
Author:
bird
Message:

Respect the WNOHANG flag.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/emx/src/lib/sys/__waitpid.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r872 r873  
    1 /* sys/waitpid.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
     1/* sys/waitpid.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes
     2                           -- Copyright (c) 2003 by Knut St. Osmundsen */
    23
    34#include "libc-alias.h"
    45#define INCL_DOSPROCESS
     6#define INCL_ERRORS
    57#define INCL_FSMACROS
    68#include <os2emx.h>
     9#include <sys/wait.h>
    710#include <emx/syscalls.h>
    811#include "syscalls.h"
     
    1013int __waitpid (int pid, int *status, int options)
    1114{
    12   ULONG rc;
    13   RESULTCODES res;
    14   PID pid2;
    15   FS_VAR();
     15    ULONG rc;
     16    RESULTCODES res;
     17    PID pid2;
     18    FS_VAR();
    1619
    17   if (pid == -1)
    18     pid = 0;
    19   FS_SAVE_LOAD();
    20   rc = DosWaitChild (DCWA_PROCESS, DCWW_WAIT, &res, &pid2, pid);
    21   FS_RESTORE();
    22   if (rc != 0)
     20    if (pid == -1)
     21        pid = 0;
     22    FS_SAVE_LOAD();
     23    rc = DosWaitChild(DCWA_PROCESS,
     24                      options & WNOHANG ? DCWW_NOWAIT : DCWW_WAIT,
     25                      &res, &pid2, pid);
     26    FS_RESTORE();
     27    if (    rc == ERROR_CHILD_NOT_COMPLETE
     28        &&  (options & WNOHANG))
     29        return 0;
     30    if (rc != 0)
    2331    {
    24       _sys_set_errno (rc);
    25       return -1;
     32        _sys_set_errno(rc);
     33        return -1;
    2634    }
    27   *status = res.codeResult << 8;
    28   return pid2;
     35    *status = res.codeResult << 8;
     36    return pid2;
    2937}
Note: See TracChangeset for help on using the changeset viewer.