[PATCH] cmdserver: add command to get pid of server handling current connection

Mads Kiilerich mads at kiilerich.com
Fri Oct 17 10:49:36 CDT 2014


On 10/17/2014 05:39 PM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1413556690 -32400
> #      Fri Oct 17 23:38:10 2014 +0900
> # Node ID 1b432767e0829aba65a8f63bdcdb3bb9cabbce4f
> # Parent  840be5ca03e1db16ba994e55597771c418166c97
> cmdserver: add command to get pid of server handling current connection
>
> Since unix-mode server forks child process per request, client cannot know
> the pid of the server, which is necessary to send SIGINT for example.
>
> Though Linux has getsockopt(SO_PEERCRED), it cannot be used because the server
> fork()s after accept().  So commandserver should provide "getpid" command.

Wouldn't it be better to keep it more high level and just have a 'stop', 
'die' or 'kill' command?

I can however see how this can be convenient for low level debugging, 
and highlevel stuff should probably not care about killing it all ...

/Mads



More information about the Mercurial-devel mailing list