posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
pwd.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Meta Platforms
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
17#ifndef ZEPHYR_INCLUDE_POSIX_PWD_H_
18#define ZEPHYR_INCLUDE_POSIX_PWD_H_
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include <sys/stat.h>
25
26#if (!defined(_PASSWD_DECLARED) && !defined(__passwd_defined)) || defined(__DOXYGEN__)
32struct passwd {
33 char *pw_name;
34 char *pw_passwd;
35 uid_t pw_uid;
36 gid_t pw_gid;
37 char *pw_comment;
38 char *pw_gecos;
39 char *pw_dir;
40 char *pw_shell;
41};
42#define _PASSWD_DECLARED
43#define __passwd_defined
44#endif
45
57int getpwnam_r(const char *nam, struct passwd *pwd, char *buffer, size_t bufsize,
58 struct passwd **result);
59
71int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result);
72
73#if defined(_XOPEN_SOURCE)
78void endpwent(void);
79
84struct passwd *getpwent(void);
85#endif
86
94struct passwd *getpwnam(const char *name);
95
103struct passwd *getpwuid(uid_t uid);
104
105#if defined(_XOPEN_SOURCE)
110void setpwent(void);
111#endif
112
113#ifdef __cplusplus
114}
115#endif
116
117#endif /* ZEPHYR_INCLUDE_POSIX_PWD_H_ */
int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
Look up a password entry by user ID (thread-safe).
int getpwnam_r(const char *nam, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
Look up a password entry by name (thread-safe).
void setpwent(void)
Rewind to the beginning of the password database.
struct passwd * getpwuid(uid_t uid)
Look up a password entry by user ID.
struct passwd * getpwnam(const char *name)
Look up a password entry by name.
void endpwent(void)
Close the password database.
struct passwd * getpwent(void)
Read the next password entry from the password database.
POSIX file status types and functions (<sys/stat.h>)
POSIX password database entry.
Definition pwd.h:32
char * pw_comment
User comment (unused).
Definition pwd.h:37
char * pw_name
User's login name.
Definition pwd.h:33
char * pw_gecos
Real name / GECOS field.
Definition pwd.h:38
char * pw_passwd
Encrypted password.
Definition pwd.h:34
char * pw_shell
Program to use as shell.
Definition pwd.h:40
uid_t pw_uid
Numerical user ID.
Definition pwd.h:35
gid_t pw_gid
Numerical group ID.
Definition pwd.h:36
char * pw_dir
Initial working directory.
Definition pwd.h:39