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.

60 lines
2.0 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. #include "config.h"
  8. #include <pthread.h>
  9. /*
  10. Versioned symbols cannot be used in some cases because it
  11. - confuse the dynamic linker in uClibc
  12. - not supported on MacOSX (in MachO binary format)
  13. */
  14. #if (!defined(__UCLIBC__) && !defined(__APPLE__))
  15. #define FUSE_SYMVER(x) __asm__(x)
  16. #else
  17. #define FUSE_SYMVER(x)
  18. #endif
  19. #ifndef USE_UCLIBC
  20. #define fuse_mutex_init(mut) pthread_mutex_init(mut, NULL)
  21. #else
  22. /* Is this hack still needed? */
  23. static inline void fuse_mutex_init(pthread_mutex_t *mut)
  24. {
  25. pthread_mutexattr_t attr;
  26. pthread_mutexattr_init(&attr);
  27. pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
  28. pthread_mutex_init(mut, &attr);
  29. pthread_mutexattr_destroy(&attr);
  30. }
  31. #endif
  32. #ifdef HAVE_STRUCT_STAT_ST_ATIM
  33. /* Linux */
  34. #define ST_ATIM_NSEC(stbuf) ((stbuf)->st_atim.tv_nsec)
  35. #define ST_CTIM_NSEC(stbuf) ((stbuf)->st_ctim.tv_nsec)
  36. #define ST_MTIM_NSEC(stbuf) ((stbuf)->st_mtim.tv_nsec)
  37. #define ST_ATIM_NSEC_SET(stbuf,val) ((stbuf)->st_atim.tv_nsec = (val))
  38. #define ST_CTIM_NSEC_SET(stbuf,val) ((stbuf)->st_ctim.tv_nsec = (val))
  39. #define ST_MTIM_NSEC_SET(stbuf,val) ((stbuf)->st_mtim.tv_nsec = (val))
  40. #elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC)
  41. /* FreeBSD */
  42. #define ST_ATIM_NSEC(stbuf) ((stbuf)->st_atimespec.tv_nsec)
  43. #define ST_CTIM_NSEC(stbuf) ((stbuf)->st_ctimespec.tv_nsec)
  44. #define ST_MTIM_NSEC(stbuf) ((stbuf)->st_mtimespec.tv_nsec)
  45. #define ST_ATIM_NSEC_SET(stbuf,val) ((stbuf)->st_atimespec.tv_nsec = (val))
  46. #define ST_CTIM_NSEC_SET(stbuf,val) ((stbuf)->st_ctimespec.tv_nsec = (val))
  47. #define ST_MTIM_NSEC_SET(stbuf,val) ((stbuf)->st_mtimespec.tv_nsec = (val))
  48. #else
  49. #define ST_ATIM_NSEC(stbuf) 0
  50. #define ST_CTIM_NSEC(stbuf) 0
  51. #define ST_MTIM_NSEC(stbuf) 0
  52. #define ST_ATIM_NSEC_SET(stbuf,val) do { } while (0)
  53. #define ST_CTIM_NSEC_SET(stbuf,val) do { } while (0)
  54. #define ST_MTIM_NSEC_SET(stbuf,val) do { } while (0)
  55. #endif