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.
This commit is contained in:
jilles 2015-05-10 14:50:50 +00:00
parent ae16c5888f
commit 8ae6fa0eb6
2 changed files with 10 additions and 2 deletions

View File

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

View File

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