version 1.18, 1998/09/06 22:48:46 |
version 1.19, 1998/09/07 01:04:13 |
|
|
|
|
#include <arpa/inet.h> |
#include <arpa/inet.h> |
|
|
|
#include <sys/pipe.h> |
|
|
#include <ctype.h> |
#include <ctype.h> |
#include <errno.h> |
#include <errno.h> |
#include <kvm.h> |
#include <kvm.h> |
|
|
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) |
|
|
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); |
} |
} |
|
|
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 |