mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-01 18:39:16 +00:00
feat(userspace/libc): implement <pwd.h> header
Implemented everything except endpwent() and setpwent() NOT TESTED! Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
@ -25,21 +25,43 @@ extern "C"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/**
|
||||
* /etc/passwd
|
||||
* name:passwd:uid:gid:gecos:dir:shell
|
||||
*
|
||||
* Example
|
||||
*
|
||||
* root:x:0:0:root:/root:/bin/sh
|
||||
* | | | | | | |
|
||||
* | | | | | | \-- pw_shell
|
||||
* | | | | | \-- pw_dir
|
||||
* | | | | \-- pw_gecos
|
||||
* | | | \-- pw_gid
|
||||
* | | \-- pw_uid
|
||||
* | \-- pw_passwd
|
||||
* \-- pw_name
|
||||
*
|
||||
* @ref https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/pwd.h.html
|
||||
* @ref https://man7.org/linux/man-pages/man3/getpw.3.html
|
||||
* @ref https://man7.org/linux/man-pages/man5/passwd.5.html
|
||||
*/
|
||||
struct passwd
|
||||
{
|
||||
char *pw_name; /* User's login name. */
|
||||
uid_t pw_uid; /* Numerical user ID. */
|
||||
gid_t pw_gid; /* Numerical group ID. */
|
||||
char *pw_dir; /* Initial working directory. */
|
||||
char *pw_shell; /* Program to use as shell. */
|
||||
char *pw_name; /* User's login name. */
|
||||
char *pw_passwd; /* User password. */
|
||||
uid_t pw_uid; /* Numerical user ID. */
|
||||
gid_t pw_gid; /* Numerical group ID. */
|
||||
char *pw_gecos; /* User information. */
|
||||
char *pw_dir; /* Initial working directory. */
|
||||
char *pw_shell; /* Program to use as shell. */
|
||||
};
|
||||
|
||||
void endpwent(void);
|
||||
struct passwd *getpwent(void);
|
||||
struct passwd *getpwnam(const char *);
|
||||
int getpwnam_r(const char *, struct passwd *, char *, size_t, struct passwd **);
|
||||
struct passwd *getpwuid(uid_t);
|
||||
int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **);
|
||||
struct passwd *getpwnam(const char *name);
|
||||
int getpwnam_r(const char *name, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result);
|
||||
struct passwd *getpwuid(uid_t uid);
|
||||
int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result);
|
||||
void setpwent(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Reference in New Issue
Block a user