URL: <http://savannah.gnu.org/bugs/?48371>
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: _______________________________________________________ Details: 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: <http://savannah.gnu.org/bugs/?48371> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/