summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-11-07 20:38:29 +0000
committerphk <phk@FreeBSD.org>2004-11-07 20:38:29 +0000
commit878fd8dde724c338fc81887b50b0a93faf7495cd (patch)
treefbb770b68ecda91a2e4551e58d408e61b12912db /usr.bin
parent185ec80b05a613b10d5aae2da64db3082aea513d (diff)
downloadFreeBSD-src-878fd8dde724c338fc81887b50b0a93faf7495cd.zip
FreeBSD-src-878fd8dde724c338fc81887b50b0a93faf7495cd.tar.gz
filedesc0 is an internal detail of the kernel, don't look at it.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/fstat/fstat.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
index f8763b0..4ed1a78 100644
--- a/usr.bin/fstat/fstat.c
+++ b/usr.bin/fstat/fstat.c
@@ -322,8 +322,7 @@ dofiles(struct kinfo_proc *kp)
{
int i;
struct file file;
- struct filedesc0 filed0;
-#define filed filed0.fd_fd
+ struct filedesc filed;
Uname = user_from_uid(kp->ki_uid, 0);
Pid = kp->ki_pid;
@@ -331,7 +330,7 @@ dofiles(struct kinfo_proc *kp)
if (kp->ki_fd == NULL)
return;
- if (!KVM_READ(kp->ki_fd, &filed0, sizeof (filed0))) {
+ if (!KVM_READ(kp->ki_fd, &filed, sizeof (filed))) {
dprintf(stderr, "can't read filedesc at %p for pid %d\n",
(void *)kp->ki_fd, Pid);
return;
@@ -360,16 +359,13 @@ dofiles(struct kinfo_proc *kp)
*/
#define FPSIZE (sizeof (struct file *))
ALLOC_OFILES(filed.fd_lastfile+1);
- if (filed.fd_nfiles > NDFILE) {
- if (!KVM_READ(filed.fd_ofiles, ofiles,
- (filed.fd_lastfile+1) * FPSIZE)) {
- dprintf(stderr,
- "can't read file structures at %p for pid %d\n",
- (void *)filed.fd_ofiles, Pid);
- return;
- }
- } else
- bcopy(filed0.fd_dfiles, ofiles, (filed.fd_lastfile+1) * FPSIZE);
+ if (!KVM_READ(filed.fd_ofiles, ofiles,
+ (filed.fd_lastfile+1) * FPSIZE)) {
+ dprintf(stderr,
+ "can't read file structures at %p for pid %d\n",
+ (void *)filed.fd_ofiles, Pid);
+ return;
+ }
for (i = 0; i <= filed.fd_lastfile; i++) {
if (ofiles[i] == NULL)
continue;
OpenPOWER on IntegriCloud