Home | History | Annotate | Download | only in lib
      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 <sys/ipc.h>
     28 #include <sys/shm.h>
     29 #include <errno.h>
     30 #include <wait.h>
     31 #include "test.h"
     32 
     33 #define SHM_RD	0400
     34 #define SHM_WR	0200
     35 #define SHM_RW	(SHM_RD|SHM_WR)
     36 
     37 #ifndef SHM_HUGETLB
     38 #define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
     39 #endif
     40 
     41 /*
     42  * to get the lower nine permission bits
     43  * from shmid_ds.ipc_perm.mode
     44  */
     45 #define MODE_MASK	0x01FF
     46 #define PATH_HUGEPAGES	"/sys/kernel/mm/hugepages/"
     47 
     48 key_t shmkey;			/* an IPC key generated by ftok() */
     49 
     50 void check_hugepage(void);
     51 
     52 int getipckey(void (*cleanup_fn) (void));
     53 int getuserid(void (*cleanup_fn) (void), char *user);
     54 void rm_shm(int shm_id);
     55 
     56 char *nr_opt;
     57 int sflag;
     58 long orig_hugepages;
     59 
     60 #endif /* hugetlb.h */
     61