From 8131eea3dce5fba0dfb78e6083d1730423fad20b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 2 Nov 2009 14:19:51 +0100 Subject: *: introduce and use ffulsh_all() function old new delta buffer_fill_and_print 179 196 +17 fflush_all - 9 +9 spawn 87 92 +5 rtcwake_main 455 453 -2 ... alarm_intr 93 84 -9 readcmd 1072 1062 -10 bb_ask 345 333 -12 more_main 845 832 -13 flush_stdout_stderr 42 23 -19 xfflush_stdout 27 - -27 flush_stderr 30 - -30 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397) Total: -366 bytes Signed-off-by: Denys Vlasenko --- networking/arping.c | 2 +- networking/ftpd.c | 2 +- networking/ifupdown.c | 4 ++-- networking/libiproute/ipaddress.c | 4 ++-- networking/libiproute/iprule.c | 2 +- networking/nc_bloaty.c | 2 +- networking/ping.c | 2 +- networking/telnetd.c | 4 ++-- networking/traceroute.c | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) (limited to 'networking') diff --git a/networking/arping.c b/networking/arping.c index 71690cf30..e3418a945 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -237,7 +237,7 @@ static bool recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM) } else { printf(" UNSOLICITED?\n"); } - fflush(stdout); + fflush_all(); } received++; if (FROM->sll_pkttype != PACKET_HOST) diff --git a/networking/ftpd.c b/networking/ftpd.c index 70a353312..9937cc3ea 100644 --- a/networking/ftpd.c +++ b/networking/ftpd.c @@ -630,7 +630,7 @@ popen_ls(const char *opt) cwd = xrealloc_getcwd_or_warn(NULL); xpiped_pair(outfd); - /*fflush(NULL); - so far we dont use stdio on output */ + /*fflush_all(); - so far we dont use stdio on output */ pid = BB_MMU ? fork() : vfork(); if (pid < 0) bb_perror_msg_and_die(BB_MMU ? "fork" : "vfork"); diff --git a/networking/ifupdown.c b/networking/ifupdown.c index d0c5cce07..88d1944da 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -969,7 +969,7 @@ static int doit(char *str) pid_t child; int status; - fflush(NULL); + fflush_all(); child = vfork(); switch (child) { case -1: /* failure */ @@ -1038,7 +1038,7 @@ static int popen2(FILE **in, FILE **out, char *command, char *param) xpiped_pair(infd); xpiped_pair(outfd); - fflush(NULL); + fflush_all(); pid = vfork(); switch (pid) { diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index 86d27548b..fcf9623e4 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c @@ -182,7 +182,7 @@ static NOINLINE int print_linkinfo(const struct nlmsghdr *n) } } bb_putchar('\n'); - /*fflush(stdout);*/ + /*fflush_all();*/ return 0; } @@ -344,7 +344,7 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM, printf(" %s", buf); } bb_putchar('\n'); - /*fflush(stdout);*/ + /*fflush_all();*/ return 0; } diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c index e52473117..659f3a9f0 100644 --- a/networking/libiproute/iprule.c +++ b/networking/libiproute/iprule.c @@ -151,7 +151,7 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM, fputs(rtnl_rtntype_n2a(r->rtm_type, b1), stdout); bb_putchar('\n'); - /*fflush(stdout);*/ + /*fflush_all();*/ return 0; } diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c index 9aaeec100..ad98bed30 100644 --- a/networking/nc_bloaty.c +++ b/networking/nc_bloaty.c @@ -152,7 +152,7 @@ enum { /* Debug: squirt whatever message and sleep a bit so we can see it go by. */ /* Beware: writes to stdOUT... */ #if 0 -#define Debug(...) do { printf(__VA_ARGS__); printf("\n"); fflush(stdout); sleep(1); } while (0) +#define Debug(...) do { printf(__VA_ARGS__); printf("\n"); fflush_all(); sleep(1); } while (0) #else #define Debug(...) do { } while (0) #endif diff --git a/networking/ping.c b/networking/ping.c index 71b2a4be8..d30eb5cfa 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -491,7 +491,7 @@ static void unpack_tail(int sz, uint32_t *tp, if (tp) printf(" time=%u.%03u ms", triptime / 1000, triptime % 1000); puts(dupmsg); - fflush(stdout); + fflush_all(); } static void unpack4(char *buf, int sz, struct sockaddr_in *from) { diff --git a/networking/telnetd.c b/networking/telnetd.c index 163efaa42..b0a1cc4d8 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c @@ -288,7 +288,7 @@ make_new_session( /*ts->size2 = 0;*/ } - fflush(NULL); /* flush all streams */ + fflush_all(); pid = vfork(); /* NOMMU-friendly */ if (pid < 0) { free(ts); @@ -331,7 +331,7 @@ make_new_session( /*termbuf.c_lflag &= ~ICANON;*/ tcsetattr_stdin_TCSANOW(&termbuf); - /* Uses FILE-based I/O to stdout, but does fflush(stdout), + /* Uses FILE-based I/O to stdout, but does fflush_all(), * so should be safe with vfork. * I fear, though, that some users will have ridiculously big * issue files, and they may block writing to fd 1, diff --git a/networking/traceroute.c b/networking/traceroute.c index 7284f0022..fa45db98a 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -815,7 +815,7 @@ int traceroute_main(int argc, char **argv) if (!first && pausemsecs > 0) usleep(pausemsecs * 1000); - fflush(stdout); + fflush_all(); t1 = monotonic_us(); send_probe(++seq, ttl); -- cgit v1.2.3