guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#30498] [WIP v2 shepherd] shepherd: If /dev/kmsg is writable, use it


From: Ludovic Courtès
Subject: [bug#30498] [WIP v2 shepherd] shepherd: If /dev/kmsg is writable, use it for logging.
Date: Tue, 27 Feb 2018 10:19:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hi Danny,

Danny Milosavljevic <address@hidden> skribis:

>> As for cryptsetup, what if the service that runs crypsetup simply
>> parameterizes ‘log-output-port’ to /dev/console?  That would give us the
>> current behavior, right?
>
> I don't understand why this current-output-port stuff is somehow passed on 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, ‘scm_open_process’ and ‘start_child’: when
the current input/output/error port isn’t 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" …))))

Or do we even need to care about ‘log-output-port’?  Thoughts?

> It wasn't my intention to inherit them as file descriptors... also, for guile
> 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’t be buffering there.

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]