1 /* Copyright (C) 1995-1997,2000,2001,2003,2008 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 #ifndef _SYS_PARAM_H 19 #define _SYS_PARAM_H 1 20 21 #ifndef ARG_MAX 22 # define __undef_ARG_MAX 23 #endif 24 25 #include <limits.h> 26 #include <linux/limits.h> 27 #include <linux/param.h> 28 29 /* The kernel headers defines ARG_MAX. The value is wrong, though. */ 30 #ifndef __undef_ARG_MAX 31 # undef ARG_MAX 32 # undef __undef_ARG_MAX 33 #endif 34 35 /* BSD names for some <limits.h> values. */ 36 37 #define NBBY CHAR_BIT 38 #ifndef NGROUPS 39 # define NGROUPS NGROUPS_MAX 40 #endif 41 #define MAXSYMLINKS 20 42 #define CANBSIZ MAX_CANON 43 #define MAXPATHLEN PATH_MAX 44 /* The following are not really correct but it is a value we used for a 45 long time and which seems to be usable. People should not use NOFILE 46 and NCARGS anyway. */ 47 #define NOFILE 256 48 #define NCARGS 131072 49 50 51 #include <sys/types.h> 52 53 /* Bit map related macros. */ 54 #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 55 #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 56 #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 57 #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 58 59 /* Macros for counting and rounding. */ 60 #ifndef howmany 61 # define howmany(x, y) (((x) + ((y) - 1)) / (y)) 62 #endif 63 #ifdef __GNUC__ 64 # define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \ 65 ? (((x) + (y) - 1) & ~((y) - 1)) \ 66 : ((((x) + ((y) - 1)) / (y)) * (y))) 67 #else 68 # define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 69 #endif 70 #define powerof2(x) ((((x) - 1) & (x)) == 0) 71 72 /* Macros for min/max. */ 73 #define MIN(a,b) (((a)<(b))?(a):(b)) 74 #define MAX(a,b) (((a)>(b))?(a):(b)) 75 76 77 /* Unit of `st_blocks'. */ 78 #define DEV_BSIZE 512 79 80 81 #endif /* sys/param.h */ 82