help needed on a unix system-call question

Guy Harris guy at auspex.UUCP
Thu Mar 9 05:40:52 AEST 1989


>In my code I use a signal (SIGALRM), system-call, following which is a 'read'
>system-call. The read is done on a tty-port. It is mentioned in the unix v
>manual that 'read' will return -1 when interrupted by a signal. Is it poss-
>ible to lose the partially read data by the 'read' system call, when the
>signal was caught , even though I execute a 'read' again ? Note that I
>am doing a 'read' on the tty-port. 

Assuming by "is it possible to lose the partially read data" you mean
"if the 'read' blocks, and then transfers some data and blocks waiting
for more data, and *then* gets interrupted by a signal, is the data it
transferred more-or-less lost", the answer is "yes, and this happens
under 4.xBSD as well".  The problem is that, since you get a -1 back
from the "read", rather than a count of the number of bytes read, you
have no idea how much data was actually transferred. 



More information about the Comp.unix.wizards mailing list