• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2016 Xiao Yang <yangx.jy@cn.fujitsu.com>
3  *
4  * This program is free software;  you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY;  without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
12  * the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.
16  */
17 
18 /*
19  * common definitions for the IPC system calls.
20  */
21 
22 #ifndef __LIBNEWIPC_H
23 #define __LIBNEWIPC_H	1
24 
25 #include <time.h>
26 #include <sys/types.h>
27 
28 #define MSG_RD	0400
29 #define MSG_WR	0200
30 #define MSG_RW	(MSG_RD | MSG_WR)
31 #define MSGSIZE	1024
32 #define MSGTYPE	1
33 #define NR_MSGQUEUES	16
34 
35 #define SEM_RD	0400
36 #define SEM_ALT	0200
37 #define SEM_RA	(SEM_RD | SEM_ALT)
38 #define PSEMS	10
39 
40 #define SHM_RD	0400
41 #define SHM_WR	0200
42 #define SHM_RW	(SHM_RD | SHM_WR)
43 #define SHM_SIZE	2048
44 #define INT_SIZE	4
45 #define MODE_MASK	0x01FF
46 
47 key_t getipckey(const char *file, const int lineno);
48 #define GETIPCKEY() \
49 	getipckey(__FILE__, __LINE__)
50 
51 int get_used_sysvipc(const char *file, const int lineno, const char *sysvipc_file);
52 #define GET_USED_QUEUES() \
53 	get_used_sysvipc(__FILE__, __LINE__, "/proc/sysvipc/msg")
54 #define GET_USED_SEGMENTS() \
55 	get_used_sysvipc(__FILE__, __LINE__, "/proc/sysvipc/shm")
56 #define GET_USED_ARRAYS() \
57 	get_used_sysvipc(__FILE__, __LINE__, "/proc/sysvipc/sem")
58 
59 void *probe_free_addr(const char *file, const int lineno);
60 #define PROBE_FREE_ADDR() \
61 	probe_free_addr(__FILE__, __LINE__)
62 
63 #endif /* newlibipc.h */
64