diff options
author | Pascal Bellard <pascal.bellard@ads-lu.com> | 2010-06-28 15:50:22 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-28 15:51:01 +0200 |
commit | ff37799dfe0e6e8fb9b971a2aeb4076d8a3784ec (patch) | |
tree | 61705ab230d6ba9b0d625f6087c39bc2dea0a679 /init | |
parent | 7d1201c5d7014365fb7e3d9da58f5e3fe0a1edc8 (diff) | |
download | busybox-w32-ff37799dfe0e6e8fb9b971a2aeb4076d8a3784ec.tar.gz busybox-w32-ff37799dfe0e6e8fb9b971a2aeb4076d8a3784ec.tar.bz2 busybox-w32-ff37799dfe0e6e8fb9b971a2aeb4076d8a3784ec.zip |
conspy: code shrink
function old new delta
conspy_main 1446 1444 -2
screen_read_close 114 108 -6
screen_char 299 293 -6
Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'init')
-rw-r--r-- | init/bootchartd.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/init/bootchartd.c b/init/bootchartd.c index f7de13e2f..4e15da4e8 100644 --- a/init/bootchartd.c +++ b/init/bootchartd.c | |||
@@ -156,7 +156,7 @@ static int dump_procs(FILE *fp, int look_for_login_process) | |||
156 | continue; | 156 | continue; |
157 | p++; | 157 | p++; |
158 | strchrnul(p, ')')[0] = '\0'; | 158 | strchrnul(p, ')')[0] = '\0'; |
159 | /* If is gdm, kdm or a getty? */ | 159 | /* Is it gdm, kdm or a getty? */ |
160 | if (((p[0] == 'g' || p[0] == 'k' || p[0] == 'x') && p[1] == 'd' && p[2] == 'm') | 160 | if (((p[0] == 'g' || p[0] == 'k' || p[0] == 'x') && p[1] == 'd' && p[2] == 'm') |
161 | || strstr(p, "getty") | 161 | || strstr(p, "getty") |
162 | ) { | 162 | ) { |
@@ -258,13 +258,12 @@ static void finalize(char *tempdir, const char *prog) | |||
258 | fprintf(header_fp, "profile.process = %s\n", prog); | 258 | fprintf(header_fp, "profile.process = %s\n", prog); |
259 | 259 | ||
260 | fputs("version = "BC_VERSION_STR"\n", header_fp); | 260 | fputs("version = "BC_VERSION_STR"\n", header_fp); |
261 | |||
262 | if (ENABLE_FEATURE_BOOTCHARTD_BLOATED_HEADER) { | 261 | if (ENABLE_FEATURE_BOOTCHARTD_BLOATED_HEADER) { |
263 | char *hostname; | 262 | char *hostname; |
264 | char *kcmdline; | 263 | char *kcmdline; |
265 | time_t t; | 264 | time_t t; |
266 | struct tm tm_time; | 265 | struct tm tm_time; |
267 | /* x2 for possible localized data */ | 266 | /* x2 for possible localized weekday/month names */ |
268 | char date_buf[sizeof("Mon Jun 21 05:29:03 CEST 2010") * 2]; | 267 | char date_buf[sizeof("Mon Jun 21 05:29:03 CEST 2010") * 2]; |
269 | struct utsname unamebuf; | 268 | struct utsname unamebuf; |
270 | 269 | ||
@@ -313,16 +312,16 @@ static void finalize(char *tempdir, const char *prog) | |||
313 | */ | 312 | */ |
314 | } | 313 | } |
315 | 314 | ||
316 | /* Usage: | 315 | //usage:#define bootchartd_trivial_usage |
317 | * bootchartd start [PROG ARGS]: start logging in background, USR1 stops it. | 316 | //usage: "start [PROG ARGS]|stop|init" |
318 | * With PROG, runs PROG, then kills background logging. | 317 | //usage:#define bootchartd_full_usage "\n\n" |
319 | * bootchartd stop: same as "killall -USR1 bootchartd" | 318 | //usage: "Create /var/log/bootchart.tgz with boot chart data\n" |
320 | * bootchartd init: start logging in background | 319 | //usage: "\nOptions:" |
321 | * Stop when getty/gdm is seen (if AUTO_STOP_LOGGER = yes). | 320 | //usage: "\nstart: start background logging; with PROG, run PROG, then kill logging with USR1" |
322 | * Meant to be used from init scripts. | 321 | //usage: "\nstop: send USR1 to all bootchartd processes" |
323 | * bootchartd (pid==1): as init, but then execs $bootchart_init, /init, /sbin/init | 322 | //usage: "\ninit: start background logging; stop when getty/xdm is seen (for init scripts)" |
324 | * Meant to be used as kernel's init process. | 323 | //usage: "\nUnder PID 1: as init, then exec $bootchart_init, /init, /sbin/init" |
325 | */ | 324 | |
326 | int bootchartd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 325 | int bootchartd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
327 | int bootchartd_main(int argc UNUSED_PARAM, char **argv) | 326 | int bootchartd_main(int argc UNUSED_PARAM, char **argv) |
328 | { | 327 | { |
@@ -358,7 +357,7 @@ int bootchartd_main(int argc UNUSED_PARAM, char **argv) | |||
358 | cmd = CMD_PID1; | 357 | cmd = CMD_PID1; |
359 | } | 358 | } |
360 | 359 | ||
361 | /* Here we are in START or INIT state */ | 360 | /* Here we are in START, INIT or CMD_PID1 state */ |
362 | 361 | ||
363 | /* Read config file: */ | 362 | /* Read config file: */ |
364 | sample_period_us = 200 * 1000; | 363 | sample_period_us = 200 * 1000; |
@@ -422,7 +421,7 @@ int bootchartd_main(int argc UNUSED_PARAM, char **argv) | |||
422 | execl(bootchart_init, bootchart_init, NULL); | 421 | execl(bootchart_init, bootchart_init, NULL); |
423 | execl("/init", "init", NULL); | 422 | execl("/init", "init", NULL); |
424 | execl("/sbin/init", "init", NULL); | 423 | execl("/sbin/init", "init", NULL); |
425 | bb_perror_msg_and_die("can't exec '%s'", "/sbin/init"); | 424 | bb_perror_msg_and_die("can't execute '%s'", "/sbin/init"); |
426 | } | 425 | } |
427 | 426 | ||
428 | if (cmd == CMD_START && argv[2]) { /* "start PROG ARGS" */ | 427 | if (cmd == CMD_START && argv[2]) { /* "start PROG ARGS" */ |
@@ -432,7 +431,7 @@ int bootchartd_main(int argc UNUSED_PARAM, char **argv) | |||
432 | if (pid == 0) { /* child */ | 431 | if (pid == 0) { /* child */ |
433 | argv += 2; | 432 | argv += 2; |
434 | execvp(argv[0], argv); | 433 | execvp(argv[0], argv); |
435 | bb_perror_msg_and_die("can't exec '%s'", argv[0]); | 434 | bb_perror_msg_and_die("can't execute '%s'", argv[0]); |
436 | } | 435 | } |
437 | /* parent */ | 436 | /* parent */ |
438 | waitpid(pid, NULL, 0); | 437 | waitpid(pid, NULL, 0); |