]>
Commit | Line | Data |
---|---|---|
f449bfef RC |
1 | /* sys/shm.h |
2 | ||
1c001dd2 | 3 | Copyright 2001, 2002 Red Hat Inc. |
f449bfef RC |
4 | Written by Robert Collins <rbtcollins@hotmail.com> |
5 | ||
6 | This file is part of Cygwin. | |
7 | ||
8 | This software is a copyrighted work licensed under the terms of the | |
9 | Cygwin license. Please consult the file "CYGWIN_LICENSE" for | |
10 | details. */ | |
11 | ||
1c001dd2 CS |
12 | #ifndef _SYS_SHM_H |
13 | #define _SYS_SHM_H | |
14 | ||
15 | #include <cygwin/ipc.h> | |
16 | ||
f449bfef RC |
17 | #ifdef __cplusplus |
18 | extern "C" | |
19 | { | |
20 | #endif | |
21 | ||
1c001dd2 CS |
22 | /* 64 Kb was hardcoded for x86. MS states this may change, but we need |
23 | * it in the header file. | |
24 | */ | |
25 | #define SHMLBA 65536 /* Segment low boundary address multiple. */ | |
f449bfef | 26 | |
1c001dd2 | 27 | /* Shared memory operation flags: |
f449bfef | 28 | */ |
1c001dd2 CS |
29 | #define SHM_RDONLY 0x01 /* Attach read-only (else read-write). */ |
30 | #define SHM_RND 0x02 /* Round attach address to SHMLBA. */ | |
f449bfef | 31 | |
1c001dd2 CS |
32 | /* Command definitions for the semctl () function: |
33 | */ | |
34 | #define SHM_STAT 0x4000 /* For ipcs(8) */ | |
35 | #define SHM_INFO 0x4001 /* For ipcs(8) */ | |
f449bfef | 36 | |
1c001dd2 CS |
37 | /* Unsigned integer used for the number of current attaches. |
38 | */ | |
39 | typedef unsigned int shmatt_t; | |
f449bfef | 40 | |
1c001dd2 CS |
41 | struct shmid_ds |
42 | { | |
43 | struct ipc_perm shm_perm; /* Operation permission structure. */ | |
44 | size_t shm_segsz; /* Size of segment in bytes. */ | |
45 | pid_t shm_lpid; /* Process ID of last operation. */ | |
46 | pid_t shm_cpid; /* Process ID of creator. */ | |
47 | shmatt_t shm_nattch; /* Number of current attaches. */ | |
48 | timestruc_t shm_atim; /* Time of last shmat (). */ | |
49 | timestruc_t shm_dtim; /* Time of last shmdt (). */ | |
50 | timestruc_t shm_ctim; /* Time of last change by shmctl (). */ | |
51 | long shm_spare4[2]; | |
f449bfef RC |
52 | }; |
53 | ||
1c001dd2 CS |
54 | #define shm_atime shm_atim.tv_sec |
55 | #define shm_dtime shm_dtim.tv_sec | |
56 | #define shm_ctime shm_ctim.tv_sec | |
f449bfef | 57 | |
1c001dd2 CS |
58 | /* Buffer type for shmctl (IPC_INFO, ...) as used by ipcs(8). |
59 | */ | |
60 | struct shminfo | |
61 | { | |
62 | unsigned long shmmax; /* Maximum size in bytes of a shared | |
63 | memory segment. */ | |
64 | unsigned long shmmin; /* Minimum size in bytes of a shared | |
65 | memory segment. */ | |
66 | unsigned long shmmni; /* Maximum number of shared memory | |
67 | segments, system wide. */ | |
68 | unsigned long shmseg; /* Maximum number of shared memory | |
69 | segments attached per process. */ | |
70 | unsigned long shmall; /* Maximum number of bytes of shared | |
71 | memory, system wide. */ | |
72 | unsigned long shm_spare[4]; | |
f449bfef RC |
73 | }; |
74 | ||
1c001dd2 | 75 | /* Buffer type for shmctl (SHM_INFO, ...) as used by ipcs(8). |
f449bfef | 76 | */ |
1c001dd2 CS |
77 | struct shm_info |
78 | { | |
79 | unsigned long shm_ids; /* Number of allocated segments. */ | |
80 | unsigned long shm_tot; /* Size in bytes of allocated segments. */ | |
81 | unsigned long shm_atts; /* Number of attached segments, system | |
82 | wide. */ | |
f449bfef | 83 | }; |
f449bfef | 84 | |
1c001dd2 CS |
85 | void *shmat (int shmid, const void *shmaddr, int shmflg); |
86 | int shmctl (int shmid, int cmd, struct shmid_ds *buf); | |
87 | int shmdt (const void *shmaddr); | |
88 | int shmget (key_t key, size_t size, int shmflg); | |
f449bfef RC |
89 | |
90 | #ifdef __cplusplus | |
91 | } | |
92 | #endif | |
1c001dd2 CS |
93 | |
94 | #endif /* _SYS_SHM_H */ |