resolved conflicts for merge of e7329284 to master
Change-Id: Iaeb09451ed1a268a025ce3033ab018f28f954848
diff --git a/libc/bionic/NetdClient.cpp b/libc/bionic/NetdClient.cpp
index 23f7c43..36796a2 100644
--- a/libc/bionic/NetdClient.cpp
+++ b/libc/bionic/NetdClient.cpp
@@ -18,11 +18,11 @@
#error NetdClient.cpp should NOT be included in static libc builds.
#endif
-#include <private/NetdClient.h>
-#include <private/libc_logging.h>
-#include <pthread.h>
+#include "private/libc_logging.h"
+#include "private/NetdClientDispatch.h"
#include <dlfcn.h>
+#include <pthread.h>
template <typename FunctionType>
static void netdClientInitFunction(void* handle, const char* symbol, FunctionType* function) {
diff --git a/libc/bionic/NetdClientDispatch.cpp b/libc/bionic/NetdClientDispatch.cpp
index 62130a1..17bbd9d 100644
--- a/libc/bionic/NetdClientDispatch.cpp
+++ b/libc/bionic/NetdClientDispatch.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <private/NetdClient.h>
+#include "private/NetdClientDispatch.h"
#ifdef __i386__
#define __socketcall __attribute__((__cdecl__))
@@ -29,7 +29,9 @@
return netId;
}
-NetdClientDispatch __netdClientDispatch __attribute__((aligned(32))) = {
+// 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.
+__LIBC_HIDDEN__ NetdClientDispatch __netdClientDispatch __attribute__((aligned(32))) = {
__accept,
__connect,
fallBackNetIdForResolv,
diff --git a/libc/bionic/accept.cpp b/libc/bionic/accept.cpp
index 46b4efc..8073234 100644
--- a/libc/bionic/accept.cpp
+++ b/libc/bionic/accept.cpp
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#include <private/NetdClient.h>
+#include "private/NetdClientDispatch.h"
+
#include <sys/socket.h>
int accept(int sockfd, sockaddr* addr, socklen_t* addrlen) {
diff --git a/libc/bionic/connect.cpp b/libc/bionic/connect.cpp
index c5db46b..1673f4a 100644
--- a/libc/bionic/connect.cpp
+++ b/libc/bionic/connect.cpp
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#include <private/NetdClient.h>
+#include "private/NetdClientDispatch.h"
+
#include <sys/socket.h>
int connect(int sockfd, const sockaddr* addr, socklen_t addrlen) {
diff --git a/libc/private/NetdClient.h b/libc/private/NetdClientDispatch.h
similarity index 82%
rename from libc/private/NetdClient.h
rename to libc/private/NetdClientDispatch.h
index 664c54f..c256288 100644
--- a/libc/private/NetdClient.h
+++ b/libc/private/NetdClientDispatch.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef PRIVATE_NETD_CLIENT_H
-#define PRIVATE_NETD_CLIENT_H
+#ifndef PRIVATE_NETD_CLIENT_DISPATCH_H
+#define PRIVATE_NETD_CLIENT_DISPATCH_H
#include <sys/cdefs.h>
#include <sys/socket.h>
@@ -28,8 +28,8 @@
unsigned (*netIdForResolv)(unsigned);
};
-extern struct NetdClientDispatch __netdClientDispatch;
+extern __LIBC_HIDDEN__ struct NetdClientDispatch __netdClientDispatch;
__END_DECLS
-#endif // PRIVATE_NETD_CLIENT_H
+#endif // PRIVATE_NETD_CLIENT_DISPATCH_H