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

Commit 48bb186

Browse files
committed
Port of druntime to DragonFlyBSD
1 parent df1de06 commit 48bb186

35 files changed

Lines changed: 848 additions & 12 deletions

posix.mak

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ endif
5757

5858
# build with shared library support
5959
# (defaults to true on supported platforms, can be overridden w/ make SHARED=0)
60-
SHARED=$(if $(findstring $(OS),linux freebsd),1,)
60+
SHARED=$(if $(findstring $(OS),linux freebsd dragonflybsd),1,)
6161

6262
LINKDL=$(if $(findstring $(OS),linux),-L-ldl,)
6363

@@ -192,7 +192,7 @@ $(IMPDIR)/%.d : src/%.d
192192
######################## Build DMD if non-existent ##############################
193193

194194
$(DMD):
195-
make -C $(DMD_DIR)/src -f posix.mak BUILD=$(BUILD) OS=$(OS) MODEL=$(MODEL)
195+
$(MAKE) -C $(DMD_DIR)/src -f posix.mak BUILD=$(BUILD) OS=$(OS) MODEL=$(MODEL)
196196

197197
################### C/ASM Targets ############################
198198

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 )
@@ -700,6 +702,8 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
700702
import core.sys.freebsd.execinfo;
701703
else version( NetBSD )
702704
import core.sys.netbsd.execinfo;
705+
else version( DragonFlyBSD )
706+
import core.sys.dragonflybsd.execinfo;
703707
else version( Windows )
704708
import core.sys.windows.stacktrace;
705709
else version( Solaris )
@@ -786,6 +790,7 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
786790

787791
version(linux) enum enableDwarf = true;
788792
else version(FreeBSD) enum enableDwarf = true;
793+
else version(DragonFlyBSD) enum enableDwarf = true;
789794
else enum enableDwarf = false;
790795

791796
static if (enableDwarf)
@@ -909,6 +914,18 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
909914
symEnd = eptr - buf.ptr;
910915
}
911916
}
917+
else version( DragonFlyBSD )
918+
{
919+
// format is: 0x00000000 <_D6module4funcAFZv+0x78> at module
920+
auto bptr = cast(char*) memchr( buf.ptr, '<', buf.length );
921+
auto eptr = cast(char*) memchr( buf.ptr, '+', buf.length );
922+
923+
if( bptr++ && eptr )
924+
{
925+
symBeg = bptr - buf.ptr;
926+
symEnd = eptr - buf.ptr;
927+
}
928+
}
912929
else version( Solaris )
913930
{
914931
// 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.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#include <errno.h>
1313

14-
1514
int getErrno()
1615
{
1716
return errno;

src/core/stdc/errno.d

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ else version (FreeBSD)
5959
alias errno = __error;
6060
}
6161
}
62+
else version (DragonFlyBSD)
63+
{
64+
pragma(mangle, "errno") extern int __errno;
65+
ref int errno() { return __errno;}
66+
}
6267
else version (CRuntime_Bionic)
6368
{
6469
extern (C)
@@ -1822,6 +1827,109 @@ else version( OpenBSD )
18221827
enum ENOTSUP = 91; /// Not supported
18231828
enum ELAST = 91; /// Must be equal largest errno
18241829
}
1830+
else version( DragonFlyBSD )
1831+
{
1832+
enum EPERM = 1; /// Operation not permitted
1833+
enum ENOENT = 2; /// No such file or directory
1834+
enum ESRCH = 3; /// No such process
1835+
enum EINTR = 4; /// Interrupted system call
1836+
enum EIO = 5; /// Input/output error
1837+
enum ENXIO = 6; /// Device not configured
1838+
enum E2BIG = 7; /// Argument list too long
1839+
enum ENOEXEC = 8; /// Exec format error
1840+
enum EBADF = 9; /// Bad file descriptor
1841+
enum ECHILD = 10; /// No child processes
1842+
enum EDEADLK = 11; /// Resource deadlock avoided
1843+
enum ENOMEM = 12; /// Cannot allocate memory
1844+
enum EACCES = 13; /// Permission denied
1845+
enum EFAULT = 14; /// Bad address
1846+
enum ENOTBLK = 15; /// Block device required
1847+
enum EBUSY = 16; /// Device busy
1848+
enum EEXIST = 17; /// File exists
1849+
enum EXDEV = 18; /// Cross-device link
1850+
enum ENODEV = 19; /// Operation not supported by device
1851+
enum ENOTDIR = 20; /// Not a directory
1852+
enum EISDIR = 21; /// Is a directory
1853+
enum EINVAL = 22; /// Invalid argument
1854+
enum ENFILE = 23; /// Too many open files in system
1855+
enum EMFILE = 24; /// Too many open files
1856+
enum ENOTTY = 25; /// Inappropriate ioctl for device
1857+
enum ETXTBSY = 26; /// Text file busy
1858+
enum EFBIG = 27; /// File too large
1859+
enum ENOSPC = 28; /// No space left on device
1860+
enum ESPIPE = 29; /// Illegal seek
1861+
enum EROFS = 30; /// Read-only file system
1862+
enum EMLINK = 31; /// Too many links
1863+
enum EPIPE = 32; /// Broken pipe
1864+
enum EDOM = 33; /// Numerical argument out of domain
1865+
enum ERANGE = 34; /// Result too large
1866+
enum EAGAIN = 35; /// Resource temporarily unavailable
1867+
enum EWOULDBLOCK = EAGAIN; /// Operation would block
1868+
enum EINPROGRESS = 36; /// Operation now in progress
1869+
enum EALREADY = 37; /// Operation already in progress
1870+
enum ENOTSOCK = 38; /// Socket operation on non-socket
1871+
enum EDESTADDRREQ = 39; /// Destination address required
1872+
enum EMSGSIZE = 40; /// Message too long
1873+
enum EPROTOTYPE = 41; /// Protocol wrong type for socket
1874+
enum ENOPROTOOPT = 42; /// Protocol not available
1875+
enum EPROTONOSUPPORT = 43; /// Protocol not supported
1876+
enum ENOTSUP = 45; /// Operation not supported
1877+
enum EOPNOTSUPP = ENOTSUP; /// Operation not supported on socket
1878+
enum EPFNOSUPPORT = 46; /// Protocol family not supported
1879+
enum EAFNOSUPPORT = 47; /// Address family not supported by protocol family
1880+
enum EADDRINUSE = 48; /// Address already in use
1881+
enum EADDRNOTAVAIL = 49; /// Can't assign requested address
1882+
enum ENETDOWN = 50; /// Network is down
1883+
enum ENETUNREACH = 51; /// Network is unreachable
1884+
enum ENETRESET = 52; /// Network dropped connection on reset
1885+
enum ECONNABORTED = 53; /// Software caused connection abort
1886+
enum ECONNRESET = 54; /// Connection reset by peer
1887+
enum ENOBUFS = 55; /// No buffer space available
1888+
enum EISCONN = 56; /// Socket is already connected
1889+
enum ENOTCONN = 57; /// Socket is not connected
1890+
enum ESHUTDOWN = 58; /// Can't send after socket shutdown
1891+
enum ETOOMANYREFS = 59; /// Too many refrences; can't splice
1892+
enum ETIMEDOUT = 60; /// Operation timed out
1893+
enum ECONNREFUSED = 61; /// Connection refused
1894+
enum ELOOP = 62; /// Too many levels of symbolic links
1895+
enum ENAMETOOLONG = 63; /// File name too long
1896+
enum EHOSTUNREACH = 65; /// No route to host
1897+
enum ENOTEMPTY = 66; /// Directory not empty
1898+
enum EPROCLIM = 67; /// Too many processes
1899+
enum EUSERS = 68; /// Too many users
1900+
enum EDQUOT = 69; /// Disc quota exceeded
1901+
enum ESTALE = 70; /// Stale NFS file handle
1902+
enum EREMOTE = 71; /// Too many levels of remote in path
1903+
enum EBADRPC = 72; /// RPC struct is bad
1904+
enum ERPCMISMATCH = 73; /// RPC version wrong
1905+
enum EPROGUNAVAIL = 74; /// RPC prog. not avail
1906+
enum EPROGMISMATCH = 75; /// Program version wrong
1907+
enum EPROCUNAVAIL = 76; /// Bad procedure for program
1908+
enum ENOLCK = 77; /// No locks available
1909+
enum ENOSYS = 78; /// Function not implemented
1910+
enum EFTYPE = 79; /// Inappropriate file type or format
1911+
enum EAUTH = 80; /// Authentication error
1912+
enum ENEEDAUTH = 81; /// Need authenticator
1913+
enum EIDRM = 82; /// Itendifier removed
1914+
enum ENOMSG = 83; /// No message of desired type
1915+
enum EOVERFLOW = 84; /// Value too large to be stored in data type
1916+
enum ECANCELED = 85; /// Operation canceled
1917+
enum EILSEQ = 86; /// Illegal byte sequence
1918+
enum ENOATTR = 87; /// Attribute not found
1919+
enum EDOOFUS = 88; /// Programming error
1920+
enum EBADMSG = 89; /// Bad message
1921+
enum EMULTIHOP = 90; /// Multihop attempted
1922+
enum ENOLINK = 91; /// Link has been severed
1923+
enum EPROTO = 92; /// Protocol error
1924+
enum ENOMEDIUM = 93;
1925+
enum EUNUSED94 = 94;
1926+
enum EUNUSED95 = 95;
1927+
enum EUNUSED96 = 96;
1928+
enum EUNUSED97 = 97;
1929+
enum EUNUSED98 = 98;
1930+
enum EASYNC = 99;
1931+
enum ELAST = 99; /// Must be equal largest errno
1932+
}
18251933
else version (Solaris)
18261934
{
18271935
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
@@ -258,6 +258,24 @@ else version ( OpenBSD )
258258

259259
alias fexcept_t = uint;
260260
}
261+
else version ( DragonFlyBSD )
262+
{
263+
struct fenv_t
264+
{
265+
struct _x87
266+
{
267+
uint control;
268+
uint status;
269+
uint tag;
270+
uint[4] others;
271+
};
272+
_x87 x87;
273+
274+
uint mxcsr;
275+
}
276+
277+
alias uint fexcept_t;
278+
}
261279
else version( CRuntime_Bionic )
262280
{
263281
version(X86)
@@ -617,6 +635,12 @@ else version( OpenBSD )
617635
///
618636
enum FE_DFL_ENV = &__fe_dfl_env;
619637
}
638+
else version( DragonFlyBSD )
639+
{
640+
private extern const fenv_t __fe_dfl_env;
641+
///
642+
enum FE_DFL_ENV = &__fe_dfl_env;
643+
}
620644
else version( CRuntime_Bionic )
621645
{
622646
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)