Query: getmajor
OS: minix
Section: 9f
Links: minix man pages all man pages
Forums: forum home forum categories
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
getmajor(9F) Kernel Functions for Drivers getmajor(9F)NAMEgetmajor - get major device numberSYNOPSIS#include <sys/types.h> #include <sys/mkdev.h> #include <sys/ddi.h> major_t getmajor(dev_t dev);INTERFACE LEVELArchitecture independent level 1 (DDI/DKI).PARAMETERSdev Device number.DESCRIPTIONgetmajor() extracts the major number from a device number.RETURN VALUESThe major number.CONTEXTgetmajor() can be called from user or interrupt context.EXAMPLESExample 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)); #endifSEE ALSOcmn_err(9F), getminor(9F), makedevice(9F) Writing Device DriversWARNINGSNo validity checking is performed. If dev is invalid, an invalid number is returned. SunOS 5.10 11 Apr 1991 getmajor(9F)