ash: in tryexec(), ensure we don't try to run embedded scripts as applets
[oweals/busybox.git] / procps / iostat.c
index 51c5fac08c43f240405fca15eb645684ae708a90..8fb4594dabb5e2757cfd0704eb3a32c80427cec3 100644 (file)
@@ -6,12 +6,11 @@
  *
  * Licensed under GPLv2, see file LICENSE in this source tree.
  */
-
 //config:config IOSTAT
-//config:      bool "iostat"
+//config:      bool "iostat (7.4 kb)"
 //config:      default y
 //config:      help
-//config:        Report CPU and I/O statistics
+//config:      Report CPU and I/O statistics
 
 //applet:IF_IOSTAT(APPLET(iostat, BB_DIR_BIN, BB_SUID_DROP))
 
@@ -109,11 +108,6 @@ enum {
        OPT_m = 1 << 5,
 };
 
-static ALWAYS_INLINE unsigned get_user_hz(void)
-{
-       return sysconf(_SC_CLK_TCK);
-}
-
 static ALWAYS_INLINE int this_is_smp(void)
 {
        return (G.total_cpus > 1);
@@ -147,7 +141,7 @@ static void print_timestamp(void)
        /* %x: date representation for the current locale */
        /* %X: time representation for the current locale */
        strftime(buf, sizeof(buf), "%x %X", &G.tmtime);
-       printf("%s\n", buf);
+       puts(buf);
 }
 
 static cputime_t get_smp_uptime(void)
@@ -393,7 +387,6 @@ static void dev_report(cputime_t itv)
 //usage:       "[-c] [-d] [-t] [-z] [-k|-m] [ALL|BLOCKDEV...] [INTERVAL [COUNT]]"
 //usage:#define iostat_full_usage "\n\n"
 //usage:       "Report CPU and I/O statistics\n"
-//usage:     "\nOptions:"
 //usage:     "\n       -c      Show CPU utilization"
 //usage:     "\n       -d      Show device utilization"
 //usage:     "\n       -t      Print current time"
@@ -415,7 +408,7 @@ int iostat_main(int argc UNUSED_PARAM, char **argv)
        memset(&stats_data, 0, sizeof(stats_data));
 
        /* Get number of clock ticks per sec */
-       G.clk_tck = get_user_hz();
+       G.clk_tck = bb_clk_tck();
 
        /* Determine number of CPUs */
        G.total_cpus = get_cpu_count();
@@ -424,8 +417,7 @@ int iostat_main(int argc UNUSED_PARAM, char **argv)
 
        /* Parse and process arguments */
        /* -k and -m are mutually exclusive */
-       opt_complementary = "k--m:m--k";
-       opt = getopt32(argv, "cdtzkm");
+       opt = getopt32(argv, "^" "cdtzkm" "\0" "k--m:m--k");
        if (!(opt & (OPT_c + OPT_d)))
                /* Default is -cd */
                opt |= OPT_c + OPT_d;