[PATCH] cmdserver: add command to get pid of server handling current connection
idankk86 at gmail.com
Fri Oct 17 17:12:08 CDT 2014
On Fri, Oct 17, 2014 at 2:29 PM, Pierre-Yves David
<pierre-yves.david at ens-lyon.org> wrote:
> On 10/17/2014 08:39 AM, 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
>> fork()s after accept(). So commandserver should provide "getpid" command.
> I'm not super excited about this, but I can see why this is necessary.
> I've a bit confused about how you get:
> (1) the child processing your request to reply to the same one
> (2) the child processing your request to reply to this as it is blocked
> replying to the request.
I believe the idea here is that a client connected to a socket mode server
wants a way to interrupt it by sending it a SIGINT, for which it needs its
So the flow is:
1) client connects to server
2) client runs command that hangs
3) user interrupts hung client
4) client sig handler can interrupt server since it now has its pid
More information about the Mercurial-devel