summaryrefslogtreecommitdiffstats
path: root/usr.bin/fstat
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2005-11-05 23:38:08 +0000
committercsjp <csjp@FreeBSD.org>2005-11-05 23:38:08 +0000
commit06f639fcfac5d9ba245d5a27d66a64bd14960cbf (patch)
treeee55cb9d74709c5bc9c61f9d22b0da2a9919a1ef /usr.bin/fstat
parent29221b42d977b1a2e6053190be35ec076a4a9aa0 (diff)
downloadFreeBSD-src-06f639fcfac5d9ba245d5a27d66a64bd14960cbf.zip
FreeBSD-src-06f639fcfac5d9ba245d5a27d66a64bd14960cbf.tar.gz
Un-break processing of device major/minor values with fstat -n. We do
this by accessing the cdev_priv element of the cdev structure. Looking forward we need a better way to handle this, as this structure shouldn't be frobbed by userspace. Submitted by: Doug Steinwand PR: bin/88203 MFC after: 1 week Discussed with: phk
Diffstat (limited to 'usr.bin/fstat')
-rw-r--r--usr.bin/fstat/fstat.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
index 9c24797..b6c0901 100644
--- a/usr.bin/fstat/fstat.c
+++ b/usr.bin/fstat/fstat.c
@@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
#include <fs/devfs/devfs.h>
+#include <fs/devfs/devfs_int.h>
#undef _KERNEL
#include <nfs/nfsproto.h>
#include <nfs/rpcv2.h>
@@ -885,11 +886,12 @@ bad:
dev_t
dev2udev(struct cdev *dev)
{
+ struct cdev_priv priv;
struct cdev si;
- if (KVM_READ(dev, &si, sizeof si)) {
- /* XXX: FIXME! */
- return 0;
+ if (KVM_READ(dev, &si, sizeof si) &&
+ KVM_READ(si.si_priv, &priv, sizeof priv)) {
+ return ((dev_t)priv.cdp_inode);
} else {
dprintf(stderr, "can't convert cdev *%p to a dev_t\n", dev);
return -1;
OpenPOWER on IntegriCloud