Changeset 1984


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

Ported the BSD SysV Semaphore module.

Location:
trunk/src/emx
Files:
4 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/ChangeLog.LIBC

    • Property cvs2svn:cvs-rev changed from 1.44 to 1.45
    r1983 r1984  
    11/* $Id$ */
     2
     32005-05-08: knut st. osmundsen <bird-gccos2-spam@anduin.net>
     4    - libc:
     5        o Added _getenv_[int|long|longlong]. Using this for LIBC_THREAD_MIN_STACK_SIZE.
     6        o Ported the BSD SysV Semaphore module.
     7        o Added a signal notification callback to the thread structure.
     8        o Changed tcpip term callback to more generic exitlist callback (SPM).
    29
    3102005-05-05: knut st. osmundsen <bird-gccos2-spam@anduin.net>
  • trunk/src/emx/include/386/builtin.h

    • Property cvs2svn:cvs-rev changed from 1.10 to 1.11
    r1983 r1984  
    7777static __inline__ int __atomic_set_bit(__volatile__ void *pv, unsigned uBit)
    7878{
    79     __asm__ __volatile__("lock btsl %2, %1\n\t"
     79    __asm__ __volatile__("lock; btsl %2, %1\n\t"
    8080                         "sbbl %0,%0"
    8181                         : "=r" (uBit),
     
    9595static __inline__ void __atomic_clear_bit(__volatile__ void *pv, unsigned uBit)
    9696{
    97     __asm__ __volatile__("lock btrl %1, %0"
     97    __asm__ __volatile__("lock; btrl %1, %0"
    9898                         : "=m" (*(__volatile__ unsigned *)pv)
    9999                         : "r" (uBit));
     
    128128static __inline__ void __atomic_add(__volatile__ unsigned *pu, const unsigned uAdd)
    129129{
    130     __asm__ __volatile__("lock addl %1, %0"
     130    __asm__ __volatile__("lock; addl %1, %0"
    131131                         : "=m" (*pu)
    132                          : "nr" (uAdd), 
     132                         : "nr" (uAdd),
    133133                           "m"  (*pu));
    134134}
     
    142142static __inline__ void __atomic_sub(__volatile__ unsigned *pu, const unsigned uSub)
    143143{
    144     __asm__ __volatile__("lock subl %1, %0"
     144    __asm__ __volatile__("lock; subl %1, %0"
    145145                         : "=m" (*pu)
    146                          : "nr" (uSub), 
     146                         : "nr" (uSub),
    147147                           "m"  (*pu));
    148148}
     
    156156static __inline__ void __atomic_increment(__volatile__ unsigned *pu)
    157157{
    158     __asm__ __volatile__("lock incl %0"
    159                          : "=m" (*pu) 
     158    __asm__ __volatile__("lock; incl %0"
     159                         : "=m" (*pu)
    160160                         : "m"  (*pu));
    161161}
    162162
    163163/**
     164 * Atomically increments a 32-bit unsigned value.
     165 *
     166 * @param   pu32    Pointer to the value to increment.
     167 */
     168static __inline__ void __atomic_increment_u32(uint32_t __volatile__ *pu32)
     169{
     170    __asm__ __volatile__("lock; incl %0"
     171                         : "=m" (*pu32)
     172                         : "m"  (*pu32));
     173}
     174
     175/**
     176 * Atomically increments a 16-bit unsigned value.
     177 *
     178 * @param   pu16    Pointer to the value to increment.
     179 */
     180static __inline__ void __atomic_increment_u16(uint16_t __volatile__ *pu16)
     181{
     182    __asm__ __volatile__("lock; incw %0"
     183                         : "=m" (*pu16)
     184                         : "m"  (*pu16));
     185}
     186
     187/**
    164188 * Atomically decrements a 32-bit unsigned value.
    165189 *
     
    168192static __inline__ void __atomic_decrement(__volatile__ unsigned *pu)
    169193{
    170     __asm__ __volatile__("lock decl %0"
    171                          : "=m" (*pu) 
     194    __asm__ __volatile__("lock; decl %0"
     195                         : "=m" (*pu)
    172196                         : "m"  (*pu));
     197}
     198
     199/**
     200 * Atomically decrements a 32-bit unsigned value.
     201 *
     202 * @param   pu      Pointer to the value to decrement.
     203 */
     204static __inline__ void __atomic_decrement_u32(__volatile__ uint32_t *pu32)
     205{
     206    __asm__ __volatile__("lock; decl %0"
     207                         : "=m" (*pu32)
     208                         : "m"  (*pu32));
     209}
     210
     211/**
     212 * Atomically decrements a 16-bit unsigned value.
     213 *
     214 * @param   pu16    Pointer to the value to decrement.
     215 */
     216static __inline__ void __atomic_decrement_u16(uint16_t __volatile__ *pu16)
     217{
     218    __asm__ __volatile__("lock; decw %0"
     219                         : "=m" (*pu16)
     220                         : "m"  (*pu16));
    173221}
    174222
     
    192240                         "2:\n\t"
    193241                         "incl  %0\n\t"
    194                          "lock  cmpxchgl %0, %1\n\t"
     242                         "lock; cmpxchgl %0, %1\n\t"
    195243                         "jz    3f\n\t"
    196244                         "jmp   1b\n"
     
    228276                         "2:\n\t"
    229277                         "incw  %w0\n\t"
    230                          "lock  cmpxchgw %w0, %2\n\t"
     278                         "lock; cmpxchgw %w0, %2\n\t"
    231279                         "jz    3f\n\t"
    232280                         "jmp   1b\n\t"
     
    261309                         "2:\n\t"
    262310                         "decl  %0\n\t"
    263                          "lock  cmpxchgl %0, %1\n\t"
     311                         "lock; cmpxchgl %0, %1\n\t"
    264312                         "jz    3f\n\t"
    265313                         "jmp   1b\n"
     
    297345                         "2:\n\t"
    298346                         "decw  %%bx\n\t"
    299                          "lock  cmpxchgw %w0, %1\n\t"
     347                         "lock; cmpxchgw %w0, %1\n\t"
    300348                         "jz    3f\n\t"
    301349                         "jmp   1b\n"
     
    321369static inline unsigned __atomic_cmpxchg32(volatile uint32_t *pu32, uint32_t u32New, uint32_t u32Old)
    322370{
    323     __asm__ __volatile__("lock  cmpxchgl %2, %1\n\t"
     371    __asm__ __volatile__("lock; cmpxchgl %2, %1\n\t"
    324372                         "setz  %%al\n\t"
    325373                         "movzx %%al, %%eax\n\t"
  • trunk/src/emx/include/InnoTekLIBC/FastInfoBlocks.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1983 r1984  
    130130 * System stuff
    131131 */
     132/** Get the current millisecond counter value. */
    132133#define fibGetMsCount()         (__libc_GpFIBGIS->SIS_MsCount)
     134/** Get the Unix timestamp (seconds). */
     135#define fibGetUnixSeconds()     (__libc_GpFIBGIS->SIS_BigTime)
    133136
    134137
  • trunk/src/emx/include/InnoTekLIBC/backend.h

    • Property cvs2svn:cvs-rev changed from 1.22 to 1.23
    r1983 r1984  
    3434#include <sys/time.h>
    3535#include <sys/wait.h>
     36#include <sys/sem.h>
    3637#include <signal.h>
    3738#include <emx/io.h>
     
    890891/** @} */
    891892
     893
     894/** @defgroup grp_Back_sysvipc LIBC Backend - SysV IPC
     895 * @{ */
     896/**
     897 * semctl syscall
     898 */
     899int __libc_Back_sysvSemCtl(int semid, int semnum, int cmd, union semun real_arg);
     900
     901/**
     902 * sysget syscall.
     903 */
     904int __libc_Back_sysvSemGet(key_t key, int nsems, int semflg);
     905
     906/**
     907 * semop syscall.
     908 */
     909int __libc_Back_sysvSemOp(int semid, struct sembuf *sops_user, size_t nsops);
     910
     911/** @} */
     912
    892913__END_DECLS
    893914
  • 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
  • trunk/src/emx/include/InnoTekLIBC/thread.h

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r1983 r1984  
    7373    volatile int    fDone;
    7474} __LIBC_THREAD_SIGSUSPEND, *__LIBC_PTHREAD_SIGSUSPEND;
     75
     76
     77/**
     78 * Signal notification callback function.
     79 *
     80 * This is a notification which can be used to correct the state of
     81 * a system object before any user code is executed.
     82 *
     83 * The semaphore lock is hold and signals are all on hold, so be very careful with waitin
     84 * on other semphores and stuff like that. Crashing is totally forbidden. :-)
     85 *
     86 * @param   iSignalNo       The signal number.
     87 * @param   pvUser          The user argument.
     88 */
     89typedef void __LIBC_FNSIGCALLBACK(int iSignalNo, void *pvUser);
     90/** Pointer to a signal callback function. */
     91typedef __LIBC_FNSIGCALLBACK *__LIBC_PFNSIGCALLBACK;
    7592
    7693
     
    174191     * when ever a thread enters for processing a signal asynchronously. */
    175192    volatile unsigned long      ulSigLastTS;
    176 
     193    /** Callback on signal/exception. */
     194    __LIBC_PFNSIGCALLBACK       pfnSigCallback;
     195    /** User argument to signal/exception callback. */
     196    void                       *pvSigCallbackUser;
    177197
    178198    /** Thread status, chiefly used for the u member of the thread structure. */
  • trunk/src/emx/include/sys/ipc.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1983 r1984  
    126126#define IXSEQ_TO_IPCID(ix,perm) (((perm.seq) << 16) | (ix & 0xffff))
    127127
     128#ifdef __EMX__
     129int     __libc_back_ipcperm(struct ipc_perm *, int);
     130#else /* !__EMX__ */
    128131struct thread;
    129132struct proc;
     
    133136extern void (*shmfork_hook)(struct proc *, struct proc *);
    134137extern void (*shmexit_hook)(struct vmspace *);
     138#endif /* !__EMX__ */
    135139
    136140#else /* ! _KERNEL */
  • trunk/src/emx/include/sys/sem.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1983 r1984  
    1010/** @file
    1111 * FreeBSD 5.3
     12 * @changed     bird: no padding in semid_ds. seminfo and semexit are static in our 'kernel'.
    1213 */
    1314
     
    2425        unsigned short  sem_nsems;      /* number of sems in set */
    2526        time_t          sem_otime;      /* last operation time */
     27#ifndef __EMX__ /* space is precious */
    2628        long            sem_pad1;       /* SVABI/386 says I need this here */
     29#endif
    2730        time_t          sem_ctime;      /* last change time */
    2831                                        /* Times measured in secs since */
    2932                                        /* 00:00:00 GMT, Jan. 1, 1970 */
     33#ifndef __EMX__ /* space is precious */
    3034        long            sem_pad2;       /* SVABI/386 says I need this here */
    3135        long            sem_pad3[4];    /* SVABI/386 says I need this here */
     36#endif
    3237};
    3338
     
    8792                semaem;         /* adjust on exit max value */
    8893};
     94#ifndef __EMX__
    8995extern struct seminfo   seminfo;
     96#endif
    9097
    9198/* internal "mode" bits */
     
    93100#define SEM_DEST        02000   /* semaphore will be destroyed on last detach */
    94101
     102#ifndef __EMX__
    95103/*
    96104 * Process sem_undo vectors at proc exit.
    97105 */
    98106void    semexit(struct proc *p);
     107#endif /* !__EMX__ */
    99108#endif /* _KERNEL */
    100109
     
    114123
    115124__BEGIN_DECLS
     125#ifndef __EMX__
    116126int semsys(int, ...);
     127#endif
    117128int semctl(int, int, int, ...);
    118129int semget(key_t, int, int);
  • trunk/src/emx/src/lib/libc.def

    • Property cvs2svn:cvs-rev changed from 1.110 to 1.111
    r1983 r1984  
    15261526    "___nullstub_function" @1531
    15271527    "___nullstub_data" @1532
     1528    "__getenv_int" @1533
     1529    "__getenv_long" @1534
     1530    "__getenv_longlong" @1535
     1531    "___libc_Back_sysvSemCtl" @1536
     1532    "___libc_Back_sysvSemGet" @1537
     1533    "___libc_Back_sysvSemOp" @1538
     1534    "__std_ftok" @1539
     1535    "__std_semctl" @1540
     1536    "__std_semget" @1541
     1537    "__std_semop" @1542
  • trunk/src/emx/src/lib/sys/sharedpm.c

    • Property cvs2svn:cvs-rev changed from 1.29 to 1.30
    r1983 r1984  
    6767#include <stdio.h>
    6868#include <sys/types.h>
     69#include <sys/ipc.h>
    6970#include <emx/startup.h>
    7071#include <386/builtin.h>
     
    103104/** Checking for nested access to the shared memory. */
    104105static unsigned                 gcNesting;
    105 /** Pointer to tcpip termination handler. */
    106 static void                   (*gapfnSocketTerm[2])(void);
     106/** Pointer to termination handlers. */
     107static void                   (*gapfnExitList[4])(void);
    107108
    108109
     
    925926
    926927/**
     928 * Checks if the calling process is a member of the specified group.
     929 *
     930 * @returns 0 if member.
     931 * @returns -EPERM if not member.
     932 * @param   gid     The group id in question.
     933 */
     934int __libc_spmIsGroupMember(gid_t gid)
     935{
     936    if (gpSPMSelf->egid == gid)
     937        return 0;
     938    int c = sizeof(gpSPMSelf->agidGroups) / sizeof(gpSPMSelf->agidGroups[0]);
     939    gid_t *pGid = &gpSPMSelf->agidGroups[0];
     940    while (c-- > 0)
     941        if (*pGid++ == gid)
     942            return 0;
     943    return -EPERM;
     944}
     945
     946
     947/**
     948 * Check if the caller can access the SysV IPC object as requested.
     949 *
     950 * @returns 0 if we can.
     951 * @returns -EPERM if we cannot.
     952 * @param   pPerm       The IPC permission structure.
     953 * @param   Mode        The access request. IPC_M, IPC_W or IPC_R.
     954 */
     955int __libc_spmCanIPC(struct ipc_perm *pPerm, mode_t Mode)
     956{
     957    uid_t euid = gpSPMSelf->euid;
     958    if (    euid != pPerm->cuid
     959        &&  euid != pPerm->uid)
     960    {
     961        /*
     962         * For a non-create/owner, we require privilege to
     963         * modify the object protections.  Note: some other
     964         * implementations permit IPC_M to be delegated to
     965         * unprivileged non-creator/owner uids/gids.
     966         */
     967        if (Mode & IPC_M)
     968            return __libc_spmIsSuperUser();
     969
     970        /*
     971         * Try to match against creator/owner group; if not, fall
     972         * back on other.
     973         */
     974        Mode >>= 3;
     975        if (    __libc_spmIsGroupMember(pPerm->gid) != 0
     976            &&  __libc_spmIsGroupMember(pPerm->cgid) != 0)
     977                Mode >>= 3;
     978    }
     979    else
     980    {
     981        /*
     982         * Always permit the creator/owner to update the object
     983         * protections regardless of whether the object mode
     984         * permits it.
     985         */
     986        if (Mode & IPC_M)
     987            return 0;
     988    }
     989
     990    if ((Mode & pPerm->mode) != Mode)
     991        return __libc_spmIsSuperUser();
     992    return 0;
     993}
     994
     995
     996/**
    927997 * Gets the specified Id.
    928998 *
     
    11591229 *
    11601230 * @returns 0 on success.
    1161  * @returns -1 and errno on failure.
     1231 * @returns Negative error code (errno.h) on failure.
     1232 *
    11621233 * @param   pRegRec     Pointer to the exception handler registration record.
     1234 * @param   ppSPMHdr    Where to store the pointer to the SPM header. Can be NULL.
     1235 *
    11631236 * @remark  Don't even think of calling this if you're not LIBC!
    11641237 */
    1165 int __libc_spmLock(__LIBC_PSPMXCPTREGREC pRegRec)
    1166 {
    1167     LIBCLOG_ENTER("\n");
    1168     int rc = spmRequestMutexErrno(pRegRec);
    1169     if (!rc)
    1170         LIBCLOG_RETURN_INT(0);
    1171     errno = rc;
    1172     LIBCLOG_RETURN_INT(-1);
     1238int __libc_spmLock(__LIBC_PSPMXCPTREGREC pRegRec, __LIBC_PSPMHEADER *ppSPMHdr)
     1239{
     1240    LIBCLOG_ENTER("pRegRec=%p ppSPMHdr=%p\n", (void *)pRegRec, (void *)ppSPMHdr);
     1241    int rc = spmRequestMutex(pRegRec);
     1242    if (!rc && ppSPMHdr)
     1243        *ppSPMHdr = gpSPMHdr;
     1244    LIBCLOG_RETURN_INT(rc);
    11731245}
    11741246
     
    11781250 *
    11791251 * @returns 0 on success.
    1180  * @returns -1 on and errno failure.
     1252 * @returns Negative error code (errno.h) on failure.
     1253 *
    11811254 * @param   pRegRec     Pointer to the exception handler registration record.
     1255 *
    11821256 * @remark  Don't even think of calling this if you're not LIBC!
    11831257 */
    11841258int __libc_spmUnlock(__LIBC_PSPMXCPTREGREC pRegRec)
    11851259{
    1186     LIBCLOG_ENTER("\n");
     1260    LIBCLOG_ENTER("pRegRec=%p\n", (void *)pRegRec);
    11871261    int rc = spmReleaseMutex(pRegRec);
    1188     if (!rc)
    1189         LIBCLOG_RETURN_INT(0);
    1190     errno = -rc;
    1191     LIBCLOG_RETURN_INT(-1);
     1262    LIBCLOG_RETURN_INT(rc);
    11921263}
    11931264
     
    11951266/**
    11961267 * Allocate memory from the LIBC shared memory.
     1268 *
     1269 * The SPM must be locked using __libc_spmLock() prior to calling this function!
    11971270 *
    11981271 * @returns Pointer to allocated memory on success.
    11991272 * @returns NULL on failure.
     1273 *
    12001274 * @param   cbSize      Size of memory to allocate.
     1275 *
     1276 * @remark  Don't think of calling this if you're not LIBC!
     1277 */
     1278void * __libc_spmAllocLocked(size_t cbSize)
     1279{
     1280    LIBCLOG_ENTER("cbSize=%d\n", cbSize);
     1281    void *pvRet = spmAlloc(cbSize);
     1282    LIBCLOG_RETURN_P(pvRet);
     1283}
     1284
     1285
     1286/**
     1287 * Free memory allocated by __libc_spmAllocLocked() or __libc_spmAlloc().
     1288 *
     1289 * The SPM must be locked using __libc_spmLock() prior to calling this function!
     1290 *
     1291 * @returns 0 on success.
     1292 * @returns -1 and errno on failure.
     1293 *
     1294 * @param   pv      Pointer to memory block returned by __libc_SpmAlloc().
     1295 *                  NULL is allowed.
     1296 * @remark  Don't think of calling this if you're not LIBC!
     1297 */
     1298int __libc_spmFreeLocked(void *pv)
     1299{
     1300    LIBCLOG_ENTER("pv=%p\n", pv);
     1301    int rc = spmFree(pv);
     1302    LIBCLOG_RETURN_INT(rc);
     1303}
     1304
     1305
     1306/**
     1307 * Allocate memory from the LIBC shared memory.
     1308 *
     1309 * @returns Pointer to allocated memory on success.
     1310 * @returns NULL on failure.
     1311 *
     1312 * @param   cbSize      Size of memory to allocate.
     1313 *
    12011314 * @remark  Don't think of calling this if you're not LIBC!
    12021315 */
     
    12341347
    12351348/**
    1236  * Free memory allocated by __libc_SpmAlloc().
     1349 * Free memory allocated by __libc_spmAlloc().
    12371350 *
    12381351 * @returns 0 on success.
     
    12801393
    12811394/**
    1282  * Register TCPIP termination handler.
     1395 * Register termination handler.
    12831396 *
    12841397 * This is a manual way of by passing a.out's broken weak symbols.
    12851398 */
    1286 void    __libc_spmSocketRegTerm(void (*pfnTerm)(void))
     1399void    __libc_spmRegTerm(void (*pfnTerm)(void))
    12871400{
    12881401    LIBCLOG_ENTER("pfnTerm=%p\n", (void *)pfnTerm);
    1289     if (    pfnTerm == gapfnSocketTerm[0]
    1290         ||  pfnTerm == gapfnSocketTerm[1])
     1402    if (    pfnTerm == gapfnExitList[0]
     1403        ||  pfnTerm == gapfnExitList[1]
     1404        ||  pfnTerm == gapfnExitList[2]
     1405        ||  pfnTerm == gapfnExitList[3])
    12911406        LIBCLOG_RETURN_VOID();
    12921407
    1293     if (!gapfnSocketTerm[0])
    1294         gapfnSocketTerm[0] = pfnTerm;
    1295     else if (!gapfnSocketTerm[1])
    1296         gapfnSocketTerm[1] = pfnTerm;
     1408    if (!gapfnExitList[0])
     1409        gapfnExitList[0] = pfnTerm;
     1410    else if (!gapfnExitList[1])
     1411        gapfnExitList[1] = pfnTerm;
     1412    else if (!gapfnExitList[2])
     1413        gapfnExitList[2] = pfnTerm;
     1414    else if (!gapfnExitList[3])
     1415        gapfnExitList[3] = pfnTerm;
    12971416    else
    1298         LIBC_ASSERTM_FAILED("There can only be two TCP/IP termination routines!!!!\n");
     1417        LIBC_ASSERTM_FAILED("There can only be 4 exit list routines!!!!\n");
    12991418
    13001419    LIBCLOG_RETURN_VOID();
     
    19322051/**
    19332052 * This function checks that there is at least 2k of writable
    1934  * stack available. If there isn't a crash is usually the
     2053 * stack available. If there isn't, a crash is usually the
    19352054 * result.
    19362055 * @internal
     
    22902409    {
    22912410        /*
    2292          * Terminate tcpip.
     2411         * Exist list callbacks .
    22932412         */
    2294         if (gapfnSocketTerm[0])
    2295             gapfnSocketTerm[0]();
    2296         if (gapfnSocketTerm[1])
    2297             gapfnSocketTerm[1]();
     2413        if (gapfnExitList[0])
     2414            gapfnExitList[0]();
     2415        if (gapfnExitList[1])
     2416            gapfnExitList[1]();
     2417        if (gapfnExitList[2])
     2418            gapfnExitList[2]();
     2419        if (gapfnExitList[3])
     2420            gapfnExitList[3]();
    22982421
    22992422        /*
  • trunk/src/emx/src/lib/sys/signals.c

    • Property cvs2svn:cvs-rev changed from 1.26 to 1.27
    r1983 r1984  
    10271027
    10281028    /*
     1029     * Does this thread have a notification callback?
     1030     */
     1031    if (pThrd->pfnSigCallback)
     1032        pThrd->pfnSigCallback(iSignalNo, pThrd->pvSigCallbackUser);
     1033
     1034    /*
    10291035     * Schedule the signal.
    10301036     */
     
    26242630
    26252631    /*
     2632     * Does this thread have a notification callback?
     2633     */
     2634    if (pThrd->pfnSigCallback)
     2635        pThrd->pfnSigCallback(0, pThrd->pvSigCallbackUser);
     2636
     2637    /*
    26262638     * Try schedule signals pending on 1st (SPM) and 2nd level (private).
    26272639     */
  • trunk/src/emx/src/lib/sys/tcpipver.c

    • Property cvs2svn:cvs-rev changed from 1.11 to 1.12
    r1983 r1984  
    13391339    static void *pfn = (void*)tcpipInit; /* reference hack */
    13401340    pfn = pfn;
    1341     __libc_spmSocketRegTerm(TCPNAME(Cleanup));
     1341    __libc_spmRegTerm(TCPNAME(Cleanup));
    13421342    LIBCLOG_RETURN_VOID();
    13431343}
Note: See TracChangeset for help on using the changeset viewer.