aboutsummaryrefslogtreecommitdiff
path: root/bin/ps
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2011-09-28 18:53:36 +0000
committerEd Schouten <ed@FreeBSD.org>2011-09-28 18:53:36 +0000
commit9f365aa1d6aab0aca269b54fb5d216ac0e31a06f (patch)
treeefc748c3ad32a5751cb0627cfa2b151f69147a78 /bin/ps
parent7d6060bd9c798d0dbf8310c48f82630d204e4fbe (diff)
downloadsrc-9f365aa1d6aab0aca269b54fb5d216ac0e31a06f.tar.gz
src-9f365aa1d6aab0aca269b54fb5d216ac0e31a06f.zip
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).
Notes
Notes: svn path=/head/; revision=225847
Diffstat (limited to 'bin/ps')
-rw-r--r--bin/ps/print.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 7d1d1902b9b3..beb6f5205735 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -392,17 +392,13 @@ tdev(KINFO *k, VARENT *ve)
{
VAR *v;
dev_t dev;
- char buff[16];
v = ve->var;
dev = k->ki_p->ki_tdev;
if (dev == NODEV)
(void)printf("%*s", v->width, "??");
- else {
- (void)snprintf(buff, sizeof(buff),
- "%d/%d", major(dev), minor(dev));
- (void)printf("%*s", v->width, buff);
- }
+ else
+ (void)printf("%#*jx", v->width, (uintmax_t)dev);
}
void