fd 8 cat.c cat(int fd)
fd 12 cat.c while((n = read(fd, buf, sizeof(buf))) > 0)
fd 23 cat.c int fd, i;
fd 31 cat.c if((fd = open(argv[i], 0)) < 0){
fd 35 cat.c cat(fd);
fd 36 cat.c close(fd);
fd 11 forktest.c printf(int fd, char *s, ...)
fd 13 forktest.c write(fd, s, strlen(s));
fd 11 grep.c grep(char *pattern, int fd)
fd 17 grep.c while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
fd 41 grep.c int fd, i;
fd 56 grep.c if((fd = open(argv[i], 0)) < 0){
fd 60 grep.c grep(pattern, fd);
fd 61 grep.c close(fd);
fd 29 ls.c int fd;
fd 33 ls.c if((fd = open(path, 0)) < 0){
fd 38 ls.c if(fstat(fd, &st) < 0){
fd 40 ls.c close(fd);
fd 57 ls.c while(read(fd, &de, sizeof(de)) == sizeof(de)){
fd 70 ls.c close(fd);
fd 70 mkfs.c int i, cc, fd;
fd 133 mkfs.c if((fd = open(argv[i], 0)) < 0){
fd 152 mkfs.c while((cc = read(fd, buf, sizeof(buf))) > 0)
fd 155 mkfs.c close(fd);
fd 6 printf.c putc(int fd, char c)
fd 8 printf.c write(fd, &c, 1);
fd 12 printf.c printint(int fd, int xx, int base, int sgn)
fd 35 printf.c putc(fd, buf[i]);
fd 40 printf.c printf(int fd, char *fmt, ...)
fd 54 printf.c putc(fd, c);
fd 58 printf.c printint(fd, *ap, 10, 1);
fd 61 printf.c printint(fd, *ap, 16, 0);
fd 69 printf.c putc(fd, *s);
fd 73 printf.c putc(fd, *ap);
fd 76 printf.c putc(fd, c);
fd 79 printf.c putc(fd, '%');
fd 80 printf.c putc(fd, c);
fd 176 proc.c int fd;
fd 182 proc.c for(fd = 0; fd < NOFILE; fd++){
fd 183 proc.c if(proc->ofile[fd]){
fd 184 proc.c fileclose(proc->ofile[fd]);
fd 185 proc.c proc->ofile[fd] = 0;
fd 32 sh.c int fd;
fd 84 sh.c close(rcmd->fd);
fd 148 sh.c int fd;
fd 151 sh.c while((fd = open("console", O_RDWR)) >= 0){
fd 152 sh.c if(fd >= 3){
fd 153 sh.c close(fd);
fd 208 sh.c redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd)
fd 219 sh.c cmd->fd = fd;
fd 19 stressfs.c int fd, i;
fd 33 stressfs.c fd = open(path, O_CREATE | O_RDWR);
fd 36 stressfs.c write(fd, data, sizeof(data));
fd 37 stressfs.c close(fd);
fd 41 stressfs.c fd = open(path, O_RDONLY);
fd 43 stressfs.c read(fd, data, sizeof(data));
fd 44 stressfs.c close(fd);
fd 22 sysfile.c int fd;
fd 25 sysfile.c if(argint(n, &fd) < 0)
fd 27 sysfile.c if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
fd 30 sysfile.c *pfd = fd;
fd 41 sysfile.c int fd;
fd 43 sysfile.c for(fd = 0; fd < NOFILE; fd++){
fd 44 sysfile.c if(proc->ofile[fd] == 0){
fd 45 sysfile.c proc->ofile[fd] = f;
fd 46 sysfile.c return fd;
fd 56 sysfile.c int fd;
fd 60 sysfile.c if((fd=fdalloc(f)) < 0)
fd 63 sysfile.c return fd;
fd 93 sysfile.c int fd;
fd 96 sysfile.c if(argfd(0, &fd, &f) < 0)
fd 98 sysfile.c proc->ofile[fd] = 0;
fd 287 sysfile.c int fd, omode;
fd 315 sysfile.c if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
fd 330 sysfile.c return fd;
fd 423 sysfile.c int *fd;
fd 427 sysfile.c if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
fd 439 sysfile.c fd[0] = fd0;
fd 440 sysfile.c fd[1] = fd1;
fd 73 ulib.c int fd;
fd 76 ulib.c fd = open(n, O_RDONLY);
fd 77 ulib.c if(fd < 0)
fd 79 ulib.c r = fstat(fd, st);
fd 80 ulib.c close(fd);
fd 17 user.h int fstat(int fd, struct stat*);
fd 100 usertests.c int fd = open("oidir", O_RDWR);
fd 101 usertests.c if(fd >= 0){
fd 121 usertests.c int fd;
fd 124 usertests.c fd = open("echo", 0);
fd 125 usertests.c if(fd < 0){
fd 129 usertests.c close(fd);
fd 130 usertests.c fd = open("doesnotexist", 0);
fd 131 usertests.c if(fd >= 0){
fd 141 usertests.c int fd;
fd 145 usertests.c fd = open("small", O_CREATE|O_RDWR);
fd 146 usertests.c if(fd >= 0){
fd 153 usertests.c if(write(fd, "aaaaaaaaaa", 10) != 10){
fd 157 usertests.c if(write(fd, "bbbbbbbbbb", 10) != 10){
fd 163 usertests.c close(fd);
fd 164 usertests.c fd = open("small", O_RDONLY);
fd 165 usertests.c if(fd >= 0){
fd 171 usertests.c i = read(fd, buf, 2000);
fd 178 usertests.c close(fd);
fd 190 usertests.c int i, fd, n;
fd 194 usertests.c fd = open("big", O_CREATE|O_RDWR);
fd 195 usertests.c if(fd < 0){
fd 202 usertests.c if(write(fd, buf, 512) != 512){
fd 208 usertests.c close(fd);
fd 210 usertests.c fd = open("big", O_RDONLY);
fd 211 usertests.c if(fd < 0){
fd 218 usertests.c i = read(fd, buf, 512);
fd 236 usertests.c close(fd);
fd 247 usertests.c int i, fd;
fd 255 usertests.c fd = open(name, O_CREATE|O_RDWR);
fd 256 usertests.c close(fd);
fd 467 usertests.c int fd, pid, i, n, nc, np;
fd 473 usertests.c fd = open("sharedfd", O_CREATE|O_RDWR);
fd 474 usertests.c if(fd < 0){
fd 481 usertests.c if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
fd 490 usertests.c close(fd);
fd 491 usertests.c fd = open("sharedfd", 0);
fd 492 usertests.c if(fd < 0){
fd 497 usertests.c while((n = read(fd, buf, sizeof(buf))) > 0){
fd 505 usertests.c close(fd);
fd 520 usertests.c int fd, pid, i, j, n, total, pi;
fd 537 usertests.c fd = open(fname, O_CREATE | O_RDWR);
fd 538 usertests.c if(fd < 0){
fd 545 usertests.c if((n = write(fd, buf, 500)) != 500){
fd 560 usertests.c fd = open(fname, 0);
fd 562 usertests.c while((n = read(fd, buf, sizeof(buf))) > 0){
fd 571 usertests.c close(fd);
fd 587 usertests.c int pid, i, fd, pi;
fd 604 usertests.c fd = open(name, O_CREATE | O_RDWR);
fd 605 usertests.c if(fd < 0){
fd 609 usertests.c close(fd);
fd 631 usertests.c fd = open(name, 0);
fd 632 usertests.c if((i == 0 || i >= N/2) && fd < 0){
fd 635 usertests.c } else if((i >= 1 && i < N/2) && fd >= 0){
fd 639 usertests.c if(fd >= 0)
fd 640 usertests.c close(fd);
fd 659 usertests.c int fd, fd1;
fd 662 usertests.c fd = open("unlinkread", O_CREATE | O_RDWR);
fd 663 usertests.c if(fd < 0){
fd 667 usertests.c write(fd, "hello", 5);
fd 668 usertests.c close(fd);
fd 670 usertests.c fd = open("unlinkread", O_RDWR);
fd 671 usertests.c if(fd < 0){
fd 684 usertests.c if(read(fd, buf, sizeof(buf)) != 5){
fd 692 usertests.c if(write(fd, buf, 10) != 10){
fd 696 usertests.c close(fd);
fd 704 usertests.c int fd;
fd 711 usertests.c fd = open("lf1", O_CREATE|O_RDWR);
fd 712 usertests.c if(fd < 0){
fd 716 usertests.c if(write(fd, "hello", 5) != 5){
fd 720 usertests.c close(fd);
fd 733 usertests.c fd = open("lf2", 0);
fd 734 usertests.c if(fd < 0){
fd 738 usertests.c if(read(fd, buf, sizeof(buf)) != 5){
fd 742 usertests.c close(fd);
fd 768 usertests.c int i, pid, n, fd;
fd 787 usertests.c fd = open(file, O_CREATE | O_RDWR);
fd 788 usertests.c if(fd < 0){
fd 792 usertests.c close(fd);
fd 801 usertests.c fd = open(".", 0);
fd 803 usertests.c while(read(fd, &de, sizeof(de)) > 0){
fd 820 usertests.c close(fd);
fd 895 usertests.c int i, fd;
fd 901 usertests.c fd = open("bd", O_CREATE);
fd 902 usertests.c if(fd < 0){
fd 906 usertests.c close(fd);
fd 937 usertests.c int fd, cc;
fd 947 usertests.c fd = open("dd/ff", O_CREATE | O_RDWR);
fd 948 usertests.c if(fd < 0){
fd 952 usertests.c write(fd, "ff", 2);
fd 953 usertests.c close(fd);
fd 965 usertests.c fd = open("dd/dd/ff", O_CREATE | O_RDWR);
fd 966 usertests.c if(fd < 0){
fd 970 usertests.c write(fd, "FF", 2);
fd 971 usertests.c close(fd);
fd 973 usertests.c fd = open("dd/dd/../ff", 0);
fd 974 usertests.c if(fd < 0){
fd 978 usertests.c cc = read(fd, buf, sizeof(buf));
fd 983 usertests.c close(fd);
fd 1016 usertests.c fd = open("dd/dd/ffff", 0);
fd 1017 usertests.c if(fd < 0){
fd 1021 usertests.c if(read(fd, buf, sizeof(buf)) != 2){
fd 1025 usertests.c close(fd);
fd 1121 usertests.c int fd, sz;
fd 1127 usertests.c fd = open("bigwrite", O_CREATE | O_RDWR);
fd 1128 usertests.c if(fd < 0){
fd 1134 usertests.c int cc = write(fd, buf, sz);
fd 1140 usertests.c close(fd);
fd 1150 usertests.c int fd, i, total, cc;
fd 1155 usertests.c fd = open("bigfile", O_CREATE | O_RDWR);
fd 1156 usertests.c if(fd < 0){
fd 1162 usertests.c if(write(fd, buf, 600) != 600){
fd 1167 usertests.c close(fd);
fd 1169 usertests.c fd = open("bigfile", 0);
fd 1170 usertests.c if(fd < 0){
fd 1176 usertests.c cc = read(fd, buf, 300);
fd 1193 usertests.c close(fd);
fd 1206 usertests.c int fd;
fd 1219 usertests.c fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
fd 1220 usertests.c if(fd < 0){
fd 1224 usertests.c close(fd);
fd 1225 usertests.c fd = open("12345678901234/12345678901234/12345678901234", 0);
fd 1226 usertests.c if(fd < 0){
fd 1230 usertests.c close(fd);
fd 1286 usertests.c int fd;
fd 1290 usertests.c fd = open("dirfile", O_CREATE);
fd 1291 usertests.c if(fd < 0){
fd 1295 usertests.c close(fd);
fd 1300 usertests.c fd = open("dirfile/xx", 0);
fd 1301 usertests.c if(fd >= 0){
fd 1305 usertests.c fd = open("dirfile/xx", O_CREATE);
fd 1306 usertests.c if(fd >= 0){
fd 1327 usertests.c fd = open(".", O_RDWR);
fd 1328 usertests.c if(fd >= 0){
fd 1332 usertests.c fd = open(".", 0);
fd 1333 usertests.c if(write(fd, "x", 1) > 0){
fd 1337 usertests.c close(fd);
fd 1346 usertests.c int i, fd;
fd 1363 usertests.c fd = open("", O_CREATE);
fd 1364 usertests.c if(fd >= 0)
fd 1365 usertests.c close(fd);
fd 1366 usertests.c fd = open("xx", O_CREATE);
fd 1367 usertests.c if(fd >= 0)
fd 1368 usertests.c close(fd);
fd 1615 usertests.c int pid, fd;
fd 1628 usertests.c fd = open("bigarg-ok", O_CREATE);
fd 1629 usertests.c close(fd);
fd 1636 usertests.c fd = open("bigarg-ok", 0);
fd 1637 usertests.c if(fd < 0){
fd 1641 usertests.c close(fd);
fd 1664 usertests.c int fd = open(name, O_CREATE|O_RDWR);
fd 1665 usertests.c if(fd < 0){
fd 1671 usertests.c int cc = write(fd, buf, 512);
fd 1678 usertests.c close(fd);
fd 8 wc.c wc(int fd, char *name)
fd 15 wc.c while((n = read(fd, buf, sizeof(buf))) > 0){
fd 38 wc.c int fd, i;
fd 46 wc.c if((fd = open(argv[i], 0)) < 0){
fd 50 wc.c wc(fd, argv[i]);
fd 51 wc.c close(fd);