Re: [PATCH 2/2] pack-objects: be incredibly anal about stdio semantics
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Apr 2, 2006, 22:58 UTC
- Message-ID
- <Pine.LNX.4.64.0604021554480.23419@g5.osdl.org>
- In-Reply-To
- <15051.1144015974@lotus.CS.Berkeley.EDU>
On Sun, 2 Apr 2006, Jason Riedy wrote:
Show 5 quoted lines
> > If you consider stdio to be a low-level wrapper over syscalls > that only adds buffering and simple parsing, then passing EINTR > back to the application is a sensible choice. I wouldn't be > too surprised if L4, VxWorks, etc. do something similar.
No, returning EINTR is insane, because stdio has to do re-starting of system calls by hand _anyway_ for the "short read" case.
EINTR really _is_ 100% equivalent to "short read of zero bytes" (that literally is what it means for a read/write system call - anybody who tells you otherwise is just crazy).
So any library that handles short reads, but doesn't handle EINTR is by definition doing something totally idiotic and broken.
Now, I agree that somebody else might be broken too. I would not agree that it's "acceptable". It's craptastically bad library code.
> Anyone with an older HP/UX care to try these patches? HP/UX > may not be sane, but I think it may lack SA_RESTART. I don't > know if stdio calls need restarted, though.
I'd assume that older HPUX is so BSD-based that all signals end up restarting. That was the BSD signal() semantics, after all.
Linus