分类: LINUX
2011-02-10 15:18:46
关于dev_t,主设备号,次设备号
The Internal Representation of Device Numbers
Within the kernel, the dev_t type (defined in
MAJOR(dev_t dev);
MINOR(dev_t dev);
If, instead, you have the major and minor numbers and need to turn them into a dev_t,
use:
MKDEV(int major, int minor);
Note that the 2.6 kernel can accommodate a vast number of devices, while previous kernel versions were limited to 255 major and 255 minor numbers. One assumes that the wider range will be sufficient for quite some time, but the computing field is littered with erroneous assumptions of that nature. So you should expect that the format of dev_t could change again in the future; if you write your drivers carefully, however, these changes will not be a problem.
在kernel中让用户空间的进程core dump
给用户空间的进程发SIGBUS信号就可以,进程收到SIGBUS的默认动作就是core dump。