[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:12 PDT 2026


================
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Header file for getpwent function and internal helpers.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_PWD_GETPWENT_H
+#define LLVM_LIBC_SRC_PWD_GETPWENT_H
+
+#include "hdr/types/struct_passwd.h"
+#include "src/__support/error_or.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace internal {
----------------
vonosmas wrote:

See note above about moving all the helpers and global state to pwd_utils instead. I think it's also an opportunity to have a more consistent naming/grouping of methods, e.g.

```
namespace pwd {

void TESTONLY_set_passwd_path(const char *path);
Error open();  // or ErrorOr<int> open();
Error close();  // or ErrorOr<int> close();
ErrorOr<struct passwd*> read_next();

}
```

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


More information about the libc-commits mailing list