From 42cb36d269431bcb53ff685bb8e5c2521bf77064 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 9 Jun 2013 14:31:59 +0000 Subject: [PATCH] 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. --- lib/libc/net/recv.c | 8 +++++--- lib/libc/net/send.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/libc/net/recv.c b/lib/libc/net/recv.c index c8230d683b9..f71d4780bb7 100644 --- a/lib/libc/net/recv.c +++ b/lib/libc/net/recv.c @@ -33,12 +33,10 @@ static char sccsid[] = "@(#)recv.c 8.2 (Berkeley) 2/21/94"; #include __FBSDID("$FreeBSD$"); -#include "namespace.h" #include #include #include -#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)); } diff --git a/lib/libc/net/send.c b/lib/libc/net/send.c index 101b0ceb45f..93cdfda1753 100644 --- a/lib/libc/net/send.c +++ b/lib/libc/net/send.c @@ -33,12 +33,10 @@ static char sccsid[] = "@(#)send.c 8.2 (Berkeley) 2/21/94"; #include __FBSDID("$FreeBSD$"); -#include "namespace.h" #include #include #include -#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)); }