fd                355 kernel/proc.c    for(int fd = 0; fd < NOFILE; fd++){
fd                356 kernel/proc.c      if(p->ofile[fd]){
fd                357 kernel/proc.c        struct file *f = p->ofile[fd];
fd                359 kernel/proc.c        p->ofile[fd] = 0;
fd                 24 kernel/sysfile.c   int fd;
fd                 27 kernel/sysfile.c   argint(n, &fd);
fd                 28 kernel/sysfile.c   if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0)
fd                 31 kernel/sysfile.c     *pfd = fd;
fd                 42 kernel/sysfile.c   int fd;
fd                 45 kernel/sysfile.c   for(fd = 0; fd < NOFILE; fd++){
fd                 46 kernel/sysfile.c     if(p->ofile[fd] == 0){
fd                 47 kernel/sysfile.c       p->ofile[fd] = f;
fd                 48 kernel/sysfile.c       return fd;
fd                 58 kernel/sysfile.c   int fd;
fd                 62 kernel/sysfile.c   if((fd=fdalloc(f)) < 0)
fd                 65 kernel/sysfile.c   return fd;
fd                100 kernel/sysfile.c   int fd;
fd                103 kernel/sysfile.c   if(argfd(0, &fd, &f) < 0)
fd                105 kernel/sysfile.c   myproc()->ofile[fd] = 0;
fd                308 kernel/sysfile.c   int fd, omode;
fd                344 kernel/sysfile.c   if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
fd                370 kernel/sysfile.c   return fd;
fd                 71 mkfs/mkfs.c      int i, cc, fd;
fd                140 mkfs/mkfs.c        if((fd = open(argv[i], 0)) < 0)
fd                159 mkfs/mkfs.c        while((cc = read(fd, buf, sizeof(buf))) > 0)
fd                162 mkfs/mkfs.c        close(fd);
fd                  8 user/cat.c     cat(int fd)
fd                 12 user/cat.c       while((n = read(fd, buf, sizeof(buf))) > 0) {
fd                 27 user/cat.c       int fd, i;
fd                 35 user/cat.c         if((fd = open(argv[i], O_RDONLY)) < 0){
fd                 39 user/cat.c         cat(fd);
fd                 40 user/cat.c         close(fd);
fd                 12 user/grep.c    grep(char *pattern, int fd)
fd                 18 user/grep.c      while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
fd                 40 user/grep.c      int fd, i;
fd                 55 user/grep.c        if((fd = open(argv[i], O_RDONLY)) < 0){
fd                 59 user/grep.c        grep(pattern, fd);
fd                 60 user/grep.c        close(fd);
fd                 53 user/grind.c     int fd = -1;
fd                 84 user/grind.c         close(fd);
fd                 85 user/grind.c         fd = open("/grindir/../a", O_CREATE|O_RDWR);
fd                 87 user/grind.c         close(fd);
fd                 88 user/grind.c         fd = open("/./grindir/./../b", O_CREATE|O_RDWR);
fd                 90 user/grind.c         write(fd, buf, sizeof(buf));
fd                 92 user/grind.c         read(fd, buf, sizeof(buf));
fd                187 user/grind.c           fd = open("x", O_CREATE|O_RDWR);
fd                 30 user/ls.c        int fd;
fd                 34 user/ls.c        if((fd = open(path, O_RDONLY)) < 0){
fd                 39 user/ls.c        if(fstat(fd, &st) < 0){
fd                 41 user/ls.c          close(fd);
fd                 59 user/ls.c          while(read(fd, &de, sizeof(de)) == sizeof(de)){
fd                 72 user/ls.c        close(fd);
fd                 10 user/printf.c  putc(int fd, char c)
fd                 12 user/printf.c    write(fd, &c, 1);
fd                 16 user/printf.c  printint(int fd, int xx, int base, int sgn)
fd                 38 user/printf.c      putc(fd, buf[i]);
fd                 42 user/printf.c  printptr(int fd, uint64 x) {
fd                 44 user/printf.c    putc(fd, '0');
fd                 45 user/printf.c    putc(fd, 'x');
fd                 47 user/printf.c      putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
fd                 52 user/printf.c  vprintf(int fd, const char *fmt, va_list ap)
fd                 64 user/printf.c          putc(fd, c0);
fd                 71 user/printf.c          printint(fd, va_arg(ap, int), 10, 1);
fd                 73 user/printf.c          printint(fd, va_arg(ap, uint64), 10, 1);
fd                 76 user/printf.c          printint(fd, va_arg(ap, uint64), 10, 1);
fd                 79 user/printf.c          printint(fd, va_arg(ap, int), 10, 0);
fd                 81 user/printf.c          printint(fd, va_arg(ap, uint64), 10, 0);
fd                 84 user/printf.c          printint(fd, va_arg(ap, uint64), 10, 0);
fd                 87 user/printf.c          printint(fd, va_arg(ap, int), 16, 0);
fd                 89 user/printf.c          printint(fd, va_arg(ap, uint64), 16, 0);
fd                 92 user/printf.c          printint(fd, va_arg(ap, uint64), 16, 0);
fd                 95 user/printf.c          printptr(fd, va_arg(ap, uint64));
fd                100 user/printf.c            putc(fd, *s);
fd                102 user/printf.c          putc(fd, '%');
fd                105 user/printf.c          putc(fd, '%');
fd                106 user/printf.c          putc(fd, c0);
fd                111 user/printf.c          printint(fd, va_arg(ap, int), 10, 1);
fd                113 user/printf.c          printint(fd, va_arg(ap, uint64), 10, 0);
fd                115 user/printf.c          printint(fd, va_arg(ap, int), 16, 0);
fd                117 user/printf.c          printptr(fd, va_arg(ap, uint64));
fd                123 user/printf.c            putc(fd, *s);
fd                127 user/printf.c          putc(fd, va_arg(ap, uint));
fd                129 user/printf.c          putc(fd, c);
fd                132 user/printf.c          putc(fd, '%');
fd                133 user/printf.c          putc(fd, c);
fd                142 user/printf.c  fprintf(int fd, const char *fmt, ...)
fd                147 user/printf.c    vprintf(fd, fmt, ap);
fd                 32 user/sh.c        int fd;
fd                 85 user/sh.c          close(rcmd->fd);
fd                149 user/sh.c        int fd;
fd                152 user/sh.c        while((fd = open("console", O_RDWR)) >= 0){
fd                153 user/sh.c          if(fd >= 3){
fd                154 user/sh.c            close(fd);
fd                208 user/sh.c      redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd)
fd                219 user/sh.c        cmd->fd = fd;
fd                 19 user/stressfs.c   int fd, i;
fd                 33 user/stressfs.c   fd = open(path, O_CREATE | O_RDWR);
fd                 36 user/stressfs.c     write(fd, data, sizeof(data));
fd                 37 user/stressfs.c   close(fd);
fd                 41 user/stressfs.c   fd = open(path, O_RDONLY);
fd                 43 user/stressfs.c     read(fd, data, sizeof(data));
fd                 44 user/stressfs.c   close(fd);
fd                 87 user/ulib.c      int fd;
fd                 90 user/ulib.c      fd = open(n, O_RDONLY);
fd                 91 user/ulib.c      if(fd < 0)
fd                 93 user/ulib.c      r = fstat(fd, st);
fd                 94 user/ulib.c      close(fd);
fd                 16 user/user.h    int fstat(int fd, struct stat*);
fd                 41 user/usertests.c     int fd = open("copyin1", O_CREATE|O_WRONLY);
fd                 42 user/usertests.c     if(fd < 0){
fd                 46 user/usertests.c     int n = write(fd, (void*)addr, 8192);
fd                 51 user/usertests.c     close(fd);
fd                 86 user/usertests.c     int fd = open("README", 0);
fd                 87 user/usertests.c     if(fd < 0){
fd                 91 user/usertests.c     int n = read(fd, (void*)addr, 8192);
fd                 96 user/usertests.c     close(fd);
fd                128 user/usertests.c     int fd = open((char *)addr, O_CREATE|O_WRONLY);
fd                129 user/usertests.c     if(fd >= 0){
fd                130 user/usertests.c       printf("open(%p) returned %d, not -1\n", (void*)addr, fd);
fd                154 user/usertests.c   int fd = open(b, O_CREATE | O_WRONLY);
fd                155 user/usertests.c   if(fd != -1){
fd                156 user/usertests.c     printf("open(%s) returned %d, not -1\n", b, fd);
fd                169 user/usertests.c     printf("exec(%s) returned %d, not -1\n", b, fd);
fd                186 user/usertests.c       printf("exec(echo, BIG) returned %d, not -1\n", fd);
fd                224 user/usertests.c   int fd = open(b, O_CREATE | O_WRONLY);
fd                225 user/usertests.c   if(fd != -1){
fd                226 user/usertests.c     printf("open(%s) returned %d, not -1\n", b, fd);
fd                239 user/usertests.c     printf("exec(%s) returned %d, not -1\n", b, fd);
fd                249 user/usertests.c   int fd, n;
fd                263 user/usertests.c   fd = open("rwsbrk", O_CREATE|O_WRONLY);
fd                264 user/usertests.c   if(fd < 0){
fd                268 user/usertests.c   n = write(fd, (void*)(a+4096), 1024);
fd                273 user/usertests.c   close(fd);
fd                276 user/usertests.c   fd = open("README", O_RDONLY);
fd                277 user/usertests.c   if(fd < 0){
fd                281 user/usertests.c   n = read(fd, (void*)(a+4096), 10);
fd                286 user/usertests.c   close(fd);
fd                388 user/usertests.c       int fd = open("truncfile", O_WRONLY);
fd                389 user/usertests.c       if(fd < 0){
fd                393 user/usertests.c       int n = write(fd, "1234567890", 10);
fd                398 user/usertests.c       close(fd);
fd                399 user/usertests.c       fd = open("truncfile", O_RDONLY);
fd                400 user/usertests.c       read(fd, buf, sizeof(buf));
fd                401 user/usertests.c       close(fd);
fd                407 user/usertests.c     int fd = open("truncfile", O_CREATE|O_WRONLY|O_TRUNC);
fd                408 user/usertests.c     if(fd < 0){
fd                412 user/usertests.c     int n = write(fd, "xxx", 3);
fd                417 user/usertests.c     close(fd);
fd                504 user/usertests.c     int fd = open("oidir", O_RDWR);
fd                505 user/usertests.c     if(fd >= 0){
fd                525 user/usertests.c   int fd;
fd                527 user/usertests.c   fd = open("echo", 0);
fd                528 user/usertests.c   if(fd < 0){
fd                532 user/usertests.c   close(fd);
fd                533 user/usertests.c   fd = open("doesnotexist", 0);
fd                534 user/usertests.c   if(fd >= 0){
fd                543 user/usertests.c   int fd;
fd                547 user/usertests.c   fd = open("small", O_CREATE|O_RDWR);
fd                548 user/usertests.c   if(fd < 0){
fd                553 user/usertests.c     if(write(fd, "aaaaaaaaaa", SZ) != SZ){
fd                557 user/usertests.c     if(write(fd, "bbbbbbbbbb", SZ) != SZ){
fd                562 user/usertests.c   close(fd);
fd                563 user/usertests.c   fd = open("small", O_RDONLY);
fd                564 user/usertests.c   if(fd < 0){
fd                568 user/usertests.c   i = read(fd, buf, N*SZ*2);
fd                573 user/usertests.c   close(fd);
fd                584 user/usertests.c   int i, fd, n;
fd                586 user/usertests.c   fd = open("big", O_CREATE|O_RDWR);
fd                587 user/usertests.c   if(fd < 0){
fd                594 user/usertests.c     if(write(fd, buf, BSIZE) != BSIZE){
fd                600 user/usertests.c   close(fd);
fd                602 user/usertests.c   fd = open("big", O_RDONLY);
fd                603 user/usertests.c   if(fd < 0){
fd                610 user/usertests.c     i = read(fd, buf, BSIZE);
fd                628 user/usertests.c   close(fd);
fd                639 user/usertests.c   int i, fd;
fd                647 user/usertests.c     fd = open(name, O_CREATE|O_RDWR);
fd                648 user/usertests.c     close(fd);
fd                684 user/usertests.c   int fd, xstatus, pid;
fd                696 user/usertests.c     fd = open("echo-ok", O_CREATE|O_WRONLY);
fd                697 user/usertests.c     if(fd < 0) {
fd                701 user/usertests.c     if(fd != 1) {
fd                717 user/usertests.c   fd = open("echo-ok", O_RDONLY);
fd                718 user/usertests.c   if(fd < 0) {
fd                722 user/usertests.c   if (read(fd, buf, 2) != 2) {
fd               1012 user/usertests.c       int fd = open("stopforking", 0);
fd               1013 user/usertests.c       if(fd >= 0){
fd               1099 user/usertests.c   int fd, pid, i, n, nc, np;
fd               1104 user/usertests.c   fd = open("sharedfd", O_CREATE|O_RDWR);
fd               1105 user/usertests.c   if(fd < 0){
fd               1112 user/usertests.c     if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
fd               1126 user/usertests.c   close(fd);
fd               1127 user/usertests.c   fd = open("sharedfd", 0);
fd               1128 user/usertests.c   if(fd < 0){
fd               1133 user/usertests.c   while((n = read(fd, buf, sizeof(buf))) > 0){
fd               1141 user/usertests.c   close(fd);
fd               1156 user/usertests.c   int fd, pid, i, j, n, total, pi;
fd               1172 user/usertests.c       fd = open(fname, O_CREATE | O_RDWR);
fd               1173 user/usertests.c       if(fd < 0){
fd               1180 user/usertests.c         if((n = write(fd, buf, SZ)) != SZ){
fd               1198 user/usertests.c     fd = open(fname, 0);
fd               1200 user/usertests.c     while((n = read(fd, buf, sizeof(buf))) > 0){
fd               1209 user/usertests.c     close(fd);
fd               1223 user/usertests.c   int pid, i, fd, pi;
fd               1238 user/usertests.c         fd = open(name, O_CREATE | O_RDWR);
fd               1239 user/usertests.c         if(fd < 0){
fd               1243 user/usertests.c         close(fd);
fd               1268 user/usertests.c       fd = open(name, 0);
fd               1269 user/usertests.c       if((i == 0 || i >= N/2) && fd < 0){
fd               1272 user/usertests.c       } else if((i >= 1 && i < N/2) && fd >= 0){
fd               1276 user/usertests.c       if(fd >= 0)
fd               1277 user/usertests.c         close(fd);
fd               1295 user/usertests.c   int fd, fd1;
fd               1297 user/usertests.c   fd = open("unlinkread", O_CREATE | O_RDWR);
fd               1298 user/usertests.c   if(fd < 0){
fd               1302 user/usertests.c   write(fd, "hello", SZ);
fd               1303 user/usertests.c   close(fd);
fd               1305 user/usertests.c   fd = open("unlinkread", O_RDWR);
fd               1306 user/usertests.c   if(fd < 0){
fd               1319 user/usertests.c   if(read(fd, buf, sizeof(buf)) != SZ){
fd               1327 user/usertests.c   if(write(fd, buf, 10) != 10){
fd               1331 user/usertests.c   close(fd);
fd               1339 user/usertests.c   int fd;
fd               1344 user/usertests.c   fd = open("lf1", O_CREATE|O_RDWR);
fd               1345 user/usertests.c   if(fd < 0){
fd               1349 user/usertests.c   if(write(fd, "hello", SZ) != SZ){
fd               1353 user/usertests.c   close(fd);
fd               1366 user/usertests.c   fd = open("lf2", 0);
fd               1367 user/usertests.c   if(fd < 0){
fd               1371 user/usertests.c   if(read(fd, buf, sizeof(buf)) != SZ){
fd               1375 user/usertests.c   close(fd);
fd               1400 user/usertests.c   int i, pid, n, fd;
fd               1418 user/usertests.c       fd = open(file, O_CREATE | O_RDWR);
fd               1419 user/usertests.c       if(fd < 0){
fd               1423 user/usertests.c       close(fd);
fd               1436 user/usertests.c   fd = open(".", 0);
fd               1438 user/usertests.c   while(read(fd, &de, sizeof(de)) > 0){
fd               1455 user/usertests.c   close(fd);
fd               1528 user/usertests.c   int fd, cc;
fd               1536 user/usertests.c   fd = open("dd/ff", O_CREATE | O_RDWR);
fd               1537 user/usertests.c   if(fd < 0){
fd               1541 user/usertests.c   write(fd, "ff", 2);
fd               1542 user/usertests.c   close(fd);
fd               1554 user/usertests.c   fd = open("dd/dd/ff", O_CREATE | O_RDWR);
fd               1555 user/usertests.c   if(fd < 0){
fd               1559 user/usertests.c   write(fd, "FF", 2);
fd               1560 user/usertests.c   close(fd);
fd               1562 user/usertests.c   fd = open("dd/dd/../ff", 0);
fd               1563 user/usertests.c   if(fd < 0){
fd               1567 user/usertests.c   cc = read(fd, buf, sizeof(buf));
fd               1572 user/usertests.c   close(fd);
fd               1605 user/usertests.c   fd = open("dd/dd/ffff", 0);
fd               1606 user/usertests.c   if(fd < 0){
fd               1610 user/usertests.c   if(read(fd, buf, sizeof(buf)) != 2){
fd               1614 user/usertests.c   close(fd);
fd               1708 user/usertests.c   int fd, sz;
fd               1712 user/usertests.c     fd = open("bigwrite", O_CREATE | O_RDWR);
fd               1713 user/usertests.c     if(fd < 0){
fd               1719 user/usertests.c       int cc = write(fd, buf, sz);
fd               1725 user/usertests.c     close(fd);
fd               1735 user/usertests.c   int fd, i, total, cc;
fd               1738 user/usertests.c   fd = open("bigfile.dat", O_CREATE | O_RDWR);
fd               1739 user/usertests.c   if(fd < 0){
fd               1745 user/usertests.c     if(write(fd, buf, SZ) != SZ){
fd               1750 user/usertests.c   close(fd);
fd               1752 user/usertests.c   fd = open("bigfile.dat", 0);
fd               1753 user/usertests.c   if(fd < 0){
fd               1759 user/usertests.c     cc = read(fd, buf, SZ/2);
fd               1776 user/usertests.c   close(fd);
fd               1787 user/usertests.c   int fd;
fd               1799 user/usertests.c   fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
fd               1800 user/usertests.c   if(fd < 0){
fd               1804 user/usertests.c   close(fd);
fd               1805 user/usertests.c   fd = open("12345678901234/12345678901234/12345678901234", 0);
fd               1806 user/usertests.c   if(fd < 0){
fd               1810 user/usertests.c   close(fd);
fd               1870 user/usertests.c   int fd;
fd               1872 user/usertests.c   fd = open("dirfile", O_CREATE);
fd               1873 user/usertests.c   if(fd < 0){
fd               1877 user/usertests.c   close(fd);
fd               1882 user/usertests.c   fd = open("dirfile/xx", 0);
fd               1883 user/usertests.c   if(fd >= 0){
fd               1887 user/usertests.c   fd = open("dirfile/xx", O_CREATE);
fd               1888 user/usertests.c   if(fd >= 0){
fd               1909 user/usertests.c   fd = open(".", O_RDWR);
fd               1910 user/usertests.c   if(fd >= 0){
fd               1914 user/usertests.c   fd = open(".", 0);
fd               1915 user/usertests.c   if(write(fd, "x", 1) > 0){
fd               1919 user/usertests.c   close(fd);
fd               1927 user/usertests.c   int i, fd;
fd               1941 user/usertests.c     fd = open("", O_CREATE);
fd               1942 user/usertests.c     if(fd >= 0)
fd               1943 user/usertests.c       close(fd);
fd               1944 user/usertests.c     fd = open("xx", O_CREATE);
fd               1945 user/usertests.c     if(fd >= 0)
fd               1946 user/usertests.c       close(fd);
fd               2246 user/usertests.c   int fd, n;
fd               2249 user/usertests.c   fd = open("sbrk", O_CREATE|O_WRONLY);
fd               2251 user/usertests.c   if(fd < 0)  {
fd               2255 user/usertests.c   if ((n = write(fd, a, PGSIZE)) < 0) {
fd               2259 user/usertests.c   close(fd);
fd               2306 user/usertests.c   int pid, fd, xstatus;
fd               2322 user/usertests.c     fd = open("bigarg-ok", O_CREATE);
fd               2323 user/usertests.c     close(fd);
fd               2333 user/usertests.c   fd = open("bigarg-ok", 0);
fd               2334 user/usertests.c   if(fd < 0){
fd               2338 user/usertests.c   close(fd);
fd               2360 user/usertests.c     int fd = open(name, O_CREATE|O_RDWR);
fd               2361 user/usertests.c     if(fd < 0){
fd               2367 user/usertests.c       int cc = write(fd, buf, BSIZE);
fd               2374 user/usertests.c     close(fd);
fd               2396 user/usertests.c   int fd;
fd               2397 user/usertests.c   fd = open("init", O_RDONLY);
fd               2398 user/usertests.c   if (fd < 0) {
fd               2402 user/usertests.c   read(fd, sbrk(0) - 1, -1);
fd               2403 user/usertests.c   close(fd);
fd               2551 user/usertests.c   int fd = open(p, O_RDWR|O_CREATE);
fd               2552 user/usertests.c   write(fd, p, 1);
fd               2553 user/usertests.c   close(fd);
fd               2554 user/usertests.c   fd = open(p, O_RDWR);
fd               2556 user/usertests.c   read(fd, p, 1);
fd               2666 user/usertests.c   int i, fd;
fd               2671 user/usertests.c   fd = open("bd", O_CREATE);
fd               2672 user/usertests.c   if(fd < 0){
fd               2676 user/usertests.c   close(fd);
fd               2726 user/usertests.c           int fd = open(name, O_CREATE | O_RDWR);
fd               2727 user/usertests.c           if(fd < 0){
fd               2732 user/usertests.c           int cc = write(fd, buf, sz);
fd               2737 user/usertests.c           close(fd);
fd               2768 user/usertests.c     int fd = open("junk", O_CREATE|O_WRONLY);
fd               2769 user/usertests.c     if(fd < 0){
fd               2773 user/usertests.c     write(fd, (char*)0xffffffffffL, 1);
fd               2774 user/usertests.c     close(fd);
fd               2778 user/usertests.c   int fd = open("junk", O_CREATE|O_WRONLY);
fd               2779 user/usertests.c   if(fd < 0){
fd               2783 user/usertests.c   if(write(fd, "x", 1) != 1){
fd               2787 user/usertests.c   close(fd);
fd               2847 user/usertests.c     int fd = open(name, O_CREATE|O_RDWR|O_TRUNC);
fd               2848 user/usertests.c     if(fd < 0){
fd               2856 user/usertests.c       if(write(fd, buf, BSIZE) != BSIZE){
fd               2858 user/usertests.c         close(fd);
fd               2862 user/usertests.c     close(fd);
fd               2878 user/usertests.c     int fd = open(name, O_CREATE|O_RDWR|O_TRUNC);
fd               2879 user/usertests.c     if(fd < 0)
fd               2881 user/usertests.c     close(fd);
fd               2923 user/usertests.c     int fd = open(name, O_CREATE|O_RDWR|O_TRUNC);
fd               2924 user/usertests.c     if(fd < 0){
fd               2928 user/usertests.c     close(fd);
fd                  9 user/wc.c      wc(int fd, char *name)
fd                 16 user/wc.c        while((n = read(fd, buf, sizeof(buf))) > 0){
fd                 39 user/wc.c        int fd, i;
fd                 47 user/wc.c          if((fd = open(argv[i], O_RDONLY)) < 0){
fd                 51 user/wc.c          wc(fd, argv[i]);
fd                 52 user/wc.c          close(fd);