aboutsummaryrefslogtreecommitdiff
path: root/libbb/procps.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-27 02:52:20 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-27 02:52:20 +0000
commitdefc1ea34074e7882724c460260d307cdf981a70 (patch)
treefca9b9a5fe243f9c0c76b84824ea2ff92ea8e589 /libbb/procps.c
parent26bc57d8b26425f23f4be974cce7bf35c95c9a1a (diff)
downloadbusybox-w32-defc1ea34074e7882724c460260d307cdf981a70.tar.gz
busybox-w32-defc1ea34074e7882724c460260d307cdf981a70.tar.bz2
busybox-w32-defc1ea34074e7882724c460260d307cdf981a70.zip
*: introduce and use FAST_FUNC: regparm on i386, otherwise no-on
text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
Diffstat (limited to 'libbb/procps.c')
-rw-r--r--libbb/procps.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index 8946917a2..7d49d83ce 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -30,7 +30,7 @@ static void clear_cache(cache_t *cp)
30 cp->cache = NULL; 30 cp->cache = NULL;
31 cp->size = 0; 31 cp->size = 0;
32} 32}
33void clear_username_cache(void) 33void FAST_FUNC clear_username_cache(void)
34{ 34{
35 clear_cache(&username); 35 clear_cache(&username);
36 clear_cache(&groupname); 36 clear_cache(&groupname);
@@ -52,7 +52,7 @@ static int get_cached(cache_t *cp, unsigned id)
52} 52}
53#endif 53#endif
54 54
55typedef char* ug_func(char *name, int bufsize, long uid); 55typedef char* FAST_FUNC ug_func(char *name, int bufsize, long uid);
56static char* get_cached(cache_t *cp, unsigned id, ug_func* fp) 56static char* get_cached(cache_t *cp, unsigned id, ug_func* fp)
57{ 57{
58 int i; 58 int i;
@@ -66,11 +66,11 @@ static char* get_cached(cache_t *cp, unsigned id, ug_func* fp)
66 fp(cp->cache[i].name, sizeof(cp->cache[i].name), id); 66 fp(cp->cache[i].name, sizeof(cp->cache[i].name), id);
67 return cp->cache[i].name; 67 return cp->cache[i].name;
68} 68}
69const char* get_cached_username(uid_t uid) 69const char* FAST_FUNC get_cached_username(uid_t uid)
70{ 70{
71 return get_cached(&username, uid, bb_getpwuid); 71 return get_cached(&username, uid, bb_getpwuid);
72} 72}
73const char* get_cached_groupname(gid_t gid) 73const char* FAST_FUNC get_cached_groupname(gid_t gid)
74{ 74{
75 return get_cached(&groupname, gid, bb_getgrgid); 75 return get_cached(&groupname, gid, bb_getgrgid);
76} 76}
@@ -78,7 +78,7 @@ const char* get_cached_groupname(gid_t gid)
78 78
79#define PROCPS_BUFSIZE 1024 79#define PROCPS_BUFSIZE 1024
80 80
81static int read_to_buf(const char *filename, void *buf) 81static int FAST_FUNC read_to_buf(const char *filename, void *buf)
82{ 82{
83 int fd; 83 int fd;
84 /* open_read_close() would do two reads, checking for EOF. 84 /* open_read_close() would do two reads, checking for EOF.
@@ -93,7 +93,7 @@ static int read_to_buf(const char *filename, void *buf)
93 return ret; 93 return ret;
94} 94}
95 95
96static procps_status_t *alloc_procps_scan(void) 96static procps_status_t* FAST_FUNC alloc_procps_scan(void)
97{ 97{
98 unsigned n = getpagesize(); 98 unsigned n = getpagesize();
99 procps_status_t* sp = xzalloc(sizeof(procps_status_t)); 99 procps_status_t* sp = xzalloc(sizeof(procps_status_t));
@@ -107,7 +107,7 @@ static procps_status_t *alloc_procps_scan(void)
107 return sp; 107 return sp;
108} 108}
109 109
110void free_procps_scan(procps_status_t* sp) 110void FAST_FUNC free_procps_scan(procps_status_t* sp)
111{ 111{
112 closedir(sp->dir); 112 closedir(sp->dir);
113 free(sp->argv0); 113 free(sp->argv0);
@@ -163,7 +163,7 @@ static char *skip_fields(char *str, int count)
163#endif 163#endif
164 164
165void BUG_comm_size(void); 165void BUG_comm_size(void);
166procps_status_t *procps_scan(procps_status_t* sp, int flags) 166procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
167{ 167{
168 struct dirent *entry; 168 struct dirent *entry;
169 char buf[PROCPS_BUFSIZE]; 169 char buf[PROCPS_BUFSIZE];
@@ -402,7 +402,7 @@ procps_status_t *procps_scan(procps_status_t* sp, int flags)
402 return sp; 402 return sp;
403} 403}
404 404
405void read_cmdline(char *buf, int col, unsigned pid, const char *comm) 405void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm)
406{ 406{
407 ssize_t sz; 407 ssize_t sz;
408 char filename[sizeof("/proc//cmdline") + sizeof(int)*3]; 408 char filename[sizeof("/proc//cmdline") + sizeof(int)*3];