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