1 /* 2 * Copyright (c) International Business Machines Corp., 2005 3 * Copyright (c) Wipro Technologies Ltd, 2005. All Rights Reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of version 2 of the GNU General Public License as 7 * published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it would be useful, but 10 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 * 13 * You should have received a copy of the GNU General Public License along 14 * with this program; if not, write the Free Software Foundation, Inc., 15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 * 17 */ 18 /********************************************************** 19 * 20 * TEST IDENTIFIER : getpagesize01 21 * 22 * EXECUTED BY : root / superuser 23 * 24 * TEST TITLE : Basic tests for getpagesize(2) 25 * 26 * TEST CASE TOTAL : 1 27 * 28 * AUTHOR : Prashant P Yendigeri 29 * <prashant.yendigeri@wipro.com> 30 * Robbie Williamson 31 * <robbiew@us.ibm.com> 32 * 33 * DESCRIPTION 34 * This is a Phase I test for the getpagesize(2) system call. 35 * It is intended to provide a limited exposure of the system call. 36 * 37 **********************************************************/ 38 39 #include <stdio.h> 40 #include <unistd.h> 41 #include <errno.h> 42 43 #include "test.h" 44 45 void setup(); 46 void cleanup(); 47 48 char *TCID = "getpagesize01"; 49 int TST_TOTAL = 1; 50 51 int main(int ac, char **av) 52 { 53 int lc; 54 55 int size, ret_sysconf; 56 /*************************************************************** 57 * parse standard options 58 ***************************************************************/ 59 tst_parse_opts(ac, av, NULL, NULL); 60 61 setup(); 62 63 for (lc = 0; TEST_LOOPING(lc); lc++) { 64 65 tst_count = 0; 66 67 TEST(getpagesize()); 68 69 if (TEST_RETURN == -1) { 70 tst_resm(TFAIL | TTERRNO, "getpagesize failed"); 71 continue; /* next loop for MTKERNEL */ 72 } 73 74 size = getpagesize(); 75 tst_resm(TINFO, "Page Size is %d", size); 76 ret_sysconf = sysconf(_SC_PAGESIZE); 77 #ifdef DEBUG 78 tst_resm(TINFO, 79 "Checking whether getpagesize returned same as sysconf"); 80 #endif 81 if (size == ret_sysconf) 82 tst_resm(TPASS, 83 "getpagesize - Page size returned %d", 84 ret_sysconf); 85 else 86 tst_resm(TFAIL, 87 "getpagesize - Page size returned %d", 88 ret_sysconf); 89 } 90 91 cleanup(); 92 tst_exit(); 93 } 94 95 void setup(void) 96 { 97 98 tst_sig(NOFORK, DEF_HANDLER, cleanup); 99 100 TEST_PAUSE; 101 } 102 103 void cleanup(void) 104 { 105 } 106