John Crispin [Thu, 14 Nov 2013 12:41:13 +0000 (13:41 +0100)]
debloat and reorganize code
split app into procd and init binaries
remove log support, this is an external service now
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Mon, 11 Nov 2013 18:28:13 +0000 (19:28 +0100)]
add service_validator support
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Mon, 11 Nov 2013 14:54:29 +0000 (15:54 +0100)]
add data type validator
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Sat, 9 Nov 2013 19:20:55 +0000 (20:20 +0100)]
bind the console to /dev/null if the real console fails to come up
this was reported on irc by oc80z
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Fri, 8 Nov 2013 21:25:20 +0000 (22:25 +0100)]
the automatic service restart should not happen during sysupgrade
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Thu, 24 Oct 2013 14:34:41 +0000 (16:34 +0200)]
add hostname option to logread
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 9 Oct 2013 11:48:00 +0000 (13:48 +0200)]
add a prefix option for messages streamed using logread
Signed-off-by: Robin Kuck <robin@basicinside.de>
Jo-Philipp Wich [Tue, 1 Oct 2013 16:39:47 +0000 (16:39 +0000)]
syslog: fix incorrect use of sizeof() in vsnprintf()
John Crispin [Sat, 28 Sep 2013 19:01:20 +0000 (21:01 +0200)]
syslog() is a blocking call on eglibc. as procd provides the actual syslog, 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>
Helmut Schaa [Tue, 17 Sep 2013 06:48:48 +0000 (06:48 +0000)]
procd: Exit askfirst on read error
When running askfirst on an unused tty device askfirst starts
busylooping forever. Fix this by returning an error if we read
an EOF.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Gabor Juhos [Tue, 10 Sep 2013 14:56:11 +0000 (16:56 +0200)]
coldplug: remove duplicated include
The unistd.h header is inluded twice.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Tue, 10 Sep 2013 14:56:10 +0000 (16:56 +0200)]
coldplug: only start hotplug timer after udevtrigger finished
Currently the last event timer for hotplug is
started after the udevtrigger process is forked.
Starting the timer means that the first hotplug
event must come in before the timer expires.
During this time the kernel must load the binary
of the udevtrigger from the underlying rootfs
which can be time consuming on slow systems.
On such systems, the timer expires before the
first hotplug event happens which results in
broken behaviour. Due to the missing device nodes,
not the ubus nor the procd code works correctly in
that case.
Change the code to only start the hotplug last
event timer after the udevtrigger process finishes.
This ensures that the delay caused by accessing the
underlying filesystem does not affects the desired
behaviour.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Wed, 11 Sep 2013 14:10:18 +0000 (16:10 +0200)]
udevtrigger: nuke scan_{subdir,class,block} functions
These functions are simple wrappers around the
'scan_subdir' function. Remove the wrapper code and
use the 'scan_subdir' function directly instead.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Wed, 11 Sep 2013 14:10:17 +0000 (16:10 +0200)]
udevtrigger: simplify scan_class function
Remove the local directory scanning code and
use the scan_subdir function instead.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Wed, 11 Sep 2013 14:10:16 +0000 (16:10 +0200)]
udevtrigger: simplify scan_block function
Remove the local directory scanning code and
use the scan_subdir function instead.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Wed, 11 Sep 2013 14:10:15 +0000 (16:10 +0200)]
udevtrigger: simplify scan_subsystem function
Remove the local directory scanning code and
use the scan_subdir function instead.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Wed, 11 Sep 2013 14:10:14 +0000 (16:10 +0200)]
udevtrigger: extend scan_subdir function
Add more arguments to the function to make it
usable recursively.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Wed, 11 Sep 2013 14:10:13 +0000 (16:10 +0200)]
udevtrigger: remove superfluous strlcpy
Use the "/sys/class/block" string directly
for the stat call. This makes the code simpler
and reduces stack usage.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Wed, 11 Sep 2013 14:10:12 +0000 (16:10 +0200)]
udevtrigger: add back directory name check into scan_subdir
It has been accidentally removed by:
commit
824a4b3da2c0be19ccf54a48dcd4c10677b82c1a
Author: Gabor Juhos <juhosg@openwrt.org>
Date: Tue Sep 10 12:59:25 2013 +0200
udevtrigger: reduce indent level in scan_* functions
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
John Crispin [Wed, 4 Sep 2013 15:32:15 +0000 (17:32 +0200)]
fix skewed parameter order in respawn code
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 4 Sep 2013 14:56:24 +0000 (16:56 +0200)]
execute the "running" hook once the daemon is started
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 4 Sep 2013 14:55:45 +0000 (16:55 +0200)]
add a way for procd to queue async init.d calls
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 4 Sep 2013 12:46:49 +0000 (14:46 +0200)]
fix a bug in the trigger handling code
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 4 Sep 2013 14:25:15 +0000 (16:25 +0200)]
remove now unused variable
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Tue, 3 Sep 2013 23:50:25 +0000 (01:50 +0200)]
add code to configure respawn via ubus
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Tue, 3 Sep 2013 23:24:14 +0000 (01:24 +0200)]
output the env associated with an instance
Signed-off-by: John Crispin <blogic@openwrt.org>
Gabor Juhos [Tue, 10 Sep 2013 10:59:25 +0000 (12:59 +0200)]
udevtrigger: reduce indent level in scan_* functions
Return early from the scan_* functions if the
opendir call fails. This allows to reduce the
indentation level of the subsequent code by
one tab.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Tue, 10 Sep 2013 10:59:24 +0000 (12:59 +0200)]
udevtrigger: rename variables in scan_subdir
There are only one variable present for a given
type. Remove the '2' suffix from the variable
names. Also rename the function argument to avoid
name collision.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Tue, 10 Sep 2013 10:59:23 +0000 (12:59 +0200)]
udevtrigger: use a helper function for subdir scanning
The scan_{block,class,subsystem} functions are using
identical code for scanning. Move that into a separate
function to avoid code duplication.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Tue, 10 Sep 2013 10:59:22 +0000 (12:59 +0200)]
udevtrigger: check presence of dev attribute
The presence of the 'uevent' attribute file
does not always mean that a corresponding
device node can be created under '/dev'.
For valid device nodes, a 'dev' attribute
file must be present which cntains the major
and minor numbers of the device.
Modify the code to check the presence of the
dev attribute as well. This allows to avoid
superfluous trigger_uevent calls. On a test
system, the patch reduced the number of the
triegger_uevent calls from 144 to 70.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Tue, 10 Sep 2013 10:59:21 +0000 (12:59 +0200)]
udevtrigger: add device_has_attribute helper
Move the code from device_list_insert() into
a separate function. This makes it possible
to reuse the code for other attribute files.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Tue, 10 Sep 2013 10:59:20 +0000 (12:59 +0200)]
udevtrigger: remove trailing whitespaces
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
John Crispin [Tue, 3 Sep 2013 18:04:49 +0000 (20:04 +0200)]
add a ubus handler that allows sending signals to processes
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Tue, 3 Sep 2013 17:36:43 +0000 (19:36 +0200)]
fix use after free bug in the trigger handling code
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Tue, 27 Aug 2013 12:50:45 +0000 (14:50 +0200)]
add suport for measuring process resource usage
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Tue, 3 Sep 2013 14:03:29 +0000 (16:03 +0200)]
fixup service_dump logic
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Tue, 27 Aug 2013 11:40:22 +0000 (13:40 +0200)]
trivial code cleanup
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Tue, 27 Aug 2013 09:41:11 +0000 (11:41 +0200)]
add respawn handling
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Sun, 1 Sep 2013 18:40:53 +0000 (20:40 +0200)]
logread: fix the facility name reporting
http://patchwork.openwrt.org/patch/3978/
Signed-off-by: Mike Brady<mikebrady@eircom.net>
Jo-Philipp Wich [Fri, 16 Aug 2013 09:24:07 +0000 (11:24 +0200)]
service: terminate uloop after fork(), redirect stdin, out and err to /dev/null
Jo-Philipp Wich [Wed, 14 Aug 2013 19:04:31 +0000 (21:04 +0200)]
hotplug: terminate uloop after fork(), redirect stdin, out and err to /dev/null
Yousong Zhou [Tue, 23 Jul 2013 08:28:38 +0000 (16:28 +0800)]
askfirst: remove superfluous 'close' calls on stdio file descriptors.
'dup2' will do it for us if necessary.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 23 Jul 2013 08:28:42 +0000 (16:28 +0800)]
Parse only init_debug option with non-empty argument.
Matching empty string makes rm_so and rm_eo of struct regmatch_t have
the same value, in this case both of them are 11. This causes a call to
atoi("\0") whose return value 0 is just the initial value of 'debug'.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 23 Jul 2013 08:28:41 +0000 (16:28 +0800)]
Error and return when failing stat('/dev/console').
Since mkdev("*", 0600) has been called in early_dev just before
early_console, no need to try checking it again.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 23 Jul 2013 08:28:40 +0000 (16:28 +0800)]
Fix event type reporting when calling 'procd_shutdown'.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Gabor Juhos [Fri, 19 Jul 2013 06:21:17 +0000 (08:21 +0200)]
early: remove superfluous close of stdio file descriptors
'man dup2' says:
dup2() makes newfd be the copy of oldfd, closing newfd first if
necessary, but note the following:
* If oldfd is not a valid file descriptor, then the call fails,
and newfd is not closed.
* If oldfd is a valid file descriptor, and newfd has the same
value as oldfd, then dup2() does nothing, and returns newfd.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Gabor Juhos [Fri, 19 Jul 2013 06:43:35 +0000 (08:43 +0200)]
early: keep stdio files open
At the end of the 'early_console' function, the
file descriptor is closed unconditionally. This
'close' call closes the stdio files if the fd
returned by the 'open(dev/console)' call equals
with any of the STD{IN,OUT,ERR}_FILENO values.
When this happens, all subsequent accesses to
the stdio files will fail and early console
access won't work.
To avoid this, don't close the file descriptor if
that equals with any of the STD*_FILENO values.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
John Crispin [Sun, 14 Jul 2013 09:56:32 +0000 (11:56 +0200)]
the cloexec logic of the watchdog was broken
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Sun, 14 Jul 2013 09:24:14 +0000 (11:24 +0200)]
logread should handle return code when sending data over the net
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Thu, 11 Jul 2013 19:47:25 +0000 (21:47 +0200)]
fix wdt cloexec bug
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 10 Jul 2013 12:10:39 +0000 (14:10 +0200)]
fix up watchdog init code
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 10 Jul 2013 10:55:37 +0000 (12:55 +0200)]
print services with no instances when verbose is set
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 10 Jul 2013 05:58:44 +0000 (07:58 +0200)]
fix service level triggers
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 10 Jul 2013 10:47:35 +0000 (12:47 +0200)]
make the verbose argument a bool
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 10 Jul 2013 10:36:53 +0000 (12:36 +0200)]
invalid pointer was passed to free()
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 10 Jul 2013 07:40:50 +0000 (09:40 +0200)]
remove bogus subscriber
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 10 Jul 2013 07:25:47 +0000 (09:25 +0200)]
remove support fro trigegrs not linked to a service
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Tue, 9 Jul 2013 15:23:33 +0000 (17:23 +0200)]
the delete handle should return an error if no service is named instead of killing all services
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Tue, 9 Jul 2013 12:33:14 +0000 (14:33 +0200)]
Fix logread file logging
This patch fixes logread and now appends to files instead of writting to the beginning the specified logfile. It also sets the access rights to 0600.
Signed-off-by: Peter Wagner <tripolar@gmx.at>
John Crispin [Tue, 9 Jul 2013 09:49:55 +0000 (11:49 +0200)]
fix up the loging over network
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Mon, 8 Jul 2013 20:12:28 +0000 (22:12 +0200)]
dont list services that have no instances
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Mon, 8 Jul 2013 19:40:14 +0000 (21:40 +0200)]
close stdin/out/err before forking an instance
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Mon, 8 Jul 2013 16:40:09 +0000 (18:40 +0200)]
remove superflous define
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Mon, 8 Jul 2013 11:10:47 +0000 (13:10 +0200)]
extend logread
* log to file
* add pidfile support
* reconnect when logging over network
Thomas Huehn [Fri, 5 Jul 2013 10:04:14 +0000 (12:04 +0200)]
bugfix of error handling while open()
The normal return value from open() is a non-negative integer.
In the case of an error, a value of -1 is returned instead.
Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
John Crispin [Mon, 1 Jul 2013 16:34:13 +0000 (18:34 +0200)]
add trigger support
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 3 Jul 2013 17:16:09 +0000 (19:16 +0200)]
properly fix umask handling
https://dev.openwrt.org/ticket/13752
https://dev.openwrt.org/ticket/13794
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 3 Jul 2013 13:55:26 +0000 (15:55 +0200)]
add 2 second sleep before rebooting
stderr is lost without this whena crash happens
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Sat, 29 Jun 2013 20:19:04 +0000 (22:19 +0200)]
add support for the system.event node
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Thu, 27 Jun 2013 17:14:03 +0000 (19:14 +0200)]
get rid of sleep() calls
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Thu, 27 Jun 2013 17:09:12 +0000 (19:09 +0200)]
make ubus handling use uloop timers
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Mon, 24 Jun 2013 16:56:34 +0000 (18:56 +0200)]
set global umask to 0
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Mon, 24 Jun 2013 16:31:51 +0000 (18:31 +0200)]
add respawn support
https://dev.openwrt.org/ticket/13751
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 19 Jun 2013 20:14:57 +0000 (22:14 +0200)]
make add facility and level to logread output
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Fri, 14 Jun 2013 08:19:00 +0000 (10:19 +0200)]
drop good bye message
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Thu, 13 Jun 2013 12:48:04 +0000 (14:48 +0200)]
register the system namespace on ubus regardless of the pid
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Mon, 10 Jun 2013 07:39:42 +0000 (09:39 +0200)]
we dont want to continue booting if sysupgrade is in progress
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Tue, 4 Jun 2013 14:12:50 +0000 (16:12 +0200)]
merge ubus system namespace from rpcd codebase
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Tue, 4 Jun 2013 09:46:00 +0000 (11:46 +0200)]
load modules from /etc/modules-boot.d/ before preinit
Signed-off-by: John Crispin <blogic@openwrt.org>
Felix Fietkau [Fri, 31 May 2013 15:14:50 +0000 (17:14 +0200)]
restart stopped instances on update
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 31 May 2013 15:11:54 +0000 (17:11 +0200)]
turn instance exit message into a debug message
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
John Crispin [Thu, 30 May 2013 13:41:19 +0000 (15:41 +0200)]
make sure path exists before mknod is called
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Wed, 29 May 2013 12:26:23 +0000 (14:26 +0200)]
update rcS.c to match new runqueue api changes
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Fri, 10 May 2013 21:22:24 +0000 (23:22 +0200)]
logread
John Crispin [Thu, 9 May 2013 18:14:27 +0000 (20:14 +0200)]
add a rcS helper
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Thu, 25 Apr 2013 19:37:25 +0000 (21:37 +0200)]
fix 32 wrap around bug when handling 64 bit time values
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Mon, 22 Apr 2013 10:58:01 +0000 (12:58 +0200)]
ignore sigpipe
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Thu, 18 Apr 2013 19:27:58 +0000 (21:27 +0200)]
fix behaviour during sysupgrade
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Thu, 18 Apr 2013 17:59:53 +0000 (19:59 +0200)]
make reboot work without -f in failsafe
Singed-off-by: John Crispin <blogic@openwrt.org>
Felix Fietkau [Sun, 7 Apr 2013 11:44:32 +0000 (13:44 +0200)]
watchdog: add support for starting/stopping watchdog refresh
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sat, 16 Mar 2013 14:50:59 +0000 (15:50 +0100)]
make a few variables static
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sat, 16 Mar 2013 01:35:47 +0000 (02:35 +0100)]
remove an unused function
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sat, 16 Mar 2013 01:35:14 +0000 (02:35 +0100)]
whitespace cleanup
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sat, 16 Mar 2013 01:33:25 +0000 (02:33 +0100)]
get rid of perror() calls, use ERROR() instead
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
John Crispin [Thu, 14 Mar 2013 18:36:07 +0000 (19:36 +0100)]
fix up the mount options to match what openwrt had before using procd as pid 1
Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin [Sat, 9 Mar 2013 23:55:36 +0000 (00:55 +0100)]
add license headers
John Crispin [Fri, 8 Mar 2013 22:52:52 +0000 (23:52 +0100)]
add new main.c and fix Makefile/headers
John Crispin [Sat, 9 Mar 2013 19:19:18 +0000 (20:19 +0100)]
DPRINTF no longer exists
John Crispin [Fri, 8 Mar 2013 22:52:16 +0000 (23:52 +0100)]
add state handler
John Crispin [Sun, 10 Mar 2013 00:11:08 +0000 (01:11 +0100)]
add debug handler