summaryrefslogtreecommitdiff
path: root/rcS.c
Commit message (Collapse)AuthorAgeFilesLines
* rcS: cast format string to int64_tRosen Penev2020-07-201-1/+2
| | | | | | | musl 1.2.0 turns time_t into a 64-bit value, even on 32-bit. This makes it compatible. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* procd: add timing to start/stop loggingKarl Vogel2018-01-221-1/+12
| | | | | | | | | | | | | | | | Shows how long an initd task took, for example: procd: stop /etc/init.d/dropbear running - took 0.088824s procd: Update service dnsmasq procd: Update instance dnsmasq::dnsmasq procd: running /etc/init.d/dnsmasq running procd: start /etc/init.d/dnsmasq running procd: stop /etc/init.d/dnsmasq running - took 0.092586s v2: rename variables, correct time unit v3: use CLOCK_MONOTONIC_RAW to prevent issues with NTP and adjtime Signed-off-by: Karl Vogel <karl.vogel@gmail.com>
* procd: Add %m to several functions that return errno.Rosen Penev2018-01-021-1/+1
| | | | | | Might help with debugging. No size impact. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* procd: Do not leak pipe file descriptors to childrenMichal Sojka2017-07-311-0/+1
| | | | | | | Without this change, a process started by procd can have access to stdout/err of processes started by procd before. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
* rcS: add missing fcntl.h includeMatthias Schiffer2017-05-291-0/+1
| | | | | | Fixes: d42b21ed9305 "procd/rcS: Use /dev/null as stdin" Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* procd/rcS: Use /dev/null as stdinMichal Sojka2017-05-091-0/+6
| | | | | | | | | | | | This change ensures that /etc/init.d/* scripts are started with /dev/null as stdin. This is useful in cases where an init.d script reads (e.g. by mistake) from stdin, which a user can perceive as if some characters typed into shell on serial console are "eaten" by something else (i.e. by the init.d script running on background). This is very annoying, because each character needs to be pressed several times before it appears on the screen. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
* procd: Log initscript output prefixed with script nameMichal Sojka2017-03-201-2/+3
| | | | | | It helps with debugging of initscript problems. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
* procd: Don't use syslog before its initializationMichal Sojka2017-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | When procd starts a rcS script, it captures its stdout and stderr and logs them via syslog(). The problem with that is that the rest of procd code uses ulog rather than syslog() directly and ulog_open() doesn't call openlog() immediately, but only after something is logged with ulog(). This lazy calling of openlog() can result in the following unwanted behavior: 1) When rcS's stdout/err is logged via syslog(), the log identifier is not set yet (due to openlog() not called) and so the log message lacks information about source. 2) procd can also log stdout/err from services. When a message from a service needs to be logged, ulog_open() is called to change the log identifier to match the service name/PID. After logging the service messages, ulog_open() is called again the change the identifier back to "procd". The lazy call to openlog() means that the messages logged directly with syslog() will be logged with the identification of the previously logged service and not of the rcS script that produced the message. Both problems are fixed by replacing direct call to syslog() with ULOG_NOTE, which automatically calls openlog() if needed. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
* procd: add cancel_timeout on rc scripts when a runtime_timeout is specifiedJurgen Van Ham2017-02-151-1/+3
| | | | | | | Enable procd to restrict the execution time of a rc scripts during shutdown, even when a script ignores the SIGTERM signal by insisting after 10s with a SIGKILL. Signed-off-by: Jurgen Van Ham <juvanham.tc@gmail.com>
* syslog: set sane priority valuesUlrich Weber2015-11-071-1/+1
| | | | | | otherwise LOG_USER/LOG_EMERG is used Signed-off-by: Ulrich Weber <uw@ocedo.com>
* Attempt to deal gracefully with allocation failures.Juliusz Chroboczek2015-07-061-0/+9
| | | | | These should probably not happen in practice, but having an explicit error message may make debugging out-of-memory situations easier.
* Log startup/shutdown to consoleJohn Crispin2014-10-301-0/+3
| | | | | | | | | | | procd has the habit of logging startup/shutdown via rcS to syslog, which is pointless in case of a shutdown, and unlikely to be complete on a startup (as syslog is not running). Write to the console instead. Signed-off-by: Michel Stam <m.stam@fugro.nl> Signed-off-by: John Crispin <blogic@openwrt.org>
* fix timeout on shutdownJohn Crispin2014-09-131-1/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* rcS: fix a format string bugFelix Fietkau2014-03-181-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* rcS: do not access ustream_buf data directlyFelix Fietkau2014-03-181-3/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* commit e0921ed71bab0ad7d2344774a33c22809eb10190 set the timeout globallyJohn Crispin2014-02-071-1/+2
| | | | | | lets restrict it to stop scripts only Signed-off-by: John Crispin <blogic@openwrt.org>
* force all runqueue tasks to a timeout of 15sJohn Crispin2014-01-291-0/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* fix rcS memory leaks and running hookJohn Crispin2013-11-201-24/+15
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* add a function to add calls to the front of the rcS queueJohn Crispin2013-11-181-3/+16
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* debloat and reorganize codeJohn Crispin2013-11-151-5/+5
| | | | | | | split app into procd and init binaries remove log support, this is an external service now Signed-off-by: John Crispin <blogic@openwrt.org>
* syslog() is a blocking call on eglibc. as procd provides the actual syslog, ↵John Crispin2013-09-281-1/+1
| | | | | | | weneed to make sure that we do not run into a deadlock. Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Markus Stenberg <markus.stenberg@iki.fi>
* add a way for procd to queue async init.d callsJohn Crispin2013-09-131-11/+33
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* update rcS.c to match new runqueue api changesJohn Crispin2013-05-291-3/+3
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* add a rcS helperJohn Crispin2013-05-091-0/+143
Signed-off-by: John Crispin <blogic@openwrt.org>