Remove the sys package

This commit is contained in:
Eugen Wissner 2021-03-12 08:48:35 +01:00
parent f27f62b80a
commit 0fcc83d00e
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0
30 changed files with 44 additions and 1450 deletions

View File

@ -1,14 +0,0 @@
rule gas
command = gcc -c $in -o $out
rule archive
command = ar rcs $out $in
build abs.o: gas x64/linux/math/abs.S
build log.o: gas x64/linux/math/log.S
build equal.o: gas x64/linux/memory/equal.S
build fill.o: gas x64/linux/memory/fill.S
build copy.o: gas x64/linux/memory/copy.S
build syscall.o: gas x64/linux/syscall.S
build tanya.a: archive syscall.o copy.o fill.o equal.o log.o abs.o

View File

@ -1,8 +0,0 @@
.text
.globl thrd_current
.type thrd_current, @function
thrd_current:
mov %fs:0, %rax
ret

View File

@ -1,35 +0,0 @@
.text
// fabsf.
.globl _D5tanya4math8nbtheory4fabsFNaNbNiNffZf
.type _D5tanya4math8nbtheory4fabsFNaNbNiNffZf, @function
_D5tanya4math8nbtheory4fabsFNaNbNiNffZf:
mov $0x7fffffff, %eax
movq %rax, %xmm1
andpd %xmm1, %xmm0
ret
// fabs.
.globl _D5tanya4math8nbtheory4fabsFNaNbNiNfdZd
.type _D5tanya4math8nbtheory4fabsFNaNbNiNfdZd, @function
_D5tanya4math8nbtheory4fabsFNaNbNiNfdZd:
mov $0x7fffffffffffffff, %rax
movq %rax, %xmm1
andpd %xmm1, %xmm0
ret
// fabsl.
.globl _D5tanya4math8nbtheory4fabsFNaNbNiNfeZe
.type _D5tanya4math8nbtheory4fabsFNaNbNiNfeZe, @function
// Load the parameter from the stack onto FP stack, execute 'fabs' instruction
// The result is returned in ST0.
_D5tanya4math8nbtheory4fabsFNaNbNiNfeZe:
fldt 0x8(%rsp)
fabs
ret

View File

@ -1,48 +0,0 @@
.text
// logf.
.globl _D5tanya4math8nbtheory4logfFNaNbNiNffZf
.type _D5tanya4math8nbtheory4logfFNaNbNiNffZf, @function
_D5tanya4math8nbtheory4logfFNaNbNiNffZf:
movss %xmm0, -4(%rsp) // Put the argument onto the stack
fldln2 // Put lb(e) onto the FPU stack
flds -4(%rsp) // Put a float onto the FPU stack
fyl2x // %st1 * lb(%st0)
// The result is on the FPU stack, but returned in %xmm0
fstps -4(%rsp)
movss -4(%rsp), %xmm0
ret
// log.
.globl _D5tanya4math8nbtheory3logFNaNbNiNfdZd
.type _D5tanya4math8nbtheory3logFNaNbNiNfdZd, @function
_D5tanya4math8nbtheory3logFNaNbNiNfdZd:
movsd %xmm0, -8(%rsp) // Put the argument onto the stack
fldln2 // Put lb(e) onto the FPU stack
fldl -8(%rsp) // Put a double onto the FPU stack
fyl2x // %st1 * lb(%st0)
// The result is on the FPU stack, but returned in %xmm0
fstpl -8(%rsp)
movsd -8(%rsp), %xmm0
ret
// logl.
.globl _D5tanya4math8nbtheory4loglFNaNbNiNfeZe
.type _D5tanya4math8nbtheory4loglFNaNbNiNfeZe, @function
_D5tanya4math8nbtheory4loglFNaNbNiNfeZe:
fldln2 // Put lb(e) onto the FPU stack
fldt 8(%rsp) // Put the argument onto the FPU stack
fyl2x // %st1 * lb(%st0)
ret

View File

@ -1,67 +0,0 @@
.text
/*
* copyMemory.
*
* rdi - source length
* rsi - source data.
* rdx - target length.
* rcx - target data.
*/
.globl _D5tanya6memory2op10copyMemoryFNaNbNixAvAvZv
.type _D5tanya6memory2op10copyMemoryFNaNbNixAvAvZv, @function
_D5tanya6memory2op10copyMemoryFNaNbNixAvAvZv:
mov %rdi, %rdx
mov %rcx, %rdi
cmp $0x08, %rdx
jc aligned_1
test $0x07, %edi
jz aligned_8
naligned:
movsb
dec %rdx
test $0x07, %edi
jnz naligned
aligned_8:
mov %rdx, %rcx
shr $0x03, %rcx
rep movsq
and $0x07, %edx
jz end
aligned_1:
// Write the remaining bytes
mov %rdx, %rcx
rep movsb
end:
ret
/*
* moveMemory.
*
* rdi - source length
* rsi - source data.
* rdx - target length.
* rcx - target data.
*/
.globl _D5tanya6memory2op10moveMemoryFNaNbNixAvAvZv
.type _D5tanya6memory2op10moveMemoryFNaNbNixAvAvZv, @function
_D5tanya6memory2op10moveMemoryFNaNbNixAvAvZv:
mov %rdi, %rdx
lea -1(%rdx, %rsi), %rsi
lea -1(%rdx, %rcx), %rdi
mov %rdx, %rcx
std // Set the direction flag
rep movsb
cld // Clear the direction flag
ret

View File

@ -1,59 +0,0 @@
.text
/*
* equalMemory.
*
* rdi - r1 length
* rsi - r1 data.
* rdx - r2 length.
* rcx - r2 data.
*/
.globl _D5tanya6memory2op11equalMemoryFNaNbNixAvxQdZb
.type _D5tanya6memory2op11equalMemoryFNaNbNixAvxQdZb, @function
_D5tanya6memory2op11equalMemoryFNaNbNixAvxQdZb:
// Compare the lengths
cmp %rdx, %rdi
jne not_equal
mov %rcx, %rdi
// Check if we're aligned
cmp $0x08, %rdx
jc aligned_1
test $0x07, %edi
jz aligned_8
naligned:
cmpsb
jne not_equal
dec %rdx
test $0x07, %edi
jnz naligned
aligned_8:
mov %rdx, %rcx
shr $0x03, %rcx
repe cmpsq
jne not_equal
and $0x07, %edx
jz equal
aligned_1: // Compare the remaining bytes
mov %rdx, %rcx
cmp $0x0, %rcx
repe cmpsb
jne not_equal
equal:
mov $0x01, %rax // Return 1
jmp end
not_equal:
xor %rax, %rax // Return 0
end:
ret

View File

@ -1,160 +0,0 @@
.text
/*
* fillMemory.
*
* rdi - length.
* rsi - pointer.
* rdx - value filled with a byte.
*/
.globl _D5tanya6memory2op10fillMemoryFNaNbNiAvmZv
.type _D5tanya6memory2op10fillMemoryFNaNbNiAvmZv, @function
_D5tanya6memory2op10fillMemoryFNaNbNiAvmZv:
// Check for zero length
test %rdi, %rdi
jz end
mov %rdi, %rax
mov %rsi, %r8
movq %rdx, %xmm0
movlhps %xmm0, %xmm0
// Check if the pointer is aligned to a 16-byte boundary
and $-0x10, %r8
// Compute the number of misaligned bytes
mov %rsi, %r9
sub %r8, %r9
test %r9, %r9
jz aligned
// Get the number of bytes to be written until we are aligned
mov $0x10, %rcx
sub %r9, %rcx
mov %rsi, %r8
// If the length is less than the number of misaligned bytes,
// write one byte at a time and exit
cmp %rax, %rcx
jg aligned_1
naligned:
mov %dl, (%r8) // Write a byte
// Advance the pointer. Decrease the total number of bytes
// and the misaligned ones
inc %r8
dec %rcx
dec %rax
// Checks if we are aligned
test %rcx, %rcx
jnz naligned
aligned:
// Checks if we're done writing bytes
test %rax, %rax
jz end
// Write 1 byte at a time
cmp $8, %rax
jl aligned_1
// Write 8 bytes at a time
cmp $16, %rax
jl aligned_8
// Write 16 bytes at a time
cmp $32, %rax
jl aligned_16
// Write 32 bytes at a time
cmp $64, %rax
jl aligned_32
aligned_64:
movdqa %xmm0, (%r8)
movdqa %xmm0, 16(%r8)
movdqa %xmm0, 32(%r8)
movdqa %xmm0, 48(%r8)
add $64, %r8
sub $64, %rax
cmp $64, %rax
jge aligned_64
// Checks if we're done writing bytes
test %rax, %rax
jz end
// Write 1 byte at a time
cmp $8, %rax
jl aligned_1
// Write 8 bytes at a time
cmp $16, %rax
jl aligned_8
// Write 16 bytes at a time
cmp $32, %rax
jl aligned_16
aligned_32:
movdqa %xmm0, (%r8)
movdqa %xmm0, 16(%r8)
add $32, %r8
sub $32, %rax
// Checks if we're done writing bytes
test %rax, %rax
jz end
// Write 1 byte at a time
cmp $8, %rax
jl aligned_1
// Write 8 bytes at a time
cmp $16, %rax
jl aligned_8
aligned_16:
movdqa %xmm0, (%r8)
add $16, %r8
sub $16, %rax
// Checks if we're done writing bytes
test %rax, %rax
jz end
// Write 1 byte at a time
cmp $8, %rax
jl aligned_1
aligned_8:
mov %rdx, (%r8)
add $8, %r8
sub $8, %rax
// Checks if we're done writing bytes
test %rax, %rax
jz end
aligned_1:
mov %dl, (%r8)
inc %r8
dec %rax
test %rax, %rax
jnz aligned_1
end:
ret

View File

@ -1,65 +0,0 @@
/*
The kernel uses the following registers:
%rdi, %rsi, %rdx, %r8, %r9, %r10
The number of the syscall is passed in %rax.
A syscall clobbers:
%rax, %rcx, %r11
The returned value is placed in %rax.
*/
.text
// 1 parameter.
.globl _D5tanya3sys5linux7syscallQiFNbNillZl
.type _D5tanya3sys5linux7syscallQiFNbNillZl, @function
_D5tanya3sys5linux7syscallQiFNbNillZl:
movq %rsi, %rax // Syscall number.
syscall
ret
// 2 parameters.
.globl _D5tanya3sys5linux7syscallQiFNbNilllZl
.type _D5tanya3sys5linux7syscallQiFNbNilllZl, @function
_D5tanya3sys5linux7syscallQiFNbNilllZl:
movq %rdx, %rax
syscall
ret
// 3 parameters.
.globl _D5tanya3sys5linux7syscallQiFNbNillllZl
.type _D5tanya3sys5linux7syscallQiFNbNillllZl, @function
_D5tanya3sys5linux7syscallQiFNbNillllZl:
movq %rcx, %rax
syscall
ret
// 6 parameters.
.globl _D5tanya3sys5linux7syscallQiFNbNilllllllZl
.type _D5tanya3sys5linux7syscallQiFNbNilllllllZl, @function
_D5tanya3sys5linux7syscallQiFNbNilllllllZl:
pushq %rbp
movq %rsp, %rbp
movq 16(%rbp), %rax
mov %rcx, %r10
syscall
leave
ret

View File

@ -11,7 +11,6 @@
"dependencies": {
"tanya:meta": "*",
"tanya:sys": "*",
"tanya:os": "*",
"tanya:encoding": "*",
"tanya:middle": "*",
@ -24,7 +23,6 @@
"subPackages": [
"./meta",
"./sys",
"./os",
"./encoding",
"./middle",
@ -45,9 +43,7 @@
{
"name": "native",
"targetType": "library",
"platforms": ["linux-x86_64-gdc"],
"preBuildCommands": ["ninja -C arch"],
"lflags": ["arch/tanya.a"],
"platforms": ["linux-x86_64"],
"versions": ["TanyaNative"]
},
{
@ -64,9 +60,7 @@
},
{
"name": "unittest-native",
"platforms": ["linux-x86_64-gdc"],
"preBuildCommands": ["ninja -C arch"],
"lflags": ["arch/tanya.a"],
"platforms": ["linux-x86_64"],
"versions": ["TanyaNative"],
"importPaths": [
"./source",

View File

@ -5,8 +5,7 @@
"dependencies": {
"tanya:meta": "*",
"tanya:os": "*",
"tanya:sys": "*"
"tanya:os": "*"
},
"dependencies-linux": {

BIN
middle/middle-test-library Executable file

Binary file not shown.

View File

@ -15,11 +15,6 @@
*/
module tanya.memory.mallocator;
version (TanyaNative)
{
}
else:
import core.stdc.stdlib;
import tanya.memory.allocator;

View File

@ -14,32 +14,18 @@
*/
module tanya.memory.mmappool;
version (TanyaNative):
import mir.linux._asm.unistd;
import core.sys.linux.sys.mman;
import tanya.memory.allocator;
import tanya.memory.op;
import tanya.os.error;
import tanya.sys.linux.syscall;
import tanya.sys.posix.mman;
private void* mapMemory(const size_t length) @nogc nothrow pure @system
{
auto p = syscall_(0,
length,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS,
-1,
0,
NR_mmap);
return p == -ErrorCode.noMemory ? null : cast(void*) p;
}
extern(C) pragma(mangle, "mmap")
private void* mapMemory(void *addr, size_t length, int prot, int flags, int fd, off_t offset)
@nogc nothrow pure @system;
private bool unmapMemory(shared void* addr, const size_t length)
@nogc nothrow pure @system
{
return syscall_(cast(ptrdiff_t) addr, length, NR_munmap) == 0;
}
extern(C) pragma(mangle, "munmap")
private bool unmapMemory(shared void* addr, size_t length)
@nogc nothrow pure @system;
/*
* This allocator allocates memory in regions (multiple of 64 KB for example).
@ -206,7 +192,7 @@ final class MmapPool : Allocator
{
block.region.next.prev = block.region.prev;
}
return unmapMemory(block.region, block.region.size);
return unmapMemory(block.region, block.region.size) == 0;
}
// Merge blocks if neigbours are free.
if (block.next !is null && block.next.free)
@ -394,9 +380,13 @@ final class MmapPool : Allocator
{
return null;
}
void* p = mapMemory(regionSize);
if (p is null)
void* p = mapMemory(null,
regionSize,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS,
-1,
0);
if (cast(ptrdiff_t) p == -1)
{
return null;
}
@ -506,10 +496,10 @@ final class MmapPool : Allocator
{
// allocate() check.
size_t tooMuchMemory = size_t.max
- MmapPool.alignment_
- BlockEntry.sizeof * 2
- RegionEntry.sizeof
- pageSize;
- MmapPool.alignment_
- MmapPool.BlockEntry.sizeof * 2
- MmapPool.RegionEntry.sizeof
- MmapPool.pageSize;
assert(MmapPool.instance.allocate(tooMuchMemory) is null);
assert(MmapPool.instance.allocate(size_t.max) is null);

View File

@ -14,23 +14,7 @@
*/
module tanya.memory.op;
version (TanyaNative)
{
extern private void fillMemory(void[], size_t) pure nothrow @system @nogc;
extern private void copyMemory(const void[], void[])
pure nothrow @system @nogc;
extern private void moveMemory(const void[], void[])
pure nothrow @system @nogc;
extern private bool equalMemory(const void[], const void[])
pure nothrow @system @nogc;
}
else
{
import core.stdc.string;
}
import core.stdc.string;
private enum alignMask = size_t.sizeof - 1;
@ -56,14 +40,7 @@ in (source.length <= target.length)
in (source.length == 0 || source.ptr !is null)
in (target.length == 0 || target.ptr !is null)
{
version (TanyaNative)
{
copyMemory(source, target);
}
else
{
memcpy(target.ptr, source.ptr, source.length);
}
memcpy(target.ptr, source.ptr, source.length);
}
///
@ -100,14 +77,7 @@ private template filledBytes(ubyte Byte, ubyte I = 0)
void fill(ubyte c = 0)(void[] memory) @trusted
in (memory.length == 0 || memory.ptr !is null)
{
version (TanyaNative)
{
fillMemory(memory, filledBytes!c);
}
else
{
memset(memory.ptr, c, memory.length);
}
memset(memory.ptr, c, memory.length);
}
///
@ -148,14 +118,7 @@ in (source.length <= target.length)
in (source.length == 0 || source.ptr !is null)
in (target.length == 0 || target.ptr !is null)
{
version (TanyaNative)
{
moveMemory(source, target);
}
else
{
memmove(target.ptr, source.ptr, source.length);
}
memmove(target.ptr, source.ptr, source.length);
}
///
@ -330,15 +293,7 @@ bool equal(const void[] r1, const void[] r2) @nogc nothrow pure @trusted
in (r1.length == 0 || r1.ptr !is null)
in (r2.length == 0 || r2.ptr !is null)
{
version (TanyaNative)
{
return equalMemory(r1, r2);
}
else
{
return r1.length == r2.length
&& memcmp(r1.ptr, r2.ptr, r1.length) == 0;
}
return r1.length == r2.length && memcmp(r1.ptr, r2.ptr, r1.length) == 0;
}
///

View File

@ -17,21 +17,8 @@ module tanya.math.nbtheory;
import tanya.meta.trait;
import tanya.meta.transform;
version (TanyaNative)
{
private extern float fabs(float) @nogc nothrow pure @safe;
private extern double fabs(double) @nogc nothrow pure @safe;
private extern real fabs(real) @nogc nothrow pure @safe;
private extern double log(double) @nogc nothrow pure @safe;
private extern float logf(float) @nogc nothrow pure @safe;
private extern real logl(real) @nogc nothrow pure @safe;
}
else
{
import core.math : fabs;
import std.math : log;
}
import core.math : fabs;
import std.math : log;
/**
* Calculates the absolute value of a number.
@ -90,46 +77,19 @@ if (isFloatingPoint!T)
static assert(is(typeof(r.abs) == real));
}
version (D_Ddoc)
/**
* Calculates natural logarithm of $(D_PARAM x).
*
* Params:
* T = Argument type.
* x = Argument.
*
* Returns: Natural logarithm of $(D_PARAM x).
*/
Unqual!T ln(T)(T x)
if (isFloatingPoint!T)
{
/**
* Calculates natural logarithm of $(D_PARAM x).
*
* Params:
* T = Argument type.
* x = Argument.
*
* Returns: Natural logarithm of $(D_PARAM x).
*/
Unqual!T ln(T)(T x)
if (isFloatingPoint!T);
}
else version (TanyaNative)
{
Unqual!T ln(T)(T x) @nogc nothrow pure @safe
if (isFloatingPoint!T)
{
static if (is(Unqual!T == float))
{
return logf(x);
}
else static if (is(Unqual!T == double))
{
return log(x);
}
else
{
return logl(x);
}
}
}
else
{
Unqual!T ln(T)(T x)
if (isFloatingPoint!T)
{
return log(x);
}
return log(x);
}
///

View File

@ -20,15 +20,7 @@ import tanya.meta.trait;
import tanya.meta.transform;
import tanya.range;
version (TanyaNative)
{
import mir.linux._asm.unistd;
import tanya.sys.linux.syscall;
import tanya.sys.posix.ioctl;
import tanya.sys.posix.net.if_;
import tanya.sys.posix.socket;
}
else version (Windows)
version (Windows)
{
import tanya.sys.windows.ifdef;
import tanya.sys.windows.iphlpapi;
@ -52,39 +44,7 @@ else version (Posix)
uint nameToIndex(R)(R name) @trusted
if (isInputRange!R && is(Unqual!(ElementType!R) == char) && hasLength!R)
{
version (TanyaNative)
{
if (name.length >= IF_NAMESIZE)
{
return 0;
}
ifreq ifreq_ = void;
copy(name, ifreq_.ifr_name[]);
ifreq_.ifr_name[name.length] = '\0';
auto socket = syscall(AF_INET,
SOCK_DGRAM | SOCK_CLOEXEC,
0,
NR_socket);
if (socket <= 0)
{
return 0;
}
scope (exit)
{
syscall(socket, NR_close);
}
if (syscall(socket,
SIOCGIFINDEX,
cast(ptrdiff_t) &ifreq_,
NR_ioctl) == 0)
{
return ifreq_.ifr_ifindex;
}
return 0;
}
else version (Windows)
version (Windows)
{
if (name.length > IF_MAX_STRING_SIZE)
{
@ -155,33 +115,7 @@ String indexToName(uint index) @nogc nothrow @trusted
{
import tanya.memory.op : findNullTerminated;
version (TanyaNative)
{
ifreq ifreq_ = void;
ifreq_.ifr_ifindex = index;
auto socket = syscall(AF_INET,
SOCK_DGRAM | SOCK_CLOEXEC,
0,
NR_socket);
if (socket <= 0)
{
return String();
}
scope (exit)
{
syscall(socket, NR_close);
}
if (syscall(socket,
SIOCGIFNAME,
cast(ptrdiff_t) &ifreq_,
NR_ioctl) == 0)
{
return String(findNullTerminated(ifreq_.ifr_name));
}
return String();
}
else version (Windows)
version (Windows)
{
NET_LUID luid;
if (ConvertInterfaceIndexToLuid(index, &luid) != 0)

View File

@ -1,13 +0,0 @@
{
"name": "sys",
"description": "Low-level operating system bindings and definitions",
"targetType": "library",
"sourcePaths": [
"."
],
"importPaths": [
"."
],
"dflags-dmd": ["-dip1000"]
}

View File

@ -1,59 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Copyright: Eugene Wissner 2018-2020.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.sys.linux.syscall;
version (TanyaNative):
extern ptrdiff_t syscall(ptrdiff_t, ptrdiff_t)
@nogc nothrow @system;
extern ptrdiff_t syscall(ptrdiff_t, ptrdiff_t, ptrdiff_t)
@nogc nothrow @system;
extern ptrdiff_t syscall(ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t)
@nogc nothrow @system;
extern ptrdiff_t syscall(ptrdiff_t,
ptrdiff_t,
ptrdiff_t,
ptrdiff_t,
ptrdiff_t,
ptrdiff_t,
ptrdiff_t) @nogc nothrow @system;
// Same syscalls as above but pure.
private template getOverloadMangling(size_t n)
{
enum string getOverloadMangling = __traits(getOverloads,
tanya.sys.linux.syscall,
"syscall")[n].mangleof;
}
pragma(mangle, getOverloadMangling!0)
extern ptrdiff_t syscall_(ptrdiff_t, ptrdiff_t)
@nogc nothrow pure @system;
pragma(mangle, getOverloadMangling!1)
extern ptrdiff_t syscall_(ptrdiff_t, ptrdiff_t, ptrdiff_t)
@nogc nothrow pure @system;
pragma(mangle, getOverloadMangling!2)
extern ptrdiff_t syscall_(ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t)
@nogc nothrow pure @system;
pragma(mangle, getOverloadMangling!3)
extern ptrdiff_t syscall_(ptrdiff_t,
ptrdiff_t,
ptrdiff_t,
ptrdiff_t,
ptrdiff_t,
ptrdiff_t,
ptrdiff_t) @nogc nothrow pure @system;

View File

@ -1,76 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Copyright: Eugene Wissner 2018-2020.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.sys.posix.ioctl;
version (TanyaNative):
enum
{
SIOCADDRT = 0x890B, // Add routing table entry.
SIOCDELRT = 0x890C, // Delete routing table entry.
SIOCRTMSG = 0x890D, // Call to routing system.
SIOCGIFNAME = 0x8910, // Get iface name.
SIOCSIFLINK = 0x8911, // Set iface channel.
SIOCGIFCONF = 0x8912, // Get iface list.
SIOCGIFFLAGS = 0x8913, // Get flags.
SIOCSIFFLAGS = 0x8914, // Set flags.
SIOCGIFADDR = 0x8915, // Get PA address.
SIOCSIFADDR = 0x8916, // Set PA address.
SIOCGIFDSTADDR = 0x8917, // Get remote PA address.
SIOCSIFDSTADDR = 0x8918, // Set remote PA address.
SIOCGIFBRDADDR = 0x8919, // Get broadcast PA address.
SIOCSIFBRDADDR = 0x891a, // Set broadcast PA address.
SIOCGIFNETMASK = 0x891b, // Get network PA mask.
SIOCSIFNETMASK = 0x891c, // Set network PA mask.
SIOCGIFMETRIC = 0x891d, // Get metric.
SIOCSIFMETRIC = 0x891e, // Set metric.
SIOCGIFMEM = 0x891f, // Get memory address (BSD).
SIOCSIFMEM = 0x8920, // Set memory address (BSD).
SIOCGIFMTU = 0x8921, // Get MTU size.
SIOCSIFMTU = 0x8922, // Set MTU size.
SIOCSIFNAME = 0x8923, // Set interface name.
SIOCSIFHWADDR = 0x8924, // Set hardware address.
SIOCGIFENCAP = 0x8925, // Get/set encapsulations.
SIOCSIFENCAP = 0x8926,
SIOCGIFHWADDR = 0x8927, // Get hardware address.
SIOCGIFSLAVE = 0x8929, // Driver slaving support.
SIOCSIFSLAVE = 0x8930,
SIOCADDMULTI = 0x8931, // Multicast address lists.
SIOCDELMULTI = 0x8932,
SIOCGIFINDEX = 0x8933, // Name -> if_index mapping.
SIOGIFINDEX = SIOCGIFINDEX, // Misprint compatibility.
SIOCSIFPFLAGS = 0x8934, // Set/get extended flags set.
SIOCGIFPFLAGS = 0x8935,
SIOCDIFADDR = 0x8936, // Delete PA address.
SIOCSIFHWBROADCAST = 0x8937, // Set hardware broadcast address.
SIOCGIFCOUNT = 0x8938, // Get number of devices.
SIOCGIFBR = 0x8940, // Bridging support.
SIOCSIFBR = 0x8941, // Set bridging options.
SIOCGIFTXQLEN = 0x8942, // Get the tx queue length.
SIOCSIFTXQLEN = 0x8943, // Set the tx queue length.
SIOCDARP = 0x8953, // Delete ARP table entry.
SIOCGARP = 0x8954, // Get ARP table entry.
SIOCSARP = 0x8955, // Set ARP table entry.
SIOCDRARP = 0x8960, // Delete RARP table entry.
SIOCGRARP = 0x8961, // Get RARP table entry.
SIOCSRARP = 0x8962, // Set RARP table entry.
SIOCGIFMAP = 0x8970, // Get device parameters.
SIOCSIFMAP = 0x8971, // Set device parameters.
SIOCADDDLCI = 0x8980, // Create new DLCI device.
SIOCDELDLCI = 0x8981, // Delete DLCI device.
}

View File

@ -1,29 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Copyright: Eugene Wissner 2018-2020.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.sys.posix.mman;
version (TanyaNative):
enum
{
PROT_EXEC = 0x4, // Page can be executed.
PROT_NONE = 0x0, // Page cannot be accessed.
PROT_READ = 0x1, // Page can be read.
PROT_WRITE = 0x2, // Page can be written.
}
enum
{
MAP_FIXED = 0x10, // Interpret addr exactly.
MAP_PRIVATE = 0x02, // Changes are private.
MAP_SHARED = 0x01, // Share changes.
MAP_ANONYMOUS = 0x20, // Don't use a file.
}

View File

@ -1,25 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Copyright: Eugene Wissner 2018-2020.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.sys.posix.net.if_;
version (TanyaNative):
enum size_t IF_NAMESIZE = 16;
struct ifreq
{
char[IF_NAMESIZE] ifr_name;
union
{
int ifr_ifindex;
}
}

View File

@ -1,150 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Copyright: Eugene Wissner 2018-2020.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.sys.posix.socket;
version (TanyaNative):
/*
* Protocol families.
*/
enum
{
PF_UNSPEC = 0, // Unspecified.
PF_LOCAL = 1, // Local to host (pipes and file-domain).
PF_UNIX = PF_LOCAL, // POSIX name for PF_LOCAL.
PF_FILE = PF_LOCAL, // Another non-standard name for PF_LOCAL.
PF_INET = 2, // IP protocol family.
PF_AX25 = 3, // Amateur Radio AX.25.
PF_IPX = 4, // Novell Internet Protocol.
PF_APPLETALK = 5, // Appletalk DDP.
PF_NETROM = 6, // Amateur radio NetROM.
PF_BRIDGE = 7, // Multiprotocol bridge.
PF_ATMPVC = 8, // ATM PVCs.
PF_X25 = 9, // Reserved for X.25 project.
PF_INET6 = 10, // IP version 6.
PF_ROSE = 11, // Amateur Radio X.25 PLP.
PF_DECnet = 12, // Reserved for DECnet project.
PF_NETBEUI = 13, // Reserved for 802.2LLC project.
PF_SECURITY = 14, // Security callback pseudo AF.
PF_KEY = 15, // PF_KEY key management API.
PF_NETLINK = 16, // Kernel user interface device.
PF_ROUTE = PF_NETLINK, // Alias to emulate 4.4BSD.
PF_PACKET = 17, // Packet family.
PF_ASH = 18, // Ash.
PF_ECONET = 19, // Acorn Econet.
PF_ATMSVC = 20, // ATM SVCs.
PF_RDS = 21, // RDS sockets.
PF_SNA = 22, // Linux SNA Project.
PF_IRDA = 23, // IRDA sockets.
PF_PPPOX = 24, // PPPoX sockets.
PF_WANPIPE = 25, // Wanpipe API sockets.
PF_LLC = 26, // Linux LLC.
PF_IB = 27, // Native InfiniBand address.
PF_MPLS = 28, // MPLS.
PF_CAN = 29, // Controller Area Network.
PF_TIPC = 30, // TIPC sockets.
PF_BLUETOOTH = 31, // Bluetooth sockets.
PF_IUCV = 32, // IUCV sockets.
PF_RXRPC = 33, // RxRPC sockets.
PF_ISDN = 34, // mISDN sockets.
PF_PHONET = 35, // Phonet sockets.
PF_IEEE802154 = 36, // IEEE 802.15.4 sockets.
PF_CAIF = 37, // CAIF sockets.
PF_ALG = 38, // Algorithm sockets.
PF_NFC = 39, // NFC sockets.
PF_VSOCK = 40, // vSockets.
PF_MAX = 41, // For now.
}
/*
* Address families.
*/
enum
{
AF_UNSPEC = PF_UNSPEC,
AF_LOCAL = PF_LOCAL,
AF_UNIX = PF_UNIX,
AF_FILE = PF_FILE,
AF_INET = PF_INET,
AF_AX25 = PF_AX25,
AF_IPX = PF_IPX,
AF_APPLETALK = PF_APPLETALK,
AF_NETROM = PF_NETROM,
AF_BRIDGE = PF_BRIDGE,
AF_ATMPVC = PF_ATMPVC,
AF_X25 = PF_X25,
AF_INET6 = PF_INET6,
AF_ROSE = PF_ROSE,
AF_DECnet = PF_DECnet,
AF_NETBEUI = PF_NETBEUI,
AF_SECURITY = PF_SECURITY,
AF_KEY = PF_KEY,
AF_NETLINK = PF_NETLINK,
AF_ROUTE = PF_ROUTE,
AF_PACKET = PF_PACKET,
AF_ASH = PF_ASH,
AF_ECONET = PF_ECONET,
AF_ATMSVC = PF_ATMSVC,
AF_RDS = PF_RDS,
AF_SNA = PF_SNA,
AF_IRDA = PF_IRDA,
AF_PPPOX = PF_PPPOX,
AF_WANPIPE = PF_WANPIPE,
AF_LLC = PF_LLC,
AF_IB = PF_IB,
AF_MPLS = PF_MPLS,
AF_CAN = PF_CAN,
AF_TIPC = PF_TIPC,
AF_BLUETOOTH = PF_BLUETOOTH,
AF_IUCV = PF_IUCV,
AF_RXRPC = PF_RXRPC,
AF_ISDN = PF_ISDN,
AF_PHONET = PF_PHONET,
AF_IEEE802154 = PF_IEEE802154,
AF_CAIF = PF_CAIF,
AF_ALG = PF_ALG,
AF_NFC = PF_NFC,
AF_VSOCK = PF_VSOCK,
AF_MAX = PF_MAX,
}
/*
* Types of sockets.
*/
enum
{
// Sequenced, reliable, connection-based byte streams.
SOCK_STREAM = 1,
// Connectionless, unreliable datagrams of fixed maximum length.
SOCK_DGRAM = 2,
// Raw protocol interface.
SOCK_RAW = 3,
// Reliably-delivered messages.
SOCK_RDM = 4,
// Sequenced, reliable, connection-based, datagrams of fixed maximum
// length.
SOCK_SEQPACKET = 5,
// Datagram Congestion Control Protocol.
SOCK_DCCP = 6,
// Linux specific way of getting packets at the dev level. For writing rarp
// and other similar things on the user level.
SOCK_PACKET = 10,
}
/*
* Flags to be ORed into the type parameter of socket and socketpair and used
* for the flags parameter of paccept.
*/
enum
{
SOCK_CLOEXEC = 0x80000, // Atomically set close-on-exec flag for the new descriptor(s).
SOCK_NONBLOCK = 0x800, // Atomically mark descriptor(s) as non-blocking.
}

View File

@ -1,64 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Base type definitions and aliases.
*
* This module doesn't provide aliases for all types used by Windows, but only
* for types that can vary on different platforms. For example there is no
* need to define `INT32` alias for D, since $(D_KEYWORD int) is always a
* 32-bit signed integer. But `int` and its Windows alias `INT` is not the
* same on all platforms in C, so its size can be something differen than
* 32 bit, therefore an $(D_PSYMBOL INT) alias is available in this module.
* $(D_PARAM TCHAR) can be a $(D_KEYWORD char) if Unicode isn't supported or
* $(D_KEYWORD wchar) if Unicode is supported, so $(D_PSYMBOL TCHAR) is
* defined here.
* Also aliases for specific types like $(D_PSYMBOL SOCKET) are defined here.
*
* Copyright: Eugene Wissner 2017-2020.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.sys.windows.def;
version (Windows):
alias BYTE = ubyte;
alias TBYTE = wchar; // If Unicode, otherwise char.
alias CHAR = char; // Signed or unsigned char.
alias WCHAR = wchar;
alias TCHAR = wchar; // If Unicode, otherwise char.
alias SHORT = short;
alias USHORT = ushort;
alias WORD = ushort;
alias INT = int;
alias UINT = uint;
alias LONG = int;
alias ULONG = uint;
alias DWORD = uint;
alias LONGLONG = long; // Or double.
alias ULONGLONG = ulong; // Or double.
alias DWORDLONG = ulong;
alias FLOAT = float;
alias BOOL = int;
alias BOOLEAN = BYTE;
alias HANDLE = void*;
enum HANDLE INVALID_HANDLE_VALUE = cast(HANDLE) -1;
enum TRUE = 1;
enum FALSE = 0;
alias PSTR = CHAR*;
alias PWSTR = WCHAR*;
alias PTSTR = TCHAR*;
align(1) struct GUID
{
uint Data1;
ushort Data2;
ushort Data3;
char[8] Data4;
}

View File

@ -1,28 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Copyright: Eugene Wissner 2018-2020.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.sys.windows.ifdef;
version (Windows):
import tanya.sys.windows.def;
union NET_LUID_LH
{
ulong Value;
ulong Info;
}
alias NET_LUID = NET_LUID_LH;
alias IF_LUID = NET_LUID_LH;
alias NET_IFINDEX = ULONG;
enum size_t IF_MAX_STRING_SIZE = 256;

View File

@ -1,37 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Copyright: Eugene Wissner 2018-2020.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.sys.windows.iphlpapi;
version (Windows):
import tanya.sys.windows.def;
import tanya.sys.windows.ifdef;
extern(Windows)
DWORD ConvertInterfaceNameToLuidA(const(CHAR)* InterfaceName,
NET_LUID* InterfaceLuid)
@nogc nothrow @system;
extern(Windows)
DWORD ConvertInterfaceLuidToIndex(const(NET_LUID)* InterfaceLuid,
NET_IFINDEX* InterfaceIndex)
@nogc nothrow @system;
extern(Windows)
DWORD ConvertInterfaceIndexToLuid(NET_IFINDEX InterfaceIndex,
NET_LUID* InterfaceLuid)
@nogc nothrow @system;
extern(Windows)
DWORD ConvertInterfaceLuidToNameA(const(NET_LUID)* InterfaceLuid,
PSTR InterfaceName,
size_t Length)
@nogc nothrow @system;

View File

@ -1,19 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Copyright: Eugene Wissner 2017-2020.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.sys.windows;
version (Windows):
public import tanya.sys.windows.def;
public import tanya.sys.windows.ifdef;
public import tanya.sys.windows.iphlpapi;
public import tanya.sys.windows.winbase;
public import tanya.sys.windows.winsock2;

View File

@ -1,53 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Definitions from winbase.h.
*
* Copyright: Eugene Wissner 2017-2020.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.sys.windows.winbase;
version (Windows):
public import tanya.sys.windows.def;
struct OVERLAPPED
{
size_t Internal;
size_t InternalHigh;
union
{
struct
{
DWORD Offset;
DWORD OffsetHigh;
}
void* Pointer;
}
HANDLE hEvent;
}
extern(Windows)
HANDLE CreateIoCompletionPort(HANDLE FileHandle,
HANDLE ExistingCompletionPort,
size_t CompletionKey,
DWORD NumberOfConcurrentThreads)
nothrow @system @nogc;
extern(Windows)
BOOL GetQueuedCompletionStatus(HANDLE CompletionPort,
DWORD* lpNumberOfBytes,
size_t* lpCompletionKey,
OVERLAPPED** lpOverlapped,
DWORD dwMilliseconds) nothrow @system @nogc;
extern(Windows)
BOOL GetOverlappedResult(HANDLE hFile,
OVERLAPPED* lpOverlapped,
DWORD* lpNumberOfBytesTransferred,
BOOL bWait) nothrow @system @nogc;

View File

@ -1,217 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Definitions from winsock2.h, ws2def.h and MSWSock.h.
*
* Copyright: Eugene Wissner 2017-2020.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.sys.windows.winsock2;
version (Windows):
public import tanya.sys.windows.def;
public import tanya.sys.windows.winbase;
alias SOCKET = size_t;
enum SOCKET INVALID_SOCKET = ~0;
enum SOCKET_ERROR = -1;
enum
{
IOC_UNIX = 0x00000000,
IOC_WS2 = 0x08000000,
IOC_PROTOCOL = 0x10000000,
IOC_VOID = 0x20000000, // No parameters.
IOC_OUT = 0x40000000, // Copy parameters back.
IOC_IN = 0x80000000, // Copy parameters into.
IOC_VENDOR = 0x18000000,
IOC_WSK = (IOC_WS2 | 0x07000000), // _WIN32_WINNT >= 0x0600.
IOC_INOUT = (IOC_IN | IOC_OUT), // Copy parameter into and get back.
}
template _WSAIO(int x, int y)
{
enum _WSAIO = IOC_VOID | x | y;
}
template _WSAIOR(int x, int y)
{
enum _WSAIOR = IOC_OUT | x | y;
}
template _WSAIOW(int x, int y)
{
enum _WSAIOW = IOC_IN | x | y;
}
template _WSAIORW(int x, int y)
{
enum _WSAIORW = IOC_INOUT | x | y;
}
alias SIO_ASSOCIATE_HANDLE = _WSAIOW!(IOC_WS2, 1);
alias SIO_ENABLE_CIRCULAR_QUEUEING = _WSAIO!(IOC_WS2, 2);
alias SIO_FIND_ROUTE = _WSAIOR!(IOC_WS2, 3);
alias SIO_FLUSH = _WSAIO!(IOC_WS2, 4);
alias SIO_GET_BROADCAST_ADDRESS = _WSAIOR!(IOC_WS2, 5);
alias SIO_GET_EXTENSION_FUNCTION_POINTER = _WSAIORW!(IOC_WS2, 6);
alias SIO_GET_QOS = _WSAIORW!(IOC_WS2, 7);
alias SIO_GET_GROUP_QOS = _WSAIORW!(IOC_WS2, 8);
alias SIO_MULTIPOINT_LOOPBACK = _WSAIOW!(IOC_WS2, 9);
alias SIO_MULTICAST_SCOPE = _WSAIOW!(IOC_WS2, 10);
alias SIO_SET_QOS = _WSAIOW!(IOC_WS2, 11);
alias SIO_SET_GROUP_QOS = _WSAIOW!(IOC_WS2, 12);
alias SIO_TRANSLATE_HANDLE = _WSAIORW!(IOC_WS2, 13);
alias SIO_ROUTING_INTERFACE_QUERY = _WSAIORW!(IOC_WS2, 20);
alias SIO_ROUTING_INTERFACE_CHANGE = _WSAIOW!(IOC_WS2, 21);
alias SIO_ADDRESS_LIST_QUERY = _WSAIOR!(IOC_WS2, 22);
alias SIO_ADDRESS_LIST_CHANGE = _WSAIO!(IOC_WS2, 23);
alias SIO_QUERY_TARGET_PNP_HANDLE = _WSAIOR!(IOC_WS2, 24);
alias SIO_NSP_NOTIFY_CHANGE = _WSAIOW!(IOC_WS2, 25);
alias GROUP = uint;
enum
{
WSA_FLAG_OVERLAPPED = 0x01,
WSA_FLAG_MULTIPOINT_C_ROOT = 0x02,
WSA_FLAG_MULTIPOINT_C_LEAF = 0x04,
WSA_FLAG_MULTIPOINT_D_ROOT = 0x08,
WSA_FLAG_MULTIPOINT_D_LEAF = 0x10,
WSA_FLAG_ACCESS_SYSTEM_SECURITY = 0x40,
WSA_FLAG_NO_HANDLE_INHERIT = 0x80,
WSA_FLAG_REGISTERED_IO = 0x100,
}
enum MAX_PROTOCOL_CHAIN = 7;
enum BASE_PROTOCOL = 1;
enum LAYERED_PROTOCOL = 0;
enum WSAPROTOCOL_LEN = 255;
struct WSAPROTOCOLCHAIN
{
int ChainLen;
DWORD[MAX_PROTOCOL_CHAIN] ChainEntries;
}
struct WSABUF
{
ULONG len;
CHAR* buf;
}
struct WSAPROTOCOL_INFO
{
DWORD dwServiceFlags1;
DWORD dwServiceFlags2;
DWORD dwServiceFlags3;
DWORD dwServiceFlags4;
DWORD dwProviderFlags;
GUID ProviderId;
DWORD dwCatalogEntryId;
WSAPROTOCOLCHAIN ProtocolChain;
int iVersion;
int iAddressFamily;
int iMaxSockAddr;
int iMinSockAddr;
int iSocketType;
int iProtocol;
int iProtocolMaxOffset;
int iNetworkByteOrder;
int iSecurityScheme;
DWORD dwMessageSize;
DWORD dwProviderReserved;
TCHAR[WSAPROTOCOL_LEN + 1] szProtocol;
}
const GUID WSAID_GETACCEPTEXSOCKADDRS = {
0xb5367df2, 0xcbac, 0x11cf,
[0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92],
};
const GUID WSAID_ACCEPTEX = {
0xb5367df1, 0xcbac, 0x11cf,
[0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92],
};
alias LPWSAOVERLAPPED_COMPLETION_ROUTINE = void function(DWORD dwError,
DWORD cbTransferred,
OVERLAPPED* lpOverlapped,
DWORD dwFlags) nothrow @nogc;
extern(Windows)
SOCKET WSASocket(int af,
int type,
int protocol,
WSAPROTOCOL_INFO* lpProtocolInfo,
GROUP g,
DWORD dwFlags) nothrow @system @nogc;
extern(Windows)
int WSARecv(SOCKET s,
WSABUF* lpBuffers,
DWORD dwBufferCount,
DWORD* lpNumberOfBytesRecvd,
DWORD* lpFlags,
OVERLAPPED* lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
nothrow @system @nogc;
extern(Windows)
int WSASend(SOCKET s,
WSABUF* lpBuffers,
DWORD dwBufferCount,
DWORD* lpNumberOfBytesRecvd,
DWORD lpFlags,
OVERLAPPED* lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
nothrow @system @nogc;
extern(Windows)
int WSAIoctl(SOCKET s,
uint dwIoControlCode,
void* lpvInBuffer,
uint cbInBuffer,
void* lpvOutBuffer,
uint cbOutBuffer,
uint* lpcbBytesReturned,
OVERLAPPED* lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
nothrow @system @nogc;
alias ADDRESS_FAMILY = USHORT;
struct SOCKADDR
{
ADDRESS_FAMILY sa_family; // Address family.
CHAR[14] sa_data; // Up to 14 bytes of direct address.
}
alias LPFN_GETACCEPTEXSOCKADDRS = void function(void*,
DWORD,
DWORD,
DWORD,
SOCKADDR**,
INT*,
SOCKADDR**,
INT*) nothrow @nogc;
alias LPFN_ACCEPTEX = extern(Windows) BOOL function(SOCKET,
SOCKET,
void*,
DWORD,
DWORD,
DWORD,
DWORD*,
OVERLAPPED*) @nogc nothrow;
enum
{
SO_MAXDG = 0x7009,
SO_MAXPATHDG = 0x700A,
SO_UPDATE_ACCEPT_CONTEXT = 0x700B,
SO_CONNECT_TIME = 0x700C,
SO_UPDATE_CONNECT_CONTEXT = 0x7010,
}

View File

@ -3,11 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
module tanya.memory.tests.mallocator;
version (TanyaNative)
{
}
else:
import tanya.memory.mallocator;
// Fails with false

View File

@ -3,8 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
module tanya.memory.tests.mmappool;
version (TanyaNative):
import tanya.memory.mmappool;
@nogc nothrow pure @system unittest