kernel: generalize awake

Awake can now interrupt several blocking syscalls (even
during note handling).

Among others, it can interrupt await, pread and pwrite.

It cannot interrupt several others for different reasons:

- awake cannot be interrupted by awake;
- syscalls like remove and create can be used for kernel comunication
  and it would be hard to know if the effect occurred in the
  receiving fs if they were interrupted;
- other syscalls do not need awake since they just provide access
  to kernel infos (eg seek or fd2path)

NOTE: awakes registered before a note cannot occur during the note
handling and will be deferred till the next call to noted.
This commit is contained in:
2017-05-15 00:05:59 +02:00
parent 79f8204766
commit f9b2e9aba4
9 changed files with 132 additions and 115 deletions

View File

@ -27,15 +27,15 @@ handler(void *v, char *s)
int i;
if(strcmp(s, "stop") == 0){
done = 1;
noted(NCONT);
}else{
print("waiting after %s", s);
for(i = 0; i < 1000*1000; ++i)
if(i % 4999 == 0)
print(".");
print("\n");
print("wait after %s terminated\n", s);
waited++;
}
print("waiting after %s", s);
for(i = 0; i < 1000*1000; ++i)
if(i % 4999 == 0)
print(".");
print("\n");
print("wait after %s terminated\n", s);
waited++;
noted(NCONT);
}
@ -60,6 +60,8 @@ main(int argc, char**argv)
sleep(100);
if(waited == 2){
print("PASS\n");
exits(0);
exits("PASS");
}
print("%d notes received\n");
exits("FAIL");
}