openbsd-compat.h revision 6209c81d40e2b4e129a28bda3259150d79d507e8
1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef _BIONIC_OPENBSD_COMPAT_H_included 18#define _BIONIC_OPENBSD_COMPAT_H_included 19 20#include <sys/cdefs.h> 21#include <stddef.h> // For size_t. 22 23#define __USE_BSD 24 25/* OpenBSD's <ctype.h> uses these names, which conflicted with stlport. 26 * Additionally, we changed the numeric/digit type from N to D for libcxx. 27 */ 28#define _U _CTYPE_U 29#define _L _CTYPE_L 30#define _N _CTYPE_D 31#define _S _CTYPE_S 32#define _P _CTYPE_P 33#define _C _CTYPE_C 34#define _X _CTYPE_X 35#define _B _CTYPE_B 36 37/* OpenBSD has this, but we can't really implement it correctly on Linux. */ 38#define issetugid() 0 39 40#define explicit_bzero(p, s) memset(p, 0, s) 41 42/* We have OpenBSD's getentropy_linux.c, but we don't mention getentropy in any header. */ 43__LIBC_HIDDEN__ extern int getentropy(void*, size_t); 44 45/* LP32 NDK ctype.h contained references to these. */ 46__LIBC64_HIDDEN__ extern const short* _tolower_tab_; 47__LIBC64_HIDDEN__ extern const short* _toupper_tab_; 48 49__LIBC_HIDDEN__ extern struct atexit* __atexit; 50__LIBC_HIDDEN__ extern const char _C_ctype_[]; 51__LIBC_HIDDEN__ extern const short _C_toupper_[]; 52__LIBC_HIDDEN__ extern const short _C_tolower_[]; 53__LIBC_HIDDEN__ extern char* __findenv(const char*, int, int*); 54__LIBC_HIDDEN__ extern char* _mktemp(char*); 55 56/* TODO: hide this when android_support.a is fixed (http://b/16298580).*/ 57/*__LIBC_HIDDEN__*/ extern int __isthreaded; 58 59#endif 60