man pages section 9: DDI and DKI Kernel Functions
  Cerca solo questo libro
Scarica il manuale in formato PDF (3618 KB)

getmajor(9F)

Name | Synopsis | Interface Level | Parameters | Description | Return Values | Context | Examples | See Also | Warnings

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).

Parameters

    dev

    Device number.

Description

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

Return Values

    The major number.

Context

    The getmajor() function can be called from user, interrupt, or kernel context.

Examples


    Example 1 Using getmajor()

    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

Warnings

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

SunOS 5.11  Last Revised 16 Jan 2006

Name | Synopsis | Interface Level | Parameters | Description | Return Values | Context | Examples | See Also | Warnings