diff options
| author | Sreeram Ramachandran <sreeram@google.com> | 2014-05-19 16:45:53 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-05-19 16:45:53 +0000 |
| commit | 308c30af72da7b13938934ba5037dd347b1ef139 (patch) | |
| tree | 1bf073b86706fca3bb4218fa666dc3a19015ccc9 | |
| parent | 3a757f403ba98ab2132ceb8d290dfafea6c4c7a5 (diff) | |
| parent | 72c53933f852be6d1cd6c09c86176fbc6d609dac (diff) | |
| download | bionic-308c30af72da7b13938934ba5037dd347b1ef139.zip bionic-308c30af72da7b13938934ba5037dd347b1ef139.tar.gz bionic-308c30af72da7b13938934ba5037dd347b1ef139.tar.bz2 | |
Merge "Cosmetic changes to netd client files."
| -rw-r--r-- | libc/bionic/NetdClient.cpp | 6 | ||||
| -rw-r--r-- | libc/bionic/NetdClientDispatch.cpp | 6 | ||||
| -rw-r--r-- | libc/bionic/accept.cpp | 3 | ||||
| -rw-r--r-- | libc/bionic/connect.cpp | 3 | ||||
| -rw-r--r-- | libc/private/NetdClientDispatch.h (renamed from libc/private/NetdClient.h) | 17 |
5 files changed, 22 insertions, 13 deletions
diff --git a/libc/bionic/NetdClient.cpp b/libc/bionic/NetdClient.cpp index 72d90b7..75e84ee 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 adfe16d..6bd2357 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__)) @@ -25,7 +25,9 @@ extern "C" __socketcall int __accept(int, sockaddr*, socklen_t*); extern "C" __socketcall int __connect(int, const sockaddr*, socklen_t); -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, }; 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 index b2ce7a6..0390bfb 100644 --- a/libc/private/NetdClient.h +++ b/libc/private/NetdClientDispatch.h @@ -14,16 +14,21 @@ * 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> +__BEGIN_DECLS + struct NetdClientDispatch { - int (*accept)(int, sockaddr*, socklen_t*); - int (*connect)(int, const sockaddr*, socklen_t); + int (*accept)(int, struct sockaddr*, socklen_t*); + int (*connect)(int, const struct sockaddr*, socklen_t); }; -extern NetdClientDispatch __netdClientDispatch; +extern __LIBC_HIDDEN__ struct NetdClientDispatch __netdClientDispatch; + +__END_DECLS -#endif // PRIVATE_NETD_CLIENT_H +#endif // PRIVATE_NETD_CLIENT_DISPATCH_H |
