proc_locks(5)
โจ NAME โจ
/proc/locks โ current file locks and leases ๐ (yes bestie, it's a programming-interface file, so it lives in the File Formats Manual section, not the syscall section, don't @ me)
๐ธ DESCRIPTION ๐ธ
/proc/locks
Okay so this file is literally the group chat of every file lock and lease currently happening on your system. It shows current file locks (flock(2) and fcntl(2)) and leases (fcntl(2)). ๐
An example of the content shown in this file is the following:
1: POSIX ADVISORY READ 5433 08:01:7864448 128 128
2: FLOCK ADVISORY WRITE 2001 08:01:7864554 0 EOF
3: FLOCK ADVISORY WRITE 1568 00:2f:32388 0 EOF
4: POSIX ADVISORY WRITE 699 00:16:28457 0 EOF
5: POSIX ADVISORY WRITE 764 00:16:21448 0 0
6: POSIX ADVISORY READ 3548 08:01:7867240 1 1
7: POSIX ADVISORY READ 3548 08:01:7865567 1826 2335
8: OFDLCK ADVISORY WRITE -1 08:01:8713209 128 191
The fields shown in each line are as follows, and yes we're going through all eight, no skips, we eat the whole plate ๐:
- [1] โ The ordinal position of the lock in the list. It's just the lineup number ok.
- [2] โ The lock type. Values that may appear here include:
- [3] โ Among the strings that can appear here are the following:
ADVISORYโ This is an advisory lock. Chill vibes, cooperative only ๐MANDATORYโ This is a mandatory lock. Actual enforcement energy ๐ค
- [4] โ The type of lock. Values that can appear here are:
READโ This is a POSIX or OFD read lock, or a BSD shared lock.WRITEโ This is a POSIX or OFD write lock, or a BSD exclusive lock.
- [5] โ The PID of the process that owns the lock. ๐ซถ
Because OFD locks are not owned by a single process (since multiple processes may have file descriptors that refer to the same open file description), the value -1 is displayed in this field for OFD locks.
โ ๏ธ Bestie listen โ Before Linux 4.14, a bug meant that the PID of the process that initially acquired the lock was displayed instead of the value -1. So if you're on ancient kernel, that number is a lie, do not trust her ๐
- [6] โ Three colon-separated subfields that identify the major and minor device ID of the device containing the filesystem where the locked file resides, followed by the inode number of the locked file. So like
major:minor:inode, that's the trio ๐ง - [7] โ The byte offset of the first byte of the lock. For BSD locks, this value is always
0. - [8] โ The byte offset of the last byte of the lock.
EOFin this field means that the lock extends to the end of the file. For BSD locks, the value shown is alwaysEOF. Very consistent of her โจ
Since Linux 4.9, the list of locks shown in /proc/locks is filtered to show just the locks for the processes in the PID namespace (see pid_namespaces(7)) for which the /proc filesystem was mounted. (In the initial PID namespace, there is no filtering of the records shown in this file.) So like, scope check, it's giving โจprivacyโจ
The lslocks(8) command provides a bit more information about each lock. So if this file is leaving you with questions, lslocks(8) is the friend who replies with the full tea ๐ต
๐ SEE ALSO ๐
and that's the whole page bestie, no notes, you understood it perfectly the first time obviously ๐
written by the Linux man-pages crew, version 6.20, dated 2026-02-08 โ mwah, thank you for your service to us all ๐โจ๐ฆ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: GPL-3.0-or-later
- Copyright 1994-1995, Daniel Quinlan <Daniel.Quinlan@linux.org>
- Copyright 2002-2017, Michael Kerrisk <mtk.manpages@gmail.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms