netatalk  4.4.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
ad_lock.h File Reference
#include <atalk/adouble.h>

Go to the source code of this file.

Macros

#define adf_lock_init(a)
#define adf_lock_free(a)

Macro Definition Documentation

◆ adf_lock_free

#define adf_lock_free ( a)
Value:
do { \
int i; \
if (!(a)->adf_lock) \
break; \
for (i = 0; i < (a)->adf_lockcount; i++) { \
adf_lock_t *lock = (a)->adf_lock + i; \
/* Always release fcntl lock when freeing array */ \
if ((a)->adf_fd >= 0) { \
lock->lock.l_type = F_UNLCK; \
if (fcntl((a)->adf_fd, F_SETLK, &lock->lock) == -1) { \
"adf_lock_free: fcntl unlock failed on fd %d: %s", \
(a)->adf_fd, strerror(errno)); \
} \
} \
/* Only free refcount memory when last reference */ \
if (--(*lock->refcount) < 1) { \
free(lock->refcount); \
} \
} \
free((a)->adf_lock); \
adf_lock_init(a); \
} while (0)
@ logtype_default
Definition logger.h:34
@ log_warning
Definition logger.h:21
Definition adouble.h:163
struct flock lock
Definition adouble.h:164
int * refcount
Definition adouble.h:166

◆ adf_lock_init

#define adf_lock_init ( a)
Value:
do { \
(a)->adf_lockmax = 0; \
(a)->adf_lockcount = 0; \
(a)->adf_lock = NULL; \
} while (0)