aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2024-10-07 07:28:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2024-10-07 07:28:44 +0200
commit96b0607302500ed201a7816282efbaa8f990aa33 (patch)
tree06356b47fe5be44acad2e5b947e23e5411f9d33a /include
parentd26e9587252fdf4774a05e351b86d3a18c46384e (diff)
downloadbusybox-w32-96b0607302500ed201a7816282efbaa8f990aa33.tar.gz
busybox-w32-96b0607302500ed201a7816282efbaa8f990aa33.tar.bz2
busybox-w32-96b0607302500ed201a7816282efbaa8f990aa33.zip
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>
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 8748464ed..f5f8e1635 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1206,11 +1206,13 @@ gid_t *bb_getgroups(int *ngroups, gid_t *group_array) FAST_FUNC;
1206 * getgroups() is cached in supplementary_array[], to make successive calls faster. 1206 * getgroups() is cached in supplementary_array[], to make successive calls faster.
1207 */ 1207 */
1208struct cached_groupinfo { 1208struct cached_groupinfo {
1209 //TODO? gid_t egid; 1209 uid_t euid;
1210 gid_t egid;
1210 int ngroups; 1211 int ngroups;
1211 gid_t *supplementary_array; 1212 gid_t *supplementary_array;
1212}; 1213};
1213//TODO? int FAST_FUNC get_cached_egid(gid_t *egid); 1214uid_t FAST_FUNC get_cached_euid(uid_t *euid);
1215gid_t FAST_FUNC get_cached_egid(gid_t *egid);
1214int FAST_FUNC is_in_supplementary_groups(struct cached_groupinfo *groupinfo, gid_t gid); 1216int FAST_FUNC is_in_supplementary_groups(struct cached_groupinfo *groupinfo, gid_t gid);
1215 1217
1216#if ENABLE_FEATURE_UTMP 1218#if ENABLE_FEATURE_UTMP