From d39f3f2c2e7fc73ddb019695f0df3417deef5bf4 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 21 Apr 2014 17:13:46 -0700 Subject: Clean up and document our hacks for building BSD source. Change-Id: Ic591e22fa5b363bb68376b9f25814c0e5bd83fbf --- HACKING.txt | 10 +++- libc/Android.mk | 20 ++++---- .../android/include/freebsd-compat.h | 54 ++++++++++++++++++++++ .../android/include/libc_private.h | 25 ++++++++++ libc/upstream-freebsd/android/include/namespace.h | 22 +++++++++ libc/upstream-freebsd/android/include/spinlock.h | 22 +++++++++ .../android/include/un-namespace.h | 20 ++++++++ libc/upstream-freebsd/freebsd-compat.h | 54 ---------------------- libc/upstream-freebsd/libc_private.h | 25 ---------- libc/upstream-freebsd/namespace.h | 22 --------- libc/upstream-freebsd/spinlock.h | 22 --------- libc/upstream-freebsd/un-namespace.h | 20 -------- libc/upstream-netbsd/README.txt | 4 -- libc/upstream-netbsd/android/include/env.h | 22 +++++++++ libc/upstream-netbsd/android/include/extern.h | 28 +++++++++++ libc/upstream-netbsd/android/include/fd_setsize.h | 0 libc/upstream-netbsd/android/include/namespace.h | 25 ++++++++++ .../android/include/netbsd-compat.h | 34 ++++++++++++++ libc/upstream-netbsd/android/include/port_after.h | 20 ++++++++ libc/upstream-netbsd/android/include/port_before.h | 28 +++++++++++ libc/upstream-netbsd/android/include/rand48.h | 34 ++++++++++++++ libc/upstream-netbsd/android/include/reentrant.h | 40 ++++++++++++++++ libc/upstream-netbsd/env.h | 22 --------- libc/upstream-netbsd/extern.h | 28 ----------- libc/upstream-netbsd/fd_setsize.h | 0 libc/upstream-netbsd/namespace.h | 25 ---------- libc/upstream-netbsd/netbsd-compat.h | 34 -------------- libc/upstream-netbsd/port_after.h | 20 -------- libc/upstream-netbsd/port_before.h | 28 ----------- libc/upstream-netbsd/rand48.h | 34 -------------- libc/upstream-netbsd/reentrant.h | 40 ---------------- libc/upstream-openbsd/README.txt | 5 ++ libc/upstream-openbsd/android/gdtoa_support.cpp | 19 ++++++++ libc/upstream-openbsd/android/include/arith.h | 24 ++++++++++ libc/upstream-openbsd/android/include/gd_qnan.h | 48 +++++++++++++++++++ .../android/include/openbsd-compat.h | 35 ++++++++++++++ .../android/include/thread_private.h | 26 +++++++++++ libc/upstream-openbsd/arith.h | 24 ---------- libc/upstream-openbsd/gd_qnan.h | 48 ------------------- libc/upstream-openbsd/gdtoa_support.cpp | 19 -------- libc/upstream-openbsd/openbsd-compat.h | 35 -------------- libc/upstream-openbsd/thread_private.h | 26 ----------- 42 files changed, 549 insertions(+), 542 deletions(-) create mode 100644 libc/upstream-freebsd/android/include/freebsd-compat.h create mode 100644 libc/upstream-freebsd/android/include/libc_private.h create mode 100644 libc/upstream-freebsd/android/include/namespace.h create mode 100644 libc/upstream-freebsd/android/include/spinlock.h create mode 100644 libc/upstream-freebsd/android/include/un-namespace.h delete mode 100644 libc/upstream-freebsd/freebsd-compat.h delete mode 100644 libc/upstream-freebsd/libc_private.h delete mode 100644 libc/upstream-freebsd/namespace.h delete mode 100644 libc/upstream-freebsd/spinlock.h delete mode 100644 libc/upstream-freebsd/un-namespace.h create mode 100644 libc/upstream-netbsd/android/include/env.h create mode 100644 libc/upstream-netbsd/android/include/extern.h create mode 100644 libc/upstream-netbsd/android/include/fd_setsize.h create mode 100644 libc/upstream-netbsd/android/include/namespace.h create mode 100644 libc/upstream-netbsd/android/include/netbsd-compat.h create mode 100644 libc/upstream-netbsd/android/include/port_after.h create mode 100644 libc/upstream-netbsd/android/include/port_before.h create mode 100644 libc/upstream-netbsd/android/include/rand48.h create mode 100644 libc/upstream-netbsd/android/include/reentrant.h delete mode 100644 libc/upstream-netbsd/env.h delete mode 100644 libc/upstream-netbsd/extern.h delete mode 100644 libc/upstream-netbsd/fd_setsize.h delete mode 100644 libc/upstream-netbsd/namespace.h delete mode 100644 libc/upstream-netbsd/netbsd-compat.h delete mode 100644 libc/upstream-netbsd/port_after.h delete mode 100644 libc/upstream-netbsd/port_before.h delete mode 100644 libc/upstream-netbsd/rand48.h delete mode 100644 libc/upstream-netbsd/reentrant.h create mode 100644 libc/upstream-openbsd/README.txt create mode 100644 libc/upstream-openbsd/android/gdtoa_support.cpp create mode 100644 libc/upstream-openbsd/android/include/arith.h create mode 100644 libc/upstream-openbsd/android/include/gd_qnan.h create mode 100644 libc/upstream-openbsd/android/include/openbsd-compat.h create mode 100644 libc/upstream-openbsd/android/include/thread_private.h delete mode 100644 libc/upstream-openbsd/arith.h delete mode 100644 libc/upstream-openbsd/gd_qnan.h delete mode 100644 libc/upstream-openbsd/gdtoa_support.cpp delete mode 100644 libc/upstream-openbsd/openbsd-compat.h delete mode 100644 libc/upstream-openbsd/thread_private.h diff --git a/HACKING.txt b/HACKING.txt index 9f45903..fb93b5a 100644 --- a/HACKING.txt +++ b/HACKING.txt @@ -97,8 +97,14 @@ libc/ upstream-openbsd/ # These directories contain unmolested upstream source. Any time we can # just use a BSD implementation of something unmodified, we should. - # See files like netbsd-compat.h for various ways in which we manage to - # build BSD source in bionic. + # The structure under these directories mimics the upstream tree, + # but there's also... + android/ + include/ + # This is where we keep the hacks necessary to build BSD source + # in our world. The *-compat.h files are automatically included + # using -include, but we also provide equivalents for missing + # header/source files needed by the BSD implementation. bionic/ # This is the biggest mess. The C++ files are files we own, typically diff --git a/libc/Android.mk b/libc/Android.mk index 0ec927a..507126e 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -306,7 +306,7 @@ libc_upstream_netbsd_src_files := \ upstream-netbsd/lib/libc/unistd/killpg.c \ libc_upstream_openbsd_gdtoa_src_files := \ - upstream-openbsd/gdtoa_support.cpp \ + upstream-openbsd/android/gdtoa_support.cpp \ upstream-openbsd/lib/libc/gdtoa/dmisc.c \ upstream-openbsd/lib/libc/gdtoa/dtoa.c \ upstream-openbsd/lib/libc/gdtoa/gdtoa.c \ @@ -549,7 +549,7 @@ LOCAL_CFLAGS := \ -I$(LOCAL_PATH)/dns/include \ -I$(LOCAL_PATH)/private \ -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \ - -include upstream-netbsd/netbsd-compat.h + -include upstream-netbsd/android/include/netbsd-compat.h LOCAL_CONLYFLAGS := $(libc_common_conlyflags) LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_C_INCLUDES := $(libc_common_c_includes) @@ -573,9 +573,9 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files) LOCAL_CFLAGS := \ $(libc_common_cflags) \ - -I$(LOCAL_PATH)/upstream-freebsd \ + -I$(LOCAL_PATH)/upstream-freebsd/android/include \ -I$(LOCAL_PATH)/upstream-freebsd/lib/libc/include \ - -include upstream-freebsd/freebsd-compat.h + -include freebsd-compat.h LOCAL_CONLYFLAGS := $(libc_common_conlyflags) LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_C_INCLUDES := $(libc_common_c_includes) @@ -600,9 +600,9 @@ LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files) LOCAL_CFLAGS := \ $(libc_common_cflags) \ -DPOSIX_MISTAKE \ - -I$(LOCAL_PATH)/upstream-netbsd \ + -I$(LOCAL_PATH)/upstream-netbsd/android/include \ -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \ - -include upstream-netbsd/netbsd-compat.h + -include netbsd-compat.h LOCAL_CONLYFLAGS := $(libc_common_conlyflags) LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_C_INCLUDES := $(libc_common_c_includes) @@ -626,9 +626,9 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files) LOCAL_CFLAGS := \ $(libc_common_cflags) \ - -I$(LOCAL_PATH)/upstream-openbsd \ + -I$(LOCAL_PATH)/upstream-openbsd/android/include \ -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \ - -include upstream-openbsd/openbsd-compat.h + -include openbsd-compat.h LOCAL_CONLYFLAGS := $(libc_common_conlyflags) LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_C_INCLUDES := $(libc_common_c_includes) @@ -653,9 +653,9 @@ LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32) LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64) LOCAL_CFLAGS := \ $(libc_common_cflags) \ - -I$(LOCAL_PATH)/upstream-openbsd \ + -I$(LOCAL_PATH)/upstream-openbsd/android/include \ -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \ - -include upstream-openbsd/openbsd-compat.h \ + -include openbsd-compat.h \ LOCAL_CONLYFLAGS := $(libc_common_conlyflags) LOCAL_CPPFLAGS := $(libc_common_cppflags) diff --git a/libc/upstream-freebsd/android/include/freebsd-compat.h b/libc/upstream-freebsd/android/include/freebsd-compat.h new file mode 100644 index 0000000..d5f1425 --- /dev/null +++ b/libc/upstream-freebsd/android/include/freebsd-compat.h @@ -0,0 +1,54 @@ +/* + * 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 _BIONIC_FREEBSD_COMPAT_H_included +#define _BIONIC_FREEBSD_COMPAT_H_included + +#define __USE_BSD +#define REPLACE_GETOPT + +/* + * FreeBSD's libc has three symbols for every symbol: + * + * __f will be the actual implementation. + * _f will be a weak reference to __f (used for calls to f from within the library). + * f will be a weak reference to __f (used for calls to f from outside the library). + * + * We collapse this into just the one symbol, f. + */ + +/* Prevent weak reference generation. */ +#define __weak_reference(sym,alias) + +/* Ensure that the implementation itself gets the underscore-free name. */ +#define __sleep sleep +#define __usleep usleep + +/* Redirect internal C library calls to the public function. */ +#define _close close +#define _fcntl fcntl +#define _fstat fstat +#define _nanosleep nanosleep +#define _open open + +/* This one is only needed as long as we have a mix of OpenBSD and FreeBSD stdio. */ +#define _sseek __sseek + +/* This is in BSD's . */ +#include +extern uint32_t arc4random_uniform(uint32_t upper_bound); + +#endif diff --git a/libc/upstream-freebsd/android/include/libc_private.h b/libc/upstream-freebsd/android/include/libc_private.h new file mode 100644 index 0000000..c6a6433 --- /dev/null +++ b/libc/upstream-freebsd/android/include/libc_private.h @@ -0,0 +1,25 @@ +/* + * 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 _BIONIC_FREEBSD_LIBC_PRIVATE_H_included +#define _BIONIC_FREEBSD_LIBC_PRIVATE_H_included + +#define STDIO_THREAD_LOCK() /* TODO: until we have the FreeBSD findfp.c, this is useless. */ +#define STDIO_THREAD_UNLOCK() /* TODO: until we have the FreeBSD findfp.c, this is useless. */ + +#define ORIENT(fp, o) /* Only needed for wide-character stream support. */ + +#endif diff --git a/libc/upstream-freebsd/android/include/namespace.h b/libc/upstream-freebsd/android/include/namespace.h new file mode 100644 index 0000000..a980b57 --- /dev/null +++ b/libc/upstream-freebsd/android/include/namespace.h @@ -0,0 +1,22 @@ +/* + * 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 _BIONIC_FREEBSD_NAMESPACE_H_included +#define _BIONIC_FREEBSD_NAMESPACE_H_included + +__attribute__((visibility("hidden"))) char* _mktemp(char*); + +#endif diff --git a/libc/upstream-freebsd/android/include/spinlock.h b/libc/upstream-freebsd/android/include/spinlock.h new file mode 100644 index 0000000..f5c3785 --- /dev/null +++ b/libc/upstream-freebsd/android/include/spinlock.h @@ -0,0 +1,22 @@ +/* + * 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 _BIONIC_FREEBSD_SPINLOCK_H_included +#define _BIONIC_FREEBSD_SPINLOCK_H_included + +/* TODO: until we have the FreeBSD findfp.c, this is useless. */ + +#endif diff --git a/libc/upstream-freebsd/android/include/un-namespace.h b/libc/upstream-freebsd/android/include/un-namespace.h new file mode 100644 index 0000000..a3f850e --- /dev/null +++ b/libc/upstream-freebsd/android/include/un-namespace.h @@ -0,0 +1,20 @@ +/* + * 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 _BIONIC_FREEBSD_NAMESPACE_H_included +#define _BIONIC_FREEBSD_NAMESPACE_H_included + +#endif diff --git a/libc/upstream-freebsd/freebsd-compat.h b/libc/upstream-freebsd/freebsd-compat.h deleted file mode 100644 index d5f1425..0000000 --- a/libc/upstream-freebsd/freebsd-compat.h +++ /dev/null @@ -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 _BIONIC_FREEBSD_COMPAT_H_included -#define _BIONIC_FREEBSD_COMPAT_H_included - -#define __USE_BSD -#define REPLACE_GETOPT - -/* - * FreeBSD's libc has three symbols for every symbol: - * - * __f will be the actual implementation. - * _f will be a weak reference to __f (used for calls to f from within the library). - * f will be a weak reference to __f (used for calls to f from outside the library). - * - * We collapse this into just the one symbol, f. - */ - -/* Prevent weak reference generation. */ -#define __weak_reference(sym,alias) - -/* Ensure that the implementation itself gets the underscore-free name. */ -#define __sleep sleep -#define __usleep usleep - -/* Redirect internal C library calls to the public function. */ -#define _close close -#define _fcntl fcntl -#define _fstat fstat -#define _nanosleep nanosleep -#define _open open - -/* This one is only needed as long as we have a mix of OpenBSD and FreeBSD stdio. */ -#define _sseek __sseek - -/* This is in BSD's . */ -#include -extern uint32_t arc4random_uniform(uint32_t upper_bound); - -#endif diff --git a/libc/upstream-freebsd/libc_private.h b/libc/upstream-freebsd/libc_private.h deleted file mode 100644 index c6a6433..0000000 --- a/libc/upstream-freebsd/libc_private.h +++ /dev/null @@ -1,25 +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 _BIONIC_FREEBSD_LIBC_PRIVATE_H_included -#define _BIONIC_FREEBSD_LIBC_PRIVATE_H_included - -#define STDIO_THREAD_LOCK() /* TODO: until we have the FreeBSD findfp.c, this is useless. */ -#define STDIO_THREAD_UNLOCK() /* TODO: until we have the FreeBSD findfp.c, this is useless. */ - -#define ORIENT(fp, o) /* Only needed for wide-character stream support. */ - -#endif diff --git a/libc/upstream-freebsd/namespace.h b/libc/upstream-freebsd/namespace.h deleted file mode 100644 index a980b57..0000000 --- a/libc/upstream-freebsd/namespace.h +++ /dev/null @@ -1,22 +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 _BIONIC_FREEBSD_NAMESPACE_H_included -#define _BIONIC_FREEBSD_NAMESPACE_H_included - -__attribute__((visibility("hidden"))) char* _mktemp(char*); - -#endif diff --git a/libc/upstream-freebsd/spinlock.h b/libc/upstream-freebsd/spinlock.h deleted file mode 100644 index f5c3785..0000000 --- a/libc/upstream-freebsd/spinlock.h +++ /dev/null @@ -1,22 +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 _BIONIC_FREEBSD_SPINLOCK_H_included -#define _BIONIC_FREEBSD_SPINLOCK_H_included - -/* TODO: until we have the FreeBSD findfp.c, this is useless. */ - -#endif diff --git a/libc/upstream-freebsd/un-namespace.h b/libc/upstream-freebsd/un-namespace.h deleted file mode 100644 index a3f850e..0000000 --- a/libc/upstream-freebsd/un-namespace.h +++ /dev/null @@ -1,20 +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 _BIONIC_FREEBSD_NAMESPACE_H_included -#define _BIONIC_FREEBSD_NAMESPACE_H_included - -#endif diff --git a/libc/upstream-netbsd/README.txt b/libc/upstream-netbsd/README.txt index 86af6eb..e2d146e 100644 --- a/libc/upstream-netbsd/README.txt +++ b/libc/upstream-netbsd/README.txt @@ -2,8 +2,4 @@ This directory contains upstream NetBSD source. You should not edit these files directly. Make fixes upstream and then pull down the new version of the file. -Note that code in the other 'netbsd' directory contains Android modifications. -We should work towards getting as many of those changes as possible upstream -and then losing those files in favor of pure upstream copies here instead. - TODO: write a script to make this process automated. diff --git a/libc/upstream-netbsd/android/include/env.h b/libc/upstream-netbsd/android/include/env.h new file mode 100644 index 0000000..8f99f9d --- /dev/null +++ b/libc/upstream-netbsd/android/include/env.h @@ -0,0 +1,22 @@ +/* + * 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 _BIONIC_NETBSD_ENV_H_included +#define _BIONIC_NETBSD_ENV_H_included + +/* Placeholder. */ + +#endif diff --git a/libc/upstream-netbsd/android/include/extern.h b/libc/upstream-netbsd/android/include/extern.h new file mode 100644 index 0000000..616becd --- /dev/null +++ b/libc/upstream-netbsd/android/include/extern.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _BIONIC_NETBSD_EXTERN_H_included +#define _BIONIC_NETBSD_EXTERN_H_included + +#include + +__BEGIN_DECLS + +const char* __strsignal(int, char*, size_t); + +__END_DECLS + +#endif diff --git a/libc/upstream-netbsd/android/include/fd_setsize.h b/libc/upstream-netbsd/android/include/fd_setsize.h new file mode 100644 index 0000000..e69de29 diff --git a/libc/upstream-netbsd/android/include/namespace.h b/libc/upstream-netbsd/android/include/namespace.h new file mode 100644 index 0000000..a4d4151 --- /dev/null +++ b/libc/upstream-netbsd/android/include/namespace.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _BIONIC_NETBSD_NAMESPACE_H_included +#define _BIONIC_NETBSD_NAMESPACE_H_included + +// NetBSD uses __weak_alias on a lot of functions. We don't want that. +#if defined(__weak_alias) +#undef __weak_alias +#endif + +#endif diff --git a/libc/upstream-netbsd/android/include/netbsd-compat.h b/libc/upstream-netbsd/android/include/netbsd-compat.h new file mode 100644 index 0000000..84be931 --- /dev/null +++ b/libc/upstream-netbsd/android/include/netbsd-compat.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _BIONIC_NETBSD_COMPAT_H_included +#define _BIONIC_NETBSD_COMPAT_H_included + +// NetBSD uses _DIAGASSERT to null-check arguments and the like. +#include +#define _DIAGASSERT(e) ((e) ? (void) 0 : __assert2(__FILE__, __LINE__, __func__, #e)) + +// TODO: update our to support this properly. +#define __type_fit(t, a) (0 == 0) + +#define _GNU_SOURCE +#define __USE_BSD + +// TODO: we don't yet have thread-safe environment variables. +#define __readlockenv() 0 +#define __unlockenv() 0 + +#endif diff --git a/libc/upstream-netbsd/android/include/port_after.h b/libc/upstream-netbsd/android/include/port_after.h new file mode 100644 index 0000000..3f8b6f8 --- /dev/null +++ b/libc/upstream-netbsd/android/include/port_after.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _BIONIC_NETBSD_PORT_BEFORE_H_included +#define _BIONIC_NETBSD_PORT_BEFORE_H_included + +#endif diff --git a/libc/upstream-netbsd/android/include/port_before.h b/libc/upstream-netbsd/android/include/port_before.h new file mode 100644 index 0000000..9fa9487 --- /dev/null +++ b/libc/upstream-netbsd/android/include/port_before.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _BIONIC_NETBSD_PORT_BEFORE_H_included +#define _BIONIC_NETBSD_PORT_BEFORE_H_included + +#include "namespace.h" +#include +#include +#include + +#define ISC_FORMAT_PRINTF(a,b) __printflike(a,b) +#define ISC_SOCKLEN_T socklen_t + +#endif diff --git a/libc/upstream-netbsd/android/include/rand48.h b/libc/upstream-netbsd/android/include/rand48.h new file mode 100644 index 0000000..1ad8b0d --- /dev/null +++ b/libc/upstream-netbsd/android/include/rand48.h @@ -0,0 +1,34 @@ +/* $NetBSD: rand48.h,v 1.6 2011/05/18 19:36:36 dsl Exp $ */ + +/* + * Copyright (c) 1993 Martin Birgmeier + * All rights reserved. + * + * You may redistribute unmodified or modified versions of this source + * code provided that the above copyright notice and this and the + * following conditions are retained. + * + * This software is provided ``as is'', and comes with no warranties + * of any kind. I shall in no event be liable for anything that happens + * to anyone/anything when using this software. + */ + +#ifndef _RAND48_H_ +#define _RAND48_H_ + +#include + +extern void __dorand48(unsigned short[3]); +extern unsigned short __rand48_seed[3]; +extern unsigned short __rand48_mult[3]; +extern unsigned short __rand48_add; + +#define RAND48_SEED_0 (0x330e) +#define RAND48_SEED_1 (0xabcd) +#define RAND48_SEED_2 (0x1234) +#define RAND48_MULT_0 (0xe66d) +#define RAND48_MULT_1 (0xdeec) +#define RAND48_MULT_2 (0x0005) +#define RAND48_ADD (0x000b) + +#endif /* _RAND48_H_ */ diff --git a/libc/upstream-netbsd/android/include/reentrant.h b/libc/upstream-netbsd/android/include/reentrant.h new file mode 100644 index 0000000..3ca8fd6 --- /dev/null +++ b/libc/upstream-netbsd/android/include/reentrant.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _BIONIC_NETBSD_REENTRANT_H_included +#define _BIONIC_NETBSD_REENTRANT_H_included + +#define _REENTRANT + +#include +#include + +// +// Map NetBSD libc internal locking to pthread locking. +// + +#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +#define mutex_t pthread_mutex_t +#define mutex_lock(x) pthread_mutex_lock(x) +#define mutex_unlock(x) pthread_mutex_unlock(x) + +#define RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER +#define rwlock_t pthread_rwlock_t +#define rwlock_rdlock pthread_rwlock_rdlock +#define rwlock_unlock pthread_rwlock_unlock +#define rwlock_wrlock pthread_rwlock_wrlock + +#endif diff --git a/libc/upstream-netbsd/env.h b/libc/upstream-netbsd/env.h deleted file mode 100644 index 8f99f9d..0000000 --- a/libc/upstream-netbsd/env.h +++ /dev/null @@ -1,22 +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 _BIONIC_NETBSD_ENV_H_included -#define _BIONIC_NETBSD_ENV_H_included - -/* Placeholder. */ - -#endif diff --git a/libc/upstream-netbsd/extern.h b/libc/upstream-netbsd/extern.h deleted file mode 100644 index 616becd..0000000 --- a/libc/upstream-netbsd/extern.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _BIONIC_NETBSD_EXTERN_H_included -#define _BIONIC_NETBSD_EXTERN_H_included - -#include - -__BEGIN_DECLS - -const char* __strsignal(int, char*, size_t); - -__END_DECLS - -#endif diff --git a/libc/upstream-netbsd/fd_setsize.h b/libc/upstream-netbsd/fd_setsize.h deleted file mode 100644 index e69de29..0000000 diff --git a/libc/upstream-netbsd/namespace.h b/libc/upstream-netbsd/namespace.h deleted file mode 100644 index a4d4151..0000000 --- a/libc/upstream-netbsd/namespace.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _BIONIC_NETBSD_NAMESPACE_H_included -#define _BIONIC_NETBSD_NAMESPACE_H_included - -// NetBSD uses __weak_alias on a lot of functions. We don't want that. -#if defined(__weak_alias) -#undef __weak_alias -#endif - -#endif diff --git a/libc/upstream-netbsd/netbsd-compat.h b/libc/upstream-netbsd/netbsd-compat.h deleted file mode 100644 index 84be931..0000000 --- a/libc/upstream-netbsd/netbsd-compat.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _BIONIC_NETBSD_COMPAT_H_included -#define _BIONIC_NETBSD_COMPAT_H_included - -// NetBSD uses _DIAGASSERT to null-check arguments and the like. -#include -#define _DIAGASSERT(e) ((e) ? (void) 0 : __assert2(__FILE__, __LINE__, __func__, #e)) - -// TODO: update our to support this properly. -#define __type_fit(t, a) (0 == 0) - -#define _GNU_SOURCE -#define __USE_BSD - -// TODO: we don't yet have thread-safe environment variables. -#define __readlockenv() 0 -#define __unlockenv() 0 - -#endif diff --git a/libc/upstream-netbsd/port_after.h b/libc/upstream-netbsd/port_after.h deleted file mode 100644 index 3f8b6f8..0000000 --- a/libc/upstream-netbsd/port_after.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _BIONIC_NETBSD_PORT_BEFORE_H_included -#define _BIONIC_NETBSD_PORT_BEFORE_H_included - -#endif diff --git a/libc/upstream-netbsd/port_before.h b/libc/upstream-netbsd/port_before.h deleted file mode 100644 index 9fa9487..0000000 --- a/libc/upstream-netbsd/port_before.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _BIONIC_NETBSD_PORT_BEFORE_H_included -#define _BIONIC_NETBSD_PORT_BEFORE_H_included - -#include "namespace.h" -#include -#include -#include - -#define ISC_FORMAT_PRINTF(a,b) __printflike(a,b) -#define ISC_SOCKLEN_T socklen_t - -#endif diff --git a/libc/upstream-netbsd/rand48.h b/libc/upstream-netbsd/rand48.h deleted file mode 100644 index 1ad8b0d..0000000 --- a/libc/upstream-netbsd/rand48.h +++ /dev/null @@ -1,34 +0,0 @@ -/* $NetBSD: rand48.h,v 1.6 2011/05/18 19:36:36 dsl Exp $ */ - -/* - * Copyright (c) 1993 Martin Birgmeier - * All rights reserved. - * - * You may redistribute unmodified or modified versions of this source - * code provided that the above copyright notice and this and the - * following conditions are retained. - * - * This software is provided ``as is'', and comes with no warranties - * of any kind. I shall in no event be liable for anything that happens - * to anyone/anything when using this software. - */ - -#ifndef _RAND48_H_ -#define _RAND48_H_ - -#include - -extern void __dorand48(unsigned short[3]); -extern unsigned short __rand48_seed[3]; -extern unsigned short __rand48_mult[3]; -extern unsigned short __rand48_add; - -#define RAND48_SEED_0 (0x330e) -#define RAND48_SEED_1 (0xabcd) -#define RAND48_SEED_2 (0x1234) -#define RAND48_MULT_0 (0xe66d) -#define RAND48_MULT_1 (0xdeec) -#define RAND48_MULT_2 (0x0005) -#define RAND48_ADD (0x000b) - -#endif /* _RAND48_H_ */ diff --git a/libc/upstream-netbsd/reentrant.h b/libc/upstream-netbsd/reentrant.h deleted file mode 100644 index 3ca8fd6..0000000 --- a/libc/upstream-netbsd/reentrant.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _BIONIC_NETBSD_REENTRANT_H_included -#define _BIONIC_NETBSD_REENTRANT_H_included - -#define _REENTRANT - -#include -#include - -// -// Map NetBSD libc internal locking to pthread locking. -// - -#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER -#define mutex_t pthread_mutex_t -#define mutex_lock(x) pthread_mutex_lock(x) -#define mutex_unlock(x) pthread_mutex_unlock(x) - -#define RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER -#define rwlock_t pthread_rwlock_t -#define rwlock_rdlock pthread_rwlock_rdlock -#define rwlock_unlock pthread_rwlock_unlock -#define rwlock_wrlock pthread_rwlock_wrlock - -#endif diff --git a/libc/upstream-openbsd/README.txt b/libc/upstream-openbsd/README.txt new file mode 100644 index 0000000..9db64ea --- /dev/null +++ b/libc/upstream-openbsd/README.txt @@ -0,0 +1,5 @@ +This directory contains upstream OpenBSD source. You should not edit these +files directly. Make fixes upstream and then pull down the new version of +the file. + +TODO: write a script to make this process automated. diff --git a/libc/upstream-openbsd/android/gdtoa_support.cpp b/libc/upstream-openbsd/android/gdtoa_support.cpp new file mode 100644 index 0000000..4e7bf3b --- /dev/null +++ b/libc/upstream-openbsd/android/gdtoa_support.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +__LIBC_HIDDEN__ pthread_mutex_t __dtoa_locks[] = { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER }; diff --git a/libc/upstream-openbsd/android/include/arith.h b/libc/upstream-openbsd/android/include/arith.h new file mode 100644 index 0000000..b262e4f --- /dev/null +++ b/libc/upstream-openbsd/android/include/arith.h @@ -0,0 +1,24 @@ +/* + * 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. + */ + +#define IEEE_8087 + +#if __LP64__ +#define Long int +#endif + +#define INFNAN_CHECK +#define MULTIPLE_THREADS diff --git a/libc/upstream-openbsd/android/include/gd_qnan.h b/libc/upstream-openbsd/android/include/gd_qnan.h new file mode 100644 index 0000000..e8e907b --- /dev/null +++ b/libc/upstream-openbsd/android/include/gd_qnan.h @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#if __arm__ + +#define f_QNAN 0xffffffff + +#define d_QNAN0 0xffffffff +#define d_QNAN1 0xffffffff + +#elif __mips__ + +#define f_QNAN 0x7fbfffff + +#define d_QNAN0 0x7ff7ffff +#define d_QNAN1 0xffffffff + +#else + +#define f_QNAN 0xffc00000 + +#define d_QNAN0 0x00000000 +#define d_QNAN1 0xfff80000 + +#endif + +/* long double. */ +#if __LP64__ +#define ld_QNAN0 0x7fff8000 +#define ld_QNAN1 0x00000000 +#define ld_QNAN2 0x00000000 +#define ld_QNAN3 0x00000000 +#else +/* sizeof(long double) == sizeof(double), so we shouldn't be trying to use these constants. */ +#endif diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h new file mode 100644 index 0000000..b55f390 --- /dev/null +++ b/libc/upstream-openbsd/android/include/openbsd-compat.h @@ -0,0 +1,35 @@ +/* + * 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_OPENBSD_COMPAT_H_included +#define _BIONIC_OPENBSD_COMPAT_H_included + +#define _GNU_SOURCE +#define __USE_BSD + +/* OpenBSD's uses these names, which conflicted with stlport. + * Additionally, we changed the numeric/digit type from N to D for libcxx. + */ +#define _U _CTYPE_U +#define _L _CTYPE_L +#define _N _CTYPE_D +#define _S _CTYPE_S +#define _P _CTYPE_P +#define _C _CTYPE_C +#define _X _CTYPE_X +#define _B _CTYPE_B + +#endif diff --git a/libc/upstream-openbsd/android/include/thread_private.h b/libc/upstream-openbsd/android/include/thread_private.h new file mode 100644 index 0000000..10421e2 --- /dev/null +++ b/libc/upstream-openbsd/android/include/thread_private.h @@ -0,0 +1,26 @@ +/* + * 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 _THREAD_PRIVATE_H_ +#define _THREAD_PRIVATE_H_ + +#include + +/* 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) + +#endif /* _THREAD_PRIVATE_H_ */ diff --git a/libc/upstream-openbsd/arith.h b/libc/upstream-openbsd/arith.h deleted file mode 100644 index b262e4f..0000000 --- a/libc/upstream-openbsd/arith.h +++ /dev/null @@ -1,24 +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. - */ - -#define IEEE_8087 - -#if __LP64__ -#define Long int -#endif - -#define INFNAN_CHECK -#define MULTIPLE_THREADS diff --git a/libc/upstream-openbsd/gd_qnan.h b/libc/upstream-openbsd/gd_qnan.h deleted file mode 100644 index e8e907b..0000000 --- a/libc/upstream-openbsd/gd_qnan.h +++ /dev/null @@ -1,48 +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. - */ - -#if __arm__ - -#define f_QNAN 0xffffffff - -#define d_QNAN0 0xffffffff -#define d_QNAN1 0xffffffff - -#elif __mips__ - -#define f_QNAN 0x7fbfffff - -#define d_QNAN0 0x7ff7ffff -#define d_QNAN1 0xffffffff - -#else - -#define f_QNAN 0xffc00000 - -#define d_QNAN0 0x00000000 -#define d_QNAN1 0xfff80000 - -#endif - -/* long double. */ -#if __LP64__ -#define ld_QNAN0 0x7fff8000 -#define ld_QNAN1 0x00000000 -#define ld_QNAN2 0x00000000 -#define ld_QNAN3 0x00000000 -#else -/* sizeof(long double) == sizeof(double), so we shouldn't be trying to use these constants. */ -#endif diff --git a/libc/upstream-openbsd/gdtoa_support.cpp b/libc/upstream-openbsd/gdtoa_support.cpp deleted file mode 100644 index 4e7bf3b..0000000 --- a/libc/upstream-openbsd/gdtoa_support.cpp +++ /dev/null @@ -1,19 +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. - */ - -#include - -__LIBC_HIDDEN__ pthread_mutex_t __dtoa_locks[] = { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER }; diff --git a/libc/upstream-openbsd/openbsd-compat.h b/libc/upstream-openbsd/openbsd-compat.h deleted file mode 100644 index b55f390..0000000 --- a/libc/upstream-openbsd/openbsd-compat.h +++ /dev/null @@ -1,35 +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_OPENBSD_COMPAT_H_included -#define _BIONIC_OPENBSD_COMPAT_H_included - -#define _GNU_SOURCE -#define __USE_BSD - -/* OpenBSD's uses these names, which conflicted with stlport. - * Additionally, we changed the numeric/digit type from N to D for libcxx. - */ -#define _U _CTYPE_U -#define _L _CTYPE_L -#define _N _CTYPE_D -#define _S _CTYPE_S -#define _P _CTYPE_P -#define _C _CTYPE_C -#define _X _CTYPE_X -#define _B _CTYPE_B - -#endif diff --git a/libc/upstream-openbsd/thread_private.h b/libc/upstream-openbsd/thread_private.h deleted file mode 100644 index 10421e2..0000000 --- a/libc/upstream-openbsd/thread_private.h +++ /dev/null @@ -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 _THREAD_PRIVATE_H_ -#define _THREAD_PRIVATE_H_ - -#include - -/* 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) - -#endif /* _THREAD_PRIVATE_H_ */ -- cgit v1.1