Ulrich Drepper
e7d476dfdf
flag parameters: NONBLOCK in eventfd
This patch adds support for the EFD_NONBLOCK flag to eventfd2. The
additional changes needed are minimal.
The following test must be adjusted for architectures other than x86 and
x86-64 and in case the syscall numbers changed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/syscall.h>
#ifndef __NR_eventfd2
# ifdef __x86_64__
# define __NR_eventfd2 290
# elif defined __i386__
# define __NR_eventfd2 328
# else
# error "need __NR_eventfd2"
# endif
#endif
#define EFD_NONBLOCK O_NONBLOCK
int
main (void)
{
int fd = syscall (__NR_eventfd2, 1, 0);
if (fd == -1)
{
puts ("eventfd2(0) failed");
return 1;
}
int fl = fcntl (fd, F_GETFL);
if (fl == -1)
{
puts ("fcntl failed");
return 1;
}
if (fl & O_NONBLOCK)
{
puts ("eventfd2(0) sets non-blocking mode");
return 1;
}
close (fd);
fd = syscall (__NR_eventfd2, 1, EFD_NONBLOCK);
if (fd == -1)
{
puts ("eventfd2(EFD_NONBLOCK) failed");
return 1;
}
fl = fcntl (fd, F_GETFL);
if (fl == -1)
{
puts ("fcntl failed");
return 1;
}
if ((fl & O_NONBLOCK) == 0)
{
puts ("eventfd2(EFD_NONBLOCK) does not set non-blocking mode");
return 1;
}
close (fd);
puts ("OK");
return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Ulrich Drepper <drepper@redhat.com>
Acked-by: Davide Libenzi <davidel@xmailserver.org>
Cc: Michael Kerrisk <mtk.manpages@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-24 10:47:29 -07:00
..
2008-07-15 16:11:29 -04:00
2008-07-23 18:24:08 -07:00
2008-07-16 15:17:52 -07:00
2008-07-21 21:55:03 -07:00
2008-07-21 10:11:00 -07:00
2008-07-21 17:05:25 +10:00
2008-07-22 13:13:47 -07:00
2008-07-20 21:21:46 -07:00
2008-07-22 13:03:22 -07:00
2008-07-24 10:47:24 -07:00
2008-07-24 10:47:27 -07:00
2008-07-17 17:59:55 -07:00
2008-07-24 10:47:24 -07:00
2008-07-22 09:59:40 -07:00
2008-07-24 10:47:22 -07:00
2008-07-16 14:51:41 -07:00
2008-07-24 10:47:20 -07:00
2008-07-17 15:21:29 -07:00
2008-07-23 19:36:53 -07:00
2008-07-18 13:22:25 +02:00
2008-07-20 17:12:38 -07:00
2008-07-22 17:30:57 -07:00
2008-07-21 21:54:59 -07:00
2008-07-21 12:00:37 +01:00
2008-07-21 21:54:53 -07:00
2008-07-21 12:00:37 +01:00
2008-07-22 10:39:36 +10:00
2008-07-17 17:59:56 -07:00
2008-07-21 21:54:53 -07:00
2008-07-24 10:47:29 -07:00
2008-07-24 10:47:28 -07:00
2008-07-16 23:27:03 +02:00
2008-07-22 19:09:51 -07:00
2008-07-24 10:47:28 -07:00
2008-07-16 17:57:47 -05:00
2008-07-20 17:12:36 -07:00
2008-07-24 10:47:20 -07:00
2008-07-20 17:12:36 -07:00
2008-07-23 15:25:21 +02:00
2008-07-24 10:47:19 -07:00
2008-07-20 07:18:38 -03:00
2008-07-23 19:56:01 +02:00
2008-07-18 18:05:19 -07:00
2008-07-16 18:02:33 -07:00
2008-07-24 10:47:28 -07:00
2008-07-21 00:55:14 -04:00
2008-07-15 10:39:22 -07:00
2008-07-16 23:27:07 +02:00
2008-07-21 13:41:16 -07:00
2008-07-20 17:12:37 -07:00
2008-07-22 19:24:31 +10:00
2008-07-24 10:47:17 -07:00
2008-07-20 12:42:40 +03:00
2008-07-20 12:42:32 +03:00
2008-07-24 10:47:21 -07:00
2008-07-24 10:47:21 -07:00
2008-07-24 10:47:21 -07:00
2008-07-24 10:47:21 -07:00
2008-07-24 10:47:24 -07:00
2008-07-24 10:47:29 -07:00
2008-07-22 14:09:06 -07:00
2008-07-22 10:39:30 +10:00
2008-07-24 10:47:15 -07:00
2008-07-24 10:47:15 -07:00
2008-07-23 12:03:18 -07:00
2008-07-16 17:25:46 -07:00
2008-07-20 00:08:47 -07:00
2008-07-24 10:47:23 -07:00
2008-07-16 23:27:07 +02:00
2008-07-22 14:19:19 -07:00
2008-07-20 00:08:47 -07:00
2008-07-23 14:42:09 +02:00
2008-07-24 10:47:14 -07:00
2008-07-24 10:47:22 -07:00
2008-07-18 04:07:44 -07:00
2008-07-24 10:47:24 -07:00
2008-07-24 10:47:29 -07:00
2008-07-24 10:47:21 -07:00
2008-07-19 22:35:47 -07:00
2008-07-20 17:12:37 -07:00
2008-07-24 10:47:13 -07:00
2008-07-22 13:03:29 -07:00
2008-07-24 10:47:28 -07:00
2008-07-21 21:55:02 -07:00
2008-07-21 21:55:01 -07:00
2008-07-19 00:07:02 -07:00
2008-07-24 10:47:27 -07:00
2008-07-22 13:03:28 -07:00
2008-07-20 17:12:34 -07:00
2008-07-22 13:03:27 -07:00
2008-07-21 21:54:55 -07:00
2008-07-21 15:16:40 -07:00
2008-07-21 15:15:55 -07:00
2008-07-20 07:17:02 -03:00
2008-07-24 10:47:14 -07:00
2008-07-24 10:47:23 -07:00
2008-07-15 08:36:38 -07:00