- if ((tty = (struct tty *)malloc(ttyspace * sizeof(*tty))) == 0) {
- printf("pstat: out of memory\n");
- return;
- }
- printf("1 cons\n");
- if (kflg)
- nl[SKL].n_value = clear(nl[SKL].n_value);
- lseek(fc, (long)nl[SKL].n_value, 0);
- read(fc, tty, sizeof(*tty));
- printf(mesg);
- ttyprt(&tty[0], 0);
- if (nl[SNDZ].n_type == 0)
- goto dh;
- if (kflg) {
- nl[SNDZ].n_value = clear(nl[SNDZ].n_value);
- nl[SDZ].n_value = clear(nl[SDZ].n_value);
- }
- lseek(fc, (long)nl[SNDZ].n_value, 0);
- read(fc, &ntty, sizeof(ntty));
- printf("%d dz lines\n", ntty);
- if (ntty > ttyspace) {
- ttyspace = ntty;
- if ((tty = (struct tty *)realloc(tty, ttyspace * sizeof(*tty))) == 0) {
- printf("pstat: out of memory\n");
- return;
- }
- }
- lseek(fc, (long)nl[SDZ].n_value, 0);
- read(fc, tty, ntty * sizeof (struct tty));
- printf(mesg);
- for (tp = tty; tp < &tty[ntty]; tp++)
- ttyprt(tp, tp - tty);
-dh:
- if (nl[SNDH].n_type == 0)
- goto dmf;
- if (kflg) {
- nl[SNDH].n_value = clear(nl[SNDH].n_value);
- nl[SDH].n_value = clear(nl[SDH].n_value);
- }
- lseek(fc, (long)nl[SNDH].n_value, 0);
- read(fc, &ntty, sizeof(ntty));
- printf("%d dh lines\n", ntty);
- if (ntty > ttyspace) {
- ttyspace = ntty;
- if ((tty = (struct tty *)realloc(tty, ttyspace * sizeof(*tty))) == 0) {
- printf("pstat: out of memory\n");
- return;
- }
- }
- lseek(fc, (long)nl[SDH].n_value, 0);
- read(fc, tty, ntty * sizeof(struct tty));
- printf(mesg);
- for (tp = tty; tp < &tty[ntty]; tp++)
- ttyprt(tp, tp - tty);
-dmf:
- if (nl[SNDMF].n_type == 0)
- goto pty;
- if (kflg) {
- nl[SNDMF].n_value = clear(nl[SNDMF].n_value);
- nl[SDMF].n_value = clear(nl[SDMF].n_value);
- }
- lseek(fc, (long)nl[SNDMF].n_value, 0);
- read(fc, &ntty, sizeof(ntty));
- printf("%d dmf lines\n", ntty);
- if (ntty > ttyspace) {
- ttyspace = ntty;
- if ((tty = (struct tty *)realloc(tty, ttyspace * sizeof(*tty))) == 0) {
- printf("pstat: out of memory\n");
- return;
- }
- }
- lseek(fc, (long)nl[SDMF].n_value, 0);
- read(fc, tty, ntty * sizeof(struct tty));
- printf(mesg);
- for (tp = tty; tp < &tty[ntty]; tp++)
- ttyprt(tp, tp - tty);
-pty:
- if (nl[SPTY].n_type == 0)
- return;
- if (kflg) {
- nl[SPTY].n_value = clear(nl[SPTY].n_value);
- nl[SNPTY].n_value = clear(nl[SNPTY].n_value);
- }
- lseek(fc, (long)nl[SNPTY].n_value, 0);
- read(fc, &ntty, sizeof(ntty));
- printf("%d pty lines\n", ntty);
- if (ntty > ttyspace) {
- ttyspace = ntty;
- if ((tty = (struct tty *)realloc(tty, ttyspace * sizeof(*tty))) == 0) {
- printf("pstat: out of memory\n");
- return;
- }
- }
- lseek(fc, (long)nl[SPTY].n_value, 0);
- read(fc, tty, ntty*sizeof(struct tty));
- printf(mesg);
- for (tp = tty; tp < &tty[ntty]; tp++)
- ttyprt(tp, tp - tty);
+ KGETRET(VTOI(vp), &inode, sizeof(struct inode), "vnode's inode");
+ flag = ip->i_flag;
+ if (flag & ILOCKED)
+ *flags++ = 'L';
+ if (flag & IWANT)
+ *flags++ = 'W';
+ if (flag & IRENAME)
+ *flags++ = 'R';
+ if (flag & IUPD)
+ *flags++ = 'U';
+ if (flag & IACC)
+ *flags++ = 'A';
+ if (flag & ICHG)
+ *flags++ = 'C';
+ if (flag & IMOD)
+ *flags++ = 'M';
+ if (flag & ISHLOCK)
+ *flags++ = 'S';
+ if (flag & IEXLOCK)
+ *flags++ = 'E';
+ if (flag & ILWAIT)
+ *flags++ = 'Z';
+ if (flag == 0)
+ *flags++ = '-';
+ *flags = '\0';
+
+ (void)printf(" %6d %5s", ip->i_number, flagbuf);
+ type = ip->i_mode & S_IFMT;
+ if (S_ISCHR(ip->i_mode) || S_ISBLK(ip->i_mode))
+ if (usenumflag || ((name = devname(ip->i_rdev, type)) == NULL))
+ (void)printf(" %2d,%-2d",
+ major(ip->i_rdev), minor(ip->i_rdev));
+ else
+ (void)printf(" %7s", name);
+ else
+ (void)printf(" %7qd", ip->i_size);
+ return (0);