stddef.h 581 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef _LINUX_STDDEF_H
  2. #define _LINUX_STDDEF_H
  3. #include <uapi/linux/stddef.h>
  4. #undef NULL
  5. #define NULL ((void *)0)
  6. enum {
  7. false = 0,
  8. true = 1
  9. };
  10. #undef offsetof
  11. #ifdef __compiler_offsetof
  12. #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
  13. #else
  14. #define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)
  15. #endif
  16. /**
  17. * offsetofend(TYPE, MEMBER)
  18. *
  19. * @TYPE: The type of the structure
  20. * @MEMBER: The member within the structure to get the end offset of
  21. */
  22. #define offsetofend(TYPE, MEMBER) \
  23. (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
  24. #endif