GETDEVMAJOR(3) | Library Functions Manual | GETDEVMAJOR(3) |
getdevmajor
—
#include <stdlib.h>
#include <sys/stat.h>
devmajor_t
getdevmajor
(const
char *name, mode_t
type);
getdevmajor
() function returns the major device
number of the block or character device specified by
name and a file type matching the one encoded in
type which must be one of
S_IFBLK
or S_IFCHR
.
NODEVMAJOR
is returned and
errno is set to indicate the error.
#include <stdlib.h> #include <sys/stat.h> devmajor_t pts; pts = getdevmajor("pts", S_IFCHR);
To retrieve the major numbers for the block and character wd(4) devices:
#include <stdlib.h> #include <sys/stat.h> devmajor_t c, b; c = getdevmajor("wd", S_IFCHR); b = getdevmajor("wd", S_IFBLK);
getdevmajor
() function may fail and set
errno for any of the errors specified for the library
functions malloc(3) and
sysctlbyname(3). In
addition, the following errors may be reported:
getdevmajor
() function call appeared in
NetBSD 3.0.
January 20, 2009 | NetBSD 9.0 |