Annotation of researchv10no/cmd/netfsbug.c, revision 1.1

1.1     ! root        1: /* if /n/... seems to screw up, type netfsbug >xxx; mail pjw < xxx */
        !             2: #include "stdio.h"
        !             3: #include "nlist.h"
        !             4: #include "sys/types.h"
        !             5: #include "sys/neta.h"
        !             6: /*
        !             7: struct nlist {
        !             8:        char    *n_name;
        !             9:        unsigned char n_type;
        !            10:        char    n_other;
        !            11:        short   n_desc;
        !            12:        unsigned long n_value;
        !            13: };
        !            14: */
        !            15: extern int errno;
        !            16: char *cmd[] = { 0, "stat", "wrt", "read", "free", "trunc", "updat", "get",
        !            17:        "nami", "put", "root", "ndel", "nlink", "creat", "nomatch", "nstart",
        !            18:        "nioctl"};
        !            19: struct nlist nl[] = {
        !            20:        {"_netabuf"}, {0}
        !            21: };
        !            22: struct {
        !            23:        char len, s, n, dummie;
        !            24:        int b[4000];
        !            25: } x;
        !            26: struct rcva *rp;
        !            27: struct senda *sp;
        !            28: main()
        !            29: {      int fd, n, i;
        !            30:        nlist("/unix", nl);
        !            31:        if(nl[0].n_value == 0) {
        !            32:                fprintf(stderr, "nlist failed\n");
        !            33:                exit(1);
        !            34:        }
        !            35:        fd = open("/dev/kmem", 0);
        !            36:        if(fd < 0) {
        !            37:                perror("/dev/kmem");
        !            38:                exit(1);
        !            39:        }
        !            40:        lseek(fd, nl[0].n_value, 0);
        !            41:        if(errno)
        !            42:                perror("lseek");
        !            43:        n = read(fd, (char *) &x, sizeof(x));
        !            44:        sp = (struct senda *) x.b;
        !            45:        rp = (struct rcva *) (x.b + x.len * sizeof(struct senda)/sizeof(int));
        !            46:        for(i = x.n - 1; i >= 0; i--)
        !            47:                out(i);
        !            48:        for(i = x.len - 1; i >= x.n; i--)
        !            49:                out(i);
        !            50: }
        !            51: 
        !            52: out(i)
        !            53: {
        !            54:        printf("%d %s tran=%d uid=%d gid=%d maj=%d min=%d tag=0x%x mode=0%o\n",
        !            55:                sp[i].version, cmd[sp[i].cmd], sp[i].trannum, sp[i].uid,
        !            56:                sp[i].gid, (sp[i].dev & 0xff00) >> 8, sp[i].dev & 0xff,
        !            57:                sp[i].tag, sp[i].mode & 0xffff);
        !            58:        printf("\tnuid=%d ngid=%d flag=%d ino=%d cnt=%d offset=%d\n",
        !            59:                sp[i].newuid, sp[i].newgid, sp[i].flags, sp[i].ino, sp[i].count,
        !            60:                sp[i].offset);
        !            61:        printf("tran=%d err=%d flag=%d maj=%d min=%d size=%d mode=0%o\n",
        !            62:                rp[i].trannum, rp[i].errno, rp[i].flags, (rp[i].dev & 0xff00) >> 16,
        !            63:                rp[i].dev & 0xff, rp[i].size, rp[i].mode & 0xffff);
        !            64:        printf("\tuid=%d gid=%d tag=0x%x nlnk=%d ino=%d count=%d\n",
        !            65:                rp[i].uid, rp[i].gid, rp[i].tag, rp[i].nlink, rp[i].ino,
        !            66:                rp[i].count);
        !            67: }

unix.superglobalmegacorp.com

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