Subject: write() returning -1 and EINTR?
To: None <netbsd-users@netbsd.org>
From: None <kpneal@pobox.com>
List: netbsd-users
Date: 12/15/2002 18:32:30
How can write() return a -1 with errno set to EINTR? Shouldn't write()
return a 0 if it is interrupted and hasn't written anything out?

Then again, when exactly are writes atomic? Only when writing to disk?

 21312 dump     RET   read 2048/0x800
 21312 dump     CALL  flock(0x3,0x8)
 21312 dump     RET   flock 0
 21312 dump     CALL  __sigprocmask14(0,0,0x12008fe90)
 21312 dump     RET   __sigprocmask14 0
 21312 dump     CALL  __sigaltstack14(0,0x1fffff798)  
 21312 dump     RET   __sigaltstack14 0
 21312 dump     CALL  write(0x4,0x120112000,0x2800)
 21312 dump     RET   write -1 errno 4 Interrupted system call

This is on an alpha running 1.6. I think it is reproducable. There were
calls from different processes in the original trace that I edited
out from the above clip.
-- 
"A method for inducing cats to exercise consists of directing a beam of
invisible light produced by a hand-held laser apparatus onto the floor ...
in the vicinity of the cat, then moving the laser ... in an irregular way
fascinating to cats,..." -- US patent 5443036, "Method of exercising a cat"