diff options
Diffstat (limited to 'include/grp_.h')
-rw-r--r-- | include/grp_.h | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/include/grp_.h b/include/grp_.h index 23c4dcc03..697a78606 100644 --- a/include/grp_.h +++ b/include/grp_.h | |||
@@ -21,21 +21,17 @@ | |||
21 | * POSIX Standard: 9.2.1 Group Database Access <grp.h> | 21 | * POSIX Standard: 9.2.1 Group Database Access <grp.h> |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef _GRP_H | 24 | #ifndef BB_GRP_H |
25 | #define _GRP_H 1 | 25 | #define BB_GRP_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 group structure. */ | 31 | /* This file is #included after #include <grp.h> |
32 | struct group { | 32 | * We will use libc-defined structures, but will #define finction names |
33 | char *gr_name; /* Group name. */ | 33 | * so that function calls are directed to bb_internal_XXX replacements |
34 | char *gr_passwd; /* Password. */ | 34 | */ |
35 | gid_t gr_gid; /* Group ID. */ | ||
36 | char **gr_mem; /* Member list. */ | ||
37 | }; | ||
38 | |||
39 | 35 | ||
40 | #define setgrent bb_internal_setgrent | 36 | #define setgrent bb_internal_setgrent |
41 | #define endgrent bb_internal_endgrent | 37 | #define endgrent bb_internal_endgrent |
@@ -53,9 +49,7 @@ struct group { | |||
53 | 49 | ||
54 | 50 | ||
55 | /* All function names below should be remapped by #defines above | 51 | /* All function names below should be remapped by #defines above |
56 | * in order to not collide with libc names. | 52 | * in order to not collide with libc names. */ |
57 | * In theory it isn't necessary, but I saw weird interactions at link time. | ||
58 | * Let's play safe */ | ||
59 | 53 | ||
60 | 54 | ||
61 | /* Rewind the group-file stream. */ | 55 | /* Rewind the group-file stream. */ |
@@ -71,14 +65,14 @@ extern struct group *getgrent(void); | |||
71 | extern struct group *fgetgrent(FILE *__stream); | 65 | extern struct group *fgetgrent(FILE *__stream); |
72 | 66 | ||
73 | /* Write the given entry onto the given stream. */ | 67 | /* Write the given entry onto the given stream. */ |
74 | extern int putgrent(__const struct group *__restrict __p, | 68 | extern int putgrent(const struct group *__restrict __p, |
75 | FILE *__restrict __f); | 69 | FILE *__restrict __f); |
76 | 70 | ||
77 | /* Search for an entry with a matching group ID. */ | 71 | /* Search for an entry with a matching group ID. */ |
78 | extern struct group *getgrgid(gid_t __gid); | 72 | extern struct group *getgrgid(gid_t __gid); |
79 | 73 | ||
80 | /* Search for an entry with a matching group name. */ | 74 | /* Search for an entry with a matching group name. */ |
81 | extern struct group *getgrnam(__const char *__name); | 75 | extern struct group *getgrnam(const char *__name); |
82 | 76 | ||
83 | /* Reentrant versions of some of the functions above. | 77 | /* Reentrant versions of some of the functions above. |
84 | 78 | ||
@@ -98,7 +92,7 @@ extern int getgrgid_r(gid_t __gid, struct group *__restrict __resultbuf, | |||
98 | struct group **__restrict __result); | 92 | struct group **__restrict __result); |
99 | 93 | ||
100 | /* Search for an entry with a matching group name. */ | 94 | /* Search for an entry with a matching group name. */ |
101 | extern int getgrnam_r(__const char *__restrict __name, | 95 | extern int getgrnam_r(const char *__restrict __name, |
102 | struct group *__restrict __resultbuf, | 96 | struct group *__restrict __resultbuf, |
103 | char *__restrict __buffer, size_t __buflen, | 97 | char *__restrict __buffer, size_t __buflen, |
104 | struct group **__restrict __result); | 98 | struct group **__restrict __result); |
@@ -113,13 +107,13 @@ extern int fgetgrent_r(FILE *__restrict __stream, | |||
113 | /* Store at most *NGROUPS members of the group set for USER into | 107 | /* Store at most *NGROUPS members of the group set for USER into |
114 | *GROUPS. Also include GROUP. The actual number of groups found is | 108 | *GROUPS. Also include GROUP. The actual number of groups found is |
115 | returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. */ | 109 | returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. */ |
116 | extern int getgrouplist(__const char *__user, gid_t __group, | 110 | extern int getgrouplist(const char *__user, gid_t __group, |
117 | gid_t *__groups, int *__ngroups); | 111 | gid_t *__groups, int *__ngroups); |
118 | 112 | ||
119 | /* Initialize the group set for the current user | 113 | /* Initialize the group set for the current user |
120 | by reading the group database and using all groups | 114 | by reading the group database and using all groups |
121 | of which USER is a member. Also include GROUP. */ | 115 | of which USER is a member. Also include GROUP. */ |
122 | extern int initgroups(__const char *__user, gid_t __group); | 116 | extern int initgroups(const char *__user, gid_t __group); |
123 | 117 | ||
124 | #if __GNUC_PREREQ(4,1) | 118 | #if __GNUC_PREREQ(4,1) |
125 | # pragma GCC visibility pop | 119 | # pragma GCC visibility pop |