On Sunday 06 April 2008 14:40:08 pieterg wrote:
> Stopping a daemon with the -x argument fails on unionfs.
>
> The reason is that pid_is_exec (debianutils/start_stop_daemon.c) looks
> where the /proc/<pid>/exe symlink points to, but that is not necessarily
> the real location of the executable in the filesystem.
>
> For instance, on unionfs, one could have the following 'exe' symlink:
> /proc/1234/exe -> /boot/mnt/flash/delta/usr/bin/djmount
>
> while the process was started as /usr/bin/djmount.
>
> As a result, attemping to stop it with
> start-stop-daemon -K -x /usr/bin/djmount will fail.
>
> Would there be any drawback to using the contents of /proc/<pid>cmdline
> (stringcompare up to the first null character), instead of the exe symlink,
> in pid_is_exec?
> I believe that would solve not only the problems on unionfs, but would also
> allow to find the right process if the command used a symlink, for instance
> with a multi-call binary.

It also allows the binary to be moved or deleted during an upgrade and still 
allow to be restarted. Anyone wishing to improve s-s-d in busybox should have 
a look at the OpenRC implementation (although BSD-2 licensed).

http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=blob;f=src/librc/librc-daemon.c;h=a58ba15cf4824189a715c29c35530ef225f27139;hb=6b74fa74d6d19393f2c1151e0b4fcdd3ae50c83d
lines 58 through 132 would be of interest to this specific query.

You may want to consider supporting the --test option which OpenRC requires, 
which is also found in the upstream Debian version.

Thanks

Roy
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to