From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Live System User Newsgroups: gmane.emacs.devel Subject: Re: [PATCH v3] Add systemd socket launching support Date: Sat, 02 Apr 2016 20:53:41 -0400 Message-ID: <87a8lbzf56.fsf@aol.com> 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 1459644846 12506 80.91.229.3 (3 Apr 2016 00:54:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Apr 2016 00:54:06 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 03 02:53:59 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 1amWIg-0000Em-HL for ged-emacs-devel@m.gmane.org; Sun, 03 Apr 2016 02:53:58 +0200 Original-Received: from localhost ([::1]:51490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1amWIf-00023R-Vo for ged-emacs-devel@m.gmane.org; Sat, 02 Apr 2016 20:53:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1amWIc-00023M-Qg for emacs-devel@gnu.org; Sat, 02 Apr 2016 20:53:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1amWIZ-00019x-LA for emacs-devel@gnu.org; Sat, 02 Apr 2016 20:53:54 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:40317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1amWIZ-00019r-EC for emacs-devel@gnu.org; Sat, 02 Apr 2016 20:53:51 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1amWIW-0000Aj-Mz for emacs-devel@gnu.org; Sun, 03 Apr 2016 02:53:48 +0200 Original-Received: from c-50-163-96-131.hsd1.ma.comcast.net ([50.163.96.131]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 03 Apr 2016 02:53:48 +0200 Original-Received: from nyc4bos by c-50-163-96-131.hsd1.ma.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 03 Apr 2016 02:53:48 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-50-163-96-131.hsd1.ma.comcast.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:sYAiDZTmC4toM1xLRRNZlix9xu0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:202604 Archived-At: Matthew Leach writes: > Hi Stefan, > > Stefan Monnier writes: > >>> +#include >> [..] >>> +#ifdef HAVE_SYSTEMD >>> + /* Read the number of sockets passed through by systemd. */ >>> + systemd_socket = sd_listen_fds(1); >> >> AFAICT, this is the core of the dependency to systemd. > > Yes, that's correct. There is also a call to `sd_is_socket' just below > this line. > >> Could you explain to us, how the socket information is actually >> passed? Is it passed via an env-var? > > I believe so, I'm not a systemd expert, though. Looking at the man page > for the sd_listen_fds: > > 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. > > HTH, If Emacs is compiled and configured for systemd integration, would it still be possible to startup Emacs(daemon) and use emacsclient *without* utilizing systemd, including from an X startup script? Thanks.