diff options
-rw-r--r-- | include/grp_.h | 11 | ||||
-rw-r--r-- | include/pwd_.h | 14 | ||||
-rw-r--r-- | include/shadow_.h | 26 | ||||
-rw-r--r-- | libpwdgrp/pwd_grp.c | 32 |
4 files changed, 41 insertions, 42 deletions
diff --git a/include/grp_.h b/include/grp_.h index f7b8d836f..db13ce3b4 100644 --- a/include/grp_.h +++ b/include/grp_.h @@ -36,31 +36,30 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN #define getgrouplist bb_internal_getgrouplist #define initgroups bb_internal_initgroups - /* All function names below should be remapped by #defines above * in order to not collide with libc names. */ /* Close the group-file stream. */ -extern void endgrent(void); +void FAST_FUNC endgrent(void); /* Search for an entry with a matching group ID. */ -extern struct group *getgrgid(gid_t __gid); +struct group* FAST_FUNC getgrgid(gid_t __gid); /* Search for an entry with a matching group name. */ -extern struct group *getgrnam(const char *__name); +struct group* FAST_FUNC getgrnam(const char *__name); /* Reentrant versions of some of the functions above. */ /* Store at most *NGROUPS members of the group set for USER into *GROUPS. Also include GROUP. The actual number of groups found is returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. */ -extern int getgrouplist(const char *__user, gid_t __group, +int FAST_FUNC getgrouplist(const char *__user, gid_t __group, gid_t *__groups, int *__ngroups); /* Initialize the group set for the current user by reading the group database and using all groups of which USER is a member. Also include GROUP. */ -extern int initgroups(const char *__user, gid_t __group); +int FAST_FUNC initgroups(const char *__user, gid_t __group); POP_SAVED_FUNCTION_VISIBILITY diff --git a/include/pwd_.h b/include/pwd_.h index d086f86e3..32b5b366e 100644 --- a/include/pwd_.h +++ b/include/pwd_.h @@ -43,21 +43,21 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN * in order to not collide with libc names. */ /* Rewind the password-file stream. */ -extern void setpwent(void); +void FAST_FUNC setpwent(void); /* Close the password-file stream. */ -extern void endpwent(void); +void FAST_FUNC endpwent(void); #ifdef UNUSED_SINCE_WE_AVOID_STATIC_BUFS /* Read an entry from the password-file stream, opening it if necessary. */ -extern struct passwd *getpwent(void); +struct passwd* FAST_FUNC getpwent(void); #endif /* Search for an entry with a matching user ID. */ -extern struct passwd *getpwuid(uid_t __uid); +struct passwd* FAST_FUNC getpwuid(uid_t __uid); /* Search for an entry with a matching username. */ -extern struct passwd *getpwnam(const char *__name); +struct passwd* FAST_FUNC getpwnam(const char *__name); /* Reentrant versions of some of the functions above. @@ -67,11 +67,11 @@ extern struct passwd *getpwnam(const char *__name); other reentrant functions so the chances are good this is what the POSIX people would choose. */ -extern int getpwent_r(struct passwd *__restrict __resultbuf, +int FAST_FUNC getpwent_r(struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result); -extern int getpwnam_r(const char *__restrict __name, +int FAST_FUNC getpwnam_r(const char *__restrict __name, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result); diff --git a/include/shadow_.h b/include/shadow_.h index 7babe4f30..8e2581e7c 100644 --- a/include/shadow_.h +++ b/include/shadow_.h @@ -57,48 +57,48 @@ struct spwd { #ifdef UNUSED_FOR_NOW /* Open database for reading */ -extern void setspent(void); +void FAST_FUNC setspent(void); /* Close database */ -extern void endspent(void); +void FAST_FUNC endspent(void); /* Get next entry from database, perhaps after opening the file */ -extern struct spwd *getspent(void); +struct spwd* FAST_FUNC getspent(void); /* Get shadow entry matching NAME */ -extern struct spwd *getspnam(const char *__name); +struct spwd* FAST_FUNC getspnam(const char *__name); /* Read shadow entry from STRING */ -extern struct spwd *sgetspent(const char *__string); +struct spwd* FAST_FUNC sgetspent(const char *__string); /* Read next shadow entry from STREAM */ -extern struct spwd *fgetspent(FILE *__stream); +struct spwd* FAST_FUNC fgetspent(FILE *__stream); /* Write line containing shadow password entry to stream */ -extern int putspent(const struct spwd *__p, FILE *__stream); +int FAST_FUNC putspent(const struct spwd *__p, FILE *__stream); /* Reentrant versions of some of the functions above */ -extern int getspent_r(struct spwd *__result_buf, char *__buffer, +int FAST_FUNC getspent_r(struct spwd *__result_buf, char *__buffer, size_t __buflen, struct spwd **__result); #endif -extern int getspnam_r(const char *__name, struct spwd *__result_buf, +int FAST_FUNC getspnam_r(const char *__name, struct spwd *__result_buf, char *__buffer, size_t __buflen, struct spwd **__result); #ifdef UNUSED_FOR_NOW -extern int sgetspent_r(const char *__string, struct spwd *__result_buf, +int FAST_FUNC sgetspent_r(const char *__string, struct spwd *__result_buf, char *__buffer, size_t __buflen, struct spwd **__result); -extern int fgetspent_r(FILE *__stream, struct spwd *__result_buf, +int FAST_FUNC fgetspent_r(FILE *__stream, struct spwd *__result_buf, char *__buffer, size_t __buflen, struct spwd **__result); /* Protect password file against multi writers */ -extern int lckpwdf(void); +int FAST_FUNC lckpwdf(void); /* Unlock password file */ -extern int ulckpwdf(void); +int FAST_FUNC ulckpwdf(void); #endif POP_SAVED_FUNCTION_VISIBILITY diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c index ed8370124..0d8e2bb5c 100644 --- a/libpwdgrp/pwd_grp.c +++ b/libpwdgrp/pwd_grp.c @@ -288,7 +288,7 @@ static void *convert_to_struct(const char *def, const unsigned char *off, /****** getXXnam/id_r */ -static int getXXnam_r(const char *name, uintptr_t db_and_field_pos, char *buffer, size_t buflen, +static int FAST_FUNC getXXnam_r(const char *name, uintptr_t db_and_field_pos, char *buffer, size_t buflen, void *result) { void *struct_buf = *(void**)result; @@ -316,18 +316,18 @@ static int getXXnam_r(const char *name, uintptr_t db_and_field_pos, char *buffer return errno; } -int getpwnam_r(const char *name, struct passwd *struct_buf, char *buffer, size_t buflen, +int FAST_FUNC getpwnam_r(const char *name, struct passwd *struct_buf, char *buffer, size_t buflen, struct passwd **result) { /* Why the "store buffer address in result" trick? * This way, getXXnam_r has the same ABI signature as getpwnam_r, - * hopefully compiler can optimize tall call better in this case. + * hopefully compiler can optimize tail call better in this case. */ *result = struct_buf; return getXXnam_r(name, (0 << 2) + 0, buffer, buflen, result); } #if ENABLE_USE_BB_SHADOW -int getspnam_r(const char *name, struct spwd *struct_buf, char *buffer, size_t buflen, +int FAST_FUNC getspnam_r(const char *name, struct spwd *struct_buf, char *buffer, size_t buflen, struct spwd **result) { *result = struct_buf; @@ -337,7 +337,7 @@ int getspnam_r(const char *name, struct spwd *struct_buf, char *buffer, size_t b /****** getXXent_r */ -static int getXXent_r(void *struct_buf, char *buffer, size_t buflen, +static int FAST_FUNC getXXent_r(void *struct_buf, char *buffer, size_t buflen, void *result, unsigned db_idx) { @@ -374,14 +374,14 @@ static int getXXent_r(void *struct_buf, char *buffer, size_t buflen, return errno; } -int getpwent_r(struct passwd *struct_buf, char *buffer, size_t buflen, struct passwd **result) +int FAST_FUNC getpwent_r(struct passwd *struct_buf, char *buffer, size_t buflen, struct passwd **result) { return getXXent_r(struct_buf, buffer, buflen, result, 0); } /****** getXXnam/id */ -static void *getXXnam(const char *name, unsigned db_and_field_pos) +static void* FAST_FUNC getXXnam(const char *name, unsigned db_and_field_pos) { char *buf; void *result; @@ -409,39 +409,39 @@ static void *getXXnam(const char *name, unsigned db_and_field_pos) return result; } -struct passwd *getpwnam(const char *name) +struct passwd* FAST_FUNC getpwnam(const char *name) { return getXXnam(name, (0 << 2) + 0); } -struct group *getgrnam(const char *name) +struct group* FAST_FUNC getgrnam(const char *name) { return getXXnam(name, (1 << 2) + 0); } -struct passwd *getpwuid(uid_t id) +struct passwd* FAST_FUNC getpwuid(uid_t id) { return getXXnam(utoa(id), (0 << 2) + 2); } -struct group *getgrgid(gid_t id) +struct group* FAST_FUNC getgrgid(gid_t id) { return getXXnam(utoa(id), (1 << 2) + 2); } /****** end/setXXend */ -void endpwent(void) +void FAST_FUNC endpwent(void) { if (has_S && S.db[0].fp) { fclose(S.db[0].fp); S.db[0].fp = NULL; } } -void setpwent(void) +void FAST_FUNC setpwent(void) { if (has_S && S.db[0].fp) { rewind(S.db[0].fp); } } -void endgrent(void) +void FAST_FUNC endgrent(void) { if (has_S && S.db[1].fp) { fclose(S.db[1].fp); @@ -491,7 +491,7 @@ static gid_t* FAST_FUNC getgrouplist_internal(int *ngroups_ptr, return group_list; } -int initgroups(const char *user, gid_t gid) +int FAST_FUNC initgroups(const char *user, gid_t gid) { int ngroups; gid_t *group_list = getgrouplist_internal(&ngroups, user, gid); @@ -501,7 +501,7 @@ int initgroups(const char *user, gid_t gid) return ngroups; } -int getgrouplist(const char *user, gid_t gid, gid_t *groups, int *ngroups) +int FAST_FUNC getgrouplist(const char *user, gid_t gid, gid_t *groups, int *ngroups) { int ngroups_old = *ngroups; gid_t *group_list = getgrouplist_internal(ngroups, user, gid); |