* read() from a removed device
@ 2020-07-06 16:56 Frank Schäfer
2020-07-06 17:17 ` Florian Weimer
0 siblings, 1 reply; 4+ messages in thread
From: Frank Schäfer @ 2020-07-06 16:56 UTC (permalink / raw)
To: libc-help
Hi,
I just noticed that read() from a usb-serial device doesn't fail after
the device got (physically) removed.
I would expect it to return -1 and set an appropriate errno, but it
returns 0 (no error, no bytes read) instead.
Is this the correct/expected behavior or a bug ?
Regards,
Frank Schäfer
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: read() from a removed device
2020-07-06 16:56 read() from a removed device Frank Schäfer
@ 2020-07-06 17:17 ` Florian Weimer
2020-07-06 17:31 ` Frank Schäfer
0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2020-07-06 17:17 UTC (permalink / raw)
To: Frank Schäfer via Libc-help
* Frank Schäfer via Libc-help:
> I just noticed that read() from a usb-serial device doesn't fail after
> the device got (physically) removed.
> I would expect it to return -1 and set an appropriate errno, but it
> returns 0 (no error, no bytes read) instead.
> Is this the correct/expected behavior or a bug ?
You need toask on one of the kernel mailing lists. glibc just calls
into the kernel and reports back whatever it receives from there.
Thanks,
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: read() from a removed device
2020-07-06 17:17 ` Florian Weimer
@ 2020-07-06 17:31 ` Frank Schäfer
2020-07-06 17:54 ` Florian Weimer
0 siblings, 1 reply; 4+ messages in thread
From: Frank Schäfer @ 2020-07-06 17:31 UTC (permalink / raw)
To: Florian Weimer, Frank Schäfer via Libc-help
Am 06.07.20 um 19:17 schrieb Florian Weimer:
> * Frank Schäfer via Libc-help:
>
>> I just noticed that read() from a usb-serial device doesn't fail after
>> the device got (physically) removed.
>> I would expect it to return -1 and set an appropriate errno, but it
>> returns 0 (no error, no bytes read) instead.
>> Is this the correct/expected behavior or a bug ?
> You need toask on one of the kernel mailing lists. glibc just calls
> into the kernel and reports back whatever it receives from there.
Guess what the kernel devs say when I report this issue to them... ;)
Can I read your reply as "this is supposed to work as you expect from
glibc side" ?
How does the "call into the kernel" look like ?
Thanks,
Frank
> Thanks,
> Florian
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: read() from a removed device
2020-07-06 17:31 ` Frank Schäfer
@ 2020-07-06 17:54 ` Florian Weimer
0 siblings, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2020-07-06 17:54 UTC (permalink / raw)
To: Frank Schäfer; +Cc: Frank Schäfer via Libc-help
* Frank Schäfer:
> Am 06.07.20 um 19:17 schrieb Florian Weimer:
>> * Frank Schäfer via Libc-help:
>>
>>> I just noticed that read() from a usb-serial device doesn't fail after
>>> the device got (physically) removed.
>>> I would expect it to return -1 and set an appropriate errno, but it
>>> returns 0 (no error, no bytes read) instead.
>>> Is this the correct/expected behavior or a bug ?
>> You need toask on one of the kernel mailing lists. glibc just calls
>> into the kernel and reports back whatever it receives from there.
> Guess what the kernel devs say when I report this issue to them... ;)
Not sure what exactly you asked. Maybe someone confused fread and read.
> How does the "call into the kernel" look like ?
Basically like this:
xor %eax, %eax
syscall
Plus some code to put the error code into errno on failure. And of
course zero return value is not a failure. There is not much that can
go wrong there.
Thanks,
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-06 17:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-06 16:56 read() from a removed device Frank Schäfer
2020-07-06 17:17 ` Florian Weimer
2020-07-06 17:31 ` Frank Schäfer
2020-07-06 17:54 ` Florian Weimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).