Chinaunix首页 | 论坛 | 博客
  • 博客访问: 193541
  • 博文数量: 40
  • 博客积分: 1031
  • 博客等级: 少尉
  • 技术积分: 321
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-18 11:35
文章分类
文章存档

2022年(1)

2020年(1)

2017年(1)

2016年(5)

2015年(1)

2013年(1)

2011年(13)

2010年(16)

2009年(1)

我的朋友

分类: LINUX

2011-02-10 15:18:46

关于dev_t,主设备号,次设备号
The Internal Representation of Device Numbers

   Within the kernel, the dev_t type (defined in ) is used to hold device numbers—both the major and minor parts. As of Version 2.6.0 of the kernel, dev_t is a 32-bit quantity with 12 bits set aside for the major number and 20 for the minor number. Your code should, of course, never make any assumptions about the internal organization of device numbers; it should, instead, make use of a set of macros found in . To obtain the major or minor parts of a dev_t, use:
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。

阅读(1747) | 评论(1) | 转发(0) |
0

上一篇:读写块设备

下一篇:ubuntu xorg config file

给主人留下些什么吧!~~