[PATCH] cmdserver: add command to get pid of server handling current connection
Yuya Nishihara
yuya at tcha.org
Fri Oct 17 16:02:52 UTC 2014
On Fri, 17 Oct 2014 17:49:36 +0200, Mads Kiilerich wrote:
> 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?
Commandserver is blocking, it cannot receive new 'stop' command while handling
'runcommand' request. So signal is the only way to interrupt stalled operation.
Regards,
More information about the Mercurial-devel
mailing list