int file_lock_try_update(struct file_lock *lock, int lock_type) { const char *error; return file_lock_do(lock->fd, lock->path, lock_type, lock->lock_method, 0, &error); }
/* APPLE */ void file_unlock_multiclient(struct file_lock **_lock, uintmax_t client_id) { struct file_lock *lock = *_lock; *_lock = NULL; if (file_lock_do(lock->fd, lock->path, F_UNLCK, lock->lock_method, 0, client_id) == 0) { /* APPLE */ /* this shouldn't happen */ i_error("file_unlock(%s) failed: %m", lock->path); } file_lock_free(&lock); }
void file_unlock(struct file_lock **_lock) { struct file_lock *lock = *_lock; const char *error; *_lock = NULL; if (file_lock_do(lock->fd, lock->path, F_UNLCK, lock->lock_method, 0, &error) == 0) { /* this shouldn't happen */ i_error("file_unlock(%s) failed: %m", lock->path); } file_lock_free(&lock); }
int file_wait_lock_error(int fd, const char *path, int lock_type, enum file_lock_method lock_method, unsigned int timeout_secs, struct file_lock **lock_r, const char **error_r) { struct file_lock *lock; int ret; ret = file_lock_do(fd, path, lock_type, lock_method, timeout_secs, error_r); if (ret <= 0) return ret; lock = i_new(struct file_lock, 1); lock->fd = fd; lock->path = i_strdup(path); lock->lock_type = lock_type; lock->lock_method = lock_method; *lock_r = lock; return 1; }
/* APPLE */ int file_wait_lock_multiclient(int fd, const char *path, int lock_type, enum file_lock_method lock_method, unsigned int timeout_secs, struct file_lock **lock_r, uintmax_t client_id) { struct file_lock *lock; int ret; ret = file_lock_do(fd, path, lock_type, lock_method, timeout_secs, client_id); /* APPLE */ if (ret <= 0) return ret; lock = i_new(struct file_lock, 1); lock->fd = fd; lock->path = i_strdup(path); lock->lock_type = lock_type; lock->lock_method = lock_method; *lock_r = lock; return 1; }
int file_lock_try_update(struct file_lock *lock, int lock_type) { return file_lock_do(lock->fd, lock->path, lock_type, lock->lock_method, 0, 0); /* APPLE */ }