/proc/<pid>/cmdline and udhcpcd

Michael Conrad mconrad at intellitree.com
Wed Mar 26 15:18:01 UTC 2014


On 03/26/2014 09:13 AM, Cristian Ionescu-Idbohrn wrote:
> On Wed, 26 Mar 2014, Denys Vlasenko wrote:
>> But how that respawn tool going to work with other programs?
> As I've written in a previous message, I know nothing of such other
> programs, but I'd be intrested to learn more.
>
>> There is no convention in Unix that you can't modify argv[].
> Sad, because if there was, there would have been something to refer
> to.

daemontools and runit's runsvdir both have a feature where they log to 
the cmdline, as a ... clever? way of not relying on a writable logging 
destination.
http://smarden.org/runit/runsvdir.8.html

I'm aware of quite a few Perl daemons that overwrite their proc title 
(otherwise you'd end up with "perl ..." all over your ps listing).  
Examples include Catalyst and Plack fast-cgi servers.

I've personally written C code that replaces the "=" with "\0" in 
options like "--option-foo=VALUE".  Not in any published open-source 
though, I don't think...

All mysql utilities overwrite passwords in cmdline as a security measure.
http://dev.mysql.com/doc/refman/5.1/en/password-security-user.html

So in short, its a thing that the Linux world has been doing for a long 
time, though infrequently.  I'm sure someone at your work thought 
re-using /proc/*/cmdline was a really cool idea, and built a system 
around it, and this system might have been working ok for you so far.  
And I sympathize with this situation.  However, there exists a 
holy-grail design of process management that is frequently advertised on 
this list, where you have one runscript per persistent daemon, and a 
daemon manager which runs all the daemons as child processes, and 
restarts them if they exit unexpectedly.  And this design is probably 
actually what you want.  So if you're interested in learning something 
new and highly effective for process management, check out the tools 
"runit", "s6", "perp" (or, my own recently completed 'daemonproxy').  
Also, runit is available as a busybox applet.

http://smarden.org/runit/
http://skarnet.org/software/s6/why.html
http://b0llix.net/perp/
https://github.com/silverdirk/daemonproxy

While a paradigm-shift could be painful, a quick fix could be as simple 
as having your current process monitor watch an instance of runsv 
instead of udhcpcd, and in turn, runsv would monitor udhcpcd.

Hope that helps.
-Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20140326/b5a84004/attachment.html>


More information about the busybox mailing list