• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 /*
21  * hugetlb.h - common definitions for the hugepage tests
22  */
23 
24 #ifndef __HUGETLB_H
25 #define __HUGETLB_H
26 
27 #include <stdlib.h>
28 #include <sys/ipc.h>
29 #include <sys/shm.h>
30 #include <errno.h>
31 #include <sys/wait.h>
32 #include "tst_test.h"
33 #include "old_tmpdir.h"
34 #include "mem.h"
35 
36 #define SHM_RD	0400
37 #define SHM_WR	0200
38 #define SHM_RW	(SHM_RD|SHM_WR)
39 
40 #ifndef SHM_HUGETLB
41 #define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
42 #endif
43 
44 /*
45  * to get the lower nine permission bits
46  * from shmid_ds.ipc_perm.mode
47  */
48 #define MODE_MASK	0x01FF
49 
50 key_t shmkey;			/* an IPC key generated by ftok() */
51 
52 int getipckey(void);
53 int getuserid(char *user);
54 void rm_shm(int shm_id);
55 
56 char *nr_opt;
57 char *Hopt;
58 void check_hugepage(void);
59 long save_nr_hugepages(void);
60 void restore_nr_hugepages(void);
61 
62 #endif /* hugetlb.h */
63