mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:17:45 +00:00
LibCore: Define and use a fallible, OS-independent getpwent(_r) wrapper
Rather than maintaining a list of #ifdef guards to check systems that do not provide the reentrant version of getpwent, we can use C++ concepts to let the compiler perform this check for us. While we're at it, we can also provide this wrapper as fallible to let the caller TRY calling it.
This commit is contained in:
parent
b367da592c
commit
1ee808fae6
3 changed files with 58 additions and 27 deletions
|
@ -122,6 +122,7 @@ ErrorOr<int> tcsetpgrp(int fd, pid_t pgrp);
|
|||
ErrorOr<void> chmod(StringView pathname, mode_t mode);
|
||||
ErrorOr<void> lchown(StringView pathname, uid_t uid, gid_t gid);
|
||||
ErrorOr<void> chown(StringView pathname, uid_t uid, gid_t gid);
|
||||
ErrorOr<Optional<struct passwd>> getpwent(Span<char> buffer);
|
||||
ErrorOr<Optional<struct passwd>> getpwnam(StringView name);
|
||||
ErrorOr<Optional<struct group>> getgrnam(StringView name);
|
||||
ErrorOr<Optional<struct passwd>> getpwuid(uid_t);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue