From 2a84e78d2ee67e2efdc4107a8a067cca7f435e1c Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 28 Sep 2011 18:53:36 +0000 Subject: Get rid of major/minor number distinction. As of FreeBSD 6, devices can only be opened through devfs. These device nodes don't have major and minor numbers anymore. The st_rdev field in struct stat is simply based a copy of st_ino. Simply display device numbers as hexadecimal, using "%#jx". This is allowed by POSIX, since it explicitly states things like the following (example taken from ls(1)): "If the file is a character special or block special file, the size of the file may be replaced with implementation-defined information associated with the device in question." This makes the output of these commands more compact. For example, ls(1) now uses approximately four columns less. While there, simplify the column length calculation from ls(1) by calling snprintf() with a NULL buffer. Don't be afraid; if needed one can still obtain individual major/minor numbers using stat(1). --- usr.sbin/pstat/pstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr.sbin/pstat') diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index 5435166..2017841 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -345,7 +345,7 @@ ttyprt(struct xtty *xt) errx(1, "struct xtty size mismatch"); if (usenumflag || xt->xt_dev == 0 || (name = devname(xt->xt_dev, S_IFCHR)) == NULL) - printf("%5d,%4d ", major(xt->xt_dev), minor(xt->xt_dev)); + printf("%#10jx ", (uintmax_t)xt->xt_dev); else printf("%10s ", name); printf("%5zu %4zu %4zu %4zu %5zu %4zu %4zu %5u %5d %5d ", -- cgit v1.1