Skip to contentSkip to conversation

chmod.2: document fchmodat(AT_EMPTY_PATH)

PATCH In review Aleksa Sarai 2 participants 2 messages Jun 18, 2025 – Jun 19, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 chmod.2: document fchmodat(AT_EMPTY_PATH)

The documentation and behaviour is indentical to the equivalent flag for fchownat(2).

---
This was added back in 2023, but I forgot to send the documentation patch for this and only noticed when I was trying to use it and realised it wasn't in the man page -- mea culpa!

---
 man/man2/chmod.2 | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
man/man2/chmod.2 +24 -1
index 307589481593..671e256ba525 100644
@@ -190,7 +190,30 @@ is absolute, then
 is ignored.
 .P
 .I flags
-can either be 0, or include the following flag:
+can either be 0, or include the following flags:
+.TP
+.BR AT_EMPTY_PATH " (since Linux 6.6)"
+.\" commit 5daeb41a6fc9d0d81cb2291884b7410e062d8fa1
+If
+.I path
+is an empty string, operate on the file referred to by
+.I dirfd
+(which may have been obtained using the
+.BR open (2)
+.B O_PATH
+flag).
+In this case,
+.I dirfd
+can refer to any type of file, not just a directory.
+If
+.I dirfd
+is
+.BR AT_FDCWD ,
+the call operates on the current working directory.
+This flag is Linux-specific; define
+.B _GNU_SOURCE
+.\" Before glibc 2.16, defining _ATFILE_SOURCE sufficed
+to obtain its definition.
 .TP
 .B AT_SYMLINK_NOFOLLOW
 If

---
base-commit: 471c38fb3c5c53c6df2fad4a7353559b330c1323
change-id: 20250619-fchmod-empty-path-7680e8bb5481

Best regards,

Signature · 1 line
Aleksa Sarai <[email protected]>
#1 lore raw

Hi Aleksa,

Quoted 8 lines · Aleksa Sarai

The documentation and behaviour is indentical to the equivalent flag for fchownat(2).

---
This was added back in 2023, but I forgot to send the documentation patch for this and only noticed when I was trying to use it and realised it wasn't in the man page -- mea culpa!

Thanks! I've applied the patch:
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=a4535bb6ddc0c1a060cedaee86430c39f590804e>

Have a lovely day!
Alex

Quoted 50 lines
---
 man/man2/chmod.2 | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
man/man2/chmod.2 +24 -2
index 307589481593..671e256ba525 100644
@@ -190,7 +190,30 @@ is absolute, then
 is ignored.
 .P
 .I flags
-can either be 0, or include the following flag:
+can either be 0, or include the following flags:
+.TP
+.BR AT_EMPTY_PATH " (since Linux 6.6)"
+.\" commit 5daeb41a6fc9d0d81cb2291884b7410e062d8fa1
+If
+.I path
+is an empty string, operate on the file referred to by
+.I dirfd
+(which may have been obtained using the
+.BR open (2)
+.B O_PATH
+flag).
+In this case,
+.I dirfd
+can refer to any type of file, not just a directory.
+If
+.I dirfd
+is
+.BR AT_FDCWD ,
+the call operates on the current working directory.
+This flag is Linux-specific; define
+.B _GNU_SOURCE
+.\" Before glibc 2.16, defining _ATFILE_SOURCE sufficed
+to obtain its definition.
 .TP
 .B AT_SYMLINK_NOFOLLOW
 If
 
---

base-commit: 471c38fb3c5c53c6df2fad4a7353559b330c1323
change-id: 20250619-fchmod-empty-path-7680e8bb5481

Best regards,

Signature · 1 line
Aleksa Sarai <[email protected]>
Signature · 1 line
<https://www.alejandro-colomar.es/>