Annotation of researchv8dc/netfs/start.c, revision 1.1.1.1

1.1       root        1: #include "fserv.h"
                      2: #include "sys/neta.h"
                      3: 
                      4: char cmdbuf[256];
                      5: int alive, rdcnt, wrcnt, dtime;
                      6: int rdnum;
                      7: struct senda y, nilrcv;
                      8: int host;
                      9: 
                     10: work()
                     11: {      int n;
                     12:        struct senda *x;
                     13:        dtime = children[myfd].dtime;
                     14:        host = children[myfd].host;
                     15:        silent = children[myfd].silent;
                     16:        debugreset();
                     17:        do {
                     18:                /* would select be better? */
                     19:                n = read(myfd, cmdbuf, sizeof(cmdbuf));
                     20:                if(n < 0) {
                     21:                        debug("read -1 on %d for %s", myfd, children[myfd].who);
                     22:                        leave(2);
                     23:                }
                     24:                if(n != sizeof(struct senda)) {
                     25:                        debug("read %d wanted %d for %s", n, sizeof(struct senda),
                     26:                                children[myfd].who);
                     27:                        leave(3);
                     28:                }
                     29:                rdnum++;
                     30:                if(rdnum % 20 == 4)
                     31:                        permredo();     /* every 10 minutes when idle */
                     32:                x = (struct senda *)cmdbuf;
                     33:                errno = 0;
                     34:                y = nilrcv;
                     35:                prcmd(x);
                     36:                switch(x->cmd) {
                     37:                default:
                     38:                        debug("unk cmnd %d for %s", n, children[myfd].who);
                     39:                        leave(4);
                     40:                case NSTAT:
                     41:                        dostat(x);
                     42:                        break;
                     43:                case NWRT:
                     44:                        dowrite(x);
                     45:                        break;
                     46:                case NREAD:
                     47:                        doread(x);
                     48:                        break;
                     49:                case NFREE:
                     50:                        dofree(x);
                     51:                        break;
                     52:                case NTRUNC:
                     53:                        dotrunc(x);
                     54:                        break;
                     55:                case NUPDAT:
                     56:                        doupdat(x);
                     57:                        break;
                     58:                case NGET:
                     59:                        doget(x);
                     60:                        break;
                     61:                case NNAMI:
                     62:                        donami(x);
                     63:                        break;
                     64:                case NPUT:
                     65:                        doput(x);
                     66:                        break;
                     67:                }
                     68:        } while(alive > 0);
                     69:        leave(0);
                     70: }
                     71: 
                     72: leave(n)
                     73: {      int i;
                     74:        debug("leaving(%d)", n);
                     75:        for(i = 0; i < dptr; i++) {
                     76:                strcat(debugbuf[i], "\n");
                     77:                write(dbgfd, debugbuf[i], strlen(debugbuf[i]));
                     78:        }
                     79:        exit(n);
                     80: }
                     81: 
                     82: extern netf netftab[];
                     83: extern int nnetf;
                     84: dumpstate()
                     85: {      struct senda *x = (struct senda *)cmdbuf;
                     86:        netf *p;
                     87:        int i;
                     88:        debug("\tmesg: ver %d flags %d trannum %d\n\tuid %d gid %d dev 0x%x tag %d mode 0%o",
                     89:        x->version, x->flags, x->trannum, x->uid, x->gid, x->dev, x->tag, x->mode);
                     90:        debug("\t\tino %d count %d offset %d", x->ino, x->count, x->offset);
                     91:        prcmd(x);
                     92:        debug("\t%s: fl %d dtime %d dev 0x%x host %d",
                     93:                children[myfd].who, children[myfd].flags, children[myfd].dtime,
                     94:                children[myfd].dev, children[myfd].host);
                     95:        for(i = 0; i < ndev; i++)
                     96:                debug("\tdev: ours 0x%x his 0x%x", devtab[i].ours,
                     97:                        devtab[i].his);
                     98:        for(p = netftab, i = 0; i < nnetf; i++, p++) {
                     99:                debug("\tnetf %d dev 0x%x ino %d how %d fd %d %s",
                    100:                        p->tag, p->dev, p->ino, p->how, p->fd,
                    101:                        p->name? p->name: "(null)");
                    102:                debug("\tstat dev 0x%x ino %d mode 0%o nlink %d size %d",
                    103:                        p->statb.st_dev, p->statb.st_ino, p->statb.st_mode,
                    104:                        p->statb.st_nlink, p->statb.st_size);
                    105:                debug("\t\tuid %d gid %d ctime %s\t\t", p->statb.st_uid,
                    106:                        p->statb.st_gid, ctime(&p->statb.st_ctime));
                    107:        }
                    108: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.