[PATCH] Use setproctitle in winbindd

Ralph Böhme slow at samba.org
Sat Jan 13 12:56:19 UTC 2018


On Fri, Jan 12, 2018 at 04:43:24PM -0700, Christof Schmitt wrote:
> On Tue, Jan 09, 2018 at 08:54:45PM +0100, Ralph Böhme wrote:
> > what for? Why calling prctl? My understanding was calling setproctitle is all
> > that's needed for fancy ps output across the board. Isn't that what the samba
> > binary calls as well?
> 
> As Andrew pointed out, argv[0] and the process name (or "comm" in
> Linux) are two different names.

Sure, but comm is useless imho as it's truncated to 15 characters, so the
process list below would be:

$ ps -ejH | grep winbindd

13566 13484  3698 pts/1    00:00:00                 samba
13570 13484  3698 pts/1    00:00:00                   samba
13571 13571 13571 ?        00:00:00                     winbindd
13581 13571 13571 ?        00:00:00                       winbindd: domai
13585 13571 13571 ?        00:00:00                       winbindd: idmap
13586 13571 13571 ?        00:00:00                       winbindd: domai

Even when skipping the "domain child" part below and used a "winbindd: DOMAIN"
pattern from winbindd, we'd only have 5 characters for the domain name, so

$ ps -ejH | grep winbindd

13566 13484  3698 pts/1    00:00:00                 samba
13570 13484  3698 pts/1    00:00:00                   samba
13571 13571 13571 ?        00:00:00                     winbindd
13581 13571 13571 ?        00:00:00                       winbindd: ADDOM
13585 13571 13571 ?        00:00:00                       winbindd: domai
13586 13571 13571 ?        00:00:00                       winbindd: BUILT

That's not worth the trouble imo. I'm fine with using the BSD variant to get a
nice process list, I don't need a crippled UNIX variant.

> The situation now for Samba is that
> depending on which one is displayed, the naming is inconsistent.

Yep, we should use setproctitle in smbd and childs as well instead of prctl. :)

> My proposal would be to have a new function in lib/util/util_process.c that
> takes two arguments and tries to set both names. A fallback would be if only
> the short name (<= 16 bytes) is provided, that can be used for both cases. Then
> this function should be the preferred approach to set the process names. Time
> permitting, i will work on a patch.

Ok, I'll review once you have something. :)

-slow

-- 
Ralph Boehme, Samba Team       https://samba.org/
Samba Developer, SerNet GmbH   https://sernet.de/en/samba/



More information about the samba-technical mailing list