param.h 2.2 KB

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