Messages in this thread | | | Date | Fri, 20 Oct 2000 18:58:13 +0100 | From | Philipp Rumpf <> | Subject | Re: [PATCH] 0-byte read()/write() behaviour |
| |
On Fri, Oct 20, 2000 at 10:47:45AM -0700, Linus Torvalds wrote: > On Fri, 20 Oct 2000, Philipp Rumpf wrote: > > > > Single Unix specifies that 0-byte reads, as well as 0-byte writes, should > > "return 0 and have no other results". Our current implementation violates > > the first requirement and makes it very easy to violate the second one. > > Note that there _are_ cases where 0-byte reads and writes have specific > meaning, notably there are some networking things where a 0-byte sendto() > does something special if I remember correctly. And I seem to remember > that this also _did_ translate into write().
sock_write and sock_read contain: if(size==0) /* Match SYS5 behaviour */ return 0;
I'm not sure which other read()/write() functions are used by "networking things", but I don't see any others sendto would map to.
So I suspect if there are any applications which would need the behaviour you described they've already been broken, and should be recompiled to use sys_send(|to|msg) (via sys_socketcall on x86, of course).
> I remember that Linux used to do exactly this, and we had to pass the > 0-byte writes into the low-level cases exactly because some low-level > cases do care.
I would suspect most of those have been eliminated by now.
> I suspect SUS only talks about regular files.
As I'm reading it, they're talking about every read() call, even those with an invalid fd. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
| |