Changeset 1986 for trunk/src/emx/include


Ignore:
Timestamp:
May 9, 2005, 7:02:45 AM (20 years ago)
Author:
bird
Message:

SysV Shared Memory.

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

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.23 to 1.24
    r1985 r1986  
    894894/** @defgroup grp_Back_sysvipc LIBC Backend - SysV IPC
    895895 * @{ */
     896
     897/**
     898 * sysget syscall.
     899 */
     900int __libc_Back_sysvSemGet(key_t key, int nsems, int semflg);
     901
     902/**
     903 * semop syscall.
     904 */
     905int __libc_Back_sysvSemOp(int semid, struct sembuf *sops_user, size_t nsops);
     906
    896907/**
    897908 * semctl syscall
     
    899910int __libc_Back_sysvSemCtl(int semid, int semnum, int cmd, union semun real_arg);
    900911
    901 /**
    902  * sysget syscall.
    903  */
    904 int __libc_Back_sysvSemGet(key_t key, int nsems, int semflg);
    905 
    906 /**
    907  * semop syscall.
    908  */
    909 int __libc_Back_sysvSemOp(int semid, struct sembuf *sops_user, size_t nsops);
     912
     913/**
     914 * shmget.
     915 */
     916int __libc_Back_sysvShmGet(key_t key, size_t size, int shmflg);
     917
     918/**
     919 * shmat.
     920 */
     921int __libc_Back_sysvShmAt(int shmid, const void *shmaddr, int shmflg, void **ppvActual);
     922
     923/**
     924 * shmdt.
     925 */
     926int __libc_Back_sysvShmDt(const void *shmaddr);
     927
     928/**
     929 * shmctl.
     930 */
     931int __libc_Back_sysvShmCtl(int shmid, int cmd, struct shmid_ds *bufptr);
     932
     933/** @} */
     934
     935
     936/** @defgroup grp_Back_safesem LIBC Backend - Internal Signal-Safe Semaphores.
     937 * @{ */
     938
     939/**
     940 * Creates a safe mutex sem.
     941 *
     942 * @returns 0 on success.
     943 * @returns Negative error code (errno.h) on failure.
     944 * @param   phmtx       Where to store the semaphore handle.
     945 * @param   fShared     Set if the semaphore should be sharable between processes.
     946 */
     947int __libc_Back_safesemMtxCreate(uintptr_t *phmtx, int fShared);
     948
     949/**
     950 * Opens a shared safe mutex sem.
     951 *
     952 * @returns 0 on success.
     953 * @returns Negative error code (errno.h) on failure.
     954 * @param   hmtx        The semaphore handle.
     955 */
     956int __libc_Back_safesemMtxOpen(uintptr_t hmtx);
     957
     958/**
     959 * Closes a shared safe mutex sem.
     960 *
     961 * @returns 0 on success.
     962 * @returns Negative error code (errno.h) on failure.
     963 * @param   hmtx        The semaphore handle.
     964 */
     965int __libc_Back_safesemMtxClose(uintptr_t hmtx);
     966
     967/**
     968 * Locks a mutex semaphore.
     969 *
     970 * @returns 0 on success.
     971 * @returns Negative errno on failure.
     972 * @param   hmtx    Handle to the mutex.
     973 */
     974int __libc_Back_safesemMtxLock(uintptr_t hmtx);
     975
     976/**
     977 * Unlocks a mutex semaphore.
     978 *
     979 * @returns 0 on success.
     980 * @returns Negative errno on failure.
     981 * @param   hmtx    Handle to the mutex.
     982 */
     983int __libc_Back_safesemMtxUnlock(uintptr_t hmtx);
     984
     985/**
     986 * Creates a safe event sem.
     987 *
     988 * @returns 0 on success.
     989 * @returns Negative error code (errno.h) on failure.
     990 * @param   phev        Where to store the semaphore handle.
     991 * @param   fShared     Set if the semaphore should be sharable between processes.
     992 */
     993int __libc_Back_safesemEvCreate(uintptr_t *phev, int fShared);
     994
     995/**
     996 * Opens a shared safe event sem.
     997 *
     998 * @returns 0 on success.
     999 * @returns Negative error code (errno.h) on failure.
     1000 * @param   hev         The semaphore handle.
     1001 */
     1002int __libc_Back_safesemEvOpen(uintptr_t hev);
     1003
     1004/**
     1005 * Closes a shared safe mutex sem.
     1006 *
     1007 * @returns 0 on success.
     1008 * @returns Negative error code (errno.h) on failure.
     1009 * @param   hev         The semaphore handle.
     1010 */
     1011int __libc_Back_safesemEvClose(uintptr_t hev);
     1012
     1013/**
     1014 * Sleep on a semaphore.
     1015 *
     1016 * This is the most difficult thing we're doing in this file.
     1017 *
     1018 * @returns 0 on success.
     1019 * @returns Negative error code (errno.h) on failure.
     1020 *
     1021 * @param   hev         The semaphore to sleep on.
     1022 * @param   hmtx        The semaphore protecting hev and which is to be unlocked while
     1023 *                      sleeping and reaquired upon waking up.
     1024 * @param   pfnComplete Function to execute on signal and on wait completion.
     1025 * @param   pvUser      User argument to pfnComplete.
     1026 */
     1027int __libc_Back_safesemEvSleep(uintptr_t hev, uintptr_t hmtx, void (*pfnComplete)(void *pvUser), void *pvUser);
     1028
     1029/**
     1030 * Wakes up all threads sleeping on a given event semaphore.
     1031 *
     1032 * @returns 0 on success.
     1033 * @returns Negative error code (errno.h) on failure.
     1034 * @param   hev         Event semaphore to post.
     1035 */
     1036int __libc_Back_safesemEvWakeup(uintptr_t hev);
     1037
    9101038
    9111039/** @} */
  • trunk/src/emx/include/InnoTekLIBC/logstrict.h

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r1985 r1986  
    184184#define __LIBC_LOG_GRP_MMAN         16
    185185
     186/** Backend SysV IPC APIs. */
     187#define __LIBC_LOG_GRP_BACK_IPC     17
    186188/** Backend Thread APIs. */
    187189#define __LIBC_LOG_GRP_BACK_THREAD  18
  • trunk/src/emx/include/InnoTekLIBC/sharedpm.h

    • Property cvs2svn:cvs-rev changed from 1.22 to 1.23
    r1985 r1986  
    557557    /** 116 - Pointer to SysV Sempahore globals. */
    558558    struct __libc_SysV_Sem             *pSysVSem;
    559 
    560     /*  120 - The rest of the block, up to cbProcess, is undefined in this version.
     559    /** 120 - Pointer to SysV Shared Memory globals. */
     560    struct __libc_SysV_Shm             *pSysVShm;
     561    /** 124 - Pointer to SysV Message Queue globals. */
     562    struct __libc_SysV_Msg             *pSysVMsg;
     563
     564    /*  128 - The rest of the block, up to cbProcess, is undefined in this version.
    561565     * Future versions of LIBC may use this area assuming it's initalized with zeros.
    562566     */
  • trunk/src/emx/include/sys/shm.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1985 r1986  
    3939/** @file
    4040 * FreeBSD 5.3
     41 * @changed the SHMLBA to 64KB.
    4142 */
    4243
     
    4849#define SHM_RDONLY  010000  /* Attach read-only (else read-write) */
    4950#define SHM_RND     020000  /* Round attach address to SHMLBA */
    50 #define SHMLBA      PAGE_SIZE /* Segment low boundary address multiple */
     51#define SHMLBA      (0x10000) /* Segment low boundary address multiple */
    5152
    5253/* "official" access mode definitions; somewhat braindead since you have
     
    6364#define SHM_INFO        14
    6465
     66#ifdef __EMX__
     67typedef __uint32_t shmatt_t;
     68#endif
     69
    6570struct shmid_ds {
    6671        struct ipc_perm shm_perm;       /* operation permission structure */
     72#ifdef __EMX__
     73        size_t          shm_segsz;      /* size of segment in bytes */
     74#else
    6775        int             shm_segsz;      /* size of segment in bytes */
     76#endif
    6877        pid_t           shm_lpid;   /* process ID of last shared memory op */
    6978        pid_t           shm_cpid;       /* process ID of creator */
    70         short           shm_nattch;     /* number of current attaches */
     79#ifdef __EMX__
     80        shmatt_t        shm_nattch;     /* number of current attaches */
     81#else
     82        short           shm_nattch;     /* number of current attaches */
     83#endif
    7184        time_t          shm_atime;      /* time of last shmat() */
    7285        time_t          shm_dtime;      /* time of last shmdt() */
     
    88101                shmall;         /* max amount of shared memory (pages) */
    89102};
     103#ifndef __EMX__
    90104extern struct shminfo   shminfo;
    91105extern struct shmid_ds  *shmsegs;
     106#endif
    92107
    93108struct shm_info {
     
    100115};
    101116
     117#ifndef __EMX__
    102118struct thread;
    103119struct proc;
     
    106122void    shmexit(struct vmspace *);
    107123void    shmfork(struct proc *, struct proc *);
     124#endif /* !__EMX__ */
    108125#else /* !_KERNEL */
    109126
     
    116133
    117134__BEGIN_DECLS
     135#ifndef __EMX__
    118136int shmsys(int, ...);
     137#endif
    119138void *shmat(int, const void *, int);
    120139int shmget(key_t, size_t, int);
Note: See TracChangeset for help on using the changeset viewer.