+2023-08-08 Bruno Haible <bruno@clisp.org>
+
+ readutmp: Add comment about multithread-safety.
+ * lib/readutmp.h (read_utmp): Add comment.
+
2023-08-08 Bruno Haible <bruno@clisp.org>
readutmp: Return entries with unbounded strings on all platforms.
If OPTIONS & READ_UTMP_CHECK_PIDS is nonzero, omit entries whose
process-IDs do not currently exist.
If OPTIONS & READ_UTMP_USER_PROCESS is nonzero, omit entries which
- do not correspond to a user process. */
+ do not correspond to a user process.
+
+ This function is not multithread-safe, since on many platforms it
+ invokes the functions setutxent, getutxent, endutxent. These
+ functions are needed because they may lock FILE (so that we don't
+ read garbage when a concurrent process writes to FILE), but their
+ drawback is that they have a common global state. */
int read_utmp (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
int options);