diff options
Diffstat (limited to 'lib/libc/gen/devname.3')
-rw-r--r-- | lib/libc/gen/devname.3 | 20 |
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. |