getdevmajor man page on Minix

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

GETDEVMAJOR(3)		 BSD Library Functions Manual		GETDEVMAJOR(3)

NAME
     getdevmajor — get block or character device major number

LIBRARY
     Standard C Library (libc, -lc)

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

     devmajor_t
     getdevmajor(const char *name, mode_t type);

DESCRIPTION
     The 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.

RETURN VALUES
     If no device matches the specified values, no information is available,
     or an error occurs, NODEVMAJOR is returned and errno is set to indicate
     the error.

EXAMPLES
     To retrieve the major number for pty(4) slave devices (aka pts devices):

	   #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);

ERRORS
     The 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:

     [EINVAL]		The value of the type argument is not S_IFCHR or
			S_IFBLK.

     [ENOENT]		The named device is not found.

SEE ALSO
     stat(2), devname(3), malloc(3), sysctlbyname(3)

HISTORY
     The getdevmajor() function call appeared in NetBSD 3.0.

BSD			       January 20, 2009				   BSD
[top]

List of man pages available for Minix

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]
Tweet
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