[-]
[+]
|
Changed |
_service:tar_git:libhybris.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/libhybris.git</param>
<param name="branch">master</param>
- <param name="revision">HEAD</param>
+ <param name="revision">0.0.5.38</param>
<param name="token"></param>
<param name="debian"></param>
<param name="dumb"></param>
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/compat/camera/Android.mk
^
|
@@ -1,12 +1,6 @@
LOCAL_PATH:= $(call my-dir)
-ifneq (,$(wildcard frameworks/av/media/mediaserver/Android.mk))
-HYBRIS_MEDIA_32_BIT_ONLY := $(shell cat frameworks/av/media/mediaserver/Android.mk | grep LOCAL_32_BIT_ONLY | grep -o "true\|false")
-else
-ifneq (,$(wildcard frameworks/av/media/mediaserver/Android.bp))
-HYBRIS_MEDIA_32_BIT_ONLY := $(shell cat frameworks/av/media/mediaserver/Android.bp | grep compile_multilib | grep -wo "32" | sed "s/32/true/")
-endif
-endif
+HYBRIS_MEDIA_32_BIT_ONLY := $(shell cat frameworks/av/media/libmediaplayerservice/Android.mk |grep LOCAL_32_BIT_ONLY |grep -o "true\|false")
ifeq ($(HYBRIS_MEDIA_32_BIT_ONLY),true)
HYBRIS_MEDIA_MULTILIB := 32
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/compat/hwc2/Android.mk
^
|
@@ -12,10 +12,10 @@
LOCAL_C_INCLUDES := ../hybris/include
-ifeq ($(shell test $(ANDROID_VERSION_MAJOR) -ge 9 && echo true),true)
+ifeq ($(strip $(ANDROID_VERSION_MAJOR)),9)
LOCAL_C_INCLUDES += \
hardware/interfaces/graphics/composer/2.1/utils/command-buffer/include
-LOCAL_HEADER_LIBRARIES := \
+LOCAL_HEADER_LIBRARIES : \
android.hardware.graphics.composer@2.1-command-buffer
else
LOCAL_STATIC_LIBRARIES := \
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/compat/media/Android.mk
^
|
@@ -1,12 +1,6 @@
LOCAL_PATH:= $(call my-dir)
-ifneq (,$(wildcard frameworks/av/media/mediaserver/Android.mk))
-HYBRIS_MEDIA_32_BIT_ONLY := $(shell cat frameworks/av/media/mediaserver/Android.mk | grep LOCAL_32_BIT_ONLY | grep -o "true\|false")
-else
-ifneq (,$(wildcard frameworks/av/media/mediaserver/Android.bp))
-HYBRIS_MEDIA_32_BIT_ONLY := $(shell cat frameworks/av/media/mediaserver/Android.bp | grep compile_multilib | grep -wo "32" | sed "s/32/true/")
-endif
-endif
+HYBRIS_MEDIA_32_BIT_ONLY := $(shell cat frameworks/av/media/libmediaplayerservice/Android.mk |grep LOCAL_32_BIT_ONLY |grep -o "true\|false")
ifeq ($(HYBRIS_MEDIA_32_BIT_ONLY),true)
HYBRIS_MEDIA_MULTILIB := 32
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/common/Makefile.am
^
|
@@ -4,10 +4,8 @@
SUBDIRS =
if !WANT_ARCH_ARM64
-if !WANT_ARCH_X86_64
SUBDIRS += jb
endif
-endif
if HAS_ANDROID_6_0_0
SUBDIRS += mm
@@ -21,10 +19,6 @@
SUBDIRS += o
endif
-if HAS_ANDROID_10_0_0
-SUBDIRS += q
-endif
-
libhybris_common_la_SOURCES = \
hooks.c \
hooks_shm.c \
@@ -59,6 +53,14 @@
libhybris_common_la_CPPFLAGS += -DWANT_ADRENO_QUIRKS
endif
+if WANT_ARM_TRACING
+# thumb mode not supported
+libhybris_common_la_CFLAGS += \
+ -marm
+libhybris_common_la_CPPFLAGS += \
+ -marm
+endif
+
if WANT_TRACE
libhybris_common_la_CPPFLAGS += -DDEBUG
endif
@@ -86,9 +88,6 @@
if HAS_ANDROID_8_0_0
libhybris_common_la_CPPFLAGS += -DWANT_LINKER_O
endif
-if HAS_ANDROID_10_0_0
-libhybris_common_la_CPPFLAGS += -DWANT_LINKER_Q
-endif
libhybris_common_la_CXXFLAGS = \
-std=gnu++11
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/common/hooks.c
^
|
@@ -125,10 +125,6 @@
void (*_android_dlwarning)(void* obj, void (*f)(void*, const char*)) = NULL;
void *(*_android_get_exported_namespace)(const char* name) = NULL;
-#if WANT_LINKER_Q
-void * (*_android_shared_globals)() = NULL;
-#endif
-
/* TODO:
* - Check if the int arguments at attr_set/get match the ones at Android
* - Check how to deal with memory leaks (specially with static initializers)
@@ -1943,7 +1939,7 @@
*namelist = result;
}
- return nItems;
+ return res;
}
static int _hybris_hook_scandir(const char *dir,
@@ -2693,14 +2689,7 @@
return _android_create_namespace(name, ld_library_path, default_library_path, type, permitted_when_isolated_path, parent);
}
-#if WANT_LINKER_Q
-void* _hybris_hook___loader_shared_globals()
-{
- TRACE("");
- return _android_shared_globals();
-}
-#endif
bool _hybris_hook_android_init_anonymous_namespace(const char* shared_libs_sonames,
const char* library_search_path)
{
@@ -2985,14 +2974,10 @@
HOOK_INDIRECT(android_init_anonymous_namespace),
HOOK_INDIRECT(android_dlwarning),
HOOK_INDIRECT(android_get_exported_namespace),
-#if WANT_LINKER_Q
- HOOK_INDIRECT(__loader_shared_globals),
-#endif
/* dirent.h */
HOOK_DIRECT_NO_DEBUG(opendir),
HOOK_DIRECT_NO_DEBUG(fdopendir),
HOOK_DIRECT_NO_DEBUG(closedir),
- HOOK_DIRECT_NO_DEBUG(__fsetlocking),
HOOK_INDIRECT(readdir),
HOOK_INDIRECT(readdir_r),
HOOK_DIRECT_NO_DEBUG(rewinddir),
@@ -3073,7 +3058,6 @@
HOOK_DIRECT_NO_DEBUG(ptsname),
HOOK_TO(__hybris_set_errno_internal, _hybris_hook___set_errno),
HOOK_DIRECT_NO_DEBUG(getservbyname),
- HOOK_DIRECT_NO_DEBUG(close), /* avoid calling fdsan functions */
/* libgen.h */
HOOK_INDIRECT(basename),
HOOK_INDIRECT(dirname),
@@ -3167,12 +3151,8 @@
#define LINKER_NAME_MM "mm"
#define LINKER_NAME_N "n"
#define LINKER_NAME_O "o"
-#define LINKER_NAME_Q "q"
-#if defined(WANT_LINKER_Q)
-#define LINKER_VERSION_DEFAULT 29
-#define LINKER_NAME_DEFAULT LINKER_NAME_Q
-#elif defined(WANT_LINKER_O)
+#if defined(WANT_LINKER_O)
#define LINKER_VERSION_DEFAULT 27
#define LINKER_NAME_DEFAULT LINKER_NAME_O
#elif defined(WANT_LINKER_N)
@@ -3276,7 +3256,7 @@
key.name = sym;
sdk_version = get_android_sdk_version();
-#if defined(WANT_LINKER_MM) || defined(WANT_LINKER_N) || defined(WANT_LINKER_O) || defined(WANT_LINKER_Q)
+#if defined(WANT_LINKER_MM) || defined(WANT_LINKER_N) || defined(WANT_LINKER_O)
if (sdk_version > 21)
found = bsearch(&key, hooks_mm, HOOKS_SIZE(hooks_mm), sizeof(hooks_mm[0]), hook_cmp);
#endif
@@ -3353,10 +3333,6 @@
/* See https://source.android.com/source/build-numbers.html for
* an overview over available SDK version numbers and which
* Android version they relate to. */
-#if defined(WANT_LINKER_Q)
- if (sdk_version <= 29)
- name = LINKER_NAME_Q;
-#endif
#if defined(WANT_LINKER_O)
if (sdk_version <= 27)
name = LINKER_NAME_O;
@@ -3410,9 +3386,7 @@
_android_init_anonymous_namespace = dlsym(linker_handle, "android_init_anonymous_namespace");
_android_dlwarning = dlsym(linker_handle, "android_dlwarning");
_android_get_exported_namespace = dlsym(linker_handle, "android_get_exported_namespace");
-#if WANT_LINKER_Q
- _android_shared_globals = dlsym(linker_handle, "android_shared_globals");
-#endif
+
/* Now its time to setup the linker itself */
#ifdef WANT_ARM_TRACING
_android_linker_init(sdk_version, __hybris_get_hooked_symbol, enable_linker_gdb_support, create_wrapper);
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/common/jb/dlfcn.c
^
|
@@ -23,12 +23,6 @@
#include "linker.h"
#include "linker_format.h"
-#ifdef WANT_ARM_TRACING
-#include "../wrappers.h"
-
-extern void *(*_create_wrapper)(const char *symbol, void *function, int wrapper_type);
-#endif
-
/* This file hijacks the symbols stubbed out in libdl.so. */
#define DL_SUCCESS 0
@@ -121,15 +115,6 @@
if(likely((bind == STB_GLOBAL) && (sym->st_shndx != 0))) {
unsigned ret = sym->st_value + found->base;
-#ifdef WANT_ARM_TRACING
- switch(ELF32_ST_TYPE(sym->st_info))
- {
- case STT_FUNC:
- case STT_GNU_IFUNC:
- case STT_ARM_TFUNC:
- ret = (void*)(_create_wrapper((char*)symbol, (void*)ret, WRAPPER_DYNHOOK));
- }
-#endif
pthread_mutex_unlock(&dl_lock);
return (void*)ret;
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/common/jb/linker.c
^
|
@@ -51,10 +51,6 @@
#include "linker_environ.h"
#include "linker_format.h"
-#ifdef WANT_ARM_TRACING
-#include "../wrappers.h"
-#endif
-
#define ALLOW_SYMBOLS_FROM_MAIN 1
#define SO_MAX 128
@@ -85,10 +81,6 @@
* having a hard limit (64)
*/
-#ifdef WANT_ARM_TRACING
-void *(*_create_wrapper)(const char *symbol, void *function, int wrapper_type);
-#endif
-
static void* (*_get_hooked_symbol)(const char *symbol, const char *requester);
static int link_image(soinfo *si, unsigned wr_offset);
@@ -1385,21 +1377,8 @@
if (sym_addr != 0) {
INFO("HYBRIS: '%s' hooked symbol %s to %x\n", si->name,
sym_name, sym_addr);
-#ifdef WANT_ARM_TRACING
- s = _do_lookup(si, sym_name, &base);
- if(s != NULL) {
- switch(ELF32_ST_TYPE(s->st_info))
- {
- case STT_FUNC:
- case STT_GNU_IFUNC:
- case STT_ARM_TFUNC:
- sym_addr = (unsigned)_create_wrapper(sym_name, (void*)sym_addr, WRAPPER_HOOKED);
- break;
- }
- }
-#endif
} else {
- s = _do_lookup(si, sym_name, &base);
+ s = _do_lookup(si, sym_name, &base);
}
if(sym_addr == 0) {
if(s == NULL) {
@@ -1468,22 +1447,7 @@
return -1;
}
#endif
-#ifdef WANT_ARM_TRACING
- switch(ELF32_ST_TYPE(s->st_info))
- {
- case STT_FUNC:
- case STT_GNU_IFUNC:
- case STT_ARM_TFUNC:
- sym_addr = (unsigned)_create_wrapper(sym_name,
- (unsigned)(s->st_value + base), WRAPPER_UNHOOKED);
- break;
- default:
- sym_addr = (unsigned)(s->st_value + base);
- break;
- }
-#else
sym_addr = (unsigned)(s->st_value + base);
-#endif
}
}
COUNT_RELOC(RELOC_SYMBOL);
@@ -2424,8 +2388,5 @@
#endif
(void) sdk_version;
_get_hooked_symbol = get_hooked_symbol;
-#ifdef WANT_ARM_TRACING
- _create_wrapper = create_wrapper;
-#endif
_linker_enable_gdb_support = enable_linker_gdb_support;
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/common/wrapper_code.h
^
|
@@ -22,13 +22,7 @@
extern "C" {
#endif
-#ifdef __aarch64__
void wrapper_code_generic() __attribute__((naked,noinline));
-#endif
-#ifdef __arm__
-void wrapper_code_generic() __attribute__((naked,noinline)) __attribute__((target("arm")));
-void wrapper_code_generic_thumb() __attribute__((naked,noinline)) __attribute__((target("thumb")));
-#endif
#ifdef __cplusplus
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/common/wrapper_code_generic_arm.c
^
|
@@ -20,28 +20,27 @@
void
wrapper_code_generic()
{
-#ifdef __arm__
// we can never use r0-r11, neither the stack
asm volatile(
// preserve the registers
- ".arm\n\
+ ".arm\n\
push {r0-r11, lr}\n"
- ".arm\n\
+ ".arm\n\
ldr r0, fun\n" // load the function pointer to r0
- ".arm\n\
+ ".arm\n\
ldr r1, name\n" // load the address of the functions name to r1
- ".arm\n\
+ ".arm\n\
ldr r2, str\n" // load the string to print
- ".arm\n\
+ ".arm\n\
ldr r4, tc\n" // load the address of trace_callback to r4
- ".arm\n\
+ ".arm\n\
blx r4\n" // call trace_callback
// restore the registers
- ".arm\n\
+ ".arm\n\
pop {r0-r11, lr}\n"
- ".arm\n\
+ ".arm\n\
ldr pc, fun\n" // jump to function
// dummy instructions, this is where we locate our pointers
@@ -50,119 +49,4 @@
"tc: .word 0xFFFFFFFF\n" // address of trace_callback
"str: .word 0xFFFFFFFF\n" // the string being printed in trace_callback
);
-#elif defined(__aarch64__)
- // we can never use r0-r11, neither the stack
- asm volatile(
- // preserve the registers
- "sub sp, sp, #32\n" // open up some temp stack space
- "stp x0, x1, [sp]\n" // save 2 pairs of registers
- "stp x2, x3, [sp,#16]\n"
-
- "sub sp, sp, #32\n" // open up some temp stack space
- "stp x4, x5, [sp]\n" // save 2 pairs of registers
- "stp x6, x7, [sp,#16]\n"
-
- "sub sp, sp, #32\n" // open up some temp stack space
- "stp x8, x9, [sp]\n" // save 2 pairs of registers
- "stp x10, x11, [sp,#16]\n"
-
- "sub sp, sp, #32\n" // open up some temp stack space
- "stp x12, x13, [sp]\n" // save 2 pairs of registers
- "stp x14, x15, [sp,#16]\n"
-
- "sub sp, sp, #32\n" // open up some temp stack space
- "stp x16, x17, [sp]\n" // save 2 pairs of registers
- "stp x18, x19, [sp,#16]\n"
-
- "sub sp, sp, #32\n" // open up some temp stack space
- "stp x20, x21, [sp]\n" // save 2 pairs of registers
- "stp x22, x23, [sp,#16]\n"
-
- "sub sp, sp, #32\n" // open up some temp stack space
- "stp x24, x25, [sp]\n" // save 2 pairs of registers
- "stp x26, x27, [sp,#16]\n"
-
- "sub sp, sp, #32\n" // open up some temp stack space
- "stp x28, x29, [sp]\n" // save a pair of registers
- "str x30, [sp,#16]\n" // save x30
-
- "ldr x0, fun\n" // load the function pointer to r0
- "ldr x1, name\n" // load the address of the functions name to r1
- "ldr x2, str\n" // load the string to print
- "ldr x4, tc\n" // load the address of trace_callback to r4
- "blr x4\n" // call trace_callback
-
- // restore the registers
- "ldp x28, x29, [sp]\n" // restore a pair of registers
- "ldr x30, [sp,#16]\n" // restore x30
- "add sp, sp, #32\n" // "free" the temp stack space
-
- "ldp x24, x25, [sp]\n" // restore 2 pairs of registers
- "ldp x26, x27, [sp,#16]\n"
- "add sp, sp, #32\n" // "free" the temp stack space
-
- "ldp x20, x21, [sp]\n" // restore 2 pairs of registers
- "ldp x22, x23, [sp,#16]\n"
- "add sp, sp, #32\n" // "free" the temp stack space
-
- "ldp x16, x17, [sp]\n" // restore 2 pairs of registers
- "ldp x18, x19, [sp,#16]\n"
- "add sp, sp, #32\n" // "free" the temp stack space
-
- "ldp x12, x13, [sp]\n" // restore 2 pairs of registers
- "ldp x14, x15, [sp,#16]\n"
- "add sp, sp, #32\n" // "free" the temp stack space
-
- "ldp x8, x9, [sp]\n" // restore 2 pairs of registers
- "ldp x10, x11, [sp,#16]\n"
- "add sp, sp, #32\n" // "free" the temp stack space
-
- "ldp x4, x5, [sp]\n" // restore 2 pairs of registers
- "ldp x6, x7, [sp,#16]\n"
- "add sp, sp, #32\n" // "free" the temp stack space
-
- "ldp x0, x1, [sp]\n" // restore 2 pairs of registers
- "ldp x2, x3, [sp,#16]\n"
- "add sp, sp, #32\n" // "free" the temp stack space
-
- "ldr x15, fun\n" // load the function pointer to "temporary" r15
- "br x15\n" // branch unconditionally to r15
-
- // dummy instructions, this is where we locate our pointers
- ".align 3\n" // advance location counter to be multiple of 8
- "name: .dword 0xFFFFFFFFFFFFFFFF\n" // name of function to call
- "fun: .dword 0xFFFFFFFFFFFFFFFF\n" // function to call
- "tc: .dword 0xFFFFFFFFFFFFFFFF\n" // address of trace_callback
- "str: .dword 0xFFFFFFFFFFFFFFFF\n" // the string being printed in trace_callback
- );
-#endif
}
-
-#ifdef __arm__
-void
-wrapper_code_generic_thumb()
-{
- // we can never use r0-r11, neither the stack
- asm volatile(
- // preserve the registers
- "push {r0-r11, lr}\n"
-
- "ldr r0, tfun\n" // load the function pointer to r0
- "ldr r1, tname\n" // load the address of the functions name to r1
- "ldr r2, tstr\n" // load the string to print
- "ldr r4, ttc\n" // load the address of trace_callback to r4
- "blx r4\n" // call trace_callback
-
- // restore the registers
- "pop {r0-r11, lr}\n"
- "ldr pc, tfun\n" // jump to function
-
- // dummy instructions, this is where we locate our pointers
- "tname: .word 0xFFFFFFFF\n" // name of function to call
- "tfun: .word 0xFFFFFFFF\n" // function to call
- "ttc: .word 0xFFFFFFFF\n" // address of trace_callback
- "tstr: .word 0xFFFFFFFF\n" // the string being printed in trace_callback
- );
-}
-#endif
-
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/common/wrappers.c
^
|
@@ -100,22 +100,9 @@
void *create_wrapper(const char *symbol, void *function, int wrapper_type)
{
size_t wrapper_size = 0;
-#ifdef __arm__
void *wrapper_code = (void*)((uint32_t)wrapper_code_generic & 0xFFFFFFFE);
-#elif defined(__aarch64__)
- void *wrapper_code = (void*)(wrapper_code_generic);
-#endif
void *wrapper_addr = NULL;
int helper = 0;
- int thumb_fixup = 0;
-
-#ifdef __arm__
- if ((uint32_t)function & 1) {
- // thumb
- wrapper_code = (void*)((uint32_t)wrapper_code_generic_thumb & 0xFFFFFFFE);
- thumb_fixup = 1;
- }
-#endif
const char *msg = NULL;
@@ -149,7 +136,7 @@
wrapper_size = get_wrapper_code_size(wrapper_code);
// 4 additional longs for data storage, see below
- wrapper_size += 4 * sizeof(uintptr_t);
+ wrapper_size += 4 * sizeof(uint32_t);
// reserve memory for the generated wrapper
wrapper_addr = mmap(NULL, wrapper_size,
@@ -166,17 +153,17 @@
memcpy(wrapper_addr, wrapper_code, wrapper_size);
// Helper = offset of data fields in wrapper_addr (interpreted as int32_t)
- helper = wrapper_size / sizeof(uintptr_t) - 4;
+ helper = wrapper_size / sizeof(uint32_t) - 4;
switch(wrapper_type)
{
case WRAPPER_HOOKED:
case WRAPPER_UNHOOKED:
case WRAPPER_DYNHOOK:
- ((uintptr_t*)wrapper_addr)[helper++] = (uintptr_t)symbol;
- ((uintptr_t*)wrapper_addr)[helper++] = (uintptr_t)function;
- ((uintptr_t*)wrapper_addr)[helper++] = (uintptr_t)trace_callback;
- ((uintptr_t*)wrapper_addr)[helper++] = (uintptr_t)msg;
+ ((int32_t*)wrapper_addr)[helper++] = (uint32_t)symbol;
+ ((int32_t*)wrapper_addr)[helper++] = (uint32_t)function;
+ ((int32_t*)wrapper_addr)[helper++] = (uint32_t)trace_callback;
+ ((int32_t*)wrapper_addr)[helper++] = (uint32_t)msg;
break;
default:
assert(0);
@@ -185,7 +172,7 @@
register_wrapper(wrapper_addr, wrapper_size, symbol, wrapper_type);
- return (void*)wrapper_addr + thumb_fixup;
+ return (void*)wrapper_addr;
}
void release_all_wrappers()
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/configure.ac
^
|
@@ -61,7 +61,7 @@
AM_CONDITIONAL( [WANT_TRACE], [test x"$trace" = x"yes"])
AC_ARG_ENABLE(arm_tracing,
- [ --enable-arm-tracing Enable ARM (both 32 and 64-bit) tracing, useful for understanding what the blob is doing, currently only the mm linker is supported. (default=disabled)],
+ [ --enable-arm-tracing Enable ARM (32-bit only) tracing, useful for understanding what the blob is doing, currently only the mm linker is supported. (default=disabled)],
[arm_tracing=$enableval],
[arm_tracing="no"])
AM_CONDITIONAL([WANT_ARM_TRACING], [test x"$arm_tracing" = x"yes"])
@@ -184,7 +184,7 @@
AM_CONDITIONAL([HAS_LIBNFC_NXP_HEADERS], [test x"$HAS_LIBNFC_NXP_HEADERS" = x"yes"])
AC_CHECK_HEADERS(hardware_legacy/wifi.h, HAS_WIFI_LEGACY_HEADERS=yes)
AM_CONDITIONAL([HAS_WIFI_LEGACY_HEADERS], [test x"$HAS_WIFI_LEGACY_HEADERS" = x"yes"])
- AC_CHECK_HEADERS(hardware/hwcomposer2.h, HAS_HWCOMPOSER2_HEADERS=yes, HAS_HWCOMPOSER2_HEADERS=no, [# include <stdbool.h>])
+ AC_CHECK_HEADERS(hardware/hwcomposer2.h, HAS_HWCOMPOSER2_HEADERS=yes)
AM_CONDITIONAL([HAS_HWCOMPOSER2_HEADERS], [test x"$HAS_HWCOMPOSER2_HEADERS" = x"yes"])
AC_CHECK_HEADERS(hardware/gralloc1.h, HAS_GRALLOC1_HEADER=yes)
AM_CONDITIONAL([HAS_GRALLOC1_HEADER], [test x"$HAS_GRALLOC1_HEADER" = x"yes"])
@@ -242,7 +242,6 @@
AC_MSG_NOTICE("Android headers version is $android_headers_major.$android_headers_minor.$android_headers_patch")
# Add automake tests for version/API needs here that you need in code, including test .am's
-AM_CONDITIONAL([HAS_ANDROID_10_0_0],[test $android_headers_major -ge 10 -a $android_headers_minor -ge 0 ])
AM_CONDITIONAL([HAS_ANDROID_9_0_0], [test $android_headers_major -ge 9 -a $android_headers_minor -ge 0 ])
AM_CONDITIONAL([HAS_ANDROID_8_0_0], [test $android_headers_major -ge 8 -a $android_headers_minor -ge 0 ])
AM_CONDITIONAL([HAS_ANDROID_7_0_0], [test $android_headers_major -ge 7 -a $android_headers_minor -ge 0 ])
@@ -278,7 +277,6 @@
common/mm/Makefile
common/n/Makefile
common/o/Makefile
- common/q/Makefile
egl/egl.pc
egl/Makefile
egl/platforms/Makefile
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/egl/egl.c
^
|
@@ -194,7 +194,7 @@
struct _EGLDisplay *display = hybris_egl_display_get_mapping(dpy);
win = ws_CreateWindow(win, display);
- assert(((struct ANativeWindow *) win)->common.magic == ANDROID_NATIVE_WINDOW_MAGIC);
+ assert(((struct ANativeWindowBuffer *) win)->common.magic == ANDROID_NATIVE_WINDOW_MAGIC);
HYBRIS_TRACE_BEGIN("native-egl", "eglCreateWindowSurface", "");
EGLSurface result = (*_eglCreateWindowSurface)(dpy, config, win, attrib_list);
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/egl/platforms/null/eglplatform_null.c
^
|
@@ -35,11 +35,7 @@
{
if (win == 0)
{
-#if (ANDROID_VERSION_MAJOR <= 7)
return android_createDisplaySurface();
-#else
- return win;
-#endif
}
else
return win;
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/egl/platforms/wayland/wayland_window.cpp
^
|
@@ -26,7 +26,6 @@
#include <android-config.h>
-#include <hardware/gralloc.h>
#include "wayland_window.h"
#include "wayland-egl-priv.h"
#include <assert.h>
@@ -90,8 +89,8 @@
void WaylandNativeWindow::resize(unsigned int width, unsigned int height)
{
lock();
- this->m_defaultWidth = m_width = width;
- this->m_defaultHeight = m_height = height;
+ this->m_defaultWidth = width;
+ this->m_defaultHeight = height;
unlock();
}
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/gralloc/gralloc.c
^
|
@@ -1,4 +1,3 @@
-#include <android-config.h>
#include <stdlib.h>
#include <hardware/hardware.h>
@@ -13,6 +12,7 @@
#ifdef ANDROID_BUILD
#include "hybris-gralloc.h"
#else
+#include <android-config.h>
#include <hybris/gralloc/gralloc.h>
#include <hybris/common/binding.h>
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/include/hybris/gralloc/gralloc.h
^
|
@@ -5,8 +5,13 @@
extern "C" {
#endif
+// for usage definitions and so on
+#if HAS_GRALLOC1_HEADER
+#include <hardware/gralloc1.h>
+#endif
+#include <hardware/gralloc.h>
+
#include <cutils/native_handle.h>
-#include <system/window.h>
void hybris_gralloc_deinitialize(void);
void hybris_gralloc_initialize(int framebuffer);
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/libsync/sync.c
^
|
@@ -23,20 +23,6 @@
#include <android-version.h>
-#if (ANDROID_VERSION_MAJOR >= 10)
-#include <linux/sync_file.h>
-struct sync_file_info* sync_file_info(int32_t fd);
-static inline struct sync_fence_info* sync_get_fence_info(const struct sync_file_info* info) {
-// This header should compile in C, but some C++ projects enable
-// warnings-as-error for C-style casts.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
- return (struct sync_fence_info *)(uintptr_t)(info->sync_fence_info);
-#pragma GCC diagnostic pop
-}
-void sync_file_info_free(struct sync_file_info* info);
-#endif
-
#if (ANDROID_VERSION_MAJOR <= 7)
#include <linux/sync.h>
#include <linux/sw_sync.h>
@@ -113,26 +99,6 @@
#endif //(ANDROID_VERSION_MAJOR >= 8)
-#if (ANDROID_VERSION_MAJOR >= 10)
-struct sync_fence_info_data {
- uint32_t len;
- char name[32];
- int32_t status;
- uint8_t pt_info[0];
-};
-struct sync_pt_info {
- uint32_t len;
- char obj_name[32];
- char driver_name[32];
- int32_t status;
- uint64_t timestamp_ns;
- uint8_t driver_data[0];
-};
-struct sync_fence_info_data* sync_fence_info(int fd);
-struct sync_pt_info* sync_pt_info(struct sync_fence_info_data* info, struct sync_pt_info* itr);
-void sync_fence_info_free(struct sync_fence_info_data* info);
-#endif
-
extern size_t strlcpy(char *dst, const char *src, size_t siz);
int sync_wait(int fd, int timeout)
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.5.38.tar.bz2/libhybris/hybris/tests/Makefile.am
^
|
@@ -16,21 +16,10 @@
test_opencl \
test_wifi \
test_hwcomposer \
- test_nfc \
- test_dlopen
-
-
-test_dlopen_SOURCES = test_dlopen.c
-test_dlopen_CFLAGS = \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/hybris/include \
- -I$(top_srcdir)/include/android
-test_dlopen_LDADD = \
- $(top_builddir)/common/libhybris-common.la \
- $(top_builddir)/hardware/libhardware.la
+ test_nfc
test_audio_SOURCES = test_audio.c
-test_audio_CFLAGS = -std=c99\
+test_audio_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/include/android
test_audio_LDADD = \
|
|
Changed |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/MODULE_LICENSE_BSD
^
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/Makefile.am
^
|
@@ -1,71 +0,0 @@
-bionic = $(top_srcdir)/common/q/bionic
-bionic_libc = $(bionic)/libc
-
-modlibexecdir = $(libdir)/libhybris/linker
-modlibexec_LTLIBRARIES = q.la
-
-ARCH_FLAGS =
-
-AM_CFLAGS = \
- -std=gnu99
-
-AM_CPPFLAGS = \
- -fno-stack-protector \
- -Wstrict-overflow=5
-
-AM_CXXFLAGS = \
- -std=gnu++11 \
- -Wold-style-cast
-
-q_la_SOURCES = \
- hybris_compat.cpp \
- dlfcn.cpp \
- linker_allocator.cpp \
- linker_block_allocator.cpp \
- linker.cpp \
- linker_cfi.cpp \
- linker_config.cpp \
- linker_dlwarning.cpp \
- linker_gdb_support.cpp \
- linker_globals.cpp \
- linker_logger.cpp \
- linker_main.cpp \
- linker_mapped_file_fragment.cpp \
- linker_memory.cpp \
- linker_namespaces.cpp \
- linker_phdr.cpp \
- linker_sdk_versions.cpp \
- linker_soinfo.cpp \
- linker_tls.cpp \
- linker_utils.cpp \
- rt.cpp \
- ../strlcpy.c \
- ../strlcat.c
-q_la_CPPFLAGS = \
- $(AM_CPPFLAGS) \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/common \
- -I$(bionic_libc)/ \
- -I$(bionic_libc)/include \
- -DDEFAULT_HYBRIS_LD_LIBRARY_PATH="\"@DEFAULT_HYBRIS_LD_LIBRARY_PATH@\"" \
- -D_USING_LIBCXX \
- $(ARCH_FLAGS) \
- $(ANDROID_HEADERS_CFLAGS)
-q_la_LDFLAGS = \
- -lsupc++ \
- -module \
- -avoid-version
-
-if WANT_DEBUG
-q_la_CPPFLAGS += \
- -DTRACE_DEBUG=1
-else
-q_la_CPPFLAGS += \
- -DTRACE_DEBUG=1
-endif
-
-if WANT_ARM_TRACING
-q_la_CPPFLAGS += \
- -DWANT_ARM_TRACING
-endif
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/async_safe/CHECK.h
^
|
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-
-#include <async_safe/log.h>
-
-__BEGIN_DECLS
-
-// TODO: replace this with something more like <android-base/logging.h>'s family of macros.
-
-#define CHECK(predicate) \
- do { \
- if (!(predicate)) { \
- async_safe_fatal("%s:%d: %s CHECK '" #predicate "' failed", \
- __FILE__, __LINE__, __FUNCTION__); \
- } \
- } while(0)
-
-__END_DECLS
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/async_safe/log.h
^
|
@@ -1,27 +0,0 @@
-#ifndef thatasyncsafeheaderthingy_replacement__
-#define thatasyncsafeheaderthingy_replacement__
-
-#include <stdio.h>
-enum {
- ANDROID_LOG_UNKNOWN = 0,
- ANDROID_LOG_DEFAULT, /* only for SetMinPriority() */
-
- ANDROID_LOG_VERBOSE,
- ANDROID_LOG_DEBUG,
- ANDROID_LOG_INFO,
- ANDROID_LOG_WARN,
- ANDROID_LOG_ERROR,
- ANDROID_LOG_FATAL,
-
- ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */
-};
-
-#define async_safe_fatal(...) { fprintf(stderr, __VA_ARGS__); abort(); }
-
-#define async_safe_format_fd(fd, ...) dprintf(fd, __VA_ARGS__)
-
-// Don't really care about verbose/debug logs for now
-#define async_safe_format_log_va_list(loglevel, category, format, ...) { if (loglevel > ANDROID_LOG_DEFAULT) { vfprintf(stdout, format, __VA_ARGS__); /*vfprintf(stderr, "%s", "\n");*/} }
-
-#endif
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/bionic/libc_init_common.h
^
|
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <sys/cdefs-android.h>
-
-typedef struct {
- void (**preinit_array)(void);
- void (**init_array)(void);
- void (**fini_array)(void);
-} structors_array_t;
-
-__BEGIN_DECLS
-
-extern int main(int argc, char** argv, char** env);
-
-void __libc_init(void* raw_args,
- void (*onexit)(void),
- int (*slingshot)(int, char**, char**),
- structors_array_t const* const structors);
-__LIBC_HIDDEN__ void __libc_fini(void* finit_array);
-
-__END_DECLS
-
-#if defined(__cplusplus)
-
-__LIBC_HIDDEN__ void __libc_init_globals();
-
-__LIBC_HIDDEN__ void __libc_init_common();
-
-__LIBC_HIDDEN__ void __libc_init_AT_SECURE(char** envp);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/bionic/pthread_internal.h
^
|
@@ -1,228 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <pthread.h>
-#include <stdatomic.h>
-#define __has_feature(x) 0
-#if __has_feature(hwaddress_sanitizer)
-#include <sanitizer/hwasan_interface.h>
-#else
-#define __hwasan_thread_enter()
-#define __hwasan_thread_exit()
-#endif
-
-#include "private/bionic_elf_tls.h"
-#include "private/bionic_lock.h"
-#include "private/bionic_tls.h"
-
-// Has the thread been detached by a pthread_join or pthread_detach call?
-#define PTHREAD_ATTR_FLAG_DETACHED 0x00000001
-
-// Has the thread been joined by another thread?
-#define PTHREAD_ATTR_FLAG_JOINED 0x00000002
-
-// Used for pthread_attr_setinheritsched. We need two flags for this apparent
-// boolean because our historical behavior matches neither of the POSIX choices.
-#define PTHREAD_ATTR_FLAG_INHERIT 0x00000004
-#define PTHREAD_ATTR_FLAG_EXPLICIT 0x00000008
-
-enum ThreadJoinState {
- THREAD_NOT_JOINED,
- THREAD_EXITED_NOT_JOINED,
- THREAD_JOINED,
- THREAD_DETACHED
-};
-
-class thread_local_dtor;
-
-class pthread_internal_t {
- public:
- class pthread_internal_t* next;
- class pthread_internal_t* prev;
-
- pid_t tid;
-
- private:
- pid_t cached_pid_;
-
- public:
- pid_t invalidate_cached_pid() {
- pid_t old_value;
- get_cached_pid(&old_value);
- set_cached_pid(0);
- return old_value;
- }
-
- void set_cached_pid(pid_t value) {
- cached_pid_ = value;
- }
-
- bool get_cached_pid(pid_t* cached_pid) {
- *cached_pid = cached_pid_;
- return (*cached_pid != 0);
- }
-
- pthread_attr_t attr;
-
- _Atomic(ThreadJoinState) join_state;
-
- //__pthread_cleanup_t* cleanup_stack;
-
- void* (*start_routine)(void*);
- void* start_routine_arg;
- void* return_value;
-
- void* alternate_signal_stack;
-
- // The start address of the shadow call stack's guard region (arm64 only).
- // This address is only used to deallocate the shadow call stack on thread
- // exit; the address of the stack itself is stored only in the x18 register.
- // Because the protection offered by SCS relies on the secrecy of the stack
- // address, storing the address here weakens the protection, but only
- // slightly, because it is relatively easy for an attacker to discover the
- // address of the guard region anyway (e.g. it can be discovered by reference
- // to other allocations), but not the stack itself, which is <0.1% of the size
- // of the guard region.
- //
- // There are at least two other options for discovering the start address of
- // the guard region on thread exit, but they are not as simple as storing in
- // TLS.
- // 1) Derive it from the value of the x18 register. This is only possible in
- // processes that do not contain legacy code that might clobber x18,
- // therefore each process must declare early during process startup whether
- // it might load legacy code.
- // 2) Mark the guard region as such using prctl(PR_SET_VMA_ANON_NAME) and
- // discover its address by reading /proc/self/maps. One issue with this is
- // that reading /proc/self/maps can race with allocations, so we may need
- // code to handle retries.
- void* shadow_call_stack_guard_region;
-
- Lock startup_handshake_lock;
-
- void* mmap_base;
- size_t mmap_size;
-
- thread_local_dtor* thread_local_dtors;
-
- /*
- * The dynamic linker implements dlerror(3), which makes it hard for us to implement this
- * per-thread buffer by simply using malloc(3) and free(3).
- */
- char* current_dlerror;
-#define __BIONIC_DLERROR_BUFFER_SIZE 512
- char dlerror_buffer[__BIONIC_DLERROR_BUFFER_SIZE];
-
- struct bionic_tls* bionic_tls;
-
- int errno_value;
-};
-
-struct ThreadMapping {
- char* mmap_base;
- size_t mmap_size;
-
- char* static_tls;
- char* stack_base;
- char* stack_top;
-};
-
-__LIBC_HIDDEN__ void __init_tcb(bionic_tcb* tcb, pthread_internal_t* thread);
-__LIBC_HIDDEN__ void __init_tcb_stack_guard(bionic_tcb* tcb);
-__LIBC_HIDDEN__ void __init_tcb_dtv(bionic_tcb* tcb);
-__LIBC_HIDDEN__ void __init_bionic_tls_ptrs(bionic_tcb* tcb, bionic_tls* tls);
-__LIBC_HIDDEN__ bionic_tls* __allocate_temp_bionic_tls();
-__LIBC_HIDDEN__ void __free_temp_bionic_tls(bionic_tls* tls);
-__LIBC_HIDDEN__ void __init_additional_stacks(pthread_internal_t*);
-__LIBC_HIDDEN__ int __init_thread(pthread_internal_t* thread);
-__LIBC_HIDDEN__ ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_size);
-
-__LIBC_HIDDEN__ pthread_t __pthread_internal_add(pthread_internal_t* thread);
-__LIBC_HIDDEN__ pthread_internal_t* __pthread_internal_find(pthread_t pthread_id, const char* caller);
-__LIBC_HIDDEN__ pid_t __pthread_internal_gettid(pthread_t pthread_id, const char* caller);
-__LIBC_HIDDEN__ void __pthread_internal_remove(pthread_internal_t* thread);
-__LIBC_HIDDEN__ void __pthread_internal_remove_and_free(pthread_internal_t* thread);
-
-static inline bionic_tcb* __get_bionic_tcb() {
- return reinterpret_cast<bionic_tcb*>(&__get_tls()[MIN_TLS_SLOT]);
-}
-
-// Make __get_thread() inlined for performance reason. See http://b/19825434.
-static inline pthread_internal_t* __get_thread() {
- return static_cast<pthread_internal_t*>(__get_tls()[TLS_SLOT_THREAD_ID]);
-}
-
-static inline bionic_tls& __get_bionic_tls() {
- return *static_cast<bionic_tls*>(__get_tls()[TLS_SLOT_BIONIC_TLS]);
-}
-
-static inline TlsDtv* __get_tcb_dtv(bionic_tcb* tcb) {
- uintptr_t dtv_slot = reinterpret_cast<uintptr_t>(tcb->tls_slot(TLS_SLOT_DTV));
- return reinterpret_cast<TlsDtv*>(dtv_slot - offsetof(TlsDtv, generation));
-}
-
-static inline void __set_tcb_dtv(bionic_tcb* tcb, TlsDtv* val) {
- tcb->tls_slot(TLS_SLOT_DTV) = &val->generation;
-}
-
-extern "C" __LIBC_HIDDEN__ int __set_tls(void* ptr);
-
-__LIBC_HIDDEN__ void pthread_key_clean_all(void);
-
-// Address space is precious on LP32, so use the minimum unit: one page.
-// On LP64, we could use more but there's no obvious advantage to doing
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/chrono_utils.h
^
|
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#pragma once
-
-#include <chrono>
-#include <sstream>
-
-#if __cplusplus > 201103L && !defined(__WIN32) // C++14
-using namespace std::chrono_literals;
-#endif
-
-namespace android {
-namespace base {
-
-// A std::chrono clock based on CLOCK_BOOTTIME.
-class boot_clock {
- public:
- typedef std::chrono::nanoseconds duration;
- typedef std::chrono::time_point<boot_clock, duration> time_point;
-
- static time_point now();
-};
-
-class Timer {
- public:
- Timer() : start_(boot_clock::now()) {}
-
- std::chrono::milliseconds duration() const {
- return std::chrono::duration_cast<std::chrono::milliseconds>(boot_clock::now() - start_);
- }
-
- private:
- boot_clock::time_point start_;
-};
-
-std::ostream& operator<<(std::ostream& os, const Timer& t);
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/cmsg.h
^
|
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <type_traits>
-#include <vector>
-
-#include <android-base/collections.h>
-#include <android-base/macros.h>
-#include <android-base/unique_fd.h>
-
-namespace android {
-namespace base {
-
-#if !defined(_WIN32)
-
-// Helpers for sending and receiving file descriptors across Unix domain sockets.
-//
-// The cmsg(3) API is very hard to get right, with multiple landmines that can
-// lead to death. Almost all of the uses of cmsg in Android make at least one of
-// the following mistakes:
-//
-// - not aligning the cmsg buffer
-// - leaking fds if more fds are received than expected
-// - blindly dereferencing CMSG_DATA without checking the header
-// - using CMSG_SPACE instead of CMSG_LEN for .cmsg_len
-// - using CMSG_LEN instead of CMSG_SPACE for .msg_controllen
-// - using a length specified in number of fds instead of bytes
-//
-// These functions wrap the hard-to-use cmsg API with an easier to use abstraction.
-
-// Send file descriptors across a Unix domain socket.
-//
-// Note that the write can return short if the socket type is SOCK_STREAM. When
-// this happens, file descriptors are still sent to the other end, but with
-// truncated data. For this reason, using SOCK_SEQPACKET or SOCK_DGRAM is recommended.
-ssize_t SendFileDescriptorVector(int sock, const void* data, size_t len,
- const std::vector<int>& fds);
-
-// Receive file descriptors from a Unix domain socket.
-//
-// If more FDs (or bytes, for datagram sockets) are received than expected,
-// -1 is returned with errno set to EMSGSIZE, and all received FDs are thrown away.
-ssize_t ReceiveFileDescriptorVector(int sock, void* data, size_t len, size_t max_fds,
- std::vector<android::base::unique_fd>* fds);
-
-// Helper for SendFileDescriptorVector that constructs a std::vector for you, e.g.:
-// SendFileDescriptors(sock, "foo", 3, std::move(fd1), std::move(fd2))
-template <typename... Args>
-ssize_t SendFileDescriptors(int sock, const void* data, size_t len, Args&&... sent_fds) {
- // Do not allow implicit conversion to int: people might try to do something along the lines of:
- // SendFileDescriptors(..., std::move(a_unique_fd))
- // and be surprised when the unique_fd isn't closed afterwards.
- AssertType<int>(std::forward<Args>(sent_fds)...);
- std::vector<int> fds;
- Append(fds, std::forward<Args>(sent_fds)...);
- return SendFileDescriptorVector(sock, data, len, fds);
-}
-
-// Helper for ReceiveFileDescriptorVector that receives an exact number of file descriptors.
-// If more file descriptors are received than requested, -1 is returned with errno set to EMSGSIZE.
-// If fewer file descriptors are received than requested, -1 is returned with errno set to ENOMSG.
-// In both cases, all arguments are cleared and any received FDs are thrown away.
-template <typename... Args>
-ssize_t ReceiveFileDescriptors(int sock, void* data, size_t len, Args&&... received_fds) {
- std::vector<unique_fd*> fds;
- Append(fds, std::forward<Args>(received_fds)...);
-
- std::vector<unique_fd> result;
- ssize_t rc = ReceiveFileDescriptorVector(sock, data, len, fds.size(), &result);
- if (rc == -1 || result.size() != fds.size()) {
- int err = rc == -1 ? errno : ENOMSG;
- for (unique_fd* fd : fds) {
- fd->reset();
- }
- errno = err;
- return -1;
- }
-
- for (size_t i = 0; i < fds.size(); ++i) {
- *fds[i] = std::move(result[i]);
- }
- return rc;
-}
-
-#endif
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/collections.h
^
|
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <utility>
-
-namespace android {
-namespace base {
-
-// Helpers for converting a variadic template parameter pack to a homogeneous collection.
-// Parameters must be implictly convertible to the contained type (including via move/copy ctors).
-//
-// Use as follows:
-//
-// template <typename... Args>
-// std::vector<int> CreateVector(Args&&... args) {
-// std::vector<int> result;
-// Append(result, std::forward<Args>(args)...);
-// return result;
-// }
-template <typename CollectionType, typename T>
-void Append(CollectionType& collection, T&& arg) {
- collection.push_back(std::forward<T>(arg));
-}
-
-template <typename CollectionType, typename T, typename... Args>
-void Append(CollectionType& collection, T&& arg, Args&&... args) {
- collection.push_back(std::forward<T>(arg));
- return Append(collection, std::forward<Args>(args)...);
-}
-
-// Assert that all of the arguments in a variadic template parameter pack are of a given type
-// after std::decay.
-template <typename T, typename Arg, typename... Args>
-void AssertType(Arg&&) {
- static_assert(std::is_same<T, typename std::decay<Arg>::type>::value);
-}
-
-template <typename T, typename Arg, typename... Args>
-void AssertType(Arg&&, Args&&... args) {
- static_assert(std::is_same<T, typename std::decay<Arg>::type>::value);
- AssertType<T>(std::forward<Args>(args)...);
-}
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/endian.h
^
|
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#pragma once
-
-/* A cross-platform equivalent of bionic's <sys/endian.h>. */
-
-#if defined(__BIONIC__)
-
-#include <sys/endian.h>
-
-#elif defined(__GLIBC__)
-
-/* glibc's <endian.h> is like bionic's <sys/endian.h>. */
-#include <endian.h>
-
-/* glibc keeps htons and htonl in <netinet/in.h>. */
-#include <netinet/in.h>
-
-/* glibc doesn't have the 64-bit variants. */
-#define htonq(x) htobe64(x)
-#define ntohq(x) be64toh(x)
-
-/* glibc has different names to BSD for these. */
-#define betoh16(x) be16toh(x)
-#define betoh32(x) be32toh(x)
-#define betoh64(x) be64toh(x)
-
-#else
-
-/* Mac OS and Windows have nothing. */
-
-#define __LITTLE_ENDIAN 1234
-#define LITTLE_ENDIAN __LITTLE_ENDIAN
-
-#define __BIG_ENDIAN 4321
-#define BIG_ENDIAN __BIG_ENDIAN
-
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#define BYTE_ORDER __BYTE_ORDER
-
-#define htons(x) __builtin_bswap16(x)
-#define htonl(x) __builtin_bswap32(x)
-#define htonq(x) __builtin_bswap64(x)
-
-#define ntohs(x) __builtin_bswap16(x)
-#define ntohl(x) __builtin_bswap32(x)
-#define ntohq(x) __builtin_bswap64(x)
-
-#define htobe16(x) __builtin_bswap16(x)
-#define htobe32(x) __builtin_bswap32(x)
-#define htobe64(x) __builtin_bswap64(x)
-
-#define betoh16(x) __builtin_bswap16(x)
-#define betoh32(x) __builtin_bswap32(x)
-#define betoh64(x) __builtin_bswap64(x)
-
-#define htole16(x) (x)
-#define htole32(x) (x)
-#define htole64(x) (x)
-
-#define letoh16(x) (x)
-#define letoh32(x) (x)
-#define letoh64(x) (x)
-
-#define be16toh(x) __builtin_bswap16(x)
-#define be32toh(x) __builtin_bswap32(x)
-#define be64toh(x) __builtin_bswap64(x)
-
-#define le16toh(x) (x)
-#define le32toh(x) (x)
-#define le64toh(x) (x)
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/errors.h
^
|
@@ -1,43 +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.
- */
-
-// Portable error handling functions. This is only necessary for host-side
-// code that needs to be cross-platform; code that is only run on Unix should
-// just use errno and strerror() for simplicity.
-//
-// There is some complexity since Windows has (at least) three different error
-// numbers, not all of which share the same type:
-// * errno: for C runtime errors.
-// * GetLastError(): Windows non-socket errors.
-// * WSAGetLastError(): Windows socket errors.
-// errno can be passed to strerror() on all platforms, but the other two require
-// special handling to get the error string. Refer to Microsoft documentation
-// to determine which error code to check for each function.
-
-#pragma once
-
-#include <string>
-
-namespace android {
-namespace base {
-
-// Returns a string describing the given system error code. |error_code| must
-// be errno on Unix or GetLastError()/WSAGetLastError() on Windows. Passing
-// errno on Windows has undefined behavior.
-std::string SystemErrorCodeToString(int error_code);
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/file.h
^
|
@@ -1,124 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <string>
-
-#include <android-base/macros.h>
-#include "android-base/off64_t.h"
-
-#if !defined(_WIN32) && !defined(O_BINARY)
-/** Windows needs O_BINARY, but Unix never mangles line endings. */
-#define O_BINARY 0
-#endif
-
-#if defined(_WIN32) && !defined(O_CLOEXEC)
-/** Windows has O_CLOEXEC but calls it O_NOINHERIT for some reason. */
-#define O_CLOEXEC O_NOINHERIT
-#endif
-
-class TemporaryFile {
- public:
- TemporaryFile();
- explicit TemporaryFile(const std::string& tmp_dir);
- ~TemporaryFile();
-
- // Release the ownership of fd, caller is reponsible for closing the
- // fd or stream properly.
- int release();
- // Don't remove the temporary file in the destructor.
- void DoNotRemove() { remove_file_ = false; }
-
- int fd;
- char path[1024];
-
- private:
- void init(const std::string& tmp_dir);
-
- bool remove_file_ = true;
-
- DISALLOW_COPY_AND_ASSIGN(TemporaryFile);
-};
-
-class TemporaryDir {
- public:
- TemporaryDir();
- ~TemporaryDir();
- // Don't remove the temporary dir in the destructor.
- void DoNotRemove() { remove_dir_and_contents_ = false; }
-
- char path[1024];
-
- private:
- bool init(const std::string& tmp_dir);
-
- bool remove_dir_and_contents_ = true;
-
- DISALLOW_COPY_AND_ASSIGN(TemporaryDir);
-};
-
-namespace android {
-namespace base {
-
-bool ReadFdToString(int fd, std::string* content);
-bool ReadFileToString(const std::string& path, std::string* content,
- bool follow_symlinks = false);
-
-bool WriteStringToFile(const std::string& content, const std::string& path,
- bool follow_symlinks = false);
-bool WriteStringToFd(const std::string& content, int fd);
-
-#if !defined(_WIN32)
-bool WriteStringToFile(const std::string& content, const std::string& path,
- mode_t mode, uid_t owner, gid_t group,
- bool follow_symlinks = false);
-#endif
-
-bool ReadFully(int fd, void* data, size_t byte_count);
-
-// Reads `byte_count` bytes from the file descriptor at the specified offset.
-// Returns false if there was an IO error or EOF was reached before reading `byte_count` bytes.
-//
-// NOTE: On Linux/Mac, this function wraps pread, which provides atomic read support without
-// modifying the read pointer of the file descriptor. On Windows, however, the read pointer does
-// get modified. This means that ReadFullyAtOffset can be used concurrently with other calls to the
-// same function, but concurrently seeking or reading incrementally can lead to unexpected
-// behavior.
-bool ReadFullyAtOffset(int fd, void* data, size_t byte_count, off64_t offset);
-
-bool WriteFully(int fd, const void* data, size_t byte_count);
-
-bool RemoveFileIfExists(const std::string& path, std::string* err = nullptr);
-
-#if !defined(_WIN32)
-bool Realpath(const std::string& path, std::string* result);
-bool Readlink(const std::string& path, std::string* result);
-#endif
-
-std::string GetExecutablePath();
-std::string GetExecutableDirectory();
-
-// Like the regular basename and dirname, but thread-safe on all
-// platforms and capable of correctly handling exotic Windows paths.
-std::string Basename(const std::string& path);
-std::string Dirname(const std::string& path);
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/logging.h
^
|
@@ -1,495 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-//
-// Google-style C++ logging.
-//
-
-// This header provides a C++ stream interface to logging.
-//
-// To log:
-//
-// LOG(INFO) << "Some text; " << some_value;
-//
-// Replace `INFO` with any severity from `enum LogSeverity`.
-//
-// To log the result of a failed function and include the string
-// representation of `errno` at the end:
-//
-// PLOG(ERROR) << "Write failed";
-//
-// The output will be something like `Write failed: I/O error`.
-// Remember this as 'P' as in perror(3).
-//
-// To output your own types, simply implement operator<< as normal.
-//
-// By default, output goes to logcat on Android and stderr on the host.
-// A process can use `SetLogger` to decide where all logging goes.
-// Implementations are provided for logcat, stderr, and dmesg.
-//
-// By default, the process' name is used as the log tag.
-// Code can choose a specific log tag by defining LOG_TAG
-// before including this header.
-
-// This header also provides assertions:
-//
-// CHECK(must_be_true);
-// CHECK_EQ(a, b) << z_is_interesting_too;
-
-// NOTE: For Windows, you must include logging.h after windows.h to allow the
-// following code to suppress the evil ERROR macro:
-#ifdef _WIN32
-// windows.h includes wingdi.h which defines an evil macro ERROR.
-#ifdef ERROR
-#undef ERROR
-#endif
-#endif
-
-#include <functional>
-#include <memory>
-#include <ostream>
-
-#include "android-base/macros.h"
-
-// Note: DO NOT USE DIRECTLY. Use LOG_TAG instead.
-#ifdef _LOG_TAG_INTERNAL
-#error "_LOG_TAG_INTERNAL must not be defined"
-#endif
-#ifdef LOG_TAG
-#define _LOG_TAG_INTERNAL LOG_TAG
-#else
-#define _LOG_TAG_INTERNAL nullptr
-#endif
-
-namespace android {
-namespace base {
-
-enum LogSeverity {
- VERBOSE,
- DEBUG,
- INFO,
- WARNING,
- ERROR,
- FATAL_WITHOUT_ABORT,
- FATAL,
-};
-
-enum LogId {
- DEFAULT,
- MAIN,
- SYSTEM,
-};
-
-using LogFunction = std::function<void(LogId, LogSeverity, const char*, const char*,
- unsigned int, const char*)>;
-using AbortFunction = std::function<void(const char*)>;
-
-// Loggers for use with InitLogging/SetLogger.
-
-// Log to the kernel log (dmesg).
-void KernelLogger(LogId, LogSeverity, const char*, const char*, unsigned int, const char*);
-// Log to stderr in the full logcat format (with pid/tid/time/tag details).
-void StderrLogger(LogId, LogSeverity, const char*, const char*, unsigned int, const char*);
-// Log just the message to stdout/stderr (without pid/tid/time/tag details).
-// The choice of stdout versus stderr is based on the severity.
-// Errors are also prefixed by the program name (as with err(3)/error(3)).
-// Useful for replacing printf(3)/perror(3)/err(3)/error(3) in command-line tools.
-void StdioLogger(LogId, LogSeverity, const char*, const char*, unsigned int, const char*);
-
-void DefaultAborter(const char* abort_message);
-
-std::string GetDefaultTag();
-void SetDefaultTag(const std::string& tag);
-
-#ifdef __ANDROID__
-// We expose this even though it is the default because a user that wants to
-// override the default log buffer will have to construct this themselves.
-class LogdLogger {
- public:
- explicit LogdLogger(LogId default_log_id = android::base::MAIN);
-
- void operator()(LogId, LogSeverity, const char* tag, const char* file,
- unsigned int line, const char* message);
-
- private:
- LogId default_log_id_;
-};
-#endif
-
-// Configure logging based on ANDROID_LOG_TAGS environment variable.
-// We need to parse a string that looks like
-//
-// *:v jdwp:d dalvikvm:d dalvikvm-gc:i dalvikvmi:i
-//
-// The tag (or '*' for the global level) comes first, followed by a colon and a
-// letter indicating the minimum priority level we're expected to log. This can
-// be used to reveal or conceal logs with specific tags.
-#ifdef __ANDROID__
-#define INIT_LOGGING_DEFAULT_LOGGER LogdLogger()
-#else
-#define INIT_LOGGING_DEFAULT_LOGGER StderrLogger
-#endif
-void InitLogging(char* argv[],
- LogFunction&& logger = INIT_LOGGING_DEFAULT_LOGGER,
- AbortFunction&& aborter = DefaultAborter);
-#undef INIT_LOGGING_DEFAULT_LOGGER
-
-// Replace the current logger.
-void SetLogger(LogFunction&& logger);
-
-// Replace the current aborter.
-void SetAborter(AbortFunction&& aborter);
-
-class ErrnoRestorer {
- public:
- ErrnoRestorer()
- : saved_errno_(errno) {
- }
-
- ~ErrnoRestorer() {
- errno = saved_errno_;
- }
-
- // Allow this object to be used as part of && operation.
- operator bool() const {
- return true;
- }
-
- private:
- const int saved_errno_;
-
- DISALLOW_COPY_AND_ASSIGN(ErrnoRestorer);
-};
-
-// A helper macro that produces an expression that accepts both a qualified name and an
-// unqualified name for a LogSeverity, and returns a LogSeverity value.
-// Note: DO NOT USE DIRECTLY. This is an implementation detail.
-#define SEVERITY_LAMBDA(severity) ([&]() { \
- using ::android::base::VERBOSE; \
- using ::android::base::DEBUG; \
- using ::android::base::INFO; \
- using ::android::base::WARNING; \
- using ::android::base::ERROR; \
- using ::android::base::FATAL_WITHOUT_ABORT; \
- using ::android::base::FATAL; \
- return (severity); }())
-
-#ifdef __clang_analyzer__
-// Clang's static analyzer does not see the conditional statement inside
-// LogMessage's destructor that will abort on FATAL severity.
-#define ABORT_AFTER_LOG_FATAL for (;; abort())
-
-struct LogAbortAfterFullExpr {
- ~LogAbortAfterFullExpr() __attribute__((noreturn)) { abort(); }
- explicit operator bool() const { return false; }
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/macros.h
^
|
@@ -1,150 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <stddef.h> // for size_t
-#include <unistd.h> // for TEMP_FAILURE_RETRY
-
-#include <utility>
-
-// bionic and glibc both have TEMP_FAILURE_RETRY, but eg Mac OS' libc doesn't.
-#ifndef TEMP_FAILURE_RETRY
-#define TEMP_FAILURE_RETRY(exp) \
- ({ \
- decltype(exp) _rc; \
- do { \
- _rc = (exp); \
- } while (_rc == -1 && errno == EINTR); \
- _rc; \
- })
-#endif
-
-// A macro to disallow the copy constructor and operator= functions
-// This must be placed in the private: declarations for a class.
-//
-// For disallowing only assign or copy, delete the relevant operator or
-// constructor, for example:
-// void operator=(const TypeName&) = delete;
-// Note, that most uses of DISALLOW_ASSIGN and DISALLOW_COPY are broken
-// semantically, one should either use disallow both or neither. Try to
-// avoid these in new code.
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&) = delete; \
- void operator=(const TypeName&) = delete
-
-// A macro to disallow all the implicit constructors, namely the
-// default constructor, copy constructor and operator= functions.
-//
-// This should be used in the private: declarations for a class
-// that wants to prevent anyone from instantiating it. This is
-// especially useful for classes containing only static methods.
-#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
- TypeName() = delete; \
- DISALLOW_COPY_AND_ASSIGN(TypeName)
-
-// The arraysize(arr) macro returns the # of elements in an array arr.
-// The expression is a compile-time constant, and therefore can be
-// used in defining new arrays, for example. If you use arraysize on
-// a pointer by mistake, you will get a compile-time error.
-//
-// One caveat is that arraysize() doesn't accept any array of an
-// anonymous type or a type defined inside a function. In these rare
-// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This is
-// due to a limitation in C++'s template system. The limitation might
-// eventually be removed, but it hasn't happened yet.
-
-// This template function declaration is used in defining arraysize.
-// Note that the function doesn't need an implementation, as we only
-// use its type.
-template <typename T, size_t N>
-char(&ArraySizeHelper(T(&array)[N]))[N]; // NOLINT(readability/casting)
-
-#define arraysize(array) (sizeof(ArraySizeHelper(array)))
-
-#define SIZEOF_MEMBER(t, f) sizeof(std::declval<t>().f)
-
-// Changing this definition will cause you a lot of pain. A majority of
-// vendor code defines LIKELY and UNLIKELY this way, and includes
-// this header through an indirect path.
-#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true ))
-#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false ))
-
-#define WARN_UNUSED __attribute__((warn_unused_result))
-
-// A deprecated function to call to create a false use of the parameter, for
-// example:
-// int foo(int x) { UNUSED(x); return 10; }
-// to avoid compiler warnings. Going forward we prefer ATTRIBUTE_UNUSED.
-template <typename... T>
-void UNUSED(const T&...) {
-}
-
-// An attribute to place on a parameter to a function, for example:
-// int foo(int x ATTRIBUTE_UNUSED) { return 10; }
-// to avoid compiler warnings.
-#define ATTRIBUTE_UNUSED __attribute__((__unused__))
-
-// The FALLTHROUGH_INTENDED macro can be used to annotate implicit fall-through
-// between switch labels:
-// switch (x) {
-// case 40:
-// case 41:
-// if (truth_is_out_there) {
-// ++x;
-// FALLTHROUGH_INTENDED; // Use instead of/along with annotations in
-// // comments.
-// } else {
-// return x;
-// }
-// case 42:
-// ...
-//
-// As shown in the example above, the FALLTHROUGH_INTENDED macro should be
-// followed by a semicolon. It is designed to mimic control-flow statements
-// like 'break;', so it can be placed in most places where 'break;' can, but
-// only if there are no statements on the execution path between it and the
-// next switch label.
-//
-// When compiled with clang, the FALLTHROUGH_INTENDED macro is expanded to
-// [[clang::fallthrough]] attribute, which is analysed when performing switch
-// labels fall-through diagnostic ('-Wimplicit-fallthrough'). See clang
-// documentation on language extensions for details:
-// http://clang.llvm.org/docs/LanguageExtensions.html#clang__fallthrough
-//
-// When used with unsupported compilers, the FALLTHROUGH_INTENDED macro has no
-// effect on diagnostics.
-//
-// In either case this macro has no effect on runtime behavior and performance
-// of code.
-#ifndef FALLTHROUGH_INTENDED
-#define FALLTHROUGH_INTENDED [[clang::fallthrough]] // NOLINT
-#endif
-
-// Current ABI string
-#if defined(__arm__)
-#define ABI_STRING "arm"
-#elif defined(__aarch64__)
-#define ABI_STRING "arm64"
-#elif defined(__i386__)
-#define ABI_STRING "x86"
-#elif defined(__x86_64__)
-#define ABI_STRING "x86_64"
-#elif defined(__mips__) && !defined(__LP64__)
-#define ABI_STRING "mips"
-#elif defined(__mips__) && defined(__LP64__)
-#define ABI_STRING "mips64"
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/mapped_file.h
^
|
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include "android-base/macros.h"
-#include "android-base/off64_t.h"
-
-#include <sys/types.h>
-
-#include <memory>
-
-#if defined(_WIN32)
-#include <windows.h>
-#define PROT_READ 1
-#define PROT_WRITE 2
-#else
-#include <sys/mman.h>
-#endif
-
-namespace android {
-namespace base {
-
-/**
- * A region of a file mapped into memory.
- */
-class MappedFile {
- public:
- /**
- * Creates a new mapping of the file pointed to by `fd`. Unlike the underlying OS primitives,
- * `offset` does not need to be page-aligned. If `PROT_WRITE` is set in `prot`, the mapping
- * will be writable, otherwise it will be read-only. Mappings are always `MAP_SHARED`.
- */
- static std::unique_ptr<MappedFile> FromFd(int fd, off64_t offset, size_t length, int prot);
-
- /**
- * Removes the mapping.
- */
- ~MappedFile();
-
- char* data() { return base_ + offset_; }
- size_t size() { return size_; }
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(MappedFile);
-
- char* base_;
- size_t size_;
-
- size_t offset_;
-
-#if defined(_WIN32)
- MappedFile(char* base, size_t size, size_t offset, HANDLE handle)
- : base_(base), size_(size), offset_(offset), handle_(handle) {}
- HANDLE handle_;
-#else
- MappedFile(char* base, size_t size, size_t offset) : base_(base), size_(size), offset_(offset) {}
-#endif
-};
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/memory.h
^
|
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-namespace android {
-namespace base {
-
-// Use memcpy for access to unaligned data on targets with alignment
-// restrictions. The compiler will generate appropriate code to access these
-// structures without generating alignment exceptions.
-template <typename T>
-static inline T get_unaligned(const void* address) {
- T result;
- memcpy(&result, address, sizeof(T));
- return result;
-}
-
-template <typename T>
-static inline void put_unaligned(void* address, T v) {
- memcpy(address, &v, sizeof(T));
-}
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/off64_t.h
^
|
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#if defined(__APPLE__)
-/** Mac OS has always had a 64-bit off_t, so it doesn't have off64_t. */
-typedef off_t off64_t;
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/parsedouble.h
^
|
@@ -1,77 +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.
- */
-
-#pragma once
-
-#include <errno.h>
-#include <stdlib.h>
-
-#include <limits>
-#include <string>
-
-namespace android {
-namespace base {
-
-// Parse floating value in the string 's' and sets 'out' to that value if it exists.
-// Optionally allows the caller to define a 'min' and 'max' beyond which
-// otherwise valid values will be rejected. Returns boolean success.
-template <typename T, T (*strtox)(const char* str, char** endptr)>
-static inline bool ParseFloatingPoint(const char* s, T* out, T min, T max) {
- errno = 0;
- char* end;
- T result = strtox(s, &end);
- if (errno != 0 || s == end || *end != '\0') {
- return false;
- }
- if (result < min || max < result) {
- return false;
- }
- if (out != nullptr) {
- *out = result;
- }
- return true;
-}
-
-// Parse double value in the string 's' and sets 'out' to that value if it exists.
-// Optionally allows the caller to define a 'min' and 'max' beyond which
-// otherwise valid values will be rejected. Returns boolean success.
-static inline bool ParseDouble(const char* s, double* out,
- double min = std::numeric_limits<double>::lowest(),
- double max = std::numeric_limits<double>::max()) {
- return ParseFloatingPoint<double, strtod>(s, out, min, max);
-}
-static inline bool ParseDouble(const std::string& s, double* out,
- double min = std::numeric_limits<double>::lowest(),
- double max = std::numeric_limits<double>::max()) {
- return ParseFloatingPoint<double, strtod>(s.c_str(), out, min, max);
-}
-
-// Parse float value in the string 's' and sets 'out' to that value if it exists.
-// Optionally allows the caller to define a 'min' and 'max' beyond which
-// otherwise valid values will be rejected. Returns boolean success.
-static inline bool ParseFloat(const char* s, float* out,
- float min = std::numeric_limits<float>::lowest(),
- float max = std::numeric_limits<float>::max()) {
- return ParseFloatingPoint<float, strtof>(s, out, min, max);
-}
-static inline bool ParseFloat(const std::string& s, float* out,
- float min = std::numeric_limits<float>::lowest(),
- float max = std::numeric_limits<float>::max()) {
- return ParseFloatingPoint<float, strtof>(s.c_str(), out, min, max);
-}
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/parseint.h
^
|
@@ -1,136 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <limits>
-#include <string>
-#include <type_traits>
-
-namespace android {
-namespace base {
-
-// Parses the unsigned decimal or hexadecimal integer in the string 's' and sets
-// 'out' to that value if it is specified. Optionally allows the caller to define
-// a 'max' beyond which otherwise valid values will be rejected. Returns boolean
-// success; 'out' is untouched if parsing fails.
-template <typename T>
-bool ParseUint(const char* s, T* out, T max = std::numeric_limits<T>::max(),
- bool allow_suffixes = false) {
- static_assert(std::is_unsigned<T>::value, "ParseUint can only be used with unsigned types");
- while (isspace(*s)) {
- s++;
- }
-
- if (s[0] == '-') {
- errno = EINVAL;
- return false;
- }
-
- int base = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) ? 16 : 10;
- errno = 0;
- char* end;
- unsigned long long int result = strtoull(s, &end, base);
- if (errno != 0) return false;
- if (end == s) {
- errno = EINVAL;
- return false;
- }
- if (*end != '\0') {
- const char* suffixes = "bkmgtpe";
- const char* suffix;
- if ((!allow_suffixes || (suffix = strchr(suffixes, tolower(*end))) == nullptr) ||
- __builtin_mul_overflow(result, 1ULL << (10 * (suffix - suffixes)), &result)) {
- errno = EINVAL;
- return false;
- }
- }
- if (max < result) {
- errno = ERANGE;
- return false;
- }
- if (out != nullptr) {
- *out = static_cast<T>(result);
- }
- return true;
-}
-
-// TODO: string_view
-template <typename T>
-bool ParseUint(const std::string& s, T* out, T max = std::numeric_limits<T>::max(),
- bool allow_suffixes = false) {
- return ParseUint(s.c_str(), out, max, allow_suffixes);
-}
-
-template <typename T>
-bool ParseByteCount(const char* s, T* out, T max = std::numeric_limits<T>::max()) {
- return ParseUint(s, out, max, true);
-}
-
-// TODO: string_view
-template <typename T>
-bool ParseByteCount(const std::string& s, T* out, T max = std::numeric_limits<T>::max()) {
- return ParseByteCount(s.c_str(), out, max);
-}
-
-// Parses the signed decimal or hexadecimal integer in the string 's' and sets
-// 'out' to that value if it is specified. Optionally allows the caller to define
-// a 'min' and 'max' beyond which otherwise valid values will be rejected. Returns
-// boolean success; 'out' is untouched if parsing fails.
-template <typename T>
-bool ParseInt(const char* s, T* out,
- T min = std::numeric_limits<T>::min(),
- T max = std::numeric_limits<T>::max()) {
- static_assert(std::is_signed<T>::value, "ParseInt can only be used with signed types");
- while (isspace(*s)) {
- s++;
- }
-
- int base = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) ? 16 : 10;
- errno = 0;
- char* end;
- long long int result = strtoll(s, &end, base);
- if (errno != 0) {
- return false;
- }
- if (s == end || *end != '\0') {
- errno = EINVAL;
- return false;
- }
- if (result < min || max < result) {
- errno = ERANGE;
- return false;
- }
- if (out != nullptr) {
- *out = static_cast<T>(result);
- }
- return true;
-}
-
-// TODO: string_view
-template <typename T>
-bool ParseInt(const std::string& s, T* out,
- T min = std::numeric_limits<T>::min(),
- T max = std::numeric_limits<T>::max()) {
- return ParseInt(s.c_str(), out, min, max);
-}
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/parsenetaddress.h
^
|
@@ -1,35 +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.
- */
-
-#pragma once
-
-#include <string>
-
-namespace android {
-namespace base {
-
-// Parses |address| into |host| and |port|.
-//
-// If |address| doesn't contain a port number, the default value is taken from
-// |port|. If |canonical_address| is non-null it will be set to "host:port" or
-// "[host]:port" as appropriate.
-//
-// On failure, returns false and fills |error|.
-bool ParseNetAddress(const std::string& address, std::string* host, int* port,
- std::string* canonical_address, std::string* error);
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/properties.h
^
|
@@ -1,74 +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.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-
-#include <chrono>
-#include <limits>
-#include <string>
-
-namespace android {
-namespace base {
-
-// Returns the current value of the system property `key`,
-// or `default_value` if the property is empty or doesn't exist.
-std::string GetProperty(const std::string& key, const std::string& default_value);
-
-// Returns true if the system property `key` has the value "1", "y", "yes", "on", or "true",
-// false for "0", "n", "no", "off", or "false", or `default_value` otherwise.
-bool GetBoolProperty(const std::string& key, bool default_value);
-
-// Returns the signed integer corresponding to the system property `key`.
-// If the property is empty, doesn't exist, doesn't have an integer value, or is outside
-// the optional bounds, returns `default_value`.
-template <typename T> T GetIntProperty(const std::string& key,
- T default_value,
- T min = std::numeric_limits<T>::min(),
- T max = std::numeric_limits<T>::max());
-
-// Returns the unsigned integer corresponding to the system property `key`.
-// If the property is empty, doesn't exist, doesn't have an integer value, or is outside
-// the optional bound, returns `default_value`.
-template <typename T> T GetUintProperty(const std::string& key,
- T default_value,
- T max = std::numeric_limits<T>::max());
-
-// Sets the system property `key` to `value`.
-// Note that system property setting is inherently asynchronous so a return value of `true`
-// isn't particularly meaningful, and immediately reading back the value won't necessarily
-// tell you whether or not your call succeeded. A `false` return value definitely means failure.
-bool SetProperty(const std::string& key, const std::string& value);
-
-// Waits for the system property `key` to have the value `expected_value`.
-// Times out after `relative_timeout`.
-// Returns true on success, false on timeout.
-#if defined(__BIONIC__)
-bool WaitForProperty(const std::string& key, const std::string& expected_value,
- std::chrono::milliseconds relative_timeout = std::chrono::milliseconds::max());
-#endif
-
-// Waits for the system property `key` to be created.
-// Times out after `relative_timeout`.
-// Returns true on success, false on timeout.
-#if defined(__BIONIC__)
-bool WaitForPropertyCreation(const std::string& key, std::chrono::milliseconds relative_timeout =
- std::chrono::milliseconds::max());
-#endif
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/quick_exit.h
^
|
@@ -1,34 +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.
- */
-
-#pragma once
-
-#include <stdlib.h>
-
-// Provide emulation for at_quick_exit/quick_exit on platforms that don't have it.
-namespace android {
-namespace base {
-
-// Bionic and glibc have quick_exit, Darwin and Windows don't.
-#if !defined(__linux__)
- void quick_exit(int exit_code) __attribute__((noreturn));
- int at_quick_exit(void (*func)());
-#else
- using ::at_quick_exit;
- using ::quick_exit;
-#endif
-}
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/scopeguard.h
^
|
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <utility> // for std::move, std::forward
-
-namespace android {
-namespace base {
-
-// ScopeGuard ensures that the specified functor is executed no matter how the
-// current scope exits.
-template <typename F>
-class ScopeGuard {
- public:
- ScopeGuard(F&& f) : f_(std::forward<F>(f)), active_(true) {}
-
- ScopeGuard(ScopeGuard&& that) noexcept : f_(std::move(that.f_)), active_(that.active_) {
- that.active_ = false;
- }
-
- template <typename Functor>
- ScopeGuard(ScopeGuard<Functor>&& that) : f_(std::move(that.f_)), active_(that.active_) {
- that.active_ = false;
- }
-
- ~ScopeGuard() {
- if (active_) f_();
- }
-
- ScopeGuard() = delete;
- ScopeGuard(const ScopeGuard&) = delete;
- void operator=(const ScopeGuard&) = delete;
- void operator=(ScopeGuard&& that) = delete;
-
- void Disable() { active_ = false; }
-
- bool active() const { return active_; }
-
- private:
- template <typename Functor>
- friend class ScopeGuard;
-
- F f_;
- bool active_;
-};
-
-template <typename F>
-ScopeGuard<F> make_scope_guard(F&& f) {
- return ScopeGuard<F>(std::forward<F>(f));
-}
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/stringprintf.h
^
|
@@ -1,40 +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.
- */
-
-#pragma once
-
-#include <stdarg.h>
-#include <string>
-
-namespace android {
-namespace base {
-
-// These printf-like functions are implemented in terms of vsnprintf, so they
-// use the same attribute for compile-time format string checking.
-
-// Returns a string corresponding to printf-like formatting of the arguments.
-std::string StringPrintf(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
-
-// Appends a printf-like formatting of the arguments to 'dst'.
-void StringAppendF(std::string* dst, const char* fmt, ...)
- __attribute__((__format__(__printf__, 2, 3)));
-
-// Appends a printf-like formatting of the arguments to 'dst'.
-void StringAppendV(std::string* dst, const char* format, va_list ap)
- __attribute__((__format__(__printf__, 2, 0)));
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/strings.h
^
|
@@ -1,72 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <sstream>
-#include <string>
-#include <vector>
-
-namespace android {
-namespace base {
-
-// Splits a string into a vector of strings.
-//
-// The string is split at each occurrence of a character in delimiters.
-//
-// The empty string is not a valid delimiter list.
-std::vector<std::string> Split(const std::string& s,
- const std::string& delimiters);
-
-// Trims whitespace off both ends of the given string.
-std::string Trim(const std::string& s);
-
-// Joins a container of things into a single string, using the given separator.
-template <typename ContainerT, typename SeparatorT>
-std::string Join(const ContainerT& things, SeparatorT separator) {
- if (things.empty()) {
- return "";
- }
-
- std::ostringstream result;
- result << *things.begin();
- for (auto it = std::next(things.begin()); it != things.end(); ++it) {
- result << separator << *it;
- }
- return result.str();
-}
-
-// We instantiate the common cases in strings.cpp.
-extern template std::string Join(const std::vector<std::string>&, char);
-extern template std::string Join(const std::vector<const char*>&, char);
-extern template std::string Join(const std::vector<std::string>&, const std::string&);
-extern template std::string Join(const std::vector<const char*>&, const std::string&);
-
-// Tests whether 's' starts with 'prefix'.
-bool StartsWith(std::string_view s, std::string_view prefix);
-bool StartsWith(std::string_view s, char prefix);
-bool StartsWithIgnoreCase(std::string_view s, std::string_view prefix);
-
-// Tests whether 's' ends with 'suffix'.
-bool EndsWith(std::string_view s, std::string_view suffix);
-bool EndsWith(std::string_view s, char suffix);
-bool EndsWithIgnoreCase(std::string_view s, std::string_view suffix);
-
-// Tests whether 'lhs' equals 'rhs', ignoring case.
-bool EqualsIgnoreCase(std::string_view lhs, std::string_view rhs);
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/test_utils.h
^
|
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <regex>
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/macros.h>
-
-class CapturedStdFd {
- public:
- CapturedStdFd(int std_fd);
- ~CapturedStdFd();
-
- std::string str();
-
- void Start();
- void Stop();
- void Reset();
-
- private:
- int fd() const;
-
- TemporaryFile temp_file_;
- int std_fd_;
- int old_fd_ = -1;
-
- DISALLOW_COPY_AND_ASSIGN(CapturedStdFd);
-};
-
-class CapturedStderr : public CapturedStdFd {
- public:
- CapturedStderr() : CapturedStdFd(STDERR_FILENO) {}
-};
-
-class CapturedStdout : public CapturedStdFd {
- public:
- CapturedStdout() : CapturedStdFd(STDOUT_FILENO) {}
-};
-
-#define ASSERT_MATCH(str, pattern) \
- do { \
- if (!std::regex_search((str), std::regex((pattern)))) { \
- FAIL() << "regex mismatch: expected " << (pattern) << " in:\n" << (str); \
- } \
- } while (0)
-
-#define ASSERT_NOT_MATCH(str, pattern) \
- do { \
- if (std::regex_search((str), std::regex((pattern)))) { \
- FAIL() << "regex mismatch: expected to not find " << (pattern) << " in:\n" << (str); \
- } \
- } while (0)
-
-#define EXPECT_MATCH(str, pattern) \
- do { \
- if (!std::regex_search((str), std::regex((pattern)))) { \
- ADD_FAILURE() << "regex mismatch: expected " << (pattern) << " in:\n" << (str); \
- } \
- } while (0)
-
-#define EXPECT_NOT_MATCH(str, pattern) \
- do { \
- if (std::regex_search((str), std::regex((pattern)))) { \
- ADD_FAILURE() << "regex mismatch: expected to not find " << (pattern) << " in:\n" << (str); \
- } \
- } while (0)
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/thread_annotations.h
^
|
@@ -1,144 +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.
- */
-
-#pragma once
-
-#include <mutex>
-
-#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
-
-#define CAPABILITY(x) \
- THREAD_ANNOTATION_ATTRIBUTE__(capability(x))
-
-#define SCOPED_CAPABILITY \
- THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable)
-
-#define SHARED_CAPABILITY(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(shared_capability(__VA_ARGS__))
-
-#define GUARDED_BY(x) \
- THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
-
-#define PT_GUARDED_BY(x) \
- THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x))
-
-#define EXCLUSIVE_LOCKS_REQUIRED(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__))
-
-#define SHARED_LOCKS_REQUIRED(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__))
-
-#define ACQUIRED_BEFORE(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__))
-
-#define ACQUIRED_AFTER(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__))
-
-#define REQUIRES(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(__VA_ARGS__))
-
-#define REQUIRES_SHARED(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(requires_shared_capability(__VA_ARGS__))
-
-#define ACQUIRE(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(__VA_ARGS__))
-
-#define ACQUIRE_SHARED(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(acquire_shared_capability(__VA_ARGS__))
-
-#define RELEASE(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(release_capability(__VA_ARGS__))
-
-#define RELEASE_SHARED(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(__VA_ARGS__))
-
-#define TRY_ACQUIRE(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_capability(__VA_ARGS__))
-
-#define TRY_ACQUIRE_SHARED(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_shared_capability(__VA_ARGS__))
-
-#define EXCLUDES(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__))
-
-#define ASSERT_CAPABILITY(x) \
- THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x))
-
-#define ASSERT_SHARED_CAPABILITY(x) \
- THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x))
-
-#define RETURN_CAPABILITY(x) \
- THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x))
-
-#define EXCLUSIVE_LOCK_FUNCTION(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__))
-
-#define EXCLUSIVE_TRYLOCK_FUNCTION(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__))
-
-#define SHARED_LOCK_FUNCTION(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__))
-
-#define SHARED_TRYLOCK_FUNCTION(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__))
-
-#define UNLOCK_FUNCTION(...) \
- THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__))
-
-#define SCOPED_LOCKABLE \
- THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable)
-
-#define LOCK_RETURNED(x) \
- THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x))
-
-#define NO_THREAD_SAFETY_ANALYSIS \
- THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis)
-
-namespace android {
-namespace base {
-
-// A class to help thread safety analysis deal with std::unique_lock and condition_variable.
-//
-// Clang's thread safety analysis currently doesn't perform alias analysis, so movable types
-// like std::unique_lock can't be marked with thread safety annotations. This helper allows
-// for manual assertion of lock state in a scope.
-//
-// For example:
-//
-// std::mutex mutex;
-// std::condition_variable cv;
-// std::vector<int> vec GUARDED_BY(mutex);
-//
-// int pop() {
-// std::unique_lock lock(mutex);
-// ScopedLockAssertion lock_assertion(mutex);
-// cv.wait(lock, []() {
-// ScopedLockAssertion lock_assertion(mutex);
-// return !vec.empty();
-// });
-//
-// int result = vec.back();
-// vec.pop_back();
-// return result;
-// }
-class SCOPED_CAPABILITY ScopedLockAssertion {
- public:
- ScopedLockAssertion(std::mutex& mutex) ACQUIRE(mutex) {}
- ~ScopedLockAssertion() RELEASE() {}
-};
-
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/threads.h
^
|
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include <stdint.h>
-
-namespace android {
-namespace base {
-uint64_t GetThreadId();
-}
-} // namespace android
-
-#if defined(__GLIBC__)
-// bionic has this Linux-specifix call, but glibc doesn't.
-extern "C" int tgkill(int tgid, int tid, int sig);
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/unique_fd.h
^
|
@@ -1,264 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#if !defined(_WIN32)
-#include <sys/socket.h>
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-// DO NOT INCLUDE OTHER LIBBASE HEADERS!
-// This file gets used in libbinder, and libbinder is used everywhere.
-// Including other headers from libbase frequently results in inclusion of
-// android-base/macros.h, which causes macro collisions.
-
-// Container for a file descriptor that automatically closes the descriptor as
-// it goes out of scope.
-//
-// unique_fd ufd(open("/some/path", "r"));
-// if (ufd.get() == -1) return error;
-//
-// // Do something useful, possibly including 'return'.
-//
-// return 0; // Descriptor is closed for you.
-//
-// unique_fd is also known as ScopedFd/ScopedFD/scoped_fd; mentioned here to help
-// you find this class if you're searching for one of those names.
-
-#if defined(__BIONIC__)
-#include <android/fdsan.h>
-#endif
-
-namespace android {
-namespace base {
-
-struct DefaultCloser {
-#if defined(__BIONIC__)
- static void Tag(int fd, void* old_addr, void* new_addr) {
- if (android_fdsan_exchange_owner_tag) {
- uint64_t old_tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
- reinterpret_cast<uint64_t>(old_addr));
- uint64_t new_tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
- reinterpret_cast<uint64_t>(new_addr));
- android_fdsan_exchange_owner_tag(fd, old_tag, new_tag);
- }
- }
- static void Close(int fd, void* addr) {
- if (android_fdsan_close_with_tag) {
- uint64_t tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
- reinterpret_cast<uint64_t>(addr));
- android_fdsan_close_with_tag(fd, tag);
- } else {
- close(fd);
- }
- }
-#else
- static void Close(int fd) {
- // Even if close(2) fails with EINTR, the fd will have been closed.
- // Using TEMP_FAILURE_RETRY will either lead to EBADF or closing someone
- // else's fd.
- // http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html
- ::close(fd);
- }
-#endif
-};
-
-template <typename Closer>
-class unique_fd_impl final {
- public:
- unique_fd_impl() {}
-
- explicit unique_fd_impl(int fd) { reset(fd); }
- ~unique_fd_impl() { reset(); }
-
- unique_fd_impl(unique_fd_impl&& other) noexcept { reset(other.release()); }
- unique_fd_impl& operator=(unique_fd_impl&& s) noexcept {
- int fd = s.fd_;
- s.fd_ = -1;
- reset(fd, &s);
- return *this;
- }
-
- void reset(int new_value = -1) { reset(new_value, nullptr); }
-
- int get() const { return fd_; }
- operator int() const { return get(); } // NOLINT
-
- // Catch bogus error checks (i.e.: "!fd" instead of "fd != -1").
- bool operator!() const = delete;
-
- int release() __attribute__((warn_unused_result)) {
- tag(fd_, this, nullptr);
- int ret = fd_;
- fd_ = -1;
- return ret;
- }
-
- private:
- void reset(int new_value, void* previous_tag) {
- int previous_errno = errno;
-
- if (fd_ != -1) {
- close(fd_, this);
- }
-
- fd_ = new_value;
- if (new_value != -1) {
- tag(new_value, previous_tag, this);
- }
-
- errno = previous_errno;
- }
-
- int fd_ = -1;
-
- // Template magic to use Closer::Tag if available, and do nothing if not.
- // If Closer::Tag exists, this implementation is preferred, because int is a better match.
- // If not, this implementation is SFINAEd away, and the no-op below is the only one that exists.
- template <typename T = Closer>
- static auto tag(int fd, void* old_tag, void* new_tag)
- -> decltype(T::Tag(fd, old_tag, new_tag), void()) {
- T::Tag(fd, old_tag, new_tag);
- }
-
- template <typename T = Closer>
- static void tag(long, void*, void*) {
- // No-op.
- }
-
- // Same as above, to select between Closer::Close(int) and Closer::Close(int, void*).
- template <typename T = Closer>
- static auto close(int fd, void* tag_value) -> decltype(T::Close(fd, tag_value), void()) {
- T::Close(fd, tag_value);
- }
-
- template <typename T = Closer>
- static auto close(int fd, void*) -> decltype(T::Close(fd), void()) {
- T::Close(fd);
- }
-
- unique_fd_impl(const unique_fd_impl&);
- void operator=(const unique_fd_impl&);
-};
-
-using unique_fd = unique_fd_impl<DefaultCloser>;
-
-#if !defined(_WIN32)
-
-// Inline functions, so that they can be used header-only.
-template <typename Closer>
-inline bool Pipe(unique_fd_impl<Closer>* read, unique_fd_impl<Closer>* write,
- int flags = O_CLOEXEC) {
- int pipefd[2];
-
-#if defined(__linux__)
- if (pipe2(pipefd, flags) != 0) {
- return false;
- }
-#else // defined(__APPLE__)
- if (flags & ~(O_CLOEXEC | O_NONBLOCK)) {
- return false;
- }
- if (pipe(pipefd) != 0) {
- return false;
- }
-
- if (flags & O_CLOEXEC) {
- if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) != 0 || fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) != 0) {
- close(pipefd[0]);
- close(pipefd[1]);
- return false;
- }
- }
- if (flags & O_NONBLOCK) {
- if (fcntl(pipefd[0], F_SETFL, O_NONBLOCK) != 0 || fcntl(pipefd[1], F_SETFL, O_NONBLOCK) != 0) {
- close(pipefd[0]);
- close(pipefd[1]);
- return false;
- }
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android-base/utf8.h
^
|
@@ -1,104 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#ifdef _WIN32
-#include <sys/types.h>
-#include <string>
-#else
-// Bring in prototypes for standard APIs so that we can import them into the utf8 namespace.
-#include <fcntl.h> // open
-#include <stdio.h> // fopen
-#include <sys/stat.h> // mkdir
-#include <unistd.h> // unlink
-#endif
-
-namespace android {
-namespace base {
-
-// Only available on Windows because this is only needed on Windows.
-#ifdef _WIN32
-// Convert size number of UTF-16 wchar_t's to UTF-8. Returns whether the
-// conversion was done successfully.
-bool WideToUTF8(const wchar_t* utf16, const size_t size, std::string* utf8);
-
-// Convert a NULL-terminated string of UTF-16 characters to UTF-8. Returns
-// whether the conversion was done successfully.
-bool WideToUTF8(const wchar_t* utf16, std::string* utf8);
-
-// Convert a UTF-16 std::wstring (including any embedded NULL characters) to
-// UTF-8. Returns whether the conversion was done successfully.
-bool WideToUTF8(const std::wstring& utf16, std::string* utf8);
-
-// Convert size number of UTF-8 char's to UTF-16. Returns whether the conversion
-// was done successfully.
-bool UTF8ToWide(const char* utf8, const size_t size, std::wstring* utf16);
-
-// Convert a NULL-terminated string of UTF-8 characters to UTF-16. Returns
-// whether the conversion was done successfully.
-bool UTF8ToWide(const char* utf8, std::wstring* utf16);
-
-// Convert a UTF-8 std::string (including any embedded NULL characters) to
-// UTF-16. Returns whether the conversion was done successfully.
-bool UTF8ToWide(const std::string& utf8, std::wstring* utf16);
-
-// Convert a file system path, represented as a NULL-terminated string of
-// UTF-8 characters, to a UTF-16 string representing the same file system
-// path using the Windows extended-lengh path representation.
-//
-// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#MAXPATH:
-// ```The Windows API has many functions that also have Unicode versions to
-// permit an extended-length path for a maximum total path length of 32,767
-// characters. To specify an extended-length path, use the "\\?\" prefix.
-// For example, "\\?\D:\very long path".```
-//
-// Returns whether the conversion was done successfully.
-bool UTF8PathToWindowsLongPath(const char* utf8, std::wstring* utf16);
-#endif
-
-// The functions in the utf8 namespace take UTF-8 strings. For Windows, these
-// are wrappers, for non-Windows these just expose existing APIs. To call these
-// functions, use:
-//
-// // anonymous namespace to avoid conflict with existing open(), unlink(), etc.
-// namespace {
-// // Import functions into anonymous namespace.
-// using namespace android::base::utf8;
-//
-// void SomeFunction(const char* name) {
-// int fd = open(name, ...); // Calls android::base::utf8::open().
-// ...
-// unlink(name); // Calls android::base::utf8::unlink().
-// }
-// }
-namespace utf8 {
-
-#ifdef _WIN32
-FILE* fopen(const char* name, const char* mode);
-int mkdir(const char* name, mode_t mode);
-int open(const char* name, int flags, ...);
-int unlink(const char* name);
-#else
-using ::fopen;
-using ::mkdir;
-using ::open;
-using ::unlink;
-#endif
-
-} // namespace utf8
-} // namespace base
-} // namespace android
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android/api-level.h
^
|
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-/**
- * @file android/api-level.h
- * @brief Functions and constants for dealing with multiple API levels.
- */
-
-#include <sys/cdefs-android.h>
-#include <android/versioning.h>
-
-__BEGIN_DECLS
-
-#ifndef __ANDROID_API_FUTURE__
-/**
- * Magic version number for an Android OS build which has
- * not yet turned into an official release,
- * for comparisons against __ANDROID_API__.
- */
-#define __ANDROID_API_FUTURE__ 10000
-#endif
-
-#ifndef __ANDROID_API__
-/**
- * `__ANDROID_API__` is the API level being targeted. For the OS,
- * this is `__ANDROID_API_FUTURE__`. For the NDK, this is set by the
- * compiler/build system based on the API level you claimed to target.
- */
-#define __ANDROID_API__ __ANDROID_API_FUTURE__
-#endif
-
-/** Names the Gingerbread API level (9), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_G__ 9
-
-/** Names the Ice-Cream Sandwich API level (14), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_I__ 14
-
-/** Names the Jellybean API level (16), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_J__ 16
-
-/** Names the Jellybean MR1 API level (17), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_J_MR1__ 17
-
-/** Names the Jellybean MR2 API level (18), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_J_MR2__ 18
-
-/** Names the KitKat API level (19), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_K__ 19
-
-/** Names the Lollipop API level (21), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_L__ 21
-
-/** Names the Lollipop MR1 API level (22), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_L_MR1__ 22
-
-/** Names the Marshmallow API level (23), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_M__ 23
-
-/** Names the Nougat API level (24), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_N__ 24
-
-/** Names the Nougat MR1 API level (25), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_N_MR1__ 25
-
-/** Names the Oreo API level (26), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_O__ 26
-
-/** Names the Oreo MR1 API level (27), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_O_MR1__ 27
-
-/** Names the Pie API level (28), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_P__ 28
-
-/** Names the "Q" API level (29), for comparisons against __ANDROID_API__. */
-#define __ANDROID_API_Q__ 29
-
-/**
- * Returns the `targetSdkVersion` of the caller, or `__ANDROID_API_FUTURE__`
- * if there is no known target SDK version (for code not running in the
- * context of an app).
- *
- * The returned values correspond to the named constants in `<android/api-level.h>`,
- * and is equivalent to the AndroidManifest.xml `targetSdkVersion`.
- *
- * See also android_get_device_api_level().
- *
- * Available since API level 24.
- */
-int android_get_application_target_sdk_version() __INTRODUCED_IN(24);
-
-#if __ANDROID_API__ < __ANDROID_API_Q__
-
-// android_get_device_api_level is a static inline before API level 29.
-#define __BIONIC_GET_DEVICE_API_LEVEL_INLINE static __inline
-#include <bits/get_device_api_level_inlines.h>
-#undef __BIONIC_GET_DEVICE_API_LEVEL_INLINE
-
-#else
-
-/**
- * Returns the API level of the device we're actually running on, or -1 on failure.
- * The returned values correspond to the named constants in `<android/api-level.h>`,
- * and is equivalent to the Java `Build.VERSION.SDK_INT` API.
- *
- * See also android_get_application_target_sdk_version().
- */
-int android_get_device_api_level() __INTRODUCED_IN(29);
-
-#endif
-
-__END_DECLS
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android/dlext.h
^
|
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __ANDROID_DLEXT_H__
-#define __ANDROID_DLEXT_H__
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/cdefs.h>
-#include <sys/types.h> /* for off64_t */
-#include <android/versioning.h>
-
-/**
- * @addtogroup libdl Dynamic Linker
- * @{
- */
-
-/**
- * \file
- * Advanced dynamic library opening support. Most users will want to use
- * the standard [dlopen(3)](http://man7.org/linux/man-pages/man3/dlopen.3.html)
- * functionality in `<dlfcn.h>` instead.
- */
-
-__BEGIN_DECLS
-
-/** Bitfield definitions for `android_dlextinfo::flags`. */
-enum {
- /**
- * When set, the `reserved_addr` and `reserved_size` fields must point to an
- * already-reserved region of address space which will be used to load the
- * library if it fits.
- *
- * If the reserved region is not large enough, loading will fail.
- */
- ANDROID_DLEXT_RESERVED_ADDRESS = 0x1,
-
- /**
- * Like `ANDROID_DLEXT_RESERVED_ADDRESS`, but if the reserved region is not large enough,
- * the linker will choose an available address instead.
- */
- ANDROID_DLEXT_RESERVED_ADDRESS_HINT = 0x2,
-
- /**
- * When set, write the GNU RELRO section of the mapped library to `relro_fd`
- * after relocation has been performed, to allow it to be reused by another
- * process loading the same library at the same address. This implies
- * `ANDROID_DLEXT_USE_RELRO`.
- *
- * This is mainly useful for the system WebView implementation.
- */
- ANDROID_DLEXT_WRITE_RELRO = 0x4,
-
- /**
- * When set, compare the GNU RELRO section of the mapped library to `relro_fd`
- * after relocation has been performed, and replace any relocated pages that
- * are identical with a version mapped from the file.
- *
- * This is mainly useful for the system WebView implementation.
- */
- ANDROID_DLEXT_USE_RELRO = 0x8,
-
- /**
- * Use `library_fd` instead of opening the file by name.
- * The filename parameter is still used to identify the library.
- */
- ANDROID_DLEXT_USE_LIBRARY_FD = 0x10,
-
- /**
- * If opening a library using `library_fd` read it starting at `library_fd_offset`.
- * This is mainly useful for loading a library stored within another file (such as uncompressed
- * inside a ZIP archive).
- * This flag is only valid when `ANDROID_DLEXT_USE_LIBRARY_FD` is set.
- */
- ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET = 0x20,
-
- /**
- * When set, do not use `stat(2)` to check if the library has already been loaded.
- *
- * This flag allows forced loading of the library in the case when for some
- * reason multiple ELF files share the same filename (because the already-loaded
- * library has been removed and overwritten, for example).
- *
- * Note that if the library has the same `DT_SONAME` as an old one and some other
- * library has the soname in its `DT_NEEDED` list, the first one will be used to resolve any
- * dependencies.
- */
- ANDROID_DLEXT_FORCE_LOAD = 0x40,
-
- // Historically we had two other options for ART.
- // They were last available in Android P.
- // Reuse these bits last!
- // ANDROID_DLEXT_FORCE_FIXED_VADDR = 0x80
- // ANDROID_DLEXT_LOAD_AT_FIXED_ADDRESS = 0x100
-
- /**
- * This flag used to load library in a different namespace. The namespace is
- * specified in `library_namespace`.
- *
- * This flag is for internal use only (since there is no NDK API for namespaces).
- */
- ANDROID_DLEXT_USE_NAMESPACE = 0x200,
-
- /**
- * Instructs dlopen to apply `ANDROID_DLEXT_RESERVED_ADDRESS`,
- * `ANDROID_DLEXT_RESERVED_ADDRESS_HINT`, `ANDROID_DLEXT_WRITE_RELRO` and
- * `ANDROID_DLEXT_USE_RELRO` to any libraries loaded as dependencies of the
- * main library as well.
- *
- * This means that if the main library depends on one or more not-already-loaded libraries, they
- * will be loaded consecutively into the region starting at `reserved_addr`, and `reserved_size`
- * must be large enough to contain all of the libraries. The libraries will be loaded in the
- * deterministic order constructed from the DT_NEEDED entries, rather than the more secure random
- * order used by default.
- *
- * Each library's GNU RELRO sections will be written out to `relro_fd` in the same order they were
- * loaded. This will mean that the resulting file is dependent on which of the libraries were
- * already loaded, as only the newly loaded libraries will be included, not any already-loaded
- * dependencies. The caller should ensure that the set of libraries newly loaded is consistent
- * for this to be effective.
- *
- * This is mainly useful for the system WebView implementation.
- */
- ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE = 0x400,
-
-
- /** Mask of valid bits. */
- ANDROID_DLEXT_VALID_FLAG_BITS = ANDROID_DLEXT_RESERVED_ADDRESS |
- ANDROID_DLEXT_RESERVED_ADDRESS_HINT |
- ANDROID_DLEXT_WRITE_RELRO |
- ANDROID_DLEXT_USE_RELRO |
- ANDROID_DLEXT_USE_LIBRARY_FD |
- ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET |
- ANDROID_DLEXT_FORCE_LOAD |
- ANDROID_DLEXT_USE_NAMESPACE |
- ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE,
-};
-
-struct android_namespace_t;
-
-/** Used to pass Android-specific arguments to `android_dlopen_ext`. */
-typedef struct {
- /** A bitmask of `ANDROID_DLEXT_` enum values. */
- uint64_t flags;
-
- /** Used by `ANDROID_DLEXT_RESERVED_ADDRESS` and `ANDROID_DLEXT_RESERVED_ADDRESS_HINT`. */
- void* reserved_addr;
- /** Used by `ANDROID_DLEXT_RESERVED_ADDRESS` and `ANDROID_DLEXT_RESERVED_ADDRESS_HINT`. */
- size_t reserved_size;
-
- /** Used by `ANDROID_DLEXT_WRITE_RELRO` and `ANDROID_DLEXT_USE_RELRO`. */
- int relro_fd;
-
- /** Used by `ANDROID_DLEXT_USE_LIBRARY_FD`. */
- int library_fd;
- /** Used by `ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET` */
- off64_t library_fd_offset;
-
- /** Used by `ANDROID_DLEXT_USE_NAMESPACE`. */
- struct android_namespace_t* library_namespace;
-} android_dlextinfo;
-
-/**
- * Opens the given library. The `__filename` and `__flags` arguments are
- * the same as for [dlopen(3)](http://man7.org/linux/man-pages/man3/dlopen.3.html),
- * with the Android-specific flags supplied via the `flags` member of `__info`.
- *
- * Available since API level 21.
- */
-void* android_dlopen_ext(const char* __filename, int __flags, const android_dlextinfo* __info)
- __INTRODUCED_IN(21);
-
-__END_DECLS
-
-/** @} */
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android/fdsan.h
^
|
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-
-/*
- * Error checking for close(2).
- *
- * Mishandling of file descriptor ownership is a common source of errors that
- * can be extremely difficult to diagnose. Mistakes like the following can
- * result in seemingly 'impossible' failures showing up on other threads that
- * happened to try to open a file descriptor between the buggy code's close and
- * fclose:
- *
- * int print(int fd) {
- * int rc;
- * char buf[128];
- * while ((rc = read(fd, buf, sizeof(buf))) > 0) {
- * printf("%.*s", rc);
- * }
- * close(fd);
- * }
- *
- * int bug() {
- * FILE* f = fopen("foo", "r");
- * print(fileno(f));
- * fclose(f);
- * }
- *
- * To make it easier to find this class of bugs, bionic provides a method to
- * require that file descriptors are closed by their owners. File descriptors
- * can be associated with tags with which they must be closed. This allows
- * objects that conceptually own an fd (FILE*, unique_fd, etc.) to use their
- * own address at the tag, to enforce that closure of the fd must come as a
- * result of their own destruction (fclose, ~unique_fd, etc.)
- *
- * By default, a file descriptor's tag is 0, and close(fd) is equivalent to
- * closing fd with the tag 0.
- */
-
-/*
- * For improved diagnostics, the type of a file descriptors owner can be
- * encoded in the most significant byte of the owner tag. Values of 0 and 0xff
- * are ignored, which allows for raw pointers to be used as owner tags without
- * modification.
- */
-enum android_fdsan_owner_type {
- /*
- * Generic Java or native owners.
- *
- * Generic Java objects always use 255 as their type, using identityHashCode
- * as the value of the tag, leaving bits 33-56 unset. Native pointers are sign
- * extended from 48-bits of virtual address space, and so can have the MSB
- * set to 255 as well. Use the value of bits 49-56 to distinguish between
- * these cases.
- */
- ANDROID_FDSAN_OWNER_TYPE_GENERIC_00 = 0,
- ANDROID_FDSAN_OWNER_TYPE_GENERIC_FF = 255,
-
- /* FILE* */
- ANDROID_FDSAN_OWNER_TYPE_FILE = 1,
-
- /* DIR* */
- ANDROID_FDSAN_OWNER_TYPE_DIR = 2,
-
- /* android::base::unique_fd */
- ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD = 3,
-
- /* sqlite-owned file descriptors */
- ANDROID_FDSAN_OWNER_TYPE_SQLITE = 4,
-
- /* java.io.FileInputStream */
- ANDROID_FDSAN_OWNER_TYPE_FILEINPUTSTREAM = 5,
-
- /* java.io.FileOutputStream */
- ANDROID_FDSAN_OWNER_TYPE_FILEOUTPUTSTREAM = 6,
-
- /* java.io.RandomAccessFile */
- ANDROID_FDSAN_OWNER_TYPE_RANDOMACCESSFILE = 7,
-
- /* android.os.ParcelFileDescriptor */
- ANDROID_FDSAN_OWNER_TYPE_PARCELFILEDESCRIPTOR = 8,
-
- /* ART FdFile */
- ANDROID_FDSAN_OWNER_TYPE_ART_FDFILE = 9,
-
- /* java.net.DatagramSocketImpl */
- ANDROID_FDSAN_OWNER_TYPE_DATAGRAMSOCKETIMPL = 10,
-
- /* java.net.SocketImpl */
- ANDROID_FDSAN_OWNER_TYPE_SOCKETIMPL = 11,
-
- /* libziparchive's ZipArchive */
- ANDROID_FDSAN_OWNER_TYPE_ZIPARCHIVE = 12,
-};
-
-/*
- * Create an owner tag with the specified type and least significant 56 bits of tag.
- */
-uint64_t android_fdsan_create_owner_tag(enum android_fdsan_owner_type type, uint64_t tag) __INTRODUCED_IN(29) __attribute__((__weak__));
-
-/*
- * Exchange a file descriptor's tag.
- *
- * Logs and aborts if the fd's tag does not match expected_tag.
- */
-void android_fdsan_exchange_owner_tag(int fd, uint64_t expected_tag, uint64_t new_tag) __INTRODUCED_IN(29) __attribute__((__weak__));
-
-/*
- * Close a file descriptor with a tag, and resets the tag to 0.
- *
- * Logs and aborts if the tag is incorrect.
- */
-int android_fdsan_close_with_tag(int fd, uint64_t tag) __INTRODUCED_IN(29) __attribute__((__weak__));
-
-/*
- * Get a file descriptor's current owner tag.
- *
- * Returns 0 for untagged and invalid file descriptors.
- */
-uint64_t android_fdsan_get_owner_tag(int fd) __INTRODUCED_IN(29);
-
-/*
- * Get an owner tag's string representation.
- *
- * The return value points to memory with static lifetime, do not attempt to modify it.
- */
-const char* android_fdsan_get_tag_type(uint64_t tag) __INTRODUCED_IN(29);
-
-/*
- * Get an owner tag's value, with the type masked off.
- */
-uint64_t android_fdsan_get_tag_value(uint64_t tag) __INTRODUCED_IN(29);
-
-enum android_fdsan_error_level {
- // No errors.
- ANDROID_FDSAN_ERROR_LEVEL_DISABLED,
-
- // Warn once(ish) on error, and then downgrade to ANDROID_FDSAN_ERROR_LEVEL_DISABLED.
- ANDROID_FDSAN_ERROR_LEVEL_WARN_ONCE,
-
- // Warn always on error.
- ANDROID_FDSAN_ERROR_LEVEL_WARN_ALWAYS,
-
- // Abort on error.
- ANDROID_FDSAN_ERROR_LEVEL_FATAL,
-};
-
-/*
- * Get the error level.
- */
-enum android_fdsan_error_level android_fdsan_get_error_level() __INTRODUCED_IN(29) __attribute__((__weak__));
-
-/*
- * Set the error level and return the previous state.
- *
- * Error checking is automatically disabled in the child of a fork, to maintain
- * compatibility with code that forks, blindly closes FDs, and then execs.
- *
- * In cases such as the zygote, where the child has no intention of calling
- * exec, call this function to reenable fdsan checks.
- *
- * This function is not thread-safe and does not synchronize with checks of the
- * value, and so should probably only be called in single-threaded contexts
- * (e.g. postfork).
- */
-enum android_fdsan_error_level android_fdsan_set_error_level(enum android_fdsan_error_level new_level) __INTRODUCED_IN(29) __attribute__((__weak__));
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/android/versioning.h
^
|
@@ -1,28 +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.
- */
-
-#pragma once
-
-#define __INTRODUCED_IN(api_level) __attribute__((annotate("introduced_in=" #api_level)))
-#define __DEPRECATED_IN(api_level) __attribute__((annotate("deprecated_in=" #api_level)))
-#define __REMOVED_IN(api_level) __attribute__((annotate("obsoleted_in=" #api_level)))
-#define __INTRODUCED_IN_32(api_level) __attribute__((annotate("introduced_in_32=" #api_level)))
-#define __INTRODUCED_IN_64(api_level) __attribute__((annotate("introduced_in_64=" #api_level)))
-#define __INTRODUCED_IN_ARM(api_level) __attribute__((annotate("introduced_in_arm=" #api_level)))
-#define __INTRODUCED_IN_X86(api_level) __attribute__((annotate("introduced_in_x86=" #api_level)))
-#define __INTRODUCED_IN_MIPS(api_level) __attribute__((annotate("introduced_in_mips=" #api_level)))
-
-#define __VERSIONER_NO_GUARD __attribute__((annotate("versioner_no_guard")))
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/dlfcn.h
^
|
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __DLFCN_H__
-#define __DLFCN_H__
-
-#include <stdint.h>
-#include <sys/cdefs.h>
-#include <android/versioning.h>
-__BEGIN_DECLS
-
-#if defined(__cplusplus)
-#define __BIONIC_CAST(_k,_t,_v) (_k<_t>(_v))
-#else
-#define __BIONIC_CAST(_k,_t,_v) ((_t) (_v))
-#endif
-
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wnullability-completeness"
-#endif
-
-typedef struct {
- /* Pathname of shared object that contains address. */
- const char* dli_fname;
- /* Address at which shared object is loaded. */
- void* dli_fbase;
- /* Name of nearest symbol with address lower than addr. */
- const char* dli_sname;
- /* Exact address of symbol named in dli_sname. */
- void* dli_saddr;
-} Dl_info;
-
-void* dlopen(const char* __filename, int __flag);
-int dlclose(void* __handle);
-char* dlerror(void);
-void* dlsym(void* __handle, const char* __symbol);
-void* dlvsym(void* __handle, const char* __symbol, const char* __version) __INTRODUCED_IN(24);
-int dladdr(const void* __addr, Dl_info* __info);
-
-#define RTLD_LOCAL 0
-#define RTLD_LAZY 0x00001
-#define RTLD_NOW 0x00002
-#define RTLD_NOLOAD 0x00004
-#define RTLD_GLOBAL 0x00100
-#define RTLD_NODELETE 0x01000
-
-#if !defined(__LP64__)
-/* LP32 is broken for historical reasons. */
-#undef RTLD_NOW
-#define RTLD_NOW 0x00000
-#undef RTLD_GLOBAL
-#define RTLD_GLOBAL 0x00002
-#endif
-
-#if defined (__LP64__)
-#define RTLD_DEFAULT __BIONIC_CAST(reinterpret_cast, void*, 0)
-#define RTLD_NEXT __BIONIC_CAST(reinterpret_cast, void*, -1L)
-#else
-#define RTLD_DEFAULT __BIONIC_CAST(reinterpret_cast, void*, 0xffffffff)
-#define RTLD_NEXT __BIONIC_CAST(reinterpret_cast, void*, 0xfffffffe)
-#endif
-
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
-__END_DECLS
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/link.h
^
|
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _LINK_H_
-#define _LINK_H_
-
-#include <android/versioning.h> // for __INTRODUCED_IN
-
-#include <stdint.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include <elf.h>
-
-__BEGIN_DECLS
-
-typedef Elf32_Word Elf32_Relr;
-typedef Elf64_Xword Elf64_Relr;
-
-#if defined(__LP64__)
-#define ElfW(type) Elf64_ ## type
-#else
-#define ElfW(type) Elf32_ ## type
-#endif
-
-struct dl_phdr_info {
- ElfW(Addr) dlpi_addr;
- const char* dlpi_name;
- const ElfW(Phdr)* dlpi_phdr;
- ElfW(Half) dlpi_phnum;
-};
-
-#if defined(__arm__)
-int dl_iterate_phdr(int (*__callback)(struct dl_phdr_info*, size_t, void*), void* __data) __INTRODUCED_IN(21);
-#else
-int dl_iterate_phdr(int (*__callback)(struct dl_phdr_info*, size_t, void*), void* __data);
-#endif
-
-#ifdef __arm__
-typedef uintptr_t _Unwind_Ptr;
-_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr, int*);
-#endif
-
-/* Used by the dynamic linker to communicate with the debugger. */
-struct link_map {
- ElfW(Addr) l_addr;
- char* l_name;
- ElfW(Dyn)* l_ld;
- struct link_map* l_next;
- struct link_map* l_prev;
-};
-
-/* Used by the dynamic linker to communicate with the debugger. */
-struct r_debug {
- int32_t r_version;
- struct link_map* r_map;
- ElfW(Addr) r_brk;
- enum {
- RT_CONSISTENT,
- RT_ADD,
- RT_DELETE
- } r_state;
- ElfW(Addr) r_ldbase;
-};
-
-__END_DECLS
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/stdatomic.h
^
|
@@ -1,525 +0,0 @@
-/*-
- * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
- * David Chisnall <theraven@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _STDATOMIC_H_
-#define _STDATOMIC_H_
-
-#include <sys/cdefs.h>
-
-#define XSTR(x) STR(x)
-#define STR(x) #x
-#pragma message "__cplusplus=" XSTR(__cplusplus)
-#pragma message "_USING_LIBCXX=" XSTR(_USING_LIBCXX)
-
-#if defined(__cplusplus) && __cplusplus >= 201103L && defined(_USING_LIBCXX)
-# ifdef __clang__
-# if __has_feature(cxx_atomic)
-# define _STDATOMIC_HAVE_ATOMIC
-# endif
-# else
-# define _STDATOMIC_HAVE_ATOMIC
-# endif
-#endif
-
-#define _STDATOMIC_HAVE_ATOMIC
-#ifdef _STDATOMIC_HAVE_ATOMIC
-
-/* We have a usable C++ <atomic>; use it instead. */
-
-#include <atomic>
-
-#undef _Atomic
- /* Also defined by <atomic> for gcc. But not used in macros. */
- /* Also a clang intrinsic. */
- /* Should not be used by client code before this file is */
- /* included. The definitions in <atomic> themselves see */
- /* the old definition, as they should. */
- /* Client code sees the following definition. */
-
-#define _Atomic(t) std::atomic<t>
-
-using std::atomic_is_lock_free;
-using std::atomic_init;
-using std::atomic_store;
-using std::atomic_store_explicit;
-using std::atomic_load;
-using std::atomic_load_explicit;
-using std::atomic_exchange;
-using std::atomic_exchange_explicit;
-using std::atomic_compare_exchange_strong;
-using std::atomic_compare_exchange_strong_explicit;
-using std::atomic_compare_exchange_weak;
-using std::atomic_compare_exchange_weak_explicit;
-using std::atomic_fetch_add;
-using std::atomic_fetch_add_explicit;
-using std::atomic_fetch_sub;
-using std::atomic_fetch_sub_explicit;
-using std::atomic_fetch_or;
-using std::atomic_fetch_or_explicit;
-using std::atomic_fetch_xor;
-using std::atomic_fetch_xor_explicit;
-using std::atomic_fetch_and;
-using std::atomic_fetch_and_explicit;
-using std::atomic_thread_fence;
-using std::atomic_signal_fence;
-
-using std::memory_order;
-using std::memory_order_relaxed;
-using std::memory_order_consume;
-using std::memory_order_acquire;
-using std::memory_order_release;
-using std::memory_order_acq_rel;
-using std::memory_order_seq_cst;
-
-using std::atomic_bool;
-using std::atomic_char;
-using std::atomic_schar;
-using std::atomic_uchar;
-using std::atomic_short;
-using std::atomic_ushort;
-using std::atomic_int;
-using std::atomic_uint;
-using std::atomic_long;
-using std::atomic_ulong;
-using std::atomic_llong;
-using std::atomic_ullong;
-using std::atomic_char16_t;
-using std::atomic_char32_t;
-using std::atomic_wchar_t;
-using std::atomic_int_least8_t;
-using std::atomic_uint_least8_t;
-using std::atomic_int_least16_t;
-using std::atomic_uint_least16_t;
-using std::atomic_int_least32_t;
-using std::atomic_uint_least32_t;
-using std::atomic_int_least64_t;
-using std::atomic_uint_least64_t;
-using std::atomic_int_fast8_t;
-using std::atomic_uint_fast8_t;
-using std::atomic_int_fast16_t;
-using std::atomic_uint_fast16_t;
-using std::atomic_int_fast32_t;
-using std::atomic_uint_fast32_t;
-using std::atomic_int_fast64_t;
-using std::atomic_uint_fast64_t;
-using std::atomic_intptr_t;
-using std::atomic_uintptr_t;
-using std::atomic_size_t;
-using std::atomic_ptrdiff_t;
-using std::atomic_intmax_t;
-using std::atomic_uintmax_t;
-
-#else /* <atomic> unavailable, possibly because this is C, not C++ */
-
-#include <sys/types.h>
-#include <stdbool.h>
-
-/*
- * C: Do it ourselves.
- * Note that the runtime representation defined here should be compatible
- * with the C++ one, i.e. an _Atomic(T) needs to contain the same
- * bits as a T.
- */
-
-#include <stddef.h> /* For ptrdiff_t. */
-#include <stdint.h> /* TODO: don't drag in all the macros, just the types. */
-// Include uchar.h only when available. Bionic's stdatomic.h is also used for
-// the host (via a copy in prebuilts/clang) and uchar.h is not available in the
-// glibc used for the host.
-#if __STDC_VERSION__ >= 201112L
-# include <uchar.h> /* For char16_t and char32_t. */
-#endif
-
-#ifdef __clang__
-# if __has_extension(c_atomic) || __has_extension(cxx_atomic)
-# define __CLANG_ATOMICS
-# else
-# error "stdatomic.h does not support your compiler"
-# endif
-# if __has_builtin(__sync_swap)
-# define __HAS_BUILTIN_SYNC_SWAP
-# endif
-#else
-# define __GNUC_ATOMICS
-#endif
-
-/*
- * 7.17.1 Atomic lock-free macros.
- */
-
-#ifdef __GCC_ATOMIC_BOOL_LOCK_FREE
-#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_CHAR_LOCK_FREE
-#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_CHAR16_T_LOCK_FREE
-#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_CHAR32_T_LOCK_FREE
-#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_WCHAR_T_LOCK_FREE
-#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_SHORT_LOCK_FREE
-#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_INT_LOCK_FREE
-#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
-#endif
-#ifdef __GCC_ATOMIC_LONG_LOCK_FREE
-#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/sys/_system_properties.h
^
|
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _INCLUDE_SYS__SYSTEM_PROPERTIES_H
-#define _INCLUDE_SYS__SYSTEM_PROPERTIES_H
-
-#include <sys/cdefs.h>
-#include <stdint.h>
-
-#ifndef _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
-#error you should #include <sys/system_properties.h> instead
-#endif
-
-#include <sys/system_properties.h>
-
-__BEGIN_DECLS
-
-#define PROP_SERVICE_NAME "property_service"
-#define PROP_FILENAME "/dev/__properties__"
-
-#define PROP_MSG_SETPROP 1
-#define PROP_MSG_SETPROP2 0x00020001
-
-#define PROP_SUCCESS 0
-#define PROP_ERROR_READ_CMD 0x0004
-#define PROP_ERROR_READ_DATA 0x0008
-#define PROP_ERROR_READ_ONLY_PROPERTY 0x000B
-#define PROP_ERROR_INVALID_NAME 0x0010
-#define PROP_ERROR_INVALID_VALUE 0x0014
-#define PROP_ERROR_PERMISSION_DENIED 0x0018
-#define PROP_ERROR_INVALID_CMD 0x001B
-#define PROP_ERROR_HANDLE_CONTROL_MESSAGE 0x0020
-#define PROP_ERROR_SET_FAILED 0x0024
-
-/*
-** This was previously for testing, but now that SystemProperties is its own testable class,
-** there is never a reason to call this function and its implementation simply returns -1.
-*/
-int __system_property_set_filename(const char* __filename);
-
-/*
-** Initialize the area to be used to store properties. Can
-** only be done by a single process that has write access to
-** the property area.
-*/
-int __system_property_area_init(void);
-
-/* Read the global serial number of the system properties
-**
-** Called to predict if a series of cached __system_property_find
-** objects will have seen __system_property_serial values change.
-** But also aids the converse, as changes in the global serial can
-** also be used to predict if a failed __system_property_find
-** could in-turn now find a new object; thus preventing the
-** cycles of effort to poll __system_property_find.
-**
-** Typically called at beginning of a cache cycle to signal if _any_ possible
-** changes have occurred since last. If there is, one may check each individual
-** __system_property_serial to confirm dirty, or __system_property_find
-** to check if the property now exists. If a call to __system_property_add
-** or __system_property_update has completed between two calls to
-** __system_property_area_serial then the second call will return a larger
-** value than the first call. Beware of race conditions as changes to the
-** properties are not atomic, the main value of this call is to determine
-** whether the expensive __system_property_find is worth retrying to see if
-** a property now exists.
-**
-** Returns the serial number on success, -1 on error.
-*/
-uint32_t __system_property_area_serial(void);
-
-/* Add a new system property. Can only be done by a single
-** process that has write access to the property area, and
-** that process must handle sequencing to ensure the property
-** does not already exist and that only one property is added
-** or updated at a time.
-**
-** Returns 0 on success, -1 if the property area is full.
-*/
-int __system_property_add(const char* __name, unsigned int __name_length, const char* __value, unsigned int __value_length);
-
-/* Update the value of a system property returned by
-** __system_property_find. Can only be done by a single process
-** that has write access to the property area, and that process
-** must handle sequencing to ensure that only one property is
-** updated at a time.
-**
-** Returns 0 on success, -1 if the parameters are incorrect.
-*/
-int __system_property_update(prop_info* __pi, const char* __value, unsigned int __value_length);
-
-/* Read the serial number of a system property returned by
-** __system_property_find.
-**
-** Returns the serial number on success, -1 on error.
-*/
-uint32_t __system_property_serial(const prop_info* __pi);
-
-/* Initialize the system properties area in read only mode.
- * Should be done by all processes that need to read system
- * properties.
- *
- * Returns 0 on success, -1 otherwise.
- */
-int __system_properties_init(void);
-
-/* Deprecated: use __system_property_wait instead. */
-uint32_t __system_property_wait_any(uint32_t __old_serial);
-
-__END_DECLS
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/sys/cdefs-android.h
^
|
@@ -1,5 +0,0 @@
-#pragma once
-#include <sys/cdefs.h>
-#define __LIBC_HIDDEN__ __attribute__((visibility("hidden")))
-#define __unused __attribute__((__unused__))
-#define __BIONIC_ALIGN(__value, __alignment) (((__value) + (__alignment)-1) & ~((__alignment)-1))
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/include/sys/system_properties.h
^
|
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _INCLUDE_SYS_SYSTEM_PROPERTIES_H
-#define _INCLUDE_SYS_SYSTEM_PROPERTIES_H
-
-#include <sys/cdefs.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-__BEGIN_DECLS
-
-typedef struct prop_info prop_info;
-
-#define PROP_VALUE_MAX 92
-
-/*
- * Sets system property `name` to `value`, creating the system property if it doesn't already exist.
- */
-int __system_property_set(const char* __name, const char* __value) __INTRODUCED_IN(12);
-
-/*
- * Returns a `prop_info` corresponding system property `name`, or nullptr if it doesn't exist.
- * Use __system_property_read_callback to query the current value.
- *
- * Property lookup is expensive, so it can be useful to cache the result of this function.
- */
-const prop_info* __system_property_find(const char* __name);
-
-/*
- * Calls `callback` with a consistent trio of name, value, and serial number for property `pi`.
- */
-void __system_property_read_callback(const prop_info* __pi,
- void (*__callback)(void* __cookie, const char* __name, const char* __value, uint32_t __serial),
- void* __cookie) __INTRODUCED_IN(26);
-
-/*
- * Passes a `prop_info` for each system property to the provided
- * callback. Use __system_property_read_callback() to read the value.
- *
- * This method is for inspecting and debugging the property system, and not generally useful.
- */
-int __system_property_foreach(void (*__callback)(const prop_info* __pi, void* __cookie), void* __cookie)
- __INTRODUCED_IN(19);
-
-/*
- * Waits for the specific system property identified by `pi` to be updated
- * past `old_serial`. Waits no longer than `relative_timeout`, or forever
- * if `relaive_timeout` is null.
- *
- * If `pi` is null, waits for the global serial number instead.
- *
- * If you don't know the current serial, use 0.
- *
- * Returns true and updates `*new_serial_ptr` on success, or false if the call
- * timed out.
- */
-struct timespec;
-bool __system_property_wait(const prop_info* __pi, uint32_t __old_serial, uint32_t* __new_serial_ptr, const struct timespec* __relative_timeout)
- __INTRODUCED_IN(26);
-
-/* Deprecated. In Android O and above, there's no limit on property name length. */
-#define PROP_NAME_MAX 32
-/* Deprecated. Use __system_property_read_callback instead. */
-int __system_property_read(const prop_info* __pi, char* __name, char* __value);
-/* Deprecated. Use __system_property_read_callback instead. */
-int __system_property_get(const char* __name, char* __value);
-/* Deprecated. Use __system_property_foreach instead. */
-const prop_info* __system_property_find_nth(unsigned __n);
-
-__END_DECLS
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/CFIShadow.h
^
|
@@ -1,91 +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 CFI_SHADOW_H
-#define CFI_SHADOW_H
-
-#include <stdint.h>
-
-#include "private/bionic_page.h"
-#include "private/bionic_macros.h"
-
-constexpr unsigned kLibraryAlignmentBits = 18;
-constexpr size_t kLibraryAlignment = 1UL << kLibraryAlignmentBits;
-
-// This class defines format of the shadow region for Control Flow Integrity support.
-// See documentation in http://clang.llvm.org/docs/ControlFlowIntegrityDesign.html#shared-library-support.
-//
-// CFI shadow is effectively a very fast and specialized implementation of dladdr: given an address that
-// belongs to a shared library or an executable, it can find the address of a specific export in that
-// library (a function called "__cfi_check"). This is only guaranteed to work for
-// addresses of possible CFI targets inside a library: indirectly called functions and virtual
-// tables. A random address inside a library may not work in the future (but it does in the current
-// implementation).
-//
-// Implementation is a sparse array of uint16_t where each element describes the location of
-// __cfi_check for a 2**kShadowGranularity range of memory. Array elements (called "shadow values"
-// below) are interpreted as follows.
-//
-// For an address P and corresponding shadow value V, the address of __cfi_check is calculated as
-// align_up(P, 2**kShadowGranularity) - (V - 2) * (2 ** kCfiCheckGranularity)
-//
-// Special shadow values:
-// 0 = kInvalidShadow, this memory range has no valid CFI targets.
-// 1 = kUncheckedShadow, any address is this memory range is a valid CFI target
-//
-// Loader requirement: each aligned 2**kShadowGranularity region of address space may contain at
-// most one DSO.
-// Compiler requirement: __cfi_check is aligned at kCfiCheckGranularity.
-// Compiler requirement: __cfi_check for a given DSO is located below any CFI target for that DSO.
-class CFIShadow {
- public:
- static constexpr uintptr_t kShadowGranularity = kLibraryAlignmentBits;
- static constexpr uintptr_t kCfiCheckGranularity = 12;
-
- // Each uint16_t element of the shadow corresponds to this much application memory.
- static constexpr uintptr_t kShadowAlign = 1UL << kShadowGranularity;
-
- // Alignment of __cfi_check.
- static constexpr uintptr_t kCfiCheckAlign = 1UL << kCfiCheckGranularity; // 4K
-
-#if defined (__LP64__)
- static constexpr uintptr_t kMaxTargetAddr = 0xffffffffffff;
-#else
- static constexpr uintptr_t kMaxTargetAddr = 0xffffffff;
-#endif
-
- // Shadow is 2 -> 2**kShadowGranularity.
- static constexpr uintptr_t kShadowSize =
- align_up((kMaxTargetAddr >> (kShadowGranularity - 1)), PAGE_SIZE);
-
- // Returns offset inside the shadow region for an address.
- static constexpr uintptr_t MemToShadowOffset(uintptr_t x) {
- return (x >> kShadowGranularity) << 1;
- }
-
- typedef int (*CFICheckFn)(uint64_t, void *, void *);
-
- public:
- enum ShadowValues : uint16_t {
- kInvalidShadow = 0, // Not a valid CFI target.
- kUncheckedShadow = 1, // Unchecked, valid CFI target.
- kRegularShadowMin = 2 // This and all higher values encode a negative offset to __cfi_check in
- // the units of kCfiCheckGranularity, starting with 0 at
- // kRegularShadowMin.
- };
-};
-
-#endif // CFI_SHADOW_H
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/CachedProperty.h
^
|
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <string.h>
-
-#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
-#include <sys/_system_properties.h>
-
-// Cached system property lookup. For code that needs to read the same property multiple times,
-// this class helps optimize those lookups.
-class CachedProperty {
- public:
- // The lifetime of `property_name` must be greater than that of this CachedProperty.
- explicit CachedProperty(const char* property_name)
- : property_name_(property_name),
- prop_info_(nullptr),
- cached_area_serial_(0),
- cached_property_serial_(0),
- is_read_only_(strncmp(property_name, "ro.", 3) == 0),
- read_only_property_(nullptr) {
- cached_value_[0] = '\0';
- }
-
- // Returns true if the property has been updated (based on the serial rather than the value)
- // since the last call to Get.
- bool DidChange() {
- uint32_t initial_property_serial_ = cached_property_serial_;
- Get();
- return (cached_property_serial_ != initial_property_serial_);
- }
-
- // Returns the current value of the underlying system property as cheaply as possible.
- // The returned pointer is valid until the next call to Get. It is the caller's responsibility
- // to provide a lock for thread-safety.
- const char* Get() {
- // Do we have a `struct prop_info` yet?
- if (prop_info_ == nullptr) {
- // `__system_property_find` is expensive, so only retry if a property
- // has been created since last time we checked.
- uint32_t property_area_serial = __system_property_area_serial();
- if (property_area_serial != cached_area_serial_) {
- prop_info_ = __system_property_find(property_name_);
- cached_area_serial_ = property_area_serial;
- }
- }
-
- if (prop_info_ != nullptr) {
- // Only bother re-reading the property if it's actually changed since last time.
- uint32_t property_serial = __system_property_serial(prop_info_);
- if (property_serial != cached_property_serial_) {
- __system_property_read_callback(prop_info_, &CachedProperty::Callback, this);
- }
- }
- if (is_read_only_ && read_only_property_ != nullptr) {
- return read_only_property_;
- }
- return cached_value_;
- }
-
- private:
- const char* property_name_;
- const prop_info* prop_info_;
- uint32_t cached_area_serial_;
- uint32_t cached_property_serial_;
- char cached_value_[PROP_VALUE_MAX];
- bool is_read_only_;
- const char* read_only_property_;
-
- static void Callback(void* data, const char*, const char* value, uint32_t serial) {
- CachedProperty* instance = reinterpret_cast<CachedProperty*>(data);
- instance->cached_property_serial_ = serial;
- // Read only properties can be larger than PROP_VALUE_MAX, but also never change value or
- // location, thus we return the pointer from the shared memory directly.
- if (instance->is_read_only_) {
- instance->read_only_property_ = value;
- } else {
- strlcpy(instance->cached_value_, value, PROP_VALUE_MAX);
- }
- }
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/ErrnoRestorer.h
^
|
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <errno.h>
-
-#include "bionic_macros.h"
-
-class ErrnoRestorer {
- public:
- explicit ErrnoRestorer() : saved_errno_(errno) {
- }
-
- ~ErrnoRestorer() {
- errno = saved_errno_;
- }
-
- void override(int new_errno) {
- saved_errno_ = new_errno;
- }
-
- private:
- int saved_errno_;
-
- BIONIC_DISALLOW_COPY_AND_ASSIGN(ErrnoRestorer);
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/FdPath.h
^
|
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#pragma once
-
-class FdPath {
- public:
- explicit FdPath(int fd) {
- snprintf(buf, sizeof(buf), "/proc/self/fd/%d", fd);
- }
-
- const char* c_str() {
- return buf;
- }
-
- private:
- char buf[40];
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/KernelArgumentBlock.h
^
|
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <elf.h>
-#include <link.h>
-#include <stdint.h>
-#include <sys/auxv.h>
-
-#include "private/bionic_macros.h"
-
-// When the kernel starts the dynamic linker, it passes a pointer to a block
-// of memory containing argc, the argv array, the environment variable array,
-// and the array of ELF aux vectors. This class breaks that block up into its
-// constituents for easy access.
-class KernelArgumentBlock {
- public:
- explicit KernelArgumentBlock(void* raw_args) {
- uintptr_t* args = reinterpret_cast<uintptr_t*>(raw_args);
- argc = static_cast<int>(*args);
- argv = reinterpret_cast<char**>(args + 1);
- envp = argv + argc + 1;
-
- // Skip over all environment variable definitions to find the aux vector.
- // The end of the environment block is marked by a NULL pointer.
- char** p = envp;
- while (*p != nullptr) {
- ++p;
- }
- ++p; // Skip the NULL itself.
-
- auxv = reinterpret_cast<ElfW(auxv_t)*>(p);
- }
-
- // Similar to ::getauxval but doesn't require the libc global variables to be set up,
- // so it's safe to call this really early on.
- unsigned long getauxval(unsigned long type) {
- for (ElfW(auxv_t)* v = auxv; v->a_type != AT_NULL; ++v) {
- if (v->a_type == type) {
- return v->a_un.a_val;
- }
- }
- return 0;
- }
-
- int argc;
- char** argv;
- char** envp;
- ElfW(auxv_t)* auxv;
-
- private:
- BIONIC_DISALLOW_COPY_AND_ASSIGN(KernelArgumentBlock);
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/MallocXmlElem.h
^
|
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <stdarg.h>
-#include <stdio.h>
-
-#include <private/bionic_macros.h>
-
-class MallocXmlElem {
- public:
- // Name must be valid throughout lifetime of the object.
- explicit MallocXmlElem(FILE* fp, const char* name,
- const char* attr_fmt = nullptr, ...) : fp_(fp), name_(name) {
- fprintf(fp, "<%s", name_);
- if (attr_fmt != nullptr) {
- va_list args;
- va_start(args, attr_fmt);
- fputc(' ', fp_);
- vfprintf(fp_, attr_fmt, args);
- va_end(args);
- }
- fputc('>', fp_);
- }
-
- ~MallocXmlElem() noexcept {
- fprintf(fp_, "</%s>", name_);
- }
-
- void Contents(const char* fmt, ...) {
- va_list args;
- va_start(args, fmt);
- vfprintf(fp_, fmt, args);
- va_end(args);
- }
-
-private:
- FILE* fp_;
- const char* name_;
-
- BIONIC_DISALLOW_IMPLICIT_CONSTRUCTORS(MallocXmlElem);
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/NetdClientDispatch.h
^
|
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef PRIVATE_NETD_CLIENT_DISPATCH_H
-#define PRIVATE_NETD_CLIENT_DISPATCH_H
-
-#include <sys/cdefs.h>
-#include <sys/socket.h>
-
-__BEGIN_DECLS
-
-struct NetdClientDispatch {
- int (*accept4)(int, struct sockaddr*, socklen_t*, int);
- int (*connect)(int, const struct sockaddr*, socklen_t);
- int (*socket)(int, int, int);
- unsigned (*netIdForResolv)(unsigned);
- int (*dnsOpenProxy)();
-};
-
-extern __LIBC_HIDDEN__ struct NetdClientDispatch __netdClientDispatch;
-
-__END_DECLS
-
-#endif // PRIVATE_NETD_CLIENT_DISPATCH_H
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/ScopedPthreadMutexLocker.h
^
|
@@ -1,37 +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.
- */
-
-#pragma once
-
-#include <pthread.h>
-
-#include "bionic_macros.h"
-
-class ScopedPthreadMutexLocker {
- public:
- explicit ScopedPthreadMutexLocker(pthread_mutex_t* mu) : mu_(mu) {
- pthread_mutex_lock(mu_);
- }
-
- ~ScopedPthreadMutexLocker() {
- pthread_mutex_unlock(mu_);
- }
-
- private:
- pthread_mutex_t* mu_;
-
- BIONIC_DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedPthreadMutexLocker);
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/ScopedRWLock.h
^
|
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <pthread.h>
-
-#include "private/bionic_macros.h"
-
-template <bool write> class ScopedRWLock {
- public:
- explicit ScopedRWLock(pthread_rwlock_t* rwlock) : rwlock_(rwlock) {
- (write ? pthread_rwlock_wrlock : pthread_rwlock_rdlock)(rwlock_);
- }
-
- ~ScopedRWLock() {
- pthread_rwlock_unlock(rwlock_);
- }
-
- private:
- pthread_rwlock_t* rwlock_;
- BIONIC_DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedRWLock);
-};
-
-typedef ScopedRWLock<true> ScopedWriteLock;
-typedef ScopedRWLock<false> ScopedReadLock;
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/ScopedReaddir.h
^
|
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <dirent.h>
-
-#include "private/bionic_macros.h"
-
-class ScopedReaddir {
- public:
- explicit ScopedReaddir(const char* path) : ScopedReaddir(opendir(path)) {
- }
-
- explicit ScopedReaddir(DIR* dir) {
- dir_ = dir;
- }
-
- ~ScopedReaddir() {
- if (dir_ != nullptr) {
- closedir(dir_);
- }
- }
-
- bool IsBad() {
- return dir_ == nullptr;
- }
-
- dirent* ReadEntry() {
- return readdir(dir_);
- }
-
- private:
- DIR* dir_;
-
- BIONIC_DISALLOW_COPY_AND_ASSIGN(ScopedReaddir);
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/ScopedSignalBlocker.h
^
|
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#pragma once
-
-#include <signal.h>
-
-#include <limits.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include "bionic_macros.h"
-
-
-#ifndef _KERNEL__NSIG
-#define _KERNEL__NSIG 64
-#endif
-
-/* Userspace's NSIG is the kernel's _NSIG + 1. */
-#define _NSIG (_KERNEL__NSIG + 1)
-#define NSIG _NSIG
-
-typedef int sig_atomic_t;
-
-typedef __sighandler_t sig_t; /* BSD compatibility. */
-typedef __sighandler_t sighandler_t; /* glibc compatibility. */
-
-#if defined(__LP64__) || defined(__mips__)
-typedef sigset_t sigset64_t;
-#else
-typedef struct { unsigned long __bits[_KERNEL__NSIG/LONG_BIT]; } sigset64_t;
-#endif
-
-
-#define BIONIC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&) = delete; \
- void operator=(const TypeName&) = delete
-
-class ScopedSignalBlocker {
- public:
- // Block all signals.
- explicit ScopedSignalBlocker() {
- //sigfillset64(&set);
- //sigprocmask64(SIG_BLOCK, &set, &old_set_);
- sigset_t mask;
- sigfillset(&mask);
- sigprocmask(SIG_SETMASK, &mask, &old_mask);
- }
-
- // Block just the specified signal.
- explicit ScopedSignalBlocker(int signal) {
- sigset_t mask;
- sigemptyset(&mask);
- sigaddset(&mask, signal);
- sigprocmask(SIG_SETMASK, &mask, &old_mask);
- //sigaddset64(&mask, signal);
- //sigprocmask64(SIG_BLOCK, &set, &old_set_);
- }
-
- ~ScopedSignalBlocker() {
- reset();
- }
-
- void reset() {
- //sigprocmask64(SIG_SETMASK, &old_set_, nullptr);
- sigprocmask(SIG_SETMASK, &old_mask, NULL);
- }
-
- //sigset64_t old_set_;
- sigset_t old_mask;
-
- BIONIC_DISALLOW_COPY_AND_ASSIGN(ScopedSignalBlocker);
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/ScopedSignalHandler.h
^
|
@@ -1,47 +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.
- */
-
-#pragma once
-
-#include <signal.h>
-
-class ScopedSignalHandler {
- public:
- ScopedSignalHandler(int signal_number, void (*handler)(int), int sa_flags = 0)
- : signal_number_(signal_number) {
- action_ = { .sa_flags = sa_flags, .sa_handler = handler };
- sigaction64(signal_number_, &action_, &old_action_);
- }
-
- ScopedSignalHandler(int signal_number, void (*action)(int, siginfo_t*, void*),
- int sa_flags = SA_SIGINFO)
- : signal_number_(signal_number) {
- action_ = { .sa_flags = sa_flags, .sa_sigaction = action };
- sigaction64(signal_number_, &action_, &old_action_);
- }
-
- explicit ScopedSignalHandler(int signal_number) : signal_number_(signal_number) {
- sigaction64(signal_number, nullptr, &old_action_);
- }
-
- ~ScopedSignalHandler() {
- sigaction64(signal_number_, &old_action_, nullptr);
- }
-
- struct sigaction64 action_;
- struct sigaction64 old_action_;
- const int signal_number_;
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/SigSetConverter.h
^
|
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-union SigSetConverter {
- int bsd;
- sigset_t sigset;
- sigset64_t sigset64;
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/WriteProtected.h
^
|
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include "../../../hybris_compat.h"
-
-#include <errno.h>
-#include <string.h>
-#include <sys/cdefs.h>
-#include <sys/mman.h>
-#include <sys/user.h>
-
-#include <async_safe/log.h>
-
-#include "private/bionic_macros.h"
-
-template <typename T>
-union WriteProtectedContents {
- T value;
- char padding[PAGE_SIZE];
-
- WriteProtectedContents() = default;
- BIONIC_DISALLOW_COPY_AND_ASSIGN(WriteProtectedContents);
-} __attribute__((aligned(PAGE_SIZE)));
-
-// Write protected wrapper class that aligns its contents to a page boundary,
-// and sets the memory protection to be non-writable, except when being modified
-// explicitly.
-template <typename T>
-class WriteProtected {
- static_assert(sizeof(T) < PAGE_SIZE,
- "WriteProtected only supports contents up to PAGE_SIZE");
- static_assert(__is_pod(T), "WriteProtected only supports POD contents");
-
- WriteProtectedContents<T> contents;
-
- public:
- WriteProtected() = default;
- BIONIC_DISALLOW_COPY_AND_ASSIGN(WriteProtected);
-
- void initialize() {
- // Not strictly necessary, but this will hopefully segfault if we initialize
- // multiple times by accident.
- memset(&contents, 0, sizeof(contents));
-
- if (mprotect(&contents, PAGE_SIZE, PROT_READ)) {
- async_safe_fatal("failed to make WriteProtected nonwritable in initialize");
- }
- }
-
- const T* operator->() {
- return &contents.value;
- }
-
- const T& operator*() {
- return contents.value;
- }
-
- template <typename Mutator>
- void mutate(Mutator mutator) {
- if (mprotect(&contents, PAGE_SIZE, PROT_READ | PROT_WRITE) != 0) {
- async_safe_fatal("failed to make WriteProtected writable in mutate: %s",
- strerror(errno));
- }
- mutator(&contents.value);
- if (mprotect(&contents, PAGE_SIZE, PROT_READ) != 0) {
- async_safe_fatal("failed to make WriteProtected nonwritable in mutate: %s",
- strerror(errno));
- }
- }
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/__bionic_get_shell_path.h
^
|
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-extern "C" const char* __bionic_get_shell_path();
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/__get_tls.h
^
|
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __BIONIC_PRIVATE_GET_TLS_H_
-#define __BIONIC_PRIVATE_GET_TLS_H_
-
-#if defined(__aarch64__)
-# define __get_tls() ({ void** __val; __asm__("mrs %0, tpidr_el0" : "=r"(__val)); __val; })
-#elif defined(__arm__)
-# define __get_tls() ({ void** __val; __asm__("mrc p15, 0, %0, c13, c0, 3" : "=r"(__val)); __val; })
-#elif defined(__mips__)
-# define __get_tls() \
- /* On mips32r1, this goes via a kernel illegal instruction trap that's optimized for v1. */ \
- ({ register void** __val asm("v1"); \
- __asm__(".set push\n" \
- ".set mips32r2\n" \
- "rdhwr %0,$29\n" \
- ".set pop\n" : "=r"(__val)); \
- __val; })
-#elif defined(__i386__)
-# define __get_tls() ({ void** __val; __asm__("movl %%gs:0, %0" : "=r"(__val)); __val; })
-#elif defined(__x86_64__)
-# define __get_tls() ({ void** __val; __asm__("mov %%fs:0, %0" : "=r"(__val)); __val; })
-#else
-#error unsupported architecture
-#endif
-
-#endif /* __BIONIC_PRIVATE_GET_TLS_H_ */
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_allocator.h
^
|
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/cdefs.h>
-#include <sys/mman.h>
-#include <sys/prctl.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <stdint.h>
-
-const uint32_t kSmallObjectMaxSizeLog2 = 10;
-const uint32_t kSmallObjectMinSizeLog2 = 4;
-const uint32_t kSmallObjectAllocatorsCount = kSmallObjectMaxSizeLog2 - kSmallObjectMinSizeLog2 + 1;
-
-class BionicSmallObjectAllocator;
-
-// This structure is placed at the beginning of each addressable page
-// and has all information we need to find the corresponding memory allocator.
-struct page_info {
- char signature[4];
- uint32_t type;
- union {
- // we use allocated_size for large objects allocator
- size_t allocated_size;
- // and allocator_addr for small ones.
- BionicSmallObjectAllocator* allocator_addr;
- };
-};
-
-struct small_object_block_record {
- small_object_block_record* next;
- size_t free_blocks_cnt;
-};
-
-// This structure is placed at the beginning of each page managed by
-// BionicSmallObjectAllocator. Note that a page_info struct is expected at the
-// beginning of each page as well, and therefore this structure contains a
-// page_info as its *first* field.
-struct small_object_page_info {
- page_info info; // Must be the first field.
-
- // Doubly linked list for traversing all pages allocated by a
- // BionicSmallObjectAllocator.
- small_object_page_info* next_page;
- small_object_page_info* prev_page;
-
- // Linked list containing all free blocks in this page.
- small_object_block_record* free_block_list;
-
- // Free blocks counter.
- size_t free_blocks_cnt;
-};
-
-class BionicSmallObjectAllocator {
- public:
- BionicSmallObjectAllocator(uint32_t type, size_t block_size);
- void* alloc();
- void free(void* ptr);
-
- size_t get_block_size() const { return block_size_; }
- private:
- void alloc_page();
- void free_page(small_object_page_info* page);
- void add_to_page_list(small_object_page_info* page);
- void remove_from_page_list(small_object_page_info* page);
-
- const uint32_t type_;
- const size_t block_size_;
- const size_t blocks_per_page_;
-
- size_t free_pages_cnt_;
-
- small_object_page_info* page_list_;
-};
-
-class BionicAllocator {
- public:
- constexpr BionicAllocator() : allocators_(nullptr), allocators_buf_() {}
- void* alloc(size_t size);
- void* memalign(size_t align, size_t size);
-
- // Note that this implementation of realloc never shrinks allocation
- void* realloc(void* ptr, size_t size);
- void free(void* ptr);
- private:
- void* alloc_mmap(size_t align, size_t size);
- inline void* alloc_impl(size_t align, size_t size);
- inline page_info* get_page_info_unchecked(void* ptr);
- inline page_info* get_page_info(void* ptr);
- BionicSmallObjectAllocator* get_small_object_allocator(uint32_t type);
- void initialize_allocators();
-
- BionicSmallObjectAllocator* allocators_;
- uint8_t allocators_buf_[sizeof(BionicSmallObjectAllocator)*kSmallObjectAllocatorsCount];
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_arc4random.h
^
|
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _PRIVATE_BIONIC_ARC4RANDOM_H_
-#define _PRIVATE_BIONIC_ARC4RANDOM_H_
-
-#include <stddef.h>
-
-// arc4random(3) aborts if it's unable to fetch entropy, which is always
-// the case for init on devices. GCE kernels have a workaround to ensure
-// sufficient entropy during early boot, but no device kernels do. This
-// wrapper falls back to AT_RANDOM if the kernel doesn't have enough
-// entropy for getrandom(2) or /dev/urandom.
-void __libc_safe_arc4random_buf(void* buf, size_t n);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_asm.h
^
|
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _PRIVATE_BIONIC_ASM_H_
-#define _PRIVATE_BIONIC_ASM_H_
-
-#include <asm/unistd.h> /* For system call numbers. */
-#define MAX_ERRNO 4095 /* For recognizing system call error returns. */
-
-#define __bionic_asm_custom_entry(f)
-#define __bionic_asm_custom_end(f)
-#define __bionic_asm_function_type @function
-
-#if defined(__aarch64__)
-#include <private/bionic_asm_arm64.h>
-#elif defined(__arm__)
-#include <private/bionic_asm_arm.h>
-#elif defined(__i386__)
-#include <private/bionic_asm_x86.h>
-#elif defined(__mips__)
-#include <private/bionic_asm_mips.h>
-#elif defined(__x86_64__)
-#include <private/bionic_asm_x86_64.h>
-#endif
-
-#define ENTRY_NO_DWARF(f) \
- .text; \
- .globl f; \
- .balign __bionic_asm_align; \
- .type f, __bionic_asm_function_type; \
- f: \
- __bionic_asm_custom_entry(f); \
-
-#define ENTRY(f) \
- ENTRY_NO_DWARF(f) \
- .cfi_startproc \
-
-#define END_NO_DWARF(f) \
- .size f, .-f; \
- __bionic_asm_custom_end(f) \
-
-#define END(f) \
- .cfi_endproc; \
- END_NO_DWARF(f) \
-
-/* Like ENTRY, but with hidden visibility. */
-#define ENTRY_PRIVATE(f) \
- ENTRY(f); \
- .hidden f \
-
-/* Like ENTRY_NO_DWARF, but with hidden visibility. */
-#define ENTRY_PRIVATE_NO_DWARF(f) \
- ENTRY_NO_DWARF(f); \
- .hidden f \
-
-#define __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(f) \
- .weak f; \
-
-#define ALIAS_SYMBOL(alias, original) \
- .globl alias; \
- .equ alias, original
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_asm_arm.h
^
|
@@ -1,48 +0,0 @@
-/* $OpenBSD: asm.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */
-/* $NetBSD: asm.h,v 1.4 2001/07/16 05:43:32 matt Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)asm.h 5.5 (Berkeley) 5/7/91
- */
-
-#pragma once
-
-#define __bionic_asm_align 0
-
-#undef __bionic_asm_custom_entry
-#undef __bionic_asm_custom_end
-#define __bionic_asm_custom_entry(f) .fnstart
-#define __bionic_asm_custom_end(f) .fnend
-
-#undef __bionic_asm_function_type
-#define __bionic_asm_function_type #function
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_asm_arm64.h
^
|
@@ -1,43 +0,0 @@
-/* $OpenBSD: asm.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */
-/* $NetBSD: asm.h,v 1.4 2001/07/16 05:43:32 matt Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)asm.h 5.5 (Berkeley) 5/7/91
- */
-
-#pragma once
-
-#define __bionic_asm_align 16
-
-#undef __bionic_asm_function_type
-#define __bionic_asm_function_type %function
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_asm_mips.h
^
|
@@ -1,187 +0,0 @@
-/* $OpenBSD: asm.h,v 1.7 2004/10/20 12:49:15 pefo Exp $ */
-
-/*
- * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#pragma once
-
-#define __bionic_asm_align 16
-
-#undef __bionic_asm_custom_entry
-#undef __bionic_asm_custom_end
-#define __bionic_asm_custom_entry(f) .ent f
-#define __bionic_asm_custom_end(f) .end f
-
-#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */
-#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */
-#define _MIPS_ISA_MIPS3 3 /* R4000 */
-#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */
-#define _MIPS_ISA_MIPS5 5
-#define _MIPS_ISA_MIPS32 6
-#define _MIPS_ISA_MIPS64 7
-
-#if !defined(ABICALLS) && !defined(_NO_ABICALLS)
-#define ABICALLS .abicalls
-#endif
-
-#if defined(ABICALLS) && !defined(_KERNEL)
- ABICALLS
-#endif
-
-/*
- * Define how to access unaligned data word
- */
-#define LWLO lwl
-#define LWHI lwr
-#define SWLO swl
-#define SWHI swr
-#define LDLO ldl
-#define LDHI ldr
-#define SDLO sdl
-#define SDHI sdr
-
-/*
- * Define programming environment for ABI.
- */
-#if defined(ABICALLS) && !defined(_KERNEL) && !defined(_STANDALONE)
-
-#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
-#define NARGSAVE 4
-
-#define SETUP_GP \
- .set noreorder; \
- .cpload $t9; \
- .set reorder;
-
-#define SAVE_GP(x) \
- .cprestore x
-
-#define SETUP_GP64(gpoff, name)
-#define RESTORE_GP64
-#endif
-
-#if (_MIPS_SIM == _ABI64) || (_MIPS_SIM == _ABIN32)
-#define NARGSAVE 0
-
-#define SETUP_GP
-#define SAVE_GP(x)
-#define SETUP_GP64(gpoff, name) \
- .cpsetup $t9, gpoff, name
-#define RESTORE_GP64 \
- .cpreturn
-#endif
-
-#define MKFSIZ(narg,locals) (((narg+locals)*REGSZ+31)&(~31))
-
-#else /* defined(ABICALLS) && !defined(_KERNEL) */
-
-#define NARGSAVE 4
-#define SETUP_GP
-#define SAVE_GP(x)
-
-#define ALIGNSZ 16 /* Stack layout alignment */
-#define FRAMESZ(sz) (((sz) + (ALIGNSZ-1)) & ~(ALIGNSZ-1))
-
-#endif
-
-/*
- * Basic register operations based on selected ISA
- */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2 || _MIPS_ISA == _MIPS_ISA_MIPS32)
-#define REGSZ 4 /* 32 bit mode register size */
-#define LOGREGSZ 2 /* log rsize */
-#define REG_S sw
-#define REG_L lw
-#define CF_SZ 24 /* Call frame size */
-#define CF_ARGSZ 16 /* Call frame arg size */
-#define CF_RA_OFFS 20 /* Call ra save offset */
-#endif
-
-#if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4 || _MIPS_ISA == _MIPS_ISA_MIPS64)
-#define REGSZ 8 /* 64 bit mode register size */
-#define LOGREGSZ 3 /* log rsize */
-#define REG_S sd
-#define REG_L ld
-#define CF_SZ 48 /* Call frame size (multiple of ALIGNSZ) */
-#define CF_ARGSZ 32 /* Call frame arg size */
-#define CF_RA_OFFS 40 /* Call ra save offset */
-#endif
-
-#define REGSZ_FP 8 /* 64 bit FP register size */
-
-#ifndef __LP64__
-#define PTR_L lw
-#define PTR_S sw
-#define PTR_SUB sub
-#define PTR_ADD add
-#define PTR_SUBU subu
-#define PTR_ADDU addu
-#define LI li
-#define LA la
-#define PTR_SLL sll
-#define PTR_SRL srl
-#define PTR_VAL .word
-#else
-#define PTR_L ld
-#define PTR_S sd
-#define PTR_ADD dadd
-#define PTR_SUB dsub
-#define PTR_SUBU dsubu
-#define PTR_ADDU daddu
-#define LI dli
-#define LA dla
-#define PTR_SLL dsll
-#define PTR_SRL dsrl
-#define PTR_VAL .dword
-#endif
-
-/*
- * LEAF(x, fsize)
- *
- * Declare a leaf routine.
- */
-#define LEAF(x, fsize) \
- .align 3; \
- .globl x; \
- .ent x, 0; \
-x: ; \
- .cfi_startproc; \
- .frame $sp, fsize, $ra; \
- SETUP_GP \
-
-/*
- * NON_LEAF(x)
- *
- * Declare a non-leaf routine (a routine that makes other C calls).
- */
-#define NON_LEAF(x, fsize, retpc) \
- .align 3; \
- .globl x; \
- .ent x, 0; \
-x: ; \
- .cfi_startproc; \
- .frame $sp, fsize, retpc; \
- SETUP_GP \
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_asm_tls.h
^
|
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-/** WARNING WARNING WARNING
- **
- ** This header file is *NOT* part of the public Bionic ABI/API and should not
- ** be used/included by user-serviceable parts of the system (e.g.
- ** applications).
- **
- ** It is only provided here for the benefit of Android components that need a
- ** pre-allocated slot for performance reasons (including ART, the OpenGL
- ** subsystem, and sanitizers).
- **/
-
-// Bionic TCB / TLS slots:
-//
-// - TLS_SLOT_SELF: On x86-{32,64}, the kernel makes TLS memory available via
-// the gs/fs segments. To get the address of a TLS variable, the first slot
-// of TLS memory (accessed using %gs:0 / %fs:0) holds the address of the
-// gs/fs segment. This slot is used by:
-// - OpenGL and compiler-rt
-// - Accesses of x86 ELF TLS variables
-//
-// - TLS_SLOT_OPENGL and TLS_SLOT_OPENGL_API: These two aren't used by bionic
-// itself, but allow the graphics code to access TLS directly rather than
-// using the pthread API.
-//
-// - TLS_SLOT_STACK_GUARD: Used for -fstack-protector by:
-// - Clang targeting Android/arm64
-// - gcc targeting Linux/x86-{32,64}
-//
-// - TLS_SLOT_SANITIZER: Lets sanitizers avoid using pthread_getspecific for
-// finding the current thread state.
-//
-// - TLS_SLOT_DTV: Pointer to ELF TLS dynamic thread vector.
-//
-// - TLS_SLOT_ART_THREAD_SELF: Fast storage for Thread::Current() in ART.
-//
-// - TLS_SLOT_BIONIC_TLS: Optimizes accesses to bionic_tls by one load versus
-// finding it using __get_thread().
-//
-// - TLS_SLOT_APP: Available for use by apps in Android Q and later. (This slot
-// was used for errno in P and earlier.)
-
-#if defined(__arm__) || defined(__aarch64__)
-
-// The ARM ELF TLS ABI specifies[1] that the thread pointer points at a 2-word
-// TCB followed by the executable's TLS segment. Both the TCB and the
-// executable's segment are aligned according to the segment, so Bionic requires
-// a minimum segment alignment, which effectively reserves an 8-word TCB. The
-// ARM spec allocates the first TCB word to the DTV.
-//
-// [1] "Addenda to, and Errata in, the ABI for the ARM Architecture". Section 3.
-// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0045e/IHI0045E_ABI_addenda.pdf
-
-#define MIN_TLS_SLOT -1 // update this value when reserving a slot
-#define TLS_SLOT_BIONIC_TLS -1
-#define TLS_SLOT_DTV 0
-#define TLS_SLOT_THREAD_ID 1
-#define TLS_SLOT_APP 2 // was historically used for errno
-#define TLS_SLOT_OPENGL 3
-#define TLS_SLOT_OPENGL_API 4
-#define TLS_SLOT_STACK_GUARD 5
-#define TLS_SLOT_SANITIZER 6 // was historically used for dlerror
-#define TLS_SLOT_ART_THREAD_SELF 7
-
-// The maximum slot is fixed by the minimum TLS alignment in Bionic executables.
-#define MAX_TLS_SLOT 7
-
-#elif defined(__i386__) || defined(__x86_64__)
-
-// x86 uses variant 2 ELF TLS layout, which places the executable's TLS segment
-// immediately before the thread pointer. New slots are allocated at positive
-// offsets from the thread pointer.
-
-#define MIN_TLS_SLOT 0
-
-#define TLS_SLOT_SELF 0
-#define TLS_SLOT_THREAD_ID 1
-#define TLS_SLOT_APP 2 // was historically used for errno
-#define TLS_SLOT_OPENGL 3
-#define TLS_SLOT_OPENGL_API 4
-#define TLS_SLOT_STACK_GUARD 5
-#define TLS_SLOT_SANITIZER 6 // was historically used for dlerror
-#define TLS_SLOT_ART_THREAD_SELF 7
-#define TLS_SLOT_DTV 8
-#define TLS_SLOT_BIONIC_TLS 9
-#define MAX_TLS_SLOT 9 // update this value when reserving a slot
-
-#endif
-
-#define BIONIC_TLS_SLOTS (MAX_TLS_SLOT - MIN_TLS_SLOT + 1)
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_asm_x86.h
^
|
@@ -1,51 +0,0 @@
-/* $NetBSD: asm.h,v 1.40 2011/06/16 13:16:20 joerg Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)asm.h 5.5 (Berkeley) 5/7/91
- */
-
-#pragma once
-
-#define PIC_PROLOGUE \
- pushl %ebx; \
- call 666f; \
-666: \
- popl %ebx; \
- addl $_GLOBAL_OFFSET_TABLE_+[.-666b], %ebx
-#define PIC_EPILOGUE \
- popl %ebx
-#define PIC_PLT(x) x@PLT
-#define PIC_GOT(x) x@GOT(%ebx)
-#define PIC_GOTOFF(x) x@GOTOFF(%ebx)
-
-#define __bionic_asm_align 16
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_asm_x86_64.h
^
|
@@ -1,42 +0,0 @@
-/* $NetBSD: asm.h,v 1.18 2013/09/12 15:36:17 joerg Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)asm.h 5.5 (Berkeley) 5/7/91
- */
-
-#pragma once
-
-#define PIC_PLT(x) x@PLT
-#define PIC_GOT(x) x@GOTPCREL(%rip)
-
-#define __bionic_asm_align 16
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_auxv.h
^
|
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-
-__LIBC_HIDDEN__ unsigned long __bionic_getauxval(unsigned long type, bool& exists);
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_config.h
^
|
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _BIONIC_CONFIG_H_
-#define _BIONIC_CONFIG_H_
-
-// valloc(3) and pvalloc(3) were removed from POSIX 2004. We do not include them
-// for LP64, but the symbols remain in LP32 for binary compatibility.
-#if !defined(__LP64__)
-#define HAVE_DEPRECATED_MALLOC_FUNCS 1
-#endif
-
-#endif // _BIONIC_CONFIG_H_
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_constants.h
^
|
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _BIONIC_CONSTANTS_H_
-#define _BIONIC_CONSTANTS_H_
-
-#define NS_PER_S 1000000000
-
-// Size of the shadow call stack. This must be a power of 2.
-#define SCS_SIZE (8 * 1024)
-
-// The shadow call stack is allocated at an aligned address within a guard region of this size. The
-// guard region must be large enough that we can allocate an SCS_SIZE-aligned SCS while ensuring
-// that there is at least one guard page after the SCS so that a stack overflow results in a SIGSEGV
-// instead of corrupting the allocation that comes after it.
-#define SCS_GUARD_REGION_SIZE (16 * 1024 * 1024)
-
-#endif // _BIONIC_CONSTANTS_H_
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_ctype.h
^
|
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __BIONIC_PRIVATE_BIONIC_CTYPE_H_
-#define __BIONIC_PRIVATE_BIONIC_CTYPE_H_
-
-static inline bool IsAlpha(int ch) {
- return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
-}
-
-static inline bool IsDigit(int ch) {
- return (ch >= '0' && ch <= '9');
-}
-
-static inline bool IsSpace(int ch) {
- return (ch == ' ') || (ch >= '\t' && ch <= '\r');
-}
-
-static inline bool IsUpper(int ch) {
- return (ch >= 'A' && ch <= 'Z');
-}
-
-static inline bool IsXDigit(int ch) {
- return (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f');
-}
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_defs.h
^
|
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __BIONIC_PRIVATE_BIONIC_DEFS_H_
-#define __BIONIC_PRIVATE_BIONIC_DEFS_H_
-
-/*
- * This label is used to mark libc/libdl symbols that may need to be replaced
- * by native bridge implementation.
- */
-#define __BIONIC_WEAK_FOR_NATIVE_BRIDGE __attribute__((__weak__, __noinline__))
-#define __BIONIC_WEAK_VARIABLE_FOR_NATIVE_BRIDGE __attribute__((__weak__))
-
-#endif /* __BIONIC_PRIVATE_BIONIC_DEFS_H_ */
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_elf_tls.h
^
|
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <link.h>
-#include <pthread.h>
-#include <stdatomic.h>
-#include <stdint.h>
-#include <sys/cdefs-android.h>
-
-__LIBC_HIDDEN__ extern _Atomic(size_t) __libc_tls_generation_copy;
-
-struct TlsSegment {
- size_t size = 0;
- size_t alignment = 1;
- const void* init_ptr = ""; // Field is non-null even when init_size is 0.
- size_t init_size = 0;
-};
-
-__LIBC_HIDDEN__ bool __bionic_get_tls_segment(const ElfW(Phdr)* phdr_table, size_t phdr_count,
- ElfW(Addr) load_bias, TlsSegment* out);
-
-__LIBC_HIDDEN__ bool __bionic_check_tls_alignment(size_t* alignment);
-
-struct StaticTlsLayout {
- constexpr StaticTlsLayout() {}
-
-private:
- size_t offset_ = 0;
- size_t alignment_ = 1;
- bool overflowed_ = false;
-
- // Offsets to various Bionic TLS structs from the beginning of static TLS.
- size_t offset_bionic_tcb_ = SIZE_MAX;
- size_t offset_bionic_tls_ = SIZE_MAX;
-
-public:
- size_t offset_bionic_tcb() const { return offset_bionic_tcb_; }
- size_t offset_bionic_tls() const { return offset_bionic_tls_; }
- size_t offset_thread_pointer() const;
-
- size_t size() const { return offset_; }
- size_t alignment() const { return alignment_; }
- bool overflowed() const { return overflowed_; }
-
- size_t reserve_exe_segment_and_tcb(const TlsSegment* exe_segment, const char* progname);
- void reserve_bionic_tls();
- size_t reserve_solib_segment(const TlsSegment& segment) {
- return reserve(segment.size, segment.alignment);
- }
- void finish_layout();
-
-private:
- size_t reserve(size_t size, size_t alignment);
-
- template <typename T> size_t reserve_type() {
- return reserve(sizeof(T), alignof(T));
- }
-
- size_t round_up_with_overflow_check(size_t value, size_t alignment);
-};
-
-static constexpr size_t kTlsGenerationNone = 0;
-static constexpr size_t kTlsGenerationFirst = 1;
-
-// The first ELF TLS module has ID 1. Zero is reserved for the first word of
-// the DTV, a generation count. Unresolved weak symbols also use module ID 0.
-static constexpr size_t kTlsUninitializedModuleId = 0;
-
-static inline size_t __tls_module_id_to_idx(size_t id) { return id - 1; }
-static inline size_t __tls_module_idx_to_id(size_t idx) { return idx + 1; }
-
-// A descriptor for a single ELF TLS module.
-struct TlsModule {
- TlsSegment segment;
-
- // Offset into the static TLS block or SIZE_MAX for a dynamic module.
- size_t static_offset = SIZE_MAX;
-
- // The generation in which this module was loaded. Dynamic TLS lookups use
- // this field to detect when a module has been unloaded.
- size_t first_generation = kTlsGenerationNone;
-
- // Used by the dynamic linker to track the associated soinfo* object.
- void* soinfo_ptr = nullptr;
-};
-
-// Table of the ELF TLS modules. Either the dynamic linker or the static
-// initialization code prepares this table, and it's then used during thread
-// creation and for dynamic TLS lookups.
-struct TlsModules {
- constexpr TlsModules() {}
-
- // A pointer to the TLS generation counter in libc.so. The counter is
- // incremented each time an solib is loaded or unloaded.
- _Atomic(size_t) generation = {kTlsGenerationFirst};
- _Atomic(size_t) *generation_libc_so = nullptr;
-
- // Access to the TlsModule[] table requires taking this lock.
- pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
-
- // Pointer to a block of TlsModule objects. The first module has ID 1 and
- // is stored at index 0 in this table.
- size_t module_count = 0;
- TlsModule* module_table = nullptr;
-};
-
-void __init_static_tls(void* static_tls);
-
-// Dynamic Thread Vector. Each thread has a different DTV. For each module
-// (executable or solib), the DTV has a pointer to that module's TLS memory. The
-// DTV is initially empty and is allocated on-demand. It grows as more modules
-// are dlopen'ed. See https://www.akkadia.org/drepper/tls.pdf.
-//
-// The layout of the DTV is specified in various documents, but it is not part
-// of Bionic's public ABI. A compiler can't generate code to access it directly,
-// because it can't access libc's global generation counter.
-struct TlsDtv {
- // Number of elements in this object's modules field.
- size_t count;
-
- // A pointer to an older TlsDtv object that should be freed when the thread
- // exits. The objects aren't immediately freed because a DTV could be
- // reallocated by a signal handler that interrupted __tls_get_addr's fast
- // path.
- TlsDtv* next;
-
- // The DTV slot points at this field, which allows omitting an add instruction
- // on the fast path for a TLS lookup. The arm64 tlsdesc_resolver.S depends on
- // the layout of fields past this point.
- size_t generation;
- void* modules[];
-};
-
-struct TlsIndex {
- size_t module_id;
- size_t offset;
-};
-
-#if defined(__i386__)
-#define TLS_GET_ADDR_CCONV __attribute__((regparm(1)))
-#define TLS_GET_ADDR ___tls_get_addr
-#else
-#define TLS_GET_ADDR_CCONV
-#define TLS_GET_ADDR __tls_get_addr
-#endif
-
-extern "C" void* TLS_GET_ADDR(const TlsIndex* ti) TLS_GET_ADDR_CCONV;
-
-struct bionic_tcb;
-void __free_dynamic_tls(bionic_tcb* tcb);
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_errdefs.h
^
|
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* the following corresponds to the error codes of the Linux kernel used by the Android platform
- * these are distinct from the OpenBSD ones, which is why we need to redeclare them here
- *
- * this file may be included several times to define either error constants or their
- * string representation
- */
-
-#ifndef __BIONIC_ERRDEF
-#error "__BIONIC_ERRDEF must be defined before including this file"
-#endif
-__BIONIC_ERRDEF( 0 , 0, "Success" )
-__BIONIC_ERRDEF( EPERM , 1, "Operation not permitted" )
-__BIONIC_ERRDEF( ENOENT , 2, "No such file or directory" )
-__BIONIC_ERRDEF( ESRCH , 3, "No such process" )
-__BIONIC_ERRDEF( EINTR , 4, "Interrupted system call" )
-__BIONIC_ERRDEF( EIO , 5, "I/O error" )
-__BIONIC_ERRDEF( ENXIO , 6, "No such device or address" )
-__BIONIC_ERRDEF( E2BIG , 7, "Argument list too long" )
-__BIONIC_ERRDEF( ENOEXEC , 8, "Exec format error" )
-__BIONIC_ERRDEF( EBADF , 9, "Bad file descriptor" )
-__BIONIC_ERRDEF( ECHILD , 10, "No child processes" )
-__BIONIC_ERRDEF( EAGAIN , 11, "Try again" )
-__BIONIC_ERRDEF( ENOMEM , 12, "Out of memory" )
-__BIONIC_ERRDEF( EACCES , 13, "Permission denied" )
-__BIONIC_ERRDEF( EFAULT , 14, "Bad address" )
-__BIONIC_ERRDEF( ENOTBLK , 15, "Block device required" )
-__BIONIC_ERRDEF( EBUSY , 16, "Device or resource busy" )
-__BIONIC_ERRDEF( EEXIST , 17, "File exists" )
-__BIONIC_ERRDEF( EXDEV , 18, "Cross-device link" )
-__BIONIC_ERRDEF( ENODEV , 19, "No such device" )
-__BIONIC_ERRDEF( ENOTDIR , 20, "Not a directory" )
-__BIONIC_ERRDEF( EISDIR , 21, "Is a directory" )
-__BIONIC_ERRDEF( EINVAL , 22, "Invalid argument" )
-__BIONIC_ERRDEF( ENFILE , 23, "File table overflow" )
-__BIONIC_ERRDEF( EMFILE , 24, "Too many open files" )
-__BIONIC_ERRDEF( ENOTTY , 25, "Not a typewriter" )
-__BIONIC_ERRDEF( ETXTBSY , 26, "Text file busy" )
-__BIONIC_ERRDEF( EFBIG , 27, "File too large" )
-__BIONIC_ERRDEF( ENOSPC , 28, "No space left on device" )
-__BIONIC_ERRDEF( ESPIPE , 29, "Illegal seek" )
-__BIONIC_ERRDEF( EROFS , 30, "Read-only file system" )
-__BIONIC_ERRDEF( EMLINK , 31, "Too many links" )
-__BIONIC_ERRDEF( EPIPE , 32, "Broken pipe" )
-__BIONIC_ERRDEF( EDOM , 33, "Math argument out of domain of func" )
-__BIONIC_ERRDEF( ERANGE , 34, "Math result not representable" )
-__BIONIC_ERRDEF( EDEADLK , 35, "Resource deadlock would occur" )
-__BIONIC_ERRDEF( ENAMETOOLONG , 36, "File name too long" )
-__BIONIC_ERRDEF( ENOLCK , 37, "No record locks available" )
-__BIONIC_ERRDEF( ENOSYS , 38, "Function not implemented" )
-__BIONIC_ERRDEF( ENOTEMPTY , 39, "Directory not empty" )
-__BIONIC_ERRDEF( ELOOP , 40, "Too many symbolic links encountered" )
-__BIONIC_ERRDEF( ENOMSG , 42, "No message of desired type" )
-__BIONIC_ERRDEF( EIDRM , 43, "Identifier removed" )
-__BIONIC_ERRDEF( ECHRNG , 44, "Channel number out of range" )
-__BIONIC_ERRDEF( EL2NSYNC , 45, "Level 2 not synchronized" )
-__BIONIC_ERRDEF( EL3HLT , 46, "Level 3 halted" )
-__BIONIC_ERRDEF( EL3RST , 47, "Level 3 reset" )
-__BIONIC_ERRDEF( ELNRNG , 48, "Link number out of range" )
-__BIONIC_ERRDEF( EUNATCH , 49, "Protocol driver not attached" )
-__BIONIC_ERRDEF( ENOCSI , 50, "No CSI structure available" )
-__BIONIC_ERRDEF( EL2HLT , 51, "Level 2 halted" )
-__BIONIC_ERRDEF( EBADE , 52, "Invalid exchange" )
-__BIONIC_ERRDEF( EBADR , 53, "Invalid request descriptor" )
-__BIONIC_ERRDEF( EXFULL , 54, "Exchange full" )
-__BIONIC_ERRDEF( ENOANO , 55, "No anode" )
-__BIONIC_ERRDEF( EBADRQC , 56, "Invalid request code" )
-__BIONIC_ERRDEF( EBADSLT , 57, "Invalid slot" )
-__BIONIC_ERRDEF( EBFONT , 59, "Bad font file format" )
-__BIONIC_ERRDEF( ENOSTR , 60, "Device not a stream" )
-__BIONIC_ERRDEF( ENODATA , 61, "No data available" )
-__BIONIC_ERRDEF( ETIME , 62, "Timer expired" )
-__BIONIC_ERRDEF( ENOSR , 63, "Out of streams resources" )
-__BIONIC_ERRDEF( ENONET , 64, "Machine is not on the network" )
-__BIONIC_ERRDEF( ENOPKG , 65, "Package not installed" )
-__BIONIC_ERRDEF( EREMOTE , 66, "Object is remote" )
-__BIONIC_ERRDEF( ENOLINK , 67, "Link has been severed" )
-__BIONIC_ERRDEF( EADV , 68, "Advertise error" )
-__BIONIC_ERRDEF( ESRMNT , 69, "Srmount error" )
-__BIONIC_ERRDEF( ECOMM , 70, "Communication error on send" )
-__BIONIC_ERRDEF( EPROTO , 71, "Protocol error" )
-__BIONIC_ERRDEF( EMULTIHOP , 72, "Multihop attempted" )
-__BIONIC_ERRDEF( EDOTDOT , 73, "RFS specific error" )
-__BIONIC_ERRDEF( EBADMSG , 74, "Not a data message" )
-__BIONIC_ERRDEF( EOVERFLOW , 75, "Value too large for defined data type" )
-__BIONIC_ERRDEF( ENOTUNIQ , 76, "Name not unique on network" )
-__BIONIC_ERRDEF( EBADFD , 77, "File descriptor in bad state" )
-__BIONIC_ERRDEF( EREMCHG , 78, "Remote address changed" )
-__BIONIC_ERRDEF( ELIBACC , 79, "Can not access a needed shared library" )
-__BIONIC_ERRDEF( ELIBBAD , 80, "Accessing a corrupted shared library" )
-__BIONIC_ERRDEF( ELIBSCN , 81, ".lib section in a.out corrupted" )
-__BIONIC_ERRDEF( ELIBMAX , 82, "Attempting to link in too many shared libraries" )
-__BIONIC_ERRDEF( ELIBEXEC , 83, "Cannot exec a shared library directly" )
-__BIONIC_ERRDEF( EILSEQ , 84, "Illegal byte sequence" )
-__BIONIC_ERRDEF( ERESTART , 85, "Interrupted system call should be restarted" )
-__BIONIC_ERRDEF( ESTRPIPE , 86, "Streams pipe error" )
-__BIONIC_ERRDEF( EUSERS , 87, "Too many users" )
-__BIONIC_ERRDEF( ENOTSOCK , 88, "Socket operation on non-socket" )
-__BIONIC_ERRDEF( EDESTADDRREQ , 89, "Destination address required" )
-__BIONIC_ERRDEF( EMSGSIZE , 90, "Message too long" )
-__BIONIC_ERRDEF( EPROTOTYPE , 91, "Protocol wrong type for socket" )
-__BIONIC_ERRDEF( ENOPROTOOPT , 92, "Protocol not available" )
-__BIONIC_ERRDEF( EPROTONOSUPPORT, 93, "Protocol not supported" )
-__BIONIC_ERRDEF( ESOCKTNOSUPPORT, 94, "Socket type not supported" )
-__BIONIC_ERRDEF( EOPNOTSUPP , 95, "Operation not supported on transport endpoint" )
-__BIONIC_ERRDEF( EPFNOSUPPORT , 96, "Protocol family not supported" )
-__BIONIC_ERRDEF( EAFNOSUPPORT , 97, "Address family not supported by protocol" )
-__BIONIC_ERRDEF( EADDRINUSE , 98, "Address already in use" )
-__BIONIC_ERRDEF( EADDRNOTAVAIL , 99, "Cannot assign requested address" )
-__BIONIC_ERRDEF( ENETDOWN , 100, "Network is down" )
-__BIONIC_ERRDEF( ENETUNREACH , 101, "Network is unreachable" )
-__BIONIC_ERRDEF( ENETRESET , 102, "Network dropped connection because of reset" )
-__BIONIC_ERRDEF( ECONNABORTED , 103, "Software caused connection abort" )
-__BIONIC_ERRDEF( ECONNRESET , 104, "Connection reset by peer" )
-__BIONIC_ERRDEF( ENOBUFS , 105, "No buffer space available" )
-__BIONIC_ERRDEF( EISCONN , 106, "Transport endpoint is already connected" )
-__BIONIC_ERRDEF( ENOTCONN , 107, "Transport endpoint is not connected" )
-__BIONIC_ERRDEF( ESHUTDOWN , 108, "Cannot send after transport endpoint shutdown" )
-__BIONIC_ERRDEF( ETOOMANYREFS , 109, "Too many references: cannot splice" )
-__BIONIC_ERRDEF( ETIMEDOUT , 110, "Connection timed out" )
-__BIONIC_ERRDEF( ECONNREFUSED , 111, "Connection refused" )
-__BIONIC_ERRDEF( EHOSTDOWN , 112, "Host is down" )
-__BIONIC_ERRDEF( EHOSTUNREACH , 113, "No route to host" )
-__BIONIC_ERRDEF( EALREADY , 114, "Operation already in progress" )
-__BIONIC_ERRDEF( EINPROGRESS , 115, "Operation now in progress" )
-__BIONIC_ERRDEF( ESTALE , 116, "Stale NFS file handle" )
-__BIONIC_ERRDEF( EUCLEAN , 117, "Structure needs cleaning" )
-__BIONIC_ERRDEF( ENOTNAM , 118, "Not a XENIX named type file" )
-__BIONIC_ERRDEF( ENAVAIL , 119, "No XENIX semaphores available" )
-__BIONIC_ERRDEF( EISNAM , 120, "Is a named type file" )
-__BIONIC_ERRDEF( EREMOTEIO , 121, "Remote I/O error" )
-__BIONIC_ERRDEF( EDQUOT , 122, "Quota exceeded" )
-__BIONIC_ERRDEF( ENOMEDIUM , 123, "No medium found" )
-__BIONIC_ERRDEF( EMEDIUMTYPE , 124, "Wrong medium type" )
-__BIONIC_ERRDEF( ECANCELED , 125, "Operation Canceled" )
-__BIONIC_ERRDEF( ENOKEY , 126, "Required key not available" )
-__BIONIC_ERRDEF( EKEYEXPIRED , 127, "Key has expired" )
-__BIONIC_ERRDEF( EKEYREVOKED , 128, "Key has been revoked" )
-__BIONIC_ERRDEF( EKEYREJECTED , 129, "Key was rejected by service" )
-__BIONIC_ERRDEF( EOWNERDEAD , 130, "Owner died" )
-__BIONIC_ERRDEF( ENOTRECOVERABLE, 131, "State not recoverable" )
-
-#undef __BIONIC_ERRDEF
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_fdsan.h
^
|
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <android/fdsan.h>
-
-#include <errno.h>
-#include <stdatomic.h>
-#include <string.h>
-#include <sys/cdefs.h>
-#include <sys/mman.h>
-#include <sys/resource.h>
-#include <sys/user.h>
-
-struct FdEntry {
- _Atomic(uint64_t) close_tag = {0};
-};
-
-struct FdTableOverflow {
- size_t len = 0;
- FdEntry entries[0];
-};
-
-template <size_t inline_fds>
-struct FdTableImpl {
- constexpr FdTableImpl() {}
-
- uint32_t version = 0; // currently 0, and hopefully it'll stay that way.
- _Atomic(android_fdsan_error_level) error_level = {ANDROID_FDSAN_ERROR_LEVEL_DISABLED};
-
- FdEntry entries[inline_fds];
- _Atomic(FdTableOverflow*) overflow = {nullptr};
-
- FdEntry* at(size_t idx);
-};
-
-using FdTable = FdTableImpl<128>;
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_fortify.h
^
|
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <poll.h> // For struct pollfd.
-#include <stdarg.h>
-#include <stdlib.h>
-#include <sys/select.h> // For struct fd_set.
-
-#include <async_safe/log.h>
-
-static inline __noreturn void __fortify_fatal(const char* fmt, ...) {
- va_list args;
- va_start(args, fmt);
- async_safe_fatal_va_list("FORTIFY", fmt, args);
- va_end(args);
- abort();
-}
-
-//
-// Common helpers.
-//
-
-static inline void __check_fd_set(const char* fn, int fd, size_t set_size) {
- if (__predict_false(fd < 0)) {
- __fortify_fatal("%s: file descriptor %d < 0", fn, fd);
- }
- if (__predict_false(fd >= FD_SETSIZE)) {
- __fortify_fatal("%s: file descriptor %d >= FD_SETSIZE %zu", fn, fd, FD_SETSIZE);
- }
- if (__predict_false(set_size < sizeof(fd_set))) {
- __fortify_fatal("%s: set size %zu is too small to be an fd_set", fn, set_size);
- }
-}
-
-static inline void __check_pollfd_array(const char* fn, size_t fds_size, nfds_t fd_count) {
- size_t pollfd_array_length = fds_size / sizeof(pollfd);
- if (__predict_false(pollfd_array_length < fd_count)) {
- __fortify_fatal("%s: %zu-element pollfd array too small for %u fds",
- fn, pollfd_array_length, fd_count);
- }
-}
-
-static inline void __check_count(const char* fn, const char* identifier, size_t value) {
- if (__predict_false(value > SSIZE_MAX)) {
- __fortify_fatal("%s: %s %zu > SSIZE_MAX", fn, identifier, value);
- }
-}
-
-static inline void __check_buffer_access(const char* fn, const char* action,
- size_t claim, size_t actual) {
- if (__predict_false(claim > actual)) {
- __fortify_fatal("%s: prevented %zu-byte %s %zu-byte buffer", fn, claim, action, actual);
- }
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_futex.h
^
|
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _BIONIC_FUTEX_H
-#define _BIONIC_FUTEX_H
-
-#include <errno.h>
-#include <linux/futex.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <sys/cdefs.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-
-struct timespec;
-
-static inline int __futex(volatile void* ftx, int op, int value,
- const timespec* timeout, int bitset) {
- // Our generated syscall assembler sets errno, but our callers (pthread functions) don't want to.
- int saved_errno = errno;
- int result = syscall(__NR_futex, ftx, op, value, timeout, NULL, bitset);
- if ((result == -1)) {
- result = -errno;
- errno = saved_errno;
- }
- return result;
-}
-
-static inline int __futex_wake(volatile void* ftx, int count) {
- return __futex(ftx, FUTEX_WAKE, count, nullptr, 0);
-}
-
-static inline int __futex_wake_ex(volatile void* ftx, bool shared, int count) {
- return __futex(ftx, shared ? FUTEX_WAKE : FUTEX_WAKE_PRIVATE, count, nullptr, 0);
-}
-
-static inline int __futex_wait(volatile void* ftx, int value, const timespec* timeout) {
- return __futex(ftx, FUTEX_WAIT, value, timeout, 0);
-}
-
-static inline int __futex_wait_ex(volatile void* ftx, bool shared, int value) {
- return __futex(ftx, (shared ? FUTEX_WAIT_BITSET : FUTEX_WAIT_BITSET_PRIVATE), value, nullptr,
- FUTEX_BITSET_MATCH_ANY);
-}
-
-__LIBC_HIDDEN__ int __futex_wait_ex(volatile void* ftx, bool shared, int value,
- bool use_realtime_clock, const timespec* abs_timeout);
-
-static inline int __futex_pi_unlock(volatile void* ftx, bool shared) {
- return __futex(ftx, shared ? FUTEX_UNLOCK_PI : FUTEX_UNLOCK_PI_PRIVATE, 0, nullptr, 0);
-}
-
-__LIBC_HIDDEN__ int __futex_pi_lock_ex(volatile void* ftx, bool shared, bool use_realtime_clock,
- const timespec* abs_timeout);
-
-#endif /* _BIONIC_FUTEX_H */
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_globals.h
^
|
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _PRIVATE_BIONIC_GLOBALS_H
-#define _PRIVATE_BIONIC_GLOBALS_H
-
-#include <stdatomic.h>
-#include <sys/cdefs.h>
-#include <link.h>
-#include <pthread.h>
-
-#include "private/bionic_allocator.h"
-#include "private/bionic_elf_tls.h"
-#include "private/bionic_fdsan.h"
-#include "private/bionic_malloc_dispatch.h"
-#include "private/bionic_vdso.h"
-#include "private/WriteProtected.h"
-
-struct libc_globals {
- vdso_entry vdso[VDSO_END];
- long setjmp_cookie;
-
- // In order to allow a complete switch between dispatch tables without
- // the need for copying each function by function in the structure,
- // use a single atomic pointer to switch.
- // The current_dispatch_table pointer can only ever be set to a complete
- // table. Any dispatch table that is pointed to by current_dispatch_table
- // cannot be modified after that. If the pointer changes in the future,
- // the old pointer must always stay valid.
- // The malloc_dispatch_table is modified by malloc debug, malloc hooks,
- // and heaprofd. Only one of these modes can be active at any given time.
- _Atomic(const MallocDispatch*) current_dispatch_table;
- // This pointer is only used by the allocation limit code when both a
- // limit is enabled and some other hook is enabled at the same time.
- _Atomic(const MallocDispatch*) default_dispatch_table;
- MallocDispatch malloc_dispatch_table;
-};
-
-__LIBC_HIDDEN__ extern WriteProtected<libc_globals> __libc_globals;
-
-struct abort_msg_t;
-
-// Globals shared between the dynamic linker and libc.so.
-struct libc_shared_globals {
- // Construct the shared globals using a constexpr constructor to ensure that
- // the object doesn't need dynamic initialization. The object is accessed
- // before the dynamic linker has relocated itself.
- constexpr libc_shared_globals() {}
-
- FdTable fd_table;
-
- // When the linker is invoked on a binary (e.g. `linker64 /system/bin/date`),
- // record the number of arguments passed to the linker itself rather than to
- // the program it's loading. Typically 0, sometimes 1.
- int initial_linker_arg_count = 0;
-
- ElfW(auxv_t)* auxv = nullptr;
-
- pthread_mutex_t abort_msg_lock = PTHREAD_MUTEX_INITIALIZER;
- abort_msg_t* abort_msg = nullptr;
-
- StaticTlsLayout static_tls_layout;
- TlsModules tls_modules;
- BionicAllocator tls_allocator;
-
- // Values passed from the linker to libc.so.
- const char* init_progname = nullptr;
- char** init_environ = nullptr;
-};
-
-__LIBC_HIDDEN__ libc_shared_globals* __libc_shared_globals();
-__LIBC_HIDDEN__ void __libc_init_fdsan();
-
-__LIBC_HIDDEN__ void __libc_init_malloc(libc_globals* globals);
-__LIBC_HIDDEN__ void __libc_init_setjmp_cookie(libc_globals* globals);
-__LIBC_HIDDEN__ void __libc_init_vdso(libc_globals* globals);
-
-#if defined(__i386__)
-__LIBC_HIDDEN__ extern void* __libc_sysinfo;
-__LIBC_HIDDEN__ void __libc_int0x80();
-__LIBC_HIDDEN__ void __libc_init_sysinfo();
-#endif
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_ieee.h
^
|
@@ -1,118 +0,0 @@
-/* $OpenBSD: ieee.h,v 1.4 2011/11/08 17:06:51 deraadt Exp $ */
-/* $NetBSD: ieee.h,v 1.2 2001/02/21 17:43:50 bjh21 Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ieee.h 8.1 (Berkeley) 6/11/93
- */
-
-#ifndef _MACHINE_IEEE_H_
-#define _MACHINE_IEEE_H_
-
-#include <sys/types.h>
-
-__BEGIN_DECLS
-
-#define SNG_EXPBITS 8
-#define SNG_FRACBITS 23
-
-#define SNG_EXP_INFNAN 255
-#define SNG_EXP_BIAS 127
-
-struct ieee_single {
- unsigned sng_frac:23;
- unsigned sng_exp:8;
- unsigned sng_sign:1;
-};
-
-#define DBL_EXPBITS 11
-#define DBL_FRACHBITS 20
-#define DBL_FRACLBITS 32
-#define DBL_FRACBITS 52
-
-#define DBL_EXP_INFNAN 2047
-#define DBL_EXP_BIAS 1023
-
-struct ieee_double {
- unsigned dbl_fracl;
- unsigned dbl_frach:20;
- unsigned dbl_exp:11;
- unsigned dbl_sign:1;
-};
-
-#if defined(__LP64__)
-
-/* 64-bit Android uses ld128 long doubles. */
-
-#define EXT_EXPBITS 15
-#define EXT_FRACHBITS 16
-#define EXT_FRACHMBITS 32
-#define EXT_FRACLMBITS 32
-#define EXT_FRACLBITS 32
-#define EXT_FRACBITS 112
-
-#define EXT_EXP_INFNAN 32767
-#define EXT_EXP_BIAS 16383
-
-#define EXT_IMPLICIT_NBIT
-
-#define EXT_TO_ARRAY32(p, a) do { \
- (a)[0] = (uint32_t)(p)->ext_fracl; \
- (a)[1] = (uint32_t)(p)->ext_fraclm; \
- (a)[2] = (uint32_t)(p)->ext_frachm; \
- (a)[3] = (uint32_t)(p)->ext_frach; \
-} while(0)
-
-struct ieee_ext {
- unsigned ext_fracl;
- unsigned ext_fraclm;
- unsigned ext_frachm;
- unsigned ext_frach:16;
- unsigned ext_exp:15;
- unsigned ext_sign:1;
-};
-
-#endif
-
-__END_DECLS
-
-#endif /* _MACHINE_IEEE_H_ */
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_inline_raise.h
^
|
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-#include <sys/syscall.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-// An inline version of pthread_sigqueue(pthread_self(), ...), to reduce the number of
-// uninteresting stack frames at the top of a crash.
-static inline __always_inline void inline_raise(int sig, void* value = nullptr) {
- // Protect ourselves against stale cached PID/TID values by fetching them via syscall.
- // http://b/37769298
- pid_t pid = syscall(__NR_getpid);
- pid_t tid = syscall(__NR_gettid);
- siginfo_t info = {};
- info.si_code = SI_QUEUE;
- info.si_pid = pid;
- info.si_uid = getuid();
- info.si_value.sival_ptr = value;
-
-#if defined(__arm__)
- register long r0 __asm__("r0") = pid;
- register long r1 __asm__("r1") = tid;
- register long r2 __asm__("r2") = sig;
- register long r3 __asm__("r3") = reinterpret_cast<long>(&info);
- register long r7 __asm__("r7") = __NR_rt_tgsigqueueinfo;
- __asm__("swi #0" : "=r"(r0) : "r"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r7) : "memory");
-#elif defined(__aarch64__)
- register long x0 __asm__("x0") = pid;
- register long x1 __asm__("x1") = tid;
- register long x2 __asm__("x2") = sig;
- register long x3 __asm__("x3") = reinterpret_cast<long>(&info);
- register long x8 __asm__("x8") = __NR_rt_tgsigqueueinfo;
- __asm__("svc #0" : "=r"(x0) : "r"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x8) : "memory");
-#else
- syscall(__NR_rt_tgsigqueueinfo, pid, tid, sig, &info);
-#endif
-}
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_lock.h
^
|
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <stdatomic.h>
-#include "private/bionic_futex.h"
-#include "private/bionic_macros.h"
-
-// Lock is used in places like pthread_rwlock_t, which can be initialized without calling
-// an initialization function. So make sure Lock can be initialized by setting its memory to 0.
-class Lock {
- private:
- enum LockState {
- Unlocked = 0,
- LockedWithoutWaiter,
- LockedWithWaiter,
- };
- _Atomic(LockState) state;
- bool process_shared;
-
- public:
- void init(bool process_shared) {
- atomic_init(&state, Unlocked);
- this->process_shared = process_shared;
- }
-
- bool trylock() {
- LockState old_state = Unlocked;
- return (atomic_compare_exchange_strong_explicit(&state, &old_state,
- LockedWithoutWaiter, memory_order_acquire, memory_order_relaxed));
- }
-
- void lock() {
- LockState old_state = Unlocked;
- if ((atomic_compare_exchange_strong_explicit(&state, &old_state,
- LockedWithoutWaiter, memory_order_acquire, memory_order_relaxed))) {
- return;
- }
- while (atomic_exchange_explicit(&state, LockedWithWaiter, memory_order_acquire) != Unlocked) {
- // TODO: As the critical section is brief, it is a better choice to spin a few times befor sleeping.
- __futex_wait_ex(&state, process_shared, LockedWithWaiter);
- }
- return;
- }
-
- void unlock() {
- bool shared = process_shared; /* cache to local variable */
- if (atomic_exchange_explicit(&state, Unlocked, memory_order_release) == LockedWithWaiter) {
- __futex_wake_ex(&state, shared, 1);
- }
- }
-};
-
-class LockGuard {
- public:
- explicit LockGuard(Lock& lock) : lock_(lock) {
- lock_.lock();
- }
- ~LockGuard() {
- lock_.unlock();
- }
-
- BIONIC_DISALLOW_COPY_AND_ASSIGN(LockGuard);
-
- private:
- Lock& lock_;
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_macros.h
^
|
@@ -1,89 +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.
- */
-
-#pragma once
-
-#include <stdint.h>
-
-#define BIONIC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&) = delete; \
- void operator=(const TypeName&) = delete
-
-#define BIONIC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
- TypeName() = delete; \
- BIONIC_DISALLOW_COPY_AND_ASSIGN(TypeName)
-
-#define BIONIC_ROUND_UP_POWER_OF_2(value) \
- ((sizeof(value) == 8) \
- ? (1UL << (64 - __builtin_clzl(static_cast<unsigned long>(value)))) \
- : (1UL << (32 - __builtin_clz(static_cast<unsigned int>(value)))))
-
-static constexpr uintptr_t align_down(uintptr_t p, size_t align) {
- return p & ~(align - 1);
-}
-
-static constexpr uintptr_t align_up(uintptr_t p, size_t align) {
- return (p + align - 1) & ~(align - 1);
-}
-
-template <typename T>
-static inline T* align_down(T* p, size_t align) {
- return reinterpret_cast<T*>(align_down(reinterpret_cast<uintptr_t>(p), align));
-}
-
-template <typename T>
-static inline T* align_up(T* p, size_t align) {
- return reinterpret_cast<T*>(align_up(reinterpret_cast<uintptr_t>(p), align));
-}
-
-#if defined(__arm__)
-// Do not emit anything for arm, clang does not allow emiting an arm unwind
-// directive.
-// #define BIONIC_STOP_UNWIND asm volatile(".cantunwind")
-#define BIONIC_STOP_UNWIND
-#elif defined(__aarch64__)
-#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined x30")
-#elif defined(__i386__)
-#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined \%eip")
-#elif defined(__x86_64__)
-#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined \%rip")
-#elif defined (__mips__)
-#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined $ra")
-#endif
-
-// The arraysize(arr) macro returns the # of elements in an array arr.
-// The expression is a compile-time constant, and therefore can be
-// used in defining new arrays, for example. If you use arraysize on
-// a pointer by mistake, you will get a compile-time error.
-//
-// One caveat is that arraysize() doesn't accept any array of an
-// anonymous type or a type defined inside a function.
-//
-// This template function declaration is used in defining arraysize.
-// Note that the function doesn't need an implementation, as we only
-// use its type.
-template <typename T, size_t N>
-char (&ArraySizeHelper(T (&array)[N]))[N]; // NOLINT(readability/casting)
-
-#define arraysize(array) (sizeof(ArraySizeHelper(array)))
-
-// Used to inform clang's -Wimplicit-fallthrough that a fallthrough is intended. There's no way to
-// silence (or enable, apparently) -Wimplicit-fallthrough in C yet.
-#ifdef __cplusplus
-#define __BIONIC_FALLTHROUGH [[clang::fallthrough]]
-#else
-#define __BIONIC_FALLTHROUGH
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_malloc.h
^
|
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <stdbool.h>
-
-// Structures for android_mallopt.
-
-typedef struct {
- // Pointer to the buffer allocated by a call to M_GET_MALLOC_LEAK_INFO.
- uint8_t* buffer;
- // The size of the "info" buffer.
- size_t overall_size;
- // The size of a single entry.
- size_t info_size;
- // The sum of all allocations that have been tracked. Does not include
- // any heap overhead.
- size_t total_memory;
- // The maximum number of backtrace entries.
- size_t backtrace_size;
-} android_mallopt_leak_info_t;
-
-// Opcodes for android_mallopt.
-
-enum {
- // Marks the calling process as a profileable zygote child, possibly
- // initializing profiling infrastructure.
- M_INIT_ZYGOTE_CHILD_PROFILING = 1,
-#define M_INIT_ZYGOTE_CHILD_PROFILING M_INIT_ZYGOTE_CHILD_PROFILING
- M_RESET_HOOKS = 2,
-#define M_RESET_HOOKS M_RESET_HOOKS
- // Set an upper bound on the total size in bytes of all allocations made
- // using the memory allocation APIs.
- // arg = size_t*
- // arg_size = sizeof(size_t)
- M_SET_ALLOCATION_LIMIT_BYTES = 3,
-#define M_SET_ALLOCATION_LIMIT_BYTES M_SET_ALLOCATION_LIMIT_BYTES
- // Called after the zygote forks to indicate this is a child.
- M_SET_ZYGOTE_CHILD = 4,
-#define M_SET_ZYGOTE_CHILD M_SET_ZYGOTE_CHILD
-
- // Options to dump backtraces of allocations. These options only
- // work when malloc debug has been enabled.
-
- // Writes the backtrace information of all current allocations to a file.
- // NOTE: arg_size has to be sizeof(FILE*) because FILE is an opaque type.
- // arg = FILE*
- // arg_size = sizeof(FILE*)
- M_WRITE_MALLOC_LEAK_INFO_TO_FILE = 5,
-#define M_WRITE_MALLOC_LEAK_INFO_TO_FILE M_WRITE_MALLOC_LEAK_INFO_TO_FILE
- // Get information about the backtraces of all
- // arg = android_mallopt_leak_info_t*
- // arg_size = sizeof(android_mallopt_leak_info_t)
- M_GET_MALLOC_LEAK_INFO = 6,
-#define M_GET_MALLOC_LEAK_INFO M_GET_MALLOC_LEAK_INFO
- // Free the memory allocated and returned by M_GET_MALLOC_LEAK_INFO.
- // arg = android_mallopt_leak_info_t*
- // arg_size = sizeof(android_mallopt_leak_info_t)
- M_FREE_MALLOC_LEAK_INFO = 7,
-#define M_FREE_MALLOC_LEAK_INFO M_FREE_MALLOC_LEAK_INFO
-};
-
-// Manipulates bionic-specific handling of memory allocation APIs such as
-// malloc. Only for use by the Android platform itself.
-//
-// On success, returns true. On failure, returns false and sets errno.
-extern "C" bool android_mallopt(int opcode, void* arg, size_t arg_size);
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_malloc_dispatch.h
^
|
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _PRIVATE_BIONIC_MALLOC_DISPATCH_H
-#define _PRIVATE_BIONIC_MALLOC_DISPATCH_H
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <private/bionic_config.h>
-
-// Entry in malloc dispatch table.
-typedef void* (*MallocCalloc)(size_t, size_t);
-typedef void (*MallocFree)(void*);
-typedef struct mallinfo (*MallocMallinfo)();
-typedef void* (*MallocMalloc)(size_t);
-typedef int (*MallocMallocInfo)(int, FILE*);
-typedef size_t (*MallocMallocUsableSize)(const void*);
-typedef void* (*MallocMemalign)(size_t, size_t);
-typedef int (*MallocPosixMemalign)(void**, size_t, size_t);
-typedef void* (*MallocRealloc)(void*, size_t);
-typedef int (*MallocIterate)(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
-typedef void (*MallocMallocDisable)();
-typedef void (*MallocMallocEnable)();
-typedef int (*MallocMallopt)(int, int);
-typedef void* (*MallocAlignedAlloc)(size_t, size_t);
-
-#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
-typedef void* (*MallocPvalloc)(size_t);
-typedef void* (*MallocValloc)(size_t);
-#endif
-
-struct MallocDispatch {
- MallocCalloc calloc;
- MallocFree free;
- MallocMallinfo mallinfo;
- MallocMalloc malloc;
- MallocMallocUsableSize malloc_usable_size;
- MallocMemalign memalign;
- MallocPosixMemalign posix_memalign;
-#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
- MallocPvalloc pvalloc;
-#endif
- MallocRealloc realloc;
-#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
- MallocValloc valloc;
-#endif
- MallocIterate iterate;
- MallocMallocDisable malloc_disable;
- MallocMallocEnable malloc_enable;
- MallocMallopt mallopt;
- MallocAlignedAlloc aligned_alloc;
- MallocMallocInfo malloc_info;
-} __attribute__((aligned(32)));
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_mbstate.h
^
|
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _BIONIC_MBSTATE_H
-#define _BIONIC_MBSTATE_H
-
-#include <errno.h>
-#include <wchar.h>
-
-__BEGIN_DECLS
-
-/*
- * These return values are specified by POSIX for multibyte conversion
- * functions.
- */
-#define __MB_ERR_ILLEGAL_SEQUENCE static_cast<size_t>(-1)
-#define __MB_ERR_INCOMPLETE_SEQUENCE static_cast<size_t>(-2)
-
-#define __MB_IS_ERR(rv) (rv == __MB_ERR_ILLEGAL_SEQUENCE || \
- rv == __MB_ERR_INCOMPLETE_SEQUENCE)
-
-static inline __wur size_t mbstate_bytes_so_far(const mbstate_t* ps) {
- return
- (ps->__seq[2] != 0) ? 3 :
- (ps->__seq[1] != 0) ? 2 :
- (ps->__seq[0] != 0) ? 1 : 0;
-}
-
-static inline void mbstate_set_byte(mbstate_t* ps, int i, char byte) {
- ps->__seq[i] = static_cast<uint8_t>(byte);
-}
-
-static inline __wur uint8_t mbstate_get_byte(const mbstate_t* ps, int n) {
- return ps->__seq[n];
-}
-
-static inline __wur size_t mbstate_reset_and_return_illegal(int _errno, mbstate_t* ps) {
- errno = _errno;
- *(reinterpret_cast<uint32_t*>(ps->__seq)) = 0;
- return __MB_ERR_ILLEGAL_SEQUENCE;
-}
-
-static inline __wur size_t mbstate_reset_and_return(int _return, mbstate_t* ps) {
- *(reinterpret_cast<uint32_t*>(ps->__seq)) = 0;
- return _return;
-}
-
-__END_DECLS
-
-#endif // _BIONIC_MBSTATE_H
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_page.h
^
|
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _BIONIC_PAGE_H_
-#define _BIONIC_PAGE_H_
-
-// Get PAGE_SIZE and PAGE_MASK.
-#include <sys/user.h>
-
-// Returns the address of the page containing address 'x'.
-#define PAGE_START(x) ((x) & PAGE_MASK)
-
-// Returns the offset of address 'x' in its page.
-#define PAGE_OFFSET(x) ((x) & ~PAGE_MASK)
-
-// Returns the address of the next page after address 'x', unless 'x' is
-// itself at the start of a page.
-#define PAGE_END(x) PAGE_START((x) + (PAGE_SIZE-1))
-
-#endif // _BIONIC_PAGE_H_
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_prctl.h
^
|
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef BIONIC_PRCTL_H
-#define BIONIC_PRCTL_H
-
-#include <sys/prctl.h>
-
-// This is only supported by Android kernels, so it's not in the uapi headers.
-#define PR_SET_VMA 0x53564d41
-#define PR_SET_VMA_ANON_NAME 0
-
-#endif // BIONIC_PRCTL_H
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_sdk_version.h
^
|
@@ -1,24 +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 _BIONIC_SDK_VERSION_H_
-#define _BIONIC_SDK_VERSION_H_
-
-#include <stdint.h>
-
-uint32_t bionic_get_application_target_sdk_version();
-
-#endif // _BIONIC_SDK_VERSION_H_
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_sigdefs.h
^
|
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * this header is used to define signal constants and names;
- * it might be included several times
- */
-
-#ifndef __BIONIC_SIGDEF
-#error __BIONIC_SIGDEF not defined
-#endif
-
-__BIONIC_SIGDEF(SIGHUP, "Hangup")
-__BIONIC_SIGDEF(SIGINT, "Interrupt")
-__BIONIC_SIGDEF(SIGQUIT, "Quit")
-__BIONIC_SIGDEF(SIGILL, "Illegal instruction")
-__BIONIC_SIGDEF(SIGTRAP, "Trap")
-__BIONIC_SIGDEF(SIGABRT, "Aborted")
-#ifdef SIGEMT
-__BIONIC_SIGDEF(SIGEMT, "EMT")
-#endif
-__BIONIC_SIGDEF(SIGFPE, "Floating point exception")
-__BIONIC_SIGDEF(SIGKILL, "Killed")
-__BIONIC_SIGDEF(SIGBUS, "Bus error")
-__BIONIC_SIGDEF(SIGSEGV, "Segmentation fault")
-__BIONIC_SIGDEF(SIGPIPE, "Broken pipe")
-__BIONIC_SIGDEF(SIGALRM, "Alarm clock")
-__BIONIC_SIGDEF(SIGTERM, "Terminated")
-__BIONIC_SIGDEF(SIGUSR1, "User signal 1")
-__BIONIC_SIGDEF(SIGUSR2, "User signal 2")
-__BIONIC_SIGDEF(SIGCHLD, "Child exited")
-__BIONIC_SIGDEF(SIGPWR, "Power failure")
-__BIONIC_SIGDEF(SIGWINCH, "Window size changed")
-__BIONIC_SIGDEF(SIGURG, "Urgent I/O condition")
-__BIONIC_SIGDEF(SIGIO, "I/O possible")
-__BIONIC_SIGDEF(SIGSTOP, "Stopped (signal)")
-__BIONIC_SIGDEF(SIGTSTP, "Stopped")
-__BIONIC_SIGDEF(SIGCONT, "Continue")
-__BIONIC_SIGDEF(SIGTTIN, "Stopped (tty input)")
-__BIONIC_SIGDEF(SIGTTOU, "Stopped (tty output)")
-__BIONIC_SIGDEF(SIGVTALRM, "Virtual timer expired")
-__BIONIC_SIGDEF(SIGPROF, "Profiling timer expired")
-__BIONIC_SIGDEF(SIGXCPU, "CPU time limit exceeded")
-__BIONIC_SIGDEF(SIGXFSZ, "File size limit exceeded")
-#if defined(SIGSTKFLT)
-__BIONIC_SIGDEF(SIGSTKFLT, "Stack fault")
-#endif
-__BIONIC_SIGDEF(SIGSYS, "Bad system call")
-
-#undef __BIONIC_SIGDEF
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_ssp.h
^
|
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _PRIVATE_SSP_H
-#define _PRIVATE_SSP_H
-
-#include <stdint.h>
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-
-/* GCC uses this on ARM and MIPS; we use it on x86 to set the guard in TLS. */
-extern uintptr_t __stack_chk_guard;
-
-/* GCC calls this if a stack guard check fails. */
-extern void __stack_chk_fail();
-
-__END_DECLS
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_string_utils.h
^
|
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _BIONIC_STRING_UTILS_H_
-#define _BIONIC_STRING_UTILS_H_
-
-#include <string.h>
-
-static inline bool ends_with(const char* s1, const char* s2) {
- size_t s1_length = strlen(s1);
- size_t s2_length = strlen(s2);
- if (s2_length > s1_length) {
- return false;
- }
- return memcmp(s1 + (s1_length - s2_length), s2, s2_length) == 0;
-}
-
-#endif // _BIONIC_STRING_UTILS_H_
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_systrace.h
^
|
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <sys/cdefs-android.h>
-#include "bionic_macros.h"
-
-// Tracing class for bionic. To begin a trace at a specified point:
-// ScopedTrace("Trace message");
-// The trace will end when the contructor goes out of scope.
-
-class __LIBC_HIDDEN__ ScopedTrace {
- public:
- explicit ScopedTrace(const char* message) {};
- ~ScopedTrace() {};
-
- void End() {};
- private:
- bool called_end_;
- BIONIC_DISALLOW_COPY_AND_ASSIGN(ScopedTrace);
-};
-
-static inline void bionic_trace_begin(const char* message) {};
-static inline void bionic_trace_end() {};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_time_conversions.h
^
|
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _BIONIC_TIME_CONVERSIONS_H
-#define _BIONIC_TIME_CONVERSIONS_H
-
-#include <errno.h>
-#include <time.h>
-#include <sys/cdefs.h>
-
-#include "private/bionic_constants.h"
-
-__BEGIN_DECLS
-
-__LIBC_HIDDEN__ bool timespec_from_timeval(timespec& ts, const timeval& tv);
-__LIBC_HIDDEN__ void timespec_from_ms(timespec& ts, const int ms);
-
-__LIBC_HIDDEN__ void timeval_from_timespec(timeval& tv, const timespec& ts);
-
-__LIBC_HIDDEN__ void monotonic_time_from_realtime_time(timespec& monotonic_time,
- const timespec& realtime_time);
-
-__END_DECLS
-
-static inline int check_timespec(const timespec* ts, bool null_allowed) {
- if (null_allowed && ts == nullptr) {
- return 0;
- }
- // glibc just segfaults if you pass a null timespec.
- // That seems a lot more likely to catch bad code than returning EINVAL.
- if (ts->tv_nsec < 0 || ts->tv_nsec >= NS_PER_S) {
- return EINVAL;
- }
- if (ts->tv_sec < 0) {
- return ETIMEDOUT;
- }
- return 0;
-}
-
-#if !defined(__LP64__)
-static inline void absolute_timespec_from_timespec(timespec& abs_ts, const timespec& ts, clockid_t clock) {
- clock_gettime(clock, &abs_ts);
- abs_ts.tv_sec += ts.tv_sec;
- abs_ts.tv_nsec += ts.tv_nsec;
- if (abs_ts.tv_nsec >= NS_PER_S) {
- abs_ts.tv_nsec -= NS_PER_S;
- abs_ts.tv_sec++;
- }
-}
-#endif
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_tls.h
^
|
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <locale.h>
-#include <mntent.h>
-#include <stdio.h>
-#include <sys/cdefs.h>
-#include <sys/param.h>
-
-#include "bionic_asm_tls.h"
-#include "bionic_macros.h"
-#include "__get_tls.h"
-#include "grp_pwd.h"
-
-/** WARNING WARNING WARNING
- **
- ** This header file is *NOT* part of the public Bionic ABI/API and should not
- ** be used/included by user-serviceable parts of the system (e.g.
- ** applications).
- **/
-
-class pthread_internal_t;
-
-// This struct is small, so the linker can allocate a temporary copy on its
-// stack. It can't be combined with pthread_internal_t because:
-// - native bridge requires pthread_internal_t to have the same layout across
-// architectures, and
-// - On x86, this struct would have to be placed at the front of
-// pthread_internal_t, moving fields like `tid`.
-// - We'd like to avoid having a temporary pthread_internal_t object that
-// needs to be transferred once the final size of static TLS is known.
-struct bionic_tcb {
- void* raw_slots_storage[BIONIC_TLS_SLOTS];
-
- // Return a reference to a slot given its TP-relative TLS_SLOT_xxx index.
- // The thread pointer (i.e. __get_tls()) points at &tls_slot(0).
- void*& tls_slot(size_t tpindex) {
- return raw_slots_storage[tpindex - MIN_TLS_SLOT];
- }
-
- // Initialize the main thread's final object using its bootstrap object.
- void copy_from_bootstrap(const bionic_tcb* boot) {
- // Copy everything. Problematic slots will be reinitialized.
- *this = *boot;
- }
-
- pthread_internal_t* thread() {
- return static_cast<pthread_internal_t*>(tls_slot(TLS_SLOT_THREAD_ID));
- }
-};
-
-/*
- * Bionic uses some pthread keys internally. All pthread keys used internally
- * should be created in constructors, except for keys that may be used in or
- * before constructors.
- *
- * We need to manually maintain the count of pthread keys used internally, but
- * pthread_test should fail if we forget.
- *
- * These are the pthread keys currently used internally by libc:
- * _res_key libc (constructor in BSD code)
- */
-
-#define LIBC_PTHREAD_KEY_RESERVED_COUNT 1
-
-/* Internally, jemalloc uses a single key for per thread data. */
-#define JEMALLOC_PTHREAD_KEY_RESERVED_COUNT 1
-#define BIONIC_PTHREAD_KEY_RESERVED_COUNT (LIBC_PTHREAD_KEY_RESERVED_COUNT + JEMALLOC_PTHREAD_KEY_RESERVED_COUNT)
-
-/*
- * Maximum number of pthread keys allocated.
- * This includes pthread keys used internally and externally.
- */
-#define BIONIC_PTHREAD_KEY_COUNT (BIONIC_PTHREAD_KEY_RESERVED_COUNT + PTHREAD_KEYS_MAX)
-
-class pthread_key_data_t {
- public:
- uintptr_t seq; // Use uintptr_t just for alignment, as we use pointer below.
- void* data;
-};
-
-// ~3 pages. This struct is allocated as static TLS memory (i.e. at a fixed
-// offset from the thread pointer).
-struct bionic_tls {
- pthread_key_data_t key_data[BIONIC_PTHREAD_KEY_COUNT];
-
- locale_t locale;
-
- char basename_buf[MAXPATHLEN];
- char dirname_buf[MAXPATHLEN];
-
- mntent mntent_buf;
- char mntent_strings[BUFSIZ];
-
- char ptsname_buf[32];
- char ttyname_buf[64];
-
- char strerror_buf[NL_TEXTMAX];
- char strsignal_buf[NL_TEXTMAX];
-
- group_state_t group;
- passwd_state_t passwd;
-
- // Initialize the main thread's final object using its bootstrap object.
- void copy_from_bootstrap(const bionic_tls* boot __attribute__((unused))) {
- // Nothing in bionic_tls needs to be preserved in the transition to the
- // final TLS objects, so don't copy anything.
- }
-};
-
-class KernelArgumentBlock;
-extern "C" void __libc_init_main_thread_early(const KernelArgumentBlock& args, bionic_tcb* temp_tcb);
-extern "C" void __libc_init_main_thread_late();
-extern "C" void __libc_init_main_thread_final();
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/bionic_vdso.h
^
|
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _PRIVATE_BIONIC_VDSO_H
-#define _PRIVATE_BIONIC_VDSO_H
-
-#include <time.h>
-
-#if defined(__aarch64__)
-#define VDSO_CLOCK_GETTIME_SYMBOL "__kernel_clock_gettime"
-#define VDSO_CLOCK_GETRES_SYMBOL "__kernel_clock_getres"
-#define VDSO_GETTIMEOFDAY_SYMBOL "__kernel_gettimeofday"
-#define VDSO_TIME_SYMBOL "__kernel_time"
-#else
-#define VDSO_CLOCK_GETTIME_SYMBOL "__vdso_clock_gettime"
-#define VDSO_CLOCK_GETRES_SYMBOL "__vdso_clock_getres"
-#define VDSO_GETTIMEOFDAY_SYMBOL "__vdso_gettimeofday"
-#define VDSO_TIME_SYMBOL "__vdso_time"
-#endif
-
-extern "C" int __clock_gettime(int, timespec*);
-extern "C" int __clock_getres(int, timespec*);
-extern "C" int __gettimeofday(timeval*, struct timezone*);
-
-struct vdso_entry {
- const char* name;
- void* fn;
-};
-
-enum {
- VDSO_CLOCK_GETTIME = 0,
- VDSO_CLOCK_GETRES,
- VDSO_GETTIMEOFDAY,
- VDSO_TIME,
- VDSO_END
-};
-
-#endif // _PRIVATE_BIONIC_VDSO_H
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/get_cpu_count_from_string.h
^
|
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <ctype.h>
-#include <stdlib.h>
-
-// Parse a string like: 0, 2-4, 6.
-static int GetCpuCountFromString(const char* s) {
- int cpu_count = 0;
- int last_cpu = -1;
- while (*s != '\0') {
- if (isdigit(*s)) {
- int cpu = static_cast<int>(strtol(s, const_cast<char**>(&s), 10));
- if (last_cpu != -1) {
- cpu_count += cpu - last_cpu;
- } else {
- cpu_count++;
- }
- last_cpu = cpu;
- } else {
- if (*s == ',') {
- last_cpu = -1;
- }
- s++;
- }
- }
- return cpu_count;
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/grp_pwd.h
^
|
@@ -1,50 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <grp.h>
-#include <pwd.h>
-
-static constexpr size_t kGrpPwdBufferSize = 32;
-
-struct group_state_t {
- group group_;
- char* group_members_[2];
- char group_name_buffer_[kGrpPwdBufferSize];
- // Must be last so init_group_state can run a simple memset for the above
- ssize_t getgrent_idx;
-};
-
-struct passwd_state_t {
- passwd passwd_;
- char name_buffer_[kGrpPwdBufferSize];
- char dir_buffer_[kGrpPwdBufferSize];
- char sh_buffer_[kGrpPwdBufferSize];
- ssize_t getpwent_idx;
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/icu.h
^
|
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _PRIVATE_ICU_H
-#define _PRIVATE_ICU_H
-
-#include <stdint.h>
-#include <wchar.h>
-
-typedef int8_t UBool;
-#define FALSE 0
-#define TRUE 1
-
-typedef int32_t UChar32;
-
-enum UProperty {
- UCHAR_ALPHABETIC = 0,
- UCHAR_DEFAULT_IGNORABLE_CODE_POINT = 5,
- UCHAR_LOWERCASE = 22,
- UCHAR_POSIX_ALNUM = 44,
- UCHAR_POSIX_BLANK = 45,
- UCHAR_POSIX_GRAPH = 46,
- UCHAR_POSIX_PRINT = 47,
- UCHAR_POSIX_XDIGIT = 48,
- UCHAR_UPPERCASE = 30,
- UCHAR_WHITE_SPACE = 31,
- UCHAR_EAST_ASIAN_WIDTH = 0x1004,
- UCHAR_HANGUL_SYLLABLE_TYPE = 0x100b,
-};
-
-enum UCharCategory {
- U_NON_SPACING_MARK = 6,
- U_ENCLOSING_MARK = 7,
- U_CONTROL_CHAR = 15,
- U_FORMAT_CHAR = 16,
-};
-
-enum UEastAsianWidth {
- U_EA_NEUTRAL,
- U_EA_AMBIGUOUS,
- U_EA_HALFWIDTH,
- U_EA_FULLWIDTH,
- U_EA_NARROW,
- U_EA_WIDE,
-};
-
-enum UHangulSyllableType {
- U_HST_NOT_APPLICABLE,
- U_HST_LEADING_JAMO,
- U_HST_VOWEL_JAMO,
- U_HST_TRAILING_JAMO,
- U_HST_LV_SYLLABLE,
- U_HST_LVT_SYLLABLE,
-};
-
-int8_t __icu_charType(wint_t wc);
-int32_t __icu_getIntPropertyValue(wint_t wc, UProperty property);
-bool __icu_hasBinaryProperty(wint_t wc, UProperty property, int (*fallback)(int));
-
-void* __find_icu_symbol(const char* symbol_name);
-
-#endif // _PRIVATE_ICU_H
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/kernel_sigset_t.h
^
|
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 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 LIBC_PRIVATE_KERNEL_SIGSET_T_H_
-#define LIBC_PRIVATE_KERNEL_SIGSET_T_H_
-
-#include <signal.h>
-
-// Our sigset_t is wrong for ARM and x86. It's 32-bit but the kernel expects 64 bits.
-// This means we can't support real-time signals correctly until we can change the ABI.
-// In the meantime, we can use this union to pass an appropriately-sized block of memory
-// to the kernel, at the cost of not being able to refer to real-time signals.
-union kernel_sigset_t {
- kernel_sigset_t() {
- clear();
- }
-
- kernel_sigset_t(const sigset_t* value) {
- clear();
- set(value);
- }
-
- void clear() {
- __builtin_memset(this, 0, sizeof(*this));
- }
-
- void set(const sigset_t* value) {
- bionic = *value;
- }
-
- sigset_t* get() {
- return &bionic;
- }
-
- sigset_t bionic;
-#ifndef __mips__
- uint32_t kernel[2];
-#endif
-};
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/linker_native_bridge.h
^
|
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-extern "C" void __linker_reserve_bionic_tls_in_static_tls();
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/sigrtmin.h
^
|
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-
-#include <signal.h>
-
-#include "bionic_macros.h"
-
-// Realtime signals reserved for internal use:
-// 32 (__SIGRTMIN + 0) POSIX timers
-// 33 (__SIGRTMIN + 1) libbacktrace
-// 34 (__SIGRTMIN + 2) libcore
-// 35 (__SIGRTMIN + 3) debuggerd -b
-// 36 (__SIGRTMIN + 4) heapprofd
-// 37 (__SIGRTMIN + 5) coverage (libprofile-extras)
-//
-// If you change this, also change __ndk_legacy___libc_current_sigrtmin
-// in <android/legacy_signal_inlines.h> to match.
-
-#define __SIGRT_RESERVED 6
-static inline __always_inline sigset64_t filter_reserved_signals(sigset64_t sigset, int how) {
- int (*block)(sigset64_t*, int);
- int (*unblock)(sigset64_t*, int);
- switch (how) {
- case SIG_BLOCK:
- __BIONIC_FALLTHROUGH;
- case SIG_SETMASK:
- block = sigaddset64;
- unblock = sigdelset64;
- break;
-
- case SIG_UNBLOCK:
- block = sigdelset64;
- unblock = sigaddset64;
- break;
- }
-
- // The POSIX timer signal must be blocked.
- block(&sigset, __SIGRTMIN + 0);
-
- // Everything else must remain unblocked.
- unblock(&sigset, __SIGRTMIN + 1);
- unblock(&sigset, __SIGRTMIN + 2);
- unblock(&sigset, __SIGRTMIN + 3);
- unblock(&sigset, __SIGRTMIN + 4);
- unblock(&sigset, __SIGRTMIN + 5);
- return sigset;
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/bionic/libc/private/thread_private.h
^
|
@@ -1,36 +0,0 @@
-/* $OpenBSD: thread_private.h,v 1.18 2006/02/22 07:16:31 otto Exp $ */
-
-/* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */
-
-#pragma once
-
-#include <pthread.h>
-
-__BEGIN_DECLS
-
-/*
- * This file defines the thread library interface to libc. Thread
- * libraries must implement the functions described here for proper
- * inter-operation with libc. libc contains weak versions of the
- * described functions for operation in a non-threaded environment.
- */
-
-#define __MUTEX_NAME(name) __CONCAT(__libc_mutex_,name)
-#define _THREAD_PRIVATE_MUTEX(name) static pthread_mutex_t __MUTEX_NAME(name) = PTHREAD_MUTEX_INITIALIZER
-#define _THREAD_PRIVATE_MUTEX_LOCK(name) pthread_mutex_lock(&__MUTEX_NAME(name))
-#define _THREAD_PRIVATE_MUTEX_UNLOCK(name) pthread_mutex_unlock(&__MUTEX_NAME(name))
-
-/* Note that these aren't compatible with the usual OpenBSD ones which lazy-initialize! */
-#define _MUTEX_LOCK(l) pthread_mutex_lock((pthread_mutex_t*) l)
-#define _MUTEX_UNLOCK(l) pthread_mutex_unlock((pthread_mutex_t*) l)
-
-__LIBC_HIDDEN__ void _thread_arc4_lock(void);
-__LIBC_HIDDEN__ void _thread_arc4_unlock(void);
-
-#define _ARC4_LOCK() _thread_arc4_lock()
-#define _ARC4_UNLOCK() _thread_arc4_unlock()
-#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
-
-extern volatile sig_atomic_t _rs_forked;
-
-__END_DECLS
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/dlfcn.cpp
^
|
@@ -1,460 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker.h"
-#include "linker_cfi.h"
-#include "linker_globals.h"
-#include "linker_dlwarning.h"
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <android/api-level.h>
-
-#include <bionic/pthread_internal.h>
-#include "private/bionic_globals.h"
-#include "private/bionic_tls.h"
-#include "private/ScopedPthreadMutexLocker.h"
-
-#define __LINKER_PUBLIC__ __attribute__((visibility("default")))
-
-extern "C" {
-
-android_namespace_t* __loader_android_create_namespace(const char* name,
- const char* ld_library_path,
- const char* default_library_path,
- uint64_t type,
- const char* permitted_when_isolated_path,
- android_namespace_t* parent_namespace,
- const void* caller_addr) __LINKER_PUBLIC__;
-void* __loader_android_dlopen_ext(const char* filename,
- int flags,
- const android_dlextinfo* extinfo,
- const void* caller_addr) __LINKER_PUBLIC__;
-void __loader_android_dlwarning(void* obj, void (*f)(void*, const char*)) __LINKER_PUBLIC__;
-int __loader_android_get_application_target_sdk_version() __LINKER_PUBLIC__;
-void __loader_android_get_LD_LIBRARY_PATH(char* buffer, size_t buffer_size) __LINKER_PUBLIC__;
-android_namespace_t* __loader_android_get_exported_namespace(const char* name) __LINKER_PUBLIC__;
-bool __loader_android_init_anonymous_namespace(const char* shared_libs_sonames,
- const char* library_search_path) __LINKER_PUBLIC__;
-bool __loader_android_link_namespaces(android_namespace_t* namespace_from,
- android_namespace_t* namespace_to,
- const char* shared_libs_sonames) __LINKER_PUBLIC__;
-bool __loader_android_link_namespaces_all_libs(android_namespace_t* namespace_from,
- android_namespace_t* namespace_to) __LINKER_PUBLIC__;
-void __loader_android_set_application_target_sdk_version(int target) __LINKER_PUBLIC__;
-void __loader_android_update_LD_LIBRARY_PATH(const char* ld_library_path) __LINKER_PUBLIC__;
-void __loader_cfi_fail(uint64_t CallSiteTypeId,
- void* Ptr,
- void *DiagData,
- void *CallerPc) __LINKER_PUBLIC__;
-int __loader_dl_iterate_phdr(int (*cb)(dl_phdr_info* info, size_t size, void* data),
- void* data) __LINKER_PUBLIC__;
-int __loader_dladdr(const void* addr, Dl_info* info) __LINKER_PUBLIC__;
-int __loader_dlclose(void* handle) __LINKER_PUBLIC__;
-char* __loader_dlerror() __LINKER_PUBLIC__;
-void* __loader_dlopen(const char* filename, int flags, const void* caller_addr) __LINKER_PUBLIC__;
-void* __loader_dlsym(void* handle, const char* symbol, const void* caller_addr) __LINKER_PUBLIC__;
-void* __loader_dlvsym(void* handle,
- const char* symbol,
- const char* version,
- const void* caller_addr) __LINKER_PUBLIC__;
-void __loader_add_thread_local_dtor(void* dso_handle) __LINKER_PUBLIC__;
-void __loader_remove_thread_local_dtor(void* dso_handle) __LINKER_PUBLIC__;
-libc_shared_globals* __loader_shared_globals() __LINKER_PUBLIC__;
-#if defined(__arm__)
-_Unwind_Ptr __loader_dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount) __LINKER_PUBLIC__;
-#endif
-}
-
-static pthread_mutex_t g_dl_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-
-static __thread char *dl_err_str;
-char __thread dlerror_buffer[__BIONIC_DLERROR_BUFFER_SIZE];
-
-static char* __bionic_set_dlerror(char* new_value) {
-#ifdef DISABLED_FOR_HYBRIS_SUPPORT
- char* old_value = __get_thread()->current_dlerror;
- __get_thread()->current_dlerror = new_value;
-
- if (new_value != nullptr) LD_LOG(kLogErrors, "dlerror set to \"%s\"", new_value);
- return old_value;
-#else
- char *old_value = dl_err_str;
- dl_err_str = new_value;
- return old_value;
-#endif
-}
-
-static void __bionic_format_dlerror(const char* msg, const char* detail) {
-#ifdef DISABLED_FOR_HYBRIS_SUPPORT
- char* buffer = __get_thread()->dlerror_buffer;
-#else
- char* buffer = dlerror_buffer;
-#endif
- strlcpy(buffer, msg, __BIONIC_DLERROR_BUFFER_SIZE);
- if (detail != nullptr) {
- strlcat(buffer, ": ", __BIONIC_DLERROR_BUFFER_SIZE);
- strlcat(buffer, detail, __BIONIC_DLERROR_BUFFER_SIZE);
- }
-
- __bionic_set_dlerror(buffer);
-}
-
-char* __loader_dlerror() {
- char* old_value = __bionic_set_dlerror(nullptr);
- return old_value;
-}
-
-void __loader_android_get_LD_LIBRARY_PATH(char* buffer, size_t buffer_size) {
- ScopedPthreadMutexLocker locker(&g_dl_mutex);
- do_android_get_LD_LIBRARY_PATH(buffer, buffer_size);
-}
-
-void __loader_android_update_LD_LIBRARY_PATH(const char* ld_library_path) {
- ScopedPthreadMutexLocker locker(&g_dl_mutex);
- do_android_update_LD_LIBRARY_PATH(ld_library_path);
-}
-
-static void* dlopen_ext(const char* filename,
- int flags,
- const android_dlextinfo* extinfo,
- const void* caller_addr) {
- ScopedPthreadMutexLocker locker(&g_dl_mutex);
- g_linker_logger.ResetState();
- void* result = do_dlopen(filename, flags, extinfo, caller_addr);
- if (result == nullptr) {
- __bionic_format_dlerror("dlopen failed", linker_get_error_buffer());
- return nullptr;
- }
- return result;
-}
-
-void* __loader_android_dlopen_ext(const char* filename,
- int flags,
- const android_dlextinfo* extinfo,
- const void* caller_addr) {
- return dlopen_ext(filename, flags, extinfo, caller_addr);
-}
-
-void* __loader_dlopen(const char* filename, int flags, const void* caller_addr) {
- return dlopen_ext(filename, flags, nullptr, caller_addr);
-}
-
-void* dlsym_impl(void* handle, const char* symbol, const char* version, const void* caller_addr) {
- ScopedPthreadMutexLocker locker(&g_dl_mutex);
- g_linker_logger.ResetState();
- void* result;
- if (!do_dlsym(handle, symbol, version, caller_addr, &result)) {
- __bionic_format_dlerror(linker_get_error_buffer(), nullptr);
- return nullptr;
- }
-
- return result;
-}
-
-void* __loader_dlsym(void* handle, const char* symbol, const void* caller_addr) {
- return dlsym_impl(handle, symbol, nullptr, caller_addr);
-}
-
-void* __loader_dlvsym(void* handle, const char* symbol, const char* version, const void* caller_addr) {
- return dlsym_impl(handle, symbol, version, caller_addr);
-}
-
-int __loader_dladdr(const void* addr, Dl_info* info) {
- ScopedPthreadMutexLocker locker(&g_dl_mutex);
- return do_dladdr(addr, info);
-}
-
-int __loader_dlclose(void* handle) {
- ScopedPthreadMutexLocker locker(&g_dl_mutex);
- int result = do_dlclose(handle);
- if (result != 0) {
- __bionic_format_dlerror("dlclose failed", linker_get_error_buffer());
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/hybris_compat.cpp
^
|
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "hybris_compat.h"
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/hybris_compat.h
^
|
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-
-#ifndef HYBRIS_ANDROID_MM_COMPAT_H_
-#define HYBRIS_ANDROID_MM_COMPAT_H_
-
-#include <string.h>
-#include <memory.h>
-
-extern "C" size_t strlcpy(char *dest, const char *src, size_t size);
-extern "C" size_t strlcat(char *dst, const char *src, size_t size);
-
-#define ELF_ST_BIND(x) ((x) >> 4)
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
-#define PAGE_MASK (~(PAGE_SIZE - 1))
-
-/*
- * From bionic/libc/include/elf.h
- *
- * Experimental support for SHT_RELR sections. For details, see proposal
- * at https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg
- */
-#define DT_RELR 0x6fffe000
-#define DT_RELRSZ 0x6fffe001
-#define DT_RELRENT 0x6fffe003
-#define DT_RELRCOUNT 0x6fffe005
-/*
- * From bionic/libc/include/elf.h
- *
- * Android compressed rel/rela sections
- */
-#define DT_ANDROID_REL (DT_LOOS + 2)
-#define DT_ANDROID_RELSZ (DT_LOOS + 3)
-
-#define DT_ANDROID_RELA (DT_LOOS + 4)
-#define DT_ANDROID_RELASZ (DT_LOOS + 5)
-
-/*
- * From bionic/libc/include/bits/elf_arm64.h
- */
-#define R_AARCH64_TLS_DTPREL64 1028 /* Module-relative offset. */
-#define R_AARCH64_TLS_DTPMOD64 1029 /* Module index. */
-#define R_AARCH64_TLS_TPREL64 1030 /* TP-relative offset. */
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/ld.config.format.md
^
|
@@ -1,86 +0,0 @@
-# Linker config file format
-
-This document describes format of /system/etc/ld.config.txt file. This file can be used to customize
-linker-namespace setup for dynamic executables.
-
-## Overview
-
-The configuration consists of 2 parts
-1. Mappings - maps executable locations to sections
-2. Sections - contains linker-namespace configuration
-
-## Mappings
-
-This part of the document maps location of an executable to a section. Here is an example
-
-The format is `dir.<section_name>=<directory>`
-
-The mappings should be defined between start of ld.config.txt and the first section.
-
-## Section
-
-Every section starts with `[section_name]` (which is used in mappings) and it defines namespaces
-configuration using set of properties described in example below.
-
-## Example
-
-```
-# The following line maps section to a dir. Binraies ran from this location will use namespaces
-# configuration specified in [example_section] below
-dir.example_section=/system/bin/example
-
-# Section starts
-[example_section]
-
-# When this flag is set to true linker will set target_sdk_version for this binary to
-# the version specified in <dirname>/.version file, where <dirname> = dirname(executable_path)
-#
-# default value is false
-enable.target.sdk.version = true
-
-# This property can be used to declare additional namespaces.Note that there is always the default
-# namespace. The default namespace is the namespace for the main executable. This list is
-# comma-separated.
-additional.namespaces = ns1
-
-# Each namespace property starts with "namespace.<namespace-name>" The following is configuration
-# for the default namespace
-
-# Is namespace isolated - the default value is false
-namespace.default.isolated = true
-
-# Default namespace search path. Note that ${LIB} here is substituted with "lib" for 32bit targets
-# and with "lib64" for 64bit ones.
-namespace.default.search.paths = /system/${LIB}:/system/other/${LIB}
-
-# ... same for asan
-namespace.default.asan.search.paths = /data/${LIB}:/data/other/${LIB}
-
-# Permitted path
-namespace.default.permitted.paths = /system/${LIB}
-
-# ... asan
-namespace.default.asan.permitted.paths = /data/${LIB}
-
-# This declares linked namespaces - comma separated list.
-namespace.default.links = ns1
-
-# For every link define list of shared libraries. This is list of the libraries accessilbe from
-# default namespace but loaded in the linked namespace.
-namespace.default.link.ns1.shared_libs = libexternal.so:libother.so
-
-# This part defines config for ns1
-namespace.ns1.isolated = true
-namespace.ns1.search.paths = /vendor/${LIB}
-namespace.ns1.asan.search.paths = /data/vendor/${LIB}
-namespace.ns1.permitted.paths = /vendor/${LIB}
-namespace.ns1.asan.permitted.paths = /data/vendor/${LIB}
-
-# and links it to default namespace
-namespace.ns.links = default
-namespace.ns.link.default.shared_libs = libc.so:libdl.so:libm.so:libstdc++.so
-
-# This defines what libraries are allowed to be loaded from ns1
-namespace.ns1.whitelisted = libsomething.so
-```
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/ld_android.cpp
^
|
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-
-extern "C" void __internal_linker_error() {
- __builtin_trap();
-}
-
-__strong_alias(__loader_android_create_namespace, __internal_linker_error);
-__strong_alias(__loader_android_dlopen_ext, __internal_linker_error);
-__strong_alias(__loader_android_dlwarning, __internal_linker_error);
-__strong_alias(__loader_android_get_application_target_sdk_version, __internal_linker_error);
-__strong_alias(__loader_android_get_LD_LIBRARY_PATH, __internal_linker_error);
-__strong_alias(__loader_android_get_exported_namespace, __internal_linker_error);
-__strong_alias(__loader_android_init_anonymous_namespace, __internal_linker_error);
-__strong_alias(__loader_android_link_namespaces, __internal_linker_error);
-__strong_alias(__loader_android_link_namespaces_all_libs, __internal_linker_error);
-__strong_alias(__loader_android_set_application_target_sdk_version, __internal_linker_error);
-__strong_alias(__loader_android_update_LD_LIBRARY_PATH, __internal_linker_error);
-__strong_alias(__loader_cfi_fail, __internal_linker_error);
-__strong_alias(__loader_dl_iterate_phdr, __internal_linker_error);
-__strong_alias(__loader_dladdr, __internal_linker_error);
-__strong_alias(__loader_dlclose, __internal_linker_error);
-__strong_alias(__loader_dlerror, __internal_linker_error);
-__strong_alias(__loader_dlopen, __internal_linker_error);
-__strong_alias(__loader_dlsym, __internal_linker_error);
-__strong_alias(__loader_dlvsym, __internal_linker_error);
-__strong_alias(__loader_add_thread_local_dtor, __internal_linker_error);
-__strong_alias(__loader_remove_thread_local_dtor, __internal_linker_error);
-__strong_alias(__loader_shared_globals, __internal_linker_error);
-#if defined(__arm__)
-__strong_alias(__loader_dl_unwind_find_exidx, __internal_linker_error);
-#endif
-__strong_alias(rtld_db_dlactivity, __internal_linker_error);
-
-#if defined(__arm__)
-// An arm32 unwinding table has an R_ARM_NONE relocation to
-// __aeabi_unwind_cpp_pr0. This shared library will never invoke the unwinder,
-// so it doesn't actually need the routine. Define a dummy version here,
-// because the real version calls libc functions (e.g. memcpy, abort), which
-// would create a dependency cycle with libc.so.
-__attribute__((visibility("hidden")))
-extern "C" void __aeabi_unwind_cpp_pr0() {
- __builtin_trap();
-}
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linked_list.h
^
|
@@ -1,260 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <android-base/macros.h>
-
-template<typename T>
-struct LinkedListEntry {
- LinkedListEntry<T>* next;
- T* element;
-};
-
-// ForwardInputIterator
-template<typename T>
-class LinkedListIterator {
- public:
- LinkedListIterator() : entry_(nullptr) {}
- LinkedListIterator(const LinkedListIterator<T>& that) : entry_(that.entry_) {}
- explicit LinkedListIterator(LinkedListEntry<T>* entry) : entry_(entry) {}
-
- LinkedListIterator<T>& operator=(const LinkedListIterator<T>& that) {
- entry_ = that.entry_;
- return *this;
- }
-
- LinkedListIterator<T>& operator++() {
- entry_ = entry_->next;
- return *this;
- }
-
- T* const operator*() {
- return entry_->element;
- }
-
- bool operator==(const LinkedListIterator<T>& that) const {
- return entry_ == that.entry_;
- }
-
- bool operator!=(const LinkedListIterator<T>& that) const {
- return entry_ != that.entry_;
- }
-
- private:
- LinkedListEntry<T> *entry_;
-};
-
-/*
- * Represents linked list of objects of type T
- */
-template<typename T, typename Allocator>
-class LinkedList {
- public:
- typedef LinkedListIterator<T> iterator;
- typedef T* value_type;
-
- LinkedList() : head_(nullptr), tail_(nullptr) {}
- ~LinkedList() {
- clear();
- }
-
- LinkedList(LinkedList&& that) noexcept {
- this->head_ = that.head_;
- this->tail_ = that.tail_;
- that.head_ = that.tail_ = nullptr;
- }
-
- void push_front(T* const element) {
- LinkedListEntry<T>* new_entry = Allocator::alloc();
- new_entry->next = head_;
- new_entry->element = element;
- head_ = new_entry;
- if (tail_ == nullptr) {
- tail_ = new_entry;
- }
- }
-
- void push_back(T* const element) {
- LinkedListEntry<T>* new_entry = Allocator::alloc();
- new_entry->next = nullptr;
- new_entry->element = element;
- if (tail_ == nullptr) {
- tail_ = head_ = new_entry;
- } else {
- tail_->next = new_entry;
- tail_ = new_entry;
- }
- }
-
- T* pop_front() {
- if (head_ == nullptr) {
- return nullptr;
- }
-
- LinkedListEntry<T>* entry = head_;
- T* element = entry->element;
- head_ = entry->next;
- Allocator::free(entry);
-
- if (head_ == nullptr) {
- tail_ = nullptr;
- }
-
- return element;
- }
-
- T* front() const {
- if (head_ == nullptr) {
- return nullptr;
- }
-
- return head_->element;
- }
-
- void clear() {
- while (head_ != nullptr) {
- LinkedListEntry<T>* p = head_;
- head_ = head_->next;
- Allocator::free(p);
- }
-
- tail_ = nullptr;
- }
-
- bool empty() {
- return (head_ == nullptr);
- }
-
- template<typename F>
- void for_each(F action) const {
- visit([&] (T* si) {
- action(si);
- return true;
- });
- }
-
- template<typename F>
- bool visit(F action) const {
- for (LinkedListEntry<T>* e = head_; e != nullptr; e = e->next) {
- if (!action(e->element)) {
- return false;
- }
- }
- return true;
- }
-
- template<typename F>
- void remove_if(F predicate) {
- for (LinkedListEntry<T>* e = head_, *p = nullptr; e != nullptr;) {
- if (predicate(e->element)) {
- LinkedListEntry<T>* next = e->next;
- if (p == nullptr) {
- head_ = next;
- } else {
- p->next = next;
- }
-
- if (tail_ == e) {
- tail_ = p;
- }
-
- Allocator::free(e);
-
- e = next;
- } else {
- p = e;
- e = e->next;
- }
- }
- }
-
- void remove(T* element) {
- remove_if([&](T* e) {
- return e == element;
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linked_list_test.cpp
^
|
@@ -1,245 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <string>
-#include <sstream>
-
-#include <gtest/gtest.h>
-
-#include "linked_list.h"
-
-namespace {
-
-bool alloc_called = false;
-bool free_called = false;
-
-class LinkedListTestAllocator {
- public:
- typedef LinkedListEntry<const char> entry_t;
-
- static entry_t* alloc() {
- alloc_called = true;
- return reinterpret_cast<entry_t*>(::malloc(sizeof(entry_t)));
- }
-
- static void free(entry_t* p) {
- free_called = true;
- ::free(p);
- }
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(LinkedListTestAllocator);
-};
-
-typedef LinkedList<const char, LinkedListTestAllocator> test_list_t;
-
-std::string test_list_to_string(test_list_t& list) {
- std::stringstream ss;
- list.for_each([&] (const char* c) {
- ss << c;
- });
-
- return ss.str();
-}
-
-};
-
-TEST(linked_list, simple) {
- alloc_called = free_called = false;
- test_list_t list;
- ASSERT_EQ("", test_list_to_string(list));
- ASSERT_TRUE(!alloc_called);
- ASSERT_TRUE(!free_called);
- list.push_front("a");
- ASSERT_TRUE(alloc_called);
- ASSERT_TRUE(!free_called);
- ASSERT_EQ("a", test_list_to_string(list));
- list.push_front("b");
- ASSERT_EQ("ba", test_list_to_string(list));
- list.push_front("c");
- list.push_front("d");
- ASSERT_EQ("dcba", test_list_to_string(list));
- ASSERT_TRUE(alloc_called);
- ASSERT_TRUE(!free_called);
- alloc_called = free_called = false;
- list.remove_if([] (const char* c) {
- return *c == 'c';
- });
-
- ASSERT_TRUE(!alloc_called);
- ASSERT_TRUE(free_called);
-
- ASSERT_EQ("dba", test_list_to_string(list));
- alloc_called = free_called = false;
- list.remove_if([] (const char* c) {
- return *c == '2';
- });
- ASSERT_TRUE(!alloc_called);
- ASSERT_TRUE(!free_called);
- ASSERT_EQ("dba", test_list_to_string(list));
- list.clear();
- ASSERT_TRUE(!alloc_called);
- ASSERT_TRUE(free_called);
- ASSERT_EQ("", test_list_to_string(list));
-}
-
-TEST(linked_list, push_pop) {
- test_list_t list;
- list.push_front("b");
- list.push_front("a");
- ASSERT_EQ("ab", test_list_to_string(list));
- list.push_back("c");
- ASSERT_EQ("abc", test_list_to_string(list));
- ASSERT_STREQ("a", list.pop_front());
- ASSERT_EQ("bc", test_list_to_string(list));
- ASSERT_STREQ("b", list.pop_front());
- ASSERT_EQ("c", test_list_to_string(list));
- ASSERT_STREQ("c", list.pop_front());
- ASSERT_EQ("", test_list_to_string(list));
- ASSERT_TRUE(list.pop_front() == nullptr);
- list.push_back("r");
- ASSERT_EQ("r", test_list_to_string(list));
- ASSERT_STREQ("r", list.pop_front());
- ASSERT_TRUE(list.pop_front() == nullptr);
-}
-
-TEST(linked_list, remove_if_then_pop) {
- test_list_t list;
- list.push_back("a");
- list.push_back("b");
- list.push_back("c");
- list.push_back("d");
- list.remove_if([](const char* c) {
- return *c == 'b' || *c == 'c';
- });
-
- ASSERT_EQ("ad", test_list_to_string(list));
- ASSERT_STREQ("a", list.pop_front());
- ASSERT_EQ("d", test_list_to_string(list));
- ASSERT_STREQ("d", list.pop_front());
- ASSERT_TRUE(list.pop_front() == nullptr);
-}
-
-TEST(linked_list, remove_if_last_then_push_back) {
- test_list_t list;
-
- list.push_back("a");
- list.push_back("b");
- list.push_back("c");
- list.push_back("d");
-
- list.remove_if([](const char* c) {
- return *c == 'c' || *c == 'd';
- });
-
- ASSERT_EQ("ab", test_list_to_string(list));
- list.push_back("d");
- ASSERT_EQ("abd", test_list_to_string(list));
-}
-
-TEST(linked_list, copy_to_array) {
- test_list_t list;
- const size_t max_size = 128;
- const char* buf[max_size];
- memset(buf, 0, sizeof(buf));
-
- ASSERT_EQ(0U, list.copy_to_array(buf, max_size));
- ASSERT_EQ(nullptr, buf[0]);
-
- list.push_back("a");
- list.push_back("b");
- list.push_back("c");
- list.push_back("d");
-
- memset(buf, 0, sizeof(buf));
- ASSERT_EQ(2U, list.copy_to_array(buf, 2));
- ASSERT_STREQ("a", buf[0]);
- ASSERT_STREQ("b", buf[1]);
- ASSERT_EQ(nullptr, buf[2]);
-
- ASSERT_EQ(4U, list.copy_to_array(buf, max_size));
- ASSERT_STREQ("a", buf[0]);
- ASSERT_STREQ("b", buf[1]);
- ASSERT_STREQ("c", buf[2]);
- ASSERT_STREQ("d", buf[3]);
- ASSERT_EQ(nullptr, buf[4]);
-
- memset(buf, 0, sizeof(buf));
- list.remove_if([](const char* c) {
- return *c != 'c';
- });
- ASSERT_EQ(1U, list.copy_to_array(buf, max_size));
- ASSERT_STREQ("c", buf[0]);
- ASSERT_EQ(nullptr, buf[1]);
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker.arm.map
^
|
@@ -1,29 +0,0 @@
-{
- global:
- __loader_dlopen;
- __loader_dlclose;
- __loader_dlsym;
- __loader_dlerror;
- __loader_dladdr;
- __loader_android_update_LD_LIBRARY_PATH;
- __loader_android_get_LD_LIBRARY_PATH;
- __loader_dl_iterate_phdr;
- __loader_android_dlopen_ext;
- __loader_android_set_application_target_sdk_version;
- __loader_android_get_application_target_sdk_version;
- __loader_android_init_anonymous_namespace;
- __loader_android_create_namespace;
- __loader_dlvsym;
- __loader_android_dlwarning;
- __loader_cfi_fail;
- __loader_android_link_namespaces;
- __loader_android_link_namespaces_all_libs;
- __loader_android_get_exported_namespace;
- __loader_dl_unwind_find_exidx;
- __loader_add_thread_local_dtor;
- __loader_remove_thread_local_dtor;
- __loader_shared_globals;
- rtld_db_dlactivity;
- local:
- *;
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker.cpp
^
|
@@ -1,4353 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <android/api-level.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/param.h>
-#include <sys/vfs.h>
-#include <unistd.h>
-
-#include <new>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "hybris_compat.h"
-
-//#include <android-base/properties.h>
-#include <android-base/scopeguard.h>
-
-#include <async_safe/log.h>
-
-// Private C library headers.
-
-#include "linker.h"
-#include "linker_block_allocator.h"
-#include "linker_cfi.h"
-#include "linker_config.h"
-#include "linker_gdb_support.h"
-#include "linker_globals.h"
-#include "linker_debug.h"
-#include "linker_dlwarning.h"
-#include "linker_main.h"
-#include "linker_namespaces.h"
-#include "linker_sleb128.h"
-#include "linker_phdr.h"
-#include "linker_relocs.h"
-#include "linker_reloc_iterators.h"
-#include "linker_tls.h"
-#include "linker_utils.h"
-
-#include "private/bionic_globals.h"
-#include "android-base/macros.h"
-//#include "android-base/strings.h"
-//#include "android-base/stringprintf.h"
-//#include "ziparchive/zip_archive.h"
-
-#ifdef WANT_ARM_TRACING
-#include "../wrappers.h"
-#endif
-
-#define TMPFS_MAGIC 0x01021994
-
-#define DF_1_PIE 0x08000000
-
-
-// Override macros to use C++ style casts.
-#undef ELF_ST_TYPE
-#define ELF_ST_TYPE(x) (static_cast<uint32_t>(x) & 0xf)
-
-static std::unordered_map<void*, size_t> g_dso_handle_counters;
-
-static std::unordered_map<std::string, android_namespace_t*> g_exported_namespaces;
-
-static LinkerTypeAllocator<soinfo> g_soinfo_allocator;
-static LinkerTypeAllocator<LinkedListEntry<soinfo>> g_soinfo_links_allocator;
-
-static LinkerTypeAllocator<android_namespace_t> g_namespace_allocator;
-android_namespace_t *g_default_namespace = new (g_namespace_allocator.alloc()) android_namespace_t();
-static android_namespace_t* g_anonymous_namespace = g_default_namespace;
-static LinkerTypeAllocator<LinkedListEntry<android_namespace_t>> g_namespace_list_allocator;
-
-static const char* const kLdConfigArchFilePath = "/system/etc/ld.config." ABI_STRING ".txt";
-
-static const char* const kLdConfigFilePath = "/system/etc/ld.config.txt";
-static const char* const kLdConfigVndkLiteFilePath = "/system/etc/ld.config.vndk_lite.txt";
-
-#if defined(__LP64__)
-static const char* const kSystemLibDir = "/system/lib64";
-static const char* const kOdmLibDir = "/odm/lib64";
-static const char* const kVendorLibDir = "/vendor/lib64";
-static const char* const kAsanSystemLibDir = "/data/asan/system/lib64";
-static const char* const kAsanOdmLibDir = "/data/asan/odm/lib64";
-static const char* const kAsanVendorLibDir = "/data/asan/vendor/lib64";
-static const char* const kRuntimeApexLibDir = "/apex/com.android.runtime/lib64";
-#else
-static const char* const kSystemLibDir = "/system/lib";
-static const char* const kOdmLibDir = "/odm/lib";
-static const char* const kVendorLibDir = "/vendor/lib";
-static const char* const kAsanSystemLibDir = "/data/asan/system/lib";
-static const char* const kAsanOdmLibDir = "/data/asan/odm/lib";
-static const char* const kAsanVendorLibDir = "/data/asan/vendor/lib";
-static const char* const kRuntimeApexLibDir = "/apex/com.android.runtime/lib";
-#endif
-
-static const char* const kAsanLibDirPrefix = "/data/asan";
-
-static const char* const kDefaultLdPaths[] = {
- kSystemLibDir,
- kOdmLibDir,
- kVendorLibDir,
- nullptr
-};
-
-static const char* const kAsanDefaultLdPaths[] = {
- kAsanSystemLibDir,
- kSystemLibDir,
- kAsanOdmLibDir,
- kOdmLibDir,
- kAsanVendorLibDir,
- kVendorLibDir,
- nullptr
-};
-
-// Is ASAN enabled?
-static bool g_is_asan = false;
-
-static CFIShadowWriter g_cfi_shadow;
-
-CFIShadowWriter* get_cfi_shadow() {
- return &g_cfi_shadow;
-}
-
-static bool is_system_library(const std::string& realpath) {
- for (const auto& dir : g_default_namespace->get_default_library_paths()) {
- if (file_is_in_dir(realpath, dir)) {
- return true;
- }
- }
- return false;
-}
-
-// Checks if the file exists and not a directory.
-static bool file_exists(const char* path) {
- struct stat s;
-
- if (stat(path, &s) != 0) {
- return false;
- }
-
- return S_ISREG(s.st_mode);
-}
-
-static std::string resolve_soname(const std::string& name) {
- // We assume that soname equals to basename here
-
- // TODO(dimitry): consider having honest absolute-path -> soname resolution
- // note that since we might end up refusing to load this library because
- // it is not in shared libs list we need to get the soname without actually loading
- // the library.
- //
- // On the other hand there are several places where we already assume that
- // soname == basename in particular for any not-loaded library mentioned
- // in DT_NEEDED list.
- return basename(name.c_str());
-}
-
-static bool maybe_accessible_via_namespace_links(android_namespace_t* ns, const char* name) {
- std::string soname = resolve_soname(name);
- for (auto& ns_link : ns->linked_namespaces()) {
- if (ns_link.is_accessible(soname.c_str())) {
- return true;
- }
- }
-
- return false;
-}
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker.generic.map
^
|
@@ -1,28 +0,0 @@
-{
- global:
- __loader_dlopen;
- __loader_dlclose;
- __loader_dlsym;
- __loader_dlerror;
- __loader_dladdr;
- __loader_android_update_LD_LIBRARY_PATH;
- __loader_android_get_LD_LIBRARY_PATH;
- __loader_dl_iterate_phdr;
- __loader_android_dlopen_ext;
- __loader_android_set_application_target_sdk_version;
- __loader_android_get_application_target_sdk_version;
- __loader_android_init_anonymous_namespace;
- __loader_android_create_namespace;
- __loader_dlvsym;
- __loader_android_dlwarning;
- __loader_cfi_fail;
- __loader_android_link_namespaces;
- __loader_android_link_namespaces_all_libs;
- __loader_android_get_exported_namespace;
- __loader_add_thread_local_dtor;
- __loader_remove_thread_local_dtor;
- __loader_shared_globals;
- rtld_db_dlactivity;
- local:
- *;
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker.h
^
|
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <dlfcn.h>
-#include <android/dlext.h>
-#include <elf.h>
-
-typedef Elf32_Word Elf32_Relr;
-typedef Elf64_Xword Elf64_Relr;
-
-
-#include <inttypes.h>
-#include <link.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "private/bionic_page.h"
-#include "linked_list.h"
-#include "linker_common_types.h"
-#include "linker_logger.h"
-#include "linker_soinfo.h"
-
-#include <string>
-#include <vector>
-
-#if defined(__LP64__)
-#define ELFW(what) ELF64_ ## what
-#else
-#define ELFW(what) ELF32_ ## what
-#endif
-
-// mips64 interprets Elf64_Rel structures' r_info field differently.
-// bionic (like other C libraries) has macros that assume regular ELF files,
-// but the dynamic linker needs to be able to load mips64 ELF files.
-#if defined(__mips__) && defined(__LP64__)
-#undef ELF64_R_SYM
-#undef ELF64_R_TYPE
-#undef ELF64_R_INFO
-#define ELF64_R_SYM(info) (((info) >> 0) & 0xffffffff)
-#define ELF64_R_SSYM(info) (((info) >> 32) & 0xff)
-#define ELF64_R_TYPE3(info) (((info) >> 40) & 0xff)
-#define ELF64_R_TYPE2(info) (((info) >> 48) & 0xff)
-#define ELF64_R_TYPE(info) (((info) >> 56) & 0xff)
-#endif
-
-#define SUPPORTED_DT_FLAGS_1 (DF_1_NOW | DF_1_GLOBAL | DF_1_NODELETE | DF_1_PIE)
-
-// Class used construct version dependency graph.
-class VersionTracker {
- public:
- VersionTracker() = default;
- bool init(const soinfo* si_from);
-
- const version_info* get_version_info(ElfW(Versym) source_symver) const;
- private:
- bool init_verneed(const soinfo* si_from);
- bool init_verdef(const soinfo* si_from);
- void add_version_info(size_t source_index, ElfW(Word) elf_hash,
- const char* ver_name, const soinfo* target_si);
-
- std::vector<version_info> version_infos;
-
- DISALLOW_COPY_AND_ASSIGN(VersionTracker);
-};
-
-bool soinfo_do_lookup(soinfo* si_from, const char* name, const version_info* vi,
- soinfo** si_found_in, const soinfo_list_t& global_group,
- const soinfo_list_t& local_group, const ElfW(Sym)** symbol);
-
-enum RelocationKind {
- kRelocAbsolute = 0,
- kRelocRelative,
- kRelocCopy,
- kRelocSymbol,
- kRelocMax
-};
-
-void count_relocation(RelocationKind kind);
-
-soinfo* get_libdl_info(const char* linker_path, const soinfo& linker_si);
-
-soinfo* find_containing_library(const void* p);
-
-int open_executable(const char* path, off64_t* file_offset, std::string* realpath);
-
-void do_android_get_LD_LIBRARY_PATH(char*, size_t);
-void do_android_update_LD_LIBRARY_PATH(const char* ld_library_path);
-void* do_dlopen(const char* name,
- int flags,
- const android_dlextinfo* extinfo,
- const void* caller_addr);
-
-int do_dlclose(void* handle);
-
-int do_dl_iterate_phdr(int (*cb)(dl_phdr_info* info, size_t size, void* data), void* data);
-
-#if defined(__arm__)
-_Unwind_Ptr do_dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount);
-#endif
-
-bool do_dlsym(void* handle, const char* sym_name,
- const char* sym_ver,
- const void* caller_addr,
- void** symbol);
-
-int do_dladdr(const void* addr, Dl_info* info);
-
-// void ___cfi_slowpath(uint64_t CallSiteTypeId, void *Ptr, void *Ret);
-// void ___cfi_slowpath_diag(uint64_t CallSiteTypeId, void *Ptr, void *DiagData, void *Ret);
-void ___cfi_fail(uint64_t CallSiteTypeId, void* Ptr, void *DiagData, void *Ret);
-
-void set_application_target_sdk_version(int target);
-int get_application_target_sdk_version();
-
-enum {
- /* A regular namespace is the namespace with a custom search path that does
- * not impose any restrictions on the location of native libraries.
- */
- ANDROID_NAMESPACE_TYPE_REGULAR = 0,
-
- /* An isolated namespace requires all the libraries to be on the search path
- * or under permitted_when_isolated_path. The search path is the union of
- * ld_library_path and default_library_path.
- */
- ANDROID_NAMESPACE_TYPE_ISOLATED = 1,
-
- /* The shared namespace clones the list of libraries of the caller namespace upon creation
- * which means that they are shared between namespaces - the caller namespace and the new one
- * will use the same copy of a library if it was loaded prior to android_create_namespace call.
- *
- * Note that libraries loaded after the namespace is created will not be shared.
- *
- * Shared namespaces can be isolated or regular. Note that they do not inherit the search path nor
- * permitted_path from the caller's namespace.
- */
- ANDROID_NAMESPACE_TYPE_SHARED = 2,
-
- /* This flag instructs linker to enable grey-list workaround for the namespace.
- * See http://b/26394120 for details.
- */
- ANDROID_NAMESPACE_TYPE_GREYLIST_ENABLED = 0x08000000,
-
- ANDROID_NAMESPACE_TYPE_SHARED_ISOLATED = ANDROID_NAMESPACE_TYPE_SHARED |
- ANDROID_NAMESPACE_TYPE_ISOLATED,
-};
-
-bool init_anonymous_namespace(const char* shared_lib_sonames, const char* library_search_path);
-android_namespace_t* create_namespace(const void* caller_addr,
- const char* name,
- const char* ld_library_path,
- const char* default_library_path,
- uint64_t type,
- const char* permitted_when_isolated_path,
- android_namespace_t* parent_namespace);
-
-bool link_namespaces(android_namespace_t* namespace_from,
- android_namespace_t* namespace_to,
- const char* shared_lib_sonames);
-
-bool link_namespaces_all_libs(android_namespace_t* namespace_from,
- android_namespace_t* namespace_to);
-
-android_namespace_t* get_exported_namespace(const char* name);
-
-void increment_dso_handle_reference_counter(void* dso_handle);
-void decrement_dso_handle_reference_counter(void* dso_handle);
-
-void purge_unused_memory();
-
-struct address_space_params {
- void* start_addr = nullptr;
- size_t reserved_size = 0;
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_allocator.cpp
^
|
@@ -1,360 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_allocator.h"
-#include "linker_debug.h"
-#include "linker_utils.h"
-#include "linker.h"
-
-#include <algorithm>
-#include <vector>
-
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-#include <async_safe/log.h>
-
-#include <memory.h>
-
-#include "private/bionic_prctl.h"
-
-#include "hybris_compat.h"
-
-//
-// LinkerMemeoryAllocator is general purpose allocator
-// designed to provide the same functionality as the malloc/free/realloc
-// libc functions.
-//
-// On alloc:
-// If size is >= 1k allocator proxies malloc call directly to mmap
-// If size < 1k allocator uses SmallObjectAllocator for the size
-// rounded up to the nearest power of two.
-//
-// On free:
-//
-// For a pointer allocated using proxy-to-mmap allocator unmaps
-// the memory.
-//
-// For a pointer allocated using SmallObjectAllocator it adds
-// the block to free_blocks_list_. If the number of free pages reaches 2,
-// SmallObjectAllocator munmaps one of the pages keeping the other one
-// in reserve.
-
-static const char kSignature[4] = {'L', 'M', 'A', 1};
-
-static const size_t kSmallObjectMaxSize = 1 << kSmallObjectMaxSizeLog2;
-
-// This type is used for large allocations (with size >1k)
-static const uint32_t kLargeObject = 111;
-
-bool operator<(const small_object_page_record& one, const small_object_page_record& two) {
- return one.page_addr < two.page_addr;
-}
-
-static inline uint16_t log2(size_t number) {
- uint16_t result = 0;
- number--;
-
- while (number != 0) {
- result++;
- number >>= 1;
- }
-
- return result;
-}
-
-LinkerSmallObjectAllocator::LinkerSmallObjectAllocator(uint32_t type, size_t block_size)
- : type_(type), block_size_(block_size), free_pages_cnt_(0), free_blocks_list_(nullptr) {}
-
-void* LinkerSmallObjectAllocator::alloc() {
- CHECK(block_size_ != 0);
-
- if (free_blocks_list_ == nullptr) {
- alloc_page();
- }
-
- small_object_block_record* block_record = free_blocks_list_;
- if (block_record->free_blocks_cnt > 1) {
- small_object_block_record* next_free = reinterpret_cast<small_object_block_record*>(
- reinterpret_cast<uint8_t*>(block_record) + block_size_);
- next_free->next = block_record->next;
- next_free->free_blocks_cnt = block_record->free_blocks_cnt - 1;
- free_blocks_list_ = next_free;
- } else {
- free_blocks_list_ = block_record->next;
- }
-
- // bookkeeping...
- auto page_record = find_page_record(block_record);
-
- if (page_record->allocated_blocks_cnt == 0) {
- free_pages_cnt_--;
- }
-
- page_record->free_blocks_cnt--;
- page_record->allocated_blocks_cnt++;
-
- memset(block_record, 0, block_size_);
-
- return block_record;
-}
-
-void LinkerSmallObjectAllocator::free_page(linker_vector_t::iterator page_record) {
- void* page_start = reinterpret_cast<void*>(page_record->page_addr);
- void* page_end = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(page_start) + PAGE_SIZE);
-
- while (free_blocks_list_ != nullptr &&
- free_blocks_list_ > page_start &&
- free_blocks_list_ < page_end) {
- free_blocks_list_ = free_blocks_list_->next;
- }
-
- small_object_block_record* current = free_blocks_list_;
-
- while (current != nullptr) {
- while (current->next > page_start && current->next < page_end) {
- current->next = current->next->next;
- }
-
- current = current->next;
- }
-
- munmap(page_start, PAGE_SIZE);
- page_records_.erase(page_record);
- free_pages_cnt_--;
-}
-
-void LinkerSmallObjectAllocator::free(void* ptr) {
- auto page_record = find_page_record(ptr);
-
- ssize_t offset = reinterpret_cast<uintptr_t>(ptr) - sizeof(page_info);
-
- if (offset % block_size_ != 0) {
- async_safe_fatal("invalid pointer: %p (block_size=%zd)", ptr, block_size_);
- }
-
- memset(ptr, 0, block_size_);
- small_object_block_record* block_record = reinterpret_cast<small_object_block_record*>(ptr);
-
- block_record->next = free_blocks_list_;
- block_record->free_blocks_cnt = 1;
-
- free_blocks_list_ = block_record;
-
- page_record->free_blocks_cnt++;
- page_record->allocated_blocks_cnt--;
-
- if (page_record->allocated_blocks_cnt == 0) {
- if (free_pages_cnt_++ > 1) {
- // if we already have a free page - unmap this one.
- free_page(page_record);
- }
- }
-}
-
-linker_vector_t::iterator LinkerSmallObjectAllocator::find_page_record(void* ptr) {
- void* addr = reinterpret_cast<void*>(PAGE_START(reinterpret_cast<uintptr_t>(ptr)));
- small_object_page_record boundary;
- boundary.page_addr = addr;
- linker_vector_t::iterator it = std::lower_bound(
- page_records_.begin(), page_records_.end(), boundary);
-
- if (it == page_records_.end() || it->page_addr != addr) {
- // not found...
- async_safe_fatal("page record for %p was not found (block_size=%zd)", ptr, block_size_);
- }
-
- return it;
-}
-
-void LinkerSmallObjectAllocator::create_page_record(void* page_addr, size_t free_blocks_cnt) {
- small_object_page_record record;
- record.page_addr = page_addr;
- record.free_blocks_cnt = free_blocks_cnt;
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_allocator.h
^
|
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __LINKER_ALLOCATOR_H
-#define __LINKER_ALLOCATOR_H
-
-#include <stdlib.h>
-#include <sys/cdefs.h>
-#include <sys/mman.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include <vector>
-
-#include <async_safe/log.h>
-
-#include "private/bionic_prctl.h"
-
-const uint32_t kSmallObjectMaxSizeLog2 = 10;
-const uint32_t kSmallObjectMinSizeLog2 = 4;
-const uint32_t kSmallObjectAllocatorsCount = kSmallObjectMaxSizeLog2 - kSmallObjectMinSizeLog2 + 1;
-
-class LinkerSmallObjectAllocator;
-
-// This structure is placed at the beginning of each addressable page
-// and has all information we need to find the corresponding memory allocator.
-struct page_info {
- char signature[4];
- uint32_t type;
- union {
- // we use allocated_size for large objects allocator
- size_t allocated_size;
- // and allocator_addr for small ones.
- LinkerSmallObjectAllocator* allocator_addr;
- };
-} __attribute__((aligned(16)));
-
-struct small_object_page_record {
- void* page_addr;
- size_t free_blocks_cnt;
- size_t allocated_blocks_cnt;
-};
-
-// for lower_bound...
-bool operator<(const small_object_page_record& one, const small_object_page_record& two);
-
-struct small_object_block_record {
- small_object_block_record* next;
- size_t free_blocks_cnt;
-};
-
-// This is implementation for std::vector allocator
-template <typename T>
-class linker_vector_allocator {
- public:
- typedef T value_type;
- typedef T* pointer;
- typedef const T* const_pointer;
- typedef T& reference;
- typedef const T& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- T* allocate(size_t n, const T* hint = nullptr) {
- size_t size = n * sizeof(T);
- void* ptr = mmap(const_cast<T*>(hint), size,
- PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
- if (ptr == MAP_FAILED) {
- // Spec says we need to throw std::bad_alloc here but because our
- // code does not support exception handling anyways - we are going to abort.
- async_safe_fatal("mmap failed");
- }
-
- prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, ptr, size, "linker_alloc_vector");
-
- return reinterpret_cast<T*>(ptr);
- }
-
- void deallocate(T* ptr, size_t n) {
- munmap(ptr, n * sizeof(T));
- }
-};
-
-typedef
- std::vector<small_object_page_record, linker_vector_allocator<small_object_page_record>>
- linker_vector_t;
-
-
-class LinkerSmallObjectAllocator {
- public:
- LinkerSmallObjectAllocator(uint32_t type, size_t block_size);
- void* alloc();
- void free(void* ptr);
-
- size_t get_block_size() const { return block_size_; }
- private:
- void alloc_page();
- void free_page(linker_vector_t::iterator page_record);
- linker_vector_t::iterator find_page_record(void* ptr);
- void create_page_record(void* page_addr, size_t free_blocks_cnt);
-
- uint32_t type_;
- size_t block_size_;
-
- size_t free_pages_cnt_;
- small_object_block_record* free_blocks_list_;
-
- // sorted vector of page records
- linker_vector_t page_records_;
-};
-
-class LinkerMemoryAllocator {
- public:
- constexpr LinkerMemoryAllocator() : allocators_(nullptr), allocators_buf_() {}
- void* alloc(size_t size);
-
- // Note that this implementation of realloc never shrinks allocation
- void* realloc(void* ptr, size_t size);
- void free(void* ptr);
- private:
- void* alloc_mmap(size_t size);
- page_info* get_page_info(void* ptr);
- LinkerSmallObjectAllocator* get_small_object_allocator(uint32_t type);
- void initialize_allocators();
-
- LinkerSmallObjectAllocator* allocators_;
- uint8_t allocators_buf_[sizeof(LinkerSmallObjectAllocator)*kSmallObjectAllocatorsCount];
-};
-
-
-#endif /* __LINKER_ALLOCATOR_H */
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_block_allocator.cpp
^
|
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_block_allocator.h"
-#include <inttypes.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/prctl.h>
-#include <unistd.h>
-
-#include "private/bionic_prctl.h"
-
-#include "hybris_compat.h"
-
-static constexpr size_t kAllocateSize = PAGE_SIZE * 100;
-static_assert(kAllocateSize % PAGE_SIZE == 0, "Invalid kAllocateSize.");
-
-// the multiplier should be power of 2
-static constexpr size_t round_up(size_t size, size_t multiplier) {
- return (size + (multiplier - 1)) & ~(multiplier-1);
-}
-
-struct LinkerBlockAllocatorPage {
- LinkerBlockAllocatorPage* next;
- uint8_t bytes[kAllocateSize - 16] __attribute__((aligned(16)));
-};
-
-struct FreeBlockInfo {
- void* next_block;
- size_t num_free_blocks;
-};
-
-LinkerBlockAllocator::LinkerBlockAllocator(size_t block_size)
- : block_size_(
- round_up(block_size < sizeof(FreeBlockInfo) ? sizeof(FreeBlockInfo) : block_size, 16)),
- page_list_(nullptr),
- free_block_list_(nullptr),
- allocated_(0)
-{}
-
-void* LinkerBlockAllocator::alloc() {
- if (free_block_list_ == nullptr) {
- create_new_page();
- }
-
- FreeBlockInfo* block_info = reinterpret_cast<FreeBlockInfo*>(free_block_list_);
- if (block_info->num_free_blocks > 1) {
- FreeBlockInfo* next_block_info = reinterpret_cast<FreeBlockInfo*>(
- reinterpret_cast<char*>(free_block_list_) + block_size_);
- next_block_info->next_block = block_info->next_block;
- next_block_info->num_free_blocks = block_info->num_free_blocks - 1;
- free_block_list_ = next_block_info;
- } else {
- free_block_list_ = block_info->next_block;
- }
-
- memset(block_info, 0, block_size_);
-
- ++allocated_;
-
- return block_info;
-}
-
-void LinkerBlockAllocator::free(void* block) {
- if (block == nullptr) {
- return;
- }
-
- LinkerBlockAllocatorPage* page = find_page(block);
-
- if (page == nullptr) {
- abort();
- }
-
- ssize_t offset = reinterpret_cast<uint8_t*>(block) - page->bytes;
-
- if (offset % block_size_ != 0) {
- abort();
- }
-
- memset(block, 0, block_size_);
-
- FreeBlockInfo* block_info = reinterpret_cast<FreeBlockInfo*>(block);
-
- block_info->next_block = free_block_list_;
- block_info->num_free_blocks = 1;
-
- free_block_list_ = block_info;
-
- --allocated_;
-}
-
-void LinkerBlockAllocator::protect_all(int prot) {
- for (LinkerBlockAllocatorPage* page = page_list_; page != nullptr; page = page->next) {
- if (mprotect(page, kAllocateSize, prot) == -1) {
- abort();
- }
- }
-}
-
-void LinkerBlockAllocator::create_new_page() {
- static_assert(sizeof(LinkerBlockAllocatorPage) == kAllocateSize,
- "Invalid sizeof(LinkerBlockAllocatorPage)");
-
- LinkerBlockAllocatorPage* page = reinterpret_cast<LinkerBlockAllocatorPage*>(
- mmap(nullptr, kAllocateSize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0));
-
- if (page == MAP_FAILED) {
- abort(); // oom
- }
-
- prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, page, kAllocateSize, "linker_alloc");
-
- FreeBlockInfo* first_block = reinterpret_cast<FreeBlockInfo*>(page->bytes);
- first_block->next_block = free_block_list_;
- first_block->num_free_blocks = sizeof(page->bytes) / block_size_;
-
- free_block_list_ = first_block;
-
- page->next = page_list_;
- page_list_ = page;
-}
-
-LinkerBlockAllocatorPage* LinkerBlockAllocator::find_page(void* block) {
- if (block == nullptr) {
- abort();
- }
-
- LinkerBlockAllocatorPage* page = page_list_;
- while (page != nullptr) {
- const uint8_t* page_ptr = reinterpret_cast<const uint8_t*>(page);
- if (block >= (page_ptr + sizeof(page->next)) && block < (page_ptr + kAllocateSize)) {
- return page;
- }
-
- page = page->next;
- }
-
- abort();
-}
-
-void LinkerBlockAllocator::purge() {
- if (allocated_) {
- return;
- }
-
- LinkerBlockAllocatorPage* page = page_list_;
- while (page) {
- LinkerBlockAllocatorPage* next = page->next;
- munmap(page, kAllocateSize);
- page = next;
- }
- page_list_ = nullptr;
- free_block_list_ = nullptr;
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_block_allocator.h
^
|
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <stdlib.h>
-#include <limits.h>
-
-#include <android-base/macros.h>
-
-struct LinkerBlockAllocatorPage;
-
-/*
- * This class is a non-template version of the LinkerTypeAllocator
- * It keeps code inside .cpp file by keeping the interface
- * template-free.
- *
- * Please use LinkerTypeAllocator<type> where possible (everywhere).
- */
-class LinkerBlockAllocator {
- public:
- explicit LinkerBlockAllocator(size_t block_size);
-
- void* alloc();
- void free(void* block);
- void protect_all(int prot);
-
- // Purge all pages if all previously allocated blocks have been freed.
- void purge();
-
- private:
- void create_new_page();
- LinkerBlockAllocatorPage* find_page(void* block);
-
- size_t block_size_;
- LinkerBlockAllocatorPage* page_list_;
- void* free_block_list_;
- size_t allocated_;
-
- DISALLOW_COPY_AND_ASSIGN(LinkerBlockAllocator);
-};
-
-/*
- * A simple allocator for the dynamic linker. An allocator allocates instances
- * of a single fixed-size type. Allocations are backed by page-sized private
- * anonymous mmaps.
- *
- * The differences between this allocator and BionicAllocator are:
- * 1. This allocator manages space more efficiently. BionicAllocator operates in
- * power-of-two sized blocks up to 1k, when this implementation splits the
- * page to aligned size of structure; For example for structures with size
- * 513 this allocator will use 516 (520 for lp64) bytes of data where
- * generalized implementation is going to use 1024 sized blocks.
- *
- * 2. This allocator does not munmap allocated memory, where BionicAllocator does.
- *
- * 3. This allocator provides mprotect services to the user, where BionicAllocator
- * always treats its memory as READ|WRITE.
- */
-template<typename T>
-class LinkerTypeAllocator {
- public:
- LinkerTypeAllocator() : block_allocator_(sizeof(T)) {}
- T* alloc() { return reinterpret_cast<T*>(block_allocator_.alloc()); }
- void free(T* t) { block_allocator_.free(t); }
- void protect_all(int prot) { block_allocator_.protect_all(prot); }
- private:
- LinkerBlockAllocator block_allocator_;
- DISALLOW_COPY_AND_ASSIGN(LinkerTypeAllocator);
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_block_allocator_test.cpp
^
|
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-
-#include <gtest/gtest.h>
-
-#include "linker_block_allocator.h"
-
-#include <unistd.h>
-
-namespace {
-
-struct test_struct_nominal {
- void* pointer;
- ssize_t value;
-};
-
-/*
- * this one has size below allocator cap which is 2*sizeof(void*)
- */
-struct test_struct_small {
- char dummy_str[5];
-};
-
-/*
- * 1009 byte struct (1009 is prime)
- */
-struct test_struct_larger {
- char dummy_str[1009];
-};
-
-static size_t kPageSize = sysconf(_SC_PAGE_SIZE);
-};
-
-TEST(linker_allocator, test_nominal) {
- LinkerTypeAllocator<test_struct_nominal> allocator;
-
- test_struct_nominal* ptr1 = allocator.alloc();
- ASSERT_TRUE(ptr1 != nullptr);
- ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr1) % 16);
- test_struct_nominal* ptr2 = allocator.alloc();
- ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr2) % 16);
- ASSERT_TRUE(ptr2 != nullptr);
- // they should be next to each other.
- ASSERT_EQ(reinterpret_cast<uint8_t*>(ptr1)+16, reinterpret_cast<uint8_t*>(ptr2));
-
- ptr1->value = 42;
-
- allocator.free(ptr1);
- allocator.free(ptr2);
-}
-
-TEST(linker_allocator, test_small) {
- LinkerTypeAllocator<test_struct_small> allocator;
-
- char* ptr1 = reinterpret_cast<char*>(allocator.alloc());
- char* ptr2 = reinterpret_cast<char*>(allocator.alloc());
-
- ASSERT_TRUE(ptr1 != nullptr);
- ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr1) % 16);
- ASSERT_TRUE(ptr2 != nullptr);
- ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr2) % 16);
- ASSERT_EQ(ptr1+16, ptr2); // aligned to 16
-}
-
-TEST(linker_allocator, test_larger) {
- LinkerTypeAllocator<test_struct_larger> allocator;
-
- test_struct_larger* ptr1 = allocator.alloc();
- test_struct_larger* ptr2 = allocator.alloc();
-
- ASSERT_TRUE(ptr1 != nullptr);
- ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr1) % 16);
- ASSERT_TRUE(ptr2 != nullptr);
- ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr2) % 16);
-
- ASSERT_EQ(reinterpret_cast<uint8_t*>(ptr1) + 1024, reinterpret_cast<uint8_t*>(ptr2));
-
- // lets allocate until we reach next page.
- size_t n = kPageSize/sizeof(test_struct_larger) + 1 - 2;
-
- for (size_t i=0; i<n; ++i) {
- ASSERT_TRUE(allocator.alloc() != nullptr);
- }
-
- test_struct_larger* ptr_to_free = allocator.alloc();
- ASSERT_TRUE(ptr_to_free != nullptr);
- allocator.free(ptr1);
-}
-
-static void protect_all() {
- LinkerTypeAllocator<test_struct_larger> allocator;
-
- // number of allocs to reach the end of first page
- size_t n = kPageSize/sizeof(test_struct_larger) - 1;
- test_struct_larger* page1_ptr = allocator.alloc();
-
- for (size_t i=0; i<n; ++i) {
- allocator.alloc();
- }
-
- test_struct_larger* page2_ptr = allocator.alloc();
- allocator.protect_all(PROT_READ);
- allocator.protect_all(PROT_READ | PROT_WRITE);
- // check access
- page2_ptr->dummy_str[23] = 27;
- page1_ptr->dummy_str[13] = 11;
-
- allocator.protect_all(PROT_READ);
- fprintf(stderr, "trying to access protected page");
-
- // this should result in segmentation fault
- page1_ptr->dummy_str[11] = 7;
-}
-
-TEST(linker_allocator, test_protect) {
- testing::FLAGS_gtest_death_test_style = "threadsafe";
- ASSERT_EXIT(protect_all(), testing::KilledBySignal(SIGSEGV), "trying to access protected page");
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_cfi.cpp
^
|
@@ -1,296 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_cfi.h"
-
-#include "linker_debug.h"
-#include "linker_globals.h"
-#include "private/bionic_page.h"
-
-#include <sys/mman.h>
-#include <sys/prctl.h>
-#include <sys/types.h>
-#include <cstdint>
-
-#include "private/bionic_prctl.h"
-
-// Update shadow without making it writable by preparing the data on the side and mremap-ing it in
-// place.
-class ShadowWrite {
- char* shadow_start;
- char* shadow_end;
- char* aligned_start;
- char* aligned_end;
- char* tmp_start;
-
- public:
- ShadowWrite(uint16_t* s, uint16_t* e) {
- shadow_start = reinterpret_cast<char*>(s);
- shadow_end = reinterpret_cast<char*>(e);
- aligned_start = reinterpret_cast<char*>(PAGE_START(reinterpret_cast<uintptr_t>(shadow_start)));
- aligned_end = reinterpret_cast<char*>(PAGE_END(reinterpret_cast<uintptr_t>(shadow_end)));
- tmp_start =
- reinterpret_cast<char*>(mmap(nullptr, aligned_end - aligned_start, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
- CHECK(tmp_start != MAP_FAILED);
- memcpy(tmp_start, aligned_start, shadow_start - aligned_start);
- memcpy(tmp_start + (shadow_end - aligned_start), shadow_end, aligned_end - shadow_end);
- }
-
- uint16_t* begin() {
- return reinterpret_cast<uint16_t*>(tmp_start + (shadow_start - aligned_start));
- }
-
- uint16_t* end() {
- return reinterpret_cast<uint16_t*>(tmp_start + (shadow_end - aligned_start));
- }
-
- ~ShadowWrite() {
- size_t size = aligned_end - aligned_start;
- mprotect(tmp_start, size, PROT_READ);
- void* res = mremap(tmp_start, size, size, MREMAP_MAYMOVE | MREMAP_FIXED,
- reinterpret_cast<void*>(aligned_start));
- CHECK(res != MAP_FAILED);
- }
-};
-
-void CFIShadowWriter::FixupVmaName() {
- prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, *shadow_start, kShadowSize, "cfi shadow");
-}
-
-void CFIShadowWriter::AddConstant(uintptr_t begin, uintptr_t end, uint16_t v) {
- uint16_t* shadow_begin = MemToShadow(begin);
- uint16_t* shadow_end = MemToShadow(end - 1) + 1;
-
- ShadowWrite sw(shadow_begin, shadow_end);
- std::fill(sw.begin(), sw.end(), v);
-}
-
-void CFIShadowWriter::AddUnchecked(uintptr_t begin, uintptr_t end) {
- AddConstant(begin, end, kUncheckedShadow);
-}
-
-void CFIShadowWriter::AddInvalid(uintptr_t begin, uintptr_t end) {
- AddConstant(begin, end, kInvalidShadow);
-}
-
-void CFIShadowWriter::Add(uintptr_t begin, uintptr_t end, uintptr_t cfi_check) {
- CHECK((cfi_check & (kCfiCheckAlign - 1)) == 0);
-
- // Don't fill anything below cfi_check. We can not represent those addresses
- // in the shadow, and must make sure at codegen to place all valid call
- // targets above cfi_check.
- begin = std::max(begin, cfi_check) & ~(kShadowAlign - 1);
- uint16_t* shadow_begin = MemToShadow(begin);
- uint16_t* shadow_end = MemToShadow(end - 1) + 1;
-
- ShadowWrite sw(shadow_begin, shadow_end);
- uint16_t sv_begin = ((begin + kShadowAlign - cfi_check) >> kCfiCheckGranularity) + kRegularShadowMin;
-
- // With each step of the loop below, __cfi_check address computation base is increased by
- // 2**ShadowGranularity.
- // To compensate for that, each next shadow value must be increased by 2**ShadowGranularity /
- // 2**CfiCheckGranularity.
- uint16_t sv_step = 1 << (kShadowGranularity - kCfiCheckGranularity);
- uint16_t sv = sv_begin;
- for (uint16_t& s : sw) {
- if (sv < sv_begin) {
- // If shadow value wraps around, also fall back to unchecked. This means the binary is too
- // large. FIXME: consider using a (slow) resolution function instead.
- s = kUncheckedShadow;
- continue;
- }
- // If there is something there already, fall back to unchecked. This may happen in rare cases
- // with MAP_FIXED libraries. FIXME: consider using a (slow) resolution function instead.
- s = (s == kInvalidShadow) ? sv : kUncheckedShadow;
- sv += sv_step;
- }
-}
-
-static soinfo* find_libdl(soinfo* solist) {
- for (soinfo* si = solist; si != nullptr; si = si->next) {
- const char* soname = si->get_soname();
- if (soname && strcmp(soname, "libdl.so") == 0) {
- return si;
- }
- }
- return nullptr;
-}
-
-static uintptr_t soinfo_find_symbol(soinfo* si, const char* s) {
- SymbolName name(s);
- const ElfW(Sym) * sym;
- if (si->find_symbol_by_name(name, nullptr, &sym) && sym) {
- return si->resolve_symbol_address(sym);
- }
- return 0;
-}
-
-uintptr_t soinfo_find_cfi_check(soinfo* si) {
- return soinfo_find_symbol(si, "__cfi_check");
-}
-
-uintptr_t CFIShadowWriter::MapShadow() {
- void* p =
- mmap(nullptr, kShadowSize, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
- CHECK(p != MAP_FAILED);
- return reinterpret_cast<uintptr_t>(p);
-}
-
-bool CFIShadowWriter::AddLibrary(soinfo* si) {
- CHECK(shadow_start != nullptr);
- if (si->base == 0 || si->size == 0) {
- return true;
- }
- uintptr_t cfi_check = soinfo_find_cfi_check(si);
- if (cfi_check == 0) {
- INFO("[ CFI add 0x%zx + 0x%zx %s ]", static_cast<uintptr_t>(si->base),
- static_cast<uintptr_t>(si->size), si->get_soname());
- AddUnchecked(si->base, si->base + si->size);
- return true;
- }
-
- INFO("[ CFI add 0x%zx + 0x%zx %s: 0x%zx ]", static_cast<uintptr_t>(si->base),
- static_cast<uintptr_t>(si->size), si->get_soname(), cfi_check);
-#ifdef __arm__
- // Require Thumb encoding.
- if ((cfi_check & 1UL) != 1UL) {
- DL_ERR("__cfi_check in not a Thumb function in the library \"%s\"", si->get_soname());
- return false;
- }
- cfi_check &= ~1UL;
-#endif
- if ((cfi_check & (kCfiCheckAlign - 1)) != 0) {
- DL_ERR("unaligned __cfi_check in the library \"%s\"", si->get_soname());
- return false;
- }
- Add(si->base, si->base + si->size, cfi_check);
- return true;
-}
-
-// Pass the shadow mapping address to libdl.so. In return, we get an pointer to the location
-// libdl.so uses to store the address.
-bool CFIShadowWriter::NotifyLibDl(soinfo* solist, uintptr_t p) {
- soinfo* libdl = find_libdl(solist);
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_cfi.h
^
|
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "hybris_compat.h"
-
-#include "linker.h"
-#include "linker_debug.h"
-
-#include <algorithm>
-
-#include "private/CFIShadow.h"
-
-// This class keeps the contents of CFI shadow up-to-date with the current set of loaded libraries.
-// See the comment in CFIShadow.h for more context.
-// See documentation in http://clang.llvm.org/docs/ControlFlowIntegrityDesign.html#shared-library-support.
-//
-// Shadow is mapped and initialized lazily as soon as the first CFI-enabled DSO is loaded.
-// It is updated after any library is loaded (but before any constructors are ran), and
-// before any library is unloaded.
-class CFIShadowWriter : private CFIShadow {
- // Returns pointer to the shadow element for an address.
- uint16_t* MemToShadow(uintptr_t x) {
- return reinterpret_cast<uint16_t*>(*shadow_start + MemToShadowOffset(x));
- }
-
- // Update shadow for the address range to the given constant value.
- void AddConstant(uintptr_t begin, uintptr_t end, uint16_t v);
-
- // Update shadow for the address range to kUncheckedShadow.
- void AddUnchecked(uintptr_t begin, uintptr_t end);
-
- // Update shadow for the address range to kInvalidShadow.
- void AddInvalid(uintptr_t begin, uintptr_t end);
-
- // Update shadow for the address range to the given __cfi_check value.
- void Add(uintptr_t begin, uintptr_t end, uintptr_t cfi_check);
-
- // Add a DSO to CFI shadow.
- bool AddLibrary(soinfo* si);
-
- // Map CFI shadow.
- uintptr_t MapShadow();
-
- // Initialize CFI shadow and update its contents for everything in solist if any loaded library is
- // CFI-enabled. If new_si != nullptr, do an incremental check by looking only at new_si; otherwise
- // look at the entire solist.
- bool MaybeInit(soinfo *new_si, soinfo *solist);
-
- // Set a human readable name for the entire shadow region.
- void FixupVmaName();
-
- // Pass the pointer to the mapped shadow region to libdl. Must only be called once.
- // Flips shadow_start to a non-nullptr value.
- bool NotifyLibDl(soinfo *solist, uintptr_t p);
-
- // Pointer to the shadow start address.
- uintptr_t *shadow_start;
-
- bool initial_link_done;
-
- public:
- // Update shadow after loading a DSO.
- // This function will initialize the shadow if it sees a CFI-enabled DSO for the first time.
- // In that case it will retroactively update shadow for all previously loaded DSOs. "solist" is a
- // pointer to the global list.
- // This function must be called before any user code has observed the newly loaded DSO.
- bool AfterLoad(soinfo* si, soinfo *solist);
-
- // Update shadow before unloading a DSO.
- void BeforeUnload(soinfo* si);
-
- // This is called as soon as the initial set of libraries is linked.
- bool InitialLinkDone(soinfo *solist);
-
- // Handle failure to locate __cfi_check for a target address.
- static void CfiFail(uint64_t CallSiteTypeId, void* Ptr, void* DiagData, void *caller_pc);
-};
-
-CFIShadowWriter* get_cfi_shadow();
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_common_types.h
^
|
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <android/dlext.h>
-#include "linked_list.h"
-
-#include <android-base/macros.h>
-
-// TODO(dimitry): move this to linker_defines.h? Unless it is removed by
-// consequent refactoring steps.
-
-// Android uses RELA for aarch64 and x86_64. mips64 still uses REL.
-#if defined(__aarch64__) || defined(__x86_64__)
-#define USE_RELA 1
-#endif
-
-
-struct soinfo;
-
-class SoinfoListAllocator {
- public:
- static LinkedListEntry<soinfo>* alloc();
- static void free(LinkedListEntry<soinfo>* entry);
-
- private:
- // unconstructable
- DISALLOW_IMPLICIT_CONSTRUCTORS(SoinfoListAllocator);
-};
-
-class NamespaceListAllocator {
- public:
- static LinkedListEntry<android_namespace_t>* alloc();
- static void free(LinkedListEntry<android_namespace_t>* entry);
-
- private:
- // unconstructable
- DISALLOW_IMPLICIT_CONSTRUCTORS(NamespaceListAllocator);
-};
-
-typedef LinkedList<soinfo, SoinfoListAllocator> soinfo_list_t;
-typedef LinkedList<android_namespace_t, NamespaceListAllocator> android_namespace_list_t;
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_config.cpp
^
|
@@ -1,604 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_config.h"
-
-#include "linker_globals.h"
-#include "linker_debug.h"
-#include "linker_utils.h"
-
-//#include <android-base/file.h>
-#include <android-base/properties.h>
-#include <android-base/scopeguard.h>
-//#include <android-base/strings.h>
-
-#include <async_safe/log.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <string>
-#include <unordered_map>
-
-#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
-#include <sys/_system_properties.h>
-
-class ConfigParser {
- public:
- enum {
- kPropertyAssign,
- kPropertyAppend,
- kSection,
- kEndOfFile,
- kError,
- };
-
- explicit ConfigParser(std::string&& content)
- : content_(std::move(content)), p_(0), lineno_(0), was_end_of_file_(false) {}
-
- /*
- * Possible return values
- * kPropertyAssign: name is set to property name and value is set to property value
- * kPropertyAppend: same as kPropertyAssign, but the value should be appended
- * kSection: name is set to section name.
- * kEndOfFile: reached end of file.
- * kError: error_msg is set.
- */
- int next_token(std::string* name, std::string* value, std::string* error_msg) {
- std::string line;
- while(NextLine(&line)) {
- size_t found = line.find('#');
- line = trim(line.substr(0, found));
-
- if (line.empty()) {
- continue;
- }
-
- if (line[0] == '[' && line.back() == ']') {
- *name = line.substr(1, line.size() - 2);
- return kSection;
- }
-
- size_t found_assign = line.find('=');
- size_t found_append = line.find("+=");
- if (found_assign != std::string::npos && found_append == std::string::npos) {
- *name = trim(line.substr(0, found_assign));
- *value = trim(line.substr(found_assign + 1));
- return kPropertyAssign;
- }
-
- if (found_append != std::string::npos) {
- *name = trim(line.substr(0, found_append));
- *value = trim(line.substr(found_append + 2));
- return kPropertyAppend;
- }
-
- *error_msg = std::string("invalid format: ") +
- line +
- ", expected \"name = property\", \"name += property\", or \"[section]\"";
- return kError;
- }
-
- // to avoid infinite cycles when programmer makes a mistake
- CHECK(!was_end_of_file_);
- was_end_of_file_ = true;
- return kEndOfFile;
- }
-
- size_t lineno() const {
- return lineno_;
- }
-
- private:
- bool NextLine(std::string* line) {
- if (p_ == std::string::npos) {
- return false;
- }
-
- size_t found = content_.find('\n', p_);
- if (found != std::string::npos) {
- *line = content_.substr(p_, found - p_);
- p_ = found + 1;
- } else {
- *line = content_.substr(p_);
- p_ = std::string::npos;
- }
-
- lineno_++;
- return true;
- }
-
- std::string content_;
- size_t p_;
- size_t lineno_;
- bool was_end_of_file_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(ConfigParser);
-};
-
-class PropertyValue {
- public:
- PropertyValue() = default;
-
- PropertyValue(std::string&& value, size_t lineno)
- : value_(std::move(value)), lineno_(lineno) {}
-
- const std::string& value() const {
- return value_;
- }
-
- void append_value(std::string&& value) {
- value_ = value_ + value;
- // lineno isn't updated as we might have cases like this:
- // property.x = blah
- // property.y = blah
- // property.x += blah
- }
-
- size_t lineno() const {
- return lineno_;
- }
-
- private:
- std::string value_;
- size_t lineno_;
-};
-
-static std::string create_error_msg(const char* file,
- size_t lineno,
- const std::string& msg) {
- char buf[1024];
- snprintf(buf, sizeof(buf), "%s:%zu: error: %s", file, lineno, msg.c_str());
-
- return std::string(buf);
-}
-
-static bool parse_config_file(const char* ld_config_file_path,
- const char* binary_realpath,
- std::unordered_map<std::string, PropertyValue>* properties,
- std::string* error_msg) {
- std::string content;
- if (!readFileToString(ld_config_file_path, &content)) {
- if (errno != ENOENT) {
- *error_msg = std::string("error reading file \"") +
- ld_config_file_path + "\": " + strerror(errno);
- }
- return false;
- }
-
- ConfigParser cp(std::move(content));
-
- std::string section_name;
-
- while (true) {
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_config.h
^
|
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <android/api-level.h>
-
-#include <stdlib.h>
-#include <limits.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-#include <unordered_map>
-
-#include <android-base/macros.h>
-
-class NamespaceLinkConfig {
- public:
- NamespaceLinkConfig() = default;
- NamespaceLinkConfig(const std::string& ns_name, const std::string& shared_libs,
- bool allow_all_shared_libs)
- : ns_name_(ns_name), shared_libs_(shared_libs),
- allow_all_shared_libs_(allow_all_shared_libs) {}
-
- const std::string& ns_name() const {
- return ns_name_;
- }
-
- const std::string& shared_libs() const {
- return shared_libs_;
- }
-
- bool allow_all_shared_libs() const {
- return allow_all_shared_libs_;
- }
-
- private:
- std::string ns_name_;
- std::string shared_libs_;
- bool allow_all_shared_libs_;
-};
-
-class NamespaceConfig {
- public:
- explicit NamespaceConfig(const std::string& name)
- : name_(name), isolated_(false), visible_(false)
- {}
-
- const char* name() const {
- return name_.c_str();
- }
-
- bool isolated() const {
- return isolated_;
- }
-
- bool visible() const {
- return visible_;
- }
-
- const std::vector<std::string>& search_paths() const {
- return search_paths_;
- }
-
- const std::vector<std::string>& permitted_paths() const {
- return permitted_paths_;
- }
-
- const std::vector<std::string>& whitelisted_libs() const {
- return whitelisted_libs_;
- }
-
- const std::vector<NamespaceLinkConfig>& links() const {
- return namespace_links_;
- }
-
- void add_namespace_link(const std::string& ns_name, const std::string& shared_libs,
- bool allow_all_shared_libs) {
- namespace_links_.push_back(NamespaceLinkConfig(ns_name, shared_libs, allow_all_shared_libs));
- }
-
- void set_isolated(bool isolated) {
- isolated_ = isolated;
- }
-
- void set_visible(bool visible) {
- visible_ = visible;
- }
-
- void set_search_paths(std::vector<std::string>&& search_paths) {
- search_paths_ = std::move(search_paths);
- }
-
- void set_permitted_paths(std::vector<std::string>&& permitted_paths) {
- permitted_paths_ = std::move(permitted_paths);
- }
-
- void set_whitelisted_libs(std::vector<std::string>&& whitelisted_libs) {
- whitelisted_libs_ = std::move(whitelisted_libs);
- }
- private:
- const std::string name_;
- bool isolated_;
- bool visible_;
- std::vector<std::string> search_paths_;
- std::vector<std::string> permitted_paths_;
- std::vector<std::string> whitelisted_libs_;
- std::vector<NamespaceLinkConfig> namespace_links_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(NamespaceConfig);
-};
-
-class Config {
- public:
- Config() : target_sdk_version_(__ANDROID_API__) {}
-
- const std::vector<std::unique_ptr<NamespaceConfig>>& namespace_configs() const {
- return namespace_configs_;
- }
-
- const NamespaceConfig* default_namespace_config() const {
- auto it = namespace_configs_map_.find("default");
- return it == namespace_configs_map_.end() ? nullptr : it->second;
- }
-
- int target_sdk_version() const {
- return target_sdk_version_;
- }
-
- // note that this is one time event and therefore there is no need to
- // read every section of the config. Every linker instance needs at
- // most one configuration.
- // Returns false in case of an error. If binary config was not found
- // sets *config = nullptr.
- static bool read_binary_config(const char* ld_config_file_path,
- const char* binary_realpath,
- bool is_asan,
- const Config** config,
- std::string* error_msg);
-
- static std::string get_vndk_version_string(const char delimiter);
- private:
- void clear();
-
- void set_target_sdk_version(int target_sdk_version) {
- target_sdk_version_ = target_sdk_version;
- }
-
- NamespaceConfig* create_namespace_config(const std::string& name);
-
- std::vector<std::unique_ptr<NamespaceConfig>> namespace_configs_;
- std::unordered_map<std::string, NamespaceConfig*> namespace_configs_map_;
- int target_sdk_version_;
-
- DISALLOW_COPY_AND_ASSIGN(Config);
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_config_test.cpp
^
|
@@ -1,307 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-
-#include <gtest/gtest.h>
-
-#include "linker_config.h"
-#include "linker_utils.h"
-
-#include <unistd.h>
-
-#include <android-base/file.h>
-#include <android-base/scopeguard.h>
-#include <android-base/stringprintf.h>
-
-#if defined(__LP64__)
-#define ARCH_SUFFIX "64"
-#else
-#define ARCH_SUFFIX ""
-#endif
-
-static const char* config_str =
- "# comment \n"
- "dir.test = /data/local/tmp\n"
- "\n"
- "[test]\n"
- "\n"
- "enable.target.sdk.version = true\n"
- "additional.namespaces=system\n"
- "additional.namespaces+=vndk\n"
- "additional.namespaces+=vndk_in_system\n"
- "namespace.default.isolated = true\n"
- "namespace.default.search.paths = /vendor/${LIB}\n"
- "namespace.default.permitted.paths = /vendor/${LIB}\n"
- "namespace.default.asan.search.paths = /data\n"
- "namespace.default.asan.search.paths += /vendor/${LIB}\n"
- "namespace.default.asan.permitted.paths = /data:/vendor\n"
- "namespace.default.links = system\n"
- "namespace.default.links += vndk\n"
- // irregular whitespaces are added intentionally for testing purpose
- "namespace.default.link.system.shared_libs= libc.so\n"
- "namespace.default.link.system.shared_libs += libm.so:libdl.so\n"
- "namespace.default.link.system.shared_libs +=libstdc++.so\n"
- "namespace.default.link.vndk.shared_libs = libcutils.so:libbase.so\n"
- "namespace.system.isolated = true\n"
- "namespace.system.visible = true\n"
- "namespace.system.search.paths = /system/${LIB}\n"
- "namespace.system.permitted.paths = /system/${LIB}\n"
- "namespace.system.asan.search.paths = /data:/system/${LIB}\n"
- "namespace.system.asan.permitted.paths = /data:/system\n"
- "namespace.vndk.isolated = tr\n"
- "namespace.vndk.isolated += ue\n" // should be ignored and return as 'false'.
- "namespace.vndk.search.paths = /system/${LIB}/vndk\n"
- "namespace.vndk.asan.search.paths = /data\n"
- "namespace.vndk.asan.search.paths += /system/${LIB}/vndk\n"
- "namespace.vndk.links = default\n"
- "namespace.vndk.link.default.allow_all_shared_libs = true\n"
- "namespace.vndk.link.vndk_in_system.allow_all_shared_libs = true\n"
- "namespace.vndk_in_system.isolated = true\n"
- "namespace.vndk_in_system.visible = true\n"
- "namespace.vndk_in_system.search.paths = /system/${LIB}\n"
- "namespace.vndk_in_system.permitted.paths = /system/${LIB}\n"
- "namespace.vndk_in_system.whitelisted = libz.so:libyuv.so:libtinyxml2.so\n"
- "\n";
-
-static bool write_version(const std::string& path, uint32_t version) {
- std::string content = android::base::StringPrintf("%d", version);
- return android::base::WriteStringToFile(content, path);
-}
-
-static std::vector<std::string> resolve_paths(std::vector<std::string> paths) {
- std::vector<std::string> resolved_paths;
- resolve_paths(paths, &resolved_paths);
- return resolved_paths;
-}
-
-static void run_linker_config_smoke_test(bool is_asan) {
- const std::vector<std::string> kExpectedDefaultSearchPath =
- resolve_paths(is_asan ? std::vector<std::string>({ "/data", "/vendor/lib" ARCH_SUFFIX }) :
- std::vector<std::string>({ "/vendor/lib" ARCH_SUFFIX }));
-
- const std::vector<std::string> kExpectedDefaultPermittedPath =
- resolve_paths(is_asan ? std::vector<std::string>({ "/data", "/vendor" }) :
- std::vector<std::string>({ "/vendor/lib" ARCH_SUFFIX }));
-
- const std::vector<std::string> kExpectedSystemSearchPath =
- resolve_paths(is_asan ? std::vector<std::string>({ "/data", "/system/lib" ARCH_SUFFIX }) :
- std::vector<std::string>({ "/system/lib" ARCH_SUFFIX }));
-
- const std::vector<std::string> kExpectedSystemPermittedPath =
- resolve_paths(is_asan ? std::vector<std::string>({ "/data", "/system" }) :
- std::vector<std::string>({ "/system/lib" ARCH_SUFFIX }));
-
- const std::vector<std::string> kExpectedVndkSearchPath =
- resolve_paths(is_asan ? std::vector<std::string>({ "/data", "/system/lib" ARCH_SUFFIX "/vndk"}) :
- std::vector<std::string>({ "/system/lib" ARCH_SUFFIX "/vndk"}));
-
- TemporaryFile tmp_file;
- close(tmp_file.fd);
- tmp_file.fd = -1;
-
- android::base::WriteStringToFile(config_str, tmp_file.path);
-
- TemporaryDir tmp_dir;
-
- std::string executable_path = std::string(tmp_dir.path) + "/some-binary";
- std::string version_file = std::string(tmp_dir.path) + "/.version";
-
- auto file_guard =
- android::base::make_scope_guard([&version_file] { unlink(version_file.c_str()); });
-
- ASSERT_TRUE(write_version(version_file, 113U)) << strerror(errno);
-
- // read config
- const Config* config = nullptr;
- std::string error_msg;
- ASSERT_TRUE(Config::read_binary_config(tmp_file.path,
- executable_path.c_str(),
- is_asan,
- &config,
- &error_msg)) << error_msg;
- ASSERT_TRUE(config != nullptr);
- ASSERT_TRUE(error_msg.empty());
-
- ASSERT_EQ(113, config->target_sdk_version());
-
- const NamespaceConfig* default_ns_config = config->default_namespace_config();
- ASSERT_TRUE(default_ns_config != nullptr);
-
- ASSERT_TRUE(default_ns_config->isolated());
- ASSERT_FALSE(default_ns_config->visible());
- ASSERT_EQ(kExpectedDefaultSearchPath, default_ns_config->search_paths());
- ASSERT_EQ(kExpectedDefaultPermittedPath, default_ns_config->permitted_paths());
-
- const auto& default_ns_links = default_ns_config->links();
- ASSERT_EQ(2U, default_ns_links.size());
-
- ASSERT_EQ("system", default_ns_links[0].ns_name());
- ASSERT_EQ("libc.so:libm.so:libdl.so:libstdc++.so", default_ns_links[0].shared_libs());
- ASSERT_FALSE(default_ns_links[0].allow_all_shared_libs());
-
- ASSERT_EQ("vndk", default_ns_links[1].ns_name());
- ASSERT_EQ("libcutils.so:libbase.so", default_ns_links[1].shared_libs());
- ASSERT_FALSE(default_ns_links[1].allow_all_shared_libs());
-
- auto& ns_configs = config->namespace_configs();
- ASSERT_EQ(4U, ns_configs.size());
-
- // find second namespace
- const NamespaceConfig* ns_system = nullptr;
- const NamespaceConfig* ns_vndk = nullptr;
- const NamespaceConfig* ns_vndk_in_system = nullptr;
- for (auto& ns : ns_configs) {
- std::string ns_name = ns->name();
- ASSERT_TRUE(ns_name == "system" || ns_name == "default" ||
- ns_name == "vndk" || ns_name == "vndk_in_system")
- << "unexpected ns name: " << ns->name();
-
- if (ns_name == "system") {
- ns_system = ns.get();
- } else if (ns_name == "vndk") {
- ns_vndk = ns.get();
- } else if (ns_name == "vndk_in_system") {
- ns_vndk_in_system = ns.get();
- }
- }
-
- ASSERT_TRUE(ns_system != nullptr) << "system namespace was not found";
-
- ASSERT_TRUE(ns_system->isolated());
- ASSERT_TRUE(ns_system->visible());
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_debug.h
^
|
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-// You can increase the verbosity of debug traces by defining the LD_DEBUG
-// environment variable to a numeric value from 0 to 2 (corresponding to
-// INFO, TRACE, and DEBUG calls in the source). This will only
-// affect new processes being launched.
-
-// By default, traces are sent to logcat, with the "linker" tag. You can
-// change this to go to stdout instead by setting the definition of
-// LINKER_DEBUG_TO_LOG to 0.
-#define LINKER_DEBUG_TO_LOG 1
-
-#define TRACE_DEBUG 1
-#define DO_TRACE_LOOKUP 1
-#define DO_TRACE_RELO 1
-#define DO_TRACE_IFUNC 1
-#define TIMING 0
-#define STATS 0
-#define COUNT_PAGES 0
-
-/*********************************************************************
- * You shouldn't need to modify anything below unless you are adding
- * more debugging information.
- *
- * To enable/disable specific debug options, change the defines above
- *********************************************************************/
-
-#include <unistd.h>
-
-#include <async_safe/log.h>
-#include <async_safe/CHECK.h>
-#include <sys/cdefs-android.h>
-
-__LIBC_HIDDEN__ extern int g_ld_debug_verbosity;
-
-#if LINKER_DEBUG_TO_LOG
-#define _PRINTVF(v, x...) \
- do { \
- if (g_ld_debug_verbosity > (v)) { fprintf(stderr, x); fprintf(stderr, "\n"); } \
- } while (0)
-#else /* !LINKER_DEBUG_TO_LOG */
-#define _PRINTVF(v, x...) \
- do { \
- if (g_ld_debug_verbosity > (v)) { fprintf(stderr, x); fprintf(stderr, "\n"); } \
- } while (0)
-#endif /* !LINKER_DEBUG_TO_LOG */
-
-#define PRINT(x...) _PRINTVF(-1, x)
-#define INFO(x...) _PRINTVF(0, x)
-#define TRACE(x...) _PRINTVF(1, x)
-
-#if TRACE_DEBUG
-#define DEBUG(x...) _PRINTVF(2, "DEBUG: " x)
-#else /* !TRACE_DEBUG */
-#define DEBUG(x...) do {} while (0)
-#endif /* TRACE_DEBUG */
-
-#define TRACE_TYPE(t, x...) do { if (DO_TRACE_##t) { TRACE(x); } } while (0)
-
-#if COUNT_PAGES
-extern uint32_t bitmask[];
-#if defined(__LP64__)
-#define MARK(offset) \
- do { \
- if ((((offset) >> 12) >> 5) < 4096) \
- bitmask[((offset) >> 12) >> 5] |= (1 << (((offset) >> 12) & 31)); \
- } while (0)
-#else
-#define MARK(offset) \
- do { \
- bitmask[((offset) >> 12) >> 3] |= (1 << (((offset) >> 12) & 7)); \
- } while (0)
-#endif
-#else
-#define MARK(x) do {} while (0)
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_dlwarning.cpp
^
|
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_dlwarning.h"
-
-#include <strings.h>
-
-#include <string>
-
-#include "hybris_compat.h"
-
-static std::string current_msg;
-
-void add_dlwarning(const char* sopath, const char* message, const char* value) {
- if (!current_msg.empty()) {
- current_msg += '\n';
- }
-
- current_msg = current_msg + basename(sopath) + ": " + message;
-
- if (value != nullptr) {
- current_msg = current_msg + " \"" + value + "\"";
- }
-}
-
-// Resets the current one (like dlerror but instead of
-// being thread-local it is process-local).
-void get_dlwarning(void* obj, void (*f)(void*, const char*)) {
- if (current_msg.empty()) {
- f(obj, nullptr);
- } else {
- std::string msg = current_msg;
- current_msg.clear();
- f(obj, msg.c_str());
- }
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_dlwarning.h
^
|
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-void add_dlwarning(const char* sopath, const char* message, const char* value = nullptr);
-
-// Resets the current one (like dlerror but instead of
-// being thread-local it is process-local). The user_data
-// is used to avoid forcing user into saving the message
-// to a global variable.
-void get_dlwarning(void* user_data, void (*f)(void*, const char*));
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_exidx_static.c
^
|
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <link.h>
-
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
-
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_gdb_support.cpp
^
|
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_gdb_support.h"
-
-#include <pthread.h>
-
-#include "private/ScopedPthreadMutexLocker.h"
-
-// This function is an empty stub where GDB locates a breakpoint to get notified
-// about linker activity.
-extern "C"
-void __attribute__((noinline)) __attribute__((visibility("default"))) rtld_db_dlactivity();
-
-r_debug _r_debug =
- {1, nullptr, reinterpret_cast<uintptr_t>(&rtld_db_dlactivity), r_debug::RT_CONSISTENT, 0};
-
-static pthread_mutex_t g__r_debug_mutex = PTHREAD_MUTEX_INITIALIZER;
-static link_map* r_debug_head = nullptr;
-
-int _linker_enable_gdb_support = 0;
-
-void insert_link_map_into_debug_map(link_map* map) {
- if (!_linker_enable_gdb_support) return;
-
- // Stick the new library at the end of the list.
- // gdb tends to care more about libc than it does
- // about leaf libraries, and ordering it this way
- // reduces the back-and-forth over the wire.
-
- if(r_debug_head == nullptr && _r_debug.r_map != nullptr) {
- link_map *glibc_link_map = new link_map(*_r_debug.r_map);
- r_debug_head = glibc_link_map;
-
- while(glibc_link_map->l_next != nullptr) {
- link_map *copy_next_link_map = new link_map(*glibc_link_map->l_next);
- glibc_link_map->l_next = copy_next_link_map;
- copy_next_link_map->l_prev = glibc_link_map;
-
- glibc_link_map = copy_next_link_map;
- }
- }
-
- if (r_debug_head != nullptr) {
- r_debug_head->l_prev = map;
- map->l_next = r_debug_head;
- map->l_prev = nullptr;
- } else {
- _r_debug.r_map = map;
- map->l_prev = nullptr;
- map->l_next = nullptr;
- }
- _r_debug.r_map = r_debug_head = map;
-}
-
-void remove_link_map_from_debug_map(link_map* map) {
- if (!_linker_enable_gdb_support) return;
-
- if (r_debug_head == map) {
- r_debug_head = map->l_next;
- }
-
- if (map->l_prev) {
- map->l_prev->l_next = map->l_next;
- }
- if (map->l_next) {
- map->l_next->l_prev = map->l_prev;
- }
-}
-
-void notify_gdb_of_load(link_map* map) {
- ScopedPthreadMutexLocker locker(&g__r_debug_mutex);
-
- _r_debug.r_state = r_debug::RT_ADD;
- rtld_db_dlactivity();
-
- insert_link_map_into_debug_map(map);
-
- _r_debug.r_state = r_debug::RT_CONSISTENT;
- rtld_db_dlactivity();
-}
-
-void notify_gdb_of_unload(link_map* map) {
- ScopedPthreadMutexLocker locker(&g__r_debug_mutex);
-
- _r_debug.r_state = r_debug::RT_DELETE;
- rtld_db_dlactivity();
-
- remove_link_map_from_debug_map(map);
-
- _r_debug.r_state = r_debug::RT_CONSISTENT;
- rtld_db_dlactivity();
-}
-
-void notify_gdb_of_libraries() {
- _r_debug.r_state = r_debug::RT_ADD;
- rtld_db_dlactivity();
- _r_debug.r_state = r_debug::RT_CONSISTENT;
- rtld_db_dlactivity();
-}
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_gdb_support.h
^
|
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <link.h>
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-
-extern int _linker_enable_gdb_support;
-
-void insert_link_map_into_debug_map(link_map* map);
-void remove_link_map_from_debug_map(link_map* map);
-void notify_gdb_of_load(link_map* map);
-void notify_gdb_of_unload(link_map* map);
-void notify_gdb_of_libraries();
-
-extern struct r_debug _r_debug;
-
-__END_DECLS
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_globals.cpp
^
|
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker.h"
-#include "linker_globals.h"
-#include "linker_namespaces.h"
-#include "linker_utils.h"
-#include <stdarg.h>
-//#include "android-base/stringprintf.h"
-
-int g_argc = 0;
-char** g_argv = nullptr;
-char** g_envp = nullptr;
-
-std::unordered_map<uintptr_t, soinfo*> g_soinfo_handles_map;
-
-static char __linker_dl_err_buf[768];
-
-char* linker_get_error_buffer() {
- return &__linker_dl_err_buf[0];
-}
-
-size_t linker_get_error_buffer_size() {
- return sizeof(__linker_dl_err_buf);
-}
-
-void DL_WARN_documented_change(int api_level, const char* doc_link, const char* fmt, ...) {
- std::string result{"Warning: "};
-
- va_list ap;
- va_start(ap, fmt);
- stringAppendV(&result, fmt, ap);
- va_end(ap);
-
- stringAppendF(&result,
- " and will not work when the app moves to API level %d or later "
- "(https://android.googlesource.com/platform/bionic/+/master/%s) "
- "(allowing for now because this app's target API level is still %d)",
- api_level, doc_link, get_application_target_sdk_version());
- DL_WARN("%s", result.c_str());
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_globals.h
^
|
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <link.h>
-#include <stddef.h>
-
-#include <string>
-#include <unordered_map>
-
-#include <async_safe/log.h>
-
-#include <hybris_compat.h>
-
-#define DL_ERR(fmt, x...) \
- do { \
- fprintf(stderr, fmt, ##x); \
- fprintf(stderr, "\n"); \
- } while (false)
-
-#define DL_ERR_NO_PRINT(fmt, x...) \
- do { \
- } while (false)
-
-#define DL_WARN(fmt, x...) \
- do { \
- fprintf(stderr, "WARNING: linker " fmt, ##x); \
- fprintf(stderr, "\n"); \
- } while (false)
-
-void DL_WARN_documented_change(int api_level, const char* doc_link, const char* fmt, ...);
-
-#define DL_ERR_AND_LOG(fmt, x...) \
- do { \
- DL_ERR(fmt, x); \
- PRINT(fmt, x); \
- } while (false)
-
-constexpr ElfW(Versym) kVersymNotNeeded = 0;
-constexpr ElfW(Versym) kVersymGlobal = 1;
-
-// These values are used to call constructors for .init_array && .preinit_array
-extern int g_argc;
-extern char** g_argv;
-extern char** g_envp;
-
-struct soinfo;
-struct android_namespace_t;
-
-extern android_namespace_t *g_default_namespace;
-
-extern std::unordered_map<uintptr_t, soinfo*> g_soinfo_handles_map;
-
-// Error buffer "variable"
-char* linker_get_error_buffer();
-size_t linker_get_error_buffer_size();
-extern void* (*_get_hooked_symbol)(const char *sym, const char *requester);
-
-#ifdef WANT_ARM_TRACING
-extern void *(*_create_wrapper)(const char *symbol, void *function, int wrapper_type);
-#endif
-
-class DlErrorRestorer {
- public:
- DlErrorRestorer() {
- saved_error_msg_ = linker_get_error_buffer();
- }
- ~DlErrorRestorer() {
- strlcpy(linker_get_error_buffer(), saved_error_msg_.c_str(), linker_get_error_buffer_size());
- }
- private:
- std::string saved_error_msg_;
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_libc_support.c
^
|
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "../libc/arch-common/bionic/__dso_handle.h"
-#include "../libc/arch-common/bionic/pthread_atfork.h"
-
-int atexit(void (*function)(void) __attribute__((__unused__))) {
- return -1;
-}
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_libcxx_support.cpp
^
|
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <async_safe/log.h>
-
-void* __find_icu_symbol(const char* symbol_name __attribute__((__unused__))) {
- async_safe_fatal("__find_icu_symbol should not be called in the linker");
-}
-
-extern "C" int __cxa_type_match() {
- async_safe_fatal("__cxa_type_match is not implemented in the linker");
-}
-
-int posix_memalign(void**, size_t, size_t) {
- async_safe_fatal("posix_memalign is not implemented in the linker");
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_logger.cpp
^
|
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_logger.h"
-
-#include <string.h>
-#include <sys/prctl.h>
-#include <unistd.h>
-#include <stdarg.h>
-
-#include <string>
-#include <vector>
-
-#include <async_safe/log.h>
-
-//#include "android-base/strings.h"
-#include "linker_utils.h"
-
-#ifdef DISABLED_FOR_HYBRIS_SUPPORT
-#include "private/CachedProperty.h"
-#endif
-
-#include "hybris_compat.h"
-
-LinkerLogger g_linker_logger;
-bool g_greylist_disabled = false;
-
-#ifdef DISABLED_FOR_HYBRIS_SUPPORT
-static uint32_t ParseProperty(const std::string& value) {
- if (value.empty()) {
- return 0;
- }
-
- std::vector<std::string> options = split(value, ",");
-
- uint32_t flags = 0;
-
- for (const auto& o : options) {
- if (o == "dlerror") {
- flags |= kLogErrors;
- } else if (o == "dlopen") {
- flags |= kLogDlopen;
- } else if (o == "dlsym") {
- flags |= kLogDlsym;
- } else {
- async_safe_format_log(ANDROID_LOG_WARN, "linker", "Ignoring unknown debug.ld option \"%s\"",
- o.c_str());
- }
- }
-
- return flags;
-}
-#endif
-
-#ifdef DISABLED_FOR_HYBRIS_SUPPORT
-static void GetAppSpecificProperty(char* buffer) {
- // Get process basename.
- const char* process_name_start = basename(g_argv[0]);
-
- // Remove ':' and everything after it. This is the naming convention for
- // services: https://developer.android.com/guide/components/services.html
- const char* process_name_end = strchr(process_name_start, ':');
-
- std::string process_name = (process_name_end != nullptr) ?
- std::string(process_name_start, (process_name_end - process_name_start)) :
- std::string(process_name_start);
-
- std::string property_name = std::string("debug.ld.app.") + process_name;
- __system_property_get(property_name.c_str(), buffer);
-}
-#endif
-
-void LinkerLogger::ResetState() {
- // The most likely scenario app is not debuggable and
- // is running on a user build, in which case logging is disabled.
- if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) {
- return;
- }
-
-#ifdef DISABLED_FOR_HYBRIS_SUPPORT
- // This is a convenient place to check whether the greylist should be disabled for testing.
- static CachedProperty greylist_disabled("debug.ld.greylist_disabled");
- bool old_value = g_greylist_disabled;
- g_greylist_disabled = (strcmp(greylist_disabled.Get(), "true") == 0);
- if (g_greylist_disabled != old_value) {
- async_safe_format_log(ANDROID_LOG_INFO, "linker", "%s greylist",
- g_greylist_disabled ? "Disabling" : "Enabling");
- }
-
- flags_ = 0;
-
- // For logging, check the flag applied to all processes first.
- static CachedProperty debug_ld_all("debug.ld.all");
- flags_ |= ParseProperty(debug_ld_all.Get());
-#endif
-
- // Safeguard against a NULL g_argv. Ignore processes started without argv (http://b/33276926).
- if (g_argv == nullptr || g_argv[0] == nullptr) {
- return;
- }
-
-#ifdef DISABLED_FOR_HYBRIS_SUPPORT
- // Otherwise check the app-specific property too.
- // We can't easily cache the property here because argv[0] changes.
- char debug_ld_app[PROP_VALUE_MAX] = {};
- GetAppSpecificProperty(debug_ld_app);
- flags_ |= ParseProperty(debug_ld_app);
-#endif
-}
-
-void LinkerLogger::Log(const char* format, ...) {
- va_list ap;
- va_start(ap, format);
- async_safe_format_log_va_list(ANDROID_LOG_DEBUG, "linker", format, ap);
- va_end(ap);
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_logger.h
^
|
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <stdlib.h>
-#include <limits.h>
-
-#include "private/bionic_systrace.h"
-
-#include <android-base/macros.h>
-
-#define __printflike(x, y) __attribute__((__format__(printf, x, y)))
-#define LD_LOG(type, x...) \
- do { \
- if (g_linker_logger.IsEnabled(type)) { g_linker_logger.Log(x); g_linker_logger.Log("\n"); } \
- } while (0)
-
-constexpr const uint32_t kLogErrors = 1 << 0;
-constexpr const uint32_t kLogDlopen = 1 << 1;
-constexpr const uint32_t kLogDlsym = 1 << 2;
-
-class LinkerLogger {
- public:
- LinkerLogger() : flags_(0) { }
-
- void ResetState();
- void Log(const char* format, ...) __printflike(2, 3);
-
- uint32_t IsEnabled(uint32_t type) {
- return flags_ & type;
- }
-
- private:
- uint32_t flags_;
-
- DISALLOW_COPY_AND_ASSIGN(LinkerLogger);
-};
-
-extern LinkerLogger g_linker_logger;
-extern char** g_argv;
-
-// If the system property debug.ld.greylist_disabled is true, we'll not use the greylist
-// regardless of API level.
-extern bool g_greylist_disabled;
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_main.cpp
^
|
@@ -1,818 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "hybris_compat.h"
-
-#include "linker_main.h"
-
-#include <link.h>
-#include <sys/auxv.h>
-#include <sys/cdefs-android.h>
-#include <stdarg.h>
-
-#include "linker_debug.h"
-#include "linker_cfi.h"
-#include "linker_gdb_support.h"
-#include "linker_globals.h"
-#include "linker_phdr.h"
-#include "linker_tls.h"
-#include "linker_utils.h"
-
-#include "private/bionic_globals.h"
-#include "private/bionic_tls.h"
-#include "private/KernelArgumentBlock.h"
-
-#include "android-base/unique_fd.h"
-//#include "android-base/strings.h"
-//#include "android-base/stringprintf.h"
-
-#include "linker_utils.h"
-
-#ifdef __ANDROID__
-#include "debuggerd/handler.h"
-#endif
-
-#include <async_safe/log.h>
-#include <bionic/libc_init_common.h>
-#include <bionic/pthread_internal.h>
-
-#include <vector>
-
-extern void __libc_init_globals(KernelArgumentBlock&);
-#ifdef DISABLED_FOR_HYBRIS_SUPPORT
-extern void __libc_init_AT_SECURE(KernelArgumentBlock&);
-#endif
-
-
-#ifdef DISABLED_FOR_HYBRIS_SUPPORT
-extern "C" void _start();
-#endif
-
-static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf);
-
-static void get_elf_base_from_phdr(const ElfW(Phdr)* phdr_table, size_t phdr_count,
- ElfW(Addr)* base, ElfW(Addr)* load_bias);
-
-// These should be preserved static to avoid emitting
-// RELATIVE relocations for the part of the code running
-// before linker links itself.
-
-// TODO (dimtiry): remove somain, rename solist to solist_head
-static soinfo* solist;
-static soinfo* sonext;
-static soinfo* somain; // main process, always the one after libdl_info
-static soinfo* solinker;
-static soinfo* vdso; // vdso if present
-
-void solist_add_soinfo(soinfo* si) {
- sonext->next = si;
- sonext = si;
-}
-
-bool solist_remove_soinfo(soinfo* si) {
- soinfo *prev = nullptr, *trav;
- for (trav = solist; trav != nullptr; trav = trav->next) {
- if (trav == si) {
- break;
- }
- prev = trav;
- }
-
- if (trav == nullptr) {
- // si was not in solist
- PRINT("name \"%s\"@%p is not in solist!", si->get_realpath(), si);
- return false;
- }
-
- // prev will never be null, because the first entry in solist is
- // always the static libdl_info.
- CHECK(prev != nullptr);
- prev->next = si->next;
- if (si == sonext) {
- sonext = prev;
- }
-
- return true;
-}
-
-soinfo* solist_get_head() {
-// hybris skip the dummy libdl so info
- return solist->next;
-}
-
-soinfo* solist_get_somain() {
- return (soinfo*)0xDEADBEEF;
-}
-
-soinfo* solist_get_vdso() {
- return vdso;
-}
-
-int g_ld_debug_verbosity;
-
-static std::vector<std::string> g_ld_preload_names;
-
-static std::vector<soinfo*> g_ld_preloads;
-
-static void parse_path(const char* path, const char* delimiters,
- std::vector<std::string>* resolved_paths) {
- std::vector<std::string> paths;
- split_path(path, delimiters, &paths);
- resolve_paths(paths, resolved_paths);
-}
-
-static void parse_LD_LIBRARY_PATH(const char* path) {
- std::vector<std::string> ld_libary_paths;
- parse_path(path, ":", &ld_libary_paths);
- g_default_namespace->set_ld_library_paths(std::move(ld_libary_paths));
-}
-
-static void parse_LD_PRELOAD(const char* path) {
- g_ld_preload_names.clear();
- if (path != nullptr) {
- // We have historically supported ':' as well as ' ' in LD_PRELOAD.
- g_ld_preload_names = split(path, " :");
- g_ld_preload_names.erase(std::remove_if(g_ld_preload_names.begin(), g_ld_preload_names.end(),
- [](const std::string& s) { return s.empty(); }),
- g_ld_preload_names.end());
- }
-}
-
-// An empty list of soinfos
-static soinfo_list_t g_empty_list;
-
-static void add_vdso() {
- ElfW(Ehdr)* ehdr_vdso = reinterpret_cast<ElfW(Ehdr)*>(getauxval(AT_SYSINFO_EHDR));
- if (ehdr_vdso == nullptr) {
- return;
- }
-
- soinfo* si = soinfo_alloc(g_default_namespace, "[vdso]", nullptr, 0, 0);
-
- si->phdr = reinterpret_cast<ElfW(Phdr)*>(reinterpret_cast<char*>(ehdr_vdso) + ehdr_vdso->e_phoff);
- si->phnum = ehdr_vdso->e_phnum;
- si->base = reinterpret_cast<ElfW(Addr)>(ehdr_vdso);
- si->size = phdr_table_get_load_size(si->phdr, si->phnum);
- si->load_bias = get_elf_exec_load_bias(ehdr_vdso);
-
- si->prelink_image();
- si->link_image(g_empty_list, soinfo_list_t::make_list(si), nullptr, nullptr);
- // prevents accidental unloads...
- si->set_dt_flags_1(si->get_dt_flags_1() | DF_1_NODELETE);
- si->set_linked();
- si->call_constructors();
-
- vdso = si;
-}
-
-// Initializes an soinfo's link_map_head field using other fields from the
-// soinfo (phdr, phnum, load_bias).
-static void init_link_map_head(soinfo& info, const char* linker_path) {
- auto& map = info.link_map_head;
- map.l_addr = info.load_bias;
- map.l_name = const_cast<char*>(linker_path);
- phdr_table_get_dynamic_section(info.phdr, info.phnum, info.load_bias, &map.l_ld, nullptr);
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_main.h
^
|
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <android/dlext.h>
-
-#include <unordered_map>
-#include <vector>
-
-#include "linker_namespaces.h"
-#include "linker_soinfo.h"
-
-class ProtectedDataGuard {
- public:
- ProtectedDataGuard();
- ~ProtectedDataGuard();
-
- private:
- void protect_data(int protection);
- static size_t ref_count_;
-};
-
-class ElfReader;
-
-std::vector<android_namespace_t*> init_default_namespaces(const char* executable_path);
-soinfo* soinfo_alloc(android_namespace_t* ns, const char* name,
- const struct stat* file_stat, off64_t file_offset,
- uint32_t rtld_flags);
-
-bool find_libraries(android_namespace_t* ns,
- soinfo* start_with,
- const char* const library_names[],
- size_t library_names_count,
- soinfo* soinfos[],
- std::vector<soinfo*>* ld_preloads,
- size_t ld_preloads_count,
- int rtld_flags,
- const android_dlextinfo* extinfo,
- bool add_as_children,
- bool search_linked_namespaces,
- std::vector<android_namespace_t*>* namespaces = nullptr);
-
-void solist_add_soinfo(soinfo* si);
-bool solist_remove_soinfo(soinfo* si);
-soinfo* solist_get_head();
-soinfo* solist_get_somain();
-soinfo* solist_get_vdso();
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_mapped_file_fragment.cpp
^
|
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_mapped_file_fragment.h"
-#include "linker_debug.h"
-#include "linker_utils.h"
-
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-MappedFileFragment::MappedFileFragment() : map_start_(nullptr), map_size_(0),
- data_(nullptr), size_ (0)
-{ }
-
-MappedFileFragment::~MappedFileFragment() {
- if (map_start_ != nullptr) {
- munmap(map_start_, map_size_);
- }
-}
-
-bool MappedFileFragment::Map(int fd, off64_t base_offset, size_t elf_offset, size_t size) {
- off64_t offset;
- CHECK(safe_add(&offset, base_offset, elf_offset));
-
- off64_t page_min = page_start(offset);
- off64_t end_offset;
-
- CHECK(safe_add(&end_offset, offset, size));
- CHECK(safe_add(&end_offset, end_offset, page_offset(offset)));
-
- size_t map_size = static_cast<size_t>(end_offset - page_min);
- CHECK(map_size >= size);
-
- uint8_t* map_start = static_cast<uint8_t*>(
- mmap64(nullptr, map_size, PROT_READ, MAP_PRIVATE, fd, page_min));
-
- if (map_start == MAP_FAILED) {
- return false;
- }
-
- map_start_ = map_start;
- map_size_ = map_size;
-
- data_ = map_start + page_offset(offset);
- size_ = size;
-
- return true;
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_mapped_file_fragment.h
^
|
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <unistd.h>
-
-#include <android-base/macros.h>
-
-class MappedFileFragment {
- public:
- MappedFileFragment();
- ~MappedFileFragment();
-
- bool Map(int fd, off64_t base_offset, size_t elf_offset, size_t size);
-
- void* data() const { return data_; }
- size_t size() const { return size_; }
- private:
- void* map_start_;
- size_t map_size_;
- void* data_;
- size_t size_;
-
- DISALLOW_COPY_AND_ASSIGN(MappedFileFragment);
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_memory.cpp
^
|
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "private/bionic_allocator.h"
-
-#include <stdlib.h>
-#include <sys/cdefs.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-#include <atomic>
-
-#include <async_safe/log.h>
-#include <sys/syscall.h>
-
-#define gettid() syscall(SYS_gettid)
-
-#if DISABLED_FOR_HYBRIS_SUPPORT
-static BionicAllocator g_bionic_allocator;
-static std::atomic<pid_t> fallback_tid(0);
-
-// Used by libdebuggerd_handler to switch allocators during a crash dump, in
-// case the linker heap is corrupted. Do not use this function.
-extern "C" bool __linker_enable_fallback_allocator() {
- pid_t expected = 0;
- return fallback_tid.compare_exchange_strong(expected, gettid());
-}
-
-extern "C" void __linker_disable_fallback_allocator() {
- pid_t previous = fallback_tid.exchange(0);
- if (previous == 0) {
- async_safe_fatal("attempted to disable unused fallback allocator");
- } else if (previous != gettid()) {
- async_safe_fatal("attempted to disable fallback allocator in use by another thread (%d)",
- previous);
- }
-}
-
-static BionicAllocator& get_fallback_allocator() {
- static BionicAllocator fallback_allocator;
- return fallback_allocator;
-}
-
-#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
-
-static BionicAllocator& get_allocator() {
- if (__predict_false(fallback_tid) && __predict_false(gettid() == fallback_tid)) {
- return get_fallback_allocator();
- }
- return g_bionic_allocator;
-}
-
-void* malloc(size_t byte_count) {
- return get_allocator().alloc(byte_count);
-}
-
-void* calloc(size_t item_count, size_t item_size) {
- return get_allocator().alloc(item_count*item_size);
-}
-
-void* realloc(void* p, size_t byte_count) {
- return get_allocator().realloc(p, byte_count);
-}
-
-void* reallocarray(void* p, size_t item_count, size_t item_size) {
- size_t byte_count;
- if (__builtin_mul_overflow(item_count, item_size, &byte_count)) {
- errno = ENOMEM;
- return nullptr;
- }
- return get_allocator().realloc(p, byte_count);
-}
-
-void free(void* ptr) {
- get_allocator().free(ptr);
-}
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_mips.cpp
^
|
@@ -1,334 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if !defined(__LP64__) && __mips_isa_rev >= 5
-#include <sys/prctl.h>
-#endif
-
-#include "linker.h"
-#include "linker_debug.h"
-#include "linker_globals.h"
-#include "linker_phdr.h"
-#include "linker_relocs.h"
-#include "linker_reloc_iterators.h"
-#include "linker_sleb128.h"
-#include "linker_soinfo.h"
-
-template bool soinfo::relocate<plain_reloc_iterator>(const VersionTracker& version_tracker,
- plain_reloc_iterator&& rel_iterator,
- const soinfo_list_t& global_group,
- const soinfo_list_t& local_group);
-
-template bool soinfo::relocate<packed_reloc_iterator<sleb128_decoder>>(
- const VersionTracker& version_tracker,
- packed_reloc_iterator<sleb128_decoder>&& rel_iterator,
- const soinfo_list_t& global_group,
- const soinfo_list_t& local_group);
-
-template <typename ElfRelIteratorT>
-bool soinfo::relocate(const VersionTracker& version_tracker,
- ElfRelIteratorT&& rel_iterator,
- const soinfo_list_t& global_group,
- const soinfo_list_t& local_group) {
- for (size_t idx = 0; rel_iterator.has_next(); ++idx) {
- const auto rel = rel_iterator.next();
-
- if (rel == nullptr) {
- return false;
- }
-
- ElfW(Word) type = ELFW(R_TYPE)(rel->r_info);
- ElfW(Word) sym = ELFW(R_SYM)(rel->r_info);
-
- ElfW(Addr) reloc = static_cast<ElfW(Addr)>(rel->r_offset + load_bias);
- ElfW(Addr) sym_addr = 0;
- const char* sym_name = nullptr;
-
- DEBUG("Processing \"%s\" relocation at index %zd", get_realpath(), idx);
- if (type == R_GENERIC_NONE) {
- continue;
- }
-
- const ElfW(Sym)* s = nullptr;
- soinfo* lsi = nullptr;
-
- if (sym != 0) {
- sym_name = get_string(symtab_[sym].st_name);
- const version_info* vi = nullptr;
-
- if (!lookup_version_info(version_tracker, sym, sym_name, &vi)) {
- return false;
- }
-
- if (!soinfo_do_lookup(this, sym_name, vi, &lsi, global_group, local_group, &s)) {
- return false;
- }
-
- if (s == nullptr) {
- // mips does not support relocation with weak-undefined symbols
- DL_ERR("cannot locate symbol \"%s\" referenced by \"%s\"...",
- sym_name, get_realpath());
- return false;
- } else {
- // We got a definition.
- sym_addr = lsi->resolve_symbol_address(s);
- }
- count_relocation(kRelocSymbol);
- }
-
- switch (type) {
- case R_MIPS_REL32:
-#if defined(__LP64__)
- // MIPS Elf64_Rel entries contain compound relocations
- // We only handle the R_MIPS_NONE|R_MIPS_64|R_MIPS_REL32 case
- if (ELF64_R_TYPE2(rel->r_info) != R_MIPS_64 ||
- ELF64_R_TYPE3(rel->r_info) != R_MIPS_NONE) {
- DL_ERR("Unexpected compound relocation type:%d type2:%d type3:%d @ %p (%zu)",
- type, static_cast<unsigned>(ELF64_R_TYPE2(rel->r_info)),
- static_cast<unsigned>(ELF64_R_TYPE3(rel->r_info)), rel, idx);
- return false;
- }
-#endif
- count_relocation(s == nullptr ? kRelocAbsolute : kRelocRelative);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO REL32 %08zx <- %08zx %s", static_cast<size_t>(reloc),
- static_cast<size_t>(sym_addr), sym_name ? sym_name : "*SECTIONHDR*");
- if (s != nullptr) {
- *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr;
- } else {
- *reinterpret_cast<ElfW(Addr)*>(reloc) += load_bias;
- }
- break;
- default:
- DL_ERR("unknown reloc type %d @ %p (%zu)", type, rel, idx);
- return false;
- }
- }
- return true;
-}
-
-bool soinfo::mips_relocate_got(const VersionTracker& version_tracker,
- const soinfo_list_t& global_group,
- const soinfo_list_t& local_group) {
- ElfW(Addr)** got = plt_got_;
- if (got == nullptr) {
- return true;
- }
-
- // got[0] is the address of the lazy resolver function.
- // got[1] may be used for a GNU extension.
- // FIXME: maybe this should be in a separate routine?
- if ((flags_ & FLAG_LINKER) == 0) {
- size_t g = 1;
- // Check for the high bit to determine whether to skip got[1]
- if (reinterpret_cast<intptr_t>(got[g]) < 0) {
- g++;
- }
- // Relocate the local GOT entries.
- for (; g < mips_local_gotno_; g++) {
- got[g] = reinterpret_cast<ElfW(Addr)*>(reinterpret_cast<uintptr_t>(got[g]) + load_bias);
- }
- }
-
- // Now for the global GOT entries...
- got = plt_got_ + mips_local_gotno_;
- for (ElfW(Word) sym = mips_gotsym_; sym < mips_symtabno_; sym++, got++) {
- // This is an undefined reference... try to locate it.
- const ElfW(Sym)* local_sym = symtab_ + sym;
- const char* sym_name = get_string(local_sym->st_name);
- soinfo* lsi = nullptr;
- const ElfW(Sym)* s = nullptr;
-
- ElfW(Word) st_visibility = (local_sym->st_other & 0x3);
-
- if (st_visibility == STV_DEFAULT) {
- const version_info* vi = nullptr;
-
- if (!lookup_version_info(version_tracker, sym, sym_name, &vi)) {
- return false;
- }
-
- if (!soinfo_do_lookup(this, sym_name, vi, &lsi, global_group, local_group, &s)) {
- return false;
- }
- } else if (st_visibility == STV_PROTECTED) {
- if (local_sym->st_value == 0) {
- DL_ERR("%s: invalid symbol \"%s\" (PROTECTED/UNDEFINED) ",
- get_realpath(), sym_name);
- return false;
- }
- s = local_sym;
- lsi = this;
- } else {
- DL_ERR("%s: invalid symbol \"%s\" visibility: 0x%x",
- get_realpath(), sym_name, st_visibility);
- return false;
- }
-
- if (s == nullptr) {
- // We only allow an undefined symbol if this is a weak reference.
- if (ELF_ST_BIND(local_sym->st_info) != STB_WEAK) {
- DL_ERR("%s: cannot locate \"%s\"...", get_realpath(), sym_name);
- return false;
- }
- *got = 0;
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_namespaces.cpp
^
|
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_namespaces.h"
-#include "linker_globals.h"
-#include "linker_soinfo.h"
-#include "linker_utils.h"
-
-#include <dlfcn.h>
-#include <algorithm>
-
-bool android_namespace_t::is_accessible(const std::string& file) {
- if (!is_isolated_) {
- return true;
- }
-
- if (!whitelisted_libs_.empty()) {
- const char *lib_name = basename(file.c_str());
- if (std::find(whitelisted_libs_.begin(), whitelisted_libs_.end(),
- lib_name) == whitelisted_libs_.end()) {
- return false;
- }
- }
-
- for (const auto& dir : ld_library_paths_) {
- if (file_is_in_dir(file, dir)) {
- return true;
- }
- }
-
- for (const auto& dir : default_library_paths_) {
- if (file_is_in_dir(file, dir)) {
- return true;
- }
- }
-
- for (const auto& dir : permitted_paths_) {
- if (file_is_under_dir(file, dir)) {
- return true;
- }
- }
-
- return false;
-}
-
-bool android_namespace_t::is_accessible(soinfo* s) {
- auto is_accessible_ftor = [this] (soinfo* si) {
- // This is workaround for apps hacking into soinfo list.
- // and inserting their own entries into it. (http://b/37191433)
- if (!si->has_min_version(3)) {
- DL_WARN("Warning: invalid soinfo version for \"%s\" (assuming inaccessible)",
- si->get_soname());
- return false;
- }
-
- if (si->get_primary_namespace() == this) {
- return true;
- }
-
- const android_namespace_list_t& secondary_namespaces = si->get_secondary_namespaces();
- if (secondary_namespaces.find(this) != secondary_namespaces.end()) {
- return true;
- }
-
- return false;
- };
-
- if (is_accessible_ftor(s)) {
- return true;
- }
-
- return !s->get_parents().visit([&](soinfo* si) {
- return !is_accessible_ftor(si);
- });
-}
-
-// TODO: this is slightly unusual way to construct
-// the global group for relocation. Not every RTLD_GLOBAL
-// library is included in this group for backwards-compatibility
-// reasons.
-//
-// This group consists of the main executable, LD_PRELOADs
-// and libraries with the DF_1_GLOBAL flag set.
-soinfo_list_t android_namespace_t::get_global_group() {
- soinfo_list_t global_group;
- soinfo_list().for_each([&](soinfo* si) {
- if ((si->get_dt_flags_1() & DF_1_GLOBAL) != 0) {
- global_group.push_back(si);
- }
- });
-
- return global_group;
-}
-
-// This function provides a list of libraries to be shared
-// by the namespace. For the default namespace this is the global
-// group (see get_global_group). For all others this is a group
-// of RTLD_GLOBAL libraries (which includes the global group from
-// the default namespace).
-soinfo_list_t android_namespace_t::get_shared_group() {
- if (this == g_default_namespace) {
- return get_global_group();
- }
-
- soinfo_list_t shared_group;
- soinfo_list().for_each([&](soinfo* si) {
- if ((si->get_rtld_flags() & RTLD_GLOBAL) != 0) {
- shared_group.push_back(si);
- }
- });
-
- return shared_group;
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_namespaces.h
^
|
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "linker_common_types.h"
-
-#include <string>
-#include <vector>
-#include <unordered_set>
-
-struct android_namespace_t;
-
-struct android_namespace_link_t {
- public:
- android_namespace_link_t(android_namespace_t* linked_namespace,
- const std::unordered_set<std::string>& shared_lib_sonames,
- bool allow_all_shared_libs)
- : linked_namespace_(linked_namespace), shared_lib_sonames_(shared_lib_sonames),
- allow_all_shared_libs_(allow_all_shared_libs)
- {}
-
- android_namespace_t* linked_namespace() const {
- return linked_namespace_;
- }
-
- const std::unordered_set<std::string>& shared_lib_sonames() const {
- return shared_lib_sonames_;
- }
-
- bool is_accessible(const char* soname) const {
- if (soname == nullptr) {
- return false;
- }
- return allow_all_shared_libs_ || shared_lib_sonames_.find(soname) != shared_lib_sonames_.end();
- }
-
- bool allow_all_shared_libs() const {
- return allow_all_shared_libs_;
- }
-
- private:
- android_namespace_t* const linked_namespace_;
- const std::unordered_set<std::string> shared_lib_sonames_;
- bool allow_all_shared_libs_;
-};
-
-struct android_namespace_t {
- public:
- android_namespace_t() : name_(nullptr), is_isolated_(false), is_greylist_enabled_(false) {}
-
- const char* get_name() const { return name_; }
- void set_name(const char* name) { name_ = name; }
-
- bool is_isolated() const { return is_isolated_; }
- void set_isolated(bool isolated) { is_isolated_ = isolated; }
-
- bool is_greylist_enabled() const { return is_greylist_enabled_; }
- void set_greylist_enabled(bool enabled) { is_greylist_enabled_ = enabled; }
-
- const std::vector<std::string>& get_ld_library_paths() const {
- return ld_library_paths_;
- }
- void set_ld_library_paths(std::vector<std::string>&& library_paths) {
- ld_library_paths_ = std::move(library_paths);
- }
-
- const std::vector<std::string>& get_default_library_paths() const {
- return default_library_paths_;
- }
- void set_default_library_paths(std::vector<std::string>&& library_paths) {
- default_library_paths_ = std::move(library_paths);
- }
- void set_default_library_paths(const std::vector<std::string>& library_paths) {
- default_library_paths_ = library_paths;
- }
-
- const std::vector<std::string>& get_permitted_paths() const {
- return permitted_paths_;
- }
- void set_permitted_paths(std::vector<std::string>&& permitted_paths) {
- permitted_paths_ = std::move(permitted_paths);
- }
- void set_permitted_paths(const std::vector<std::string>& permitted_paths) {
- permitted_paths_ = permitted_paths;
- }
-
- const std::vector<std::string>& get_whitelisted_libs() const {
- return whitelisted_libs_;
- }
- void set_whitelisted_libs(std::vector<std::string>&& whitelisted_libs) {
- whitelisted_libs_ = std::move(whitelisted_libs);
- }
- void set_whitelisted_libs(const std::vector<std::string>& whitelisted_libs) {
- whitelisted_libs_ = whitelisted_libs;
- }
-
- const std::vector<android_namespace_link_t>& linked_namespaces() const {
- return linked_namespaces_;
- }
- void add_linked_namespace(android_namespace_t* linked_namespace,
- const std::unordered_set<std::string>& shared_lib_sonames,
- bool allow_all_shared_libs) {
- linked_namespaces_.push_back(
- android_namespace_link_t(linked_namespace, shared_lib_sonames, allow_all_shared_libs));
- }
-
- void add_soinfo(soinfo* si) {
- soinfo_list_.push_back(si);
- }
-
- void add_soinfos(const soinfo_list_t& soinfos) {
- for (auto si : soinfos) {
- add_soinfo(si);
- }
- }
-
- void remove_soinfo(soinfo* si) {
- soinfo_list_.remove_if([&](soinfo* candidate) {
- return si == candidate;
- });
- }
-
- const soinfo_list_t& soinfo_list() const { return soinfo_list_; }
-
- // For isolated namespaces - checks if the file is on the search path;
- // always returns true for not isolated namespace.
- bool is_accessible(const std::string& path);
-
- // Returns true if si is accessible from this namespace. A soinfo
- // is considered accessible when it belongs to this namespace
- // or one of it's parent soinfos belongs to this namespace.
- bool is_accessible(soinfo* si);
-
- soinfo_list_t get_global_group();
- soinfo_list_t get_shared_group();
-
- private:
- const char* name_;
- bool is_isolated_;
- bool is_greylist_enabled_;
- std::vector<std::string> ld_library_paths_;
- std::vector<std::string> default_library_paths_;
- std::vector<std::string> permitted_paths_;
- std::vector<std::string> whitelisted_libs_;
- // Loader looks into linked namespace if it was not able
- // to find a library in this namespace. Note that library
- // lookup in linked namespaces are limited by the list of
- // shared sonames.
- std::vector<android_namespace_link_t> linked_namespaces_;
- soinfo_list_t soinfo_list_;
-
- DISALLOW_COPY_AND_ASSIGN(android_namespace_t);
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_phdr.cpp
^
|
@@ -1,1110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "hybris_compat.h"
-
-#include "linker_phdr.h"
-
-#include <errno.h>
-#include <string.h>
-#include <sys/mman.h>
-//#include <sys/prctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "linker.h"
-#include "linker_dlwarning.h"
-#include "linker_globals.h"
-#include "linker_debug.h"
-#include "linker_utils.h"
-
-#include <android/api-level.h>
-
-#include "private/CFIShadow.h" // For kLibraryAlignment
-#include "private/bionic_prctl.h"
-
-static int GetTargetElfMachine() {
-#if defined(__arm__)
- return EM_ARM;
-#elif defined(__aarch64__)
- return EM_AARCH64;
-#elif defined(__i386__)
- return EM_386;
-#elif defined(__mips__)
- return EM_MIPS;
-#elif defined(__x86_64__)
- return EM_X86_64;
-#endif
-}
-
-/**
- TECHNICAL NOTE ON ELF LOADING.
-
- An ELF file's program header table contains one or more PT_LOAD
- segments, which corresponds to portions of the file that need to
- be mapped into the process' address space.
-
- Each loadable segment has the following important properties:
-
- p_offset -> segment file offset
- p_filesz -> segment file size
- p_memsz -> segment memory size (always >= p_filesz)
- p_vaddr -> segment's virtual address
- p_flags -> segment flags (e.g. readable, writable, executable)
-
- We will ignore the p_paddr and p_align fields of ElfW(Phdr) for now.
-
- The loadable segments can be seen as a list of [p_vaddr ... p_vaddr+p_memsz)
- ranges of virtual addresses. A few rules apply:
-
- - the virtual address ranges should not overlap.
-
- - if a segment's p_filesz is smaller than its p_memsz, the extra bytes
- between them should always be initialized to 0.
-
- - ranges do not necessarily start or end at page boundaries. Two distinct
- segments can have their start and end on the same page. In this case, the
- page inherits the mapping flags of the latter segment.
-
- Finally, the real load addrs of each segment is not p_vaddr. Instead the
- loader decides where to load the first segment, then will load all others
- relative to the first one to respect the initial range layout.
-
- For example, consider the following list:
-
- [ offset:0, filesz:0x4000, memsz:0x4000, vaddr:0x30000 ],
- [ offset:0x4000, filesz:0x2000, memsz:0x8000, vaddr:0x40000 ],
-
- This corresponds to two segments that cover these virtual address ranges:
-
- 0x30000...0x34000
- 0x40000...0x48000
-
- If the loader decides to load the first segment at address 0xa0000000
- then the segments' load address ranges will be:
-
- 0xa0030000...0xa0034000
- 0xa0040000...0xa0048000
-
- In other words, all segments must be loaded at an address that has the same
- constant offset from their p_vaddr value. This offset is computed as the
- difference between the first segment's load address, and its p_vaddr value.
-
- However, in practice, segments do _not_ start at page boundaries. Since we
- can only memory-map at page boundaries, this means that the bias is
- computed as:
-
- load_bias = phdr0_load_address - PAGE_START(phdr0->p_vaddr)
-
- (NOTE: The value must be used as a 32-bit unsigned integer, to deal with
- possible wrap around UINT32_MAX for possible large p_vaddr values).
-
- And that the phdr0_load_address must start at a page boundary, with
- the segment's real content starting at:
-
- phdr0_load_address + PAGE_OFFSET(phdr0->p_vaddr)
-
- Note that ELF requires the following condition to make the mmap()-ing work:
-
- PAGE_OFFSET(phdr0->p_vaddr) == PAGE_OFFSET(phdr0->p_offset)
-
- The load_bias must be added to any p_vaddr value read from the ELF file to
- determine the corresponding memory address.
-
- **/
-
-#define MAYBE_MAP_FLAG(x, from, to) (((x) & (from)) ? (to) : 0)
-#define PFLAGS_TO_PROT(x) (MAYBE_MAP_FLAG((x), PF_X, PROT_EXEC) | \
- MAYBE_MAP_FLAG((x), PF_R, PROT_READ) | \
- MAYBE_MAP_FLAG((x), PF_W, PROT_WRITE))
-
-ElfReader::ElfReader()
- : did_read_(false), did_load_(false), fd_(-1), file_offset_(0), file_size_(0), phdr_num_(0),
- phdr_table_(nullptr), shdr_table_(nullptr), shdr_num_(0), dynamic_(nullptr), strtab_(nullptr),
- strtab_size_(0), load_start_(nullptr), load_size_(0), load_bias_(0), loaded_phdr_(nullptr),
- mapped_by_caller_(false) {
-}
-
-bool ElfReader::Read(const char* name, int fd, off64_t file_offset, off64_t file_size) {
- if (did_read_) {
- return true;
- }
- name_ = name;
- fd_ = fd;
- file_offset_ = file_offset;
- file_size_ = file_size;
-
- if (ReadElfHeader() &&
- VerifyElfHeader() &&
- ReadProgramHeaders() &&
- ReadSectionHeaders() &&
- ReadDynamicSection()) {
- did_read_ = true;
- }
-
- return did_read_;
-}
-
-bool ElfReader::Load(address_space_params* address_space) {
- CHECK(did_read_);
- if (did_load_) {
- return true;
- }
- if (ReserveAddressSpace(address_space) && LoadSegments() && FindPhdr()) {
- did_load_ = true;
- }
-
- return did_load_;
-}
-
-const char* ElfReader::get_string(ElfW(Word) index) const {
- CHECK(strtab_ != nullptr);
- CHECK(index < strtab_size_);
-
- return strtab_ + index;
-}
-
-bool ElfReader::ReadElfHeader() {
- ssize_t rc = TEMP_FAILURE_RETRY(pread64(fd_, &header_, sizeof(header_), file_offset_));
- if (rc < 0) {
- DL_ERR("can't read file \"%s\": %s", name_.c_str(), strerror(errno));
- return false;
- }
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_phdr.h
^
|
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-/* Declarations related to the ELF program header table and segments.
- *
- * The design goal is to provide an API that is as close as possible
- * to the ELF spec, and does not depend on linker-specific data
- * structures (e.g. the exact layout of struct soinfo).
- */
-
-#include "linker.h"
-#include "linker_mapped_file_fragment.h"
-
-class ElfReader {
- public:
- ElfReader();
-
- bool Read(const char* name, int fd, off64_t file_offset, off64_t file_size);
- bool Load(address_space_params* address_space);
-
- const char* name() const { return name_.c_str(); }
- size_t phdr_count() const { return phdr_num_; }
- ElfW(Addr) load_start() const { return reinterpret_cast<ElfW(Addr)>(load_start_); }
- size_t load_size() const { return load_size_; }
- ElfW(Addr) load_bias() const { return load_bias_; }
- const ElfW(Phdr)* loaded_phdr() const { return loaded_phdr_; }
- const ElfW(Dyn)* dynamic() const { return dynamic_; }
- const char* get_string(ElfW(Word) index) const;
- bool is_mapped_by_caller() const { return mapped_by_caller_; }
- ElfW(Addr) entry_point() const { return header_.e_entry + load_bias_; }
-
- private:
- bool ReadElfHeader();
- bool VerifyElfHeader();
- bool ReadProgramHeaders();
- bool ReadSectionHeaders();
- bool ReadDynamicSection();
- bool ReserveAddressSpace(address_space_params* address_space);
- bool LoadSegments();
- bool FindPhdr();
- bool CheckPhdr(ElfW(Addr));
- bool CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment);
-
- bool did_read_;
- bool did_load_;
- std::string name_;
- int fd_;
- off64_t file_offset_;
- off64_t file_size_;
-
- ElfW(Ehdr) header_;
- size_t phdr_num_;
-
- MappedFileFragment phdr_fragment_;
- const ElfW(Phdr)* phdr_table_;
-
- MappedFileFragment shdr_fragment_;
- const ElfW(Shdr)* shdr_table_;
- size_t shdr_num_;
-
- MappedFileFragment dynamic_fragment_;
- const ElfW(Dyn)* dynamic_;
-
- MappedFileFragment strtab_fragment_;
- const char* strtab_;
- size_t strtab_size_;
-
- // First page of reserved address space.
- void* load_start_;
- // Size in bytes of reserved address space.
- size_t load_size_;
- // Load bias.
- ElfW(Addr) load_bias_;
-
- // Loaded phdr.
- const ElfW(Phdr)* loaded_phdr_;
-
- // Is map owned by the caller
- bool mapped_by_caller_;
-};
-
-size_t phdr_table_get_load_size(const ElfW(Phdr)* phdr_table, size_t phdr_count,
- ElfW(Addr)* min_vaddr = nullptr, ElfW(Addr)* max_vaddr = nullptr);
-
-int phdr_table_protect_segments(const ElfW(Phdr)* phdr_table,
- size_t phdr_count, ElfW(Addr) load_bias);
-
-int phdr_table_unprotect_segments(const ElfW(Phdr)* phdr_table, size_t phdr_count,
- ElfW(Addr) load_bias);
-
-int phdr_table_protect_gnu_relro(const ElfW(Phdr)* phdr_table, size_t phdr_count,
- ElfW(Addr) load_bias);
-
-int phdr_table_serialize_gnu_relro(const ElfW(Phdr)* phdr_table, size_t phdr_count,
- ElfW(Addr) load_bias, int fd, size_t* file_offset);
-
-int phdr_table_map_gnu_relro(const ElfW(Phdr)* phdr_table, size_t phdr_count,
- ElfW(Addr) load_bias, int fd, size_t* file_offset);
-
-#if defined(__arm__)
-int phdr_table_get_arm_exidx(const ElfW(Phdr)* phdr_table, size_t phdr_count, ElfW(Addr) load_bias,
- ElfW(Addr)** arm_exidx, size_t* arm_exidix_count);
-#endif
-
-void phdr_table_get_dynamic_section(const ElfW(Phdr)* phdr_table, size_t phdr_count,
- ElfW(Addr) load_bias, ElfW(Dyn)** dynamic,
- ElfW(Word)* dynamic_flags);
-
-const char* phdr_table_get_interpreter_name(const ElfW(Phdr) * phdr_table, size_t phdr_count,
- ElfW(Addr) load_bias);
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_reloc_iterators.h
^
|
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "linker.h"
-
-#include <string.h>
-
-const size_t RELOCATION_GROUPED_BY_INFO_FLAG = 1;
-const size_t RELOCATION_GROUPED_BY_OFFSET_DELTA_FLAG = 2;
-const size_t RELOCATION_GROUPED_BY_ADDEND_FLAG = 4;
-const size_t RELOCATION_GROUP_HAS_ADDEND_FLAG = 8;
-
-class plain_reloc_iterator {
-#if defined(USE_RELA)
- typedef ElfW(Rela) rel_t;
-#else
- typedef ElfW(Rel) rel_t;
-#endif
- public:
- plain_reloc_iterator(rel_t* rel_array, size_t count)
- : begin_(rel_array), end_(begin_ + count), current_(begin_) {}
-
- bool has_next() {
- return current_ < end_;
- }
-
- rel_t* next() {
- return current_++;
- }
- private:
- rel_t* const begin_;
- rel_t* const end_;
- rel_t* current_;
-
- DISALLOW_COPY_AND_ASSIGN(plain_reloc_iterator);
-};
-
-template <typename decoder_t>
-class packed_reloc_iterator {
-#if defined(USE_RELA)
- typedef ElfW(Rela) rel_t;
-#else
- typedef ElfW(Rel) rel_t;
-#endif
- public:
- explicit packed_reloc_iterator(decoder_t&& decoder)
- : decoder_(decoder) {
- // initialize fields
- memset(&reloc_, 0, sizeof(reloc_));
- relocation_count_ = decoder_.pop_front();
- reloc_.r_offset = decoder_.pop_front();
- relocation_index_ = 0;
- relocation_group_index_ = 0;
- group_size_ = 0;
- }
-
- bool has_next() const {
- return relocation_index_ < relocation_count_;
- }
-
- rel_t* next() {
- if (relocation_group_index_ == group_size_) {
- if (!read_group_fields()) {
- // Iterator is inconsistent state; it should not be called again
- // but in case it is let's make sure has_next() returns false.
- relocation_index_ = relocation_count_ = 0;
- return nullptr;
- }
- }
-
- if (is_relocation_grouped_by_offset_delta()) {
- reloc_.r_offset += group_r_offset_delta_;
- } else {
- reloc_.r_offset += decoder_.pop_front();
- }
-
- if (!is_relocation_grouped_by_info()) {
- reloc_.r_info = decoder_.pop_front();
- }
-
-#if defined(USE_RELA)
- if (is_relocation_group_has_addend() &&
- !is_relocation_grouped_by_addend()) {
- reloc_.r_addend += decoder_.pop_front();
- }
-#endif
-
- relocation_index_++;
- relocation_group_index_++;
-
- return &reloc_;
- }
- private:
- bool read_group_fields() {
- group_size_ = decoder_.pop_front();
- group_flags_ = decoder_.pop_front();
-
- if (is_relocation_grouped_by_offset_delta()) {
- group_r_offset_delta_ = decoder_.pop_front();
- }
-
- if (is_relocation_grouped_by_info()) {
- reloc_.r_info = decoder_.pop_front();
- }
-
- if (is_relocation_group_has_addend() &&
- is_relocation_grouped_by_addend()) {
-#if !defined(USE_RELA)
- // This platform does not support rela, and yet we have it encoded in android_rel section.
- DL_ERR("unexpected r_addend in android.rel section");
- return false;
-#else
- reloc_.r_addend += decoder_.pop_front();
- } else if (!is_relocation_group_has_addend()) {
- reloc_.r_addend = 0;
-#endif
- }
-
- relocation_group_index_ = 0;
- return true;
- }
-
- bool is_relocation_grouped_by_info() {
- return (group_flags_ & RELOCATION_GROUPED_BY_INFO_FLAG) != 0;
- }
-
- bool is_relocation_grouped_by_offset_delta() {
- return (group_flags_ & RELOCATION_GROUPED_BY_OFFSET_DELTA_FLAG) != 0;
- }
-
- bool is_relocation_grouped_by_addend() {
- return (group_flags_ & RELOCATION_GROUPED_BY_ADDEND_FLAG) != 0;
- }
-
- bool is_relocation_group_has_addend() {
- return (group_flags_ & RELOCATION_GROUP_HAS_ADDEND_FLAG) != 0;
- }
-
- decoder_t decoder_;
- size_t relocation_count_;
- size_t group_size_;
- size_t group_flags_;
- size_t group_r_offset_delta_;
- size_t relocation_index_;
- size_t relocation_group_index_;
- rel_t reloc_;
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_relocs.h
^
|
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <elf.h>
-
-#define R_GENERIC_NONE 0 // R_*_NONE is always 0
-
-#if defined (__aarch64__)
-
-#define R_GENERIC_JUMP_SLOT R_AARCH64_JUMP_SLOT
-#define R_GENERIC_GLOB_DAT R_AARCH64_GLOB_DAT
-#define R_GENERIC_RELATIVE R_AARCH64_RELATIVE
-#define R_GENERIC_IRELATIVE R_AARCH64_IRELATIVE
-#define R_GENERIC_TLS_DTPMOD R_AARCH64_TLS_DTPMOD64
-#define R_GENERIC_TLS_DTPREL R_AARCH64_TLS_DTPREL64
-#define R_GENERIC_TLS_TPREL R_AARCH64_TLS_TPREL64
-#define R_GENERIC_TLSDESC R_AARCH64_TLSDESC
-
-#elif defined (__arm__)
-
-#define R_GENERIC_JUMP_SLOT R_ARM_JUMP_SLOT
-#define R_GENERIC_GLOB_DAT R_ARM_GLOB_DAT
-#define R_GENERIC_RELATIVE R_ARM_RELATIVE
-#define R_GENERIC_IRELATIVE R_ARM_IRELATIVE
-#define R_GENERIC_TLS_DTPMOD R_ARM_TLS_DTPMOD32
-#define R_GENERIC_TLS_DTPREL R_ARM_TLS_DTPOFF32
-#define R_GENERIC_TLS_TPREL R_ARM_TLS_TPOFF32
-#define R_GENERIC_TLSDESC R_ARM_TLS_DESC
-
-#elif defined (__i386__)
-
-#define R_GENERIC_JUMP_SLOT R_386_JMP_SLOT
-#define R_GENERIC_GLOB_DAT R_386_GLOB_DAT
-#define R_GENERIC_RELATIVE R_386_RELATIVE
-#define R_GENERIC_IRELATIVE R_386_IRELATIVE
-#define R_GENERIC_TLS_DTPMOD R_386_TLS_DTPMOD32
-#define R_GENERIC_TLS_DTPREL R_386_TLS_DTPOFF32
-#define R_GENERIC_TLS_TPREL R_386_TLS_TPOFF
-#define R_GENERIC_TLSDESC R_386_TLS_DESC
-
-#elif defined (__x86_64__)
-
-#define R_GENERIC_JUMP_SLOT R_X86_64_JUMP_SLOT
-#define R_GENERIC_GLOB_DAT R_X86_64_GLOB_DAT
-#define R_GENERIC_RELATIVE R_X86_64_RELATIVE
-#define R_GENERIC_IRELATIVE R_X86_64_IRELATIVE
-#define R_GENERIC_TLS_DTPMOD R_X86_64_DTPMOD64
-#define R_GENERIC_TLS_DTPREL R_X86_64_DTPOFF64
-#define R_GENERIC_TLS_TPREL R_X86_64_TPOFF64
-#define R_GENERIC_TLSDESC R_X86_64_TLSDESC
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_sdk_versions.cpp
^
|
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker.h"
-#include <android/api-level.h>
-#include <atomic>
-
-static std::atomic<int> g_target_sdk_version(__ANDROID_API__);
-
-void set_application_target_sdk_version(int target) {
- // translate current sdk_version to platform sdk_version
- if (target == 0) {
- target = __ANDROID_API__;
- }
- g_target_sdk_version = target;
-}
-
-int get_application_target_sdk_version() {
- return g_target_sdk_version;
-}
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_sleb128.h
^
|
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <stdint.h>
-
-#include <async_safe/log.h>
-
-#include "linker_debug.h"
-
-// Helper classes for decoding LEB128, used in packed relocation data.
-// http://en.wikipedia.org/wiki/LEB128
-
-class sleb128_decoder {
- public:
- sleb128_decoder(const uint8_t* buffer, size_t count)
- : current_(buffer), end_(buffer+count) { }
-
- size_t pop_front() {
- size_t value = 0;
- static const size_t size = CHAR_BIT * sizeof(value);
-
- size_t shift = 0;
- uint8_t byte;
-
- do {
- if (current_ >= end_) {
- async_safe_fatal("sleb128_decoder ran out of bounds");
- }
- byte = *current_++;
- value |= (static_cast<size_t>(byte & 127) << shift);
- shift += 7;
- } while (byte & 128);
-
- if (shift < size && (byte & 64)) {
- value |= -(static_cast<size_t>(1) << shift);
- }
-
- return value;
- }
-
- private:
- const uint8_t* current_;
- const uint8_t* const end_;
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_sleb128_test.cpp
^
|
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-
-#include <gtest/gtest.h>
-
-#include "linker_sleb128.h"
-
-TEST(linker_sleb128, smoke) {
- std::vector<uint8_t> encoding;
- // 624485
- encoding.push_back(0xe5);
- encoding.push_back(0x8e);
- encoding.push_back(0x26);
- // 0
- encoding.push_back(0x00);
- // 1
- encoding.push_back(0x01);
- // 63
- encoding.push_back(0x3f);
- // 64
- encoding.push_back(0xc0);
- encoding.push_back(0x00);
- // -1
- encoding.push_back(0x7f);
- // -624485
- encoding.push_back(0x9b);
- encoding.push_back(0xf1);
- encoding.push_back(0x59);
- // 2147483647
- encoding.push_back(0xff);
- encoding.push_back(0xff);
- encoding.push_back(0xff);
- encoding.push_back(0xff);
- encoding.push_back(0x07);
- // -2147483648
- encoding.push_back(0x80);
- encoding.push_back(0x80);
- encoding.push_back(0x80);
- encoding.push_back(0x80);
- encoding.push_back(0x78);
-#if defined(__LP64__)
- // 9223372036854775807
- encoding.push_back(0xff);
- encoding.push_back(0xff);
- encoding.push_back(0xff);
- encoding.push_back(0xff);
- encoding.push_back(0xff);
- encoding.push_back(0xff);
- encoding.push_back(0xff);
- encoding.push_back(0xff);
- encoding.push_back(0xff);
- encoding.push_back(0x00);
- // -9223372036854775808
- encoding.push_back(0x80);
- encoding.push_back(0x80);
- encoding.push_back(0x80);
- encoding.push_back(0x80);
- encoding.push_back(0x80);
- encoding.push_back(0x80);
- encoding.push_back(0x80);
- encoding.push_back(0x80);
- encoding.push_back(0x80);
- encoding.push_back(0x7f);
-#endif
- sleb128_decoder decoder(&encoding[0], encoding.size());
-
- EXPECT_EQ(624485U, decoder.pop_front());
-
- EXPECT_EQ(0U, decoder.pop_front());
- EXPECT_EQ(1U, decoder.pop_front());
- EXPECT_EQ(63U, decoder.pop_front());
- EXPECT_EQ(64U, decoder.pop_front());
- EXPECT_EQ(static_cast<size_t>(-1), decoder.pop_front());
- EXPECT_EQ(static_cast<size_t>(-624485), decoder.pop_front());
- EXPECT_EQ(2147483647U, decoder.pop_front());
- EXPECT_EQ(static_cast<size_t>(-2147483648), decoder.pop_front());
-#if defined(__LP64__)
- EXPECT_EQ(9223372036854775807ULL, decoder.pop_front());
- EXPECT_EQ(static_cast<uint64_t>(-9223372036854775807LL - 1), decoder.pop_front());
-#endif
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_soinfo.cpp
^
|
@@ -1,847 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_soinfo.h"
-
-#include <dlfcn.h>
-#include <elf.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <android/api-level.h>
-
-#include <async_safe/log.h>
-
-#include "linker_debug.h"
-#include "linker_globals.h"
-#include "linker_logger.h"
-#include "linker_utils.h"
-
-#include "hybris_compat.h"
-
-#define ELF_ST_TYPE(x) ((x) & 0xf)
-
-// TODO(dimitry): These functions are currently located in linker.cpp - find a better place for it
-bool find_verdef_version_index(const soinfo* si, const version_info* vi, ElfW(Versym)* versym);
-ElfW(Addr) call_ifunc_resolver(ElfW(Addr) resolver_addr);
-int get_application_target_sdk_version();
-
-soinfo::soinfo(android_namespace_t* ns, const char* realpath,
- const struct stat* file_stat, off64_t file_offset,
- int rtld_flags) {
-// memset(this, 0, sizeof(*this));
-
- if (realpath != nullptr) {
- realpath_ = realpath;
- }
-
- flags_ = FLAG_NEW_SOINFO;
- version_ = SOINFO_VERSION;
-
- if (file_stat != nullptr) {
- this->st_dev_ = file_stat->st_dev;
- this->st_ino_ = file_stat->st_ino;
- this->file_offset_ = file_offset;
- }
-
- this->rtld_flags_ = rtld_flags;
- this->primary_namespace_ = ns;
-}
-
-soinfo::~soinfo() {
- g_soinfo_handles_map.erase(handle_);
-}
-
-void soinfo::set_dt_runpath(const char* path) {
- if (!has_min_version(3)) {
- return;
- }
-
- std::vector<std::string> runpaths;
-
- split_path(path, ":", &runpaths);
-
- std::string origin = dirname(get_realpath());
- // FIXME: add $PLATFORM.
- std::vector<std::pair<std::string, std::string>> params = {
- {"ORIGIN", origin},
-/*#if defined(LIB_PATH)
- {"LIB", LIB_PATH},
-#else
-#error "LIB_PATH not defined"
-#endif*/
- };
- for (auto&& s : runpaths) {
- format_string(&s, params);
- }
-
- resolve_paths(runpaths, &dt_runpath_);
-}
-
-const ElfW(Versym)* soinfo::get_versym(size_t n) const {
- if (has_min_version(2) && versym_ != nullptr) {
- return versym_ + n;
- }
-
- return nullptr;
-}
-
-ElfW(Addr) soinfo::get_verneed_ptr() const {
- if (has_min_version(2)) {
- return verneed_ptr_;
- }
-
- return 0;
-}
-
-size_t soinfo::get_verneed_cnt() const {
- if (has_min_version(2)) {
- return verneed_cnt_;
- }
-
- return 0;
-}
-
-ElfW(Addr) soinfo::get_verdef_ptr() const {
- if (has_min_version(2)) {
- return verdef_ptr_;
- }
-
- return 0;
-}
-
-size_t soinfo::get_verdef_cnt() const {
- if (has_min_version(2)) {
- return verdef_cnt_;
- }
-
- return 0;
-}
-
-bool soinfo::find_symbol_by_name(SymbolName& symbol_name,
- const version_info* vi,
- const ElfW(Sym)** symbol) const {
- uint32_t symbol_index;
- bool success =
- is_gnu_hash() ?
- gnu_lookup(symbol_name, vi, &symbol_index) :
- elf_lookup(symbol_name, vi, &symbol_index);
-
- if (success) {
- *symbol = symbol_index == 0 ? nullptr : symtab_ + symbol_index;
- }
-
- return success;
-}
-
-static bool is_symbol_global_and_defined(const soinfo* si, const ElfW(Sym)* s) {
- if (ELF_ST_BIND(s->st_info) == STB_GLOBAL ||
- ELF_ST_BIND(s->st_info) == STB_WEAK) {
- return s->st_shndx != SHN_UNDEF;
- } else if (ELF_ST_BIND(s->st_info) != STB_LOCAL) {
- DL_WARN("Warning: unexpected ST_BIND value: %d for \"%s\" in \"%s\" (ignoring)",
- ELF_ST_BIND(s->st_info), si->get_string(s->st_name), si->get_realpath());
- }
-
- return false;
-}
-
-static const ElfW(Versym) kVersymHiddenBit = 0x8000;
-
-static inline bool is_versym_hidden(const ElfW(Versym)* versym) {
- // the symbol is hidden if bit 15 of versym is set.
- return versym != nullptr && (*versym & kVersymHiddenBit) != 0;
-}
-
-static inline bool check_symbol_version(const ElfW(Versym) verneed,
- const ElfW(Versym)* verdef) {
- return verneed == kVersymNotNeeded ||
- verdef == nullptr ||
- verneed == (*verdef & ~kVersymHiddenBit);
-}
-
-bool soinfo::gnu_lookup(SymbolName& symbol_name,
- const version_info* vi,
- uint32_t* symbol_index) const {
- uint32_t hash = symbol_name.gnu_hash();
- uint32_t h2 = hash >> gnu_shift2_;
-
- uint32_t bloom_mask_bits = sizeof(ElfW(Addr))*8;
- uint32_t word_num = (hash / bloom_mask_bits) & gnu_maskwords_;
- ElfW(Addr) bloom_word = gnu_bloom_filter_[word_num];
-
- *symbol_index = 0;
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_soinfo.h
^
|
@@ -1,398 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <link.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "private/bionic_elf_tls.h"
-#include "linker_namespaces.h"
-#include "linker_tls.h"
-
-#define FLAG_LINKED 0x00000001
-#define FLAG_EXE 0x00000004 // The main executable
-#define FLAG_LINKER 0x00000010 // The linker itself
-#define FLAG_GNU_HASH 0x00000040 // uses gnu hash
-#define FLAG_MAPPED_BY_CALLER 0x00000080 // the map is reserved by the caller
- // and should not be unmapped
-#define FLAG_IMAGE_LINKED 0x00000100 // Is image linked - this is a guard on link_image.
- // The difference between this flag and
- // FLAG_LINKED is that FLAG_LINKED
- // means is set when load_group is
- // successfully loaded whereas this
- // flag is set to avoid linking image
- // when link_image called for the
- // second time. This situation happens
- // when load group is crossing
- // namespace boundary twice and second
- // local group depends on the same libraries.
-#define FLAG_RESERVED 0x00000200 // This flag was set when there is at least one
- // outstanding thread_local dtor
- // registered with this soinfo. In such
- // a case the actual unload is
- // postponed until the last thread_local
- // destructor associated with this
- // soinfo is executed and this flag is
- // unset.
-#define FLAG_NEW_SOINFO 0x40000000 // new soinfo format
-
-#define SOINFO_VERSION 5
-
-typedef void (*linker_dtor_function_t)();
-typedef void (*linker_ctor_function_t)(int, char**, char**);
-
-class SymbolName {
- public:
- explicit SymbolName(const char* name)
- : name_(name), has_elf_hash_(false), has_gnu_hash_(false),
- elf_hash_(0), gnu_hash_(0) { }
-
- const char* get_name() {
- return name_;
- }
-
- uint32_t elf_hash();
- uint32_t gnu_hash();
-
- private:
- const char* name_;
- bool has_elf_hash_;
- bool has_gnu_hash_;
- uint32_t elf_hash_;
- uint32_t gnu_hash_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolName);
-};
-
-struct version_info {
- constexpr version_info() : elf_hash(0), name(nullptr), target_si(nullptr) {}
-
- uint32_t elf_hash;
- const char* name;
- const soinfo* target_si;
-};
-
-// TODO(dimitry): remove reference from soinfo member functions to this class.
-class VersionTracker;
-
-struct soinfo_tls {
- TlsSegment segment;
- size_t module_id = kTlsUninitializedModuleId;
-};
-
-#if defined(__work_around_b_24465209__)
-#define SOINFO_NAME_LEN 128
-#endif
-
-struct soinfo {
-#if defined(__work_around_b_24465209__)
- private:
- char old_name_[SOINFO_NAME_LEN];
-#endif
- public:
- const ElfW(Phdr)* phdr;
- size_t phnum;
-#if defined(__work_around_b_24465209__)
- ElfW(Addr) unused0; // DO NOT USE, maintained for compatibility.
-#endif
- ElfW(Addr) base;
- size_t size;
-
-#if defined(__work_around_b_24465209__)
- uint32_t unused1; // DO NOT USE, maintained for compatibility.
-#endif
-
- ElfW(Dyn)* dynamic;
-
-#if defined(__work_around_b_24465209__)
- uint32_t unused2; // DO NOT USE, maintained for compatibility
- uint32_t unused3; // DO NOT USE, maintained for compatibility
-#endif
-
- soinfo* next;
- private:
- uint32_t flags_;
-
- const char* strtab_;
- ElfW(Sym)* symtab_;
-
- size_t nbucket_;
- size_t nchain_;
- uint32_t* bucket_;
- uint32_t* chain_;
-
-#if defined(__mips__) || !defined(__LP64__)
- // This is only used by mips and mips64, but needs to be here for
- // all 32-bit architectures to preserve binary compatibility.
- ElfW(Addr)** plt_got_;
-#endif
-
-#if defined(USE_RELA)
- ElfW(Rela)* plt_rela_;
- size_t plt_rela_count_;
-
- ElfW(Rela)* rela_;
- size_t rela_count_;
-#else
- ElfW(Rel)* plt_rel_;
- size_t plt_rel_count_;
-
- ElfW(Rel)* rel_;
- size_t rel_count_;
-#endif
-
- linker_ctor_function_t* preinit_array_;
- size_t preinit_array_count_;
-
- linker_ctor_function_t* init_array_;
- size_t init_array_count_;
- linker_dtor_function_t* fini_array_;
- size_t fini_array_count_;
-
- linker_ctor_function_t init_func_;
- linker_dtor_function_t fini_func_;
-
-#if defined(__arm__)
- public:
- // ARM EABI section used for stack unwinding.
- uint32_t* ARM_exidx;
- size_t ARM_exidx_count;
- private:
-#elif defined(__mips__)
- uint32_t mips_symtabno_;
- uint32_t mips_local_gotno_;
- uint32_t mips_gotsym_;
- bool mips_relocate_got(const VersionTracker& version_tracker,
- const soinfo_list_t& global_group,
- const soinfo_list_t& local_group);
-#if !defined(__LP64__)
- bool mips_check_and_adjust_fp_modes();
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_test_globals.cpp
^
|
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-// To enable logging
-int g_ld_debug_verbosity = 0;
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_tls.cpp
^
|
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_tls.h"
-
-#include <vector>
-
-#include <android/versioning.h>
-#include "async_safe/CHECK.h"
-#include "private/ScopedRWLock.h"
-#include "private/ScopedSignalBlocker.h"
-#include "private/bionic_defs.h"
-#include "private/bionic_elf_tls.h"
-#include "private/bionic_globals.h"
-#include "private/linker_native_bridge.h"
-#include "linker_main.h"
-#include "linker_soinfo.h"
-#include <stdint.h>
-
-__LIBC_HIDDEN__ _Atomic(size_t) __libc_tls_generation_copy = {SIZE_MAX};
-
-static bool g_static_tls_finished;
-static std::vector<TlsModule> g_tls_modules;
-
-static size_t get_unused_module_index() {
- for (size_t i = 0; i < g_tls_modules.size(); ++i) {
- if (g_tls_modules[i].soinfo_ptr == nullptr) {
- return i;
- }
- }
- g_tls_modules.push_back({});
- __libc_shared_globals()->tls_modules.module_count = g_tls_modules.size();
- __libc_shared_globals()->tls_modules.module_table = g_tls_modules.data();
- return g_tls_modules.size() - 1;
-}
-
-#if 0
-static void register_tls_module(soinfo* si, size_t static_offset) {
- TlsModules& libc_modules = __libc_shared_globals()->tls_modules;
-
- // The global TLS module table points at the std::vector of modules declared
- // in this file, so acquire a write lock before modifying the std::vector.
- ScopedSignalBlocker ssb;
- ScopedWriteLock locker(&libc_modules.rwlock);
-
- size_t module_idx = get_unused_module_index();
-
- soinfo_tls* si_tls = si->get_tls();
- si_tls->module_id = __tls_module_idx_to_id(module_idx);
-
- const size_t new_generation = ++libc_modules.generation;
- __libc_tls_generation_copy = new_generation;
- if (libc_modules.generation_libc_so != nullptr) {
- *libc_modules.generation_libc_so = new_generation;
- }
-
- g_tls_modules[module_idx] = {
- .segment = si_tls->segment,
- .static_offset = static_offset,
- .first_generation = new_generation,
- .soinfo_ptr = si,
- };
-}
-#endif
-
-#if 0
-static void unregister_tls_module(soinfo* si) {
- ScopedSignalBlocker ssb;
- ScopedWriteLock locker(&__libc_shared_globals()->tls_modules.rwlock);
-
- soinfo_tls* si_tls = si->get_tls();
- TlsModule& mod = g_tls_modules[__tls_module_id_to_idx(si_tls->module_id)];
- CHECK(mod.static_offset == SIZE_MAX);
- CHECK(mod.soinfo_ptr == si);
- mod = {};
- si_tls->module_id = kTlsUninitializedModuleId;
-}
-#endif
-
-// The reference is valid until a TLS module is registered or unregistered.
-const TlsModule& get_tls_module(size_t module_id) {
- size_t module_idx = __tls_module_id_to_idx(module_id);
- CHECK(module_idx < g_tls_modules.size());
- return g_tls_modules[module_idx];
-}
-
-extern "C" void __linker_reserve_bionic_tls_in_static_tls() {
- //__libc_shared_globals()->static_tls_layout.reserve_bionic_tls();
-}
-
-void linker_setup_exe_static_tls(const char* progname) {
- soinfo* somain = solist_get_somain();
- StaticTlsLayout& layout = __libc_shared_globals()->static_tls_layout;
- if (somain->get_tls() == nullptr) {
- //layout.reserve_exe_segment_and_tcb(nullptr, progname);
- } else {
- //register_tls_module(somain, layout.reserve_exe_segment_and_tcb(&somain->get_tls()->segment, progname));
- }
-
- // The pthread key data is located at the very front of bionic_tls. As a
- // temporary workaround, allocate bionic_tls just after the thread pointer so
- // Golang can find its pthread key, as long as the executable's TLS segment is
- // small enough. Specifically, Golang scans forward 384 words from the TP on
- // ARM.
- // - http://b/118381796
- // - https://github.com/golang/go/issues/29674
- __linker_reserve_bionic_tls_in_static_tls();
-}
-
-void linker_finalize_static_tls() {
- g_static_tls_finished = true;
- //__libc_shared_globals()->static_tls_layout.finish_layout();
-}
-
-void register_soinfo_tls(soinfo* si) {
- soinfo_tls* si_tls = si->get_tls();
- if (si_tls == nullptr || si_tls->module_id != kTlsUninitializedModuleId) {
- return;
- }
- size_t static_offset = SIZE_MAX;
- if (!g_static_tls_finished) {
- StaticTlsLayout& layout = __libc_shared_globals()->static_tls_layout;
- //static_offset = layout.reserve_solib_segment(si_tls->segment);
- }
- // register_tls_module(si, static_offset);
-}
-
-void unregister_soinfo_tls(soinfo* si) {
- soinfo_tls* si_tls = si->get_tls();
- if (si_tls == nullptr || si_tls->module_id == kTlsUninitializedModuleId) {
- return;
- }
- // return unregister_tls_module(si);
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_tls.h
^
|
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <stdlib.h>
-
-#include "private/bionic_elf_tls.h"
-
-struct TlsModule;
-struct soinfo;
-
-void linker_setup_exe_static_tls(const char* progname);
-void linker_finalize_static_tls();
-
-void register_soinfo_tls(soinfo* si);
-void unregister_soinfo_tls(soinfo* si);
-
-const TlsModule& get_tls_module(size_t module_id);
-
-typedef size_t TlsDescResolverFunc(size_t);
-
-struct TlsDescriptor {
-#if defined(__arm__)
- size_t arg;
- TlsDescResolverFunc* func;
-#else
- TlsDescResolverFunc* func;
- size_t arg;
-#endif
-};
-
-struct TlsDynamicResolverArg {
- size_t generation;
- TlsIndex index;
-};
-
-extern "C" size_t tlsdesc_resolver_static(size_t);
-extern "C" size_t tlsdesc_resolver_dynamic(size_t);
-extern "C" size_t tlsdesc_resolver_unresolved_weak(size_t);
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_utils.cpp
^
|
@@ -1,425 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_utils.h"
-
-#include "linker_debug.h"
-#include "linker_globals.h"
-
-//#include "android-base/strings.h"
-#include "android-base/file.h"
-#include <android-base/unique_fd.h>
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <linux/limits.h>
-#include <fcntl.h>
-
-#include <sstream>
-
-#include "hybris_compat.h"
-
-std::string trim(const std::string& s) {
- std::string result;
-
- if (s.size() == 0) {
- return result;
- }
-
- size_t start_index = 0;
- size_t end_index = s.size() - 1;
-
- // Skip initial whitespace.
- while (start_index < s.size()) {
- if (!isspace(s[start_index])) {
- break;
- }
- start_index++;
- }
-
- // Skip terminating whitespace.
- while (end_index >= start_index) {
- if (!isspace(s[end_index])) {
- break;
- }
- end_index--;
- }
-
- // All spaces, no beef.
- if (end_index < start_index) {
- return "";
- }
- // Start_index is the first non-space, end_index is the last one.
- return s.substr(start_index, end_index - start_index + 1);
-}
-
-std::vector<std::string> split(const std::string &text, const std::string &sep) {
- std::vector<std::string> tokens;
- std::size_t start = 0, end = 0;
- while ((end = text.find(sep, start)) != std::string::npos) {
- tokens.push_back(text.substr(start, end - start));
- start = end + 1;
- }
- tokens.push_back(text.substr(start));
- return tokens;
-}
-
-std::string join(const std::vector<std::string>& things, char separator) {
- if (things.empty()) {
- return "";
- }
- std::ostringstream result;
- result << *things.begin();
- for (auto it = std::next(things.begin()); it != things.end(); ++it) {
- result << separator << *it;
- }
- return result.str();
-}
-
-void format_string(std::string* str, const std::vector<std::pair<std::string, std::string>>& params) {
- size_t pos = 0;
- while (pos < str->size()) {
- pos = str->find("$", pos);
- if (pos == std::string::npos) break;
- for (const auto& param : params) {
- const std::string& token = param.first;
- const std::string& replacement = param.second;
- if (str->substr(pos + 1, token.size()) == token) {
- str->replace(pos, token.size() + 1, replacement);
- // -1 to compensate for the ++pos below.
- pos += replacement.size() - 1;
- break;
- } else if (str->substr(pos + 1, token.size() + 2) == "{" + token + "}") {
- str->replace(pos, token.size() + 3, replacement);
- pos += replacement.size() - 1;
- break;
- }
- }
- // Skip $ in case it did not match any of the known substitutions.
- ++pos;
- }
-}
-
-std::string dirname(const char* path) {
- const char* last_slash = strrchr(path, '/');
-
- if (last_slash == path) {
- return "/";
- } else if (last_slash == nullptr) {
- return ".";
- } else {
- return std::string(path, last_slash - path);
- }
-}
-
-bool normalize_path(const char* path, std::string* normalized_path) {
- // Input should be an absolute path
- if (path[0] != '/') {
- PRINT("normalize_path - invalid input: \"%s\", the input path should be absolute", path);
- return false;
- }
-
- const size_t len = strlen(path) + 1;
- char buf[len];
-
- const char* in_ptr = path;
- char* out_ptr = buf;
-
- while (*in_ptr != 0) {
- if (*in_ptr == '/') {
- char c1 = in_ptr[1];
- if (c1 == '.') {
- char c2 = in_ptr[2];
- if (c2 == '/') {
- in_ptr += 2;
- continue;
- } else if (c2 == '.' && (in_ptr[3] == '/' || in_ptr[3] == 0)) {
- in_ptr += 3;
- while (out_ptr > buf && *--out_ptr != '/') {
- }
- if (in_ptr[0] == 0) {
- // retain '/' (or write the initial '/' for "/..")
- *out_ptr++ = '/';
- }
- continue;
- }
- } else if (c1 == '/') {
- ++in_ptr;
- continue;
- }
- }
- *out_ptr++ = *in_ptr++;
- }
-
- *out_ptr = 0;
- *normalized_path = buf;
- return true;
-}
-
-bool file_is_in_dir(const std::string& file, const std::string& dir) {
- const char* needle = dir.c_str();
- const char* haystack = file.c_str();
- size_t needle_len = strlen(needle);
-
- return strncmp(haystack, needle, needle_len) == 0 &&
- haystack[needle_len] == '/' &&
- strchr(haystack + needle_len + 1, '/') == nullptr;
-}
-
-bool file_is_under_dir(const std::string& file, const std::string& dir) {
- const char* needle = dir.c_str();
- const char* haystack = file.c_str();
- size_t needle_len = strlen(needle);
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_utils.h
^
|
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <string>
-#include <vector>
-
-std::string trim(const std::string& s);
-std::vector<std::string> split(const std::string &text, const std::string &sep);
-std::string join(const std::vector<std::string>& things, char separator);
-
-extern const char* const kZipFileSeparator;
-
-void format_string(std::string* str, const std::vector<std::pair<std::string, std::string>>& params);
-
-bool file_is_in_dir(const std::string& file, const std::string& dir);
-bool file_is_under_dir(const std::string& file, const std::string& dir);
-bool normalize_path(const char* path, std::string* normalized_path);
-bool parse_zip_path(const char* input_path, std::string* zip_path, std::string* entry_path);
-
-// For every path element this function checks of it exists, and is a directory,
-// and normalizes it:
-// 1. For regular path it converts it to realpath()
-// 2. For path in a zip file it uses realpath on the zipfile
-// normalizes entry name by calling normalize_path function.
-void resolve_paths(std::vector<std::string>& paths,
- std::vector<std::string>* resolved_paths);
-
-void split_path(const char* path, const char* delimiters, std::vector<std::string>* paths);
-
-std::string dirname(const char* path);
-
-off64_t page_start(off64_t offset);
-size_t page_offset(off64_t offset);
-bool safe_add(off64_t* out, off64_t a, size_t b);
-bool is_first_stage_init();
-
-void stringAppendV(std::string* dst, const char* format, va_list ap);
-void stringAppendF(std::string* dst, const char* format, ...);
-std::string stringPrintf(const char* fmt, ...);
-bool startsWith(const std::string& s, const char* prefix);
-bool endsWith(const std::string& s, const char* suffix);
-bool readFileToString(const std::string& path, std::string* content, bool follow_symlinks = false);
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_utils_test.cpp
^
|
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-
-#include <gtest/gtest.h>
-
-#include "linker_utils.h"
-
-TEST(linker_utils, format_string) {
- std::vector<std::pair<std::string, std::string>> params = {{ "LIB", "lib32"}, { "SDKVER", "42"}};
- std::string str_smoke = "LIB$LIB${LIB${SDKVER}SDKVER$TEST$";
- format_string(&str_smoke, params);
- ASSERT_EQ("LIBlib32${LIB42SDKVER$TEST$", str_smoke);
-}
-
-TEST(linker_utils, normalize_path_smoke) {
- std::string output;
- ASSERT_TRUE(normalize_path("/../root///dir/.///dir2/somedir/../zipfile!/dir/dir9//..///afile", &output));
- ASSERT_EQ("/root/dir/dir2/zipfile!/dir/afile", output);
-
- ASSERT_TRUE(normalize_path("/../root///dir/.///dir2/somedir/.../zipfile!/.dir/dir9//..///afile", &output));
- ASSERT_EQ("/root/dir/dir2/somedir/.../zipfile!/.dir/afile", output);
-
- ASSERT_TRUE(normalize_path("/root/..", &output));
- ASSERT_EQ("/", output);
-
- ASSERT_TRUE(normalize_path("/root/notroot/..", &output));
- ASSERT_EQ("/root/", output);
-
- ASSERT_TRUE(normalize_path("/a/../../b", &output));
- ASSERT_EQ("/b", output);
-
- ASSERT_TRUE(normalize_path("/..", &output));
- ASSERT_EQ("/", output);
-
- output = "unchanged";
- ASSERT_FALSE(normalize_path("root///dir/.///dir2/somedir/../zipfile!/dir/dir9//..///afile", &output));
- ASSERT_EQ("unchanged", output);
-}
-
-TEST(linker_utils, file_is_in_dir_smoke) {
- ASSERT_TRUE(file_is_in_dir("/foo/bar/file", "/foo/bar"));
- ASSERT_FALSE(file_is_in_dir("/foo/bar/file", "/foo"));
-
- ASSERT_FALSE(file_is_in_dir("/foo/bar/file", "/bar/foo"));
-
- ASSERT_TRUE(file_is_in_dir("/file", ""));
- ASSERT_FALSE(file_is_in_dir("/file", "/"));
-}
-
-TEST(linker_utils, file_is_under_dir_smoke) {
- ASSERT_TRUE(file_is_under_dir("/foo/bar/file", "/foo/bar"));
- ASSERT_TRUE(file_is_under_dir("/foo/bar/file", "/foo"));
-
- ASSERT_FALSE(file_is_under_dir("/foo/bar/file", "/bar/foo"));
-
- ASSERT_TRUE(file_is_under_dir("/file", ""));
- ASSERT_TRUE(file_is_under_dir("/foo/bar/file", ""));
- ASSERT_FALSE(file_is_under_dir("/file", "/"));
- ASSERT_FALSE(file_is_under_dir("/foo/bar/file", "/"));
-}
-
-TEST(linker_utils, parse_zip_path_smoke) {
- std::string zip_path;
- std::string entry_path;
-
- ASSERT_FALSE(parse_zip_path("/not/a/zip/path/file.zip", &zip_path, &entry_path));
- ASSERT_FALSE(parse_zip_path("/not/a/zip/path/file.zip!path/in/zip", &zip_path, &entry_path));
- ASSERT_TRUE(parse_zip_path("/zip/path/file.zip!/path/in/zip", &zip_path, &entry_path));
- ASSERT_EQ("/zip/path/file.zip", zip_path);
- ASSERT_EQ("path/in/zip", entry_path);
-
- ASSERT_TRUE(parse_zip_path("/zip/path/file2.zip!/", &zip_path, &entry_path));
- ASSERT_EQ("/zip/path/file2.zip", zip_path);
- ASSERT_EQ("", entry_path);
-}
-
-TEST(linker_utils, page_start) {
- ASSERT_EQ(0x0001000, page_start(0x0001000));
- ASSERT_EQ(0x3002000, page_start(0x300222f));
- ASSERT_EQ(0x6001000, page_start(0x6001fff));
-}
-
-TEST(linker_utils, page_offset) {
- ASSERT_EQ(0x0U, page_offset(0x0001000));
- ASSERT_EQ(0x22fU, page_offset(0x300222f));
- ASSERT_EQ(0xfffU, page_offset(0x6001fff));
-}
-
-TEST(linker_utils, safe_add) {
- int64_t val = 42;
- ASSERT_FALSE(safe_add(&val, INT64_MAX-20, 21U));
- ASSERT_EQ(42, val);
- ASSERT_TRUE(safe_add(&val, INT64_MAX-42, 42U));
- ASSERT_EQ(INT64_MAX, val);
- ASSERT_TRUE(safe_add(&val, 2000, 42U));
- ASSERT_EQ(2042, val);
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/linker_wrapper.cpp
^
|
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "private/KernelArgumentBlock.h"
-
-extern const char linker_offset;
-
-// This will be replaced by host_bionic_inject, but must be non-zero
-// here so that it's placed in the data section.
-uintptr_t original_start = 42;
-
-/* Find the load bias and base address of an executable or shared object loaded
- * by the kernel. The ELF file's PHDR table must have a PT_PHDR entry.
- *
- * A VDSO doesn't have a PT_PHDR entry in its PHDR table.
- */
-static void get_elf_base_from_phdr(const ElfW(Phdr)* phdr_table, size_t phdr_count,
- ElfW(Addr)* base, ElfW(Addr)* load_bias) {
- for (size_t i = 0; i < phdr_count; ++i) {
- if (phdr_table[i].p_type == PT_PHDR) {
- *load_bias = reinterpret_cast<ElfW(Addr)>(phdr_table) - phdr_table[i].p_vaddr;
- *base = reinterpret_cast<ElfW(Addr)>(phdr_table) - phdr_table[i].p_offset;
- return;
- }
- }
-}
-
-/*
- * This is the entry point for the linker wrapper, which finds
- * the real linker, then bootstraps into it.
- */
-extern "C" ElfW(Addr) __linker_init(void* raw_args) {
- KernelArgumentBlock args(raw_args);
-
- ElfW(Addr) base_addr = 0;
- ElfW(Addr) load_bias = 0;
- get_elf_base_from_phdr(
- reinterpret_cast<ElfW(Phdr)*>(args.getauxval(AT_PHDR)), args.getauxval(AT_PHNUM),
- &base_addr, &load_bias);
-
- ElfW(Addr) linker_addr = base_addr + reinterpret_cast<uintptr_t>(&linker_offset);
- ElfW(Addr) linker_entry_offset = reinterpret_cast<ElfW(Ehdr)*>(linker_addr)->e_entry;
-
- for (ElfW(auxv_t)* v = args.auxv; v->a_type != AT_NULL; ++v) {
- if (v->a_type == AT_BASE) {
- // Set AT_BASE to the embedded linker
- v->a_un.a_val = linker_addr;
- }
- if (v->a_type == AT_ENTRY) {
- // Set AT_ENTRY to the proper entry point
- v->a_un.a_val = base_addr + original_start;
- }
- }
-
- // Return address of linker entry point
- return linker_addr + linker_entry_offset;
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/make.txt
^
|
@@ -1,2 +0,0 @@
- CXX q_la-dlfcn.lo
-Makefile:612: recipe for target 'q_la-dlfcn.lo' failed
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/common/q/rt.cpp
^
|
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * This function is an empty stub where GDB locates a breakpoint to get notified
- * about linker activity. It canʼt be inlined away, can't be hidden.
- */
-extern "C" void __attribute__((noinline)) __attribute__((visibility("default"))) rtld_db_dlactivity() {
-}
-
|
[-]
[+]
|
Deleted |
_service:tar_git:libhybris-0.0.5.42.tar.bz2/libhybris/hybris/tests/test_dlopen.c
^
|
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2019 Zhongmin Wu <vwzm@live.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#include <hybris/common/binding.h>
-#include <dlfcn.h>
-#include <EGL/egl.h>
-#include <stdio.h>
-#include <stddef.h>
-
-
-int main(int argc, char **argv) {
-
- int i = 0;
- char *libname = "libc.so";
-
- if (argc > 1) {
- libname = argv[1];
- }
-
- void *handler = android_dlopen(libname, RTLD_LAZY);
- printf("android %s is %p\n", libname,handler);
- return 0;
-}
|