Mirror of git://git.busybox.net/busybox with our patches on top
Source
if ((opt & 0x80000000UL) || (opt & (SSD_CTX_STOP | SSD_CTX_START)) == 0) {
/* vi: set sw=4 ts=4: */
/*
* Mini start-stop-daemon implementation(s) for busybox
*
* Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>,
* public domain.
* Adapted for busybox David Kimdon <dwhedon@gordian.com>
*/
static int signal_nr = 15;
static int user_id = -1;
static int quiet = 0;
static char *userspec = NULL;
static char *cmdname = NULL;
static char *execname = NULL;
static char *pidfile = NULL;
struct pid_list {
struct pid_list *next;
pid_t pid;
};
static struct pid_list *found = NULL;
static inline void
push(pid_t pid)
{
struct pid_list *p;
p = xmalloc(sizeof(*p));
p->next = found;
p->pid = pid;
found = p;
}
static int
pid_is_exec(pid_t pid, const char *name)
{
char buf[32];
struct stat sb, exec_stat;
if (name && stat(name, &exec_stat))
bb_perror_msg_and_die("stat %s", name);
sprintf(buf, "/proc/%d/exe", pid);
if (stat(buf, &sb) != 0)
return 0;
return (sb.st_dev == exec_stat.st_dev && sb.st_ino == exec_stat.st_ino);
}