Hi,

Aug 28, 2025, 20:50 by samuel.thiba...@gnu.org:

> yelni...@tutamail.com, le mar. 26 août 2025 12:33:44 +0200, a ecrit:
>
>> Hello Samuel,
>>
>> Something like this fixes the D_WOULD_BLOCK errno for me.
>> --8<---------------cut here---------------start------------->8---
>> diff --git a/trans/streamio.c b/trans/streamio.c
>> index e42ff908..93057146 100644
>> --- a/trans/streamio.c
>> +++ b/trans/streamio.c
>> @@ -1049,6 +1049,8 @@ device_read_reply_inband (mach_port_t reply, 
>> kern_return_t errorcode,
>>  
>>    input_pending = 0;
>>    err = errorcode;
>> +  if (err == D_WOULD_BLOCK)
>> +    err = EWOULDBLOCK;
>>
>
> Don't we rather want to set it to 0?
>
> If we leave err non-0, the rest of the function will call dev_close. I
> don't think we want to close the file just on a D_WOULD_BLOCK
> notification?
> But it's not an error, it just tells that there is currently nothing to
> read. If nowait is 0, we still want to enter the wait loop.
>
This makes a lot more sense.
What about this?
--8<---------------cut here---------------start------------->8---
diff --git a/trans/streamio.c b/trans/streamio.c
index e42ff908..c6e7229e 100644
--- a/trans/streamio.c
+++ b/trans/streamio.c
@@ -1049,9 +1049,11 @@ device_read_reply_inband (mach_port_t reply, 
kern_return_t errorcode,
 
   input_pending = 0;
   err = errorcode;
+  if (err == D_WOULD_BLOCK)
+    err = 0;
   if (!err)
     {
-      if (datalen == 0)
+      if (datalen == 0 && errorcode != D_WOULD_BLOCK)
{
  eof = 1;
  dev_close ();
--8<---------------cut here---------------end--------------->8---

The second check is to not treat getting nothing + D_WOULD_BLOCK as EOF 


>> One other thing that I found is that the "last" line in the kernel log is 
>> missing a terminating newline. Is there a way to add it?
>>
>
> That might be related.
>

This is still happening with the new patch. These are the initial last messages 
in /dev/klog for me after a reboot:

module 0: pci-arbiter --host-priv-port=${host-port} 
--device-master-port=${device-port} --next-task=${disk-task} 
$(pci-task=task-create) $(task-resume)
module 1: rumpdisk --next-task=${fs-task} $(disk-task=task-create)
module 2: ext2fs --multiboot-command-line=${kernel-command-line} 
--exec-server-task=${exec-task} --store-type=typed ${root} 
$(fs-task=task-create)
module 3: exec $(exec-task=task-create)
4 multiboot modules
task loaded: pci-arbiter --host-priv-port=1 --device-master-port=2 --next-task=3
task loaded: rumpdisk --next-task=1
task loaded: ext2fs --multiboot-command-line=rootEWOULDBLOCK




> Samuel
>


Reply via email to