Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/core/runtime.d
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ extern (C) UnitTestResult runModuleUnitTests()
import core.sys.freebsd.execinfo;
else version( NetBSD )
import core.sys.netbsd.execinfo;
else version( DragonFlyBSD )
import core.sys.dragonflybsd.execinfo;
else version( Windows )
import core.sys.windows.stacktrace;
else version( Solaris )
Expand Down Expand Up @@ -705,6 +707,8 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
import core.sys.freebsd.execinfo;
else version( NetBSD )
import core.sys.netbsd.execinfo;
else version( DragonFlyBSD )
import core.sys.dragonflybsd.execinfo;
else version( Windows )
import core.sys.windows.stacktrace;
else version( Solaris )
Expand Down Expand Up @@ -791,6 +795,7 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )

version(linux) enum enableDwarf = true;
else version(FreeBSD) enum enableDwarf = true;
else version(DragonFlyBSD) enum enableDwarf = true;
else enum enableDwarf = false;

static if (enableDwarf)
Expand Down Expand Up @@ -914,6 +919,18 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
symEnd = eptr - buf.ptr;
}
}
else version( DragonFlyBSD )
{
// format is: 0x00000000 <_D6module4funcAFZv+0x78> at module
auto bptr = cast(char*) memchr( buf.ptr, '<', buf.length );
auto eptr = cast(char*) memchr( buf.ptr, '+', buf.length );

if( bptr++ && eptr )
{
symBeg = bptr - buf.ptr;
symEnd = eptr - buf.ptr;
}
}
else version( Solaris )
{
// format is object'symbol+offset [pc]
Expand Down
7 changes: 7 additions & 0 deletions src/core/stdc/assert_.d
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ else version (FreeBSD)
*/
void __assert(const(char)* exp, const(char)* file, uint line);
}
else version (DragonFlyBSD)
{
/***
* Assert failure function in the DragonFlyBSD C library.
*/
void __assert(const(char)* exp, const(char)* file, uint line);
}
else version (CRuntime_Glibc)
{
/***
Expand Down
2 changes: 2 additions & 0 deletions src/core/stdc/config.d
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ else version( DigitalMars )
alias real c_long_double;
else version( NetBSD )
alias real c_long_double;
else version( DragonFlyBSD )
alias real c_long_double;
else version( Solaris )
alias real c_long_double;
else version( Darwin )
Expand Down
108 changes: 108 additions & 0 deletions src/core/stdc/errno.d
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ else version (FreeBSD)
alias errno = __error;
}
}
else version (DragonFlyBSD)
{
pragma(mangle, "errno") extern int __errno;
ref int errno() { return __errno;}
}
else version (CRuntime_Bionic)
{
extern (C)
Expand Down Expand Up @@ -1830,6 +1835,109 @@ else version( OpenBSD )
enum ENOTSUP = 91; /// Not supported
enum ELAST = 91; /// Must be equal largest errno
}
else version( DragonFlyBSD )
{
enum EPERM = 1;
enum ENOENT = 2;
enum ESRCH = 3;
enum EINTR = 4;
enum EIO = 5;
enum ENXIO = 6;
enum E2BIG = 7;
enum ENOEXEC = 8;
enum EBADF = 9;
enum ECHILD = 10;
enum EDEADLK = 11;
enum ENOMEM = 12;
enum EACCES = 13;
enum EFAULT = 14;
enum ENOTBLK = 15;
enum EBUSY = 16;
enum EEXIST = 17;
enum EXDEV = 18;
enum ENODEV = 19;
enum ENOTDIR = 20;
enum EISDIR = 21;
enum EINVAL = 22;
enum ENFILE = 23;
enum EMFILE = 24;
enum ENOTTY = 25;
enum ETXTBSY = 26;
enum EFBIG = 27;
enum ENOSPC = 28;
enum ESPIPE = 29;
enum EROFS = 30;
enum EMLINK = 31;
enum EPIPE = 32;
enum EDOM = 33;
enum ERANGE = 34;
enum EAGAIN = 35;
enum EWOULDBLOCK = EAGAIN;
enum EINPROGRESS = 36;
enum EALREADY = 37;
enum ENOTSOCK = 38;
enum EDESTADDRREQ = 39;
enum EMSGSIZE = 40;
enum EPROTOTYPE = 41;
enum ENOPROTOOPT = 42;
enum EPROTONOSUPPORT = 43;
enum ENOTSUP = 45;
enum EOPNOTSUPP = ENOTSUP;
enum EPFNOSUPPORT = 46;
enum EAFNOSUPPORT = 47;
enum EADDRINUSE = 48;
enum EADDRNOTAVAIL = 49;
enum ENETDOWN = 50;
enum ENETUNREACH = 51;
enum ENETRESET = 52;
enum ECONNABORTED = 53;
enum ECONNRESET = 54;
enum ENOBUFS = 55;
enum EISCONN = 56;
enum ENOTCONN = 57;
enum ESHUTDOWN = 58;
enum ETOOMANYREFS = 59;
enum ETIMEDOUT = 60;
enum ECONNREFUSED = 61;
enum ELOOP = 62;
enum ENAMETOOLONG = 63;
enum EHOSTUNREACH = 65;
enum ENOTEMPTY = 66;
enum EPROCLIM = 67;
enum EUSERS = 68;
enum EDQUOT = 69;
enum ESTALE = 70;
enum EREMOTE = 71;
enum EBADRPC = 72;
enum ERPCMISMATCH = 73;
enum EPROGUNAVAIL = 74;
enum EPROGMISMATCH = 75;
enum EPROCUNAVAIL = 76;
enum ENOLCK = 77;
enum ENOSYS = 78;
enum EFTYPE = 79;
enum EAUTH = 80;
enum ENEEDAUTH = 81;
enum EIDRM = 82;
enum ENOMSG = 83;
enum EOVERFLOW = 84;
enum ECANCELED = 85;
enum EILSEQ = 86;
enum ENOATTR = 87;
enum EDOOFUS = 88;
enum EBADMSG = 89;
enum EMULTIHOP = 90;
enum ENOLINK = 91;
enum EPROTO = 92;
enum ENOMEDIUM = 93;
enum EUNUSED94 = 94;
enum EUNUSED95 = 95;
enum EUNUSED96 = 96;
enum EUNUSED97 = 97;
enum EUNUSED98 = 98;
enum EASYNC = 99;
enum ELAST = 99;
}
else version (Solaris)
{
enum EPERM = 1 /** Not super-user */;
Expand Down
24 changes: 24 additions & 0 deletions src/core/stdc/fenv.d
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,24 @@ else version ( OpenBSD )

alias fexcept_t = uint;
}
else version ( DragonFlyBSD )
{
struct fenv_t
{
struct _x87
{
uint control;
uint status;
uint tag;
uint[4] others;
};
_x87 x87;

uint mxcsr;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this patch, but I've just noticed that the OpenBSD branch is wrong.

}

alias uint fexcept_t;
}
else version( CRuntime_Bionic )
{
version(X86)
Expand Down Expand Up @@ -649,6 +667,12 @@ else version( OpenBSD )
///
enum FE_DFL_ENV = &__fe_dfl_env;
}
else version( DragonFlyBSD )
{
private extern const fenv_t __fe_dfl_env;
///
enum FE_DFL_ENV = &__fe_dfl_env;
}
else version( CRuntime_Bionic )
{
private extern const fenv_t __fe_dfl_env;
Expand Down
17 changes: 17 additions & 0 deletions src/core/stdc/locale.d
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,23 @@ else version(OpenBSD)
///
enum LC_MESSAGES = 6;
}
else version(DragonFlyBSD)
{
///
enum LC_ALL = 0;
///
enum LC_COLLATE = 1;
///
enum LC_CTYPE = 2;
///
enum LC_MONETARY = 3;
///
enum LC_NUMERIC = 4;
///
enum LC_TIME = 5;
///
enum LC_MESSAGES = 6;
}
else version(CRuntime_Bionic)
{
enum
Expand Down
Loading