[PATCH 4 of 4] chg: change server's process title

Jun Wu quark at fb.com
Thu Aug 11 13:28:09 EDT 2016


Excerpts from Yuya Nishihara's message of 2016-08-12 01:55:44 +0900:
> Maybe we'll need setproctitle() equivalent for Linux which will update argv?

That would be probably rewriting argv[0], afaik. I think it is impossible
to get the "argv" pointer in a reasonable way.

> 16-char limitation of prctl() would come from pthread API. If we want to
> extend the (ab)use of process title to hgweb, PR_SET_NAME won't be useful.
> It won't be displayed in normal ps output.

It's still useful with '-O comm', and atop will record it. prctl is lower
level than pthread. Sadly 16 is hardcoded in Linux.

> I found some examples in CRuby (MRI) and PostgreSQL code, though I don't
> know if OSX is supported.

I was aware "ARGV[0] = 'foo'" works and "Process.setproctitle" was
introduced in some new version of Ruby. I guess they just rewrite argv[0].

What I can confirm now is neither of them works with Ruby 2.0.0 on OS X -
the latter is not implemented.

> > If we really want OS X support, it is probably doable like what node.js
> > does [1], although the code and comment scares me a bit.
> > 
> > [1]: https://github.com/openwebos/nodejs/blob/master/src/platform_darwin_proctitle.cc


More information about the Mercurial-devel mailing list