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