Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jun 2013 14:32:00 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r251575 - head/lib/libc/net
Message-ID:  <201306091432.r59EW0ZX042025@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306091432.r59EW0ZX042025>