not really an explanation but a pointer:
if you're really only using read(2) for reading, things work as expected:
-------------------------------------------------------------------------------
*** posix.c~ Mon Dec 9 14:48:00 1996
--- posix.c Mon Dec 9 14:59:05 1996
***************
*** 26,36 ****
sigaction (SIGALRM, &sa, NULL);
pipe(fildes);
- fp = fdopen (fildes[0], "r");
alarm(2);
! ch = fgetc (fp);
result = ch == EOF && errno == EINTR;
alarm(0);
--- 26,39 ----
sigaction (SIGALRM, &sa, NULL);
pipe(fildes);
alarm(2);
! #if 0
! lseek(3, 0, SEEK_CUR);
! #endif
!
! read(fildes[0],&ch,1);
result = ch == EOF && errno == EINTR;
alarm(0);
-------------------------------------------------------------------------------
sigaction(SIGALRM, {0x1074, [], 0}, NULL) = 0
pipe([3, 4]) = 0
alarm(2) = 0
read(3, 0xbffff8a8, 1) = ? ERESTARTSYS (To be restarted)
--- SIGALRM (Alarm clock) ---
sigreturn() = ? (mask now [])
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 192), ...}) = 0
brk(0x6000) = 0x6000
brk(0x7000) = 0x7000
ioctl(1, TCGETS, {B9600 opost isig icanon echo ...}) = 0
write(1, "ch 0 errno 4 4 \n", 16ch 0 errno 4 4
) = 16
alarm(0) = 0
_exit(0) = ?
-------------------------------------------------------------------------------
as soon as you add the lseek() read() will restart and hang...
my `man 2 read' page says
ERRORS
EINTR The call was interrupted by a signal before any
data was read.
so lseek() seems to change the state of "before any data was read" ...
Harald
-- All SCSI disks will from now on ___ _____ be required to send an email notice 0--,| /OOOOOOO\ 24 hours prior to complete hardware failure! <_/ / /OOOOOOOOOOO\ \ \/OOOOOOOOOOOOOOO\ \ OOOOOOOOOOOOOOOOO|// Harald Koenig, \/\/\/\/\/\/\/\/\/ Inst.f.Theoret.Astrophysik // / \\ \ koenig@tat.physik.uni-tuebingen.de ^^^^^ ^^^^^