Deleted Added
full compact
1/*-
2 * Copyright (c) 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 41 unchanged lines hidden (view full) ---

50#include <sys/socket.h>
51#include <sys/socketvar.h>
52#include <sys/domain.h>
53#include <sys/protosw.h>
54#include <sys/unpcb.h>
55#include <sys/sysctl.h>
56#include <sys/filedesc.h>
57#include <sys/queue.h>
58#define KERNEL
59#include <sys/file.h>
60#include <ufs/ufs/quota.h>
61#include <ufs/ufs/inode.h>
62#undef KERNEL
63#define NFS
64#include <sys/mount.h>
65#include <nfs/nfsproto.h>

--- 70 unchanged lines hidden (view full) ---

136/*
137 * a kvm_read that returns true if everything is read
138 */
139#define KVM_READ(kaddr, paddr, len) \
140 (kvm_read(kd, (u_long)(kaddr), (char *)(paddr), (len)) == (len))
141
142kvm_t *kd;
143
144int ufs_filestat(), nfs_filestat();
145void dofiles(), getinetproto(), socktrans();
146void usage(), vtrans();
147
148main(argc, argv)
149 int argc;
150 char **argv;
151{
152 extern char *optarg;
153 extern int optind;
154 register struct passwd *passwd;
155 struct kinfo_proc *p, *plast;
156 int arg, ch, what;
157 char *memf, *nlistf;
158 int cnt;
159
160 arg = 0;
161 what = KERN_PROC_ALL;

--- 131 unchanged lines hidden (view full) ---

293{
294 int i, last;
295 struct file file;
296 struct filedesc0 filed0;
297#define filed filed0.fd_fd
298 struct proc *p = &kp->kp_proc;
299 struct eproc *ep = &kp->kp_eproc;
300
301 extern char *user_from_uid();
302
303 Uname = user_from_uid(ep->e_ucred.cr_uid, 0);
304 Pid = p->p_pid;
305 Comm = p->p_comm;
306
307 if (p->p_fd == NULL)
308 return;
309 if (!KVM_READ(p->p_fd, &filed0, sizeof (filed0))) {
310 dprintf(stderr, "can't read filedesc at %x for pid %d\n",

--- 38 unchanged lines hidden (view full) ---

349 continue;
350 }
351 if (file.f_type == DTYPE_VNODE)
352 vtrans((struct vnode *)file.f_data, i, file.f_flag);
353 else if (file.f_type == DTYPE_SOCKET) {
354 if (checkfile == 0)
355 socktrans((struct socket *)file.f_data, i);
356 }
357 else {
358 dprintf(stderr,
359 "unknown file type %d for file %d of pid %d\n",
360 file.f_type, i, Pid);
361 }
362 }
363}
364

--- 189 unchanged lines hidden (view full) ---

554 mt->m = m;
555 bcopy(&mount.mnt_stat.f_mntonname[0], &mt->mntonname[0], MNAMELEN);
556 mt->next = mhead;
557 mhead = mt;
558 return (mt->mntonname);
559}
560
561void
562socktrans(sock, i)
563 struct socket *sock;
564 int i;
565{
566 static char *stypename[] = {
567 "unused", /* 0 */
568 "stream", /* 1 */
569 "dgram", /* 2 */

--- 140 unchanged lines hidden (view full) ---

710 cp ="raw"; break;
711 default:
712 printf(" %d", number);
713 return;
714 }
715 printf(" %s", cp);
716}
717
718getfname(filename)
719 char *filename;
720{
721 struct stat statbuf;
722 DEVS *cur;
723
724 if (stat(filename, &statbuf)) {
725 fprintf(stderr, "fstat: %s: %s\n", filename, strerror(errno));

--- 22 unchanged lines hidden ---