make includes fix from trunk
[minix.git] / include / sys / shm.h
blob78fcec1b6c37b3d147250967004a16d5143ba5b8
1 #ifndef _SYS_SHM_H
2 #define _SYS_SHM_H
4 #include <sys/types.h>
5 #include <sys/ipc.h>
7 #include <unistd.h>
9 typedef unsigned long int shmatt_t;
11 #define SHMLBA getpagesize()
12 #define SHMMNI 4096
13 #define SHMSEG 32 /* max shared segs per process */
15 struct shmid_ds
17 struct ipc_perm shm_perm; /* Ownership and permissions */
18 size_t shm_segsz; /* Size of segment (bytes) */
19 time_t shm_atime; /* Last attach time */
20 time_t shm_dtime; /* Last detach time */
21 time_t shm_ctime; /* Last change time */
22 pid_t shm_cpid; /* PID of creator */
23 pid_t shm_lpid; /* PID of last shmat()/shmdt() */
24 shmatt_t shm_nattch; /* No. of current attaches */
27 /* Permission flag for shmget. */
28 #define SHM_R 0400
29 #define SHM_W 0200
31 #define SHM_RDONLY 010000 /* attach read-only else read-write */
32 #define SHM_RND 020000 /* round attach address to SHMLBA */
34 /* shm_mode upper byte flags */
35 #define SHM_DEST 01000 /* segment will be destroyed on last detach */
36 #define SHM_LOCKED 02000 /* segment will not be swapped */
38 /* ipcs ctl commands */
39 #define SHM_STAT 13
40 #define SHM_INFO 14
42 struct shminfo
44 unsigned long int shmmax;
45 unsigned long int shmmin;
46 unsigned long int shmmni;
47 unsigned long int shmseg;
48 unsigned long int shmall;
51 struct shm_info
53 int used_ids;
54 unsigned long int shm_tot; /* total allocated shm */
55 unsigned long int shm_rss; /* total resident shm */
56 unsigned long int shm_swp; /* total swapped shm */
57 unsigned long int swap_attempts;
58 unsigned long int swap_successes;
61 /* The following System V style IPC functions implement a shared memory
62 * facility. The definition is found in XPG4.2.
65 /* Shared memory control operation. */
66 _PROTOTYPE( int shmctl, (int __shmid, int __cmd, struct shmid_ds *__buf));
68 /* Get shared memory segment. */
69 _PROTOTYPE( int shmget, (key_t __key, size_t __size, int __shmflg));
71 /* Attach shared memory segment. */
72 _PROTOTYPE( void *shmat, (int __shmid, const void *__shmaddr, int __shmflg));
74 /* Deattach shared memory segment. */
75 _PROTOTYPE( int shmdt, (const void *__shmaddr));
77 #endif /* _SYS_SHM_H */