Add signalfd call to bionic

Add signalfd() call to bionic.

Adding the signalfd call was done in 3 steps:
- add signalfd4 system call (function name and syscall
  number) to libc/SYSCALLS.TXT
- generate all necessary headers by calling
  libc/tools/gensyscalls.py. This patch is adding
  the generated files since the build system
  does not call gensyscalls.py.
- create the signalfd wrapper in signalfd.cpp and add
  the function prototype to sys/signalfd.h

(cherry-pick of 0c11611c11f4dc1b6d43587b72c3ccbe8c51a51c, modified to
work with older versions of GCC still in use on some branches.)

Change-Id: I4c6c3f12199559af8be63f93a5336851b7e63355
diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h
index ec48ada..738d9e8 100644
--- a/libc/include/sys/linux-syscalls.h
+++ b/libc/include/sys/linux-syscalls.h
@@ -173,6 +173,7 @@
 #define __NR_rt_sigaction                 (__NR_SYSCALL_BASE + 174)
 #define __NR_rt_sigprocmask               (__NR_SYSCALL_BASE + 175)
 #define __NR_rt_sigtimedwait              (__NR_SYSCALL_BASE + 177)
+#define __NR_signalfd4                    (__NR_SYSCALL_BASE + 355)
 #define __NR_socket                       (__NR_SYSCALL_BASE + 281)
 #define __NR_socketpair                   (__NR_SYSCALL_BASE + 288)
 #define __NR_bind                         (__NR_SYSCALL_BASE + 282)
@@ -329,6 +330,7 @@
 #define __NR_unshare                      (__NR_SYSCALL_BASE + 310)
 #define __NR_getcpu                       (__NR_SYSCALL_BASE + 318)
 #define __NR_utimensat                    (__NR_SYSCALL_BASE + 320)
+#define __NR_signalfd4                    (__NR_SYSCALL_BASE + 327)
 #define __NR_eventfd2                     (__NR_SYSCALL_BASE + 328)
 #define __NR_pipe2                        (__NR_SYSCALL_BASE + 331)
 #define __NR_perf_event_open              (__NR_SYSCALL_BASE + 336)
@@ -463,6 +465,7 @@
 #define __NR_ioprio_set                   (__NR_SYSCALL_BASE + 314)
 #define __NR_ioprio_get                   (__NR_SYSCALL_BASE + 315)
 #define __NR_utimensat                    (__NR_SYSCALL_BASE + 316)
+#define __NR_signalfd4                    (__NR_SYSCALL_BASE + 324)
 #define __NR_eventfd2                     (__NR_SYSCALL_BASE + 325)
 #define __NR_pipe2                        (__NR_SYSCALL_BASE + 328)
 #define __NR_perf_event_open              (__NR_SYSCALL_BASE + 333)
diff --git a/libc/include/sys/signalfd.h b/libc/include/sys/signalfd.h
new file mode 100644
index 0000000..af1f290
--- /dev/null
+++ b/libc/include/sys/signalfd.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _SYS_SIGNALFD_H_
+#define _SYS_SIGNALFD_H_
+
+#include <linux/signalfd.h>
+#include <sys/cdefs.h>
+#include <signal.h>
+
+__BEGIN_DECLS
+
+/* Compatibility with GLibc */
+extern int signalfd(int fd, const sigset_t *mask, int flags);
+
+__END_DECLS
+
+#endif /* _SYS_SIGNALFD_H */