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:
    • FLOCK โ€” This is a BSD file lock created using flock(2).
    • OFDLCK โ€” This is an open file description (OFD) lock created using fcntl(2).
    • POSIX โ€” This is a POSIX byte-range lock created using fcntl(2).
  • [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. EOF in this field means that the lock extends to the end of the file. For BSD locks, the value shown is always EOF. 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
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms