summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVijay Venkatraman <vijaykv@google.com>2017-01-24 22:43:32 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-01-24 22:43:32 +0000
commit897bc9b2b38ead33aa883359593eb4356b68bda2 (patch)
treeba77b27060b2a6802beb15b543d9b0291d47d504 /include
parentd945f27cd6958be0fb7d83305eec7de9c75ce623 (diff)
parent3c6763ca21c1150d66daf8fde9b440b1c3219fe6 (diff)
downloadsystem_core-897bc9b2b38ead33aa883359593eb4356b68bda2.tar.gz
system_core-897bc9b2b38ead33aa883359593eb4356b68bda2.tar.bz2
system_core-897bc9b2b38ead33aa883359593eb4356b68bda2.zip
Merge "Exporting C headers from system/core"
Diffstat (limited to 'include')
l---------include/cutils1
-rw-r--r--include/cutils/android_get_control_file.h37
-rw-r--r--include/cutils/android_reboot.h39
-rw-r--r--include/cutils/ashmem.h34
-rw-r--r--include/cutils/atomic.h246
-rw-r--r--include/cutils/bitops.h120
-rw-r--r--include/cutils/compiler.h44
-rw-r--r--include/cutils/config_utils.h64
-rw-r--r--include/cutils/fs.h85
-rw-r--r--include/cutils/hashmap.h150
-rw-r--r--include/cutils/iosched_policy.h38
-rw-r--r--include/cutils/jstring.h46
-rw-r--r--include/cutils/klog.h47
-rw-r--r--include/cutils/list.h88
-rw-r--r--include/cutils/log.h1
-rw-r--r--include/cutils/memory.h42
-rw-r--r--include/cutils/misc.h41
-rw-r--r--include/cutils/multiuser.h45
-rw-r--r--include/cutils/native_handle.h100
-rw-r--r--include/cutils/open_memstream.h36
-rw-r--r--include/cutils/partition_utils.h26
-rw-r--r--include/cutils/properties.h133
-rw-r--r--include/cutils/qtaguid.h66
-rw-r--r--include/cutils/record_stream.h43
-rw-r--r--include/cutils/sched_policy.h64
-rw-r--r--include/cutils/sockets.h161
-rw-r--r--include/cutils/str_parms.h60
-rw-r--r--include/cutils/threads.h148
-rw-r--r--include/cutils/trace.h257
-rw-r--r--include/cutils/uevent.h36
l---------include/log1
-rw-r--r--include/log/event_tag_map.h65
-rw-r--r--include/log/log.h871
-rw-r--r--include/log/log_event_list.h297
-rw-r--r--include/log/logd.h1
-rw-r--r--include/log/logger.h1
-rw-r--r--include/log/logprint.h163
-rw-r--r--include/log/uio.h51
l---------[-rw-r--r--]include/private/android_logger.h195
39 files changed, 3 insertions, 3940 deletions
diff --git a/include/cutils b/include/cutils
new file mode 120000
index 000000000..ac2ed4004
--- /dev/null
+++ b/include/cutils
@@ -0,0 +1 @@
+../libcutils/include/cutils/ \ No newline at end of file
diff --git a/include/cutils/android_get_control_file.h b/include/cutils/android_get_control_file.h
deleted file mode 100644
index ed8fbf830..000000000
--- a/include/cutils/android_get_control_file.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#ifndef __CUTILS_ANDROID_GET_CONTROL_FILE_H
-#define __CUTILS_ANDROID_GET_CONTROL_FILE_H
-
-#define ANDROID_FILE_ENV_PREFIX "ANDROID_FILE_"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * android_get_control_file - simple helper function to get the file
- * descriptor of our init-managed file. `path' is the filename path as
- * given in init.rc. Returns -1 on error.
- */
-int android_get_control_file(const char* path);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CUTILS_ANDROID_GET_CONTROL_FILE_H */
diff --git a/include/cutils/android_reboot.h b/include/cutils/android_reboot.h
deleted file mode 100644
index a3861a02d..000000000
--- a/include/cutils/android_reboot.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2011, 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.
- */
-
-#ifndef __CUTILS_ANDROID_REBOOT_H__
-#define __CUTILS_ANDROID_REBOOT_H__
-
-#include <mntent.h>
-
-__BEGIN_DECLS
-
-/* Commands */
-#define ANDROID_RB_RESTART 0xDEAD0001
-#define ANDROID_RB_POWEROFF 0xDEAD0002
-#define ANDROID_RB_RESTART2 0xDEAD0003
-
-/* Properties */
-#define ANDROID_RB_PROPERTY "sys.powerctl"
-
-int android_reboot(int cmd, int flags, const char *arg);
-int android_reboot_with_callback(
- int cmd, int flags, const char *arg,
- void (*cb_on_remount)(const struct mntent*));
-
-__END_DECLS
-
-#endif /* __CUTILS_ANDROID_REBOOT_H__ */
diff --git a/include/cutils/ashmem.h b/include/cutils/ashmem.h
deleted file mode 100644
index d80caa698..000000000
--- a/include/cutils/ashmem.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* cutils/ashmem.h
- **
- ** Copyright 2008 The Android Open Source Project
- **
- ** This file is dual licensed. It may be redistributed and/or modified
- ** under the terms of the Apache 2.0 License OR version 2 of the GNU
- ** General Public License.
- */
-
-#ifndef _CUTILS_ASHMEM_H
-#define _CUTILS_ASHMEM_H
-
-#include <stddef.h>
-
-#if defined(__BIONIC__)
-#include <linux/ashmem.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int ashmem_valid(int fd);
-int ashmem_create_region(const char *name, size_t size);
-int ashmem_set_prot_region(int fd, int prot);
-int ashmem_pin_region(int fd, size_t offset, size_t len);
-int ashmem_unpin_region(int fd, size_t offset, size_t len);
-int ashmem_get_size_region(int fd);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CUTILS_ASHMEM_H */
diff --git a/include/cutils/atomic.h b/include/cutils/atomic.h
deleted file mode 100644
index 0c88bfedd..000000000
--- a/include/cutils/atomic.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#ifndef ANDROID_CUTILS_ATOMIC_H
-#define ANDROID_CUTILS_ATOMIC_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <stdatomic.h>
-
-#ifndef ANDROID_ATOMIC_INLINE
-#define ANDROID_ATOMIC_INLINE static inline
-#endif
-
-/*
- * A handful of basic atomic operations.
- * THESE ARE HERE FOR LEGACY REASONS ONLY. AVOID.
- *
- * PREFERRED ALTERNATIVES:
- * - Use C++/C/pthread locks/mutexes whenever there is not a
- * convincing reason to do otherwise. Note that very clever and
- * complicated, but correct, lock-free code is often slower than
- * using locks, especially where nontrivial data structures
- * are involved.
- * - C11 stdatomic.h.
- * - Where supported, C++11 std::atomic<T> .
- *
- * PLEASE STOP READING HERE UNLESS YOU ARE TRYING TO UNDERSTAND
- * OR UPDATE OLD CODE.
- *
- * The "acquire" and "release" terms can be defined intuitively in terms
- * of the placement of memory barriers in a simple lock implementation:
- * - wait until compare-and-swap(lock-is-free --> lock-is-held) succeeds
- * - barrier
- * - [do work]
- * - barrier
- * - store(lock-is-free)
- * In very crude terms, the initial (acquire) barrier prevents any of the
- * "work" from happening before the lock is held, and the later (release)
- * barrier ensures that all of the work happens before the lock is released.
- * (Think of cached writes, cache read-ahead, and instruction reordering
- * around the CAS and store instructions.)
- *
- * The barriers must apply to both the compiler and the CPU. Note it is
- * legal for instructions that occur before an "acquire" barrier to be
- * moved down below it, and for instructions that occur after a "release"
- * barrier to be moved up above it.
- *
- * The ARM-driven implementation we use here is short on subtlety,
- * and actually requests a full barrier from the compiler and the CPU.
- * The only difference between acquire and release is in whether they
- * are issued before or after the atomic operation with which they
- * are associated. To ease the transition to C/C++ atomic intrinsics,
- * you should not rely on this, and instead assume that only the minimal
- * acquire/release protection is provided.
- *
- * NOTE: all int32_t* values are expected to be aligned on 32-bit boundaries.
- * If they are not, atomicity is not guaranteed.
- */
-
-ANDROID_ATOMIC_INLINE
-volatile atomic_int_least32_t* to_atomic_int_least32_t(volatile const int32_t* addr) {
-#ifdef __cplusplus
- return reinterpret_cast<volatile atomic_int_least32_t*>(const_cast<volatile int32_t*>(addr));
-#else
- return (volatile atomic_int_least32_t*)addr;
-#endif
-}
-
-/*
- * Basic arithmetic and bitwise operations. These all provide a
- * barrier with "release" ordering, and return the previous value.
- *
- * These have the same characteristics (e.g. what happens on overflow)
- * as the equivalent non-atomic C operations.
- */
-ANDROID_ATOMIC_INLINE
-int32_t android_atomic_inc(volatile int32_t* addr)
-{
- volatile atomic_int_least32_t* a = to_atomic_int_least32_t(addr);
- /* Int32_t, if it exists, is the same as int_least32_t. */
- return atomic_fetch_add_explicit(a, 1, memory_order_release);
-}
-
-ANDROID_ATOMIC_INLINE
-int32_t android_atomic_dec(volatile int32_t* addr)
-{
- volatile atomic_int_least32_t* a = to_atomic_int_least32_t(addr);
- return atomic_fetch_sub_explicit(a, 1, memory_order_release);
-}
-
-ANDROID_ATOMIC_INLINE
-int32_t android_atomic_add(int32_t value, volatile int32_t* addr)
-{
- volatile atomic_int_least32_t* a = to_atomic_int_least32_t(addr);
- return atomic_fetch_add_explicit(a, value, memory_order_release);
-}
-
-ANDROID_ATOMIC_INLINE
-int32_t android_atomic_and(int32_t value, volatile int32_t* addr)
-{
- volatile atomic_int_least32_t* a = to_atomic_int_least32_t(addr);
- return atomic_fetch_and_explicit(a, value, memory_order_release);
-}
-
-ANDROID_ATOMIC_INLINE
-int32_t android_atomic_or(int32_t value, volatile int32_t* addr)
-{
- volatile atomic_int_least32_t* a = to_atomic_int_least32_t(addr);
- return atomic_fetch_or_explicit(a, value, memory_order_release);
-}
-
-/*
- * Perform an atomic load with "acquire" or "release" ordering.
- *
- * Note that the notion of a "release" ordering for a load does not
- * really fit into the C11 or C++11 memory model. The extra ordering
- * is normally observable only by code using memory_order_relaxed
- * atomics, or data races. In the rare cases in which such ordering
- * is called for, use memory_order_relaxed atomics and a leading
- * atomic_thread_fence (typically with memory_order_acquire,
- * not memory_order_release!) instead. If you do not understand
- * this comment, you are in the vast majority, and should not be
- * using release loads or replacing them with anything other than
- * locks or default sequentially consistent atomics.
- */
-ANDROID_ATOMIC_INLINE
-int32_t android_atomic_acquire_load(volatile const int32_t* addr)
-{
- volatile atomic_int_least32_t* a = to_atomic_int_least32_t(addr);
- return atomic_load_explicit(a, memory_order_acquire);
-}
-
-ANDROID_ATOMIC_INLINE
-int32_t android_atomic_release_load(volatile const int32_t* addr)
-{
- volatile atomic_int_least32_t* a = to_atomic_int_least32_t(addr);
- atomic_thread_fence(memory_order_seq_cst);
- /* Any reasonable clients of this interface would probably prefer */
- /* something weaker. But some remaining clients seem to be */
- /* abusing this API in strange ways, e.g. by using it as a fence. */
- /* Thus we are conservative until we can get rid of remaining */
- /* clients (and this function). */
- return atomic_load_explicit(a, memory_order_relaxed);
-}
-
-/*
- * Perform an atomic store with "acquire" or "release" ordering.
- *
- * Note that the notion of an "acquire" ordering for a store does not
- * really fit into the C11 or C++11 memory model. The extra ordering
- * is normally observable only by code using memory_order_relaxed
- * atomics, or data races. In the rare cases in which such ordering
- * is called for, use memory_order_relaxed atomics and a trailing
- * atomic_thread_fence (typically with memory_order_release,
- * not memory_order_acquire!) instead.
- */
-ANDROID_ATOMIC_INLINE
-void android_atomic_acquire_store(int32_t value, volatile int32_t* addr)
-{
- volatile atomic_int_least32_t* a = to_atomic_int_least32_t(addr);
- atomic_store_explicit(a, value, memory_order_relaxed);
- atomic_thread_fence(memory_order_seq_cst);
- /* Again overly conservative to accomodate weird clients. */
-}
-
-ANDROID_ATOMIC_INLINE
-void android_atomic_release_store(int32_t value, volatile int32_t* addr)
-{
- volatile atomic_int_least32_t* a = to_atomic_int_least32_t(addr);
- atomic_store_explicit(a, value, memory_order_release);
-}
-
-/*
- * Compare-and-set operation with "acquire" or "release" ordering.
- *
- * This returns zero if the new value was successfully stored, which will
- * only happen when *addr == oldvalue.
- *
- * (The return value is inverted from implementations on other platforms,
- * but matches the ARM ldrex/strex result.)
- *
- * Implementations that use the release CAS in a loop may be less efficient
- * than possible, because we re-issue the memory barrier on each iteration.
- */
-ANDROID_ATOMIC_INLINE
-int android_atomic_acquire_cas(int32_t oldvalue, int32_t newvalue,
- volatile int32_t* addr)
-{
- volatile atomic_int_least32_t* a = to_atomic_int_least32_t(addr);
- return !atomic_compare_exchange_strong_explicit(
- a, &oldvalue, newvalue,
- memory_order_acquire,
- memory_order_acquire);
-}
-
-ANDROID_ATOMIC_INLINE
-int android_atomic_release_cas(int32_t oldvalue, int32_t newvalue,
- volatile int32_t* addr)
-{
- volatile atomic_int_least32_t* a = to_atomic_int_least32_t(addr);
- return !atomic_compare_exchange_strong_explicit(
- a, &oldvalue, newvalue,
- memory_order_release,
- memory_order_relaxed);
-}
-
-/*
- * Fence primitives.
- */
-ANDROID_ATOMIC_INLINE
-void android_compiler_barrier(void)
-{
- __asm__ __volatile__ ("" : : : "memory");
- /* Could probably also be: */
- /* atomic_signal_fence(memory_order_seq_cst); */
-}
-
-ANDROID_ATOMIC_INLINE
-void android_memory_barrier(void)
-{
- atomic_thread_fence(memory_order_seq_cst);
-}
-
-/*
- * Aliases for code using an older version of this header. These are now
- * deprecated and should not be used. The definitions will be removed
- * in a future release.
- */
-#define android_atomic_write android_atomic_release_store
-#define android_atomic_cmpxchg android_atomic_release_cas
-
-#endif // ANDROID_CUTILS_ATOMIC_H
diff --git a/include/cutils/bitops.h b/include/cutils/bitops.h
deleted file mode 100644
index 045830d90..000000000
--- a/include/cutils/bitops.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#ifndef __CUTILS_BITOPS_H
-#define __CUTILS_BITOPS_H
-
-#include <stdbool.h>
-#include <string.h>
-#include <strings.h>
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-
-/*
- * Bitmask Operations
- *
- * Note this doesn't provide any locking/exclusion, and isn't atomic.
- * Additionally no bounds checking is done on the bitmask array.
- *
- * Example:
- *
- * int num_resources;
- * unsigned int resource_bits[BITS_TO_WORDS(num_resources)];
- * bitmask_init(resource_bits, num_resources);
- * ...
- * int bit = bitmask_ffz(resource_bits, num_resources);
- * bitmask_set(resource_bits, bit);
- * ...
- * if (bitmask_test(resource_bits, bit)) { ... }
- * ...
- * bitmask_clear(resource_bits, bit);
- *
- */
-
-#define BITS_PER_WORD (sizeof(unsigned int) * 8)
-#define BITS_TO_WORDS(x) (((x) + BITS_PER_WORD - 1) / BITS_PER_WORD)
-#define BIT_IN_WORD(x) ((x) % BITS_PER_WORD)
-#define BIT_WORD(x) ((x) / BITS_PER_WORD)
-#define BIT_MASK(x) (1 << BIT_IN_WORD(x))
-
-static inline void bitmask_init(unsigned int *bitmask, int num_bits)
-{
- memset(bitmask, 0, BITS_TO_WORDS(num_bits)*sizeof(unsigned int));
-}
-
-static inline int bitmask_ffz(unsigned int *bitmask, int num_bits)
-{
- int bit, result;
- size_t i;
-
- for (i = 0; i < BITS_TO_WORDS(num_bits); i++) {
- bit = ffs(~bitmask[i]);
- if (bit) {
- // ffs is 1-indexed, return 0-indexed result
- bit--;
- result = BITS_PER_WORD * i + bit;
- if (result >= num_bits)
- return -1;
- return result;
- }
- }
- return -1;
-}
-
-static inline int bitmask_weight(unsigned int *bitmask, int num_bits)
-{
- size_t i;
- int weight = 0;
-
- for (i = 0; i < BITS_TO_WORDS(num_bits); i++)
- weight += __builtin_popcount(bitmask[i]);
- return weight;
-}
-
-static inline void bitmask_set(unsigned int *bitmask, int bit)
-{
- bitmask[BIT_WORD(bit)] |= BIT_MASK(bit);
-}
-
-static inline void bitmask_clear(unsigned int *bitmask, int bit)
-{
- bitmask[BIT_WORD(bit)] &= ~BIT_MASK(bit);
-}
-
-static inline bool bitmask_test(unsigned int *bitmask, int bit)
-{
- return bitmask[BIT_WORD(bit)] & BIT_MASK(bit);
-}
-
-static inline int popcount(unsigned int x)
-{
- return __builtin_popcount(x);
-}
-
-static inline int popcountl(unsigned long x)
-{
- return __builtin_popcountl(x);
-}
-
-static inline int popcountll(unsigned long long x)
-{
- return __builtin_popcountll(x);
-}
-
-__END_DECLS
-
-#endif /* __CUTILS_BITOPS_H */
diff --git a/include/cutils/compiler.h b/include/cutils/compiler.h
deleted file mode 100644
index 70f884a1e..000000000
--- a/include/cutils/compiler.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef ANDROID_CUTILS_COMPILER_H
-#define ANDROID_CUTILS_COMPILER_H
-
-/*
- * helps the compiler's optimizer predicting branches
- */
-
-#ifdef __cplusplus
-# define CC_LIKELY( exp ) (__builtin_expect( !!(exp), true ))
-# define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), false ))
-#else
-# define CC_LIKELY( exp ) (__builtin_expect( !!(exp), 1 ))
-# define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), 0 ))
-#endif
-
-/**
- * exports marked symbols
- *
- * if used on a C++ class declaration, this macro must be inserted
- * after the "class" keyword. For instance:
- *
- * template <typename TYPE>
- * class ANDROID_API Singleton { }
- */
-
-#define ANDROID_API __attribute__((visibility("default")))
-
-#endif // ANDROID_CUTILS_COMPILER_H
diff --git a/include/cutils/config_utils.h b/include/cutils/config_utils.h
deleted file mode 100644
index 2dea6f19f..000000000
--- a/include/cutils/config_utils.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-#ifndef __CUTILS_CONFIG_UTILS_H
-#define __CUTILS_CONFIG_UTILS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct cnode cnode;
-
-
-struct cnode
-{
- cnode *next;
- cnode *first_child;
- cnode *last_child;
- const char *name;
- const char *value;
-};
-
-/* parse a text string into a config node tree */
-void config_load(cnode *root, char *data);
-
-/* parse a file into a config node tree */
-void config_load_file(cnode *root, const char *fn);
-
-/* create a single config node */
-cnode* config_node(const char *name, const char *value);
-
-/* locate a named child of a config node */
-cnode* config_find(cnode *root, const char *name);
-
-/* look up a child by name and return the boolean value */
-int config_bool(cnode *root, const char *name, int _default);
-
-/* look up a child by name and return the string value */
-const char* config_str(cnode *root, const char *name, const char *_default);
-
-/* add a named child to a config node (or modify it if it already exists) */
-void config_set(cnode *root, const char *name, const char *value);
-
-/* free a config node tree */
-void config_free(cnode *root);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/cutils/fs.h b/include/cutils/fs.h
deleted file mode 100644
index a34ce8602..000000000
--- a/include/cutils/fs.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#ifndef __CUTILS_FS_H
-#define __CUTILS_FS_H
-
-#include <sys/types.h>
-#include <unistd.h>
-
-/*
- * TEMP_FAILURE_RETRY is defined by some, but not all, versions of
- * <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
- * not already defined, then define it here.
- */
-#ifndef TEMP_FAILURE_RETRY
-/* Used to retry syscalls that can return EINTR. */
-#define TEMP_FAILURE_RETRY(exp) ({ \
- typeof (exp) _rc; \
- do { \
- _rc = (exp); \
- } while (_rc == -1 && errno == EINTR); \
- _rc; })
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Ensure that directory exists with given mode and owners. If it exists
- * with a different mode or owners, they are fixed to match the given values.
- */
-extern int fs_prepare_dir(const char* path, mode_t mode, uid_t uid, gid_t gid);
-
-/*
- * Ensure that directory exists with given mode and owners. If it exists
- * with different owners, they are not fixed and -1 is returned.
- */
-extern int fs_prepare_dir_strict(const char* path, mode_t mode, uid_t uid, gid_t gid);
-
-/*
- * Ensure that file exists with given mode and owners. If it exists
- * with different owners, they are not fixed and -1 is returned.
- */
-extern int fs_prepare_file_strict(const char* path, mode_t mode, uid_t uid, gid_t gid);
-
-
-/*
- * Read single plaintext integer from given file, correctly handling files
- * partially written with fs_write_atomic_int().
- */
-extern int fs_read_atomic_int(const char* path, int* value);
-
-/*
- * Write single plaintext integer to given file, creating backup while
- * in progress.
- */
-extern int fs_write_atomic_int(const char* path, int value);
-
-/*
- * Ensure that all directories along given path exist, creating parent
- * directories as needed. Validates that given path is absolute and that
- * it contains no relative "." or ".." paths or symlinks. Last path segment
- * is treated as filename and ignored, unless the path ends with "/".
- */
-extern int fs_mkdirs(const char* path, mode_t mode);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CUTILS_FS_H */
diff --git a/include/cutils/hashmap.h b/include/cutils/hashmap.h
deleted file mode 100644
index 5cb344c15..000000000
--- a/include/cutils/hashmap.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-/**
- * Hash map.
- */
-
-#ifndef __HASHMAP_H
-#define __HASHMAP_H
-
-#include <stdbool.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** A hash map. */
-typedef struct Hashmap Hashmap;
-
-/**
- * Creates a new hash map. Returns NULL if memory allocation fails.
- *
- * @param initialCapacity number of expected entries
- * @param hash function which hashes keys
- * @param equals function which compares keys for equality
- */
-Hashmap* hashmapCreate(size_t initialCapacity,
- int (*hash)(void* key), bool (*equals)(void* keyA, void* keyB));
-
-/**
- * Frees the hash map. Does not free the keys or values themselves.
- */
-void hashmapFree(Hashmap* map);
-
-/**
- * Hashes the memory pointed to by key with the given size. Useful for
- * implementing hash functions.
- */
-int hashmapHash(void* key, size_t keySize);
-
-/**
- * Puts value for the given key in the map. Returns pre-existing value if
- * any.
- *
- * If memory allocation fails, this function returns NULL, the map's size
- * does not increase, and errno is set to ENOMEM.
- */
-void* hashmapPut(Hashmap* map, void* key, void* value);
-
-/**
- * Gets a value from the map. Returns NULL if no entry for the given key is
- * found or if the value itself is NULL.
- */
-void* hashmapGet(Hashmap* map, void* key);
-
-/**
- * Returns true if the map contains an entry for the given key.
- */
-bool hashmapContainsKey(Hashmap* map, void* key);
-
-/**
- * Gets the value for a key. If a value is not found, this function gets a
- * value and creates an entry using the given callback.
- *
- * If memory allocation fails, the callback is not called, this function
- * returns NULL, and errno is set to ENOMEM.
- */
-void* hashmapMemoize(Hashmap* map, void* key,
- void* (*initialValue)(void* key, void* context), void* context);
-
-/**
- * Removes an entry from the map. Returns the removed value or NULL if no
- * entry was present.
- */
-void* hashmapRemove(Hashmap* map, void* key);
-
-/**
- * Gets the number of entries in this map.
- */
-size_t hashmapSize(Hashmap* map);
-
-/**
- * Invokes the given callback on each entry in the map. Stops iterating if
- * the callback returns false.
- */
-void hashmapForEach(Hashmap* map,
- bool (*callback)(void* key, void* value, void* context),
- void* context);
-
-/**
- * Concurrency support.
- */
-
-/**
- * Locks the hash map so only the current thread can access it.
- */
-void hashmapLock(Hashmap* map);
-
-/**
- * Unlocks the hash map so other threads can access it.
- */
-void hashmapUnlock(Hashmap* map);
-
-/**
- * Key utilities.
- */
-
-/**
- * Hashes int keys. 'key' is a pointer to int.
- */
-int hashmapIntHash(void* key);
-
-/**
- * Compares two int keys for equality.
- */
-bool hashmapIntEquals(void* keyA, void* keyB);
-
-/**
- * For debugging.
- */
-
-/**
- * Gets current capacity.
- */
-size_t hashmapCurrentCapacity(Hashmap* map);
-
-/**
- * Counts the number of entry collisions.
- */
-size_t hashmapCountCollisions(Hashmap* map);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __HASHMAP_H */
diff --git a/include/cutils/iosched_policy.h b/include/cutils/iosched_policy.h
deleted file mode 100644
index 07c5d1fca..000000000
--- a/include/cutils/iosched_policy.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#ifndef __CUTILS_IOSCHED_POLICY_H
-#define __CUTILS_IOSCHED_POLICY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- IoSchedClass_NONE,
- IoSchedClass_RT,
- IoSchedClass_BE,
- IoSchedClass_IDLE,
-} IoSchedClass;
-
-extern int android_set_ioprio(int pid, IoSchedClass clazz, int ioprio);
-extern int android_get_ioprio(int pid, IoSchedClass *clazz, int *ioprio);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CUTILS_IOSCHED_POLICY_H */
diff --git a/include/cutils/jstring.h b/include/cutils/jstring.h
deleted file mode 100644
index a3426081a..000000000
--- a/include/cutils/jstring.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-#ifndef __CUTILS_STRING16_H
-#define __CUTILS_STRING16_H
-
-#include <stdint.h>
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if __STDC_VERSION__ < 201112L && __cplusplus < 201103L
- typedef uint16_t char16_t;
-#endif
- // otherwise char16_t is a keyword with the right semantics
-
-extern char * strndup16to8 (const char16_t* s, size_t n);
-extern size_t strnlen16to8 (const char16_t* s, size_t n);
-extern char * strncpy16to8 (char *dest, const char16_t*s, size_t n);
-
-extern char16_t * strdup8to16 (const char* s, size_t *out_len);
-extern size_t strlen8to16 (const char* utf8Str);
-extern char16_t * strcpy8to16 (char16_t *dest, const char*s, size_t *out_len);
-extern char16_t * strcpylen8to16 (char16_t *dest, const char*s, int length,
- size_t *out_len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CUTILS_STRING16_H */
diff --git a/include/cutils/klog.h b/include/cutils/klog.h
deleted file mode 100644
index e7cd30046..000000000
--- a/include/cutils/klog.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef _CUTILS_KLOG_H_
-#define _CUTILS_KLOG_H_
-
-#include <sys/cdefs.h>
-#include <sys/uio.h>
-#include <stdarg.h>
-
-__BEGIN_DECLS
-
-int klog_get_level(void);
-void klog_set_level(int level);
-
-void klog_write(int level, const char *fmt, ...)
- __attribute__ ((format(printf, 2, 3)));
-void klog_writev(int level, const struct iovec* iov, int iov_count);
-
-__END_DECLS
-
-#define KLOG_ERROR_LEVEL 3
-#define KLOG_WARNING_LEVEL 4
-#define KLOG_NOTICE_LEVEL 5
-#define KLOG_INFO_LEVEL 6
-#define KLOG_DEBUG_LEVEL 7
-
-#define KLOG_ERROR(tag,x...) klog_write(KLOG_ERROR_LEVEL, "<3>" tag ": " x)
-#define KLOG_WARNING(tag,x...) klog_write(KLOG_WARNING_LEVEL, "<4>" tag ": " x)
-#define KLOG_NOTICE(tag,x...) klog_write(KLOG_NOTICE_LEVEL, "<5>" tag ": " x)
-#define KLOG_INFO(tag,x...) klog_write(KLOG_INFO_LEVEL, "<6>" tag ": " x)
-#define KLOG_DEBUG(tag,x...) klog_write(KLOG_DEBUG_LEVEL, "<7>" tag ": " x)
-
-#endif
diff --git a/include/cutils/list.h b/include/cutils/list.h
deleted file mode 100644
index 4ba2cfd49..000000000
--- a/include/cutils/list.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2008-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.
- * 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.
- */
-
-#ifndef _CUTILS_LIST_H_
-#define _CUTILS_LIST_H_
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-struct listnode
-{
- struct listnode *next;
- struct listnode *prev;
-};
-
-#define node_to_item(node, container, member) \
- (container *) (((char*) (node)) - offsetof(container, member))
-
-#define list_declare(name) \
- struct listnode name = { \
- .next = &name, \
- .prev = &name, \
- }
-
-#define list_for_each(node, list) \
- for (node = (list)->next; node != (list); node = node->next)
-
-#define list_for_each_reverse(node, list) \
- for (node = (list)->prev; node != (list); node = node->prev)
-
-#define list_for_each_safe(node, n, list) \
- for (node = (list)->next, n = node->next; \
- node != (list); \
- node = n, n = node->next)
-
-static inline void list_init(struct listnode *node)
-{
- node->next = node;
- node->prev = node;
-}
-
-static inline void list_add_tail(struct listnode *head, struct listnode *item)
-{
- item->next = head;
- item->prev = head->prev;
- head->prev->next = item;
- head->prev = item;
-}
-
-static inline void list_add_head(struct listnode *head, struct listnode *item)
-{
- item->next = head->next;
- item->prev = head;
- head->next->prev = item;
- head->next = item;
-}
-
-static inline void list_remove(struct listnode *item)
-{
- item->next->prev = item->prev;
- item->prev->next = item->next;
-}
-
-#define list_empty(list) ((list) == (list)->next)
-#define list_head(list) ((list)->next)
-#define list_tail(list) ((list)->prev)
-
-#ifdef __cplusplus
-};
-#endif /* __cplusplus */
-
-#endif
diff --git a/include/cutils/log.h b/include/cutils/log.h
deleted file mode 100644
index 0e0248e50..000000000
--- a/include/cutils/log.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <log/log.h>
diff --git a/include/cutils/memory.h b/include/cutils/memory.h
deleted file mode 100644
index 4d2688255..000000000
--- a/include/cutils/memory.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-#ifndef ANDROID_CUTILS_MEMORY_H
-#define ANDROID_CUTILS_MEMORY_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* size is given in bytes and must be multiple of 2 */
-void android_memset16(uint16_t* dst, uint16_t value, size_t size);
-
-/* size is given in bytes and must be multiple of 4 */
-void android_memset32(uint32_t* dst, uint32_t value, size_t size);
-
-#if defined(__GLIBC__) || defined(_WIN32)
-/* Declaration of strlcpy() for platforms that don't already have it. */
-size_t strlcpy(char *dst, const char *src, size_t size);
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // ANDROID_CUTILS_MEMORY_H
diff --git a/include/cutils/misc.h b/include/cutils/misc.h
deleted file mode 100644
index 0de505f27..000000000
--- a/include/cutils/misc.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-#ifndef __CUTILS_MISC_H
-#define __CUTILS_MISC_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /* Load an entire file into a malloc'd chunk of memory
- * that is length_of_file + 1 (null terminator). If
- * sz is non-zero, return the size of the file via sz.
- * Returns 0 on failure.
- */
-extern void *load_file(const char *fn, unsigned *sz);
-
- /* This is the range of UIDs (and GIDs) that are reserved
- * for assigning to applications.
- */
-#define FIRST_APPLICATION_UID 10000
-#define LAST_APPLICATION_UID 99999
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CUTILS_MISC_H */
diff --git a/include/cutils/multiuser.h b/include/cutils/multiuser.h
deleted file mode 100644
index 5bd9c7b82..000000000
--- a/include/cutils/multiuser.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#ifndef __CUTILS_MULTIUSER_H
-#define __CUTILS_MULTIUSER_H
-
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef uid_t userid_t;
-typedef uid_t appid_t;
-
-extern userid_t multiuser_get_user_id(uid_t uid);
-extern appid_t multiuser_get_app_id(uid_t uid);
-
-extern uid_t multiuser_get_uid(userid_t user_id, appid_t app_id);
-
-extern gid_t multiuser_get_cache_gid(userid_t user_id, appid_t app_id);
-extern gid_t multiuser_get_ext_gid(userid_t user_id, appid_t app_id);
-extern gid_t multiuser_get_shared_gid(userid_t user_id, appid_t app_id);
-
-/* TODO: switch callers over to multiuser_get_shared_gid() */
-extern gid_t multiuser_get_shared_app_gid(uid_t uid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CUTILS_MULTIUSER_H */
diff --git a/include/cutils/native_handle.h b/include/cutils/native_handle.h
deleted file mode 100644
index 7d6a98802..000000000
--- a/include/cutils/native_handle.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef NATIVE_HANDLE_H_
-#define NATIVE_HANDLE_H_
-
-#include <stdalign.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Declare a char array for use with native_handle_init */
-#define NATIVE_HANDLE_DECLARE_STORAGE(name, maxFds, maxInts) \
- alignas(native_handle_t) char name[ \
- sizeof(native_handle_t) + sizeof(int) * (maxFds + maxInts)]
-
-typedef struct native_handle
-{
- int version; /* sizeof(native_handle_t) */
- int numFds; /* number of file-descriptors at &data[0] */
- int numInts; /* number of ints at &data[numFds] */
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wzero-length-array"
-#endif
- int data[0]; /* numFds + numInts ints */
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-} native_handle_t;
-
-/*
- * native_handle_close
- *
- * closes the file descriptors contained in this native_handle_t
- *
- * return 0 on success, or a negative error code on failure
- *
- */
-int native_handle_close(const native_handle_t* h);
-
-/*
- * native_handle_init
- *
- * Initializes a native_handle_t from storage. storage must be declared with
- * NATIVE_HANDLE_DECLARE_STORAGE. numFds and numInts must not respectively
- * exceed maxFds and maxInts used to declare the storage.
- */
-native_handle_t* native_handle_init(char* storage, int numFds, int numInts);
-
-/*
- * native_handle_create
- *
- * creates a native_handle_t and initializes it. must be destroyed with
- * native_handle_delete().
- *
- */
-native_handle_t* native_handle_create(int numFds, int numInts);
-
-/*
- * native_handle_clone
- *
- * creates a native_handle_t and initializes it from another native_handle_t.
- * Must be destroyed with native_handle_delete().
- *
- */
-native_handle_t* native_handle_clone(const native_handle_t* handle);
-
-/*
- * native_handle_delete
- *
- * frees a native_handle_t allocated with native_handle_create().
- * This ONLY frees the memory allocated for the native_handle_t, but doesn't
- * close the file descriptors; which can be achieved with native_handle_close().
- *
- * return 0 on success, or a negative error code on failure
- *
- */
-int native_handle_delete(native_handle_t* h);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NATIVE_HANDLE_H_ */
diff --git a/include/cutils/open_memstream.h b/include/cutils/open_memstream.h
deleted file mode 100644
index c1a81ebbc..000000000
--- a/include/cutils/open_memstream.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef __CUTILS_OPEN_MEMSTREAM_H__
-#define __CUTILS_OPEN_MEMSTREAM_H__
-
-#include <stdio.h>
-
-#if defined(__APPLE__)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-FILE* open_memstream(char** bufp, size_t* sizep);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __APPLE__ */
-
-#endif /*__CUTILS_OPEN_MEMSTREAM_H__*/
diff --git a/include/cutils/partition_utils.h b/include/cutils/partition_utils.h
deleted file mode 100644
index 72ca80d35..000000000
--- a/include/cutils/partition_utils.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2011, 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.
- */
-
-#ifndef __CUTILS_PARTITION_WIPED_H__
-#define __CUTILS_PARTITION_WIPED_H__
-
-__BEGIN_DECLS
-
-int partition_wiped(char *source);
-
-__END_DECLS
-
-#endif /* __CUTILS_PARTITION_WIPED_H__ */
diff --git a/include/cutils/properties.h b/include/cutils/properties.h
deleted file mode 100644
index adf670bf1..000000000
--- a/include/cutils/properties.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-#ifndef __CUTILS_PROPERTIES_H
-#define __CUTILS_PROPERTIES_H
-
-#include <sys/cdefs.h>
-#include <stddef.h>
-#include <sys/system_properties.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* System properties are *small* name value pairs managed by the
-** property service. If your data doesn't fit in the provided
-** space it is not appropriate for a system property.
-**
-** WARNING: system/bionic/include/sys/system_properties.h also defines
-** these, but with different names. (TODO: fix that)
-*/
-#define PROPERTY_KEY_MAX PROP_NAME_MAX
-#define PROPERTY_VALUE_MAX PROP_VALUE_MAX
-
-/* property_get: returns the length of the value which will never be
-** greater than PROPERTY_VALUE_MAX - 1 and will always be zero terminated.
-** (the length does not include the terminating zero).
-**
-** If the property read fails or returns an empty value, the default
-** value is used (if nonnull).
-*/
-int property_get(const char *key, char *value, const char *default_value);
-
-/* property_get_bool: returns the value of key coerced into a
-** boolean. If the property is not set, then the default value is returned.
-**
-* The following is considered to be true (1):
-** "1", "true", "y", "yes", "on"
-**
-** The following is considered to be false (0):
-** "0", "false", "n", "no", "off"
-**
-** The conversion is whitespace-sensitive (e.g. " off" will not be false).
-**
-** If no property with this key is set (or the key is NULL) or the boolean
-** conversion fails, the default value is returned.
-**/
-int8_t property_get_bool(const char *key, int8_t default_value);
-
-/* property_get_int64: returns the value of key truncated and coerced into a
-** int64_t. If the property is not set, then the default value is used.
-**
-** The numeric conversion is identical to strtoimax with the base inferred:
-** - All digits up to the first non-digit characters are read
-** - The longest consecutive prefix of digits is converted to a long
-**
-** Valid strings of digits are:
-** - An optional sign character + or -
-** - An optional prefix indicating the base (otherwise base 10 is assumed)
-** -- 0 prefix is octal
-** -- 0x / 0X prefix is hex
-**
-** Leading/trailing whitespace is ignored. Overflow/underflow will cause
-** numeric conversion to fail.
-**
-** If no property with this key is set (or the key is NULL) or the numeric
-** conversion fails, the default value is returned.
-**/
-int64_t property_get_int64(const char *key, int64_t default_value);
-
-/* property_get_int32: returns the value of key truncated and coerced into an
-** int32_t. If the property is not set, then the default value is used.
-**
-** The numeric conversion is identical to strtoimax with the base inferred:
-** - All digits up to the first non-digit characters are read
-** - The longest consecutive prefix of digits is converted to a long
-**
-** Valid strings of digits are:
-** - An optional sign character + or -
-** - An optional prefix indicating the base (otherwise base 10 is assumed)
-** -- 0 prefix is octal
-** -- 0x / 0X prefix is hex
-**
-** Leading/trailing whitespace is ignored. Overflow/underflow will cause
-** numeric conversion to fail.
-**
-** If no property with this key is set (or the key is NULL) or the numeric
-** conversion fails, the default value is returned.
-**/
-int32_t property_get_int32(const char *key, int32_t default_value);
-
-/* property_set: returns 0 on success, < 0 on failure
-*/
-int property_set(const char *key, const char *value);
-
-int property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie);
-
-#if defined(__BIONIC_FORTIFY) && !defined(__clang__)
-
-extern int __property_get_real(const char *, char *, const char *)
- __asm__(__USER_LABEL_PREFIX__ "property_get");
-__errordecl(__property_get_too_small_error, "property_get() called with too small of a buffer");
-
-__BIONIC_FORTIFY_INLINE
-int property_get(const char *key, char *value, const char *default_value) {
- size_t bos = __bos(value);
- if (bos < PROPERTY_VALUE_MAX) {
- __property_get_too_small_error();
- }
- return __property_get_real(key, value, default_value);
-}
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/cutils/qtaguid.h b/include/cutils/qtaguid.h
deleted file mode 100644
index f8550fda8..000000000
--- a/include/cutils/qtaguid.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#ifndef __CUTILS_QTAGUID_H
-#define __CUTILS_QTAGUID_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Set tags (and owning UIDs) for network sockets.
-*/
-extern int qtaguid_tagSocket(int sockfd, int tag, uid_t uid);
-
-/*
- * Untag a network socket before closing.
-*/
-extern int qtaguid_untagSocket(int sockfd);
-
-/*
- * For the given uid, switch counter sets.
- * The kernel only keeps a limited number of sets.
- * 2 for now.
- */
-extern int qtaguid_setCounterSet(int counterSetNum, uid_t uid);
-
-/*
- * Delete all tag info that relates to the given tag an uid.
- * If the tag is 0, then ALL info about the uid is freeded.
- * The delete data also affects active tagged socketd, which are
- * then untagged.
- * The calling process can only operate on its own tags.
- * Unless it is part of the happy AID_NET_BW_ACCT group.
- * In which case it can clobber everything.
- */
-extern int qtaguid_deleteTagData(int tag, uid_t uid);
-
-/*
- * Enable/disable qtaguid functionnality at a lower level.
- * When pacified, the kernel will accept commands but do nothing.
- */
-extern int qtaguid_setPacifier(int on);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CUTILS_QTAG_UID_H */
diff --git a/include/cutils/record_stream.h b/include/cutils/record_stream.h
deleted file mode 100644
index bfac87a53..000000000
--- a/include/cutils/record_stream.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-/*
- * A simple utility for reading fixed records out of a stream fd
- */
-
-#ifndef _CUTILS_RECORD_STREAM_H
-#define _CUTILS_RECORD_STREAM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-typedef struct RecordStream RecordStream;
-
-extern RecordStream *record_stream_new(int fd, size_t maxRecordLen);
-extern void record_stream_free(RecordStream *p_rs);
-
-extern int record_stream_get_next (RecordStream *p_rs, void ** p_outRecord,
- size_t *p_outRecordLen);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /*_CUTILS_RECORD_STREAM_H*/
-
diff --git a/include/cutils/sched_policy.h b/include/cutils/sched_policy.h
deleted file mode 100644
index 591bd4478..000000000
--- a/include/cutils/sched_policy.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#ifndef __CUTILS_SCHED_POLICY_H
-#define __CUTILS_SCHED_POLICY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Keep in sync with THREAD_GROUP_* in frameworks/base/core/java/android/os/Process.java */
-typedef enum {
- SP_DEFAULT = -1,
- SP_BACKGROUND = 0,
- SP_FOREGROUND = 1,
- SP_SYSTEM = 2, // can't be used with set_sched_policy()
- SP_AUDIO_APP = 3,
- SP_AUDIO_SYS = 4,
- SP_TOP_APP = 5,
- SP_CNT,
- SP_MAX = SP_CNT - 1,
- SP_SYSTEM_DEFAULT = SP_FOREGROUND,
-} SchedPolicy;
-
-extern int set_cpuset_policy(int tid, SchedPolicy policy);
-
-/* Assign thread tid to the cgroup associated with the specified policy.
- * If the thread is a thread group leader, that is it's gettid() == getpid(),
- * then the other threads in the same thread group are _not_ affected.
- * On platforms which support gettid(), zero tid means current thread.
- * Return value: 0 for success, or -errno for error.
- */
-extern int set_sched_policy(int tid, SchedPolicy policy);
-
-/* Return the policy associated with the cgroup of thread tid via policy pointer.
- * On platforms which support gettid(), zero tid means current thread.
- * Return value: 0 for success, or -1 for error and set errno.
- */
-extern int get_sched_policy(int tid, SchedPolicy *policy);
-
-/* Return a displayable string corresponding to policy.
- * Return value: non-NULL NUL-terminated name of unspecified length;
- * the caller is responsible for displaying the useful part of the string.
- */
-extern const char *get_sched_policy_name(SchedPolicy policy);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CUTILS_SCHED_POLICY_H */
diff --git a/include/cutils/sockets.h b/include/cutils/sockets.h
deleted file mode 100644
index d724dd6a5..000000000
--- a/include/cutils/sockets.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-#ifndef __CUTILS_SOCKETS_H
-#define __CUTILS_SOCKETS_H
-
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdbool.h>
-
-#if defined(_WIN32)
-
-#include <winsock2.h>
-#include <ws2tcpip.h>
-
-typedef int socklen_t;
-typedef SOCKET cutils_socket_t;
-
-#else
-
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-typedef int cutils_socket_t;
-#define INVALID_SOCKET (-1)
-
-#endif
-
-#define ANDROID_SOCKET_ENV_PREFIX "ANDROID_SOCKET_"
-#define ANDROID_SOCKET_DIR "/dev/socket"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * android_get_control_socket - simple helper function to get the file
- * descriptor of our init-managed Unix domain socket. `name' is the name of the
- * socket, as given in init.rc. Returns -1 on error.
- */
-int android_get_control_socket(const char* name);
-
-/*
- * See also android.os.LocalSocketAddress.Namespace
- */
-// Linux "abstract" (non-filesystem) namespace
-#define ANDROID_SOCKET_NAMESPACE_ABSTRACT 0
-// Android "reserved" (/dev/socket) namespace
-#define ANDROID_SOCKET_NAMESPACE_RESERVED 1
-// Normal filesystem namespace
-#define ANDROID_SOCKET_NAMESPACE_FILESYSTEM 2
-
-/*
- * Functions to create sockets for some common usages.
- *
- * All these functions are implemented for Unix, but only a few are implemented
- * for Windows. Those which are can be identified by the cutils_socket_t
- * return type. The idea is to be able to use this return value with the
- * standard Unix socket functions on any platform.
- *
- * On Unix the returned cutils_socket_t is a standard int file descriptor and
- * can always be used as normal with all file descriptor functions.
- *
- * On Windows utils_socket_t is an unsigned int pointer, and is only valid
- * with functions that specifically take a socket, e.g. send(), sendto(),
- * recv(), and recvfrom(). General file descriptor functions such as read(),
- * write(), and close() will not work with utils_socket_t and will require
- * special handling.
- *
- * These functions return INVALID_SOCKET (-1) on failure for all platforms.
- */
-cutils_socket_t socket_network_client(const char* host, int port, int type);
-int socket_network_client_timeout(const char* host, int port, int type,
- int timeout, int* getaddrinfo_error);
-int socket_loopback_server(int port, int type);
-int socket_loopback_server6(int port, int type);
-int socket_local_server(const char* name, int namespaceId, int type);
-int socket_local_server_bind(int s, const char* name, int namespaceId);
-int socket_local_client_connect(int fd, const char *name, int namespaceId,
- int type);
-int socket_local_client(const char* name, int namespaceId, int type);
-cutils_socket_t socket_inaddr_any_server(int port, int type);
-
-/*
- * Closes a cutils_socket_t. Windows doesn't allow calling close() on a socket
- * so this is a cross-platform way to close a cutils_socket_t.
- *
- * Returns 0 on success.
- */
-int socket_close(cutils_socket_t sock);
-
-/*
- * Sets socket receive timeout using SO_RCVTIMEO. Setting |timeout_ms| to 0
- * disables receive timeouts.
- *
- * Return 0 on success.
- */
-int socket_set_receive_timeout(cutils_socket_t sock, int timeout_ms);
-
-/*
- * Returns the local port the socket is bound to or -1 on error.
- */
-int socket_get_local_port(cutils_socket_t sock);
-
-/*
- * Sends to a socket from multiple buffers; wraps writev() on Unix or WSASend()
- * on Windows. This can give significant speedup compared to calling send()
- * multiple times.
- *
- * Example usage:
- * cutils_socket_buffer_t buffers[2] = { {data0, len0}, {data1, len1} };
- * socket_send_buffers(sock, buffers, 2);
- *
- * If you try to pass more than SOCKET_SEND_BUFFERS_MAX_BUFFERS buffers into
- * this function it will return -1 without sending anything.
- *
- * Returns the number of bytes written or -1 on error.
- */
-typedef struct {
- const void* data;
- size_t length;
-} cutils_socket_buffer_t;
-
-#define SOCKET_SEND_BUFFERS_MAX_BUFFERS 16
-
-ssize_t socket_send_buffers(cutils_socket_t sock,
- const cutils_socket_buffer_t* buffers,
- size_t num_buffers);
-
-/*
- * socket_peer_is_trusted - Takes a socket which is presumed to be a
- * connected local socket (e.g. AF_LOCAL) and returns whether the peer
- * (the userid that owns the process on the other end of that socket)
- * is one of the two trusted userids, root or shell.
- *
- * Note: This only works as advertised on the Android OS and always
- * just returns true when called on other operating systems.
- */
-extern bool socket_peer_is_trusted(int fd);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CUTILS_SOCKETS_H */
diff --git a/include/cutils/str_parms.h b/include/cutils/str_parms.h
deleted file mode 100644
index aa1435a08..000000000
--- a/include/cutils/str_parms.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#ifndef __CUTILS_STR_PARMS_H
-#define __CUTILS_STR_PARMS_H
-
-#include <stdint.h>
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-
-struct str_parms;
-
-struct str_parms *str_parms_create(void);
-struct str_parms *str_parms_create_str(const char *_string);
-void str_parms_destroy(struct str_parms *str_parms);
-
-void str_parms_del(struct str_parms *str_parms, const char *key);
-
-int str_parms_add_str(struct str_parms *str_parms, const char *key,
- const char *value);
-int str_parms_add_int(struct str_parms *str_parms, const char *key, int value);
-
-int str_parms_add_float(struct str_parms *str_parms, const char *key,
- float value);
-
-// Returns non-zero if the str_parms contains the specified key.
-int str_parms_has_key(struct str_parms *str_parms, const char *key);
-
-// Gets value associated with the specified key (if present), placing it in the buffer
-// pointed to by the out_val parameter. Returns the length of the returned string value.
-// If 'key' isn't in the parms, then return -ENOENT (-2) and leave 'out_val' untouched.
-int str_parms_get_str(struct str_parms *str_parms, const char *key,
- char *out_val, int len);
-int str_parms_get_int(struct str_parms *str_parms, const char *key,
- int *out_val);
-int str_parms_get_float(struct str_parms *str_parms, const char *key,
- float *out_val);
-
-char *str_parms_to_str(struct str_parms *str_parms);
-
-/* debug */
-void str_parms_dump(struct str_parms *str_parms);
-
-__END_DECLS
-
-#endif /* __CUTILS_STR_PARMS_H */
diff --git a/include/cutils/threads.h b/include/cutils/threads.h
deleted file mode 100644
index 572749407..000000000
--- a/include/cutils/threads.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#ifndef _LIBS_CUTILS_THREADS_H
-#define _LIBS_CUTILS_THREADS_H
-
-#include <sys/types.h>
-
-#if !defined(_WIN32)
-#include <pthread.h>
-#else
-#include <windows.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/***********************************************************************/
-/***********************************************************************/
-/***** *****/
-/***** local thread storage *****/
-/***** *****/
-/***********************************************************************/
-/***********************************************************************/
-
-extern pid_t gettid();
-
-#if !defined(_WIN32)
-
-typedef struct {
- pthread_mutex_t lock;
- int has_tls;
- pthread_key_t tls;
-} thread_store_t;
-
-#define THREAD_STORE_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, 0 }
-
-#else // !defined(_WIN32)
-
-typedef struct {
- int lock_init;
- int has_tls;
- DWORD tls;
- CRITICAL_SECTION lock;
-} thread_store_t;
-
-#define THREAD_STORE_INITIALIZER { 0, 0, 0, {0, 0, 0, 0, 0, 0} }
-
-#endif // !defined(_WIN32)
-
-typedef void (*thread_store_destruct_t)(void* value);
-
-extern void* thread_store_get(thread_store_t* store);
-
-extern void thread_store_set(thread_store_t* store,
- void* value,
- thread_store_destruct_t destroy);
-
-/***********************************************************************/
-/***********************************************************************/
-/***** *****/
-/***** mutexes *****/
-/***** *****/
-/***********************************************************************/
-/***********************************************************************/
-
-#if !defined(_WIN32)
-
-typedef pthread_mutex_t mutex_t;
-
-#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
-
-static __inline__ void mutex_lock(mutex_t* lock)
-{
- pthread_mutex_lock(lock);
-}
-static __inline__ void mutex_unlock(mutex_t* lock)
-{
- pthread_mutex_unlock(lock);
-}
-static __inline__ int mutex_init(mutex_t* lock)
-{
- return pthread_mutex_init(lock, NULL);
-}
-static __inline__ void mutex_destroy(mutex_t* lock)
-{
- pthread_mutex_destroy(lock);
-}
-
-#else // !defined(_WIN32)
-
-typedef struct {
- int init;
- CRITICAL_SECTION lock[1];
-} mutex_t;
-
-#define MUTEX_INITIALIZER { 0, {{ NULL, 0, 0, NULL, NULL, 0 }} }
-
-static __inline__ void mutex_lock(mutex_t* lock)
-{
- if (!lock->init) {
- lock->init = 1;
- InitializeCriticalSection( lock->lock );
- lock->init = 2;
- } else while (lock->init != 2)
- Sleep(10);
-
- EnterCriticalSection(lock->lock);
-}
-
-static __inline__ void mutex_unlock(mutex_t* lock)
-{
- LeaveCriticalSection(lock->lock);
-}
-static __inline__ int mutex_init(mutex_t* lock)
-{
- InitializeCriticalSection(lock->lock);
- lock->init = 2;
- return 0;
-}
-static __inline__ void mutex_destroy(mutex_t* lock)
-{
- if (lock->init) {
- lock->init = 0;
- DeleteCriticalSection(lock->lock);
- }
-}
-#endif // !defined(_WIN32)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _LIBS_CUTILS_THREADS_H */
diff --git a/include/cutils/trace.h b/include/cutils/trace.h
deleted file mode 100644
index fcbdc9b79..000000000
--- a/include/cutils/trace.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#ifndef _LIBS_CUTILS_TRACE_H
-#define _LIBS_CUTILS_TRACE_H
-
-#include <inttypes.h>
-#include <stdatomic.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <cutils/compiler.h>
-
-__BEGIN_DECLS
-
-/**
- * The ATRACE_TAG macro can be defined before including this header to trace
- * using one of the tags defined below. It must be defined to one of the
- * following ATRACE_TAG_* macros. The trace tag is used to filter tracing in
- * userland to avoid some of the runtime cost of tracing when it is not desired.
- *
- * Defining ATRACE_TAG to be ATRACE_TAG_ALWAYS will result in the tracing always
- * being enabled - this should ONLY be done for debug code, as userland tracing
- * has a performance cost even when the trace is not being recorded. Defining
- * ATRACE_TAG to be ATRACE_TAG_NEVER or leaving ATRACE_TAG undefined will result
- * in the tracing always being disabled.
- *
- * ATRACE_TAG_HAL should be bitwise ORed with the relevant tags for tracing
- * within a hardware module. For example a camera hardware module would set:
- * #define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
- *
- * Keep these in sync with frameworks/base/core/java/android/os/Trace.java.
- */
-#define ATRACE_TAG_NEVER 0 // This tag is never enabled.
-#define ATRACE_TAG_ALWAYS (1<<0) // This tag is always enabled.
-#define ATRACE_TAG_GRAPHICS (1<<1)
-#define ATRACE_TAG_INPUT (1<<2)
-#define ATRACE_TAG_VIEW (1<<3)
-#define ATRACE_TAG_WEBVIEW (1<<4)
-#define ATRACE_TAG_WINDOW_MANAGER (1<<5)
-#define ATRACE_TAG_ACTIVITY_MANAGER (1<<6)
-#define ATRACE_TAG_SYNC_MANAGER (1<<7)
-#define ATRACE_TAG_AUDIO (1<<8)
-#define ATRACE_TAG_VIDEO (1<<9)
-#define ATRACE_TAG_CAMERA (1<<10)
-#define ATRACE_TAG_HAL (1<<11)
-#define ATRACE_TAG_APP (1<<12)
-#define ATRACE_TAG_RESOURCES (1<<13)
-#define ATRACE_TAG_DALVIK (1<<14)
-#define ATRACE_TAG_RS (1<<15)
-#define ATRACE_TAG_BIONIC (1<<16)
-#define ATRACE_TAG_POWER (1<<17)
-#define ATRACE_TAG_PACKAGE_MANAGER (1<<18)
-#define ATRACE_TAG_SYSTEM_SERVER (1<<19)
-#define ATRACE_TAG_DATABASE (1<<20)
-#define ATRACE_TAG_NETWORK (1<<21)
-#define ATRACE_TAG_ADB (1<<22)
-#define ATRACE_TAG_LAST ATRACE_TAG_ADB
-
-// Reserved for initialization.
-#define ATRACE_TAG_NOT_READY (1ULL<<63)
-
-#define ATRACE_TAG_VALID_MASK ((ATRACE_TAG_LAST - 1) | ATRACE_TAG_LAST)
-
-#ifndef ATRACE_TAG
-#define ATRACE_TAG ATRACE_TAG_NEVER
-#elif ATRACE_TAG > ATRACE_TAG_VALID_MASK
-#error ATRACE_TAG must be defined to be one of the tags defined in cutils/trace.h
-#endif
-
-/**
- * Opens the trace file for writing and reads the property for initial tags.
- * The atrace.tags.enableflags property sets the tags to trace.
- * This function should not be explicitly called, the first call to any normal
- * trace function will cause it to be run safely.
- */
-void atrace_setup();
-
-/**
- * If tracing is ready, set atrace_enabled_tags to the system property
- * debug.atrace.tags.enableflags. Can be used as a sysprop change callback.
- */
-void atrace_update_tags();
-
-/**
- * Set whether the process is debuggable. By default the process is not
- * considered debuggable. If the process is not debuggable then application-
- * level tracing is not allowed unless the ro.debuggable system property is
- * set to '1'.
- */
-void atrace_set_debuggable(bool debuggable);
-
-/**
- * Set whether tracing is enabled for the current process. This is used to
- * prevent tracing within the Zygote process.
- */
-void atrace_set_tracing_enabled(bool enabled);
-
-/**
- * Flag indicating whether setup has been completed, initialized to 0.
- * Nonzero indicates setup has completed.
- * Note: This does NOT indicate whether or not setup was successful.
- */
-extern atomic_bool atrace_is_ready;
-
-/**
- * Set of ATRACE_TAG flags to trace for, initialized to ATRACE_TAG_NOT_READY.
- * A value of zero indicates setup has failed.
- * Any other nonzero value indicates setup has succeeded, and tracing is on.
- */
-extern uint64_t atrace_enabled_tags;
-
-/**
- * Handle to the kernel's trace buffer, initialized to -1.
- * Any other value indicates setup has succeeded, and is a valid fd for tracing.
- */
-extern int atrace_marker_fd;
-
-/**
- * atrace_init readies the process for tracing by opening the trace_marker file.
- * Calling any trace function causes this to be run, so calling it is optional.
- * This can be explicitly run to avoid setup delay on first trace function.
- */
-#define ATRACE_INIT() atrace_init()
-static inline void atrace_init()
-{
- if (CC_UNLIKELY(!atomic_load_explicit(&atrace_is_ready, memory_order_acquire))) {
- atrace_setup();
- }
-}
-
-/**
- * Get the mask of all tags currently enabled.
- * It can be used as a guard condition around more expensive trace calculations.
- * Every trace function calls this, which ensures atrace_init is run.
- */
-#define ATRACE_GET_ENABLED_TAGS() atrace_get_enabled_tags()
-static inline uint64_t atrace_get_enabled_tags()
-{
- atrace_init();
- return atrace_enabled_tags;
-}
-
-/**
- * Test if a given tag is currently enabled.
- * Returns nonzero if the tag is enabled, otherwise zero.
- * It can be used as a guard condition around more expensive trace calculations.
- */
-#define ATRACE_ENABLED() atrace_is_tag_enabled(ATRACE_TAG)
-static inline uint64_t atrace_is_tag_enabled(uint64_t tag)
-{
- return atrace_get_enabled_tags() & tag;
-}
-
-/**
- * Trace the beginning of a context. name is used to identify the context.
- * This is often used to time function execution.
- */
-#define ATRACE_BEGIN(name) atrace_begin(ATRACE_TAG, name)
-static inline void atrace_begin(uint64_t tag, const char* name)
-{
- if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
- void atrace_begin_body(const char*);
- atrace_begin_body(name);
- }
-}
-
-/**
- * Trace the end of a context.
- * This should match up (and occur after) a corresponding ATRACE_BEGIN.
- */
-#define ATRACE_END() atrace_end(ATRACE_TAG)
-static inline void atrace_end(uint64_t tag)
-{
- if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
- void atrace_end_body();
- atrace_end_body();
- }
-}
-
-/**
- * Trace the beginning of an asynchronous event. Unlike ATRACE_BEGIN/ATRACE_END
- * contexts, asynchronous events do not need to be nested. The name describes
- * the event, and the cookie provides a unique identifier for distinguishing
- * simultaneous events. The name and cookie used to begin an event must be
- * used to end it.
- */
-#define ATRACE_ASYNC_BEGIN(name, cookie) \
- atrace_async_begin(ATRACE_TAG, name, cookie)
-static inline void atrace_async_begin(uint64_t tag, const char* name,
- int32_t cookie)
-{
- if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
- void atrace_async_begin_body(const char*, int32_t);
- atrace_async_begin_body(name, cookie);
- }
-}
-
-/**
- * Trace the end of an asynchronous event.
- * This should have a corresponding ATRACE_ASYNC_BEGIN.
- */
-#define ATRACE_ASYNC_END(name, cookie) atrace_async_end(ATRACE_TAG, name, cookie)
-static inline void atrace_async_end(uint64_t tag, const char* name, int32_t cookie)
-{
- if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
- void atrace_async_end_body(const char*, int32_t);
- atrace_async_end_body(name, cookie);
- }
-}
-
-/**
- * Traces an integer counter value. name is used to identify the counter.
- * This can be used to track how a value changes over time.
- */
-#define ATRACE_INT(name, value) atrace_int(ATRACE_TAG, name, value)
-static inline void atrace_int(uint64_t tag, const char* name, int32_t value)
-{
- if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
- void atrace_int_body(const char*, int32_t);
- atrace_int_body(name, value);
- }
-}
-
-/**
- * Traces a 64-bit integer counter value. name is used to identify the
- * counter. This can be used to track how a value changes over time.
- */
-#define ATRACE_INT64(name, value) atrace_int64(ATRACE_TAG, name, value)
-static inline void atrace_int64(uint64_t tag, const char* name, int64_t value)
-{
- if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) {
- void atrace_int64_body(const char*, int64_t);
- atrace_int64_body(name, value);
- }
-}
-
-__END_DECLS
-
-#endif // _LIBS_CUTILS_TRACE_H
diff --git a/include/cutils/uevent.h b/include/cutils/uevent.h
deleted file mode 100644
index da1c2aae6..000000000
--- a/include/cutils/uevent.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#ifndef __CUTILS_UEVENT_H
-#define __CUTILS_UEVENT_H
-
-#include <stdbool.h>
-#include <sys/socket.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int uevent_open_socket(int buf_sz, bool passcred);
-ssize_t uevent_kernel_multicast_recv(int socket, void *buffer, size_t length);
-ssize_t uevent_kernel_multicast_uid_recv(int socket, void *buffer, size_t length, uid_t *uid);
-ssize_t uevent_kernel_recv(int socket, void *buffer, size_t length, bool require_group, uid_t *uid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CUTILS_UEVENT_H */
diff --git a/include/log b/include/log
new file mode 120000
index 000000000..714065f45
--- /dev/null
+++ b/include/log
@@ -0,0 +1 @@
+../liblog/include/log \ No newline at end of file
diff --git a/include/log/event_tag_map.h b/include/log/event_tag_map.h
deleted file mode 100644
index 22e62ec98..000000000
--- a/include/log/event_tag_map.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#ifndef _LIBS_CUTILS_EVENTTAGMAP_H
-#define _LIBS_CUTILS_EVENTTAGMAP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define EVENT_TAG_MAP_FILE "/system/etc/event-log-tags"
-
-struct EventTagMap;
-typedef struct EventTagMap EventTagMap;
-
-/*
- * Open the specified file as an event log tag map.
- *
- * Returns NULL on failure.
- */
-EventTagMap* android_openEventTagMap(const char* fileName);
-
-/*
- * Close the map.
- */
-void android_closeEventTagMap(EventTagMap* map);
-
-/*
- * Look up a tag by index. Returns the tag string, or NULL if not found.
- */
-const char* android_lookupEventTag(const EventTagMap* map, unsigned int tag)
- __attribute__((deprecated("use android_lookupEventTag_len() instead to minimize MAP_PRIVATE copy-on-write memory impact")));
-
-/*
- * Look up a tag by index. Returns the tag string & string length, or NULL if
- * not found. Returned string is not guaranteed to be nul terminated.
- */
-const char* android_lookupEventTag_len(const EventTagMap* map,
- size_t* len, unsigned int tag);
-
-/*
- * Look up a format by index. Returns the format string & string length,
- * or NULL if not found. Returned string is not guaranteed to be nul terminated.
- */
-const char* android_lookupEventFormat_len(const EventTagMap* map,
- size_t* len, unsigned int tag);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*_LIBS_CUTILS_EVENTTAGMAP_H*/
diff --git a/include/log/log.h b/include/log/log.h
deleted file mode 100644
index ece9ea6d1..000000000
--- a/include/log/log.h
+++ /dev/null
@@ -1,871 +0,0 @@
-/*
- * Copyright (C) 2005-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.
- */
-
-#ifndef _LIBS_LOG_LOG_H
-#define _LIBS_LOG_LOG_H
-
-/* Too many in the ecosystem assume these are included */
-#if !defined(_WIN32)
-#include <pthread.h>
-#endif
-#include <stdint.h> /* uint16_t, int32_t */
-#include <stdio.h>
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <android/log.h>
-#include <log/uio.h> /* helper to define iovec for portability */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * LOG_TAG is the local tag used for the following simplified
- * logging macros. You can change this preprocessor definition
- * before using the other macros to change the tag.
- */
-
-#ifndef LOG_TAG
-#define LOG_TAG NULL
-#endif
-
-/* --------------------------------------------------------------------- */
-
-/*
- * This file uses ", ## __VA_ARGS__" zero-argument token pasting to
- * work around issues with debug-only syntax errors in assertions
- * that are missing format strings. See commit
- * 19299904343daf191267564fe32e6cd5c165cd42
- */
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
-#endif
-
-/*
- * Send a simple string to the log.
- */
-int __android_log_buf_write(int bufID, int prio, const char* tag, const char* text);
-int __android_log_buf_print(int bufID, int prio, const char* tag, const char* fmt, ...)
-#if defined(__GNUC__)
- __attribute__((__format__(printf, 4, 5)))
-#endif
- ;
-
-/*
- * Simplified macro to send a verbose system log message using current LOG_TAG.
- */
-#ifndef SLOGV
-#define __SLOGV(...) \
- ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
-#if LOG_NDEBUG
-#define SLOGV(...) do { if (0) { __SLOGV(__VA_ARGS__); } } while (0)
-#else
-#define SLOGV(...) __SLOGV(__VA_ARGS__)
-#endif
-#endif
-
-#ifndef SLOGV_IF
-#if LOG_NDEBUG
-#define SLOGV_IF(cond, ...) ((void)0)
-#else
-#define SLOGV_IF(cond, ...) \
- ( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
- : (void)0 )
-#endif
-#endif
-
-/*
- * Simplified macro to send a debug system log message using current LOG_TAG.
- */
-#ifndef SLOGD
-#define SLOGD(...) \
- ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef SLOGD_IF
-#define SLOGD_IF(cond, ...) \
- ( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
- : (void)0 )
-#endif
-
-/*
- * Simplified macro to send an info system log message using current LOG_TAG.
- */
-#ifndef SLOGI
-#define SLOGI(...) \
- ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef SLOGI_IF
-#define SLOGI_IF(cond, ...) \
- ( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)) \
- : (void)0 )
-#endif
-
-/*
- * Simplified macro to send a warning system log message using current LOG_TAG.
- */
-#ifndef SLOGW
-#define SLOGW(...) \
- ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef SLOGW_IF
-#define SLOGW_IF(cond, ...) \
- ( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) \
- : (void)0 )
-#endif
-
-/*
- * Simplified macro to send an error system log message using current LOG_TAG.
- */
-#ifndef SLOGE
-#define SLOGE(...) \
- ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef SLOGE_IF
-#define SLOGE_IF(cond, ...) \
- ( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
- : (void)0 )
-#endif
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Simplified macro to send a verbose radio log message using current LOG_TAG.
- */
-#ifndef RLOGV
-#define __RLOGV(...) \
- ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
-#if LOG_NDEBUG
-#define RLOGV(...) do { if (0) { __RLOGV(__VA_ARGS__); } } while (0)
-#else
-#define RLOGV(...) __RLOGV(__VA_ARGS__)
-#endif
-#endif
-
-#ifndef RLOGV_IF
-#if LOG_NDEBUG
-#define RLOGV_IF(cond, ...) ((void)0)
-#else
-#define RLOGV_IF(cond, ...) \
- ( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
- : (void)0 )
-#endif
-#endif
-
-/*
- * Simplified macro to send a debug radio log message using current LOG_TAG.
- */
-#ifndef RLOGD
-#define RLOGD(...) \
- ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef RLOGD_IF
-#define RLOGD_IF(cond, ...) \
- ( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
- : (void)0 )
-#endif
-
-/*
- * Simplified macro to send an info radio log message using current LOG_TAG.
- */
-#ifndef RLOGI
-#define RLOGI(...) \
- ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef RLOGI_IF
-#define RLOGI_IF(cond, ...) \
- ( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)) \
- : (void)0 )
-#endif
-
-/*
- * Simplified macro to send a warning radio log message using current LOG_TAG.
- */
-#ifndef RLOGW
-#define RLOGW(...) \
- ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef RLOGW_IF
-#define RLOGW_IF(cond, ...) \
- ( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) \
- : (void)0 )
-#endif
-
-/*
- * Simplified macro to send an error radio log message using current LOG_TAG.
- */
-#ifndef RLOGE
-#define RLOGE(...) \
- ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef RLOGE_IF
-#define RLOGE_IF(cond, ...) \
- ( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
- : (void)0 )
-#endif
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Event logging.
- */
-
-/*
- * The following should not be used directly.
- */
-
-int __android_log_bwrite(int32_t tag, const void* payload, size_t len);
-int __android_log_btwrite(int32_t tag, char type, const void* payload,
- size_t len);
-int __android_log_bswrite(int32_t tag, const char* payload);
-
-#define android_bWriteLog(tag, payload, len) \
- __android_log_bwrite(tag, payload, len)
-#define android_btWriteLog(tag, type, payload, len) \
- __android_log_btwrite(tag, type, payload, len)
-
-/*
- * Event log entry types.
- */
-#ifndef __AndroidEventLogType_defined
-#define __AndroidEventLogType_defined
-typedef enum {
- /* Special markers for android_log_list_element type */
- EVENT_TYPE_LIST_STOP = '\n', /* declare end of list */
- EVENT_TYPE_UNKNOWN = '?', /* protocol error */
-
- /* must match with declaration in java/android/android/util/EventLog.java */
- EVENT_TYPE_INT = 0, /* int32_t */
- EVENT_TYPE_LONG = 1, /* int64_t */
- EVENT_TYPE_STRING = 2,
- EVENT_TYPE_LIST = 3,
- EVENT_TYPE_FLOAT = 4,
-} AndroidEventLogType;
-#endif
-#define sizeof_AndroidEventLogType sizeof(typeof_AndroidEventLogType)
-#define typeof_AndroidEventLogType unsigned char
-
-#ifndef LOG_EVENT_INT
-#define LOG_EVENT_INT(_tag, _value) { \
- int intBuf = _value; \
- (void) android_btWriteLog(_tag, EVENT_TYPE_INT, &intBuf, \
- sizeof(intBuf)); \
- }
-#endif
-#ifndef LOG_EVENT_LONG
-#define LOG_EVENT_LONG(_tag, _value) { \
- long long longBuf = _value; \
- (void) android_btWriteLog(_tag, EVENT_TYPE_LONG, &longBuf, \
- sizeof(longBuf)); \
- }
-#endif
-#ifndef LOG_EVENT_FLOAT
-#define LOG_EVENT_FLOAT(_tag, _value) { \
- float floatBuf = _value; \
- (void) android_btWriteLog(_tag, EVENT_TYPE_FLOAT, &floatBuf, \
- sizeof(floatBuf)); \
- }
-#endif
-#ifndef LOG_EVENT_STRING
-#define LOG_EVENT_STRING(_tag, _value) \
- (void) __android_log_bswrite(_tag, _value);
-#endif
-
-#ifndef log_id_t_defined
-#define log_id_t_defined
-typedef enum log_id {
- LOG_ID_MIN = 0,
-
- LOG_ID_MAIN = 0,
- LOG_ID_RADIO = 1,
- LOG_ID_EVENTS = 2,
- LOG_ID_SYSTEM = 3,
- LOG_ID_CRASH = 4,
- LOG_ID_SECURITY = 5,
- LOG_ID_KERNEL = 6, /* place last, third-parties can not use it */
-
- LOG_ID_MAX
-} log_id_t;
-#endif
-#define sizeof_log_id_t sizeof(typeof_log_id_t)
-#define typeof_log_id_t unsigned char
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Native log reading interface section. See logcat for sample code.
- *
- * The preferred API is an exec of logcat. Likely uses of this interface
- * are if native code suffers from exec or filtration being too costly,
- * access to raw information, or parsing is an issue.
- */
-
-/*
- * The userspace structure for version 1 of the logger_entry ABI.
- */
-#ifndef __struct_logger_entry_defined
-#define __struct_logger_entry_defined
-struct logger_entry {
- uint16_t len; /* length of the payload */
- uint16_t __pad; /* no matter what, we get 2 bytes of padding */
- int32_t pid; /* generating process's pid */
- int32_t tid; /* generating process's tid */
- int32_t sec; /* seconds since Epoch */
- int32_t nsec; /* nanoseconds */
-#ifndef __cplusplus
- char msg[0]; /* the entry's payload */
-#endif
-};
-#endif
-
-/*
- * The userspace structure for version 2 of the logger_entry ABI.
- */
-#ifndef __struct_logger_entry_v2_defined
-#define __struct_logger_entry_v2_defined
-struct logger_entry_v2 {
- uint16_t len; /* length of the payload */
- uint16_t hdr_size; /* sizeof(struct logger_entry_v2) */
- int32_t pid; /* generating process's pid */
- int32_t tid; /* generating process's tid */
- int32_t sec; /* seconds since Epoch */
- int32_t nsec; /* nanoseconds */
- uint32_t euid; /* effective UID of logger */
-#ifndef __cplusplus
- char msg[0]; /* the entry's payload */
-#endif
-} __attribute__((__packed__));
-#endif
-
-/*
- * The userspace structure for version 3 of the logger_entry ABI.
- */
-#ifndef __struct_logger_entry_v3_defined
-#define __struct_logger_entry_v3_defined
-struct logger_entry_v3 {
- uint16_t len; /* length of the payload */
- uint16_t hdr_size; /* sizeof(struct logger_entry_v3) */
- int32_t pid; /* generating process's pid */
- int32_t tid; /* generating process's tid */
- int32_t sec; /* seconds since Epoch */
- int32_t nsec; /* nanoseconds */
- uint32_t lid; /* log id of the payload */
-#ifndef __cplusplus
- char msg[0]; /* the entry's payload */
-#endif
-} __attribute__((__packed__));
-#endif
-
-/*
- * The userspace structure for version 4 of the logger_entry ABI.
- */
-#ifndef __struct_logger_entry_v4_defined
-#define __struct_logger_entry_v4_defined
-struct logger_entry_v4 {
- uint16_t len; /* length of the payload */
- uint16_t hdr_size; /* sizeof(struct logger_entry_v4) */
- int32_t pid; /* generating process's pid */
- uint32_t tid; /* generating process's tid */
- uint32_t sec; /* seconds since Epoch */
- uint32_t nsec; /* nanoseconds */
- uint32_t lid; /* log id of the payload, bottom 4 bits currently */
- uint32_t uid; /* generating process's uid */
-#ifndef __cplusplus
- char msg[0]; /* the entry's payload */
-#endif
-};
-#endif
-
-/* struct log_time is a wire-format variant of struct timespec */
-#define NS_PER_SEC 1000000000ULL
-
-#ifndef __struct_log_time_defined
-#define __struct_log_time_defined
-#ifdef __cplusplus
-
-/*
- * NB: we did NOT define a copy constructor. This will result in structure
- * no longer being compatible with pass-by-value which is desired
- * efficient behavior. Also, pass-by-reference breaks C/C++ ABI.
- */
-struct log_time {
-public:
- uint32_t tv_sec; /* good to Feb 5 2106 */
- uint32_t tv_nsec;
-
- static const uint32_t tv_sec_max = 0xFFFFFFFFUL;
- static const uint32_t tv_nsec_max = 999999999UL;
-
- log_time(const timespec& T)
- {
- tv_sec = static_cast<uint32_t>(T.tv_sec);
- tv_nsec = static_cast<uint32_t>(T.tv_nsec);
- }
- log_time(uint32_t sec, uint32_t nsec)
- {
- tv_sec = sec;
- tv_nsec = nsec;
- }
-#ifdef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
-#define __struct_log_time_private_defined
- static const timespec EPOCH;
-#endif
- log_time()
- {
- }
-#ifdef __linux__
- log_time(clockid_t id)
- {
- timespec T;
- clock_gettime(id, &T);
- tv_sec = static_cast<uint32_t>(T.tv_sec);
- tv_nsec = static_cast<uint32_t>(T.tv_nsec);
- }
-#endif
- log_time(const char* T)
- {
- const uint8_t* c = reinterpret_cast<const uint8_t*>(T);
- tv_sec = c[0] |
- (static_cast<uint32_t>(c[1]) << 8) |
- (static_cast<uint32_t>(c[2]) << 16) |
- (static_cast<uint32_t>(c[3]) << 24);
- tv_nsec = c[4] |
- (static_cast<uint32_t>(c[5]) << 8) |
- (static_cast<uint32_t>(c[6]) << 16) |
- (static_cast<uint32_t>(c[7]) << 24);
- }
-
- /* timespec */
- bool operator== (const timespec& T) const
- {
- return (tv_sec == static_cast<uint32_t>(T.tv_sec))
- && (tv_nsec == static_cast<uint32_t>(T.tv_nsec));
- }
- bool operator!= (const timespec& T) const
- {
- return !(*this == T);
- }
- bool operator< (const timespec& T) const
- {
- return (tv_sec < static_cast<uint32_t>(T.tv_sec))
- || ((tv_sec == static_cast<uint32_t>(T.tv_sec))
- && (tv_nsec < static_cast<uint32_t>(T.tv_nsec)));
- }
- bool operator>= (const timespec& T) const
- {
- return !(*this < T);
- }
- bool operator> (const timespec& T) const
- {
- return (tv_sec > static_cast<uint32_t>(T.tv_sec))
- || ((tv_sec == static_cast<uint32_t>(T.tv_sec))
- && (tv_nsec > static_cast<uint32_t>(T.tv_nsec)));
- }
- bool operator<= (const timespec& T) const
- {
- return !(*this > T);
- }
-
-#ifdef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
- log_time operator-= (const timespec& T);
- log_time operator- (const timespec& T) const
- {
- log_time local(*this);
- return local -= T;
- }
- log_time operator+= (const timespec& T);
- log_time operator+ (const timespec& T) const
- {
- log_time local(*this);
- return local += T;
- }
-#endif
-
- /* log_time */
- bool operator== (const log_time& T) const
- {
- return (tv_sec == T.tv_sec) && (tv_nsec == T.tv_nsec);
- }
- bool operator!= (const log_time& T) const
- {
- return !(*this == T);
- }
- bool operator< (const log_time& T) const
- {
- return (tv_sec < T.tv_sec)
- || ((tv_sec == T.tv_sec) && (tv_nsec < T.tv_nsec));
- }
- bool operator>= (const log_time& T) const
- {
- return !(*this < T);
- }
- bool operator> (const log_time& T) const
- {
- return (tv_sec > T.tv_sec)
- || ((tv_sec == T.tv_sec) && (tv_nsec > T.tv_nsec));
- }
- bool operator<= (const log_time& T) const
- {
- return !(*this > T);
- }
-
-#ifdef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
- log_time operator-= (const log_time& T);
- log_time operator- (const log_time& T) const
- {
- log_time local(*this);
- return local -= T;
- }
- log_time operator+= (const log_time& T);
- log_time operator+ (const log_time& T) const
- {
- log_time local(*this);
- return local += T;
- }
-#endif
-
- uint64_t nsec() const
- {
- return static_cast<uint64_t>(tv_sec) * NS_PER_SEC + tv_nsec;
- }
-
-#ifdef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
- static const char default_format[];
-
- /* Add %#q for the fraction of a second to the standard library functions */
- char* strptime(const char* s, const char* format = default_format);
-#endif
-} __attribute__((__packed__));
-
-#else
-
-typedef struct log_time {
- uint32_t tv_sec;
- uint32_t tv_nsec;
-} __attribute__((__packed__)) log_time;
-
-#endif
-#endif
-
-/*
- * The maximum size of the log entry payload that can be
- * written to the logger. An attempt to write more than
- * this amount will result in a truncated log entry.
- */
-#define LOGGER_ENTRY_MAX_PAYLOAD 4068
-
-/*
- * The maximum size of a log entry which can be read from the
- * kernel logger driver. An attempt to read less than this amount
- * may result in read() returning EINVAL.
- */
-#define LOGGER_ENTRY_MAX_LEN (5*1024)
-
-#ifndef __struct_log_msg_defined
-#define __struct_log_msg_defined
-struct log_msg {
- union {
- unsigned char buf[LOGGER_ENTRY_MAX_LEN + 1];
- struct logger_entry_v4 entry;
- struct logger_entry_v4 entry_v4;
- struct logger_entry_v3 entry_v3;
- struct logger_entry_v2 entry_v2;
- struct logger_entry entry_v1;
- } __attribute__((aligned(4)));
-#ifdef __cplusplus
- /* Matching log_time operators */
- bool operator== (const log_msg& T) const
- {
- return (entry.sec == T.entry.sec) && (entry.nsec == T.entry.nsec);
- }
- bool operator!= (const log_msg& T) const
- {
- return !(*this == T);
- }
- bool operator< (const log_msg& T) const
- {
- return (entry.sec < T.entry.sec)
- || ((entry.sec == T.entry.sec)
- && (entry.nsec < T.entry.nsec));
- }
- bool operator>= (const log_msg& T) const
- {
- return !(*this < T);
- }
- bool operator> (const log_msg& T) const
- {
- return (entry.sec > T.entry.sec)
- || ((entry.sec == T.entry.sec)
- && (entry.nsec > T.entry.nsec));
- }
- bool operator<= (const log_msg& T) const
- {
- return !(*this > T);
- }
- uint64_t nsec() const
- {
- return static_cast<uint64_t>(entry.sec) * NS_PER_SEC + entry.nsec;
- }
-
- /* packet methods */
- log_id_t id()
- {
- return static_cast<log_id_t>(entry.lid);
- }
- char* msg()
- {
- unsigned short hdr_size = entry.hdr_size;
- if (!hdr_size) {
- hdr_size = sizeof(entry_v1);
- }
- if ((hdr_size < sizeof(entry_v1)) || (hdr_size > sizeof(entry))) {
- return NULL;
- }
- return reinterpret_cast<char*>(buf) + hdr_size;
- }
- unsigned int len()
- {
- return (entry.hdr_size ?
- entry.hdr_size :
- static_cast<uint16_t>(sizeof(entry_v1))) +
- entry.len;
- }
-#endif
-};
-#endif
-
-#ifndef __ANDROID_USE_LIBLOG_READER_INTERFACE
-#ifndef __ANDROID_API__
-#define __ANDROID_USE_LIBLOG_READER_INTERFACE 3
-#elif __ANDROID_API__ > 23 /* > Marshmallow */
-#define __ANDROID_USE_LIBLOG_READER_INTERFACE 3
-#elif __ANDROID_API__ > 22 /* > Lollipop */
-#define __ANDROID_USE_LIBLOG_READER_INTERFACE 2
-#elif __ANDROID_API__ > 19 /* > KitKat */
-#define __ANDROID_USE_LIBLOG_READER_INTERFACE 1
-#else
-#define __ANDROID_USE_LIBLOG_READER_INTERFACE 0
-#endif
-#endif
-
-#if __ANDROID_USE_LIBLOG_READER_INTERFACE
-
-struct logger;
-
-log_id_t android_logger_get_id(struct logger* logger);
-
-int android_logger_clear(struct logger* logger);
-long android_logger_get_log_size(struct logger* logger);
-int android_logger_set_log_size(struct logger* logger, unsigned long size);
-long android_logger_get_log_readable_size(struct logger* logger);
-int android_logger_get_log_version(struct logger* logger);
-
-struct logger_list;
-
-#if __ANDROID_USE_LIBLOG_READER_INTERFACE > 1
-ssize_t android_logger_get_statistics(struct logger_list* logger_list,
- char* buf, size_t len);
-ssize_t android_logger_get_prune_list(struct logger_list* logger_list,
- char* buf, size_t len);
-int android_logger_set_prune_list(struct logger_list* logger_list,
- char* buf, size_t len);
-#endif
-
-#define ANDROID_LOG_RDONLY O_RDONLY
-#define ANDROID_LOG_WRONLY O_WRONLY
-#define ANDROID_LOG_RDWR O_RDWR
-#define ANDROID_LOG_ACCMODE O_ACCMODE
-#define ANDROID_LOG_NONBLOCK O_NONBLOCK
-#if __ANDROID_USE_LIBLOG_READER_INTERFACE > 2
-#define ANDROID_LOG_WRAP 0x40000000 /* Block until buffer about to wrap */
-#define ANDROID_LOG_WRAP_DEFAULT_TIMEOUT 7200 /* 2 hour default */
-#endif
-#if __ANDROID_USE_LIBLOG_READER_INTERFACE > 1
-#define ANDROID_LOG_PSTORE 0x80000000
-#endif
-
-struct logger_list* android_logger_list_alloc(int mode,
- unsigned int tail,
- pid_t pid);
-struct logger_list* android_logger_list_alloc_time(int mode,
- log_time start,
- pid_t pid);
-void android_logger_list_free(struct logger_list* logger_list);
-/* In the purest sense, the following two are orthogonal interfaces */
-int android_logger_list_read(struct logger_list* logger_list,
- struct log_msg* log_msg);
-
-/* Multiple log_id_t opens */
-struct logger* android_logger_open(struct logger_list* logger_list,
- log_id_t id);
-#define android_logger_close android_logger_free
-/* Single log_id_t open */
-struct logger_list* android_logger_list_open(log_id_t id,
- int mode,
- unsigned int tail,
- pid_t pid);
-#define android_logger_list_close android_logger_list_free
-
-#endif /* __ANDROID_USE_LIBLOG_READER_INTERFACE */
-
-#ifdef __linux__
-
-#ifndef __ANDROID_USE_LIBLOG_CLOCK_INTERFACE
-#ifndef __ANDROID_API__
-#define __ANDROID_USE_LIBLOG_CLOCK_INTERFACE 1
-#elif __ANDROID_API__ > 22 /* > Lollipop */
-#define __ANDROID_USE_LIBLOG_CLOCK_INTERFACE 1
-#else
-#define __ANDROID_USE_LIBLOG_CLOCK_INTERFACE 0
-#endif
-#endif
-
-#if __ANDROID_USE_LIBLOG_CLOCK_INTERFACE
-clockid_t android_log_clockid();
-#endif
-
-#endif /* __linux__ */
-
-/*
- * log_id_t helpers
- */
-log_id_t android_name_to_log_id(const char* logName);
-const char* android_log_id_to_name(log_id_t log_id);
-
-/* --------------------------------------------------------------------- */
-
-#ifndef _ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE
-#ifndef __ANDROID_API__
-#define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 1
-#elif __ANDROID_API__ > 22 /* > Lollipop */
-#define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 1
-#else
-#define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 0
-#endif
-#endif
-
-#if __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE
-
-#define android_errorWriteLog(tag, subTag) \
- __android_log_error_write(tag, subTag, -1, NULL, 0)
-
-#define android_errorWriteWithInfoLog(tag, subTag, uid, data, dataLen) \
- __android_log_error_write(tag, subTag, uid, data, dataLen)
-
-int __android_log_error_write(int tag, const char* subTag, int32_t uid,
- const char* data, uint32_t dataLen);
-
-#endif /* __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE */
-
-/* --------------------------------------------------------------------- */
-
-#ifndef __ANDROID_USE_LIBLOG_CLOSE_INTERFACE
-#ifndef __ANDROID_API__
-#define __ANDROID_USE_LIBLOG_CLOSE_INTERFACE 1
-#elif __ANDROID_API__ > 18 /* > JellyBean */
-#define __ANDROID_USE_LIBLOG_CLOSE_INTERFACE 1
-#else
-#define __ANDROID_USE_LIBLOG_CLOSE_INTERFACE 0
-#endif
-#endif
-
-#if __ANDROID_USE_LIBLOG_CLOSE_INTERFACE
-/*
- * Release any logger resources (a new log write will immediately re-acquire)
- *
- * May be used to clean up File descriptors after a Fork, the resources are
- * all O_CLOEXEC so wil self clean on exec().
- */
-void __android_log_close();
-#endif
-
-#ifndef __ANDROID_USE_LIBLOG_RATELIMIT_INTERFACE
-#ifndef __ANDROID_API__
-#define __ANDROID_USE_LIBLOG_RATELIMIT_INTERFACE 1
-#elif __ANDROID_API__ > 25 /* > OC */
-#define __ANDROID_USE_LIBLOG_RATELIMIT_INTERFACE 1
-#else
-#define __ANDROID_USE_LIBLOG_RATELIMIT_INTERFACE 0
-#endif
-#endif
-
-#if __ANDROID_USE_LIBLOG_RATELIMIT_INTERFACE
-
-/*
- * if last is NULL, caller _must_ provide a consistent value for seconds.
- *
- * Return -1 if we can not acquire a lock, which below will permit the logging,
- * error on allowing a log message through.
- */
-int __android_log_ratelimit(time_t seconds, time_t* last);
-
-/*
- * Usage:
- *
- * // Global default and state
- * IF_ALOG_RATELIMIT() {
- * ALOG*(...);
- * }
- *
- * // local state, 10 seconds ratelimit
- * static time_t local_state;
- * IF_ALOG_RATELIMIT_LOCAL(10, &local_state) {
- * ALOG*(...);
- * }
- */
-
-#define IF_ALOG_RATELIMIT() \
- if (__android_log_ratelimit(0, NULL) > 0)
-#define IF_ALOG_RATELIMIT_LOCAL(seconds, state) \
- if (__android_log_ratelimit(seconds, state) > 0)
-
-#else
-
-/* No ratelimiting as API unsupported */
-#define IF_ALOG_RATELIMIT() if (1)
-#define IF_ALOG_RATELIMIT_LOCAL(...) if (1)
-
-#endif
-
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _LIBS_LOG_LOG_H */
diff --git a/include/log/log_event_list.h b/include/log/log_event_list.h
deleted file mode 100644
index 31d49b2f9..000000000
--- a/include/log/log_event_list.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (C) 2005-2016 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.
- */
-
-#ifndef _LIBS_LOG_EVENT_LIST_H
-#define _LIBS_LOG_EVENT_LIST_H
-
-#include <stdint.h>
-
-#if (defined(__cplusplus) && defined(_USING_LIBCXX))
-extern "C++" {
-#include <string>
-}
-#endif
-
-#include <log/log.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __ANDROID_USE_LIBLOG_EVENT_INTERFACE
-#ifndef __ANDROID_API__
-#define __ANDROID_USE_LIBLOG_EVENT_INTERFACE 1
-#elif __ANDROID_API__ > 23 /* > Marshmallow */
-#define __ANDROID_USE_LIBLOG_EVENT_INTERFACE 1
-#else
-#define __ANDROID_USE_LIBLOG_EVENT_INTERFACE 0
-#endif
-#endif
-
-#if __ANDROID_USE_LIBLOG_EVENT_INTERFACE
-
-/* For manipulating lists of events. */
-
-#define ANDROID_MAX_LIST_NEST_DEPTH 8
-
-/*
- * The opaque context used to manipulate lists of events.
- */
-#ifndef __android_log_context_defined
-#define __android_log_context_defined
-typedef struct android_log_context_internal* android_log_context;
-#endif
-
-/*
- * Elements returned when reading a list of events.
- */
-#ifndef __android_log_list_element_defined
-#define __android_log_list_element_defined
-typedef struct {
- AndroidEventLogType type;
- uint16_t complete;
- uint16_t len;
- union {
- int32_t int32;
- int64_t int64;
- char* string;
- float float32;
- } data;
-} android_log_list_element;
-#endif
-
-/*
- * Creates a context associated with an event tag to write elements to
- * the list of events.
- */
-android_log_context create_android_logger(uint32_t tag);
-
-/* All lists must be braced by a begin and end call */
-/*
- * NB: If the first level braces are missing when specifying multiple
- * elements, we will manufacturer a list to embrace it for your API
- * convenience. For a single element, it will remain solitary.
- */
-int android_log_write_list_begin(android_log_context ctx);
-int android_log_write_list_end(android_log_context ctx);
-
-int android_log_write_int32(android_log_context ctx, int32_t value);
-int android_log_write_int64(android_log_context ctx, int64_t value);
-int android_log_write_string8(android_log_context ctx, const char* value);
-int android_log_write_string8_len(android_log_context ctx,
- const char* value, size_t maxlen);
-int android_log_write_float32(android_log_context ctx, float value);
-
-/* Submit the composed list context to the specified logger id */
-/* NB: LOG_ID_EVENTS and LOG_ID_SECURITY only valid binary buffers */
-int android_log_write_list(android_log_context ctx, log_id_t id);
-
-/*
- * Creates a context from a raw buffer representing a list of events to be read.
- */
-android_log_context create_android_log_parser(const char* msg, size_t len);
-
-android_log_list_element android_log_read_next(android_log_context ctx);
-android_log_list_element android_log_peek_next(android_log_context ctx);
-
-/* Finished with reader or writer context */
-int android_log_destroy(android_log_context* ctx);
-
-#ifdef __cplusplus
-#ifndef __class_android_log_event_list_defined
-#define __class_android_log_event_list_defined
-/* android_log_list C++ helpers */
-extern "C++" {
-class android_log_event_list {
-friend class __android_log_event_list;
-
-private:
- android_log_context ctx;
- int ret;
-
- android_log_event_list(const android_log_event_list&) = delete;
- void operator =(const android_log_event_list&) = delete;
-
-public:
- explicit android_log_event_list(int tag) : ret(0) {
- ctx = create_android_logger(static_cast<uint32_t>(tag));
- }
- explicit android_log_event_list(log_msg& log_msg) : ret(0) {
- ctx = create_android_log_parser(log_msg.msg() + sizeof(uint32_t),
- log_msg.entry.len - sizeof(uint32_t));
- }
- ~android_log_event_list() { android_log_destroy(&ctx); }
-
- int close() {
- int retval = android_log_destroy(&ctx);
- if (retval < 0) ret = retval;
- return retval;
- }
-
- /* To allow above C calls to use this class as parameter */
- operator android_log_context() const { return ctx; }
-
- int status() const { return ret; }
-
- int begin() {
- int retval = android_log_write_list_begin(ctx);
- if (retval < 0) ret = retval;
- return ret;
- }
- int end() {
- int retval = android_log_write_list_end(ctx);
- if (retval < 0) ret = retval;
- return ret;
- }
-
- android_log_event_list& operator <<(int32_t value) {
- int retval = android_log_write_int32(ctx, value);
- if (retval < 0) ret = retval;
- return *this;
- }
-
- android_log_event_list& operator <<(uint32_t value) {
- int retval = android_log_write_int32(ctx, static_cast<int32_t>(value));
- if (retval < 0) ret = retval;
- return *this;
- }
-
- android_log_event_list& operator <<(int64_t value) {
- int retval = android_log_write_int64(ctx, value);
- if (retval < 0) ret = retval;
- return *this;
- }
-
- android_log_event_list& operator <<(uint64_t value) {
- int retval = android_log_write_int64(ctx, static_cast<int64_t>(value));
- if (retval < 0) ret = retval;
- return *this;
- }
-
- android_log_event_list& operator <<(const char* value) {
- int retval = android_log_write_string8(ctx, value);
- if (retval < 0) ret = retval;
- return *this;
- }
-
-#if defined(_USING_LIBCXX)
- android_log_event_list& operator <<(const std::string& value) {
- int retval = android_log_write_string8_len(ctx,
- value.data(),
- value.length());
- if (retval < 0) ret = retval;
- return *this;
- }
-#endif
-
- android_log_event_list& operator <<(float value) {
- int retval = android_log_write_float32(ctx, value);
- if (retval < 0) ret = retval;
- return *this;
- }
-
- int write(log_id_t id = LOG_ID_EVENTS) {
- int retval = android_log_write_list(ctx, id);
- if (retval < 0) ret = retval;
- return ret;
- }
-
- int operator <<(log_id_t id) {
- int retval = android_log_write_list(ctx, id);
- if (retval < 0) ret = retval;
- android_log_destroy(&ctx);
- return ret;
- }
-
- /*
- * Append<Type> methods removes any integer promotion
- * confusion, and adds access to string with length.
- * Append methods are also added for all types for
- * convenience.
- */
-
- bool AppendInt(int32_t value) {
- int retval = android_log_write_int32(ctx, value);
- if (retval < 0) ret = retval;
- return ret >= 0;
- }
-
- bool AppendLong(int64_t value) {
- int retval = android_log_write_int64(ctx, value);
- if (retval < 0) ret = retval;
- return ret >= 0;
- }
-
- bool AppendString(const char* value) {
- int retval = android_log_write_string8(ctx, value);
- if (retval < 0) ret = retval;
- return ret >= 0;
- }
-
- bool AppendString(const char* value, size_t len) {
- int retval = android_log_write_string8_len(ctx, value, len);
- if (retval < 0) ret = retval;
- return ret >= 0;
- }
-
-#if defined(_USING_LIBCXX)
- bool AppendString(const std::string& value) {
- int retval = android_log_write_string8_len(ctx,
- value.data(),
- value.length());
- if (retval < 0) ret = retval;
- return ret;
- }
-
- bool Append(const std::string& value) {
- int retval = android_log_write_string8_len(ctx,
- value.data(),
- value.length());
- if (retval < 0) ret = retval;
- return ret;
- }
-#endif
-
- bool AppendFloat(float value) {
- int retval = android_log_write_float32(ctx, value);
- if (retval < 0) ret = retval;
- return ret >= 0;
- }
-
- template <typename Tvalue>
- bool Append(Tvalue value) { *this << value; return ret >= 0; }
-
- bool Append(const char* value, size_t len) {
- int retval = android_log_write_string8_len(ctx, value, len);
- if (retval < 0) ret = retval;
- return ret >= 0;
- }
-
- android_log_list_element read() { return android_log_read_next(ctx); }
- android_log_list_element peek() { return android_log_peek_next(ctx); }
-
-};
-}
-#endif
-#endif
-
-#endif /* __ANDROID_USE_LIBLOG_EVENT_INTERFACE */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _LIBS_LOG_EVENT_LIST_H */
diff --git a/include/log/logd.h b/include/log/logd.h
deleted file mode 100644
index 0e0248e50..000000000
--- a/include/log/logd.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <log/log.h>
diff --git a/include/log/logger.h b/include/log/logger.h
deleted file mode 100644
index 0e0248e50..000000000
--- a/include/log/logger.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <log/log.h>
diff --git a/include/log/logprint.h b/include/log/logprint.h
deleted file mode 100644
index 3509e7f51..000000000
--- a/include/log/logprint.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-#ifndef _LOGPRINT_H
-#define _LOGPRINT_H
-
-#include <pthread.h>
-
-#include <android/log.h>
-#include <log/event_tag_map.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- /* Verbs */
- FORMAT_OFF = 0,
- FORMAT_BRIEF,
- FORMAT_PROCESS,
- FORMAT_TAG,
- FORMAT_THREAD,
- FORMAT_RAW,
- FORMAT_TIME,
- FORMAT_THREADTIME,
- FORMAT_LONG,
- /* Adverbs. The following are modifiers to above format verbs */
- FORMAT_MODIFIER_COLOR, /* converts priority to color */
- FORMAT_MODIFIER_TIME_USEC, /* switches from msec to usec time precision */
- FORMAT_MODIFIER_PRINTABLE, /* converts non-printable to printable escapes */
- FORMAT_MODIFIER_YEAR, /* Adds year to date */
- FORMAT_MODIFIER_ZONE, /* Adds zone to date */
- FORMAT_MODIFIER_EPOCH, /* Print time as seconds since Jan 1 1970 */
- FORMAT_MODIFIER_MONOTONIC, /* Print cpu time as seconds since start */
- FORMAT_MODIFIER_UID, /* Adds uid */
- FORMAT_MODIFIER_DESCRIPT, /* Adds descriptive */
-} AndroidLogPrintFormat;
-
-typedef struct AndroidLogFormat_t AndroidLogFormat;
-
-typedef struct AndroidLogEntry_t {
- time_t tv_sec;
- long tv_nsec;
- android_LogPriority priority;
- int32_t uid;
- int32_t pid;
- int32_t tid;
- const char* tag;
- size_t tagLen;
- size_t messageLen;
- const char* message;
-} AndroidLogEntry;
-
-AndroidLogFormat* android_log_format_new();
-
-void android_log_format_free(AndroidLogFormat* p_format);
-
-/* currently returns 0 if format is a modifier, 1 if not */
-int android_log_setPrintFormat(AndroidLogFormat* p_format,
- AndroidLogPrintFormat format);
-
-/**
- * Returns FORMAT_OFF on invalid string
- */
-AndroidLogPrintFormat android_log_formatFromString(const char* s);
-
-/**
- * filterExpression: a single filter expression
- * eg "AT:d"
- *
- * returns 0 on success and -1 on invalid expression
- *
- * Assumes single threaded execution
- *
- */
-
-int android_log_addFilterRule(AndroidLogFormat* p_format,
- const char* filterExpression);
-
-/**
- * filterString: a whitespace-separated set of filter expressions
- * eg "AT:d *:i"
- *
- * returns 0 on success and -1 on invalid expression
- *
- * Assumes single threaded execution
- *
- */
-
-int android_log_addFilterString(AndroidLogFormat* p_format,
- const char* filterString);
-
-/**
- * returns 1 if this log line should be printed based on its priority
- * and tag, and 0 if it should not
- */
-int android_log_shouldPrintLine (
- AndroidLogFormat* p_format, const char* tag, android_LogPriority pri);
-
-/**
- * Splits a wire-format buffer into an AndroidLogEntry
- * entry allocated by caller. Pointers will point directly into buf
- *
- * Returns 0 on success and -1 on invalid wire format (entry will be
- * in unspecified state)
- */
-int android_log_processLogBuffer(struct logger_entry* buf,
- AndroidLogEntry* entry);
-
-/**
- * Like android_log_processLogBuffer, but for binary logs.
- *
- * If "map" is non-NULL, it will be used to convert the log tag number
- * into a string.
- */
-int android_log_processBinaryLogBuffer(struct logger_entry* buf,
- AndroidLogEntry* entry, const EventTagMap* map, char* messageBuf,
- int messageBufLen);
-
-/**
- * Formats a log message into a buffer
- *
- * Uses defaultBuffer if it can, otherwise malloc()'s a new buffer
- * If return value != defaultBuffer, caller must call free()
- * Returns NULL on malloc error
- */
-
-char* android_log_formatLogLine (
- AndroidLogFormat* p_format,
- char* defaultBuffer,
- size_t defaultBufferSize,
- const AndroidLogEntry* p_line,
- size_t* p_outLength);
-
-/**
- * Either print or do not print log line, based on filter
- *
- * Assumes single threaded execution
- *
- */
-int android_log_printLogLine(
- AndroidLogFormat* p_format,
- int fd,
- const AndroidLogEntry* entry);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*_LOGPRINT_H*/
diff --git a/include/log/uio.h b/include/log/uio.h
deleted file mode 100644
index 7059da5f7..000000000
--- a/include/log/uio.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 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.
- * 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.
- */
-
-#ifndef _LIBS_CUTILS_UIO_H
-#define _LIBS_CUTILS_UIO_H
-
-#if !defined(_WIN32)
-
-#include <sys/uio.h>
-
-#else
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//
-// Implementation of sys/uio.h for Win32.
-//
-
-#include <stddef.h>
-
-struct iovec {
- void* iov_base;
- size_t iov_len;
-};
-
-extern int readv( int fd, struct iovec* vecs, int count );
-extern int writev( int fd, const struct iovec* vecs, int count );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif /* _LIBS_UTILS_UIO_H */
-
diff --git a/include/private/android_logger.h b/include/private/android_logger.h
index 9f81b1f06..f187a6d22 100644..120000
--- a/include/private/android_logger.h
+++ b/include/private/android_logger.h
@@ -1,194 +1 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-/* This file is used to define the internal protocol for the Android Logger */
-
-#ifndef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
-#define _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
-
-/* Android private interfaces */
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#if (defined(__cplusplus) && defined(_USING_LIBCXX))
-extern "C++" {
-#include <string>
-}
-#endif
-
-#include <log/log_event_list.h>
-#include <log/log.h>
-
-#define LOGGER_MAGIC 'l'
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-/* Header Structure to pstore */
-typedef struct __attribute__((__packed__)) {
- uint8_t magic;
- uint16_t len;
- uint16_t uid;
- uint16_t pid;
-} android_pmsg_log_header_t;
-
-/* Header Structure to logd, and second header for pstore */
-typedef struct __attribute__((__packed__)) {
- typeof_log_id_t id;
- uint16_t tid;
- log_time realtime;
-} android_log_header_t;
-
-/* Event Header Structure to logd */
-typedef struct __attribute__((__packed__)) {
- int32_t tag; // Little Endian Order
-} android_event_header_t;
-
-/* Event payload EVENT_TYPE_INT */
-typedef struct __attribute__((__packed__)) {
- int8_t type; // EVENT_TYPE_INT
- int32_t data; // Little Endian Order
-} android_event_int_t;
-
-/* Event with single EVENT_TYPE_INT */
-typedef struct __attribute__((__packed__)) {
- android_event_header_t header;
- android_event_int_t payload;
-} android_log_event_int_t;
-
-/* Event payload EVENT_TYPE_LONG */
-typedef struct __attribute__((__packed__)) {
- int8_t type; // EVENT_TYPE_LONG
- int64_t data; // Little Endian Order
-} android_event_long_t;
-
-/* Event with single EVENT_TYPE_LONG */
-typedef struct __attribute__((__packed__)) {
- android_event_header_t header;
- android_event_long_t payload;
-} android_log_event_long_t;
-
-/*
- * Event payload EVENT_TYPE_STRING
- *
- * Danger: do not embed this structure into another structure.
- * This structure uses a flexible array member, and when
- * compiled using g++, __builtin_object_size(data, 1) returns
- * a bad value. This is possibly a g++ bug, or a bug due to
- * the fact that flexible array members are not supported
- * in C++.
- * http://stackoverflow.com/questions/4412749/are-flexible-array-members-valid-in-c
- */
-
-typedef struct __attribute__((__packed__)) {
- int8_t type; // EVENT_TYPE_STRING;
- int32_t length; // Little Endian Order
- char data[];
-} android_event_string_t;
-
-/* Event with single EVENT_TYPE_STRING */
-typedef struct __attribute__((__packed__)) {
- android_event_header_t header;
- int8_t type; // EVENT_TYPE_STRING;
- int32_t length; // Little Endian Order
- char data[];
-} android_log_event_string_t;
-
-#define ANDROID_LOG_PMSG_FILE_MAX_SEQUENCE 256 /* 1MB file */
-#define ANDROID_LOG_PMSG_FILE_SEQUENCE 1000
-
-ssize_t __android_log_pmsg_file_write(
- log_id_t logId,
- char prio,
- const char* filename,
- const char* buf, size_t len);
-
-#define LOG_ID_ANY ((log_id_t)-1)
-#define ANDROID_LOG_ANY ANDROID_LOG_UNKNOWN
-
-/* first 5 arguments match __android_log_msg_file_write, a cast is safe */
-typedef ssize_t (*__android_log_pmsg_file_read_fn)(
- log_id_t logId,
- char prio,
- const char* filename,
- const char* buf, size_t len, void* arg);
-
-ssize_t __android_log_pmsg_file_read(
- log_id_t logId, char prio, const char* prefix,
- __android_log_pmsg_file_read_fn fn, void* arg);
-
-int __android_log_security_bwrite(int32_t tag, const void* payload, size_t len);
-int __android_log_security_bswrite(int32_t tag, const char* payload);
-int __android_log_security(); /* Device Owner is present */
-
-int __android_log_is_debuggable();
-
-#define BOOL_DEFAULT_FLAG_TRUE_FALSE 0x1
-#define BOOL_DEFAULT_FALSE 0x0 /* false if property not present */
-#define BOOL_DEFAULT_TRUE 0x1 /* true if property not present */
-#define BOOL_DEFAULT_FLAG_PERSIST 0x2 /* <key>, persist.<key>, ro.<key> */
-#define BOOL_DEFAULT_FLAG_ENG 0x4 /* off for user */
-#define BOOL_DEFAULT_FLAG_SVELTE 0x8 /* off for low_ram */
-bool __android_logger_property_get_bool(const char* key, int flag);
-
-#define LOG_BUFFER_SIZE (256 * 1024) /* Tuned with ro.logd.size per-platform */
-#define LOG_BUFFER_MIN_SIZE (64 * 1024UL)
-#define LOG_BUFFER_MAX_SIZE (256 * 1024 * 1024UL)
-unsigned long __android_logger_get_buffer_size(log_id_t logId);
-bool __android_logger_valid_buffer_size(unsigned long value);
-
-/* Retrieve the composed event buffer */
-int android_log_write_list_buffer(android_log_context ctx, const char** msg);
-
-#ifdef __cplusplus
-#ifdef __class_android_log_event_list_defined
-#ifndef __class_android_log_event_list_private_defined
-#define __class_android_log_event_list_private_defined
-/* android_log_context C++ helpers */
-extern "C++" {
-class __android_log_event_list : public android_log_event_list {
- __android_log_event_list(const android_log_event_list&) = delete;
- void operator =(const __android_log_event_list&) = delete;
-
-public:
- explicit __android_log_event_list(int tag) : android_log_event_list(tag) { }
- explicit __android_log_event_list(log_msg& log_msg) : android_log_event_list(log_msg) { }
-
-#if defined(_USING_LIBCXX)
- operator std::string() {
- if (ret) return std::string("");
- const char* cp = NULL;
- ssize_t len = android_log_write_list_buffer(ctx, &cp);
- if (len < 0) ret = len;
- if (!cp || (len <= 0)) return std::string("");
- return std::string(cp, len);
- }
-#endif
-
-};
-}
-#endif
-#endif
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ */
+../../liblog/include/private/android_logger.h \ No newline at end of file