n 59 kernel/console.c consolewrite(int user_src, uint64 src, int n) n 63 kernel/console.c for(i = 0; i < n; i++){ n 80 kernel/console.c consoleread(int user_dst, uint64 dst, int n) n 86 kernel/console.c target = n; n 88 kernel/console.c while(n > 0){ n 102 kernel/console.c if(n < target){ n 116 kernel/console.c --n; n 126 kernel/console.c return target - n; n 33 kernel/defs.h int fileread(struct file*, uint64, int n); n 35 kernel/defs.h int filewrite(struct file*, uint64, int n); n 150 kernel/exec.c uint i, n; n 158 kernel/exec.c n = sz - i; n 160 kernel/exec.c n = PGSIZE; n 161 kernel/exec.c if(readi(ip, 0, (uint64)pa, offset+i, n) != n) n 107 kernel/file.c fileread(struct file *f, uint64 addr, int n) n 115 kernel/file.c r = piperead(f->pipe, addr, n); n 119 kernel/file.c r = devsw[f->major].read(1, addr, n); n 122 kernel/file.c if((r = readi(f->ip, 1, addr, f->off, n)) > 0) n 135 kernel/file.c filewrite(struct file *f, uint64 addr, int n) n 143 kernel/file.c ret = pipewrite(f->pipe, addr, n); n 147 kernel/file.c ret = devsw[f->major].write(1, addr, n); n 157 kernel/file.c while(i < n){ n 158 kernel/file.c int n1 = n - i; n 175 kernel/file.c ret = (i == n ? n : -1); n 14 kernel/file.h #define mkdev(m,n) ((uint)((m)<<16| (n))) n 472 kernel/fs.c readi(struct inode *ip, int user_dst, uint64 dst, uint off, uint n) n 477 kernel/fs.c if(off > ip->size || off + n < off) n 479 kernel/fs.c if(off + n > ip->size) n 480 kernel/fs.c n = ip->size - off; n 482 kernel/fs.c for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ n 487 kernel/fs.c m = min(n - tot, BSIZE - off%BSIZE); n 506 kernel/fs.c writei(struct inode *ip, int user_src, uint64 src, uint off, uint n) n 511 kernel/fs.c if(off > ip->size || off + n < off) n 513 kernel/fs.c if(off + n > MAXFILE*BSIZE) n 516 kernel/fs.c for(tot=0; tot<n; tot+=m, off+=m, src+=m){ n 521 kernel/fs.c m = min(n - tot, BSIZE - off%BSIZE); n 36 kernel/log.c int n; n 73 kernel/log.c for (tail = 0; tail < log.lh.n; tail++) { n 92 kernel/log.c log.lh.n = lh->n; n 93 kernel/log.c for (i = 0; i < log.lh.n; i++) { n 108 kernel/log.c hb->n = log.lh.n; n 109 kernel/log.c for (i = 0; i < log.lh.n; i++) { n 121 kernel/log.c log.lh.n = 0; n 133 kernel/log.c } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ n 183 kernel/log.c for (tail = 0; tail < log.lh.n; tail++) { n 196 kernel/log.c if (log.lh.n > 0) { n 200 kernel/log.c log.lh.n = 0; n 220 kernel/log.c if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) n 225 kernel/log.c for (i = 0; i < log.lh.n; i++) { n 230 kernel/log.c if (i == log.lh.n) { // Add new block to log? n 232 kernel/log.c log.lh.n++; n 77 kernel/pipe.c pipewrite(struct pipe *pi, uint64 addr, int n) n 83 kernel/pipe.c while(i < n){ n 106 kernel/pipe.c piperead(struct pipe *pi, uint64 addr, int n) n 120 kernel/pipe.c for(i = 0; i < n; i++){ //DOC: piperead-copy n 260 kernel/proc.c growproc(int n) n 266 kernel/proc.c if(n > 0){ n 267 kernel/proc.c if((sz = uvmalloc(p->pagetable, sz, sz + n, PTE_W)) == 0) { n 270 kernel/proc.c } else if(n < 0){ n 271 kernel/proc.c sz = uvmdealloc(p->pagetable, sz, sz + n); n 4 kernel/string.c memset(void *dst, int c, uint n) n 8 kernel/string.c for(i = 0; i < n; i++){ n 15 kernel/string.c memcmp(const void *v1, const void *v2, uint n) n 21 kernel/string.c while(n-- > 0){ n 31 kernel/string.c memmove(void *dst, const void *src, uint n) n 36 kernel/string.c if(n == 0) n 41 kernel/string.c if(s < d && s + n > d){ n 42 kernel/string.c s += n; n 43 kernel/string.c d += n; n 44 kernel/string.c while(n-- > 0) n 47 kernel/string.c while(n-- > 0) n 55 kernel/string.c memcpy(void *dst, const void *src, uint n) n 57 kernel/string.c return memmove(dst, src, n); n 61 kernel/string.c strncmp(const char *p, const char *q, uint n) n 63 kernel/string.c while(n > 0 && *p && *p == *q) n 64 kernel/string.c n--, p++, q++; n 65 kernel/string.c if(n == 0) n 71 kernel/string.c strncpy(char *s, const char *t, int n) n 76 kernel/string.c while(n-- > 0 && (*s++ = *t++) != 0) n 78 kernel/string.c while(n-- > 0) n 85 kernel/string.c safestrcpy(char *s, const char *t, int n) n 90 kernel/string.c if(n <= 0) n 92 kernel/string.c while(--n > 0 && (*s++ = *t++) != 0) n 101 kernel/string.c int n; n 103 kernel/string.c for(n = 0; s[n]; n++) n 105 kernel/string.c return n; n 34 kernel/syscall.c argraw(int n) n 37 kernel/syscall.c switch (n) { n 57 kernel/syscall.c argint(int n, int *ip) n 59 kernel/syscall.c *ip = argraw(n); n 66 kernel/syscall.c argaddr(int n, uint64 *ip) n 68 kernel/syscall.c *ip = argraw(n); n 75 kernel/syscall.c argstr(int n, char *buf, int max) n 78 kernel/syscall.c argaddr(n, &addr); n 22 kernel/sysfile.c argfd(int n, int *pfd, struct file **pf) n 27 kernel/sysfile.c argint(n, &fd); n 72 kernel/sysfile.c int n; n 76 kernel/sysfile.c argint(2, &n); n 79 kernel/sysfile.c return fileread(f, p, n); n 86 kernel/sysfile.c int n; n 90 kernel/sysfile.c argint(2, &n); n 94 kernel/sysfile.c return filewrite(f, p, n); n 311 kernel/sysfile.c int n; n 314 kernel/sysfile.c if((n = argstr(0, path, MAXPATH)) < 0) n 12 kernel/sysproc.c int n; n 13 kernel/sysproc.c argint(0, &n); n 14 kernel/sysproc.c exit(n); n 42 kernel/sysproc.c int n; n 44 kernel/sysproc.c argint(0, &n); n 46 kernel/sysproc.c if(growproc(n) < 0) n 54 kernel/sysproc.c int n; n 57 kernel/sysproc.c argint(0, &n); n 58 kernel/sysproc.c if(n < 0) n 59 kernel/sysproc.c n = 0; n 62 kernel/sysproc.c while(ticks - ticks0 < n){ n 361 kernel/vm.c uint64 n, va0, pa0; n 373 kernel/vm.c n = PGSIZE - (dstva - va0); n 374 kernel/vm.c if(n > len) n 375 kernel/vm.c n = len; n 376 kernel/vm.c memmove((void *)(pa0 + (dstva - va0)), src, n); n 378 kernel/vm.c len -= n; n 379 kernel/vm.c src += n; n 391 kernel/vm.c uint64 n, va0, pa0; n 398 kernel/vm.c n = PGSIZE - (srcva - va0); n 399 kernel/vm.c if(n > len) n 400 kernel/vm.c n = len; n 401 kernel/vm.c memmove(dst, (void *)(pa0 + (srcva - va0)), n); n 403 kernel/vm.c len -= n; n 404 kernel/vm.c dst += n; n 417 kernel/vm.c uint64 n, va0, pa0; n 425 kernel/vm.c n = PGSIZE - (srcva - va0); n 426 kernel/vm.c if(n > max) n 427 kernel/vm.c n = max; n 430 kernel/vm.c while(n > 0){ n 438 kernel/vm.c --n; n 42 mkfs/mkfs.c void iappend(uint inum, void *p, int n); n 255 mkfs/mkfs.c iappend(uint inum, void *xp, int n) n 267 mkfs/mkfs.c while(n > 0){ n 286 mkfs/mkfs.c n1 = min(n, (fbn + 1) * BSIZE - off); n 290 mkfs/mkfs.c n -= n1; n 10 user/cat.c int n; n 12 user/cat.c while((n = read(fd, buf, sizeof(buf))) > 0) { n 13 user/cat.c if (write(1, buf, n) != n) { n 18 user/cat.c if(n < 0){ n 19 user/forktest.c int n, pid; n 23 user/forktest.c for(n=0; n<N; n++){ n 31 user/forktest.c if(n == N){ n 36 user/forktest.c for(; n > 0; n--){ n 14 user/grep.c int n, m; n 18 user/grep.c while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ n 19 user/grep.c m += n; n 39 user/ulib.c int n; n 41 user/ulib.c for(n = 0; s[n]; n++) n 43 user/ulib.c return n; n 47 user/ulib.c memset(void *dst, int c, uint n) n 51 user/ulib.c for(i = 0; i < n; i++){ n 85 user/ulib.c stat(const char *n, struct stat *st) n 90 user/ulib.c fd = open(n, O_RDONLY); n 101 user/ulib.c int n; n 103 user/ulib.c n = 0; n 105 user/ulib.c n = n*10 + *s++ - '0'; n 106 user/ulib.c return n; n 110 user/ulib.c memmove(void *vdst, const void *vsrc, int n) n 118 user/ulib.c while(n-- > 0) n 121 user/ulib.c dst += n; n 122 user/ulib.c src += n; n 123 user/ulib.c while(n-- > 0) n 130 user/ulib.c memcmp(const void *s1, const void *s2, uint n) n 133 user/ulib.c while (n-- > 0) { n 144 user/ulib.c memcpy(void *dst, const void *src, uint n) n 146 user/ulib.c return memmove(dst, src, n); n 46 user/usertests.c int n = write(fd, (void*)addr, 8192); n 47 user/usertests.c if(n >= 0){ n 48 user/usertests.c printf("write(fd, %p, 8192) returned %d, not -1\n", (void*)addr, n); n 54 user/usertests.c n = write(1, (char*)addr, 8192); n 55 user/usertests.c if(n > 0){ n 56 user/usertests.c printf("write(1, %p, 8192) returned %d, not -1 or 0\n", (void*)addr, n); n 65 user/usertests.c n = write(fds[1], (char*)addr, 8192); n 66 user/usertests.c if(n > 0){ n 67 user/usertests.c printf("write(pipe, %p, 8192) returned %d, not -1 or 0\n", (void*)addr, n); n 91 user/usertests.c int n = read(fd, (void*)addr, 8192); n 92 user/usertests.c if(n > 0){ n 93 user/usertests.c printf("read(fd, %p, 8192) returned %d, not -1 or 0\n", (void*)addr, n); n 103 user/usertests.c n = write(fds[1], "x", 1); n 104 user/usertests.c if(n != 1){ n 108 user/usertests.c n = read(fds[0], (void*)addr, 8192); n 109 user/usertests.c if(n > 0){ n 110 user/usertests.c printf("read(pipe, %p, 8192) returned %d, not -1 or 0\n", (void*)addr, n); n 249 user/usertests.c int fd, n; n 268 user/usertests.c n = write(fd, (void*)(a+4096), 1024); n 269 user/usertests.c if(n >= 0){ n 270 user/usertests.c printf("write(fd, %p, 1024) returned %d, not -1\n", (void*)a+4096, n); n 281 user/usertests.c n = read(fd, (void*)(a+4096), 10); n 282 user/usertests.c if(n >= 0){ n 283 user/usertests.c printf("read(fd, %p, 10) returned %d, not -1\n", (void*)a+4096, n); n 303 user/usertests.c int n = read(fd2, buf, sizeof(buf)); n 304 user/usertests.c if(n != 4){ n 305 user/usertests.c printf("%s: read %d bytes, wanted 4\n", s, n); n 312 user/usertests.c n = read(fd3, buf, sizeof(buf)); n 313 user/usertests.c if(n != 0){ n 315 user/usertests.c printf("%s: read %d bytes, wanted 0\n", s, n); n 319 user/usertests.c n = read(fd2, buf, sizeof(buf)); n 320 user/usertests.c if(n != 0){ n 322 user/usertests.c printf("%s: read %d bytes, wanted 0\n", s, n); n 328 user/usertests.c n = read(fd3, buf, sizeof(buf)); n 329 user/usertests.c if(n != 6){ n 330 user/usertests.c printf("%s: read %d bytes, wanted 6\n", s, n); n 334 user/usertests.c n = read(fd2, buf, sizeof(buf)); n 335 user/usertests.c if(n != 2){ n 336 user/usertests.c printf("%s: read %d bytes, wanted 2\n", s, n); n 361 user/usertests.c int n = write(fd1, "x", 1); n 362 user/usertests.c if(n != -1){ n 363 user/usertests.c printf("%s: write returned %d, expected -1\n", s, n); n 393 user/usertests.c int n = write(fd, "1234567890", 10); n 394 user/usertests.c if(n != 10){ n 395 user/usertests.c printf("%s: write got %d, expected 10\n", s, n); n 412 user/usertests.c int n = write(fd, "xxx", 3); n 413 user/usertests.c if(n != 3){ n 414 user/usertests.c printf("%s: write got %d, expected 3\n", s, n); n 584 user/usertests.c int i, fd, n; n 608 user/usertests.c n = 0; n 612 user/usertests.c if(n != MAXFILE){ n 613 user/usertests.c printf("%s: read only %d blocks from big", s, n); n 621 user/usertests.c if(((int*)buf)[0] != n){ n 623 user/usertests.c n, ((int*)buf)[0]); n 626 user/usertests.c n++; n 742 user/usertests.c int seq, i, n, cc, total; n 753 user/usertests.c for(n = 0; n < N; n++){ n 766 user/usertests.c while((n = read(fds[0], buf, cc)) > 0){ n 767 user/usertests.c for(i = 0; i < n; i++){ n 773 user/usertests.c total += n; n 1099 user/usertests.c int fd, pid, i, n, nc, np; n 1133 user/usertests.c while((n = read(fd, buf, sizeof(buf))) > 0){ n 1156 user/usertests.c int fd, pid, i, j, n, total, pi; n 1180 user/usertests.c if((n = write(fd, buf, SZ)) != SZ){ n 1181 user/usertests.c printf("write failed %d\n", n); n 1200 user/usertests.c while((n = read(fd, buf, sizeof(buf))) > 0){ n 1201 user/usertests.c for(j = 0; j < n; j++){ n 1207 user/usertests.c total += n; n 1400 user/usertests.c int i, pid, n, fd; n 1437 user/usertests.c n = 0; n 1452 user/usertests.c n++; n 1457 user/usertests.c if(n != N){ n 1966 user/usertests.c int n, pid; n 1968 user/usertests.c for(n=0; n<N; n++){ n 1976 user/usertests.c if (n == 0) { n 1981 user/usertests.c if(n == N){ n 1986 user/usertests.c for(; n > 0; n--){ n 2226 user/usertests.c int n = 0; n 2228 user/usertests.c n += *(a+i); n 2232 user/usertests.c printf("%s: allocate a lot of memory succeeded %d\n", s, n); n 2246 user/usertests.c int fd, n; n 2255 user/usertests.c if ((n = write(fd, a, PGSIZE)) < 0) { n 3045 user/usertests.c int n = 0; n 3055 user/usertests.c n += 1; n 3061 user/usertests.c return n; n 11 user/wc.c int i, n; n 16 user/wc.c while((n = read(fd, buf, sizeof(buf))) > 0){ n 17 user/wc.c for(i=0; i<n; i++){ n 29 user/wc.c if(n < 0){