Changeset 1630


Ignore:
Timestamp:
Nov 14, 2004, 12:28:29 PM (21 years ago)
Author:
bird
Message:

More signals and waiting stuff.

Location:
trunk/src/emx
Files:
6 added
3 deleted
45 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/InnoTekLIBC/sharedpm.h

    • Property cvs2svn:cvs-rev changed from 1.16 to 1.17
    r1629 r1630  
    9999    /** Structure size. */
    100100    unsigned                        cb;
    101     /** Process ID. */
     101    /** Process Id. */
    102102    pid_t                           pid;
     103    /** Process Group Id. */
     104    pid_t                           pgrp;
    103105    /** Exit code. */
    104106    int                             iExitCode;
     
    542544    unsigned                            cSigMaxActive;
    543545    /** 112 - Notification event semaphore.
    544      * This semaphore is signaled when an event occurs.
     546     * This semaphore is signaled when an event occurs. An event is either a signal
     547     * or a child notification.
     548     * At the moment this isn't used by anyone, but it's being signaled just in case.
    545549     */
    546550    unsigned long                       hevNotify;
  • trunk/src/emx/include/sys/signal.h

    • Property cvs2svn:cvs-rev changed from 1.9 to 1.10
    r1629 r1630  
    160160/** Don't mask the signal which is being delivered. */
    161161#define SA_NODEFER          0x00000010
    162 /** Don't keep zombies around for wait*(). Not implmented on OS/2. */
     162/** Don't keep zombies around for wait*(). */
    163163#define SA_NOCLDWAIT        0x00000020
    164164/** Signal the handler with the full set of arguments. */
     
    407407    /** Signal code. (See SI_* and FPE_* macros.) */
    408408    int             si_code;
    409     /** Timestamp when the signal was generated - LIBC extension. */
     409    /** LIBC Extension: Timestamp when the signal was generated. */
    410410    unsigned        si_timestamp;
    411     /** Flags - LIBC extension. __LIBC_SI_* */
     411    /** LIBC Extension: Flags. __LIBC_SI_* */
    412412    unsigned        si_flags;
    413413    /** Process sending the signal. */
    414414    __pid_t         si_pid;
    415     /** Thread sending the signal - LIBC extension. */
     415    /** LIBC Extension: the program group of the sender. */
     416    unsigned        si_pgrp;
     417    /** LIBC Extension: Thread sending the signal. */
    416418    unsigned        si_tid;
    417     /** User sending the signal (ruid). (Usually 0 for OS/2) */
     419    /** User sending the signal (real uid). */
    418420    __uid_t         si_uid;
    419421    /** Exit value. (SIGCHLD) */
     
    428430    int             si_fd;
    429431    /** Reserve a little bit for future usage. */
    430     unsigned        auReserved[3];
     432    unsigned        auReserved[6];
    431433} siginfo_t;
    432434
     
    435437 * @{ */
    436438/** If set the signal was queue. */
    437 #define __LIBC_SI_QUEUED        0x00000001
     439#define __LIBC_SI_QUEUED            0x00000001
    438440/** Internal signal generated by LIBC. */
    439 #define __LIBC_SI_INTERNAL      0x00000002
     441#define __LIBC_SI_INTERNAL          0x00000002
     442/** Don't notify the child wait facilities. (Signal origins there.) */
     443#define __LIBC_SI_NO_NOTIFY_CHILD   0x00000004
    440444/** @} */
    441445#endif
  • trunk/src/emx/include/sys/wait.h

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1629 r1630  
    103103pid_t   wait(int *);
    104104pid_t   waitpid(pid_t, int *, int);
    105 #if 0 /* bird: old __BSD_VISIBLE */
    106105struct rusage;
    107106pid_t   wait3(int *, int, struct rusage *);
    108107pid_t   wait4(pid_t, int *, int, struct rusage *);
    109 #endif
    110108
    111109
     
    118116/** Wait for processes that have exited. */
    119117#define WEXITED         8
    120 /** Wait for processes that have stopped. */
    121 #define WSTOPPED       16
    122 /** Keep the wait state around for later wait calls, i.e. just peek at the stuff. */
    123 #define WNOWAIT        32
     118/** Wait for processes that have stopped. Same as WUNTRACED atm. */
     119#define WSTOPPED       WUNTRACED
     120/** Keep the wait state around for later wait calls, i.e. just peek at the stuff.
     121 * Very logical name, not chance at all that anyone will confuse it for WNOHANG. */
     122#define WNOWAIT        16
    124123
    125124/* The following values are used by the `waitid' function.  */
  • trunk/src/emx/src/lib/libc.def

    • Property cvs2svn:cvs-rev changed from 1.77 to 1.78
    r1629 r1630  
    12641264    "__std_setruid" @1286
    12651265    "__std_waitid" @1287
     1266    "__std_wait3" @1288
     1267    "__std_wait4" @1289
  • trunk/src/emx/src/lib/process/wait.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1629 r1630  
    1 /* wait.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
     1/* $Id: waitid.c,v 1.1 2004/11/08 09:57:37 bird Exp $ */
     2/** @file
     3 *
     4 * LIBC - wait().
     5 *
     6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>
     7 *
     8 *
     9 * This file is part of InnoTek LIBC.
     10 *
     11 * InnoTek LIBC is free software; you can redistribute it and/or modify
     12 * it under the terms of the GNU Lesser General Public License as published
     13 * by the Free Software Foundation; either version 2 of the License, or
     14 * (at your option) any later version.
     15 *
     16 * InnoTek LIBC is distributed in the hope that it will be useful,
     17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19 * GNU Lesser General Public License for more details.
     20 *
     21 * You should have received a copy of the GNU Lesser General Public License
     22 * along with InnoTek LIBC; if not, write to the Free Software
     23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     24 *
     25 */
    226
     27
     28/*******************************************************************************
     29*   Header Files                                                               *
     30*******************************************************************************/
    331#include "libc-alias.h"
    4 #include <stdlib.h>
    5 #include <process.h>
     32#include <sys/wait.h>
    633#include <errno.h>
    7 #include <emx/syscalls.h>
     34#include <InnoTekLIBC/backend.h>
    835#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
    936#include <InnoTekLIBC/logstrict.h>
    1037
    11 int _STD(wait)(int *status)
     38
     39/**
     40 * Waits/polls for a child process to change it's running status.
     41 *
     42 * @returns Process id of the child.
     43 * @returns -1 and errno on failure.
     44 * @param   piStatus    Where to return the status.
     45 */
     46pid_t _STD(wait)(int *piStatus)
    1247{
    13     LIBCLOG_ENTER("status=%p\n", status);
    14     int dummy;
    15     int rc;
    16 
    17     if (status == NULL)
    18         status = &dummy;
    19     rc = __wait(status);
    20     LIBCLOG_RETURN_MSG(rc,"ret %d (%#x). *status=%#x\n", rc, rc, *status);
     48    LIBCLOG_ENTER("piStatus=%p\n", (void *)piStatus);
     49    /*
     50     * Just pass it along to waitpid.
     51     */
     52    pid_t pid = waitpid(-1, piStatus, 0);
     53    if (pid > 0)
     54        LIBCLOG_RETURN_MSG(pid, "ret %d (%#x) iStatus=%#x\n", pid, pid, piStatus ? *piStatus : -1);
     55    LIBCLOG_RETURN_INT(pid);
    2156}
  • trunk/src/emx/src/lib/process/waitpid.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1629 r1630  
    1 /* waitpid.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
     1/* $Id: waitid.c,v 1.1 2004/11/08 09:57:37 bird Exp $ */
     2/** @file
     3 *
     4 * LIBC - waitpid().
     5 *
     6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>
     7 *
     8 *
     9 * This file is part of InnoTek LIBC.
     10 *
     11 * InnoTek LIBC is free software; you can redistribute it and/or modify
     12 * it under the terms of the GNU Lesser General Public License as published
     13 * by the Free Software Foundation; either version 2 of the License, or
     14 * (at your option) any later version.
     15 *
     16 * InnoTek LIBC is distributed in the hope that it will be useful,
     17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19 * GNU Lesser General Public License for more details.
     20 *
     21 * You should have received a copy of the GNU Lesser General Public License
     22 * along with InnoTek LIBC; if not, write to the Free Software
     23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     24 *
     25 */
    226
    327
     28/*******************************************************************************
     29*   Header Files                                                               *
     30*******************************************************************************/
    431#include "libc-alias.h"
    5 #include <stdlib.h>
    6 #include <process.h>
     32#include <sys/wait.h>
    733#include <errno.h>
    8 #include <emx/syscalls.h>
     34#include <InnoTekLIBC/backend.h>
    935#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
    1036#include <InnoTekLIBC/logstrict.h>
    1137
    12 int _STD(waitpid)(int pid, int *status, int options)
     38
     39/**
     40 * Waits/polls for a child process in a specified set of processes to change
     41 * it's running status.
     42 *
     43 * @returns Process id of the child.
     44 * @returns -1 and errno on failure.
     45 * @param   pid         Pid to wait for.
     46 *                      If -1, then any child process.
     47 *                      If > 0, then wait for process with that id.
     48 *                      If 0, then wait for any child process who is in the same process group id.
     49 *                      If < -1, then wait any child process whose process group is -pid.
     50 * @param   piStatus    Where to return the status.
     51 * @param   fOptions    Same as waitid() in our implementation.
     52 */
     53pid_t _STD(waitpid)(pid_t pid, int *piStatus, int fOptions)
    1354{
    14     LIBCLOG_ENTER("pid=%d status=%p options=%#x\n", pid, status, options);
    15     int dummy;
    16     int rc;
     55    LIBCLOG_ENTER("pid=%#x (%d) piStatus=%p fOptions=%#x\n", pid, pid, (void *)piStatus, fOptions);
    1756
    18     if (status == NULL)
    19         status = &dummy;
    20     rc = __waitpid(pid, status, options);
    21     LIBCLOG_RETURN_MSG(rc,"ret %d (%#x). *status=%#x\n", rc, rc, *status);
     57    /*
     58     * Call waitid to do the actual waiting.
     59     */
     60    /* convert pid to enmIdType and Id. */
     61    id_t     Id;
     62    idtype_t enmIdType;
     63    if (pid > 0)
     64    {
     65        enmIdType = P_PID;
     66        Id = pid;
     67    }
     68    else if (pid == 0)
     69    {
     70        enmIdType = P_PGID;
     71        Id = 0;
     72    }
     73    else if (pid == -1)
     74    {
     75        enmIdType = P_ALL;
     76        Id = 0;
     77    }
     78    else
     79    {
     80        Id = -pid;
     81        enmIdType = P_PGID;
     82    }
     83
     84    /* do the call */
     85    siginfo_t SigInfo = {0};
     86    int rc = waitid(P_ALL, 0, &SigInfo, WEXITED);
     87    if (!rc)
     88    {
     89        /*
     90         * Convert signal info to status code.
     91         */
     92        int iStatus;
     93        switch (SigInfo.si_code)
     94        {
     95            default:
     96                LIBC_ASSERTM_FAILED("Invalid si_code=%d\n", SigInfo.si_code);
     97            case CLD_EXITED:    iStatus = W_EXITCODE(SigInfo.si_status, 0); break;
     98            case CLD_KILLED:    iStatus = W_EXITCODE(0, SigInfo.si_status); break;
     99            case CLD_DUMPED:    iStatus = W_EXITCODE(0, SigInfo.si_status) | WCOREFLAG; break;
     100            case CLD_TRAPPED:   iStatus = W_STOPCODE(SigInfo.si_status); break;
     101            case CLD_STOPPED:   iStatus = W_STOPCODE(SigInfo.si_status); break;
     102            case CLD_CONTINUED: iStatus = W_STOPCODE(SigInfo.si_status); break;
     103
     104        }
     105        if (piStatus)
     106            *piStatus = iStatus;
     107        LIBCLOG_RETURN_MSG(SigInfo.si_pid, "ret %d (%#x) iStatus=%#x\n",
     108                           SigInfo.si_pid, SigInfo.si_pid, iStatus);
     109    }
     110    errno = -rc;
     111    LIBCLOG_RETURN_INT(-1);
    22112}
     113
  • trunk/src/emx/src/lib/sys/__fcntl.c

    • Property cvs2svn:cvs-rev changed from 1.11 to 1.12
    r1629 r1630  
    1111#define INCL_FSMACROS
    1212#include <os2emx.h>
    13 #include "fs.h"
     13#include "b_fs.h"
    1414#include <386/builtin.h>
    1515#include <emx/io.h>
  • trunk/src/emx/src/lib/sys/__init.c

    • Property cvs2svn:cvs-rev changed from 1.18 to 1.19
    r1629 r1630  
    3131#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_INITTERM
    3232#include <InnoTekLIBC/logstrict.h>
    33 #include "signals.h"
     33#include "b_signal.h"
    3434
    3535
  • trunk/src/emx/src/lib/sys/__initdll.c

    • Property cvs2svn:cvs-rev changed from 1.18 to 1.19
    r1629 r1630  
    3434#include <InnoTekLIBC/fork.h>
    3535#include "syscalls.h"
    36 #include "fs.h"
    37 #include "signals.h"
     36#include "b_fs.h"
     37#include "b_signal.h"
    3838#include <InnoTekLIBC/thread.h>
    3939#include <InnoTekLIBC/libc.h>
  • trunk/src/emx/src/lib/sys/__spawnve.c

    • Property cvs2svn:cvs-rev changed from 1.11 to 1.12
    r1629 r1630  
    1212#define INCL_FSMACROS
    1313#include <os2emx.h>
    14 #include "fs.h"
     14#include "b_fs.h"
     15#include "b_signal.h"
     16#include "b_process.h"
    1517#include <emx/syscalls.h>
    1618#include <InnoTekLIBC/sharedpm.h>
     
    4648        {
    4749            /*
    48              * Allocate shared memory.
     50             * Get Signal stuff
    4951             */
    50             size_t  cb = sizeof(__LIBC_SPMINHERIT) + ((cbFH + 3) & ~3) + ((cbFS + 3) & ~3);
    51             pRet = __libc_spmAlloc(cb);
    52             if (pRet)
     52            size_t              cbSig;
     53            __LIBC_PSPMINHSIG   pSig;
     54            if (!__libc_back_signalInheritPack(&pSig, &cbSig))
    5355            {
    54                 pRet->cb = sizeof(*pRet);
    55                 pRet->pFHBundles = (__LIBC_PSPMINHFHBHDR)(pRet + 1);
    56                 memcpy(pRet->pFHBundles, pFH, cbFH);
    57                 if (pFS)
     56                /*
     57                 * Allocate shared memory.
     58                 */
     59                size_t  cb = sizeof(__LIBC_SPMINHERIT) + ((cbFH + 3) & ~3) + ((cbFS + 3) & ~3) + ((cbSig + 3) & ~3);
     60                pRet = __libc_spmAlloc(cb);
     61                if (pRet)
    5862                {
    59                     pRet->pFS = (__LIBC_PSPMINHFS)((char *)pRet->pFHBundles + ((cbFH + 3) & ~3));
    60                     memcpy(pRet->pFS, pFS, cbFS);
    61                     free(pFS);
     63                    /* fh */
     64                    pRet->cb = sizeof(*pRet);
     65                    pRet->pFHBundles = (__LIBC_PSPMINHFHBHDR)(pRet + 1);
     66                    memcpy(pRet->pFHBundles, pFH, cbFH);
     67                    free(pFH);
     68
     69                    /* fs */
     70                    if (pFS)
     71                    {
     72                        pRet->pFS = (__LIBC_PSPMINHFS)((char *)pRet->pFHBundles + ((cbFH + 3) & ~3));
     73                        memcpy(pRet->pFS, pFS, cbFS);
     74                        free(pFS);
     75                    }
     76                    else
     77                        pRet->pFS = NULL;
     78
     79                    /* sig */
     80                    if (pSig)
     81                    {
     82                        pRet->pSig = (__LIBC_PSPMINHSIG)((char *)pRet->pFHBundles + ((cbFH + 3) & ~3) + ((cbFS + 3) & ~3));
     83                        memcpy(pRet->pSig, pSig, cbSig);
     84                        free(pFS);
     85                    }
     86
     87                    /* done! */
     88                    LIBCLOG_RETURN_P(pRet);
    6289                }
    63                 else
    64                     pRet->pFS = NULL;
    65                 free(pFH);
    66                 LIBCLOG_RETURN_P(pRet);
     90                free(pSig);
    6791            }
    6892            free(pFS);
     
    249273            char        szObj[40];
    250274            int         rc;
     275
     276            /*
     277             * Notify the process waiter system.
     278             */
     279            __libc_back_processWaitNotifyExec();
    251280
    252281            /*
  • trunk/src/emx/src/lib/sys/b_fsDirChangeRoot.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3030*******************************************************************************/
    3131#include "libc-alias.h"
    32 #include "fs.h"
     32#include "b_fs.h"
    3333#include <string.h>
    3434#include <InnoTekLIBC/backend.h>
  • trunk/src/emx/src/lib/sys/b_fsDirCreate.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1629 r1630  
    3434#define INCL_ERRORS
    3535#include <os2emx.h>
    36 #include "fs.h"
     36#include "b_fs.h"
    3737#include "syscalls.h"
    3838#include <errno.h>
  • trunk/src/emx/src/lib/sys/b_fsDirCurrentGet.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3232#define INCL_FSMACROS
    3333#include <os2emx.h>
    34 #include "fs.h"
     34#include "b_fs.h"
    3535#include <string.h>
    3636#include <errno.h>
  • trunk/src/emx/src/lib/sys/b_fsDirCurrentSet.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3232#define INCL_FSMACROS
    3333#include <os2emx.h>
    34 #include "fs.h"
     34#include "b_fs.h"
    3535#include <InnoTekLIBC/backend.h>
    3636#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
  • trunk/src/emx/src/lib/sys/b_fsDirRemove.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3333#define INCL_ERRORS
    3434#include <os2emx.h>
    35 #include "fs.h"
     35#include "b_fs.h"
    3636#include <errno.h>
    3737#include <InnoTekLIBC/backend.h>
  • trunk/src/emx/src/lib/sys/b_fsDriveDefaultGet.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3232#define INCL_FSMACROS
    3333#include <os2emx.h>
    34 #include "fs.h"
     34#include "b_fs.h"
    3535#include <InnoTekLIBC/backend.h>
    3636#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
  • trunk/src/emx/src/lib/sys/b_fsDriveDefaultSet.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3232#define INCL_FSMACROS
    3333#include <os2emx.h>
    34 #include "fs.h"
     34#include "b_fs.h"
    3535#include <InnoTekLIBC/backend.h>
    3636#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
  • trunk/src/emx/src/lib/sys/b_fsFileStat.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #include "fs.h"
     31#include "b_fs.h"
    3232#include <sys/stat.h>
    3333#include <InnoTekLIBC/backend.h>
  • trunk/src/emx/src/lib/sys/b_fsFileStatFH.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1629 r1630  
    3232#define INCL_FSMACROS
    3333#include <os2emx.h>
    34 #include "fs.h"
     34#include "b_fs.h"
    3535#include <string.h>
    3636#include <errno.h>
  • trunk/src/emx/src/lib/sys/b_fsNativeFileStat.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1629 r1630  
    3333#define INCL_FSMACROS
    3434#include <os2emx.h>
    35 #include "fs.h"
     35#include "b_fs.h"
    3636#include <string.h>
    3737#include <errno.h>
  • trunk/src/emx/src/lib/sys/b_fsPathResolve.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1629 r1630  
    3333#define INCL_BASE
    3434#include <os2emx.h>
    35 #include "fs.h"
     35#include "b_fs.h"
    3636#include <errno.h>
    3737#include <string.h>
  • trunk/src/emx/src/lib/sys/b_fsStat.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1629 r1630  
    3030*******************************************************************************/
    3131#include "libc-alias.h"
    32 #include "fs.h"
     32#include "b_fs.h"
    3333#include <stdlib.h>
    3434#include <string.h>
  • trunk/src/emx/src/lib/sys/b_fsSymlinkCreate.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3030*   Header Files                                                               *
    3131*******************************************************************************/
    32 #include "fs.h"
     32#include "b_fs.h"
    3333#include <string.h>
    3434#include <errno.h>
  • trunk/src/emx/src/lib/sys/b_fsSymlinkRead.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3030*   Header Files                                                               *
    3131*******************************************************************************/
    32 #include "fs.h"
     32#include "b_fs.h"
    3333#include <string.h>
    3434#include <errno.h>
  • trunk/src/emx/src/lib/sys/b_fsSymlinkStat.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #include "fs.h"
     31#include "b_fs.h"
    3232#include <sys/stat.h>
    3333#include <InnoTekLIBC/backend.h>
  • trunk/src/emx/src/lib/sys/b_ioFileOpen.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1629 r1630  
    3434#define INCL_FSMACROS
    3535#include <os2emx.h>
    36 #include "fs.h"
     36#include "b_fs.h"
    3737#include <string.h>
    3838#include <errno.h>
  • trunk/src/emx/src/lib/sys/b_ioFileSizeSet.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1629 r1630  
    3333#define INCL_ERRORS
    3434#include <os2emx.h>
    35 #include "fs.h"
     35#include "b_fs.h"
    3636#include <limits.h>
    3737#include <errno.h>
  • trunk/src/emx/src/lib/sys/b_ioSeek.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3232#define INCL_FSMACROS
    3333#include <os2emx.h>
    34 #include "fs.h"
     34#include "b_fs.h"
    3535#include <limits.h>
    3636#include <errno.h>
  • trunk/src/emx/src/lib/sys/b_mmanProtect.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3333#define INCL_BASE
    3434#include <os2emx.h>
    35 #include "mman.h"
     35#include "b_mman.h"
    3636#include <string.h>
    3737#include <errno.h>
  • trunk/src/emx/src/lib/sys/b_processWait.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1629 r1630  
    4141#include <sys/fmutex.h>
    4242#include "backend.h"
     43#include "b_process.h"
    4344#include <emx/startup.h>
    4445#include <emx/umalloc.h>
     
    4748#include <InnoTekLIBC/sharedpm.h>
    4849#include <InnoTekLIBC/backend.h>
    49 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL
     50#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_PROCESS
    5051#include <InnoTekLIBC/logstrict.h>
    5152
     
    6869    /** Pointer to the previous node in the list. */
    6970    volatile PWAITINFO pPrev;
     71    /** Child process id. */
     72    pid_t       pid;
    7073    /** Child process group. */
    71     pid_t       pid;
    72     /** Process group. (not implemented yet) */
    73     pid_t       pgid;
     74    pid_t       pgrp;
    7475    /** Code (si_code for SIGCHLD). */
    7576    int         uCode;
     
    105106 * This is something which the signal subsystem controls, it
    106107 * will notify us when this state changes. */
    107 static volatile int         gfNoWaitStatus;
     108static volatile unsigned    gfNoWaitStatus;
    108109
    109110/** The event semaphore the callers are sleeping on. */
     
    122123static int  waitChild(PWAITINFO pWait, int fNoWait, pid_t pidWait);
    123124static int  waitAllocInsert(const PWAITINFO pWaitInsert);
    124 
    125 /* move us */
    126 void __libc_back_processWaitNotifyTerm(void);
    127 void __libc_back_processWaitNotifyExec(void);
    128 void __libc_back_processWaitNotifyChild(siginfo_t *pSigInfo, pid_t pgid);
     125static inline void waitInfoToSigInfo(const PWAITINFO pWait, siginfo_t *pSigInfo);
    129126
    130127
     
    344341        case TC_EXIT:
    345342            pWait->uCode    = CLD_EXITED;
    346             pWait->uStatus  = W_EXITCODE(resc.codeResult, 0);
     343            pWait->uStatus  = resc.codeResult;
    347344            break;
    348345
    349346        case TC_HARDERROR:
    350347            pWait->uCode    = CLD_KILLED;
    351             pWait->uStatus  = W_EXITCODE(resc.codeResult, SIGBUS);
     348            pWait->uStatus  = SIGBUS;
    352349            break;
    353350
     
    355352        case TC_EXCEPTION:
    356353            pWait->uCode    = CLD_DUMPED;
    357             pWait->uStatus  = W_EXITCODE(resc.codeResult, SIGSEGV);
     354            pWait->uStatus  = SIGSEGV;
    358355            break;
    359356
    360357        case TC_KILLPROCESS:
    361358            pWait->uCode    = CLD_KILLED;
    362             pWait->uStatus  = W_EXITCODE(resc.codeResult, SIGKILL);
     359            pWait->uStatus  = SIGKILL;
    363360            break;
    364361
    365362        default:
    366363            pWait->uCode    = CLD_KILLED;
    367             pWait->uStatus  = W_EXITCODE(resc.codeResult, SIGSEGV);
     364            pWait->uStatus  = SIGSEGV;
    368365            break;
    369366    }
     
    382379        LIBCLOG_MSG2("SPM Child %#lx (%ld) for reason %d and with code %d (%#x).\n",
    383380                     pid, pid, Notify.enmDeathReason, Notify.iExitCode, Notify.iExitCode);
     381        pWait->pgrp = Notify.pgrp;
    384382
    385383        switch (Notify.enmDeathReason)
     
    387385            case __LIBC_EXIT_REASON_EXIT:
    388386                pWait->uCode    = CLD_EXITED;
    389                 pWait->uStatus  = W_EXITCODE(Notify.iExitCode, 0);
     387                pWait->uStatus  = Notify.iExitCode;
    390388                break;
    391389
    392390            case __LIBC_EXIT_REASON_HARDERROR:
    393391                pWait->uCode    = CLD_KILLED;
    394                 pWait->uStatus  = W_EXITCODE(Notify.iExitCode, SIGBUS);
     392                pWait->uStatus  = SIGBUS;
    395393                break;
    396394
     
    398396            case __LIBC_EXIT_REASON_XCPT:
    399397                pWait->uCode    = CLD_DUMPED;
    400                 pWait->uStatus  = W_EXITCODE(Notify.iExitCode, SIGSEGV);
     398                pWait->uStatus  = SIGSEGV;
    401399                break;
    402400
    403401            case __LIBC_EXIT_REASON_KILL:
    404402                pWait->uCode    = CLD_KILLED;
    405                 pWait->uStatus  = W_EXITCODE(Notify.iExitCode, SIGKILL);
     403                pWait->uStatus  = SIGKILL;
    406404                break;
    407405
     
    411409                {
    412410                    pWait->uCode    = CLD_KILLED;
    413                     pWait->uStatus  = W_EXITCODE(Notify.iExitCode, Notify.enmDeathReason - __LIBC_EXIT_REASON_SIGNAL_BASE);
     411                    pWait->uStatus  = Notify.enmDeathReason - __LIBC_EXIT_REASON_SIGNAL_BASE;
    414412                    break;
    415413                }
     
    421419    }
    422420
     421    /*
     422     * Raise signal.
     423     */
     424    siginfo_t SigInfo = {0};
     425    waitInfoToSigInfo(pWait, &SigInfo);
     426    SigInfo.si_flags = __LIBC_SI_QUEUED | __LIBC_SI_INTERNAL | __LIBC_SI_NO_NOTIFY_CHILD;
     427    rc = __libc_Back_signalRaise(SIGCHLD, &SigInfo, NULL, __LIBC_BSRF_QUEUED | __LIBC_BSRF_EXTERNAL);
     428    LIBC_ASSERTM(rc >= 0, "failed raising SIGCHLD. rc=%d\n", rc);
     429
    423430    return 0;
    424431}
     
    507514
    508515/**
     516 * Informs the wait facilities that a SIGCHLD signal action change have
     517 * action have modified the properties of the wait*() calls.
     518 *
     519 * If SIGCHLD action is either set to SIG_IGN or have the SA_NOCLDWAIT flag set
     520 * zombies will no longer be kept around. What happens for normal child exits are
     521 * simply that the wait selection get's empty and ECHILD is the correct reply.
     522 * In the case of stopped and continued children is a bit of a mystery. ECHILD
     523 * isn't the right one I think, it's also damn difficult to emulate. So, for now
     524 * those situations will not be handled properly and may cause deadlocks.
     525 *
     526 * @param   fNoWaitStatus       New child wait mode.
     527 */
     528void __libc_back_processWaitNotifyNoWait(int fNoWaitStatus)
     529{
     530    __atomic_xchg(&gfNoWaitStatus, fNoWaitStatus);
     531}
     532
     533/**
    509534 * Notify the process wait facilities that a child
    510535 * process have posted a SIGCHLD signal to the parent.
    511  */
    512 void __libc_back_processWaitNotifyChild(siginfo_t *pSigInfo, pid_t pgid)
    513 {
    514     LIBCLOG_ENTER("pSigInfo=%p{si_code=%d si_status=%d si_pid=%d} pgid=%d\n", (void *)pSigInfo,
    515                   pSigInfo->si_code, pSigInfo->si_status, pSigInfo->si_pid, pgid);
     536 *
     537 * @param   pSigInfo    The signal info of the SIGCHLD signal.
     538 */
     539void __libc_back_processWaitNotifyChild(siginfo_t *pSigInfo)
     540{
     541    LIBCLOG_ENTER("pSigInfo=%p{si_code=%d si_status=%d si_pid=%#x si_pgrp=%#x}\n", (void *)pSigInfo,
     542                  pSigInfo->si_code, pSigInfo->si_status, pSigInfo->si_pid, pSigInfo->si_pgrp);
    516543
    517544    int rc = waitSemRequest(1);
    518     if (rc)
     545    if (!rc)
    519546    {
    520547        /*
     
    536563            /* fill node */
    537564            pWait->pid          = pSigInfo->si_pid;
    538             pWait->pgid         = pgid;
     565            pWait->pgrp         = pSigInfo->si_pgrp;
    539566            pWait->uCode        = pSigInfo->si_code;
    540567            pWait->uStatus      = pSigInfo->si_status;
     
    564591    pSigInfo->si_signo      = SIGCHLD;
    565592    pSigInfo->si_pid        = pWait->pid;
     593    pSigInfo->si_pgrp       = pWait->pgrp;
    566594    pSigInfo->si_code       = pWait->uCode;
    567595    pSigInfo->si_status     = pWait->uStatus;
    568596    pSigInfo->si_timestamp  = pWait->uTimestamp;
    569597    pSigInfo->si_uid        = pWait->uid;
     598    pSigInfo->si_flags      = __LIBC_SI_NO_NOTIFY_CHILD;
    570599}
    571600
     
    590619
    591620    /*
     621     * Make sure there is a worker around.
     622     */
     623    if (!gtidThread)
     624        __libc_back_processWaitNotifyExec();
     625
     626    /*
    592627     * Validate options.
    593628     */
     
    607642        LIBC_ASSERTM_FAILED("pSigInfo is NULL.\n");
    608643        LIBCLOG_RETURN_INT(-EINVAL);
     644    }
     645    switch (enmIdType)
     646    {
     647        case P_ALL:
     648        case P_PID:
     649        case P_PGID:
     650            break;
     651        default:
     652            LIBC_ASSERTM_FAILED("Invalid id type %d\n", enmIdType);
     653            LIBCLOG_RETURN_INT(-EINVAL);
    609654    }
    610655
     
    651696                    fFlag = WEXITED;
    652697                    break;
     698                #if 0 /* not implemented! */
    653699                case CLD_TRAPPED:
    654                     fFlag = WUNTRACED; /* ?? - not implemented anyway. */
    655700                    break;
     701                #endif
    656702                case CLD_STOPPED:
    657                     fFlag = WSTOPPED;
     703                    fFlag = WSTOPPED | WUNTRACED;
    658704                    break;
    659705                case CLD_CONTINUED:
     
    668714                if (enmIdType == P_ALL)
    669715                    break;
    670                 if (    enmIdType == P_PID
    671                     &&  pInfo->pid == (pid_t)Id)
     716                if (    (enmIdType == P_PID  && pInfo->pid  == (pid_t)Id)
     717                    ||  (enmIdType == P_PGID && pInfo->pgrp == (pid_t)Id))
    672718                    break;
    673719            }
     
    715761         * Verify the wait id (again).
    716762         */
     763        waitSemRelease();
    717764        if (    enmIdType == P_ALL
    718765            ||  enmIdType == P_PID)
     
    738785            }
    739786        }
    740         else if (enmIdType == P_PGID)
    741         {
    742             LIBC_ASSERTM_FAILED("Process groups are not implemented yet\n");
    743             LIBCLOG_RETURN_INT(-ENOSYS);
    744         }
    745787        else
    746788        {
    747             LIBC_ASSERTM_FAILED("Invalid enmIdType=%d!\n", enmIdType);
    748             LIBCLOG_RETURN_INT(-EINVAL);
     789            rc = __libc_Back_signalSendPGrp((pid_t)Id, 0);
     790            if (rc)
     791                LIBCLOG_RETURN_INT(rc);
    749792        }
    750793
  • trunk/src/emx/src/lib/sys/b_signalInterrupt.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3535#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SIGNAL
    3636#include <InnoTekLIBC/logstrict.h>
    37 #include "signals.h"
     37#include "b_signal.h"
    3838
    3939
  • trunk/src/emx/src/lib/sys/b_signalMask.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1629 r1630  
    4141#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SIGNAL
    4242#include <InnoTekLIBC/logstrict.h>
    43 #include "signals.h"
     43#include "b_signal.h"
    4444
    4545
  • trunk/src/emx/src/lib/sys/b_signalPending.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1629 r1630  
    3636#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SIGNAL
    3737#include <InnoTekLIBC/logstrict.h>
    38 #include "signals.h"
     38#include "b_signal.h"
    3939
    4040
  • trunk/src/emx/src/lib/sys/b_signalQueue.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1629 r1630  
    3535#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SIGNAL
    3636#include <InnoTekLIBC/logstrict.h>
    37 #include "signals.h"
     37#include "b_signal.h"
    3838#include "syscalls.h"
    3939
     
    6666     */
    6767    siginfo_t   SigInfo = {0};
     68    SigInfo.si_signo    = iSignalNo;
     69    SigInfo.si_code     = SI_QUEUE;
    6870    SigInfo.si_flags   |= __LIBC_SI_QUEUED;
    6971    SigInfo.si_value    = SigVal;
    70     SigInfo.si_signo    = iSignalNo;
    7172    int rc;
    7273    if (pid == _sys_pid)
  • trunk/src/emx/src/lib/sys/b_signalSendPid.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1629 r1630  
    4040#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SIGNAL
    4141#include <InnoTekLIBC/logstrict.h>
    42 #include "signals.h"
     42#include "b_signal.h"
    4343#include "syscalls.h"
    4444
  • trunk/src/emx/src/lib/sys/b_signalStack.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1629 r1630  
    3636#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SIGNAL
    3737#include <InnoTekLIBC/logstrict.h>
    38 #include "signals.h"
     38#include "b_signal.h"
    3939
    4040/**
  • trunk/src/emx/src/lib/sys/b_signalSuspend.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1629 r1630  
    3636#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SIGNAL
    3737#include <InnoTekLIBC/logstrict.h>
    38 #include "signals.h"
     38#include "b_signal.h"
    3939
    4040
  • trunk/src/emx/src/lib/sys/b_signalWait.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1629 r1630  
    3737#include <errno.h>
    3838#include <386/builtin.h>
    39 #include "signals.h"
     39#include "b_signal.h"
    4040#include <InnoTekLIBC/thread.h>
    4141#include <InnoTekLIBC/backend.h>
  • trunk/src/emx/src/lib/sys/b_threadInit.c

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r1629 r1630  
    3333#include <emx/syscalls.h>
    3434#include "syscalls.h"
    35 #include "signals.h"
     35#include "b_signal.h"
    3636#include <InnoTekLIBC/thread.h>
    3737#include <InnoTekLIBC/backend.h>
  • trunk/src/emx/src/lib/sys/exceptions.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1629 r1630  
    4141#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL
    4242#include <InnoTekLIBC/logstrict.h>
    43 #include "signals.h"
     43#include "b_signal.h"
    4444
    4545
  • trunk/src/emx/src/lib/sys/filefind.c

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r1629 r1630  
    1010#define INCL_FSMACROS
    1111#include <os2emx.h>
    12 #include "fs.h"
     12#include "b_fs.h"
    1313#include <stdlib.h>
    1414#include <string.h>
  • trunk/src/emx/src/lib/sys/fs.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1629 r1630  
    3535#define INCL_ERRORS
    3636#include <os2emx.h>
    37 #include "fs.h"
     37#include "b_fs.h"
    3838#include <stddef.h>
    3939#include <string.h>
  • trunk/src/emx/src/lib/sys/sharedpm.c

    • Property cvs2svn:cvs-rev changed from 1.19 to 1.20
    r1629 r1630  
    525525            pTerm->iExitCode        = 0;
    526526            pTerm->pid              = -1;
     527            pTerm->pgrp             = pProcess->pgrp;
    527528            pTerm->pNext            = NULL;
    528529            pProcess->pTerm         = pTerm;
     
    15131514         * Unlink it and free it.
    15141515         */
    1515         /* statistics */
    1516         if (gpSPMSelf->pid != pSig->pidSender)
    1517         {
    1518             __LIBC_PSPMPROCESS pSender = spmQueryProcessInState(pSig->pidSender, __LIBC_PROCSTATE_ALIVE);
    1519             if (pSender)
    1520                 pSender->cSigsSent--;
    1521         }
     1516        /* statistics (free signal update sender stats) */
    15221517        gpSPMHdr->cSigActive--;
    15231518
     
    21382133                if (pParent)
    21392134                {
     2135                    pTerm->pid = pProcess->pid;
     2136                    pTerm->pgrp = pProcess->pgrp;
     2137                    pTerm->pNext = NULL;
    21402138                    *pParent->ppChildNotifyTail = pTerm;
    21412139                    pParent->ppChildNotifyTail = &pTerm->pNext;
    2142                     pTerm->pNext = NULL;
    21432140                    DosPostEventSem(gpSPMHdr->hevNotify);
    21442141                }
     
    24612458            pTerm->iExitCode        = 0;
    24622459            pTerm->pid              = pid;
     2460            pTerm->pgrp             = pProcess->pgrp;
    24632461            pTerm->pNext            = NULL;
    24642462            pProcess->pTerm         = pTerm;
     
    27342732                else
    27352733                    pSig->Info.si_flags &= ~__LIBC_SI_QUEUED;
     2734                if (!pSig->Info.si_pid)
     2735                    pSig->Info.si_pid = gpSPMSelf->pid;
     2736                if (!pSig->Info.si_pgrp)
     2737                    pSig->Info.si_pgrp = gpSPMSelf->pgrp;
     2738                if (!pSig->Info.si_uid)
     2739                    pSig->Info.si_uid = gpSPMSelf->uid;
    27362740
    27372741                /* insert (FIFO) */
     
    27502754                    gpSPMSelf->cSigsSent++;
    27512755                gpSPMHdr->cSigActive++;
     2756
     2757                /* post notification sem. */
     2758                DosPostEventSem(gpSPMHdr->hevNotify);
    27522759            }
    27532760            else
     
    28202827static void spmFreeSignal(__LIBC_PSPMSIGNAL pSig)
    28212828{
    2822     LIBCLOG_ENTER("pSig=%p\n", (void *)pSig);
     2829    LIBCLOG_ENTER("pSig=%p {.pidSender=%#x}\n", (void *)pSig, pSig->pidSender);
     2830
     2831    /*
     2832     * If it got a sender, update it's statistics.
     2833     */
     2834    if (!pSig->pidSender && gpSPMSelf->pid != pSig->pidSender)
     2835    {
     2836        __LIBC_PSPMPROCESS pSender = spmQueryProcessInState(pSig->pidSender, __LIBC_PROCSTATE_ALIVE);
     2837        if (pSender)
     2838            pSender->cSigsSent--;
     2839    }
     2840
     2841    /*
     2842     * Decide whether to put it in the queue of free signals
     2843     * or to return it to the memory pool.
     2844     */
    28232845    if (gpSPMHdr->cSigFree < 32)
    28242846    {
  • trunk/src/emx/src/lib/sys/signals.c

    • Property cvs2svn:cvs-rev changed from 1.10 to 1.11
    r1629 r1630  
    8585#include <InnoTekLIBC/logstrict.h>
    8686#include "syscalls.h"
    87 #include "signals.h"
     87#include "b_signal.h"
     88#include "b_process.h"
    8889
    8990
     
    589590        if (!rc)
    590591        {
     592            /*
     593             * Process inherited signal setup.
     594             */
     595            __LIBC_PSPMINHERIT pInherit = __libc_spmInheritRequest();
     596            if (pInherit)
     597            {
     598                if (    pInherit->pSig
     599                    &&  pInherit->pSig->cb >= sizeof(__LIBC_SPMINHSIG)
     600                    &&  !__SIGSET_ISEMPTY(&pInherit->pSig->SigSetIGN))
     601                {
     602                    /* Ignored signals. */
     603                    int iSignalNo;
     604                    for (iSignalNo = 1; iSignalNo < __SIGSET_MAXSIGNALS; iSignalNo++)
     605                        if (__SIGSET_ISSET(&pInherit->pSig->SigSetIGN, iSignalNo) && iSignalNo != SIGCHLD)
     606                            gaSignalActions[iSignalNo].__sigaction_u.__sa_handler = SIG_IGN;
     607                }
     608                __libc_spmInheritRelease();
     609            }
     610
    591611            FS_RESTORE();
    592612            LIBCLOG_RETURN_INT(0);
     
    915935int __libc_Back_signalRaise(int iSignalNo, siginfo_t *pSigInfo, void *pvXcptOrQueued, unsigned fFlags)
    916936{
    917     LIBCLOG_ENTER("iSignalNo=%d pSigInfo=%p{.si_signo=%d, .si_errno=%d, .si_code=%#x, .si_timestamp=%#x, .si_flags=%#x .si_pid=%#x, .si_tid=%#x, .si_uid=%d, .si_status=%d, .si_addr=%p, .si_value=%p, .si_band=%ld, .si_fd=%d} pvXcptOrQueued=%p fFlags=%#x\n",
     937    LIBCLOG_ENTER("iSignalNo=%d pSigInfo=%p{.si_signo=%d, .si_errno=%d, .si_code=%#x, .si_timestamp=%#x, .si_flags=%#x .si_pid=%#x, .si_pgrp=%#x, .si_tid=%#x, .si_uid=%d, .si_status=%d, .si_addr=%p, .si_value=%p, .si_band=%ld, .si_fd=%d} pvXcptOrQueued=%p fFlags=%#x\n",
    918938                  iSignalNo, (void *)pSigInfo,
    919939                  pSigInfo ? pSigInfo->si_signo : 0,
     
    923943                  pSigInfo ? pSigInfo->si_flags : 0,
    924944                  pSigInfo ? pSigInfo->si_pid : 0,
     945                  pSigInfo ? pSigInfo->si_pgrp : 0,
    925946                  pSigInfo ? pSigInfo->si_tid : 0,
    926947                  pSigInfo ? pSigInfo->si_uid : 0,
     
    13131334                                            NULL);
    13141335                    if (rc >= 0)
     1336                    {
     1337                        /*
     1338                         * Special handling of child notifications.
     1339                         */
     1340                        if (    iSignalNo == SIGCHLD
     1341                            &&  (SigInfo.si_flags & (__LIBC_SI_INTERNAL | __LIBC_SI_NO_NOTIFY_CHILD)) == __LIBC_SI_INTERNAL)
     1342                            __libc_back_processWaitNotifyChild(&SigInfo);
     1343
    13151344                        cSignals--;
     1345                    }
    13161346                    else
    13171347                    {
     
    21492179        SigInfo = *pSigInfo;
    21502180    SigInfo.si_signo        = iSignalNo;
     2181    if (pSigInfo)
     2182        SigInfo.si_code     = SI_USER;
    21512183    if (SigInfo.si_pid)
    21522184        SigInfo.si_pid      = _sys_pid;
     
    23292361    siginfo_t SigInfo = {0};
    23302362    SigInfo.si_signo        = iSignalNo;
     2363    SigInfo.si_code         = SI_USER;
    23312364    if (SigInfo.si_pid)
    23322365        SigInfo.si_pid      = _sys_pid;
     
    26352668                &&  pSigAct->__sigaction_u.__sa_handler != SIG_HOLD)
    26362669            {
     2670                /*
     2671                 * Check if it's SIGCHLD and changes the way wait*() works.
     2672                 */
     2673                if (    iSignalNo == SIGCHLD
     2674                    &&  (   (   gaSignalActions[iSignalNo].__sigaction_u.__sa_handler != pSigAct->__sigaction_u.__sa_handler
     2675                             && (   pSigAct->__sigaction_u.__sa_handler == SIG_IGN
     2676                                 ||  gaSignalActions[iSignalNo].__sigaction_u.__sa_handler == SIG_IGN))
     2677                         ||  ((gaSignalActions[iSignalNo].sa_flags & SA_NOCLDWAIT) ^ (pSigAct->sa_flags & SA_NOCLDWAIT))
     2678                         )
     2679                    )
     2680                    __libc_back_processWaitNotifyNoWait(*pSigAct->__sigaction_u.__sa_handler == SIG_IGN || (pSigAct->sa_flags & SA_NOCLDWAIT));
     2681
    26372682                /*
    26382683                 * Update the handler.
     
    29923037
    29933038
     3039/**
     3040 * Construct the inheritance packet for signals.
     3041 *
     3042 * @returns 0 on success.
     3043 * @param   ppSig       Where to store the allocated data.
     3044 * @param   pcbSig      Size of the packet.
     3045 */
     3046int         __libc_back_signalInheritPack(__LIBC_PSPMINHSIG *ppSig, size_t *pcbSig)
     3047{
     3048    /*
     3049     * Allocate a packet.
     3050     */
     3051    __LIBC_PSPMINHSIG pSig = _hmalloc(sizeof(*pSig));
     3052    if (!pSig)
     3053        return -ENOMEM;
     3054
     3055    /* acquire the sem. */
     3056    int rc = __libc_back_signalSemRequest();
     3057
     3058    /*
     3059     * Fill the packet.
     3060     */
     3061    pSig->cb = sizeof(*pSig);
     3062    __SIGSET_EMPTY(&pSig->SigSetIGN);
     3063    unsigned iSignalNo;
     3064    for (iSignalNo = 1; iSignalNo < __SIGSET_MAXSIGNALS; iSignalNo++)
     3065        if (    iSignalNo != SIGCHLD
     3066            &&  gaSignalActions[iSignalNo].__sigaction_u.__sa_handler == SIG_IGN)
     3067            __SIGSET_SET(&pSig->SigSetIGN, iSignalNo);
     3068
     3069    /*
     3070     * Return
     3071     */
     3072    if (!rc)
     3073        __libc_back_signalSemRelease();
     3074    *ppSig = pSig;
     3075    *pcbSig = sizeof(*pSig);
     3076    return 0;
     3077}
     3078
     3079
    29943080
    29953081_FORK_CHILD1(0x0000000f, signalForkChild)
  • trunk/src/emx/src/lib/sys/umask.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1629 r1630  
    2929*******************************************************************************/
    3030#include "libc-alias.h"
    31 #include "fs.h"
     31#include "b_fs.h"
    3232#include <386/builtin.h>
    3333#include <sys/stat.h>
Note: See TracChangeset for help on using the changeset viewer.