diff --git a/README b/README index 9c61468..4f50a3a 100644 --- a/README +++ b/README @@ -98,6 +98,11 @@ int fdread(int, void*, int); Like regular read(), but puts task to sleep while waiting for data instead of blocking the whole program. +int fdreadn(int, void*, int); + + Like fdread(), but does successive read calls until n bytes have + been read, or a read system call returns a non-positive count. + int fdwrite(int, void*, int); Like regular write(), but puts task to sleep while waiting to diff --git a/fd.c b/fd.c index 4a7d51d..5b4f579 100644 --- a/fd.c +++ b/fd.c @@ -290,6 +290,22 @@ fdread(int fd, void *buf, int n) return m; } +int +fdreadn(int fd, void *buf, int n) +{ + int m, tot; + + for(tot=0; tot