[git commit future 1/1] add epoll_pwait()

Khem Raj raj.khem at gmail.com
Sat Mar 19 18:51:25 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=00c44b9f566f34d1fa3f2889771730b8496b6f95
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future

Add epoll.h header for sparc.
Update epoll.h from glibc (disabling though epoll_create1).

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 libc/sysdeps/linux/common/epoll.c                |   18 +++-----
 libc/sysdeps/linux/common/stubs.c                |    4 ++
 libc/sysdeps/linux/common/sys/epoll.h            |   44 ++++++++++++++++++++--
 libc/sysdeps/linux/{common => sparc}/sys/epoll.h |   43 +++++++++++++++++++--
 libc/sysdeps/linux/x86_64/sys/epoll.h            |   40 +++++++++++++++++++-
 5 files changed, 129 insertions(+), 20 deletions(-)
 copy libc/sysdeps/linux/{common => sparc}/sys/epoll.h (74%)

diff --git a/libc/sysdeps/linux/common/epoll.c b/libc/sysdeps/linux/common/epoll.c
index dda9228..4fbba16 100644
--- a/libc/sysdeps/linux/common/epoll.c
+++ b/libc/sysdeps/linux/common/epoll.c
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * epoll_create() / epoll_ctl() / epoll_wait() for uClibc
+ * epoll_create() / epoll_ctl() / epoll_wait() / epoll_pwait() for uClibc
  *
  * Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
  *
@@ -10,23 +10,19 @@
 #include <sys/syscall.h>
 #include <sys/epoll.h>
 
-/*
- * epoll_create()
- */
 #ifdef __NR_epoll_create
 _syscall1(int, epoll_create, int, size)
 #endif
 
-/*
- * epoll_ctl()
- */
 #ifdef __NR_epoll_ctl
-_syscall4(int,epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, event)
+_syscall4(int, epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, event)
 #endif
 
-/*
- * epoll_wait()
- */
 #ifdef __NR_epoll_wait
 _syscall4(int, epoll_wait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout)
 #endif
+
+#ifdef __NR_epoll_pwait
+_syscall5(int, epoll_pwait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout,
+	  const sigset_t *, ss)
+#endif
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index 655c640..0e740b1 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -63,6 +63,10 @@ make_stub(epoll_ctl)
 make_stub(epoll_wait)
 #endif
 
+#ifndef __NR_epoll_pwait
+make_stub(epoll_pwait)
+#endif
+
 #ifndef __NR_fdatasync
 make_stub(fdatasync)
 #endif
diff --git a/libc/sysdeps/linux/common/sys/epoll.h b/libc/sysdeps/linux/common/sys/epoll.h
index 44e814b..bf196d2 100644
--- a/libc/sysdeps/linux/common/sys/epoll.h
+++ b/libc/sysdeps/linux/common/sys/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,26 @@
 #include <stdint.h>
 #include <sys/types.h>
 
+/* Get __sigset_t.  */
+#include <bits/sigset.h>
+
+#ifndef __sigset_t_defined
+# define __sigset_t_defined
+typedef __sigset_t sigset_t;
+#endif
+
+
+#if 0
+/* Flags to be passed to epoll_create1.  */
+enum
+  {
+    EPOLL_CLOEXEC = 02000000,
+#define EPOLL_CLOEXEC EPOLL_CLOEXEC
+    EPOLL_NONBLOCK = 04000
+#define EPOLL_NONBLOCK EPOLL_NONBLOCK
+  };
+#endif
+
 
 enum EPOLL_EVENTS
   {
@@ -55,9 +75,9 @@ enum EPOLL_EVENTS
 
 
 /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl().  */
-#define EPOLL_CTL_ADD 1	/* Add a file decriptor to the interface.  */
-#define EPOLL_CTL_DEL 2	/* Remove a file decriptor from the interface.  */
-#define EPOLL_CTL_MOD 3	/* Change file decriptor epoll_event structure.  */
+#define EPOLL_CTL_ADD 1	/* Add a file descriptor to the interface.  */
+#define EPOLL_CTL_DEL 2	/* Remove a file descriptor from the interface.  */
+#define EPOLL_CTL_MOD 3	/* Change file descriptor epoll_event structure.  */
 
 
 typedef union epoll_data
@@ -83,6 +103,12 @@ __BEGIN_DECLS
    returned by epoll_create() should be closed with close().  */
 extern int epoll_create (int __size) __THROW;
 
+#if 0
+/* Same as epoll_create but with an FLAGS parameter.  The unused SIZE
+   parameter has been dropped.  */
+extern int epoll_create1 (int __flags) __THROW;
+#endif
+
 
 /* Manipulate an epoll instance "epfd". Returns 0 in case of success,
    -1 in case of error ( the "errno" variable will contain the
@@ -107,6 +133,16 @@ extern int epoll_ctl (int __epfd, int __op, int __fd,
 extern int epoll_wait (int __epfd, struct epoll_event *__events,
 		       int __maxevents, int __timeout);
 
+
+/* Same as epoll_wait, but the thread's signal mask is temporarily
+   and atomically replaced with the one provided as parameter.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
+extern int epoll_pwait (int __epfd, struct epoll_event *__events,
+			int __maxevents, int __timeout,
+			__const __sigset_t *__ss);
+
 __END_DECLS
 
 #endif /* sys/epoll.h */
diff --git a/libc/sysdeps/linux/common/sys/epoll.h b/libc/sysdeps/linux/sparc/sys/epoll.h
similarity index 74%
copy from libc/sysdeps/linux/common/sys/epoll.h
copy to libc/sysdeps/linux/sparc/sys/epoll.h
index 44e814b..83a61da 100644
--- a/libc/sysdeps/linux/common/sys/epoll.h
+++ b/libc/sysdeps/linux/sparc/sys/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2006, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,26 @@
 #include <stdint.h>
 #include <sys/types.h>
 
+/* Get __sigset_t.  */
+#include <bits/sigset.h>
+
+#ifndef __sigset_t_defined
+# define __sigset_t_defined
+typedef __sigset_t sigset_t;
+#endif
+
+
+#if 0
+/* Flags to be passed to epoll_create2.  */
+enum
+  {
+    EPOLL_CLOEXEC = 0x400000,
+#define EPOLL_CLOEXEC EPOLL_CLOEXEC
+    EPOLL_NONBLOCK = 0x4000
+#define EPOLL_NONBLOCK EPOLL_NONBLOCK
+  };
+#endif
+
 
 enum EPOLL_EVENTS
   {
@@ -55,9 +75,9 @@ enum EPOLL_EVENTS
 
 
 /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl().  */
-#define EPOLL_CTL_ADD 1	/* Add a file decriptor to the interface.  */
-#define EPOLL_CTL_DEL 2	/* Remove a file decriptor from the interface.  */
-#define EPOLL_CTL_MOD 3	/* Change file decriptor epoll_event structure.  */
+#define EPOLL_CTL_ADD 1	/* Add a file descriptor to the interface.  */
+#define EPOLL_CTL_DEL 2	/* Remove a file descriptor from the interface.  */
+#define EPOLL_CTL_MOD 3	/* Change file descriptor epoll_event structure.  */
 
 
 typedef union epoll_data
@@ -83,6 +103,11 @@ __BEGIN_DECLS
    returned by epoll_create() should be closed with close().  */
 extern int epoll_create (int __size) __THROW;
 
+#if 0
+/* Same as epoll_create but with an additional FLAGS parameter.  */
+extern int epoll_create2 (int __size, int __flags) __THROW;
+#endif
+
 
 /* Manipulate an epoll instance "epfd". Returns 0 in case of success,
    -1 in case of error ( the "errno" variable will contain the
@@ -107,6 +132,16 @@ extern int epoll_ctl (int __epfd, int __op, int __fd,
 extern int epoll_wait (int __epfd, struct epoll_event *__events,
 		       int __maxevents, int __timeout);
 
+
+/* Same as epoll_wait, but the thread's signal mask is temporarily
+   and atomically replaced with the one provided as parameter.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
+extern int epoll_pwait (int __epfd, struct epoll_event *__events,
+			int __maxevents, int __timeout,
+			__const __sigset_t *__ss);
+
 __END_DECLS
 
 #endif /* sys/epoll.h */
diff --git a/libc/sysdeps/linux/x86_64/sys/epoll.h b/libc/sysdeps/linux/x86_64/sys/epoll.h
index 02672d3..6b90d54 100644
--- a/libc/sysdeps/linux/x86_64/sys/epoll.h
+++ b/libc/sysdeps/linux/x86_64/sys/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,26 @@
 #include <stdint.h>
 #include <sys/types.h>
 
+/* Get __sigset_t.  */
+#include <bits/sigset.h>
+
+#ifndef __sigset_t_defined
+# define __sigset_t_defined
+typedef __sigset_t sigset_t;
+#endif
+
+
+#if 0
+/* Flags to be passed to epoll_create1.  */
+enum
+  {
+    EPOLL_CLOEXEC = 02000000,
+#define EPOLL_CLOEXEC EPOLL_CLOEXEC
+    EPOLL_NONBLOCK = 04000
+#define EPOLL_NONBLOCK EPOLL_NONBLOCK
+  };
+#endif
+
 
 enum EPOLL_EVENTS
   {
@@ -45,6 +65,8 @@ enum EPOLL_EVENTS
 #define EPOLLERR EPOLLERR
     EPOLLHUP = 0x010,
 #define EPOLLHUP EPOLLHUP
+    EPOLLRDHUP = 0x2000,
+#define EPOLLRDHUP EPOLLRDHUP
     EPOLLONESHOT = (1 << 30),
 #define EPOLLONESHOT EPOLLONESHOT
     EPOLLET = (1 << 31)
@@ -81,6 +103,12 @@ __BEGIN_DECLS
    returned by epoll_create() should be closed with close().  */
 extern int epoll_create (int __size) __THROW;
 
+#if 0
+/* Same as epoll_create but with an FLAGS parameter.  The unused SIZE
+   parameter has been dropped.  */
+extern int epoll_create1 (int __flags) __THROW;
+#endif
+
 
 /* Manipulate an epoll instance "epfd". Returns 0 in case of success,
    -1 in case of error ( the "errno" variable will contain the
@@ -105,6 +133,16 @@ extern int epoll_ctl (int __epfd, int __op, int __fd,
 extern int epoll_wait (int __epfd, struct epoll_event *__events,
 		       int __maxevents, int __timeout);
 
+
+/* Same as epoll_wait, but the thread's signal mask is temporarily
+   and atomically replaced with the one provided as parameter.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
+extern int epoll_pwait (int __epfd, struct epoll_event *__events,
+			int __maxevents, int __timeout,
+			__const __sigset_t *__ss);
+
 __END_DECLS
 
 #endif /* sys/epoll.h */
-- 
1.7.3.4



More information about the uClibc-cvs mailing list