svc: The timestamp should have subsecond resolution

When finit completes quicker than one second it will
not find if any configurations has been changed.

Signed-off-by: Mattias Walström <mattias.walstrom@westermo.se>
This commit is contained in:
Mattias Walström committed 2017-01-11 16:28:03 +01:00
1 parent 816aa9a17c
commit a95df9d64b
5 files changed
+20 -14

No files matched your search

+3 -3
View File
@@ -86,7 +86,7 @@ typedef struct svc {
pid_t pid;
const svc_state_t state; /* Paused, Reloading, Restart, Running, ... */
svc_type_t type;
time_t mtime; /* Modification time for .conf from /etc/finit.d/ */
struct timeval mtime; /* Modification time for .conf from /etc/finit.d/ */
const int dirty; /* Set if old mtime != new mtime => reloaded,
* or -1 when marked for removal */
int starting; /* ... waiting for pidfile to be re-asserted */
@@ -160,7 +160,7 @@ void svc_foreach_type (int types, void (*cb)(svc_t *));
int svc_stop_completed (void);
void svc_mark_dynamic (void);
void svc_check_dirty (svc_t *svc, time_t mtime);
void svc_check_dirty (svc_t *svc, struct timeval *mtime);
void svc_mark_dirty (svc_t *svc);
void svc_mark_clean (svc_t *svc);
void svc_clean_dynamic (void (*cb)(svc_t *));
@@ -177,7 +177,7 @@ static inline void svc_starting (svc_t *svc) { svc->starting = 1; }
static inline void svc_started (svc_t *svc) { svc->starting = 0; }
static inline int svc_is_starting (svc_t *svc) { return 0 != svc->starting; }
static inline int svc_is_dynamic (svc_t *svc) { return svc && 0 != svc->mtime; }
static inline int svc_is_dynamic (svc_t *svc) { return svc && 0 != svc->mtime.tv_sec; }
static inline int svc_is_removed (svc_t *svc) { return svc && -1 == svc->dirty; }
static inline int svc_is_changed (svc_t *svc) { return svc && 0 != svc->dirty; }
static inline int svc_is_updated (svc_t *svc) { return svc && 1 == svc->dirty; }