blob: c2cfee17aa0ef3768546e9e5177758c53e99bda8 [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
12/* Versioned symbols confuse the dynamic linker in uClibc */
13#ifndef __UCLIBC__
14#define FUSE_SYMVER(x) __asm__(x)
15#else
16#define FUSE_SYMVER(x)
17#endif
18
19#ifndef USE_UCLIBC
20#define fuse_mutex_init(mut) pthread_mutex_init(mut, NULL)
21#else
22/* Is this hack still needed? */
23static 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
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_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_MTIM_NSEC_SET(stbuf, val) (stbuf)->st_mtimespec.tv_nsec = (val)
47#else
48#define ST_ATIM_NSEC(stbuf) 0
49#define ST_CTIM_NSEC(stbuf) 0
50#define ST_MTIM_NSEC(stbuf) 0
51#define ST_ATIM_NSEC_SET(stbuf, val) do { } while (0)
52#define ST_MTIM_NSEC_SET(stbuf, val) do { } while (0)
53#endif