forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
21
Kha/Tools/linux_arm64/std/eval/luv/Async.hx
Normal file
21
Kha/Tools/linux_arm64/std/eval/luv/Async.hx
Normal file
@ -0,0 +1,21 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Inter-loop communication.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Async
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:coreType abstract Async to Handle {
|
||||
/**
|
||||
Allocates and initializes an async handle.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function init(loop:Loop, callback:(async:Async)->Void):Result<Async>;
|
||||
|
||||
/**
|
||||
Triggers a call to the handle's callback by the handle's loop.
|
||||
**/
|
||||
public function send():Result<Result.NoData>;
|
||||
}
|
23
Kha/Tools/linux_arm64/std/eval/luv/Barrier.hx
Normal file
23
Kha/Tools/linux_arm64/std/eval/luv/Barrier.hx
Normal file
@ -0,0 +1,23 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Barriers.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Barrier
|
||||
**/
|
||||
@:coreType abstract Barrier {
|
||||
/**
|
||||
Allocates and initializes a barrier.
|
||||
**/
|
||||
static public function init(count:Int):Result<Barrier>;
|
||||
|
||||
/**
|
||||
Cleans up a barrier.
|
||||
**/
|
||||
public function destroy():Void;
|
||||
|
||||
/**
|
||||
Waits on a barrier.
|
||||
**/
|
||||
public function wait():Bool;
|
||||
}
|
120
Kha/Tools/linux_arm64/std/eval/luv/Buffer.hx
Normal file
120
Kha/Tools/linux_arm64/std/eval/luv/Buffer.hx
Normal file
@ -0,0 +1,120 @@
|
||||
package eval.luv;
|
||||
|
||||
import haxe.io.Bytes;
|
||||
|
||||
/**
|
||||
Data buffers.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Buffer
|
||||
**/
|
||||
@:coreType abstract Buffer {
|
||||
/**
|
||||
Allocates a fresh buffer of the given size.
|
||||
**/
|
||||
static public function create(size:Int):Buffer;
|
||||
|
||||
/**
|
||||
Creates a buffer from a string.
|
||||
**/
|
||||
@:from static public function fromNativeString(s:NativeString):Buffer;
|
||||
|
||||
/**
|
||||
Creates a buffer from a string.
|
||||
**/
|
||||
@:from static public function fromString(s:String):Buffer;
|
||||
|
||||
/**
|
||||
Creates a buffer from bytes.
|
||||
**/
|
||||
@:from static public function fromBytes(b:Bytes):Buffer;
|
||||
|
||||
/**
|
||||
Evaluates to the sum of the sizes of the buffers in the array.
|
||||
**/
|
||||
static public function totalSize(buffers:Array<Buffer>):Int;
|
||||
|
||||
/**
|
||||
`Buffer.drop(buffers, count)` drops the first `count` bytes from `buffers`.
|
||||
|
||||
For example, if `buffers` contains two buffers of size 16, `Buffer.drop(buffers, 18)`
|
||||
will evaluate to an array that has lost the reference to the first buffer,
|
||||
and contains only a view into the second buffer of size 14.
|
||||
**/
|
||||
static public function drop(buffers:Array<Buffer>, count:Int):Array<Buffer>;
|
||||
|
||||
/**
|
||||
Evaluates to the size of the buffer.
|
||||
**/
|
||||
public function size():Int;
|
||||
|
||||
/**
|
||||
Retrieve a byte at the given index.
|
||||
**/
|
||||
@:arrayAccess public function get(index:Int):Int;
|
||||
|
||||
/**
|
||||
Retrieve a byte at the given index without a bounds check.
|
||||
**/
|
||||
public function unsafeGet(index:Int):Int;
|
||||
|
||||
/**
|
||||
Set byte value at the given index.
|
||||
**/
|
||||
@:arrayAccess public function set(index:Int, byte:Int):Int;
|
||||
|
||||
/**
|
||||
Set byte value at the given index without a bounds check.
|
||||
**/
|
||||
public function unsafeSet(index:Int, byte:Int):Int;
|
||||
|
||||
/**
|
||||
Creates a view into buffer that starts at the given `offset` and has the given `length`.
|
||||
|
||||
No data is copied.
|
||||
**/
|
||||
public function sub(offset:Int, length:Int):Buffer;
|
||||
|
||||
/**
|
||||
Copies data from this buffer to destination.
|
||||
|
||||
The amount of data copied is the minimum of the two buffers' size.
|
||||
**/
|
||||
public function blit(destination:Buffer):Void;
|
||||
|
||||
/**
|
||||
Fills the given buffer with the given byte.
|
||||
**/
|
||||
public function fill(byte:Int):Void;
|
||||
|
||||
/**
|
||||
Creates a string with the same contents as the buffer.
|
||||
**/
|
||||
public function toString():String;
|
||||
|
||||
/**
|
||||
Creates a native string with the same contents as the buffer.
|
||||
**/
|
||||
public function toNativeString():NativeString;
|
||||
|
||||
/**
|
||||
Creates a `haxe.io.Bytes` instance with the same contents as this buffer.
|
||||
**/
|
||||
public function toBytes():Bytes;
|
||||
|
||||
/**
|
||||
Copies data from a buffer to bytes buffer.
|
||||
**/
|
||||
public function blitToBytes(destination:Bytes, destinationOffset:Int):Void;
|
||||
|
||||
/**
|
||||
Copies data from bytes to a buffer.
|
||||
**/
|
||||
public function blitFromBytes(source:Bytes, sourceOffset:Int):Void;
|
||||
|
||||
/**
|
||||
Copies data from bytes to a buffer.
|
||||
|
||||
Note: `sourceOffset` is not a character offset but a byte offset.
|
||||
**/
|
||||
public function blitFromString(source:NativeString, sourceOffset:Int):Void;
|
||||
}
|
26
Kha/Tools/linux_arm64/std/eval/luv/Check.hx
Normal file
26
Kha/Tools/linux_arm64/std/eval/luv/Check.hx
Normal file
@ -0,0 +1,26 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Post-I/O callback.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Check
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:coreType abstract Check to Handle {
|
||||
/**
|
||||
Allocate and initialize a check handle.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function init(loop:Loop):Result<Check>;
|
||||
|
||||
/**
|
||||
Starts the handle with the given callback.
|
||||
**/
|
||||
public function start(callback:()->Void):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Stops the handle.
|
||||
**/
|
||||
public function stop():Result<Result.NoData>;
|
||||
}
|
39
Kha/Tools/linux_arm64/std/eval/luv/Condition.hx
Normal file
39
Kha/Tools/linux_arm64/std/eval/luv/Condition.hx
Normal file
@ -0,0 +1,39 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Condition variables.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Condition
|
||||
**/
|
||||
@:coreType abstract Condition {
|
||||
/**
|
||||
Allocates and initializes a condition variable.
|
||||
**/
|
||||
static public function init():Result<Condition>;
|
||||
|
||||
/**
|
||||
Cleans up a condition variable.
|
||||
**/
|
||||
public function destroy():Void;
|
||||
|
||||
/**
|
||||
Signals a condition variable.
|
||||
**/
|
||||
public function signal():Void;
|
||||
|
||||
/**
|
||||
Signals a condition variable, waking all waiters.
|
||||
**/
|
||||
public function broadcast():Void;
|
||||
|
||||
/**
|
||||
Waits on a condition variable.
|
||||
**/
|
||||
public function wait(mutex:Mutex):Void;
|
||||
|
||||
/**
|
||||
Waits on a condition variable with a timeout.
|
||||
The timeout is given in nanoseconds.
|
||||
**/
|
||||
public function timedWait(mutex:Mutex, timeout:Int):Void;
|
||||
}
|
34
Kha/Tools/linux_arm64/std/eval/luv/ConnectedUdp.hx
Normal file
34
Kha/Tools/linux_arm64/std/eval/luv/ConnectedUdp.hx
Normal file
@ -0,0 +1,34 @@
|
||||
package eval.luv;
|
||||
|
||||
import eval.luv.SockAddr;
|
||||
|
||||
/**
|
||||
Connected UDP sockets.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/UDP/Connected
|
||||
**/
|
||||
@:forward
|
||||
@:using(eval.luv.Handle)
|
||||
abstract ConnectedUdp(Udp) to Udp to Handle {
|
||||
/**
|
||||
Removes the peer address assigned to the given socket.
|
||||
**/
|
||||
extern public function disconnect():Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Retrieves the peer address assigned to the given socket.
|
||||
**/
|
||||
extern public function getPeerName():Result<SockAddr>;
|
||||
|
||||
/**
|
||||
Like `eval.luv.UDP.send`, but the remote address used is the peer address
|
||||
assigned to the socket.
|
||||
**/
|
||||
extern public function send(data:Array<Buffer>, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Like `eval.luv.UDP.trySend`, but the remote address used is the peer address
|
||||
assigned to the socket.
|
||||
**/
|
||||
extern public function trySend(data:Array<Buffer>):Result<Result.NoData>;
|
||||
}
|
73
Kha/Tools/linux_arm64/std/eval/luv/Dir.hx
Normal file
73
Kha/Tools/linux_arm64/std/eval/luv/Dir.hx
Normal file
@ -0,0 +1,73 @@
|
||||
package eval.luv;
|
||||
|
||||
import eval.luv.File;
|
||||
|
||||
enum abstract DirentKind(Int) {
|
||||
var UNKNOWN = 0;
|
||||
var FILE = 1;
|
||||
var DIR = 2;
|
||||
var LINK = 3;
|
||||
var FIFO = 4;
|
||||
var SOCKET = 5;
|
||||
var CHAR = 6;
|
||||
var BLOCK = 7;
|
||||
}
|
||||
|
||||
typedef Dirent = {
|
||||
var kind:DirentKind;
|
||||
var name:NativeString;
|
||||
}
|
||||
|
||||
typedef DirectoryScan = {
|
||||
/**
|
||||
Retrieves the next directory entry.
|
||||
**/
|
||||
function next():Null<Dirent>;
|
||||
|
||||
/**
|
||||
Cleans up after a directory scan.
|
||||
**/
|
||||
function end():Void;
|
||||
}
|
||||
|
||||
/**
|
||||
@see https://aantron.github.io/luv/luv/Luv/File#module-Dir
|
||||
**/
|
||||
@:coreType abstract Dir {
|
||||
/**
|
||||
Opens the directory at the given path for listing.
|
||||
**/
|
||||
static public function open(loop:Loop, path:NativeString, ?request:FileRequest, callback:(result:Result<Dir>)->Void):Void;
|
||||
|
||||
/**
|
||||
Closes the directory.
|
||||
**/
|
||||
public function close(loop:Loop, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Retrieves a directory entry.
|
||||
**/
|
||||
public function read(loop:Loop, ?numberOfEntries:Int, ?request:FileRequest, callback:(result:Result<Array<Dirent>>)->Void):Void;
|
||||
|
||||
/**
|
||||
Begins directory listing.
|
||||
**/
|
||||
static public function scan(loop:Loop, path:NativeString, ?request:FileRequest, callback:(result:Result<DirectoryScan>)->Void):Void;
|
||||
}
|
||||
|
||||
/**
|
||||
Synchronous version of `eval.luv.Dir` API
|
||||
**/
|
||||
extern class DirSync {
|
||||
@:inheritDoc(eval.luv.Dir.open)
|
||||
static public function open(loop:Loop, path:NativeString):Result<Dir>;
|
||||
|
||||
@:inheritDoc(eval.luv.Dir.close)
|
||||
static public function close(dir:Dir, loop:Loop):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.Dir.read)
|
||||
static public function read(dir:Dir, loop:Loop, ?numberOfEntries:Int):Result<Array<Dirent>>;
|
||||
|
||||
@:inheritDoc(eval.luv.Dir.scan)
|
||||
static public function scan(loop:Loop, path:NativeString):Result<DirectoryScan>;
|
||||
}
|
69
Kha/Tools/linux_arm64/std/eval/luv/Dns.hx
Normal file
69
Kha/Tools/linux_arm64/std/eval/luv/Dns.hx
Normal file
@ -0,0 +1,69 @@
|
||||
package eval.luv;
|
||||
|
||||
@:forward
|
||||
abstract AddrInfoRequest(Request) to Request {}
|
||||
|
||||
typedef AddrInfo = {
|
||||
var family:SockAddr.AddressFamily;
|
||||
var sockType:SockAddr.SocketType;
|
||||
var protocol:Int;
|
||||
var addr:SockAddr;
|
||||
var ?canonName:String;
|
||||
}
|
||||
|
||||
typedef AddrInfoOptions = {
|
||||
var ?request:AddrInfoRequest;
|
||||
var ?family:SockAddr.AddressFamily;
|
||||
var ?sockType:SockAddr.SocketType;
|
||||
var ?protocol:Int;
|
||||
var ?flags:Array<AddrInfoFlag>;
|
||||
}
|
||||
|
||||
enum abstract AddrInfoFlag(Int) {
|
||||
var PASSIVE = 0;
|
||||
var CANONNAME = 1;
|
||||
var NUMERICHOST = 2;
|
||||
var NUMERICSERV = 3;
|
||||
var V4MAPPED = 4;
|
||||
var ALL = 5;
|
||||
var ADDRCONFIG = 6;
|
||||
}
|
||||
|
||||
@:forward
|
||||
abstract NameInfoRequest(Request) to Request {}
|
||||
|
||||
enum abstract NameInfoFlag(Int) {
|
||||
var NAMEREQD = 0;
|
||||
var DGRAM = 1;
|
||||
var NOFQDN = 2;
|
||||
var NUMERICHOST = 3;
|
||||
var NUMERICSERV = 4;
|
||||
}
|
||||
|
||||
typedef NameInfoOptions = {
|
||||
var ?request:NameInfoRequest;
|
||||
var ?flags:Array<NameInfoFlag>;
|
||||
}
|
||||
|
||||
/**
|
||||
DNS queries.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Dns
|
||||
**/
|
||||
extern class Dns {
|
||||
|
||||
static function createAddrRequest():AddrInfoRequest;
|
||||
|
||||
static function createNameRequest():NameInfoRequest;
|
||||
|
||||
/**
|
||||
Retrieves addresses.
|
||||
Either `node` or `service` may be `null` but not both.
|
||||
**/
|
||||
static function getAddrInfo(loop:Loop, node:Null<String>, service:Null<String>, ?options:AddrInfoOptions, callback:(result:Result<Array<AddrInfo>>)->Void):Void;
|
||||
|
||||
/**
|
||||
Retrieves host names.
|
||||
**/
|
||||
static function getNameInfo(loop:Loop, addr:SockAddr, ?options:NameInfoOptions, callback:(result:Result<{hostName:String, service:String}>)->Void):Void;
|
||||
}
|
23
Kha/Tools/linux_arm64/std/eval/luv/Env.hx
Normal file
23
Kha/Tools/linux_arm64/std/eval/luv/Env.hx
Normal file
@ -0,0 +1,23 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Environment variables.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Env
|
||||
**/
|
||||
extern class Env {
|
||||
/**
|
||||
Retrieves the value of an environment variable.
|
||||
**/
|
||||
static function getEnv(name:String):Result<NativeString>;
|
||||
|
||||
/**
|
||||
Sets an environment variable.
|
||||
**/
|
||||
static function setEnv(name:String, value:NativeString):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Retrieves all environment variables.
|
||||
**/
|
||||
static function environ():Result<Map<String,NativeString>>;
|
||||
}
|
424
Kha/Tools/linux_arm64/std/eval/luv/File.hx
Normal file
424
Kha/Tools/linux_arm64/std/eval/luv/File.hx
Normal file
@ -0,0 +1,424 @@
|
||||
package eval.luv;
|
||||
|
||||
import eval.integers.Int64;
|
||||
import eval.integers.UInt64;
|
||||
|
||||
@:forward
|
||||
abstract FileRequest(Request) to Request {}
|
||||
|
||||
enum abstract FileOpenFlag(Int) {
|
||||
var RDONLY = 0;
|
||||
var WRONLY = 1;
|
||||
var RDWR = 2;
|
||||
var CREAT = 3;
|
||||
var EXCL = 4;
|
||||
var EXLOCK = 5;
|
||||
var NOCTTY = 6;
|
||||
var NOFOLLOW = 7;
|
||||
var TEMPORARY = 8;
|
||||
var TRUNC = 9;
|
||||
var APPEND = 10;
|
||||
var DIRECT = 11;
|
||||
var DSYNC = 12;
|
||||
var FILEMAP = 13;
|
||||
var NOATIME = 14;
|
||||
var NONBLOCK = 15;
|
||||
var RANDOM = 16;
|
||||
var SEQUENTIAL = 17;
|
||||
var SHORT_LIVED = 18;
|
||||
var SYMLINK = 19;
|
||||
var SYNC = 20;
|
||||
}
|
||||
|
||||
/**
|
||||
Permission bits.
|
||||
@see https://aantron.github.io/luv/luv/Luv/File/Mode
|
||||
**/
|
||||
enum FileMode {
|
||||
IRWXU;
|
||||
IRUSR;
|
||||
IWUSR;
|
||||
IXUSR;
|
||||
IRWXG;
|
||||
IRGRP;
|
||||
IWGRP;
|
||||
IXGRP;
|
||||
IRWXO;
|
||||
IROTH;
|
||||
IWOTH;
|
||||
IXOTH;
|
||||
ISUID;
|
||||
ISGID;
|
||||
ISVTX;
|
||||
IFMT;
|
||||
IFREG;
|
||||
IFDIR;
|
||||
IFBLK;
|
||||
IFCHR;
|
||||
IFLNK;
|
||||
IFIFO;
|
||||
NUMERIC(mode:Int);
|
||||
}
|
||||
|
||||
/**
|
||||
Abstract type for a bit field of permissions bits, i.e., an `int` in which
|
||||
multiple bits may be set. These bit fields are returned by operations such
|
||||
as `eval.luv.File.stat`
|
||||
**/
|
||||
@:coreType abstract FileModeNumeric {}
|
||||
|
||||
typedef FileStatTimeSpec = {
|
||||
var sec:Int64;
|
||||
var nsec:Int64;
|
||||
}
|
||||
|
||||
typedef FileStat = {
|
||||
var dev:UInt64;
|
||||
var mode:FileModeNumeric;
|
||||
var nlink:UInt64;
|
||||
var uid:UInt64;
|
||||
var gid:UInt64;
|
||||
var rdev:UInt64;
|
||||
var ino:UInt64;
|
||||
var size:UInt64;
|
||||
var blksize:UInt64;
|
||||
var blocks:UInt64;
|
||||
var flags:UInt64;
|
||||
var gen:UInt64;
|
||||
var atim:FileStatTimeSpec;
|
||||
var mtim:FileStatTimeSpec;
|
||||
var ctim:FileStatTimeSpec;
|
||||
var birthtim:FileStatTimeSpec;
|
||||
}
|
||||
|
||||
typedef FileStatFs = {
|
||||
var type:UInt64;
|
||||
var bsize:UInt64;
|
||||
var blocks:UInt64;
|
||||
var bfree:UInt64;
|
||||
var bavail:UInt64;
|
||||
var files:UInt64;
|
||||
var ffree:UInt64;
|
||||
var fspare:Array<UInt64>;
|
||||
}
|
||||
|
||||
enum abstract FileCopyFlag(Int) {
|
||||
var COPYFILE_EXCL = 0;
|
||||
var COPYFILE_FICLONE = 1;
|
||||
var COPYFILE_FICLONE_FORCE = 2;
|
||||
}
|
||||
|
||||
enum abstract FileAccessFlag(Int) {
|
||||
var F_OK = 0;
|
||||
var R_OK = 1;
|
||||
var W_OK = 2;
|
||||
var X_OK = 3;
|
||||
}
|
||||
|
||||
enum abstract FileSymlinkFlag(Int) {
|
||||
var SYMLINK_DIR = 0;
|
||||
var SYMLINK_JUNCTION = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
Files.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/File
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:coreType abstract File to Handle {
|
||||
|
||||
extern static public final stdin:File;
|
||||
extern static public final stdout:File;
|
||||
extern static public final stderr:File;
|
||||
|
||||
static public function createRequest():FileRequest;
|
||||
|
||||
/**
|
||||
Checks whether all the bits in `mask` are set in `bits`.
|
||||
|
||||
For example, if `bits` is equal to octal 0o644, then
|
||||
`eval.luv.File.testMode [IRUSR] bits` evaluates to `true`.
|
||||
**/
|
||||
static public function testMode(mask:Array<FileMode>, bits:FileModeNumeric):Bool;
|
||||
|
||||
/**
|
||||
Opens the file at the given path.
|
||||
The default value of the `mode` argument is equal to octal `0o644`.
|
||||
**/
|
||||
static public function open(loop:Loop, path:NativeString, flags:Array<FileOpenFlag>, ?mode:Array<FileMode>, ?request:FileRequest, callback:(result:Result<File>)->Void):Void;
|
||||
|
||||
/**
|
||||
Closes the file.
|
||||
**/
|
||||
public function close(loop:Loop, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Reads from the file.
|
||||
|
||||
The incoming data is written consecutively to into the given buffers.
|
||||
The number of bytes that the operation tries to read is the total length
|
||||
of the buffers.
|
||||
|
||||
End of file is indicated by `Result.Ok(0)`. Note that this is different
|
||||
from `eval.luv.Stream.readStart`.
|
||||
**/
|
||||
public function read(loop:Loop, fileOffset:Int64, buffers:Array<Buffer>, ?request:FileRequest, callback:(result:Result<UInt64>)->Void):Void;
|
||||
|
||||
/**
|
||||
Writes to the file.
|
||||
**/
|
||||
public function write(loop:Loop, fileOffset:Int64, buffers:Array<Buffer>, ?request:FileRequest, callback:(result:Result<UInt64>)->Void):Void;
|
||||
|
||||
/**
|
||||
Deletes the file at the given path.
|
||||
**/
|
||||
static public function unlink(loop:Loop, path:NativeString, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Moves the file at the given path to the path given by `toPath`
|
||||
**/
|
||||
static public function rename(loop:Loop, path:NativeString, toPath:NativeString, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Creates a temporary file with name based on the given pattern.
|
||||
**/
|
||||
static public function mkstemp(loop:Loop, pattern:NativeString, ?request:FileRequest, callback:(result:Result<{name:NativeString,file:File}>)->Void):Void;
|
||||
|
||||
/**
|
||||
Creates a temporary directory with name based on the given pattern.
|
||||
**/
|
||||
static public function mkdtemp(loop:Loop, pattern:NativeString, ?request:FileRequest, callback:(result:Result<NativeString>)->Void):Void;
|
||||
|
||||
/**
|
||||
Creates a directory.
|
||||
**/
|
||||
static public function mkdir(loop:Loop, path:NativeString, ?mode:Array<FileMode>, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Deletes a directory.
|
||||
**/
|
||||
static public function rmdir(loop:Loop, path:NativeString, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Retrieves status information for the file at the given path.
|
||||
**/
|
||||
static public function stat(loop:Loop, path:NativeString, ?request:FileRequest, callback:(result:Result<FileStat>)->Void):Void;
|
||||
|
||||
/**
|
||||
Like `eval.luv.File.stat`, but does not dereference symlinks.
|
||||
**/
|
||||
static public function lstat(loop:Loop, path:NativeString, ?request:FileRequest, callback:(result:Result<FileStat>)->Void):Void;
|
||||
|
||||
/**
|
||||
Retrieves status information for this file.
|
||||
**/
|
||||
public function fstat(loop:Loop, ?request:FileRequest, callback:(result:Result<FileStat>)->Void):Void;
|
||||
|
||||
/**
|
||||
Retrieves status information for the filesystem containing the given path.
|
||||
**/
|
||||
static public function statFs(loop:Loop, path:NativeString, ?request:FileRequest, callback:(result:Result<FileStatFs>)->Void):Void;
|
||||
|
||||
/**
|
||||
Flushes file changes to storage.
|
||||
**/
|
||||
public function fsync(loop:Loop, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Like `eval.luv.File.fsync`, but may omit some metadata.
|
||||
**/
|
||||
public function fdataSync(loop:Loop, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Truncates the given file to the given length.
|
||||
**/
|
||||
public function ftruncate(loop:Loop, length:Int64, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Copies the file at the given path to the path given by `toPath`.
|
||||
**/
|
||||
static public function copyFile(loop:Loop, path:NativeString, toPath:NativeString, ?flags:Array<FileCopyFlag>, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Transfers data between file descriptors.
|
||||
**/
|
||||
public function sendFile(loop:Loop, toFile:File, offset:Int64, length:UInt64, ?request:FileRequest, callback:(result:Result<UInt64>)->Void):Void;
|
||||
|
||||
/**
|
||||
Checks whether the calling process can access the file at the given path.
|
||||
**/
|
||||
static public function access(loop:Loop, path:NativeString, flags:Array<FileAccessFlag>, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Changes permissions of the file at the given path.
|
||||
**/
|
||||
static public function chmod(loop:Loop, path:NativeString, mode:Array<FileMode>, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Changes permissions of the file.
|
||||
**/
|
||||
public function fchmod(loop:Loop, mode:Array<FileMode>, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Sets timestamps of the file at the given path.
|
||||
**/
|
||||
static public function utime(loop:Loop, path:NativeString, atime:Float, mtime:Float, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Sets timestamps of the file.
|
||||
**/
|
||||
public function futime(loop:Loop, atime:Float, mtime:Float, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Sets timestamps of the file at the given path without dereferencing symlinks.
|
||||
**/
|
||||
static public function lutime(loop:Loop, path:NativeString, atime:Float, mtime:Float, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Hardlinks a file at the location given by `link`.
|
||||
**/
|
||||
static public function link(loop:Loop, path:NativeString, link:NativeString, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Symlinks a file at the location given by `link`.
|
||||
**/
|
||||
static public function symlink(loop:Loop, path:NativeString, link:NativeString, ?flags:Array<FileSymlinkFlag>, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Reads the target path of a symlink.
|
||||
**/
|
||||
static public function readLink(loop:Loop, path:NativeString, ?request:FileRequest, callback:(result:Result<NativeString>)->Void):Void;
|
||||
|
||||
/**
|
||||
Resolves a real absolute path to the given file.
|
||||
**/
|
||||
static public function realPath(loop:Loop, path:NativeString, ?request:FileRequest, callback:(result:Result<NativeString>)->Void):Void;
|
||||
|
||||
/**
|
||||
Changes owneship of the file at the given path.
|
||||
**/
|
||||
static public function chown(loop:Loop, path:NativeString, uid:Int, gid:Int, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Changes owneship of the file at the given path. without dereferencing symlinks.
|
||||
**/
|
||||
static public function lchown(loop:Loop, path:NativeString, uid:Int, gid:Int, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Changes owneship of the file.
|
||||
**/
|
||||
public function fchown(loop:Loop, uid:Int, gid:Int, ?request:FileRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Returns the integer representation of `eval.luv.File`.
|
||||
|
||||
`eval.luv.File` is defined as an integer file descriptor by libuv on all
|
||||
platforms at the moment. This is a convenience function for interoperability
|
||||
with `eval.luv.Process`, the API of which assumes that files are represented
|
||||
by integers.
|
||||
**/
|
||||
public function toInt():Int;
|
||||
}
|
||||
|
||||
/**
|
||||
Synchronous version of `eval.luv.File` API
|
||||
**/
|
||||
extern class FileSync {
|
||||
@:inheritDoc(eval.luv.File.open)
|
||||
static function open(path:NativeString, flags:Array<FileOpenFlag>, ?mode:Array<FileMode>):Result<File>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.close)
|
||||
static function close(file:File):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.read)
|
||||
static function read(file:File, fileOffset:Int64, buffers:Array<Buffer>):Result<UInt64>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.write)
|
||||
static function write(file:File, fileOffset:Int64, buffers:Array<Buffer>):Result<UInt64>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.unlink)
|
||||
static function unlink(path:NativeString):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.rename)
|
||||
static function rename(path:NativeString, toPath:NativeString):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.mkstemp)
|
||||
static function mkstemp(pattern:NativeString):Result<{name:NativeString,file:File}>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.mkdtemp)
|
||||
static function mkdtemp(pattern:NativeString):Result<NativeString>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.mkdir)
|
||||
static function mkdir(path:NativeString, ?mode:Array<FileMode>):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.rmdir)
|
||||
static function rmdir(path:NativeString):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.stat)
|
||||
static function stat(path:NativeString):Result<FileStat>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.lstat)
|
||||
static function lstat(path:NativeString):Result<FileStat>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.fstat)
|
||||
static function fstat(file:File):Result<FileStat>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.statFs)
|
||||
static function statFs(path:NativeString):Result<FileStatFs>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.fsync)
|
||||
static function fsync(file:File):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.fdataSync)
|
||||
static function fdataSync(file:File):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.ftruncate)
|
||||
static function ftruncate(file:File, length:Int64):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.copyFile)
|
||||
static function copyFile(path:NativeString, toPath:NativeString, ?flags:Array<FileCopyFlag>):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.sendFile)
|
||||
static function sendFile(file:File, toFile:File, offset:Int64, length:UInt64):Result<UInt64>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.access)
|
||||
static function access(path:NativeString, flags:Array<FileAccessFlag>):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.chmod)
|
||||
static function chmod(path:NativeString, mode:Array<FileMode>):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.fchmod)
|
||||
static function fchmod(file:File, mode:Array<FileMode>):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.utime)
|
||||
static function utime(path:NativeString, atime:Float, mtime:Float):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.futime)
|
||||
static function futime(file:File, atime:Float, mtime:Float):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.lutime)
|
||||
static function lutime(path:NativeString, atime:Float, mtime:Float):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.link)
|
||||
static function link(path:NativeString, link:NativeString):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.symlink)
|
||||
static function symlink(path:NativeString, link:NativeString, ?flags:Array<FileSymlinkFlag>):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.readLink)
|
||||
static function readLink(path:NativeString):Result<NativeString>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.realPath)
|
||||
static function realPath(path:NativeString):Result<NativeString>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.chown)
|
||||
static function chown(path:NativeString, uid:Int, gid:Int):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.lchown)
|
||||
static function lchown(path:NativeString, uid:Int, gid:Int):Result<Result.NoData>;
|
||||
|
||||
@:inheritDoc(eval.luv.File.fchown)
|
||||
static function fchown(file:File, uid:Int, gid:Int):Result<Result.NoData>;
|
||||
|
||||
}
|
36
Kha/Tools/linux_arm64/std/eval/luv/FsEvent.hx
Normal file
36
Kha/Tools/linux_arm64/std/eval/luv/FsEvent.hx
Normal file
@ -0,0 +1,36 @@
|
||||
package eval.luv;
|
||||
|
||||
enum abstract FsEventType(Int) {
|
||||
var RENAME = 0;
|
||||
var CHANGE = 1;
|
||||
}
|
||||
|
||||
enum abstract FsEventFlag(Int) {
|
||||
var FS_EVENT_WATCH_ENTRY = 0;
|
||||
var FS_EVENT_STAT = 1;
|
||||
var FS_EVENT_RECURSIVE = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
Filesystem events.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/FS_event
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:coreType abstract FsEvent to Handle {
|
||||
/**
|
||||
Allocates and initializes an FS event handle.
|
||||
**/
|
||||
static public function init(loop:Loop):Result<FsEvent>;
|
||||
|
||||
/**
|
||||
Starts the handle and watches the given path for changes.
|
||||
**/
|
||||
public function start(path:NativeString, ?flags:Array<FsEventFlag>, callback:(result:Result<{file:NativeString,events:Array<FsEventType>}>)->Void):Void;
|
||||
|
||||
/**
|
||||
Stops the handle.
|
||||
**/
|
||||
public function stop():Result<Result.NoData>;
|
||||
|
||||
}
|
30
Kha/Tools/linux_arm64/std/eval/luv/FsPoll.hx
Normal file
30
Kha/Tools/linux_arm64/std/eval/luv/FsPoll.hx
Normal file
@ -0,0 +1,30 @@
|
||||
package eval.luv;
|
||||
|
||||
import eval.luv.File;
|
||||
|
||||
/**
|
||||
Filesystem polling.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/FS_poll
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:coreType abstract FsPoll to Handle {
|
||||
/**
|
||||
Allocates and initializes an FS polling handle.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function init(loop:Loop):Result<FsPoll>;
|
||||
|
||||
/**
|
||||
Starts the handle and polls the given path for changes.
|
||||
|
||||
The default value of `interval` is 2000 (milliseconds).
|
||||
**/
|
||||
public function start(path:NativeString, ?interval:Int, callback:(result:Result<{previous:FileStat,current:FileStat}>)->Void):Void;
|
||||
|
||||
/**
|
||||
Stops the handle.
|
||||
**/
|
||||
public function stop():Result<Result.NoData>;
|
||||
}
|
85
Kha/Tools/linux_arm64/std/eval/luv/Handle.hx
Normal file
85
Kha/Tools/linux_arm64/std/eval/luv/Handle.hx
Normal file
@ -0,0 +1,85 @@
|
||||
package eval.luv;
|
||||
|
||||
@:coreType abstract SocketHandle {}
|
||||
|
||||
/**
|
||||
Handles.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Handle
|
||||
**/
|
||||
@:coreType abstract Handle {
|
||||
/**
|
||||
Closes the given handle.
|
||||
**/
|
||||
extern static public function close(handle:Handle, callback:()->Void):Void;
|
||||
|
||||
/**
|
||||
Returns `true` if the handle is active, `false` otherwise.
|
||||
**/
|
||||
static public function isActive(handle:Handle):Bool;
|
||||
|
||||
/**
|
||||
Returns `true` if the handle is closing or closed, `false` otherwise.
|
||||
|
||||
Note: This function should only be used between the initialization of
|
||||
the handle and the arrival of the close callback.
|
||||
**/
|
||||
static public function isClosing(handle:Handle):Bool;
|
||||
|
||||
/**
|
||||
Reference the given handle.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Handle/#val-ref
|
||||
**/
|
||||
static public function ref(handle:Handle):Void;
|
||||
|
||||
/**
|
||||
Un-reference the given handle.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Handle/#val-unref
|
||||
**/
|
||||
static public function unref(handle:Handle):Void;
|
||||
|
||||
/**
|
||||
Returns `true` if the handle referenced, `false` otherwise.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Handle/#val-has_ref
|
||||
**/
|
||||
static public function hasRef(handle:Handle):Bool;
|
||||
|
||||
/**
|
||||
Gets the size of the OS send buffer for a socket.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Handle/#val-send_buffer_size
|
||||
**/
|
||||
static public function sendBufferSize(handle:SocketHandle):Result<Int>;
|
||||
|
||||
/**
|
||||
Sets the size of the OS send buffer for a socket.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Handle/#val-set_send_buffer_size
|
||||
**/
|
||||
static public function setSendBufferSize(handle:SocketHandle, size:Int):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Gets the size of the OS receive buffer for a socket.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Handle/#val-recv_buffer_size
|
||||
**/
|
||||
static public function recvBufferSize(handle:SocketHandle):Result<Int>;
|
||||
|
||||
/**
|
||||
Sets the size of the OS receive buffer for a socket.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Handle/#val-set_recv_buffer_size
|
||||
**/
|
||||
static public function setRecvBufferSize(handle:SocketHandle, size:Int):Result<Result.NoData>;
|
||||
|
||||
// TODO
|
||||
// /**
|
||||
// Retrieves the file descriptor associated with the handle.
|
||||
|
||||
// @see https://aantron.github.io/luv/luv/Luv/Handle/#val-fileno
|
||||
// **/
|
||||
// static public function fileno(handle:FileNo):Result<OsFd>;
|
||||
}
|
26
Kha/Tools/linux_arm64/std/eval/luv/Idle.hx
Normal file
26
Kha/Tools/linux_arm64/std/eval/luv/Idle.hx
Normal file
@ -0,0 +1,26 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Per-iteration callback.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Idle
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:coreType abstract Idle to Handle {
|
||||
/**
|
||||
Allocate and initialize an idle handle.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function init(loop:Loop):Result<Idle>;
|
||||
|
||||
/**
|
||||
Starts the handle with the given callback.
|
||||
**/
|
||||
public function start(callback:()->Void):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Stops the handle.
|
||||
**/
|
||||
public function stop():Result<Result.NoData>;
|
||||
}
|
93
Kha/Tools/linux_arm64/std/eval/luv/Loop.hx
Normal file
93
Kha/Tools/linux_arm64/std/eval/luv/Loop.hx
Normal file
@ -0,0 +1,93 @@
|
||||
package eval.luv;
|
||||
|
||||
enum abstract RunMode(Int) {
|
||||
/** Runs the event loop until there are no more active and referenced handles or requests. */
|
||||
var DEFAULT = 0;
|
||||
/** Poll for i/o once. Note that this mode blocks if there are no pending callbacks. */
|
||||
var ONCE = 1;
|
||||
/** Poll for i/o once but don't block if there are no pending callbacks. */
|
||||
var NOWAIT = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
Configuration options.
|
||||
@see http://docs.libuv.org/en/v1.x/loop.html#c.uv_loop_configure
|
||||
**/
|
||||
enum abstract LoopOption<T>(Int) {
|
||||
extern static public final sigprof:Int;
|
||||
|
||||
var LOOP_BLOCK_SIGNAL:LoopOption<Int> = 0;
|
||||
var METRICS_IDLE_TIME:LoopOption<Result.NoData> = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
Event loops.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Loop
|
||||
|
||||
Haxe event loops define an implicit cast to libuv loops. That is, you can use
|
||||
`sys.thread.Thread.current().events` in any place where `eval.luv.Loop` is
|
||||
expected.
|
||||
**/
|
||||
@:coreType abstract Loop {
|
||||
@:from
|
||||
static inline function fromHaxeEventLoop(events:sys.thread.EventLoop):Loop {
|
||||
return events.handle;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the default event loop.
|
||||
**/
|
||||
static public function defaultLoop():Loop;
|
||||
|
||||
/**
|
||||
Allocates and initializes a new event loop.
|
||||
**/
|
||||
static public function init():Result<Loop>;
|
||||
|
||||
/**
|
||||
Releases any state libuv is holding on to.
|
||||
|
||||
Normally there's no need to do this manually.
|
||||
|
||||
Warning! Only call `Loop.libraryShutdown()` once.
|
||||
Warning! Don’t call `Loop.libraryShutdown()` when there are still event loops or I/O requests active.
|
||||
Warning! Don’t call libuv functions after calling `Loop.libraryShutdown()`.
|
||||
**/
|
||||
static public function libraryShutdown():Void;
|
||||
|
||||
/**
|
||||
Runs an event loop.
|
||||
**/
|
||||
public function run(mode:RunMode):Bool;
|
||||
|
||||
/**
|
||||
Releases resources associated with an event loop.
|
||||
**/
|
||||
public function close():Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Indicates whether the loop is monitoring any activity.
|
||||
**/
|
||||
public function alive():Bool;
|
||||
|
||||
/**
|
||||
Stops an event loop as soon as possible.
|
||||
**/
|
||||
public function stop():Void;
|
||||
|
||||
/**
|
||||
Returns the cached loop timestamp.
|
||||
**/
|
||||
public function now():eval.integers.UInt64;
|
||||
|
||||
/**
|
||||
Updates the cached loop timestamp.
|
||||
**/
|
||||
public function updateTime():Void;
|
||||
|
||||
/**
|
||||
Sets the loop option.
|
||||
**/
|
||||
public function configure<T>(option:LoopOption<T>, value:T):Result<Result.NoData>;
|
||||
}
|
19
Kha/Tools/linux_arm64/std/eval/luv/LuvException.hx
Normal file
19
Kha/Tools/linux_arm64/std/eval/luv/LuvException.hx
Normal file
@ -0,0 +1,19 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Exceptions thrown by functions in `eval.luv` package.
|
||||
**/
|
||||
class LuvException extends haxe.Exception {
|
||||
/**
|
||||
The error.
|
||||
**/
|
||||
public final error:UVError;
|
||||
|
||||
/**
|
||||
Instantiates an error with given message and position.
|
||||
**/
|
||||
public function new(error:UVError, ?message:String, ?previous:haxe.Exception) {
|
||||
super(message == null ? error.toString() : message, previous);
|
||||
this.error = error;
|
||||
}
|
||||
}
|
13
Kha/Tools/linux_arm64/std/eval/luv/Metrics.hx
Normal file
13
Kha/Tools/linux_arm64/std/eval/luv/Metrics.hx
Normal file
@ -0,0 +1,13 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Metrics.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Metrics
|
||||
**/
|
||||
extern class Metrics {
|
||||
/**
|
||||
Retrieves the amount of time the loop has been blocked waiting in the kernel.
|
||||
**/
|
||||
static function idleTime(loop:Loop):eval.integers.UInt64;
|
||||
}
|
35
Kha/Tools/linux_arm64/std/eval/luv/Mutex.hx
Normal file
35
Kha/Tools/linux_arm64/std/eval/luv/Mutex.hx
Normal file
@ -0,0 +1,35 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Mutexes.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Mutex
|
||||
**/
|
||||
@:coreType abstract Mutex {
|
||||
/**
|
||||
Allocates and initializes a mutex.
|
||||
**/
|
||||
static public function init(?recursive:Bool):Result<Mutex>;
|
||||
|
||||
/**
|
||||
Cleans up a mutex.
|
||||
**/
|
||||
public function destroy():Void;
|
||||
|
||||
/**
|
||||
Takes the mutex.
|
||||
|
||||
The calling thread is blocked until it obtains the mutex.
|
||||
**/
|
||||
public function lock():Void;
|
||||
|
||||
/**
|
||||
Tries to take the mutex without blocking.
|
||||
**/
|
||||
public function tryLock():Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Releases the mutex.
|
||||
**/
|
||||
public function unlock():Void;
|
||||
}
|
36
Kha/Tools/linux_arm64/std/eval/luv/Network.hx
Normal file
36
Kha/Tools/linux_arm64/std/eval/luv/Network.hx
Normal file
@ -0,0 +1,36 @@
|
||||
package eval.luv;
|
||||
|
||||
typedef InterfaceAddress = {
|
||||
var name:String;
|
||||
var isInternal:Bool;
|
||||
var physical:NativeString;
|
||||
var address:SockAddr;
|
||||
var netmask:SockAddr;
|
||||
}
|
||||
|
||||
/**
|
||||
Network interfaces and hostname.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Network
|
||||
**/
|
||||
extern class Network {
|
||||
/**
|
||||
Lists network interface addresses.
|
||||
**/
|
||||
static function interfaceAddresses():Result<Array<InterfaceAddress>>;
|
||||
|
||||
/**
|
||||
Retrieves a network interface name.
|
||||
**/
|
||||
static function ifIndexToName(index:Int):Result<String>;
|
||||
|
||||
/**
|
||||
Retrieves a network interface identifier suitable for use in an IPv6 scoped address.
|
||||
**/
|
||||
static function ifIndexToIid(index:Int):Result<String>;
|
||||
|
||||
/**
|
||||
Evaluates to the system's hostname.
|
||||
**/
|
||||
static function getHostName():Result<String>;
|
||||
}
|
18
Kha/Tools/linux_arm64/std/eval/luv/Once.hx
Normal file
18
Kha/Tools/linux_arm64/std/eval/luv/Once.hx
Normal file
@ -0,0 +1,18 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Once-only initialization.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Once
|
||||
**/
|
||||
@:coreType abstract Once {
|
||||
/**
|
||||
Allocates and initializes a once-only barrier.
|
||||
**/
|
||||
static public function init():Result<Once>;
|
||||
|
||||
/**
|
||||
Guards the given callback to be called only once.
|
||||
**/
|
||||
public function once(callback:()->Void):Void;
|
||||
}
|
6
Kha/Tools/linux_arm64/std/eval/luv/OsFd.hx
Normal file
6
Kha/Tools/linux_arm64/std/eval/luv/OsFd.hx
Normal file
@ -0,0 +1,6 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
@see https://aantron.github.io/luv/luv/Luv/Os_fd/Fd
|
||||
**/
|
||||
@:coreType abstract OsFd {}
|
6
Kha/Tools/linux_arm64/std/eval/luv/OsSocket.hx
Normal file
6
Kha/Tools/linux_arm64/std/eval/luv/OsSocket.hx
Normal file
@ -0,0 +1,6 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
@see https://aantron.github.io/luv/luv/Luv/Os_fd/Socket
|
||||
**/
|
||||
@:coreType abstract OsSocket {}
|
21
Kha/Tools/linux_arm64/std/eval/luv/Passwd.hx
Normal file
21
Kha/Tools/linux_arm64/std/eval/luv/Passwd.hx
Normal file
@ -0,0 +1,21 @@
|
||||
package eval.luv;
|
||||
|
||||
typedef PasswdData = {
|
||||
var username:String;
|
||||
var uid:Int;
|
||||
var gid:Int;
|
||||
var shell:Null<String>;
|
||||
var homedir:NativeString;
|
||||
}
|
||||
|
||||
/**
|
||||
Current user information.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Passwd
|
||||
**/
|
||||
extern class Passwd {
|
||||
/**
|
||||
Gets passwd entry for the current user.
|
||||
**/
|
||||
static function getPasswd():Result<PasswdData>;
|
||||
}
|
37
Kha/Tools/linux_arm64/std/eval/luv/Path.hx
Normal file
37
Kha/Tools/linux_arm64/std/eval/luv/Path.hx
Normal file
@ -0,0 +1,37 @@
|
||||
package eval.luv;
|
||||
|
||||
import eval.integers.Int64;
|
||||
import eval.integers.UInt64;
|
||||
|
||||
/**
|
||||
Relevant directories.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Path
|
||||
**/
|
||||
extern class Path {
|
||||
/**
|
||||
Evaluates to the executable's path.
|
||||
It's always the path to the Haxe compiler.
|
||||
**/
|
||||
static function exePath():Result<NativeString>;
|
||||
|
||||
/**
|
||||
Evaluates to the current working directory.
|
||||
**/
|
||||
static function cwd():Result<NativeString>;
|
||||
|
||||
/**
|
||||
Changes the current working directory.
|
||||
**/
|
||||
static function chdir(dir:NativeString):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Evaluates to the path of the home directory.
|
||||
**/
|
||||
static function homedir():Result<NativeString>;
|
||||
|
||||
/**
|
||||
Evaluates to the path of the temporary directory.
|
||||
**/
|
||||
static function tmpdir():Result<NativeString>;
|
||||
}
|
18
Kha/Tools/linux_arm64/std/eval/luv/Pid.hx
Normal file
18
Kha/Tools/linux_arm64/std/eval/luv/Pid.hx
Normal file
@ -0,0 +1,18 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Process ids.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Pid
|
||||
**/
|
||||
extern class Pid {
|
||||
/**
|
||||
Evaluates to the pid of the current process.
|
||||
**/
|
||||
static function getPid():Int;
|
||||
|
||||
/**
|
||||
Evaluates to the pid of the parent process.
|
||||
**/
|
||||
static function getPPid():Int;
|
||||
}
|
77
Kha/Tools/linux_arm64/std/eval/luv/Pipe.hx
Normal file
77
Kha/Tools/linux_arm64/std/eval/luv/Pipe.hx
Normal file
@ -0,0 +1,77 @@
|
||||
package eval.luv;
|
||||
|
||||
enum abstract PipeMode(Int) {
|
||||
var READ = 0;
|
||||
var WRITE = 1;
|
||||
var READ_WRITE = 2;
|
||||
}
|
||||
|
||||
enum ReceiveHandle {
|
||||
NONE;
|
||||
TCP(associate:(tcp:Tcp)->Result<Result.NoData>);
|
||||
PIPE(associate:(pipe:Pipe)->Result<Result.NoData>);
|
||||
}
|
||||
|
||||
/**
|
||||
Pipes
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Pipe
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:using(eval.luv.Stream)
|
||||
@:coreType abstract Pipe to Handle to Stream to Stream.TStream<Pipe> to Handle.SocketHandle {
|
||||
/**
|
||||
Allocates and initializes a pipe.
|
||||
|
||||
The pipe is not yet connected to anything at this point.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function init(loop:Loop, forHandlePassing:Bool = false):Result<Pipe>;
|
||||
|
||||
/**
|
||||
Assigns a pipe a name or an address.
|
||||
**/
|
||||
public function bind(nameOrAddress:NativeString):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Connects to the pipe at the given name or address.
|
||||
**/
|
||||
public function connect(target:NativeString, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Retrieves the name or address assigned to the pipe.
|
||||
**/
|
||||
public function getSockName():Result<NativeString>;
|
||||
|
||||
/**
|
||||
Retrieves the name or address of the pipe's peer.
|
||||
**/
|
||||
public function getPeerName():Result<NativeString>;
|
||||
|
||||
/**
|
||||
Set the number of pending pipe instance handles when the pipe server is
|
||||
waiting for connections.
|
||||
**/
|
||||
public function pendingInstances(amount:Int):Void;
|
||||
|
||||
/**
|
||||
Receives a file descriptor over the given pipe.
|
||||
|
||||
File descriptors are sent using the `sendHandle` argument of `eval.luv.Stream.write2`.
|
||||
On the receiving end, call `eval.luv.Stream.readStart`. When that function
|
||||
calls its callback, there may be file descriptors in the pipe, in addition
|
||||
to the ordinary data provided to the callback.
|
||||
|
||||
To check, call this function `eval.luv.Pipe.recieveHandle` in a loop until
|
||||
it returns `NONE`. Each time it returns `TCP(associate)` or `PIPE(associate)`,
|
||||
create an appropriate handle using either `eval.luv.TCP.init` or `eval.uv.Pipe.init`,
|
||||
and call `associate` to receive the file descriptor and associate it with handle.
|
||||
**/
|
||||
public function receiveHandle():ReceiveHandle;
|
||||
|
||||
/**
|
||||
Sets pipe permissions.
|
||||
**/
|
||||
public function chmod(mode:PipeMode):Result<Result.NoData>;
|
||||
}
|
26
Kha/Tools/linux_arm64/std/eval/luv/Prepare.hx
Normal file
26
Kha/Tools/linux_arm64/std/eval/luv/Prepare.hx
Normal file
@ -0,0 +1,26 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Pre-I/O callback.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Prepare
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:coreType abstract Prepare to Handle {
|
||||
/**
|
||||
Allocate and initialize a prepare handle.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function init(loop:Loop):Result<Prepare>;
|
||||
|
||||
/**
|
||||
Starts the handle with the given callback.
|
||||
**/
|
||||
public function start(callback:()->Void):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Stops the handle.
|
||||
**/
|
||||
public function stop():Result<Result.NoData>;
|
||||
}
|
89
Kha/Tools/linux_arm64/std/eval/luv/Process.hx
Normal file
89
Kha/Tools/linux_arm64/std/eval/luv/Process.hx
Normal file
@ -0,0 +1,89 @@
|
||||
package eval.luv;
|
||||
|
||||
import eval.integers.Int64;
|
||||
|
||||
/**
|
||||
File descriptor redirections for use with `eval.luv.Process.spawn`
|
||||
**/
|
||||
@:coreType abstract Redirection {}
|
||||
|
||||
/**
|
||||
Options for spawning the process.
|
||||
**/
|
||||
typedef ProcessOptions = {
|
||||
var ?onExit:(p:Process, exitStatus:Int64, termSignal:Int)->Void;
|
||||
var ?environment:Map<String,NativeString>;
|
||||
var ?workingDirectory:NativeString;
|
||||
var ?redirect:Array<Redirection>;
|
||||
var ?uid:Int;
|
||||
var ?gid:Int;
|
||||
var ?windowsVerbatimArguments:Bool;
|
||||
var ?detached:Bool;
|
||||
var ?windowsHide:Bool;
|
||||
var ?windowsHideConsole:Bool;
|
||||
var ?windowsHideGui:Bool;
|
||||
}
|
||||
|
||||
/**
|
||||
Subprocesses.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Process
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:coreType abstract Process to Handle {
|
||||
extern static public final stdin:Int;
|
||||
extern static public final stdout:Int;
|
||||
extern static public final stderr:Int;
|
||||
|
||||
/**
|
||||
Causes `fd` in the child to be connected to `toParentPipe` in the parent.
|
||||
|
||||
Binds `UV_CREATE_PIPE`.
|
||||
|
||||
`readableInChild` sets `UV_READABLE_PIPE`, and `writableInChild` sets `UV_WRITABLE_PIPE`.
|
||||
|
||||
`overlapped` sets `UV_OVERLAPPED_PIPE`.
|
||||
**/
|
||||
static public function toParentPipe(fd:Int, parentPipe:Pipe, readableInChild:Bool, writableInChild:Bool, overlapped:Bool):Redirection;
|
||||
|
||||
/**
|
||||
Causes `fd` in the child to be connected to the same device or peer as `fromParentFd` in the parent.
|
||||
|
||||
Binds `UV_INHERIT_FD`
|
||||
**/
|
||||
static public function inheritFd(fd:Int, fromParentFd:Int):Redirection;
|
||||
|
||||
/**
|
||||
Same as `eval.luv.Process.inheritFd`, but takes an `eval.luv.Stream` for the parent file descriptor.
|
||||
|
||||
Binds `UV_INHERIT_STREAM`.
|
||||
**/
|
||||
static public function inheritStream(fd:Int, fromParentStream:Stream):Redirection;
|
||||
|
||||
/**
|
||||
Starts a process.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function spawn(loop:Loop, cmd:NativeString, args:Array<NativeString>, ?options:ProcessOptions):Result<Process>;
|
||||
|
||||
/**
|
||||
Disables (tries) file descriptor inheritance for inherited descriptors.
|
||||
**/
|
||||
static public function disableStdioInheritance():Void;
|
||||
|
||||
/**
|
||||
Sends the given signal to the process with the given pid.
|
||||
**/
|
||||
static public function killPid(pid:Int, sigNum:Signal.SigNum):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Sends the given signal to the process.
|
||||
**/
|
||||
public function kill(sigNum:Signal.SigNum):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Evaluates to the pid of the process.
|
||||
**/
|
||||
public function pid():Int;
|
||||
}
|
26
Kha/Tools/linux_arm64/std/eval/luv/Random.hx
Normal file
26
Kha/Tools/linux_arm64/std/eval/luv/Random.hx
Normal file
@ -0,0 +1,26 @@
|
||||
package eval.luv;
|
||||
|
||||
@:forward
|
||||
abstract RandomRequest(Request) to Request {}
|
||||
|
||||
/**
|
||||
System entropy source.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Random
|
||||
**/
|
||||
extern class Random {
|
||||
|
||||
static function createRequest():RandomRequest;
|
||||
|
||||
/**
|
||||
Fills the given buffer with bits from the system entropy source.
|
||||
**/
|
||||
static function random(loop:Loop, buffer:Buffer, ?request:RandomRequest, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
}
|
||||
|
||||
extern class RandomSync {
|
||||
/**
|
||||
Fills the given buffer with bits from the system entropy source.
|
||||
**/
|
||||
static function random(buffer:Buffer):Result<Result.NoData>;
|
||||
}
|
13
Kha/Tools/linux_arm64/std/eval/luv/Request.hx
Normal file
13
Kha/Tools/linux_arm64/std/eval/luv/Request.hx
Normal file
@ -0,0 +1,13 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Requests.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Request
|
||||
**/
|
||||
@:coreType abstract Request {
|
||||
/**
|
||||
Tries to cancel a pending request.
|
||||
**/
|
||||
public function cancel():Result<Result.NoData>;
|
||||
}
|
78
Kha/Tools/linux_arm64/std/eval/luv/Resource.hx
Normal file
78
Kha/Tools/linux_arm64/std/eval/luv/Resource.hx
Normal file
@ -0,0 +1,78 @@
|
||||
package eval.luv;
|
||||
|
||||
import eval.integers.UInt64;
|
||||
import eval.integers.Int64;
|
||||
|
||||
typedef RUsage = {
|
||||
var utime:{sec:Int64, usec:Int64};
|
||||
var stime:{sec:Int64, usec:Int64};
|
||||
var maxrss:UInt64;
|
||||
var ixrss:UInt64;
|
||||
var idrss:UInt64;
|
||||
var isrss:UInt64;
|
||||
var minflt:UInt64;
|
||||
var majflt:UInt64;
|
||||
var nswap:UInt64;
|
||||
var inblock:UInt64;
|
||||
var oublock:UInt64;
|
||||
var msgsnd:UInt64;
|
||||
var msgrcv:UInt64;
|
||||
var nsignals:UInt64;
|
||||
var nvcsw:UInt64;
|
||||
var nivcsw:UInt64;
|
||||
}
|
||||
|
||||
/**
|
||||
Resource usage.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Resource
|
||||
**/
|
||||
extern class Resource {
|
||||
/**
|
||||
Evaluates to the current uptime.
|
||||
**/
|
||||
static function uptime():Result<Float>;
|
||||
|
||||
/**
|
||||
Evaluates to the load average.
|
||||
**/
|
||||
static function loadAvg():Array<Float>;
|
||||
|
||||
/**
|
||||
Evaluates to the amount of free memory, in bytes.
|
||||
**/
|
||||
static function freeMemory():UInt64;
|
||||
|
||||
/**
|
||||
Evaluates to the total amount of memory, in bytes.
|
||||
**/
|
||||
static function totalMemory():UInt64;
|
||||
|
||||
/**
|
||||
Gets the amount of memory available to the process (in bytes) based on
|
||||
limits imposed by the OS.
|
||||
If there is no such constraint returns `null`
|
||||
**/
|
||||
static function constrainedMemory():Null<UInt64>;
|
||||
|
||||
/**
|
||||
Evaluates to the priority of the process with the given pid.
|
||||
**/
|
||||
static function getPriority(pid:Int):Result<Int>;
|
||||
|
||||
/**
|
||||
Sets the priority of the process with the given pid.
|
||||
**/
|
||||
static function setPriority(pid:Int, priority:Int):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Evaluates to the resident set size for the current process.
|
||||
**/
|
||||
static function residentSetMemory(pid:Int):Result<UInt64>;
|
||||
|
||||
/**
|
||||
Gets the resource usage measures for the current process.
|
||||
**/
|
||||
static function getRUsage():Result<RUsage>;
|
||||
|
||||
}
|
40
Kha/Tools/linux_arm64/std/eval/luv/Result.hx
Normal file
40
Kha/Tools/linux_arm64/std/eval/luv/Result.hx
Normal file
@ -0,0 +1,40 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Outcome of an operation.
|
||||
**/
|
||||
@:using(eval.luv.Result.ResultTools)
|
||||
enum Result<T> {
|
||||
/** Operation completed successfully. **/
|
||||
Ok(value:T);
|
||||
/** Operation failed. **/
|
||||
Error(e:UVError);
|
||||
}
|
||||
|
||||
enum abstract NoData(Dynamic) {
|
||||
var NoData = null;
|
||||
}
|
||||
|
||||
class ResultTools {
|
||||
/**
|
||||
Returns the result value on success or throws `eval.luv.LuvException`
|
||||
on failure.
|
||||
**/
|
||||
static public inline function resolve<T>(result:Result<T>):T {
|
||||
switch result {
|
||||
case Ok(v): return v;
|
||||
case Error(e): throw new LuvException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Returns `true` if the result is `Ok`.
|
||||
Returns `false` if the result is `Error`.
|
||||
**/
|
||||
static public inline function isOk<T>(result:Result<T>):Bool {
|
||||
return switch result {
|
||||
case Ok(_): true;
|
||||
case Error(_): false;
|
||||
}
|
||||
}
|
||||
}
|
48
Kha/Tools/linux_arm64/std/eval/luv/RwLock.hx
Normal file
48
Kha/Tools/linux_arm64/std/eval/luv/RwLock.hx
Normal file
@ -0,0 +1,48 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Read-write locks.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Rwlock
|
||||
**/
|
||||
@:coreType abstract RwLock {
|
||||
/**
|
||||
Allocates and initializes a read-write lock.
|
||||
**/
|
||||
static public function init():Result<RwLock>;
|
||||
|
||||
/**
|
||||
Cleans up a read-write lock.
|
||||
**/
|
||||
public function destroy():Void;
|
||||
|
||||
/**
|
||||
Takes a read-write lock for reading (shared access).
|
||||
**/
|
||||
public function rdLock():Void;
|
||||
|
||||
/**
|
||||
Tries to take a read-write lock for reading without blocking.
|
||||
**/
|
||||
public function rdTryLock():Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Releases a read-write lock after it was taken for reading.
|
||||
**/
|
||||
public function rdUnlock():Void;
|
||||
|
||||
/**
|
||||
Takes a read-write lock for writing (exclusive access).
|
||||
**/
|
||||
public function wrLock():Void;
|
||||
|
||||
/**
|
||||
Tries to take a read-write lock for writing without blocking.
|
||||
**/
|
||||
public function wrTryLock():Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Releases a read-write lock after it was taken for writing.
|
||||
**/
|
||||
public function wrUnlock():Void;
|
||||
}
|
33
Kha/Tools/linux_arm64/std/eval/luv/Semaphore.hx
Normal file
33
Kha/Tools/linux_arm64/std/eval/luv/Semaphore.hx
Normal file
@ -0,0 +1,33 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Semaphores.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Semaphore
|
||||
**/
|
||||
@:coreType abstract Semaphore {
|
||||
/**
|
||||
Allocates and initializes a read-write lock.
|
||||
**/
|
||||
static public function init(value:Int):Result<Semaphore>;
|
||||
|
||||
/**
|
||||
Cleans up a semaphore.
|
||||
**/
|
||||
public function destroy():Void;
|
||||
|
||||
/**
|
||||
Increments a semaphore.
|
||||
**/
|
||||
public function post():Void;
|
||||
|
||||
/**
|
||||
Decrements a semaphore.
|
||||
**/
|
||||
public function wait():Void;
|
||||
|
||||
/**
|
||||
Tries to decrement a semaphore without blocking.
|
||||
**/
|
||||
public function tryWait():Result<Result.NoData>;
|
||||
}
|
57
Kha/Tools/linux_arm64/std/eval/luv/Signal.hx
Normal file
57
Kha/Tools/linux_arm64/std/eval/luv/Signal.hx
Normal file
@ -0,0 +1,57 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
For the moment, the signals exposed are those that are both present on Unix
|
||||
and present or emulated by libuv on Windows.
|
||||
|
||||
You can also provide a plain integer signal code instead of the values of
|
||||
this enum.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Signal#signals
|
||||
**/
|
||||
extern enum abstract SigNum(Int) from Int to Int {
|
||||
var SIGABRT;
|
||||
var SIGFPE;
|
||||
var SIGHUP;
|
||||
var SIGILL;
|
||||
var SIGINT;
|
||||
var SIGKILL;
|
||||
var SIGSEGV;
|
||||
var SIGTERM;
|
||||
var SIGWINCH;
|
||||
}
|
||||
|
||||
/**
|
||||
Signals.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Signal
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:coreType abstract Signal to Handle {
|
||||
/**
|
||||
Allocates and initializes a signal handle.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function init(loop:Loop):Result<Signal>;
|
||||
|
||||
/**
|
||||
Starts the signal handle.
|
||||
**/
|
||||
public function start(sigNum:SigNum, callback:()->Void):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Like `eval.luv.Signal.start`, but the handle is stopped after one callback call.
|
||||
**/
|
||||
public function startOneshot(sigNum:SigNum, callback:()->Void):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Stops the signal handle.
|
||||
**/
|
||||
public function stop():Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Evaluates to the signal number associated with the handle.
|
||||
**/
|
||||
public function signum():Int;
|
||||
}
|
47
Kha/Tools/linux_arm64/std/eval/luv/SockAddr.hx
Normal file
47
Kha/Tools/linux_arm64/std/eval/luv/SockAddr.hx
Normal file
@ -0,0 +1,47 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Network address families.
|
||||
**/
|
||||
enum AddressFamily {
|
||||
UNSPEC;
|
||||
INET;
|
||||
INET6;
|
||||
OTHER(i:Int);
|
||||
}
|
||||
|
||||
/**
|
||||
Socket types.
|
||||
**/
|
||||
enum SocketType {
|
||||
STREAM;
|
||||
DGRAM;
|
||||
RAW;
|
||||
OTHER(i:Int);
|
||||
}
|
||||
|
||||
/**
|
||||
Binds `struct sockaddr`.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Sockaddr
|
||||
**/
|
||||
@:coreType abstract SockAddr {
|
||||
/** Extracts the port in a network address. */
|
||||
public var port(get,never):Null<Int>;
|
||||
function get_port():Null<Int>;
|
||||
|
||||
/**
|
||||
Converts a string and port number to an IPv4 struct sockaddr.
|
||||
**/
|
||||
static public function ipv4(host:String, port:Int):Result<SockAddr>;
|
||||
|
||||
/**
|
||||
Converts a string and port number to an IPv6 struct sockaddr.
|
||||
**/
|
||||
static public function ipv6(host:String, port:Int):Result<SockAddr>;
|
||||
|
||||
/**
|
||||
Converts a network address to a string.
|
||||
**/
|
||||
public function toString():String;
|
||||
}
|
111
Kha/Tools/linux_arm64/std/eval/luv/Stream.hx
Normal file
111
Kha/Tools/linux_arm64/std/eval/luv/Stream.hx
Normal file
@ -0,0 +1,111 @@
|
||||
package eval.luv;
|
||||
|
||||
@:coreType abstract TStream<T> to Stream {}
|
||||
// typedef TStream<T> = Stream;
|
||||
|
||||
enum SendHandle {
|
||||
TCP(tcp:Tcp);
|
||||
PIPE(pipe:Pipe);
|
||||
}
|
||||
|
||||
/**
|
||||
Streams.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Stream
|
||||
**/
|
||||
@:coreType abstract Stream to Handle {
|
||||
/**
|
||||
Shuts down the write side of the stream.
|
||||
**/
|
||||
extern static public function shutdown(stream:Stream, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Starts listening for incoming connections.
|
||||
|
||||
`backlog` indicates the number of connections the kernel might queue.
|
||||
When a new incoming connection is received the `callback` is called.
|
||||
**/
|
||||
extern static public function listen(stream:Stream, callback:(result:Result<Result.NoData>)->Void, ?backlog:Int):Void;
|
||||
|
||||
/**
|
||||
This call is used in conjunction with `Stream.listen()` to accept incoming
|
||||
connections. Call this function after receiving a `callback` of `listen(callback)`
|
||||
to accept the connection. Before calling this function the client handle
|
||||
must be initialized.
|
||||
|
||||
When the `callback` of `listen(callback)` is called it is guaranteed that
|
||||
this function will complete successfully the first time.
|
||||
|
||||
`client` should be a freshly-initialized stream.
|
||||
**/
|
||||
extern static public function accept<T>(server:TStream<T>, client:TStream<T>):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Calls the `callback` whenever data is available on the stream.
|
||||
|
||||
The amount of data read is equal to the length of the buffer passed to
|
||||
the `callback`. `allocate` is called immediately before each call to the
|
||||
main `callback`, to create buffer, into which the data will be read.
|
||||
|
||||
The end of the stream (typically, when the remote peer closes or shuts down
|
||||
the connection) is indicated by `UVError.UV_EOF` being passed to the `callback`.
|
||||
Note that this behavior is different from `eval.luv.File.read`.
|
||||
|
||||
Zero-length reads are possible, and do not indicate the end of stream. Instead,
|
||||
they usually indicate `UVError.UV_EAGAIN` inside libuv; libuv still calls the
|
||||
`callback` in order to give the C user a chance to deallocate the data buffer.
|
||||
This is not usually an issue in OCaml (which is the backend for eval target of
|
||||
Haxe), so a wrapper of this function can usually simply ignore zero-length reads.
|
||||
It is then also safe to convert `UVError.UV_EOF` to zero-length reads in a
|
||||
higher-level API, for consistency with reading files, and in accordance with OS
|
||||
API convention.
|
||||
|
||||
To read only once, call `eval.luv.Stream.readStop` immediately, in the `callback`.
|
||||
Otherwise, the main callback will be called repeatedly.
|
||||
**/
|
||||
extern static public function readStart(stream:Stream, callback:(result:Result<Buffer>)->Void, ?allocate:(size:Int)->Buffer):Void;
|
||||
|
||||
/**
|
||||
Stops reading.
|
||||
**/
|
||||
extern static public function readStop(stream:Stream):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Writes the given buffer to the stream.
|
||||
|
||||
The second argument passed to the `callback` is the number of bytes written.
|
||||
libuv has an internal queue of writes, in part to implement retry. This means
|
||||
that writes can be partial at the libuv API level, so it is possible to receive
|
||||
both an `UVError` result, and for some data to have been successfully written.
|
||||
**/
|
||||
extern static public function write(stream:Stream, data:Array<Buffer>, callback:(result:Result<Result.NoData>, bytesWritten:Int)->Void):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Like `eval.luv.Stream.write`, but allows sending a TCP socket or pipe over the
|
||||
stream.
|
||||
**/
|
||||
extern static public function write2(stream:TStream<Pipe>, data:Array<Buffer>, sendHandle:SendHandle, callback:(result:Result<Result.NoData>, bytesWritten:Int)->Void):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Same as `eval.luv.Stream.write()`, but won’t queue a write request if it can’t
|
||||
be completed immediately.
|
||||
|
||||
Returns the number of bytes written.
|
||||
**/
|
||||
extern static public function tryWrite(stream:Stream, data:Array<Buffer>):Result<Int>;
|
||||
|
||||
/**
|
||||
Indicates whether the stream is readable (has data).
|
||||
**/
|
||||
extern static public function isReadable(stream:Stream):Bool;
|
||||
|
||||
/**
|
||||
Indicates whether the stream is writable (has space in buffers).
|
||||
**/
|
||||
extern static public function isWritable(stream:Stream):Bool;
|
||||
|
||||
/**
|
||||
Sets the blocking mode of the stream.
|
||||
**/
|
||||
extern static public function setBlocking(stream:Stream, block:Bool):Result<Result.NoData>;
|
||||
}
|
39
Kha/Tools/linux_arm64/std/eval/luv/SystemInfo.hx
Normal file
39
Kha/Tools/linux_arm64/std/eval/luv/SystemInfo.hx
Normal file
@ -0,0 +1,39 @@
|
||||
package eval.luv;
|
||||
|
||||
import eval.integers.UInt64;
|
||||
|
||||
typedef CpuInfo = {
|
||||
var model:String;
|
||||
var speed:Int;
|
||||
var times:{
|
||||
var user:UInt64;
|
||||
var nice:UInt64;
|
||||
var sys:UInt64;
|
||||
var idle:UInt64;
|
||||
var irq:UInt64;
|
||||
};
|
||||
}
|
||||
|
||||
typedef Uname = {
|
||||
var sysname:String;
|
||||
var release:String;
|
||||
var version:String;
|
||||
var machine:String;
|
||||
}
|
||||
|
||||
/**
|
||||
System information.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/System_info
|
||||
**/
|
||||
extern class SystemInfo {
|
||||
/**
|
||||
Gets information about the CPUs on the system.
|
||||
**/
|
||||
static function cpuInfo():Result<Array<CpuInfo>>;
|
||||
|
||||
/**
|
||||
Gets information about the CPUs on the system.
|
||||
**/
|
||||
static function uname():Result<Uname>;
|
||||
}
|
62
Kha/Tools/linux_arm64/std/eval/luv/Tcp.hx
Normal file
62
Kha/Tools/linux_arm64/std/eval/luv/Tcp.hx
Normal file
@ -0,0 +1,62 @@
|
||||
package eval.luv;
|
||||
|
||||
import haxe.ds.Option;
|
||||
import eval.luv.SockAddr;
|
||||
|
||||
/**
|
||||
TCP sockets.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/TCP
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:using(eval.luv.Stream)
|
||||
@:coreType abstract Tcp to Handle to Stream to Stream.TStream<Tcp> to Handle.SocketHandle {
|
||||
/**
|
||||
Allocates and initializes a TCP stream.
|
||||
|
||||
The stream is not yet connected or listening.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function init(loop:Loop, ?domain:AddressFamily):Result<Tcp>;
|
||||
|
||||
/**
|
||||
Sets TCP_NODELAY.
|
||||
**/
|
||||
public function noDelay(enable:Bool):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Sets the TCP keepalive.
|
||||
**/
|
||||
public function keepAlive(value:Option<Int>):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Sets simultaneous accept.
|
||||
**/
|
||||
public function simultaneousAccepts(value:Bool):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Assigns an address to the TCP socket.
|
||||
**/
|
||||
public function bind(addr:SockAddr, ipv6Only:Bool = false):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Retrieves the address assigned to the TCP socket.
|
||||
**/
|
||||
public function getSockName():Result<SockAddr>;
|
||||
|
||||
/**
|
||||
Retrieves the address of the TCP socket's peer.
|
||||
**/
|
||||
public function getPeerName():Result<SockAddr>;
|
||||
|
||||
/**
|
||||
Connects to a host.
|
||||
**/
|
||||
public function connect(addr:SockAddr, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Resets the connection.
|
||||
**/
|
||||
public function closeReset(callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
}
|
34
Kha/Tools/linux_arm64/std/eval/luv/Thread.hx
Normal file
34
Kha/Tools/linux_arm64/std/eval/luv/Thread.hx
Normal file
@ -0,0 +1,34 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Threads.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Thread
|
||||
|
||||
`eval.luv` integrates libuv with the OCaml runtime lock. This means that, as
|
||||
in any other OCaml program, two threads cannot be running OCaml code at the
|
||||
same time. Thus, two threads cannot be running Haxe code at the same time
|
||||
because eval interpreter is written in OCaml.
|
||||
However, `eval.luv` releases the lock when calling a potentially-blocking libuv API,
|
||||
so that other threads can run while the calling thread is blocked. In particular,
|
||||
the lock is released during calls to `eval.luv.Loop.run`, which means that other
|
||||
threads can run in between when you make a call to a non-blocking API, and when
|
||||
its callback is called by libuv.
|
||||
**/
|
||||
@:coreType abstract Thread {
|
||||
/**
|
||||
Returns the representation of the calling thread.
|
||||
**/
|
||||
static public function self():Thread;
|
||||
|
||||
/**
|
||||
Starts a new thread, which will run the given function.
|
||||
**/
|
||||
static public function create(fn:()->Void, ?stackSize:Int):Result<Thread>;
|
||||
|
||||
/**
|
||||
Waits for the thread to terminate.
|
||||
**/
|
||||
public function join():Result<Result.NoData>;
|
||||
|
||||
}
|
31
Kha/Tools/linux_arm64/std/eval/luv/ThreadPool.hx
Normal file
31
Kha/Tools/linux_arm64/std/eval/luv/ThreadPool.hx
Normal file
@ -0,0 +1,31 @@
|
||||
package eval.luv;
|
||||
|
||||
@:forward
|
||||
abstract ThreadPoolRequest(Request) to Request {}
|
||||
|
||||
/**
|
||||
Thread pool.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Thread_pool
|
||||
**/
|
||||
extern class ThreadPool {
|
||||
|
||||
static function createRequest():ThreadPoolRequest;
|
||||
|
||||
/**
|
||||
Schedules a function to be called by a thread in the thread pool.
|
||||
|
||||
`work` is the function that will be called in the thread pool.
|
||||
`callback` will be called by the `loop` after `work` completes, or
|
||||
immediately, in case there is an error scheduling `work`.
|
||||
**/
|
||||
static function queueWork(loop:Loop, ?request:ThreadPoolRequest, work:()->Void, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Sets thread pool size.
|
||||
|
||||
This function should be called as soon during process startup as possible.
|
||||
**/
|
||||
static function setSize(size:Int, ?ifNotAlreadySet:Bool):Void;
|
||||
|
||||
}
|
27
Kha/Tools/linux_arm64/std/eval/luv/Time.hx
Normal file
27
Kha/Tools/linux_arm64/std/eval/luv/Time.hx
Normal file
@ -0,0 +1,27 @@
|
||||
package eval.luv;
|
||||
|
||||
import eval.integers.Int64;
|
||||
import eval.integers.UInt64;
|
||||
|
||||
/**
|
||||
Current time.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Time
|
||||
**/
|
||||
extern class Time {
|
||||
/**
|
||||
Get time.
|
||||
**/
|
||||
static function getTimeOfDay():Result<{sec:Int64, usec:Int}>;
|
||||
|
||||
/**
|
||||
Samples the high-resolution timer.
|
||||
**/
|
||||
static function hrTime():UInt64;
|
||||
|
||||
/**
|
||||
Suspends the calling thread for at least the given number of milliseconds.
|
||||
**/
|
||||
static function sleep(duration:Int):Void;
|
||||
|
||||
}
|
40
Kha/Tools/linux_arm64/std/eval/luv/Timer.hx
Normal file
40
Kha/Tools/linux_arm64/std/eval/luv/Timer.hx
Normal file
@ -0,0 +1,40 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Timers.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Timer
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:coreType abstract Timer to Handle {
|
||||
/** The timer repeat interval. */
|
||||
public var repeat(get,set):Int;
|
||||
function get_repeat():Int;
|
||||
function set_repeat(v:Int):Int;
|
||||
|
||||
/** Evaluates to the time until the timer expires, or zero if it has already expired. */
|
||||
public var dueIn(get,never):Int;
|
||||
function get_dueIn():Int;
|
||||
|
||||
/**
|
||||
Allocate and initialize an idle handle.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function init(loop:Loop):Result<Timer>;
|
||||
|
||||
/**
|
||||
Starts a timer.
|
||||
**/
|
||||
public function start(callback:()->Void, timeoutMs:Int, ?repeatMs:Int):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Stops a timer.
|
||||
**/
|
||||
public function stop():Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Restarts a timer.
|
||||
**/
|
||||
public function again():Result<Result.NoData>;
|
||||
}
|
63
Kha/Tools/linux_arm64/std/eval/luv/Tty.hx
Normal file
63
Kha/Tools/linux_arm64/std/eval/luv/Tty.hx
Normal file
@ -0,0 +1,63 @@
|
||||
package eval.luv;
|
||||
|
||||
enum abstract TtyMode(Int) {
|
||||
var NORMAL = 0;
|
||||
var RAW = 1;
|
||||
var IO = 2;
|
||||
}
|
||||
|
||||
enum abstract VTermState(Int) {
|
||||
var SUPPORTED = 0;
|
||||
var UNSUPPORTED = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
Consoles.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Tty
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:using(eval.luv.Stream)
|
||||
@:coreType abstract Tty to Handle to Stream to Stream.TStream<Tty> {
|
||||
/**
|
||||
To be called when the program exits.
|
||||
Resets TTY settings to default values for the next process to take over.
|
||||
**/
|
||||
static public function resetMode():Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Controls whether console virtual terminal sequences are processed by libuv
|
||||
or console. Useful in particular for enabling ConEmu support of ANSI X3.64
|
||||
and Xterm 256 colors. Otherwise Windows10 consoles are usually detected
|
||||
automatically.
|
||||
|
||||
This function is only meaningful on Windows systems. On Unix it is silently
|
||||
ignored.
|
||||
**/
|
||||
static public function setVTermState(state:VTermState):Void;
|
||||
|
||||
/**
|
||||
Get the current state of whether console virtual terminal sequences are
|
||||
handled by libuv or the console.
|
||||
|
||||
This function is not implemented on Unix, where it returns `UVError.UV_ENOTSUP`.
|
||||
**/
|
||||
static public function getVTermState():Result<VTermState>;
|
||||
|
||||
/**
|
||||
Allocates and initializes a TTY handle.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function init(loop:Loop, file:File):Result<Tty>;
|
||||
|
||||
/**
|
||||
Sets the TTY's mode.
|
||||
**/
|
||||
public function setMode(mode:TtyMode):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Retrieves the current window size.
|
||||
**/
|
||||
public function getWinSize():Result<{width:Int, height:Int}>;
|
||||
}
|
187
Kha/Tools/linux_arm64/std/eval/luv/UVError.hx
Normal file
187
Kha/Tools/linux_arm64/std/eval/luv/UVError.hx
Normal file
@ -0,0 +1,187 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Error handling.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Error
|
||||
**/
|
||||
enum abstract UVError(Int) {
|
||||
/** argument list too long */
|
||||
var UV_E2BIG = 0;
|
||||
/** permission denied */
|
||||
var UV_EACCES = 1;
|
||||
/** address already in use */
|
||||
var UV_EADDRINUSE = 2;
|
||||
/** address not available */
|
||||
var UV_EADDRNOTAVAIL = 3;
|
||||
/** address family not supported */
|
||||
var UV_EAFNOSUPPORT = 4;
|
||||
/** resource temporarily unavailable */
|
||||
var UV_EAGAIN = 5;
|
||||
/** address family not supported */
|
||||
var UV_EAI_ADDRFAMILY = 6;
|
||||
/** temporary failure */
|
||||
var UV_EAI_AGAIN = 7;
|
||||
/** bad ai_flags value */
|
||||
var UV_EAI_BADFLAGS = 8;
|
||||
/** invalid value for hints */
|
||||
var UV_EAI_BADHINTS = 9;
|
||||
/** request canceled */
|
||||
var UV_EAI_CANCELED = 10;
|
||||
/** permanent failure */
|
||||
var UV_EAI_FAIL = 11;
|
||||
/** ai_family not supported */
|
||||
var UV_EAI_FAMILY = 12;
|
||||
/** out of memory */
|
||||
var UV_EAI_MEMORY = 13;
|
||||
/** no address */
|
||||
var UV_EAI_NODATA = 14;
|
||||
/** unknown node or service */
|
||||
var UV_EAI_NONAME = 15;
|
||||
/** argument buffer overflow */
|
||||
var UV_EAI_OVERFLOW = 16;
|
||||
/** resolved protocol is unknown */
|
||||
var UV_EAI_PROTOCOL = 17;
|
||||
/** service not available for socket type */
|
||||
var UV_EAI_SERVICE = 18;
|
||||
/** socket type not supported */
|
||||
var UV_EAI_SOCKTYPE = 19;
|
||||
/** connection already in progress */
|
||||
var UV_EALREADY = 20;
|
||||
/** bad file descriptor */
|
||||
var UV_EBADF = 21;
|
||||
/** resource busy or locked */
|
||||
var UV_EBUSY = 22;
|
||||
/** operation canceled */
|
||||
var UV_ECANCELED = 23;
|
||||
/** invalid Unicode character */
|
||||
// var UV_ECHARSET = 24; // not defined in Luv ocaml library
|
||||
/** software caused connection abort */
|
||||
var UV_ECONNABORTED = 25;
|
||||
/** connection refused */
|
||||
var UV_ECONNREFUSED = 26;
|
||||
/** connection reset by peer */
|
||||
var UV_ECONNRESET = 27;
|
||||
/** destination address required */
|
||||
var UV_EDESTADDRREQ = 28;
|
||||
/** file already exists */
|
||||
var UV_EEXIST = 29;
|
||||
/** bad address in system call argument */
|
||||
var UV_EFAULT = 30;
|
||||
/** file too large */
|
||||
var UV_EFBIG = 31;
|
||||
/** host is unreachable */
|
||||
var UV_EHOSTUNREACH = 32;
|
||||
/** interrupted system call */
|
||||
var UV_EINTR = 33;
|
||||
/** invalid argument */
|
||||
var UV_EINVAL = 34;
|
||||
/** i/o error */
|
||||
var UV_EIO = 35;
|
||||
/** socket is already connected */
|
||||
var UV_EISCONN = 36;
|
||||
/** illegal operation on a directory */
|
||||
var UV_EISDIR = 37;
|
||||
/** too many symbolic links encountered */
|
||||
var UV_ELOOP = 38;
|
||||
/** too many open files */
|
||||
var UV_EMFILE = 39;
|
||||
/** message too long */
|
||||
var UV_EMSGSIZE = 40;
|
||||
/** name too long */
|
||||
var UV_ENAMETOOLONG = 41;
|
||||
/** network is down */
|
||||
var UV_ENETDOWN = 42;
|
||||
/** network is unreachable */
|
||||
var UV_ENETUNREACH = 43;
|
||||
/** file table overflow */
|
||||
var UV_ENFILE = 44;
|
||||
/** no buffer space available */
|
||||
var UV_ENOBUFS = 45;
|
||||
/** no such device */
|
||||
var UV_ENODEV = 46;
|
||||
/** no such file or directory */
|
||||
var UV_ENOENT = 47;
|
||||
/** not enough memory */
|
||||
var UV_ENOMEM = 48;
|
||||
/** machine is not on the network */
|
||||
var UV_ENONET = 49;
|
||||
/** protocol not available */
|
||||
var UV_ENOPROTOOPT = 50;
|
||||
/** no space left on device */
|
||||
var UV_ENOSPC = 51;
|
||||
/** function not implemented */
|
||||
var UV_ENOSYS = 52;
|
||||
/** socket is not connected */
|
||||
var UV_ENOTCONN = 53;
|
||||
/** not a directory */
|
||||
var UV_ENOTDIR = 54;
|
||||
/** directory not empty */
|
||||
var UV_ENOTEMPTY = 55;
|
||||
/** socket operation on non-socket */
|
||||
var UV_ENOTSOCK = 56;
|
||||
/** operation not supported on socket */
|
||||
var UV_ENOTSUP = 57;
|
||||
/** operation not permitted */
|
||||
var UV_EPERM = 58;
|
||||
/** broken pipe */
|
||||
var UV_EPIPE = 59;
|
||||
/** protocol error */
|
||||
var UV_EPROTO = 60;
|
||||
/** protocol not supported */
|
||||
var UV_EPROTONOSUPPORT = 61;
|
||||
/** protocol wrong type for socket */
|
||||
var UV_EPROTOTYPE = 62;
|
||||
/** result too large */
|
||||
var UV_ERANGE = 63;
|
||||
/** read-only file system */
|
||||
var UV_EROFS = 64;
|
||||
/** cannot send after transport endpoint shutdown */
|
||||
var UV_ESHUTDOWN = 65;
|
||||
/** invalid seek */
|
||||
var UV_ESPIPE = 66;
|
||||
/** no such process */
|
||||
var UV_ESRCH = 67;
|
||||
/** connection timed out */
|
||||
var UV_ETIMEDOUT = 68;
|
||||
/** text file is busy */
|
||||
var UV_ETXTBSY = 69;
|
||||
/** cross-device link not permitted */
|
||||
var UV_EXDEV = 70;
|
||||
/** unknown error */
|
||||
var UV_UNKNOWN = 71;
|
||||
/** end of file */
|
||||
var UV_EOF = 72;
|
||||
/** no such device or address */
|
||||
var UV_ENXIO = 73;
|
||||
/** too many links */
|
||||
var UV_EMLINK = 74;
|
||||
/** inappropriate ioctl for device */
|
||||
var UV_ENOTTY = 75;
|
||||
/** inappropriate file type or format */
|
||||
var UV_EFTYPE = 76;
|
||||
/** illegal byte sequence */
|
||||
var UV_EILSEQ = 77;
|
||||
|
||||
/**
|
||||
Converts a system error code to a libuv error.
|
||||
**/
|
||||
extern static public function translateSysError(code:Int):UVError;
|
||||
|
||||
/**
|
||||
Setup a callback for unhandled exceptions.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Error#val-set_on_unhandled_exception
|
||||
**/
|
||||
extern static public function setOnUnhandledException(callback:(e:haxe.Exception)->Void):Void;
|
||||
|
||||
/**
|
||||
Returns the name of the given error.
|
||||
**/
|
||||
extern public function errName():String;
|
||||
|
||||
/**
|
||||
Returns the error message corresponding to the given error.
|
||||
**/
|
||||
extern public function toString():String;
|
||||
}
|
121
Kha/Tools/linux_arm64/std/eval/luv/Udp.hx
Normal file
121
Kha/Tools/linux_arm64/std/eval/luv/Udp.hx
Normal file
@ -0,0 +1,121 @@
|
||||
package eval.luv;
|
||||
|
||||
import haxe.ds.Option;
|
||||
import eval.luv.SockAddr;
|
||||
|
||||
enum abstract UdpMembership(Int) {
|
||||
var LEAVE_GROUP = 0;
|
||||
var JOIN_GROUP = 1;
|
||||
}
|
||||
|
||||
enum abstract RecvFlag(Int) {
|
||||
var PARTIAL = 0;
|
||||
var MMSG_CHUNK = 1;
|
||||
var MMSG_FREE = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
UDP sockets.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/UDP
|
||||
**/
|
||||
@:using(eval.luv.Handle)
|
||||
@:coreType abstract Udp to Handle to Handle.SocketHandle {
|
||||
/**
|
||||
Allocates and initializes a UDP socket.
|
||||
|
||||
The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed.
|
||||
**/
|
||||
static public function init(loop:Loop, ?domain:AddressFamily, recvmmsg:Bool = false):Result<Udp>;
|
||||
|
||||
/**
|
||||
Assigns an address to the UDP socket.
|
||||
**/
|
||||
public function bind(addr:SockAddr, ipv6Only:Bool = false, reuseAddr:Bool = false):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Assigns a peer address to the socket.
|
||||
**/
|
||||
public function connect(addr:SockAddr):Result<ConnectedUdp>;
|
||||
|
||||
/**
|
||||
Retrieves the address assigned to the UDP socket.
|
||||
**/
|
||||
public function getSockName():Result<SockAddr>;
|
||||
|
||||
/**
|
||||
Sets multicast group membership.
|
||||
**/
|
||||
public function setMembership(group:String, interfaceName:String, membership:UdpMembership):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Sets source-specific multicast group membership.
|
||||
**/
|
||||
public function setSourceMembership(group:String, interfaceName:String, source:String, membership:UdpMembership):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Set multicast loopback.
|
||||
**/
|
||||
public function setMulticastLoop(value:Bool):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Set multicast TTL.
|
||||
**/
|
||||
public function setMulticastTtl(value:Int):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Sets the interface to be used for multicast.
|
||||
**/
|
||||
public function setMulticastInterface(value:Int):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Sets broadcast.
|
||||
**/
|
||||
public function setBroadcast(value:Bool):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Sets the TTL.
|
||||
**/
|
||||
public function setTtl(value:Int):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Sends a datagram.
|
||||
|
||||
For connected UDP sockets, see `eval.luv.UDP.Connected.send`.
|
||||
**/
|
||||
public function send(data:Array<Buffer>, addr:SockAddr, callback:(result:Result<Result.NoData>)->Void):Void;
|
||||
|
||||
/**
|
||||
Like `eval.luv.UDP.send`, but only attempts to send the datagram immediately.
|
||||
**/
|
||||
public function trySend(data:Array<Buffer>, addr:SockAddr):Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Calls `callback` whenever a datagram is received on the UDP socket.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/UDP/index.html#val-recv_start
|
||||
**/
|
||||
public function recvStart(callback:(result:Result<{data:Buffer, addr:Option<SockAddr>, flags:Array<RecvFlag>}>, ?allocate:(size:Int)->Buffer)->Void):Void;
|
||||
|
||||
/**
|
||||
Stops the callback provided to `eval.luv.UDP.recvStart`.
|
||||
**/
|
||||
public function recvStop():Result<Result.NoData>;
|
||||
|
||||
/**
|
||||
Evaluates to true if and only if the UDP was created with `recvmmsg = true`
|
||||
and the platform supports recvmmsg(2).
|
||||
**/
|
||||
public function usingRecvmmsg():Bool;
|
||||
|
||||
/**
|
||||
Number of bytes queued for sending. This field strictly shows how much
|
||||
information is currently queued.
|
||||
**/
|
||||
public function getSendQueueSize():Int;
|
||||
|
||||
/**
|
||||
Number of send requests currently in the queue awaiting to be processed.
|
||||
**/
|
||||
public function getSendQueueCount():Int;
|
||||
}
|
44
Kha/Tools/linux_arm64/std/eval/luv/Version.hx
Normal file
44
Kha/Tools/linux_arm64/std/eval/luv/Version.hx
Normal file
@ -0,0 +1,44 @@
|
||||
package eval.luv;
|
||||
|
||||
/**
|
||||
Version information for the vendored libuv.
|
||||
|
||||
@see https://aantron.github.io/luv/luv/Luv/Version
|
||||
**/
|
||||
extern class Version {
|
||||
/**
|
||||
Returns the libuv version as a string.
|
||||
**/
|
||||
static function string():String;
|
||||
|
||||
/**
|
||||
libuv major version number.
|
||||
**/
|
||||
static final major:Int;
|
||||
|
||||
/**
|
||||
libuv minor version number.
|
||||
**/
|
||||
static final minor:Int;
|
||||
|
||||
/**
|
||||
libuv patch version number.
|
||||
**/
|
||||
static final patch:Int;
|
||||
|
||||
/**
|
||||
`true` if the libuv version is a release, and `false` if it is a development version.
|
||||
This does not depend on Haxe compilation arguments and will almost always be `true`.
|
||||
**/
|
||||
static final isRelease:Bool;
|
||||
|
||||
/**
|
||||
libuv version suffix for development releases.
|
||||
**/
|
||||
static final suffix:String;
|
||||
|
||||
/**
|
||||
libuv version packed into a single integer.
|
||||
**/
|
||||
static final hex:Int;
|
||||
}
|
Reference in New Issue
Block a user