n 63 kernel/console.c consolewrite(int user_src, uint64 src, int n) n 68 kernel/console.c while (i < n) { n 70 kernel/console.c if (nn > n - i) n 71 kernel/console.c nn = n - i; n 88 kernel/console.c consoleread(int user_dst, uint64 dst, int n) n 94 kernel/console.c target = n; n 96 kernel/console.c while (n > 0) { n 113 kernel/console.c if (n < target) { n 127 kernel/console.c --n; n 137 kernel/console.c return target - n; n 34 kernel/defs.h int fileread(struct file*, uint64, int n); n 36 kernel/defs.h int filewrite(struct file*, uint64, int n); n 160 kernel/exec.c uint i, n; n 168 kernel/exec.c n = sz - i; n 170 kernel/exec.c n = PGSIZE; n 171 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 111 kernel/file.c if (f->readable == 0 || n < 0) 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 139 kernel/file.c if (f->writable == 0 || n < 0) 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 155 kernel/file.c while (i < n) { n 156 kernel/file.c int n1 = n - i; n 173 kernel/file.c ret = (i == n ? n : -1); n 14 kernel/file.h #define mkdev(m, n) ((uint)((m) << 16 | (n))) n 510 kernel/fs.c readi(struct inode *ip, int user_dst, uint64 dst, uint off, uint n) n 515 kernel/fs.c if (off > ip->size || off + n < off) n 517 kernel/fs.c if (off + n > ip->size) n 518 kernel/fs.c n = ip->size - off; n 520 kernel/fs.c for (tot = 0; tot < n; tot += m, off += m, dst += m) { n 525 kernel/fs.c m = min(n - tot, BSIZE - off % BSIZE); n 544 kernel/fs.c writei(struct inode *ip, int user_src, uint64 src, uint off, uint n) n 549 kernel/fs.c if (off > ip->size || off + n < off) n 551 kernel/fs.c if (off + n > MAXFILE * BSIZE) n 554 kernel/fs.c for (tot = 0; tot < n; tot += m, off += m, src += m) { n 559 kernel/fs.c m = min(n - tot, BSIZE - off % BSIZE); n 36 kernel/log.c int n; n 72 kernel/log.c for (tail = 0; tail < log.lh.n; tail++) { n 94 kernel/log.c log.lh.n = lh->n; n 95 kernel/log.c for (i = 0; i < log.lh.n; i++) { n 110 kernel/log.c hb->n = log.lh.n; n 111 kernel/log.c for (i = 0; i < log.lh.n; i++) { n 123 kernel/log.c log.lh.n = 0; n 138 kernel/log.c } else if (log.lh.n + (log.outstanding + 1) * MAXOPBLOCKS > LOGBLOCKS) { n 192 kernel/log.c for (tail = 0; tail < log.lh.n; tail++) { n 205 kernel/log.c if (log.lh.n > 0) { n 209 kernel/log.c log.lh.n = 0; n 229 kernel/log.c if (log.lh.n >= LOGBLOCKS) n 234 kernel/log.c for (i = 0; i < log.lh.n; i++) { n 239 kernel/log.c if (i == log.lh.n) { // Add new block to log? n 241 kernel/log.c log.lh.n++; n 251 kernel/log.c int n = log.ncommit + 1; n 252 kernel/log.c while (log.ncommit < n) { n 77 kernel/pipe.c pipewrite(struct pipe *pi, uint64 addr, int n) n 83 kernel/pipe.c while (i < n) { n 112 kernel/pipe.c piperead(struct pipe *pi, uint64 addr, int n) n 129 kernel/pipe.c for (i = 0; i < n; i++) { //DOC: piperead-copy n 236 kernel/proc.c growproc(int n) n 242 kernel/proc.c if (n > 0) { n 243 kernel/proc.c if (sz + n > TRAPFRAME) { n 246 kernel/proc.c if ((sz = uvmalloc(p->pagetable, sz, sz + n, PTE_W)) == 0) { n 249 kernel/proc.c } else if (n < 0) { n 250 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 35 kernel/syscall.c argraw(int n) n 38 kernel/syscall.c switch (n) { n 58 kernel/syscall.c argint(int n, int *ip) n 60 kernel/syscall.c *ip = argraw(n); n 67 kernel/syscall.c argaddr(int n, uint64 *ip) n 69 kernel/syscall.c *ip = argraw(n); n 76 kernel/syscall.c argstr(int n, char *buf, int max) n 79 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 335 kernel/sysfile.c int n; n 338 kernel/sysfile.c if ((n = argstr(0, path, MAXPATH)) < 0) n 13 kernel/sysproc.c int n; n 14 kernel/sysproc.c argint(0, &n); n 15 kernel/sysproc.c kexit(n); n 44 kernel/sysproc.c int n; n 46 kernel/sysproc.c argint(0, &n); n 50 kernel/sysproc.c if (t == SBRK_EAGER || n < 0) { n 51 kernel/sysproc.c if (growproc(n) < 0) { n 58 kernel/sysproc.c if (addr + n < addr) n 60 kernel/sysproc.c if (addr + n > TRAPFRAME) n 62 kernel/sysproc.c myproc()->sz += n; n 70 kernel/sysproc.c int n; n 73 kernel/sysproc.c argint(0, &n); n 74 kernel/sysproc.c if (n < 0) n 75 kernel/sysproc.c n = 0; n 78 kernel/sysproc.c while (ticks - ticks0 < n) { n 80 kernel/uart.c uartwrite(char buf[], int n) n 85 kernel/uart.c while (i < n) { n 347 kernel/vm.c uint64 n, va0, pa0; n 367 kernel/vm.c n = PGSIZE - (dstva - va0); n 368 kernel/vm.c if (n > len) n 369 kernel/vm.c n = len; n 370 kernel/vm.c memmove((void *)(pa0 + (dstva - va0)), src, n); n 372 kernel/vm.c len -= n; n 373 kernel/vm.c src += n; n 385 kernel/vm.c uint64 n, va0, pa0; n 395 kernel/vm.c n = PGSIZE - (srcva - va0); n 396 kernel/vm.c if (n > len) n 397 kernel/vm.c n = len; n 398 kernel/vm.c memmove(dst, (void *)(pa0 + (srcva - va0)), n); n 400 kernel/vm.c len -= n; n 401 kernel/vm.c dst += n; n 415 kernel/vm.c uint64 n, va0, pa0; n 426 kernel/vm.c n = PGSIZE - (srcva - va0); n 427 kernel/vm.c if (n > max) n 428 kernel/vm.c n = max; n 431 kernel/vm.c while (n > 0) { n 439 kernel/vm.c --n; n 46 mkfs/mkfs.c void iappend(uint inum, void *p, int n); n 259 mkfs/mkfs.c iappend(uint inum, void *xp, int n) n 271 mkfs/mkfs.c while (n > 0) { n 290 mkfs/mkfs.c n1 = min(n, (fbn + 1) * BSIZE - off); n 294 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 16 user/logstress.c int fd, n; n 33 user/logstress.c if ((n = write(fd, buf, SZ)) != SZ) { n 34 user/logstress.c printf("write failed %d\n", n); n 42 user/ulib.c int n; n 44 user/ulib.c for (n = 0; s[n]; n++) n 46 user/ulib.c return n; n 50 user/ulib.c memset(void *dst, int c, uint n) n 54 user/ulib.c for (i = 0; i < n; i++) { n 88 user/ulib.c stat(const char *n, struct stat *st) n 93 user/ulib.c fd = open(n, O_RDONLY); n 104 user/ulib.c int n; n 106 user/ulib.c n = 0; n 108 user/ulib.c n = n * 10 + *s++ - '0'; n 109 user/ulib.c return n; n 113 user/ulib.c memmove(void *vdst, const void *vsrc, int n) n 121 user/ulib.c while (n-- > 0) n 124 user/ulib.c dst += n; n 125 user/ulib.c src += n; n 126 user/ulib.c while (n-- > 0) n 133 user/ulib.c memcmp(const void *s1, const void *s2, uint n) n 136 user/ulib.c while (n-- > 0) { n 147 user/ulib.c memcpy(void *dst, const void *src, uint n) n 149 user/ulib.c return memmove(dst, src, n); n 153 user/ulib.c sbrk(int n) n 155 user/ulib.c return sys_sbrk(n, SBRK_EAGER); n 159 user/ulib.c sbrklazy(int n) n 161 user/ulib.c return sys_sbrk(n, SBRK_LAZY); 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 68 user/usertests.c n); n 92 user/usertests.c int n = read(fd, (void *)addr, 8192); n 93 user/usertests.c if (n > 0) { n 94 user/usertests.c printf("read(fd, %p, 8192) returned %d, not -1 or 0\n", (void *)addr, n); n 104 user/usertests.c n = write(fds[1], "x", 1); n 105 user/usertests.c if (n != 1) { n 109 user/usertests.c n = read(fds[0], (void *)addr, 8192); n 110 user/usertests.c if (n > 0) { n 112 user/usertests.c n); n 251 user/usertests.c int fd, n; n 270 user/usertests.c n = write(fd, (void *)(a + PGSIZE), 1024); n 271 user/usertests.c if (n >= 0) { n 272 user/usertests.c printf("write(fd, %p, 1024) returned %d, not -1\n", (void *)a + PGSIZE, n); n 283 user/usertests.c n = read(fd, (void *)(a + PGSIZE), 10); n 284 user/usertests.c if (n >= 0) { n 285 user/usertests.c printf("read(fd, %p, 10) returned %d, not -1\n", (void *)a + PGSIZE, n); n 305 user/usertests.c int n = read(fd2, buf, sizeof(buf)); n 306 user/usertests.c if (n != 4) { n 307 user/usertests.c printf("%s: read %d bytes, wanted 4\n", s, n); n 314 user/usertests.c n = read(fd3, buf, sizeof(buf)); n 315 user/usertests.c if (n != 0) { n 317 user/usertests.c printf("%s: read %d bytes, wanted 0\n", s, n); n 321 user/usertests.c n = read(fd2, buf, sizeof(buf)); n 322 user/usertests.c if (n != 0) { n 324 user/usertests.c printf("%s: read %d bytes, wanted 0\n", s, n); n 330 user/usertests.c n = read(fd3, buf, sizeof(buf)); n 331 user/usertests.c if (n != 6) { n 332 user/usertests.c printf("%s: read %d bytes, wanted 6\n", s, n); n 336 user/usertests.c n = read(fd2, buf, sizeof(buf)); n 337 user/usertests.c if (n != 2) { n 338 user/usertests.c printf("%s: read %d bytes, wanted 2\n", s, n); n 363 user/usertests.c int n = write(fd1, "x", 1); n 364 user/usertests.c if (n != -1) { n 365 user/usertests.c printf("%s: write returned %d, expected -1\n", s, n); n 395 user/usertests.c int n = write(fd, "1234567890", 10); n 396 user/usertests.c if (n != 10) { n 397 user/usertests.c printf("%s: write got %d, expected 10\n", s, n); n 414 user/usertests.c int n = write(fd, "xxx", 3); n 415 user/usertests.c if (n != 3) { n 416 user/usertests.c printf("%s: write got %d, expected 3\n", s, n); n 585 user/usertests.c int i, fd, n; n 609 user/usertests.c n = 0; n 613 user/usertests.c if (n != MAXFILE) { n 614 user/usertests.c printf("%s: read only %d blocks from big", s, n); n 622 user/usertests.c if (((int *)buf)[0] != n) { n 623 user/usertests.c printf("%s: read content of block %d is %d\n", s, n, ((int *)buf)[0]); n 626 user/usertests.c n++; n 749 user/usertests.c int seq, i, n, cc, total; n 760 user/usertests.c for (n = 0; n < N; n++) { n 773 user/usertests.c while ((n = read(fds[0], buf, cc)) > 0) { n 774 user/usertests.c for (i = 0; i < n; i++) { n 780 user/usertests.c total += n; n 1132 user/usertests.c int fd, pid, i, n, nc, np; n 1166 user/usertests.c while ((n = read(fd, buf, sizeof(buf))) > 0) { n 1189 user/usertests.c int fd, pid, i, j, n, total, pi; n 1213 user/usertests.c if ((n = write(fd, buf, SZ)) != SZ) { n 1214 user/usertests.c printf("write failed %d\n", n); n 1233 user/usertests.c while ((n = read(fd, buf, sizeof(buf))) > 0) { n 1234 user/usertests.c for (j = 0; j < n; j++) { n 1240 user/usertests.c total += n; n 1433 user/usertests.c int i, pid, n, fd; n 1470 user/usertests.c n = 0; n 1485 user/usertests.c n++; n 1490 user/usertests.c if (n != N) { n 1997 user/usertests.c int n, pid; n 1999 user/usertests.c for (n = 0; n < N; n++) { n 2007 user/usertests.c if (n == 0) { n 2012 user/usertests.c if (n == N) { n 2017 user/usertests.c for (; n > 0; n--) { n 2278 user/usertests.c int fd, n; n 2287 user/usertests.c if ((n = write(fd, a, PGSIZE)) < 0) { n 2793 user/usertests.c int n = TRAPFRAME - PGSIZE - (uint64)p; n 2795 user/usertests.c char *p1 = sbrklazy(n); n 2797 user/usertests.c printf("sbrklazy(%d) returned %p, not expected %p\n", n, p1, p); n 3458 user/usertests.c int n = 0; n 3465 user/usertests.c n += 1; n 3468 user/usertests.c return n; n 3479 user/usertests.c int n; n 3480 user/usertests.c n = runtests(quicktests, justone, continuous); n 3481 user/usertests.c if (n < 0) { n 3486 user/usertests.c ntests += n; n 3491 user/usertests.c n = runtests(slowtests, justone, continuous); n 3492 user/usertests.c if (n < 0) { n 3497 user/usertests.c ntests += 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) {