qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-discuss] Fwd: Why iocl with RNDGETENTCNT does not work?


From: Marco Aurélio Lopes Barbosa
Subject: [Qemu-discuss] Fwd: Why iocl with RNDGETENTCNT does not work?
Date: Tue, 3 Oct 2017 07:50:21 -0300

Hello,

Consider the following program

#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/random.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
    int success = 0;
    int fd = open("/dev/urandom", O_RDONLY);
    if (fd != -1)
    {
        int entropy;
        if (ioctl(fd, RNDGETENTCNT, &entropy) == -1)
        {
            printf("ioctl failed");
        } else {
            printf("ioctl ok");
        }
        close(fd);
    }
    else
    {
        printf("open failed");
    }
    return 0;
}


When I run this program with qemu-x86_64-static I got the error

Unsupported ioctl: cmd=0xffffffff80045200
ioctl failed

But it works fine if the program is executed without qemu.

I compiled the program in a x86_64 box with gcc.

Am I doing something wrong?

I've patched qemu to forward the iocl with RNDGETENTCNT  to the host and it
worked as expected. Can someone explain me why this does not work out of
the box?

Thanks.

-- 
Marco A L Barbosa
http://malbarbo.pro.br
--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]