You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.1 KiB

  1. /*
  2. FUSE: Filesystem in Userspace
  3. Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
  4. This program can be distributed under the terms of the GNU LGPLv2.
  5. See the file COPYING.LIB
  6. */
  7. #pragma once
  8. #include "config.h"
  9. #include <pthread.h>
  10. /*
  11. Versioned symbols cannot be used in some cases because it
  12. - confuse the dynamic linker in uClibc
  13. - not supported on MacOSX (in MachO binary format)
  14. */
  15. #if (!defined(__UCLIBC__) && !defined(__APPLE__))
  16. #define FUSE_SYMVER(x) __asm__(x)
  17. #else
  18. #define FUSE_SYMVER(x)
  19. #endif
  20. #ifndef USE_UCLIBC
  21. #define fuse_mutex_init(mut) pthread_mutex_init(mut, NULL)
  22. #else
  23. /* Is this hack still needed? */
  24. static inline void fuse_mutex_init(pthread_mutex_t *mut)
  25. {
  26. pthread_mutexattr_t attr;
  27. pthread_mutexattr_init(&attr);
  28. pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
  29. pthread_mutex_init(mut, &attr);
  30. pthread_mutexattr_destroy(&attr);
  31. }
  32. #endif
  33. #ifdef HAVE_STRUCT_STAT_ST_ATIM
  34. /* Linux */
  35. #define ST_ATIM_NSEC(stbuf) ((stbuf)->st_atim.tv_nsec)
  36. #define ST_CTIM_NSEC(stbuf) ((stbuf)->st_ctim.tv_nsec)
  37. #define ST_MTIM_NSEC(stbuf) ((stbuf)->st_mtim.tv_nsec)
  38. #define ST_ATIM_NSEC_SET(stbuf,val) ((stbuf)->st_atim.tv_nsec = (val))
  39. #define ST_CTIM_NSEC_SET(stbuf,val) ((stbuf)->st_ctim.tv_nsec = (val))
  40. #define ST_MTIM_NSEC_SET(stbuf,val) ((stbuf)->st_mtim.tv_nsec = (val))
  41. #elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC)
  42. /* FreeBSD */
  43. #define ST_ATIM_NSEC(stbuf) ((stbuf)->st_atimespec.tv_nsec)
  44. #define ST_CTIM_NSEC(stbuf) ((stbuf)->st_ctimespec.tv_nsec)
  45. #define ST_MTIM_NSEC(stbuf) ((stbuf)->st_mtimespec.tv_nsec)
  46. #define ST_ATIM_NSEC_SET(stbuf,val) ((stbuf)->st_atimespec.tv_nsec = (val))
  47. #define ST_CTIM_NSEC_SET(stbuf,val) ((stbuf)->st_ctimespec.tv_nsec = (val))
  48. #define ST_MTIM_NSEC_SET(stbuf,val) ((stbuf)->st_mtimespec.tv_nsec = (val))
  49. #else
  50. #define ST_ATIM_NSEC(stbuf) 0
  51. #define ST_CTIM_NSEC(stbuf) 0
  52. #define ST_MTIM_NSEC(stbuf) 0
  53. #define ST_ATIM_NSEC_SET(stbuf,val) do { } while (0)
  54. #define ST_CTIM_NSEC_SET(stbuf,val) do { } while (0)
  55. #define ST_MTIM_NSEC_SET(stbuf,val) do { } while (0)
  56. #endif