Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

makedevice(9f) [mojave man page]

makedevice(9F)                                             Kernel Functions for Drivers                                             makedevice(9F)

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)

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)
Man Page

13 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Accept user input - only numbers

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)
Discussion started by: pvar
1 Replies

2. Programming

Device Major/Minor numbers

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)
Discussion started by: zazzybob
1 Replies

3. UNIX for Dummies Questions & Answers


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)
Discussion started by: lo-lp-kl
2 Replies

4. UNIX for Dummies Questions & Answers

How to reuse same major number

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)
Discussion started by: Agnello
0 Replies

5. UNIX for Dummies Questions & Answers

how can i add two numbers

hi, i am having one file which looks like the one below: ABC1 *** 1 4 ABC2 *** 7 12 ABC3 *** 0 34 ... (4 Replies)
Discussion started by: kripssmart
4 Replies

6. Solaris

Help with Major and minor number

Hi Does anyone know what the major and minor numbers are in Solaris? (2 Replies)
Discussion started by: wisdom
2 Replies

7. AIX

how do I change major-minor numbers of disk devices

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)
Discussion started by: zxmaus
2 Replies

8. AIX

VG major number in HACMP

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 to overcome this situation..? shan (3 Replies)
Discussion started by: to_bsr
3 Replies

9. Shell Programming and Scripting

How to take set of numbers?

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)
Discussion started by: VishBoy
3 Replies

10. UNIX for Dummies Questions & Answers

"Playing" with numbers

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)
Discussion started by: cosmologist
2 Replies

11. Solaris

Major and Minor number of Virtual File System

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)
Discussion started by: nitj
8 Replies

12. AIX

AIX: mkdev is waiting in kernel at et_wait

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)
Discussion started by: Muppana Prasad
1 Replies

13. Shell Programming and Scripting

Lottery number checker

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)
Discussion started by: gsiva
9 Replies

Featured Tech Videos