]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/io/README: Add file
authorAlejandro Colomar <alx@kernel.org>
Fri, 13 Mar 2026 00:53:38 +0000 (01:53 +0100)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Mon, 16 Mar 2026 11:12:58 +0000 (12:12 +0100)
This documents the main APIs under 'lib/io/'.

Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/io/README [new file with mode: 0644]

diff --git a/lib/io/README b/lib/io/README
new file mode 100644 (file)
index 0000000..adae56b
--- /dev/null
@@ -0,0 +1,29 @@
+General guidelines:
+===================
+
+-  If there's a *_a() macro that wraps an API, use the macro if
+   possible.  These use countof() to add bounds safety.
+
+-  If there's a *_T() macro that wraps an API, use the macro if
+   possible.  These use _Generic() to add type safety.
+   Prefer *_a() macros over *_T() macros.
+
+-  If there's an upper-case macro that wraps a function, use the macro
+   if possible.  These use macro magic to add safety.
+   Prefer *_T() macros over upper-case macros.
+
+
+Specific guidelines:
+====================
+       Under lib/io/ we provide a set of APIs to do IO.
+       In this section, we provide a broad overview.
+
+fgets/ - Read lines
+
+    fgets_a()
+       Like fgets(3), but takes an array.
+
+syslog.h - System log
+
+    SYSLOG()
+       Like syslog(3), but uses the C locale if necessary.