zc_xplatform.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * This file is part of the zlog Library.
  3. *
  4. * Copyright (C) 2011 by Hardy Simpson <HardySimpson1984@gmail.com>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING in base directory.
  7. */
  8. #ifndef __zc_xplatform_h
  9. #define __zc_xplatform_h
  10. #include <limits.h>
  11. #define ZLOG_INT32_LEN sizeof("-2147483648") - 1
  12. #define ZLOG_INT64_LEN sizeof("-9223372036854775808") - 1
  13. #if ((__GNU__ == 2) && (__GNUC_MINOR__ < 8))
  14. #define ZLOG_MAX_UINT32_VALUE (uint32_t) 0xffffffffLL
  15. #else
  16. #define ZLOG_MAX_UINT32_VALUE (uint32_t) 0xffffffff
  17. #endif
  18. #define ZLOG_MAX_INT32_VALUE (uint32_t) 0x7fffffff
  19. #define MAXLEN_PATH 1024
  20. #define MAXLEN_CFG_LINE (MAXLEN_PATH * 4)
  21. #define MAXLINES_NO 128
  22. #define FILE_NEWLINE "\n"
  23. #define FILE_NEWLINE_LEN 1
  24. #include <string.h>
  25. #include <strings.h>
  26. #define STRCMP(_a_,_C_,_b_) ( strcmp(_a_,_b_) _C_ 0 )
  27. #define STRNCMP(_a_,_C_,_b_,_n_) ( strncmp(_a_,_b_,_n_) _C_ 0 )
  28. #define STRICMP(_a_,_C_,_b_) ( strcasecmp(_a_,_b_) _C_ 0 )
  29. #define STRNICMP(_a_,_C_,_b_,_n_) ( strncasecmp(_a_,_b_,_n_) _C_ 0 )
  30. #ifdef __APPLE__
  31. #include <AvailabilityMacros.h>
  32. #endif
  33. /* Define zlog_fstat to fstat or fstat64() */
  34. #if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6)
  35. #define zlog_fstat fstat64
  36. #define zlog_stat stat64
  37. #else
  38. #define zlog_fstat fstat
  39. #define zlog_stat stat
  40. #endif
  41. /* Define zlog_fsync to fdatasync() in Linux and fsync() for all the rest */
  42. #ifdef __linux__
  43. #define zlog_fsync fdatasync
  44. #else
  45. #define zlog_fsync fsync
  46. #endif
  47. #endif