summaryrefslogtreecommitdiffstats
path: root/docs/CODING_STYLE.md
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-04-25 13:56:20 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2023-04-25 14:05:08 +0200
commit4d26b2277a9a982b8c061d7da2300b266161b716 (patch)
tree93579093bfb94a4329c3ee70db80bf05b3916216 /docs/CODING_STYLE.md
parentuser-record-nss: make return values optional (diff)
downloadsystemd-4d26b2277a9a982b8c061d7da2300b266161b716.tar.xz
systemd-4d26b2277a9a982b8c061d7da2300b266161b716.zip
doc: say in CODING_STYLE that AT_EMPTY_PATH should be implied on openat() style APIs (and NULL path is OK)
As discussed here: https://github.com/systemd/systemd/pull/27397#issuecomment-1521630044
Diffstat (limited to 'docs/CODING_STYLE.md')
-rw-r--r--docs/CODING_STYLE.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/CODING_STYLE.md b/docs/CODING_STYLE.md
index 1a044c023a..f76525205f 100644
--- a/docs/CODING_STYLE.md
+++ b/docs/CODING_STYLE.md
@@ -613,6 +613,15 @@ SPDX-License-Identifier: LGPL-2.1-or-later
effect on the regular file. If in doubt consider turning off `O_NONBLOCK`
again after opening.
+- These days we generally prefer `openat()`-style file APIs, i.e. APIs that
+ accept a combination of file descriptor and path string, and where the path
+ (if not absolute) is considered relative to the specified file
+ descriptor. When implementing library calls in similar style, please make
+ sure to imply `AT_EMPTY_PATH` if an empty or `NULL` path argument is
+ specified (and convert that latter to an empty string). This differs from the
+ underlying kernel semantics, where `AT_EMPTY_PATH` must always be specified
+ explicitly, and `NULL` is not acepted as path.
+
## Command Line
- If you parse a command line, and want to store the parsed parameters in