Ulrich Drepper
6b1ef0e60d
flag parameters: NONBLOCK in timerfd_create
This patch adds support for the TFD_NONBLOCK flag to timerfd_create. 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 <time.h>
#include <unistd.h>
#include <sys/syscall.h>
#ifndef __NR_timerfd_create
# ifdef __x86_64__
# define __NR_timerfd_create 283
# elif defined __i386__
# define __NR_timerfd_create 322
# else
# error "need __NR_timerfd_create"
# endif
#endif
#define TFD_NONBLOCK O_NONBLOCK
int
main (void)
{
int fd = syscall (__NR_timerfd_create, CLOCK_REALTIME, 0);
if (fd == -1)
{
puts ("timerfd_create(0) failed");
return 1;
}
int fl = fcntl (fd, F_GETFL);
if (fl == -1)
{
puts ("fcntl failed");
return 1;
}
if (fl & O_NONBLOCK)
{
puts ("timerfd_create(0) set non-blocking mode");
return 1;
}
close (fd);
fd = syscall (__NR_timerfd_create, CLOCK_REALTIME, TFD_NONBLOCK);
if (fd == -1)
{
puts ("timerfd_create(TFD_NONBLOCK) failed");
return 1;
}
fl = fcntl (fd, F_GETFL);
if (fl == -1)
{
puts ("fcntl failed");
return 1;
}
if ((fl & O_NONBLOCK) == 0)
{
puts ("timerfd_create(TFD_NONBLOCK) 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-03 09:59:03 -05:00
2008-04-30 08:29:54 -07:00
2008-05-06 13:45:33 -04:00
2008-06-06 11:29:10 -07:00
2008-05-01 08:04:01 -07:00
2008-05-16 12:01:45 -07:00
2008-04-30 08:29:54 -07:00
2008-07-14 15:29:34 -06:00
2008-07-21 21:54:41 -07:00
2008-07-17 15:21:29 -07:00
2008-04-18 22:16:44 -04:00
2008-07-21 21:54:59 -07:00
2008-04-30 08:29:48 -07:00
2008-07-17 15:21:29 -07:00
2008-07-14 15:29:34 -06:00
2008-04-02 15:28:19 -07:00
2008-04-30 08:29:54 -07:00
2008-04-28 08:58:43 -07:00
2008-07-04 10:40:05 -07:00
2008-07-11 19:27:31 -04:00
2008-07-14 15:29:34 -06:00
2008-04-29 08:06:00 -07:00
2008-06-17 18:08:10 -07:00
2008-07-15 10:38:46 -07:00
2008-04-30 08:29:52 -07:00
2008-05-13 08:02:24 -07:00
2008-05-21 16:55:58 -07:00
2008-07-24 10:47:17 -07:00
2008-04-30 08:29:33 -07:00
2008-05-14 19:11:14 -07:00
2008-07-11 19:27:31 -04:00
2008-05-01 11:15:28 -07:00
2008-06-10 15:12:58 -05:00
2008-07-20 21:21:46 -07:00
2008-06-20 14:05:54 -06:00
2008-07-02 15:06:27 -06:00
2008-07-15 18:34:58 -04:00
2008-07-20 21:21:46 -07:00
2008-05-24 09:56:08 -07:00
2008-07-17 15:21:29 -07:00
2008-07-21 21:54:52 -07:00
2008-07-24 10:47:17 -07:00
2008-07-04 09:52:14 +02:00
2008-07-08 12:39:31 -07:00
2008-07-02 15:06:27 -06:00
2008-07-21 21:55:01 -07:00
2008-04-30 08:29:52 -07:00
2008-07-15 17:35:24 +03:00
2008-06-24 11:38:03 +02:00
2008-05-13 08:02:23 -07:00
2008-06-20 14:05:54 -06:00
2008-07-11 11:37:18 -07:00
2008-06-06 11:36:22 -07:00
2008-07-24 10:47:28 -07:00
2008-04-29 08:06:04 -07:00
2008-06-06 11:29:13 -07:00
2008-07-22 09:59:40 -07:00
2008-04-29 08:06:04 -07:00
2008-06-06 11:29:13 -07:00
2008-07-24 10:47:27 -07:00
2008-04-29 08:06:04 -07:00
2008-04-25 09:23:53 -04:00
2008-07-03 13:21:13 +02:00
2008-07-03 13:21:15 +02:00
2008-06-23 08:30:55 -04:00
2008-07-15 21:55:59 +02:00
2008-06-20 14:05:53 -06:00
2008-07-19 00:30:39 -07:00
2008-07-24 10:47:27 -07:00
2008-07-24 10:47:15 -07:00
2008-05-01 13:08:16 -04:00
2008-05-13 08:02:23 -07:00
2008-04-29 08:06:05 -07:00
2008-07-24 10:47:29 -07:00
2008-07-24 10:47:28 -07:00
2008-07-24 10:47:15 -07:00
2008-07-24 10:47:28 -07:00
2008-05-01 13:08:16 -04:00
2008-05-16 17:22:52 -04:00
2008-07-14 19:10:52 +03:00
2008-05-06 13:13:37 -07:00
2008-07-24 10:47:28 -07:00
2008-04-21 23:11:01 -04:00
2008-04-29 08:06:00 -07:00
2008-07-17 10:55:51 -07:00
2008-06-06 11:29:08 -07:00
2008-07-04 10:40:07 -07:00
2008-06-23 11:52:30 -04:00
2008-07-16 15:02:57 -07:00
2008-04-15 19:35:41 -07:00
2008-07-11 19:27:31 -04:00
2008-06-23 11:52:30 -04:00
2008-07-14 15:02:05 +10:00
2008-07-24 10:47:19 -07:00
2008-07-24 10:47:28 -07:00
2008-04-23 00:05:09 -04:00
2008-04-23 00:05:09 -04:00
2008-04-28 08:58:32 -07:00
2008-04-30 08:29:51 -07:00
2008-04-28 08:58:33 -07:00
2008-07-02 15:06:27 -06:00
2008-06-22 12:23:15 -07:00
2008-04-23 00:04:38 -04:00
2008-07-24 10:47:29 -07:00
2008-07-04 09:52:14 +02:00
2008-07-24 10:47:15 -07:00
2008-07-24 10:47:17 -07:00
2008-07-24 10:47:29 -07:00
2008-06-23 08:43:52 -04:00
2008-04-29 08:06:06 -07:00