| DEVNAME(3) | Library Functions Manual | DEVNAME(3) | 
devname, devname_r —
#include <stdlib.h>
#include <sys/stat.h>
char *
  
  devname(dev_t
    dev, mode_t
  type);
int
  
  devname_r(dev_t
    dev, mode_t type,
    char *path,
    size_t len);
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 nul-terminated.
The traditional display for applications when no device is found is the string “??”.
devname() returns a pointer to a
  nul-terminated string containing the name of the device. If an error occurs
  devname will return NULL.
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.
devname_r() function may fail if:
devname function call appeared in
  4.4BSD.
The devname_r() function first appeared in
    NetBSD 6.0.
| September 9, 2017 | NetBSD 9.4 |