n 10 cat.c int n; n 12 cat.c while((n = read(fd, buf, sizeof(buf))) > 0) { n 13 cat.c if (write(1, buf, n) != n) { n 18 cat.c if(n < 0){ n 236 console.c consoleread(struct inode *ip, char *dst, int n) n 242 console.c target = n; n 244 console.c while(n > 0){ n 255 console.c if(n < target){ n 263 console.c --n; n 270 console.c return target - n; n 274 console.c consolewrite(struct inode *ip, char *buf, int n) n 280 console.c for(i = 0; i < n; i++) n 285 console.c return n; n 33 defs.h int fileread(struct file*, char*, int n); n 35 defs.h int filewrite(struct file*, char*, int n); n 97 file.c fileread(struct file *f, char *addr, int n) n 104 file.c return piperead(f->pipe, addr, n); n 107 file.c if((r = readi(f->ip, addr, f->off, n)) > 0) n 118 file.c filewrite(struct file *f, char *addr, int n) n 125 file.c return pipewrite(f->pipe, addr, n); n 135 file.c while(i < n){ n 136 file.c int n1 = n - i; n 153 file.c return i == n ? n : -1; n 19 forktest.c int n, pid; n 23 forktest.c for(n=0; n<N; n++){ n 31 forktest.c if(n == N){ n 36 forktest.c for(; n > 0; n--){ n 453 fs.c readi(struct inode *ip, char *dst, uint off, uint n) n 461 fs.c return devsw[ip->major].read(ip, dst, n); n 464 fs.c if(off > ip->size || off + n < off) n 466 fs.c if(off + n > ip->size) n 467 fs.c n = ip->size - off; n 469 fs.c for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ n 471 fs.c m = min(n - tot, BSIZE - off%BSIZE); n 475 fs.c return n; n 482 fs.c writei(struct inode *ip, char *src, uint off, uint n) n 490 fs.c return devsw[ip->major].write(ip, src, n); n 493 fs.c if(off > ip->size || off + n < off) n 495 fs.c if(off + n > MAXFILE*BSIZE) n 498 fs.c for(tot=0; tot<n; tot+=m, off+=m, src+=m){ n 500 fs.c m = min(n - tot, BSIZE - off%BSIZE); n 506 fs.c if(n > 0 && off > ip->size){ n 510 fs.c return n; n 13 grep.c int n, m; n 17 grep.c while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ n 18 grep.c m += n; n 35 log.c int n; n 74 log.c for (tail = 0; tail < log.lh.n; tail++) { n 91 log.c log.lh.n = lh->n; n 92 log.c for (i = 0; i < log.lh.n; i++) { n 107 log.c hb->n = log.lh.n; n 108 log.c for (i = 0; i < log.lh.n; i++) { n 120 log.c log.lh.n = 0; n 132 log.c } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ n 182 log.c for (tail = 0; tail < log.lh.n; tail++) { n 195 log.c if (log.lh.n > 0) { n 199 log.c log.lh.n = 0; n 218 log.c if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) n 224 log.c for (i = 0; i < log.lh.n; i++) { n 229 log.c if (i == log.lh.n) n 230 log.c log.lh.n++; n 42 mkfs.c void iappend(uint inum, void *p, int n); n 256 mkfs.c iappend(uint inum, void *xp, int n) n 268 mkfs.c while(n > 0){ n 287 mkfs.c n1 = min(n, (fbn + 1) * BSIZE - off); n 291 mkfs.c n -= n1; n 79 pipe.c pipewrite(struct pipe *p, char *addr, int n) n 84 pipe.c for(i = 0; i < n; i++){ n 97 pipe.c return n; n 101 pipe.c piperead(struct pipe *p, char *addr, int n) n 113 pipe.c for(i = 0; i < n; i++){ //DOC: piperead-copy n 159 proc.c growproc(int n) n 165 proc.c if(n > 0){ n 166 proc.c if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) n 168 proc.c } else if(n < 0){ n 169 proc.c if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) n 5 string.c memset(void *dst, int c, uint n) n 7 string.c if ((int)dst%4 == 0 && n%4 == 0){ n 9 string.c stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); n 11 string.c stosb(dst, c, n); n 16 string.c memcmp(const void *v1, const void *v2, uint n) n 22 string.c while(n-- > 0){ n 32 string.c memmove(void *dst, const void *src, uint n) n 39 string.c if(s < d && s + n > d){ n 40 string.c s += n; n 41 string.c d += n; n 42 string.c while(n-- > 0) n 45 string.c while(n-- > 0) n 53 string.c memcpy(void *dst, const void *src, uint n) n 55 string.c return memmove(dst, src, n); n 59 string.c strncmp(const char *p, const char *q, uint n) n 61 string.c while(n > 0 && *p && *p == *q) n 62 string.c n--, p++, q++; n 63 string.c if(n == 0) n 69 string.c strncpy(char *s, const char *t, int n) n 74 string.c while(n-- > 0 && (*s++ = *t++) != 0) n 76 string.c while(n-- > 0) n 83 string.c safestrcpy(char *s, const char *t, int n) n 88 string.c if(n <= 0) n 90 string.c while(--n > 0 && (*s++ = *t++) != 0) n 99 string.c int n; n 101 string.c for(n = 0; s[n]; n++) n 103 string.c return n; n 50 syscall.c argint(int n, int *ip) n 52 syscall.c return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); n 59 syscall.c argptr(int n, char **pp, int size) n 64 syscall.c if(argint(n, &i) < 0) n 77 syscall.c argstr(int n, char **pp) n 80 syscall.c if(argint(n, &addr) < 0) n 22 sysfile.c argfd(int n, int *pfd, struct file **pf) n 27 sysfile.c if(argint(n, &fd) < 0) n 73 sysfile.c int n; n 76 sysfile.c if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) n 78 sysfile.c return fileread(f, p, n); n 85 sysfile.c int n; n 88 sysfile.c if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) n 90 sysfile.c return filewrite(f, p, n); n 49 sysproc.c int n; n 51 sysproc.c if(argint(0, &n) < 0) n 54 sysproc.c if(growproc(n) < 0) n 62 sysproc.c int n; n 65 sysproc.c if(argint(0, &n) < 0) n 69 sysproc.c while(ticks - ticks0 < n){ n 29 ulib.c int n; n 31 ulib.c for(n = 0; s[n]; n++) n 33 ulib.c return n; n 37 ulib.c memset(void *dst, int c, uint n) n 39 ulib.c stosb(dst, c, n); n 71 ulib.c stat(const char *n, struct stat *st) n 76 ulib.c fd = open(n, O_RDONLY); n 87 ulib.c int n; n 89 ulib.c n = 0; n 91 ulib.c n = n*10 + *s++ - '0'; n 92 ulib.c return n; n 96 ulib.c memmove(void *vdst, const void *vsrc, int n) n 103 ulib.c while(n-- > 0) n 190 usertests.c int i, fd, n; n 216 usertests.c n = 0; n 220 usertests.c if(n == MAXFILE - 1){ n 221 usertests.c printf(stdout, "read only %d blocks from big", n); n 229 usertests.c if(((int*)buf)[0] != n){ n 231 usertests.c n, ((int*)buf)[0]); n 234 usertests.c n++; n 309 usertests.c int seq, i, n, cc, total; n 319 usertests.c for(n = 0; n < 5; n++){ n 332 usertests.c while((n = read(fds[0], buf, cc)) > 0){ n 333 usertests.c for(i = 0; i < n; i++){ n 339 usertests.c total += n; n 467 usertests.c int fd, pid, i, n, nc, np; n 497 usertests.c while((n = read(fd, buf, sizeof(buf))) > 0){ n 520 usertests.c int fd, pid, i, j, n, total, pi; n 545 usertests.c if((n = write(fd, buf, 500)) != 500){ n 546 usertests.c printf(1, "write failed %d\n", n); n 562 usertests.c while((n = read(fd, buf, sizeof(buf))) > 0){ n 563 usertests.c for(j = 0; j < n; j++){ n 569 usertests.c total += n; n 768 usertests.c int i, pid, n, fd; n 802 usertests.c n = 0; n 817 usertests.c n++; n 822 usertests.c if(n != 40){ n 1382 usertests.c int n, pid; n 1386 usertests.c for(n=0; n<1000; n++){ n 1394 usertests.c if(n == 1000){ n 1399 usertests.c for(; n > 0; n--){ n 200 vm.c uint i, pa, n; n 210 vm.c n = sz - i; n 212 vm.c n = PGSIZE; n 213 vm.c if(readi(ip, P2V(pa), offset+i, n) != n) n 369 vm.c uint n, va0; n 377 vm.c n = PGSIZE - (va - va0); n 378 vm.c if(n > len) n 379 vm.c n = len; n 380 vm.c memmove(pa0 + (va - va0), buf, n); n 381 vm.c len -= n; n 382 vm.c buf += n; n 10 wc.c int i, n; n 15 wc.c while((n = read(fd, buf, sizeof(buf))) > 0){ n 16 wc.c for(i=0; i<n; i++){ n 28 wc.c if(n < 0){