Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 2613173

Browse files
authored
Merge pull request #1999 from dkgroot/dragonflybsd-master
Add DragonFlyBSD support for druntime merged-on-behalf-of: unknown
2 parents dee73ba + d580191 commit 2613173

File tree

31 files changed

+760
-17
lines changed

31 files changed

+760
-17
lines changed

src/core/runtime.d

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,8 @@ extern (C) UnitTestResult runModuleUnitTests()
588588
import core.sys.freebsd.execinfo;
589589
else version( NetBSD )
590590
import core.sys.netbsd.execinfo;
591+
else version( DragonFlyBSD )
592+
import core.sys.dragonflybsd.execinfo;
591593
else version( Windows )
592594
import core.sys.windows.stacktrace;
593595
else version( Solaris )
@@ -705,6 +707,8 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
705707
import core.sys.freebsd.execinfo;
706708
else version( NetBSD )
707709
import core.sys.netbsd.execinfo;
710+
else version( DragonFlyBSD )
711+
import core.sys.dragonflybsd.execinfo;
708712
else version( Windows )
709713
import core.sys.windows.stacktrace;
710714
else version( Solaris )
@@ -791,6 +795,7 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
791795

792796
version(linux) enum enableDwarf = true;
793797
else version(FreeBSD) enum enableDwarf = true;
798+
else version(DragonFlyBSD) enum enableDwarf = true;
794799
else enum enableDwarf = false;
795800

796801
static if (enableDwarf)
@@ -914,6 +919,18 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
914919
symEnd = eptr - buf.ptr;
915920
}
916921
}
922+
else version( DragonFlyBSD )
923+
{
924+
// format is: 0x00000000 <_D6module4funcAFZv+0x78> at module
925+
auto bptr = cast(char*) memchr( buf.ptr, '<', buf.length );
926+
auto eptr = cast(char*) memchr( buf.ptr, '+', buf.length );
927+
928+
if( bptr++ && eptr )
929+
{
930+
symBeg = bptr - buf.ptr;
931+
symEnd = eptr - buf.ptr;
932+
}
933+
}
917934
else version( Solaris )
918935
{
919936
// format is object'symbol+offset [pc]

src/core/stdc/assert_.d

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ else version (FreeBSD)
5353
*/
5454
void __assert(const(char)* exp, const(char)* file, uint line);
5555
}
56+
else version (DragonFlyBSD)
57+
{
58+
/***
59+
* Assert failure function in the DragonFlyBSD C library.
60+
*/
61+
void __assert(const(char)* exp, const(char)* file, uint line);
62+
}
5663
else version (CRuntime_Glibc)
5764
{
5865
/***

src/core/stdc/config.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ else version( DigitalMars )
129129
alias real c_long_double;
130130
else version( NetBSD )
131131
alias real c_long_double;
132+
else version( DragonFlyBSD )
133+
alias real c_long_double;
132134
else version( Solaris )
133135
alias real c_long_double;
134136
else version( Darwin )

src/core/stdc/errno.d

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ else version (FreeBSD)
6767
alias errno = __error;
6868
}
6969
}
70+
else version (DragonFlyBSD)
71+
{
72+
pragma(mangle, "errno") extern int __errno;
73+
ref int errno() { return __errno;}
74+
}
7075
else version (CRuntime_Bionic)
7176
{
7277
extern (C)
@@ -1838,6 +1843,109 @@ else version( OpenBSD )
18381843
enum ENOTSUP = 91; /// Not supported
18391844
enum ELAST = 91; /// Must be equal largest errno
18401845
}
1846+
else version( DragonFlyBSD )
1847+
{
1848+
enum EPERM = 1;
1849+
enum ENOENT = 2;
1850+
enum ESRCH = 3;
1851+
enum EINTR = 4;
1852+
enum EIO = 5;
1853+
enum ENXIO = 6;
1854+
enum E2BIG = 7;
1855+
enum ENOEXEC = 8;
1856+
enum EBADF = 9;
1857+
enum ECHILD = 10;
1858+
enum EDEADLK = 11;
1859+
enum ENOMEM = 12;
1860+
enum EACCES = 13;
1861+
enum EFAULT = 14;
1862+
enum ENOTBLK = 15;
1863+
enum EBUSY = 16;
1864+
enum EEXIST = 17;
1865+
enum EXDEV = 18;
1866+
enum ENODEV = 19;
1867+
enum ENOTDIR = 20;
1868+
enum EISDIR = 21;
1869+
enum EINVAL = 22;
1870+
enum ENFILE = 23;
1871+
enum EMFILE = 24;
1872+
enum ENOTTY = 25;
1873+
enum ETXTBSY = 26;
1874+
enum EFBIG = 27;
1875+
enum ENOSPC = 28;
1876+
enum ESPIPE = 29;
1877+
enum EROFS = 30;
1878+
enum EMLINK = 31;
1879+
enum EPIPE = 32;
1880+
enum EDOM = 33;
1881+
enum ERANGE = 34;
1882+
enum EAGAIN = 35;
1883+
enum EWOULDBLOCK = EAGAIN;
1884+
enum EINPROGRESS = 36;
1885+
enum EALREADY = 37;
1886+
enum ENOTSOCK = 38;
1887+
enum EDESTADDRREQ = 39;
1888+
enum EMSGSIZE = 40;
1889+
enum EPROTOTYPE = 41;
1890+
enum ENOPROTOOPT = 42;
1891+
enum EPROTONOSUPPORT = 43;
1892+
enum ENOTSUP = 45;
1893+
enum EOPNOTSUPP = ENOTSUP;
1894+
enum EPFNOSUPPORT = 46;
1895+
enum EAFNOSUPPORT = 47;
1896+
enum EADDRINUSE = 48;
1897+
enum EADDRNOTAVAIL = 49;
1898+
enum ENETDOWN = 50;
1899+
enum ENETUNREACH = 51;
1900+
enum ENETRESET = 52;
1901+
enum ECONNABORTED = 53;
1902+
enum ECONNRESET = 54;
1903+
enum ENOBUFS = 55;
1904+
enum EISCONN = 56;
1905+
enum ENOTCONN = 57;
1906+
enum ESHUTDOWN = 58;
1907+
enum ETOOMANYREFS = 59;
1908+
enum ETIMEDOUT = 60;
1909+
enum ECONNREFUSED = 61;
1910+
enum ELOOP = 62;
1911+
enum ENAMETOOLONG = 63;
1912+
enum EHOSTUNREACH = 65;
1913+
enum ENOTEMPTY = 66;
1914+
enum EPROCLIM = 67;
1915+
enum EUSERS = 68;
1916+
enum EDQUOT = 69;
1917+
enum ESTALE = 70;
1918+
enum EREMOTE = 71;
1919+
enum EBADRPC = 72;
1920+
enum ERPCMISMATCH = 73;
1921+
enum EPROGUNAVAIL = 74;
1922+
enum EPROGMISMATCH = 75;
1923+
enum EPROCUNAVAIL = 76;
1924+
enum ENOLCK = 77;
1925+
enum ENOSYS = 78;
1926+
enum EFTYPE = 79;
1927+
enum EAUTH = 80;
1928+
enum ENEEDAUTH = 81;
1929+
enum EIDRM = 82;
1930+
enum ENOMSG = 83;
1931+
enum EOVERFLOW = 84;
1932+
enum ECANCELED = 85;
1933+
enum EILSEQ = 86;
1934+
enum ENOATTR = 87;
1935+
enum EDOOFUS = 88;
1936+
enum EBADMSG = 89;
1937+
enum EMULTIHOP = 90;
1938+
enum ENOLINK = 91;
1939+
enum EPROTO = 92;
1940+
enum ENOMEDIUM = 93;
1941+
enum EUNUSED94 = 94;
1942+
enum EUNUSED95 = 95;
1943+
enum EUNUSED96 = 96;
1944+
enum EUNUSED97 = 97;
1945+
enum EUNUSED98 = 98;
1946+
enum EASYNC = 99;
1947+
enum ELAST = 99;
1948+
}
18411949
else version (Solaris)
18421950
{
18431951
enum EPERM = 1 /** Not super-user */;

src/core/stdc/fenv.d

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,24 @@ else version ( OpenBSD )
263263

264264
alias fexcept_t = uint;
265265
}
266+
else version ( DragonFlyBSD )
267+
{
268+
struct fenv_t
269+
{
270+
struct _x87
271+
{
272+
uint control;
273+
uint status;
274+
uint tag;
275+
uint[4] others;
276+
};
277+
_x87 x87;
278+
279+
uint mxcsr;
280+
}
281+
282+
alias uint fexcept_t;
283+
}
266284
else version( CRuntime_Bionic )
267285
{
268286
version(X86)
@@ -706,6 +724,12 @@ else version( OpenBSD )
706724
///
707725
enum FE_DFL_ENV = &__fe_dfl_env;
708726
}
727+
else version( DragonFlyBSD )
728+
{
729+
private extern const fenv_t __fe_dfl_env;
730+
///
731+
enum FE_DFL_ENV = &__fe_dfl_env;
732+
}
709733
else version( CRuntime_Bionic )
710734
{
711735
private extern const fenv_t __fe_dfl_env;

src/core/stdc/locale.d

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,23 @@ else version(OpenBSD)
169169
///
170170
enum LC_MESSAGES = 6;
171171
}
172+
else version(DragonFlyBSD)
173+
{
174+
///
175+
enum LC_ALL = 0;
176+
///
177+
enum LC_COLLATE = 1;
178+
///
179+
enum LC_CTYPE = 2;
180+
///
181+
enum LC_MONETARY = 3;
182+
///
183+
enum LC_NUMERIC = 4;
184+
///
185+
enum LC_TIME = 5;
186+
///
187+
enum LC_MESSAGES = 6;
188+
}
172189
else version(CRuntime_Bionic)
173190
{
174191
enum

0 commit comments

Comments
 (0)