• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef SYS_SHM_H
2 #define SYS_SHM_H
3 
4 #define IPC_RMID	0x1
5 #define IPC_CREAT	0x2
6 #define IPC_PRIVATE	0x4
7 
8 typedef int uid_t;
9 typedef int gid_t;
10 
11 typedef int shmatt_t;
12 typedef int key_t;
13 
14 struct ipc_perm
15 {
16 	uid_t    uid;    /* owner's user ID */
17 	gid_t    gid;    /* owner's group ID */
18 	uid_t    cuid;   /* creator's user ID */
19 	gid_t    cgid;   /* creator's group ID */
20 	mode_t   mode;   /* read/write permission */
21 };
22 
23 
24 struct shmid_ds
25 {
26 	struct ipc_perm shm_perm;   /* operation permission structure */
27 	size_t          shm_segsz;  /* size of segment in bytes */
28 	pid_t           shm_lpid;   /* process ID of last shared memory operation */
29 	pid_t           shm_cpid;   /* process ID of creator */
30 	shmatt_t        shm_nattch; /* number of current attaches */
31 	time_t          shm_atime;  /* time of last shmat() */
32 	time_t          shm_dtime;  /* time of last shmdt() */
33 	time_t          shm_ctime;  /* time of last change by shmctl() */
34 };
35 
36 int shmctl(int shmid, int cmd, struct shmid_ds *buf);
37 int shmget(key_t key, size_t size, int shmflg);
38 void *shmat(int shmid, const void *shmaddr, int shmflg);
39 int shmdt(const void *shmaddr);
40 
41 #endif /* SYS_SHM_H */
42