Ignore:
Timestamp:
May 8, 2005, 2:11:22 PM (20 years ago)
Author:
bird
Message:

Ported the BSD SysV Semaphore module.

File:
1 edited

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.21 to 1.22
    r1983 r1984  
    44 * LIBC Shared Process Management.
    55 *
    6  *
     6 * Copyright (c) 2004-2005 knut st. osmundsen <bird@anduin.net>
     7 * Copyright (c) 2004 nickk
    78 *
    89 * This file is part of InnoTek LIBC.
     
    3031#include <sys/types.h>
    3132#include <sys/signal.h>
     33#include <sys/ipc.h>
    3234
    3335
     
    553555    unsigned long                       hevNotify;
    554556
    555     /*  116 - The rest of the block, up to cbProcess, is undefined in this version.
     557    /** 116 - Pointer to SysV Sempahore globals. */
     558    struct __libc_SysV_Sem             *pSysVSem;
     559
     560    /*  120 - The rest of the block, up to cbProcess, is undefined in this version.
    556561     * Future versions of LIBC may use this area assuming it's initalized with zeros.
    557562     */
     
    729734
    730735/**
     736 * Checks if the calling process is a member of the specified group.
     737 *
     738 * @returns 0 if member.
     739 * @returns -EPERM if not member.
     740 * @param   gid     The group id in question.
     741 */
     742int __libc_spmIsGroupMember(gid_t gid);
     743
     744/**
     745 * Check if the caller can access the SysV IPC object as requested.
     746 *
     747 * @returns 0 if we can.
     748 * @returns -EPERM if we cannot.
     749 * @param   pPerm       The IPC permission structure.
     750 * @param   Mode        The access request. IPC_M, IPC_W or IPC_R.
     751 */
     752int __libc_spmCanIPC(struct ipc_perm *pPerm, mode_t Mode);
     753
     754/**
    731755 * Marks the current process (if we have it around) as zombie
    732756 * or dead freeing all resources associated with it.
     
    841865 *
    842866 * @returns 0 on success.
    843  * @returns -1 and errno on failure.
     867 * @returns Negative error code (errno.h) on failure.
     868 *
    844869 * @param   pRegRec     Pointer to the exception handler registration record.
     870 * @param   ppSPMHdr    Where to store the pointer to the SPM header. Can be NULL.
     871 *
    845872 * @remark  Don't even think of calling this if you're not LIBC!
    846873 */
    847 int __libc_spmLock(__LIBC_PSPMXCPTREGREC pRegRec);
     874int __libc_spmLock(__LIBC_PSPMXCPTREGREC pRegRec, __LIBC_PSPMHEADER *ppSPMHdr);
    848875
    849876/**
     
    851878 *
    852879 * @returns 0 on success.
    853  * @returns -1 on and errno failure.
     880 * @returns Negative error code (errno.h) on failure.
     881 *
    854882 * @param   pRegRec     Pointer to the exception handler registration record.
     883 *
    855884 * @remark  Don't even think of calling this if you're not LIBC!
    856885 */
     
    859888/**
    860889 * Allocate memory from the LIBC shared memory.
     890 *
     891 * The SPM must be locked using __libc_spmLock() prior to calling this function!
    861892 *
    862893 * @returns Pointer to allocated memory on success.
    863894 * @returns NULL on failure.
     895 *
    864896 * @param   cbSize      Size of memory to allocate.
     897 *
    865898 * @remark  Don't think of calling this if you're not LIBC!
    866899 */
    867 void * __libc_spmAlloc(size_t cbSize);
    868 
    869 /**
    870  * Free memory allocated by __libc_SpmAlloc().
     900void * __libc_spmAllocLocked(size_t cbSize);
     901
     902/**
     903 * Free memory allocated by __libc_spmAllocLocked() or __libc_spmAlloc().
     904 *
     905 * The SPM must be locked using __libc_spmLock() prior to calling this function!
    871906 *
    872907 * @returns 0 on success.
    873908 * @returns -1 and errno on failure.
     909 *
    874910 * @param   pv      Pointer to memory block returned by __libc_SpmAlloc().
    875911 *                  NULL is allowed.
    876912 * @remark  Don't think of calling this if you're not LIBC!
    877913 */
     914int __libc_spmFreeLocked(void *pv);
     915
     916/**
     917 * Allocate memory from the LIBC shared memory.
     918 *
     919 * @returns Pointer to allocated memory on success.
     920 * @returns NULL on failure.
     921 *
     922 * @param   cbSize      Size of memory to allocate.
     923 *
     924 * @remark  Don't think of calling this if you're not LIBC!
     925 */
     926void * __libc_spmAlloc(size_t cbSize);
     927
     928/**
     929 * Free memory allocated by __libc_SpmAlloc().
     930 *
     931 * @returns 0 on success.
     932 * @returns -1 and errno on failure.
     933 *
     934 * @param   pv      Pointer to memory block returned by __libc_SpmAlloc().
     935 *                  NULL is allowed.
     936 *
     937 * @remark  Don't think of calling this if you're not LIBC!
     938 */
    878939int __libc_spmFree(void *pv);
    879940
    880 
    881 /**
    882  * Register TCPIP termination handler.
     941/**
     942 * Register termination handler.
    883943 *
    884944 * This is a manual way of by passing a.out's broken weak symbols.
    885  * @param   pfnTerm     Pointer to the termination function.
    886  */
    887 void    __libc_spmSocketRegTerm(void (*pfnTerm)(void));
     945 */
     946void __libc_spmRegTerm(void (*pfnTerm)(void));
    888947
    889948
Note: See TracChangeset for help on using the changeset viewer.