[BACK]Return to fstat.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / fstat

Diff for /src/usr.bin/fstat/fstat.c between version 1.21 and 1.22

version 1.21, 1998/11/30 10:19:02 version 1.22, 1999/04/30 02:26:59
Line 80 
Line 80 
   
 #include <arpa/inet.h>  #include <arpa/inet.h>
   
   #define PIPE_NODIRECT           /* XXX - define here, since it's not defined
                                      outside _KERNEL */
   #include <sys/pipe.h>
   
 #include <ctype.h>  #include <ctype.h>
 #include <errno.h>  #include <errno.h>
 #include <kvm.h>  #include <kvm.h>
Line 144 
Line 148 
 void usage __P((void));  void usage __P((void));
 void vtrans __P((struct vnode *, int, int));  void vtrans __P((struct vnode *, int, int));
 int getfname __P((char *));  int getfname __P((char *));
   void pipetrans __P((struct pipe *, int));
   
 int  int
 main(argc, argv)  main(argc, argv)
Line 350 
Line 355 
                 else if (file.f_type == DTYPE_SOCKET) {                  else if (file.f_type == DTYPE_SOCKET) {
                         if (checkfile == 0)                          if (checkfile == 0)
                                 socktrans((struct socket *)file.f_data, i);                                  socktrans((struct socket *)file.f_data, i);
                 }                  } else if (file.f_type == DTYPE_PIPE) {
                 else {                          if (checkfile == 0)
                                   pipetrans((struct pipe *)file.f_data, i);
                   } else {
                         dprintf("unknown file type %d for file %d of pid %d",                          dprintf("unknown file type %d for file %d of pid %d",
                                 file.f_type, i, Pid);                                  file.f_type, i, Pid);
                 }                  }
Line 623 
Line 630 
         mt->next = mhead;          mt->next = mhead;
         mhead = mt;          mhead = mt;
         return (mt->mntonname);          return (mt->mntonname);
   }
   
   void
   pipetrans(pipe, i)
           struct pipe *pipe;
           int i;
   {
           struct pipe pi;
           void *maxaddr;
   
           PREFIX(i);
   
           printf(" ");
   
           /* fill in socket */
           if (!KVM_READ(pipe, &pi, sizeof(struct pipe))) {
                   dprintf("can't read pipe at %p", pipe);
                   goto bad;
           }
   
           /*
            * We don't have enough space to fit both peer and own address, so
            * we select the higher address so both ends of the pipe have the
            * same visible addr. (it's the higher address because when the other
            * end closes, it becomes 0)
            */
           maxaddr = MAX(pipe, pi.pipe_peer);
   
           printf("pipe %p state: %s%s%s", maxaddr,
                  (pi.pipe_state & PIPE_WANTR) ? "R" : "",
                  (pi.pipe_state & PIPE_WANTW) ? "W" : "",
                  (pi.pipe_state & PIPE_EOF) ? "E" : "");
   
           printf("\n");
           return;
   bad:
           printf("* error\n");
 }  }
   
 void  void

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22