am 59a4a10f: am d57d710f: Merge "Fix build (take two)."

* commit '59a4a10f097a0bdd8d5e9aa52ce1139ccabf82b1':
  Fix build (take two).
This commit is contained in:
Sreeram Ramachandran 2014-05-14 00:51:49 +00:00 committed by Android Git Automerger
commit 4d61e7b549
3 changed files with 34 additions and 19 deletions

View File

@ -142,6 +142,7 @@ libc_bionic_src_files := \
bionic/mkfifo.cpp \
bionic/mknod.cpp \
bionic/mntent.cpp \
bionic/NetdClientDispatch.cpp \
bionic/open.cpp \
bionic/pause.cpp \
bionic/pipe.cpp \
@ -847,7 +848,6 @@ LOCAL_SRC_FILES := \
bionic/dlmalloc.c \
bionic/malloc_debug_common.cpp \
bionic/libc_init_static.cpp \
bionic/NetdClient.cpp \
LOCAL_CFLAGS := $(libc_common_cflags) \
-DLIBC_STATIC

View File

@ -14,24 +14,14 @@
* limitations under the License.
*/
#ifdef LIBC_STATIC
#error NetdClient.cpp should NOT be included in static libc builds.
#endif
#include <private/NetdClient.h>
#include <private/libc_logging.h>
#include <pthread.h>
#ifdef __i386__
#define __socketcall __attribute__((__cdecl__))
#else
#define __socketcall
#endif
extern "C" __socketcall int __connect(int, const sockaddr*, socklen_t);
NetdClientDispatch __netdClientDispatch __attribute__((aligned(32))) = {
__connect
};
#ifndef LIBC_STATIC
#include <dlfcn.h>
template <typename FunctionType>
@ -56,13 +46,9 @@ static void netdClientInitImpl() {
static pthread_once_t netdClientInitOnce = PTHREAD_ONCE_INIT;
#endif // LIBC_STATIC
extern "C" __LIBC_HIDDEN__ void netdClientInit() {
#ifndef LIBC_STATIC
if (pthread_once(&netdClientInitOnce, netdClientInitImpl)) {
__libc_format_log(ANDROID_LOG_ERROR, "netdClient",
"Unable to initialize netd_client component.");
}
#endif // LIBC_STATIC
}

View File

@ -0,0 +1,29 @@
/*
* 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>
#ifdef __i386__
#define __socketcall __attribute__((__cdecl__))
#else
#define __socketcall
#endif
extern "C" __socketcall int __connect(int, const sockaddr*, socklen_t);
NetdClientDispatch __netdClientDispatch __attribute__((aligned(32))) = {
__connect
};