@@ -1,4 +1,4 @@
-e6caaab9d359198b760c698dcb6d253afb3f81f6
+178c44ff362902af589603767055cfac89215652
The first line of this file holds the git revision number of the last
merge done from the dlang/druntime repository.
@@ -280,8 +280,9 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \
core/sys/linux/sys/procfs.d core/sys/linux/sys/signalfd.d \
core/sys/linux/sys/socket.d core/sys/linux/sys/sysinfo.d \
core/sys/linux/sys/time.d core/sys/linux/sys/xattr.d \
- core/sys/linux/termios.d core/sys/linux/time.d \
- core/sys/linux/timerfd.d core/sys/linux/tipc.d core/sys/linux/unistd.d
+ core/sys/linux/syscalls.d core/sys/linux/termios.d \
+ core/sys/linux/time.d core/sys/linux/timerfd.d core/sys/linux/tipc.d \
+ core/sys/linux/unistd.d
DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \
core/sys/netbsd/err.d core/sys/netbsd/execinfo.d \
@@ -294,12 +295,13 @@ DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \
DRUNTIME_DSOURCES_OPENBSD = core/sys/openbsd/dlfcn.d \
core/sys/openbsd/err.d core/sys/openbsd/execinfo.d \
- core/sys/openbsd/stdlib.d core/sys/openbsd/string.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/elf_common.d core/sys/openbsd/sys/link_elf.d \
- core/sys/openbsd/sys/mman.d core/sys/openbsd/sys/sysctl.d \
- core/sys/openbsd/time.d core/sys/openbsd/unistd.d
+ core/sys/openbsd/pthread_np.d core/sys/openbsd/stdlib.d \
+ core/sys/openbsd/string.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/elf_common.d \
+ core/sys/openbsd/sys/link_elf.d core/sys/openbsd/sys/mman.d \
+ core/sys/openbsd/sys/sysctl.d core/sys/openbsd/time.d \
+ core/sys/openbsd/unistd.d
DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \
core/sys/posix/arpa/inet.d core/sys/posix/config.d \
@@ -343,10 +343,10 @@ am__objects_14 = core/sys/netbsd/dlfcn.lo core/sys/netbsd/err.lo \
core/sys/netbsd/sys/sysctl.lo core/sys/netbsd/time.lo
@DRUNTIME_OS_NETBSD_TRUE@am__objects_15 = $(am__objects_14)
am__objects_16 = core/sys/openbsd/dlfcn.lo core/sys/openbsd/err.lo \
- core/sys/openbsd/execinfo.lo core/sys/openbsd/stdlib.lo \
- core/sys/openbsd/string.lo core/sys/openbsd/sys/cdefs.lo \
- core/sys/openbsd/sys/elf.lo core/sys/openbsd/sys/elf32.lo \
- core/sys/openbsd/sys/elf64.lo \
+ core/sys/openbsd/execinfo.lo core/sys/openbsd/pthread_np.lo \
+ core/sys/openbsd/stdlib.lo core/sys/openbsd/string.lo \
+ core/sys/openbsd/sys/cdefs.lo core/sys/openbsd/sys/elf.lo \
+ core/sys/openbsd/sys/elf32.lo core/sys/openbsd/sys/elf64.lo \
core/sys/openbsd/sys/elf_common.lo \
core/sys/openbsd/sys/link_elf.lo core/sys/openbsd/sys/mman.lo \
core/sys/openbsd/sys/sysctl.lo core/sys/openbsd/time.lo \
@@ -367,9 +367,9 @@ am__objects_18 = core/sys/linux/config.lo core/sys/linux/dlfcn.lo \
core/sys/linux/sys/procfs.lo core/sys/linux/sys/signalfd.lo \
core/sys/linux/sys/socket.lo core/sys/linux/sys/sysinfo.lo \
core/sys/linux/sys/time.lo core/sys/linux/sys/xattr.lo \
- core/sys/linux/termios.lo core/sys/linux/time.lo \
- core/sys/linux/timerfd.lo core/sys/linux/tipc.lo \
- core/sys/linux/unistd.lo
+ core/sys/linux/syscalls.lo core/sys/linux/termios.lo \
+ core/sys/linux/time.lo core/sys/linux/timerfd.lo \
+ core/sys/linux/tipc.lo core/sys/linux/unistd.lo
@DRUNTIME_OS_LINUX_TRUE@am__objects_19 = $(am__objects_18)
am__objects_20 = core/sys/windows/accctrl.lo \
core/sys/windows/aclapi.lo core/sys/windows/aclui.lo \
@@ -944,8 +944,9 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \
core/sys/linux/sys/procfs.d core/sys/linux/sys/signalfd.d \
core/sys/linux/sys/socket.d core/sys/linux/sys/sysinfo.d \
core/sys/linux/sys/time.d core/sys/linux/sys/xattr.d \
- core/sys/linux/termios.d core/sys/linux/time.d \
- core/sys/linux/timerfd.d core/sys/linux/tipc.d core/sys/linux/unistd.d
+ core/sys/linux/syscalls.d core/sys/linux/termios.d \
+ core/sys/linux/time.d core/sys/linux/timerfd.d core/sys/linux/tipc.d \
+ core/sys/linux/unistd.d
DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \
core/sys/netbsd/err.d core/sys/netbsd/execinfo.d \
@@ -958,12 +959,13 @@ DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \
DRUNTIME_DSOURCES_OPENBSD = core/sys/openbsd/dlfcn.d \
core/sys/openbsd/err.d core/sys/openbsd/execinfo.d \
- core/sys/openbsd/stdlib.d core/sys/openbsd/string.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/elf_common.d core/sys/openbsd/sys/link_elf.d \
- core/sys/openbsd/sys/mman.d core/sys/openbsd/sys/sysctl.d \
- core/sys/openbsd/time.d core/sys/openbsd/unistd.d
+ core/sys/openbsd/pthread_np.d core/sys/openbsd/stdlib.d \
+ core/sys/openbsd/string.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/elf_common.d \
+ core/sys/openbsd/sys/link_elf.d core/sys/openbsd/sys/mman.d \
+ core/sys/openbsd/sys/sysctl.d core/sys/openbsd/time.d \
+ core/sys/openbsd/unistd.d
DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \
core/sys/posix/arpa/inet.d core/sys/posix/config.d \
@@ -1616,6 +1618,7 @@ core/sys/openbsd/$(am__dirstamp):
core/sys/openbsd/dlfcn.lo: core/sys/openbsd/$(am__dirstamp)
core/sys/openbsd/err.lo: core/sys/openbsd/$(am__dirstamp)
core/sys/openbsd/execinfo.lo: core/sys/openbsd/$(am__dirstamp)
+core/sys/openbsd/pthread_np.lo: core/sys/openbsd/$(am__dirstamp)
core/sys/openbsd/stdlib.lo: core/sys/openbsd/$(am__dirstamp)
core/sys/openbsd/string.lo: core/sys/openbsd/$(am__dirstamp)
core/sys/openbsd/sys/$(am__dirstamp):
@@ -1672,6 +1675,7 @@ core/sys/linux/sys/socket.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/sysinfo.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/time.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/xattr.lo: core/sys/linux/sys/$(am__dirstamp)
+core/sys/linux/syscalls.lo: core/sys/linux/$(am__dirstamp)
core/sys/linux/termios.lo: core/sys/linux/$(am__dirstamp)
core/sys/linux/time.lo: core/sys/linux/$(am__dirstamp)
core/sys/linux/timerfd.lo: core/sys/linux/$(am__dirstamp)
@@ -346,6 +346,13 @@ pure @safe:
}
+ void popFront(int i)
+ {
+ while (i--)
+ popFront();
+ }
+
+
void match( char val )
{
test( val );
@@ -636,6 +643,7 @@ pure @safe:
TypeDelegate
TypeNone
TypeVoid
+ TypeNoreturn
TypeByte
TypeUbyte
TypeShort
@@ -715,6 +723,9 @@ pure @safe:
TypeVoid:
v
+ TypeNoreturn
+ Nn
+
TypeByte:
g
@@ -873,6 +884,10 @@ pure @safe:
popFront();
switch ( front )
{
+ case 'n': // Noreturn
+ popFront();
+ put("noreturn");
+ return dst[beg .. len];
case 'g': // Wild (Ng Type)
popFront();
// TODO: Anything needed here?
@@ -1164,9 +1179,11 @@ pure @safe:
case 'g':
case 'h':
case 'k':
+ case 'n':
// NOTE: The inout parameter type is represented as "Ng".
// The vector parameter type is represented as "Nh".
// The return parameter type is represented as "Nk".
+ // The noreturn parameter type is represented as "Nn".
// These make it look like a FuncAttr, but infact
// if we see these, then we know we're really in
// the parameter list. Rewind and break.
@@ -1217,6 +1234,59 @@ pure @safe:
break;
}
putComma(n);
+
+ /* Do special return, scope, ref, out combinations
+ */
+ int npops;
+ if ( 'M' == front && peek(1) == 'N' && peek(2) == 'k')
+ {
+ const c3 = peek(3);
+ if (c3 == 'J')
+ {
+ put("scope return out "); // MNkJ
+ npops = 4;
+ }
+ else if (c3 == 'K')
+ {
+ put("scope return ref "); // MNkK
+ npops = 4;
+ }
+ }
+ else if ('N' == front && peek(1) == 'k')
+ {
+ const c2 = peek(2);
+ if (c2 == 'J')
+ {
+ put("return out "); // NkJ
+ npops = 3;
+ }
+ else if (c2 == 'K')
+ {
+ put("return ref "); // NkK
+ npops = 3;
+ }
+ else if (c2 == 'M')
+ {
+ const c3 = peek(3);
+ if (c3 == 'J')
+ {
+ put("return scope out "); // NkMJ
+ npops = 4;
+ }
+ else if (c3 == 'K')
+ {
+ put("return scope ref "); // NkMK
+ npops = 4;
+ }
+ else
+ {
+ put("return scope "); // NkM
+ npops = 3;
+ }
+ }
+ }
+ popFront(npops);
+
if ( 'M' == front )
{
popFront();
@@ -2558,6 +2628,15 @@ else
`nothrow @trusted ulong std.algorithm.iteration.FilterResult!(std.typecons.Tuple!(int, "a", int, "b", int, "c").`
~`Tuple.rename!([0:"c", 2:"a"]).rename().__lambda1, int[]).FilterResult.__xtoHash(ref const(std.algorithm.iteration.`
~`FilterResult!(std.typecons.Tuple!(int, "a", int, "b", int, "c").Tuple.rename!([0:"c", 2:"a"]).rename().__lambda1, int[]).FilterResult))`],
+
+ ["_D4test4rrs1FKPiZv", "void test.rrs1(ref int*)"],
+ ["_D4test4rrs1FMNkJPiZv", "void test.rrs1(scope return out int*)"],
+ ["_D4test4rrs1FMNkKPiZv", "void test.rrs1(scope return ref int*)"],
+ ["_D4test4rrs1FNkJPiZv", "void test.rrs1(return out int*)"],
+ ["_D4test4rrs1FNkKPiZv", "void test.rrs1(return ref int*)"],
+ ["_D4test4rrs1FNkMJPiZv", "void test.rrs1(return scope out int*)"],
+ ["_D4test4rrs1FNkMKPiZv", "void test.rrs1(return scope ref int*)"],
+ ["_D4test4rrs1FNkMPiZv", "void test.rrs1(return scope int*)"],
];
@@ -2621,6 +2700,25 @@ unittest
assert(s.demangle == expected);
}
+// https://issues.dlang.org/show_bug.cgi?id=22235
+unittest
+{
+ enum parent = __MODULE__ ~ '.' ~ __traits(identifier, __traits(parent, {}));
+
+ static noreturn abort() { assert(false); }
+ assert(demangle(abort.mangleof) == "pure nothrow @nogc @safe noreturn " ~ parent ~ "().abort()");
+
+ static void accept(noreturn) {}
+ assert(demangle(accept.mangleof) == "pure nothrow @nogc @safe void " ~ parent ~ "().accept(noreturn)");
+
+ static void templ(T)(T, T) {}
+ assert(demangle(templ!noreturn.mangleof) == "pure nothrow @nogc @safe void " ~ parent ~ "().templ!(noreturn).templ(noreturn, noreturn)");
+
+ static struct S(T) {}
+ static void aggr(S!noreturn) { assert(0); }
+ assert(demangle(aggr.mangleof) == "pure nothrow @nogc @safe void " ~ parent ~ "().aggr(" ~ parent ~ "().S!(noreturn).S)");
+}
+
/*
*
*/
@@ -97,7 +97,7 @@ class ArrayIndexError : RangeError
this.length = length;
// Constructing the message is a bit clumsy:
- // It's essentially `printf("index [%zu] exceeds array of length [%zu]", index, length)`,
+ // It's essentially `printf("index [%zu] is out of bounds for array of length [%zu]", index, length)`,
// but even `snprintf` isn't `pure`.
// Also string concatenation isn't `@nogc`, and casting to/from immutable isn't `@safe`
import core.internal.string : unsignedToTempString;
@@ -106,8 +106,7 @@ class ArrayIndexError : RangeError
char[] sink = buf[];
sink.rangeMsgPut("index [");
sink.rangeMsgPut(unsignedToTempString!10(index, tmpBuf));
- sink.rangeMsgPut("]");
- sink.rangeMsgPut(" exceeds array of length ");
+ sink.rangeMsgPut("] is out of bounds for array of length ");
sink.rangeMsgPut(unsignedToTempString!10(length, tmpBuf));
this.msgBuf = buf;
super(msgBuf[0..$-sink.length], file, line, next);
@@ -116,7 +115,7 @@ class ArrayIndexError : RangeError
@safe pure unittest
{
- assert(new ArrayIndexError(900, 700).msg == "index [900] exceeds array of length 700");
+ assert(new ArrayIndexError(900, 700).msg == "index [900] is out of bounds for array of length 700");
// Ensure msg buffer doesn't overflow on large numbers
assert(new ArrayIndexError(size_t.max, size_t.max-1).msg);
}
@@ -836,12 +835,24 @@ extern (C)
onArraySliceError(lower, upper, length, file[0 .. strlen(file)], line);
}
+ /// ditto
+ void _d_arraybounds_slice(string file, uint line, size_t lower, size_t upper, size_t length)
+ {
+ onArraySliceError(lower, upper, length, file, line);
+ }
+
/// Called when an out of range array index is accessed
void _d_arraybounds_indexp(immutable(char*) file, uint line, size_t index, size_t length)
{
import core.stdc.string : strlen;
onArrayIndexError(index, length, file[0 .. strlen(file)], line);
}
+
+ /// ditto
+ void _d_arraybounds_index(string file, uint line, size_t index, size_t length)
+ {
+ onArrayIndexError(index, length, file, line);
+ }
}
// TLS storage shared for all errors, chaining might create circular reference
@@ -9,44 +9,50 @@
*/
module core.internal.array.construction;
+import core.internal.traits : Unqual;
+
/**
* Does array initialization (not assignment) from another array of the same element type.
* Params:
- * to = what array to initialize
* from = what data the array should be initialized with
* Returns:
- * The constructed `to`
+ * The created and initialized array `to`
* Bugs:
* This function template was ported from a much older runtime hook that bypassed safety,
* purity, and throwabilty checks. To prevent breaking existing code, this function template
* is temporarily declared `@trusted` until the implementation can be brought up to modern D expectations.
*/
-Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
+Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @trusted
+ if (is(Unqual!T1 == Unqual!T2))
{
pragma(inline, false);
- import core.internal.traits : hasElaborateCopyConstructor, Unqual;
+ import core.internal.traits : hasElaborateCopyConstructor;
import core.lifetime : copyEmplace;
import core.stdc.string : memcpy;
- debug(PRINTF) import core.stdc.stdio;
+ import core.stdc.stdint : uintptr_t;
+ debug(PRINTF) import core.stdc.stdio : printf;
+
+ debug(PRINTF) printf("_d_arrayctor(to = %p,%d, from = %p,%d) size = %d\n", from.ptr, from.length, to.ptr, to.length, T1.tsize);
+
+ Tarr1 to = void;
+
+ void[] vFrom = (cast(void*)from.ptr)[0..from.length];
+ void[] vTo = (cast(void*)to.ptr)[0..to.length];
// Force `enforceRawArraysConformable` to be `pure`
- void enforceRawArraysConformable(const char[] action, const size_t elementSize, const void[] a1, const void[] a2, in bool allowOverlap = false) @trusted
+ void enforceRawArraysConformable(const char[] action, const size_t elementSize,
+ const void[] a1, const void[] a2) @trusted
{
- import core.internal.util.array : enforceRawArraysConformable;
+ import core.internal.util.array : enforceRawArraysConformableNogc;
- alias Type = void function(const char[] action, const size_t elementSize, const void[] a1, const void[] a2, in bool allowOverlap = false) pure nothrow;
- (cast(Type)&enforceRawArraysConformable)(action, elementSize, a1, a2, allowOverlap);
+ alias Type = void function(const char[] action, const size_t elementSize,
+ const void[] a1, const void[] a2, in bool allowOverlap = false) @nogc pure nothrow;
+ (cast(Type)&enforceRawArraysConformableNogc)(action, elementSize, a1, a2, false);
}
- debug(PRINTF) printf("_d_arrayctor(to = %p,%d, from = %p,%d) size = %d\n", from.ptr, from.length, to.ptr, to.length, T.tsize);
-
- auto element_size = T.sizeof;
-
- void[] vFrom = (cast(void*)from.ptr)[0..from.length];
- void[] vTo = (cast(void*)to.ptr)[0..to.length];
- enforceRawArraysConformable("initialization", element_size, vFrom, vTo, false);
+ enforceRawArraysConformable("initialization", T1.sizeof, vFrom, vTo);
- static if (hasElaborateCopyConstructor!T)
+ static if (hasElaborateCopyConstructor!T1)
{
size_t i;
try
@@ -60,7 +66,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
*/
while (i--)
{
- auto elem = cast(Unqual!T*)&to[i];
+ auto elem = cast(Unqual!T1*)&to[i];
destroy(*elem);
}
@@ -70,7 +76,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
else
{
// blit all elements at once
- memcpy(cast(void*) to.ptr, from.ptr, to.length * T.sizeof);
+ memcpy(cast(void*) to.ptr, from.ptr, to.length * T1.sizeof);
}
return to;
@@ -88,7 +94,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
S[4] arr1;
S[4] arr2 = [S(0), S(1), S(2), S(3)];
- _d_arrayctor(arr1[], arr2[]);
+ arr1 = _d_arrayctor!(typeof(arr1))(arr2[]);
assert(counter == 4);
assert(arr1 == arr2);
@@ -111,7 +117,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
S[4] arr1;
S[4] arr2 = [S(0), S(1), S(2), S(3)];
- _d_arrayctor(arr1[], arr2[]);
+ arr1 = _d_arrayctor!(typeof(arr1))(arr2[]);
assert(counter == 4);
assert(arr1 == arr2);
@@ -137,7 +143,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
{
Throw[4] a;
Throw[4] b = [Throw(1), Throw(2), Throw(3), Throw(4)];
- _d_arrayctor(a[], b[]);
+ a = _d_arrayctor!(typeof(a))(b[]);
}
catch (Exception)
{
@@ -162,7 +168,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
{
NoThrow[4] a;
NoThrow[4] b = [NoThrow(1), NoThrow(2), NoThrow(3), NoThrow(4)];
- _d_arrayctor(a[], b[]);
+ a = _d_arrayctor!(typeof(a))(b[]);
}
catch (Exception)
{
@@ -186,7 +192,6 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
void _d_arraysetctor(Tarr : T[], T)(scope Tarr p, scope ref T value) @trusted
{
pragma(inline, false);
- import core.internal.traits : Unqual;
import core.lifetime : copyEmplace;
size_t i;
@@ -269,7 +274,7 @@ void _d_arraysetctor(Tarr : T[], T)(scope Tarr p, scope ref T value) @trusted
{
Throw[4] a;
Throw[4] b = [Throw(1), Throw(2), Throw(3), Throw(4)];
- _d_arrayctor(a[], b[]);
+ a = _d_arrayctor!(typeof(a))(b[]);
}
catch (Exception)
{
@@ -104,7 +104,7 @@ version (DigitalMars)
pop RBX;
ret;
}
- }, SrcPtr, RetPtr));
+ }, [SrcPtr, RetPtr]));
}
else
{
@@ -139,7 +139,7 @@ version (DigitalMars)
mov %0, src;
lock; cmpxchg [%0], %1;
}
- }, SrcReg, ZeroReg, ResReg));
+ }, [SrcReg, ZeroReg, ResReg]));
}
else version (D_InlineAsm_X86_64)
{
@@ -159,7 +159,7 @@ version (DigitalMars)
lock; cmpxchg [%0], %1;
ret;
}
- }, SrcReg, ZeroReg, ResReg));
+ }, [SrcReg, ZeroReg, ResReg]));
}
}
else
@@ -252,7 +252,7 @@ version (DigitalMars)
mov %0, dest;
lock; xadd[%0], %1;
}
- }, DestReg, ValReg));
+ }, [DestReg, ValReg]));
}
else version (D_InlineAsm_X86_64)
{
@@ -276,7 +276,7 @@ version (DigitalMars)
?2 mov %2, %1;
ret;
}
- }, DestReg, ValReg, ResReg));
+ }, [DestReg, ValReg, ResReg]));
}
else
static assert (false, "Unsupported architecture.");
@@ -305,7 +305,7 @@ version (DigitalMars)
mov %0, dest;
xchg [%0], %1;
}
- }, DestReg, ValReg));
+ }, [DestReg, ValReg]));
}
else version (D_InlineAsm_X86_64)
{
@@ -329,7 +329,7 @@ version (DigitalMars)
?2 mov %2, %1;
ret;
}
- }, DestReg, ValReg, ResReg));
+ }, [DestReg, ValReg, ResReg]));
}
else
static assert (false, "Unsupported architecture.");
@@ -362,7 +362,7 @@ version (DigitalMars)
setz AL;
pop %1;
}
- }, DestAddr, CmpAddr, Val, Cmp));
+ }, [DestAddr, CmpAddr, Val, Cmp]));
}
else static if (T.sizeof == 8)
{
@@ -421,7 +421,7 @@ version (DigitalMars)
xor AL, AL;
ret;
}
- }, DestAddr, CmpAddr, Val, Res));
+ }, [DestAddr, CmpAddr, Val, Res]));
}
else
{
@@ -500,7 +500,7 @@ version (DigitalMars)
lock; cmpxchg [%0], %2;
setz AL;
}
- }, DestAddr, Cmp, Val));
+ }, [DestAddr, Cmp, Val]));
}
else static if (T.sizeof == 8)
{
@@ -551,7 +551,7 @@ version (DigitalMars)
setz AL;
ret;
}
- }, DestAddr, Cmp, Val, AXReg));
+ }, [DestAddr, Cmp, Val, AXReg]));
}
else
{
@@ -1094,7 +1094,7 @@ template needsStoreBarrier( MemoryOrder ms )
}
// this is a helper to build asm blocks
-string simpleFormat(string format, string[] args...)
+string simpleFormat(string format, scope string[] args)
{
string result;
outer: while (format.length)
@@ -191,7 +191,7 @@ private string miniFormat(V)(const scope ref V v)
}
// Fall back to a simple cast - we're violating the type system anyways
- return miniFormat(__ctfe ? cast(const T) v : *cast(const T*) &v);
+ return miniFormat(*cast(const T*) &v);
}
// Format enum members using their name
else static if (is(V BaseType == enum))
@@ -150,7 +150,11 @@ class ConservativeGC : GC
static bool _inFinalizer;
__gshared bool isPrecise = false;
- // lock GC, throw InvalidMemoryOperationError on recursive locking during finalization
+ /*
+ * Lock the GC.
+ *
+ * Throws: InvalidMemoryOperationError on recursive locking during finalization.
+ */
static void lockNR() @nogc nothrow
{
if (_inFinalizer)
@@ -158,6 +162,12 @@ class ConservativeGC : GC
gcLock.lock();
}
+ /*
+ * Initialize the GC based on command line configuration.
+ *
+ * Throws:
+ * OutOfMemoryError if failed to initialize GC due to not enough memory.
+ */
this()
{
//config is assumed to have already been initialized
@@ -194,6 +204,10 @@ class ConservativeGC : GC
}
+ /**
+ * Enables the GC if disable() was previously called. Must be called
+ * for each time disable was called in order to enable the GC again.
+ */
void enable()
{
static void go(Gcx* gcx) nothrow
@@ -205,6 +219,9 @@ class ConservativeGC : GC
}
+ /**
+ * Disable the GC. The GC may still run if it deems necessary.
+ */
void disable()
{
static void go(Gcx* gcx) nothrow
@@ -216,6 +233,13 @@ class ConservativeGC : GC
debug (GC_RECURSIVE_LOCK) static bool lockedOnThisThread;
+ /**
+ * Run a function inside a lock/unlock set.
+ *
+ * Params:
+ * func = The function to run.
+ * args = The function arguments.
+ */
auto runLocked(alias func, Args...)(auto ref Args args)
{
debug(PROFILE_API) immutable tm = (config.profile > 1 ? currTime.ticks : 0);
@@ -248,7 +272,17 @@ class ConservativeGC : GC
return res;
}
-
+ /**
+ * Run a function in an lock/unlock set that keeps track of
+ * how much time was spend inside this function (in ticks)
+ * and how many times this fuction was called.
+ *
+ * Params:
+ * func = The function to run.
+ * time = The variable keeping track of the time (in ticks).
+ * count = The variable keeping track of how many times this fuction was called.
+ * args = The function arguments.
+ */
auto runLocked(alias func, alias time, alias count, Args...)(auto ref Args args)
{
debug(PROFILE_API) immutable tm = (config.profile > 1 ? currTime.ticks : 0);
@@ -287,6 +321,17 @@ class ConservativeGC : GC
}
+ /**
+ * Returns a bit field representing all block attributes set for the memory
+ * referenced by p.
+ *
+ * Params:
+ * p = A pointer to the base of a valid memory block or to null.
+ *
+ * Returns:
+ * A bit field containing any bits set for the memory block referenced by
+ * p or zero on error.
+ */
uint getAttr(void* p) nothrow
{
if (!p)
@@ -314,7 +359,20 @@ class ConservativeGC : GC
return runLocked!(go, otherTime, numOthers)(gcx, p);
}
-
+ /**
+ * Sets the specified bits for the memory references by p.
+ *
+ * If p was not allocated by the GC, points inside a block, or is null, no
+ * action will be taken.
+ *
+ * Params:
+ * p = A pointer to the base of a valid memory block or to null.
+ * mask = A bit field containing any bits to set for this memory block.
+ *
+ * Returns:
+ * The result of a call to getAttr after the specified bits have been
+ * set.
+ */
uint setAttr(void* p, uint mask) nothrow
{
if (!p)
@@ -344,6 +402,20 @@ class ConservativeGC : GC
}
+ /**
+ * Clears the specified bits for the memory references by p.
+ *
+ * If p was not allocated by the GC, points inside a block, or is null, no
+ * action will be taken.
+ *
+ * Params:
+ * p = A pointer to the base of a valid memory block or to null.
+ * mask = A bit field containing any bits to clear for this memory block.
+ *
+ * Returns:
+ * The result of a call to getAttr after the specified bits have been
+ * cleared
+ */
uint clrAttr(void* p, uint mask) nothrow
{
if (!p)
@@ -372,8 +444,21 @@ class ConservativeGC : GC
return runLocked!(go, otherTime, numOthers)(gcx, p, mask);
}
-
- void *malloc(size_t size, uint bits, const TypeInfo ti) nothrow
+ /**
+ * Requests an aligned block of managed memory from the garbage collector.
+ *
+ * Params:
+ * size = The desired allocation size in bytes.
+ * bits = A bitmask of the attributes to set on this block.
+ * ti = TypeInfo to describe the memory.
+ *
+ * Returns:
+ * A reference to the allocated memory or null if no memory was requested.
+ *
+ * Throws:
+ * OutOfMemoryError on allocation failure
+ */
+ void *malloc(size_t size, uint bits = 0, const TypeInfo ti = null) nothrow
{
if (!size)
{
@@ -394,7 +479,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation for malloc and calloc.
//
private void *mallocNoSync(size_t size, uint bits, ref size_t alloc_size, const TypeInfo ti = null) nothrow
{
@@ -423,7 +508,6 @@ class ConservativeGC : GC
return p;
}
-
BlkInfo qalloc( size_t size, uint bits, const scope TypeInfo ti) nothrow
{
@@ -446,7 +530,22 @@ class ConservativeGC : GC
}
- void *calloc(size_t size, uint bits, const TypeInfo ti) nothrow
+ /**
+ * Requests an aligned block of managed memory from the garbage collector,
+ * which is initialized with all bits set to zero.
+ *
+ * Params:
+ * size = The desired allocation size in bytes.
+ * bits = A bitmask of the attributes to set on this block.
+ * ti = TypeInfo to describe the memory.
+ *
+ * Returns:
+ * A reference to the allocated memory or null if no memory was requested.
+ *
+ * Throws:
+ * OutOfMemoryError on allocation failure.
+ */
+ void *calloc(size_t size, uint bits = 0, const TypeInfo ti = null) nothrow
{
if (!size)
{
@@ -466,8 +565,27 @@ class ConservativeGC : GC
return p;
}
-
- void *realloc(void *p, size_t size, uint bits, const TypeInfo ti) nothrow
+ /**
+ * Request that the GC reallocate a block of memory, attempting to adjust
+ * the size in place if possible. If size is 0, the memory will be freed.
+ *
+ * If p was not allocated by the GC, points inside a block, or is null, no
+ * action will be taken.
+ *
+ * Params:
+ * p = A pointer to the root of a valid memory block or to null.
+ * size = The desired allocation size in bytes.
+ * bits = A bitmask of the attributes to set on this block.
+ * ti = TypeInfo to describe the memory.
+ *
+ * Returns:
+ * A reference to the allocated memory on success or null if size is
+ * zero.
+ *
+ * Throws:
+ * OutOfMemoryError on allocation failure.
+ */
+ void *realloc(void *p, size_t size, uint bits = 0, const TypeInfo ti = null) nothrow
{
size_t localAllocSize = void;
auto oldp = p;
@@ -483,6 +601,8 @@ class ConservativeGC : GC
}
+ //
+ // The implementation of realloc.
//
// bits will be set to the resulting bits of the new block
//
@@ -624,7 +744,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of extend.
//
private size_t extendNoSync(void* p, size_t minsize, size_t maxsize, const TypeInfo ti = null) nothrow
in
@@ -678,6 +798,16 @@ class ConservativeGC : GC
}
+ /**
+ * Requests that at least size bytes of memory be obtained from the operating
+ * system and marked as free.
+ *
+ * Params:
+ * size = The desired size in bytes.
+ *
+ * Returns:
+ * The actual number of bytes reserved or zero on error.
+ */
size_t reserve(size_t size) nothrow
{
if (!size)
@@ -690,7 +820,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of reserve
//
private size_t reserveNoSync(size_t size) nothrow
{
@@ -701,7 +831,16 @@ class ConservativeGC : GC
}
- void free(void *p) nothrow @nogc
+ /**
+ * Deallocates the memory referenced by p.
+ *
+ * If p was not allocated by the GC, points inside a block, is null, or
+ * if free is called from a finalizer, no action will be taken.
+ *
+ * Params:
+ * p = A pointer to the root of a valid memory block or to null.
+ */
+ void free(void *p) nothrow
{
if (!p || _inFinalizer)
{
@@ -713,7 +852,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of free.
//
private void freeNoSync(void *p) nothrow @nogc
{
@@ -792,7 +931,18 @@ class ConservativeGC : GC
}
- void* addrOf(void *p) nothrow @nogc
+ /**
+ * Determine the base address of the block containing p. If p is not a gc
+ * allocated pointer, return null.
+ *
+ * Params:
+ * p = A pointer to the root or the interior of a valid memory block or to
+ * null.
+ *
+ * Returns:
+ * The base address of the memory block referenced by p or null on error.
+ */
+ void* addrOf(void *p) nothrow
{
if (!p)
{
@@ -804,7 +954,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of addrOf.
//
void* addrOfNoSync(void *p) nothrow @nogc
{
@@ -820,7 +970,17 @@ class ConservativeGC : GC
}
- size_t sizeOf(void *p) nothrow @nogc
+ /**
+ * Determine the allocated size of pointer p. If p is an interior pointer
+ * or not a gc allocated pointer, return 0.
+ *
+ * Params:
+ * p = A pointer to the root of a valid memory block or to null.
+ *
+ * Returns:
+ * The size in bytes of the memory block referenced by p or zero on error.
+ */
+ size_t sizeOf(void *p) nothrow
{
if (!p)
{
@@ -832,7 +992,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of sizeOf.
//
private size_t sizeOfNoSync(void *p) nothrow @nogc
{
@@ -852,6 +1012,18 @@ class ConservativeGC : GC
}
+ /**
+ * Determine the base address of the block containing p. If p is not a gc
+ * allocated pointer, return null.
+ *
+ * Params:
+ * p = A pointer to the root or the interior of a valid memory block or to
+ * null.
+ *
+ * Returns:
+ * Information regarding the memory block referenced by p or BlkInfo.init
+ * on error.
+ */
BlkInfo query(void *p) nothrow
{
if (!p)
@@ -864,7 +1036,7 @@ class ConservativeGC : GC
}
//
- //
+ // Implementation of query
//
BlkInfo queryNoSync(void *p) nothrow
{
@@ -884,10 +1056,14 @@ class ConservativeGC : GC
/**
- * Verify that pointer p:
- * 1) belongs to this memory pool
- * 2) points to the start of an allocated piece of memory
- * 3) is not on a free list
+ * Performs certain checks on a pointer. These checks will cause asserts to
+ * fail unless the following conditions are met:
+ * 1) The poiinter belongs to this memory pool.
+ * 2) The pointer points to the start of an allocated piece of memory.
+ * 3) The pointer is not on a free list.
+ *
+ * Params:
+ * p = The pointer to be checked.
*/
void check(void *p) nothrow
{
@@ -901,7 +1077,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of check
//
private void checkNoSync(void *p) nothrow
{
@@ -939,6 +1115,12 @@ class ConservativeGC : GC
}
+ /**
+ * Add p to list of roots. If p is null, no operation is performed.
+ *
+ * Params:
+ * p = A pointer into a GC-managed memory block or null.
+ */
void addRoot(void *p) nothrow @nogc
{
if (!p)
@@ -950,6 +1132,13 @@ class ConservativeGC : GC
}
+ /**
+ * Remove p from list of roots. If p is null or is not a value
+ * previously passed to addRoot() then no operation is performed.
+ *
+ * Params:
+ * p = A pointer into a GC-managed memory block or null.
+ */
void removeRoot(void *p) nothrow @nogc
{
if (!p)
@@ -960,13 +1149,23 @@ class ConservativeGC : GC
gcx.removeRoot(p);
}
-
+ /**
+ * Returns an iterator allowing roots to be traversed via a foreach loop.
+ */
@property RootIterator rootIter() @nogc
{
return &gcx.rootsApply;
}
+ /**
+ * Add range to scan for roots. If p is null or sz is 0, no operation is performed.
+ *
+ * Params:
+ * p = A pointer to a valid memory address or to null.
+ * sz = The size in bytes of the block to add.
+ * ti = TypeInfo to describe the memory.
+ */
void addRange(void *p, size_t sz, const TypeInfo ti = null) nothrow @nogc
{
if (!p || !sz)
@@ -978,6 +1177,14 @@ class ConservativeGC : GC
}
+ /**
+ * Remove range from list of ranges. If p is null or does not represent
+ * a value previously passed to addRange() then no operation is
+ * performed.
+ *
+ * Params:
+ * p = A pointer to a valid memory address or to null.
+ */
void removeRange(void *p) nothrow @nogc
{
if (!p)
@@ -989,12 +1196,21 @@ class ConservativeGC : GC
}
+ /**
+ * Returns an iterator allowing ranges to be traversed via a foreach loop.
+ */
@property RangeIterator rangeIter() @nogc
{
return &gcx.rangesApply;
}
+ /**
+ * Run all finalizers in the code segment.
+ *
+ * Params:
+ * segment = address range of a code segment
+ */
void runFinalizers(const scope void[] segment) nothrow
{
static void go(Gcx* gcx, const scope void[] segment) nothrow
@@ -1024,8 +1240,10 @@ class ConservativeGC : GC
/**
- * Do full garbage collection.
- * Return number of pages free'd.
+ * Begins a full collection, scanning all stack segments for roots.
+ *
+ * Returns:
+ * The number of pages freed.
*/
size_t fullCollect() nothrow
{
@@ -1054,7 +1272,7 @@ class ConservativeGC : GC
/**
- * do full garbage collection ignoring roots
+ * Begins a full collection while ignoring all stack segments for roots.
*/
void fullCollectNoStack() nothrow
{
@@ -1068,6 +1286,9 @@ class ConservativeGC : GC
}
+ /**
+ * Minimize free space usage.
+ */
void minimize() nothrow
{
static void go(Gcx* gcx) nothrow
@@ -1109,7 +1330,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of getStats
//
private void getStatsNoSync(out core.memory.GC.Stats stats) nothrow
{
@@ -213,46 +213,38 @@ else
Returns:
true if memory is scarce
*/
-// TOOD: get virtual mem sizes and current usage from OS
+// TODO: get virtual mem sizes and current usage from OS
// TODO: compare current RSS and avail. physical memory
-version (Windows)
+bool isLowOnMem(size_t mapped) nothrow @nogc
{
- bool isLowOnMem(size_t mapped) nothrow @nogc
+ version (Windows)
{
- version (D_LP64)
+ import core.sys.windows.winbase : GlobalMemoryStatusEx, MEMORYSTATUSEX;
+
+ MEMORYSTATUSEX stat;
+ stat.dwLength = stat.sizeof;
+ const success = GlobalMemoryStatusEx(&stat) != 0;
+ assert(success, "GlobalMemoryStatusEx() failed");
+ if (!success)
return false;
- else
- {
- import core.sys.windows.winbase : GlobalMemoryStatus, MEMORYSTATUS;
- MEMORYSTATUS stat;
- GlobalMemoryStatus(&stat);
- // Less than 5 % of virtual address space available
- return stat.dwAvailVirtual < stat.dwTotalVirtual / 20;
- }
+
+ // dwMemoryLoad is the 'approximate percentage of physical memory that is in use'
+ // https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex
+ const percentPhysicalRAM = stat.ullTotalPhys / 100;
+ return (stat.dwMemoryLoad >= 95 && mapped > percentPhysicalRAM)
+ || (stat.dwMemoryLoad >= 90 && mapped > 10 * percentPhysicalRAM);
}
-}
-else version (Darwin)
-{
- bool isLowOnMem(size_t mapped) nothrow @nogc
+ else
{
enum GB = 2 ^^ 30;
version (D_LP64)
return false;
- else
+ else version (Darwin)
{
// 80 % of available 4GB is used for GC (excluding malloc and mmap)
enum size_t limit = 4UL * GB * 8 / 10;
return mapped > limit;
}
- }
-}
-else
-{
- bool isLowOnMem(size_t mapped) nothrow @nogc
- {
- enum GB = 2 ^^ 30;
- version (D_LP64)
- return false;
else
{
// be conservative and assume 3GB
@@ -646,13 +646,8 @@ size_t hashOf(T)(T aa) if (!is(T == enum) && __traits(isAssociativeArray, T))
size_t h = 0;
// The computed hash is independent of the foreach traversal order.
- foreach (key, ref val; aa)
- {
- size_t[2] hpair;
- hpair[0] = key.hashOf();
- hpair[1] = val.hashOf();
- h += hpair.hashOf();
- }
+ foreach (ref key, ref val; aa)
+ h += hashOf(hashOf(val), hashOf(key));
return h;
}
@@ -4,7 +4,7 @@
* Copyright: Copyright Digital Mars 2017
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
*
-* Source: $(DRUNTIMESRC src/core/internal/parseoptions.d)
+* Source: $(DRUNTIMESRC core/internal/parseoptions.d)
*/
module core.internal.parseoptions;
@@ -14,7 +14,7 @@ template Fields(T)
{
static if (is(T == struct) || is(T == union))
alias Fields = typeof(T.tupleof[0 .. $ - __traits(isNested, T)]);
- else static if (is(T == class))
+ else static if (is(T == class) || is(T == interface))
alias Fields = typeof(T.tupleof);
else
alias Fields = AliasSeq!T;
@@ -326,7 +326,7 @@ template hasElaborateAssign(S)
template hasIndirections(T)
{
static if (is(T == struct) || is(T == union))
- enum hasIndirections = anySatisfy!(.hasIndirections, Fields!T);
+ enum hasIndirections = anySatisfy!(.hasIndirections, typeof(T.tupleof));
else static if (is(T == E[N], E, size_t N))
enum hasIndirections = T.sizeof && is(E == void) ? true : hasIndirections!(BaseElemOf!E);
else static if (isFunctionPointer!T)
@@ -367,6 +367,10 @@ unittest
static assert( hasUnsharedIndirections!(Foo*));
static assert(!hasUnsharedIndirections!(shared(Foo)*));
static assert(!hasUnsharedIndirections!(immutable(Foo)*));
+
+ int local;
+ struct HasContextPointer { int opCall() { return ++local; } }
+ static assert(hasIndirections!HasContextPointer);
}
enum bool isAggregateType(T) = is(T == struct) || is(T == union) ||
@@ -13,6 +13,17 @@ import core.internal.string;
import core.stdc.stdint;
+// TLS storage shared for all error messages.
+private align(2 * size_t.sizeof) char[256] _store;
+
+private char[] errorMessage(Args...)(scope const(char*) format,
+ const char[] action, Args args) @trusted
+{
+ import core.stdc.stdio : snprintf;
+ snprintf(&_store[0], _store.sizeof, format, &action[0], args);
+ return _store;
+}
+
@safe /* pure dmd @@@BUG11461@@@ */ nothrow:
void enforceTypedArraysConformable(T)(const char[] action,
@@ -65,6 +76,44 @@ private void _enforceNoOverlap(const char[] action,
assert(0, msg);
}
+void enforceTypedArraysConformableNogc(T)(const char[] action,
+ const T[] a1, const T[] a2, const bool allowOverlap = false)
+{
+ _enforceSameLengthNogc(action, a1.length, a2.length);
+ if (!allowOverlap)
+ _enforceNoOverlapNogc(action, arrayToPtr(a1), arrayToPtr(a2), T.sizeof * a1.length);
+}
+
+void enforceRawArraysConformableNogc(const char[] action, const size_t elementSize,
+ const void[] a1, const void[] a2, const bool allowOverlap = false)
+{
+ _enforceSameLengthNogc(action, a1.length, a2.length);
+ if (!allowOverlap)
+ _enforceNoOverlapNogc(action, arrayToPtr(a1), arrayToPtr(a2), elementSize * a1.length);
+}
+
+private void _enforceNoOverlapNogc(const ref char[] action,
+ uintptr_t ptr1, uintptr_t ptr2, const size_t bytes)
+{
+ const d = ptr1 > ptr2 ? ptr1 - ptr2 : ptr2 - ptr1;
+ if (d >= bytes)
+ return;
+ const overlappedBytes = bytes - d;
+
+ assert(0, errorMessage("Overlapping arrays in %s: %zu byte(s) overlap of %zu",
+ action, overlappedBytes, bytes));
+}
+
+private void _enforceSameLengthNogc(const ref char[] action,
+ const size_t length1, const size_t length2)
+{
+ if (length1 == length2)
+ return;
+
+ assert(0, errorMessage("Array lengths don't match for %s: %zu != %zu",
+ action, length1, length2));
+}
+
private uintptr_t arrayToPtr(const void[] array) @trusted
{
// Ok because the user will never dereference the pointer
@@ -2124,7 +2124,9 @@ private void moveEmplaceImpl(T)(scope ref T target, return scope ref T source)
() @trusted { memset(&source, 0, sz); }();
else
{
- auto init = typeid(T).initializer();
+ import core.internal.lifetime : emplaceInitializer;
+ ubyte[T.sizeof] init = void;
+ emplaceInitializer(*(() @trusted { return cast(T*)init.ptr; }()));
() @trusted { memcpy(&source, init.ptr, sz); }();
}
}
@@ -848,6 +848,7 @@ else static if (hasExecinfo) private class DefaultTraceInfo : Throwable.TraceInf
version (linux) enum enableDwarf = true;
else version (FreeBSD) enum enableDwarf = true;
else version (DragonFlyBSD) enum enableDwarf = true;
+ else version (OpenBSD) enum enableDwarf = true;
else version (Darwin) enum enableDwarf = true;
else enum enableDwarf = false;
@@ -9,7 +9,7 @@
* (See accompanying file LICENSE)
* Authors: Sean Kelly
* Standards: ISO/IEC 9899:1999 (E)
- * Source: $(DRUNTIMESRC src/core/stdc/_stdlib.d)
+ * Source: $(DRUNTIMESRC core/stdc/_stdlib.d)
*/
module core.stdc.stdlib;
@@ -86,7 +86,7 @@ class ReadWriteMutex
* Throws:
* SyncError on error.
*/
- this( Policy policy = Policy.PREFER_WRITERS )
+ this( Policy policy = Policy.PREFER_WRITERS ) @safe nothrow
{
m_commonMutex = new Mutex;
if ( !m_commonMutex )
@@ -105,6 +105,26 @@ class ReadWriteMutex
m_writer = new Writer;
}
+ /// ditto
+ shared this( Policy policy = Policy.PREFER_WRITERS ) @safe nothrow
+ {
+ m_commonMutex = new shared Mutex;
+ if ( !m_commonMutex )
+ throw new SyncError( "Unable to initialize mutex" );
+
+ m_readerQueue = new shared Condition( m_commonMutex );
+ if ( !m_readerQueue )
+ throw new SyncError( "Unable to initialize mutex" );
+
+ m_writerQueue = new shared Condition( m_commonMutex );
+ if ( !m_writerQueue )
+ throw new SyncError( "Unable to initialize mutex" );
+
+ m_policy = policy;
+ m_reader = new shared Reader;
+ m_writer = new shared Writer;
+ }
+
////////////////////////////////////////////////////////////////////////////
// General Properties
////////////////////////////////////////////////////////////////////////////
@@ -116,11 +136,16 @@ class ReadWriteMutex
* Returns:
* The policy used by this mutex.
*/
- @property Policy policy()
+ @property Policy policy() @safe nothrow
{
return m_policy;
}
+ ///ditto
+ @property Policy policy() shared @safe nothrow
+ {
+ return m_policy;
+ }
////////////////////////////////////////////////////////////////////////////
// Reader/Writer Handles
@@ -133,11 +158,16 @@ class ReadWriteMutex
* Returns:
* A reader sub-mutex.
*/
- @property Reader reader()
+ @property Reader reader() @safe nothrow
{
return m_reader;
}
+ ///ditto
+ @property shared(Reader) reader() shared @safe nothrow
+ {
+ return m_reader;
+ }
/**
* Gets an object representing the writer lock for the associated mutex.
@@ -145,7 +175,13 @@ class ReadWriteMutex
* Returns:
* A writer sub-mutex.
*/
- @property Writer writer()
+ @property Writer writer() @safe nothrow
+ {
+ return m_writer;
+ }
+
+ ///ditto
+ @property shared(Writer) writer() shared @safe nothrow
{
return m_writer;
}
@@ -166,13 +202,13 @@ class ReadWriteMutex
/**
* Initializes a read/write mutex reader proxy object.
*/
- this()
+ this(this Q)() @trusted nothrow
+ if (is(Q == Reader) || is(Q == shared Reader))
{
m_proxy.link = this;
- this.__monitor = &m_proxy;
+ this.__monitor = cast(void*) &m_proxy;
}
-
/**
* Acquires a read lock on the enclosing mutex.
*/
@@ -189,6 +225,19 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted void lock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ ++(cast()m_numQueuedReaders);
+ scope(exit) --(cast()m_numQueuedReaders);
+
+ while ( shouldQueueReader )
+ m_readerQueue.wait();
+ ++(cast()m_numActiveReaders);
+ }
+ }
/**
* Releases a read lock on the enclosing mutex.
@@ -205,6 +254,18 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted void unlock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ if ( --(cast()m_numActiveReaders) < 1 )
+ {
+ if ( m_numQueuedWriters > 0 )
+ m_writerQueue.notify();
+ }
+ }
+ }
/**
* Attempts to acquire a read lock on the enclosing mutex. If one can
@@ -214,7 +275,7 @@ class ReadWriteMutex
* Returns:
* true if the lock was acquired and false if not.
*/
- bool tryLock()
+ @trusted bool tryLock()
{
synchronized( m_commonMutex )
{
@@ -225,6 +286,18 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted bool tryLock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ if ( shouldQueueReader )
+ return false;
+ ++(cast()m_numActiveReaders);
+ return true;
+ }
+ }
+
/**
* Attempts to acquire a read lock on the enclosing mutex. If one can
* be obtained without blocking, the lock is acquired and true is
@@ -237,7 +310,7 @@ class ReadWriteMutex
* Returns:
* true if the lock was acquired and false if not.
*/
- bool tryLock(Duration timeout)
+ @trusted bool tryLock(Duration timeout)
{
synchronized( m_commonMutex )
{
@@ -270,9 +343,34 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted bool tryLock(Duration timeout) shared
+ {
+ const initialTime = MonoTime.currTime;
+ synchronized( m_commonMutex )
+ {
+ ++(cast()m_numQueuedReaders);
+ scope(exit) --(cast()m_numQueuedReaders);
+
+ while (shouldQueueReader)
+ {
+ const timeElapsed = MonoTime.currTime - initialTime;
+ if (timeElapsed >= timeout)
+ return false;
+ auto nextWait = timeout - timeElapsed;
+ // Avoid problems calling wait(Duration) with huge arguments.
+ enum maxWaitPerCall = dur!"hours"(24 * 365);
+ m_readerQueue.wait(nextWait < maxWaitPerCall ? nextWait : maxWaitPerCall);
+ }
+ ++(cast()m_numActiveReaders);
+ return true;
+ }
+ }
+
private:
- @property bool shouldQueueReader()
+ @property bool shouldQueueReader(this Q)() nothrow @safe @nogc
+ if (is(Q == Reader) || is(Q == shared Reader))
{
if ( m_numActiveWriters > 0 )
return true;
@@ -314,10 +412,11 @@ class ReadWriteMutex
/**
* Initializes a read/write mutex writer proxy object.
*/
- this()
+ this(this Q)() @trusted nothrow
+ if (is(Q == Writer) || is(Q == shared Writer))
{
m_proxy.link = this;
- this.__monitor = &m_proxy;
+ this.__monitor = cast(void*) &m_proxy;
}
@@ -337,6 +436,20 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted void lock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ ++(cast()m_numQueuedWriters);
+ scope(exit) --(cast()m_numQueuedWriters);
+
+ while ( shouldQueueWriter )
+ m_writerQueue.wait();
+ ++(cast()m_numActiveWriters);
+ }
+ }
+
/**
* Releases a write lock on the enclosing mutex.
@@ -366,6 +479,32 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted void unlock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ if ( --(cast()m_numActiveWriters) < 1 )
+ {
+ switch ( m_policy )
+ {
+ default:
+ case Policy.PREFER_READERS:
+ if ( m_numQueuedReaders > 0 )
+ m_readerQueue.notifyAll();
+ else if ( m_numQueuedWriters > 0 )
+ m_writerQueue.notify();
+ break;
+ case Policy.PREFER_WRITERS:
+ if ( m_numQueuedWriters > 0 )
+ m_writerQueue.notify();
+ else if ( m_numQueuedReaders > 0 )
+ m_readerQueue.notifyAll();
+ }
+ }
+ }
+ }
+
/**
* Attempts to acquire a write lock on the enclosing mutex. If one can
@@ -375,7 +514,7 @@ class ReadWriteMutex
* Returns:
* true if the lock was acquired and false if not.
*/
- bool tryLock()
+ @trusted bool tryLock()
{
synchronized( m_commonMutex )
{
@@ -386,6 +525,18 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted bool tryLock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ if ( shouldQueueWriter )
+ return false;
+ ++(cast()m_numActiveWriters);
+ return true;
+ }
+ }
+
/**
* Attempts to acquire a write lock on the enclosing mutex. If one can
* be obtained without blocking, the lock is acquired and true is
@@ -398,7 +549,7 @@ class ReadWriteMutex
* Returns:
* true if the lock was acquired and false if not.
*/
- bool tryLock(Duration timeout)
+ @trusted bool tryLock(Duration timeout)
{
synchronized( m_commonMutex )
{
@@ -431,8 +582,33 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted bool tryLock(Duration timeout) shared
+ {
+ const initialTime = MonoTime.currTime;
+ synchronized( m_commonMutex )
+ {
+ ++(cast()m_numQueuedWriters);
+ scope(exit) --(cast()m_numQueuedWriters);
+
+ while (shouldQueueWriter)
+ {
+ const timeElapsed = MonoTime.currTime - initialTime;
+ if (timeElapsed >= timeout)
+ return false;
+ auto nextWait = timeout - timeElapsed;
+ // Avoid problems calling wait(Duration) with huge arguments.
+ enum maxWaitPerCall = dur!"hours"(24 * 365);
+ m_writerQueue.wait(nextWait < maxWaitPerCall ? nextWait : maxWaitPerCall);
+ }
+ ++(cast()m_numActiveWriters);
+ return true;
+ }
+ }
+
private:
- @property bool shouldQueueWriter()
+ @property bool shouldQueueWriter(this Q)()
+ if (is(Q == Writer) || is(Q == shared Writer))
{
if ( m_numActiveWriters > 0 ||
m_numActiveReaders > 0 )
@@ -691,3 +867,215 @@ unittest
otherThread.join;
}
}
+
+unittest
+{
+ import core.atomic, core.thread, core.sync.semaphore;
+
+ static void runTest(ReadWriteMutex.Policy policy)
+ {
+ shared scope mutex = new shared ReadWriteMutex(policy);
+ scope rdSemA = new Semaphore, rdSemB = new Semaphore,
+ wrSemA = new Semaphore, wrSemB = new Semaphore;
+ shared size_t numReaders, numWriters;
+
+ void readerFn()
+ {
+ synchronized (mutex.reader)
+ {
+ atomicOp!"+="(numReaders, 1);
+ rdSemA.notify();
+ rdSemB.wait();
+ atomicOp!"-="(numReaders, 1);
+ }
+ }
+
+ void writerFn()
+ {
+ synchronized (mutex.writer)
+ {
+ atomicOp!"+="(numWriters, 1);
+ wrSemA.notify();
+ wrSemB.wait();
+ atomicOp!"-="(numWriters, 1);
+ }
+ }
+
+ void waitQueued(size_t queuedReaders, size_t queuedWriters)
+ {
+ for (;;)
+ {
+ synchronized (mutex.m_commonMutex)
+ {
+ if (mutex.m_numQueuedReaders == queuedReaders &&
+ mutex.m_numQueuedWriters == queuedWriters)
+ break;
+ }
+ Thread.yield();
+ }
+ }
+
+ scope group = new ThreadGroup;
+
+ // 2 simultaneous readers
+ group.create(&readerFn); group.create(&readerFn);
+ rdSemA.wait(); rdSemA.wait();
+ assert(numReaders == 2);
+ rdSemB.notify(); rdSemB.notify();
+ group.joinAll();
+ assert(numReaders == 0);
+ foreach (t; group) group.remove(t);
+
+ // 1 writer at a time
+ group.create(&writerFn); group.create(&writerFn);
+ wrSemA.wait();
+ assert(!wrSemA.tryWait());
+ assert(numWriters == 1);
+ wrSemB.notify();
+ wrSemA.wait();
+ assert(numWriters == 1);
+ wrSemB.notify();
+ group.joinAll();
+ assert(numWriters == 0);
+ foreach (t; group) group.remove(t);
+
+ // reader and writer are mutually exclusive
+ group.create(&readerFn);
+ rdSemA.wait();
+ group.create(&writerFn);
+ waitQueued(0, 1);
+ assert(!wrSemA.tryWait());
+ assert(numReaders == 1 && numWriters == 0);
+ rdSemB.notify();
+ wrSemA.wait();
+ assert(numReaders == 0 && numWriters == 1);
+ wrSemB.notify();
+ group.joinAll();
+ assert(numReaders == 0 && numWriters == 0);
+ foreach (t; group) group.remove(t);
+
+ // writer and reader are mutually exclusive
+ group.create(&writerFn);
+ wrSemA.wait();
+ group.create(&readerFn);
+ waitQueued(1, 0);
+ assert(!rdSemA.tryWait());
+ assert(numReaders == 0 && numWriters == 1);
+ wrSemB.notify();
+ rdSemA.wait();
+ assert(numReaders == 1 && numWriters == 0);
+ rdSemB.notify();
+ group.joinAll();
+ assert(numReaders == 0 && numWriters == 0);
+ foreach (t; group) group.remove(t);
+
+ // policy determines whether queued reader or writers progress first
+ group.create(&writerFn);
+ wrSemA.wait();
+ group.create(&readerFn);
+ group.create(&writerFn);
+ waitQueued(1, 1);
+ assert(numReaders == 0 && numWriters == 1);
+ wrSemB.notify();
+
+ if (policy == ReadWriteMutex.Policy.PREFER_READERS)
+ {
+ rdSemA.wait();
+ assert(numReaders == 1 && numWriters == 0);
+ rdSemB.notify();
+ wrSemA.wait();
+ assert(numReaders == 0 && numWriters == 1);
+ wrSemB.notify();
+ }
+ else if (policy == ReadWriteMutex.Policy.PREFER_WRITERS)
+ {
+ wrSemA.wait();
+ assert(numReaders == 0 && numWriters == 1);
+ wrSemB.notify();
+ rdSemA.wait();
+ assert(numReaders == 1 && numWriters == 0);
+ rdSemB.notify();
+ }
+ group.joinAll();
+ assert(numReaders == 0 && numWriters == 0);
+ foreach (t; group) group.remove(t);
+ }
+ runTest(ReadWriteMutex.Policy.PREFER_READERS);
+ runTest(ReadWriteMutex.Policy.PREFER_WRITERS);
+}
+
+unittest
+{
+ import core.atomic, core.thread;
+ shared static ReadWriteMutex rwmutex;
+ shared static bool threadTriedOnceToGetLock;
+ shared static bool threadFinallyGotLock;
+
+ rwmutex = new shared ReadWriteMutex();
+ atomicFence;
+ const maxTimeAllowedForTest = dur!"seconds"(20);
+ // Test ReadWriteMutex.Reader.tryLock(Duration).
+ {
+ static void testReaderTryLock()
+ {
+ assert(!rwmutex.reader.tryLock(Duration.min));
+ threadTriedOnceToGetLock.atomicStore(true);
+ assert(rwmutex.reader.tryLock(Duration.max));
+ threadFinallyGotLock.atomicStore(true);
+ rwmutex.reader.unlock;
+ }
+ assert(rwmutex.writer.tryLock(Duration.zero), "should have been able to obtain lock without blocking");
+ auto otherThread = new Thread(&testReaderTryLock).start;
+ const failIfThisTimeisReached = MonoTime.currTime + maxTimeAllowedForTest;
+ Thread.yield;
+ // We started otherThread with the writer lock held so otherThread's
+ // first rwlock.reader.tryLock with timeout Duration.min should fail.
+ while (!threadTriedOnceToGetLock.atomicLoad)
+ {
+ assert(MonoTime.currTime < failIfThisTimeisReached, "timed out");
+ Thread.yield;
+ }
+ rwmutex.writer.unlock;
+ // Soon after we release the writer lock otherThread's second
+ // rwlock.reader.tryLock with timeout Duration.max should succeed.
+ while (!threadFinallyGotLock.atomicLoad)
+ {
+ assert(MonoTime.currTime < failIfThisTimeisReached, "timed out");
+ Thread.yield;
+ }
+ otherThread.join;
+ }
+ threadTriedOnceToGetLock.atomicStore(false); // Reset.
+ threadFinallyGotLock.atomicStore(false); // Reset.
+ // Test ReadWriteMutex.Writer.tryLock(Duration).
+ {
+ static void testWriterTryLock()
+ {
+ assert(!rwmutex.writer.tryLock(Duration.min));
+ threadTriedOnceToGetLock.atomicStore(true);
+ assert(rwmutex.writer.tryLock(Duration.max));
+ threadFinallyGotLock.atomicStore(true);
+ rwmutex.writer.unlock;
+ }
+ assert(rwmutex.reader.tryLock(Duration.zero), "should have been able to obtain lock without blocking");
+ auto otherThread = new Thread(&testWriterTryLock).start;
+ const failIfThisTimeisReached = MonoTime.currTime + maxTimeAllowedForTest;
+ Thread.yield;
+ // We started otherThread with the reader lock held so otherThread's
+ // first rwlock.writer.tryLock with timeout Duration.min should fail.
+ while (!threadTriedOnceToGetLock.atomicLoad)
+ {
+ assert(MonoTime.currTime < failIfThisTimeisReached, "timed out");
+ Thread.yield;
+ }
+ rwmutex.reader.unlock;
+ // Soon after we release the reader lock otherThread's second
+ // rwlock.writer.tryLock with timeout Duration.max should succeed.
+ while (!threadFinallyGotLock.atomicLoad)
+ {
+ assert(MonoTime.currTime < failIfThisTimeisReached, "timed out");
+ Thread.yield;
+ }
+ otherThread.join;
+ }
+}
@@ -13,7 +13,9 @@ public import core.sys.posix.config;
// __FreeBSD_version numbers are documented in the Porter's Handbook.
// NOTE: When adding newer versions of FreeBSD, verify all current versioned
// bindings are still compatible with the release.
- version (FreeBSD_12) enum __FreeBSD_version = 1202000;
+
+ version (FreeBSD_13) enum __FreeBSD_version = 1300000;
+else version (FreeBSD_12) enum __FreeBSD_version = 1202000;
else version (FreeBSD_11) enum __FreeBSD_version = 1104000;
else version (FreeBSD_10) enum __FreeBSD_version = 1004000;
else version (FreeBSD_9) enum __FreeBSD_version = 903000;
@@ -154,39 +154,42 @@ enum {
S_XFLAG_HASATTR = 0x80000000, /// no DIFLAG for this
}
-enum BLKROSET = _IO(0x12, 93); /// set device read-only
-enum BLKROGET = _IO(0x12, 94); /// get read-only status
-enum BLKRRPART = _IO(0x12, 95); /// re-read partition table
-enum BLKGETSIZE = _IO(0x12, 96); /// return device size
-enum BLKFLSBUF = _IO(0x12, 97); /// flush buffer cache
-enum BLKRASET = _IO(0x12, 98); /// set read ahead for block device
-enum BLKRAGET = _IO(0x12, 99); /// get current read ahead setting
-enum BLKFRASET = _IO(0x12, 100); /// set filesystem
-enum BLKFRAGET = _IO(0x12, 101); /// get filesystem
-enum BLKSECTSET = _IO(0x12, 102); /// set max sectors per request
-enum BLKSECTGET = _IO(0x12, 103); /// get max sectors per request
-enum BLKSSZGET = _IO(0x12, 104); /// get block device sector size
+static if (__traits(compiles, _IO(1, 2)))
+{
+ enum BLKROSET = _IO(0x12, 93); /// set device read-only
+ enum BLKROGET = _IO(0x12, 94); /// get read-only status
+ enum BLKRRPART = _IO(0x12, 95); /// re-read partition table
+ enum BLKGETSIZE = _IO(0x12, 96); /// return device size
+ enum BLKFLSBUF = _IO(0x12, 97); /// flush buffer cache
+ enum BLKRASET = _IO(0x12, 98); /// set read ahead for block device
+ enum BLKRAGET = _IO(0x12, 99); /// get current read ahead setting
+ enum BLKFRASET = _IO(0x12, 100); /// set filesystem
+ enum BLKFRAGET = _IO(0x12, 101); /// get filesystem
+ enum BLKSECTSET = _IO(0x12, 102); /// set max sectors per request
+ enum BLKSECTGET = _IO(0x12, 103); /// get max sectors per request
+ enum BLKSSZGET = _IO(0x12, 104); /// get block device sector size
-enum BLKBSZGET = _IOR!size_t(0x12, 112);
-enum BLKBSZSET = _IOW!size_t(0x12, 113);
-enum BLKGETSIZE64 = _IOR!size_t(0x12, 114);
-enum BLKTRACESTART = _IO(0x12, 116);
-enum BLKTRACESTOP = _IO(0x12, 117);
-enum BLKTRACETEARDOWN = _IO(0x12, 118);
-enum BLKDISCARD = _IO(0x12, 119);
-enum BLKIOMIN = _IO(0x12, 120);
-enum BLKIOOPT = _IO(0x12, 121);
-enum BLKALIGNOFF = _IO(0x12, 122);
-enum BLKPBSZGET = _IO(0x12, 123);
-enum BLKDISCARDZEROES = _IO(0x12, 124);
-enum BLKSECDISCARD = _IO(0x12, 125);
-enum BLKROTATIONAL = _IO(0x12, 126);
-enum BLKZEROOUT = _IO(0x12, 127);
+ enum BLKBSZGET = _IOR!size_t(0x12, 112);
+ enum BLKBSZSET = _IOW!size_t(0x12, 113);
+ enum BLKGETSIZE64 = _IOR!size_t(0x12, 114);
+ enum BLKTRACESTART = _IO(0x12, 116);
+ enum BLKTRACESTOP = _IO(0x12, 117);
+ enum BLKTRACETEARDOWN = _IO(0x12, 118);
+ enum BLKDISCARD = _IO(0x12, 119);
+ enum BLKIOMIN = _IO(0x12, 120);
+ enum BLKIOOPT = _IO(0x12, 121);
+ enum BLKALIGNOFF = _IO(0x12, 122);
+ enum BLKPBSZGET = _IO(0x12, 123);
+ enum BLKDISCARDZEROES = _IO(0x12, 124);
+ enum BLKSECDISCARD = _IO(0x12, 125);
+ enum BLKROTATIONAL = _IO(0x12, 126);
+ enum BLKZEROOUT = _IO(0x12, 127);
-enum BMAP_IOCTL = 1; /// obsolete - kept for compatibility
-enum FIBMAP = _IO(0x00, 1); /// bmap access
-enum FIGETBSZ = _IO(0x00, 2); /// get the block size used for bmap
+ enum BMAP_IOCTL = 1; /// obsolete - kept for compatibility
+ enum FIBMAP = _IO(0x00, 1); /// bmap access
+ enum FIGETBSZ = _IO(0x00, 2); /// get the block size used for bmap
+}
enum FSLABEL_MAX = 256; /// Max chars for the interface; each fs may differ
@@ -2073,8 +2073,6 @@ else
struct
{
- import std.bitmanip : bitfields;
-
/* mixin(bitfields!(ulong, "mem_rsvd", 24, ulong, "mem_snoopx", 2, ulong,
"mem_remote", 1, ulong, "mem_lvl_num", 4, ulong, "mem_dtlb", 7, ulong,
"mem_lock", 2, ulong, "mem_snoop", 5, ulong, "mem_lvl",
@@ -32,7 +32,7 @@ public import core.sys.posix.sys.mman;
import core.sys.linux.config;
// <bits/mman.h>
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/powerpc/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/powerpc/bits/mman.h
version (PPC_Any)
{
enum PROT_SAO = 0x10;
@@ -57,7 +57,7 @@ version (PPC_Any)
// MCL_FUTURE = 0x4000,
// }
}
-// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/riscv/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/riscv/bits/mman.h
else version (RISCV_Any)
{
static if (__USE_MISC) enum
@@ -82,7 +82,7 @@ else version (RISCV_Any)
// MCL_FUTURE = 0x4000,
// }
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/s390/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/mman.h
else version (IBMZ_Any)
{
static if (__USE_MISC) enum
@@ -98,7 +98,7 @@ else version (IBMZ_Any)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/sh/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sh/bits/mman.h
else version (SH)
{
static if (__USE_MISC) enum
@@ -114,7 +114,7 @@ else version (SH)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
else version (SPARC_Any)
{
static if (__USE_MISC) enum
@@ -138,7 +138,7 @@ else version (SPARC_Any)
// MCL_FUTURE = 0x4000,
// }
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/x86/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/bits/mman.h
else version (X86_Any)
{
static if (__USE_MISC) enum MAP_32BIT = 0x40;
@@ -156,7 +156,7 @@ else version (X86_Any)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/aarch64/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/aarch64/bits/mman.h
else version (AArch64)
{
static if (__USE_MISC) enum
@@ -172,7 +172,7 @@ else version (AArch64)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/alpha/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/alpha/bits/mman.h
else version (Alpha)
{
enum
@@ -264,7 +264,7 @@ else version (Alpha)
// POSIX_MADV_DONTNEED = 6,
// }
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/arm/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/arm/bits/mman.h
else version (ARM)
{
static if (__USE_MISC) enum
@@ -280,7 +280,7 @@ else version (ARM)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/hppa/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/hppa/bits/mman.h
else version (HPPA_Any)
{
enum
@@ -384,7 +384,7 @@ else version (HPPA_Any)
// POSIX_MADV_DONTNEED = 4,
// }
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/ia64/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/ia64/bits/mman.h
else version (IA64)
{
static if (__USE_MISC) enum
@@ -401,7 +401,7 @@ else version (IA64)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/m68k/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/m68k/bits/mman.h
else version (M68K)
{
static if (__USE_MISC) enum
@@ -417,7 +417,7 @@ else version (M68K)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
else version (MIPS_Any)
{
static if (__USE_MISC) enum
@@ -440,7 +440,7 @@ else
// <bits/mman-linux.h>
-// https://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=bits/mman-linux.h
+// https://sourceware.org/git/?p=glibc.git;a=blob;f=bits/mman-linux.h
version (Alpha)
{
}
@@ -527,12 +527,12 @@ else
}
// Workaround https://issues.dlang.org/show_bug.cgi?id=17883
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
version (SPARC_Any)
{
static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS;
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
else version (MIPS_Any)
{
static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS;
new file mode 100644
@@ -0,0 +1,745 @@
+module core.sys.linux.syscalls;
+
+version (linux):
+extern (C):
+@system:
+nothrow:
+@nogc:
+
+import core.stdc.config : c_long;
+
+version (CoreDdoc)
+{
+ /// Linux system call number from Linux's asm/unistd.h
+ enum SystemCall : c_long;
+}
+else version (X86_64)
+{
+ // https://github.com/torvalds/linux/blob/v4.14/arch/sh/include/uapi/asm/unistd_64.h
+ // https://github.com/torvalds/linux/blob/v4.14/arch/x86/entry/syscalls/syscall_64.tbl
+ enum SystemCall : c_long
+ {
+ read = 0,
+ write = 1,
+ open = 2,
+ close = 3,
+ stat = 4,
+ fstat = 5,
+ lstat = 6,
+ poll = 7,
+ lseek = 8,
+ mmap = 9,
+ mprotect = 10,
+ munmap = 11,
+ brk = 12,
+ rt_sigaction = 13,
+ rt_sigprocmask = 14,
+ rt_sigreturn = 15,
+ ioctl = 16,
+ pread64 = 17,
+ pwrite64 = 18,
+ readv = 19,
+ writev = 20,
+ access = 21,
+ pipe = 22,
+ select = 23,
+ sched_yield = 24,
+ mremap = 25,
+ msync = 26,
+ mincore = 27,
+ madvise = 28,
+ shmget = 29,
+ shmat = 30,
+ shmctl = 31,
+ dup = 32,
+ dup2 = 33,
+ pause = 34,
+ nanosleep = 35,
+ getitimer = 36,
+ alarm = 37,
+ setitimer = 38,
+ getpid = 39,
+ sendfile = 40,
+ socket = 41,
+ connect = 42,
+ accept = 43,
+ sendto = 44,
+ recvfrom = 45,
+ sendmsg = 46,
+ recvmsg = 47,
+ shutdown = 48,
+ bind = 49,
+ listen = 50,
+ getsockname = 51,
+ getpeername = 52,
+ socketpair = 53,
+ setsockopt = 54,
+ getsockopt = 55,
+ clone = 56,
+ fork = 57,
+ vfork = 58,
+ execve = 59,
+ exit = 60,
+ wait4 = 61,
+ kill = 62,
+ uname = 63,
+ semget = 64,
+ semop = 65,
+ semctl = 66,
+ shmdt = 67,
+ msgget = 68,
+ msgsnd = 69,
+ msgrcv = 70,
+ msgctl = 71,
+ fcntl = 72,
+ flock = 73,
+ fsync = 74,
+ fdatasync = 75,
+ truncate = 76,
+ ftruncate = 77,
+ getdents = 78,
+ getcwd = 79,
+ chdir = 80,
+ fchdir = 81,
+ rename = 82,
+ mkdir = 83,
+ rmdir = 84,
+ creat = 85,
+ link = 86,
+ unlink = 87,
+ symlink = 88,
+ readlink = 89,
+ chmod = 90,
+ fchmod = 91,
+ chown = 92,
+ fchown = 93,
+ lchown = 94,
+ umask = 95,
+ gettimeofday = 96,
+ getrlimit = 97,
+ getrusage = 98,
+ sysinfo = 99,
+ times = 100,
+ ptrace = 101,
+ getuid = 102,
+ syslog = 103,
+ getgid = 104,
+ setuid = 105,
+ setgid = 106,
+ geteuid = 107,
+ getegid = 108,
+ setpgid = 109,
+ getppid = 110,
+ getpgrp = 111,
+ setsid = 112,
+ setreuid = 113,
+ setregid = 114,
+ getgroups = 115,
+ setgroups = 116,
+ setresuid = 117,
+ getresuid = 118,
+ setresgid = 119,
+ getresgid = 120,
+ getpgid = 121,
+ setfsuid = 122,
+ setfsgid = 123,
+ getsid = 124,
+ capget = 125,
+ capset = 126,
+ rt_sigpending = 127,
+ rt_sigtimedwait = 128,
+ rt_sigqueueinfo = 129,
+ rt_sigsuspend = 130,
+ sigaltstack = 131,
+ utime = 132,
+ mknod = 133,
+ uselib = 134,
+ personality = 135,
+ ustat = 136,
+ statfs = 137,
+ fstatfs = 138,
+ sysfs = 139,
+ getpriority = 140,
+ setpriority = 141,
+ sched_setparam = 142,
+ sched_getparam = 143,
+ sched_setscheduler = 144,
+ sched_getscheduler = 145,
+ sched_get_priority_max = 146,
+ sched_get_priority_min = 147,
+ sched_rr_get_interval = 148,
+ mlock = 149,
+ munlock = 150,
+ mlockall = 151,
+ munlockall = 152,
+ vhangup = 153,
+ modify_ldt = 154,
+ pivot_root = 155,
+ _sysctl = 156,
+ prctl = 157,
+ arch_prctl = 158,
+ adjtimex = 159,
+ setrlimit = 160,
+ chroot = 161,
+ sync = 162,
+ acct = 163,
+ settimeofday = 164,
+ mount = 165,
+ umount2 = 166,
+ swapon = 167,
+ swapoff = 168,
+ reboot = 169,
+ sethostname = 170,
+ setdomainname = 171,
+ iopl = 172,
+ ioperm = 173,
+ create_module = 174,
+ init_module = 175,
+ delete_module = 176,
+ get_kernel_syms = 177,
+ query_module = 178,
+ quotactl = 179,
+ nfsservctl = 180,
+ getpmsg = 181,
+ putpmsg = 182,
+ afs_syscall = 183,
+ tuxcall = 184,
+ security = 185,
+ gettid = 186,
+ readahead = 187,
+ setxattr = 188,
+ lsetxattr = 189,
+ fsetxattr = 190,
+ getxattr = 191,
+ lgetxattr = 192,
+ fgetxattr = 193,
+ listxattr = 194,
+ llistxattr = 195,
+ flistxattr = 196,
+ removexattr = 197,
+ lremovexattr = 198,
+ fremovexattr = 199,
+ tkill = 200,
+ time = 201,
+ futex = 202,
+ sched_setaffinity = 203,
+ sched_getaffinity = 204,
+ set_thread_area = 205,
+ io_setup = 206,
+ io_destroy = 207,
+ io_getevents = 208,
+ io_submit = 209,
+ io_cancel = 210,
+ get_thread_area = 211,
+ lookup_dcookie = 212,
+ epoll_create = 213,
+ epoll_ctl_old = 214,
+ epoll_wait_old = 215,
+ remap_file_pages = 216,
+ getdents64 = 217,
+ set_tid_address = 218,
+ restart_syscall = 219,
+ semtimedop = 220,
+ fadvise64 = 221,
+ timer_create = 222,
+ timer_settime = 223,
+ timer_gettime = 224,
+ timer_getoverrun = 225,
+ timer_delete = 226,
+ clock_settime = 227,
+ clock_gettime = 228,
+ clock_getres = 229,
+ clock_nanosleep = 230,
+ exit_group = 231,
+ epoll_wait = 232,
+ epoll_ctl = 233,
+ tgkill = 234,
+ utimes = 235,
+ vserver = 236,
+ mbind = 237,
+ set_mempolicy = 238,
+ get_mempolicy = 239,
+ mq_open = 240,
+ mq_unlink = 241,
+ mq_timedsend = 242,
+ mq_timedreceive = 243,
+ mq_notify = 244,
+ mq_getsetattr = 245,
+ kexec_load = 246,
+ waitid = 247,
+ add_key = 248,
+ request_key = 249,
+ keyctl = 250,
+ ioprio_set = 251,
+ ioprio_get = 252,
+ inotify_init = 253,
+ inotify_add_watch = 254,
+ inotify_rm_watch = 255,
+ migrate_pages = 256,
+ openat = 257,
+ mkdirat = 258,
+ mknodat = 259,
+ fchownat = 260,
+ futimesat = 261,
+ newfstatat = 262,
+ unlinkat = 263,
+ renameat = 264,
+ linkat = 265,
+ symlinkat = 266,
+ readlinkat = 267,
+ fchmodat = 268,
+ faccessat = 269,
+ pselect6 = 270,
+ ppoll = 271,
+ unshare = 272,
+ set_robust_list = 273,
+ get_robust_list = 274,
+ splice = 275,
+ tee = 276,
+ sync_file_range = 277,
+ vmsplice = 278,
+ move_pages = 279,
+ utimensat = 280,
+ epoll_pwait = 281,
+ signalfd = 282,
+ timerfd_create = 283,
+ eventfd = 284,
+ fallocate = 285,
+ timerfd_settime = 286,
+ timerfd_gettime = 287,
+ accept4 = 288,
+ signalfd4 = 289,
+ eventfd2 = 290,
+ epoll_create1 = 291,
+ dup3 = 292,
+ pipe2 = 293,
+ inotify_init1 = 294,
+ preadv = 295,
+ pwritev = 296,
+ rt_tgsigqueueinfo = 297,
+ perf_event_open = 298,
+ recvmmsg = 299,
+ fanotify_init = 300,
+ fanotify_mark = 301,
+ prlimit64 = 302,
+ name_to_handle_at = 303,
+ open_by_handle_at = 304,
+ clock_adjtime = 305,
+ syncfs = 306,
+ sendmmsg = 307,
+ setns = 308,
+ getcpu = 309,
+ process_vm_readv = 310,
+ process_vm_writev = 311,
+ kcmp = 312,
+ finit_module = 313,
+ sched_setattr = 314,
+ sched_getattr = 315,
+ renameat2 = 316,
+ seccomp = 317,
+ getrandom = 318,
+ memfd_create = 319,
+ kexec_file_load = 320,
+ bpf = 321,
+ execveat = 322,
+ userfaultfd = 323,
+ membarrier = 324,
+ mlock2 = 325,
+ copy_file_range = 326,
+ preadv2 = 327,
+ pwritev2 = 328,
+ pkey_mprotect = 329,
+ pkey_alloc = 330,
+ pkey_free = 331,
+ statx = 332,
+ }
+}
+else version (X86)
+{
+ // https://github.com/torvalds/linux/blob/master/arch/x86/entry/syscalls/syscall_32.tbl
+ // https://github.com/torvalds/linux/blob/v4.14/arch/sh/include/uapi/asm/unistd_32.h
+ enum SystemCall : c_long
+ {
+ restart_syscall = 0,
+ exit = 1,
+ fork = 2,
+ read = 3,
+ write = 4,
+ open = 5,
+ close = 6,
+ waitpid = 7,
+ creat = 8,
+ link = 9,
+ unlink = 10,
+ execve = 11,
+ chdir = 12,
+ time = 13,
+ mknod = 14,
+ chmod = 15,
+ lchown = 16,
+ break_ = 17,
+ oldstat = 18,
+ lseek = 19,
+ getpid = 20,
+ mount = 21,
+ umount = 22,
+ setuid = 23,
+ getuid = 24,
+ stime = 25,
+ ptrace = 26,
+ alarm = 27,
+ oldfstat = 28,
+ pause = 29,
+ utime = 30,
+ stty = 31,
+ gtty = 32,
+ access = 33,
+ nice = 34,
+ ftime = 35,
+ sync = 36,
+ kill = 37,
+ rename = 38,
+ mkdir = 39,
+ rmdir = 40,
+ dup = 41,
+ pipe = 42,
+ times = 43,
+ prof = 44,
+ brk = 45,
+ setgid = 46,
+ getgid = 47,
+ signal = 48,
+ geteuid = 49,
+ getegid = 50,
+ acct = 51,
+ umount2 = 52,
+ lock = 53,
+ ioctl = 54,
+ fcntl = 55,
+ mpx = 56,
+ setpgid = 57,
+ ulimit = 58,
+ oldolduname = 59,
+ umask = 60,
+ chroot = 61,
+ ustat = 62,
+ dup2 = 63,
+ getppid = 64,
+ getpgrp = 65,
+ setsid = 66,
+ sigaction = 67,
+ sgetmask = 68,
+ ssetmask = 69,
+ setreuid = 70,
+ setregid = 71,
+ sigsuspend = 72,
+ sigpending = 73,
+ sethostname = 74,
+ setrlimit = 75,
+ getrlimit = 76,
+ getrusage = 77,
+ gettimeofday = 78,
+ settimeofday = 79,
+ getgroups = 80,
+ setgroups = 81,
+ select = 82,
+ symlink = 83,
+ oldlstat = 84,
+ readlink = 85,
+ uselib = 86,
+ swapon = 87,
+ reboot = 88,
+ readdir = 89,
+ mmap = 90,
+ munmap = 91,
+ truncate = 92,
+ ftruncate = 93,
+ fchmod = 94,
+ fchown = 95,
+ getpriority = 96,
+ setpriority = 97,
+ profil = 98,
+ statfs = 99,
+ fstatfs = 100,
+ ioperm = 101,
+ socketcall = 102,
+ syslog = 103,
+ setitimer = 104,
+ getitimer = 105,
+ stat = 106,
+ lstat = 107,
+ fstat = 108,
+ olduname = 109,
+ iopl = 110,
+ vhangup = 111,
+ idle = 112,
+ vm86old = 113,
+ wait4 = 114,
+ swapoff = 115,
+ sysinfo = 116,
+ ipc = 117,
+ fsync = 118,
+ sigreturn = 119,
+ clone = 120,
+ setdomainname = 121,
+ uname = 122,
+ modify_ldt = 123,
+ adjtimex = 124,
+ mprotect = 125,
+ sigprocmask = 126,
+ create_module = 127,
+ init_module = 128,
+ delete_module = 129,
+ get_kernel_syms = 130,
+ quotactl = 131,
+ getpgid = 132,
+ fchdir = 133,
+ bdflush = 134,
+ sysfs = 135,
+ personality = 136,
+ afs_syscall = 137,
+ setfsuid = 138,
+ setfsgid = 139,
+ _llseek = 140,
+ getdents = 141,
+ _newselect = 142,
+ flock = 143,
+ msync = 144,
+ readv = 145,
+ writev = 146,
+ getsid = 147,
+ fdatasync = 148,
+ _sysctl = 149,
+ mlock = 150,
+ munlock = 151,
+ mlockall = 152,
+ munlockall = 153,
+ sched_setparam = 154,
+ sched_getparam = 155,
+ sched_setscheduler = 156,
+ sched_getscheduler = 157,
+ sched_yield = 158,
+ sched_get_priority_max = 159,
+ sched_get_priority_min = 160,
+ sched_rr_get_interval = 161,
+ nanosleep = 162,
+ mremap = 163,
+ setresuid = 164,
+ getresuid = 165,
+ vm86 = 166,
+ query_module = 167,
+ poll = 168,
+ nfsservctl = 169,
+ setresgid = 170,
+ getresgid = 171,
+ prctl = 172,
+ rt_sigreturn = 173,
+ rt_sigaction = 174,
+ rt_sigprocmask = 175,
+ rt_sigpending = 176,
+ rt_sigtimedwait = 177,
+ rt_sigqueueinfo = 178,
+ rt_sigsuspend = 179,
+ pread64 = 180,
+ pwrite64 = 181,
+ chown = 182,
+ getcwd = 183,
+ capget = 184,
+ capset = 185,
+ sigaltstack = 186,
+ sendfile = 187,
+ getpmsg = 188,
+ putpmsg = 189,
+ vfork = 190,
+ ugetrlimit = 191,
+ mmap2 = 192,
+ truncate64 = 193,
+ ftruncate64 = 194,
+ stat64 = 195,
+ lstat64 = 196,
+ fstat64 = 197,
+ lchown32 = 198,
+ getuid32 = 199,
+ getgid32 = 200,
+ geteuid32 = 201,
+ getegid32 = 202,
+ setreuid32 = 203,
+ setregid32 = 204,
+ getgroups32 = 205,
+ setgroups32 = 206,
+ fchown32 = 207,
+ setresuid32 = 208,
+ getresuid32 = 209,
+ setresgid32 = 210,
+ getresgid32 = 211,
+ chown32 = 212,
+ setuid32 = 213,
+ setgid32 = 214,
+ setfsuid32 = 215,
+ setfsgid32 = 216,
+ pivot_root = 217,
+ mincore = 218,
+ madvise = 219,
+ getdents64 = 220,
+ fcntl64 = 221,
+ gettid = 224,
+ readahead = 225,
+ setxattr = 226,
+ lsetxattr = 227,
+ fsetxattr = 228,
+ getxattr = 229,
+ lgetxattr = 230,
+ fgetxattr = 231,
+ listxattr = 232,
+ llistxattr = 233,
+ flistxattr = 234,
+ removexattr = 235,
+ lremovexattr = 236,
+ fremovexattr = 237,
+ tkill = 238,
+ sendfile64 = 239,
+ futex = 240,
+ sched_setaffinity = 241,
+ sched_getaffinity = 242,
+ set_thread_area = 243,
+ get_thread_area = 244,
+ io_setup = 245,
+ io_destroy = 246,
+ io_getevents = 247,
+ io_submit = 248,
+ io_cancel = 249,
+ fadvise64 = 250,
+ exit_group = 252,
+ lookup_dcookie = 253,
+ epoll_create = 254,
+ epoll_ctl = 255,
+ epoll_wait = 256,
+ remap_file_pages = 257,
+ set_tid_address = 258,
+ timer_create = 259,
+ timer_settime = 260,
+ timer_gettime = 261,
+ timer_getoverrun = 262,
+ timer_delete = 263,
+ clock_settime = 264,
+ clock_gettime = 265,
+ clock_getres = 266,
+ clock_nanosleep = 267,
+ statfs64 = 268,
+ fstatfs64 = 269,
+ tgkill = 270,
+ utimes = 271,
+ fadvise64_64 = 272,
+ vserver = 273,
+ mbind = 274,
+ get_mempolicy = 275,
+ set_mempolicy = 276,
+ mq_open = 277,
+ mq_unlink = 278,
+ mq_timedsend = 279,
+ mq_timedreceive = 280,
+ mq_notify = 281,
+ mq_getsetattr = 282,
+ kexec_load = 283,
+ waitid = 284,
+ add_key = 286,
+ request_key = 287,
+ keyctl = 288,
+ ioprio_set = 289,
+ ioprio_get = 290,
+ inotify_init = 291,
+ inotify_add_watch = 292,
+ inotify_rm_watch = 293,
+ migrate_pages = 294,
+ openat = 295,
+ mkdirat = 296,
+ mknodat = 297,
+ fchownat = 298,
+ futimesat = 299,
+ fstatat64 = 300,
+ unlinkat = 301,
+ renameat = 302,
+ linkat = 303,
+ symlinkat = 304,
+ readlinkat = 305,
+ fchmodat = 306,
+ faccessat = 307,
+ pselect6 = 308,
+ ppoll = 309,
+ unshare = 310,
+ set_robust_list = 311,
+ get_robust_list = 312,
+ splice = 313,
+ sync_file_range = 314,
+ tee = 315,
+ vmsplice = 316,
+ move_pages = 317,
+ getcpu = 318,
+ epoll_pwait = 319,
+ utimensat = 320,
+ signalfd = 321,
+ timerfd_create = 322,
+ eventfd = 323,
+ fallocate = 324,
+ timerfd_settime = 325,
+ timerfd_gettime = 326,
+ signalfd4 = 327,
+ eventfd2 = 328,
+ epoll_create1 = 329,
+ dup3 = 330,
+ pipe2 = 331,
+ inotify_init1 = 332,
+ preadv = 333,
+ pwritev = 334,
+ rt_tgsigqueueinfo = 335,
+ perf_event_open = 336,
+ recvmmsg = 337,
+ fanotify_init = 338,
+ fanotify_mark = 339,
+ prlimit64 = 340,
+ name_to_handle_at = 341,
+ open_by_handle_at = 342,
+ clock_adjtime = 343,
+ syncfs = 344,
+ sendmmsg = 345,
+ setns = 346,
+ process_vm_readv = 347,
+ process_vm_writev = 348,
+ kcmp = 349,
+ finit_module = 350,
+ sched_setattr = 351,
+ sched_getattr = 352,
+ renameat2 = 353,
+ seccomp = 354,
+ getrandom = 355,
+ memfd_create = 356,
+ bpf = 357,
+ execveat = 358,
+ socket = 359,
+ socketpair = 360,
+ bind = 361,
+ connect = 362,
+ listen = 363,
+ accept4 = 364,
+ getsockopt = 365,
+ setsockopt = 366,
+ getsockname = 367,
+ getpeername = 368,
+ sendto = 369,
+ sendmsg = 370,
+ recvfrom = 371,
+ recvmsg = 372,
+ shutdown = 373,
+ userfaultfd = 374,
+ membarrier = 375,
+ mlock2 = 376,
+ copy_file_range = 377,
+ preadv2 = 378,
+ pwritev2 = 379,
+ pkey_mprotect = 380,
+ pkey_alloc = 381,
+ pkey_free = 382,
+ statx = 383,
+ arch_prctl = 384,
+ }
+}
@@ -1,16 +1,20 @@
module core.sys.linux.unistd;
-public import core.sys.posix.unistd;
-
version (linux):
-extern(C):
+extern (C):
nothrow:
@system:
+@nogc:
+
+public import core.sys.posix.unistd;
+public import core.sys.linux.syscalls : SystemCall;
+import core.stdc.config : c_long;
// Additional seek constants for sparse file handling
// from Linux's unistd.h, stdio.h, and linux/fs.h
// (see http://man7.org/linux/man-pages/man2/lseek.2.html)
-enum {
+enum
+{
/// Offset is relative to the next location containing data
SEEK_DATA = 3,
/// Offset is relative to the next hole (or EOF if file is not sparse)
@@ -22,3 +26,17 @@ char* getpass(const(char)* prompt);
// Exit all threads in a process
void exit_group(int status);
+
+/**
+Invoke system call specified by number, passing it the remaining arguments.
+This is completely system-dependent, and not often useful.
+
+In Unix, `syscall' sets `errno' for all errors and most calls return -1
+for errors; in many systems you cannot pass arguments or get return
+values for all system calls (`pipe', `fork', and `getppid' typically
+among them).
+
+In Mach, all system calls take normal arguments and always return an
+error code (zero for success).
+*/
+c_long syscall(SystemCall number, ...) @nogc nothrow;
@@ -1,7 +1,7 @@
/**
* D header file for OpenBSD.
*
- * $(LINK2 http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/include/link_elf.h?rev=1.6&content-type=text/x-cvsweb-markup, dlfcn.h)
+ * $(LINK2 https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/include/dlfcn.h?rev=1.15&content-type=text/plain, dlfcn.h)
*/
module core.sys.openbsd.dlfcn;
@@ -16,6 +16,7 @@ static assert(RTLD_NOW == 2);
static assert(RTLD_GLOBAL == 0x100);
static assert(RTLD_LOCAL == 0);
enum RTLD_TRACE = 0x200;
+enum RTLD_NODELETE = 0x400;
enum RTLD_NEXT = cast(void *)-1;
enum RTLD_DEFAULT = cast(void *)-2;
@@ -24,6 +25,7 @@ enum RTLD_SELF = cast(void *)-3;
enum DL_GETERRNO = 1;
enum DL_SETTHREADLCK = 2;
enum DL_SETBINDLCK = 3;
+enum DL_REFERENCE = 4;
enum DL_LAZY = RTLD_LAZY;
new file mode 100644
@@ -0,0 +1,23 @@
+/**
+ * D header file for OpenBSD pthread_np.h.
+ *
+ * Copyright: Copyright © 2021, The D Language Foundation
+ * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
+ * Authors: Brian Callahan
+ */
+module core.sys.openbsd.pthread_np;
+
+version (OpenBSD):
+extern (C):
+nothrow:
+@nogc:
+
+public import core.sys.posix.sys.types;
+import core.sys.posix.signal : stack_t;
+
+int pthread_mutexattr_getkind_np(pthread_mutexattr_t);
+int pthread_mutexattr_setkind_np(pthread_mutexattr_t*, int);
+void pthread_get_name_np(pthread_t, char*, size_t);
+void pthread_set_name_np(pthread_t, const(char)*);
+int pthread_stackseg_np(pthread_t, stack_t*);
+int pthread_main_np();
@@ -13,5 +13,11 @@ extern (C):
nothrow:
@nogc:
+void freezero(void*, size_t);
+void* calloc_conceal(size_t, size_t);
+void* malloc_conceal(size_t);
+void* reallocarray(void*, size_t, size_t);
+void* recallocarray(void*, size_t, size_t, size_t);
+
const(char)* getprogname();
-void setprogname(scope const char* name);
+void setprogname(scope const char*);
@@ -17,7 +17,13 @@ nothrow:
static if (__BSD_VISIBLE)
{
+ void explicit_bzero(void*, size_t);
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
+ void* memrchr(scope const void*, int, size_t);
+ size_t strlcat(char*, scope const char*, size_t);
+ size_t strlcpy(char*, scope const char*, size_t);
+ void strmode(int, char*);
+ char* strsep(char**, scope const char*);
pure int timingsafe_bcmp(scope const void*, scope const void*, size_t);
pure int timingsafe_memcmp(scope const void*, scope const void*, size_t);
}
@@ -19,11 +19,12 @@ import core.sys.posix.sys.types;
// enum MAP_PRIVATE = 0x0002;
// enum MAP_FIXED = 0x0010;
// enum MAP_ANON = 0x1000;
+// enum MAP_STACK = 0x4000;
alias MAP_ANONYMOUS = MAP_ANON;
-enum MAP_STACK = 0x4000;
+enum MAP_CONCEAL = 0x8000;
-enum MAP_FLAGMASK = 0x7ff7;
+enum MAP_FLAGMASK = 0xfff7;
alias MAP_COPY = MAP_PRIVATE;
enum MAP_FILE = 0;
@@ -45,7 +46,6 @@ static if (__BSD_VISIBLE)
enum MADV_FREE = 6;
int madvise(void *, size_t, int);
- int mincore(const(void) *, size_t, char *);
int minherit(void *, size_t, int);
void* mquery(void *, size_t, int, int, int, off_t);
}
@@ -250,5 +250,4 @@ enum
}
///
-int sysctl(const int* name, uint namelen, void* oldp, size_t* oldlenp,
- const void* newp, size_t newlen);
+int sysctl(const int*, uint, void*, size_t*, void*, size_t);
@@ -6,12 +6,12 @@
* Authors: Brian Callahan
*/
module core.sys.openbsd.unistd;
-public import core.sys.posix.unistd;
version (OpenBSD):
extern (C):
nothrow:
@nogc:
+int getentropy(void*, size_t);
int pledge(const scope char*, const scope char*);
int unveil(const scope char*, const scope char*);
@@ -567,6 +567,7 @@ else version (OpenBSD)
enum AI_NUMERICHOST = 0x4;
enum AI_EXT = 0x8;
enum AI_NUMERICSERV = 0x10;
+ enum AI_V4MAPPED = 0; // Not supported
enum AI_FQDN = 0x20;
enum AI_ADDRCONFIG = 0x40;
enum AI_MASK = AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | AI_FQDN | AI_ADDRCONFIG;
@@ -34,3 +34,15 @@ version (Darwin)
enum uint FIOGETOWN = _IOR!(int)('f', 123); // get owner
enum uint FIODTYPE = _IOR!(int)('f', 122); // get d_type
}
+
+version (OpenBSD)
+{
+ // File-descriptor ioctl's
+ enum uint FIOCLEX = _IO('f', 1); // set close on exec on fd
+ enum uint FIONCLEX = _IO('f', 2); // remove close on exec
+ enum uint FIONREAD = _IOR!(int)('f', 127); // get # bytes to read
+ enum uint FIONBIO = _IOW!(int)('f', 126); // set/clear non-blocking i/o
+ enum uint FIOASYNC = _IOW!(int)('f', 125); // set/clear async i/o
+ enum uint FIOSETOWN = _IOW!(int)('f', 124); // set owner
+ enum uint FIOGETOWN = _IOR!(int)('f', 123); // get owner
+}
@@ -137,3 +137,59 @@ else version (FreeBSD)
return _IOC(IOC_INOUT, cast(uint)g, cast(uint)n, T.sizeof);
}
}
+else version (OpenBSD)
+{
+ /* OpenBSD 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_MASK = 0x1fff; // 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 << 12); // 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 = 0xe0000000;
+
+ // 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);
+ }
+ // 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);
+ }
+}
@@ -375,6 +375,11 @@ else version (NetBSD)
}
else version (OpenBSD)
{
+ import core.sys.posix.termios; // termios
+ import core.sys.posix.sys.time; // timeval
+
+ public import core.sys.posix.sys.ttycom; // Terminal related ioctls
+
struct winsize
{
ushort ws_row;
@@ -383,6 +388,8 @@ else version (OpenBSD)
ushort ws_ypixel;
}
+ public import core.sys.posix.sys.filio; // File related ioctls
+
int ioctl(int, c_ulong, ...);
}
else version (DragonFlyBSD)
@@ -460,6 +460,7 @@ else version (OpenBSD)
enum MAP_PRIVATE = 0x0002;
enum MAP_FIXED = 0x0010;
enum MAP_ANON = 0x1000;
+ enum MAP_STACK = 0x4000;
enum MAP_FAILED = cast(void*)-1;
@@ -536,7 +536,8 @@ version (CRuntime_Glibc)
enum
{
- SOMAXCONN = 128
+ // https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/unix/sysv/linux/bits/socket.h;h=96958e2700f5b4f4d1183a0606b2b9848a53ea44
+ SOMAXCONN = 4096
}
enum : uint
@@ -214,3 +214,104 @@ else version (FreeBSD)
enum uint NETGRAPHDISC = 6; // Netgraph tty node discipline
enum uint H4DISC = 7; // Netgraph Blutooth H4 discipline
}
+else version (OpenBSD)
+{
+ 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
+ }
+
+ struct tstamps {
+ int ts_set; // TIOCM_CAR and/or TIOCM_CTS
+ int ts_clr;
+ }
+
+ // 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 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 TIOCSETVERAUTH = _IOW!(int)('t', 28); // set verified auth
+ enum uint TIOCCLRVERAUTH = _IO('t', 29); // clear verified auth
+ enum uint TIOCCHKVERAUTH = _IO('t', 30); // check verified auth
+ // 31-89 unused
+ enum uint TIOCSTSTAMP = _IOW!(tstamps)('t', 90); // timestamp reasons
+ enum uint TIOCGTSTAMP = _IOR!(timeval)('t', 91); // get timestamp
+ // 92-93 device flags
+ enum uint TIOCSFLAGS = _IOW!(int)('t', 92); // set device flags
+ enum uint TIOCGFLAGS = _IOR!(int)('t', 93); // get device flags
+ // 94-97 conflicts: tun and tap
+ enum uint TIOCDRAIN = _IO('t', 94); // wait till output drained
+ enum uint TIOCSIG = _IOW!(int)('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
+ enum uint TIOCREMOTE = _IOW!(int)('t', 105); // remote input editing
+ 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_CAR = 0x40; // carrier detect
+ enum uint TIOCM_RNG = 0x80; // ring
+ enum uint TIOCM_DSR = 0x100; // data set ready
+ enum uint TIOCM_CD = TIOCM_CAR;
+ enum uint TIOCM_RI = TIOCM_RNG;
+ 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
+ // 114 unused
+ 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 TABLDISC = 3; // tablet description
+ enum uint SLIPDISC = 4; // serial IP discipline
+ enum uint PPPDISC = 5; // PPP discipline
+ enum uint STRIPDISC = 6; // metricom wireless IP discipline
+ enum uint NMEADISC = 7; // NMEA0183 discipline
+ enum uint MSTSDISC = 8; // Meinberg time string discipline
+ enum uint ENDRUNDISC = 9; // Endrun time format discipline
+}
@@ -341,11 +341,6 @@ else version (OpenBSD)
int clock_gettime(clockid_t, timespec*);
int clock_settime(clockid_t, const scope timespec*);
int nanosleep(const scope timespec*, timespec*);
- int timer_create(clockid_t, sigevent*, timer_t*);
- int timer_delete(timer_t);
- int timer_gettime(timer_t, itimerspec*);
- int timer_getoverrun(timer_t);
- int timer_settime(timer_t, int, const scope itimerspec*, itimerspec*);
}
else version (Solaris)
{
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_accctrl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_accctrl.d)
*/
module core.sys.windows.accctrl;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_aclapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_aclapi.d)
*/
module core.sys.windows.aclapi;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_aclui.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_aclui.d)
*/
module core.sys.windows.aclui;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_basetsd.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_basetsd.d)
*/
module core.sys.windows.basetsd;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.10
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_basetyps.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_basetyps.d)
*/
module core.sys.windows.basetyps;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_cderr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_cderr.d)
*/
module core.sys.windows.cderr;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_cguid.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_cguid.d)
*/
module core.sys.windows.cguid;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_comcat.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_comcat.d)
*/
module core.sys.windows.comcat;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.12
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_commctrl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_commctrl.d)
*/
module core.sys.windows.commctrl;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.12
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_commdlg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_commdlg.d)
*/
module core.sys.windows.commdlg;
version (Windows):
@@ -2,7 +2,7 @@
* Helper module for the Windows API
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_core.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_core.d)
*/
module core.sys.windows.core;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_cpl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_cpl.d)
*/
module core.sys.windows.cpl;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_cplext.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_cplext.d)
*/
module core.sys.windows.cplext;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_custcntl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_custcntl.d)
*/
module core.sys.windows.custcntl;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Vladimir Vlasov
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_dbt.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_dbt.d)
*/
module core.sys.windows.dbt;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_dde.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_dde.d)
*/
module core.sys.windows.dde;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ddeml.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ddeml.d)
*/
module core.sys.windows.ddeml;
version (Windows):
@@ -16,6 +16,11 @@ pragma(lib, "user32");
import core.sys.windows.basetsd, core.sys.windows.windef, core.sys.windows.winnt;
+mixin DECLARE_HANDLE!("HCONVLIST");
+mixin DECLARE_HANDLE!("HCONV");
+mixin DECLARE_HANDLE!("HSZ");
+mixin DECLARE_HANDLE!("HDDEDATA");
+
enum : int {
CP_WINANSI = 1004,
CP_WINUNICODE = 1200
@@ -76,10 +81,13 @@ enum : UINT {
XTYP_SHIFT = 4
}
-/+
-#define TIMEOUT_ASYNC 0xFFFFFFFF
-#define QID_SYNC 0xFFFFFFFF
-+/
+enum : UINT {
+ TIMEOUT_ASYNC = 0xFFFFFFFF
+}
+
+enum : UINT {
+ QID_SYNC = 0xFFFFFFFF
+}
enum : UINT {
ST_CONNECTED = 1,
@@ -93,9 +101,9 @@ enum : UINT {
ST_ISSELF = 256
}
-/+
-#define CADV_LATEACK 0xFFFF
-+/
+enum : UINT {
+ CADV_LATEACK = 0xFFFF
+}
enum : UINT {
DMLERR_NO_ERROR = 0,
@@ -121,22 +129,26 @@ enum : UINT {
DMLERR_LAST = DMLERR_UNFOUND_QUEUE_ID
}
-/+
-#define DDE_FACK 0x8000
-#define DDE_FBUSY 0x4000
-#define DDE_FDEFERUPD 0x4000
-#define DDE_FACKREQ 0x8000
-#define DDE_FRELEASE 0x2000
-#define DDE_FREQUESTED 0x1000
-#define DDE_FAPPSTATUS 0x00ff
-#define DDE_FNOTPROCESSED 0
-#define DDE_FACKRESERVED (~(DDE_FACK|DDE_FBUSY|DDE_FAPPSTATUS))
-#define DDE_FADVRESERVED (~(DDE_FACKREQ|DDE_FDEFERUPD))
-#define DDE_FDATRESERVED (~(DDE_FACKREQ|DDE_FRELEASE|DDE_FREQUESTED))
-#define DDE_FPOKRESERVED (~DDE_FRELEASE)
-#define MSGF_DDEMGR 0x8001
-#define CBR_BLOCK ((HDDEDATA)0xffffffff)
-+/
+enum : UINT {
+ DDE_FACK = 0x8000,
+ DDE_FBUSY = 0x4000,
+ DDE_FDEFERUPD = 0x4000,
+ DDE_FACKREQ = 0x8000,
+ DDE_FRELEASE = 0x2000,
+ DDE_FREQUESTED = 0x1000,
+ DDE_FAPPSTATUS = 0x00ff,
+ DDE_FNOTPROCESSED = 0,
+ DDE_FACKRESERVED = (~(DDE_FACK|DDE_FBUSY|DDE_FAPPSTATUS)),
+ DDE_FADVRESERVED = (~(DDE_FACKREQ|DDE_FDEFERUPD)),
+ DDE_FDATRESERVED = (~(DDE_FACKREQ|DDE_FRELEASE|DDE_FREQUESTED)),
+ DDE_FPOKRESERVED = (~DDE_FRELEASE)
+}
+
+enum : UINT {
+ MSGF_DDEMGR = 0x8001
+}
+
+enum CBR_BLOCK = cast(HDDEDATA)-1;
enum DWORD
APPCLASS_STANDARD = 0,
@@ -180,10 +192,13 @@ enum : UINT {
DNS_FILTEROFF = 8
}
-/+
-#define HDATA_APPOWNED 1
-#define MAX_MONITORS 4
-+/
+enum : UINT {
+ HDATA_APPOWNED = 1
+}
+
+enum : UINT {
+ MAX_MONITORS = 4
+}
enum : int {
MH_CREATE = 1,
@@ -192,11 +207,6 @@ enum : int {
MH_CLEANUP = 4
}
-mixin DECLARE_HANDLE!("HCONVLIST");
-mixin DECLARE_HANDLE!("HCONV");
-mixin DECLARE_HANDLE!("HSZ");
-mixin DECLARE_HANDLE!("HDDEDATA");
-
extern (Windows) alias HDDEDATA
function(UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, ULONG_PTR, ULONG_PTR) PFNCALLBACK;
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_dhcpcsdk.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_dhcpcsdk.d)
*/
module core.sys.windows.dhcpcsdk;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_dlgs.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_dlgs.d)
*/
module core.sys.windows.dlgs;
version (Windows):
@@ -6,7 +6,7 @@
* $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
* (See accompanying file LICENSE)
* Authors: Rainer Schuetze
- * Source: $(DRUNTIMESRC src/core/sys/windows/_dll.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_dll.d)
*/
/* NOTE: This file has been patched from the original DMD distribution to
@@ -573,10 +573,10 @@ bool dll_thread_detach( bool detach_thread = true, bool exitTls = true )
/// ---
mixin template SimpleDllMain()
{
- import core.sys.windows.windef : HINSTANCE;
+ import core.sys.windows.windef : HINSTANCE, BOOL, DWORD, LPVOID;
extern(Windows)
- bool DllMain(HINSTANCE hInstance, uint ulReason, void* reserved)
+ BOOL DllMain(HINSTANCE hInstance, DWORD ulReason, LPVOID reserved)
{
import core.sys.windows.winnt;
import core.sys.windows.dll :
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_docobj.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_docobj.d)
*/
module core.sys.windows.docobj;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_errorrep.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_errorrep.d)
*/
module core.sys.windows.errorrep;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_exdisp.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_exdisp.d)
*/
module core.sys.windows.exdisp;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_exdispid.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_exdispid.d)
*/
module core.sys.windows.exdispid;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_httpext.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_httpext.d)
*/
module core.sys.windows.httpext;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_idispids.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_idispids.d)
*/
module core.sys.windows.idispids;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_imagehlp.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_imagehlp.d)
*/
module core.sys.windows.imagehlp;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_imm.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_imm.d)
*/
module core.sys.windows.imm;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_intshcut.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_intshcut.d)
*/
module core.sys.windows.intshcut;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ipexport.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ipexport.d)
*/
module core.sys.windows.ipexport;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_iphlpapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_iphlpapi.d)
*/
module core.sys.windows.iphlpapi;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ipifcons.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ipifcons.d)
*/
module core.sys.windows.ipifcons;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_iprtrmib.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_iprtrmib.d)
*/
module core.sys.windows.iprtrmib;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_iptypes.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_iptypes.d)
*/
module core.sys.windows.iptypes;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_isguids.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_isguids.d)
*/
module core.sys.windows.isguids;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lm.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lm.d)
*/
module core.sys.windows.lm;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmaccess.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmaccess.d)
*/
module core.sys.windows.lmaccess;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmalert.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmalert.d)
*/
module core.sys.windows.lmalert;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmapibuf.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmapibuf.d)
*/
module core.sys.windows.lmapibuf;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmat.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmat.d)
*/
module core.sys.windows.lmat;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmaudit.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmaudit.d)
*/
// COMMENT: This file may be deprecated.
module core.sys.windows.lmaudit;
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmbrowsr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmbrowsr.d)
*/
module core.sys.windows.lmbrowsr;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmchdev.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmchdev.d)
*/
module core.sys.windows.lmchdev;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmconfig.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmconfig.d)
*/
module core.sys.windows.lmconfig;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmcons.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmcons.d)
*/
module core.sys.windows.lmcons;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmerr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmerr.d)
*/
module core.sys.windows.lmerr;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmerrlog.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmerrlog.d)
*/
module core.sys.windows.lmerrlog;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmmsg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmmsg.d)
*/
module core.sys.windows.lmmsg;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmremutl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmremutl.d)
*/
module core.sys.windows.lmremutl;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmrepl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmrepl.d)
*/
module core.sys.windows.lmrepl;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmserver.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmserver.d)
*/
module core.sys.windows.lmserver;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmshare.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmshare.d)
*/
module core.sys.windows.lmshare;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmsname.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmsname.d)
*/
module core.sys.windows.lmsname;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmstats.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmstats.d)
*/
module core.sys.windows.lmstats;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmsvc.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmsvc.d)
*/
module core.sys.windows.lmsvc;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmuse.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmuse.d)
*/
module core.sys.windows.lmuse;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.10
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmuseflg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmuseflg.d)
*/
module core.sys.windows.lmuseflg;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmwksta.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmwksta.d)
*/
module core.sys.windows.lmwksta;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lzexpand.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lzexpand.d)
*/
module core.sys.windows.lzexpand;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mapi.d)
*/
module core.sys.windows.mapi;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mciavi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mciavi.d)
*/
module core.sys.windows.mciavi;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mcx.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mcx.d)
*/
module core.sys.windows.mcx;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mgmtapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mgmtapi.d)
*/
module core.sys.windows.mgmtapi;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mmsystem.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mmsystem.d)
*/
module core.sys.windows.mmsystem;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_msacm.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_msacm.d)
*/
module core.sys.windows.msacm;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mshtml.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mshtml.d)
*/
module core.sys.windows.mshtml;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Daniel Keep
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mswsock.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mswsock.d)
*/
module core.sys.windows.mswsock;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_nb30.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_nb30.d)
*/
module core.sys.windows.nb30;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_nddeapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_nddeapi.d)
*/
module core.sys.windows.nddeapi;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_nspapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_nspapi.d)
*/
module core.sys.windows.nspapi;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ntdef.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ntdef.d)
*/
module core.sys.windows.ntdef;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ntdll.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ntdll.d)
*/
module core.sys.windows.ntdll;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ntldap.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ntldap.d)
*/
module core.sys.windows.ntldap;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ntsecapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ntsecapi.d)
*/
module core.sys.windows.ntsecapi;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Ellery Newcomer
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ntsecpkg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ntsecpkg.d)
*/
module core.sys.windows.ntsecpkg;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_oaidl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_oaidl.d)
*/
module core.sys.windows.oaidl;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_objbase.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_objbase.d)
*/
module core.sys.windows.objbase;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_objfwd.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_objfwd.d)
*/
module core.sys.windows.objfwd;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_objidl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_objidl.d)
*/
// TODO (Don):
// # why is "alias IPSFactoryBuffer* LPPSFACTORYBUFFER;" in this file,
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_objsafe.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_objsafe.d)
*/
module core.sys.windows.objsafe;
version (Windows):
@@ -6,7 +6,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ocidl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ocidl.d)
*/
module core.sys.windows.ocidl;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_odbcinst.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_odbcinst.d)
*/
module core.sys.windows.odbcinst;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ole.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ole.d)
*/
module core.sys.windows.ole;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ole2.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ole2.d)
*/
module core.sys.windows.ole2;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.10
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ole2ver.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ole2ver.d)
*/
module core.sys.windows.ole2ver;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_oleacc.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_oleacc.d)
*/
module core.sys.windows.oleacc;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_oleauto.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_oleauto.d)
*/
module core.sys.windows.oleauto;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_olectl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_olectl.d)
*/
module core.sys.windows.olectl;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_olectlid.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_olectlid.d)
*/
module core.sys.windows.olectlid;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_oledlg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_oledlg.d)
*/
module core.sys.windows.oledlg;
@system:
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_oleidl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_oleidl.d)
*/
module core.sys.windows.oleidl;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_pbt.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_pbt.d)
*/
module core.sys.windows.pbt;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_powrprof.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_powrprof.d)
*/
module core.sys.windows.powrprof;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Vladimir Vlasov
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_prsht.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_prsht.d)
*/
module core.sys.windows.prsht;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_psapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_psapi.d)
*/
/* Comment from MinGW
* Process status API (PSAPI)
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rapi.d)
*/
module core.sys.windows.rapi;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ras.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ras.d)
*/
module core.sys.windows.ras;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rasdlg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rasdlg.d)
*/
module core.sys.windows.rasdlg;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_raserror.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_raserror.d)
*/
module core.sys.windows.raserror;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rassapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rassapi.d)
*/
module core.sys.windows.rassapi;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_reason.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_reason.d)
*/
module core.sys.windows.reason;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_regstr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_regstr.d)
*/
module core.sys.windows.regstr;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_richedit.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_richedit.d)
*/
module core.sys.windows.richedit;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_richole.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_richole.d)
*/
module core.sys.windows.richole;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpc.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpc.d)
*/
module core.sys.windows.rpc;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcdce.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcdce.d)
*/
module core.sys.windows.rpcdce;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcdce2.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcdce2.d)
*/
module core.sys.windows.rpcdce2;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcdcep.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcdcep.d)
*/
module core.sys.windows.rpcdcep;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcndr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcndr.d)
*/
module core.sys.windows.rpcndr;
version (Windows):
@@ -6,7 +6,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcnsi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcnsi.d)
*/
module core.sys.windows.rpcnsi;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcnsip.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcnsip.d)
*/
module core.sys.windows.rpcnsip;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcnterr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcnterr.d)
*/
module core.sys.windows.rpcnterr;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_schannel.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_schannel.d)
*/
module core.sys.windows.schannel;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from Windows SDK API
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/sdkddkver.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/sdkddkver.d)
*/
module core.sys.windows.sdkddkver;
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_secext.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_secext.d)
*/
// Don't include this file directly, use core.sys.windows.security instead.
module core.sys.windows.secext;
@@ -5,7 +5,7 @@
*
* Authors: Ellery Newcomer, John Colvin
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_security.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_security.d)
*/
module core.sys.windows.security;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.10
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_servprov.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_servprov.d)
*/
module core.sys.windows.servprov;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Vladimir Vlasov
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_setupapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_setupapi.d)
*/
module core.sys.windows.setupapi;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_shellapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_shellapi.d)
*/
module core.sys.windows.shellapi;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_shldisp.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_shldisp.d)
*/
module core.sys.windows.shldisp;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_shlguid.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_shlguid.d)
*/
module core.sys.windows.shlguid;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 4.0
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_shlobj.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_shlobj.d)
*/
module core.sys.windows.shlobj;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_shlwapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_shlwapi.d)
*/
module core.sys.windows.shlwapi;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_snmp.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_snmp.d)
*/
module core.sys.windows.snmp;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_sql.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_sql.d)
*/
module core.sys.windows.sql;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_sqlext.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_sqlext.d)
*/
module core.sys.windows.sqlext;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_sqltypes.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_sqltypes.d)
*/
module core.sys.windows.sqltypes;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_sqlucode.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_sqlucode.d)
*/
module core.sys.windows.sqlucode;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Ellery Newcomer
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_sspi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_sspi.d)
*/
module core.sys.windows.sspi;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Iain Buclaw
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/stdc/_malloc.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/stdc/_malloc.d)
*/
module core.sys.windows.stdc.malloc;
version (CRuntime_Microsoft):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_subauth.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_subauth.d)
*/
module core.sys.windows.subauth;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_tlhelp32.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_tlhelp32.d)
*/
module core.sys.windows.tlhelp32;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_tmschema.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_tmschema.d)
*/
module core.sys.windows.tmschema;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_unknwn.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_unknwn.d)
*/
module core.sys.windows.unknwn;
version (Windows):
@@ -4,7 +4,7 @@
* written in the D programming language
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_vfw.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_vfw.d)
*/
module core.sys.windows.vfw;
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_w32api.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_w32api.d)
*/
module core.sys.windows.w32api;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.10
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winbase.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winbase.d)
*/
module core.sys.windows.winbase;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winber.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winber.d)
*/
module core.sys.windows.winber;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wincon.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wincon.d)
*/
module core.sys.windows.wincon;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wincrypt.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wincrypt.d)
*/
module core.sys.windows.wincrypt;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_windef.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_windef.d)
*/
module core.sys.windows.windef;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 4.0
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_windows.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_windows.d)
*/
module core.sys.windows.windows;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winerror.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winerror.d)
*/
module core.sys.windows.winerror;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wingdi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wingdi.d)
*/
module core.sys.windows.wingdi;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from Windows SDK Headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winhttp.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winhttp.d)
*/
module core.sys.windows.winhttp;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wininet.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wininet.d)
*/
module core.sys.windows.wininet;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winioctl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winioctl.d)
*/
module core.sys.windows.winioctl;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winldap.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winldap.d)
*/
module core.sys.windows.winldap;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winnetwk.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winnetwk.d)
*/
module core.sys.windows.winnetwk;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winnls.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winnls.d)
*/
module core.sys.windows.winnls;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.12
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winnt.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winnt.d)
*/
module core.sys.windows.winnt;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winperf.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winperf.d)
*/
module core.sys.windows.winperf;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winreg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winreg.d)
*/
module core.sys.windows.winreg;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winspool.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winspool.d)
*/
module core.sys.windows.winspool;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winsvc.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winsvc.d)
*/
module core.sys.windows.winsvc;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winuser.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winuser.d)
*/
module core.sys.windows.winuser;
version (Windows):
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winver.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winver.d)
*/
module core.sys.windows.winver;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW-w64 API
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wtsapi32.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wtsapi32.d)
*/
module core.sys.windows.wtsapi32;
version (Windows):
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wtypes.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wtypes.d)
*/
module core.sys.windows.wtypes;
version (Windows):
@@ -1043,10 +1043,14 @@ private:
// Allocate more for the memory guard
sz += guardPageSize;
+ int mmap_flags = MAP_PRIVATE | MAP_ANON;
+ version (OpenBSD)
+ mmap_flags |= MAP_STACK;
+
m_pmem = mmap( null,
sz,
PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANON,
+ mmap_flags,
-1,
0 );
if ( m_pmem == MAP_FAILED )
@@ -1894,7 +1898,7 @@ unittest
try
{
- (new Fiber({
+ (new Fiber(function() {
throw new Exception( MSG );
})).call();
assert( false, "Expected rethrown exception." );
@@ -1109,6 +1109,7 @@ unittest
try
{
new Thread(
+ function()
{
throw new Exception( MSG );
}).start().join();
@@ -1196,8 +1196,8 @@ public:
+/
template split(units...)
if (allAreAcceptedUnits!("weeks", "days", "hours", "minutes", "seconds",
- "msecs", "usecs", "hnsecs", "nsecs")(units) &&
- unitsAreInDescendingOrder(units))
+ "msecs", "usecs", "hnsecs", "nsecs")([units]) &&
+ unitsAreInDescendingOrder([units]))
{
/++ Ditto +/
void split(Args...)(out Args args) const nothrow @nogc
@@ -3709,7 +3709,7 @@ unittest
/+
Whether all of the given strings are among the accepted strings.
+/
-bool allAreAcceptedUnits(acceptedUnits...)(string[] units...)
+bool allAreAcceptedUnits(acceptedUnits...)(scope string[] units)
{
foreach (unit; units)
{
@@ -3730,12 +3730,12 @@ bool allAreAcceptedUnits(acceptedUnits...)(string[] units...)
unittest
{
- assert(allAreAcceptedUnits!("hours", "seconds")("seconds", "hours"));
- assert(!allAreAcceptedUnits!("hours", "seconds")("minutes", "hours"));
- assert(!allAreAcceptedUnits!("hours", "seconds")("seconds", "minutes"));
- assert(allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")("minutes"));
- assert(!allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")("usecs"));
- assert(!allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")("secs"));
+ assert(allAreAcceptedUnits!("hours", "seconds")(["seconds", "hours"]));
+ assert(!allAreAcceptedUnits!("hours", "seconds")(["minutes", "hours"]));
+ assert(!allAreAcceptedUnits!("hours", "seconds")(["seconds", "minutes"]));
+ assert(allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")(["minutes"]));
+ assert(!allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")(["usecs"]));
+ assert(!allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")(["secs"]));
}
@@ -3743,7 +3743,7 @@ unittest
Whether the given time unit strings are arranged in order from largest to
smallest.
+/
-bool unitsAreInDescendingOrder(string[] units...)
+bool unitsAreInDescendingOrder(scope string[] units)
{
if (units.length <= 1)
return true;
@@ -3783,13 +3783,13 @@ bool unitsAreInDescendingOrder(string[] units...)
unittest
{
- assert(unitsAreInDescendingOrder("years", "months", "weeks", "days", "hours", "minutes",
- "seconds", "msecs", "usecs", "hnsecs", "nsecs"));
- assert(unitsAreInDescendingOrder("weeks", "hours", "msecs"));
- assert(unitsAreInDescendingOrder("days", "hours", "minutes"));
- assert(unitsAreInDescendingOrder("hnsecs"));
- assert(!unitsAreInDescendingOrder("days", "hours", "hours"));
- assert(!unitsAreInDescendingOrder("days", "hours", "days"));
+ assert(unitsAreInDescendingOrder(["years", "months", "weeks", "days", "hours", "minutes",
+ "seconds", "msecs", "usecs", "hnsecs", "nsecs"]));
+ assert(unitsAreInDescendingOrder(["weeks", "hours", "msecs"]));
+ assert(unitsAreInDescendingOrder(["days", "hours", "minutes"]));
+ assert(unitsAreInDescendingOrder(["hnsecs"]));
+ assert(!unitsAreInDescendingOrder(["days", "hours", "hours"]));
+ assert(!unitsAreInDescendingOrder(["days", "hours", "days"]));
}
version (Darwin)
@@ -2446,7 +2446,7 @@ class Throwable : Object
override string toString()
{
string s;
- toString((buf) { s ~= buf; });
+ toString((in buf) { s ~= buf; });
return s;
}
@@ -4752,3 +4752,79 @@ template _arrayOp(Args...)
}
public import core.builtins : __ctfeWrite;
+
+/**
+
+Provides an "inline import", i.e. an `import` that is only available for a
+limited lookup. For example:
+
+---
+void fun(imported!"std.stdio".File input)
+{
+ ... use File from std.stdio normally ...
+}
+---
+
+There is no need to import `std.stdio` at top level, so `fun` carries its own
+dependencies. The same approach can be used for template constraints:
+
+---
+void fun(T)(imported!"std.stdio".File input, T value)
+if (imported!"std.traits".isIntegral!T)
+{
+ ...
+}
+---
+
+An inline import may be used in conjunction with the `with` statement as well.
+Inside the scope controlled by `with`, all symbols in the imported module are
+made available:
+
+---
+void fun()
+{
+ with (imported!"std.datetime")
+ with (imported!"std.stdio")
+ {
+ Clock.currTime.writeln;
+ }
+}
+---
+
+The advantages of inline imports over top-level uses of the `import` declaration
+are the following:
+
+$(UL
+$(LI The `imported` template specifies dependencies at declaration level, not at
+module level. This allows reasoning about the dependency cost of declarations in
+separation instead of aggregated at module level.)
+$(LI Declarations using `imported` are easier to move around because they don't
+require top-level context, making for simpler and quicker refactorings.)
+$(LI Declarations using `imported` scale better with templates. This is because
+templates that are not instantiated do not have their parameters and constraints
+instantiated, so additional modules are not imported without necessity. This
+makes the cost of unused templates negligible. Dependencies are pulled on a need
+basis depending on the declarations used by client code.)
+)
+
+The use of `imported` also has drawbacks:
+
+$(UL
+$(LI If most declarations in a module need the same imports, then factoring them
+at top level, outside the declarations, is simpler than repeating them.)
+$(LI Traditional dependency-tracking tools such as make and other build systems
+assume file-level dependencies and need special tooling (such as rdmd) in order
+to work efficiently.)
+$(LI Dependencies at the top of a module are easier to inspect quickly than
+dependencies spread throughout the module.)
+)
+
+See_Also: The $(HTTP forum.dlang.org/post/tzqzmqhankrkbrfsrmbo@forum.dlang.org,
+forum discussion) that led to the creation of the `imported` facility. Credit is
+due to Daniel Nielsen and Dominikus Dittes Scherkl.
+
+*/
+template imported(string moduleName)
+{
+ mixin("import imported = " ~ moduleName ~ ";");
+}
@@ -8,19 +8,8 @@
* Authors: Walter Bright, Sean Kelly
* Source: $(DRUNTIMESRC rt/_aApplyR.d)
*/
-
-/* Copyright Digital Mars 2004 - 2010.
- * Distributed under the Boost Software License, Version 1.0.
- * (See accompanying file LICENSE or copy at
- * http://www.boost.org/LICENSE_1_0.txt)
- */
module rt.aApplyR;
-/* This code handles decoding UTF strings for foreach_reverse loops.
- * There are 6 combinations of conversions between char, wchar,
- * and dchar, and 2 of each of those.
- */
-
import core.internal.utf;
/**********************************************/
@@ -833,11 +833,9 @@ extern (C) hash_t _aaGetHash(scope const AA* paa, scope const TypeInfo tiRaw) no
size_t h;
foreach (b; aa.buckets)
{
- if (!b.filled)
- continue;
- size_t[2] h2 = [keyHash(b.entry), valHash(b.entry + off)];
// use addition here, so that hash is independent of element order
- h += hashOf(h2);
+ if (b.filled)
+ h += hashOf(valHash(b.entry + off), keyHash(b.entry));
}
return h;
@@ -538,7 +538,7 @@ private extern (C) int _d_run_main2(char[][] args, size_t totalArgsLength, MainF
return result;
}
-private void formatThrowable(Throwable t, scope void delegate(const scope char[] s) nothrow sink)
+private void formatThrowable(Throwable t, scope void delegate(in char[] s) nothrow sink)
{
foreach (u; t)
{
@@ -667,7 +667,7 @@ extern (C) void _d_print_throwable(Throwable t)
}
}
- void sink(const scope char[] buf) scope nothrow
+ void sink(in char[] buf) scope nothrow
{
fprintf(stderr, "%.*s", cast(int)buf.length, buf.ptr);
}
new file mode 100644
@@ -0,0 +1,19 @@
+/*******************************************/
+// https://issues.dlang.org/show_bug.cgi?id=22336
+
+import core.lifetime;
+
+struct Foo {
+ int f = -1;
+ @disable this(this);
+ this(int x) { f = x; }
+ @disable this();
+}
+
+extern(C) int main() {
+ Foo a = Foo(42);
+ Foo b = move(a);
+ assert(a.f == -1);
+ assert(b.f == 42);
+ return 0;
+}
@@ -426,6 +426,18 @@ void testShared()
import core.atomic : atomicLoad;
static assert( __traits(compiles, atomicLoad(s1)));
static assert(!__traits(compiles, atomicLoad(b1)));
+
+ static struct Fail
+ {
+ int value;
+
+ @safe pure nothrow @nogc:
+ bool opCast () shared const scope { return true; }
+ }
+
+ shared Fail fail = { value: 1 };
+ assert(_d_assert_fail!(shared Fail)("==", fail) == "Fail(1) != true");
+ assert(_d_assert_fail!(shared Fail)("==", fail, fail) == "Fail(1) != Fail(1)");
}
void testException()