diff --git a/ndk/Android.mk b/ndk/Android.mk index 6c93761c1..c3626940f 100644 --- a/ndk/Android.mk +++ b/ndk/Android.mk @@ -1,4 +1 @@ -# Please this file empty. It is used to make the Android build system happy. - -include development/ndk/sources/android/libportable/Android.mk include development/ndk/sources/android/native_app_glue/Android.mk diff --git a/ndk/sources/android/libportable/Android.mk b/ndk/sources/android/libportable/Android.mk deleted file mode 100644 index 6c52e894c..000000000 --- a/ndk/sources/android/libportable/Android.mk +++ /dev/null @@ -1,48 +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. -# - -LOCAL_PATH := $(call my-dir) - -ifeq ($(BUILD_LIBPORTABLE_TOO),true) - -#===================================================================== -# Device Shared Library libportable -#===================================================================== - -include $(CLEAR_VARS) - -LOCAL_MODULE := libportable -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_CLASS := SHARED_LIBRARIES - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/common/include - -# Uncomment the next line to easily enable Lib-Portable logging during development. -# LOCAL_CFLAGS += -DLOG_NDEBUG=0 - -libportable_src_files = \ - $(patsubst $(LOCAL_PATH)/%,%,$(wildcard $(LOCAL_PATH)/arch-$(TARGET_ARCH)/*.c)) \ - $(patsubst $(LOCAL_PATH)/%,%,$(wildcard $(LOCAL_PATH)/arch-$(TARGET_ARCH)/*.S)) - -LOCAL_SRC_FILES := \ - $(libportable_src_files) - -LOCAL_WHOLE_STATIC_LIBRARIES += cpufeatures -LOCAL_SHARED_LIBRARIES += liblog libdl - -include $(BUILD_SHARED_LIBRARY) - -endif # BUILD_LIBPORTABLE_TOO diff --git a/ndk/sources/android/libportable/arch-arm/fenv.c b/ndk/sources/android/libportable/arch-arm/fenv.c deleted file mode 100644 index d3c18af07..000000000 --- a/ndk/sources/android/libportable/arch-arm/fenv.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-arm/md_swap.c b/ndk/sources/android/libportable/arch-arm/md_swap.c deleted file mode 100644 index 47652e6cc..000000000 --- a/ndk/sources/android/libportable/arch-arm/md_swap.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 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. - */ - -#include -#include - -/* - * REV and REV16 weren't available on ARM5 or ARM4. - */ -#if !defined __ARM_ARCH_5__ && !defined __ARM_ARCH_5T__ && \ - !defined __ARM_ARCH_5TE__ && !defined __ARM_ARCH_5TEJ__ && \ - !defined __ARM_ARCH_4T__ && !defined __ARM_ARCH_4__ - -uint16_t WRAP(__swap16md)(uint16_t x) { - register uint16_t _x = (x); - __asm volatile ("rev16 %0, %0" : "+l" (_x)); - return _x; -} - -uint32_t WRAP(__swap32md)(uint32_t x) { - register uint32_t _x = (x); - __asm volatile ("rev %0, %0" : "+l" (_x)); - return _x; -} - -#endif - diff --git a/ndk/sources/android/libportable/arch-arm/stat.c b/ndk/sources/android/libportable/arch-arm/stat.c deleted file mode 100644 index 8a2a477bc..000000000 --- a/ndk/sources/android/libportable/arch-arm/stat.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-arm/unwind.c b/ndk/sources/android/libportable/arch-arm/unwind.c deleted file mode 100644 index f7e63264f..000000000 --- a/ndk/sources/android/libportable/arch-arm/unwind.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -struct _Unwind_Context; - -typedef enum { - _UVRSC_CORE = 0, // integer register - _UVRSC_VFP = 1, // vfp - _UVRSC_WMMXD = 3, // Intel WMMX data register - _UVRSC_WMMXC = 4 // Intel WMMX control register -} _Unwind_VRS_RegClass; - -typedef enum { - _UVRSD_UINT32 = 0, - _UVRSD_VFPX = 1, - _UVRSD_UINT64 = 3, - _UVRSD_FLOAT = 4, - _UVRSD_DOUBLE = 5 -} _Unwind_VRS_DataRepresentation; - -typedef enum { - _UVRSR_OK = 0, - _UVRSR_NOT_IMPLEMENTED = 1, - _UVRSR_FAILED = 2 -} _Unwind_VRS_Result; - -_Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *context, - _Unwind_VRS_RegClass regclass, - uint32_t regno, - _Unwind_VRS_DataRepresentation representation, - void* valuep); - -_Unwind_VRS_Result _Unwind_VRS_Set(struct _Unwind_Context *context, - _Unwind_VRS_RegClass regclass, - uint32_t regno, - _Unwind_VRS_DataRepresentation representation, - void* valuep); - -#define UNWIND_POINTER_REG 12 -#define UNWIND_STACK_REG 13 -#define UNWIND_IP_REG 15 - -uint64_t WRAP(_Unwind_GetGR)(struct _Unwind_Context* ctx, int index) { - uint32_t val; - _Unwind_VRS_Get(ctx, _UVRSC_CORE, index, _UVRSD_UINT32, &val); - return (uint64_t)val; -} - -void WRAP(_Unwind_SetGR)(struct _Unwind_Context* ctx, int index, uint64_t new_value) { - uint32_t val = (uint32_t)new_value; - _Unwind_VRS_Set(ctx, _UVRSC_CORE, index, _UVRSD_UINT32, &val); -} - -uint64_t WRAP(_Unwind_GetIP)(struct _Unwind_Context* ctx) { - return WRAP(_Unwind_GetGR)(ctx, UNWIND_IP_REG) & ~1; // thumb bit -} - -void WRAP(_Unwind_SetIP)(struct _Unwind_Context* ctx, uintptr_t new_value) { - uint32_t val = (uint32_t)new_value; - // Propagate thumb bit to instruction pointer - uint32_t thumbState = WRAP(_Unwind_GetGR)(ctx, UNWIND_IP_REG) & 1; - uint64_t new_val = (uint64_t)(val | thumbState); - WRAP(_Unwind_SetGR)(ctx, UNWIND_IP_REG, new_val); -} diff --git a/ndk/sources/android/libportable/arch-arm/vfs.c b/ndk/sources/android/libportable/arch-arm/vfs.c deleted file mode 100644 index fe8becd43..000000000 --- a/ndk/sources/android/libportable/arch-arm/vfs.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-arm64/fenv.c b/ndk/sources/android/libportable/arch-arm64/fenv.c deleted file mode 100644 index d3c18af07..000000000 --- a/ndk/sources/android/libportable/arch-arm64/fenv.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-arm64/stat.c b/ndk/sources/android/libportable/arch-arm64/stat.c deleted file mode 100644 index 8a2a477bc..000000000 --- a/ndk/sources/android/libportable/arch-arm64/stat.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-arm64/vfs.c b/ndk/sources/android/libportable/arch-arm64/vfs.c deleted file mode 100644 index fe8becd43..000000000 --- a/ndk/sources/android/libportable/arch-arm64/vfs.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-mips/errno.c b/ndk/sources/android/libportable/arch-mips/errno.c deleted file mode 100644 index b9ed45657..000000000 --- a/ndk/sources/android/libportable/arch-mips/errno.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-mips/fcntl.c b/ndk/sources/android/libportable/arch-mips/fcntl.c deleted file mode 100644 index de620c550..000000000 --- a/ndk/sources/android/libportable/arch-mips/fcntl.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-mips/fenv.c b/ndk/sources/android/libportable/arch-mips/fenv.c deleted file mode 100644 index d3c18af07..000000000 --- a/ndk/sources/android/libportable/arch-mips/fenv.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-mips/signal.c b/ndk/sources/android/libportable/arch-mips/signal.c deleted file mode 100644 index 7da280157..000000000 --- a/ndk/sources/android/libportable/arch-mips/signal.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-mips/stat.c b/ndk/sources/android/libportable/arch-mips/stat.c deleted file mode 100644 index 8a2a477bc..000000000 --- a/ndk/sources/android/libportable/arch-mips/stat.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-mips/vfs.c b/ndk/sources/android/libportable/arch-mips/vfs.c deleted file mode 100644 index fe8becd43..000000000 --- a/ndk/sources/android/libportable/arch-mips/vfs.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-mips64/errno.c b/ndk/sources/android/libportable/arch-mips64/errno.c deleted file mode 100644 index b9ed45657..000000000 --- a/ndk/sources/android/libportable/arch-mips64/errno.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-mips64/fcntl.c b/ndk/sources/android/libportable/arch-mips64/fcntl.c deleted file mode 100644 index de620c550..000000000 --- a/ndk/sources/android/libportable/arch-mips64/fcntl.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-mips64/fenv.c b/ndk/sources/android/libportable/arch-mips64/fenv.c deleted file mode 100644 index d3c18af07..000000000 --- a/ndk/sources/android/libportable/arch-mips64/fenv.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-mips64/stat.c b/ndk/sources/android/libportable/arch-mips64/stat.c deleted file mode 100644 index 8a2a477bc..000000000 --- a/ndk/sources/android/libportable/arch-mips64/stat.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-mips64/vfs.c b/ndk/sources/android/libportable/arch-mips64/vfs.c deleted file mode 100644 index fe8becd43..000000000 --- a/ndk/sources/android/libportable/arch-mips64/vfs.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-x86/epoll.c b/ndk/sources/android/libportable/arch-x86/epoll.c deleted file mode 100644 index ef929af68..000000000 --- a/ndk/sources/android/libportable/arch-x86/epoll.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-x86/fcntl.c b/ndk/sources/android/libportable/arch-x86/fcntl.c deleted file mode 100644 index de620c550..000000000 --- a/ndk/sources/android/libportable/arch-x86/fcntl.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-x86/fenv.c b/ndk/sources/android/libportable/arch-x86/fenv.c deleted file mode 100644 index d3c18af07..000000000 --- a/ndk/sources/android/libportable/arch-x86/fenv.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-x86/md_swap.c b/ndk/sources/android/libportable/arch-x86/md_swap.c deleted file mode 100644 index da3c29060..000000000 --- a/ndk/sources/android/libportable/arch-x86/md_swap.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -uint16_t WRAP(__swap16md)(uint16_t x) { - register uint16_t _x = (x); - __asm volatile ("rorw $8, %w0" : "+r" (_x)); - return _x; -} - -uint32_t WRAP(__swap32md)(uint32_t x) { - register uint32_t _x = (x); - __asm volatile ("bswap %0" : "+r" (_x)); - return _x; -} - diff --git a/ndk/sources/android/libportable/arch-x86/stat.c b/ndk/sources/android/libportable/arch-x86/stat.c deleted file mode 100644 index 8a2a477bc..000000000 --- a/ndk/sources/android/libportable/arch-x86/stat.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-x86/vfs.c b/ndk/sources/android/libportable/arch-x86/vfs.c deleted file mode 100644 index fe8becd43..000000000 --- a/ndk/sources/android/libportable/arch-x86/vfs.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-x86_64/epoll.c b/ndk/sources/android/libportable/arch-x86_64/epoll.c deleted file mode 100644 index ef929af68..000000000 --- a/ndk/sources/android/libportable/arch-x86_64/epoll.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-x86_64/fcntl.c b/ndk/sources/android/libportable/arch-x86_64/fcntl.c deleted file mode 100644 index de620c550..000000000 --- a/ndk/sources/android/libportable/arch-x86_64/fcntl.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-x86_64/fenv.c b/ndk/sources/android/libportable/arch-x86_64/fenv.c deleted file mode 100644 index d3c18af07..000000000 --- a/ndk/sources/android/libportable/arch-x86_64/fenv.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-x86_64/stat.c b/ndk/sources/android/libportable/arch-x86_64/stat.c deleted file mode 100644 index 8a2a477bc..000000000 --- a/ndk/sources/android/libportable/arch-x86_64/stat.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/arch-x86_64/vfs.c b/ndk/sources/android/libportable/arch-x86_64/vfs.c deleted file mode 100644 index fe8becd43..000000000 --- a/ndk/sources/android/libportable/arch-x86_64/vfs.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2014, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include diff --git a/ndk/sources/android/libportable/common/include/epoll_portable.h b/ndk/sources/android/libportable/common/include/epoll_portable.h deleted file mode 100644 index ebf4389d0..000000000 --- a/ndk/sources/android/libportable/common/include/epoll_portable.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 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 _EPOLL_PORTABLE_H_ -#define _EPOLL_PORTABLE_H_ - -#include -#include -#include -#include - -struct epoll_event_portable -{ - uint32_t events; - uint8_t __padding[4]; - epoll_data_t data; -}; - - -int WRAP(epoll_ctl)(int epfd, int op, int fd, struct epoll_event_portable *event) -{ - struct epoll_event machine_epoll_event; - - machine_epoll_event.events = event->events; - machine_epoll_event.data = event->data; - - return REAL(epoll_ctl)(epfd, op, fd, &machine_epoll_event); -} - -int WRAP(epoll_wait)(int epfd, struct epoll_event_portable *events, int max, int timeout) -{ - struct epoll_event machine_epoll_event; - int ret = REAL(epoll_wait)(epfd, &machine_epoll_event, max, timeout); - - events->events = machine_epoll_event.events; - events->data = machine_epoll_event.data; - - return ret; -} - -int WRAP(epoll_pwait)(int fd, struct epoll_event_portable* events, int max_events, int timeout, const sigset_t* ss) -{ - struct epoll_event machine_epoll_event; - int ret = REAL(epoll_pwait)(fd, &machine_epoll_event, max_events, timeout, ss); - - events->events = machine_epoll_event.events; - events->data = machine_epoll_event.data; - - return ret; -} - -#endif /* _EPOLL_PORTABLE_H */ diff --git a/ndk/sources/android/libportable/common/include/errno_portable.h b/ndk/sources/android/libportable/common/include/errno_portable.h deleted file mode 100644 index 8966c7775..000000000 --- a/ndk/sources/android/libportable/common/include/errno_portable.h +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright 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 _ERRNO_PORTABLE_H_ -#define _ERRNO_PORTABLE_H_ - -#include -#include -#include -#include - -#define ALOGV(...) - -#define EDEADLK_PORTABLE 35 -#define ENAMETOOLONG_PORTABLE 36 -#define ENOLCK_PORTABLE 37 -#define ENOSYS_PORTABLE 38 -#define ENOTEMPTY_PORTABLE 39 -#define ELOOP_PORTABLE 40 -#define EWOULDBLOCK_PORTABLE 11 /* EAGAIN */ -#define ENOMSG_PORTABLE 42 -#define EIDRM_PORTABLE 43 -#define ECHRNG_PORTABLE 44 -#define EL2NSYNC_PORTABLE 45 -#define EL3HLT_PORTABLE 46 -#define EL3RST_PORTABLE 47 -#define ELNRNG_PORTABLE 48 -#define EUNATCH_PORTABLE 49 -#define ENOCSI_PORTABLE 50 -#define EL2HLT_PORTABLE 51 -#define EBADE_PORTABLE 52 -#define EBADR_PORTABLE 53 -#define EXFULL_PORTABLE 54 -#define ENOANO_PORTABLE 55 -#define EBADRQC_PORTABLE 56 -#define EBADSLT_PORTABLE 57 - -#define EDEADLOCK_PORTABLE EDEADLK_PORTABLE - -#define EBFONT_PORTABLE 59 -#define ENOSTR_PORTABLE 60 -#define ENODATA_PORTABLE 61 -#define ETIME_PORTABLE 62 -#define ENOSR_PORTABLE 63 -#define ENONET_PORTABLE 64 -#define ENOPKG_PORTABLE 65 -#define EREMOTE_PORTABLE 66 -#define ENOLINK_PORTABLE 67 -#define EADV_PORTABLE 68 -#define ESRMNT_PORTABLE 69 -#define ECOMM_PORTABLE 70 -#define EPROTO_PORTABLE 71 -#define EMULTIHOP_PORTABLE 72 -#define EDOTDOT_PORTABLE 73 -#define EBADMSG_PORTABLE 74 -#define EOVERFLOW_PORTABLE 75 -#define ENOTUNIQ_PORTABLE 76 -#define EBADFD_PORTABLE 77 -#define EREMCHG_PORTABLE 78 -#define ELIBACC_PORTABLE 79 -#define ELIBBAD_PORTABLE 80 -#define ELIBSCN_PORTABLE 81 -#define ELIBMAX_PORTABLE 82 -#define ELIBEXEC_PORTABLE 83 -#define EILSEQ_PORTABLE 84 -#define ERESTART_PORTABLE 85 -#define ESTRPIPE_PORTABLE 86 -#define EUSERS_PORTABLE 87 -#define ENOTSOCK_PORTABLE 88 -#define EDESTADDRREQ_PORTABLE 89 -#define EMSGSIZE_PORTABLE 90 -#define EPROTOTYPE_PORTABLE 91 -#define ENOPROTOOPT_PORTABLE 92 -#define EPROTONOSUPPORT_PORTABLE 93 -#define ESOCKTNOSUPPORT_PORTABLE 94 -#define EOPNOTSUPP_PORTABLE 95 -#define EPFNOSUPPORT_PORTABLE 96 -#define EAFNOSUPPORT_PORTABLE 97 -#define EADDRINUSE_PORTABLE 98 -#define EADDRNOTAVAIL_PORTABLE 99 -#define ENETDOWN_PORTABLE 100 -#define ENETUNREACH_PORTABLE 101 -#define ENETRESET_PORTABLE 102 -#define ECONNABORTED_PORTABLE 103 -#define ECONNRESET_PORTABLE 104 -#define ENOBUFS_PORTABLE 105 -#define EISCONN_PORTABLE 106 -#define ENOTCONN_PORTABLE 107 -#define ESHUTDOWN_PORTABLE 108 -#define ETOOMANYREFS_PORTABLE 109 -#define ETIMEDOUT_PORTABLE 110 -#define ECONNREFUSED_PORTABLE 111 -#define EHOSTDOWN_PORTABLE 112 -#define EHOSTUNREACH_PORTABLE 113 -#define EALREADY_PORTABLE 114 -#define EINPROGRESS_PORTABLE 115 -#define ESTALE_PORTABLE 116 -#define EUCLEAN_PORTABLE 117 -#define ENOTNAM_PORTABLE 118 -#define ENAVAIL_PORTABLE 119 -#define EISNAM_PORTABLE 120 -#define EREMOTEIO_PORTABLE 121 -#define EDQUOT_PORTABLE 122 - -#define ENOMEDIUM_PORTABLE 123 -#define EMEDIUMTYPE_PORTABLE 124 -#define ECANCELED_PORTABLE 125 -#define ENOKEY_PORTABLE 126 -#define EKEYEXPIRED_PORTABLE 127 -#define EKEYREVOKED_PORTABLE 128 -#define EKEYREJECTED_PORTABLE 129 - -#define EOWNERDEAD_PORTABLE 130 -#define ENOTRECOVERABLE_PORTABLE 131 -#define ERFKILL_PORTABLE 132 -#define EHWPOISON_PORTABLE 133 - -extern volatile int* REAL(__errno)(); - -static int errno_ntop(int native_errno) -{ - switch (native_errno) { - case ENAMETOOLONG: return ENAMETOOLONG_PORTABLE; - case ENOLCK: return ENOLCK_PORTABLE; - case ENOSYS: return ENOSYS_PORTABLE; - case ENOTEMPTY: return ENOTEMPTY_PORTABLE; - case ELOOP: return ELOOP_PORTABLE; - case EWOULDBLOCK: return EWOULDBLOCK_PORTABLE; - case ENOMSG: return ENOMSG_PORTABLE; - case EIDRM: return EIDRM_PORTABLE; - case ECHRNG: return ECHRNG_PORTABLE; - case EL2NSYNC: return EL2NSYNC_PORTABLE; - case EL3HLT: return EL3HLT_PORTABLE; - case EL3RST: return EL3RST_PORTABLE; - case ELNRNG: return ELNRNG_PORTABLE; - case EUNATCH: return EUNATCH_PORTABLE; - case ENOCSI: return ENOCSI_PORTABLE; - case EL2HLT: return EL2HLT_PORTABLE; - case EBADE: return EBADE_PORTABLE; - case EBADR: return EBADR_PORTABLE; - case EXFULL: return EXFULL_PORTABLE; - case ENOANO: return ENOANO_PORTABLE; - case EBADRQC: return EBADRQC_PORTABLE; - case EBADSLT: return EBADSLT_PORTABLE; - case EDEADLOCK: return EDEADLOCK_PORTABLE; - case EBFONT: return EBFONT_PORTABLE; - case ENOSTR: return ENOSTR_PORTABLE; - case ENODATA: return ENODATA_PORTABLE; - case ETIME: return ETIME_PORTABLE; - case ENOSR: return ENOSR_PORTABLE; - case ENONET: return ENONET_PORTABLE; - case ENOPKG: return ENOPKG_PORTABLE; - case EREMOTE: return EREMOTE_PORTABLE; - case ENOLINK: return ENOLINK_PORTABLE; - case EADV: return EADV_PORTABLE; - case ESRMNT: return ESRMNT_PORTABLE; - case ECOMM: return ECOMM_PORTABLE; - case EPROTO: return EPROTO_PORTABLE; - case EMULTIHOP: return EMULTIHOP_PORTABLE; - case EDOTDOT: return EDOTDOT_PORTABLE; - case EBADMSG: return EBADMSG_PORTABLE; - case EOVERFLOW: return EOVERFLOW_PORTABLE; - case ENOTUNIQ: return ENOTUNIQ_PORTABLE; - case EBADFD: return EBADFD_PORTABLE; - case EREMCHG: return EREMCHG_PORTABLE; - case ELIBACC: return ELIBACC_PORTABLE; - case ELIBBAD: return ELIBBAD_PORTABLE; - case ELIBSCN: return ELIBSCN_PORTABLE; - case ELIBMAX: return ELIBMAX_PORTABLE; - case ELIBEXEC: return ELIBEXEC_PORTABLE; - case EILSEQ: return EILSEQ_PORTABLE; - case ERESTART: return ERESTART_PORTABLE; - case ESTRPIPE: return ESTRPIPE_PORTABLE; - case EUSERS: return EUSERS_PORTABLE; - case ENOTSOCK: return ENOTSOCK_PORTABLE; - case EDESTADDRREQ: return EDESTADDRREQ_PORTABLE; - case EMSGSIZE: return EMSGSIZE_PORTABLE; - case EPROTOTYPE: return EPROTOTYPE_PORTABLE; - case ENOPROTOOPT: return ENOPROTOOPT_PORTABLE; - case EPROTONOSUPPORT: return EPROTONOSUPPORT_PORTABLE; - case ESOCKTNOSUPPORT: return ESOCKTNOSUPPORT_PORTABLE; - case EOPNOTSUPP: return EOPNOTSUPP_PORTABLE; - case EPFNOSUPPORT: return EPFNOSUPPORT_PORTABLE; - case EAFNOSUPPORT: return EAFNOSUPPORT_PORTABLE; - case EADDRINUSE: return EADDRINUSE_PORTABLE; - case EADDRNOTAVAIL: return EADDRNOTAVAIL_PORTABLE; - case ENETDOWN: return ENETDOWN_PORTABLE; - case ENETUNREACH: return ENETUNREACH_PORTABLE; - case ENETRESET: return ENETRESET_PORTABLE; - case ECONNABORTED: return ECONNABORTED_PORTABLE; - case ECONNRESET: return ECONNRESET_PORTABLE; - case ENOBUFS: return ENOBUFS_PORTABLE; - case EISCONN: return EISCONN_PORTABLE; - case ENOTCONN: return ENOTCONN_PORTABLE; - case ESHUTDOWN: return ESHUTDOWN_PORTABLE; - case ETOOMANYREFS: return ETOOMANYREFS_PORTABLE; - case ETIMEDOUT: return ETIMEDOUT_PORTABLE; - case ECONNREFUSED: return ECONNREFUSED_PORTABLE; - case EHOSTDOWN: return EHOSTDOWN_PORTABLE; - case EHOSTUNREACH: return EHOSTUNREACH_PORTABLE; - case EALREADY: return EALREADY_PORTABLE; - case EINPROGRESS: return EINPROGRESS_PORTABLE; - case ESTALE: return ESTALE_PORTABLE; - case EUCLEAN: return EUCLEAN_PORTABLE; - case ENOTNAM: return ENOTNAM_PORTABLE; - case ENAVAIL: return ENAVAIL_PORTABLE; - case EISNAM: return EISNAM_PORTABLE; - case EREMOTEIO: return EREMOTEIO_PORTABLE; - case EDQUOT: return EDQUOT_PORTABLE; - case ENOMEDIUM: return ENOMEDIUM_PORTABLE; - case EMEDIUMTYPE: return EMEDIUMTYPE_PORTABLE; - case ECANCELED: return ECANCELED_PORTABLE; - case ENOKEY: return ENOKEY_PORTABLE; - case EKEYEXPIRED: return EKEYEXPIRED_PORTABLE; - case EKEYREVOKED: return EKEYREVOKED_PORTABLE; - case EKEYREJECTED: return EKEYREJECTED_PORTABLE; - case EOWNERDEAD: return EOWNERDEAD_PORTABLE; - case ENOTRECOVERABLE: return ENOTRECOVERABLE_PORTABLE; - } - return native_errno; -} - -static int errno_pton(int portable_errno) -{ - switch (portable_errno) { - case ENAMETOOLONG_PORTABLE: return ENAMETOOLONG; - case ENOLCK_PORTABLE: return ENOLCK; - case ENOSYS_PORTABLE: return ENOSYS; - case ENOTEMPTY_PORTABLE: return ENOTEMPTY; - case ELOOP_PORTABLE: return ELOOP; - case EWOULDBLOCK_PORTABLE: return EWOULDBLOCK; - case ENOMSG_PORTABLE: return ENOMSG; - case EIDRM_PORTABLE: return EIDRM; - case ECHRNG_PORTABLE: return ECHRNG; - case EL2NSYNC_PORTABLE: return EL2NSYNC; - case EL3HLT_PORTABLE: return EL3HLT; - case EL3RST_PORTABLE: return EL3RST; - case ELNRNG_PORTABLE: return ELNRNG; - case EUNATCH_PORTABLE: return EUNATCH; - case ENOCSI_PORTABLE: return ENOCSI; - case EL2HLT_PORTABLE: return EL2HLT; - case EBADE_PORTABLE: return EBADE; - case EBADR_PORTABLE: return EBADR; - case EXFULL_PORTABLE: return EXFULL; - case ENOANO_PORTABLE: return ENOANO; - case EBADRQC_PORTABLE: return EBADRQC; - case EBADSLT_PORTABLE: return EBADSLT; - case EDEADLOCK_PORTABLE: return EDEADLOCK; - case EBFONT_PORTABLE: return EBFONT; - case ENOSTR_PORTABLE: return ENOSTR; - case ENODATA_PORTABLE: return ENODATA; - case ETIME_PORTABLE: return ETIME; - case ENOSR_PORTABLE: return ENOSR; - case ENONET_PORTABLE: return ENONET; - case ENOPKG_PORTABLE: return ENOPKG; - case EREMOTE_PORTABLE: return EREMOTE; - case ENOLINK_PORTABLE: return ENOLINK; - case EADV_PORTABLE: return EADV; - case ESRMNT_PORTABLE: return ESRMNT; - case ECOMM_PORTABLE: return ECOMM; - case EPROTO_PORTABLE: return EPROTO; - case EMULTIHOP_PORTABLE: return EMULTIHOP; - case EDOTDOT_PORTABLE: return EDOTDOT; - case EBADMSG_PORTABLE: return EBADMSG; - case EOVERFLOW_PORTABLE: return EOVERFLOW; - case ENOTUNIQ_PORTABLE: return ENOTUNIQ; - case EBADFD_PORTABLE: return EBADFD; - case EREMCHG_PORTABLE: return EREMCHG; - case ELIBACC_PORTABLE: return ELIBACC; - case ELIBBAD_PORTABLE: return ELIBBAD; - case ELIBSCN_PORTABLE: return ELIBSCN; - case ELIBMAX_PORTABLE: return ELIBMAX; - case ELIBEXEC_PORTABLE: return ELIBEXEC; - case EILSEQ_PORTABLE: return EILSEQ; - case ERESTART_PORTABLE: return ERESTART; - case ESTRPIPE_PORTABLE: return ESTRPIPE; - case EUSERS_PORTABLE: return EUSERS; - case ENOTSOCK_PORTABLE: return ENOTSOCK; - case EDESTADDRREQ_PORTABLE: return EDESTADDRREQ; - case EMSGSIZE_PORTABLE: return EMSGSIZE; - case EPROTOTYPE_PORTABLE: return EPROTOTYPE; - case ENOPROTOOPT_PORTABLE: return ENOPROTOOPT; - case EPROTONOSUPPORT_PORTABLE: return EPROTONOSUPPORT; - case ESOCKTNOSUPPORT_PORTABLE: return ESOCKTNOSUPPORT; - case EOPNOTSUPP_PORTABLE: return EOPNOTSUPP; - case EPFNOSUPPORT_PORTABLE: return EPFNOSUPPORT; - case EAFNOSUPPORT_PORTABLE: return EAFNOSUPPORT; - case EADDRINUSE_PORTABLE: return EADDRINUSE; - case EADDRNOTAVAIL_PORTABLE: return EADDRNOTAVAIL; - case ENETDOWN_PORTABLE: return ENETDOWN; - case ENETUNREACH_PORTABLE: return ENETUNREACH; - case ENETRESET_PORTABLE: return ENETRESET; - case ECONNABORTED_PORTABLE: return ECONNABORTED; - case ECONNRESET_PORTABLE: return ECONNRESET; - case ENOBUFS_PORTABLE: return ENOBUFS; - case EISCONN_PORTABLE: return EISCONN; - case ENOTCONN_PORTABLE: return ENOTCONN; - case ESHUTDOWN_PORTABLE: return ESHUTDOWN; - case ETOOMANYREFS_PORTABLE: return ETOOMANYREFS; - case ETIMEDOUT_PORTABLE: return ETIMEDOUT; - case ECONNREFUSED_PORTABLE: return ECONNREFUSED; - case EHOSTDOWN_PORTABLE: return EHOSTDOWN; - case EHOSTUNREACH_PORTABLE: return EHOSTUNREACH; - case EALREADY_PORTABLE: return EALREADY; - case EINPROGRESS_PORTABLE: return EINPROGRESS; - case ESTALE_PORTABLE: return ESTALE; - case EUCLEAN_PORTABLE: return EUCLEAN; - case ENOTNAM_PORTABLE: return ENOTNAM; - case ENAVAIL_PORTABLE: return ENAVAIL; - case EISNAM_PORTABLE: return EISNAM; - case EREMOTEIO_PORTABLE: return EREMOTEIO; - case EDQUOT_PORTABLE: return EDQUOT; - case ENOMEDIUM_PORTABLE: return ENOMEDIUM; - case EMEDIUMTYPE_PORTABLE: return EMEDIUMTYPE; - case ECANCELED_PORTABLE: return ECANCELED; - case ENOKEY_PORTABLE: return ENOKEY; - case EKEYEXPIRED_PORTABLE: return EKEYEXPIRED; - case EKEYREVOKED_PORTABLE: return EKEYREVOKED; - case EKEYREJECTED_PORTABLE: return EKEYREJECTED; - case EOWNERDEAD_PORTABLE: return EOWNERDEAD; - case ENOTRECOVERABLE_PORTABLE: return ENOTRECOVERABLE; - } - return portable_errno; -} - -/* Key for the thread-specific portable errno */ -static pthread_key_t errno_key; - -/* Once-only initialisation of the key */ -static pthread_once_t errno_key_once = PTHREAD_ONCE_INIT; - -/* Free the thread-specific portable errno */ -static void errno_key_destroy(void *buf) -{ - if (buf) - free(buf); -} - -/* Allocate the key */ -static void errno_key_create(void) -{ - pthread_key_create(&errno_key, errno_key_destroy); -} - -struct errno_state { - int pshadow; /* copy of last portable errno */ - int perrno; /* portable errno that may be modified by app */ -}; - -/* Return the thread-specific portable errno */ -static struct errno_state *errno_key_data(void) -{ - struct errno_state *data; - static struct errno_state errno_state; - - pthread_once(&errno_key_once, errno_key_create); - data = (struct errno_state *)pthread_getspecific(errno_key); - if (data == NULL) { - data = malloc(sizeof(struct errno_state)); - pthread_setspecific(errno_key, data); - } - if (data == NULL) - data = &errno_state; - return data; -} - -/* - * Attempt to return a thread specific location containnig the portable errno. - * This can be assigned to without affecting the native errno. If the key - * allocation fails fall back to using the native errno location. - */ -volatile int* WRAP(__errno)() -{ - struct errno_state *p; - int save_errno; - - /* pthread_* calls may modify errno so use a copy */ - save_errno = *REAL(__errno)(); - - p = errno_key_data(); - - ALOGV(" "); - ALOGV("%s(): { save_errno = errno:%d, (p:%p)->{pshadow:%d, perrno:%d}", __func__, - save_errno, p, p->pshadow, p->perrno); - - if (save_errno == 0 && p->pshadow != p->perrno) { - /* - * portable errno has changed but native hasn't - * - copy portable error back to native - */ - p->pshadow = p->perrno; - save_errno = errno_pton(p->perrno); - } - else if (save_errno != 0 && p->pshadow == p->perrno) { - /* - * Native errno has changed but portable hasn't - * - copy native error to portable. - */ - p->pshadow = p->perrno = errno_ntop(save_errno); - save_errno = 0; - } - else if (save_errno != 0 && p->pshadow != p->perrno) { - /* - * Both native and portable errno values have changed - * so give priority to native errno - * - copy native error to portable - */ - p->pshadow = p->perrno = errno_ntop(save_errno); - save_errno = 0; - } - - ALOGV("%s: new save_errno:%d p:%p->{pshadow:%d, perrno:%d}", __func__, - save_errno, p, p->pshadow, p->perrno); - - *REAL(__errno)() = save_errno; - - ALOGV("%s: return (&p->perrno):%p; }", __func__, &p->perrno); - - /* return pointer to the modifiable portable errno value */ - return &p->perrno; -} - - -/* set portable errno */ -void WRAP(__set_errno)(int portable_errno) -{ - struct errno_state *p; - int save_errno; - - /* pthread_* calls may modify errno so use a copy */ - save_errno = *REAL(__errno)(); - - p = errno_key_data(); - - ALOGV("%s(): { save_errno = errno:%d, p:%p->{pshadow:%d, perrno:%d}", __func__, - save_errno, p, p->pshadow, p->perrno); - - p->pshadow = p->perrno = portable_errno; - - save_errno = errno_pton(portable_errno); - - ALOGV("%s: new save_errno:%d, p:%p->{pshadow:%d, perrno:%d}", __func__, - save_errno, p, p->pshadow, p->perrno); - - *REAL(__errno)() = save_errno; - - ALOGV("%s: return; }", __func__); -} - -extern char* REAL(strerror)(int); -char *WRAP(strerror)(int errnum) -{ - return REAL(strerror)(errno_pton(errnum)); -} - -/* BSD style strerror_r */ -int WRAP(strerror_r)(int errnum, char *buf, size_t buflen) -{ - return REAL(strerror_r)(errno_pton(errnum), buf, buflen); -} -#endif /* _ERRNO_PORTABLE_H */ diff --git a/ndk/sources/android/libportable/common/include/fcntl_portable.h b/ndk/sources/android/libportable/common/include/fcntl_portable.h deleted file mode 100644 index 08b3b2bcc..000000000 --- a/ndk/sources/android/libportable/common/include/fcntl_portable.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 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 _FCNTL_PORTABLE_H_ -#define _FCNTL_PORTABLE_H_ -#endif - -#include -#include -#include - -#define O_DIRECTORY_PORTABLE 040000 -#define O_NOFOLLOW_PORTABLE 0100000 -#define O_DIRECT_PORTABLE 0200000 -#define O_LARGEFILE_PORTABLE 0400000 - -static int flags_p2n(int p_flags) -{ - int machine_flags = p_flags; - if (p_flags & O_DIRECTORY_PORTABLE) { - machine_flags ^= O_DIRECTORY_PORTABLE; - machine_flags |= O_DIRECTORY; - } - if (p_flags & O_NOFOLLOW_PORTABLE) { - machine_flags ^= O_NOFOLLOW_PORTABLE; - machine_flags |= O_NOFOLLOW; - } - if (p_flags & O_DIRECT_PORTABLE) { - machine_flags ^= O_DIRECT_PORTABLE; - machine_flags |= O_DIRECT; - } - if (p_flags & O_LARGEFILE_PORTABLE) { - machine_flags ^= O_LARGEFILE_PORTABLE; - machine_flags |= O_LARGEFILE; - } - - return machine_flags; -} - -#define FLAGS_VAARGS_TRANSLATE \ - flags = flags_p2n(flags); \ - mode_t mode = 0; \ - if ((flags & O_CREAT) != 0) { \ - va_list args; \ - va_start(args, flags); \ - mode = (mode_t) va_arg(args, int); \ - va_end(args);\ - } - - -int WRAP(openat)(int fd, const char* path, int flags, ...) -{ - FLAGS_VAARGS_TRANSLATE - return REAL(openat)(fd, path, flags, mode); -} - -int WRAP(openat64)(int fd, const char* path, int flags, ...) -{ - FLAGS_VAARGS_TRANSLATE - return REAL(openat64)(fd, path, flags, mode); -} - -int WRAP(open)(const char* path, int flags, ...) -{ - FLAGS_VAARGS_TRANSLATE - return REAL(open)(path, flags, mode); -} - -int WRAP(open64)(const char* path, int flags, ...) -{ - FLAGS_VAARGS_TRANSLATE - return REAL(open64)(path, flags, mode); -} diff --git a/ndk/sources/android/libportable/common/include/fenv_portable.h b/ndk/sources/android/libportable/common/include/fenv_portable.h deleted file mode 100644 index 97a287673..000000000 --- a/ndk/sources/android/libportable/common/include/fenv_portable.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright 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 _FENV_PORTABLE_H_ -#define _FENV_PORTABLE_H_ - -#include -#include -#include -#include - -typedef struct { - unsigned char a[128]; -} fenv_t_portable; -typedef uint32_t fexcept_t_portable; - -/* Exception flags. */ -#define FE_INVALID_PORTABLE 0x01 -#define FE_DIVBYZERO_PORTABLE 0x02 -#define FE_OVERFLOW_PORTABLE 0x04 -#define FE_UNDERFLOW_PORTABLE 0x08 -#define FE_INEXACT_PORTABLE 0x10 -#define FE_ALL_EXCEPT_PORTABLE (FE_DIVBYZERO_PORTABLE | FE_INEXACT_PORTABLE | FE_INVALID_PORTABLE |\ - FE_OVERFLOW_PORTABLE | FE_UNDERFLOW_PORTABLE) - -/* Rounding modes. */ -#define FE_TONEAREST_PORTABLE 0x0 -#define FE_UPWARD_PORTABLE 0x1 -#define FE_DOWNWARD_PORTABLE 0x2 -#define FE_TOWARDZERO_PORTABLE 0x3 - - -static inline int target_change_except(int flags) -{ - int targetflags = 0; - - if (flags & FE_INVALID_PORTABLE) - targetflags |= FE_INVALID; - if (flags & FE_DIVBYZERO_PORTABLE) - targetflags |= FE_DIVBYZERO; - if (flags & FE_OVERFLOW_PORTABLE) - targetflags |= FE_OVERFLOW; - if (flags & FE_UNDERFLOW_PORTABLE) - targetflags |= FE_UNDERFLOW; - if (flags & FE_INEXACT_PORTABLE) - targetflags |= FE_INEXACT; - - return targetflags; -} - -static inline int target_change_rounding(int flags) -{ - int targetflags = 0; - - switch(flags) - { - case FE_TONEAREST_PORTABLE: - targetflags = FE_TONEAREST; - break; - case FE_DOWNWARD_PORTABLE: - targetflags = FE_DOWNWARD; - break; - case FE_UPWARD_PORTABLE: - targetflags = FE_UPWARD; - break; - case FE_TOWARDZERO_PORTABLE: - targetflags = FE_TOWARDZERO; - break; - } - return targetflags; -} - -static inline int target_get_except(int targetflags) -{ - int flags = 0; - - if (targetflags & FE_INVALID) - flags |= FE_INVALID_PORTABLE; - if (targetflags & FE_DIVBYZERO) - flags |= FE_DIVBYZERO_PORTABLE; - if (targetflags & FE_OVERFLOW) - flags |= FE_OVERFLOW_PORTABLE; - if (targetflags & FE_UNDERFLOW) - flags |= FE_UNDERFLOW_PORTABLE; - if (targetflags & FE_INEXACT) - flags |= FE_INEXACT_PORTABLE; - return flags; -} - -static inline int target_get_rounding(int targetflags) -{ - int flags = 0; - - switch(targetflags) - { - case FE_TONEAREST: - flags = FE_TONEAREST_PORTABLE; - break; - case FE_DOWNWARD: - flags = FE_DOWNWARD_PORTABLE; - break; - case FE_UPWARD: - flags = FE_UPWARD_PORTABLE; - break; - case FE_TOWARDZERO: - flags = FE_TOWARDZERO_PORTABLE; - break; - } - return flags; -} - - -int WRAP(fegetenv)(fenv_t_portable* __envp) { - return REAL(fegetenv)((fenv_t*) __envp); -} - -int WRAP(fesetenv)(const fenv_t_portable* __envp) { - return REAL(fesetenv)((fenv_t*) __envp); -} - -int WRAP(feclearexcept)(int __excepts) { - __excepts = target_change_except(__excepts); - return REAL(feclearexcept)(__excepts); -} - -int WRAP(fegetexceptflag)(fexcept_t_portable* __flagp, int __excepts) { - __excepts = target_change_except(__excepts); - int ret = REAL(fegetexceptflag)((fexcept_t*) __flagp, __excepts); - *__flagp = target_get_except(*__flagp); - return ret; -} - -int WRAP(fesetexceptflag)(const fexcept_t_portable* __flagp, int __excepts) { - __excepts = target_change_except(__excepts); - return REAL(fesetexceptflag)((const fexcept_t*) __flagp, __excepts); -} - -int WRAP(feraiseexcept)(int __excepts) { - __excepts = target_change_except(__excepts); - return REAL(feraiseexcept)(__excepts); -} - -int WRAP(fetestexcept)(int __excepts) { - __excepts = target_change_except(__excepts); - return target_get_except(REAL(fetestexcept)(__excepts)); -} - -int WRAP(fegetround)(void) { - int rounding = REAL(fegetround)(); - return target_get_rounding(rounding); -} - -int WRAP(fesetround)(int __round) { - __round = target_change_rounding(__round); - return REAL(fesetround)(__round); -} - -int WRAP(feholdexcept)(fenv_t_portable* __envp) { - memset(__envp, '\0', sizeof(fenv_t_portable)); - fenv_t env; - int ret = REAL(feholdexcept)(&env); - memcpy(__envp, &env, sizeof(env)); - return ret; -} - -int WRAP(feupdateenv)(const fenv_t_portable* __envp) { - fenv_t env; - memcpy(&env, __envp, sizeof(env)); - return REAL(feupdateenv)(&env); -} - -int WRAP(feenableexcept)(int __excepts) { - __excepts = target_change_except(__excepts); - return REAL(feenableexcept)(__excepts); -} - -int WRAP(fedisableexcept)(int __excepts) { - __excepts = target_change_except(__excepts); - return REAL(fedisableexcept)(__excepts); -} - -#endif /* _FENV_PORTABLE_H_ */ diff --git a/ndk/sources/android/libportable/common/include/portability.h b/ndk/sources/android/libportable/common/include/portability.h deleted file mode 100644 index 21bcb5090..000000000 --- a/ndk/sources/android/libportable/common/include/portability.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 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 _PORTABILITY_H_ -#define _PORTABILITY_H_ - -/* - * Hidden functions are exposed while linking the libportable shared object - * but are not exposed thereafter. - */ -#define __hidden __attribute__((visibility("hidden"))) - -#if !defined(__HOST__) -#define WRAP(f) f ## _portable -#define REAL(f) f -#else -/* On host app link with libpportable.a with -Wl,--wrap=symbol, which resolves undefined symbol to __wrap_symbol, - * and undefined __real_symbol to the original symbol - */ -#define WRAP(f) __wrap_ ## f -#define REAL(f) __real_ ## f -#endif - - -#endif /* _PORTABILITY_H_ */ diff --git a/ndk/sources/android/libportable/common/include/signal_portable.h b/ndk/sources/android/libportable/common/include/signal_portable.h deleted file mode 100644 index e80db4b85..000000000 --- a/ndk/sources/android/libportable/common/include/signal_portable.h +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Copyright 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 _SIGNAL_PORTABLE_H_ -#define _SIGNAL_PORTABLE_H_ - -#if (__mips__) - -#include -#include -#include -#include - -struct stack_t_portable { - void *ss_sp; - int ss_flags; - size_t ss_size; -}; - -static inline void stack_t_pton(const struct stack_t_portable *ptr_p, stack_t *ptr_n) { - memset(ptr_n, '\0', sizeof(stack_t)); - ptr_n->ss_sp = ptr_p->ss_sp; - ptr_n->ss_flags = ptr_p->ss_flags; - ptr_n->ss_size = ptr_p->ss_size; -} - -static inline void stack_t_ntop(const stack_t *ptr_n, struct stack_t_portable *ptr_p) { - memset(ptr_p, '\0', sizeof(struct stack_t_portable)); - ptr_p->ss_sp = ptr_n->ss_sp; - ptr_p->ss_flags = ptr_n->ss_flags; - ptr_p->ss_size = ptr_n->ss_size; -} - -int WRAP(sigaltstack)(const struct stack_t_portable *ss, struct stack_t_portable *oss) { - stack_t ss_n, oss_n; - if (ss != NULL) { - stack_t_pton(ss, &ss_n); - if (oss != NULL){ - int ret = REAL(sigaltstack)(&ss_n, &oss_n); - stack_t_ntop(&oss_n, oss); - return ret; - } - else - return REAL(sigaltstack)(&ss_n, NULL); - } - else if (oss != NULL) { - int ret = REAL(sigaltstack)(NULL, &oss_n); - stack_t_ntop(&oss_n, oss); - return ret; - } - else - return REAL(sigaltstack)(NULL, NULL); -} - -#define SIGHUP_PORTABLE 1 -#define SIGINT_PORTABLE 2 -#define SIGQUIT_PORTABLE 3 -#define SIGILL_PORTABLE 4 -#define SIGTRAP_PORTABLE 5 -#define SIGABRT_PORTABLE 6 -#define SIGIOT_PORTABLE 6 -#define SIGBUS_PORTABLE 7 -#define SIGFPE_PORTABLE 8 -#define SIGKILL_PORTABLE 9 -#define SIGUSR1_PORTABLE 10 -#define SIGSEGV_PORTABLE 11 -#define SIGUSR2_PORTABLE 12 -#define SIGPIPE_PORTABLE 13 -#define SIGALRM_PORTABLE 14 -#define SIGTERM_PORTABLE 15 -// unsupported in MIPS -#define SIGSTKFLT_PORTABLE 16 -// -#define SIGCHLD_PORTABLE 17 -#define SIGCONT_PORTABLE 18 -#define SIGSTOP_PORTABLE 19 -#define SIGTSTP_PORTABLE 20 -#define SIGTTIN_PORTABLE 21 -#define SIGTTOU_PORTABLE 22 -#define SIGURG_PORTABLE 23 -#define SIGXCPU_PORTABLE 24 -#define SIGXFSZ_PORTABLE 25 -#define SIGVTALRM_PORTABLE 26 -#define SIGPROF_PORTABLE 27 -#define SIGWINCH_PORTABLE 28 -#define SIGIO_PORTABLE 29 -#define SIGPOLL_PORTABLE SIGIO_PORTABLE -#define SIGPWR_PORTABLE 30 -#define SIGSYS_PORTABLE 31 -#define SIGUNUSED_PORTABLE 31 -// unsupported in MIPS -#define SIGSWI_PORTABLE 32 -// - -static inline int signo_pton(int signum_p) { - switch(signum_p) { - case SIGHUP_PORTABLE: return SIGHUP; - case SIGINT_PORTABLE: return SIGINT; - case SIGQUIT_PORTABLE: return SIGQUIT; - case SIGILL_PORTABLE: return SIGILL; - case SIGTRAP_PORTABLE: return SIGTRAP; - case SIGABRT_PORTABLE: return SIGABRT; - case SIGBUS_PORTABLE: return SIGBUS; - case SIGFPE_PORTABLE: return SIGFPE; - case SIGKILL_PORTABLE: return SIGKILL; - case SIGUSR1_PORTABLE: return SIGUSR1; - case SIGSEGV_PORTABLE: return SIGSEGV; - case SIGUSR2_PORTABLE: return SIGUSR2; - case SIGPIPE_PORTABLE: return SIGPIPE; - case SIGALRM_PORTABLE: return SIGALRM; - case SIGTERM_PORTABLE: return SIGTERM; - case SIGCHLD_PORTABLE: return SIGCHLD; - case SIGCONT_PORTABLE: return SIGCONT; - case SIGSTOP_PORTABLE: return SIGSTOP; - case SIGTSTP_PORTABLE: return SIGTSTP; - case SIGTTIN_PORTABLE: return SIGTTIN; - case SIGTTOU_PORTABLE: return SIGTTOU; - case SIGURG_PORTABLE: return SIGURG; - case SIGXCPU_PORTABLE: return SIGXCPU; - case SIGXFSZ_PORTABLE: return SIGXFSZ; - case SIGVTALRM_PORTABLE: return SIGVTALRM; - case SIGPROF_PORTABLE: return SIGPROF; - case SIGWINCH_PORTABLE: return SIGWINCH; - case SIGIO_PORTABLE: return SIGIO; - case SIGPWR_PORTABLE: return SIGPWR; - case SIGSYS_PORTABLE: return SIGSYS; - default: - fprintf(stderr, "Unknown SIGNAL:%d\n", signum_p); - abort(); - } -} - -static inline int signo_ntop(int signum_n) { - switch(signum_n) { - case SIGHUP: return SIGHUP_PORTABLE; - case SIGINT: return SIGINT_PORTABLE; - case SIGQUIT: return SIGQUIT_PORTABLE; - case SIGILL: return SIGILL_PORTABLE; - case SIGTRAP: return SIGTRAP_PORTABLE; - case SIGABRT: return SIGABRT_PORTABLE; - case SIGBUS: return SIGBUS_PORTABLE; - case SIGFPE: return SIGFPE_PORTABLE; - case SIGKILL: return SIGKILL_PORTABLE; - case SIGUSR1: return SIGUSR1_PORTABLE; - case SIGSEGV: return SIGSEGV_PORTABLE; - case SIGUSR2: return SIGUSR2_PORTABLE; - case SIGPIPE: return SIGPIPE_PORTABLE; - case SIGALRM: return SIGALRM_PORTABLE; - case SIGTERM: return SIGTERM_PORTABLE; - case SIGCHLD: return SIGCHLD_PORTABLE; - case SIGCONT: return SIGCONT_PORTABLE; - case SIGSTOP: return SIGSTOP_PORTABLE; - case SIGTSTP: return SIGTSTP_PORTABLE; - case SIGTTIN: return SIGTTIN_PORTABLE; - case SIGTTOU: return SIGTTOU_PORTABLE; - case SIGURG: return SIGURG_PORTABLE; - case SIGXCPU: return SIGXCPU_PORTABLE; - case SIGXFSZ: return SIGXFSZ_PORTABLE; - case SIGVTALRM: return SIGVTALRM_PORTABLE; - case SIGPROF: return SIGPROF_PORTABLE; - case SIGWINCH: return SIGWINCH_PORTABLE; - case SIGIO: return SIGIO_PORTABLE; - case SIGPWR: return SIGPWR_PORTABLE; - case SIGSYS: return SIGSYS_PORTABLE; - default: - fprintf(stderr, "Unknown SIGNAL:%d\n", signum_n); - abort(); - } -} - -#define SA_NOCLDSTOP_PORTABLE 0x00000001 -#define SA_NOCLDWAIT_PORTABLE 0x00000002 -#define SA_SIGINFO_PORTABLE 0x00000004 -// unsupported in MIPS -#define SA_THIRTYTWO_PORTABLE 0x02000000 -#define SA_RESTORER_PORTABLE 0x04000000 -// -#define SA_ONSTACK_PORTABLE 0x08000000 -#define SA_RESTART_PORTABLE 0x10000000 -#define SA_NODEFER_PORTABLE 0x40000000 -#define SA_RESETHAND_PORTABLE 0x80000000 -#define SA_NOMASK_PORTABLE SA_NODEFER_PORTABLE -#define SA_ONESHOT_PORTABLE SA_RESETHAND_PORTABLE - -static inline int sa_flags_pton(int sa_flags_p) { - int sa_flags_n = 0; - sa_flags_n |= (sa_flags_p & SA_NOCLDSTOP_PORTABLE) ? SA_NOCLDSTOP : 0; - sa_flags_n |= (sa_flags_p & SA_NOCLDWAIT_PORTABLE) ? SA_NOCLDWAIT : 0; - sa_flags_n |= (sa_flags_p & SA_SIGINFO_PORTABLE) ? SA_SIGINFO : 0; - sa_flags_n |= (sa_flags_p & SA_ONSTACK_PORTABLE) ? SA_ONSTACK : 0; - sa_flags_n |= (sa_flags_p & SA_RESTART_PORTABLE) ? SA_RESTART : 0; - sa_flags_n |= (sa_flags_p & SA_NODEFER_PORTABLE) ? SA_NODEFER : 0; - sa_flags_n |= (sa_flags_p & SA_RESETHAND_PORTABLE) ? SA_RESETHAND : 0; - return sa_flags_n; -} - -static inline int sa_flags_ntop(int sa_flags_n) { - int sa_flags_p = 0; - sa_flags_p |= (sa_flags_n & SA_NOCLDSTOP) ? SA_NOCLDSTOP_PORTABLE : 0; - sa_flags_p |= (sa_flags_n & SA_NOCLDWAIT) ? SA_NOCLDWAIT_PORTABLE : 0; - sa_flags_p |= (sa_flags_n & SA_SIGINFO) ? SA_SIGINFO_PORTABLE : 0; - sa_flags_p |= (sa_flags_n & SA_ONSTACK) ? SA_ONSTACK_PORTABLE : 0; - sa_flags_p |= (sa_flags_n & SA_RESTART) ? SA_RESTART_PORTABLE : 0; - sa_flags_p |= (sa_flags_n & SA_NODEFER) ? SA_NODEFER_PORTABLE : 0; - sa_flags_p |= (sa_flags_n & SA_RESETHAND) ? SA_RESETHAND_PORTABLE : 0; - return sa_flags_p; -} - -typedef unsigned long sigset_t_portable; -struct sigaction_portable { - union { - __sighandler_t _sa_handler; - void (*_sa_sigaction)(int, struct siginfo *, void *); - } _u; - sigset_t_portable sa_mask; - unsigned long sa_flags; - void (*sa_restorer)(void); // obsolete -}; - -static inline void sigset_t_pton(const sigset_t_portable *ptr_p, sigset_t *ptr_n) { - memset(ptr_n, '\0', sizeof(sigset_t)); - ptr_n->sig[0] = *ptr_p; -} - -static inline void sigset_t_ntop(const sigset_t *ptr_n, sigset_t_portable *ptr_p) { - memset(ptr_p, '\0', sizeof(sigset_t_portable)); - *ptr_p = ptr_n->sig[0]; -} - -static inline void sigaction_pton(const struct sigaction_portable *ptr_p, struct sigaction *ptr_n) { - memset(ptr_n, '\0', sizeof(struct sigaction)); - ptr_n->sa_sigaction = ptr_p->_u._sa_sigaction; - sigset_t_pton(&ptr_p->sa_mask, &ptr_n->sa_mask); - ptr_n->sa_flags = sa_flags_pton(ptr_p->sa_flags); -} - -static inline void sigaction_ntop(const struct sigaction *ptr_n, struct sigaction_portable *ptr_p) { - memset(ptr_p, '\0', sizeof(struct sigaction_portable)); - ptr_p->_u._sa_sigaction = ptr_n->sa_sigaction; - sigset_t_ntop(&ptr_n->sa_mask, &ptr_p->sa_mask); - ptr_p->sa_flags = sa_flags_ntop(ptr_n->sa_flags); -} - -int WRAP(sigaction)(int signum, const struct sigaction_portable *act, struct sigaction_portable *oldact) { - struct sigaction act_n, oldact_n; - int signum_n = signo_pton(signum); - - if (act != NULL) { - sigaction_pton(act, &act_n); - if (oldact != NULL) { - int ret = REAL(sigaction)(signum_n, &act_n, &oldact_n); - sigaction_ntop(&oldact_n, oldact); - return ret; - } - else - return REAL(sigaction)(signum_n, &act_n, NULL); - } - else if (oldact != NULL) { - int ret = REAL(sigaction)(signum_n, NULL, &oldact_n); - sigaction_ntop(&oldact_n, oldact); - return ret; - } - else - return REAL(sigaction)(signum_n, NULL, NULL); -} - -int WRAP(sigaddset)(sigset_t_portable *set, int signum) { - int signum_n = signo_pton(signum); - sigset_t set_n; - sigset_t_pton(set, &set_n); - int ret = REAL(sigaddset)(&set_n, signum_n); - sigset_t_ntop(&set_n, set); - return ret; -} - -int WRAP(sigdelset)(sigset_t_portable *set, int signum) { - int signum_n = signo_pton(signum); - sigset_t set_n; - sigset_t_pton(set, &set_n); - int ret = REAL(sigdelset)(&set_n, signum_n); - sigset_t_ntop(&set_n, set); - return ret; -} - -int WRAP(sigemptyset)(sigset_t_portable *set){ - sigset_t set_n; - sigset_t_pton(set, &set_n); - int ret = REAL(sigemptyset)(&set_n); - sigset_t_ntop(&set_n, set); - return ret; -} - -int WRAP(sigfillset)(sigset_t_portable *set){ - sigset_t set_n; - sigset_t_pton(set, &set_n); - int ret = REAL(sigfillset)(&set_n); - sigset_t_ntop(&set_n, set); - return ret; -} - -int WRAP(sigismember)(const sigset_t_portable *set, int signum) { - int signum_n = signo_pton(signum); - sigset_t set_n; - sigset_t_pton(set, &set_n); - return REAL(sigismember)(&set_n, signum_n); -} - -int WRAP(sigpending)(sigset_t_portable *set) { - sigset_t set_n; - sigset_t_pton(set, &set_n); - int ret = REAL(sigpending)(&set_n); - sigset_t_ntop(&set_n, set); - return ret; -} - -#define SIG_BLOCK_PORTABLE 0 -#define SIG_UNBLOCK_PORTABLE 1 -#define SIG_SETMASK_PORTABLE 2 - -int WRAP(sigprocmask)(int how, const sigset_t_portable *set, sigset_t_portable *oldset) { - int how_n; - switch(how) { - case SIG_BLOCK_PORTABLE: how_n = SIG_BLOCK; break; - case SIG_UNBLOCK_PORTABLE: how_n = SIG_UNBLOCK; break; - case SIG_SETMASK_PORTABLE: how_n = SIG_SETMASK; break; - default: - fprintf(stderr, "Unknown sigprocmask action:%d\n", how); - abort(); - } - sigset_t set_n, oldset_n; - if (set != NULL) { - sigset_t_pton(set, &set_n); - if (oldset != NULL) { - int ret = REAL(sigprocmask)(how_n, &set_n, &oldset_n); - sigset_t_ntop(&oldset_n, oldset); - return ret; - } - else - return REAL(sigprocmask)(how_n, &set_n, NULL); - } - else if (oldset != NULL) { - int ret = REAL(sigprocmask)(how_n, NULL, &oldset_n); - sigset_t_ntop(&oldset_n, oldset); - return ret; - } - else - return REAL(sigprocmask)(how_n, NULL, NULL); -} - -int WRAP(sigsuspend)(const sigset_t_portable *mask) { - sigset_t mask_n; - sigset_t_pton(mask, &mask_n); - return REAL(sigsuspend)(&mask_n); -} - -int WRAP(sigwait)(const sigset_t_portable *set, int *sig) { - sigset_t set_n; - sigset_t_pton(set, &set_n); - int ret = REAL(sigwait)(&set_n, sig); - *sig = signo_ntop(*sig); - return ret; -} - -int WRAP(kill)(pid_t pid, int sig) { - int sig_n = signo_pton(sig); - return REAL(kill)(pid, sig_n); -} - -// sigset_t related function -#include -int WRAP(pselect)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, const sigset_t_portable *sigmask) { - sigset_t sigmask_n; - sigset_t_pton(sigmask, &sigmask_n); - return REAL(pselect)(nfds, readfds, writefds, exceptfds, timeout, sigmask_n); -} - -#include -int WRAP(signalfd)(int fd, const sigset_t_portable* mask, int flags) { - sigset_t mask_n; - sigset_t_pton(mask, &mask_n); - return REAL(signalfd)(fd, mask_n, flags); -} - -#include -int WRAP(ppoll)(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts, const sigset_t_portable *sigmask) { - sigset_t sigmask_n; - sigset_t_pton(sigmask, &sigmask_n); - return REAL(ppoll)(fds, nfds, timeout_ts, sigmask_n); -} - -#include -int WRAP(pthread_sigmask)(int how, const sigset_t_portable *set, sigset_t_portable *oldset) { - int how_n; - switch(how) { - case SIG_BLOCK_PORTABLE: how_n = SIG_BLOCK; break; - case SIG_UNBLOCK_PORTABLE: how_n = SIG_UNBLOCK; break; - case SIG_SETMASK_PORTABLE: how_n = SIG_SETMASK; break; - default: - fprintf(stderr, "Unknown pthread_sigmask action:%d\n", how); - abort(); - } - sigset_t set_n, oldset_n; - if (set != NULL) { - sigset_t_pton(set, &set_n); - if (oldset != NULL) { - int ret = REAL(pthread_sigmask)(how_n, &set_n, &oldset_n); - sigset_t_ntop(&oldset_n, oldset); - return ret; - } - else - return REAL(pthread_sigmask)(how_n, &set_n, NULL); - } - else if (oldset != NULL) { - int ret = REAL(pthread_sigmask)(how_n, NULL, &oldset_n); - sigset_t_ntop(&oldset_n, oldset); - return ret; - } - else - return REAL(pthread_sigmask)(how_n, NULL, NULL); -} - -#include -int WRAP(epoll_pwait)(int fd, struct epoll_event* events, int max_events, int timeout, const sigset_t_portable* ss) { - sigset_t ss_n; - sigset_t_pton(ss, &ss_n); - return REAL(epoll_pwait)(fd, events, max_events, timeout, ss_n); -} -#endif /* __mips__ */ -#endif /* _SIGNAL_PORTABLE_H */ diff --git a/ndk/sources/android/libportable/common/include/stat_portable.h b/ndk/sources/android/libportable/common/include/stat_portable.h deleted file mode 100644 index a2f3be7f1..000000000 --- a/ndk/sources/android/libportable/common/include/stat_portable.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 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 _StatPortable_H_ -#define _StatPortable_H_ - -#include -#include -#include -#include - -#define __STAT64_BODY_PORTABLE \ - unsigned long st_dev; \ - unsigned long st_ino; \ - unsigned long st_mode; \ - unsigned long st_nlink; \ - uid_t st_uid; /* 32-bit uid_t */ \ - unsigned char padding[4]; \ - gid_t st_gid; /* 32-bit gid_t */ \ - unsigned char padding2[4]; \ - unsigned long st_rdev; \ - long st_size; \ - long st_blksize; \ - long st_blocks; \ - long st_atime; \ - unsigned long st_atime_nsec; \ - long st_mtime; \ - unsigned long st_mtime_nsec; \ - long st_ctime; \ - unsigned long st_ctime_nsec; \ - unsigned char padding3[8]; - -struct StatPortable { __STAT64_BODY_PORTABLE }; -typedef struct StatPortable Stat64Portable; - -static inline void stat_n2p(struct stat* pn, struct StatPortable* pp) -{ - memset(pp, '\0', sizeof(struct StatPortable)); - pp->st_dev = pn->st_dev; - pp->st_ino = pn->st_ino; - pp->st_mode = pn->st_mode; - pp->st_nlink = pn->st_nlink; - pp->st_uid = pn->st_uid; - pp->st_gid = pn->st_gid; - pp->st_rdev = pn->st_rdev; - pp->st_size = pn->st_size; - pp->st_blksize = pn->st_blksize; - pp->st_blocks = pn->st_blocks; - pp->st_atime = pn->st_atime; - pp->st_atime_nsec = pn->st_atime_nsec; - pp->st_mtime = pn->st_mtime; - pp->st_mtime_nsec = pn->st_mtime_nsec; - pp->st_ctime = pn->st_ctime; - pp->st_ctime_nsec = pn->st_ctime_nsec; -} - -int WRAP(fstat)(int a, struct StatPortable* p) -{ - struct stat target_stat_obj; - int ret = REAL(fstat)(a, &target_stat_obj); - stat_n2p(&target_stat_obj, p); - return ret; -} - -int WRAP(fstat64)(int a, Stat64Portable* p) -{ - return WRAP(fstat)(a, p); -} - -int WRAP(fstatat)(int a, const char* p1, struct StatPortable* p2, int b) -{ - struct stat target_stat_obj; - int ret = REAL(fstatat)(a, p1, &target_stat_obj, b); - stat_n2p(&target_stat_obj, p2); - return ret; -} - -int WRAP(fstatat64)(int a, const char* b, Stat64Portable* c, int d) -{ - return WRAP(fstatat)(a, b, c, d); -} - -int WRAP(lstat)(const char* a, struct StatPortable* p) -{ - struct stat target_stat_obj; - int ret = REAL(lstat)(a, &target_stat_obj); - stat_n2p(&target_stat_obj, p); - return ret; -} - -int WRAP(lstat64)(const char* a, Stat64Portable* p) -{ - return WRAP(lstat)(a, p); -} - -int WRAP(stat)(const char* a, struct StatPortable* p) -{ - struct stat target_stat_obj; - int ret = REAL(stat)(a, &target_stat_obj); - stat_n2p(&target_stat_obj, p); - return ret; -} - -int WRAP(stat64)(const char* a, Stat64Portable* p) -{ - return WRAP(stat)(a, p); -} - -#endif /* _StatPortable_H */ diff --git a/ndk/sources/android/libportable/common/include/vfs_portable.h b/ndk/sources/android/libportable/common/include/vfs_portable.h deleted file mode 100644 index ac57dedea..000000000 --- a/ndk/sources/android/libportable/common/include/vfs_portable.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 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 _VFS_PORTABLE_H_ -#define _VFS_PORTABLE_H_ - -#include -#include -#include -#include - -typedef __fsid_t fsid_t; - -#define __STATFS64_BODY_PORTABLE \ - uint64_t f_type; \ - uint64_t f_bsize; \ - uint64_t f_blocks; \ - uint64_t f_bfree; \ - uint64_t f_bavail; \ - uint64_t f_files; \ - uint64_t f_ffree; \ - fsid_t f_fsid; \ - uint64_t f_namelen; \ - uint64_t f_frsize; \ - uint64_t f_flags; \ - uint64_t f_spare[5]; - - -struct StatfsPortable { __STATFS64_BODY_PORTABLE }; -typedef struct StatfsPortable Statfs64Portable; - -#undef __STATFS64_BODY_PORTABLE - -static void statfs_n2p(const struct statfs* pn, struct StatfsPortable* pp) -{ - memset(pp, '\0', sizeof(struct StatfsPortable)); - pp->f_type = pn->f_type; - pp->f_bsize = pn->f_bsize; - pp->f_blocks = pn->f_blocks; - pp->f_bfree = pn->f_bfree; - pp->f_bavail = pn->f_bavail; - pp->f_files = pn->f_files; - pp->f_ffree = pn->f_ffree; - memcpy(&pp->f_fsid, &pn->f_fsid, sizeof(int)*2); - pp->f_namelen = pn->f_namelen; - pp->f_frsize = pn->f_frsize; - pp->f_flags = pn->f_flags; -#ifdef __mips__ - memcpy(&pp->f_spare, &pn->f_spare, 4); -#else - memcpy(&pp->f_spare, &pn->f_spare, 5); -#endif -} - -int WRAP(statfs)(const char* path, struct StatfsPortable* stat) -{ - struct statfs target_stat; - int ret = REAL(statfs)(path, &target_stat); - statfs_n2p(&target_stat, stat); - return ret; -} - -int WRAP(statfs64)(const char* path, Statfs64Portable* stat) -{ - return WRAP(statfs)(path, stat); -} - -int WRAP(fstatfs)(int fd, struct StatfsPortable* stat) -{ - struct statfs target_stat; - int ret = REAL(fstatfs)(fd, &target_stat); - statfs_n2p(&target_stat, stat); - return ret; -} - -int WRAP(fstatfs64)(int fd, Statfs64Portable* stat) -{ - return WRAP(fstatfs)(fd, stat); -} - -#endif /* _VFS_PORTABLE_H */