[libc-commits] [libc] [libc] Add getpwent, setpwent, and endpwent entrypoints (PR #213076)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Thu Jul 30 20:56:13 PDT 2026


================
@@ -1,3 +1,46 @@
+add_entrypoint_object(
+  getpwent
+  SRCS
+    getpwent.cpp
+  HDRS
+    getpwent.h
+  DEPENDS
+    libc.hdr.types.struct_passwd
+    libc.src.errno.errno
+    libc.src.__support.common
+    libc.src.__support.macros.config
+    libc.src.__support.File.file
+    libc.src.__support.File.platform_file
+    libc.hdr.stdio_macros
+    .pwd_utils
+)
+
+add_entrypoint_object(
+  setpwent
+  SRCS
+    setpwent.cpp
+  HDRS
+    setpwent.h
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.__support.common
+    libc.src.__support.macros.config
+    .getpwent
----------------
vonosmas wrote:

I think we should avoid having one entrypoint depend on another (and actually fix a few existing cases like this that we have today). Can you move the logic for iterative over pwd database, and a global state, into a separate file in `pwd_utils` and have all three entrypoints simply invoke the methods there?

https://github.com/llvm/llvm-project/pull/213076


More information about the libc-commits mailing list