[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r5695 - in glibc-package/trunk/debian: . patches patches/hurd-i386



Author: sthibault
Date: 2013-09-21 13:56:21 +0000 (Sat, 21 Sep 2013)
New Revision: 5695

Added:
   glibc-package/trunk/debian/patches/hurd-i386/tg-socket_flags.diff
   glibc-package/trunk/debian/patches/hurd-i386/tg-socketpair_flags.diff
Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/patches/series
Log:
  * patches/hurd-i386/tg-socket{,pair}_flags.diff: New patch from Thomas
    Schwinge to add support for SOCK_CLOEXEC and SOCK_NONBLOCK.


Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2013-09-13 18:10:20 UTC (rev 5694)
+++ glibc-package/trunk/debian/changelog	2013-09-21 13:56:21 UTC (rev 5695)
@@ -15,6 +15,8 @@
     Winter to prepare reboot() for /hurd/init getting PID 2 instead of 1.
   * patches/hurd-i386/submitted-path_mounted.diff: New patch from Justus
     Winter to fix hurd-i386's _PATH_MOUNTED according to Debian usage.
+  * patches/hurd-i386/tg-socket{,pair}_flags.diff: New patch from Thomas
+    Schwinge to add support for SOCK_CLOEXEC and SOCK_NONBLOCK.
 
  -- Adam Conrad <adconrad@0c3.net>  Thu, 01 Aug 2013 23:00:51 +0100
 

Added: glibc-package/trunk/debian/patches/hurd-i386/tg-socket_flags.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-socket_flags.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-socket_flags.diff	2013-09-21 13:56:21 UTC (rev 5695)
@@ -0,0 +1,69 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] socket_flags
+
+2008-12-17  Thomas Schwinge  <tschwinge@gnu.org>
+
+	SOCK_CLOEXEC and SOCK_NONBLOCK for socket on GNU Hurd.
+	* sysdeps/mach/hurd/socket.c (__socket): Handle SOCK_CLOEXEC and
+	SOCK_NONBLOCK.
+	* sysdeps/mach/hurd/kernel-features.h (__ASSUME_SOCK_CLOEXEC): Define.
+
+---
+ sysdeps/mach/hurd/kernel-features.h |  1 +
+ sysdeps/mach/hurd/socket.c          | 15 ++++++++++++++-
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/sysdeps/mach/hurd/kernel-features.h b/sysdeps/mach/hurd/kernel-features.h
+index 29d73c4..2b10327 100644
+--- a/sysdeps/mach/hurd/kernel-features.h
++++ b/sysdeps/mach/hurd/kernel-features.h
+@@ -23,3 +23,4 @@
+ #define __ASSUME_O_CLOEXEC	1
+ #define __ASSUME_DUP3		1
+ #define __ASSUME_ACCEPT4	1
++#define __ASSUME_SOCK_CLOEXEC	1
+diff --git a/sysdeps/mach/hurd/socket.c b/sysdeps/mach/hurd/socket.c
+index 7917686..9bb1eee 100644
+--- a/sysdeps/mach/hurd/socket.c
++++ b/sysdeps/mach/hurd/socket.c
+@@ -21,6 +21,7 @@
+ #include <hurd/socket.h>
+ #include <hurd/fd.h>
+ #include <fcntl.h>
++#include <fcntl-internal.h>
+ 
+ /* Create a new socket of type TYPE in domain DOMAIN, using
+    protocol PROTOCOL.  If PROTOCOL is zero, one is chosen automatically.
+@@ -33,6 +34,11 @@ __socket (domain, type, protocol)
+ {
+   error_t err;
+   socket_t sock, server;
++  int flags = sock_to_o_flags (type & ~SOCK_TYPE_MASK);
++  type &= SOCK_TYPE_MASK;
++
++  if (flags & ~(O_CLOEXEC | O_NONBLOCK))
++    return __hurd_fail (EINVAL);
+ 
+   /* Find the socket server for DOMAIN.  */
+   server = _hurd_socket_server (domain, 0);
+@@ -58,10 +64,17 @@ __socket (domain, type, protocol)
+       || err == MIG_BAD_ID || err == EOPNOTSUPP)
+     err = EAFNOSUPPORT;
+ 
++  if (! err)
++    {
++      if (flags & O_NONBLOCK)
++	err = __io_set_some_openmodes (sock, O_NONBLOCK);
++      /* TODO: do we need special ERR massaging after the previous call?  */
++    }
++
+   if (err)
+     return __hurd_fail (err);
+ 
+-  return _hurd_intern_fd (sock, O_IGNORE_CTTY, 1);
++  return _hurd_intern_fd (sock, O_IGNORE_CTTY | flags, 1);
+ }
+ 
+ weak_alias (__socket, socket)
+-- 
+tg: (703def4..) t/socket_flags (depends on: t/fcntl-internal.h)

Added: glibc-package/trunk/debian/patches/hurd-i386/tg-socketpair_flags.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/tg-socketpair_flags.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/tg-socketpair_flags.diff	2013-09-21 13:56:21 UTC (rev 5695)
@@ -0,0 +1,84 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] socketpair_flags
+
+2008-12-17  Thomas Schwinge  <tschwinge@gnu.org>
+
+	SOCK_CLOEXEC and SOCK_NONBLOCK for socketpair on GNU Hurd.
+	* sysdeps/mach/hurd/socketpair.c (__socketpair): Handle SOCK_CLOEXEC
+	and SOCK_NONBLOCK.
+
+---
+ sysdeps/mach/hurd/socketpair.c | 25 ++++++++++++++++++++++---
+ 1 file changed, 22 insertions(+), 3 deletions(-)
+
+diff --git a/sysdeps/mach/hurd/socketpair.c b/sysdeps/mach/hurd/socketpair.c
+index 47f50d2..a16dd80 100644
+--- a/sysdeps/mach/hurd/socketpair.c
++++ b/sysdeps/mach/hurd/socketpair.c
+@@ -17,6 +17,7 @@
+ 
+ #include <errno.h>
+ #include <fcntl.h>
++#include <fcntl-internal.h>
+ #include <sys/socket.h>
+ #include <unistd.h>
+ 
+@@ -34,6 +35,11 @@ __socketpair (int domain, int type, int protocol, int fds[2])
+   error_t err;
+   socket_t server, sock1, sock2;
+   int d1, d2;
++  int flags = sock_to_o_flags (type & ~SOCK_TYPE_MASK);
++  type &= SOCK_TYPE_MASK;
++
++  if (flags & ~(O_CLOEXEC | O_NONBLOCK))
++    return __hurd_fail (EINVAL);
+ 
+   if (fds == NULL)
+     return __hurd_fail (EINVAL);
+@@ -56,6 +62,14 @@ __socketpair (int domain, int type, int protocol, int fds[2])
+ 	return -1;
+       err = __socket_create (server, type, protocol, &sock1);
+     }
++  /* TODO: do we need special ERR massaging here, like it is done in
++     __socket?  */
++  if (! err)
++    {
++      if (flags & O_NONBLOCK)
++	err = __io_set_some_openmodes (sock1, O_NONBLOCK);
++      /* TODO: do we need special ERR massaging after the previous call?  */
++    }
+   if (err)
+     return __hurd_fail (err);
+   if (err = __socket_create (server, type, protocol, &sock2))
+@@ -63,7 +77,12 @@ __socketpair (int domain, int type, int protocol, int fds[2])
+       __mach_port_deallocate (__mach_task_self (), sock1);
+       return __hurd_fail (err);
+     }
+-  if (err = __socket_connect2 (sock1, sock2))
++  if (flags & O_NONBLOCK)
++    err = __io_set_some_openmodes (sock2, O_NONBLOCK);
++  /* TODO: do we need special ERR massaging after the previous call?  */
++  if (! err)
++    err = __socket_connect2 (sock1, sock2);
++  if (err)
+     {
+       __mach_port_deallocate (__mach_task_self (), sock1);
+       __mach_port_deallocate (__mach_task_self (), sock2);
+@@ -72,13 +91,13 @@ __socketpair (int domain, int type, int protocol, int fds[2])
+ 
+   /* Put the sockets into file descriptors.  */
+ 
+-  d1 = _hurd_intern_fd (sock1, O_IGNORE_CTTY, 1);
++  d1 = _hurd_intern_fd (sock1, O_IGNORE_CTTY | flags, 1);
+   if (d1 < 0)
+     {
+       __mach_port_deallocate (__mach_task_self (), sock2);
+       return -1;
+     }
+-  d2 = _hurd_intern_fd (sock2, O_IGNORE_CTTY, 1);
++  d2 = _hurd_intern_fd (sock2, O_IGNORE_CTTY | flags, 1);
+   if (d2 < 0)
+     {
+       err = errno;
+-- 
+tg: (a7a0166..) t/socketpair_flags (depends on: t/socket_flags)

Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series	2013-09-13 18:10:20 UTC (rev 5694)
+++ glibc-package/trunk/debian/patches/series	2013-09-21 13:56:21 UTC (rev 5695)
@@ -128,6 +128,8 @@
 hurd-i386/unsubmitted-clock_t_centiseconds.diff
 hurd-i386/submitted-startup-pid2.diff
 hurd-i386/submitted-path_mounted.diff
+hurd-i386/tg-socket_flags.diff
+hurd-i386/tg-socketpair_flags.diff
 
 i386/local-biarch.diff
 i386/local-cmov.diff


Reply to: