xref: /aosp_15_r20/external/ltp/include/ipcmsg.h (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker /*
2*49cdfc7eSAndroid Build Coastguard Worker  *
3*49cdfc7eSAndroid Build Coastguard Worker  *   Copyright (c) International Business Machines  Corp., 2001
4*49cdfc7eSAndroid Build Coastguard Worker  *
5*49cdfc7eSAndroid Build Coastguard Worker  *   This program is free software;  you can redistribute it and/or modify
6*49cdfc7eSAndroid Build Coastguard Worker  *   it under the terms of the GNU General Public License as published by
7*49cdfc7eSAndroid Build Coastguard Worker  *   the Free Software Foundation; either version 2 of the License, or
8*49cdfc7eSAndroid Build Coastguard Worker  *   (at your option) any later version.
9*49cdfc7eSAndroid Build Coastguard Worker  *
10*49cdfc7eSAndroid Build Coastguard Worker  *   This program is distributed in the hope that it will be useful,
11*49cdfc7eSAndroid Build Coastguard Worker  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12*49cdfc7eSAndroid Build Coastguard Worker  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13*49cdfc7eSAndroid Build Coastguard Worker  *   the GNU General Public License for more details.
14*49cdfc7eSAndroid Build Coastguard Worker  *
15*49cdfc7eSAndroid Build Coastguard Worker  *   You should have received a copy of the GNU General Public License
16*49cdfc7eSAndroid Build Coastguard Worker  *   along with this program;  if not, write to the Free Software
17*49cdfc7eSAndroid Build Coastguard Worker  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*49cdfc7eSAndroid Build Coastguard Worker  */
19*49cdfc7eSAndroid Build Coastguard Worker 
20*49cdfc7eSAndroid Build Coastguard Worker /*
21*49cdfc7eSAndroid Build Coastguard Worker  * ipcmsg.h - common definitions for the IPC message tests.
22*49cdfc7eSAndroid Build Coastguard Worker  */
23*49cdfc7eSAndroid Build Coastguard Worker 
24*49cdfc7eSAndroid Build Coastguard Worker #ifndef __IPCMSG_H
25*49cdfc7eSAndroid Build Coastguard Worker #define __IPCMSG_H	1
26*49cdfc7eSAndroid Build Coastguard Worker 
27*49cdfc7eSAndroid Build Coastguard Worker #include <errno.h>
28*49cdfc7eSAndroid Build Coastguard Worker #include <sys/ipc.h>
29*49cdfc7eSAndroid Build Coastguard Worker #include <sys/msg.h>
30*49cdfc7eSAndroid Build Coastguard Worker #include <sys/types.h>
31*49cdfc7eSAndroid Build Coastguard Worker 
32*49cdfc7eSAndroid Build Coastguard Worker #include "test.h"
33*49cdfc7eSAndroid Build Coastguard Worker 
34*49cdfc7eSAndroid Build Coastguard Worker void cleanup(void);
35*49cdfc7eSAndroid Build Coastguard Worker void setup(void);
36*49cdfc7eSAndroid Build Coastguard Worker 
37*49cdfc7eSAndroid Build Coastguard Worker #define MSG_RD  0400            /* read permission for the queue */
38*49cdfc7eSAndroid Build Coastguard Worker #define MSG_WR  0200            /* write permission for the queue */
39*49cdfc7eSAndroid Build Coastguard Worker #define MSG_RW	MSG_RD | MSG_WR
40*49cdfc7eSAndroid Build Coastguard Worker 
41*49cdfc7eSAndroid Build Coastguard Worker #define MSGSIZE	1024		/* a resonable size for a message */
42*49cdfc7eSAndroid Build Coastguard Worker #define MSGTYPE 1		/* a type ID for a message */
43*49cdfc7eSAndroid Build Coastguard Worker 
44*49cdfc7eSAndroid Build Coastguard Worker #define NR_MSGQUEUES	16	/* MSGMNI as defined in linux/msg.h */
45*49cdfc7eSAndroid Build Coastguard Worker 
46*49cdfc7eSAndroid Build Coastguard Worker typedef struct mbuf {		/* a generic message structure */
47*49cdfc7eSAndroid Build Coastguard Worker 	long mtype;
48*49cdfc7eSAndroid Build Coastguard Worker 	char mtext[MSGSIZE + 1];  /* add 1 here so the message can be 1024   */
49*49cdfc7eSAndroid Build Coastguard Worker } MSGBUF;			  /* characters long with a '\0' termination */
50*49cdfc7eSAndroid Build Coastguard Worker 
51*49cdfc7eSAndroid Build Coastguard Worker #ifdef LIBIPC
52*49cdfc7eSAndroid Build Coastguard Worker key_t msgkey;                   /* the ftok() generated message key */
53*49cdfc7eSAndroid Build Coastguard Worker #else
54*49cdfc7eSAndroid Build Coastguard Worker extern key_t msgkey;                   /* the ftok() generated message key */
55*49cdfc7eSAndroid Build Coastguard Worker #endif
56*49cdfc7eSAndroid Build Coastguard Worker 
57*49cdfc7eSAndroid Build Coastguard Worker void init_buf(MSGBUF *, int, int);
58*49cdfc7eSAndroid Build Coastguard Worker void rm_queue(int);
59*49cdfc7eSAndroid Build Coastguard Worker 
60*49cdfc7eSAndroid Build Coastguard Worker key_t getipckey();
61*49cdfc7eSAndroid Build Coastguard Worker int getuserid(char *);
62*49cdfc7eSAndroid Build Coastguard Worker 
63*49cdfc7eSAndroid Build Coastguard Worker int get_max_msgqueues(void);
64*49cdfc7eSAndroid Build Coastguard Worker int get_used_msgqueues(void);
65*49cdfc7eSAndroid Build Coastguard Worker 
66*49cdfc7eSAndroid Build Coastguard Worker #endif /* ipcmsg.h */
67