oweals/procd.git
10 years agohotplug: fix firmware loading
Felix Fietkau [Fri, 18 Jul 2014 14:40:56 +0000 (16:40 +0200)]
hotplug: fix firmware loading

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: fix trigger related double-free
Felix Fietkau [Wed, 2 Jul 2014 19:04:52 +0000 (21:04 +0200)]
service: fix trigger related double-free

The memdup is unnecessary, because the data is contained inside
in->config.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: implement get_data to dump the data fields for every instance
Felix Fietkau [Wed, 2 Jul 2014 17:00:32 +0000 (19:00 +0200)]
service: implement get_data to dump the data fields for every instance

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoinstance: allow filling "data" with fields of arbitrary type
Felix Fietkau [Wed, 2 Jul 2014 17:00:11 +0000 (19:00 +0200)]
instance: allow filling "data" with fields of arbitrary type

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agomake static linking work for upgraded
John Crispin [Thu, 19 Jun 2014 11:16:08 +0000 (12:16 +0100)]
make static linking work for upgraded

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoonly build upgraded on mips
John Crispin [Tue, 17 Jun 2014 16:16:25 +0000 (17:16 +0100)]
only build upgraded on mips

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agomove upgrade to its own subfolder
John Crispin [Mon, 16 Jun 2014 16:43:03 +0000 (17:43 +0100)]
move upgrade to its own subfolder

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agorename the folder option to path
John Crispin [Mon, 16 Jun 2014 15:52:18 +0000 (16:52 +0100)]
rename the folder option to path

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoprocd: force -lc -lgcc to handle cross-dependencies between those two
Felix Fietkau [Wed, 11 Jun 2014 17:48:16 +0000 (19:48 +0200)]
procd: force -lc -lgcc to handle cross-dependencies between those two

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoIncrease buffers for hotplug and cmdline for UML
Steven Barth [Wed, 11 Jun 2014 13:23:39 +0000 (15:23 +0200)]
Increase buffers for hotplug and cmdline for UML

Thanks to Markus Stenberg for debugging and testing.

Signed-off-by: Steven Barth <steven@midlink.org>
10 years agoonly add the nandupgrade method when /sbin/upgraded exists
John Crispin [Wed, 11 Jun 2014 01:37:08 +0000 (02:37 +0100)]
only add the nandupgrade method when /sbin/upgraded exists

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd upgraded support for nand flashing
John Crispin [Tue, 10 Jun 2014 15:50:15 +0000 (16:50 +0100)]
add upgraded support for nand flashing

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoallow instances to report errors. if an error is set, the instance wont be started
John Crispin [Thu, 5 Jun 2014 13:02:29 +0000 (14:02 +0100)]
allow instances to report errors. if an error is set, the instance wont be started

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoservice: do not emit any service events before the ubus connection is up
Felix Fietkau [Thu, 5 Jun 2014 14:53:29 +0000 (16:53 +0200)]
service: do not emit any service events before the ubus connection is up

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: register the subscriber object before the event handler
Felix Fietkau [Thu, 5 Jun 2014 14:46:32 +0000 (16:46 +0200)]
service: register the subscriber object before the event handler

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: fix a debug message typo
Felix Fietkau [Thu, 5 Jun 2014 14:45:21 +0000 (16:45 +0200)]
service: fix a debug message typo

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: fix a leftover debug hack
Felix Fietkau [Thu, 5 Jun 2014 14:44:29 +0000 (16:44 +0200)]
service: fix a leftover debug hack

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years ago0467aebb79f64d1c9d05a84367fda7c02c4ea6b8 included too much
John Crispin [Thu, 5 Jun 2014 10:53:01 +0000 (11:53 +0100)]
0467aebb79f64d1c9d05a84367fda7c02c4ea6b8 included too much

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agowait for kmod loader to complete on first boot
John Crispin [Wed, 4 Jun 2014 19:55:58 +0000 (20:55 +0100)]
wait for kmod loader to complete on first boot

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agosend ubus_notify events when servers and instances change state
John Crispin [Wed, 4 Jun 2014 19:50:00 +0000 (20:50 +0100)]
send ubus_notify events when servers and instances change state

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd wildcard support to trigger matching code
John Crispin [Wed, 4 Jun 2014 18:36:03 +0000 (19:36 +0100)]
add wildcard support to trigger matching code

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoallow instances to register ubus object that should be watched
John Crispin [Wed, 4 Jun 2014 11:46:28 +0000 (12:46 +0100)]
allow instances to register ubus object that should be watched

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoservice: fix json object leak in validate code
Felix Fietkau [Sun, 25 May 2014 19:29:36 +0000 (21:29 +0200)]
service: fix json object leak in validate code

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: free trigger json_script context
Felix Fietkau [Sun, 25 May 2014 19:24:09 +0000 (21:24 +0200)]
service: free trigger json_script context

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: fix trigger data memleak
Felix Fietkau [Sun, 25 May 2014 19:15:05 +0000 (21:15 +0200)]
service: fix trigger data memleak

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: ensure that trigger timers are always cancelled before free
Felix Fietkau [Sun, 25 May 2014 19:12:49 +0000 (21:12 +0200)]
service: ensure that trigger timers are always cancelled before free

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: fix memleak in trigger handling
Felix Fietkau [Sun, 25 May 2014 19:04:46 +0000 (21:04 +0200)]
service: fix memleak in trigger handling

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: use avl_remove_all_elements()
Felix Fietkau [Sun, 25 May 2014 19:01:30 +0000 (21:01 +0200)]
service: use avl_remove_all_elements()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: remove unused argument to service_update()
Felix Fietkau [Sun, 25 May 2014 18:59:56 +0000 (20:59 +0200)]
service: remove unused argument to service_update()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: fix double-free in error path
Felix Fietkau [Sun, 25 May 2014 18:58:51 +0000 (20:58 +0200)]
service: fix double-free in error path

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice: use blob_memdup()
Felix Fietkau [Sun, 25 May 2014 18:55:30 +0000 (20:55 +0200)]
service: use blob_memdup()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agohotplug: fix memleak in debug codepath
Felix Fietkau [Sun, 25 May 2014 18:48:09 +0000 (20:48 +0200)]
hotplug: fix memleak in debug codepath

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoinittab: strip trailing whitespace (especially newline)
Felix Fietkau [Sat, 24 May 2014 15:43:45 +0000 (17:43 +0200)]
inittab: strip trailing whitespace (especially newline)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoinittab: avoid character collating to work around character class escaping issue...
Felix Fietkau [Thu, 20 Mar 2014 15:05:47 +0000 (16:05 +0100)]
inittab: avoid character collating to work around character class escaping issue in a regex

This makes the regex work with musl

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agorcS: fix a format string bug
Felix Fietkau [Tue, 18 Mar 2014 12:53:23 +0000 (13:53 +0100)]
rcS: fix a format string bug

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agorcS: do not access ustream_buf data directly
Felix Fietkau [Tue, 18 Mar 2014 12:24:57 +0000 (13:24 +0100)]
rcS: do not access ustream_buf data directly

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoinstance: improve portability of setting resource limits
Felix Fietkau [Mon, 24 Feb 2014 16:42:57 +0000 (17:42 +0100)]
instance: improve portability of setting resource limits

the data type varies for different implementations

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agocommit e0921ed71bab0ad7d2344774a33c22809eb10190 set the timeout globally
John Crispin [Fri, 7 Feb 2014 13:24:10 +0000 (13:24 +0000)]
commit e0921ed71bab0ad7d2344774a33c22809eb10190 set the timeout globally

lets restrict it to stop scripts only

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agofix the dump logic to show validators and triggers even if no instances exist
John Crispin [Wed, 29 Jan 2014 17:33:50 +0000 (17:33 +0000)]
fix the dump logic to show validators and triggers even if no instances exist

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoforce all runqueue tasks to a timeout of 15s
John Crispin [Wed, 29 Jan 2014 03:30:57 +0000 (03:30 +0000)]
force all runqueue tasks to a timeout of 15s

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agostate.c: pass ubus commandline is writable buffer to service_start_early()
Jo-Philipp Wich [Mon, 20 Jan 2014 18:06:28 +0000 (18:06 +0000)]
state.c: pass ubus commandline is writable buffer to service_start_early()

The service_start_early() function uses strtok() on the command line argument,
therfore we cannot pass it constant string literals directly.

Fixes OpenWrt bug #14832

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
10 years agoprocd: fix service file tracking
Jo-Philipp Wich [Wed, 18 Dec 2013 14:17:16 +0000 (14:17 +0000)]
procd: fix service file tracking

The instance_config_move() function in the procd instance managing code is
missing a blobmsg_list_move() call to update the tracked file items with the
newly calculated checksums in case of a file change.

Without that change, services are always reloaded after the first change to
a tracked file regardless of whether there are any subsequent changes or not.

Add a missing instance of blobmsg_list_free() as well.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
10 years agofix copy paste error
John Crispin [Mon, 9 Dec 2013 12:57:43 +0000 (13:57 +0100)]
fix copy paste error

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoprocd: set resource limits for service instances
Ulrich Weber [Thu, 5 Dec 2013 12:46:34 +0000 (12:46 +0000)]
procd: set resource limits for service instances

useful to enable core dumps or set resource limits

Signed-off-by: Ulrich Weber <uw@xyne.com>
11 years agocleanup debug level handover
John Crispin [Fri, 22 Nov 2013 12:13:54 +0000 (13:13 +0100)]
cleanup debug level handover

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agofix rcS memory leaks and running hook
John Crispin [Wed, 20 Nov 2013 18:00:12 +0000 (19:00 +0100)]
fix rcS memory leaks and running hook

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agomake ue of the md5.c inside libubox
John Crispin [Tue, 19 Nov 2013 19:55:54 +0000 (20:55 +0100)]
make ue of the md5.c inside libubox

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agofix up the order of respawn parameters for ubus
John Crispin [Tue, 19 Nov 2013 14:48:37 +0000 (15:48 +0100)]
fix up the order of respawn parameters for ubus

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agoadd a event broadcast function
John Crispin [Mon, 18 Nov 2013 11:22:22 +0000 (12:22 +0100)]
add a event broadcast function

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agoadd debug level handover between preinit and main process
John Crispin [Mon, 18 Nov 2013 10:41:04 +0000 (11:41 +0100)]
add debug level handover between preinit and main process

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agomake the service running trigger be queued directly after the service was startetd
John Crispin [Mon, 18 Nov 2013 10:32:47 +0000 (11:32 +0100)]
make the service running trigger be queued directly after the service was startetd

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agoadd a function to add calls to the front of the rcS queue
John Crispin [Mon, 18 Nov 2013 10:32:11 +0000 (11:32 +0100)]
add a function to add calls to the front of the rcS queue

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agoprocd: Allow process respawning forever
Helmut Schaa [Fri, 15 Nov 2013 18:32:31 +0000 (19:32 +0100)]
procd: Allow process respawning forever

Use respawn_retry==0 as indication to respawn a process forever.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agodebloat and reorganize code
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>
11 years agoadd service_validator support
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>
11 years agoadd data type validator
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>
11 years agobind the console to /dev/null if the real console fails to come up
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>
11 years agothe automatic service restart should not happen during sysupgrade
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>
11 years agoadd hostname option to logread
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>
11 years agoadd a prefix option for messages streamed using logread
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>
11 years agosyslog: fix incorrect use of sizeof() in vsnprintf()
Jo-Philipp Wich [Tue, 1 Oct 2013 16:39:47 +0000 (16:39 +0000)]
syslog: fix incorrect use of sizeof() in vsnprintf()

11 years agosyslog() is a blocking call on eglibc. as procd provides the actual syslog, weneed...
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>
11 years agoprocd: Exit askfirst on read error
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>
11 years agocoldplug: remove duplicated include
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>
11 years agocoldplug: only start hotplug timer after udevtrigger finished
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>
11 years agoudevtrigger: nuke scan_{subdir,class,block} functions
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>
11 years agoudevtrigger: simplify scan_class function
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>
11 years agoudevtrigger: simplify scan_block function
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>
11 years agoudevtrigger: simplify scan_subsystem function
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>
11 years agoudevtrigger: extend scan_subdir function
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>
11 years agoudevtrigger: remove superfluous strlcpy
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>
11 years agoudevtrigger: add back directory name check into scan_subdir
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>
11 years agofix skewed parameter order in respawn code
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>
11 years agoexecute the "running" hook once the daemon is started
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>
11 years agoadd a way for procd to queue async init.d calls
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>
11 years agofix a bug in the trigger handling code
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>
11 years agoremove now unused variable
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>
11 years agoadd code to configure respawn via ubus
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>
11 years agooutput the env associated with an instance
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>
11 years agoudevtrigger: reduce indent level in scan_* functions
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>
11 years agoudevtrigger: rename variables in scan_subdir
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>
11 years agoudevtrigger: use a helper function for subdir scanning
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>
11 years agoudevtrigger: check presence of dev attribute
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>
11 years agoudevtrigger: add device_has_attribute helper
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>
11 years agoudevtrigger: remove trailing whitespaces
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>
11 years agoadd a ubus handler that allows sending signals to processes
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>
11 years agofix use after free bug in the trigger handling code
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>
11 years agoadd suport for measuring process resource usage
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>
11 years agofixup service_dump logic
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>
11 years agotrivial code cleanup
John Crispin [Tue, 27 Aug 2013 11:40:22 +0000 (13:40 +0200)]
trivial code cleanup

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agoadd respawn handling
John Crispin [Tue, 27 Aug 2013 09:41:11 +0000 (11:41 +0200)]
add respawn handling

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agologread: fix the facility name reporting
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>
11 years agoservice: terminate uloop after fork(), redirect stdin, out and err to /dev/null
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

11 years agohotplug: 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

11 years agoaskfirst: remove superfluous 'close' calls on stdio file descriptors.
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>
11 years agoParse only init_debug option with non-empty argument.
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>
11 years agoError and return when failing stat('/dev/console').
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>
11 years agoFix event type reporting when calling 'procd_shutdown'.
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>
11 years agoearly: remove superfluous close of stdio file descriptors
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>
11 years agoearly: keep stdio files open
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>