- 论坛徽章:
- 3
|
原帖由 Godbach 于 2008-7-24 16:22 发表 ![]()
多谢兄弟指点。不过这里的-1000L应该是十进制的。-0x1000转换出来正好是0xFFFF0000,也就是一个Page通常用4K,这里要保留最后一个page。因此指针指向的地址不能大于0xFFFF0000. 这个是2.6内核中的。
2.4的 ...
/*
* Kernel pointers have redundant information, so we can use a
* scheme where we can return either an error code or a dentry
* pointer with the same return value.
*
* This should be a per-architecture thing, to allow different
* error and pointer decisions.
*/
#define MAX_ERRNO 4095
#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
static inline void *ERR_PTR(long error)
{
return (void *) error;
}
static inline long PTR_ERR(const void *ptr)
{
return (long) ptr;
}
static inline long IS_ERR(const void *ptr)
{
return IS_ERR_VALUE((unsigned long)ptr);
}
#endif /* _LINUX_ERR_H */
2.6.18里面这个值变了。 |
|