Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1225949
  • 博文数量: 479
  • 博客积分: 12240
  • 博客等级: 上将
  • 技术积分: 4999
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-24 17:12
文章分类

全部博文(479)

文章存档

2014年(1)

2013年(1)

2012年(1)

2011年(95)

2010年(177)

2009年(167)

2008年(16)

2007年(21)

分类: LINUX

2009-12-22 08:36:34


在新近内核驱动中发现一个新的函数,函数原型如下:
(见include/linux/slab.h)

 299/**
 300 * kzalloc - allocate memory. The memory is set to zero.
 301 * @size: how many bytes of memory are required.
 302 * @flags: the type of memory to allocate (see kmalloc).
 303 */
 304static  void *( ,  )
 305{
 306        return (,  | );
 307}

从注释也可以知道,就是在进行内存块的时候,同时用0进行初始化,比先用kmalloc申请内存然后用memset进行初始化方便多了。

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

上一篇:《Ubuntu Linux指南》

下一篇:GPO_00使用

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