PageRenderTime 29ms CodeModel.GetById 15ms app.highlight 11ms RepoModel.GetById 2ms app.codeStats 0ms

/src/core/sys/posix/sys/shm.d

http://github.com/AlexeyProkhin/druntime
D | 126 lines | 71 code | 14 blank | 41 comment | 2 complexity | 7f714732154d6dcd3fbaa43caa584035 MD5 | raw file
  1/**
  2 * D header file for POSIX.
  3 *
  4 * Copyright: Copyright Sean Kelly 2005 - 2009.
  5 * License:   <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
  6 * Authors:   Sean Kelly
  7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
  8 */
  9
 10/*          Copyright Sean Kelly 2005 - 2009.
 11 * Distributed under the Boost Software License, Version 1.0.
 12 *    (See accompanying file LICENSE or copy at
 13 *          http://www.boost.org/LICENSE_1_0.txt)
 14 */
 15module core.sys.posix.sys.shm;
 16
 17private import core.sys.posix.config;
 18public import core.sys.posix.sys.types; // for pid_t, time_t, key_t, size_t
 19public import core.sys.posix.sys.ipc;
 20
 21version (Posix):
 22extern (C):
 23
 24//
 25// XOpen (XSI)
 26//
 27/*
 28SHM_RDONLY
 29SHM_RND
 30
 31SHMLBA
 32
 33shmatt_t
 34
 35struct shmid_ds
 36{
 37    ipc_perm    shm_perm;
 38    size_t      shm_segsz;
 39    pid_t       shm_lpid;
 40    pid_t       shm_cpid;
 41    shmatt_t    shm_nattch;
 42    time_t      shm_atime;
 43    time_t      shm_dtime;
 44    time_t      shm_ctime;
 45}
 46
 47void* shmat(int, in void*, int);
 48int   shmctl(int, int, shmid_ds*);
 49int   shmdt(in void*);
 50int   shmget(key_t, size_t, int);
 51*/
 52
 53version( linux )
 54{
 55    enum SHM_RDONLY     = 0x01000; // 010000
 56    enum SHM_RND        = 0x02000; // 020000
 57
 58    int   __getpagesize();
 59    alias __getpagesize SHMLBA;
 60
 61    alias c_ulong   shmatt_t;
 62
 63    struct shmid_ds
 64    {
 65        ipc_perm    shm_perm;
 66        size_t      shm_segsz;
 67        time_t      shm_atime;
 68        c_ulong     __unused1;
 69        time_t      shm_dtime;
 70        c_ulong     __unused2;
 71        time_t      shm_ctime;
 72        c_ulong     __unused3;
 73        pid_t       shm_cpid;
 74        pid_t       shm_lpid;
 75        shmatt_t    shm_nattch;
 76        c_ulong     __unused4;
 77        c_ulong     __unused5;
 78    }
 79
 80    void* shmat(int, in void*, int);
 81    int   shmctl(int, int, shmid_ds*);
 82    int   shmdt(in void*);
 83    int   shmget(key_t, size_t, int);
 84}
 85else version( FreeBSD )
 86{
 87    enum SHM_RDONLY     = 0x01000; // 010000
 88    enum SHM_RND        = 0x02000; // 020000
 89    enum SHMLBA         = 1 << 12; // PAGE_SIZE = (1<<PAGE_SHIFT)
 90
 91    alias c_ulong   shmatt_t;
 92
 93    struct shmid_ds_old // <= FreeBSD7
 94    {
 95        ipc_perm_old    shm_perm;
 96        int             shm_segsz;
 97        pid_t           shm_lpid;
 98        pid_t           shm_cpid;
 99        short           shm_nattch;
100        time_t          shm_atime;
101        time_t          shm_dtime;
102        time_t          shm_ctime;
103        void*           shm_internal;
104    }
105
106    struct shmid_ds
107    {
108         ipc_perm    shm_perm;
109         int         shm_segsz;
110         pid_t       shm_lpid;
111         pid_t       shm_cpid;
112         short       shm_nattch;
113         time_t      shm_atime;
114         time_t      shm_dtime;
115         time_t      shm_ctime;
116    }
117
118    void* shmat(int, in void*, int);
119    int   shmctl(int, int, shmid_ds*);
120    int   shmdt(in void*);
121    int   shmget(key_t, size_t, int);
122}
123else version( OSX )
124{
125
126}