- NetBSD Manual Pages
DEVNAME(3) NetBSD Library Functions Manual DEVNAME(3)
Powered by man-cgi (2020-09-24).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
devname, devname_r -- get device name
Standard C Library (libc, -lc)
devname(dev_t dev, mode_t type);
devname_r(dev_t dev, mode_t type, char *path, size_t len);
The devname() function returns a pointer to the static buffer with the
name of the block or character device in ``/dev'' with a device number of
dev, and a file type matching the one encoded in 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.
The devname_r() function is a reentrant and thread-safe version of
devname(). This function returns the device name by copying it into the
path argument with up to len characters. The path argument is always
The traditional display for applications when no device is found is the
If successful, devname() returns a pointer to a nul-terminated string
containing the name of the device. If an error occurs devname will
If successful, devname_r() places a nul-terminated string containing the
name of the device in the buffer pointed to by path and returns 0. If an
error occurs devname_r() will return an error number from <sys/errno.h>
indicating what went wrong.
/var/run/dev.cdb Device database file.
The devname_r() function may fail if:
[ENOENT] The corresponding device does not exist.
[ERANGE] The passed buffer length is too short.
The devname function call appeared in 4.4BSD.
The devname_r() function first appeared in NetBSD 6.0.
NetBSD 9.99 September 9, 2017 NetBSD 9.99