> The client is (really?) suspended until Tread, but the read() sys call
> cannot be interrupted by alarm().
i didn't understand your errata, so to clarify,
read(2) is interruptable with a note (modulo the
file server, but that's a different story). here's a
program that demonstrates:
; 8.readalarm
note: alarm
read -1
interrupted
- erik
----
#include <u.h>
#include <libc.h>
void
nofun(void*, char *msg)
{
print("note: %s\n", msg);
if(strstr(msg, "alarm") != nil)
noted(NCONT);
else
noted(NDFLT);
}
void
main(void)
{
char buf[1024];
int fd, n;
fd = open("/net/log", OREAD);
if(fd == -1)
sysfatal("open: %r");
notify(nofun);
alarm(500);
n = read(fd, buf, 1024);
alarm(0);
print("read %d\n", n);
if(n < 0)
print(" %r\n");
exits("");
}