[Top][All Lists]

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

[bug #48371] read(fd, NULL, 0) from /dev/klog blocks until there is data

From: Kalle Olavi Niemitalo
Subject: [bug #48371] read(fd, NULL, 0) from /dev/klog blocks until there is data
Date: Fri, 1 Jul 2016 21:47:48 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.8.0


                 Summary: read(fd, NULL, 0) from /dev/klog blocks until there
is data
                 Project: The GNU Hurd
            Submitted by: kon
            Submitted on: Fri Jul  1 21:47:46 2016
                Category: Hurd Servers
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Standard Compliance
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Reproducibility: None
              Size (loc): None
         Planned Release: None
                  Effort: 0.00
Wiki-like text discussion box: 



I patched rsyslog 8.16.0 to make it use /dev/klog on the Hurd.  (Set
os_type="bsd" in configure.ac.)  It opened /dev/klog all right but then hung
waiting for input.  rpctrace showed that it was calling read with size=0. 
This call is in plugins/imklog/bsd.c (klogWillRunPostPrivDrop).  I removed the
call and rsyslog then started quickly.

The translator of /dev/klog is "/hurd/streamio kmsg".  I assume storeio gets
to the dev_read function, which then waits for input from the kernel, without
noticing that the requested size is 0.

According to antrik, POSIX specifies that read with nbyte==0 must immediately
return 0 or return an error.  This could be implemented in libc, libtrivfs, or
streamio.  It seems best to implement this in streamio so that translators can
still return EBADF if the file was not opened for reading.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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