Deleted Added
full compact
fstat.c (130489) fstat.c (130640)
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

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

38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)fstat.c 8.3 (Berkeley) 5/2/95";
43#endif
44#endif /* not lint */
45#include <sys/cdefs.h>
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

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

38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)fstat.c 8.3 (Berkeley) 5/2/95";
43#endif
44#endif /* not lint */
45#include <sys/cdefs.h>
46__FBSDID("$FreeBSD: head/usr.bin/fstat/fstat.c 130489 2004-06-14 20:54:18Z rwatson $");
46__FBSDID("$FreeBSD: head/usr.bin/fstat/fstat.c 130640 2004-06-17 17:16:53Z phk $");
47
48#include <sys/param.h>
49#include <sys/time.h>
50#include <sys/proc.h>
51#include <sys/user.h>
52#include <sys/stat.h>
53#include <sys/vnode.h>
54#include <sys/socket.h>

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

580 struct inode inode;
581
582 if (!KVM_READ(VTOI(vp), &inode, sizeof (inode))) {
583 dprintf(stderr, "can't read inode at %p for pid %d\n",
584 (void *)VTOI(vp), Pid);
585 return 0;
586 }
587 /*
47
48#include <sys/param.h>
49#include <sys/time.h>
50#include <sys/proc.h>
51#include <sys/user.h>
52#include <sys/stat.h>
53#include <sys/vnode.h>
54#include <sys/socket.h>

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

580 struct inode inode;
581
582 if (!KVM_READ(VTOI(vp), &inode, sizeof (inode))) {
583 dprintf(stderr, "can't read inode at %p for pid %d\n",
584 (void *)VTOI(vp), Pid);
585 return 0;
586 }
587 /*
588 * The st_dev from stat(2) is a udev_t. These kernel structures
589 * contain dev_t structures. We need to convert to udev to make
588 * The st_dev from stat(2) is a dev_t. These kernel structures
589 * contain cdev pointers. We need to convert to dev_t to make
590 * comparisons
591 */
592 fsp->fsid = dev2udev(inode.i_dev);
593 fsp->fileid = (long)inode.i_number;
594 fsp->mode = (mode_t)inode.i_mode;
595 fsp->size = (u_long)inode.i_size;
596#if should_be_but_is_hard
597 /* XXX - need to load i_ump and i_din[12] from kernel memory */

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

870 printf("\n");
871 return;
872bad:
873 printf("* error\n");
874}
875
876
877/*
590 * comparisons
591 */
592 fsp->fsid = dev2udev(inode.i_dev);
593 fsp->fileid = (long)inode.i_number;
594 fsp->mode = (mode_t)inode.i_mode;
595 fsp->size = (u_long)inode.i_size;
596#if should_be_but_is_hard
597 /* XXX - need to load i_ump and i_din[12] from kernel memory */

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

870 printf("\n");
871 return;
872bad:
873 printf("* error\n");
874}
875
876
877/*
878 * Read the cdev structure in the kernel (as pointed to by a dev_t)
879 * in order to work out the associated udev_t
878 * Read the cdev structure in the kernel in order to work out the
879 * associated dev_t
880 */
880 */
881udev_t
881dev_t
882dev2udev(dev)
883 struct cdev *dev;
884{
885 struct cdev si;
886
887 if (KVM_READ(dev, &si, sizeof si)) {
888 return si.si_udev;
889 } else {
882dev2udev(dev)
883 struct cdev *dev;
884{
885 struct cdev si;
886
887 if (KVM_READ(dev, &si, sizeof si)) {
888 return si.si_udev;
889 } else {
890 dprintf(stderr, "can't convert dev_t %x to a udev_t\n", dev);
890 dprintf(stderr, "can't convert cdev *%x to a dev_t\n", dev);
891 return -1;
892 }
893}
894
895/*
896 * getinetproto --
897 * print name of protocol number
898 */

--- 44 unchanged lines hidden ---
891 return -1;
892 }
893}
894
895/*
896 * getinetproto --
897 * print name of protocol number
898 */

--- 44 unchanged lines hidden ---