From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH v3] Add systemd socket launching support Date: Thu, 31 Mar 2016 13:11:25 -0400 Message-ID: References: <874mbn7kmn.fsf@mattleach.net> <871t6qkc3h.fsf@mattleach.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1459444314 22023 80.91.229.3 (31 Mar 2016 17:11:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Mar 2016 17:11:54 +0000 (UTC) Cc: emacs-devel@gnu.org To: Matthew Leach Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 31 19:11:48 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1alg8J-0003NL-Hv for ged-emacs-devel@m.gmane.org; Thu, 31 Mar 2016 19:11:47 +0200 Original-Received: from localhost ([::1]:33489 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alg8I-0007HQ-SU for ged-emacs-devel@m.gmane.org; Thu, 31 Mar 2016 13:11:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alg84-0007HH-PI for emacs-devel@gnu.org; Thu, 31 Mar 2016 13:11:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alg7z-0002tf-7H for emacs-devel@gnu.org; Thu, 31 Mar 2016 13:11:32 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:33067) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alg7z-0002tT-1J for emacs-devel@gnu.org; Thu, 31 Mar 2016 13:11:27 -0400 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id u2VHBPbw029692; Thu, 31 Mar 2016 13:11:26 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id A7BAFAE15D; Thu, 31 Mar 2016 13:11:25 -0400 (EDT) In-Reply-To: <871t6qkc3h.fsf@mattleach.net> (Matthew Leach's message of "Thu, 31 Mar 2016 14:31:46 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5628=0 X-NAI-Spam-Version: 2.3.0.9418 : core <5628> : inlines <4625> : streams <1611887> : uri <2176474> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:202516 Archived-At: > Internally, sd_listen_fds() checks whether the $LISTEN_PID environment > variable equals the daemon PID. If not, it returns > immediately. Otherwise, it parses the number passed in the $LISTEN_FDS > environment variable, then sets the FD_CLOEXEC flag for the parsed > number of file descriptors starting from SD_LISTEN_FDS_START. Finally, > it returns the parsed number. Then I think it would be better to follow an approach like the one with which you started (i.e. without the internal systemd_socket variable), so the systemd-specific code is limited to just a function that returns an FD, and then everything else is code that could be used for other purposes (such as xinetd) and can be explained/documented independently from systemd. Stefan "IIUC"