summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/devname.3
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-06-20 09:52:27 +0000
committerphk <phk@FreeBSD.org>2003-06-20 09:52:27 +0000
commit9dbf18e1187c8ae01aea93f7fb0cf83ca2cbad6d (patch)
tree2d55c9b273c19713662748839742679a5c3db336 /lib/libc/gen/devname.3
parent4d61d2249d5799c859f3007fbbd4eca0b9d4a361 (diff)
downloadFreeBSD-src-9dbf18e1187c8ae01aea93f7fb0cf83ca2cbad6d.zip
FreeBSD-src-9dbf18e1187c8ae01aea93f7fb0cf83ca2cbad6d.tar.gz
Add devname_r(3) which takes a buffer as argument.
Diffstat (limited to 'lib/libc/gen/devname.3')
-rw-r--r--lib/libc/gen/devname.320
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/libc/gen/devname.3 b/lib/libc/gen/devname.3
index 83952dc..f25e7da 100644
--- a/lib/libc/gen/devname.3
+++ b/lib/libc/gen/devname.3
@@ -45,6 +45,8 @@
.In stdlib.h
.Ft char *
.Fn devname "dev_t dev" "mode_t type"
+.Ft char *
+.Fn devname_r "dev_t dev" "mode_t type" "char *buf" "int len"
.Sh DESCRIPTION
The
.Fn devname
@@ -61,27 +63,25 @@ or
.Dv S_IFCHR .
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
+asks the kernel via the
.Va kern.devname
sysctl.
-If it was still unable to come up with a suitable name,
+If it is 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.
+.Pp
+.Fn devname
+returns the name stored in a static buffer which will be overwritten
+on subsequent calls.
+.Fn devname_r
+takes a buffer and length as argument to avoid this problem.
.Sh SEE ALSO
.Xr stat 2 ,
-.Xr dev_mkdb 8
.Sh HISTORY
The
.Fn devname
function appeared in
.Bx 4.4 .
-.Sh BUGS
-The
-.Fn devname
-function returns a pointer to an internal static object;
-thus, subsequent calls will modify the same buffer.
OpenPOWER on IntegriCloud