From patchwork Wed Feb 3 21:08:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1435624 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=FbB5IU2t; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DWDnN5mNBz9tjt for ; Thu, 4 Feb 2021 08:08:55 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 26ABC393BC3E; Wed, 3 Feb 2021 21:08:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26ABC393BC3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1612386532; bh=jgYGzVQNhR4zJwptD+S3tkmPUJdnITYkPGqQYtdFTV8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=FbB5IU2togy5k8GErnnsKqRlmEX1ICYmrySOS/KxJ22GxZKrbdkUi8ca9YOFawWti MUUQf+9dWRPx7VXdvbaiwbdPOEHVJ5jwfUUV+LzwlWtsVPG829XNtD/DyyAcbVgXW9 KVDv8fnY6jVfpN/b2ujJzrw3T6CcRfzD9oZKbFsM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by sourceware.org (Postfix) with ESMTPS id A78DD393BC3E for ; Wed, 3 Feb 2021 21:08:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A78DD393BC3E Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4DWDn15LvJzQlVm; Wed, 3 Feb 2021 22:08:37 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id epsKvaC4PhmZ; Wed, 3 Feb 2021 22:08:30 +0100 (CET) To: gcc-patches@gcc.gnu.org Subject: [committed] libphobos: Merge upstream druntime 9d0c8364, phobos 9d575282e. Date: Wed, 3 Feb 2021 22:08:27 +0100 Message-Id: <20210203210827.1614048-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-MBO-SPAM-Probability: X-Rspamd-Score: -2.11 / 15.00 / 15.00 X-Rspamd-Queue-Id: 7E1BD17CF X-Rspamd-UID: c65d20 X-Spam-Status: No, score=-16.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch merges the D runtime library with upstream druntime 9d0c8364, and the standard library with upstream phobos 9d575282e. Adds bindings to libdruntime to replace extern(C) declarations found in the phobos part of the library, and fixes an issue with the locale bindings being incomplete (PR98910). Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, and committed to mainline. Regards, Iain. --- libphobos/ChangeLog: PR d/98910 * libdruntime/MERGE: Merge upstream druntime 9d0c8364. * libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add core/internal/attributes.d (DRUNTIME_DSOURCES_BIONIC): Add core/sys/bionic/stdlib.d. (DRUNTIME_DSOURCES_DARWIN): Add core/sys/darwin/stdlib.d, and core/sys/darwin/sys/sysctl.d. (DRUNTIME_DSOURCES_DRAGONFLYBSD): Add core/sys/dragonflybsd/stdlib.d, and core/sys/dragonflybsd/sys/sysctl.d. (DRUNTIME_DSOURCES_FREEBSD): Add core/sys/freebsd/stdlib.d, and core/sys/freebsd/sys/sysctl.d. (DRUNTIME_DSOURCES_NETBSD): Add core/sys/netbsd/stdlib.d, and core/sys/netbsd/sys/sysctl.d. (DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/stdlib.d, and core/sys/openbsd/sys/sysctl.d. (DRUNTIME_DSOURCES_SOLARIS): Add core/sys/solaris/stdlib.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 9d575282e. --- libphobos/libdruntime/MERGE | 2 +- libphobos/libdruntime/Makefile.am | 69 ++-- libphobos/libdruntime/Makefile.in | 174 +++++---- .../libdruntime/core/internal/attributes.d | 11 + .../libdruntime/core/sys/bionic/stdlib.d | 17 + .../libdruntime/core/sys/darwin/mach/dyld.d | 5 +- .../libdruntime/core/sys/darwin/stdlib.d | 26 ++ .../libdruntime/core/sys/darwin/sys/sysctl.d | 253 +++++++++++++ .../core/sys/dragonflybsd/stdlib.d | 17 + .../core/sys/dragonflybsd/sys/sysctl.d | 199 +++++++++++ .../libdruntime/core/sys/freebsd/stdlib.d | 17 + .../libdruntime/core/sys/freebsd/sys/sysctl.d | 211 +++++++++++ .../libdruntime/core/sys/netbsd/stdlib.d | 17 + .../libdruntime/core/sys/netbsd/sys/sysctl.d | 254 +++++++++++++ .../libdruntime/core/sys/openbsd/stdlib.d | 17 + .../libdruntime/core/sys/openbsd/sys/sysctl.d | 254 +++++++++++++ libphobos/libdruntime/core/sys/posix/locale.d | 335 +++++++++++++++--- libphobos/libdruntime/core/sys/posix/mqueue.d | 6 +- .../libdruntime/core/sys/posix/pthread.d | 3 +- .../libdruntime/core/sys/posix/sys/statvfs.d | 101 ------ .../libdruntime/core/sys/posix/sys/types.d | 9 +- .../libdruntime/core/sys/solaris/stdlib.d | 17 + libphobos/src/MERGE | 2 +- libphobos/src/std/conv.d | 2 - libphobos/src/std/datetime/systime.d | 110 ++++-- libphobos/src/std/datetime/timezone.d | 17 +- libphobos/src/std/exception.d | 5 +- .../allocator/building_blocks/region.d | 44 ++- .../experimental/allocator/mmap_allocator.d | 17 + libphobos/src/std/file.d | 88 ++++- libphobos/src/std/math.d | 33 +- libphobos/src/std/parallelism.d | 233 +++++++----- libphobos/src/std/socket.d | 4 +- libphobos/src/std/stdio.d | 9 +- libphobos/src/std/system.d | 6 + 35 files changed, 2172 insertions(+), 412 deletions(-) create mode 100644 libphobos/libdruntime/core/internal/attributes.d create mode 100644 libphobos/libdruntime/core/sys/bionic/stdlib.d create mode 100644 libphobos/libdruntime/core/sys/darwin/stdlib.d create mode 100644 libphobos/libdruntime/core/sys/darwin/sys/sysctl.d create mode 100644 libphobos/libdruntime/core/sys/dragonflybsd/stdlib.d create mode 100644 libphobos/libdruntime/core/sys/dragonflybsd/sys/sysctl.d create mode 100644 libphobos/libdruntime/core/sys/freebsd/stdlib.d create mode 100644 libphobos/libdruntime/core/sys/freebsd/sys/sysctl.d create mode 100644 libphobos/libdruntime/core/sys/netbsd/stdlib.d create mode 100644 libphobos/libdruntime/core/sys/netbsd/sys/sysctl.d create mode 100644 libphobos/libdruntime/core/sys/openbsd/stdlib.d create mode 100644 libphobos/libdruntime/core/sys/openbsd/sys/sysctl.d create mode 100644 libphobos/libdruntime/core/sys/solaris/stdlib.d diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE index 4654e58e2d9..3485bde1200 100644 --- a/libphobos/libdruntime/MERGE +++ b/libphobos/libdruntime/MERGE @@ -1,4 +1,4 @@ -e4aae28e36c118f13e346a61af6c413aadd8e838 +9d0c8364450064d0b6e68da4384f8acd19eb454f The first line of this file holds the git revision number of the last merge done from the dlang/druntime repository. diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am index 57de872862b..df2c06c3dab 100644 --- a/libphobos/libdruntime/Makefile.am +++ b/libphobos/libdruntime/Makefile.am @@ -166,7 +166,8 @@ DRUNTIME_CSOURCES = core/stdc/errno_.c DRUNTIME_DSOURCES = core/atomic.d core/attribute.d core/bitop.d \ core/checkedint.d core/cpuid.d core/demangle.d core/exception.d \ - core/internal/abort.d core/internal/arrayop.d core/internal/convert.d \ + core/internal/abort.d core/internal/arrayop.d \ + core/internal/attributes.d core/internal/convert.d \ core/internal/hash.d core/internal/spinlock.d core/internal/string.d \ core/internal/traits.d core/math.d core/memory.d core/runtime.d \ core/simd.d core/stdc/assert_.d core/stdc/complex.d core/stdc/config.d \ @@ -201,8 +202,8 @@ DRUNTIME_DSOURCES_STDCXX = core/stdcpp/exception.d \ core/stdcpp/typeinfo.d DRUNTIME_DSOURCES_BIONIC = core/sys/bionic/err.d \ - core/sys/bionic/fcntl.d core/sys/bionic/string.d \ - core/sys/bionic/unistd.d + core/sys/bionic/fcntl.d core/sys/bionic/stdlib.d \ + core/sys/bionic/string.d core/sys/bionic/unistd.d DRUNTIME_DSOURCES_DARWIN = core/sys/darwin/crt_externs.d \ core/sys/darwin/dlfcn.d core/sys/darwin/err.d \ @@ -212,32 +213,35 @@ DRUNTIME_DSOURCES_DARWIN = core/sys/darwin/crt_externs.d \ core/sys/darwin/mach/nlist.d core/sys/darwin/mach/port.d \ core/sys/darwin/mach/semaphore.d core/sys/darwin/mach/stab.d \ core/sys/darwin/mach/thread_act.d core/sys/darwin/netinet/in_.d \ - core/sys/darwin/pthread.d core/sys/darwin/string.d \ - core/sys/darwin/sys/attr.d core/sys/darwin/sys/cdefs.d \ - core/sys/darwin/sys/event.d core/sys/darwin/sys/mman.d + core/sys/darwin/pthread.d core/sys/darwin/stdlib.d \ + core/sys/darwin/string.d core/sys/darwin/sys/attr.d \ + core/sys/darwin/sys/cdefs.d core/sys/darwin/sys/event.d \ + core/sys/darwin/sys/mman.d core/sys/darwin/sys/sysctl.d DRUNTIME_DSOURCES_DRAGONFLYBSD = core/sys/dragonflybsd/dlfcn.d \ core/sys/dragonflybsd/err.d core/sys/dragonflybsd/execinfo.d \ core/sys/dragonflybsd/netinet/in_.d core/sys/dragonflybsd/pthread_np.d \ - core/sys/dragonflybsd/string.d core/sys/dragonflybsd/sys/_bitset.d \ + core/sys/dragonflybsd/stdlib.d core/sys/dragonflybsd/string.d \ + core/sys/dragonflybsd/sys/_bitset.d \ core/sys/dragonflybsd/sys/_cpuset.d core/sys/dragonflybsd/sys/cdefs.d \ core/sys/dragonflybsd/sys/elf.d core/sys/dragonflybsd/sys/elf32.d \ core/sys/dragonflybsd/sys/elf64.d \ core/sys/dragonflybsd/sys/elf_common.d \ core/sys/dragonflybsd/sys/event.d core/sys/dragonflybsd/sys/link_elf.d \ core/sys/dragonflybsd/sys/mman.d core/sys/dragonflybsd/sys/socket.d \ - core/sys/dragonflybsd/time.d + core/sys/dragonflybsd/sys/sysctl.d core/sys/dragonflybsd/time.d DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \ core/sys/freebsd/dlfcn.d core/sys/freebsd/err.d \ core/sys/freebsd/execinfo.d core/sys/freebsd/netinet/in_.d \ - core/sys/freebsd/pthread_np.d core/sys/freebsd/string.d \ - core/sys/freebsd/sys/_bitset.d core/sys/freebsd/sys/_cpuset.d \ - core/sys/freebsd/sys/cdefs.d core/sys/freebsd/sys/elf.d \ - core/sys/freebsd/sys/elf32.d core/sys/freebsd/sys/elf64.d \ - core/sys/freebsd/sys/elf_common.d core/sys/freebsd/sys/event.d \ - core/sys/freebsd/sys/link_elf.d core/sys/freebsd/sys/mman.d \ - core/sys/freebsd/sys/mount.d core/sys/freebsd/time.d \ + core/sys/freebsd/pthread_np.d core/sys/freebsd/stdlib.d \ + core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \ + core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \ + core/sys/freebsd/sys/elf.d core/sys/freebsd/sys/elf32.d \ + core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \ + core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \ + core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \ + core/sys/freebsd/sys/sysctl.d core/sys/freebsd/time.d \ core/sys/freebsd/unistd.d DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ @@ -257,18 +261,20 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \ core/sys/netbsd/err.d core/sys/netbsd/execinfo.d \ - core/sys/netbsd/string.d core/sys/netbsd/sys/elf.d \ - core/sys/netbsd/sys/elf32.d core/sys/netbsd/sys/elf64.d \ - core/sys/netbsd/sys/elf_common.d core/sys/netbsd/sys/event.d \ - core/sys/netbsd/sys/featuretest.d core/sys/netbsd/sys/link_elf.d \ - core/sys/netbsd/sys/mman.d core/sys/netbsd/time.d + core/sys/netbsd/stdlib.d core/sys/netbsd/string.d \ + core/sys/netbsd/sys/elf.d core/sys/netbsd/sys/elf32.d \ + core/sys/netbsd/sys/elf64.d core/sys/netbsd/sys/elf_common.d \ + core/sys/netbsd/sys/event.d core/sys/netbsd/sys/featuretest.d \ + core/sys/netbsd/sys/link_elf.d core/sys/netbsd/sys/mman.d \ + core/sys/netbsd/sys/sysctl.d core/sys/netbsd/time.d DRUNTIME_DSOURCES_OPENBSD = core/sys/openbsd/dlfcn.d \ - core/sys/openbsd/err.d core/sys/openbsd/string.d \ - core/sys/openbsd/sys/cdefs.d core/sys/openbsd/sys/elf.d \ - core/sys/openbsd/sys/elf32.d core/sys/openbsd/sys/elf64.d \ - core/sys/openbsd/sys/elf_common.d core/sys/openbsd/sys/link_elf.d \ - core/sys/openbsd/sys/mman.d core/sys/openbsd/time.d + core/sys/openbsd/err.d core/sys/openbsd/stdlib.d \ + core/sys/openbsd/string.d core/sys/openbsd/sys/cdefs.d \ + core/sys/openbsd/sys/elf.d core/sys/openbsd/sys/elf32.d \ + core/sys/openbsd/sys/elf64.d core/sys/openbsd/sys/elf_common.d \ + core/sys/openbsd/sys/link_elf.d core/sys/openbsd/sys/mman.d \ + core/sys/openbsd/sys/sysctl.d core/sys/openbsd/time.d DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \ core/sys/posix/arpa/inet.d core/sys/posix/config.d \ @@ -300,12 +306,13 @@ DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \ DRUNTIME_DSOURCES_SOLARIS = core/sys/solaris/dlfcn.d \ core/sys/solaris/elf.d core/sys/solaris/err.d \ core/sys/solaris/execinfo.d core/sys/solaris/libelf.d \ - core/sys/solaris/link.d core/sys/solaris/sys/elf.d \ - core/sys/solaris/sys/elf_386.d core/sys/solaris/sys/elf_SPARC.d \ - core/sys/solaris/sys/elf_amd64.d core/sys/solaris/sys/elf_notes.d \ - core/sys/solaris/sys/elftypes.d core/sys/solaris/sys/link.d \ - core/sys/solaris/sys/priocntl.d core/sys/solaris/sys/procset.d \ - core/sys/solaris/sys/types.d core/sys/solaris/time.d + core/sys/solaris/link.d core/sys/solaris/stdlib.d \ + core/sys/solaris/sys/elf.d core/sys/solaris/sys/elf_386.d \ + core/sys/solaris/sys/elf_SPARC.d core/sys/solaris/sys/elf_amd64.d \ + core/sys/solaris/sys/elf_notes.d core/sys/solaris/sys/elftypes.d \ + core/sys/solaris/sys/link.d core/sys/solaris/sys/priocntl.d \ + core/sys/solaris/sys/procset.d core/sys/solaris/sys/types.d \ + core/sys/solaris/time.d DRUNTIME_DSOURCES_WINDOWS = core/sys/windows/accctrl.d \ core/sys/windows/aclapi.d core/sys/windows/aclui.d \ diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in index e1b0a851b67..aadc6f3ede0 100644 --- a/libphobos/libdruntime/Makefile.in +++ b/libphobos/libdruntime/Makefile.in @@ -188,31 +188,32 @@ am__dirstamp = $(am__leading_dot)dirstamp am__objects_1 = core/atomic.lo core/attribute.lo core/bitop.lo \ core/checkedint.lo core/cpuid.lo core/demangle.lo \ core/exception.lo core/internal/abort.lo \ - core/internal/arrayop.lo core/internal/convert.lo \ - core/internal/hash.lo core/internal/spinlock.lo \ - core/internal/string.lo core/internal/traits.lo core/math.lo \ - core/memory.lo core/runtime.lo core/simd.lo \ - core/stdc/assert_.lo core/stdc/complex.lo core/stdc/config.lo \ - core/stdc/ctype.lo core/stdc/errno.lo core/stdc/fenv.lo \ - core/stdc/float_.lo core/stdc/inttypes.lo core/stdc/limits.lo \ - core/stdc/locale.lo core/stdc/math.lo core/stdc/signal.lo \ - core/stdc/stdarg.lo core/stdc/stddef.lo core/stdc/stdint.lo \ - core/stdc/stdio.lo core/stdc/stdlib.lo core/stdc/string.lo \ - core/stdc/tgmath.lo core/stdc/time.lo core/stdc/wchar_.lo \ - core/stdc/wctype.lo core/sync/barrier.lo \ - core/sync/condition.lo core/sync/config.lo \ - core/sync/exception.lo core/sync/mutex.lo core/sync/rwmutex.lo \ - core/sync/semaphore.lo core/thread/context.lo \ - core/thread/fiber.lo core/thread/osthread.lo \ - core/thread/package.lo core/thread/threadbase.lo \ - core/thread/threadgroup.lo core/thread/types.lo core/time.lo \ - core/vararg.lo gc/bits.lo gc/config.lo gc/gcinterface.lo \ - gc/impl/conservative/gc.lo gc/impl/manual/gc.lo gc/os.lo \ - gc/pooltable.lo gc/proxy.lo gcc/attribute.lo gcc/backtrace.lo \ - gcc/builtins.lo gcc/deh.lo gcc/emutls.lo gcc/gthread.lo \ - gcc/sections/android.lo gcc/sections/elf_shared.lo \ - gcc/sections/osx.lo gcc/sections/package.lo \ - gcc/sections/win32.lo gcc/sections/win64.lo gcc/unwind/arm.lo \ + core/internal/arrayop.lo core/internal/attributes.lo \ + core/internal/convert.lo core/internal/hash.lo \ + core/internal/spinlock.lo core/internal/string.lo \ + core/internal/traits.lo core/math.lo core/memory.lo \ + core/runtime.lo core/simd.lo core/stdc/assert_.lo \ + core/stdc/complex.lo core/stdc/config.lo core/stdc/ctype.lo \ + core/stdc/errno.lo core/stdc/fenv.lo core/stdc/float_.lo \ + core/stdc/inttypes.lo core/stdc/limits.lo core/stdc/locale.lo \ + core/stdc/math.lo core/stdc/signal.lo core/stdc/stdarg.lo \ + core/stdc/stddef.lo core/stdc/stdint.lo core/stdc/stdio.lo \ + core/stdc/stdlib.lo core/stdc/string.lo core/stdc/tgmath.lo \ + core/stdc/time.lo core/stdc/wchar_.lo core/stdc/wctype.lo \ + core/sync/barrier.lo core/sync/condition.lo \ + core/sync/config.lo core/sync/exception.lo core/sync/mutex.lo \ + core/sync/rwmutex.lo core/sync/semaphore.lo \ + core/thread/context.lo core/thread/fiber.lo \ + core/thread/osthread.lo core/thread/package.lo \ + core/thread/threadbase.lo core/thread/threadgroup.lo \ + core/thread/types.lo core/time.lo core/vararg.lo gc/bits.lo \ + gc/config.lo gc/gcinterface.lo gc/impl/conservative/gc.lo \ + gc/impl/manual/gc.lo gc/os.lo gc/pooltable.lo gc/proxy.lo \ + gcc/attribute.lo gcc/backtrace.lo gcc/builtins.lo gcc/deh.lo \ + gcc/emutls.lo gcc/gthread.lo gcc/sections/android.lo \ + gcc/sections/elf_shared.lo gcc/sections/osx.lo \ + gcc/sections/package.lo gcc/sections/win32.lo \ + gcc/sections/win64.lo gcc/unwind/arm.lo \ gcc/unwind/arm_common.lo gcc/unwind/c6x.lo \ gcc/unwind/generic.lo gcc/unwind/package.lo gcc/unwind/pe.lo \ object.lo rt/aApply.lo rt/aApplyR.lo rt/aaA.lo rt/adi.lo \ @@ -263,14 +264,16 @@ am__objects_5 = core/sys/darwin/crt_externs.lo \ core/sys/darwin/mach/stab.lo \ core/sys/darwin/mach/thread_act.lo \ core/sys/darwin/netinet/in_.lo core/sys/darwin/pthread.lo \ - core/sys/darwin/string.lo core/sys/darwin/sys/attr.lo \ - core/sys/darwin/sys/cdefs.lo core/sys/darwin/sys/event.lo \ - core/sys/darwin/sys/mman.lo + core/sys/darwin/stdlib.lo core/sys/darwin/string.lo \ + core/sys/darwin/sys/attr.lo core/sys/darwin/sys/cdefs.lo \ + core/sys/darwin/sys/event.lo core/sys/darwin/sys/mman.lo \ + core/sys/darwin/sys/sysctl.lo @DRUNTIME_OS_DARWIN_TRUE@am__objects_6 = $(am__objects_5) am__objects_7 = core/sys/dragonflybsd/dlfcn.lo \ core/sys/dragonflybsd/err.lo core/sys/dragonflybsd/execinfo.lo \ core/sys/dragonflybsd/netinet/in_.lo \ core/sys/dragonflybsd/pthread_np.lo \ + core/sys/dragonflybsd/stdlib.lo \ core/sys/dragonflybsd/string.lo \ core/sys/dragonflybsd/sys/_bitset.lo \ core/sys/dragonflybsd/sys/_cpuset.lo \ @@ -283,39 +286,43 @@ am__objects_7 = core/sys/dragonflybsd/dlfcn.lo \ core/sys/dragonflybsd/sys/link_elf.lo \ core/sys/dragonflybsd/sys/mman.lo \ core/sys/dragonflybsd/sys/socket.lo \ + core/sys/dragonflybsd/sys/sysctl.lo \ core/sys/dragonflybsd/time.lo @DRUNTIME_OS_DRAGONFLYBSD_TRUE@am__objects_8 = $(am__objects_7) am__objects_9 = core/sys/bionic/err.lo core/sys/bionic/fcntl.lo \ - core/sys/bionic/string.lo core/sys/bionic/unistd.lo + core/sys/bionic/stdlib.lo core/sys/bionic/string.lo \ + core/sys/bionic/unistd.lo @DRUNTIME_OS_ANDROID_TRUE@am__objects_10 = $(am__objects_9) am__objects_11 = core/sys/freebsd/config.lo core/sys/freebsd/dlfcn.lo \ core/sys/freebsd/err.lo core/sys/freebsd/execinfo.lo \ core/sys/freebsd/netinet/in_.lo core/sys/freebsd/pthread_np.lo \ - core/sys/freebsd/string.lo core/sys/freebsd/sys/_bitset.lo \ + core/sys/freebsd/stdlib.lo core/sys/freebsd/string.lo \ + core/sys/freebsd/sys/_bitset.lo \ core/sys/freebsd/sys/_cpuset.lo core/sys/freebsd/sys/cdefs.lo \ core/sys/freebsd/sys/elf.lo core/sys/freebsd/sys/elf32.lo \ core/sys/freebsd/sys/elf64.lo \ core/sys/freebsd/sys/elf_common.lo \ core/sys/freebsd/sys/event.lo core/sys/freebsd/sys/link_elf.lo \ core/sys/freebsd/sys/mman.lo core/sys/freebsd/sys/mount.lo \ - core/sys/freebsd/time.lo core/sys/freebsd/unistd.lo + core/sys/freebsd/sys/sysctl.lo core/sys/freebsd/time.lo \ + core/sys/freebsd/unistd.lo @DRUNTIME_OS_FREEBSD_TRUE@am__objects_12 = $(am__objects_11) am__objects_13 = core/sys/netbsd/dlfcn.lo core/sys/netbsd/err.lo \ - core/sys/netbsd/execinfo.lo core/sys/netbsd/string.lo \ - core/sys/netbsd/sys/elf.lo core/sys/netbsd/sys/elf32.lo \ - core/sys/netbsd/sys/elf64.lo core/sys/netbsd/sys/elf_common.lo \ - core/sys/netbsd/sys/event.lo \ + core/sys/netbsd/execinfo.lo core/sys/netbsd/stdlib.lo \ + core/sys/netbsd/string.lo core/sys/netbsd/sys/elf.lo \ + core/sys/netbsd/sys/elf32.lo core/sys/netbsd/sys/elf64.lo \ + core/sys/netbsd/sys/elf_common.lo core/sys/netbsd/sys/event.lo \ core/sys/netbsd/sys/featuretest.lo \ core/sys/netbsd/sys/link_elf.lo core/sys/netbsd/sys/mman.lo \ - core/sys/netbsd/time.lo + core/sys/netbsd/sys/sysctl.lo core/sys/netbsd/time.lo @DRUNTIME_OS_NETBSD_TRUE@am__objects_14 = $(am__objects_13) am__objects_15 = core/sys/openbsd/dlfcn.lo core/sys/openbsd/err.lo \ - core/sys/openbsd/string.lo core/sys/openbsd/sys/cdefs.lo \ - core/sys/openbsd/sys/elf.lo core/sys/openbsd/sys/elf32.lo \ - core/sys/openbsd/sys/elf64.lo \ + core/sys/openbsd/stdlib.lo core/sys/openbsd/string.lo \ + core/sys/openbsd/sys/cdefs.lo core/sys/openbsd/sys/elf.lo \ + core/sys/openbsd/sys/elf32.lo core/sys/openbsd/sys/elf64.lo \ core/sys/openbsd/sys/elf_common.lo \ core/sys/openbsd/sys/link_elf.lo core/sys/openbsd/sys/mman.lo \ - core/sys/openbsd/time.lo + core/sys/openbsd/sys/sysctl.lo core/sys/openbsd/time.lo @DRUNTIME_OS_OPENBSD_TRUE@am__objects_16 = $(am__objects_15) am__objects_17 = core/sys/linux/config.lo core/sys/linux/dlfcn.lo \ core/sys/linux/elf.lo core/sys/linux/epoll.lo \ @@ -422,7 +429,8 @@ am__objects_19 = core/sys/windows/accctrl.lo \ am__objects_21 = core/sys/solaris/dlfcn.lo core/sys/solaris/elf.lo \ core/sys/solaris/err.lo core/sys/solaris/execinfo.lo \ core/sys/solaris/libelf.lo core/sys/solaris/link.lo \ - core/sys/solaris/sys/elf.lo core/sys/solaris/sys/elf_386.lo \ + core/sys/solaris/stdlib.lo core/sys/solaris/sys/elf.lo \ + core/sys/solaris/sys/elf_386.lo \ core/sys/solaris/sys/elf_SPARC.lo \ core/sys/solaris/sys/elf_amd64.lo \ core/sys/solaris/sys/elf_notes.lo \ @@ -784,7 +792,8 @@ libgdruntime_convenience_la_LINK = $(libgdruntime_la_LINK) DRUNTIME_CSOURCES = core/stdc/errno_.c DRUNTIME_DSOURCES = core/atomic.d core/attribute.d core/bitop.d \ core/checkedint.d core/cpuid.d core/demangle.d core/exception.d \ - core/internal/abort.d core/internal/arrayop.d core/internal/convert.d \ + core/internal/abort.d core/internal/arrayop.d \ + core/internal/attributes.d core/internal/convert.d \ core/internal/hash.d core/internal/spinlock.d core/internal/string.d \ core/internal/traits.d core/math.d core/memory.d core/runtime.d \ core/simd.d core/stdc/assert_.d core/stdc/complex.d core/stdc/config.d \ @@ -819,8 +828,8 @@ DRUNTIME_DSOURCES_STDCXX = core/stdcpp/exception.d \ core/stdcpp/typeinfo.d DRUNTIME_DSOURCES_BIONIC = core/sys/bionic/err.d \ - core/sys/bionic/fcntl.d core/sys/bionic/string.d \ - core/sys/bionic/unistd.d + core/sys/bionic/fcntl.d core/sys/bionic/stdlib.d \ + core/sys/bionic/string.d core/sys/bionic/unistd.d DRUNTIME_DSOURCES_DARWIN = core/sys/darwin/crt_externs.d \ core/sys/darwin/dlfcn.d core/sys/darwin/err.d \ @@ -830,32 +839,35 @@ DRUNTIME_DSOURCES_DARWIN = core/sys/darwin/crt_externs.d \ core/sys/darwin/mach/nlist.d core/sys/darwin/mach/port.d \ core/sys/darwin/mach/semaphore.d core/sys/darwin/mach/stab.d \ core/sys/darwin/mach/thread_act.d core/sys/darwin/netinet/in_.d \ - core/sys/darwin/pthread.d core/sys/darwin/string.d \ - core/sys/darwin/sys/attr.d core/sys/darwin/sys/cdefs.d \ - core/sys/darwin/sys/event.d core/sys/darwin/sys/mman.d + core/sys/darwin/pthread.d core/sys/darwin/stdlib.d \ + core/sys/darwin/string.d core/sys/darwin/sys/attr.d \ + core/sys/darwin/sys/cdefs.d core/sys/darwin/sys/event.d \ + core/sys/darwin/sys/mman.d core/sys/darwin/sys/sysctl.d DRUNTIME_DSOURCES_DRAGONFLYBSD = core/sys/dragonflybsd/dlfcn.d \ core/sys/dragonflybsd/err.d core/sys/dragonflybsd/execinfo.d \ core/sys/dragonflybsd/netinet/in_.d core/sys/dragonflybsd/pthread_np.d \ - core/sys/dragonflybsd/string.d core/sys/dragonflybsd/sys/_bitset.d \ + core/sys/dragonflybsd/stdlib.d core/sys/dragonflybsd/string.d \ + core/sys/dragonflybsd/sys/_bitset.d \ core/sys/dragonflybsd/sys/_cpuset.d core/sys/dragonflybsd/sys/cdefs.d \ core/sys/dragonflybsd/sys/elf.d core/sys/dragonflybsd/sys/elf32.d \ core/sys/dragonflybsd/sys/elf64.d \ core/sys/dragonflybsd/sys/elf_common.d \ core/sys/dragonflybsd/sys/event.d core/sys/dragonflybsd/sys/link_elf.d \ core/sys/dragonflybsd/sys/mman.d core/sys/dragonflybsd/sys/socket.d \ - core/sys/dragonflybsd/time.d + core/sys/dragonflybsd/sys/sysctl.d core/sys/dragonflybsd/time.d DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \ core/sys/freebsd/dlfcn.d core/sys/freebsd/err.d \ core/sys/freebsd/execinfo.d core/sys/freebsd/netinet/in_.d \ - core/sys/freebsd/pthread_np.d core/sys/freebsd/string.d \ - core/sys/freebsd/sys/_bitset.d core/sys/freebsd/sys/_cpuset.d \ - core/sys/freebsd/sys/cdefs.d core/sys/freebsd/sys/elf.d \ - core/sys/freebsd/sys/elf32.d core/sys/freebsd/sys/elf64.d \ - core/sys/freebsd/sys/elf_common.d core/sys/freebsd/sys/event.d \ - core/sys/freebsd/sys/link_elf.d core/sys/freebsd/sys/mman.d \ - core/sys/freebsd/sys/mount.d core/sys/freebsd/time.d \ + core/sys/freebsd/pthread_np.d core/sys/freebsd/stdlib.d \ + core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \ + core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \ + core/sys/freebsd/sys/elf.d core/sys/freebsd/sys/elf32.d \ + core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \ + core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \ + core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \ + core/sys/freebsd/sys/sysctl.d core/sys/freebsd/time.d \ core/sys/freebsd/unistd.d DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ @@ -875,18 +887,20 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \ core/sys/netbsd/err.d core/sys/netbsd/execinfo.d \ - core/sys/netbsd/string.d core/sys/netbsd/sys/elf.d \ - core/sys/netbsd/sys/elf32.d core/sys/netbsd/sys/elf64.d \ - core/sys/netbsd/sys/elf_common.d core/sys/netbsd/sys/event.d \ - core/sys/netbsd/sys/featuretest.d core/sys/netbsd/sys/link_elf.d \ - core/sys/netbsd/sys/mman.d core/sys/netbsd/time.d + core/sys/netbsd/stdlib.d core/sys/netbsd/string.d \ + core/sys/netbsd/sys/elf.d core/sys/netbsd/sys/elf32.d \ + core/sys/netbsd/sys/elf64.d core/sys/netbsd/sys/elf_common.d \ + core/sys/netbsd/sys/event.d core/sys/netbsd/sys/featuretest.d \ + core/sys/netbsd/sys/link_elf.d core/sys/netbsd/sys/mman.d \ + core/sys/netbsd/sys/sysctl.d core/sys/netbsd/time.d DRUNTIME_DSOURCES_OPENBSD = core/sys/openbsd/dlfcn.d \ - core/sys/openbsd/err.d core/sys/openbsd/string.d \ - core/sys/openbsd/sys/cdefs.d core/sys/openbsd/sys/elf.d \ - core/sys/openbsd/sys/elf32.d core/sys/openbsd/sys/elf64.d \ - core/sys/openbsd/sys/elf_common.d core/sys/openbsd/sys/link_elf.d \ - core/sys/openbsd/sys/mman.d core/sys/openbsd/time.d + core/sys/openbsd/err.d core/sys/openbsd/stdlib.d \ + core/sys/openbsd/string.d core/sys/openbsd/sys/cdefs.d \ + core/sys/openbsd/sys/elf.d core/sys/openbsd/sys/elf32.d \ + core/sys/openbsd/sys/elf64.d core/sys/openbsd/sys/elf_common.d \ + core/sys/openbsd/sys/link_elf.d core/sys/openbsd/sys/mman.d \ + core/sys/openbsd/sys/sysctl.d core/sys/openbsd/time.d DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \ core/sys/posix/arpa/inet.d core/sys/posix/config.d \ @@ -918,12 +932,13 @@ DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \ DRUNTIME_DSOURCES_SOLARIS = core/sys/solaris/dlfcn.d \ core/sys/solaris/elf.d core/sys/solaris/err.d \ core/sys/solaris/execinfo.d core/sys/solaris/libelf.d \ - core/sys/solaris/link.d core/sys/solaris/sys/elf.d \ - core/sys/solaris/sys/elf_386.d core/sys/solaris/sys/elf_SPARC.d \ - core/sys/solaris/sys/elf_amd64.d core/sys/solaris/sys/elf_notes.d \ - core/sys/solaris/sys/elftypes.d core/sys/solaris/sys/link.d \ - core/sys/solaris/sys/priocntl.d core/sys/solaris/sys/procset.d \ - core/sys/solaris/sys/types.d core/sys/solaris/time.d + core/sys/solaris/link.d core/sys/solaris/stdlib.d \ + core/sys/solaris/sys/elf.d core/sys/solaris/sys/elf_386.d \ + core/sys/solaris/sys/elf_SPARC.d core/sys/solaris/sys/elf_amd64.d \ + core/sys/solaris/sys/elf_notes.d core/sys/solaris/sys/elftypes.d \ + core/sys/solaris/sys/link.d core/sys/solaris/sys/priocntl.d \ + core/sys/solaris/sys/procset.d core/sys/solaris/sys/types.d \ + core/sys/solaris/time.d DRUNTIME_DSOURCES_WINDOWS = core/sys/windows/accctrl.d \ core/sys/windows/aclapi.d core/sys/windows/aclui.d \ @@ -1106,6 +1121,7 @@ core/internal/$(am__dirstamp): @: > core/internal/$(am__dirstamp) core/internal/abort.lo: core/internal/$(am__dirstamp) core/internal/arrayop.lo: core/internal/$(am__dirstamp) +core/internal/attributes.lo: core/internal/$(am__dirstamp) core/internal/convert.lo: core/internal/$(am__dirstamp) core/internal/hash.lo: core/internal/$(am__dirstamp) core/internal/spinlock.lo: core/internal/$(am__dirstamp) @@ -1347,6 +1363,7 @@ core/sys/darwin/netinet/$(am__dirstamp): core/sys/darwin/netinet/in_.lo: \ core/sys/darwin/netinet/$(am__dirstamp) core/sys/darwin/pthread.lo: core/sys/darwin/$(am__dirstamp) +core/sys/darwin/stdlib.lo: core/sys/darwin/$(am__dirstamp) core/sys/darwin/string.lo: core/sys/darwin/$(am__dirstamp) core/sys/darwin/sys/$(am__dirstamp): @$(MKDIR_P) core/sys/darwin/sys @@ -1355,6 +1372,7 @@ core/sys/darwin/sys/attr.lo: core/sys/darwin/sys/$(am__dirstamp) core/sys/darwin/sys/cdefs.lo: core/sys/darwin/sys/$(am__dirstamp) core/sys/darwin/sys/event.lo: core/sys/darwin/sys/$(am__dirstamp) core/sys/darwin/sys/mman.lo: core/sys/darwin/sys/$(am__dirstamp) +core/sys/darwin/sys/sysctl.lo: core/sys/darwin/sys/$(am__dirstamp) core/sys/dragonflybsd/$(am__dirstamp): @$(MKDIR_P) core/sys/dragonflybsd @: > core/sys/dragonflybsd/$(am__dirstamp) @@ -1369,6 +1387,8 @@ core/sys/dragonflybsd/netinet/in_.lo: \ core/sys/dragonflybsd/netinet/$(am__dirstamp) core/sys/dragonflybsd/pthread_np.lo: \ core/sys/dragonflybsd/$(am__dirstamp) +core/sys/dragonflybsd/stdlib.lo: \ + core/sys/dragonflybsd/$(am__dirstamp) core/sys/dragonflybsd/string.lo: \ core/sys/dragonflybsd/$(am__dirstamp) core/sys/dragonflybsd/sys/$(am__dirstamp): @@ -1396,12 +1416,15 @@ core/sys/dragonflybsd/sys/mman.lo: \ core/sys/dragonflybsd/sys/$(am__dirstamp) core/sys/dragonflybsd/sys/socket.lo: \ core/sys/dragonflybsd/sys/$(am__dirstamp) +core/sys/dragonflybsd/sys/sysctl.lo: \ + core/sys/dragonflybsd/sys/$(am__dirstamp) core/sys/dragonflybsd/time.lo: core/sys/dragonflybsd/$(am__dirstamp) core/sys/bionic/$(am__dirstamp): @$(MKDIR_P) core/sys/bionic @: > core/sys/bionic/$(am__dirstamp) core/sys/bionic/err.lo: core/sys/bionic/$(am__dirstamp) core/sys/bionic/fcntl.lo: core/sys/bionic/$(am__dirstamp) +core/sys/bionic/stdlib.lo: core/sys/bionic/$(am__dirstamp) core/sys/bionic/string.lo: core/sys/bionic/$(am__dirstamp) core/sys/bionic/unistd.lo: core/sys/bionic/$(am__dirstamp) core/sys/freebsd/$(am__dirstamp): @@ -1417,6 +1440,7 @@ core/sys/freebsd/netinet/$(am__dirstamp): core/sys/freebsd/netinet/in_.lo: \ core/sys/freebsd/netinet/$(am__dirstamp) core/sys/freebsd/pthread_np.lo: core/sys/freebsd/$(am__dirstamp) +core/sys/freebsd/stdlib.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/string.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/sys/$(am__dirstamp): @$(MKDIR_P) core/sys/freebsd/sys @@ -1434,6 +1458,7 @@ core/sys/freebsd/sys/link_elf.lo: \ core/sys/freebsd/sys/$(am__dirstamp) core/sys/freebsd/sys/mman.lo: core/sys/freebsd/sys/$(am__dirstamp) core/sys/freebsd/sys/mount.lo: core/sys/freebsd/sys/$(am__dirstamp) +core/sys/freebsd/sys/sysctl.lo: core/sys/freebsd/sys/$(am__dirstamp) core/sys/freebsd/time.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/unistd.lo: core/sys/freebsd/$(am__dirstamp) core/sys/netbsd/$(am__dirstamp): @@ -1442,6 +1467,7 @@ core/sys/netbsd/$(am__dirstamp): core/sys/netbsd/dlfcn.lo: core/sys/netbsd/$(am__dirstamp) core/sys/netbsd/err.lo: core/sys/netbsd/$(am__dirstamp) core/sys/netbsd/execinfo.lo: core/sys/netbsd/$(am__dirstamp) +core/sys/netbsd/stdlib.lo: core/sys/netbsd/$(am__dirstamp) core/sys/netbsd/string.lo: core/sys/netbsd/$(am__dirstamp) core/sys/netbsd/sys/$(am__dirstamp): @$(MKDIR_P) core/sys/netbsd/sys @@ -1456,12 +1482,14 @@ core/sys/netbsd/sys/featuretest.lo: \ core/sys/netbsd/sys/$(am__dirstamp) core/sys/netbsd/sys/link_elf.lo: core/sys/netbsd/sys/$(am__dirstamp) core/sys/netbsd/sys/mman.lo: core/sys/netbsd/sys/$(am__dirstamp) +core/sys/netbsd/sys/sysctl.lo: core/sys/netbsd/sys/$(am__dirstamp) core/sys/netbsd/time.lo: core/sys/netbsd/$(am__dirstamp) core/sys/openbsd/$(am__dirstamp): @$(MKDIR_P) core/sys/openbsd @: > core/sys/openbsd/$(am__dirstamp) core/sys/openbsd/dlfcn.lo: core/sys/openbsd/$(am__dirstamp) core/sys/openbsd/err.lo: core/sys/openbsd/$(am__dirstamp) +core/sys/openbsd/stdlib.lo: core/sys/openbsd/$(am__dirstamp) core/sys/openbsd/string.lo: core/sys/openbsd/$(am__dirstamp) core/sys/openbsd/sys/$(am__dirstamp): @$(MKDIR_P) core/sys/openbsd/sys @@ -1475,6 +1503,7 @@ core/sys/openbsd/sys/elf_common.lo: \ core/sys/openbsd/sys/link_elf.lo: \ core/sys/openbsd/sys/$(am__dirstamp) core/sys/openbsd/sys/mman.lo: core/sys/openbsd/sys/$(am__dirstamp) +core/sys/openbsd/sys/sysctl.lo: core/sys/openbsd/sys/$(am__dirstamp) core/sys/openbsd/time.lo: core/sys/openbsd/$(am__dirstamp) core/sys/linux/$(am__dirstamp): @$(MKDIR_P) core/sys/linux @@ -1698,6 +1727,7 @@ core/sys/solaris/err.lo: core/sys/solaris/$(am__dirstamp) core/sys/solaris/execinfo.lo: core/sys/solaris/$(am__dirstamp) core/sys/solaris/libelf.lo: core/sys/solaris/$(am__dirstamp) core/sys/solaris/link.lo: core/sys/solaris/$(am__dirstamp) +core/sys/solaris/stdlib.lo: core/sys/solaris/$(am__dirstamp) core/sys/solaris/sys/$(am__dirstamp): @$(MKDIR_P) core/sys/solaris/sys @: > core/sys/solaris/sys/$(am__dirstamp) diff --git a/libphobos/libdruntime/core/internal/attributes.d b/libphobos/libdruntime/core/internal/attributes.d new file mode 100644 index 00000000000..b7253c23e9b --- /dev/null +++ b/libphobos/libdruntime/core/internal/attributes.d @@ -0,0 +1,11 @@ +module core.internal.attributes; + +/** +Used to annotate `unittest`s which need to be tested in a `-betterC` environment. + +Such `unittest`s will be compiled and executed without linking druntime in, with +a `__traits(getUnitTests, mixin(__MODULE__))` style test runner. +Note that just like any other `unittest` in druntime, they will also be compiled +and executed without `-betterC`. +*/ +package(core) enum betterC = 1; diff --git a/libphobos/libdruntime/core/sys/bionic/stdlib.d b/libphobos/libdruntime/core/sys/bionic/stdlib.d new file mode 100644 index 00000000000..46fabe5a0e6 --- /dev/null +++ b/libphobos/libdruntime/core/sys/bionic/stdlib.d @@ -0,0 +1,17 @@ +/** + * D header file for Bionic stdlib.h. + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.bionic.stdlib; +public import core.sys.posix.stdlib; + +version (CRuntime_Bionic): +extern (C): +nothrow: +@nogc: + +const(char)* getprogname(); +void setprogname(scope const char* name); diff --git a/libphobos/libdruntime/core/sys/darwin/mach/dyld.d b/libphobos/libdruntime/core/sys/darwin/mach/dyld.d index 62d1a779262..6e28bfa655b 100644 --- a/libphobos/libdruntime/core/sys/darwin/mach/dyld.d +++ b/libphobos/libdruntime/core/sys/darwin/mach/dyld.d @@ -33,7 +33,10 @@ uint _dyld_image_count(); const(char)* _dyld_get_image_name(uint image_index); mach_header* _dyld_get_image_header(uint image_index); intptr_t _dyld_get_image_vmaddr_slide(uint image_index); + void _dyld_register_func_for_add_image(void function(const scope mach_header* mh, intptr_t vmaddr_slide)); void _dyld_register_func_for_remove_image(void function(const scope mach_header* mh, intptr_t vmaddr_slide)); - +int NSVersionOfRunTimeLibrary(const char* libraryPath); +int NSVersionOfLinkTimeLibrary(const char* libraryPath); +int _NSGetExecutablePath(char* buf, uint* bufsize); diff --git a/libphobos/libdruntime/core/sys/darwin/stdlib.d b/libphobos/libdruntime/core/sys/darwin/stdlib.d new file mode 100644 index 00000000000..287eaa038e4 --- /dev/null +++ b/libphobos/libdruntime/core/sys/darwin/stdlib.d @@ -0,0 +1,26 @@ +/** + * D header file for Darwin stdlib.h. + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.darwin.stdlib; +public import core.sys.posix.stdlib; + +version (OSX) + version = Darwin; +else version (iOS) + version = Darwin; +else version (TVOS) + version = Darwin; +else version (WatchOS) + version = Darwin; + +version (Darwin): +extern (C): +nothrow: +@nogc: + +const(char)* getprogname(); +void setprogname(scope const char* name); diff --git a/libphobos/libdruntime/core/sys/darwin/sys/sysctl.d b/libphobos/libdruntime/core/sys/darwin/sys/sysctl.d new file mode 100644 index 00000000000..6af16cc8f50 --- /dev/null +++ b/libphobos/libdruntime/core/sys/darwin/sys/sysctl.d @@ -0,0 +1,253 @@ +/** + * D header file for Darwin sys/sysctl.h + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.darwin.sys.sysctl; + +version (OSX) + version = Darwin; +else version (iOS) + version = Darwin; +else version (TVOS) + version = Darwin; +else version (WatchOS) + version = Darwin; + +version (Darwin): +extern (C): +nothrow: +@nogc: + +// Top-level identifiers +enum +{ + CTL_UNSPEC = 0, + CTL_KERN = 1, + CTL_VM = 2, + CTL_VFS = 3, + CTL_NET = 4, + CTL_DEBUG = 5, + CTL_HW = 6, + CTL_MACHDEP = 7, + CTL_USER = 8, + CTL_MAXID = 9, +} + +// CTL_KERN identifiers +enum +{ + KERN_OSTYPE = 1, + KERN_OSRELEASE = 2, + KERN_OSREV = 3, + KERN_VERSION = 4, + KERN_MAXVNODES = 5, + KERN_MAXPROC = 6, + KERN_MAXFILES = 7, + KERN_ARGMAX = 8, + KERN_SECURELVL = 9, + KERN_HOSTNAME = 10, + KERN_HOSTID = 11, + KERN_CLOCKRATE = 12, + KERN_VNODE = 13, + KERN_PROC = 14, + KERN_FILE = 15, + KERN_PROF = 16, + KERN_POSIX1 = 17, + KERN_NGROUPS = 18, + KERN_JOB_CONTROL = 19, + KERN_SAVED_IDS = 20, + KERN_BOOTTIME = 21, + KERN_NISDOMAINNAME = 22, + KERN_DOMAINNAME = KERN_NISDOMAINNAME, + KERN_MAXPARTITIONS = 23, + KERN_KDEBUG = 24, + KERN_UPDATEINTERVAL = 25, + KERN_OSRELDATE = 26, + KERN_NTP_PLL = 27, + KERN_BOOTFILE = 28, + KERN_MAXFILESPERPROC = 29, + KERN_MAXPROCPERUID = 30, + KERN_DUMPDEV = 31, + KERN_IPC = 32, + KERN_DUMMY = 33, + KERN_PS_STRINGS = 34, + KERN_USRSTACK32 = 35, + KERN_LOGSIGEXIT = 36, + KERN_SYMFILE = 37, + KERN_PROCARGS = 38, + KERN_NETBOOT = 40, + KERN_SYSV = 42, + KERN_AFFINITY = 43, + KERN_TRANSLATE = 44, + KERN_CLASSIC = KERN_TRANSLATE, + KERN_EXEC = 45, + KERN_CLASSICHANDLER = KERN_EXEC, + KERN_AIOMAX = 46, + KERN_AIOPROCMAX = 47, + KERN_AIOTHREADS = 48, + KERN_PROCARGS2 = 49, + KERN_COREFILE = 50, + KERN_COREDUMP = 51, + KERN_SUGID_COREDUMP = 52, + KERN_PROCDELAYTERM = 53, + KERN_SHREG_PRIVATIZABLE = 54, + KERN_LOW_PRI_WINDOW = 56, + KERN_LOW_PRI_DELAY = 57, + KERN_POSIX = 58, + KERN_USRSTACK64 = 59, + KERN_NX_PROTECTION = 60, + KERN_TFP = 61, + KERN_PROCNAME = 62, + KERN_THALTSTACK = 63, + KERN_SPECULATIVE_READS = 64, + KERN_OSVERSION = 65, + KERN_SAFEBOOT = 66, + KERN_RAGEVNODE = 68, + KERN_TTY = 69, + KERN_CHECKOPENEVT = 70, + KERN_THREADNAME = 71, + KERN_MAXID = 72, +} + +// KERN_RAGEVNODE types +enum +{ + KERN_RAGE_PROC = 1, + KERN_RAGE_THREAD = 2, + KERN_UNRAGE_PROC = 3, + KERN_UNRAGE_THREAD = 4, +} + +// KERN_OPENEVT types +enum +{ + KERN_OPENEVT_PROC = 1, + KERN_UNOPENEVT_PROC = 2, +} + +// KERN_TFP types +enum +{ + KERN_TFP_POLICY = 1, +} + +// KERN_TFP_POLICY values +enum +{ + KERN_TFP_POLICY_DENY = 0, + KERN_TFP_POLICY_DEFAULT = 2, +} + +// KERN_PROC subtypes +enum +{ + KERN_PROC_ALL = 0, + KERN_PROC_PID = 1, + KERN_PROC_PGRP = 2, + KERN_PROC_SESSION = 3, + KERN_PROC_TTY = 4, + KERN_PROC_UID = 5, + KERN_PROC_RUID = 6, + KERN_PROC_LCID = 7, +} + +// KERN_VFSNSPACE subtypes +enum +{ + KERN_VFSNSPACE_HANDLE_PROC = 1, + KERN_VFSNSPACE_UNHANDLE_PROC = 2, +} + +// KERN_IPC identifiers +enum +{ + KIPC_MAXSOCKBUF = 1, + KIPC_SOCKBUF_WASTE = 2, + KIPC_SOMAXCONN = 3, + KIPC_MAX_LINKHDR = 4, + KIPC_MAX_PROTOHDR = 5, + KIPC_MAX_HDR = 6, + KIPC_MAX_DATALEN = 7, + KIPC_MBSTAT = 8, + KIPC_NMBCLUSTERS = 9, + KIPC_SOQLIMITCOMPAT = 10, +} + +// CTL_VM identifiers +enum +{ + VM_METER = 1, + VM_LOADAVG = 2, + VM_MACHFACTOR = 4, + VM_SWAPUSAGE = 5, + VM_MAXID = 6, +} + +// CTL_HW identifiers +enum +{ + HW_MACHINE = 1, + HW_MODEL = 2, + HW_NCPU = 3, + HW_BYTEORDER = 4, + HW_PHYSMEM = 5, + HW_USERMEM = 6, + HW_PAGESIZE = 7, + HW_DISKNAMES = 8, + HW_DISKSTATS = 9, + HW_EPOCH = 10, + HW_FLOATINGPT = 11, + HW_MACHINE_ARCH = 12, + HW_VECTORUNIT = 13, + HW_BUS_FREQ = 14, + HW_CPU_FREQ = 15, + HW_CACHELINE = 16, + HW_L1ICACHESIZE = 17, + HW_L1DCACHESIZE = 18, + HW_L2SETTINGS = 19, + HW_L2CACHESIZE = 20, + HW_L3SETTINGS = 21, + HW_L3CACHESIZE = 22, + HW_TB_FREQ = 23, + HW_MEMSIZE = 24, + HW_AVAILCPU = 25, + HW_MAXID = 26, +} + +// CTL_USER identifiers +enum +{ + USER_CS_PATH = 1, + USER_BC_BASE_MAX = 2, + USER_BC_DIM_MAX = 3, + USER_BC_SCALE_MAX = 4, + USER_BC_STRING_MAX = 5, + USER_COLL_WEIGHTS_MAX = 6, + USER_EXPR_NEST_MAX = 7, + USER_LINE_MAX = 8, + USER_RE_DUP_MAX = 9, + USER_POSIX2_VERSION = 10, + USER_POSIX2_C_BIND = 11, + USER_POSIX2_C_DEV = 12, + USER_POSIX2_CHAR_TERM = 13, + USER_POSIX2_FORT_DEV = 14, + USER_POSIX2_FORT_RUN = 15, + USER_POSIX2_LOCALEDEF = 16, + USER_POSIX2_SW_DEV = 17, + USER_POSIX2_UPE = 18, + USER_STREAM_MAX = 19, + USER_TZNAME_MAX = 20, + USER_MAXID = 21, +} + +/// +int sysctl(const int* name, uint namelen, void* oldp, size_t* oldlenp, + const void* newp, size_t newlen); +/// +int sysctlbyname(const char* name, void* oldp, size_t* oldlenp, + const void* newp, size_t newlen); +/// +int sysctlnametomib(const char* sname, int* name, size_t* namelenp); diff --git a/libphobos/libdruntime/core/sys/dragonflybsd/stdlib.d b/libphobos/libdruntime/core/sys/dragonflybsd/stdlib.d new file mode 100644 index 00000000000..8936701078a --- /dev/null +++ b/libphobos/libdruntime/core/sys/dragonflybsd/stdlib.d @@ -0,0 +1,17 @@ +/** + * D header file for DragonFlyBSD stdlib.h. + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.dragonflybsd.stdlib; +public import core.sys.posix.stdlib; + +version (DragonFlyBSD): +extern (C): +nothrow: +@nogc: + +const(char)* getprogname(); +void setprogname(scope const char* name); diff --git a/libphobos/libdruntime/core/sys/dragonflybsd/sys/sysctl.d b/libphobos/libdruntime/core/sys/dragonflybsd/sys/sysctl.d new file mode 100644 index 00000000000..932082f2698 --- /dev/null +++ b/libphobos/libdruntime/core/sys/dragonflybsd/sys/sysctl.d @@ -0,0 +1,199 @@ +/** + * D header file for DragonFlyBSD sys/sysctl.h + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.dragonflybsd.sys.sysctl; + +version (DragonFlyBSD): +extern (C): +nothrow: +@nogc: + +// Top-level identifiers +enum +{ + CTL_SYSCTL = 0, + CTL_KERN = 1, + CTL_VM = 2, + CTL_VFS = 3, + CTL_NET = 4, + CTL_DEBUG = 5, + CTL_HW = 6, + CTL_MACHDEP = 7, + CTL_USER = 8, + CTL_P1003_1B = 9, + CTL_LWKT = 10, + CTL_MAXID = 11, +} + +// CTL_SYSCTL identifiers +enum +{ + CTL_SYSCTL_DEBUG = 0, + CTL_SYSCTL_NAME = 1, + CTL_SYSCTL_NEXT = 2, + CTL_SYSCTL_NAME2OID = 3, + CTL_SYSCTL_OIDFMT = 4, + CTL_SYSCTL_OIDDESCR = 5, +} + +// CTL_KERN identifiers +enum +{ + KERN_OSTYPE = 1, + KERN_OSRELEASE = 2, + KERN_OSREV = 3, + KERN_VERSION = 4, + KERN_MAXVNODES = 5, + KERN_MAXPROC = 6, + KERN_MAXFILES = 7, + KERN_ARGMAX = 8, + KERN_SECURELVL = 9, + KERN_HOSTNAME = 10, + KERN_HOSTID = 11, + KERN_CLOCKRATE = 12, + KERN_VNODE = 13, + KERN_PROC = 14, + KERN_FILE = 15, + KERN_POSIX1 = 17, + KERN_NGROUPS = 18, + KERN_JOB_CONTROL = 19, + KERN_SAVED_IDS = 20, + KERN_BOOTTIME = 21, + KERN_NISDOMAINNAME = 22, + KERN_UPDATEINTERVAL = 23, + KERN_OSRELDATE = 24, + KERN_NTP_PLL = 25, + KERN_BOOTFILE = 26, + KERN_MAXFILESPERPROC = 27, + KERN_MAXPROCPERUID = 28, + KERN_DUMPDEV = 29, + KERN_IPC = 30, + KERN_DUMMY = 31, + KERN_PS_STRINGS = 32, + KERN_USRSTACK = 33, + KERN_LOGSIGEXIT = 34, + KERN_IOV_MAX = 35, + KERN_MAXPOSIXLOCKSPERUID = 36, + KERN_MAXID = 37, +} + +// KERN_PROC subtypes +enum +{ + KERN_PROC_ALL = 0, + KERN_PROC_PID = 1, + KERN_PROC_PGRP = 2, + KERN_PROC_SESSION = 3, + KERN_PROC_TTY = 4, + KERN_PROC_UID = 5, + KERN_PROC_RUID = 6, + KERN_PROC_ARGS = 7, + KERN_PROC_CWD = 8, + KERN_PROC_PATHNAME = 9, + KERN_PROC_SIGTRAMP = 10, + KERN_PROC_FLAGMASK = 0x10, + KERN_PROC_FLAG_LWP = 0x10, +} + +// KERN_IPC identifiers +enum +{ + KIPC_MAXSOCKBUF = 1, + KIPC_SOCKBUF_WASTE = 2, + KIPC_SOMAXCONN = 3, + KIPC_MAX_LINKHDR = 4, + KIPC_MAX_PROTOHDR = 5, + KIPC_MAX_HDR = 6, + KIPC_MAX_DATALEN = 7, + KIPC_MBSTAT = 8, + KIPC_NMBCLUSTERS = 9, +} + +// CTL_HW identifiers +enum +{ + HW_MACHINE = 1, + HW_MODEL = 2, + HW_NCPU = 3, + HW_BYTEORDER = 4, + HW_PHYSMEM = 5, + HW_USERMEM = 6, + HW_PAGESIZE = 7, + HW_DISKNAMES = 8, + HW_DISKSTATS = 9, + HW_FLOATINGPT = 10, + HW_MACHINE_ARCH = 11, + HW_MACHINE_PLATFORM = 12, + HW_SENSORS = 13, + HW_MAXID = 14, +} + +// CTL_USER definitions +enum +{ + USER_CS_PATH = 1, + USER_BC_BASE_MAX = 2, + USER_BC_DIM_MAX = 3, + USER_BC_SCALE_MAX = 4, + USER_BC_STRING_MAX = 5, + USER_COLL_WEIGHTS_MAX = 6, + USER_EXPR_NEST_MAX = 7, + USER_LINE_MAX = 8, + USER_RE_DUP_MAX = 9, + USER_POSIX2_VERSION = 10, + USER_POSIX2_C_BIND = 11, + USER_POSIX2_C_DEV = 12, + USER_POSIX2_CHAR_TERM = 13, + USER_POSIX2_FORT_DEV = 14, + USER_POSIX2_FORT_RUN = 15, + USER_POSIX2_LOCALEDEF = 16, + USER_POSIX2_SW_DEV = 17, + USER_POSIX2_UPE = 18, + USER_STREAM_MAX = 19, + USER_TZNAME_MAX = 20, + USER_MAXID = 21, +} + +// POSIX 1003.1B definitions +enum +{ + CTL_P1003_1B_ASYNCHRONOUS_IO = 1, + CTL_P1003_1B_MAPPED_FILES = 2, + CTL_P1003_1B_MEMLOCK = 3, + CTL_P1003_1B_MEMLOCK_RANGE = 4, + CTL_P1003_1B_MEMORY_PROTECTION = 5, + CTL_P1003_1B_MESSAGE_PASSING = 6, + CTL_P1003_1B_PRIORITIZED_IO = 7, + CTL_P1003_1B_PRIORITY_SCHEDULING = 8, + CTL_P1003_1B_REALTIME_SIGNALS = 9, + CTL_P1003_1B_SEMAPHORES = 10, + CTL_P1003_1B_FSYNC = 11, + CTL_P1003_1B_SHARED_MEMORY_OBJECTS = 12, + CTL_P1003_1B_SYNCHRONIZED_IO = 13, + CTL_P1003_1B_TIMERS = 14, + CTL_P1003_1B_AIO_LISTIO_MAX = 15, + CTL_P1003_1B_AIO_MAX = 16, + CTL_P1003_1B_AIO_PRIO_DELTA_MAX = 17, + CTL_P1003_1B_DELAYTIMER_MAX = 18, + CTL_P1003_1B_UNUSED19 = 19, + CTL_P1003_1B_PAGESIZE = 20, + CTL_P1003_1B_RTSIG_MAX = 21, + CTL_P1003_1B_SEM_NSEMS_MAX = 22, + CTL_P1003_1B_UNUSED23 = 23, + CTL_P1003_1B_SIGQUEUE_MAX = 24, + CTL_P1003_1B_TIMER_MAX = 25, + CTL_P1003_1B_MAXID = 26, +} + +/// +int sysctl(const int* name, uint namelen, void* oldp, size_t* oldlenp, + const void* newp, size_t newlen); +/// +int sysctlbyname(const char* name, void* oldp, size_t* oldlenp, + const void* newp, size_t newlen); +/// +int sysctlnametomib(const char* name, int* mibp, size_t* sizep); diff --git a/libphobos/libdruntime/core/sys/freebsd/stdlib.d b/libphobos/libdruntime/core/sys/freebsd/stdlib.d new file mode 100644 index 00000000000..bf93c3a451d --- /dev/null +++ b/libphobos/libdruntime/core/sys/freebsd/stdlib.d @@ -0,0 +1,17 @@ +/** + * D header file for FreeBSD stdlib.h. + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.freebsd.stdlib; +public import core.sys.posix.stdlib; + +version (FreeBSD): +extern (C): +nothrow: +@nogc: + +const(char)* getprogname(); +void setprogname(scope const char* name); diff --git a/libphobos/libdruntime/core/sys/freebsd/sys/sysctl.d b/libphobos/libdruntime/core/sys/freebsd/sys/sysctl.d new file mode 100644 index 00000000000..b9b3e93b05f --- /dev/null +++ b/libphobos/libdruntime/core/sys/freebsd/sys/sysctl.d @@ -0,0 +1,211 @@ +/** + * D header file for FreeBSD sys/sysctl.h + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.freebsd.sys.sysctl; + +version (FreeBSD): +extern (C): +nothrow: +@nogc: + +// Top-level identifiers +enum +{ + CTL_SYSCTL = 0, + CTL_KERN = 1, + CTL_VM = 2, + CTL_VFS = 3, + CTL_NET = 4, + CTL_DEBUG = 5, + CTL_HW = 6, + CTL_MACHDEP = 7, + CTL_USER = 8, + CTL_P1003_1B = 9, +} + +// CTL_SYSCTL identifiers +enum +{ + CTL_SYSCTL_DEBUG = 0, + CTL_SYSCTL_NAME = 1, + CTL_SYSCTL_NEXT = 2, + CTL_SYSCTL_NAME2OID = 3, + CTL_SYSCTL_OIDFMT = 4, + CTL_SYSCTL_OIDDESCR = 5, + CTL_SYSCTL_OIDLABEL = 6, +} + +// CTL_KERN identifiers +enum +{ + KERN_OSTYPE = 1, + KERN_OSRELEASE = 2, + KERN_OSREV = 3, + KERN_VERSION = 4, + KERN_MAXVNODES = 5, + KERN_MAXPROC = 6, + KERN_MAXFILES = 7, + KERN_ARGMAX = 8, + KERN_SECURELVL = 9, + KERN_HOSTNAME = 10, + KERN_HOSTID = 11, + KERN_CLOCKRATE = 12, + KERN_VNODE = 13, + KERN_PROC = 14, + KERN_FILE = 15, + KERN_PROF = 16, + KERN_POSIX1 = 17, + KERN_NGROUPS = 18, + KERN_JOB_CONTROL = 19, + KERN_SAVED_IDS = 20, + KERN_BOOTTIME = 21, + KERN_NISDOMAINNAME = 22, + KERN_UPDATEINTERVAL = 23, + KERN_OSRELDATE = 24, + KERN_NTP_PLL = 25, + KERN_BOOTFILE = 26, + KERN_MAXFILESPERPROC = 27, + KERN_MAXPROCPERUID = 28, + KERN_DUMPDEV = 29, + KERN_IPC = 30, + KERN_DUMMY = 31, + KERN_PS_STRINGS = 32, + KERN_USRSTACK = 33, + KERN_LOGSIGEXIT = 34, + KERN_IOV_MAX = 35, + KERN_HOSTUUID = 36, + KERN_ARND = 37, + KERN_MAXPHYS = 38, +} + +// KERN_PROC subtypes +enum +{ + KERN_PROC_ALL = 0, + KERN_PROC_PID = 1, + KERN_PROC_PGRP = 2, + KERN_PROC_SESSION = 3, + KERN_PROC_TTY = 4, + KERN_PROC_UID = 5, + KERN_PROC_RUID = 6, + KERN_PROC_ARGS = 7, + KERN_PROC_PROC = 8, + KERN_PROC_SV_NAME = 9, + KERN_PROC_RGID = 10, + KERN_PROC_GID = 11, + KERN_PROC_PATHNAME = 12, + KERN_PROC_OVMMAP = 13, + KERN_PROC_OFILEDESC = 14, + KERN_PROC_KSTACK = 15, + KERN_PROC_INC_THREAD = 0x10, + KERN_PROC_VMMAP = 32, + KERN_PROC_FILEDESC = 33, + KERN_PROC_GROUPS = 34, + KERN_PROC_ENV = 35, + KERN_PROC_AUXV = 36, + KERN_PROC_RLIMIT = 37, + KERN_PROC_PS_STRINGS = 38, + KERN_PROC_UMASK = 39, + KERN_PROC_OSREL = 40, + KERN_PROC_SIGTRAMP = 41, + KERN_PROC_CWD = 42, + KERN_PROC_NFDS = 43, +} + +// KERN_IPC identifiers +enum +{ + KIPC_MAXSOCKBUF = 1, + KIPC_SOCKBUF_WASTE = 2, + KIPC_SOMAXCONN = 3, + KIPC_MAX_LINKHDR = 4, + KIPC_MAX_PROTOHDR = 5, + KIPC_MAX_HDR = 6, + KIPC_MAX_DATALEN = 7, +} + +// CTL_HW identifiers +enum +{ + HW_MACHINE = 1, + HW_MODEL = 2, + HW_NCPU = 3, + HW_BYTEORDER = 4, + HW_PHYSMEM = 5, + HW_USERMEM = 6, + HW_PAGESIZE = 7, + HW_DISKNAMES = 8, + HW_DISKSTATS = 9, + HW_FLOATINGPT = 10, + HW_MACHINE_ARCH = 11, + HW_REALMEM = 12, +} + +// CTL_USER identifiers +enum +{ + USER_CS_PATH = 1, + USER_BC_BASE_MAX = 2, + USER_BC_DIM_MAX = 3, + USER_BC_SCALE_MAX = 4, + USER_BC_STRING_MAX = 5, + USER_COLL_WEIGHTS_MAX = 6, + USER_EXPR_NEST_MAX = 7, + USER_LINE_MAX = 8, + USER_RE_DUP_MAX = 9, + USER_POSIX2_VERSION = 10, + USER_POSIX2_C_BIND = 11, + USER_POSIX2_C_DEV = 12, + USER_POSIX2_CHAR_TERM = 13, + USER_POSIX2_FORT_DEV = 14, + USER_POSIX2_FORT_RUN = 15, + USER_POSIX2_LOCALEDEF = 16, + USER_POSIX2_SW_DEV = 17, + USER_POSIX2_UPE = 18, + USER_STREAM_MAX = 19, + USER_TZNAME_MAX = 20, +} + +// POSIX 1003.1B definitions +enum +{ + CTL_P1003_1B_ASYNCHRONOUS_IO = 1, + CTL_P1003_1B_MAPPED_FILES = 2, + CTL_P1003_1B_MEMLOCK = 3, + CTL_P1003_1B_MEMLOCK_RANGE = 4, + CTL_P1003_1B_MEMORY_PROTECTION = 5, + CTL_P1003_1B_MESSAGE_PASSING = 6, + CTL_P1003_1B_PRIORITIZED_IO = 7, + CTL_P1003_1B_PRIORITY_SCHEDULING = 8, + CTL_P1003_1B_REALTIME_SIGNALS = 9, + CTL_P1003_1B_SEMAPHORES = 10, + CTL_P1003_1B_FSYNC = 11, + CTL_P1003_1B_SHARED_MEMORY_OBJECTS = 12, + CTL_P1003_1B_SYNCHRONIZED_IO = 13, + CTL_P1003_1B_TIMERS = 14, + CTL_P1003_1B_AIO_LISTIO_MAX = 15, + CTL_P1003_1B_AIO_MAX = 16, + CTL_P1003_1B_AIO_PRIO_DELTA_MAX = 17, + CTL_P1003_1B_DELAYTIMER_MAX = 18, + CTL_P1003_1B_UNUSED19 = 19, + CTL_P1003_1B_PAGESIZE = 20, + CTL_P1003_1B_RTSIG_MAX = 21, + CTL_P1003_1B_SEM_NSEMS_MAX = 22, + CTL_P1003_1B_UNUSED23 = 23, + CTL_P1003_1B_SIGQUEUE_MAX = 24, + CTL_P1003_1B_TIMER_MAX = 25, + CTL_P1003_1B_MAXID = 26, +} + +/// +int sysctl(const int* name, uint namelen, void* oldp, size_t* oldlenp, + const void* newp, size_t newlen); +/// +int sysctlbyname(const char* name, void* oldp, size_t* oldlenp, + const void* newp, size_t newlen); +/// +int sysctlnametomib(const char* name, int* mibp, size_t* sizep); diff --git a/libphobos/libdruntime/core/sys/netbsd/stdlib.d b/libphobos/libdruntime/core/sys/netbsd/stdlib.d new file mode 100644 index 00000000000..84c68a74e0d --- /dev/null +++ b/libphobos/libdruntime/core/sys/netbsd/stdlib.d @@ -0,0 +1,17 @@ +/** + * D header file for NetBSD stdlib.h. + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.netbsd.stdlib; +public import core.sys.posix.stdlib; + +version (NetBSD): +extern (C): +nothrow: +@nogc: + +const(char)* getprogname(); +void setprogname(scope const char* name); diff --git a/libphobos/libdruntime/core/sys/netbsd/sys/sysctl.d b/libphobos/libdruntime/core/sys/netbsd/sys/sysctl.d new file mode 100644 index 00000000000..9b2a0b7a9b6 --- /dev/null +++ b/libphobos/libdruntime/core/sys/netbsd/sys/sysctl.d @@ -0,0 +1,254 @@ +/** + * D header file for NetBSD sys/sysctl.h + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.netbsd.sys.sysctl; + +version (NetBSD): +extern (C): +nothrow: +@nogc: + +// Top-level identifiers +enum +{ + CTL_UNSPEC = 0, + CTL_KERN = 1, + CTL_VM = 2, + CTL_VFS = 3, + CTL_NET = 4, + CTL_DEBUG = 5, + CTL_HW = 6, + CTL_MACHDEP = 7, + CTL_DDB = 9, + CTL_PROC = 10, + CTL_VENDOR = 11, + CTL_EMUL = 12, + CTL_SECURITY = 13, +} + +// CTL_KERN identifiers +enum +{ + KERN_OSTYPE = 1, + KERN_OSRELEASE = 2, + KERN_OSREV = 3, + KERN_VERSION = 4, + KERN_MAXVNODES = 5, + KERN_MAXPROC = 6, + KERN_MAXFILES = 7, + KERN_ARGMAX = 8, + KERN_SECURELVL = 9, + KERN_HOSTNAME = 10, + KERN_HOSTID = 11, + KERN_CLOCKRATE = 12, + KERN_VNODE = 13, + KERN_PROC = 14, + KERN_FILE = 15, + KERN_PROF = 16, + KERN_POSIX1 = 17, + KERN_NGROUPS = 18, + KERN_JOB_CONTROL = 19, + KERN_SAVED_IDS = 20, + KERN_OBOOTTIME = 21, + KERN_DOMAINNAME = 22, + KERN_MAXPARTITIONS = 23, + KERN_RAWPARTITION = 24, + KERN_NTPTIME = 25, + KERN_TIMEX = 26, + KERN_AUTONICETIME = 27, + KERN_AUTONICEVAL = 28, + KERN_RTC_OFFSET = 29, + KERN_ROOT_DEVICE = 30, + KERN_MSGBUFSIZE = 31, + KERN_FSYNC = 32, + KERN_OLDSYSVMSG = 33, + KERN_OLDSYSVSEM = 34, + KERN_OLDSYSVSHM = 35, + KERN_OLDSHORTCORENAME = 36, + KERN_SYNCHRONIZED_IO = 37, + KERN_IOV_MAX = 38, + KERN_MBUF = 39, + KERN_MAPPED_FILES = 40, + KERN_MEMLOCK = 41, + KERN_MEMLOCK_RANGE = 42, + KERN_MEMORY_PROTECTION = 43, + KERN_LOGIN_NAME_MAX = 44, + KERN_DEFCORENAME = 45, + KERN_LOGSIGEXIT = 46, + KERN_PROC2 = 47, + KERN_PROC_ARGS = 48, + KERN_FSCALE = 49, + KERN_CCPU = 50, + KERN_CP_TIME = 51, + KERN_OLDSYSVIPC_INFO = 52, + KERN_MSGBUF = 53, + KERN_CONSDEV = 54, + KERN_MAXPTYS = 55, + KERN_PIPE = 56, + KERN_MAXPHYS = 57, + KERN_SBMAX = 58, + KERN_TKSTAT = 59, + KERN_MONOTONIC_CLOCK = 60, + KERN_URND = 61, + KERN_LABELSECTOR = 62, + KERN_LABELOFFSET = 63, + KERN_LWP = 64, + KERN_FORKFSLEEP = 65, + KERN_POSIX_THREADS = 66, + KERN_POSIX_SEMAPHORES = 67, + KERN_POSIX_BARRIERS = 68, + KERN_POSIX_TIMERS = 69, + KERN_POSIX_SPIN_LOCKS = 70, + KERN_POSIX_READER_WRITER_LOCKS = 71, + KERN_DUMP_ON_PANIC = 72, + KERN_SOMAXKVA = 73, + KERN_ROOT_PARTITION = 74, + KERN_DRIVERS = 75, + KERN_BUF = 76, + KERN_FILE2 = 77, + KERN_VERIEXEC = 78, + KERN_CP_ID = 79, + KERN_HARDCLOCK_TICKS = 80, + KERN_ARND = 81, + KERN_SYSVIPC = 82, + KERN_BOOTTIME = 83, + KERN_EVCNT = 84, + KERN_SOFIXEDBUF = 85, +} + +// KERN_PROC subtypes +enum +{ + KERN_PROC_ALL = 0, + KERN_PROC_PID = 1, + KERN_PROC_PGRP = 2, + KERN_PROC_SESSION = 3, + KERN_PROC_TTY = 4, + KERN_PROC_UID = 5, + KERN_PROC_RUID = 6, + KERN_PROC_KTHREAD = 7, + KERN_PROC_RGID = 8, +} + +// KERN_PROC_ARGS subtypes +enum +{ + KERN_PROC_ARGV = 1, + KERN_PROC_NARGV = 2, + KERN_PROC_ENV = 3, + KERN_PROC_NENV = 4, + KERN_PROC_PATHNAME = 5, + KERN_PROC_CWD = 6, +} + +// KERN_SYSVIPC subtypes +enum +{ + KERN_SYSVIPC_INFO = 1, + KERN_SYSVIPC_MSG = 2, + KERN_SYSVIPC_SEM = 3, + KERN_SYSVIPC_SHM = 4, + KERN_SYSVIPC_SHMMAX = 5, + KERN_SYSVIPC_SHMMNI = 6, + KERN_SYSVIPC_SHMSEG = 7, + KERN_SYSVIPC_SHMMAXPGS = 8, + KERN_SYSVIPC_SHMUSEPHYS = 9, +} + +// KERN_SYSVIPC_INFO subtypes +enum +{ + KERN_SYSVIPC_MSG_INFO = 4, + KERN_SYSVIPC_SEM_INFO = 5, + KERN_SYSVIPC_SHM_INFO = 6, +} + +// KERN_TKSTAT subtypes +enum +{ + KERN_TKSTAT_NIN = 1, + KERN_TKSTAT_NOUT = 2, + KERN_TKSTAT_CANCC = 3, + KERN_TKSTAT_RAWCC = 4, +} + +// KERN_BUF subtypes +enum +{ + KERN_BUF_ALL = 0, +} + +// KERN_FILE +enum +{ + KERN_FILE_BYFILE = 1, + KERN_FILE_BYPID = 2, + KERN_FILESLOP = 10, +} + +// KERN_EVCNT +enum +{ + KERN_EVCNT_COUNT_ANY = 0, + KERN_EVCNT_COUNT_NONZERO = 1, +} + +// CTL_HW identifiers +enum +{ + HW_MACHINE = 1, + HW_MODEL = 2, + HW_NCPU = 3, + HW_BYTEORDER = 4, + HW_PHYSMEM = 5, + HW_USERMEM = 6, + HW_PAGESIZE = 7, + HW_DISKNAMES = 8, + HW_IOSTATS = 9, + HW_MACHINE_ARCH = 10, + HW_ALIGNBYTES = 11, + HW_CNMAGIC = 12, + HW_PHYSMEM64 = 13, + HW_USERMEM64 = 14, + HW_IOSTATNAMES = 15, + HW_NCPUONLINE = 16, +} + +// CTL_USER definitions +enum +{ + USER_CS_PATH = 1, + USER_BC_BASE_MAX = 2, + USER_BC_DIM_MAX = 3, + USER_BC_SCALE_MAX = 4, + USER_BC_STRING_MAX = 5, + USER_COLL_WEIGHTS_MAX = 6, + USER_EXPR_NEST_MAX = 7, + USER_LINE_MAX = 8, + USER_RE_DUP_MAX = 9, + USER_POSIX2_VERSION = 10, + USER_POSIX2_C_BIND = 11, + USER_POSIX2_C_DEV = 12, + USER_POSIX2_CHAR_TERM = 13, + USER_POSIX2_FORT_DEV = 14, + USER_POSIX2_FORT_RUN = 15, + USER_POSIX2_LOCALEDEF = 16, + USER_POSIX2_SW_DEV = 17, + USER_POSIX2_UPE = 18, + USER_STREAM_MAX = 19, + USER_TZNAME_MAX = 20, + USER_ATEXIT_MAX = 21, +} + +/// +int sysctl(const int* name, uint namelen, void* oldp, size_t* oldlenp, + const void* newp, size_t newlen); +/// +int sysctlbyname(const char* name, void* oldp, size_t* oldlenp, + const void* newp, size_t newlen); +/// +int sysctlnametomib(const char* sname, int* name, size_t* namelenp); diff --git a/libphobos/libdruntime/core/sys/openbsd/stdlib.d b/libphobos/libdruntime/core/sys/openbsd/stdlib.d new file mode 100644 index 00000000000..2d4d7a9a4f2 --- /dev/null +++ b/libphobos/libdruntime/core/sys/openbsd/stdlib.d @@ -0,0 +1,17 @@ +/** + * D header file for OpenBSD stdlib.h. + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.openbsd.stdlib; +public import core.sys.posix.stdlib; + +version (OpenBSD): +extern (C): +nothrow: +@nogc: + +const(char)* getprogname(); +void setprogname(scope const char* name); diff --git a/libphobos/libdruntime/core/sys/openbsd/sys/sysctl.d b/libphobos/libdruntime/core/sys/openbsd/sys/sysctl.d new file mode 100644 index 00000000000..c6f98455fef --- /dev/null +++ b/libphobos/libdruntime/core/sys/openbsd/sys/sysctl.d @@ -0,0 +1,254 @@ +/** + * D header file for OpenBSD sys/sysctl.h + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.openbsd.sys.sysctl; + +version (OpenBSD): +extern (C): +nothrow: +@nogc: + +// Top-level identifiers +enum +{ + CTL_UNSPEC = 0, + CTL_KERN = 1, + CTL_VM = 2, + CTL_FS = 3, + CTL_NET = 4, + CTL_DEBUG = 5, + CTL_HW = 6, + CTL_MACHDEP = 7, + CTL_DDB = 9, + CTL_VFS = 10, + CTL_MAXID = 11, +} + +// CTL_KERN identifiers +enum +{ + KERN_OSTYPE = 1, + KERN_OSRELEASE = 2, + KERN_OSREV = 3, + KERN_VERSION = 4, + KERN_MAXVNODES = 5, + KERN_MAXPROC = 6, + KERN_MAXFILES = 7, + KERN_ARGMAX = 8, + KERN_SECURELVL = 9, + KERN_HOSTNAME = 10, + KERN_HOSTID = 11, + KERN_CLOCKRATE = 12, + KERN_PROF = 16, + KERN_POSIX1 = 17, + KERN_NGROUPS = 18, + KERN_JOB_CONTROL = 19, + KERN_SAVED_IDS = 20, + KERN_BOOTTIME = 21, + KERN_DOMAINNAME = 22, + KERN_MAXPARTITIONS = 23, + KERN_RAWPARTITION = 24, + KERN_MAXTHREAD = 25, + KERN_NTHREADS = 26, + KERN_OSVERSION = 27, + KERN_SOMAXCONN = 28, + KERN_SOMINCONN = 29, + KERN_NOSUIDCOREDUMP = 32, + KERN_FSYNC = 33, + KERN_SYSVMSG = 34, + KERN_SYSVSEM = 35, + KERN_SYSVSHM = 36, + KERN_MSGBUFSIZE = 38, + KERN_MALLOCSTATS = 39, + KERN_CPTIME = 40, + KERN_NCHSTATS = 41, + KERN_FORKSTAT = 42, + KERN_NSELCOLL = 43, + KERN_TTY = 44, + KERN_CCPU = 45, + KERN_FSCALE = 46, + KERN_NPROCS = 47, + KERN_MSGBUF = 48, + KERN_POOL = 49, + KERN_STACKGAPRANDOM = 50, + KERN_SYSVIPC_INFO = 51, + KERN_ALLOWKMEM = 52, + KERN_WITNESSWATCH = 53, + KERN_SPLASSERT = 54, + KERN_PROC_ARGS = 55, + KERN_NFILES = 56, + KERN_TTYCOUNT = 57, + KERN_NUMVNODES = 58, + KERN_MBSTAT = 59, + KERN_WITNESS = 60, + KERN_SEMINFO = 61, + KERN_SHMINFO = 62, + KERN_INTRCNT = 63, + KERN_WATCHDOG = 64, + KERN_ALLOWDT = 65, + KERN_PROC = 66, + KERN_MAXCLUSTERS = 67, + KERN_EVCOUNT = 68, + KERN_TIMECOUNTER = 69, + KERN_MAXLOCKSPERUID = 70, + KERN_CPTIME2 = 71, + KERN_CACHEPCT = 72, + KERN_FILE = 73, + KERN_WXABORT = 74, + KERN_CONSDEV = 75, + KERN_NETLIVELOCKS = 76, + KERN_POOL_DEBUG = 77, + KERN_PROC_CWD = 78, + KERN_PROC_NOBROADCASTKILL = 79, + KERN_PROC_VMMAP = 80, + KERN_GLOBAL_PTRACE = 81, + KERN_CONSBUFSIZE = 82, + KERN_CONSBUF = 83, + KERN_AUDIO = 84, + KERN_CPUSTATS = 85, + KERN_PFSTATUS = 86, + KERN_TIMEOUT_STATS = 87, + KERN_UTC_OFFSET = 88, + KERN_MAXID = 89, +} + +// KERN_PROC subtypes +enum +{ + KERN_PROC_ALL = 0, + KERN_PROC_PID = 1, + KERN_PROC_PGRP = 2, + KERN_PROC_SESSION = 3, + KERN_PROC_TTY = 4, + KERN_PROC_UID = 5, + KERN_PROC_RUID = 6, + KERN_PROC_KTHREAD = 7, + KERN_PROC_SHOW_THREADS = 0x40000000, +} + +// KERN_SYSVIPC_INFO subtypes +enum +{ + KERN_SYSVIPC_MSG_INFO = 1, + KERN_SYSVIPC_SEM_INFO = 2, + KERN_SYSVIPC_SHM_INFO = 3, +} + +// KERN_PROC_ARGS subtypes +enum +{ + KERN_PROC_ARGV = 1, + KERN_PROC_NARGV = 2, + KERN_PROC_ENV = 3, + KERN_PROC_NENV = 4, +} + +// KERN_AUDIO subtypes +enum +{ + KERN_AUDIO_RECORD = 1, + KERN_AUDIO_MAXID = 2, +} + +// KERN_WITNESS +enum +{ + KERN_WITNESS_WATCH = 1, + KERN_WITNESS_LOCKTRACE = 2, + KERN_WITNESS_MAXID = 3, +} + +// KERN_FILE +enum +{ + KERN_FILE_BYFILE = 1, + KERN_FILE_BYPID = 2, + KERN_FILE_BYUID = 3, + KERN_FILESLOP = 10, + + KERN_FILE_TEXT = -1, + KERN_FILE_CDIR = -2, + KERN_FILE_RDIR = -3, + KERN_FILE_TRACE = -4, +} + +// KERN_INTRCNT +enum +{ + KERN_INTRCNT_NUM = 1, + KERN_INTRCNT_CNT = 2, + KERN_INTRCNT_NAME = 3, + KERN_INTRCNT_VECTOR = 4, + KERN_INTRCNT_MAXID = 5, +} + +// KERN_WATCHDOG +enum +{ + KERN_WATCHDOG_PERIOD = 1, + KERN_WATCHDOG_AUTO = 2, + KERN_WATCHDOG_MAXID = 3, +} + +// KERN_TIMECOUNTER +enum +{ + KERN_TIMECOUNTER_TICK = 1, + KERN_TIMECOUNTER_TIMESTEPWARNINGS = 2, + KERN_TIMECOUNTER_HARDWARE = 3, + KERN_TIMECOUNTER_CHOICE = 4, + KERN_TIMECOUNTER_MAXID = 5, +} + +// CTL_FS identifiers +enum +{ + FS_POSIX = 1, + FS_MAXID = 2, +} + +// CTL_FS_POSIX identifiers +enum +{ + FS_POSIX_SETUID = 1, + FS_POSIX_MAXID = 2, +} + +// CTL_HW identifiers +enum +{ + HW_MACHINE = 1, + HW_MODEL = 2, + HW_NCPU = 3, + HW_BYTEORDER = 4, + HW_PHYSMEM = 5, + HW_USERMEM = 6, + HW_PAGESIZE = 7, + HW_DISKNAMES = 8, + HW_DISKSTATS = 9, + HW_DISKCOUNT = 10, + HW_SENSORS = 11, + HW_CPUSPEED = 12, + HW_SETPERF = 13, + HW_VENDOR = 14, + HW_PRODUCT = 15, + HW_VERSION = 16, + HW_SERIALNO = 17, + HW_UUID = 18, + HW_PHYSMEM64 = 19, + HW_USERMEM64 = 20, + HW_NCPUFOUND = 21, + HW_ALLOWPOWERDOWN = 22, + HW_PERFPOLICY = 23, + HW_SMT = 24, + HW_NCPUONLINE = 25, + HW_MAXID = 26, +} + +/// +int sysctl(const int* name, uint namelen, void* oldp, size_t* oldlenp, + const void* newp, size_t newlen); diff --git a/libphobos/libdruntime/core/sys/posix/locale.d b/libphobos/libdruntime/core/sys/posix/locale.d index 172e9aa583c..19c7e209ac7 100644 --- a/libphobos/libdruntime/core/sys/posix/locale.d +++ b/libphobos/libdruntime/core/sys/posix/locale.d @@ -34,50 +34,44 @@ version (NetBSD) version (DragonflyBSD) version = DarwinBSDLocale; -/// -struct lconv -{ - char* currency_symbol; - char* decimal_point; - char frac_digits; - char* grouping; - char* int_curr_symbol; - char int_frac_digits; - char int_n_cs_precedes; - char int_n_sep_by_space; - char int_n_sign_posn; - char int_p_cs_precedes; - char int_p_sep_by_space; - char int_p_sign_posn; - char* mon_decimal_point; - char* mon_grouping; - char* mon_thousands_sep; - char* negative_sign; - char n_cs_precedes; - char n_sep_by_space; - char n_sign_posn; - char* positive_sign; - char p_cs_precedes; - char p_sep_by_space; - char p_sign_posn; - char* thousands_sep; -} - -/// Duplicate existing locale -locale_t duplocale(locale_t locale); -/// Free an allocated locale -void freelocale(locale_t locale); -/// Natural language formatting for C -lconv* localeconv(); -/// Create a new locale -locale_t newlocale(int mask, const char* locale, locale_t base); -/// Set the C library's notion of natural language formatting style -char* setlocale(int category, const char* locale); -/// Set the per-thread locale -locale_t uselocale (locale_t locale); +version (CRuntime_Glibc) + version = GNULinuxLocale; +version (CRuntime_Bionic) + version = GNULinuxLocale; +version (CRuntime_UClibc) + version = GNULinuxLocale; version (DarwinBSDLocale) { + /// + struct lconv + { + char* decimal_point; + char* thousands_sep; + char* grouping; + char* int_curr_symbol; + char* currency_symbol; + char* mon_decimal_point; + char* mon_thousands_sep; + char* mon_grouping; + char* positive_sign; + char* negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + char int_p_cs_precedes; + char int_n_cs_precedes; + char int_p_sep_by_space; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; + } + /// enum { @@ -116,10 +110,51 @@ version (DarwinBSDLocale) /// enum LC_GLOBAL_LOCALE = (cast(locale_t)-1); -} -version (linux) + /// Duplicate existing locale + locale_t duplocale(locale_t locale); + /// Free an allocated locale + void freelocale(locale_t locale); + /// Natural language formatting for C + lconv* localeconv(); + /// Create a new locale + locale_t newlocale(int mask, const char* locale, locale_t base); + /// Set the C library's notion of natural language formatting style + char* setlocale(int category, const char* locale); + /// Set the per-thread locale + locale_t uselocale (locale_t locale); +} +else version (GNULinuxLocale) { + /// + struct lconv + { + char* decimal_point; + char* thousands_sep; + char* grouping; + char* int_curr_symbol; + char* currency_symbol; + char* mon_decimal_point; + char* mon_thousands_sep; + char* mon_grouping; + char* positive_sign; + char* negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + char int_p_cs_precedes; + char int_p_sep_by_space; + char int_n_cs_precedes; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; + } + /// enum { @@ -172,4 +207,218 @@ version (linux) /// enum LC_GLOBAL_LOCALE = (cast(locale_t)-1); + + /// Duplicate existing locale + locale_t duplocale(locale_t locale); + /// Free an allocated locale + void freelocale(locale_t locale); + /// Natural language formatting for C + lconv* localeconv(); + /// Create a new locale + locale_t newlocale(int mask, const char* locale, locale_t base); + /// Set the C library's notion of natural language formatting style + char* setlocale(int category, const char* locale); + /// Set the per-thread locale + locale_t uselocale (locale_t locale); +} +else version (CRuntime_Musl) +{ + /// + struct lconv + { + char* decimal_point; + char* thousands_sep; + char* grouping; + char* int_curr_symbol; + char* currency_symbol; + char* mon_decimal_point; + char* mon_thousands_sep; + char* mon_grouping; + char* positive_sign; + char* negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + char int_p_cs_precedes; + char int_p_sep_by_space; + char int_n_cs_precedes; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; + } + + /// + enum + { + LC_CTYPE = 0, + LC_NUMERIC = 1, + LC_TIME = 2, + LC_COLLATE = 3, + LC_MONETARY = 4, + LC_MESSAGES = 5, + LC_ALL = 6, + } + + /// + enum + { + LC_CTYPE_MASK = (1 << LC_CTYPE), + LC_NUMERIC_MASK = (1 << LC_NUMERIC), + LC_TIME_MASK = (1 << LC_TIME), + LC_COLLATE_MASK = (1 << LC_COLLATE), + LC_MONETARY_MASK = (1 << LC_MONETARY), + LC_MESSAGES_MASK = (1 << LC_MESSAGES), + LC_ALL_MASK = 0x7fffffff, + } + + private struct __locale_struct; + + /// + alias locale_t = __locale_struct*; + + /// + enum LC_GLOBAL_LOCALE = (cast(locale_t)-1); + + /// Duplicate existing locale + locale_t duplocale(locale_t locale); + /// Free an allocated locale + void freelocale(locale_t locale); + /// Natural language formatting for C + lconv* localeconv(); + /// Create a new locale + locale_t newlocale(int mask, const char* locale, locale_t base); + /// Set the C library's notion of natural language formatting style + char* setlocale(int category, const char* locale); + /// Set the per-thread locale + locale_t uselocale (locale_t locale); +} +else version (OpenBSD) +{ + /// + struct lconv + { + char* decimal_point; + char* thousands_sep; + char* grouping; + char* int_curr_symbol; + char* currency_symbol; + char* mon_decimal_point; + char* mon_thousands_sep; + char* mon_grouping; + char* positive_sign; + char* negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + char int_p_cs_precedes; + char int_n_cs_precedes; + char int_p_sep_by_space; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; + } + + /// + enum + { + LC_ALL = 0, + LC_COLLATE = 1, + LC_CTYPE = 2, + LC_MONETARY = 3, + LC_NUMERIC = 4, + LC_TIME = 5, + LC_MESSAGES = 6, + } + private enum _LC_LAST = 7; + + /// + enum + { + LC_COLLATE_MASK = (1 << LC_COLLATE), + LC_CTYPE_MASK = (1 << LC_CTYPE), + LC_MONETARY_MASK = (1 << LC_MONETARY), + LC_NUMERIC_MASK = (1 << LC_NUMERIC), + LC_TIME_MASK = (1 << LC_TIME), + LC_MESSAGES_MASK = (1 << LC_MESSAGES), + LC_ALL_MASK = ((1 << _LC_LAST) - 2), + } + + /// + alias locale_t = void*; + + /// + enum LC_GLOBAL_LOCALE = (cast(locale_t)-1); + + /// Duplicate existing locale + locale_t duplocale(locale_t locale); + /// Free an allocated locale + void freelocale(locale_t locale); + /// Natural language formatting for C + lconv* localeconv(); + /// Create a new locale + locale_t newlocale(int mask, const char* locale, locale_t base); + /// Set the C library's notion of natural language formatting style + char* setlocale(int category, const char* locale); + /// Set the per-thread locale + locale_t uselocale (locale_t locale); +} +else version (Solaris) +{ + /// + struct lconv + { + char* decimal_point; + char* thousands_sep; + char* grouping; + char* int_curr_symbol; + char* currency_symbol; + char* mon_decimal_point; + char* mon_thousands_sep; + char* mon_grouping; + char* positive_sign; + char* negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + char int_p_cs_precedes; + char int_n_cs_precedes; + char int_p_sep_by_space; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; + } + + /// + enum + { + LC_CTYPE = 0, + LC_NUMERIC = 1, + LC_TIME = 2, + LC_COLLATE = 3, + LC_MONETARY = 4, + LC_MESSAGES = 5, + LC_ALL = 6, + } + + /// Natural language formatting for C + lconv* localeconv(); + /// Set the C library's notion of natural language formatting style + char* setlocale(int category, const char* locale); } +else + static assert(false, "unimplemented platform"); diff --git a/libphobos/libdruntime/core/sys/posix/mqueue.d b/libphobos/libdruntime/core/sys/posix/mqueue.d index 3b447a1a434..2f1a8c69ad6 100644 --- a/libphobos/libdruntime/core/sys/posix/mqueue.d +++ b/libphobos/libdruntime/core/sys/posix/mqueue.d @@ -19,6 +19,7 @@ * Authors: Andreas Bok Andersen, Mathias Lang * Standards: POSIX.1-2001. * See_Also: $(HTTP pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html, Standard) + * Source: $(DRUNTIMESRC core/sys/posix/mqueue.d) */ module core.sys.posix.mqueue; @@ -58,16 +59,17 @@ struct mq_attr * Note: * Linux prototypes are: * mqd_t mq_open (const(char)* name, int oflag); - * mqd_t mq_open(const(char)* name, int oflag, mode_t mode, mq_attr* attr); + * mqd_t mq_open (const(char)* name, int oflag, mode_t mode, mq_attr* attr); * * Params: * name = Name of the message queue to open. - * oflags = determines the type of access used. + * oflag = determines the type of access used. * If `O_CREAT` is on `oflag`, the third argument is taken as a * `mode_t`, the mode of the created message queue. * If `O_CREAT` is on `oflag`, the fourth argument is taken as * a pointer to a `mq_attr' (message queue attributes). * If the fourth argument is `null`, default attributes are used. + * ... = varargs matching the function prototypes * * Returns: * Message queue descriptor or (mqd_t) -1 on error. diff --git a/libphobos/libdruntime/core/sys/posix/pthread.d b/libphobos/libdruntime/core/sys/posix/pthread.d index 577fb71ace1..395ed0f7e91 100644 --- a/libphobos/libdruntime/core/sys/posix/pthread.d +++ b/libphobos/libdruntime/core/sys/posix/pthread.d @@ -291,7 +291,7 @@ else version (OpenBSD) } enum PTHREAD_MUTEX_INITIALIZER = null; - //enum PTHREAD_ONCE_INIT = { PTHREAD_NEEDS_INIT, PTHREAD_MUTEX_INITIALIZER }; + enum PTHREAD_ONCE_INIT = pthread_once_t.init; enum PTHREAD_COND_INITIALIZER = null; enum PTHREAD_RWLOCK_INITIALIZER = null; } @@ -330,7 +330,6 @@ else version (DragonFlyBSD) enum PTHREAD_DONE_INIT = 1; enum PTHREAD_MUTEX_INITIALIZER = null; - //enum PTHREAD_ONCE_INIT = { PTHREAD_NEEDS_INIT, NULL }; enum PTHREAD_ONCE_INIT = pthread_once_t.init; enum PTHREAD_COND_INITIALIZER = null; enum PTHREAD_RWLOCK_INITIALIZER = null; diff --git a/libphobos/libdruntime/core/sys/posix/sys/statvfs.d b/libphobos/libdruntime/core/sys/posix/sys/statvfs.d index aeaf5bce3fa..49c84508b9a 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/statvfs.d +++ b/libphobos/libdruntime/core/sys/posix/sys/statvfs.d @@ -159,107 +159,6 @@ else version (OpenBSD) } else version (FreeBSD) { - import core.sys.freebsd.sys.mount; - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - alias MFSNAMELEN = core.sys.freebsd.sys.mount.MFSNAMELEN; - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - alias MNAMELEN = core.sys.freebsd.sys.mount.MNAMELEN; - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - alias fsid_t = core.sys.freebsd.sys.mount.fsid_t; - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - alias statfs_t = core.sys.freebsd.sys.mount.statfs_t; - - // @@@DEPRECATED_2.091@@@ - deprecated("Values moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - enum FFlag - { - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_RDONLY = 1, /* read only filesystem */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_SYNCHRONOUS = 2, /* fs written synchronously */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_NOEXEC = 4, /* can't exec from filesystem */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_NOSUID = 8, /* don't honor setuid fs bits */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_NFS4ACLS = 16, /* enable NFS version 4 ACLs */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_UNION = 32, /* union with underlying fs */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_ASYNC = 64, /* fs written asynchronously */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_SUIDDIR = 128, /* special SUID dir handling */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_SOFTDEP = 256, /* using soft updates */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_NOSYMFOLLOW = 512, /* do not follow symlinks */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_GJOURNAL = 1024, /* GEOM journal support enabled */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_MULTILABEL = 2048, /* MAC support for objects */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_ACLS = 4096, /* ACL support enabled */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_NOATIME = 8192, /* dont update file access time */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_NOCLUSTERR = 16384, /* disable cluster read */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_NOCLUSTERW = 32768, /* disable cluster write */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_SUJ = 65536, /* using journaled soft updates */ - - // @@@DEPRECATED_2.091@@@ - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - MNT_AUTOMOUNTED = 131072 /* mounted by automountd(8) */ - } - - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - alias statfs = core.sys.freebsd.sys.mount.statfs; - - deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h") - alias fstatfs = core.sys.freebsd.sys.mount.fstatfs; - struct statvfs_t { fsblkcnt_t f_bavail; diff --git a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d index 8e84ddb4c60..abcea99019f 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/types.d +++ b/libphobos/libdruntime/core/sys/posix/sys/types.d @@ -1103,7 +1103,14 @@ else version (DragonFlyBSD) alias void* pthread_key_t; alias void* pthread_mutex_t; alias void* pthread_mutexattr_t; - alias void* pthread_once_t; + + private struct pthread_once + { + int state; + pthread_mutex_t mutex; + } + alias pthread_once pthread_once_t; + alias void* pthread_rwlock_t; alias void* pthread_rwlockattr_t; alias void* pthread_t; diff --git a/libphobos/libdruntime/core/sys/solaris/stdlib.d b/libphobos/libdruntime/core/sys/solaris/stdlib.d new file mode 100644 index 00000000000..0b6fffe8646 --- /dev/null +++ b/libphobos/libdruntime/core/sys/solaris/stdlib.d @@ -0,0 +1,17 @@ +/** + * D header file for Solaris stdlib.h. + * + * Copyright: Copyright © 2021, The D Language Foundation + * License: Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.solaris.stdlib; +public import core.sys.posix.stdlib; + +version (Solaris): +extern (C): +nothrow: +@nogc: + +const(char)* getprogname(); +void setprogname(scope const char* name); diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE index 1d8f8dfb46d..6de04b453ff 100644 --- a/libphobos/src/MERGE +++ b/libphobos/src/MERGE @@ -1,4 +1,4 @@ -3dd5df6864b3849450d3657e219b90909663a513 +9d575282edeccecbc061e615bf2486fd07e8c084 The first line of this file holds the git revision number of the last merge done from the dlang/phobos repository. diff --git a/libphobos/src/std/conv.d b/libphobos/src/std/conv.d index 743d203b2bb..31cc6517173 100644 --- a/libphobos/src/std/conv.d +++ b/libphobos/src/std/conv.d @@ -3148,8 +3148,6 @@ if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum { version (CRuntime_Microsoft) ld1 = 0x1.FFFFFFFFFFFFFFFEp-16382L; // strtold currently mapped to strtod - else version (CRuntime_Bionic) - ld1 = 0x1.FFFFFFFFFFFFFFFEp-16382L; // strtold currently mapped to strtod else ld1 = strtold(s.ptr, null); } diff --git a/libphobos/src/std/datetime/systime.d b/libphobos/src/std/datetime/systime.d index 0b11ed96745..b2291910616 100644 --- a/libphobos/src/std/datetime/systime.d +++ b/libphobos/src/std/datetime/systime.d @@ -7,6 +7,15 @@ +/ module std.datetime.systime; +version (OSX) + version = Darwin; +else version (iOS) + version = Darwin; +else version (TVOS) + version = Darwin; +else version (WatchOS) + version = Darwin; + import core.time; import std.datetime.date; import std.datetime.timezone; @@ -161,18 +170,19 @@ public: static import core.stdc.time; enum hnsecsToUnixEpoch = unixTimeToStdTime(0); - version (OSX) + version (Darwin) { static if (clockType == ClockType.second) return unixTimeToStdTime(core.stdc.time.time(null)); else { import core.sys.posix.sys.time : gettimeofday, timeval; - timeval tv; - if (gettimeofday(&tv, null) != 0) - throw new TimeException("Call to gettimeofday() failed"); + timeval tv = void; + // Posix gettimeofday called with a valid timeval address + // and a null second parameter doesn't fail. + gettimeofday(&tv, null); return convert!("seconds", "hnsecs")(tv.tv_sec) + - convert!("usecs", "hnsecs")(tv.tv_usec) + + tv.tv_usec * 10 + hnsecsToUnixEpoch; } } @@ -188,9 +198,16 @@ public: else static if (clockType == ClockType.normal) alias clockArg = CLOCK_REALTIME; else static if (clockType == ClockType.precise) alias clockArg = CLOCK_REALTIME; else static assert(0, "Previous static if is wrong."); - timespec ts; - if (clock_gettime(clockArg, &ts) != 0) - throw new TimeException("Call to clock_gettime() failed"); + timespec ts = void; + immutable error = clock_gettime(clockArg, &ts); + // Posix clock_gettime called with a valid address and valid clock_id is only + // permitted to fail if the number of seconds does not fit in time_t. If tv_sec + // is long or larger overflow won't happen before 292 billion years A.D. + static if (ts.tv_sec.max < long.max) + { + if (error) + throw new TimeException("Call to clock_gettime() failed"); + } return convert!("seconds", "hnsecs")(ts.tv_sec) + ts.tv_nsec / 100 + hnsecsToUnixEpoch; @@ -205,9 +222,16 @@ public: else static if (clockType == ClockType.precise) alias clockArg = CLOCK_REALTIME_PRECISE; else static if (clockType == ClockType.second) alias clockArg = CLOCK_SECOND; else static assert(0, "Previous static if is wrong."); - timespec ts; - if (clock_gettime(clockArg, &ts) != 0) - throw new TimeException("Call to clock_gettime() failed"); + timespec ts = void; + immutable error = clock_gettime(clockArg, &ts); + // Posix clock_gettime called with a valid address and valid clock_id is only + // permitted to fail if the number of seconds does not fit in time_t. If tv_sec + // is long or larger overflow won't happen before 292 billion years A.D. + static if (ts.tv_sec.max < long.max) + { + if (error) + throw new TimeException("Call to clock_gettime() failed"); + } return convert!("seconds", "hnsecs")(ts.tv_sec) + ts.tv_nsec / 100 + hnsecsToUnixEpoch; @@ -218,12 +242,38 @@ public: return unixTimeToStdTime(core.stdc.time.time(null)); else { - import core.sys.posix.sys.time : gettimeofday, timeval; - timeval tv; - if (gettimeofday(&tv, null) != 0) - throw new TimeException("Call to gettimeofday() failed"); - return convert!("seconds", "hnsecs")(tv.tv_sec) + - convert!("usecs", "hnsecs")(tv.tv_usec) + + import core.sys.netbsd.time : clock_gettime, CLOCK_REALTIME; + timespec ts = void; + immutable error = clock_gettime(CLOCK_REALTIME, &ts); + // Posix clock_gettime called with a valid address and valid clock_id is only + // permitted to fail if the number of seconds does not fit in time_t. If tv_sec + // is long or larger overflow won't happen before 292 billion years A.D. + static if (ts.tv_sec.max < long.max) + { + if (error) + throw new TimeException("Call to clock_gettime() failed"); + } + return convert!("seconds", "hnsecs")(ts.tv_sec) + + ts.tv_nsec / 100 + + hnsecsToUnixEpoch; + } + } + else version (OpenBSD) + { + static if (clockType == ClockType.second) + return unixTimeToStdTime(core.stdc.time.time(null)); + else + { + import core.sys.openbsd.time : clock_gettime, CLOCK_REALTIME; + static if (clockType == ClockType.coarse) alias clockArg = CLOCK_REALTIME; + else static if (clockType == ClockType.normal) alias clockArg = CLOCK_REALTIME; + else static if (clockType == ClockType.precise) alias clockArg = CLOCK_REALTIME; + else static assert(0, "Previous static if is wrong."); + timespec ts; + if (clock_gettime(clockArg, &ts) != 0) + throw new TimeException("Call to clock_gettime() failed"); + return convert!("seconds", "hnsecs")(ts.tv_sec) + + ts.tv_nsec / 100 + hnsecsToUnixEpoch; } } @@ -236,9 +286,16 @@ public: else static if (clockType == ClockType.precise) alias clockArg = CLOCK_REALTIME_PRECISE; else static if (clockType == ClockType.second) alias clockArg = CLOCK_SECOND; else static assert(0, "Previous static if is wrong."); - timespec ts; - if (clock_gettime(clockArg, &ts) != 0) - throw new TimeException("Call to clock_gettime() failed"); + timespec ts = void; + immutable error = clock_gettime(clockArg, &ts); + // Posix clock_gettime called with a valid address and valid clock_id is only + // permitted to fail if the number of seconds does not fit in time_t. If tv_sec + // is long or larger overflow won't happen before 292 billion years A.D. + static if (ts.tv_sec.max < long.max) + { + if (error) + throw new TimeException("Call to clock_gettime() failed"); + } return convert!("seconds", "hnsecs")(ts.tv_sec) + ts.tv_nsec / 100 + hnsecsToUnixEpoch; @@ -254,9 +311,16 @@ public: else static if (clockType == ClockType.normal) alias clockArg = CLOCK_REALTIME; else static if (clockType == ClockType.precise) alias clockArg = CLOCK_REALTIME; else static assert(0, "Previous static if is wrong."); - timespec ts; - if (clock_gettime(clockArg, &ts) != 0) - throw new TimeException("Call to clock_gettime() failed"); + timespec ts = void; + immutable error = clock_gettime(clockArg, &ts); + // Posix clock_gettime called with a valid address and valid clock_id is only + // permitted to fail if the number of seconds does not fit in time_t. If tv_sec + // is long or larger overflow won't happen before 292 billion years A.D. + static if (ts.tv_sec.max < long.max) + { + if (error) + throw new TimeException("Call to clock_gettime() failed"); + } return convert!("seconds", "hnsecs")(ts.tv_sec) + ts.tv_nsec / 100 + hnsecsToUnixEpoch; diff --git a/libphobos/src/std/datetime/timezone.d b/libphobos/src/std/datetime/timezone.d index 7ae19020243..9b744ff7ab0 100644 --- a/libphobos/src/std/datetime/timezone.d +++ b/libphobos/src/std/datetime/timezone.d @@ -14,6 +14,15 @@ import std.exception : enforce; import std.range.primitives; import std.traits : isIntegral, isSomeString, Unqual; +version (OSX) + version = Darwin; +else version (iOS) + version = Darwin; +else version (TVOS) + version = Darwin; +else version (WatchOS) + version = Darwin; + version (Windows) { import core.stdc.time : time_t; @@ -296,7 +305,7 @@ public: else version (NetBSD) enum utcZone = "UTC"; else version (DragonFlyBSD) enum utcZone = "UTC"; else version (linux) enum utcZone = "UTC"; - else version (OSX) enum utcZone = "UTC"; + else version (Darwin) enum utcZone = "UTC"; else version (Solaris) enum utcZone = "UTC"; else static assert(0, "The location of the UTC timezone file on this Posix platform must be set."); @@ -671,7 +680,11 @@ public: @safe unittest { - assert(LocalTime().dstName !is null); + // tzname, called from dstName, isn't set by default for Musl. + version (CRuntime_Musl) + assert(LocalTime().dstName is null); + else + assert(LocalTime().dstName !is null); version (Posix) { diff --git a/libphobos/src/std/exception.d b/libphobos/src/std/exception.d index 73afadc07e0..56133c9ad89 100644 --- a/libphobos/src/std/exception.d +++ b/libphobos/src/std/exception.d @@ -1478,10 +1478,13 @@ private bool isUnionAliasedImpl(T)(size_t offset) static assert( isUnionAliased!(S.A5, 1)); //a5.b1; } +version (CRuntime_Glibc) version = GNU_STRERROR; +version (CRuntime_UClibc) version = GNU_STRERROR; + package string errnoString(int errno) nothrow @trusted { import core.stdc.string : strlen; - version (CRuntime_Glibc) + version (GNU_STRERROR) { import core.stdc.string : strerror_r; char[1024] buf = void; diff --git a/libphobos/src/std/experimental/allocator/building_blocks/region.d b/libphobos/src/std/experimental/allocator/building_blocks/region.d index 835d0937cec..53f5ef988d4 100644 --- a/libphobos/src/std/experimental/allocator/building_blocks/region.d +++ b/libphobos/src/std/experimental/allocator/building_blocks/region.d @@ -5,6 +5,15 @@ import std.experimental.allocator.building_blocks.null_allocator; import std.experimental.allocator.common; import std.typecons : Flag, Yes, No; +version (OSX) + version = Darwin; +else version (iOS) + version = Darwin; +else version (TVOS) + version = Darwin; +else version (WatchOS) + version = Darwin; + /** A $(D Region) allocator allocates memory straight from one contiguous chunk. There is no deallocation, and once the region is full, allocation requests @@ -580,14 +589,26 @@ struct InSituRegion(size_t size, size_t minAlign = platformAlignment) assert(a.length == 2001); } -version(CRuntime_Musl) +version (CRuntime_Musl) { // sbrk and brk are disabled in Musl: // https://git.musl-libc.org/cgit/musl/commit/?id=7a995fe706e519a4f55399776ef0df9596101f93 // https://git.musl-libc.org/cgit/musl/commit/?id=863d628d93ea341b6a32661a1654320ce69f6a07 -} else: -private extern(C) void* sbrk(long); -private extern(C) int brk(shared void*); +} +version (DragonFlyBSD) +{ + // sbrk is deprecated in favor of mmap (we could implement a mmap + MAP_NORESERVE + PROT_NONE version) + // brk has been removed + // https://www.dragonflydigest.com/2019/02/22/22586.html + // http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/dc676eaefa61b0f47bbea1c53eab86fd5ccd78c6 + // http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4b5665564ef37dc939a3a9ffbafaab9894c18885 + // http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/8618d94a0e2ff8303ad93c123a3fa598c26a116e +} +else +{ + private extern(C) void* sbrk(long) nothrow @nogc; + private extern(C) int brk(shared void*) nothrow @nogc; +} /** @@ -599,11 +620,14 @@ that uncontrolled calls to $(D brk) and $(D sbrk) may affect the workings of $(D SbrkRegion) adversely. */ +version (CRuntime_Musl) {} else +version (DragonFlyBSD) {} else version (Posix) struct SbrkRegion(uint minAlign = platformAlignment) { import core.sys.posix.pthread : pthread_mutex_init, pthread_mutex_destroy, pthread_mutex_t, pthread_mutex_lock, pthread_mutex_unlock, - PTHREAD_MUTEX_INITIALIZER; + + PTHREAD_MUTEX_INITIALIZER; private static shared pthread_mutex_t sbrkMutex = PTHREAD_MUTEX_INITIALIZER; import std.typecons : Ternary; @@ -763,7 +787,9 @@ version (Posix) struct SbrkRegion(uint minAlign = platformAlignment) } } -version (Posix) @system unittest +version (CRuntime_Musl) {} else +version (DragonFlyBSD) {} else +version (Posix) @system nothrow @nogc unittest { // Let's test the assumption that sbrk(n) returns the old address const p1 = sbrk(0); @@ -775,7 +801,9 @@ version (Posix) @system unittest sbrk(-4096); } -version (Posix) @system unittest +version (CRuntime_Musl) {} else +version (DragonFlyBSD) {} else +version (Posix) @system nothrow @nogc unittest { import std.typecons : Ternary; alias alloc = SbrkRegion!(8).instance; @@ -786,7 +814,7 @@ version (Posix) @system unittest assert(alloc.owns(a) == Ternary.yes); assert(alloc.owns(b) == Ternary.yes); // reducing the brk does not work on OSX - version (OSX) {} else + version (Darwin) {} else { assert(alloc.deallocate(b)); assert(alloc.deallocateAll); diff --git a/libphobos/src/std/experimental/allocator/mmap_allocator.d b/libphobos/src/std/experimental/allocator/mmap_allocator.d index 945859b8c56..e07d444c32c 100644 --- a/libphobos/src/std/experimental/allocator/mmap_allocator.d +++ b/libphobos/src/std/experimental/allocator/mmap_allocator.d @@ -46,6 +46,21 @@ struct MmapAllocator if (b.ptr) munmap(b.ptr, b.length) == 0 || assert(0); return true; } + + // Anonymous mmap might be zero-filled on all Posix systems but + // not all commit to this in the documentation. + version (linux) + // http://man7.org/linux/man-pages/man2/mmap.2.html + package alias allocateZeroed = allocate; + else version (NetBSD) + // http://netbsd.gw.com/cgi-bin/man-cgi?mmap+2+NetBSD-current + package alias allocateZeroed = allocate; + else version (Solaris) + // https://docs.oracle.com/cd/E88353_01/html/E37841/mmap-2.html + package alias allocateZeroed = allocate; + else version (AIX) + // https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/com.ibm.aix.basetrf1/mmap.htm + package alias allocateZeroed = allocate; } else version (Windows) { @@ -67,6 +82,8 @@ struct MmapAllocator { return b.ptr is null || VirtualFree(b.ptr, 0, MEM_RELEASE) != 0; } + + package alias allocateZeroed = allocate; } } diff --git a/libphobos/src/std/file.d b/libphobos/src/std/file.d index 380ecfc2bcd..13a3db0ff66 100644 --- a/libphobos/src/std/file.d +++ b/libphobos/src/std/file.d @@ -1490,6 +1490,15 @@ if (isInputRange!R && !isInfinite!R && isSomeChar!(ElementEncodingType!R)) // vfs.timestamp_precision sysctl to a value greater than zero. // - OS X, where the native filesystem (HFS+) stores filesystem // timestamps with 1-second precision. +// +// Note: on linux systems, although in theory a change to a file date +// can be tracked with precision of 4 msecs, this test waits 20 msecs +// to prevent possible problems relative to the CI services the dlang uses, +// as they may have the HZ setting that controls the software clock set to 100 +// (instead of the more common 250). +// see https://man7.org/linux/man-pages/man7/time.7.html +// https://stackoverflow.com/a/14393315, +// https://issues.dlang.org/show_bug.cgi?id=21148 version (FreeBSD) {} else version (DragonFlyBSD) {} else version (OSX) {} else @@ -1508,7 +1517,7 @@ version (OSX) {} else remove(deleteme); assert(time != lastTime); lastTime = time; - Thread.sleep(10.msecs); + Thread.sleep(20.msecs); } } @@ -2757,15 +2766,27 @@ else version (NetBSD) buffer.length *= 2; } } + else version (DragonFlyBSD) + { + import core.sys.dragonflybsd.sys.sysctl : sysctl, CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME; + import std.exception : errnoEnforce, assumeUnique; + + int[4] mib = [CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1]; + size_t len; + + auto result = sysctl(mib.ptr, mib.length, null, &len, null, 0); // get the length of the path + errnoEnforce(result == 0); + + auto buffer = new char[len - 1]; + result = sysctl(mib.ptr, mib.length, buffer.ptr, &len, null, 0); + errnoEnforce(result == 0); + + return buffer.assumeUnique; + } else version (FreeBSD) { + import core.sys.freebsd.sys.sysctl : sysctl, CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME; import std.exception : errnoEnforce, assumeUnique; - enum - { - CTL_KERN = 1, - KERN_PROC = 14, - KERN_PROC_PATHNAME = 12 - } int[4] mib = [CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1]; size_t len; @@ -2781,11 +2802,58 @@ else version (NetBSD) } else version (NetBSD) { - return readLink("/proc/self/exe"); + import core.sys.netbsd.sys.sysctl : sysctl, CTL_KERN, KERN_PROC_ARGS, KERN_PROC_PATHNAME; + import std.exception : errnoEnforce, assumeUnique; + + int[4] mib = [CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME]; + size_t len; + + auto result = sysctl(mib.ptr, mib.length, null, &len, null, 0); // get the length of the path + errnoEnforce(result == 0); + + auto buffer = new char[len - 1]; + result = sysctl(mib.ptr, mib.length, buffer.ptr, &len, null, 0); + errnoEnforce(result == 0); + + return buffer.assumeUnique; } - else version (DragonFlyBSD) + else version (OpenBSD) { - return readLink("/proc/curproc/file"); + import core.sys.openbsd.sys.sysctl : sysctl, CTL_KERN, KERN_PROC_ARGS, KERN_PROC_ARGV; + import core.sys.posix.unistd : getpid; + import std.conv : to; + import std.exception : enforce, errnoEnforce; + import std.process : searchPathFor; + + int[4] mib = [CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV]; + size_t len; + + auto result = sysctl(mib.ptr, mib.length, null, &len, null, 0); + errnoEnforce(result == 0); + + auto argv = new char*[len - 1]; + result = sysctl(mib.ptr, mib.length, argv.ptr, &len, null, 0); + errnoEnforce(result == 0); + + auto argv0 = argv[0]; + if (*argv0 == '/' || *argv0 == '.') + { + import core.sys.posix.stdlib : realpath; + auto absolutePath = realpath(argv0, null); + scope (exit) + { + if (absolutePath) + free(absolutePath); + } + errnoEnforce(absolutePath); + return to!(string)(absolutePath); + } + else + { + auto absolutePath = searchPathFor(to!string(argv0)); + errnoEnforce(absolutePath); + return absolutePath; + } } else version (Solaris) { diff --git a/libphobos/src/std/math.d b/libphobos/src/std/math.d index 3d18cfa528b..ff368b79f9d 100644 --- a/libphobos/src/std/math.d +++ b/libphobos/src/std/math.d @@ -167,19 +167,14 @@ version (SystemZ) version = IBMZ_Any; version (RISCV32) version = RISCV_Any; version (RISCV64) version = RISCV_Any; -version (D_InlineAsm_X86) -{ - version = InlineAsm_X86_Any; -} -else version (D_InlineAsm_X86_64) -{ - version = InlineAsm_X86_Any; -} +version (D_InlineAsm_X86) version = InlineAsm_X86_Any; +version (D_InlineAsm_X86_64) version = InlineAsm_X86_Any; -version (CRuntime_Microsoft) +version (InlineAsm_X86_Any) version = InlineAsm_X87; +version (InlineAsm_X87) { - version (InlineAsm_X86_Any) - version = MSVC_InlineAsm; + static assert(real.mant_dig == 64); + version (CRuntime_Microsoft) version = InlineAsm_X87_MSVC; } version (X86_64) version = StaticallyHaveSSE; @@ -3610,7 +3605,7 @@ real log1p(real x) @safe pure nothrow @nogc real log2(real x) @safe pure nothrow @nogc { version (INLINE_YL2X) - return core.math.yl2x(x, 1); + return core.math.yl2x(x, 1.0L); else { // Special cases are the same as for log. @@ -4586,19 +4581,21 @@ real round(real x) @trusted nothrow @nogc * If the fractional part of x is exactly 0.5, the return value is rounded * away from zero. * - * $(BLUE This function is Posix-Only.) + * $(BLUE This function is not implemented for Digital Mars C runtime.) */ long lround(real x) @trusted nothrow @nogc { - version (Posix) - return core.stdc.math.llroundl(x); - else + version (CRuntime_DigitalMars) assert(0, "lround not implemented"); + else + return core.stdc.math.llroundl(x); } -version (Posix) +/// +@safe nothrow @nogc unittest { - @safe nothrow @nogc unittest + version (CRuntime_DigitalMars) {} + else { assert(lround(0.49) == 0); assert(lround(0.5) == 1); diff --git a/libphobos/src/std/parallelism.d b/libphobos/src/std/parallelism.d index 64fa2f93c7e..43a1ba59527 100644 --- a/libphobos/src/std/parallelism.d +++ b/libphobos/src/std/parallelism.d @@ -40,6 +40,15 @@ License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0) */ module std.parallelism; +version (OSX) + version = Darwin; +else version (iOS) + version = Darwin; +else version (TVOS) + version = Darwin; +else version (WatchOS) + version = Darwin; + /// @system unittest { @@ -86,107 +95,82 @@ import std.meta; import std.range.primitives; import std.traits; -version (OSX) -{ - version = useSysctlbyname; -} -else version (FreeBSD) -{ - version = useSysctlbyname; -} -else version (DragonFlyBSD) -{ - version = useSysctlbyname; -} -else version (NetBSD) -{ - version = useSysctlbyname; -} +/* +(For now public undocumented with reserved name.) +A lazily initialized global constant. The underlying value is a shared global +statically initialized to `outOfBandValue` which must not be a legit value of +the constant. Upon the first call the situation is detected and the global is +initialized by calling `initializer`. The initializer is assumed to be pure +(even if not marked as such), i.e. return the same value upon repeated calls. +For that reason, no special precautions are taken so `initializer` may be called +more than one time leading to benign races on the cached value. -version (Windows) -{ - // BUGS: Only works on Windows 2000 and above. - shared static this() - { - import core.sys.windows.windows : SYSTEM_INFO, GetSystemInfo; - import std.algorithm.comparison : max; +In the quiescent state the cost of the function is an atomic load from a global. - SYSTEM_INFO si; - GetSystemInfo(&si); - totalCPUs = max(1, cast(uint) si.dwNumberOfProcessors); - } +Params: + T = The type of the pseudo-constant (may be qualified) + outOfBandValue = A value that cannot be valid, it is used for initialization + initializer = The function performing initialization; must be `nothrow` -} -else version (linux) -{ - shared static this() - { - import core.sys.posix.unistd : _SC_NPROCESSORS_ONLN, sysconf; - totalCPUs = cast(uint) sysconf(_SC_NPROCESSORS_ONLN); - } -} -else version (Solaris) -{ - shared static this() - { - import core.sys.posix.unistd : _SC_NPROCESSORS_ONLN, sysconf; - totalCPUs = cast(uint) sysconf(_SC_NPROCESSORS_ONLN); - } -} -else version (useSysctlbyname) +Returns: + The lazily initialized value +*/ +@property pure +T __lazilyInitializedConstant(T, alias outOfBandValue, alias initializer)() +if (is(Unqual!T : T) + && is(typeof(initializer()) : T) + && is(typeof(outOfBandValue) : T)) { - extern(C) int sysctlbyname( - const char *, void *, size_t *, void *, size_t - ); - - shared static this() - { - version (OSX) - { - auto nameStr = "machdep.cpu.core_count\0".ptr; - } - else version (FreeBSD) + static T impl() nothrow + { + // Thread-local cache + static Unqual!T tls = outOfBandValue; + auto local = tls; + // Shortest path, no atomic operations + if (local != outOfBandValue) return local; + // Process-level cache + static shared Unqual!T result = outOfBandValue; + // Initialize both process-level cache and tls + local = atomicLoad(result); + if (local == outOfBandValue) { - auto nameStr = "hw.ncpu\0".ptr; + local = initializer(); + atomicStore(result, local); } - else version (DragonFlyBSD) - { - auto nameStr = "hw.ncpu\0".ptr; - } - else version (NetBSD) - { - auto nameStr = "hw.ncpu\0".ptr; - } - - uint ans; - size_t len = uint.sizeof; - sysctlbyname(nameStr, &ans, &len, null, 0); - totalCPUs = ans; + tls = local; + return local; } + import std.traits : SetFunctionAttributes; + alias Fun = SetFunctionAttributes!(typeof(&impl), "D", + functionAttributes!(typeof(&impl)) | FunctionAttribute.pure_); + auto purified = (() @trusted => cast(Fun) &impl)(); + return purified(); } -else -{ - static assert(0, "Don't know how to get N CPUs on this OS."); -} -immutable size_t cacheLineSize; -shared static this() +// Returns the size of a cache line. +alias cacheLineSize = + __lazilyInitializedConstant!(immutable(size_t), size_t.max, cacheLineSizeImpl); + +private size_t cacheLineSizeImpl() @nogc nothrow @trusted { + size_t result = 0; import core.cpuid : datacache; - size_t lineSize = 0; - foreach (cachelevel; datacache) + foreach (ref const cachelevel; datacache) { - if (cachelevel.lineSize > lineSize && cachelevel.lineSize < uint.max) + if (cachelevel.lineSize > result && cachelevel.lineSize < uint.max) { - lineSize = cachelevel.lineSize; + result = cachelevel.lineSize; } } - - cacheLineSize = lineSize; + return result; } +@nogc @safe nothrow unittest +{ + assert(cacheLineSize == cacheLineSizeImpl); +} /* Atomics code. These forward to core.atomic, but are written like this for two reasons: @@ -957,7 +941,81 @@ if (is(typeof(fun(args))) && isSafeTask!F) The total number of CPU cores available on the current machine, as reported by the operating system. */ -immutable uint totalCPUs; +alias totalCPUs = + __lazilyInitializedConstant!(immutable(uint), uint.max, totalCPUsImpl); + +uint totalCPUsImpl() @nogc nothrow @trusted +{ + version (Windows) + { + // BUGS: Only works on Windows 2000 and above. + import core.sys.windows.winbase : SYSTEM_INFO, GetSystemInfo; + import std.algorithm.comparison : max; + SYSTEM_INFO si; + GetSystemInfo(&si); + return max(1, cast(uint) si.dwNumberOfProcessors); + } + else version (linux) + { + import core.sys.linux.sched : CPU_COUNT, cpu_set_t, sched_getaffinity; + import core.sys.posix.unistd : _SC_NPROCESSORS_ONLN, sysconf; + + cpu_set_t set = void; + if (sched_getaffinity(0, cpu_set_t.sizeof, &set) == 0) + { + int count = CPU_COUNT(&set); + if (count > 0) + return cast(uint) count; + } + return cast(uint) sysconf(_SC_NPROCESSORS_ONLN); + } + else version (Darwin) + { + import core.sys.darwin.sys.sysctl : sysctlbyname; + uint result; + size_t len = result.sizeof; + sysctlbyname("hw.physicalcpu", &result, &len, null, 0); + return result; + } + else version (DragonFlyBSD) + { + import core.sys.dragonflybsd.sys.sysctl : sysctlbyname; + uint result; + size_t len = result.sizeof; + sysctlbyname("hw.ncpu", &result, &len, null, 0); + return result; + } + else version (FreeBSD) + { + import core.sys.freebsd.sys.sysctl : sysctlbyname; + uint result; + size_t len = result.sizeof; + sysctlbyname("hw.ncpu", &result, &len, null, 0); + return result; + } + else version (NetBSD) + { + import core.sys.netbsd.sys.sysctl : sysctlbyname; + uint result; + size_t len = result.sizeof; + sysctlbyname("hw.ncpu", &result, &len, null, 0); + return result; + } + else version (Solaris) + { + import core.sys.posix.unistd : _SC_NPROCESSORS_ONLN, sysconf; + return cast(uint) sysconf(_SC_NPROCESSORS_ONLN); + } + else version (OpenBSD) + { + import core.sys.posix.unistd : _SC_NPROCESSORS_ONLN, sysconf; + return cast(uint) sysconf(_SC_NPROCESSORS_ONLN); + } + else + { + static assert(0, "Don't know how to get N CPUs on this OS."); + } +} /* This class serves two purposes: @@ -3302,11 +3360,7 @@ terminating the main thread. }()); } -private shared uint _defaultPoolThreads; -shared static this() -{ - atomicStore(_defaultPoolThreads, totalCPUs - 1); -} +private shared uint _defaultPoolThreads = uint.max; /** These properties get and set the number of worker threads in the $(D TaskPool) @@ -3316,7 +3370,8 @@ number of worker threads in the instance returned by $(D taskPool). */ @property uint defaultPoolThreads() @trusted { - return atomicLoad(_defaultPoolThreads); + const local = atomicLoad(_defaultPoolThreads); + return local < uint.max ? local : totalCPUs - 1; } /// Ditto diff --git a/libphobos/src/std/socket.d b/libphobos/src/std/socket.d index a4ba39c8336..ecb2c8b916e 100644 --- a/libphobos/src/std/socket.d +++ b/libphobos/src/std/socket.d @@ -146,6 +146,8 @@ class SocketException: Exception mixin basicExceptionCtors; } +version (CRuntime_Glibc) version = GNU_STRERROR; +version (CRuntime_UClibc) version = GNU_STRERROR; /* * Needs to be public so that SocketOSException can be thrown outside of @@ -159,7 +161,7 @@ string formatSocketError(int err) @trusted { char[80] buf; const(char)* cs; - version (CRuntime_Glibc) + version (GNU_STRERROR) { cs = strerror_r(err, buf.ptr, buf.length); } diff --git a/libphobos/src/std/stdio.d b/libphobos/src/std/stdio.d index c59bc4c219b..bbf785773d4 100644 --- a/libphobos/src/std/stdio.d +++ b/libphobos/src/std/stdio.d @@ -79,6 +79,10 @@ else version (NetBSD) { version = GENERIC_IO; } +else version (OpenBSD) +{ + version = GENERIC_IO; +} else version (DragonFlyBSD) { version = GENERIC_IO; @@ -93,12 +97,11 @@ version (Windows) { private alias FSChar = wchar; } -else version (Posix) +else { private alias FSChar = char; } -else - static assert(0); + version (Windows) { diff --git a/libphobos/src/std/system.d b/libphobos/src/std/system.d index e0b3dee8dae..353d692848a 100644 --- a/libphobos/src/std/system.d +++ b/libphobos/src/std/system.d @@ -30,6 +30,9 @@ immutable win64, /// Microsoft 64 bit Windows systems linux, /// All Linux Systems, except for Android osx, /// Mac OS X + iOS, /// iOS + tvOS, /// tvOS + watchOS, /// watchOS freeBSD, /// FreeBSD netBSD, /// NetBSD dragonFlyBSD, /// DragonFlyBSD @@ -44,6 +47,9 @@ immutable else version (Android) OS os = OS.android; else version (linux) OS os = OS.linux; else version (OSX) OS os = OS.osx; + else version (iOS) OS os = OS.iOS; + else version (tvOS) OS os = OS.tvOS; + else version (watchOS) OS os = OS.watchOS; else version (FreeBSD) OS os = OS.freeBSD; else version (NetBSD) OS os = OS.netBSD; else version (DragonFlyBSD) OS os = OS.dragonFlyBSD;