2
0

param.h 954 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef _SYS_PARAM_H
  2. #define _SYS_PARAM_H
  3. #define MIN(a,b) (((a) < (b)) ? (a) : (b))
  4. #define MAX(a,b) (((a) > (b)) ? (a) : (b))
  5. #define __bitop(array, index, op) ((array)[(index) / 8] op (1 << (index) % 8))
  6. #define setbit(array, index) __bitop(array, index, |=)
  7. #define clrbit(array, index) __bitop(array, index, &= ~)
  8. #define isset(array, index) __bitop(array, index, &)
  9. #define isclr(array, index) !isset(array, index)
  10. #define howmany(bits, size) (((bits) + (size) - 1) / (size))
  11. #define roundup(bits, size) (howmany(bits, size) * (size))
  12. #define powerof2(n) !(((n) - 1) & (n))
  13. // Shamelessly copied from musl.
  14. // Tweak as needed.
  15. #define MAXSYMLINKS 20
  16. #define MAXHOSTNAMELEN 64
  17. #define MAXNAMLEN 255
  18. #define MAXPATHLEN 4096
  19. #define NBBY 8
  20. #define NGROUPS 32
  21. #define CANBSIZ 255
  22. #define NOFILE 256
  23. #define NCARGS 131072
  24. #define DEV_BSIZE 512
  25. #define NOGROUP (-1)
  26. #include <sys/resource.h>
  27. #include <limits.h>
  28. #include <machine/endian.h>
  29. #endif