Hello, While running the Shepherd on the Hurd, I stumbled upon this:
--8<---------------cut here---------------start------------->8--- System lacks support for 'signalfd'; using fallback mechanism. shepherd[1]: GNU Shepherd 1.0.4 (Guile 3.0.9, i586-pc-gnu) shepherd[1]: Starting service root... shepherd[1]: Service root started. shepherd[1]: Service root running with value #<<process> id: 1 command: #f>. shepherd[1]: Service root has been started. shepherd[1]: starting services... shepherd[1]: Configuration successfully loaded from '/gnu/store/giw6z1y2kssq1d7dplxp5i1fawjfabmp-shepherd.conf'. shepherd[1]: Starting service pam... shepherd[1]: Starting service user-file-systems... shepherd[1]: Starting service root-file-system... shepherd[1]: Starting service loopback... shepherd[1]: Starting service networking... shepherd[1]: Service pam started. shepherd[1]: Service user-file-systems started. shepherd[1]: Service root-file-system started. shepherd[1]: Service pam running with value #t. shepherd[1]: Service pam has been started. shepherd[1]: Service user-file-systems running with value #t. shepherd[1]: Service user-file-systems has been started. shepherd[1]: Service root-file-system running with value #t. shepherd[1]: Service root-file-system has been started. Uncaught exception in task: In fibers.scm: 172:8 7 (_) In shepherd/service/system-log.scm: 240:7 6 (run-system-log #<<channel> getq: #<atomic-box 33088d0?> ?) In ice-9/suspendable-ports.scm: 681:11 5 (read-delimited _ _ _) 613:2 4 (read-char _) 184:27 3 (fill-input #<input: /dev/klog 44> _ _) 72:4 2 (read-bytes #<input: /dev/klog 44> #vu8(51 98 120 121 ?) ?) In unknown file: 1 (port-read #<input: /dev/klog 44> #vu8(51 98 120 121 ?) ?) In ice-9/boot-9.scm: 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: In procedure fport_read: (os/device) operation would block --8<---------------cut here---------------end--------------->8--- What happens here is that reading from /dev/klog (opened with O_NONBLOCK) returns ED_WOULD_BLOCK. However Guile and its concurrency framework (Fibers) don’t know about this error, hence the (non-fatal) backtrace, but they do know about EAGAIN and EWOULDBLOCK. What do you think of the patch below? Thanks, Ludo’.
diff --git a/trans/streamio.c b/trans/streamio.c index e42ff908..cdc0af40 100644 --- a/trans/streamio.c +++ b/trans/streamio.c @@ -1011,7 +1011,13 @@ dev_read (size_t amount, void **buf, size_t *len, int nowait) { err = start_input (nowait); if (err) - return err; + { + if (err == ED_WOULD_BLOCK) + /* Return a POSIX error code that the client is more likely to + handle properly. */ + err = EAGAIN; + return err; + } if (eof) {