1 /** 2 D header file for C99. 3 4 $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_errno.h.html, _errno.h) 5 6 Copyright: Copyright Sean Kelly 2005 - 2009. 7 License: Distributed under the 8 $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). 9 (See accompanying file LICENSE) 10 Authors: Sean Kelly, Alex Rønne Petersen 11 Standards: ISO/IEC 9899:1999 (E) 12 */ 13 module nulib.c.errno; 14 15 version (OSX) 16 version = Darwin; 17 else version (iOS) 18 version = Darwin; 19 else version (TVOS) 20 version = Darwin; 21 else version (WatchOS) 22 version = Darwin; 23 24 version (ARM) version = ARM_Any; 25 version (AArch64) version = ARM_Any; 26 version (HPPA) version = HPPA_Any; 27 version (MIPS32) version = MIPS_Any; 28 version (MIPS64) version = MIPS_Any; 29 version (PPC) version = PPC_Any; 30 version (PPC64) version = PPC_Any; 31 version (RISCV32) version = RISCV_Any; 32 version (RISCV64) version = RISCV_Any; 33 version (S390) version = IBMZ_Any; 34 version (SPARC) version = SPARC_Any; 35 version (SPARC64) version = SPARC_Any; 36 version (SystemZ) version = IBMZ_Any; 37 version (X86) version = X86_Any; 38 version (X86_64) version = X86_Any; 39 40 @trusted: // Only manipulates errno. 41 nothrow: 42 @nogc: 43 44 version (CRuntime_Microsoft) { 45 extern (C) { 46 ref int _errno(); 47 alias errno = _errno; 48 } 49 } else version (CRuntime_Glibc) { 50 extern (C) { 51 ref int __errno_location(); 52 alias errno = __errno_location; 53 } 54 } else version (CRuntime_Musl) { 55 extern (C) { 56 ref int __errno_location(); 57 alias errno = __errno_location; 58 } 59 } else version (CRuntime_Newlib) { 60 extern (C) { 61 ref int __errno(); 62 alias errno = __errno; 63 } 64 } else version (OpenBSD) { 65 // https://github.com/openbsd/src/blob/master/include/errno.h 66 extern (C) { 67 ref int __errno(); 68 alias errno = __errno; 69 } 70 } else version (NetBSD) { 71 // https://github.com/NetBSD/src/blob/trunk/include/errno.h 72 extern (C) { 73 ref int __errno(); 74 alias errno = __errno; 75 } 76 } else version (FreeBSD) { 77 extern (C) { 78 ref int __error(); 79 alias errno = __error; 80 } 81 } else version (DragonFlyBSD) { 82 extern (C) { 83 pragma(mangle, "errno") int __errno; 84 ref int __error() { 85 return __errno; 86 } 87 88 alias errno = __error; 89 } 90 } else version (CRuntime_Bionic) { 91 extern (C) { 92 ref int __errno(); 93 alias errno = __errno; 94 } 95 } else version (CRuntime_UClibc) { 96 extern (C) { 97 ref int __errno_location(); 98 alias errno = __errno_location; 99 } 100 } else version (Darwin) { 101 extern (C) { 102 ref int __error(); 103 alias errno = __error; 104 } 105 } else version (Solaris) { 106 extern (C) { 107 ref int ___errno(); 108 alias errno = ___errno; 109 } 110 } else version (Haiku) { 111 // https://github.com/haiku/haiku/blob/master/headers/posix/errno.h 112 extern (C) { 113 ref int _errnop(); 114 alias errno = _errnop; 115 } 116 }