.\" @(#)devname.3 8.2 (Berkeley) 4/29/95
.\" $FreeBSD: src/lib/libc/gen/devname.3,v 1.11 2001/10/01 16:08:50 ru Exp $
.\"
-.Dd April 29, 1995
+.Dd October 25, 2004
.Dt DEVNAME 3
.Os
.Sh NAME
-.Nm devname
+.Nm devname ,
+.Nm devname_r
.Nd get device name
.Sh LIBRARY
.Lb libc
.In sys/stat.h
.In stdlib.h
.Ft char *
-.Fn devname "dev_t dev" "mode_t type"
+.Fo devname
+.Fa "dev_t dev"
+.Fa "mode_t type"
+.Fc
+.Ft char *
+.Fo devname_r
+.Fa "dev_t dev"
+.Fa "mode_t type"
+.Fa "char *buf"
+.Fa "int len"
+.Fc
.Sh DESCRIPTION
The
.Fn devname
.Fa dev ,
and a file type matching the one encoded in
.Fa type
-which must be one of S_IFBLK or S_IFCHR.
+which must be one of
+.Dv S_IFBLK
+or
+.Dv S_IFCHR .
If no device matches the specified values, or no information is
available, NULL is returned.
.Pp
+The
+.Fn devname
+function uses a static buffer, which will be overwritten
+on subsequent calls.
+The
+.Fn devname_r
+functions takes a buffer and length as arguments to avoid this problem.
+.Pp
The traditional display for applications when no device is
found is the string
.Dq ?? .