我有一个设备会产生一些噪音,我想将它添加到嵌入式Linux系统中/ dev/random设备的熵池中.
我正在阅读/ dev/random上的手册页,我真的不明白你传递给RNDADDENTROPY ioctl调用的结构.
RNDADDENTROPY
Add some additional entropy to the input pool, incrementing
the entropy count. This differs from writing to /dev/random
or /dev/urandom, which only adds some data but does not
increment the entropy count. The following structure is used:
struct rand_pool_info {
int entropy_count;
int buf_size;
__u32 buf[0];
};
Here entropy_count is the value added to (or subtracted from)
the entropy count, and buf is the buffer of size buf_size
which gets added to the entropy pool.
就是entropy_count在这种结构中,我加入的位数?为什么不总是这样buf_size * 8(假设buf_size是以字节为单位)?
另外为什么是buf零尺寸阵列?我该如何为它分配一个值?
感谢您的帮助!