[lkml]   [2004]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectrandom ioctls - are they supposed to be like this?
include/linux/random.h has:

#define RNDADDENTROPY _IOW( 'R', 0x03, int [2] )
#define RNDGETPOOL _IOR( 'R', 0x02, int [2] )

However, these seem to be used differently in practice.
For example, the one user of RNDADDENTROPY I find does:

struct {
int ent_count;
int size;
unsigned char data[size];
} entropy;

if (ioctl(fd, RNDADDENTROPY, &entropy) != 0) {

And, looking at the random driver, it does appear to expect
this format.

Now, RNDGETPOOL in the kernel does:

if (get_user(size, p) ||
put_user(random_state->poolinfo.poolwords, p++))
return -EFAULT;
if (!copy_to_user(p, tmp, size * sizeof(__u32))) {
if(put_user(ent_count, p++))
return -EFAULT;

Which obviously isn't going to work right if you
just pass in a two-int structure.

Am I reading this wrong, or are callers just supposed
to know to use the other interface?

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:05    [W:0.018 / U:1.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site