diff options
| author | Charles.Forsyth <devnull@localhost> | 2007-07-14 09:52:44 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2007-07-14 09:52:44 +0000 |
| commit | ad88539715c50f30c4e8fca27338158dc33feaaa (patch) | |
| tree | 2423bd08dc7f3e7734b460c801a11e3c243c405d /emu/port/inferno.c | |
| parent | 150ed664169adc7de05ac8c4fdcf87a0987bc372 (diff) | |
20070714-1052
Diffstat (limited to 'emu/port/inferno.c')
| -rw-r--r-- | emu/port/inferno.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/emu/port/inferno.c b/emu/port/inferno.c index 1149d623..b568f9fa 100644 --- a/emu/port/inferno.c +++ b/emu/port/inferno.c @@ -271,6 +271,35 @@ Sys_read(void *fp) } void +Sys_readn(void *fp) +{ + int fd, m, n, t; + F_Sys_readn *f; + + f = fp; + n = f->n; + if(f->buf == (Array*)H || n < 0) { + *f->ret = 0; + return; + } + if(n > f->buf->len) + n = f->buf->len; + fd = fdchk(f->fd); + + release(); + for(t = 0; t < n; t += m){ + m = kread(fd, (char*)f->buf->data+t, n-t); + if(m <= 0){ + if(t == 0) + t = m; + break; + } + } + *f->ret = t; + acquire(); +} + +void Sys_pread(void *fp) { int n; |
