Fix FreeBSD build
This commit is contained in:
parent
200fff3714
commit
c966b42ac3
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
|||||||
# D
|
# D
|
||||||
.dub
|
.dub
|
||||||
__test__*__
|
__test__*__
|
||||||
|
__test__*__.core
|
||||||
|
52
README.md
52
README.md
@ -1,12 +1,17 @@
|
|||||||
# Tanya
|
# Tanya
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/caraus-ecms/tanya.svg?branch=master)](https://travis-ci.org/caraus-ecms/tanya)
|
[![Build Status](https://travis-ci.org/caraus-ecms/tanya.svg?branch=master)](https://travis-ci.org/caraus-ecms/tanya)
|
||||||
[![License](http://img.shields.io/badge/license-MPL2-blue.svg)](https://raw.githubusercontent.com/caraus-ecms/tanya/master/LICENSE)
|
[![Dub Version](https://img.shields.io/dub/v/tanya.svg)](https://code.dlang.org/packages/tanya)
|
||||||
|
[![License](https://img.shields.io/badge/license-MPL_2.0-blue.svg)](https://raw.githubusercontent.com/caraus-ecms/tanya/master/LICENSE)
|
||||||
|
|
||||||
Tanya is a general purpose library for D programming language that doesn't
|
Tanya is a general purpose library for D programming language that doesn't
|
||||||
rely on the Garbage Collector.
|
rely on the Garbage Collector.
|
||||||
|
|
||||||
The library is currently in development.
|
Its aim is to simplify the manual memory management in D and to provide a
|
||||||
|
guarantee with @nogc attribute that there are no hidden allocations on the
|
||||||
|
Garbage Collector heap. Everything in the library is usable in @nogc code.
|
||||||
|
Tanya extends Phobos functionality and provides alternative implementations for
|
||||||
|
data structures and utilities that depend on the Garbage Collector in Phobos.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
@ -18,3 +23,46 @@ Tanya consists of the following packages:
|
|||||||
* `math`: Multiple precision integer and a set of functions.
|
* `math`: Multiple precision integer and a set of functions.
|
||||||
* `memory`: Tools for manual memory management (allocator, reference counting, helper functions).
|
* `memory`: Tools for manual memory management (allocator, reference counting, helper functions).
|
||||||
* `network`: URL-Parsing, sockets.
|
* `network`: URL-Parsing, sockets.
|
||||||
|
|
||||||
|
### Current status
|
||||||
|
|
||||||
|
The library is currently under development, but some parts of it can already be
|
||||||
|
used.
|
||||||
|
|
||||||
|
Containers were newly reworked and the API won't change significantly, but will
|
||||||
|
be only extended. The same is true for the `memory` package.
|
||||||
|
|
||||||
|
`network` and `async` packages should be reviewed in the future and the API may
|
||||||
|
change.
|
||||||
|
|
||||||
|
`math` package contains an arbitrary precision integer implementation that has
|
||||||
|
a stable API (that mostly consists of operator overloads), but still needs
|
||||||
|
testing and work on its performance.
|
||||||
|
|
||||||
|
I'm currently mostly working on `crypto` that is not a complete cryptographic
|
||||||
|
suite, but contains (will contain) algorithm implementations required by TLS.
|
||||||
|
|
||||||
|
### Other properties
|
||||||
|
|
||||||
|
* Tanya is a native D library (only D and Assembler are tolerated).
|
||||||
|
|
||||||
|
* It is important for me to document the code and attach at least a few unit
|
||||||
|
tests where possible. So the documentation and usage examples can be found in
|
||||||
|
the source code.
|
||||||
|
|
||||||
|
* Tanya is mostly tested on a 64-bit Linux and some features are
|
||||||
|
platform-dependant, but not because it is a Linux-only library. Therefore any
|
||||||
|
help to bring better support for Windows and BSD systems would be accepted.
|
||||||
|
|
||||||
|
* The library isn't thread-safe. Thread-safity should be added later.
|
||||||
|
|
||||||
|
* I'm working with the latest dmd version, but will be looking to support other
|
||||||
|
D compilers and keep compatibility with the elder dmd versions in the future.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Since I'm mostly busy writing new code and implementing new features I would
|
||||||
|
appreciate, if anyone uses the library. It would help me to improve the
|
||||||
|
codebase and fix issues.
|
||||||
|
|
||||||
|
Feel free to contact me if you have any questions.
|
||||||
|
@ -6,44 +6,49 @@
|
|||||||
* Copyright: Eugene Wissner 2016.
|
* Copyright: Eugene Wissner 2016.
|
||||||
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
|
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
|
||||||
* Mozilla Public License, v. 2.0).
|
* Mozilla Public License, v. 2.0).
|
||||||
* Authors: $(LINK2 mailto:belka@caraus.de, Eugene Wissner)
|
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
|
||||||
*/
|
*/
|
||||||
module tanya.async.event.kqueue;
|
module tanya.async.event.kqueue;
|
||||||
|
|
||||||
version (OSX)
|
version (OSX)
|
||||||
{
|
{
|
||||||
version = MissingKevent;
|
version = MacBSD;
|
||||||
}
|
}
|
||||||
else version (iOS)
|
else version (iOS)
|
||||||
{
|
{
|
||||||
version = MissingKevent;
|
version = MacBSD;
|
||||||
}
|
}
|
||||||
else version (TVOS)
|
else version (TVOS)
|
||||||
{
|
{
|
||||||
version = MissingKevent;
|
version = MacBSD;
|
||||||
}
|
}
|
||||||
else version (WatchOS)
|
else version (WatchOS)
|
||||||
{
|
{
|
||||||
version = MissingKevent;
|
version = MacBSD;
|
||||||
|
}
|
||||||
|
else version (FreeBSD)
|
||||||
|
{
|
||||||
|
version = MacBSD;
|
||||||
}
|
}
|
||||||
else version (OpenBSD)
|
else version (OpenBSD)
|
||||||
{
|
{
|
||||||
version = MissingKevent;
|
version = MacBSD;
|
||||||
}
|
}
|
||||||
else version (DragonFlyBSD)
|
else version (DragonFlyBSD)
|
||||||
{
|
{
|
||||||
version = MissingKevent;
|
version = MacBSD;
|
||||||
}
|
}
|
||||||
|
|
||||||
version (MissingKevent)
|
version (MacBSD):
|
||||||
{
|
|
||||||
extern (C):
|
|
||||||
nothrow:
|
|
||||||
@nogc:
|
|
||||||
|
|
||||||
import core.stdc.stdint; // intptr_t, uintptr_t
|
import core.stdc.stdint; // intptr_t, uintptr_t
|
||||||
import core.sys.posix.time; // timespec
|
import core.sys.posix.time; // timespec
|
||||||
|
|
||||||
|
void EV_SET(kevent_t* kevp, typeof(kevent_t.tupleof) args) pure nothrow @nogc
|
||||||
|
{
|
||||||
|
*kevp = kevent_t(args);
|
||||||
|
}
|
||||||
|
|
||||||
enum : short
|
enum : short
|
||||||
{
|
{
|
||||||
EVFILT_READ = -1,
|
EVFILT_READ = -1,
|
||||||
@ -60,11 +65,6 @@ version (MissingKevent)
|
|||||||
EVFILT_SYSCOUNT = 11
|
EVFILT_SYSCOUNT = 11
|
||||||
}
|
}
|
||||||
|
|
||||||
extern(D) void EV_SET(kevent_t* kevp, typeof(kevent_t.tupleof) args)
|
|
||||||
{
|
|
||||||
*kevp = kevent_t(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct kevent_t
|
struct kevent_t
|
||||||
{
|
{
|
||||||
uintptr_t ident; /* identifier for this event */
|
uintptr_t ident; /* identifier for this event */
|
||||||
@ -97,35 +97,10 @@ version (MissingKevent)
|
|||||||
EV_ERROR = 0x4000, /* error, data contains errno */
|
EV_ERROR = 0x4000, /* error, data contains errno */
|
||||||
}
|
}
|
||||||
|
|
||||||
int kqueue();
|
extern(C) int kqueue() nothrow @nogc;
|
||||||
int kevent(int kq, const kevent_t *changelist, int nchanges,
|
extern(C) int kevent(int kq, const kevent_t *changelist, int nchanges,
|
||||||
kevent_t *eventlist, int nevents,
|
kevent_t *eventlist, int nevents, const timespec *timeout)
|
||||||
const timespec *timeout);
|
nothrow @nogc;
|
||||||
}
|
|
||||||
|
|
||||||
version (OSX)
|
|
||||||
{
|
|
||||||
version = MacBSD;
|
|
||||||
}
|
|
||||||
else version (iOS)
|
|
||||||
{
|
|
||||||
version = MacBSD;
|
|
||||||
}
|
|
||||||
else version (FreeBSD)
|
|
||||||
{
|
|
||||||
version = MacBSD;
|
|
||||||
public import core.sys.freebsd.sys.event;
|
|
||||||
}
|
|
||||||
else version (OpenBSD)
|
|
||||||
{
|
|
||||||
version = MacBSD;
|
|
||||||
}
|
|
||||||
else version (DragonFlyBSD)
|
|
||||||
{
|
|
||||||
version = MacBSD;
|
|
||||||
}
|
|
||||||
|
|
||||||
version (MacBSD):
|
|
||||||
|
|
||||||
import tanya.async.event.selector;
|
import tanya.async.event.selector;
|
||||||
import tanya.async.loop;
|
import tanya.async.loop;
|
||||||
@ -251,7 +226,7 @@ class KqueueLoop : SelectorLoop
|
|||||||
{
|
{
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
{
|
{
|
||||||
throw defaultAllocatorAllocator.make!BadLoopException();
|
throw defaultAllocator.make!BadLoopException();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -17,17 +17,17 @@
|
|||||||
* {
|
* {
|
||||||
* private DuplexTransport transport;
|
* private DuplexTransport transport;
|
||||||
*
|
*
|
||||||
* void received(ubyte[] data)
|
* void received(ubyte[] data) @nogc
|
||||||
* {
|
* {
|
||||||
* transport.write(data);
|
* transport.write(data);
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* void connected(DuplexTransport transport)
|
* void connected(DuplexTransport transport) @nogc
|
||||||
* {
|
* {
|
||||||
* this.transport = transport;
|
* this.transport = transport;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* void disconnected(SocketException e = null)
|
* void disconnected(SocketException e = null) @nogc
|
||||||
* {
|
* {
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
*/
|
*/
|
||||||
module tanya.math.random;
|
module tanya.math.random;
|
||||||
|
|
||||||
import std.experimental.allocator;
|
|
||||||
import std.digest.sha;
|
import std.digest.sha;
|
||||||
import std.typecons;
|
import std.typecons;
|
||||||
import tanya.memory;
|
import tanya.memory;
|
||||||
@ -167,7 +166,7 @@ class Entropy
|
|||||||
|
|
||||||
private ubyte sourceCount_;
|
private ubyte sourceCount_;
|
||||||
|
|
||||||
private IAllocator allocator;
|
private shared Allocator allocator;
|
||||||
|
|
||||||
/// Entropy accumulator.
|
/// Entropy accumulator.
|
||||||
protected SHA!(maxGather * 8, 512) accumulator;
|
protected SHA!(maxGather * 8, 512) accumulator;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user