diff options
author | Julio Merino <jmmv@google.com> | 2016-02-08 11:12:22 -0500 |
---|---|---|
committer | Julio Merino <jmmv@meroh.net> | 2016-02-08 20:46:37 -0500 |
commit | ddbe3bee444909420049a68f7891563f0e431669 (patch) | |
tree | 1273577a0fd0fa7ce54b426688938b785b442666 /compat/darwin_compat.h | |
parent | b10d21db3185a2b25e3bd35579f57d3c7b8d882e (diff) | |
parent | 9bcb98945405db3d64cd8dca409aa18990ff1929 (diff) | |
download | sshfs-ddbe3bee444909420049a68f7891563f0e431669.tar sshfs-ddbe3bee444909420049a68f7891563f0e431669.tar.gz sshfs-ddbe3bee444909420049a68f7891563f0e431669.tar.bz2 sshfs-ddbe3bee444909420049a68f7891563f0e431669.zip |
Merge remote-tracking branch 'osxfuse/master' into merge-osxfuse
Pull in all changes from osxfuse's fork of sshfs into libfuse's sshfs.
There need not be two different copies of this codebase, particularly
because libfuse's version is already autoconf-ified and can support
multiple platforms.
The merge is mostly clean with just a few manual edits to resolve
conflicts.
Diffstat (limited to 'compat/darwin_compat.h')
-rw-r--r-- | compat/darwin_compat.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/compat/darwin_compat.h b/compat/darwin_compat.h new file mode 100644 index 0000000..0a16471 --- /dev/null +++ b/compat/darwin_compat.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2006-2008 Amit Singh/Google Inc. + * Copyright (c) 2011-2013 Benjamin Fleischer + */ + +#ifndef _DARWIN_COMPAT_ +#define _DARWIN_COMPAT_ + +#include <pthread.h> + +/* Semaphores */ + +typedef struct darwin_sem { + int id; + union { + struct + { + unsigned int count; + pthread_mutex_t count_lock; + pthread_cond_t count_cond; + } local; + } __data; +} darwin_sem_t; + +#define DARWIN_SEM_VALUE_MAX ((int32_t)32767) + +int darwin_sem_init(darwin_sem_t *sem, int pshared, unsigned int value); +int darwin_sem_destroy(darwin_sem_t *sem); +int darwin_sem_getvalue(darwin_sem_t *sem, unsigned int *value); +int darwin_sem_post(darwin_sem_t *sem); +int darwin_sem_timedwait(darwin_sem_t *sem, const struct timespec *abs_timeout); +int darwin_sem_trywait(darwin_sem_t *sem); +int darwin_sem_wait(darwin_sem_t *sem); + +/* Caller must not include <semaphore.h> */ + +typedef darwin_sem_t sem_t; + +#define sem_init(s, p, v) darwin_sem_init(s, p, v) +#define sem_destroy(s) darwin_sem_destroy(s) +#define sem_getvalue(s, v) darwin_sem_getvalue(s, v) +#define sem_post(s) darwin_sem_post(s) +#define sem_timedwait(s, t) darwin_sem_timedwait(s, t) +#define sem_trywait(s) darwin_sem_trywait(s) +#define sem_wait(s) darwin_sem_wait(s) + +#define SEM_VALUE_MAX DARWIN_SEM_VALUE_MAX + +#endif /* _DARWIN_COMPAT_ */ |