summaryrefslogtreecommitdiffstats
path: root/libcutils
diff options
context:
space:
mode:
Diffstat (limited to 'libcutils')
-rw-r--r--libcutils/Android.mk30
-rw-r--r--libcutils/android_reboot.c7
-rw-r--r--libcutils/arch-x86/android_memset16.S7
-rw-r--r--libcutils/arch-x86/android_memset32.S8
-rwxr-xr-x[-rw-r--r--]libcutils/arch-x86/sse2-memset16-atom.S8
-rwxr-xr-x[-rw-r--r--]libcutils/arch-x86/sse2-memset32-atom.S8
-rw-r--r--libcutils/ashmem-dev.c2
-rw-r--r--libcutils/debugger.c2
-rw-r--r--libcutils/dir_hash.c1
-rw-r--r--libcutils/iosched_policy.c9
-rw-r--r--libcutils/list.c37
-rw-r--r--libcutils/socket_local_client.c4
-rw-r--r--libcutils/str_parms.c13
13 files changed, 46 insertions, 90 deletions
diff --git a/libcutils/Android.mk b/libcutils/Android.mk
index 0fd5a57..93bccb0 100644
--- a/libcutils/Android.mk
+++ b/libcutils/Android.mk
@@ -37,7 +37,6 @@ commonSources := \
config_utils.c \
cpu_info.c \
load_file.c \
- list.c \
open_memstream.c \
strdup16to8.c \
strdup8to16.c \
@@ -96,11 +95,6 @@ include $(BUILD_HOST_STATIC_LIBRARY)
# Shared and static library for target
# ========================================================
-# This is needed in LOCAL_C_INCLUDES to access the C library's private
-# header named <bionic_time.h>
-#
-libcutils_c_includes := bionic/libc/private
-
include $(CLEAR_VARS)
LOCAL_MODULE := libcutils
LOCAL_SRC_FILES := $(commonSources) \
@@ -115,21 +109,21 @@ LOCAL_SRC_FILES := $(commonSources) \
uevent.c
ifeq ($(TARGET_ARCH),arm)
-LOCAL_SRC_FILES += arch-arm/memset32.S
+ LOCAL_SRC_FILES += arch-arm/memset32.S
else # !arm
-ifeq ($(TARGET_ARCH_VARIANT),x86-atom)
-LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32
-LOCAL_SRC_FILES += arch-x86/android_memset16.S arch-x86/android_memset32.S memory.c
-else # !x86-atom
-ifeq ($(TARGET_ARCH),mips)
-LOCAL_SRC_FILES += arch-mips/android_memset.c
-else # !mips
-LOCAL_SRC_FILES += memory.c
-endif # !mips
-endif # !x86-atom
+ ifeq ($(TARGET_ARCH),x86)
+ LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32
+ LOCAL_SRC_FILES += arch-x86/android_memset16.S arch-x86/android_memset32.S memory.c
+ else # !x86
+ ifeq ($(TARGET_ARCH),mips)
+ LOCAL_SRC_FILES += arch-mips/android_memset.c
+ else # !mips
+ LOCAL_SRC_FILES += memory.c
+ endif # !mips
+ endif # !x86
endif # !arm
-LOCAL_C_INCLUDES := $(libcutils_c_includes) $(KERNEL_HEADERS)
+LOCAL_C_INCLUDES := $(libcutils_c_includes)
LOCAL_STATIC_LIBRARIES := liblog
LOCAL_CFLAGS += $(targetSmpFlag)
include $(BUILD_STATIC_LIBRARY)
diff --git a/libcutils/android_reboot.c b/libcutils/android_reboot.c
index 16f82bb..b7895fa 100644
--- a/libcutils/android_reboot.c
+++ b/libcutils/android_reboot.c
@@ -16,6 +16,7 @@
#include <unistd.h>
#include <sys/reboot.h>
+#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -24,6 +25,8 @@
#include <cutils/android_reboot.h>
+#define UNUSED __attribute__((unused))
+
/* Check to see if /proc/mounts contains any writeable filesystems
* backed by a block device.
* Return true if none found, else return false.
@@ -101,7 +104,7 @@ static void remount_ro(void)
}
-int android_reboot(int cmd, int flags, char *arg)
+int android_reboot(int cmd, int flags UNUSED, char *arg)
{
int ret;
@@ -118,7 +121,7 @@ int android_reboot(int cmd, int flags, char *arg)
break;
case ANDROID_RB_RESTART2:
- ret = __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
+ ret = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
LINUX_REBOOT_CMD_RESTART2, arg);
break;
diff --git a/libcutils/arch-x86/android_memset16.S b/libcutils/arch-x86/android_memset16.S
index b1f09cb..f8b79bd 100644
--- a/libcutils/arch-x86/android_memset16.S
+++ b/libcutils/arch-x86/android_memset16.S
@@ -17,16 +17,9 @@
* Contributed by: Intel Corporation
*/
-#if defined(USE_SSE2)
-
# include "cache_wrapper.S"
# undef __i686
# define USE_AS_ANDROID
# define sse2_memset16_atom android_memset16
# include "sse2-memset16-atom.S"
-#else
-
-# include "memset16.S"
-
-#endif
diff --git a/libcutils/arch-x86/android_memset32.S b/libcutils/arch-x86/android_memset32.S
index 1fb2ffe..6249fce 100644
--- a/libcutils/arch-x86/android_memset32.S
+++ b/libcutils/arch-x86/android_memset32.S
@@ -17,17 +17,9 @@
* Contributed by: Intel Corporation
*/
-#if defined(USE_SSE2)
-
# include "cache_wrapper.S"
# undef __i686
# define USE_AS_ANDROID
# define sse2_memset32_atom android_memset32
# include "sse2-memset32-atom.S"
-#else
-
-# include "memset32.S"
-
-#endif
-
diff --git a/libcutils/arch-x86/sse2-memset16-atom.S b/libcutils/arch-x86/sse2-memset16-atom.S
index cafec82..c2a762b 100644..100755
--- a/libcutils/arch-x86/sse2-memset16-atom.S
+++ b/libcutils/arch-x86/sse2-memset16-atom.S
@@ -86,7 +86,7 @@ name: \
# define SETRTNVAL movl DEST(%esp), %eax
#endif
-#ifdef SHARED
+#if (defined SHARED || defined __PIC__)
# define ENTRANCE PUSH (%ebx);
# define RETURN_END POP (%ebx); ret
# define RETURN RETURN_END; CFI_PUSH (%ebx)
@@ -344,7 +344,7 @@ L(128bytesormore):
PUSH (%ebx)
mov $SHARED_CACHE_SIZE, %ebx
#else
-# ifdef SHARED
+# if (defined SHARED || defined __PIC__)
call __i686.get_pc_thunk.bx
add $_GLOBAL_OFFSET_TABLE_, %ebx
mov __x86_shared_cache_size@GOTOFF(%ebx), %ebx
@@ -362,7 +362,7 @@ L(128bytesormore):
# define RESTORE_EBX_STATE CFI_PUSH (%ebx)
cmp $DATA_CACHE_SIZE, %ecx
#else
-# ifdef SHARED
+# if (defined SHARED || defined __PIC__)
# define RESTORE_EBX_STATE
call __i686.get_pc_thunk.bx
add $_GLOBAL_OFFSET_TABLE_, %ebx
@@ -471,7 +471,7 @@ L(128bytesormore_nt):
jae L(128bytesormore_nt)
sfence
L(shared_cache_loop_end):
-#if defined DATA_CACHE_SIZE || !defined SHARED
+#if defined DATA_CACHE_SIZE || !(defined SHARED || defined __PIC__)
POP (%ebx)
#endif
add %ecx, %edx
diff --git a/libcutils/arch-x86/sse2-memset32-atom.S b/libcutils/arch-x86/sse2-memset32-atom.S
index 4a52484..05eb64f 100644..100755
--- a/libcutils/arch-x86/sse2-memset32-atom.S
+++ b/libcutils/arch-x86/sse2-memset32-atom.S
@@ -86,7 +86,7 @@ name: \
# define SETRTNVAL
#endif
-#ifdef SHARED
+#if (defined SHARED || defined __PIC__)
# define ENTRANCE PUSH (%ebx);
# define RETURN_END POP (%ebx); ret
# define RETURN RETURN_END; CFI_PUSH (%ebx)
@@ -259,7 +259,7 @@ L(128bytesormore):
PUSH (%ebx)
mov $SHARED_CACHE_SIZE, %ebx
#else
-# ifdef SHARED
+# if (defined SHARED || defined __PIC__)
call __i686.get_pc_thunk.bx
add $_GLOBAL_OFFSET_TABLE_, %ebx
mov __x86_shared_cache_size@GOTOFF(%ebx), %ebx
@@ -276,7 +276,7 @@ L(128bytesormore):
# define RESTORE_EBX_STATE CFI_PUSH (%ebx)
cmp $DATA_CACHE_SIZE, %ecx
#else
-# ifdef SHARED
+# if (defined SHARED || defined __PIC__)
# define RESTORE_EBX_STATE
call __i686.get_pc_thunk.bx
add $_GLOBAL_OFFSET_TABLE_, %ebx
@@ -386,7 +386,7 @@ L(128bytesormore_nt):
jae L(128bytesormore_nt)
sfence
L(shared_cache_loop_end):
-#if defined DATA_CACHE_SIZE || !defined SHARED
+#if defined DATA_CACHE_SIZE || !(defined SHARED || defined __PIC__)
POP (%ebx)
#endif
add %ecx, %edx
diff --git a/libcutils/ashmem-dev.c b/libcutils/ashmem-dev.c
index 8b71f87..3089a94 100644
--- a/libcutils/ashmem-dev.c
+++ b/libcutils/ashmem-dev.c
@@ -48,7 +48,7 @@ int ashmem_create_region(const char *name, size_t size)
return fd;
if (name) {
- char buf[ASHMEM_NAME_LEN];
+ char buf[ASHMEM_NAME_LEN] = {0};
strlcpy(buf, name, sizeof(buf));
ret = ioctl(fd, ASHMEM_SET_NAME, buf);
diff --git a/libcutils/debugger.c b/libcutils/debugger.c
index 9425006..7d907fc 100644
--- a/libcutils/debugger.c
+++ b/libcutils/debugger.c
@@ -30,6 +30,7 @@ int dump_tombstone(pid_t tid, char* pathbuf, size_t pathlen) {
debugger_msg_t msg;
msg.tid = tid;
msg.action = DEBUGGER_ACTION_DUMP_TOMBSTONE;
+ msg.abort_msg_address = 0;
int result = 0;
if (TEMP_FAILURE_RETRY(write(s, &msg, sizeof(msg))) != sizeof(msg)) {
@@ -63,6 +64,7 @@ int dump_backtrace_to_file(pid_t tid, int fd) {
debugger_msg_t msg;
msg.tid = tid;
msg.action = DEBUGGER_ACTION_DUMP_BACKTRACE;
+ msg.abort_msg_address = 0;
int result = 0;
if (TEMP_FAILURE_RETRY(write(s, &msg, sizeof(msg))) != sizeof(msg)) {
diff --git a/libcutils/dir_hash.c b/libcutils/dir_hash.c
index be14af6..098b5db 100644
--- a/libcutils/dir_hash.c
+++ b/libcutils/dir_hash.c
@@ -159,6 +159,7 @@ static int recurse(HashAlgorithm algorithm, const char *directory_path,
free(name);
free(node);
+ closedir(d);
return -1;
}
diff --git a/libcutils/iosched_policy.c b/libcutils/iosched_policy.c
index f350f58..5d90a01 100644
--- a/libcutils/iosched_policy.c
+++ b/libcutils/iosched_policy.c
@@ -1,7 +1,6 @@
-
-/* libs/cutils/iosched_policy.c
+/*
**
-** Copyright 2007, The Android Open Source Project
+** Copyright 2007-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.
@@ -27,7 +26,11 @@
#include <cutils/iosched_policy.h>
+#ifdef HAVE_ANDROID_OS
+/* #include <linux/ioprio.h> */
extern int ioprio_set(int which, int who, int ioprio);
+extern int ioprio_get(int which, int who);
+#endif
enum {
WHO_PROCESS = 1,
diff --git a/libcutils/list.c b/libcutils/list.c
deleted file mode 100644
index e13452d..0000000
--- a/libcutils/list.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2008 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 <cutils/list.h>
-
-void list_init(struct listnode *node)
-{
- node->next = node;
- node->prev = node;
-}
-
-void list_add_tail(struct listnode *head, struct listnode *item)
-{
- item->next = head;
- item->prev = head->prev;
- head->prev->next = item;
- head->prev = item;
-}
-
-void list_remove(struct listnode *item)
-{
- item->next->prev = item->prev;
- item->prev->next = item->next;
-}
diff --git a/libcutils/socket_local_client.c b/libcutils/socket_local_client.c
index 036ce2e..5310516 100644
--- a/libcutils/socket_local_client.c
+++ b/libcutils/socket_local_client.c
@@ -39,6 +39,8 @@ int socket_local_client(const char *name, int namespaceId, int type)
#include "socket_local.h"
+#define UNUSED __attribute__((unused))
+
#define LISTEN_BACKLOG 4
/* Documented in header file. */
@@ -122,7 +124,7 @@ error:
* Used by AndroidSocketImpl
*/
int socket_local_client_connect(int fd, const char *name, int namespaceId,
- int type)
+ int type UNUSED)
{
struct sockaddr_un addr;
socklen_t alen;
diff --git a/libcutils/str_parms.c b/libcutils/str_parms.c
index 9e1d2dc..7cfbcb3 100644
--- a/libcutils/str_parms.c
+++ b/libcutils/str_parms.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2011-2013 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.
@@ -30,6 +30,8 @@
#include <cutils/str_parms.h>
+#define UNUSED __attribute__((unused))
+
struct str_parms {
Hashmap *map;
};
@@ -278,10 +280,11 @@ int str_parms_get_float(struct str_parms *str_parms, const char *key,
return -ENOENT;
out = strtof(value, &end);
- if (*value != '\0' && *end == '\0')
- return 0;
+ if (*value == '\0' || *end != '\0')
+ return -EINVAL;
- return -EINVAL;
+ *val = out;
+ return 0;
}
static bool combine_strings(void *key, void *value, void *context)
@@ -318,7 +321,7 @@ char *str_parms_to_str(struct str_parms *str_parms)
return str;
}
-static bool dump_entry(void *key, void *value, void *context)
+static bool dump_entry(void *key, void *value, void *context UNUSED)
{
ALOGI("key: '%s' value: '%s'\n", (char *)key, (char *)value);
return true;