types.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (c) 2008-2009 Travis Geiselbrecht
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining
  5. * a copy of this software and associated documentation files
  6. * (the "Software"), to deal in the Software without restriction,
  7. * including without limitation the rights to use, copy, modify, merge,
  8. * publish, distribute, sublicense, and/or sell copies of the Software,
  9. * and to permit persons to whom the Software is furnished to do so,
  10. * subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be
  13. * included in all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  18. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  19. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  20. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  21. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. #ifndef __SYS_TYPES_H
  24. #define __SYS_TYPES_H
  25. #ifndef __cplusplus
  26. #define false 0
  27. #define true 1
  28. typedef int bool;
  29. #endif
  30. #include <stddef.h>
  31. #include <limits.h>
  32. #include <stdint.h>
  33. typedef unsigned char uchar;
  34. typedef unsigned short ushort;
  35. typedef unsigned int uint;
  36. typedef unsigned long ulong;
  37. typedef unsigned char u_char;
  38. typedef unsigned short u_short;
  39. typedef unsigned int u_int;
  40. typedef unsigned long u_long;
  41. #ifndef _SIZE_T_DEFINED_
  42. typedef unsigned long size_t;
  43. #endif
  44. typedef long ssize_t;
  45. typedef long long off_t;
  46. typedef int status_t;
  47. typedef uintptr_t addr_t;
  48. typedef uintptr_t vaddr_t;
  49. typedef uintptr_t paddr_t;
  50. typedef int kobj_id;
  51. typedef unsigned long time_t;
  52. typedef unsigned long long bigtime_t;
  53. #define INFINITE_TIME ULONG_MAX
  54. #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
  55. #define TIME_GTE(a, b) ((long)((a) - (b)) >= 0)
  56. #define TIME_LTE(a, b) ((long)((a) - (b)) <= 0)
  57. #define TIME_GT(a, b) ((long)((a) - (b)) > 0)
  58. #define TIME_LT(a, b) ((long)((a) - (b)) < 0)
  59. enum handler_return {
  60. INT_NO_RESCHEDULE = 0,
  61. INT_RESCHEDULE,
  62. };
  63. #endif