param.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* Copyright (C) 1995-1997,2000,2001,2003,2008 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, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _SYS_PARAM_H
  15. #define _SYS_PARAM_H 1
  16. #ifndef ARG_MAX
  17. # define __undef_ARG_MAX
  18. #endif
  19. #include <limits.h>
  20. #include <linux/limits.h>
  21. #include <linux/param.h>
  22. /* The kernel headers defines ARG_MAX. The value is wrong, though. */
  23. #ifndef __undef_ARG_MAX
  24. # undef ARG_MAX
  25. # undef __undef_ARG_MAX
  26. #endif
  27. /* BSD names for some <limits.h> values. */
  28. #define NBBY CHAR_BIT
  29. #ifndef NGROUPS
  30. # define NGROUPS NGROUPS_MAX
  31. #endif
  32. #define MAXSYMLINKS 20
  33. #define CANBSIZ MAX_CANON
  34. #define MAXPATHLEN PATH_MAX
  35. /* The following are not really correct but it is a value we used for a
  36. long time and which seems to be usable. People should not use NOFILE
  37. and NCARGS anyway. */
  38. #define NOFILE 256
  39. #define NCARGS 131072
  40. #include <sys/types.h>
  41. /* Bit map related macros. */
  42. #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
  43. #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
  44. #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
  45. #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
  46. /* Macros for counting and rounding. */
  47. #ifndef howmany
  48. # define howmany(x, y) (((x) + ((y) - 1)) / (y))
  49. #endif
  50. #ifdef __GNUC__
  51. # define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \
  52. ? (((x) + (y) - 1) & ~((y) - 1)) \
  53. : ((((x) + ((y) - 1)) / (y)) * (y)))
  54. #else
  55. # define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
  56. #endif
  57. #define powerof2(x) ((((x) - 1) & (x)) == 0)
  58. /* Macros for min/max. */
  59. #define MIN(a,b) (((a)<(b))?(a):(b))
  60. #define MAX(a,b) (((a)>(b))?(a):(b))
  61. /* Unit of `st_blocks'. */
  62. #define DEV_BSIZE 512
  63. #endif /* sys/param.h */