Slight cleanup of public API in helpers.c

Function renames:
  - set_procname() --> procname_set()
  - kill_procname() --> procname_kill()
  - get_pidname() --> pid_get_name()

Also added three new helper functions, for external plugins:
  - pid_alive()
  - pidfile_poll()
  - pidfile_read()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2012-09-27 20:56:46 +02:00
1 parent 0d70fa4cf0
commit ff73dab447
4 files changed
+253 -139

No files matched your search

+3 -2
View File
@@ -270,7 +270,7 @@ void svc_monitor(void)
/* Cleanup any lingering or semi-restarting tasks before respawning */
_d("Sending SIGTERM to service group %s", name);
kill_procname(name, SIGTERM);
procname_kill(name, SIGTERM);
/* Restarting lost service. */
if (svc_enabled(svc, 0))
@@ -280,6 +280,7 @@ void svc_monitor(void)
}
}
/* Remember: svc_enabled() must be called before calling svc_start() */
int svc_start(svc_t *svc)
{
int respawn = svc->pid != 0;
@@ -362,7 +363,7 @@ int svc_stop(svc_t *svc)
}
print_descr("Stopping ", svc->descr);
_d("Sending SIGTERM to pid:%d name:'%s'", svc->pid, get_pidname(svc->pid, NULL, 0));
_d("Sending SIGTERM to pid:%d name:'%s'", svc->pid, pid_get_name(svc->pid, NULL, 0));
res = kill(svc->pid, SIGTERM);
print_result(res);
svc->pid = 0;