param.h 2.4 KB

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