aboutsummaryrefslogtreecommitdiff
path: root/include/pwd_.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/pwd_.h')
-rw-r--r--include/pwd_.h33
1 files changed, 12 insertions, 21 deletions
diff --git a/include/pwd_.h b/include/pwd_.h
index 6199034d2..c36e4686c 100644
--- a/include/pwd_.h
+++ b/include/pwd_.h
@@ -21,24 +21,17 @@
21 * POSIX Standard: 9.2.2 User Database Access <pwd.h> 21 * POSIX Standard: 9.2.2 User Database Access <pwd.h>
22 */ 22 */
23 23
24#ifndef _PWD_H 24#ifndef BB_PWD_H
25#define _PWD_H 1 25#define BB_PWD_H 1
26 26
27#if __GNUC_PREREQ(4,1) 27#if __GNUC_PREREQ(4,1)
28# pragma GCC visibility push(hidden) 28# pragma GCC visibility push(hidden)
29#endif 29#endif
30 30
31/* The passwd structure. */ 31/* This file is #included after #include <pwd.h>
32struct passwd { 32 * We will use libc-defined structures, but will #define finction names
33 char *pw_name; /* Username. */ 33 * so that function calls are directed to bb_internal_XXX replacements
34 char *pw_passwd; /* Password. */ 34 */
35 uid_t pw_uid; /* User ID. */
36 gid_t pw_gid; /* Group ID. */
37 char *pw_gecos; /* Real name. */
38 char *pw_dir; /* Home directory. */
39 char *pw_shell; /* Shell program. */
40};
41
42 35
43#define setpwent bb_internal_setpwent 36#define setpwent bb_internal_setpwent
44#define endpwent bb_internal_endpwent 37#define endpwent bb_internal_endpwent
@@ -51,13 +44,11 @@ struct passwd {
51#define getpwuid_r bb_internal_getpwuid_r 44#define getpwuid_r bb_internal_getpwuid_r
52#define getpwnam_r bb_internal_getpwnam_r 45#define getpwnam_r bb_internal_getpwnam_r
53#define fgetpwent_r bb_internal_fgetpwent_r 46#define fgetpwent_r bb_internal_fgetpwent_r
54#define getpw bb_internal_getpw 47//#define getpw bb_internal_getpw
55 48
56 49
57/* All function names below should be remapped by #defines above 50/* All function names below should be remapped by #defines above
58 * in order to not collide with libc names. 51 * in order to not collide with libc names. */
59 * In theory it isn't necessary, but I saw weird interactions at link time.
60 * Let's play safe */
61 52
62 53
63/* Rewind the password-file stream. */ 54/* Rewind the password-file stream. */
@@ -73,14 +64,14 @@ extern struct passwd *getpwent(void);
73extern struct passwd *fgetpwent(FILE *__stream); 64extern struct passwd *fgetpwent(FILE *__stream);
74 65
75/* Write the given entry onto the given stream. */ 66/* Write the given entry onto the given stream. */
76extern int putpwent(__const struct passwd *__restrict __p, 67extern int putpwent(const struct passwd *__restrict __p,
77 FILE *__restrict __f); 68 FILE *__restrict __f);
78 69
79/* Search for an entry with a matching user ID. */ 70/* Search for an entry with a matching user ID. */
80extern struct passwd *getpwuid(uid_t __uid); 71extern struct passwd *getpwuid(uid_t __uid);
81 72
82/* Search for an entry with a matching username. */ 73/* Search for an entry with a matching username. */
83extern struct passwd *getpwnam(__const char *__name); 74extern struct passwd *getpwnam(const char *__name);
84 75
85/* Reentrant versions of some of the functions above. 76/* Reentrant versions of some of the functions above.
86 77
@@ -99,7 +90,7 @@ extern int getpwuid_r(uid_t __uid,
99 char *__restrict __buffer, size_t __buflen, 90 char *__restrict __buffer, size_t __buflen,
100 struct passwd **__restrict __result); 91 struct passwd **__restrict __result);
101 92
102extern int getpwnam_r(__const char *__restrict __name, 93extern int getpwnam_r(const char *__restrict __name,
103 struct passwd *__restrict __resultbuf, 94 struct passwd *__restrict __resultbuf,
104 char *__restrict __buffer, size_t __buflen, 95 char *__restrict __buffer, size_t __buflen,
105 struct passwd **__restrict __result); 96 struct passwd **__restrict __result);
@@ -114,7 +105,7 @@ extern int fgetpwent_r(FILE *__restrict __stream,
114/* Re-construct the password-file line for the given uid 105/* Re-construct the password-file line for the given uid
115 in the given buffer. This knows the format that the caller 106 in the given buffer. This knows the format that the caller
116 will expect, but this need not be the format of the password file. */ 107 will expect, but this need not be the format of the password file. */
117extern int getpw(uid_t __uid, char *__buffer); 108/* UNUSED extern int getpw(uid_t __uid, char *__buffer); */
118 109
119#if __GNUC_PREREQ(4,1) 110#if __GNUC_PREREQ(4,1)
120# pragma GCC visibility pop 111# pragma GCC visibility pop