summaryrefslogtreecommitdiffstats
path: root/src/kernel/tests/include/ipcshm.h
blob: 08307d4ab946b2d634f322534bc10f8e9d0294c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 *
 *   Copyright (c) International Business Machines  Corp., 2001
 *
 *   This program is free software;  you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 *   the GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program;  if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

/*
 * ipcshm.h - common definitions for the IPC shared memory tests
 */

#ifndef __IPCSHM_H
#define __IPCSHM_H

#include <errno.h>
#include <sys/wait.h>
#include <sys/ipc.h>
#include <sys/shm.h>

#include "test.h"

void cleanup(void);
void setup(void);

#define SHM_RD	0400
#define SHM_WR	0200
#define SHM_RW	SHM_RD | SHM_WR

#define SHM_SIZE	2048	/* a resonable size for a memory segment */
#define INT_SIZE	4	/* instead of sizeof(int) */

#define MODE_MASK	0x01FF	/* to get the lower nine permission bits */
				/* from shmid_ds.ipc_perm.mode		 */

key_t shmkey;			/* an IPC key generated by ftok() */

void rm_shm(int shm_id);

int getipckey();
int getuserid(char*);

#endif /* ipcshm.h */