|
NAMEdevname —
get device name
LIBRARYStandard C Library (libc, -lc)SYNOPSIS#include <sys/stat.h>
#include <stdlib.h>
char *
char *
char *
char *
DESCRIPTIONThedevname () function returns 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 () asks the kernel via the
kern.devname sysctl. If it is unable to come up with a
suitable name, it will format the information encapsulated in
dev and type in a human-readable
format.
The
EXAMPLESint fd; struct stat buf; char *name; fd = open("/dev/tun"); fstat(fd, &buf); printf("devname is /dev/%s\n", devname(buf.st_rdev, S_IFCHR)); printf("fdevname is /dev/%s\n", fdevname(fd)); SEE ALSOstat(2)HISTORYThedevname () function appeared in
4.4BSD. The fdevname ()
function appeared in FreeBSD 8.0.
Visit the GSP FreeBSD Man Page Interface. |