05-04-2011
Perderabo,
First, thanks man! Second, I do like your sense of humor. Third, I know about /dev, what I've ben asking, how to figure out that I need this or that major number. Is it something that you simply know/remember as a result of long experience, or there's some place where it all is mapped out?
Again, thanks for explaining "awk" statement. It appears like a very flexible tool, I'm going to spend some time on it.
4 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I am looking for a guide on how to program for either the Linux or FreeBSD (includes 4.4BSD, NetBSD or OpenBSD) kernel. I would prefer to learn how to write device drivers, but anything would help.
If you know, please email me at *removed* or leave a post here
Regards,
Farhan (0 Replies)
Discussion started by: Farhan
0 Replies
2. Solaris
I've been researching minimizeing Solaris 8 and found that on the web page http://www.sun.com/bigadmin/content/packagelist/s8u7PkgList/p2.html the package SUNWglmr
is listed as "rasctrl environment monitoring driver for i2c, (Root) (32-bit)" while in the document "Solaris 8 minimize-updt1.pdf"... (1 Reply)
Discussion started by: roygoodwin
1 Replies
3. Linux
I recently started working with Linux and wrote my first device driver for a hardware chip controlled by a host CPU running Linux 2.6.x kernel.
1. The user space process makes an IOCTL call with pointer to a user memory buffer.
2. The kernel device driver in the big switch-case of IOCTL,... (1 Reply)
Discussion started by: agaurav
1 Replies
4. UNIX for Advanced & Expert Users
Hi all!
I am trying to register a device in an existing device class, but I am
having trouble getting the pointer to an existing class.
I can create a class in a module, get the pointer to it and then use
it to register the device with:
*cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies
LEARN ABOUT POSIX
getmajor
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)