Back to index

glibc  2.9
param.h
Go to the documentation of this file.
00001 /* Copyright (C) 1995-1997,2000,2001,2003,2008 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _SYS_PARAM_H
00020 #define _SYS_PARAM_H 1
00021 
00022 #ifndef ARG_MAX
00023 # define __undef_ARG_MAX
00024 #endif
00025 
00026 #include <limits.h>
00027 #include <linux/limits.h>
00028 #include <linux/param.h>
00029 
00030 /* The kernel headers defines ARG_MAX.  The value is wrong, though.  */
00031 #ifndef __undef_ARG_MAX
00032 # undef ARG_MAX
00033 # undef __undef_ARG_MAX
00034 #endif
00035 
00036 /* BSD names for some <limits.h> values.  */
00037 
00038 #define       NBBY          CHAR_BIT
00039 #ifndef       NGROUPS
00040 # define NGROUPS     NGROUPS_MAX
00041 #endif
00042 #define       MAXSYMLINKS   20
00043 #define       CANBSIZ              MAX_CANON
00044 #define MAXPATHLEN   PATH_MAX
00045 /* The following are not really correct but it is a value we used for a
00046    long time and which seems to be usable.  People should not use NOFILE
00047    and NCARGS anyway.  */
00048 #define NOFILE              256
00049 #define       NCARGS        131072
00050 
00051 
00052 #include <sys/types.h>
00053 
00054 /* Bit map related macros.  */
00055 #define       setbit(a,i)   ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
00056 #define       clrbit(a,i)   ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
00057 #define       isset(a,i)    ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
00058 #define       isclr(a,i)    (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
00059 
00060 /* Macros for counting and rounding.  */
00061 #ifndef howmany
00062 # define howmany(x, y)      (((x) + ((y) - 1)) / (y))
00063 #endif
00064 #ifdef __GNUC__
00065 # define roundup(x, y)      (__builtin_constant_p (y) && powerof2 (y)       \
00066                       ? (((x) + (y) - 1) & ~((y) - 1))               \
00067                       : ((((x) + ((y) - 1)) / (y)) * (y)))
00068 #else
00069 # define roundup(x, y)      ((((x) + ((y) - 1)) / (y)) * (y))
00070 #endif
00071 #define powerof2(x)  ((((x) - 1) & (x)) == 0)
00072 
00073 /* Macros for min/max.  */
00074 #define       MIN(a,b) (((a)<(b))?(a):(b))
00075 #define       MAX(a,b) (((a)>(b))?(a):(b))
00076 
00077 
00078 /* Unit of `st_blocks'.  */
00079 #define DEV_BSIZE       512
00080 
00081 
00082 #endif /* sys/param.h */