dj_ukyo 发表于 2015-04-29 09:14

ZERO_SIZE_PTR的定义

在slab代码当中有如下的定义
/*
* ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
*
* Dereferencing ZERO_SIZE_PTR will lead to a distinct access fault.
*
* ZERO_SIZE_PTR can be passed to kfree though in the same way that NULL can.
* Both make kfree a no-op.
*/
#define ZERO_SIZE_PTR ((void *)16)
我的问题,这个16是怎么来的?

nswcfd 发表于 2015-04-29 11:30

如果只是作为一个特殊的标记的话,感觉不一定非得是(void *)16,(void *)1或者(void *)256都可以。
只要不跟正常的虚地址重合就可以。
页: [1]
查看完整版本: ZERO_SIZE_PTR的定义