Bug 19179

Summary: patch to fix display of dev_t's in sysctl(8)
Product: Base System Reporter: kbyanc <kbyanc>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description kbyanc 2000-06-10 20:50:01 UTC
	Sysctl(8) attempts to display devices in human-readable format
	using major/minor numbers. However, the kernel uses all ones to
	indicate 'no device' (i.e. kern.dumpdev if no dump device is
	configured for crash dumps). Currently sysctl has no knowledge of
	this and displays a nonsensicle device number.

	Similarly, sysctl uses the minor() macro to get the minor device
	number from a dev_t. However, minor returns a 'cookie' that may
	have it's high bit set. In which case, sysctl currently displays a
	negative value for the minor number.

	This patch fixes sysctl to display the major/minor numbers the
	same way they are in ls(1), switching to hexidecimal when the
	minor cookie looks more like a cookie than a recognizable
	minor number. It also teaches sysctl(8) about the special case
	where dev_t is all ones.

	Note to committer: while you are reviewing this, please also
	review PR kern/15251 (assuming it is still not closed). It adds
	comprehensive unsigned sysctl support to the kernel and teaches
	sysctl(8) how to display unsigned sysctl values. Thanks.

	-Kelly
	 kbyanc@posi.net

How-To-Repeat: 
	sysctl -a | grep dev
Comment 1 Poul-Henning Kamp freebsd_committer freebsd_triage 2000-06-10 20:55:51 UTC
State Changed
From-To: open->closed

committed, thanks!