Lines Matching refs:flock
37 * FL_FLOCK locks are created with calls to flock(), through the flock()
38 * system call, which is new. Old C libraries implement flock() via fcntl()
41 * FL_FLOCK locks follow the 4.4 BSD flock() semantics. They are associated
77 * flock() and fcntl().
118 * If multiple threads attempt to lock the same byte (or flock the same file)
565 /* Verify a "struct flock" and copy it to a "struct file_lock" as a POSIX
569 struct flock *l)
2203 * sys_flock: - flock() system call.
2213 * - %LOCK_MAND -- a 'mandatory' flock.
2219 SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
2251 if (f.file->f_op->flock)
2252 error = f.file->f_op->flock(f.file,
2301 * If the flock owner process is dead and its pid has been already
2303 * flock owner pid number in init pidns.
2315 static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl)
2317 flock->l_pid = locks_translate_pid(fl, task_active_pid_ns(current));
2321 * legacy 32bit flock.
2328 flock->l_start = fl->fl_start;
2329 flock->l_len = fl->fl_end == OFFSET_MAX ? 0 :
2331 flock->l_whence = 0;
2332 flock->l_type = fl->fl_type;
2337 static void posix_lock_to_flock64(struct flock64 *flock, struct file_lock *fl)
2339 flock->l_pid = locks_translate_pid(fl, task_active_pid_ns(current));
2340 flock->l_start = fl->fl_start;
2341 flock->l_len = fl->fl_end == OFFSET_MAX ? 0 :
2343 flock->l_whence = 0;
2344 flock->l_type = fl->fl_type;
2351 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock)
2360 if (flock->l_type != F_RDLCK && flock->l_type != F_WRLCK)
2363 error = flock_to_posix_lock(filp, fl, flock);
2369 if (flock->l_pid != 0)
2381 flock->l_type = fl->fl_type;
2383 error = posix_lock_to_flock(flock, fl);
2477 struct flock *flock)
2495 error = flock_to_posix_lock(filp, file_lock, flock);
2510 if (flock->l_pid != 0)
2519 if (flock->l_pid != 0)
2564 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock)
2574 if (flock->l_type != F_RDLCK && flock->l_type != F_WRLCK)
2577 error = flock64_to_posix_lock(filp, fl, flock);
2583 if (flock->l_pid != 0)
2595 flock->l_type = fl->fl_type;
2597 posix_lock_to_flock64(flock, fl);
2608 struct flock64 *flock)
2626 error = flock64_to_posix_lock(filp, file_lock, flock);
2641 if (flock->l_pid != 0)
2650 if (flock->l_pid != 0)
2744 if (filp->f_op->flock)
2745 filp->f_op->flock(filp, F_SETLKW, &fl);
2788 /* remove flock locks */