Re: [PATCH 04/13] qemu-kvm: Remove eventfd compat header

Bernhard Held
2011-07-03T09:47:08Z

[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]

Am 28.06.2011 13:09, schrieb Michael S. Tsirkin:
> On Mon, Jun 27, 2011 at 08:19:47PM +0200, Jan Kiszka wrote:
>> From: Jan Kiszka<jan.kiszka@siemens.com>
>>
>> No longer used.
>>
>> Signed-off-by: Jan Kiszka<jan.kiszka@siemens.com>
>
> I think it's actually handy to build on old systems which have
> a recent enough kernel but not the header.
Yep, I'm running recent qemu-kvm and kernels on CentOS 5.6.

The current eventfd.h was handy in the beginning, but some day I had big
troubles with crashing qemu-kvm. It turned out that I had to switch from
eventfd to eventfd2. IIRC the old eventfd doesn't care about the flags.

My version of eventfd.h is attached.

Bernhard

>> ---
>> compat/sys/eventfd.h | 13 -------------
>> 1 files changed, 0 insertions(+), 13 deletions(-)
>> delete mode 100644 compat/sys/eventfd.h
>>
>> diff --git a/compat/sys/eventfd.h b/compat/sys/eventfd.h
>> deleted file mode 100644
>> index f55d96a..0000000
>> --- a/compat/sys/eventfd.h
>> +++ /dev/null
>> @@ -1,13 +0,0 @@
>> -#ifndef _COMPAT_SYS_EVENTFD
>> -#define _COMPAT_SYS_EVENTFD
>> -
>> -#include<unistd.h>
>> -#include<syscall.h>
>> -
>> -
>> -static inline int eventfd (int count, int flags)
>> -{
>> - return syscall(SYS_eventfd, count, flags);
>> -}
>> -
>> -#endif
>> --
>> 1.7.1
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

[-- Attachment #2: eventfd.h --]
[-- Type: text/x-chdr, Size: 599 bytes --]

#ifndef _COMPAT_SYS_EVENTFD
#define _COMPAT_SYS_EVENTFD

#include <unistd.h>
#include <syscall.h>

/* Flags for signalfd. */
enum
{
EFD_SEMAPHORE = 1,
#define EFD_SEMAPHORE EFD_SEMAPHORE
EFD_CLOEXEC = 02000000,
#define EFD_CLOEXEC EFD_CLOEXEC
EFD_NONBLOCK = 04000
#define EFD_NONBLOCK EFD_NONBLOCK
};

#ifndef __NR_eventfd2
#if defined(__x86_64__)
#define __NR_eventfd2 290
#elif defined(__i386__)
#define __NR_eventfd2 328
#else
#error Cannot detect your architecture!
#endif
#endif

static inline int eventfd (int count, int flags)
{
return syscall(__NR_eventfd2, count, flags);
}

#endif