devname_r man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

DEVNAME(3)		 BSD Library Functions Manual		    DEVNAME(3)

     devname, devname_r, fdevname, fdevname_r — get device name

     Standard C Library (libc, -lc)

     #include <sys/stat.h>
     #include <stdlib.h>

     char *
     devname(dev_t dev, mode_t type);

     char *
     devname_r(dev_t dev, mode_t type, char *buf, size_t len);

     char *
     fdevname(int fd);

     fdevname_r(int fd, char *buf, size_t len);

     The devname() and devname_r() functions return a pointer to 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.  To find the right name, devname() and devname_r() first
     search the device database created by dev_mkdb(8); if that fails, it will
     format the information encapsulated in dev and type in a human-readable

     The fdevname() and fdevname_r() function obtain the device name directly
     from a file descriptor pointing to a character device.

     devname() and fdevname() returns a pointer to an internal static object;
     thus, subsequent calls will modify the same buffer.  devname_r() and
     fdevname_r() avoid this problem by taking a buffer buf and a buffer
     length len as arguments.

     The devname(), devname_r() and fdevname() functions return a pointer to
     the name of the block or character device in /dev if successful; other‐
     wise NULL is returned.  If fdevname() fails, errno is set to indicate the

     The fdevname_r() function returns 0 if successful.	 Otherwise an error
     number is returned.

     The fdevname() and fdevname_r() functions may fail and return the follow‐
     ing error codes:

     [EBADF]		The fd is not a valid open file descriptor.

     [EINVAL]		The fd must belong to a character device.

     The fdevname_r() function may fail and return the following error code:

     [ERANGE]		The len argument is smaller than the length of the
			string to be returned.

     stat(2), dev_mkdb(8)

     The devname() function appeared in 4.4BSD.

     The devname_r() function appeared in DragonFly 1.0 and the fdevname() and
     fdevname_r() functions appeared in DragonFly 2.3.

BSD				August 11, 2009				   BSD

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net