[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    getmajor(9F) manual page Table of Contents

Name

getmajor - get major device number

Synopsis


#include <sys/types.h>
#include <sys/mkdev.h>
#include <sys/ddi.h>

major_t getmajor(dev_t dev);

Interface Level

Architecture independent level 1 (DDI/DKI).

Arguments

dev
Device number.

Description

getmajor() extracts the major number from a device number.

Return Values

The major number.

Context

getmajor() can be called from user or interrupt context.

Example

The following example shows both the getmajor() and getminor(9F) functions used in a debug cmn_err(9F) statement to return the major and minor numbers for the device supported by the driver.


dev_t dev;
#ifdef DEBUG 
cmn_err(CE_NOTE,"Driver Started.  Major# = %d,
    Minor# = %d", getmajor(dev), getminor(dev));
#endif

See Also

cmn_err(9F) , getminor(9F) , makedevice(9F)

Warnings

No validity checking is performed. If dev is invalid, an invalid number is returned.


Table of Contents