logread: flush output. closes 6710

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
logread: don't call shmdt() before exit, kernel does it for us.

function                                             old     new   delta
logread_main                                         472     466      -6
interrupted                                           20       9     -11
error_exit                                            20       -     -20
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-37)             Total: -37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
build system: do not generate MAX_APPLET_NAME_LEN (unused)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
devfsd: remove static variable

function                                             old     new   delta
static.msg                                             4       -      -4
get_uid_gid                                          114     107      -7
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-11)             Total: -11 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb: add sketch of tentative 'better' passwd/group API

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
init: halt on SIGPWR too

Most init processes implement a handler for SIGPWR that gracefully
stops all child processes when shutting down a machine. Some other
technologies rely on this signal - e.g. Busybox powered LXC
containers.

This patch makes busybox init halt when receiving SIGPWR.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
build system: use od -b instead of od -t x1

od -t is not available in non-CONFIG_DESKTOPed busybox od

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
platform: strchrnul is missing if __APPLE__

Signed-off-by: Daniel Borca <dborca@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
hush: typo fixes in comments

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
sed: open input files sequentially to avoid EMFILE

Currently, sed pre-opens all files, which may cause EMFILE errors
on systems with low ulimit -n.  Change sed to open one file at a time.

function                                             old     new   delta
get_next_line                                        177     235     +58
sed_main                                             682     652     -30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 58/-30)             Total: 28 bytes

Based on the patch by Daniel Borca <dborca@yahoo.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
sed: code shrink

function                                             old     new   delta
get_next_line                                        246     250      +4
sed_main                                             671     662      -9
add_input_file                                        47       -     -47
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 4/-56)             Total: -52 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
dpkg-deb: cosmetic correction to usage text

Signed-off-by: Daniel Borca <dborca@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ping: try SOCK_DGRAM if no root privileges

Signed-off-by: Daniel Borca <dborca@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
chpst: fix a bug where -U USER was using wrong USER (one from -u USER)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
fix assorted unused code and wrong format specs found by cppchekc (bug 6716)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Use unsigned printf/scanf conversion where more appropriate

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ntpd: let user know if spike was detected

function                                             old     new   delta
update_local_clock                                   861     943     +82

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ntpd: promote log level 3 to production

Without it, peer selection logic is hard to debug

function                                             old     new   delta
update_local_clock                                   861     982    +121
select_and_cluster                                   962    1065    +103
common_ping_main                                    1788    1821     +33
huft_build                                          1287    1296      +9
chpst_main                                           708     704      -4
INET6_resolve                                        127     119      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/2 up/down: 266/-12)           Total: 254 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ntpd: comment out "spike detection" code

function                                             old     new   delta
update_local_clock                                   982     835    -147

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ntpd: do not invalidate datapoints after step

Used to set p->filter_datapoint[i].d_dispersion = MAXDISP
and clear reachable bits, but this proved to be too agressive:
after step (tested with suspinding laptop for ~30 secs),
this caused all previous data to be considered invalid,
making us needing to collect full ~8 datapoins per peer
after step in order to start trusting them.
In turn, this was making poll interval decrease even after
step was done. (Poll interval decreases already before step
in this scenario, because we see large offsets and end up with
no good peer to select).

function                                             old     new   delta
reset_peer_stats                                     157     139     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>