mirror of
https://github.com/troglobit/finit.git
synced 2026-10-30 12:50:34 +00:00
Merge branch 'master' into wip-tests
This commit is contained in:
commit
3ebac3dece
6 files changed
+18
-12
No files matched your search
+5
-5
@@ -138,8 +138,8 @@ static void pidfile_handle_dir(struct iwatch *iw, char *dir, char *name, int mas
|
|||||||
|
|
||||||
if (mask & IN_CREATE) {
|
if (mask & IN_CREATE) {
|
||||||
if (!iwp) {
|
if (!iwp) {
|
||||||
pidfile_add_path(iw, path);
|
if (!pidfile_add_path(iw, path))
|
||||||
pidfile_scandir(iw, path, sizeof(path));
|
pidfile_scandir(iw, path, sizeof(path));
|
||||||
}
|
}
|
||||||
} else if (mask & IN_DELETE) {
|
} else if (mask & IN_DELETE) {
|
||||||
if (iwp)
|
if (iwp)
|
||||||
@@ -265,9 +265,9 @@ static void pidfile_init(void *arg)
|
|||||||
*
|
*
|
||||||
* service <net/iface/lo> /sbin/dropbear ...
|
* service <net/iface/lo> /sbin/dropbear ...
|
||||||
*
|
*
|
||||||
* Which provides the <pid/sbin/dropbear> condition, will not be
|
* Which provides the <pid/dropbear> condition, will not be set by
|
||||||
* set by pidfile.so during `initctl reload` because dropbear is
|
* pidfile.so during `initctl reload` because dropbear is still
|
||||||
* still SIGSTP:ed waiting for <net/iface/lo>.
|
* SIGSTP:ed waiting for <net/iface/lo>.
|
||||||
*/
|
*/
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = __FILE__,
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ char *mkcond(svc_t *svc, char *buf, size_t len)
|
|||||||
char ident[sizeof(svc->name) + sizeof(svc->id) + 2];
|
char ident[sizeof(svc->name) + sizeof(svc->id) + 2];
|
||||||
|
|
||||||
snprintf(buf, len, "pid/%s", svc_ident(svc, ident, sizeof(ident)));
|
snprintf(buf, len, "pid/%s", svc_ident(svc, ident, sizeof(ident)));
|
||||||
_d("Created condition => %s", buf);
|
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@@ -243,7 +242,6 @@ void cond_reload(void)
|
|||||||
_d("");
|
_d("");
|
||||||
|
|
||||||
cond_bump_reconf();
|
cond_bump_reconf();
|
||||||
cond_update(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reassert(const char *fpath, const struct stat *sb, int tflg, struct FTW *ftw)
|
static int reassert(const char *fpath, const struct stat *sb, int tflg, struct FTW *ftw)
|
||||||
|
|||||||
+1
-1
@@ -626,7 +626,7 @@ static int parse_conf(char *file)
|
|||||||
_d("%s", line);
|
_d("%s", line);
|
||||||
|
|
||||||
parse_static(line);
|
parse_static(line);
|
||||||
parse_dynamic(line, global_rlimit, NULL);
|
parse_dynamic(line, global_rlimit, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|||||||
+2
-2
@@ -48,7 +48,7 @@ int iwatch_init(struct iwatch *iw)
|
|||||||
|
|
||||||
iw->fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
|
iw->fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
|
||||||
if (iw->fd < 0) {
|
if (iw->fd < 0) {
|
||||||
_pe("inotify_init()");
|
_pe("Failed creating inotify descriptor");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
@@ -90,7 +90,7 @@ int iwatch_add(struct iwatch *iw, char *file, uint32_t mask)
|
|||||||
|
|
||||||
wd = inotify_add_watch(iw->fd, path, IWATCH_MASK | mask);
|
wd = inotify_add_watch(iw->fd, path, IWATCH_MASK | mask);
|
||||||
if (wd < 0) {
|
if (wd < 0) {
|
||||||
_pe("inotify_add_watch(%s)", path);
|
_pe("Failed adding watcher for %s", path);
|
||||||
free(path);
|
free(path);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-2
@@ -29,9 +29,16 @@
|
|||||||
#include <lite/queue.h>
|
#include <lite/queue.h>
|
||||||
#include <sys/inotify.h>
|
#include <sys/inotify.h>
|
||||||
|
|
||||||
|
#ifndef IN_MASK_CREATE
|
||||||
|
#define IN_MASK_CREATE 0x10000000 /* since Linux 4.18 */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Monitors changes to both directories and files by default */
|
/*
|
||||||
#define IWATCH_MASK (IN_CREATE | IN_DELETE | IN_MODIFY | IN_ATTRIB | IN_MOVE)
|
* Monitors changes to both directories and files by default, but only
|
||||||
|
* add watcher once (IN_MASK_CREATE) to avoid clobbering any already
|
||||||
|
* monitored paths.
|
||||||
|
*/
|
||||||
|
#define IWATCH_MASK (IN_CREATE | IN_DELETE | IN_MODIFY | IN_ATTRIB | IN_MOVE | IN_MASK_CREATE)
|
||||||
|
|
||||||
struct iwatch_path {
|
struct iwatch_path {
|
||||||
TAILQ_ENTRY(iwatch_path) link;
|
TAILQ_ENTRY(iwatch_path) link;
|
||||||
|
|||||||
@@ -1107,6 +1107,7 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
|
|||||||
else
|
else
|
||||||
svc_mark_clean(svc);
|
svc_mark_clean(svc);
|
||||||
|
|
||||||
|
/* for finit native services only, e.g. plugins/hotplug.c */
|
||||||
if (!file)
|
if (!file)
|
||||||
svc->protect = 1;
|
svc->protect = 1;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user