Lines Matching refs:lock_fd
214 _cleanup_close_ int lock_fd = -1; in pick_uid() local
268 … lock_fd = open(lock_path, O_CREAT|O_RDWR|O_NOFOLLOW|O_CLOEXEC|O_NOCTTY, 0600); in pick_uid()
269 if (lock_fd < 0) in pick_uid()
272 … r = flock(lock_fd, LOCK_EX|LOCK_NB); /* Try to get a BSD file lock on the UID lock file */ in pick_uid()
280 if (fstat(lock_fd, &st) < 0) in pick_uid()
287 lock_fd = safe_close(lock_fd); in pick_uid()
299 l = pwritev(lock_fd, in pick_uid()
310 (void) ftruncate(lock_fd, l); in pick_uid()
314 return TAKE_FD(lock_fd); in pick_uid()
324 int lock_fd; in dynamic_user_pop() local
334 k = receive_one_fd_iov(d->storage_socket[0], &iov, 1, MSG_DONTWAIT, &lock_fd); in dynamic_user_pop()
339 *ret_lock_fd = lock_fd; in dynamic_user_pop()
344 static int dynamic_user_push(DynamicUser *d, uid_t uid, int lock_fd) { in dynamic_user_push() argument
350 return send_one_fd_iov(d->storage_socket[1], lock_fd, &iov, 1, MSG_DONTWAIT); in dynamic_user_push()
353 static void unlink_uid_lock(int lock_fd, uid_t uid, const char *name) { in unlink_uid_lock() argument
356 if (lock_fd < 0) in unlink_uid_lock()
528 _cleanup_close_ int lock_fd = -1; in dynamic_user_current() local
540 r = dynamic_user_pop(d, &uid, &lock_fd); in dynamic_user_current()
544 r = dynamic_user_push(d, uid, lock_fd); in dynamic_user_current()
570 _cleanup_close_ int lock_fd = -1; in dynamic_user_close() local
581 r = dynamic_user_pop(d, &uid, &lock_fd); in dynamic_user_close()
589 unlink_uid_lock(lock_fd, uid, d->name); in dynamic_user_close()