ash: cache more of uid/gid syscalls
Testcase: setuidgid 1:1 strace ash -c 'test -x TODO; test -x TODO; echo $?' should show that second "test -x" does not query ids again. function old new delta ash_main 1236 1256 +20 get_cached_euid - 19 +19 get_cached_egid - 19 +19 test_main 56 72 +16 test_exec 119 135 +16 is_in_supplementary_groups 52 57 +5 nexpr 718 702 -16 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 4/1 up/down: 95/-16) Total: 79 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
d26e958725
commit
96b0607302
4 changed files with 30 additions and 10 deletions
|
@ -46,6 +46,20 @@ gid_t* FAST_FUNC bb_getgroups(int *ngroups, gid_t *group_array)
|
|||
return group_array;
|
||||
}
|
||||
|
||||
uid_t FAST_FUNC get_cached_euid(uid_t *euid)
|
||||
{
|
||||
if (*euid == (uid_t)-1)
|
||||
*euid = geteuid();
|
||||
return *euid;
|
||||
}
|
||||
|
||||
gid_t FAST_FUNC get_cached_egid(gid_t *egid)
|
||||
{
|
||||
if (*egid == (gid_t)-1)
|
||||
*egid = getegid();
|
||||
return *egid;
|
||||
}
|
||||
|
||||
/* Return non-zero if GID is in our supplementary group list. */
|
||||
int FAST_FUNC is_in_supplementary_groups(struct cached_groupinfo *groupinfo, gid_t gid)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue