plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (c) International Business Machines Corp., 2001 |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 13 | * the GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
Wanlong Gao | 4548c6c | 2012-10-19 18:03:36 +0800 | [diff] [blame] | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | /* |
| 21 | * ipcshm.h - common definitions for the IPC shared memory tests |
| 22 | */ |
| 23 | |
| 24 | #ifndef __IPCSHM_H |
| 25 | #define __IPCSHM_H |
| 26 | |
| 27 | #include <errno.h> |
robbiew | b682d46 | 2003-03-27 16:01:39 +0000 | [diff] [blame] | 28 | #include <wait.h> |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 29 | #include <sys/ipc.h> |
| 30 | #include <sys/shm.h> |
| 31 | |
| 32 | #include "test.h" |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 33 | |
| 34 | void cleanup(void); |
| 35 | void setup(void); |
| 36 | |
| 37 | #define SHM_RD 0400 |
| 38 | #define SHM_WR 0200 |
| 39 | #define SHM_RW SHM_RD | SHM_WR |
| 40 | |
| 41 | #define SHM_SIZE 2048 /* a resonable size for a memory segment */ |
| 42 | #define INT_SIZE 4 /* instead of sizeof(int) */ |
| 43 | |
| 44 | #define MODE_MASK 0x01FF /* to get the lower nine permission bits */ |
| 45 | /* from shmid_ds.ipc_perm.mode */ |
| 46 | |
| 47 | key_t shmkey; /* an IPC key generated by ftok() */ |
| 48 | |
robbiew | 23499f0 | 2002-11-18 19:54:58 +0000 | [diff] [blame] | 49 | void rm_shm(int shm_id); |
robbiew | 23499f0 | 2002-11-18 19:54:58 +0000 | [diff] [blame] | 50 | |
| 51 | int getipckey(); |
| 52 | int getuserid(char*); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 53 | |
| 54 | #endif /* ipcshm.h */ |