Commit Graph

492 Commits

Author SHA1 Message Date
Bernhard Reutner-Fischer
86a7f18f21 *: Switch to POSIX utmpx API
UTMP is SVID legacy, UTMPX is mandated by POSIX.

Glibc and uClibc have identical layout of UTMP and UTMPX, both of these
libc treat _PATH_UTMPX as _PATH_UTMP so from a user-perspective nothing
changes except the names of the API entrypoints.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-02 23:03:46 +02:00
Denys Vlasenko
da9212667c libbb: code shrink by factoring out common update_utmp_DEAD_PROCESS
function                                             old     new   delta
update_utmp_DEAD_PROCESS                               -      17     +17
telnetd_main                                        1685    1674     -11
mark_terminated                                       56      45     -11
handle_sigchld                                        74      63     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 15:37:58 +01:00
Denys Vlasenko
2bba9ad67a init: do not run shutdown/reexec actions from signal handler
this is racy wrt various libc functions such as syslog()

function                                             old     new   delta
check_delayed_sigs                                   182     352    +170
init_main                                            772     728     -44
restart_handler                                       74       -     -74
halt_reboot_pwoff                                     79       -     -79
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/1 up/down: 170/-197)          Total: -27 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-21 20:10:57 +01:00
Michael Tokarev
922fdf6527 init: do not fail build if SIGPWR is not defined
Apparently, some *BSD variants (and maybe some other OSes) does not define
SIGPWR signal.  So since commit 760fc6debc, busybox fails to build on
such platforms.  Fix this.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-30 13:22:04 +01:00
Bogdan Purcareata
760fc6debc 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>
2013-11-26 13:54:48 +01:00
Denys Vlasenko
8b59b2c13e libbb: move nuke_str() from passwd into libbb
function                                             old     new   delta
nuke_str                                               -      15     +15
ask_and_check_password_extended                      215     206      -9
init_main                                            781     771     -10
nuke_str                                              27       -     -27
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 15/-46)            Total: -31 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-19 13:36:45 +01:00
Yuan-Hsiang Lee
b21bc80c76 init: fix illegal memory access when max message length is reached
Signed-off-by: Yuan-Hsiang Lee <yhlee@ubnt.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-03 00:13:16 +01:00
Denys Vlasenko
18b461925c bootchartd: warn if .config looks wrong
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-03 00:07:31 +01:00
Denys Vlasenko
730e4d8b52 init: better --help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-12 04:52:22 +02:00
Paulius Zaleckas
9f07af6156 init: don't srop unterminated processes' entries during inittab reload
This feature was removed in 72c99af

It is useful when process is removed from inittab and later added
back, but never terminated. It prevents init from spawning duplicate.

function                                             old     new   delta
check_delayed_sigs                                   176     182      +6

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-16 12:01:58 +02:00
Denys Vlasenko
d2e07bc16c init: don't use fixed size buffer for command
We store init actions forever. 256 bytes per action means that
a typical inittab of ~10 commands uses 2.5k just to remember
command strings - which are usually _much_ shorter than 256 bytes.

At a cost of a bit more code, it's possible to allocate
only actually needed amount.

function                                             old     new   delta
init_exec                                            224     248     +24
new_init_action                                      140     142      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-16 11:48:48 +02:00
Denys Vlasenko
f958425451 init: remove special-case code for machines with less tham 1 MB of RAM.
function                                             old     new   delta
init_main                                            920     781    -139

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-21 16:36:51 +02:00
Denys Vlasenko
2c0508b4fa examples/inittab: fix a few incorrect statements about init
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-29 14:35:44 +01:00
Denys Vlasenko
60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00
Denys Vlasenko
da2b2da6a7 init: add a segv debugging aid, disabled by default
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-30 12:15:22 +01:00
Quentin Casasnovas
c158601d50 bootchartd: add process accounting feature
function                                             old     new   delta
bootchartd_main                                      962    1088    +126
finalize                                             294     357     +63
acct                                                   -      33     +33
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 222/0)             Total: 222 bytes

Signed-off-by: Quentin Casasnovas <quentin.casasnovas@mathembedded.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-18 02:12:13 +01:00
Denys Vlasenko
ef7aa46bc4 init: code shrink -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-05 03:54:28 +01:00
Denys Vlasenko
beb860ac75 init: utmp update of DEAD_PROCESS was misplaced, and could be skipped. Fixing.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-05 03:31:05 +01:00
Denys Vlasenko
d2277e262f nommu: fix cases where we mangle argv[0][0]
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-22 17:19:26 +01:00
Denys Vlasenko
67905e2d7c *: work around sysinfo.h versus linux/*.h problems
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-26 13:42:12 +02:00
Denys Vlasenko
db43d3d418 halt: perror_msg_and_die needs bb_ prefix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08 06:23:08 +02:00
Denys Vlasenko
104e01409d halt/reboot: better message if /sbin/telinit is not found
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-03 01:46:02 +02:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Denys Vlasenko
4a2aecb53a mesg: operate on stdin, not on stderr (compat)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-28 00:59:16 +02:00
Denys Vlasenko
beea5a70c3 mesg: make group/all writability configurable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-22 06:54:36 +01:00
Denys Vlasenko
32176ccec4 init: fix a case where execv's 1st arg was wrong
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-21 05:07:43 +01:00
Denys Vlasenko
8d0e0cdadf move utmp.h include to libbb.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 23:21:46 +01:00
Denys Vlasenko
b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Denys Vlasenko
6088e138e1 init: simpler handling of leading dash in commands
function                                             old     new   delta
init_exec                                            233     219     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-25 23:58:42 +01:00
Denys Vlasenko
1c31e9e82b use BB_EXECVP_or_die where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 04:34:09 +01:00
Denys Vlasenko
db5fe62b6d init: if PID!=1, show clearer error message. move usage text closer to main()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-02 20:13:03 +01:00
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko
3b060528a2 init: do not sleep forever on usage errors
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-25 00:40:32 +02:00
Denys Vlasenko
f2657a9968 init: do not clear CRTSCTS (fix from Debian bug 528560)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 02:04:10 +02:00
Denys Vlasenko
b1db09be5a init/*: move applet/kbuild/config/help bits into applet source files
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-12 13:47:15 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Jeremie Koenig
e7a0632b7b bootchartd: mounting tmpfs is Linux-specific
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-30 01:16:00 +02:00
Denys Vlasenko
ba2dcccd79 *: trailing empty lines removed
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26 01:49:12 +02:00
Jeremie Koenig
1c05303fdc init: make the initial $TERM value configurable
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:46:00 +02:00
Jeremie Koenig
714674e4da init,halt: portability improvements
* make init and halt use the same RB_* constants for reboot()
* conditionalize the Linux-specific code

Inspired by init.init.diff from the Debian kFreeBSD patches at:
http://svn.debian.org/viewsvn/d-i/people/slackydeb/kfreebsd/busybox/1.14/debian

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:45:51 +02:00
Jeremie Koenig
f812eace18 init,loginutils: termios portability fixes
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:45:42 +02:00
Jeremie Koenig
1d7266d3b5 mark Linux-specific configuration options
PLATFORM_LINUX is used as a dependency for applets or features
which require Linux-specific interfaces.

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:44:56 +02:00
Denys Vlasenko
7a2aa87c75 bootchartd: fix labels in config system. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-06 15:49:01 +02:00
Pascal Bellard
926031b764 *: introduce and use xfork() and xvfork()
function                                             old     new   delta
launch_helper                                        170     169      -1
setup_heredoc                                        312     302     -10
handle_dir_common                                    367     354     -13
expand_vars_to_list                                 2456    2443     -13
open_transformer                                      89      74     -15
data_extract_to_command                              439     423     -16
do_ipaddr                                           1406    1389     -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-85)             Total: -85 bytes

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04 15:32:38 +02:00
Keisuke Yasui
c03fb3cd7d bootchartd: fix sample period calculations
Signed-off-by: Keisuke Yasui <keisuke.yasui@toshiba.co.jp>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-28 16:05:54 +02:00
Pascal Bellard
ff37799dfe 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>
2010-06-28 15:51:01 +02:00
Denys Vlasenko
64606c6d01 typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-22 18:33:15 +02:00
Denys Vlasenko
6d9c88ad98 fix config help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-21 07:25:36 +02:00
Denys Vlasenko
adbbee46ad bootchartd: added optional compat features
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-21 07:17:23 +02:00
Denys Vlasenko
d70e0e995e *: add INSERTs to *.src files where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-08 12:15:11 +02:00