Changeset 1628


Ignore:
Timestamp:
Nov 14, 2004, 6:17:04 AM (21 years ago)
Author:
bird
Message:

Signals, processes and stuff.

Location:
trunk/src/emx/include
Files:
5 edited

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r1627 r1628  
    497497 * @param   fFlags              Flags of the #defines __LIBC_BSRF_* describing how to
    498498 *                              deliver the signal.
    499  *
    500  * @remark  This Backend Signal API does NOT require the caller to own the signal semaphore.
    501499 */
    502500int __libc_Back_signalRaise(int iSignalNo, siginfo_t *pSigInfo, void *pvXcptOrQueued, unsigned fFlags);
     
    516514 * Send a signal to a process.
    517515 *
     516 * Special case for iSignalNo equal to 0, where no signal is sent but permissions to
     517 * do so is checked.
     518 *
    518519 * @returns 0 on if signal sent.
    519520 * @returns -errno on failure.
     
    521522 * @param   pid         Process Id of the process which the signal is to be sent to.
    522523 * @param   iSignalNo   The signal to send.
    523  * @remark  This Backend Signal API does NOT require the caller to own the signal semaphore.
     524 *                      If 0 no signal is sent, but error handling is done as if.
    524525 */
    525526int __libc_Back_signalSendPid(pid_t pid, int iSignalNo);
    526527
    527528/**
    528  * Verify the existance of another process and that the current process
    529  * is allowed to signal it.
    530  *
    531  * @return 0 on success.
    532  * @return -ESRCH if pid doesn't exist.
    533  * @return -EPERM if we aren't allowed to signal the pid.
    534  * @param   pid     Process Id for the process which we wanna signal.
    535  * @todo    Do EPERM check, no ideas here yet.
    536  * @remark  This Backend Signal API does NOT require the caller to own the signal semaphore.
    537  */
    538 int __libc_Back_signalVerifyPid(pid_t pid);
    539 
    540 /**
    541  * Not implemented.
    542  *
    543  * @returns -ENOSYS.
     529 * Sends a signal to a process group.
     530 *
     531 * Special case for iSignalNo equal to 0, where no signal is sent but permissions to
     532 * do so is checked.
     533 *
     534 * @returns 0 on if signal sent.
     535 * @returns -errno on failure.
     536 *
    544537 * @param   pgrp        Process group (positive).
    545538 *                      0 means the process group of this process.
    546  *                      1 means all process in the system.
     539 *                      1 means all process in the system. (not implemented!)
    547540 * @param   iSignalNo   Signal to send to all the processes in the group.
     541 *                      If 0 no signal is sent, but error handling is done as if.
    548542 */
    549543int __libc_Back_signalSendPGrp(pid_t pgrp, int iSignalNo);
    550 
    551 /**
    552  * Verify the existance of a process group and that the current process
    553  * is allowed to signal it.
    554  *
    555  * @return 0 on success.
    556  * @return -ESRCH if pgid doesn't exist.
    557  * @return -EPERM if we aren't allowed to signal the pgid.
    558  * @param   pgid    Process group id which the current process intend to signal.
    559  * @todo    Do EPERM check, no ideas here yet.
    560  * @remark  This Backend Signal API does NOT require the caller to own the signal semaphore.
    561  */
    562 int __libc_Back_signalVerifyPGrp(pid_t pgid);
    563544
    564545/**
     
    641622/**
    642623 * Suspends the current thread till a signal have been handled.
    643  * The signal semaphore is owned.
    644  *
    645  * @returns Negative error code (errno) on failure. (allways fails)
     624 *
     625 * @returns Negative error code (errno) on failure. (always fails)
    646626 * @param   pSigSet     Temporary signal mask for the thread.
    647627 */
     
    681661int __libc_Back_processWait(idtype_t enmIdType, id_t Id, siginfo_t *pSigInfo, unsigned fOptions, struct rusage *pUsage);
    682662
     663/**
     664 * Gets the real user id of the current process.
     665 * @returns Real user id.
     666 */
     667uid_t __libc_Back_processGetUid(void);
     668
     669/**
     670 * Gets the effective user id of the current process.
     671 * @returns Effective user id.
     672 */
     673uid_t __libc_Back_processGetEffUid(void);
     674
     675/**
     676 * Sets the effective user id of the current process.
     677 * If the caller is superuser real and saved user id are also set.
     678 *
     679 * @returns 0 on success.
     680 * @returns Negative error code (errno) on failure.
     681 * @param   uid         New effective user id.
     682 *                      For superusers this is also the new real and saved user id.
     683 */
     684int __libc_Back_processSetUid(uid_t uid);
     685
     686/**
     687 * Sets the real, effective and saved user ids of the current process.
     688 * Unprivilegde users can only set them to the real user id, the
     689 * effective user id or the saved user id.
     690 *
     691 * @returns 0 on success.
     692 * @returns Negative error code (errno) on failure.
     693 * @param   ruid    New real user id. Ignore if -1.
     694 * @param   euid    New effective user id. Ignore if -1.
     695 * @param   svuid   New Saved user id. Ignore if -1.
     696 */
     697int __libc_Back_processSetUidAll(uid_t ruid, uid_t euid, uid_t svuid);
     698
     699
     700/**
     701 * Gets the real group id of the current process.
     702 * @returns Real group id.
     703 */
     704gid_t __libc_Back_processGetGid(void);
     705
     706/**
     707 * Gets the effective group id of the current process.
     708 * @returns Effective group id.
     709 */
     710gid_t __libc_Back_processGetEffGid(void);
     711
     712/**
     713 * Sets the effective group id of the current process.
     714 * If the caller is superuser real and saved group id are also set.
     715 *
     716 * @returns 0 on success.
     717 * @returns Negative error code (errno) on failure.
     718 */
     719int __libc_Back_processSetGid(gid_t gid);
     720
     721/**
     722 * Sets the real, effective and saved group ids of the current process.
     723 * Unprivilegde users can only set them to the real group id, the
     724 * effective group id or the saved group id.
     725 *
     726 * @returns 0 on success.
     727 * @returns Negative error code (errno) on failure.
     728 * @param   rgid    New real group id. Ignore if -1.
     729 * @param   egid    New effective group id. Ignore if -1.
     730 * @param   svgid   New Saved group id. Ignore if -1.
     731 */
     732int __libc_Back_processSetGidAll(gid_t rgid, gid_t egid, gid_t svgid);
     733
     734
    683735/** @} */
    684736
  • trunk/src/emx/include/InnoTekLIBC/logstrict.h

    • Property cvs2svn:cvs-rev changed from 1.10 to 1.11
    r1627 r1628  
    184184#define __LIBC_LOG_GRP_MMAN         16
    185185
     186/** Backend Process APIs. */
     187#define __LIBC_LOG_GRP_BACK_PROCESS 19
    186188/** Backend Signal APIs and Events. */
    187189#define __LIBC_LOG_GRP_BACK_SIGNAL  20
  • trunk/src/emx/include/InnoTekLIBC/sharedpm.h

    • Property cvs2svn:cvs-rev changed from 1.15 to 1.16
    r1627 r1628  
    3535
    3636/** The name of the shared semaphore protecting the memory. */
    37 #define SPM_MUTEX_NAME          "\\SEM32\\INNOTEKLIBC.V01"
     37#define SPM_MUTEX_NAME          "\\SEM32\\INNOTEKLIBC-V1.1"
    3838
    3939/** The name of the shared memory. */
    40 #define SPM_MEMORY_NAME         "\\SHAREMEM\\INNOTEKLIBC.V01"
     40#define SPM_MEMORY_NAME         "\\SHAREMEM\\INNOTEKLIBC-V1.1"
    4141
    4242/** The timeout for accessing the shared mem semaphore. */
     
    6060#define SPM_VERSION             0x00010001
    6161
    62 /**
    63  * Process state.
    64  */
    65 typedef enum __LIBC_SPMPROCSTAT
    66 {
    67     /** The process is free. */
    68     __LIBC_PROCSTATE_FREE = 0,
    69     /** The process is waiting for a chile to be created and snatch all the
    70      * inherited goodies from it.
    71      * If not caught before DosExecPgm/DosStartSession returns
    72      * it will be freed by the disapointed parent.
    73      */
    74     __LIBC_PROCSTATE_EMBRYO = 1,
    75     /** The process is running. */
    76     __LIBC_PROCSTATE_ALIVE = 2,
    77     /** The process is dead but other guys are still using it's data. */
    78     __LIBC_PROCSTATE_ZOMBIE = 3,
    79     /** The maximum state number (exclusive). */
    80     __LIBC_PROCSTATE_MAX = 10,
    81     /** Hack to ensure that this will be a 32-bit int. */
    82     __LIBC_PROCSTATE_MAKE_INT32 = 0x7fffffff
    83 } __LIBC_SPMPROCSTAT;
    8462
    8563/**
     
    10987
    11088
     89/** Pointer to child termination data. */
     90typedef struct __LIBC_SPMCHILDNOTIFY *__LIBC_PSPMCHILDNOTIFY;
     91
     92/**
     93 * Child termination notification data.
     94 */
     95typedef struct __LIBC_SPMCHILDNOTIFY
     96{
     97    /** Pointer to the next node in the list. */
     98    __LIBC_PSPMCHILDNOTIFY volatile pNext;
     99    /** Structure size. */
     100    unsigned                        cb;
     101    /** Process ID. */
     102    pid_t                           pid;
     103    /** Exit code. */
     104    int                             iExitCode;
     105    /** Reason code. */
     106    __LIBC_EXIT_REASON              enmDeathReason;
     107} __LIBC_SPMCHILDNOTIFY;
     108
     109
     110/**
     111 * Process state.
     112 */
     113typedef enum __LIBC_SPMPROCSTAT
     114{
     115    /** The process is free. */
     116    __LIBC_PROCSTATE_FREE = 0,
     117    /** The process is waiting for a chile to be created and snatch all the
     118     * inherited goodies from it.
     119     * If not caught before DosExecPgm/DosStartSession returns
     120     * it will be freed by the disappointed parent.
     121     */
     122    __LIBC_PROCSTATE_EMBRYO = 1,
     123    /** The process is running. */
     124    __LIBC_PROCSTATE_ALIVE = 2,
     125    /** The process is dead but other guys are still using it's data. */
     126    __LIBC_PROCSTATE_ZOMBIE = 3,
     127    /** Reserved process state. */
     128    __LIBC_PROCSTATE_RESERVED = 4,
     129    /** The maximum state number (exclusive). */
     130    __LIBC_PROCSTATE_MAX = 5,
     131    /** Hack to ensure that this will be a 32-bit int. */
     132    __LIBC_PROCSTATE_MAKE_INT32 = 0x7fffffff
     133} __LIBC_SPMPROCSTAT;
     134
     135
     136/** Pointer to (queued) signal. */
     137typedef struct __libc_SPMSignal *__LIBC_PSPMSIGNAL;
     138
    111139/**
    112140 * Signal (queued).
     
    117145    unsigned                    cb;
    118146    /** Pointer to the next signal. */
    119     struct __libc_SPMSignal    *pNext;
     147    __LIBC_PSPMSIGNAL volatile  pNext;
    120148    /** Sender process.
    121149     * This is used to decrement the cSigsSent count of the sender. */
    122150    pid_t                       pidSender;
    123 
    124151    /** Signal info. */
    125152    siginfo_t                   Info;
    126153} __LIBC_SPMSIGNAL;
    127 /** Pointer to (queued) signal. */
    128 typedef __LIBC_SPMSIGNAL *__LIBC_PSPMSIGNAL;
    129154
    130155
     
    154179    unsigned char   cHandles;
    155180    /** Start handle number. */
    156     unsigned short  fhStart;
     181    unsigned short  StartFH;
    157182} __LIBC_SPMINHFHBHDR;
    158183#pragma pack()
     
    171196    __LIBC_SPMINHFHBHDR Hdr;
    172197    /** Array of flags of Hdr.cHandles entries. */
    173     unsigned        afFlags[1];
     198    unsigned            afFlags[1];
    174199} __LIBC_SPMINHFHBSTD;
    175200#pragma pack()
     
    216241typedef __LIBC_SPMINHFS *__LIBC_PSPMINHFS;
    217242
     243/**
     244 * SPM signal inherit data.
     245 */
     246typedef struct __libc_SPMInhSig
     247{
     248    /** The size of this structure. */
     249    unsigned    cb;
     250    /** Mask of signals which should be ignored. */
     251    sigset_t    SigSetIGN;
     252} __LIBC_SPMINHSIG;
     253/** Pointer to Signal inherit data. */
     254typedef __LIBC_SPMINHSIG *__LIBC_PSPMINHSIG;
     255
    218256
    219257
     
    232270    /** Pointer to the file system part. If NULL default values are assumed. */
    233271    __LIBC_PSPMINHFS        pFS;
    234 
    235     /** @todo Add signals and the other properties which are inherited. */
     272    /** Pointer to the signal part. If NULL default values are assumed. */
     273    __LIBC_PSPMINHSIG       pSig;
     274
    236275} __LIBC_SPMINHERIT;
    237276/** Pointer to inherit data. */
     
    239278
    240279
     280/** Pointer to per process data structure. */
     281typedef struct __libc_SPMProcess *__LIBC_PSPMPROCESS;
     282
    241283/**
    242284 * Per Process Data.
     
    244286typedef struct __libc_SPMProcess
    245287{
    246     /** Pointer to the next process in the list.
     288    /**  0 - Pointer to the next process in the list.
    247289     * Every process is in one or another list depending on their state. */
    248     struct __libc_SPMProcess   *pNext;
    249     /** Pointer to the previous process in the list. */
    250     struct __libc_SPMProcess   *pPrev;
    251 
    252     /** Version of the SPM which created this process. */
     290    volatile __LIBC_PSPMPROCESS pNext;
     291    /**  4 - Pointer to the previous process in the list. */
     292    volatile __LIBC_PSPMPROCESS pPrev;
     293
     294
     295    /** Core
     296     * @{ */
     297    /**  8 - Version of the SPM which created this process. */
    253298    unsigned                    uVersion;
    254     /** Number of references to this process.
     299    /** 12 - Number of references to this process.
    255300     * A process is not actually free till the reference count
    256301     * reaches 0. */
    257     unsigned                    cReferences;
    258     /** Process id. */
     302    volatile unsigned           cReferences;
     303    /** 16 - State of this process. */
     304    volatile __LIBC_SPMPROCSTAT enmState;
     305    /** 20 - Process id. */
    259306    pid_t                       pid;
    260     /** Process id of parent. */
     307    /** 24 - Process id of parent.
     308     * This might not match the OS/2 one since there are no notification
     309     * when a parent dies.  */
    261310    pid_t                       pidParent;
    262     /** State of this process. */
    263     __LIBC_SPMPROCSTAT          enmState;
    264     /** The SPM open count of this process. */
     311    /** @} */
     312
     313
     314    /** User & Group
     315     * @{ */
     316    /** 28 - User id. */
     317    uid_t                       uid;
     318    /** 32 - Effective user id. */
     319    uid_t                       euid;
     320    /** 36 - Saved user id. */
     321    uid_t                       svuid;
     322    /** 40 - Group id. */
     323    gid_t                       gid;
     324    /** 44 - Effecive group id. */
     325    gid_t                       egid;
     326    /** 48 - Saved group id. */
     327    gid_t                       svgid;
     328    /** 52 - Supplementary group ids. */
     329    gid_t                       agidGroups[16 /*NGROUPS_MAX*/];
     330    /** @} */
     331
     332
     333    /** Misc
     334     * @{ */
     335    /** 116 - Creation timestamp. */
     336    unsigned                    uTimestamp;
     337    /** 120 - The SPM open count of this process. */
    265338    unsigned                    cSPMOpens;
    266     /** Exit code. */
    267     int                         iExitCode;
    268     /** Reason code. */
    269     __LIBC_EXIT_REASON          enmDeathReason;
    270     /** Pointer to fork module list head. */
    271     void * volatile             pvModuleHead;
    272     /** Pointer to fork module list tail pointer. */
    273     void * volatile * volatile  ppvModuleTail;
    274     /** Pointer to fork handle which a child should use when spawned by fork(). */
    275     void                       *pvForkHandle;
    276     /** Creation timestamp. */
    277     unsigned                    uTimestamp;
    278     /** Incoming signal queue (FIFO).
    279      * For signals which aren't queable only one signal can be queued.
    280      */
    281     volatile __LIBC_PSPMSIGNAL  pSigHead;
    282     /** Number of signals send.
    283      * After _POSIX_SIGQUEUE_MAX signals only SIGCHLD will be allowed sent.
    284      */
    285     volatile unsigned           cSigsSent;
    286     /** Indicates that the process is a full featured LIBC process.
    287      * Untill this flag is set (atomically) it's not a good idea to
     339    /** 124 - Indicates that the process is a full featured LIBC process.
     340     * Until this flag is set (atomically) it's not a good idea to
    288341     * queue signals on the process since it won't have a signal handler
    289342     * installed, and thus won't get to know about them.
    290343     */
    291344    volatile unsigned           fExeInited;
    292 
    293     /** Reserved pool pointer field with default value 0. */
    294     unsigned                    aReserved[40 - 17];
    295 
    296     /** Number of possible pointers to shared memory starting at pvInherit.
     345    /** 128 - Reserved for future use. Must be 0. */
     346    unsigned                    uMiscReserved;
     347    /** @} */
     348
     349
     350    /** Fork
     351     * @{  */
     352    /** 132 - Pointer to fork module list head. */
     353    void * volatile             pvModuleHead;
     354    /** 136 - Pointer to fork module list tail pointer. */
     355    void * volatile * volatile  ppvModuleTail;
     356    /** 140 - Pointer to fork handle which a child should use when spawned by fork(). */
     357    void                       *pvForkHandle;
     358    /** @} */
     359
     360
     361    /** Signals & Job Control
     362     * @{ */
     363    /** 144 - Incoming signal queue (FIFO).
     364     * For signals which aren't queable only one signal can be queued.
     365     */
     366    volatile __LIBC_PSPMSIGNAL  pSigHead;
     367    /** 148 - Number of signals send.
     368     * After _POSIX_SIGQUEUE_MAX signals only SIGCHLD will be allowed sent.
     369     */
     370    volatile unsigned           cSigsSent;
     371    /** 152 - Session Id. */
     372    pid_t                       sid;
     373    /** 156 - Process group. */
     374    pid_t                       pgrp;
     375    /** 160 - Reserved for future use. Must be 0. */
     376    unsigned                    uSigReserved1;
     377    /** 164 - Reserved for future use. Must be 0. */
     378    unsigned                    uSigReserved2;
     379    /** @} */
     380
     381
     382    /** Termination
     383     * @{ */
     384    /** 168 - Termination information which will be sent to the parent process. */
     385    __LIBC_PSPMCHILDNOTIFY      pTerm;
     386    /** 172 - List of child termination notifications. */
     387    __LIBC_PSPMCHILDNOTIFY volatile pChildNotifyHead;
     388    /** 176 - Pointer to the pointer where to insert the next child notification. */
     389    __LIBC_PSPMCHILDNOTIFY volatile * volatile ppChildNotifyTail;
     390    /** @} */
     391
     392
     393    /** 180 - Reserved pool pointer field with default value 0. */
     394    unsigned                    auReserved[56 - 45];
     395
     396
     397    /** 224 - Number of possible pointers to shared memory starting at pvInherit.
    297398     * This means we can extend the structure with pointers for as long as we
    298399     * want and still have older LIBC versions cleanup the mess. */
    299400    unsigned                    cPoolPointers;
    300     /** Pointer to data inherited from the parent process. */
     401    /** 228 -  Pointer to data inherited from the parent process. */
    301402    __LIBC_PSPMINHERIT volatile pInherit;
    302     /** Pointer to data inherited from the parent process when it's locked.
     403    /** 232 - Pointer to data inherited from the parent process when it's locked.
    303404     * When locked pInherit is NULL and this member points to the data instead.
    304405     * This prevents spmAlloc() from reclaiming it while it's in use. */
    305406    __LIBC_PSPMINHERIT volatile pInheritLocked;
    306 } __LIBC_SPMPROCESS, *__LIBC_PSPMPROCESS;
    307 
     407
     408} __LIBC_SPMPROCESS;
     409
     410/** The current value for __LIBC_SPMPROCESS::cPoolPointers. */
     411#define __LIBC_SPMPROCESS_POOLPOINTERS      2
    308412
    309413/**
     
    378482typedef struct __libc_SPMHeader
    379483{
    380     /** SPM version. (the one which initialized the memory)  */
    381     unsigned                    uVersion;
    382 
    383     /** Size of the shared memory. */
    384     size_t                      cb;
    385     /** Free memory. */
    386     size_t                      cbFree;
    387     /** Start chunk of shared memory pool. */
    388     __LIBC_PSPMPOOLCHUNK        pPoolHead;
    389     /** End chunk of shared memory pool. */
    390     __LIBC_PSPMPOOLCHUNK        pPoolTail;
    391     /** Start free chunk in the shared memory pool. */
    392     __LIBC_PSPMPOOLCHUNKFREE    pPoolFreeHead;
    393     /** End free chunk in the shared memory pool. */
    394     __LIBC_PSPMPOOLCHUNKFREE    pPoolFreeTail;
    395 
    396     /** The size of one process block in this version of the shared memory. */
    397     size_t                      cbProcess;
    398     /** Array index by process state giving the head pointers
     484    /**  0 - SPM version. (the one which initialized the memory)  */
     485    unsigned                            uVersion;
     486
     487    /**  4 - Size of the shared memory. */
     488    size_t                              cb;
     489    /**  8 - Free memory. */
     490    volatile size_t                     cbFree;
     491    /** 12 - Start chunk of shared memory pool. */
     492    volatile __LIBC_PSPMPOOLCHUNK       pPoolHead;
     493    /** 16 - End chunk of shared memory pool. */
     494    volatile __LIBC_PSPMPOOLCHUNK       pPoolTail;
     495    /** 20 - Start free chunk in the shared memory pool. */
     496    volatile __LIBC_PSPMPOOLCHUNKFREE   pPoolFreeHead;
     497    /** 24 - End free chunk in the shared memory pool. */
     498    volatile __LIBC_PSPMPOOLCHUNKFREE   pPoolFreeTail;
     499
     500    /** 28 - The size of one process block in this version of the shared memory. */
     501    size_t                              cbProcess;
     502    /** 32 - Array index by process state giving the head pointers
    399503     * to the processes in that state. */
    400     __LIBC_PSPMPROCESS volatile apHeads[__LIBC_PROCSTATE_MAX];
    401 
    402     /** Pointer to the tcpip globals. */
    403     __LIBC_PSPMTCPIP            pTcpip;
    404     /** Creator pid. */
    405     pid_t                       pidCreate;
    406     /** Creation timestamp. */
     504    volatile __LIBC_PSPMPROCESS         apHeads[__LIBC_PROCSTATE_MAX];
     505    /** 52 -List of free child (termination) notification structures. */
     506    volatile __LIBC_PSPMCHILDNOTIFY     pChildNotifyFreeHead;
     507
     508    /** 56 - Pointer to the tcpip globals. */
     509    __LIBC_PSPMTCPIP                    pTcpip;
     510    /** 60 - Creator pid. */
     511    pid_t                               pidCreate;
     512    /** 64 - Creation timestamp. */
    407513    __extension__ union
    408514    {
    409515#ifdef INCL_DOSDATETIME
    410         DATETIME                dtCreate;
     516        DATETIME                        dtCreate;
    411517#endif
    412         char                    ach[16];
     518        char                            ach[16];
    413519    };
    414520
    415     /** System Load Averages. */
    416     __LIBC_SPMLOADAVG           LoadAvg;
    417 
    418     /** List of free signal structures. This will reduce
     521    /** 80 - System Load Averages. */
     522    volatile __LIBC_SPMLOADAVG          LoadAvg;
     523
     524    /** 96 - List of free signal structures. This will reduce
    419525     * the time spent allocating a signal structure in most cases.
    420526     * During SPM init 8 signal structures will be allocated and queued. */
    421     __LIBC_PSPMSIGNAL           pSigFreeHead;
    422     /** Number of free signal structures in the list.
     527    volatile __LIBC_PSPMSIGNAL          pSigFreeHead;
     528    /** 100 - Number of free signal structures in the list.
    423529     * This is used to prevent the list from growing infinitly under stress.
    424530     * When cSigFree reaches 32 unused signal structures will be freed instead
    425531     * of put in the list. */
    426     unsigned                    cSigFree;
    427     /** Number of active signals.
     532    volatile unsigned                   cSigFree;
     533    /** 104 - Number of active signals.
    428534     * This is used to keep a reasonable limit of the number of active signal
    429535     * structures so a process cannot exhaust the shared memory pool.
    430536     * The maximum is defined by cSigMaxActive.
    431537     */
    432     unsigned                    cSigActive;
    433     /** The maximum number of active signals.
     538    volatile unsigned                   cSigActive;
     539    /** 108 - The maximum number of active signals.
    434540     * This is initialized by the SPM creator but can be adjusted later.
    435541     */
    436     unsigned                    cSigMaxActive;
    437 
    438     /* The rest of the block, up to cbProcess, is undefined in this version.
     542    unsigned                            cSigMaxActive;
     543    /** 112 - Notification event semaphore.
     544     * This semaphore is signaled when an event occurs.
     545     */
     546    unsigned long                       hevNotify;
     547
     548    /*  116 - The rest of the block, up to cbProcess, is undefined in this version.
    439549     * Future versions of LIBC may use this area assuming it's initalized with zeros.
    440550     */
     
    550660
    551661/**
    552  * Gets the exit code and reason of death for a specific child process
    553  * which is believed to have died.
     662 * Query about notifications from a specific child process.
     663 * The notifications are related to death, the cause and such.
    554664 *
    555665 * @returns 0 on success.
    556666 * @returns Negative error code (errno.h) on failure.
    557667 * @param   pid                 Process id.
    558  * @param   pendDeathReason     Where to store the death reason.
    559  * @param   piExitCode          Where to store the exit code.
    560  */
    561 int __libc_spmReapChild(pid_t pid, __LIBC_EXIT_REASON *penmDeathReason, int *piExitCode);
     668 * @param   pNotify             Where to store the notification from the child.
     669 */
     670int __libc_spmQueryChildNotification(pid_t pid, __LIBC_PSPMCHILDNOTIFY pNotifyOut);
     671
     672/**
     673 * Identificators which can be obtained using __libc_spmGetId().
     674 */
     675typedef enum __LIBC_SPMId
     676{
     677    __LIBC_SPMID_PID = 0,
     678    __LIBC_SPMID_PPID,
     679    __LIBC_SPMID_SID,
     680    __LIBC_SPMID_PGRP,
     681    __LIBC_SPMID_UID,
     682    __LIBC_SPMID_EUID,
     683    __LIBC_SPMID_SVUID,
     684    __LIBC_SPMID_GID,
     685    __LIBC_SPMID_EGID,
     686    __LIBC_SPMID_SVGID
     687} __LIBC_SPMID;
     688
     689
     690/**
     691 * Gets the specified Id.
     692 *
     693 * @returns Requested Id.
     694 * @param   enmId       Identification to get.
     695 */
     696unsigned __libc_spmGetId(__LIBC_SPMID enmId);
     697
     698/**
     699 * Sets the effective user id of the current process.
     700 * If the caller is superuser real and saved user id are also set.
     701 *
     702 * @returns 0 on success.
     703 * @returns Negative error code (errno) on failure.
     704 * @param   uid         New effective user id.
     705 *                      For superusers this is also the new real and saved user id.
     706 */
     707int __libc_spmSetUid(uid_t uid);
     708
     709/**
     710 * Sets the real, effective and saved user ids of the current process.
     711 * Unprivilegde users can only set them to the real user id, the
     712 * effective user id or the saved user id.
     713 *
     714 * @returns 0 on success.
     715 * @returns Negative error code (errno) on failure.
     716 * @param   ruid    New real user id. Ignore if -1.
     717 * @param   euid    New effective user id. Ignore if -1.
     718 * @param   svuid   New Saved user id. Ignore if -1.
     719 */
     720int __libc_spmSetUidAll(uid_t ruid, uid_t euid, uid_t svuid);
     721
     722/**
     723 * Sets the effective group id of the current process.
     724 * If the caller is superuser real and saved group id are also set.
     725 *
     726 * @returns 0 on success.
     727 * @returns Negative error code (errno) on failure.
     728 */
     729int __libc_spmSetGid(gid_t gid);
     730
     731/**
     732 * Sets the real, effective and saved group ids of the current process.
     733 * Unprivilegde users can only set them to the real group id, the
     734 * effective group id or the saved group id.
     735 *
     736 * @returns 0 on success.
     737 * @returns Negative error code (errno) on failure.
     738 * @param   rgid    New real group id. Ignore if -1.
     739 * @param   egid    New effective group id. Ignore if -1.
     740 * @param   svgid   New Saved group id. Ignore if -1.
     741 */
     742int __libc_spmSetGidAll(gid_t rgid, gid_t egid, gid_t svgid);
    562743
    563744/**
     
    668849 * @returns 0 on success.
    669850 * @returns Negative error code (errno.h) on failure.
    670  * @param   pSignal     Signal to queue.
     851 */
     852void    __libc_spmExeInited(void);
     853
     854/**
     855 * Queues a signal on another process.
     856 *
     857 * @returns 0 on success.
     858 * @returns Negative error code (errno.h) on failure.
     859 * @param   pSigInfo    Signal to queue.
    671860 * @param   pid         Pid to queue it on.
    672861 * @param   fQueued     Set if the signal type is queued.
    673862 */
    674 void    __libc_spmExeInited(void);
     863int     __libc_spmSigQueue(int iSignalNo, siginfo_t *pSigInfo, pid_t pid, int fQueued);
     864
     865/**
     866 * Callback which is called when a signal have been queued on a process.
     867 *
     868 * @returns 0 on success.
     869 * @returns Negative error code (errno.h) on failure.
     870 * @param   iSignalNo   The signal which have been queued.
     871 * @param   pProcess    Process which the signal was queued on.
     872 * @param   pvUser      User argument.
     873 */
     874typedef int (*__LIBC_PFNSPMSIGNALED)(int iSignalNo, const __LIBC_SPMPROCESS * pProcess, void *pvUser);
    675875
    676876/**
     
    679879 * @returns 0 on success.
    680880 * @returns Negative error code (errno.h) on failure.
    681  * @param   pSignal     Signal to queue.
    682  * @param   pid         Pid to queue it on.
     881 * @param   iSignalNo   The signal to send. If 0 only permissions are checked.
     882 * @param   pSigInfo     Signal to queue. If NULL only permissions are checked.
     883 * @param   pgrp        Process group to queue a signal on.
    683884 * @param   fQueued     Set if the signal type is queued.
    684  */
    685 int     __libc_spmSigQueue(siginfo_t *pSignal, pid_t pid, int fQueued);
     885 * @param   pfnCallback Pointer to callback function to post process signaled processes.
     886 *                      The callback must be _very_ careful. No crashing or blocking!
     887 * @param   pvUser      User argument specified to pfnCallback.
     888 */
     889int     __libc_spmSigQueuePGrp(int iSignalNo, siginfo_t *pSigInfo, pid_t pgrp, int fQueued, __LIBC_PFNSPMSIGNALED pfnCallback, void *pvUser);
    686890
    687891/**
  • trunk/src/emx/include/os2emx.h

    • Property cvs2svn:cvs-rev changed from 1.20 to 1.21
    r1627 r1628  
    1333413334typedef struct _LINFOSEG
    1333513335{
    13336     PID         pidCurrent;
    13337     PID         pidParent;
     13336    USHORT      pidCurrent;
     13337    USHORT      pidParent;
    1333813338    USHORT      prtyCurrent;
    13339     TID         tidCurrent;
     13339    USHORT      tidCurrent;
    1334013340    USHORT      sgCurrent;
    1334113341    UCHAR       rfProcStatus;
    1334213342    UCHAR       dummy1;
    13343     BOOL        fForeground;
     13343    USHORT      fForeground;
    1334413344    UCHAR       typeProcess;
    1334513345    UCHAR       dummy2;
     
    1334913349    USHORT      cbStack;
    1335013350    USHORT      cbHeap;
    13351     HMODULE     hmod;
     13351    USHORT      hmod;
    1335213352    SEL         selDS;
    1335313353} LINFOSEG;
  • trunk/src/emx/include/unistd.h

    • Property cvs2svn:cvs-rev changed from 1.23 to 1.24
    r1627 r1628  
    423423#if __POSIX_VISIBLE >= 200112
    424424/* tcpip: int    gethostname(char *, size_t); */
    425 /** @todo int    setegid(gid_t);  */
    426 /** @todo int    seteuid(uid_t); */
     425int      setegid(gid_t);
     426int      seteuid(uid_t);
    427427#endif
    428428
     
    452452/** @todo ssize_t        pwrite(int, const void *, size_t, off_t); */
    453453/** @todo int    setpgrp(pid_t _pid, pid_t _pgrp); */ /* obsoleted by setpgid() */
    454 /** @todo int    setregid(gid_t, gid_t); */
    455 /** @todo int    setreuid(uid_t, uid_t); */
     454int      setregid(gid_t, gid_t);
     455int      setreuid(uid_t, uid_t);
    456456/* void  swab(const void * __restrict, void * __restrict, ssize_t); */
    457457void     sync(void);
     
    545545/** @todo int    setlogin(const char *); */
    546546/* crash with DOS: void *setmode(const char *); */
    547 /** @todo int    setresgid(gid_t, gid_t, gid_t); */
    548 /** @todo int    setresuid(uid_t, uid_t, uid_t); */
    549 /** @todo int    setrgid(gid_t); */
    550 /** @todo int    setruid(uid_t); */
     547int      setresgid(gid_t, gid_t, gid_t);
     548int      setresuid(uid_t, uid_t, uid_t);
     549int      setrgid(gid_t);
     550int      setruid(uid_t);
    551551void     setusershell(void);
    552552/** @todo int    strtofflags(char **, u_long *, u_long *); */
Note: See TracChangeset for help on using the changeset viewer.