技术解析
系统是 ubuntu14.04 ,内核是 3.13.0-24-generic ,编译过程基本是照着这个教程做的: http://www.franksthinktank.com/howto/addsyscall/ 然后编译时各种报语法错误,手工改了一个还会有另一个文件报错:
include/uapi/linux/random.h:37:1: error: expected ‘=’, ‘,’, ‘;’, ‘ asm ’ or ‘attribute’ before ‘ struct ’
我从官网下的内核好吗,打开源文件一看,虽然我 C 语言差,但是我还是能看出来那里本来就不需要符号吧
最神奇的是 2 个星期前,我做过一次完全一样的实验,那次什么问题都没有,是 ubuntu 在这两个星期内更新了编译器还是怎么回事= =
最后附报错的其中一个文件内容:
/*
* include/linux/random.h
*
* Include file for the random number generator.
*/
#ifndef _UAPI_LINUX_RANDOM_H
#define _UAPI_LINUX_RANDOM_H
#include
#include
#include
/* ioctl()'s for the random number generator */
/* Get the entropy count. */
#define RNDGETENTCNT _IOR( 'R', 0x00, int )
/* Add to (or subtract from) the entropy count. (Superuser only.) */
#define RNDADDTOENTCNT _IOW( 'R', 0x01, int )
/* Get the contents of the entropy pool. (Superuser only.) */
#define RNDGETPOOL _IOR( 'R', 0x02, int [2] )
/*
* Write bytes into the entropy pool and add to the entropy count.
* (Superuser only.)
*/
#define RNDADDENTROPY _IOW( 'R', 0x03, int [2] )
/* Clear entropy count to 0. (Superuser only.) */
#define RNDZAPENTCNT _IO( 'R', 0x04 )
/* Clear the entropy pool and associated counters. (Superuser only.) */
#define RNDCLEARPOOL _IO( 'R', 0x06 )
struct rand_pool_info {
int entropy_count;
int buf_size;
__u32 buf[0];
};
#endif /* _UAPI_LINUX_RANDOM_H */