Files
linux-legacy/include/linux
Ulrich Drepper 5fb5e04926 flag parameters: NONBLOCK in signalfd
This patch adds support for the SFD_NONBLOCK flag to signalfd4.  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 <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/syscall.h>

#ifndef __NR_signalfd4
# ifdef __x86_64__
#  define __NR_signalfd4 289
# elif defined __i386__
#  define __NR_signalfd4 327
# else
#  error "need __NR_signalfd4"
# endif
#endif

#define SFD_NONBLOCK O_NONBLOCK

int
main (void)
{
  sigset_t ss;
  sigemptyset (&ss);
  sigaddset (&ss, SIGUSR1);
  int fd = syscall (__NR_signalfd4, -1, &ss, 8, 0);
  if (fd == -1)
    {
      puts ("signalfd4(0) failed");
      return 1;
    }
  int fl = fcntl (fd, F_GETFL);
  if (fl == -1)
    {
      puts ("fcntl failed");
      return 1;
    }
  if (fl & O_NONBLOCK)
    {
      puts ("signalfd4(0) set non-blocking mode");
      return 1;
    }
  close (fd);

  fd = syscall (__NR_signalfd4, -1, &ss, 8, SFD_NONBLOCK);
  if (fd == -1)
    {
      puts ("signalfd4(SFD_NONBLOCK) failed");
      return 1;
    }
  fl = fcntl (fd, F_GETFL);
  if (fl == -1)
    {
      puts ("fcntl failed");
      return 1;
    }
  if ((fl & O_NONBLOCK) == 0)
    {
      puts ("signalfd4(SFD_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-21 21:55:03 -07:00
2008-07-14 14:52:56 -04:00
2008-07-22 13:03:22 -07:00
2008-07-24 10:47:24 -07:00
2008-04-29 08:06:01 -07:00
2007-10-17 08:42:52 -07:00
2008-07-20 17:12:38 -07:00
2008-07-22 17:30:57 -07:00
2008-07-21 12:00:37 +01:00
2008-07-21 12:00:37 +01:00
2007-02-09 17:39:36 -05:00
2008-01-28 23:21:18 +01:00
2008-07-24 10:47:27 -07:00
2008-07-24 10:47:28 -07:00
2008-07-16 23:27:03 +02:00
2008-07-24 10:47:28 -07:00
2006-10-02 07:57:12 -07:00
2008-07-20 17:12:36 -07:00
2008-07-20 17:12:36 -07:00
2008-07-23 15:25:21 +02:00
2008-07-23 19:56:01 +02:00
2008-07-18 18:05:19 -07:00
2008-07-14 22:49:06 -07:00
2008-07-16 18:02:33 -07:00
2008-07-24 10:47:28 -07:00
2008-07-16 23:27:07 +02:00
2008-07-20 17:12:37 -07:00
2008-07-10 08:17:14 +02:00
2008-07-24 10:47:17 -07:00
2007-05-09 12:30:53 -07:00
2008-07-20 12:42:32 +03:00
2008-02-06 10:41:01 -08:00
2005-04-16 15:20:36 -07:00
2008-07-24 10:47:24 -07:00
2005-04-16 15:20:36 -07:00
2006-11-30 04:40:22 +01:00
2008-06-06 11:29:12 -07:00
2006-08-27 11:01:32 -07:00
2008-07-24 10:47:15 -07:00
2005-04-16 15:20:36 -07:00
2008-02-14 21:13:33 -08:00
2006-10-03 23:01:26 +02:00
2008-07-22 14:19:19 -07:00
2008-07-24 10:47:22 -07:00
2008-04-25 00:25:08 +02:00
2008-07-24 10:47:24 -07:00
2008-07-14 22:49:06 -07:00
2008-07-24 10:47:21 -07:00
2008-01-25 21:08:34 +01:00
2008-07-20 17:12:37 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2008-07-24 10:47:28 -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 15:15:55 -07:00
2008-04-28 08:58:21 -07:00
2008-07-24 10:47:14 -07:00