make run_stop_schedule accept a pid instead of a pid file
This commit is contained in:
parent
27c2bd997d
commit
36a0ab9054
@ -297,7 +297,7 @@ int do_stop(const char *applet, const char *exec, const char *const *argv,
|
|||||||
|
|
||||||
int run_stop_schedule(const char *applet,
|
int run_stop_schedule(const char *applet,
|
||||||
const char *exec, const char *const *argv,
|
const char *exec, const char *const *argv,
|
||||||
const char *pidfile, uid_t uid,
|
pid_t pid, uid_t uid,
|
||||||
bool test, bool progress)
|
bool test, bool progress)
|
||||||
{
|
{
|
||||||
SCHEDULEITEM *item = TAILQ_FIRST(&schedule);
|
SCHEDULEITEM *item = TAILQ_FIRST(&schedule);
|
||||||
@ -306,14 +306,13 @@ int run_stop_schedule(const char *applet,
|
|||||||
int nrunning = 0;
|
int nrunning = 0;
|
||||||
long nloops, nsecs;
|
long nloops, nsecs;
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
pid_t pid = 0;
|
|
||||||
const char *const *p;
|
const char *const *p;
|
||||||
bool progressed = false;
|
bool progressed = false;
|
||||||
|
|
||||||
if (exec)
|
if (exec)
|
||||||
einfov("Will stop %s", exec);
|
einfov("Will stop %s", exec);
|
||||||
if (pidfile)
|
if (pid > 0)
|
||||||
einfov("Will stop PID in pidfile `%s'", pidfile);
|
einfov("Will stop PID %d", pid);
|
||||||
if (uid)
|
if (uid)
|
||||||
einfov("Will stop processes owned by UID %d", uid);
|
einfov("Will stop processes owned by UID %d", uid);
|
||||||
if (argv && *argv) {
|
if (argv && *argv) {
|
||||||
@ -328,12 +327,6 @@ int run_stop_schedule(const char *applet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pidfile) {
|
|
||||||
pid = get_pid(applet, pidfile);
|
|
||||||
if (pid == -1)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (item) {
|
while (item) {
|
||||||
switch (item->type) {
|
switch (item->type) {
|
||||||
case SC_GOTO:
|
case SC_GOTO:
|
||||||
|
@ -21,7 +21,7 @@ int do_stop(const char *applet, const char *exec, const char *const *argv,
|
|||||||
pid_t pid, uid_t uid,int sig, bool test);
|
pid_t pid, uid_t uid,int sig, bool test);
|
||||||
int run_stop_schedule(const char *applet,
|
int run_stop_schedule(const char *applet,
|
||||||
const char *exec, const char *const *argv,
|
const char *exec, const char *const *argv,
|
||||||
const char *pidfile, uid_t uid,
|
pid_t pid, uid_t uid,
|
||||||
bool test, bool progress);
|
bool test, bool progress);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -657,7 +657,7 @@ int main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
parse_schedule(applet, NULL, sig);
|
parse_schedule(applet, NULL, sig);
|
||||||
i = run_stop_schedule(applet, exec, (const char *const *)margv,
|
i = run_stop_schedule(applet, exec, (const char *const *)margv,
|
||||||
pidfile, uid, test, progress);
|
get_pid(applet, pidfile), uid, test, progress);
|
||||||
|
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
/* We failed to stop something */
|
/* We failed to stop something */
|
||||||
|
Loading…
Reference in New Issue
Block a user