]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/ipcutils.h
db85f57bc4b9cfcb8ff5ee3c2d00243a513ce419
1 #ifndef UTIL_LINUX_IPCUTILS_H
2 #define UTIL_LINUX_IPCUTILS_H
10 #include <sys/types.h>
18 * SHM_DEST and SHM_LOCKED are defined in kernel headers, but inside
19 * #ifdef __KERNEL__ ... #endif
22 /* shm_mode upper byte flags */
23 # define SHM_DEST 01000 /* segment will be destroyed on last detach */
24 # define SHM_LOCKED 02000 /* segment will not be swapped */
27 /* For older kernels the same holds for the defines below */
38 unsigned long shm_tot
; /* total allocated shm */
39 unsigned long shm_rss
; /* total resident shm */
40 unsigned long shm_swp
; /* total swapped shm */
41 unsigned long swap_attempts
;
42 unsigned long swap_successes
;
51 /* Some versions of libc only define IPC_INFO when __USE_GNU is defined. */
57 * * The last arg of semctl is a union semun, but where is it defined? X/OPEN
58 * * tells us to define it ourselves, but until recently Linux include files
59 * * would also define it.
61 #ifndef HAVE_UNION_SEMUN
62 /* according to X/OPEN we have to define it ourselves */
66 unsigned short int *array
;
67 struct seminfo
*__buf
;
72 * X/OPEN (Jan 1987) does not define fields key, seq in struct ipc_perm;
73 * glibc-1.09 has no support for sysv ipc.
74 * glibc 2 uses __key, __seq
76 #if defined (__GLIBC__) && __GLIBC__ >= 2
82 /* Size printing in ipcs is using these. */
91 uint64_t shmmni
; /* max number of segments */
92 uint64_t shmmax
; /* max segment size */
93 uint64_t shmall
; /* max total shared memory */
94 uint64_t shmmin
; /* min segment size */
96 int semmni
; /* max number of arrays */
97 int semmsl
; /* max semaphores per array */
98 int semmns
; /* max semaphores system wide */
99 int semopm
; /* max ops per semop call */
100 unsigned int semvmx
; /* semaphore max value (constant) */
102 int msgmni
; /* max queues system wide */
103 uint64_t msgmax
; /* max size of message */
104 int msgmnb
; /* default max size of queue */
107 extern int ipc_msg_get_limits(struct ipc_limits
*lim
);
108 extern int ipc_sem_get_limits(struct ipc_limits
*lim
);
109 extern int ipc_shm_get_limits(struct ipc_limits
*lim
);
114 uid_t uid
; /* current uid */
115 gid_t gid
; /* current gid */
116 uid_t cuid
; /* creator uid */
117 gid_t cgid
; /* creator gid */
121 extern void ipc_print_perms(FILE *f
, struct ipc_stat
*is
);
122 extern void ipc_print_size(int unit
, char *msg
, uint64_t size
, const char *end
, int width
);
124 /* See 'struct shmid_kernel' in kernel sources
127 struct ipc_stat shm_perm
;
131 int64_t shm_atim
; /* __kernel_time_t is signed long */
139 struct shm_data
*next
;
142 extern int ipc_shm_get_info(int id
, struct shm_data
**shmds
);
143 extern void ipc_shm_free_info(struct shm_data
*shmds
);
145 /* See 'struct sem_array' in kernel sources
149 int ncount
; /* processes waiting on increase semval */
150 int zcount
; /* processes waiting on semval set to zero */
151 pid_t pid
; /* process last executed semop(2) call */
154 struct ipc_stat sem_perm
;
160 struct sem_elem
*elements
;
161 struct sem_data
*next
;
164 extern int ipc_sem_get_info(int id
, struct sem_data
**semds
);
165 extern void ipc_sem_free_info(struct sem_data
*semds
);
167 /* See 'struct msg_queue' in kernel sources
170 struct ipc_stat msg_perm
;
181 struct msg_data
*next
;
184 extern int ipc_msg_get_info(int id
, struct msg_data
**msgds
);
185 extern void ipc_msg_free_info(struct msg_data
*msgds
);
187 #endif /* UTIL_LINUX_IPCUTILS_H */