Commit 1e78c638 by Iain Buclaw Committed by Iain Buclaw

libphobos: Merge upstream druntime 5bb8ce19

Synchronizes extern(C) bindings with latest release.

Reviewed-on: https://github.com/dlang/druntime/pull/2741

libphobos/ChangeLog:

	* libdruntime/Makefile.am (DRUNTIME_DSOURCES_BIONIC): Add
	core/sys/bionic/string.d.
	(DRUNTIME_DSOURCES_DARWIN): Add core/sys/darwin/string.d.
	(DRUNTIME_DSOURCES_DRAGONFLYBSD): Add core/sys/dragonflybsd/string.d,
	core/sys/dragonflybsd/sys/socket.d.
	(DRUNTIME_DSOURCES_FREEBSD): Add core/sys/freebsd/string.d.
	(DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/string.d.
	(DRUNTIME_DSOURCES_NETBSD): Add core/sys/netbsd/string.d,
	core/sys/netbsd/sys/featuretest.d.
	* libdruntime/Makefile.in: Regenerate.

From-SVN: r274773
parent 0234a917
2019-08-20 Iain Buclaw <ibuclaw@gdcproject.org> 2019-08-20 Iain Buclaw <ibuclaw@gdcproject.org>
* libdruntime/Makefile.am (DRUNTIME_DSOURCES_BIONIC): Add
core/sys/bionic/string.d.
(DRUNTIME_DSOURCES_DARWIN): Add core/sys/darwin/string.d.
(DRUNTIME_DSOURCES_DRAGONFLYBSD): Add core/sys/dragonflybsd/string.d,
core/sys/dragonflybsd/sys/socket.d.
(DRUNTIME_DSOURCES_FREEBSD): Add core/sys/freebsd/string.d.
(DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/string.d.
(DRUNTIME_DSOURCES_NETBSD): Add core/sys/netbsd/string.d,
core/sys/netbsd/sys/featuretest.d.
* libdruntime/Makefile.in: Regenerate.
2019-08-20 Iain Buclaw <ibuclaw@gdcproject.org>
* libdruntime/Makefile.am (DRUNTIME_DSOURCES_OPENBSD): Add * libdruntime/Makefile.am (DRUNTIME_DSOURCES_OPENBSD): Add
core/sys/openbsd/sys/cdefs.d, core/sys/openbsd/sys/elf.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/elf32.d, core/sys/openbsd/sys/elf64.d,
......
94686651757294d608cfd5f053fda09dcf86695e 5bb8ce19fa495e5f794b3c513ae1bf7aabae93ff
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the dlang/druntime repository. merge done from the dlang/druntime repository.
...@@ -198,7 +198,7 @@ DRUNTIME_DSOURCES_GC = gc/bits.d gc/config.d gc/gcinterface.d \ ...@@ -198,7 +198,7 @@ DRUNTIME_DSOURCES_GC = gc/bits.d gc/config.d gc/gcinterface.d \
DRUNTIME_DSOURCES_GCSTUB = gcstub/gc.d DRUNTIME_DSOURCES_GCSTUB = gcstub/gc.d
DRUNTIME_DSOURCES_BIONIC = core/sys/bionic/fcntl.d \ DRUNTIME_DSOURCES_BIONIC = core/sys/bionic/fcntl.d \
core/sys/bionic/unistd.d core/sys/bionic/string.d core/sys/bionic/unistd.d
DRUNTIME_DSOURCES_DARWIN = core/sys/darwin/crt_externs.d \ DRUNTIME_DSOURCES_DARWIN = core/sys/darwin/crt_externs.d \
core/sys/darwin/dlfcn.d core/sys/darwin/execinfo.d \ core/sys/darwin/dlfcn.d core/sys/darwin/execinfo.d \
...@@ -206,35 +206,39 @@ DRUNTIME_DSOURCES_DARWIN = core/sys/darwin/crt_externs.d \ ...@@ -206,35 +206,39 @@ DRUNTIME_DSOURCES_DARWIN = core/sys/darwin/crt_externs.d \
core/sys/darwin/mach/kern_return.d core/sys/darwin/mach/loader.d \ core/sys/darwin/mach/kern_return.d core/sys/darwin/mach/loader.d \
core/sys/darwin/mach/port.d core/sys/darwin/mach/semaphore.d \ core/sys/darwin/mach/port.d core/sys/darwin/mach/semaphore.d \
core/sys/darwin/mach/thread_act.d core/sys/darwin/netinet/in_.d \ core/sys/darwin/mach/thread_act.d core/sys/darwin/netinet/in_.d \
core/sys/darwin/pthread.d core/sys/darwin/sys/cdefs.d \ core/sys/darwin/pthread.d core/sys/darwin/string.d \
core/sys/darwin/sys/event.d core/sys/darwin/sys/mman.d core/sys/darwin/sys/cdefs.d core/sys/darwin/sys/event.d \
core/sys/darwin/sys/mman.d
DRUNTIME_DSOURCES_DRAGONFLYBSD = core/sys/dragonflybsd/dlfcn.d \ DRUNTIME_DSOURCES_DRAGONFLYBSD = core/sys/dragonflybsd/dlfcn.d \
core/sys/dragonflybsd/execinfo.d core/sys/dragonflybsd/netinet/in_.d \ core/sys/dragonflybsd/execinfo.d core/sys/dragonflybsd/netinet/in_.d \
core/sys/dragonflybsd/pthread_np.d core/sys/dragonflybsd/sys/_bitset.d \ core/sys/dragonflybsd/pthread_np.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/_cpuset.d core/sys/dragonflybsd/sys/cdefs.d \
core/sys/dragonflybsd/sys/elf.d core/sys/dragonflybsd/sys/elf32.d \ core/sys/dragonflybsd/sys/elf.d core/sys/dragonflybsd/sys/elf32.d \
core/sys/dragonflybsd/sys/elf64.d \ core/sys/dragonflybsd/sys/elf64.d \
core/sys/dragonflybsd/sys/elf_common.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/event.d core/sys/dragonflybsd/sys/link_elf.d \
core/sys/dragonflybsd/sys/mman.d core/sys/dragonflybsd/time.d core/sys/dragonflybsd/sys/mman.d core/sys/dragonflybsd/sys/socket.d \
core/sys/dragonflybsd/time.d
DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/dlfcn.d \ DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/dlfcn.d \
core/sys/freebsd/execinfo.d core/sys/freebsd/netinet/in_.d \ core/sys/freebsd/execinfo.d core/sys/freebsd/netinet/in_.d \
core/sys/freebsd/pthread_np.d core/sys/freebsd/sys/_bitset.d \ core/sys/freebsd/pthread_np.d core/sys/freebsd/string.d \
core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \ core/sys/freebsd/sys/_bitset.d core/sys/freebsd/sys/_cpuset.d \
core/sys/freebsd/sys/elf.d core/sys/freebsd/sys/elf32.d \ core/sys/freebsd/sys/cdefs.d core/sys/freebsd/sys/elf.d \
core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \ core/sys/freebsd/sys/elf32.d core/sys/freebsd/sys/elf64.d \
core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \ core/sys/freebsd/sys/elf_common.d core/sys/freebsd/sys/event.d \
core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \ core/sys/freebsd/sys/link_elf.d core/sys/freebsd/sys/mman.d \
core/sys/freebsd/time.d core/sys/freebsd/unistd.d core/sys/freebsd/sys/mount.d core/sys/freebsd/time.d \
core/sys/freebsd/unistd.d
DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \
core/sys/linux/dlfcn.d core/sys/linux/elf.d core/sys/linux/epoll.d \ core/sys/linux/dlfcn.d core/sys/linux/elf.d core/sys/linux/epoll.d \
core/sys/linux/errno.d core/sys/linux/execinfo.d \ core/sys/linux/errno.d core/sys/linux/execinfo.d \
core/sys/linux/fcntl.d core/sys/linux/ifaddrs.d core/sys/linux/link.d \ core/sys/linux/fcntl.d core/sys/linux/ifaddrs.d core/sys/linux/link.d \
core/sys/linux/netinet/in_.d core/sys/linux/netinet/tcp.d \ core/sys/linux/netinet/in_.d core/sys/linux/netinet/tcp.d \
core/sys/linux/sched.d core/sys/linux/stdio.d \ core/sys/linux/sched.d core/sys/linux/stdio.d core/sys/linux/string.d \
core/sys/linux/sys/auxv.d core/sys/linux/sys/eventfd.d \ core/sys/linux/sys/auxv.d core/sys/linux/sys/eventfd.d \
core/sys/linux/sys/file.d core/sys/linux/sys/inotify.d \ core/sys/linux/sys/file.d core/sys/linux/sys/inotify.d \
core/sys/linux/sys/mman.d core/sys/linux/sys/netinet/tcp.d \ core/sys/linux/sys/mman.d core/sys/linux/sys/netinet/tcp.d \
...@@ -245,17 +249,19 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ ...@@ -245,17 +249,19 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \
core/sys/linux/timerfd.d core/sys/linux/tipc.d core/sys/linux/unistd.d core/sys/linux/timerfd.d core/sys/linux/tipc.d core/sys/linux/unistd.d
DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \ DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \
core/sys/netbsd/execinfo.d core/sys/netbsd/sys/elf.d \ core/sys/netbsd/execinfo.d core/sys/netbsd/string.d \
core/sys/netbsd/sys/elf32.d core/sys/netbsd/sys/elf64.d \ core/sys/netbsd/sys/elf.d core/sys/netbsd/sys/elf32.d \
core/sys/netbsd/sys/elf_common.d core/sys/netbsd/sys/event.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/link_elf.d core/sys/netbsd/sys/mman.d \
core/sys/netbsd/time.d core/sys/netbsd/time.d
DRUNTIME_DSOURCES_OPENBSD = core/sys/openbsd/dlfcn.d \ DRUNTIME_DSOURCES_OPENBSD = core/sys/openbsd/dlfcn.d \
core/sys/openbsd/sys/cdefs.d core/sys/openbsd/sys/elf.d \ core/sys/openbsd/string.d core/sys/openbsd/sys/cdefs.d \
core/sys/openbsd/sys/elf32.d core/sys/openbsd/sys/elf64.d \ core/sys/openbsd/sys/elf.d core/sys/openbsd/sys/elf32.d \
core/sys/openbsd/sys/elf_common.d core/sys/openbsd/sys/link_elf.d \ core/sys/openbsd/sys/elf64.d core/sys/openbsd/sys/elf_common.d \
core/sys/openbsd/sys/mman.d core/sys/openbsd/time.d core/sys/openbsd/sys/link_elf.d core/sys/openbsd/sys/mman.d \
core/sys/openbsd/time.d
DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \ DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \
core/sys/posix/arpa/inet.d core/sys/posix/config.d \ core/sys/posix/arpa/inet.d core/sys/posix/config.d \
......
...@@ -63,7 +63,7 @@ else version (NetBSD) ...@@ -63,7 +63,7 @@ else version (NetBSD)
else version (OpenBSD) else version (OpenBSD)
{ {
/*** /***
* Assert failure function in the NetBSD C library. * Assert failure function in the OpenBSD C library.
*/ */
void __assert(const(char)* file, int line, const(char)* exp); void __assert(const(char)* file, int line, const(char)* exp);
/// ///
......
...@@ -249,16 +249,16 @@ else version (NetBSD) ...@@ -249,16 +249,16 @@ else version (NetBSD)
{ {
struct _x87 struct _x87
{ {
ushort control; /* Control word register */ ushort control; /* Control word register */
ushort unused1; ushort unused1;
ushort status; /* Status word register */ ushort status; /* Status word register */
ushort unused2; ushort unused2;
ushort tag; /* Tag word register */ ushort tag; /* Tag word register */
ushort unused3; ushort unused3;
uint[4] others; /* EIP, Pointer Selector, etc */ uint[4] others; /* EIP, Pointer Selector, etc */
}; };
_x87 x87; _x87 x87;
uint32_t mxcsr; /* Control and status register */ uint mxcsr; /* Control and status register */
}; };
} }
...@@ -375,7 +375,42 @@ else version (Solaris) ...@@ -375,7 +375,42 @@ else version (Solaris)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
version (X86_64) version (AArch64)
{
struct fenv_t
{
uint __fpcr;
uint __fpsr;
}
alias uint fexcept_t;
}
else version (ARM)
{
struct fenv_t
{
c_ulong __cw;
}
alias c_ulong fexcept_t;
}
else version (IBMZ_Any)
{
alias uint fenv_t;
alias uint fexcept_t;
}
else version (MIPS_Any)
{
struct fenv_t
{
uint __cw;
}
alias ushort fexcept_t;
}
else version (PPC_Any)
{
alias double fenv_t;
alias uint fexcept_t;
}
else version (X86_Any)
{ {
struct fenv_t struct fenv_t
{ {
...@@ -391,7 +426,8 @@ else version (CRuntime_Musl) ...@@ -391,7 +426,8 @@ else version (CRuntime_Musl)
uint __data_offset; uint __data_offset;
ushort __data_selector; ushort __data_selector;
ushort __unused5; ushort __unused5;
uint __mxcsr; version (X86_64)
uint __mxcsr;
} }
alias ushort fexcept_t; alias ushort fexcept_t;
} }
......
/**
* D header file for Bionic string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.bionic.string;
public import core.stdc.string;
version (CRuntime_Bionic):
extern (C):
nothrow:
@nogc:
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
...@@ -32,6 +32,7 @@ public import core.sys.darwin.mach.loader; ...@@ -32,6 +32,7 @@ public import core.sys.darwin.mach.loader;
uint _dyld_image_count(); uint _dyld_image_count();
const(char)* _dyld_get_image_name(uint image_index); const(char)* _dyld_get_image_name(uint image_index);
mach_header* _dyld_get_image_header(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(in mach_header* mh, intptr_t vmaddr_slide)); void _dyld_register_func_for_add_image(void function(in mach_header* mh, intptr_t vmaddr_slide));
void _dyld_register_func_for_remove_image(void function(in mach_header* mh, intptr_t vmaddr_slide)); void _dyld_register_func_for_remove_image(void function(in mach_header* mh, intptr_t vmaddr_slide));
......
/**
* D header file for Darwin string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.darwin.string;
public import core.stdc.string;
import core.sys.darwin.sys.cdefs;
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:
static if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL)
{
// ^ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
/**
* D header file for DragonFlyBSD string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.dragonflybsd.string;
public import core.stdc.string;
import core.sys.dragonflybsd.sys.cdefs;
version (DragonFlyBSD):
extern (C):
nothrow:
@nogc:
static if (__BSD_VISIBLE)
{
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
/**
* D header file for DragonFlyBSD
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
*/
module core.sys.dragonflybsd.sys.socket;
public import core.sys.posix.sys.socket;
version (DragonFlyBSD):
extern(C):
@nogc:
nothrow:
enum
{
AF_IMPLINK = 3,
AF_PUP = 4,
AF_CHAOS = 5,
AF_NETBIOS = 6,
AF_ISO = 7,
AF_OSI = AF_ISO,
AF_ECMA = 8,
AF_DATAKIT = 9,
AF_CCITT = 10,
AF_SNA = 11,
AF_DECnet = 12,
AF_DLI = 13,
AF_LAT = 14,
AF_HYLINK = 15,
AF_ROUTE = 17,
AF_LINK = 18,
pseudo_AF_XTP = 19,
AF_COIP = 20,
AF_CNT = 21,
pseudo_AF_RTIP = 22,
AF_SIP = 24,
pseudo_AF_PIP = 25,
AF_ISDN = 26,
AF_E164 = AF_ISDN,
pseudo_AF_KEY = 27,
AF_NATM = 29,
AF_ATM = 30,
pseudo_AF_HDRCMPLT = 31,
AF_NETGRAPH = 32,
AF_BLUETOOTH = 33,
AF_MPLS = 34,
AF_IEEE80211 = 35,
}
/* protocol families */
enum PF_UNSPEC = AF_UNSPEC;
enum PF_LOCAL = AF_LOCAL;
enum PF_UNIX = PF_LOCAL;
enum PF_INET = AF_INET;
enum PF_IMPLINK = AF_IMPLINK;
enum PF_PUP = AF_PUP;
enum PF_CHAOS = AF_CHAOS;
enum PF_NETBIOS = AF_NETBIOS;
enum PF_ISO = AF_ISO;
enum PF_OSI = AF_ISO;
enum PF_ECMA = AF_ECMA;
enum PF_DATAKIT = AF_DATAKIT;
enum PF_CCITT = AF_CCITT;
enum PF_SNA = AF_SNA;
enum PF_DECnet = AF_DECnet;
enum PF_DLI = AF_DLI;
enum PF_LAT = AF_LAT;
enum PF_HYLINK = AF_HYLINK;
enum PF_APPLETALK = AF_APPLETALK;
enum PF_ROUTE = AF_ROUTE;
enum PF_LINK = AF_LINK;
enum PF_XTP = pseudo_AF_XTP;
enum PF_COIP = AF_COIP;
enum PF_CNT = AF_CNT;
enum PF_SIP = AF_SIP;
enum PF_IPX = AF_IPX;
enum PF_RTIP = pseudo_AF_RTIP;
enum PF_PIP = pseudo_AF_PIP;
enum PF_ISDN = AF_ISDN;
enum PF_KEY = pseudo_AF_KEY;
enum PF_INET6 = AF_INET6;
enum PF_NATM = AF_NATM;
enum PF_ATM = AF_ATM;
enum PF_NETGRAPH = AF_NETGRAPH;
enum PF_BLUETOOTH = AF_BLUETOOTH;
/**
* D header file for FreeBSD string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.freebsd.string;
public import core.stdc.string;
import core.sys.freebsd.sys.cdefs;
version (FreeBSD):
extern (C):
nothrow:
@nogc:
static if (__BSD_VISIBLE)
{
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
...@@ -43,6 +43,15 @@ struct Elf64_Ehdr ...@@ -43,6 +43,15 @@ struct Elf64_Ehdr
Elf64_Half e_shstrndx; Elf64_Half e_shstrndx;
} }
struct Elf64_Lib
{
Elf64_Word l_name;
Elf64_Word l_time_stamp;
Elf64_Word l_checksum;
Elf64_Word l_version;
Elf64_Word l_flags;
}
struct Elf64_Shdr struct Elf64_Shdr
{ {
Elf64_Word sh_name; Elf64_Word sh_name;
......
...@@ -852,3 +852,105 @@ enum R_X86_64_DTPOFF32 = 21; ...@@ -852,3 +852,105 @@ enum R_X86_64_DTPOFF32 = 21;
enum R_X86_64_GOTTPOFF = 22; enum R_X86_64_GOTTPOFF = 22;
enum R_X86_64_TPOFF32 = 23; enum R_X86_64_TPOFF32 = 23;
enum R_X86_64_IRELATIVE = 37; enum R_X86_64_IRELATIVE = 37;
version (PPC64)
{
enum __ELF_WORD_SIZE = 64;
enum ELF_ARCH = EM_PPC64;
enum ELF_MACHINE_OK(x) = ((x) == EM_PPC64);
}
version (PPC)
{
enum __ELF_WORD_SIZE = 32;
enum ELF_ARCH = EM_PPC;
enum ELF_ARCH32 = EM_PPC;
enum ELF_MACHINE_OK(x) = ((x) == EM_PPC);
}
/**
* Auxiliary vector entries for passing information to the interpreter.
*
* The PowerPC supplement to the SVR4 ABI specification names this "auxv_t",
* but POSIX lays claim to all symbols ending with "_t".
*/
struct Elf32_Auxinfo
{
int a_type;
union a_un
{
long a_val;
void *a_ptr;
void function(void* a) a_fcn;
}
}
struct Elf64_Auxinfo
{
long a_type;
union a_un
{
long a_val;
void *a_ptr;
void function(void* a) a_fcn;
}
}
// __ElfType(Auxinfo);
/**
* Values for a_type.
*/
enum AT_NULL = 0;
enum AT_IGNORE = 1;
enum AT_EXECFD = 2;
enum AT_PHDR = 3;
enum AT_PHENT = 4;
enum AT_PHNUM = 5;
enum AT_PAGESZ = 6;
enum AT_BASE = 7;
enum AT_FLAGS = 8;
enum AT_ENTRY = 9;
enum AT_DCACHEBSIZE = 10;
enum AT_ICACHEBSIZE = 11;
enum AT_UCACHEBSIZE = 12;
enum AT_EXECPATH = 13;
enum AT_CANARY = 14;
enum AT_CANARYLEN = 15;
enum AT_OSRELDATE = 16;
enum AT_NCPUS = 17;
enum AT_PAGESIZES = 18;
enum AT_PAGESIZESLEN = 19;
enum AT_STACKPROT = 21;
enum AT_TIMEKEEP = 22;
enum AT_COUNT = 23;
/**
* Relocation types.
*/
enum R_PPC_COUNT = 37;
enum R_PPC_EMB_COUNT = (R_PPC_EMB_RELSDA - R_PPC_EMB_NADDR32 + 1);
/**
* Define "machine" characteristics
*/
version (PPC64)
{
enum ELF_TARG_CLASS = ELFCLASS64;
enum ELF_TARG_DATA = ELFDATA2MSB;
enum ELF_TARG_MACH = EM_PPC64;
enum ELF_TARG_VER = 1;
}
version (PPC)
{
enum ELF_TARG_CLASS = ELFCLASS32;
enum ELF_TARG_DATA = ELFDATA2MSB;
enum ELF_TARG_MACH = EM_PPC;
enum ELF_TARG_VER = 1;
}
enum ET_DYN_LOAD_ADDR = 0x01010000;
/******************************************************************************* /*******************************************************************************
D binding for Linux specific scheduler control methods. D binding for Linux specific scheduler control and thread spawning
methods.
Defines functions sched_setaffinity and sched_getaffinity and the data Defines functions sched_setaffinity and sched_getaffinity and the data
types they operate on. types they operate on, as well as clone and unshare and their related
constants.
Copyright: Copyright (c) 2016 Sociomantic Labs. All rights reserved. Copyright: Copyright (c) 2016 Sociomantic Labs. All rights reserved.
License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
...@@ -100,6 +102,24 @@ int CPU_COUNT(cpu_set_t* cpusetp) pure ...@@ -100,6 +102,24 @@ int CPU_COUNT(cpu_set_t* cpusetp) pure
return __CPU_COUNT_S(cpu_set_t.sizeof, cpusetp); return __CPU_COUNT_S(cpu_set_t.sizeof, cpusetp);
} }
/* Functions */ /* Scheduler control functions */
int sched_setaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask); int sched_setaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask); int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
/* Clone and related functions and constants */
int clone(int function(void*), void* child_stack, int flags, void* arg, ...);
int unshare(int flags) @trusted;
enum CLONE_FILES = 0x400;
enum CLONE_FS = 0x200;
enum CLONE_NEWCGROUP = 0x2000000;
enum CLONE_NEWIPC = 0x8000000;
enum CLONE_NEWNET = 0x40000000;
enum CLONE_NEWNS = 0x20000;
enum CLONE_NEWPID = 0x20000000;
enum CLONE_NEWUSER = 0x10000000;
enum CLONE_NEWUTS = 0x4000000;
enum CLONE_SIGHAND = 0x800;
enum CLONE_SYSVSEM = 0x40000;
enum CLONE_THREAD = 0x10000;
enum CLONE_VM = 0x100;
/**
* D header file for Linux string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.linux.string;
public import core.stdc.string;
import core.sys.linux.config;
version (linux):
extern (C):
nothrow:
@nogc:
static if (__USE_GNU)
{
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
/**
* D header file for NetBSD string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.netbsd.string;
public import core.stdc.string;
import core.sys.netbsd.sys.featuretest;
version (NetBSD):
extern (C):
nothrow:
@nogc:
static if (_NETBSD_SOURCE)
{
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
/**
* D header file for NetBSD featuretest;.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.netbsd.sys.featuretest;
version (NetBSD):
enum _NETBSD_SOURCE = true;
/**
* D header file for OpenBSD string.
*
* Copyright: Copyright © 2019, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Ernesto Castellotti
*/
module core.sys.openbsd.string;
public import core.stdc.string;
import core.sys.openbsd.sys.cdefs;
version (OpenBSD):
extern (C):
nothrow:
@nogc:
static if (__BSD_VISIBLE)
{
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
...@@ -72,6 +72,10 @@ version (CRuntime_Glibc) ...@@ -72,6 +72,10 @@ version (CRuntime_Glibc)
} }
} }
} }
else version (CRuntime_Bionic)
{
// Bionic does not define aiocb.
}
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
// https://git.musl-libc.org/cgit/musl/tree/include/aio.h // https://git.musl-libc.org/cgit/musl/tree/include/aio.h
...@@ -446,6 +450,10 @@ version (CRuntime_Glibc) ...@@ -446,6 +450,10 @@ version (CRuntime_Glibc)
int lio_listio(int mode, const(aiocb*)* aiocb_list, int nitems, sigevent* sevp); int lio_listio(int mode, const(aiocb*)* aiocb_list, int nitems, sigevent* sevp);
} }
} }
else version (CRuntime_Bionic)
{
// Bionic does not implement aio.h
}
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
static if (__USE_LARGEFILE64) static if (__USE_LARGEFILE64)
...@@ -517,7 +525,7 @@ version (CRuntime_Glibc) ...@@ -517,7 +525,7 @@ version (CRuntime_Glibc)
void aio_init(const(aioinit)* init); void aio_init(const(aioinit)* init);
} }
} }
version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
static if (__USE_GNU) static if (__USE_GNU)
{ {
......
...@@ -506,7 +506,7 @@ else version (CRuntime_Bionic) ...@@ -506,7 +506,7 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
int readdir_r(DIR*, dirent*, dirent**);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -591,6 +591,8 @@ else version (CRuntime_Bionic) ...@@ -591,6 +591,8 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
void seekdir(DIR*, c_long);
c_long telldir(DIR*);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
......
...@@ -854,7 +854,15 @@ else version (CRuntime_Bionic) ...@@ -854,7 +854,15 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
enum PTHREAD_BARRIER_SERIAL_THREAD = -1;
int pthread_barrier_destroy(pthread_barrier_t*);
int pthread_barrier_init(pthread_barrier_t*, in pthread_barrierattr_t*, uint);
int pthread_barrier_wait(pthread_barrier_t*);
int pthread_barrierattr_destroy(pthread_barrierattr_t*);
int pthread_barrierattr_getpshared(in pthread_barrierattr_t*, int*);
int pthread_barrierattr_init(pthread_barrierattr_t*);
int pthread_barrierattr_setpshared(pthread_barrierattr_t*, int);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -880,6 +888,55 @@ else ...@@ -880,6 +888,55 @@ else
int pthread_condattr_getclock(in pthread_condattr_t*, clockid_t*); int pthread_condattr_getclock(in pthread_condattr_t*, clockid_t*);
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t); int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
*/ */
version (CRuntime_Glibc)
{
int pthread_condattr_getclock(in pthread_condattr_t*, clockid_t*);
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
}
else version (FreeBSD)
{
int pthread_condattr_getclock(in pthread_condattr_t*, clockid_t*);
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
}
else version (DragonFlyBSD)
{
int pthread_condattr_getclock(in pthread_condattr_t*, clockid_t*);
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
}
else version (NetBSD)
{
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
}
else version (OpenBSD)
{
int pthread_condattr_getclock(in pthread_condattr_t*, clockid_t*);
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
}
else version (Darwin)
{
}
else version (Solaris)
{
int pthread_condattr_getclock(in pthread_condattr_t*, clockid_t*);
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
}
else version (CRuntime_Bionic)
{
}
else version (CRuntime_Musl)
{
int pthread_condattr_getclock(in pthread_condattr_t*, clockid_t*);
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
}
else version (CRuntime_UClibc)
{
int pthread_condattr_getclock(in pthread_condattr_t*, clockid_t*);
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
}
else
{
static assert(false, "Unsupported platform");
}
// //
// Spinlock (SPI) // Spinlock (SPI)
...@@ -948,7 +1005,11 @@ else version (CRuntime_Bionic) ...@@ -948,7 +1005,11 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
int pthread_spin_destroy(pthread_spinlock_t*);
int pthread_spin_init(pthread_spinlock_t*, int);
int pthread_spin_lock(pthread_spinlock_t*);
int pthread_spin_trylock(pthread_spinlock_t*);
int pthread_spin_unlock(pthread_spinlock_t*);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -1187,7 +1248,7 @@ else version (CRuntime_Bionic) ...@@ -1187,7 +1248,7 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
int pthread_getcpuclockid(pthread_t, clockid_t*);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -1256,7 +1317,9 @@ else version (CRuntime_Bionic) ...@@ -1256,7 +1317,9 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
int pthread_mutex_timedlock(pthread_mutex_t*, in timespec*);
int pthread_rwlock_timedrdlock(pthread_rwlock_t*, in timespec*);
int pthread_rwlock_timedwrlock(pthread_rwlock_t*, in timespec*);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -1693,7 +1756,12 @@ else version (CRuntime_Bionic) ...@@ -1693,7 +1756,12 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
int pthread_condattr_getpshared(pthread_condattr_t*, int*);
int pthread_condattr_setpshared(pthread_condattr_t*, int);
int pthread_mutexattr_getpshared(pthread_mutexattr_t*, int*);
int pthread_mutexattr_setpshared(pthread_mutexattr_t*, int);
int pthread_rwlockattr_getpshared(pthread_rwlockattr_t*, int*);
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
......
...@@ -172,7 +172,8 @@ else version (CRuntime_Bionic) ...@@ -172,7 +172,8 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
struct passwd { struct passwd
{
char *pw_name; char *pw_name;
char *pw_passwd; char *pw_passwd;
uid_t pw_uid; uid_t pw_uid;
...@@ -257,6 +258,8 @@ else version (CRuntime_Bionic) ...@@ -257,6 +258,8 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -325,8 +328,9 @@ else version (CRuntime_Bionic) ...@@ -325,8 +328,9 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
int getpwnam_r(in char*, passwd*, char*, size_t, passwd**); void endpwent();
int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**); passwd* getpwent();
void setpwent();
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
......
...@@ -22,6 +22,8 @@ extern (C) nothrow @nogc: ...@@ -22,6 +22,8 @@ extern (C) nothrow @nogc:
version (RISCV32) version = RISCV_Any; version (RISCV32) version = RISCV_Any;
version (RISCV64) version = RISCV_Any; version (RISCV64) version = RISCV_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
// //
// Required // Required
...@@ -210,6 +212,11 @@ else version (FreeBSD) ...@@ -210,6 +212,11 @@ else version (FreeBSD)
// __int128_t // __int128_t
struct _jmp_buf { long[2][_JBLEN + 1] _jb; }; struct _jmp_buf { long[2][_JBLEN + 1] _jb; };
} }
else version (PPC_Any)
{
enum _JBLEN = 100;
struct _jmp_buf { long[_JBLEN + 1] _jb; }
}
else else
static assert(0); static assert(0);
alias _jmp_buf[1] jmp_buf; alias _jmp_buf[1] jmp_buf;
...@@ -417,6 +424,10 @@ else version (FreeBSD) ...@@ -417,6 +424,10 @@ else version (FreeBSD)
// __int128_t // __int128_t
struct _sigjmp_buf { long[2][_JBLEN + 1] _jb; }; struct _sigjmp_buf { long[2][_JBLEN + 1] _jb; };
} }
else version (PPC_Any)
{
struct _sigjmp_buf { long[_JBLEN + 1] _sjb; }
}
else else
static assert(0); static assert(0);
alias _sigjmp_buf[1] sigjmp_buf; alias _sigjmp_buf[1] sigjmp_buf;
......
...@@ -1136,55 +1136,57 @@ else version (NetBSD) ...@@ -1136,55 +1136,57 @@ else version (NetBSD)
enum SIG_UNBLOCK = 2; enum SIG_UNBLOCK = 2;
enum SIG_SETMASK = 3; enum SIG_SETMASK = 3;
union sigval_t { union sigval_t
int sival_int; {
void *sival_ptr; int sival_int;
}; void* sival_ptr;
struct _rt{ }
pid_t _pid;
uid_t _uid; struct _ksiginfo
sigval_t _value; {
};
struct _child{
pid_t _pid;
uid_t _uid;
int _status;
clock_t _utime;
clock_t _stime;
};
struct _fault{
void *_addr;
int _trap;
int _trap2;
int _trap3;
};
struct _poll{
long _band;
int _fd;
};
union _reason{
_rt rt;
_child child;
_fault fault;
_poll poll;
};
struct _ksiginfo {
int _signo; int _signo;
int _code; int _code;
int _errno; int _errno;
/+#ifdef _LP64 version (D_LP64)
/* In _LP64 the union starts on an 8-byte boundary. */ int _pad;
int _pad;
#endif+/
_reason reason;
};
union reason_t
{
struct rt_t
{
pid_t _pid;
uid_t _uid;
sigval_t _value;
} rt_t _rt;
struct child_t
{
pid_t _pid;
uid_t _uid;
int _status;
clock_t _utime;
clock_t _stime;
} child_t _child;
struct fault_t
{
void* _addr;
int _trap;
int _trap2;
int _trap3;
} fault_t fault;
struct poll_t
{
c_long _band;
int _fd;
} poll_t _poll;
}
reason_t _reason;
}
union siginfo_t union siginfo_t
{ {
ubyte[128] si_pad;/* Total size; for future expansion */ ubyte[128] si_pad;
_ksiginfo _info; _ksiginfo _info;
@property ref c_long si_band() return { return _info.reason.poll._band; } @property ref c_long si_band() return { return _info._reason._poll._band; }
} }
enum SI_USER = 0; enum SI_USER = 0;
...@@ -1589,27 +1591,53 @@ else version (CRuntime_Bionic) ...@@ -1589,27 +1591,53 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
struct sigset_t { struct sigset_t
ulong[128/long.sizeof] __bits; {
c_ulong[128/c_long.sizeof] __bits;
} }
enum SIG_BLOCK = 0; version (MIPS_Any)
enum SIG_UNBLOCK = 1; {
enum SIG_SETMASK = 2; enum SIG_BLOCK = 1;
enum SIG_UNBLOCK = 2;
enum SIG_SETMASK = 3;
}
else
{
enum SIG_BLOCK = 0;
enum SIG_UNBLOCK = 1;
enum SIG_SETMASK = 2;
}
struct siginfo_t { struct siginfo_t
int si_signo, si_errno, si_code; {
union __si_fields_t { int si_signo;
char[128 - 2*int.sizeof - long.sizeof] __pad = 0; version (MIPS_Any) // __SI_SWAP_ERRNO_CODE
struct __si_common_t { {
union __first_t { int si_code;
struct __piduid_t { int si_errno;
}
else
{
int si_errno;
int si_code;
}
union __si_fields_t
{
char[128 - 2*int.sizeof - c_long.sizeof] __pad = 0;
struct __si_common_t
{
union __first_t
{
struct __piduid_t
{
pid_t si_pid; pid_t si_pid;
uid_t si_uid; uid_t si_uid;
} }
__piduid_t __piduid; __piduid_t __piduid;
struct __timer_t { struct __timer_t
{
int si_timerid; int si_timerid;
int si_overrun; int si_overrun;
} }
...@@ -1617,11 +1645,14 @@ else version (CRuntime_Musl) ...@@ -1617,11 +1645,14 @@ else version (CRuntime_Musl)
} }
__first_t __first; __first_t __first;
union __second_t { union __second_t
{
sigval si_value; sigval si_value;
struct __sigchld_t { struct __sigchld_t
{
int si_status; int si_status;
clock_t si_utime, si_stime; clock_t si_utime;
clock_t si_stime;
} }
__sigchld_t __sigchld; __sigchld_t __sigchld;
} }
...@@ -1629,11 +1660,14 @@ else version (CRuntime_Musl) ...@@ -1629,11 +1660,14 @@ else version (CRuntime_Musl)
} }
__si_common_t __si_common; __si_common_t __si_common;
struct __sigfault_t { struct __sigfault_t
{
void *si_addr; void *si_addr;
short si_addr_lsb; short si_addr_lsb;
union __first_t { union __first_t
struct __addr_bnd_t { {
struct __addr_bnd_t
{
void *si_lower; void *si_lower;
void *si_upper; void *si_upper;
} }
...@@ -1644,13 +1678,15 @@ else version (CRuntime_Musl) ...@@ -1644,13 +1678,15 @@ else version (CRuntime_Musl)
} }
__sigfault_t __sigfault; __sigfault_t __sigfault;
struct __sigpoll_t { struct __sigpoll_t
long si_band; {
c_long si_band;
int si_fd; int si_fd;
} }
__sigpoll_t __sigpoll; __sigpoll_t __sigpoll;
struct __sigsys_t { struct __sigsys_t
{
void *si_call_addr; void *si_call_addr;
int si_syscall; int si_syscall;
uint si_arch; uint si_arch;
...@@ -3030,7 +3066,177 @@ else version (CRuntime_Bionic) ...@@ -3030,7 +3066,177 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
enum SA_RESTART = 0x10000000; version (MIPS_Any)
{
enum SIGPOLL = 22;
enum SIGPROF = 29;
enum SIGSYS = 12;
enum SIGTRAP = 5;
enum SIGVTALRM = 28;
enum SIGXCPU = 30;
enum SIGXFSZ = 31;
enum SA_ONSTACK = 0x08000000;
enum SA_RESETHAND = 0x80000000;
enum SA_RESTART = 0x10000000;
enum SA_SIGINFO = 8;
enum SA_NOCLDWAIT = 0x10000;
enum SA_NODEFER = 0x40000000;
}
else
{
enum SIGPOLL = 29;
enum SIGPROF = 27;
enum SIGSYS = 31;
enum SIGTRAP = 5;
enum SIGVTALRM = 26;
enum SIGXCPU = 24;
enum SIGXFSZ = 25;
enum SA_ONSTACK = 0x08000000;
enum SA_RESETHAND = 0x80000000;
enum SA_RESTART = 0x10000000;
enum SA_SIGINFO = 4;
enum SA_NOCLDWAIT = 2;
enum SA_NODEFER = 0x40000000;
}
enum SS_ONSTACK = 1;
enum SS_DISABLE = 2;
version (ARM)
{
enum MINSIGSTKSZ = 2048;
enum SIGSTKSZ = 8192;
}
else version (AArch64)
{
enum MINSIGSTKSZ = 6144;
enum SIGSTKSZ = 12288;
}
else version (IBMZ_Any)
{
enum MINSIGSTKSZ = 4096;
enum SIGSTKSZ = 10240;
}
else version (MIPS_Any)
{
enum MINSIGSTKSZ = 2048;
enum SIGSTKSZ = 8192;
}
else version (PPC_Any)
{
enum MINSIGSTKSZ = 4096;
enum SIGSTKSZ = 10240;
}
else version (X86_Any)
{
enum MINSIGSTKSZ = 2048;
enum SIGSTKSZ = 8192;
}
else
static assert(0, "unimplemented");
//ucontext_t (defined in core.sys.posix.ucontext)
//mcontext_t (defined in core.sys.posix.ucontext)
version (MIPS_Any)
{
struct stack_t
{
void* ss_sp;
size_t ss_size;
int ss_flags;
}
}
else
{
struct stack_t
{
void* ss_sp;
int ss_flags;
size_t ss_size;
}
}
enum
{
ILL_ILLOPC = 1,
ILL_ILLOPN,
ILL_ILLADR,
ILL_ILLTRP,
ILL_PRVOPC,
ILL_PRVREG,
ILL_COPROC,
ILL_BADSTK
}
enum
{
FPE_INTDIV = 1,
FPE_INTOVF,
FPE_FLTDIV,
FPE_FLTOVF,
FPE_FLTUND,
FPE_FLTRES,
FPE_FLTINV,
FPE_FLTSUB
}
enum
{
SEGV_MAPERR = 1,
SEGV_ACCERR
}
enum
{
BUS_ADRALN = 1,
BUS_ADRERR,
BUS_OBJERR
}
enum
{
TRAP_BRKPT = 1,
TRAP_TRACE
}
enum
{
CLD_EXITED = 1,
CLD_KILLED,
CLD_DUMPED,
CLD_TRAPPED,
CLD_STOPPED,
CLD_CONTINUED
}
enum
{
POLL_IN = 1,
POLL_OUT,
POLL_MSG,
POLL_ERR,
POLL_PRI,
POLL_HUP
}
sigfn_t bsd_signal(int sig, sigfn_t func);
sigfn_t sigset(int sig, sigfn_t func);
nothrow:
@nogc:
sigfn_t2 bsd_signal(int sig, sigfn_t2 func);
sigfn_t2 sigset(int sig, sigfn_t2 func);
int killpg(pid_t, int);
int sigaltstack(const scope stack_t*, stack_t*);
int sighold(int);
int sigignore(int);
int siginterrupt(int, int);
int sigpause(int);
int sigrelse(int);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -3485,7 +3691,7 @@ else version (CRuntime_Musl) ...@@ -3485,7 +3691,7 @@ else version (CRuntime_Musl)
int sigev_notify; int sigev_notify;
void function(sigval) sigev_notify_function; void function(sigval) sigev_notify_function;
pthread_attr_t *sigev_notify_attributes; pthread_attr_t *sigev_notify_attributes;
char[56 - 3 * long.sizeof] __pad = void; char[56 - 3 * c_long.sizeof] __pad = void;
} }
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
......
...@@ -66,3 +66,64 @@ version (OSX) ...@@ -66,3 +66,64 @@ version (OSX)
return _IOC!(T)(IOC_INOUT, cast(uint)g, cast(uint)n, T.sizeof); return _IOC!(T)(IOC_INOUT, cast(uint)g, cast(uint)n, T.sizeof);
} }
} }
else version (FreeBSD)
{
/* FreeBSD ioctl's encode the command in the lower 16-bits
* and the size of any in/out parameters in the lower 13 bits of the upper
* 16-bits of a 32 bit unsigned integer. The high 3 bits of the upper
* 16-bits encode the in/out status of the parameter.
*/
enum uint IOCPARM_SHIFT = 13; // number of bits for ioctl size
enum uint IOCPARM_MASK = ((1 << IOCPARM_SHIFT) - 1); // parameter length mask
uint IOCPARM_LEN(uint x) // to extract the encoded parameter length
{
return ((x >> 16) & IOCPARM_MASK);
}
uint IOCBASECMD(uint x) // to extract the encoded command
{
return (x & ~(IOCPARM_MASK << 16));
}
uint IOCGROUP(uint x) // to extract the encoded group
{
return ((x >> 8) & 0xff);
}
enum uint IOCPARM_MAX = (1 << IOCPARM_SHIFT); // max size of ioctl args
enum uint IOC_VOID = 0x20000000; // no parameters
enum uint IOC_OUT = 0x40000000; // copy parameters back
enum uint IOC_IN = 0x80000000; // copy parameters into
enum uint IOC_INOUT = (IOC_IN | IOC_OUT);
enum uint IOC_DIRMASK = (IOC_VOID|IOC_OUT|IOC_IN);
// encode the ioctl info into 32 bits
uint _IOC(uint inorout, uint group, uint num, size_t len)
{
return (inorout | ((len & IOCPARM_MASK) << 16) | (group << 8) | num);
}
// encode a command with no parameters
uint _IO(char g, int n)
{
return _IOC(IOC_VOID, cast(uint)g, cast(uint)n, cast(size_t)0);
}
uint _IOWINT(char g, int n)
{
return _IOC(IOC_VOID, cast(uint)g, cast(uint)n, int.sizeof);
}
// encode a command that returns info
uint _IOR(T)(char g, int n)
{
return _IOC(IOC_OUT, cast(uint)g, cast(uint)n, T.sizeof);
}
// encode a command that takes info
uint _IOW(T)(char g, int n)
{
return _IOC(IOC_IN, cast(uint)g, cast(uint)n, T.sizeof);
}
// encode a command that takes info and returns info
uint _IOWR(T)(char g, int n)
{
return _IOC(IOC_INOUT, cast(uint)g, cast(uint)n, T.sizeof);
}
}
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
module core.sys.posix.sys.ioctl; module core.sys.posix.sys.ioctl;
import core.stdc.config; import core.stdc.config;
public import core.sys.posix.sys.ttycom;
version (OSX) version (OSX)
version = Darwin; version = Darwin;
...@@ -357,14 +358,6 @@ else version (FreeBSD) ...@@ -357,14 +358,6 @@ else version (FreeBSD)
void* buf; void* buf;
} }
struct winsize
{
ushort ws_row;
ushort ws_col;
ushort ws_xpixel;
ushort ws_ypixel;
}
int ioctl(int, c_ulong, ...); int ioctl(int, c_ulong, ...);
} }
else version (NetBSD) else version (NetBSD)
......
...@@ -137,6 +137,15 @@ else version (CRuntime_Bionic) ...@@ -137,6 +137,15 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
enum
{
POSIX_MADV_NORMAL = 0,
POSIX_MADV_RANDOM = 1,
POSIX_MADV_SEQUENTIAL = 2,
POSIX_MADV_WILLNEED = 3,
POSIX_MADV_DONTNEED = 4,
}
int posix_madvise(void *, size_t, int);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -655,6 +664,14 @@ else version (CRuntime_Bionic) ...@@ -655,6 +664,14 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
enum
{
MCL_CURRENT = 1,
MCL_FUTURE = 2,
}
int mlockall(int);
int munlockall();
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -723,6 +740,8 @@ else version (CRuntime_Bionic) ...@@ -723,6 +740,8 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
int mlock(in void*, size_t);
int munlock(in void*, size_t);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -834,6 +853,8 @@ else version (CRuntime_Bionic) ...@@ -834,6 +853,8 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
int shm_open(in char*, int, mode_t);
int shm_unlink(in char*);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
......
...@@ -1359,41 +1359,8 @@ else version (DragonFlyBSD) ...@@ -1359,41 +1359,8 @@ else version (DragonFlyBSD)
AF_LOCAL = 1, AF_LOCAL = 1,
AF_UNIX = AF_LOCAL, AF_UNIX = AF_LOCAL,
AF_INET = 2, AF_INET = 2,
AF_IMPLINK = 3,
AF_PUP = 4,
AF_CHAOS = 5,
AF_NETBIOS = 6,
AF_ISO = 7,
AF_OSI = AF_ISO,
AF_ECMA = 8,
AF_DATAKIT = 9,
AF_CCITT = 10,
AF_SNA = 11,
AF_DECnet = 12,
AF_DLI = 13,
AF_LAT = 14,
AF_HYLINK = 15,
AF_APPLETALK = 16, AF_APPLETALK = 16,
AF_ROUTE = 17,
AF_LINK = 18,
pseudo_AF_XTP = 19,
AF_COIP = 20,
AF_CNT = 21,
pseudo_AF_RTIP = 22,
AF_IPX = 23, AF_IPX = 23,
AF_SIP = 24,
pseudo_AF_PIP = 25,
AF_ISDN = 26,
AF_E164 = AF_ISDN,
pseudo_AF_KEY = 27,
//AF_INET6 = 28, // defined below
AF_NATM = 29,
AF_ATM = 30,
pseudo_AF_HDRCMPLT = 31,
AF_NETGRAPH = 32,
AF_BLUETOOTH = 33,
AF_MPLS = 34,
AF_IEEE80211 = 35,
} }
struct sockaddr struct sockaddr
...@@ -1427,43 +1394,6 @@ else version (DragonFlyBSD) ...@@ -1427,43 +1394,6 @@ else version (DragonFlyBSD)
byte[_SS_PAD2SIZE] __ss_pad2; byte[_SS_PAD2SIZE] __ss_pad2;
} }
/* protocol families */
enum PF_UNSPEC = AF_UNSPEC;
enum PF_LOCAL = AF_LOCAL;
enum PF_UNIX = PF_LOCAL;
enum PF_INET = AF_INET;
enum PF_IMPLINK = AF_IMPLINK;
enum PF_PUP = AF_PUP;
enum PF_CHAOS = AF_CHAOS;
enum PF_NETBIOS = AF_NETBIOS;
enum PF_ISO = AF_ISO;
enum PF_OSI = AF_ISO;
enum PF_ECMA = AF_ECMA;
enum PF_DATAKIT = AF_DATAKIT;
enum PF_CCITT = AF_CCITT;
enum PF_SNA = AF_SNA;
enum PF_DECnet = AF_DECnet;
enum PF_DLI = AF_DLI;
enum PF_LAT = AF_LAT;
enum PF_HYLINK = AF_HYLINK;
enum PF_APPLETALK = AF_APPLETALK;
enum PF_ROUTE = AF_ROUTE;
enum PF_LINK = AF_LINK;
enum PF_XTP = pseudo_AF_XTP;
enum PF_COIP = AF_COIP;
enum PF_CNT = AF_CNT;
enum PF_SIP = AF_SIP;
enum PF_IPX = AF_IPX;
enum PF_RTIP = pseudo_AF_RTIP;
enum PF_PIP = pseudo_AF_PIP;
enum PF_ISDN = AF_ISDN;
enum PF_KEY = pseudo_AF_KEY;
enum PF_INET6 = AF_INET6;
enum PF_NATM = AF_NATM;
enum PF_ATM = AF_ATM;
enum PF_NETGRAPH = AF_NETGRAPH;
enum PF_BLUETOOTH = AF_BLUETOOTH;
struct msghdr struct msghdr
{ {
void* msg_name; void* msg_name;
...@@ -1928,10 +1858,10 @@ else version (CRuntime_Musl) ...@@ -1928,10 +1858,10 @@ else version (CRuntime_Musl)
c_ulong __ss_align; c_ulong __ss_align;
} }
enum { enum
{
SOCK_STREAM = 1, SOCK_STREAM = 1,
SOCK_DGRAM = 2, SOCK_DGRAM = 2,
SOCK_RAW = 3,
SOCK_RDM = 4, SOCK_RDM = 4,
SOCK_SEQPACKET = 5, SOCK_SEQPACKET = 5,
SOCK_DCCP = 6, SOCK_DCCP = 6,
...@@ -2374,6 +2304,10 @@ else version (CRuntime_Bionic) ...@@ -2374,6 +2304,10 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
enum
{
SOCK_RAW = 3
}
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
......
...@@ -108,3 +108,99 @@ version (OSX) ...@@ -108,3 +108,99 @@ version (OSX)
enum uint SLIPDISC = 4; // serial IP discipline enum uint SLIPDISC = 4; // serial IP discipline
enum uint PPPDISC = 5; // PPP discipline enum uint PPPDISC = 5; // PPP discipline
} }
else version (FreeBSD)
{
struct winsize {
ushort ws_row; // rows, in characters
ushort ws_col; // columns, in characters
ushort ws_xpixel; // horizontal size, pixels
ushort ws_ypixel; // vertical size, pixels
}
// Serial/TTY ioctl's
// 0-2 compat
// 3-7 unused
// 8-10 compat
// 11-12 unused
enum uint TIOCEXCL = _IO('t', 13); // set exclusive use of tty
enum uint TIOCNXCL = _IO('t', 14); // reset exclusive use of tty
enum uint TIOCGPTN = _IOR!(int)('t', 15); // get pts number
enum uint TIOCFLUSH = _IOW!(int)('t', 16); // flush buffers
// 17-18 compat
enum uint TIOCGETA = _IOR!(termios)('t', 19); // get termios struct
enum uint TIOCSETA = _IOW!(termios)('t', 20); // set termios struct
enum uint TIOCSETAW = _IOW!(termios)('t', 21); // drain output, set
enum uint TIOCSETAF = _IOW!(termios)('t', 22); // drn out, fls in, set
// 23-25 unused
enum uint TIOCGETD = _IOR!(int)('t', 26); // get line discipline
enum uint TIOCSETD = _IOW!(int)('t', 27); // set line discipline
enum uint TIOCPTMASTER = _IO('t', 28); // pts master validation
// 29-85 unused
enum uint TIOCGDRAINWAIT = _IOR!(int)('t', 86); // get ttywait timeout
enum uint TIOCSDRAINWAIT = _IOW!(int)('t', 87); // set ttywait timeout
// 88 unused
// 89-91 conflicts: tun and tap
enum uint TIOCTIMESTAMP = _IOR!(timeval)('t', 89); // enable/get timestamp of last input event
enum uint TIOCMGDTRWAIT = _IOR!(int)('t', 90); // modem: get wait on close
enum uint TIOCMSDTRWAIT = _IOW!(int)('t', 91); // modem: set wait on close
// 92-93 tun and tap
// 94-97 conflicts: tun and tap
enum uint TIOCDRAIN = _IO('t', 94); // wait till output drained
enum uint TIOCSIG = _IOWINT('t', 95); // pty: generate signal
enum uint TIOCEXT = _IOW!(int)('t', 96); // pty: external processing
enum uint TIOCSCTTY = _IO('t', 97); // become controlling tty
enum uint TIOCCONS = _IOW!(int)('t', 98); // become virtual console
enum uint TIOCGSID = _IOR!(int)('t', 99); // get session id
// 100 unused
enum uint TIOCSTAT = _IO('t', 101); // simulate ^T status message
enum uint TIOCUCNTL = _IOW!(int)('t', 102); // pty: set/clr usr cntl mode
enum uint UIOCCMD(n) = _IO('u', n); // usr cntl op "n"
enum uint TIOCSWINSZ = _IOW!(winsize)('t', 103); // set window size
enum uint TIOCGWINSZ = _IOR!(winsize)('t', 104); // get window size
// 105 unused
enum uint TIOCMGET = _IOR!(int)('t', 106); // get all modem bits
enum uint TIOCM_LE = 0x01; // line enable
enum uint TIOCM_DTR = 0x02; // data terminal ready
enum uint TIOCM_RTS = 0x04; // request to send
enum uint TIOCM_ST = 0x08; // secondary transmit
enum uint TIOCM_SR = 0x10; // secondary receive
enum uint TIOCM_CTS = 0x20; // clear to send
enum uint TIOCM_DCD = 0x40; // data carrier detect
enum uint TIOCM_RI = 0x80; // ring indicate
enum uint TIOCM_DSR = 0x100; // data set ready
enum uint TIOCM_CD = TIOCM_DCD;
enum uint TIOCM_CAR = TIOCM_DCD;
enum uint TIOCM_RNG = TIOCM_RI;
enum uint TIOCMBIC = _IOW!(int)('t', 107); // bic modem bits
enum uint TIOCMBIS = _IOW!(int)('t', 108); // bis modem bits
enum uint TIOCMSET = _IOW!(int)('t', 109); // set all modem bits
enum uint TIOCSTART = _IO('t', 110); // start output like ^Q
enum uint TIOCSTOP = _IO('t', 111); // stop output like ^S
enum uint TIOCPKT = _IOW!(int)('t', 112); // pty: set/clr packet mode
enum uint TIOCPKT_DATA = 0x00; // data packet
enum uint TIOCPKT_FLUSHREAD = 0x01; // flush packet
enum uint TIOCPKT_FLUSHWRITE = 0x02; // flush packet
enum uint TIOCPKT_STOP = 0x04; // stop output
enum uint TIOCPKT_START = 0x08; // start output
enum uint TIOCPKT_NOSTOP = 0x10; // no more ^S, ^Q
enum uint TIOCPKT_DOSTOP = 0x20; // now do ^S, ^Q
enum uint TIOCPKT_IOCTL = 0x40; // state change of pty driver
enum uint TIOCNOTTY = _IO('t', 113); // void tty association
enum uint TIOCSTI = _IOW!(char)('t', 114); // simulate terminal input
enum uint TIOCOUTQ = _IOR!(int)('t', 115); // output queue size
// 116-117 compat
enum uint TIOCSPGRP = _IOW!(int)('t', 118); // set pgrp of tty
enum uint TIOCGPGRP = _IOR!(int)('t', 119); // get pgrp of tty
enum uint TIOCCDTR = _IO('t', 120); // clear data terminal ready
enum uint TIOCSDTR = _IO('t', 121); // set data terminal ready
enum uint TIOCCBRK = _IO('t', 122); // clear break bit
enum uint TIOCSBRK = _IO('t', 123); // set break bit
// 124-127 compat
enum uint TTYDISC = 0; // termios tty line discipline
enum uint SLIPDISC = 4; // serial IP discipline
enum uint PPPDISC = 5; // PPP discipline
enum uint NETGRAPHDISC = 6; // Netgraph tty node discipline
enum uint H4DISC = 7; // Netgraph Blutooth H4 discipline
}
...@@ -112,20 +112,25 @@ version (CRuntime_Glibc) ...@@ -112,20 +112,25 @@ version (CRuntime_Glibc)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
alias long blksize_t; alias c_long blksize_t;
alias ulong nlink_t; alias c_ulong nlink_t;
alias long dev_t; alias long dev_t;
alias long blkcnt_t; alias long blkcnt_t;
alias ulong ino_t; alias ulong ino_t;
alias long off_t; alias long off_t;
alias long _Addr; alias int pid_t;
alias int pid_t; alias uint uid_t;
alias uint uid_t; alias uint gid_t;
alias uint gid_t; version (D_X32)
alias long time_t; alias long time_t;
alias long clock_t; else
alias ulong pthread_t; alias c_long time_t;
alias _Addr ssize_t; alias c_long clock_t;
alias c_ulong pthread_t;
version (D_LP64)
alias c_long ssize_t;
else
alias int ssize_t;
} }
else version (Darwin) else version (Darwin)
{ {
...@@ -447,7 +452,10 @@ else version (CRuntime_Musl) ...@@ -447,7 +452,10 @@ else version (CRuntime_Musl)
} }
alias uint mode_t; alias uint mode_t;
alias uint id_t; alias uint id_t;
alias long suseconds_t; version (D_X32)
alias long susseconds_t;
else
alias c_long suseconds_t;
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -750,40 +758,77 @@ version (CRuntime_Glibc) ...@@ -750,40 +758,77 @@ version (CRuntime_Glibc)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
version (X86_64) { version (D_LP64)
{
union pthread_attr_t union pthread_attr_t
{ {
int[14] __i; int[14] __i;
ulong[7] __s; ulong[7] __s;
} }
union pthread_cond_t union pthread_cond_t
{ {
int[12] __i; int[12] __i;
void*[6] __p; void*[6] __p;
} }
union pthread_mutex_t union pthread_mutex_t
{ {
int[10] __i; int[10] __i;
void*[5] __p; void*[5] __p;
} }
union pthread_rwlock_t union pthread_rwlock_t
{ {
int[14] __i; int[14] __i;
void*[7] __p; void*[7] __p;
} }
struct pthread_rwlockattr_t }
else
{
union pthread_attr_t
{
int[9] __i;
uint[9] __s;
}
union pthread_cond_t
{
int[12] __i;
void*[12] __p;
}
union pthread_mutex_t
{
int[6] __i;
void*[6] __p;
}
union pthread_rwlock_t
{ {
uint[2] __attr; int[8] __i;
void*[8] __p;
} }
alias uint pthread_key_t;
alias uint pthread_condattr_t;
alias uint pthread_mutexattr_t;
alias int pthread_once_t;
} }
else
struct pthread_rwlockattr_t
{ {
static assert (false, "Architecture unsupported"); uint[2] __attr;
}
alias uint pthread_key_t;
struct pthread_condattr_t
{
uint __attr;
} }
struct pthread_mutexattr_t
{
uint __attr;
}
alias int pthread_once_t;
} }
else version (Darwin) else version (Darwin)
{ {
...@@ -1352,6 +1397,27 @@ else version (CRuntime_Bionic) ...@@ -1352,6 +1397,27 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
version (D_LP64)
{
union pthread_barrier_t
{
int[8] __i;
void*[4] __p;
}
}
else
{
union pthread_barrier_t
{
int[5] __i;
void*[5] __p;
}
}
struct pthread_barrierattr_t
{
uint __attr;
}
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
...@@ -1407,6 +1473,10 @@ else version (CRuntime_UClibc) ...@@ -1407,6 +1473,10 @@ else version (CRuntime_UClibc)
{ {
alias int pthread_spinlock_t; // volatile alias int pthread_spinlock_t; // volatile
} }
else version (CRuntime_Musl)
{
alias int pthread_spinlock_t;
}
// //
// Timer (TMR) // Timer (TMR)
......
...@@ -392,6 +392,19 @@ else version (CRuntime_Bionic) ...@@ -392,6 +392,19 @@ else version (CRuntime_Bionic)
} }
else version (CRuntime_Musl) else version (CRuntime_Musl)
{ {
enum WEXITED = 4;
enum WSTOPPED = 2;
enum WCONTINUED = 8;
enum WNOWAIT = 0x01000000;
enum idtype_t
{
P_ALL,
P_PID,
P_PGID
}
int waitid(idtype_t, id_t, siginfo_t*, int);
} }
else version (CRuntime_UClibc) else version (CRuntime_UClibc)
{ {
......
...@@ -127,22 +127,10 @@ CLOCK_MONOTONIC ...@@ -127,22 +127,10 @@ CLOCK_MONOTONIC
version (linux) version (linux)
{ {
enum CLOCK_MONOTONIC = 1; enum CLOCK_MONOTONIC = 1;
// To be removed in December 2015.
static import core.sys.linux.time;
deprecated("Please import it from core.sys.linux.time instead.")
alias CLOCK_MONOTONIC_RAW = core.sys.linux.time.CLOCK_MONOTONIC_RAW; // non-standard
deprecated("Please import it from core.sys.linux.time instead.")
alias CLOCK_MONOTONIC_COARSE = core.sys.linux.time.CLOCK_MONOTONIC_COARSE; // non-standard
} }
else version (FreeBSD) else version (FreeBSD)
{ // time.h { // time.h
enum CLOCK_MONOTONIC = 4; enum CLOCK_MONOTONIC = 4;
// To be removed in December 2015.
static import core.sys.freebsd.time;
deprecated("Please import it from core.sys.freebsd.time instead.")
alias CLOCK_MONOTONIC_PRECISE = core.sys.freebsd.time.CLOCK_MONOTONIC_PRECISE;
deprecated("Please import it from core.sys.freebsd.time instead.")
alias CLOCK_MONOTONIC_FAST = core.sys.freebsd.time.CLOCK_MONOTONIC_FAST;
} }
else version (NetBSD) else version (NetBSD)
{ {
...@@ -157,12 +145,6 @@ else version (OpenBSD) ...@@ -157,12 +145,6 @@ else version (OpenBSD)
else version (DragonFlyBSD) else version (DragonFlyBSD)
{ // time.h { // time.h
enum CLOCK_MONOTONIC = 4; enum CLOCK_MONOTONIC = 4;
// To be removed in December 2015.
static import core.sys.dragonflybsd.time;
deprecated("Please import it from core.sys.dragonflybsd.time instead.")
alias CLOCK_MONOTONIC_PRECISE = core.sys.dragonflybsd.time.CLOCK_MONOTONIC_PRECISE;
deprecated("Please import it from core.sys.dragonflybsd.time instead.")
alias CLOCK_MONOTONIC_FAST = core.sys.dragonflybsd.time.CLOCK_MONOTONIC_FAST;
} }
else version (Darwin) else version (Darwin)
{ {
...@@ -236,10 +218,6 @@ version (CRuntime_Glibc) ...@@ -236,10 +218,6 @@ version (CRuntime_Glibc)
} }
enum CLOCK_REALTIME = 0; enum CLOCK_REALTIME = 0;
// To be removed in December 2015.
static import core.sys.linux.time;
deprecated("Please import it from core.sys.linux.time instead.")
alias CLOCK_REALTIME_COARSE = core.sys.linux.time.CLOCK_REALTIME_COARSE; // non-standard
enum TIMER_ABSTIME = 0x01; enum TIMER_ABSTIME = 0x01;
alias int clockid_t; alias int clockid_t;
......
...@@ -23,6 +23,10 @@ extern (C): ...@@ -23,6 +23,10 @@ extern (C):
nothrow: nothrow:
@nogc: @nogc:
version (MIPS32) version = MIPS_Any;
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
version (RISCV32) version = RISCV_Any; version (RISCV32) version = RISCV_Any;
version (RISCV64) version = RISCV_Any; version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any; version (S390) version = IBMZ_Any;
...@@ -770,6 +774,139 @@ version (CRuntime_Glibc) ...@@ -770,6 +774,139 @@ version (CRuntime_Glibc)
else else
static assert(0, "unimplemented"); static assert(0, "unimplemented");
} }
else version (CRuntime_Musl)
{
version (AArch64)
{
struct mcontext_t
{
real[18+256] __regs;
}
struct ucontext_t
{
c_ulong uc_flags;
ucontext_t* uc_link;
stack_t uc_stack;
sigset_t uc_sigmask;
mcontext_t uc_mcontext;
}
}
else version (ARM)
{
struct mcontext_t
{
c_ulong[21] __regs;
}
struct ucontext_t
{
c_ulong uc_flags;
ucontext_t* uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
sigset_t uc_sigmask;
ulong[64] uc_regspace;
}
}
else version (IBMZ_Any)
{
struct mcontext_t
{
c_ulong[18] __regs1;
uint[18] __regs2;
double[16] __regs3;
}
struct ucontext_t
{
c_ulong uc_flags;
ucontext_t* uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
sigset_t uc_sigmask;
}
}
else version (MIPS_Any)
{
version (MIPS_N32)
{
struct mcontext_t
{
ulong[32] __mc1;
double[32] __mc2;
ulong[9] __mc3;
uint[4] __mc4;
}
}
else version (MIPS64)
{
struct mcontext_t
{
ulong[32] __mc1;
double[32] __mc2;
ulong[9] __mc3;
uint[4] __mc4;
}
}
else
{
struct mcontext_t
{
uint[2] __mc1;
ulong[65] __mc2;
uint[5] __mc3;
ulong[2] __mc4;
uint[6] __mc5;
}
}
struct ucontext_t
{
c_ulong uc_flags;
ucontext_t* uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
sigset_t uc_sigmask;
}
}
else version (X86)
{
struct mcontext_t
{
uint[22] __space;
}
struct ucontext_t
{
c_ulong uc_flags;
ucontext_t* uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
sigset_t uc_sigmask;
c_ulong[28] __fpregs_mem;
}
}
else version (X86_64)
{
struct mcontext_t
{
ulong[32] __space;
}
struct ucontext_t
{
c_ulong uc_flags;
ucontext_t* uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
sigset_t uc_sigmask;
ulong[64] __fpregs_mem;
}
}
else
static assert(0, "unimplemented");
}
else version (FreeBSD) else version (FreeBSD)
{ {
// <machine/ucontext.h> // <machine/ucontext.h>
...@@ -897,6 +1034,26 @@ else version (FreeBSD) ...@@ -897,6 +1034,26 @@ else version (FreeBSD)
ulong[8] mc_spare; ulong[8] mc_spare;
} }
} }
else version (PPC_Any)
{
alias size_t __register_t;
alias uint __uint32_t;
alias ulong __uint64_t;
struct mcontext_t {
int mc_vers;
int mc_flags;
enum _MC_FP_VALID = 0x01;
enum _MC_AV_VALID = 0x02;
int mc_onstack;
int mc_len;
__uint64_t[32 * 2] mc_avec;
__uint32_t[2] mc_av;
__register_t[42] mc_frame;
__uint64_t[33] mc_fpreg;
__uint64_t[32] mc_vsxfpreg;
}
}
// <ucontext.h> // <ucontext.h>
enum UCF_SWAPPED = 0x00000001; enum UCF_SWAPPED = 0x00000001;
...@@ -914,44 +1071,57 @@ else version (FreeBSD) ...@@ -914,44 +1071,57 @@ else version (FreeBSD)
} }
else version (NetBSD) else version (NetBSD)
{ {
version (X86_64) version (X86_64)
{ {
enum { NGREG = 26 }; private
alias __greg_t = ulong; {
alias __gregset_t = __greg_t[NGREG]; enum _NGREG = 26;
alias __fpregset_t = align(8)ubyte[512]; alias __greg_t = c_ulong;
alias __gregset_t = __greg_t[_NGREG];
alias __fpregset_t = align(8) ubyte[512];
}
struct mcontext_t { struct mcontext_t
__gregset_t __gregs; {
__greg_t _mc_tlsbase; __gregset_t __gregs;
__fpregset_t __fpregs; __greg_t _mc_tlsbase;
} __fpregset_t __fpregs;
}
} }
else version (X86) else version (X86)
{ {
enum { NGREG = 19 }; private
alias __greg_t = ulong; {
alias __gregset_t = __greg_t[_NGREG]; enum _NGREG = 19;
struct __fpregset_t{ alias __greg_t = int;
union __fp_reg_set{ alias __gregset_t = __greg_t[_NGREG];
struct __fpchip_state{ struct __fpregset_t
int[27] __fp_state; /* Environment and registers */ {
} ; /* x87 regs in fsave format */ union fp_reg_set_t
struct __fp_xmm_state{ {
struct fpchip_state_t
{
int[27] __fp_state;
}
struct fp_xmm_state_t
{
ubyte[512] __fp_xmm; ubyte[512] __fp_xmm;
} ; /* x87 and xmm regs in fxsave format */ }
int[128] __fp_fpregs; fpchip_state_t __fpchip_state;
}; fp_xmm_state_t __fp_xmm_state;
__fpregset_t __fp_reg_set; int[128] __fp_fpregs;
int[33] __fp_pad; /* Historic padding */ }
}; fp_reg_set_t __fp_reg_set;
int[33] __fp_pad;
}
}
struct mcontext_t { struct mcontext_t
__gregset_t __gregs; {
__fpregset_t __fpregs; __gregset_t __gregs;
__greg_t _mc_tlsbase; __fpregset_t __fpregs;
} __greg_t _mc_tlsbase;
}
} }
struct ucontext_t struct ucontext_t
...@@ -965,7 +1135,6 @@ else version (NetBSD) ...@@ -965,7 +1135,6 @@ else version (NetBSD)
long __uc_pad[_UC_MACHINE_PAD]; long __uc_pad[_UC_MACHINE_PAD];
#endif #endif
+/ +/
} }
} }
else version (OpenBSD) else version (OpenBSD)
......
...@@ -2403,7 +2403,7 @@ else version (OpenBSD) ...@@ -2403,7 +2403,7 @@ else version (OpenBSD)
{ {
char* crypt(in char*, in char*); char* crypt(in char*, in char*);
//char* ctermid(char*); //char* ctermid(char*);
//void encrypt(ref char[64], int) @trusted; void encrypt(ref char[64], int) @trusted;
int fchdir(int) @trusted; int fchdir(int) @trusted;
c_long gethostid() @trusted; c_long gethostid() @trusted;
pid_t getpgid(pid_t) @trusted; pid_t getpgid(pid_t) @trusted;
......
...@@ -49,6 +49,9 @@ alias void* PVOID64; ...@@ -49,6 +49,9 @@ alias void* PVOID64;
alias const(char)* PCCH, LPCCH, PCSTR, LPCSTR; alias const(char)* PCCH, LPCCH, PCSTR, LPCSTR;
alias const(wchar)* LPCWCH, PCWCH, LPCWSTR, PCWSTR; alias const(wchar)* LPCWCH, PCWCH, LPCWSTR, PCWSTR;
alias PSTR* PZPSTR;
alias PWSTR* PZPWSTR;
version (Unicode) { version (Unicode) {
alias WCHAR TCHAR, _TCHAR; alias WCHAR TCHAR, _TCHAR;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment