Mark sockets on accept().
Conflicts:
libc/SYSCALLS.TXT
Change-Id: I5d09be413cf720fbed905f96313b007997ada76c
diff --git a/libc/bionic/NetdClient.cpp b/libc/bionic/NetdClient.cpp
index 6826ee8..72d90b7 100644
--- a/libc/bionic/NetdClient.cpp
+++ b/libc/bionic/NetdClient.cpp
@@ -40,6 +40,7 @@
// default implementations of functions that it would've overridden.
return;
}
+ netdClientInitFunction(netdClientHandle, "netdClientInitAccept", &__netdClientDispatch.accept);
netdClientInitFunction(netdClientHandle, "netdClientInitConnect",
&__netdClientDispatch.connect);
}
diff --git a/libc/bionic/NetdClientDispatch.cpp b/libc/bionic/NetdClientDispatch.cpp
index 31728d2..adfe16d 100644
--- a/libc/bionic/NetdClientDispatch.cpp
+++ b/libc/bionic/NetdClientDispatch.cpp
@@ -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,
};
diff --git a/libc/bionic/accept.cpp b/libc/bionic/accept.cpp
new file mode 100644
index 0000000..46b4efc
--- /dev/null
+++ b/libc/bionic/accept.cpp
@@ -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);
+}