svn commit: r282729 - head/lib/libc/net

Jilles Tjoelker jilles at FreeBSD.org
Sun May 10 14:50:51 UTC 2015


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));
 }


More information about the svn-src-all mailing list