makedevice(9F) Kernel Functions for Drivers makedevice(9F)NAME
makedevice - make device number from major and minor numbers
SYNOPSIS
#include <sys/types.h>
#include <sys/mkdev.h>
#include <sys/ddi.h>
dev_t makedevice(major_t majnum, minor_t minnum);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
majnum Major device number.
minnum Minor device number.
DESCRIPTION
makedevice() creates a device number from a major and minor device number. makedevice() should be used to create device numbers so the
driver will port easily to releases that treat device numbers differently.
RETURN VALUES
The device number, containing both the major number and the minor number, is returned. No validation of the major or minor numbers is per-
formed.
CONTEXT
makedevice() can be called from user or interrupt context.
SEE ALSO getmajor(9F), getminor(9F)SunOS 5.10 11 Apr 1991 makedevice(9F)
Check Out this Related Man Page
getmajor(9F) Kernel Functions for Drivers getmajor(9F)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
getmajor() extracts the major number from a device number.
RETURN VALUES
The major number.
CONTEXT
getmajor() can be called from user or interrupt 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 cmn_err(9F), getminor(9F), makedevice(9F)
Writing Device Drivers
WARNINGS
No validity checking is performed. If dev is invalid, an invalid number is returned.
SunOS 5.10 11 Apr 1991 getmajor(9F)
I have a situation where I want the user to enter only numbers in response to a READ command. I have some validation to restrict the number to be between 1 and 12, but if the user type in some characters the script echoes some error message and goes to the next command. Below is a snippet of the... (1 Reply)
To further my fledgling knowledge of C, I am re-writing some of the Unix command set. My current command is an ls-style command.
All works well, except for device files. How do I get the major/minor numbers for the dev files?
I see from the stat struct there are st_rdev and st_dev members. Do... (1 Reply)
Hello
I installed solaris 9, but when I reboot the box, I got this message
WARNING:add_spec:No major number for mpt
WARNING:add_spec:No major number for mpt
WARNING:add_spec:No major number for mpt
WARNING:add_spec:No major number for mpt
WARNING:add_spec:No major number for mpt
... (2 Replies)
Hi,
I am working on device drivers.Once If register a device i'll get one major no. If i unregister and register again i'll get a different major no.What i have to do to get same major no. each time :( (0 Replies)
Good evening ...
does anyone of you know how to change major/minor numbers of disk devices ?
I had to migrate from raid1 to raid5 and this messed up my ASM cluster - I know which devices should have which IDs to match the content - but I have no idea how to change it.
Any help would be... (2 Replies)
HI All,
I would like to know is it compulsory to keep major number of shared VG's on cluster nodes to be same..?
I have come across a situation where on one node major number of shared vg is the major number of altinst_rootvg on other node..how to overcome this situation..?
shan (3 Replies)
I have to take a list of numbers from the keyboard and not by passing arguments. How will I read a set of numbers in such a way that I can use any number I wish to operate upon. Is there any specific command to do so. As said before I dont want to pass the numbers as arguments from command line.... (3 Replies)
I am wondering if there is a way to create a file like this somehow without having to type it line by line... It becomes a torture to obtain such a file when i am dealing with large numbers, it would take forever to type line by line (which I did a couple of times, after failing to come up with a... (2 Replies)
Hi friends, Please let me know if there is any way to find out Major and Minor numbers of virtual file system like below:
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K ... (8 Replies)
Hi All,
bash-3.2# ps -eaf | grep mkdev
root 4378752 1548526 0 03:27:04 - 0:00 /usr/sbin/mkdev -c disk -s vscsi -t xyz -l virtualdev
bash-3.2#
Here we are trying to create a virtual device using mkdev and the device is already populated in the namespace and the corresponding ODMs... (1 Reply)
hi ,
Let me put it in a different way with words.
Assume the lottery have numbers from 1-50.
Out of this 50 numbers, I am going to pick up only 35 numbers randomly.
so, my total numbers would be 35 numbers shuffled from nos.
I have list of winning numbers in file.
Now, the... (9 Replies)