am 54c83fee: am 9925c1a8: Merge "Mark sockets on creation (socket()) and accept4()."
* commit '54c83feebfc3b2046ed9e060e19ba6793dec17c4': Mark sockets on creation (socket()) and accept4().
This commit is contained in:
commit
d70e0c884c
@ -98,6 +98,7 @@ libc_common_src_files += \
|
|||||||
libc_bionic_src_files := \
|
libc_bionic_src_files := \
|
||||||
bionic/abort.cpp \
|
bionic/abort.cpp \
|
||||||
bionic/accept.cpp \
|
bionic/accept.cpp \
|
||||||
|
bionic/accept4.cpp \
|
||||||
bionic/access.cpp \
|
bionic/access.cpp \
|
||||||
bionic/assert.cpp \
|
bionic/assert.cpp \
|
||||||
bionic/atof.cpp \
|
bionic/atof.cpp \
|
||||||
@ -199,6 +200,7 @@ libc_bionic_src_files := \
|
|||||||
bionic/sigprocmask.cpp \
|
bionic/sigprocmask.cpp \
|
||||||
bionic/sigsuspend.cpp \
|
bionic/sigsuspend.cpp \
|
||||||
bionic/sigwait.cpp \
|
bionic/sigwait.cpp \
|
||||||
|
bionic/socket.cpp \
|
||||||
bionic/stat.cpp \
|
bionic/stat.cpp \
|
||||||
bionic/statvfs.cpp \
|
bionic/statvfs.cpp \
|
||||||
bionic/strerror.cpp \
|
bionic/strerror.cpp \
|
||||||
|
@ -231,13 +231,12 @@ int __rt_sigtimedwait:rt_sigtimedwait(const sigset_t*, struct siginfo_t*, st
|
|||||||
int __signalfd4:signalfd4(int, const sigset_t*, size_t, int) all
|
int __signalfd4:signalfd4(int, const sigset_t*, size_t, int) all
|
||||||
|
|
||||||
# sockets
|
# sockets
|
||||||
int socket(int, int, int) arm,arm64,mips,mips64,x86_64
|
int __socket:socket(int, int, int) arm,arm64,mips,mips64,x86_64
|
||||||
int socketpair(int, int, int, int*) arm,arm64,mips,mips64,x86_64
|
int socketpair(int, int, int, int*) arm,arm64,mips,mips64,x86_64
|
||||||
int bind(int, struct sockaddr*, int) arm,arm64,mips,mips64,x86_64
|
int bind(int, struct sockaddr*, int) arm,arm64,mips,mips64,x86_64
|
||||||
int __connect:connect(int, struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64
|
int __connect:connect(int, struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64
|
||||||
int listen(int, int) arm,arm64,mips,mips64,x86_64
|
int listen(int, int) arm,arm64,mips,mips64,x86_64
|
||||||
int __accept:accept(int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64
|
int __accept4:accept4(int, struct sockaddr*, socklen_t*, int) arm,arm64,mips,mips64,x86_64
|
||||||
int accept4(int, struct sockaddr*, socklen_t*, int) arm,arm64,mips,mips64,x86_64
|
|
||||||
int getsockname(int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64
|
int getsockname(int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64
|
||||||
int getpeername(int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64
|
int getpeername(int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64
|
||||||
int sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64
|
int sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64
|
||||||
@ -251,11 +250,10 @@ int recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct tim
|
|||||||
int sendmmsg(int, struct mmsghdr*, unsigned int, int) arm,arm64,mips,mips64,x86_64
|
int sendmmsg(int, struct mmsghdr*, unsigned int, int) arm,arm64,mips,mips64,x86_64
|
||||||
|
|
||||||
# sockets for x86. These are done as an "indexed" call to socketcall syscall.
|
# sockets for x86. These are done as an "indexed" call to socketcall syscall.
|
||||||
int socket:socketcall:1(int, int, int) x86
|
int __socket:socketcall:1(int, int, int) x86
|
||||||
int bind:socketcall:2(int, struct sockaddr*, int) x86
|
int bind:socketcall:2(int, struct sockaddr*, int) x86
|
||||||
int __connect:socketcall:3(int, struct sockaddr*, socklen_t) x86
|
int __connect:socketcall:3(int, struct sockaddr*, socklen_t) x86
|
||||||
int listen:socketcall:4(int, int) x86
|
int listen:socketcall:4(int, int) x86
|
||||||
int __accept:socketcall:5(int, struct sockaddr*, socklen_t*) x86
|
|
||||||
int getsockname:socketcall:6(int, struct sockaddr*, socklen_t*) x86
|
int getsockname:socketcall:6(int, struct sockaddr*, socklen_t*) x86
|
||||||
int getpeername:socketcall:7(int, struct sockaddr*, socklen_t*) x86
|
int getpeername:socketcall:7(int, struct sockaddr*, socklen_t*) x86
|
||||||
int socketpair:socketcall:8(int, int, int, int*) x86
|
int socketpair:socketcall:8(int, int, int, int*) x86
|
||||||
@ -266,7 +264,7 @@ int setsockopt:socketcall:14(int, int, int, const void*, socklen_t) x
|
|||||||
int getsockopt:socketcall:15(int, int, int, void*, socklen_t*) x86
|
int getsockopt:socketcall:15(int, int, int, void*, socklen_t*) x86
|
||||||
int sendmsg:socketcall:16(int, const struct msghdr*, unsigned int) x86
|
int sendmsg:socketcall:16(int, const struct msghdr*, unsigned int) x86
|
||||||
int recvmsg:socketcall:17(int, struct msghdr*, unsigned int) x86
|
int recvmsg:socketcall:17(int, struct msghdr*, unsigned int) x86
|
||||||
int accept4:socketcall:18(int, struct sockaddr*, socklen_t*, int) x86
|
int __accept4:socketcall:18(int, struct sockaddr*, socklen_t*, int) x86
|
||||||
int recvmmsg:socketcall:19(int, struct mmsghdr*, unsigned int, int, const struct timespec*) x86
|
int recvmmsg:socketcall:19(int, struct mmsghdr*, unsigned int, int, const struct timespec*) x86
|
||||||
int sendmmsg:socketcall:20(int, struct mmsghdr*, unsigned int, int) x86
|
int sendmmsg:socketcall:20(int, struct mmsghdr*, unsigned int, int) x86
|
||||||
|
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
/* Generated by gensyscalls.py. Do not edit. */
|
|
||||||
|
|
||||||
#include <private/bionic_asm.h>
|
|
||||||
|
|
||||||
ENTRY(__accept)
|
|
||||||
mov ip, r7
|
|
||||||
ldr r7, =__NR_accept
|
|
||||||
swi #0
|
|
||||||
mov r7, ip
|
|
||||||
cmn r0, #(MAX_ERRNO + 1)
|
|
||||||
bxls lr
|
|
||||||
neg r0, r0
|
|
||||||
b __set_errno
|
|
||||||
END(__accept)
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(accept4)
|
ENTRY(__accept4)
|
||||||
mov ip, r7
|
mov ip, r7
|
||||||
ldr r7, =__NR_accept4
|
ldr r7, =__NR_accept4
|
||||||
swi #0
|
swi #0
|
||||||
@ -11,4 +11,4 @@ ENTRY(accept4)
|
|||||||
bxls lr
|
bxls lr
|
||||||
neg r0, r0
|
neg r0, r0
|
||||||
b __set_errno
|
b __set_errno
|
||||||
END(accept4)
|
END(__accept4)
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(socket)
|
ENTRY(__socket)
|
||||||
mov ip, r7
|
mov ip, r7
|
||||||
ldr r7, =__NR_socket
|
ldr r7, =__NR_socket
|
||||||
swi #0
|
swi #0
|
||||||
@ -11,4 +11,4 @@ ENTRY(socket)
|
|||||||
bxls lr
|
bxls lr
|
||||||
neg r0, r0
|
neg r0, r0
|
||||||
b __set_errno
|
b __set_errno
|
||||||
END(socket)
|
END(__socket)
|
@ -1,22 +0,0 @@
|
|||||||
/* Generated by gensyscalls.py. Do not edit. */
|
|
||||||
|
|
||||||
#include <private/bionic_asm.h>
|
|
||||||
|
|
||||||
ENTRY(__accept)
|
|
||||||
stp x29, x30, [sp, #-16]!
|
|
||||||
mov x29, sp
|
|
||||||
str x8, [sp, #-16]!
|
|
||||||
|
|
||||||
mov x8, __NR_accept
|
|
||||||
svc #0
|
|
||||||
|
|
||||||
ldr x8, [sp], #16
|
|
||||||
ldp x29, x30, [sp], #16
|
|
||||||
|
|
||||||
cmn x0, #(MAX_ERRNO + 1)
|
|
||||||
cneg x0, x0, hi
|
|
||||||
b.hi __set_errno
|
|
||||||
|
|
||||||
ret
|
|
||||||
END(__accept)
|
|
||||||
.hidden __accept
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(accept4)
|
ENTRY(__accept4)
|
||||||
stp x29, x30, [sp, #-16]!
|
stp x29, x30, [sp, #-16]!
|
||||||
mov x29, sp
|
mov x29, sp
|
||||||
str x8, [sp, #-16]!
|
str x8, [sp, #-16]!
|
||||||
@ -18,4 +18,5 @@ ENTRY(accept4)
|
|||||||
b.hi __set_errno
|
b.hi __set_errno
|
||||||
|
|
||||||
ret
|
ret
|
||||||
END(accept4)
|
END(__accept4)
|
||||||
|
.hidden __accept4
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(socket)
|
ENTRY(__socket)
|
||||||
stp x29, x30, [sp, #-16]!
|
stp x29, x30, [sp, #-16]!
|
||||||
mov x29, sp
|
mov x29, sp
|
||||||
str x8, [sp, #-16]!
|
str x8, [sp, #-16]!
|
||||||
@ -18,4 +18,5 @@ ENTRY(socket)
|
|||||||
b.hi __set_errno
|
b.hi __set_errno
|
||||||
|
|
||||||
ret
|
ret
|
||||||
END(socket)
|
END(__socket)
|
||||||
|
.hidden __socket
|
@ -1,19 +0,0 @@
|
|||||||
/* Generated by gensyscalls.py. Do not edit. */
|
|
||||||
|
|
||||||
#include <private/bionic_asm.h>
|
|
||||||
|
|
||||||
ENTRY(__accept)
|
|
||||||
.set noreorder
|
|
||||||
.cpload t9
|
|
||||||
li v0, __NR_accept
|
|
||||||
syscall
|
|
||||||
bnez a3, 1f
|
|
||||||
move a0, v0
|
|
||||||
j ra
|
|
||||||
nop
|
|
||||||
1:
|
|
||||||
la t9,__set_errno
|
|
||||||
j t9
|
|
||||||
nop
|
|
||||||
.set reorder
|
|
||||||
END(__accept)
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(accept4)
|
ENTRY(__accept4)
|
||||||
.set noreorder
|
.set noreorder
|
||||||
.cpload t9
|
.cpload t9
|
||||||
li v0, __NR_accept4
|
li v0, __NR_accept4
|
||||||
@ -16,4 +16,4 @@ ENTRY(accept4)
|
|||||||
j t9
|
j t9
|
||||||
nop
|
nop
|
||||||
.set reorder
|
.set reorder
|
||||||
END(accept4)
|
END(__accept4)
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(socket)
|
ENTRY(__socket)
|
||||||
.set noreorder
|
.set noreorder
|
||||||
.cpload t9
|
.cpload t9
|
||||||
li v0, __NR_socket
|
li v0, __NR_socket
|
||||||
@ -16,4 +16,4 @@ ENTRY(socket)
|
|||||||
j t9
|
j t9
|
||||||
nop
|
nop
|
||||||
.set reorder
|
.set reorder
|
||||||
END(socket)
|
END(__socket)
|
@ -1,26 +0,0 @@
|
|||||||
/* Generated by gensyscalls.py. Do not edit. */
|
|
||||||
|
|
||||||
#include <private/bionic_asm.h>
|
|
||||||
|
|
||||||
ENTRY(__accept)
|
|
||||||
.set push
|
|
||||||
.set noreorder
|
|
||||||
li v0, __NR_accept
|
|
||||||
syscall
|
|
||||||
bnez a3, 1f
|
|
||||||
move a0, v0
|
|
||||||
j ra
|
|
||||||
nop
|
|
||||||
1:
|
|
||||||
move t0, ra
|
|
||||||
bal 2f
|
|
||||||
nop
|
|
||||||
2:
|
|
||||||
.cpsetup ra, t1, 2b
|
|
||||||
LA t9,__set_errno
|
|
||||||
.cpreturn
|
|
||||||
j t9
|
|
||||||
move ra, t0
|
|
||||||
.set pop
|
|
||||||
END(__accept)
|
|
||||||
.hidden __accept
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(accept4)
|
ENTRY(__accept4)
|
||||||
.set push
|
.set push
|
||||||
.set noreorder
|
.set noreorder
|
||||||
li v0, __NR_accept4
|
li v0, __NR_accept4
|
||||||
@ -22,4 +22,5 @@ ENTRY(accept4)
|
|||||||
j t9
|
j t9
|
||||||
move ra, t0
|
move ra, t0
|
||||||
.set pop
|
.set pop
|
||||||
END(accept4)
|
END(__accept4)
|
||||||
|
.hidden __accept4
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(socket)
|
ENTRY(__socket)
|
||||||
.set push
|
.set push
|
||||||
.set noreorder
|
.set noreorder
|
||||||
li v0, __NR_socket
|
li v0, __NR_socket
|
||||||
@ -22,4 +22,5 @@ ENTRY(socket)
|
|||||||
j t9
|
j t9
|
||||||
move ra, t0
|
move ra, t0
|
||||||
.set pop
|
.set pop
|
||||||
END(socket)
|
END(__socket)
|
||||||
|
.hidden __socket
|
@ -1,27 +0,0 @@
|
|||||||
/* Generated by gensyscalls.py. Do not edit. */
|
|
||||||
|
|
||||||
#include <private/bionic_asm.h>
|
|
||||||
|
|
||||||
ENTRY(__accept)
|
|
||||||
pushl %ebx
|
|
||||||
pushl %ecx
|
|
||||||
.cfi_def_cfa_offset 8
|
|
||||||
.cfi_rel_offset ebx, 0
|
|
||||||
.cfi_rel_offset ecx, 4
|
|
||||||
mov $5, %ebx
|
|
||||||
mov %esp, %ecx
|
|
||||||
addl $12, %ecx
|
|
||||||
movl $__NR_socketcall, %eax
|
|
||||||
int $0x80
|
|
||||||
cmpl $-MAX_ERRNO, %eax
|
|
||||||
jb 1f
|
|
||||||
negl %eax
|
|
||||||
pushl %eax
|
|
||||||
call __set_errno
|
|
||||||
addl $4, %esp
|
|
||||||
orl $-1, %eax
|
|
||||||
1:
|
|
||||||
popl %ecx
|
|
||||||
popl %ebx
|
|
||||||
ret
|
|
||||||
END(__accept)
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(accept4)
|
ENTRY(__accept4)
|
||||||
pushl %ebx
|
pushl %ebx
|
||||||
pushl %ecx
|
pushl %ecx
|
||||||
.cfi_def_cfa_offset 8
|
.cfi_def_cfa_offset 8
|
||||||
@ -24,4 +24,4 @@ ENTRY(accept4)
|
|||||||
popl %ecx
|
popl %ecx
|
||||||
popl %ebx
|
popl %ebx
|
||||||
ret
|
ret
|
||||||
END(accept4)
|
END(__accept4)
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(socket)
|
ENTRY(__socket)
|
||||||
pushl %ebx
|
pushl %ebx
|
||||||
pushl %ecx
|
pushl %ecx
|
||||||
.cfi_def_cfa_offset 8
|
.cfi_def_cfa_offset 8
|
||||||
@ -24,4 +24,4 @@ ENTRY(socket)
|
|||||||
popl %ecx
|
popl %ecx
|
||||||
popl %ebx
|
popl %ebx
|
||||||
ret
|
ret
|
||||||
END(socket)
|
END(__socket)
|
@ -1,17 +0,0 @@
|
|||||||
/* Generated by gensyscalls.py. Do not edit. */
|
|
||||||
|
|
||||||
#include <private/bionic_asm.h>
|
|
||||||
|
|
||||||
ENTRY(__accept)
|
|
||||||
movl $__NR_accept, %eax
|
|
||||||
syscall
|
|
||||||
cmpq $-MAX_ERRNO, %rax
|
|
||||||
jb 1f
|
|
||||||
negl %eax
|
|
||||||
movl %eax, %edi
|
|
||||||
call __set_errno
|
|
||||||
orq $-1, %rax
|
|
||||||
1:
|
|
||||||
ret
|
|
||||||
END(__accept)
|
|
||||||
.hidden __accept
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(accept4)
|
ENTRY(__accept4)
|
||||||
movq %rcx, %r10
|
movq %rcx, %r10
|
||||||
movl $__NR_accept4, %eax
|
movl $__NR_accept4, %eax
|
||||||
syscall
|
syscall
|
||||||
@ -14,4 +14,5 @@ ENTRY(accept4)
|
|||||||
orq $-1, %rax
|
orq $-1, %rax
|
||||||
1:
|
1:
|
||||||
ret
|
ret
|
||||||
END(accept4)
|
END(__accept4)
|
||||||
|
.hidden __accept4
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <private/bionic_asm.h>
|
#include <private/bionic_asm.h>
|
||||||
|
|
||||||
ENTRY(socket)
|
ENTRY(__socket)
|
||||||
movl $__NR_socket, %eax
|
movl $__NR_socket, %eax
|
||||||
syscall
|
syscall
|
||||||
cmpq $-MAX_ERRNO, %rax
|
cmpq $-MAX_ERRNO, %rax
|
||||||
@ -13,4 +13,5 @@ ENTRY(socket)
|
|||||||
orq $-1, %rax
|
orq $-1, %rax
|
||||||
1:
|
1:
|
||||||
ret
|
ret
|
||||||
END(socket)
|
END(__socket)
|
||||||
|
.hidden __socket
|
@ -40,18 +40,19 @@ static void netdClientInitImpl() {
|
|||||||
// default implementations of functions that it would've overridden.
|
// default implementations of functions that it would've overridden.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
netdClientInitFunction(netdClientHandle, "netdClientInitAccept", &__netdClientDispatch.accept);
|
netdClientInitFunction(netdClientHandle, "netdClientInitAccept4",
|
||||||
|
&__netdClientDispatch.accept4);
|
||||||
netdClientInitFunction(netdClientHandle, "netdClientInitConnect",
|
netdClientInitFunction(netdClientHandle, "netdClientInitConnect",
|
||||||
&__netdClientDispatch.connect);
|
&__netdClientDispatch.connect);
|
||||||
netdClientInitFunction(netdClientHandle, "netdClientInitNetIdForResolv",
|
netdClientInitFunction(netdClientHandle, "netdClientInitNetIdForResolv",
|
||||||
&__netdClientDispatch.netIdForResolv);
|
&__netdClientDispatch.netIdForResolv);
|
||||||
|
netdClientInitFunction(netdClientHandle, "netdClientInitSocket", &__netdClientDispatch.socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
static pthread_once_t netdClientInitOnce = PTHREAD_ONCE_INIT;
|
static pthread_once_t netdClientInitOnce = PTHREAD_ONCE_INIT;
|
||||||
|
|
||||||
extern "C" __LIBC_HIDDEN__ void netdClientInit() {
|
extern "C" __LIBC_HIDDEN__ void netdClientInit() {
|
||||||
if (pthread_once(&netdClientInitOnce, netdClientInitImpl)) {
|
if (pthread_once(&netdClientInitOnce, netdClientInitImpl)) {
|
||||||
__libc_format_log(ANDROID_LOG_ERROR, "netdClient",
|
__libc_format_log(ANDROID_LOG_ERROR, "netdClient", "Failed to initialize netd_client");
|
||||||
"Unable to initialize netd_client component.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,9 @@
|
|||||||
#define __socketcall
|
#define __socketcall
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C" __socketcall int __accept(int, sockaddr*, socklen_t*);
|
extern "C" __socketcall int __accept4(int, sockaddr*, socklen_t*, int);
|
||||||
extern "C" __socketcall int __connect(int, const sockaddr*, socklen_t);
|
extern "C" __socketcall int __connect(int, const sockaddr*, socklen_t);
|
||||||
|
extern "C" __socketcall int __socket(int, int, int);
|
||||||
|
|
||||||
static unsigned fallBackNetIdForResolv(unsigned netId) {
|
static unsigned fallBackNetIdForResolv(unsigned netId) {
|
||||||
return netId;
|
return netId;
|
||||||
@ -32,7 +33,8 @@ static unsigned fallBackNetIdForResolv(unsigned netId) {
|
|||||||
// This structure is modified only at startup (when libc.so is loaded) and never
|
// This structure is modified only at startup (when libc.so is loaded) and never
|
||||||
// afterwards, so it's okay that it's read later at runtime without a lock.
|
// afterwards, so it's okay that it's read later at runtime without a lock.
|
||||||
__LIBC_HIDDEN__ NetdClientDispatch __netdClientDispatch __attribute__((aligned(32))) = {
|
__LIBC_HIDDEN__ NetdClientDispatch __netdClientDispatch __attribute__((aligned(32))) = {
|
||||||
__accept,
|
__accept4,
|
||||||
__connect,
|
__connect,
|
||||||
|
__socket,
|
||||||
fallBackNetIdForResolv,
|
fallBackNetIdForResolv,
|
||||||
};
|
};
|
||||||
|
@ -14,10 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "private/NetdClientDispatch.h"
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
int accept(int sockfd, sockaddr* addr, socklen_t* addrlen) {
|
int accept(int sockfd, sockaddr* addr, socklen_t* addrlen) {
|
||||||
return __netdClientDispatch.accept(sockfd, addr, addrlen);
|
return accept4(sockfd, addr, addrlen, 0);
|
||||||
}
|
}
|
||||||
|
23
libc/bionic/accept4.cpp
Normal file
23
libc/bionic/accept4.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "private/NetdClientDispatch.h"
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
int accept4(int sockfd, sockaddr* addr, socklen_t* addrlen, int flags) {
|
||||||
|
return __netdClientDispatch.accept4(sockfd, addr, addrlen, flags);
|
||||||
|
}
|
23
libc/bionic/socket.cpp
Normal file
23
libc/bionic/socket.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "private/NetdClientDispatch.h"
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
int socket(int domain, int type, int protocol) {
|
||||||
|
return __netdClientDispatch.socket(domain, type, protocol);
|
||||||
|
}
|
@ -23,8 +23,9 @@
|
|||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
struct NetdClientDispatch {
|
struct NetdClientDispatch {
|
||||||
int (*accept)(int, struct sockaddr*, socklen_t*);
|
int (*accept4)(int, struct sockaddr*, socklen_t*, int);
|
||||||
int (*connect)(int, const struct sockaddr*, socklen_t);
|
int (*connect)(int, const struct sockaddr*, socklen_t);
|
||||||
|
int (*socket)(int, int, int);
|
||||||
unsigned (*netIdForResolv)(unsigned);
|
unsigned (*netIdForResolv)(unsigned);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user