mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Port of phobos to DragonFlyBSD
Notes: - FIXME message related to dragonfly malloc issue (issue reported on upstream dragonfly issue database)
This commit is contained in:
parent
801fa1696b
commit
31ca73d58d
11 changed files with 88 additions and 10 deletions
|
@ -13,7 +13,8 @@
|
|||
#
|
||||
# make BUILD=debug unittest => builds all unittests (for debug) and runs them
|
||||
#
|
||||
# make DEBUGGER=ddd std/XXXXX.debug => builds the module XXXXX and executes it in the debugger ddd
|
||||
# make DEBUGGER=ddd std/XXXXX.debug => builds the module XXXXX and executes it
|
||||
# in the debugger ddd
|
||||
#
|
||||
# make html => makes html documentation
|
||||
#
|
||||
|
@ -25,10 +26,10 @@
|
|||
################################################################################
|
||||
# Configurable stuff, usually from the command line
|
||||
#
|
||||
# OS can be linux, win32, win32wine, osx, or freebsd. The system will be
|
||||
# determined by using uname
|
||||
# OS can be linux, win32, win32wine, osx, freebsd, netbsd or dragonflybsd.
|
||||
# The system will be determined by using uname
|
||||
|
||||
QUIET:=
|
||||
QUIET:=@
|
||||
|
||||
DEBUGGER=gdb
|
||||
GIT_HOME=https://github.com/dlang
|
||||
|
|
|
@ -214,6 +214,22 @@ public:
|
|||
hnsecsToUnixEpoch;
|
||||
}
|
||||
}
|
||||
else version(DragonFlyBSD)
|
||||
{
|
||||
import core.sys.dragonflybsd.time : clock_gettime, CLOCK_REALTIME,
|
||||
CLOCK_REALTIME_FAST, CLOCK_REALTIME_PRECISE, CLOCK_SECOND;
|
||||
static if (clockType == ClockType.coarse) alias clockArg = CLOCK_REALTIME_FAST;
|
||||
else static if (clockType == ClockType.normal) alias clockArg = CLOCK_REALTIME;
|
||||
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");
|
||||
return convert!("seconds", "hnsecs")(ts.tv_sec) +
|
||||
ts.tv_nsec / 100 +
|
||||
hnsecsToUnixEpoch;
|
||||
}
|
||||
else version(Solaris)
|
||||
{
|
||||
static if (clockType == ClockType.second)
|
||||
|
|
|
@ -327,6 +327,7 @@ public:
|
|||
{
|
||||
version(FreeBSD) enum utcZone = "Etc/UTC";
|
||||
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 static assert(0, "The location of the UTC timezone file on this Posix platform must be set.");
|
||||
|
|
|
@ -278,7 +278,7 @@ struct AlignedMallocator
|
|||
|
||||
/**
|
||||
Forwards to $(D alignedReallocate(b, newSize, platformAlignment)).
|
||||
Should be used with bocks obtained with `allocate` otherwise the custom
|
||||
Should be used with blocks obtained with `allocate` otherwise the custom
|
||||
alignment passed with `alignedAllocate` can be lost.
|
||||
*/
|
||||
@system @nogc nothrow
|
||||
|
@ -375,6 +375,9 @@ version(Posix)
|
|||
AlignedMallocator.instance.alignedReallocate(c, 32, 32);
|
||||
assert(c.ptr);
|
||||
|
||||
version (DragonFlyBSD) {} else /* FIXME: Malloc on DragonFly does not return NULL when allocating more than UINTPTR_MAX
|
||||
* $(LINK: https://bugs.dragonflybsd.org/issues/3114, dragonfly bug report)
|
||||
* $(LINK: https://github.com/dlang/druntime/pull/1999#discussion_r157536030, PR Discussion) */
|
||||
assert(!AlignedMallocator.instance.alignedReallocate(c, size_t.max, 4096));
|
||||
AlignedMallocator.instance.deallocate(c);
|
||||
}
|
||||
|
|
|
@ -1488,6 +1488,7 @@ if (isInputRange!R && !isInfinite!R && isSomeChar!(ElementEncodingType!R))
|
|||
// - OS X, where the native filesystem (HFS+) stores filesystem
|
||||
// timestamps with 1-second precision.
|
||||
version (FreeBSD) {} else
|
||||
version (DragonFlyBSD) {} else
|
||||
version (OSX) {} else
|
||||
@system unittest
|
||||
{
|
||||
|
@ -2779,6 +2780,10 @@ else version (NetBSD)
|
|||
{
|
||||
return readLink("/proc/self/exe");
|
||||
}
|
||||
else version (DragonFlyBSD)
|
||||
{
|
||||
return readLink("/proc/curproc/file");
|
||||
}
|
||||
else version (Solaris)
|
||||
{
|
||||
import core.sys.posix.unistd : getpid;
|
||||
|
|
28
std/math.d
28
std/math.d
|
@ -7444,6 +7444,34 @@ private real polyImpl(real x, in real[] A) @trusted pure nothrow @nogc
|
|||
;
|
||||
}
|
||||
}
|
||||
else version (DragonFlyBSD)
|
||||
{
|
||||
asm pure nothrow @nogc // assembler by W. Bright
|
||||
{
|
||||
// EDX = (A.length - 1) * real.sizeof
|
||||
mov ECX,A[EBP] ; // ECX = A.length
|
||||
dec ECX ;
|
||||
lea EDX,[ECX*8] ;
|
||||
lea EDX,[EDX][ECX*4] ;
|
||||
add EDX,A+4[EBP] ;
|
||||
fld real ptr [EDX] ; // ST0 = coeff[ECX]
|
||||
jecxz return_ST ;
|
||||
fld x[EBP] ; // ST0 = x
|
||||
fxch ST(1) ; // ST1 = x, ST0 = r
|
||||
align 4 ;
|
||||
L2: fmul ST,ST(1) ; // r *= x
|
||||
fld real ptr -12[EDX] ;
|
||||
sub EDX,12 ; // deg--
|
||||
faddp ST(1),ST ;
|
||||
dec ECX ;
|
||||
jne L2 ;
|
||||
fxch ST(1) ; // ST1 = r, ST0 = x
|
||||
fstp ST(0) ; // dump x
|
||||
align 4 ;
|
||||
return_ST: ;
|
||||
;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
static assert(0);
|
||||
|
|
|
@ -94,6 +94,10 @@ else version(FreeBSD)
|
|||
{
|
||||
version = useSysctlbyname;
|
||||
}
|
||||
else version(DragonFlyBSD)
|
||||
{
|
||||
version = useSysctlbyname;
|
||||
}
|
||||
else version(NetBSD)
|
||||
{
|
||||
version = useSysctlbyname;
|
||||
|
@ -984,6 +988,10 @@ uint totalCPUsImpl() @nogc nothrow @trusted
|
|||
{
|
||||
auto nameStr = "hw.ncpu\0".ptr;
|
||||
}
|
||||
else version(DragonFlyBSD)
|
||||
{
|
||||
auto nameStr = "hw.ncpu\0".ptr;
|
||||
}
|
||||
else version(NetBSD)
|
||||
{
|
||||
auto nameStr = "hw.ncpu\0".ptr;
|
||||
|
|
|
@ -3970,7 +3970,7 @@ string expandTilde(string inputPath) nothrow
|
|||
}
|
||||
|
||||
if (errno != ERANGE &&
|
||||
// On FreeBSD and OSX, errno can be left at 0 instead of set to ERANGE
|
||||
// On BSD and OSX, errno can be left at 0 instead of set to ERANGE
|
||||
errno != 0)
|
||||
onOutOfMemoryError();
|
||||
|
||||
|
|
|
@ -187,6 +187,14 @@ string formatSocketError(int err) @trusted
|
|||
else
|
||||
return "Socket error " ~ to!string(err);
|
||||
}
|
||||
else version (DragonFlyBSD)
|
||||
{
|
||||
auto errs = strerror_r(err, buf.ptr, buf.length);
|
||||
if (errs == 0)
|
||||
cs = buf.ptr;
|
||||
else
|
||||
return "Socket error " ~ to!string(err);
|
||||
}
|
||||
else version (Solaris)
|
||||
{
|
||||
auto errs = strerror_r(err, buf.ptr, buf.length);
|
||||
|
|
|
@ -63,6 +63,12 @@ version (NetBSD)
|
|||
version = HAS_GETDELIM;
|
||||
}
|
||||
|
||||
version (DragonFlyBSD)
|
||||
{
|
||||
version = GENERIC_IO;
|
||||
version = HAS_GETDELIM;
|
||||
}
|
||||
|
||||
version (Solaris)
|
||||
{
|
||||
version = GENERIC_IO;
|
||||
|
|
|
@ -32,6 +32,7 @@ immutable
|
|||
osx, /// Mac OS X
|
||||
freeBSD, /// FreeBSD
|
||||
netBSD, /// NetBSD
|
||||
dragonFlyBSD, /// DragonFlyBSD
|
||||
solaris, /// Solaris
|
||||
android, /// Android
|
||||
otherPosix /// Other Posix Systems
|
||||
|
@ -45,6 +46,7 @@ immutable
|
|||
else version(OSX) OS os = OS.osx;
|
||||
else version(FreeBSD) OS os = OS.freeBSD;
|
||||
else version(NetBSD) OS os = OS.netBSD;
|
||||
else version(DragonFlyBSD) OS os = OS.dragonFlyBSD;
|
||||
else version(Posix) OS os = OS.otherPosix;
|
||||
else static assert(0, "Unknown OS.");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue