xref: /aosp_15_r20/external/ltp/include/ipcsem.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  * ipcsem.h - common definitions for the IPC semaphore tests
22*49cdfc7eSAndroid Build Coastguard Worker  */
23*49cdfc7eSAndroid Build Coastguard Worker 
24*49cdfc7eSAndroid Build Coastguard Worker #ifndef __IPCSEM_H
25*49cdfc7eSAndroid Build Coastguard Worker #define __IPCSEM_H
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/sem.h>
30*49cdfc7eSAndroid Build Coastguard Worker 
31*49cdfc7eSAndroid Build Coastguard Worker #include "test.h"
32*49cdfc7eSAndroid Build Coastguard Worker #include "lapi/sem.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 SEM_RD	0400
38*49cdfc7eSAndroid Build Coastguard Worker #define SEM_ALT	0200
39*49cdfc7eSAndroid Build Coastguard Worker #define SEM_RA	SEM_RD | SEM_ALT
40*49cdfc7eSAndroid Build Coastguard Worker 
41*49cdfc7eSAndroid Build Coastguard Worker #define PSEMS	10		/* a reasonable value for the number of */
42*49cdfc7eSAndroid Build Coastguard Worker 				/* "primitive semaphores" per ID 	*/
43*49cdfc7eSAndroid Build Coastguard Worker 
44*49cdfc7eSAndroid Build Coastguard Worker #ifdef LIBIPC
45*49cdfc7eSAndroid Build Coastguard Worker key_t semkey;			/* an IPC key generated by ftok() */
46*49cdfc7eSAndroid Build Coastguard Worker #else
47*49cdfc7eSAndroid Build Coastguard Worker extern key_t semkey;	 	 /* an IPC key generated by ftok() */
48*49cdfc7eSAndroid Build Coastguard Worker #endif
49*49cdfc7eSAndroid Build Coastguard Worker 
50*49cdfc7eSAndroid Build Coastguard Worker void rm_sema(int sem_id);
51*49cdfc7eSAndroid Build Coastguard Worker 
52*49cdfc7eSAndroid Build Coastguard Worker int getipckey();
53*49cdfc7eSAndroid Build Coastguard Worker int getuserid(char *);
54*49cdfc7eSAndroid Build Coastguard Worker 
55*49cdfc7eSAndroid Build Coastguard Worker #endif /* ipcsem.h */
56