qemu-discuss
[Top][All Lists]
Advanced

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

[Qemu-discuss] how to acces a virtual device to a posix shared memory in


From: dykelin
Subject: [Qemu-discuss] how to acces a virtual device to a posix shared memory in the kernel module?
Date: Fri, 3 Feb 2012 22:49:42 +0800

Hi:
Every one!
Does anyone read this page:

http://www.giuseppecoviello.net/2010/11/vmshm-a-mechanism-for-accessing-to-p
osix-shared-memory-from-qemu-kvm-guests/

it create an pci device(vmshm) for guest linux ,and access to an posix
shared memory(share-with-qemu) on host linux,then can communication between
guest processes and host processes, on the guest there is a driver, than
when use can use like this:( userspace )

int fd = open("/dev/vshm0", O_RDWR);
if(fd < 0) {
    fprintf(stderr, "Cannot open device.\n");
    exit(0);
}
 
if(ioctl(fd, 0, "/shared-with-qemu") != 0) {
    fprintf(stderr, "Cannot map host's shared memory object.\n");
    exit(0);
}
 
char *shm = mmap(NULL, 1024 * 1024, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
0);

my question is if I want to use this in kernel module, how to come true? I
think we can use filp_open() to open the vmshm0, right? If so ,how to
"ioctl"(how to access to the posix shared memory)? it seems not a qemu
question , if we can not ask this question here ,please forgive me .





reply via email to

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