summaryrefslogtreecommitdiffstats
path: root/service
AgeCommit message (Collapse)Author
2015-11-30Strip down procd to the necessary code, update copyrightMatthias Schiffer
2015-07-07service: if logging start app with LD_PRELOAD & lib for line bufferingRafał Miłecki
Using pipe automatically switches service to block buffering which kind of breaks our logging. We won't get anything from stdout FD until the buffer gets filled fully or the service exits. This makes log messages appear with an unwanted delay. This change adds a tiny libsetlbf.so switching stdout to line buffering and uses this lib for every logging-enabled service started by procd. We don't need any extra change for stderr as it's unbuffered by default. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Modified to use no buffering to align with stderr. Several cleanups. Signed-off-by: Steven Barth <steven@midlink.org>
2015-06-14service: reorder function to avoid forward declarationFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-06-14service: close instance pipe fd on restart.Yousong Zhou
Otherwise we hit max number of fd limit (1024) and instances fail to start with the following errors in syslog Sun Jun 14 01:27:38 2015 daemon.warn procd: pipe() failed: 24 (Too many open files) Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-06-14service: allow get_data of specifc instance.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-06-14service: remove unused struct watch_subscribe definition.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-06-14service: dump respawn params in the same order as when passed in.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-06-14service: optimize relaying stdio output of daemons a bit.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-06-04trigger: make trigger_match() bool and make return value less confusingFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-06-02allow multiple identical events to be queuedJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-05-05instance: handle setgid() before setuid()Jo-Philipp Wich
When attempting to run a service with an unprivileged user and group id procd, the following error might occur: procd: failed to set uid:1000, gid:1000 This is due to the fact that procd first performs the setuid(), then the setgid() call. Usually there no sufficient permissions after a setuid() anymore to change the effective group id of the process. Refactor the code to: * Swap the invocations (first gid, then uid) * Don't set user or group id if it is 0 * Handle errors independently and make them more verbose Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-04-19instance: avoid dumping invalid service instances - prevents a potential crashFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-03-28properly handle return codesJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-03-23procd can now start jailed processesJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-03-06json 0.12 fixesJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-02-27service: rename variables / struct members called stdout, stderr to avoid ↵Felix Fietkau
conflicts with system defines Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-02-26service: don't use stdio log channelJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-02-26procd: support relayoing daemon stdout/stderr to syslogJo-Philipp Wich
This commit adds support to procd for relaying stdout and stderr streams to the system log. That is mainly useful for services not using syslog, e.g. uhttpd. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-11-19service: fix ubus list commandFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-09-08instances can now start as a !root userJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-08-29add .data to instance_dump()John Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-08-29add an event for "service.update" triggersJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-08-29explicitly include json/json.h where neededFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-02service: fix trigger related double-freeFelix Fietkau
The memdup is unnecessary, because the data is contained inside in->config. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-02service: implement get_data to dump the data fields for every instanceFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-02instance: allow filling "data" with fields of arbitrary typeFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-06-06allow instances to report errors. if an error is set, the instance wont be ↵John Crispin
started Signed-off-by: John Crispin <blogic@openwrt.org>
2014-06-05service: do not emit any service events before the ubus connection is upFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-06-05service: register the subscriber object before the event handlerFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-06-05service: fix a debug message typoFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-06-05service: fix a leftover debug hackFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-06-05send ubus_notify events when servers and instances change stateJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-06-05add wildcard support to trigger matching codeJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-06-05allow instances to register ubus object that should be watchedJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-05-25service: fix json object leak in validate codeFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-25service: free trigger json_script contextFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-25service: fix trigger data memleakFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-25service: ensure that trigger timers are always cancelled before freeFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-25service: fix memleak in trigger handlingFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-25service: use avl_remove_all_elements()Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-25service: remove unused argument to service_update()Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-25service: fix double-free in error pathFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-25service: use blob_memdup()Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-02-24instance: improve portability of setting resource limitsFelix Fietkau
the data type varies for different implementations Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-01-29fix the dump logic to show validators and triggers even if no instances existJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-12-18procd: fix service file trackingJo-Philipp Wich
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>
2013-12-09procd: set resource limits for service instancesUlrich Weber
useful to enable core dumps or set resource limits Signed-off-by: Ulrich Weber <uw@xyne.com>
2013-11-20fix rcS memory leaks and running hookJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-11-19make ue of the md5.c inside libuboxJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-11-19fix up the order of respawn parameters for ubusJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>