From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqbQc-0008Vn-8L for guix-patches@gnu.org; Tue, 27 Feb 2018 04:20:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqbQZ-0004OS-4t for guix-patches@gnu.org; Tue, 27 Feb 2018 04:20:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:54620) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqbQY-0004OI-W1 for guix-patches@gnu.org; Tue, 27 Feb 2018 04:20:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqbQY-0000LC-KN for guix-patches@gnu.org; Tue, 27 Feb 2018 04:20:02 -0500 Subject: [bug#30498] [WIP v2 shepherd] shepherd: If /dev/kmsg is writable, use it for logging. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180217122035.1443-1-dannym@scratchpost.org> <20180217164835.1178-1-dannym@scratchpost.org> <87muzvtyo3.fsf@gnu.org> <20180226233214.6fe40fa3@scratchpost.org> Date: Tue, 27 Feb 2018 10:19:47 +0100 In-Reply-To: <20180226233214.6fe40fa3@scratchpost.org> (Danny Milosavljevic's message of "Mon, 26 Feb 2018 23:32:14 +0100") Message-ID: <87inai6b7w.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Danny Milosavljevic Cc: 30498@debbugs.gnu.org Hi Danny, Danny Milosavljevic skribis: >> As for cryptsetup, what if the service that runs crypsetup simply >> parameterizes =E2=80=98log-output-port=E2=80=99 to /dev/console? That w= ould give us the >> current behavior, right? > > I don't understand why this current-output-port stuff is somehow passed o= n to > forked processes in the first place (why does cryptsetup care what I do > to guile variables?). > > scheme@(guile-user)> (current-output-port (%make-void-port "w")) > scheme@(guile-user)> (system* "ls" "/") > scheme@(guile-user)> Funny no? :-) This is in libguile/posix.c, =E2=80=98scm_open_process=E2=80=99 and =E2=80= =98start_child=E2=80=99: when the current input/output/error port isn=E2=80=99t a file port, FDs 0/1/2 in= the child are made to point to /dev/null. Otherwise, they are inherited as file descriptors. For cryptsetup, this should be what we want if we do: (call-with-output-file "/dev/console" (lambda (port) (parameterize ((log-output-port port) (current-input-port port) (current-error-port port)) (invoke "cryptsetup" =E2=80=A6)))) Or do we even need to care about =E2=80=98log-output-port=E2=80=99? Though= ts? > It wasn't my intention to inherit them as file descriptors... also, for g= uile > buffering ports, how does it inherit those as file descriptors? Will it = still > do the custom line buffering that shepherd does, also when a child process > writes there? Shepherd does not process the stdout/err of child processes in any way, so there shouldn=E2=80=99t be buffering there. Ludo=E2=80=99.