[libc-commits] [libc] [libc] Add getgrnam and getgrgid entrypoints (PR #224858)
Victor Campos via libc-commits
libc-commits at lists.llvm.org
Mon Sep 21 03:24:34 PDT 2026
================
@@ -168,14 +168,40 @@ LIBC_CONSTINIT pwd::FlatFileDatabase<struct group>
// Note: These static buffers are process-global and NOT protected by a mutex
// at this stage. POSIX getgrent is non-reentrant.
//
-// A single static buffer is reused across non-reentrant group calls via
-// realloc, growing only to the high-water mark of the largest record seen.
-// endgrent() closes the file stream without freeing the buffer so that
+// A single static buffer and struct group are reused across getgrent,
+// getgrnam, and getgrgid per POSIX ("The return value may point to a static
+// area which is overwritten by a subsequent call to getgrent(), getgrgid(),
+// or getgrnam()"), growing only to the high-water mark of the largest record
----------------
vhscampos wrote:
Can you replace "high-water mark of the largest record seen" by a more formal description? I'm not a native speaker and it took me a good number of seconds to understand the meaning here.
https://github.com/llvm/llvm-project/pull/224858
More information about the libc-commits
mailing list