* commit 'd2ac8787496422ee70e44f6e5abf65b570015470': Mark sockets on accept().
This commit is contained in:
commit
62090bb6b9
@ -98,6 +98,7 @@ libc_common_src_files += \
|
||||
|
||||
libc_bionic_src_files := \
|
||||
bionic/abort.cpp \
|
||||
bionic/accept.cpp \
|
||||
bionic/access.cpp \
|
||||
bionic/assert.cpp \
|
||||
bionic/atof.cpp \
|
||||
|
@ -236,7 +236,7 @@ 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 __connect:connect(int, struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64
|
||||
int listen(int, int) arm,arm64,mips,mips64,x86_64
|
||||
int accept(int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64
|
||||
int __accept:accept(int, struct sockaddr*, socklen_t*) 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 getpeername(int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64
|
||||
@ -255,7 +255,7 @@ int socket:socketcall:1(int, int, int) x86
|
||||
int bind:socketcall:2(int, struct sockaddr*, int) x86
|
||||
int __connect:socketcall:3(int, struct sockaddr*, socklen_t) x86
|
||||
int listen:socketcall:4(int, int) x86
|
||||
int accept:socketcall:5(int, struct sockaddr*, socklen_t*) x86
|
||||
int __accept:socketcall:5(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 socketpair:socketcall:8(int, int, int, int*) x86
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <private/bionic_asm.h>
|
||||
|
||||
ENTRY(accept)
|
||||
ENTRY(__accept)
|
||||
mov ip, r7
|
||||
ldr r7, =__NR_accept
|
||||
swi #0
|
||||
@ -11,4 +11,4 @@ ENTRY(accept)
|
||||
bxls lr
|
||||
neg r0, r0
|
||||
b __set_errno
|
||||
END(accept)
|
||||
END(__accept)
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <private/bionic_asm.h>
|
||||
|
||||
ENTRY(accept)
|
||||
ENTRY(__accept)
|
||||
stp x29, x30, [sp, #-16]!
|
||||
mov x29, sp
|
||||
str x8, [sp, #-16]!
|
||||
@ -18,4 +18,5 @@ ENTRY(accept)
|
||||
b.hi __set_errno
|
||||
|
||||
ret
|
||||
END(accept)
|
||||
END(__accept)
|
||||
.hidden __accept
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <private/bionic_asm.h>
|
||||
|
||||
ENTRY(accept)
|
||||
ENTRY(__accept)
|
||||
.set noreorder
|
||||
.cpload t9
|
||||
li v0, __NR_accept
|
||||
@ -16,4 +16,4 @@ ENTRY(accept)
|
||||
j t9
|
||||
nop
|
||||
.set reorder
|
||||
END(accept)
|
||||
END(__accept)
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <private/bionic_asm.h>
|
||||
|
||||
ENTRY(accept)
|
||||
ENTRY(__accept)
|
||||
.set push
|
||||
.set noreorder
|
||||
li v0, __NR_accept
|
||||
@ -22,4 +22,5 @@ ENTRY(accept)
|
||||
j t9
|
||||
move ra, t0
|
||||
.set pop
|
||||
END(accept)
|
||||
END(__accept)
|
||||
.hidden __accept
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <private/bionic_asm.h>
|
||||
|
||||
ENTRY(accept)
|
||||
ENTRY(__accept)
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
.cfi_def_cfa_offset 8
|
||||
@ -24,4 +24,4 @@ ENTRY(accept)
|
||||
popl %ecx
|
||||
popl %ebx
|
||||
ret
|
||||
END(accept)
|
||||
END(__accept)
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <private/bionic_asm.h>
|
||||
|
||||
ENTRY(accept)
|
||||
ENTRY(__accept)
|
||||
movl $__NR_accept, %eax
|
||||
syscall
|
||||
cmpq $-MAX_ERRNO, %rax
|
||||
@ -13,4 +13,5 @@ ENTRY(accept)
|
||||
orq $-1, %rax
|
||||
1:
|
||||
ret
|
||||
END(accept)
|
||||
END(__accept)
|
||||
.hidden __accept
|
@ -40,6 +40,7 @@ static void netdClientInitImpl() {
|
||||
// default implementations of functions that it would've overridden.
|
||||
return;
|
||||
}
|
||||
netdClientInitFunction(netdClientHandle, "netdClientInitAccept", &__netdClientDispatch.accept);
|
||||
netdClientInitFunction(netdClientHandle, "netdClientInitConnect",
|
||||
&__netdClientDispatch.connect);
|
||||
}
|
||||
|
@ -22,8 +22,10 @@
|
||||
#define __socketcall
|
||||
#endif
|
||||
|
||||
extern "C" __socketcall int __accept(int, sockaddr*, socklen_t*);
|
||||
extern "C" __socketcall int __connect(int, const sockaddr*, socklen_t);
|
||||
|
||||
NetdClientDispatch __netdClientDispatch __attribute__((aligned(32))) = {
|
||||
__connect
|
||||
__accept,
|
||||
__connect,
|
||||
};
|
||||
|
22
libc/bionic/accept.cpp
Normal file
22
libc/bionic/accept.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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/NetdClient.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
int accept(int sockfd, sockaddr* addr, socklen_t* addrlen) {
|
||||
return __netdClientDispatch.accept(sockfd, addr, addrlen);
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
#include <sys/socket.h>
|
||||
|
||||
struct NetdClientDispatch {
|
||||
int (*accept)(int, sockaddr*, socklen_t*);
|
||||
int (*connect)(int, const sockaddr*, socklen_t);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user