Author: jilles
Date: Sun Jun  9 14:31:59 2013
New Revision: 251575
URL: http://svnweb.freebsd.org/changeset/base/251575

Log:
  Make recv() and send() cancellation points, as required by POSIX.
  
  Call the recvfrom() and sendto() functions overridden by libthr instead of
  the _recvfrom() and _sendto() versions that are not cancellation points.

Modified:
  head/lib/libc/net/recv.c
  head/lib/libc/net/send.c

Modified: head/lib/libc/net/recv.c
==============================================================================
--- head/lib/libc/net/recv.c    Sun Jun  9 13:58:37 2013        (r251574)
+++ head/lib/libc/net/recv.c    Sun Jun  9 14:31:59 2013        (r251575)
@@ -33,12 +33,10 @@ static char sccsid[] = "@(#)recv.c  8.2 (
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "namespace.h"
 #include <sys/types.h>
 #include <sys/socket.h>
 
 #include <stddef.h>
-#include "un-namespace.h"
 
 ssize_t
 recv(s, buf, len, flags)
@@ -46,5 +44,9 @@ recv(s, buf, len, flags)
        size_t len;
        void *buf;
 {
-       return (_recvfrom(s, buf, len, flags, NULL, 0));
+       /*
+        * POSIX says recv() shall be a cancellation point, so call the
+        * cancellation-enabled recvfrom() and not _recvfrom().
+        */
+       return (recvfrom(s, buf, len, flags, NULL, 0));
 }

Modified: head/lib/libc/net/send.c
==============================================================================
--- head/lib/libc/net/send.c    Sun Jun  9 13:58:37 2013        (r251574)
+++ head/lib/libc/net/send.c    Sun Jun  9 14:31:59 2013        (r251575)
@@ -33,12 +33,10 @@ static char sccsid[] = "@(#)send.c  8.2 (
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "namespace.h"
 #include <sys/types.h>
 #include <sys/socket.h>
 
 #include <stddef.h>
-#include "un-namespace.h"
 
 ssize_t
 send(s, msg, len, flags)
@@ -46,5 +44,9 @@ send(s, msg, len, flags)
        size_t len;
        const void *msg;
 {
-       return (_sendto(s, msg, len, flags, NULL, 0));
+       /*
+        * POSIX says send() shall be a cancellation point, so call the
+        * cancellation-enabled sendto() and not _sendto().
+        */
+       return (sendto(s, msg, len, flags, NULL, 0));
 }
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to