Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 May 2015 14:50:50 +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: r282729 - head/lib/libc/net
Message-ID:  <201505101450.t4AEooNH074786@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun May 10 14:50:50 2015
New Revision: 282729
URL: https://svnweb.freebsd.org/changeset/base/282729

Log:
  recv(),send(): Directly call interposing entry instead of going through PLT.
  
  recv() and send()'s calls to recvfrom() and sendto() are much like
  waitpid()'s call to wait4(), and likewise need not allow PLT interposing on
  the called function.

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 May 10 13:30:21 2015	(r282728)
+++ head/lib/libc/net/recv.c	Sun May 10 14:50:50 2015	(r282729)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/types.h>
 #include <sys/socket.h>
+#include "libc_private.h"
 
 #include <stddef.h>
 
@@ -48,5 +49,8 @@ recv(s, buf, len, flags)
 	 * 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));
+	return (((ssize_t (*)(int, void *, size_t, int,
+	    struct sockaddr *, socklen_t *))
+	    __libc_interposing[INTERPOS_recvfrom])(s, buf, len, flags,
+	   NULL, NULL));
 }

Modified: head/lib/libc/net/send.c
==============================================================================
--- head/lib/libc/net/send.c	Sun May 10 13:30:21 2015	(r282728)
+++ head/lib/libc/net/send.c	Sun May 10 14:50:50 2015	(r282729)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/types.h>
 #include <sys/socket.h>
+#include "libc_private.h"
 
 #include <stddef.h>
 
@@ -48,5 +49,8 @@ send(s, msg, len, flags)
 	 * 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));
+	return (((ssize_t (*)(int, const void *, size_t, int,
+	    const struct sockaddr *, socklen_t))
+	    __libc_interposing[INTERPOS_sendto])(s, msg, len, flags,
+	    NULL, 0));
 }



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