From f04938aa8ec450549860e700a68d93ff726e5cc6 Mon Sep 17 00:00:00 2001
From: Dima Dorfman
Date: Mon, 18 Mar 2002 02:32:53 +0000
Subject: [PATCH] Update to reflect reality; devname(3) hasn't returned NULL on
failure since revision 1.2 of devname.c (1999/07/18). While I'm here, note,
in the BUGS section, that the returned pointer is to a static buffer.
---
lib/libc/gen/devname.3 | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/lib/libc/gen/devname.3 b/lib/libc/gen/devname.3
index ccc60c5a191c..6904a897257b 100644
--- a/lib/libc/gen/devname.3
+++ b/lib/libc/gen/devname.3
@@ -56,12 +56,19 @@ with a device number of
and a file type matching the one encoded in
.Fa type
which must be one of S_IFBLK or S_IFCHR.
-If no device matches the specified values, or no information is
-available, NULL is returned.
-.Pp
-The traditional display for applications when no device is
-found is the string
-.Dq ?? .
+To find the right name,
+.Fn devname
+first searches the device database created by
+.Xr dev_mkdb 8 ;
+if that fails, it asks the kernel via the
+.Va kern.devname
+sysctl.
+If it was still unable to come up with a suitable name,
+it will format the information encapsulated in
+.Fa dev
+and
+.Fa type
+in a human-readable format.
.Sh SEE ALSO
.Xr stat 2 ,
.Xr dev_mkdb 8
@@ -70,3 +77,8 @@ The
.Fn devname
function call appeared in
.Bx 4.4 .
+.Sh BUGS
+The
+.Fn devname
+function returns a poiner to an internal static object;
+thus, subsequent calls will modify the same buffer.