koffi 2.14.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -1
- package/README.md +1 -1
- package/build/koffi/darwin_arm64/koffi.node +0 -0
- package/build/koffi/darwin_x64/koffi.node +0 -0
- package/build/koffi/freebsd_arm64/koffi.node +0 -0
- package/build/koffi/freebsd_ia32/koffi.node +0 -0
- package/build/koffi/freebsd_x64/koffi.node +0 -0
- package/build/koffi/linux_arm64/koffi.node +0 -0
- package/build/koffi/linux_armhf/koffi.node +0 -0
- package/build/koffi/linux_ia32/koffi.node +0 -0
- package/build/koffi/linux_loong64/koffi.node +0 -0
- package/build/koffi/linux_riscv64d/koffi.node +0 -0
- package/build/koffi/linux_x64/koffi.node +0 -0
- package/build/koffi/musl_arm64/koffi.node +0 -0
- package/build/koffi/musl_x64/koffi.node +0 -0
- package/build/koffi/openbsd_ia32/koffi.node +0 -0
- package/build/koffi/openbsd_x64/koffi.node +0 -0
- package/build/koffi/win32_arm64/koffi.node +0 -0
- package/build/koffi/win32_ia32/koffi.node +0 -0
- package/build/koffi/win32_x64/koffi.node +0 -0
- package/doc/assets.ini +2 -1
- package/doc/build.sh +9 -0
- package/doc/pages/404.md +17 -0
- package/doc/pages/index.md +43 -4
- package/doc/pages/misc.md +16 -11
- package/doc/pages/platforms.md +8 -19
- package/doc/pages.ini +4 -7
- package/doc/static/highlight.js +2 -14
- package/doc/static/koffi.css +3 -15
- package/doc/static/perf_windows.png +0 -0
- package/doc/static/print.css +2 -14
- package/index.d.ts +29 -24
- package/index.js +10 -9
- package/indirect.js +10 -9
- package/{src/core → lib/native}/base/base.cc +1753 -1089
- package/{src/core → lib/native}/base/base.hh +868 -572
- package/{src/core → lib/native}/base/crc.inc +3 -21
- package/lib/native/base/crc_gen.py +72 -0
- package/{src/core → lib/native}/base/mimetypes.inc +2 -20
- package/{src/core → lib/native}/base/mimetypes_gen.py +2 -21
- package/lib/native/base/tower.cc +821 -0
- package/lib/native/base/tower.hh +81 -0
- package/{src/core → lib/native}/base/unicode.inc +3 -21
- package/{src/core → lib/native}/base/unicode_gen.py +5 -42
- package/package.json +3 -2
- package/src/cnoke/assets/FindCNoke.cmake +8 -20
- package/src/cnoke/assets/win_delay_hook.c +2 -20
- package/src/cnoke/cnoke.js +2 -21
- package/src/cnoke/src/builder.js +3 -22
- package/src/cnoke/src/index.js +2 -20
- package/src/cnoke/src/tools.js +2 -20
- package/src/koffi/CMakeLists.txt +19 -22
- package/src/koffi/cmake/raylib.cmake +5 -22
- package/src/koffi/cmake/sqlite3.cmake +2 -20
- package/src/koffi/src/abi_arm32.cc +31 -49
- package/src/koffi/src/abi_arm32_asm.S +2 -20
- package/src/koffi/src/abi_arm64.cc +36 -54
- package/src/koffi/src/abi_arm64_asm.S +2 -20
- package/src/koffi/src/abi_arm64_asm.asm +2 -20
- package/src/koffi/src/abi_loong64.cc +2 -20
- package/src/koffi/src/abi_loong64_asm.S +2 -20
- package/src/koffi/src/abi_riscv64.cc +34 -52
- package/src/koffi/src/abi_riscv64_asm.S +2 -20
- package/src/koffi/src/abi_x64_sysv.cc +36 -54
- package/src/koffi/src/abi_x64_sysv_asm.S +2 -20
- package/src/koffi/src/abi_x64_win.cc +32 -50
- package/src/koffi/src/abi_x64_win_asm.asm +2 -20
- package/src/koffi/src/abi_x86.cc +33 -51
- package/src/koffi/src/abi_x86_asm.S +2 -20
- package/src/koffi/src/abi_x86_asm.asm +2 -20
- package/src/koffi/src/call.cc +107 -281
- package/src/koffi/src/call.hh +9 -27
- package/src/koffi/src/errno.inc +2 -20
- package/src/koffi/src/ffi.cc +121 -121
- package/src/koffi/src/ffi.hh +23 -38
- package/src/koffi/src/init.js +2 -20
- package/src/koffi/src/parser.cc +15 -29
- package/src/koffi/src/parser.hh +4 -22
- package/src/koffi/src/trampolines/armasm.inc +0 -21
- package/src/koffi/src/trampolines/gnu.inc +0 -21
- package/src/koffi/src/trampolines/masm32.inc +0 -21
- package/src/koffi/src/trampolines/masm64.inc +0 -21
- package/src/koffi/src/trampolines/prototypes.inc +1 -22
- package/src/koffi/src/util.cc +87 -102
- package/src/koffi/src/util.hh +11 -29
- package/src/koffi/src/uv.cc +193 -0
- package/src/koffi/src/uv.def +10 -0
- package/src/koffi/src/uv.hh +40 -0
- package/src/koffi/src/win32.cc +7 -25
- package/src/koffi/src/win32.hh +4 -22
- package/vendor/node-api-headers/include/uv/aix.h +32 -0
- package/vendor/node-api-headers/include/uv/bsd.h +34 -0
- package/vendor/node-api-headers/include/uv/darwin.h +61 -0
- package/vendor/node-api-headers/include/uv/errno.h +483 -0
- package/vendor/node-api-headers/include/uv/linux.h +34 -0
- package/vendor/node-api-headers/include/uv/os390.h +33 -0
- package/vendor/node-api-headers/include/uv/posix.h +31 -0
- package/vendor/node-api-headers/include/uv/sunos.h +44 -0
- package/vendor/node-api-headers/include/uv/threadpool.h +37 -0
- package/vendor/node-api-headers/include/uv/tree.h +521 -0
- package/vendor/node-api-headers/include/uv/unix.h +512 -0
- package/vendor/node-api-headers/include/uv/version.h +43 -0
- package/vendor/node-api-headers/include/uv/win.h +698 -0
- package/vendor/node-api-headers/include/uv.h +1990 -0
- package/src/core/base/crc_gen.py +0 -109
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
#include "uv.hh"
|
|
4
|
+
#include "util.hh"
|
|
5
|
+
|
|
6
|
+
#include <uv.h>
|
|
7
|
+
|
|
8
|
+
namespace K {
|
|
9
|
+
|
|
10
|
+
Napi::Function PollHandle::Define(Napi::Env env)
|
|
11
|
+
{
|
|
12
|
+
return DefineClass(env, "PollHandle", {
|
|
13
|
+
InstanceMethod("start", &PollHandle::Start),
|
|
14
|
+
InstanceMethod("stop", &PollHandle::Stop),
|
|
15
|
+
InstanceMethod("close", &PollHandle::Close),
|
|
16
|
+
InstanceMethod("unref", &PollHandle::Unref),
|
|
17
|
+
InstanceMethod("ref", &PollHandle::Ref)
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
PollHandle::PollHandle(const Napi::CallbackInfo &info)
|
|
22
|
+
: Napi::ObjectWrap<PollHandle>(info), env(info.Env())
|
|
23
|
+
{
|
|
24
|
+
InstanceData *instance = env.GetInstanceData<InstanceData>();
|
|
25
|
+
|
|
26
|
+
if (info.Length() < 1 || !info[0].IsNumber()) {
|
|
27
|
+
ThrowError<Napi::Error>(env, "Expected 1 argument, got %1", info.Length());
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!info[0].IsNumber()) {
|
|
31
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for descriptor, expected number", GetValueType(instance, info[0]));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
int fd = info[0].As<Napi::Number>().Int32Value();
|
|
36
|
+
|
|
37
|
+
uv_loop_t *loop = nullptr;
|
|
38
|
+
if (napi_get_uv_event_loop(env, &loop) != napi_ok || !loop) {
|
|
39
|
+
ThrowError<Napi::Error>(env, "napi_get_uv_event_loop() failed");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// We would store it inside the class, but the definition of uv_poll_t involves windows.h...
|
|
44
|
+
// and we won't want that on Windows. Heap allocation it is!
|
|
45
|
+
// Also, it may have to outlive the object, because uv_close() is asynchronous.
|
|
46
|
+
handle = new uv_poll_t();
|
|
47
|
+
|
|
48
|
+
if (int ret = uv_poll_init_socket(loop, handle, (uv_os_sock_t)fd); ret != 0) {
|
|
49
|
+
ThrowError<Napi::Error>(env, "Failed to init UV poll: %1", uv_strerror(ret));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
handle->data = this;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
void PollHandle::Start(const Napi::CallbackInfo &info)
|
|
57
|
+
{
|
|
58
|
+
InstanceData *instance = env.GetInstanceData<InstanceData>();
|
|
59
|
+
|
|
60
|
+
bool has_opts = (info.Length() >= 2 && info[0].IsObject());
|
|
61
|
+
|
|
62
|
+
if (info.Length() < 1u + has_opts) {
|
|
63
|
+
ThrowError<Napi::TypeError>(env, "Expected 1 to 2 arguments, got %1", info.Length());
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!info[0u + has_opts].IsFunction()) {
|
|
67
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for callback, expected function", GetValueType(instance, info[0u + has_opts]));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
int events = 0;
|
|
72
|
+
Napi::Function cb = info[0 + has_opts].As<Napi::Function>();
|
|
73
|
+
|
|
74
|
+
if (has_opts) {
|
|
75
|
+
Napi::Object opts = has_opts ? info[0].As<Napi::Object>() : Napi::Object::New(env);
|
|
76
|
+
|
|
77
|
+
events |= opts.Get("readable").ToBoolean() ? UV_READABLE : 0;
|
|
78
|
+
events |= opts.Get("writable").ToBoolean() ? UV_WRITABLE : 0;
|
|
79
|
+
events |= opts.Get("disconnect").ToBoolean() ? UV_DISCONNECT : 0;
|
|
80
|
+
} else {
|
|
81
|
+
events = UV_READABLE;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
callback.Reset(cb, 1);
|
|
85
|
+
|
|
86
|
+
if (int ret = uv_poll_start(handle, events, &PollHandle::OnPoll); ret != 0) {
|
|
87
|
+
callback.Reset();
|
|
88
|
+
ThrowError<Napi::Error>(env, "Failed to start UV poll: %1", uv_strerror(ret));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void PollHandle::Stop(const Napi::CallbackInfo &)
|
|
93
|
+
{
|
|
94
|
+
uv_poll_stop(handle);
|
|
95
|
+
callback.Reset();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
void PollHandle::Close(const Napi::CallbackInfo &)
|
|
99
|
+
{
|
|
100
|
+
Close();
|
|
101
|
+
callback.Reset();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
void PollHandle::Ref(const Napi::CallbackInfo &)
|
|
105
|
+
{
|
|
106
|
+
uv_ref((uv_handle_t *)handle);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
void PollHandle::Unref(const Napi::CallbackInfo &)
|
|
110
|
+
{
|
|
111
|
+
uv_unref((uv_handle_t *)handle);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
void PollHandle::Close()
|
|
115
|
+
{
|
|
116
|
+
if (!handle)
|
|
117
|
+
return;
|
|
118
|
+
|
|
119
|
+
const auto release = [](uv_handle_t *ptr) {
|
|
120
|
+
uv_poll_t *handle = (uv_poll_t *)ptr;
|
|
121
|
+
delete handle;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
uv_poll_stop(handle);
|
|
125
|
+
uv_close((uv_handle_t *)handle, release);
|
|
126
|
+
|
|
127
|
+
handle = nullptr;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
void PollHandle::OnPoll(uv_poll_t *h, int status, int events)
|
|
131
|
+
{
|
|
132
|
+
PollHandle *poll = (PollHandle *)h->data;
|
|
133
|
+
|
|
134
|
+
if (poll->callback.IsEmpty()) [[unlikely]]
|
|
135
|
+
return;
|
|
136
|
+
|
|
137
|
+
Napi::Env env = poll->env;
|
|
138
|
+
Napi::HandleScope scope(env);
|
|
139
|
+
|
|
140
|
+
Napi::Object obj = Napi::Object::New(env);
|
|
141
|
+
|
|
142
|
+
obj.Set("readable", !!(events & UV_READABLE));
|
|
143
|
+
obj.Set("writable", !!(events & UV_WRITABLE));
|
|
144
|
+
obj.Set("disconnect", !!(events & UV_DISCONNECT));
|
|
145
|
+
|
|
146
|
+
napi_value args[] = { Napi::Number::New(env, status), obj };
|
|
147
|
+
poll->callback.Call(poll->Value(), K_LEN(args), args);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
Napi::Value Poll(const Napi::CallbackInfo &info)
|
|
151
|
+
{
|
|
152
|
+
Napi::Env env = info.Env();
|
|
153
|
+
InstanceData *instance = env.GetInstanceData<InstanceData>();
|
|
154
|
+
|
|
155
|
+
bool has_opts = (info.Length() >= 3 && info[1].IsObject());
|
|
156
|
+
|
|
157
|
+
if (info.Length() < 2u + has_opts) {
|
|
158
|
+
ThrowError<Napi::TypeError>(env, "Expected 2 to 3 arguments, got %1", info.Length());
|
|
159
|
+
return env.Null();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (!info[0].IsNumber()) {
|
|
163
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for descriptor, expected number", GetValueType(instance, info[0]));
|
|
164
|
+
return env.Null();
|
|
165
|
+
}
|
|
166
|
+
if (!info[1 + has_opts].IsFunction()) {
|
|
167
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for callback, expected function", GetValueType(instance, info[1 + has_opts]));
|
|
168
|
+
return env.Null();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
int fd = info[0].As<Napi::Number>().Int32Value();
|
|
172
|
+
|
|
173
|
+
Napi::Function ctor = PollHandle::Define(env);
|
|
174
|
+
Napi::Object inst = ctor.New({ Napi::Number::New(env, fd) });
|
|
175
|
+
Napi::Function start = inst.Get("start").As<Napi::Function>();
|
|
176
|
+
|
|
177
|
+
if (env.IsExceptionPending()) [[unlikely]]
|
|
178
|
+
return env.Null();
|
|
179
|
+
|
|
180
|
+
if (has_opts) {
|
|
181
|
+
Napi::Value opts = info[1];
|
|
182
|
+
Napi::Function cb = info[2].As<Napi::Function>();
|
|
183
|
+
|
|
184
|
+
start.Call(inst, { opts, cb });
|
|
185
|
+
} else {
|
|
186
|
+
Napi::Function cb = info[1].As<Napi::Function>();
|
|
187
|
+
start.Call(inst, { cb });
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return inst;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#include "lib/native/base/base.hh"
|
|
6
|
+
|
|
7
|
+
#include <napi.h>
|
|
8
|
+
|
|
9
|
+
struct uv_poll_s;
|
|
10
|
+
typedef struct uv_poll_s uv_poll_t;
|
|
11
|
+
|
|
12
|
+
namespace K {
|
|
13
|
+
|
|
14
|
+
class PollHandle: public Napi::ObjectWrap<PollHandle> {
|
|
15
|
+
Napi::Env env = nullptr;
|
|
16
|
+
|
|
17
|
+
uv_poll_t *handle = nullptr;
|
|
18
|
+
Napi::FunctionReference callback;
|
|
19
|
+
|
|
20
|
+
public:
|
|
21
|
+
static Napi::Function Define(Napi::Env env);
|
|
22
|
+
|
|
23
|
+
PollHandle(const Napi::CallbackInfo &info);
|
|
24
|
+
~PollHandle() { Close(); }
|
|
25
|
+
|
|
26
|
+
void Start(const Napi::CallbackInfo &info);
|
|
27
|
+
void Stop(const Napi::CallbackInfo &info);
|
|
28
|
+
void Close(const Napi::CallbackInfo &info);
|
|
29
|
+
void Ref(const Napi::CallbackInfo &info);
|
|
30
|
+
void Unref(const Napi::CallbackInfo &info);
|
|
31
|
+
|
|
32
|
+
private:
|
|
33
|
+
void Close();
|
|
34
|
+
|
|
35
|
+
static void OnPoll(uv_poll_t *handle, int status, int events);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
Napi::Value Poll(const Napi::CallbackInfo &info);
|
|
39
|
+
|
|
40
|
+
}
|
package/src/koffi/src/win32.cc
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
// this software and associated documentation files (the “Software”), to deal in
|
|
5
|
-
// the Software without restriction, including without limitation the rights to use,
|
|
6
|
-
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
|
-
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
8
|
-
// subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
// copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
|
14
|
-
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
15
|
-
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
16
|
-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
17
|
-
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
18
|
-
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
19
|
-
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
20
|
-
// OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// SPDX-FileCopyrightText: 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
21
3
|
|
|
22
4
|
#if defined(_WIN32)
|
|
23
5
|
|
|
@@ -34,7 +16,7 @@
|
|
|
34
16
|
#include <ntsecapi.h>
|
|
35
17
|
#include <processthreadsapi.h>
|
|
36
18
|
|
|
37
|
-
namespace
|
|
19
|
+
namespace K {
|
|
38
20
|
|
|
39
21
|
const HashMap<int, const char *> WindowsMachineNames = {
|
|
40
22
|
{ 0x184, "Alpha AXP, 32-bit" },
|
|
@@ -138,9 +120,9 @@ static int GetFileMachine(HANDLE h, bool check_dll)
|
|
|
138
120
|
PE_DOS_HEADER dos = {};
|
|
139
121
|
PE_NT_HEADERS nt = {};
|
|
140
122
|
|
|
141
|
-
if (!ReadAt(h, 0, &dos,
|
|
123
|
+
if (!ReadAt(h, 0, &dos, K_SIZE(dos)))
|
|
142
124
|
goto generic;
|
|
143
|
-
if (!ReadAt(h, dos.e_lfanew, &nt,
|
|
125
|
+
if (!ReadAt(h, dos.e_lfanew, &nt, K_SIZE(nt)))
|
|
144
126
|
goto generic;
|
|
145
127
|
|
|
146
128
|
if (dos.e_magic != 0x5A4D) // MZ
|
|
@@ -179,7 +161,7 @@ int GetSelfMachine()
|
|
|
179
161
|
LogError("Cannot open '%1': %2", filename, GetWin32ErrorString());
|
|
180
162
|
return -1;
|
|
181
163
|
}
|
|
182
|
-
|
|
164
|
+
K_DEFER { CloseHandle(h); };
|
|
183
165
|
|
|
184
166
|
return GetFileMachine(h, false);
|
|
185
167
|
}
|
|
@@ -193,7 +175,7 @@ int GetDllMachine(const wchar_t *filename)
|
|
|
193
175
|
LogError("Cannot open '%1': %2", filename, GetWin32ErrorString());
|
|
194
176
|
return -1;
|
|
195
177
|
}
|
|
196
|
-
|
|
178
|
+
K_DEFER { CloseHandle(h); };
|
|
197
179
|
|
|
198
180
|
return GetFileMachine(h, true);
|
|
199
181
|
}
|
package/src/koffi/src/win32.hh
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
// this software and associated documentation files (the “Software”), to deal in
|
|
5
|
-
// the Software without restriction, including without limitation the rights to use,
|
|
6
|
-
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
|
-
// Software, and to permit persons to whom the Software is furnished to do so,
|
|
8
|
-
// subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
// copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
|
14
|
-
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
15
|
-
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
16
|
-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
17
|
-
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
18
|
-
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
19
|
-
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
20
|
-
// OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// SPDX-FileCopyrightText: 2025 Niels Martignène <niels.martignene@protonmail.com>
|
|
21
3
|
|
|
22
4
|
#pragma once
|
|
23
5
|
|
|
24
|
-
#include "
|
|
6
|
+
#include "lib/native/base/base.hh"
|
|
25
7
|
|
|
26
8
|
#include <intrin.h>
|
|
27
9
|
#include <napi.h>
|
|
28
10
|
|
|
29
|
-
namespace
|
|
11
|
+
namespace K {
|
|
30
12
|
|
|
31
13
|
struct PE_DOS_HEADER {
|
|
32
14
|
uint16_t e_magic;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
2
|
+
*
|
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
* furnished to do so, subject to the following conditions:
|
|
9
|
+
*
|
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
|
11
|
+
* all copies or substantial portions of the Software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
19
|
+
* IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef UV_AIX_H
|
|
23
|
+
#define UV_AIX_H
|
|
24
|
+
|
|
25
|
+
#define UV_PLATFORM_LOOP_FIELDS \
|
|
26
|
+
int fs_fd; \
|
|
27
|
+
|
|
28
|
+
#define UV_PLATFORM_FS_EVENT_FIELDS \
|
|
29
|
+
uv__io_t event_watcher; \
|
|
30
|
+
char *dir_filename; \
|
|
31
|
+
|
|
32
|
+
#endif /* UV_AIX_H */
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
2
|
+
*
|
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
* furnished to do so, subject to the following conditions:
|
|
9
|
+
*
|
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
|
11
|
+
* all copies or substantial portions of the Software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
19
|
+
* IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef UV_BSD_H
|
|
23
|
+
#define UV_BSD_H
|
|
24
|
+
|
|
25
|
+
#define UV_PLATFORM_FS_EVENT_FIELDS \
|
|
26
|
+
uv__io_t event_watcher; \
|
|
27
|
+
|
|
28
|
+
#define UV_IO_PRIVATE_PLATFORM_FIELDS \
|
|
29
|
+
int rcount; \
|
|
30
|
+
int wcount; \
|
|
31
|
+
|
|
32
|
+
#define UV_HAVE_KQUEUE 1
|
|
33
|
+
|
|
34
|
+
#endif /* UV_BSD_H */
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
2
|
+
*
|
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
* furnished to do so, subject to the following conditions:
|
|
9
|
+
*
|
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
|
11
|
+
* all copies or substantial portions of the Software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
19
|
+
* IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef UV_DARWIN_H
|
|
23
|
+
#define UV_DARWIN_H
|
|
24
|
+
|
|
25
|
+
#if defined(__APPLE__) && defined(__MACH__)
|
|
26
|
+
# include <mach/mach.h>
|
|
27
|
+
# include <mach/task.h>
|
|
28
|
+
# include <mach/semaphore.h>
|
|
29
|
+
# include <TargetConditionals.h>
|
|
30
|
+
# define UV_PLATFORM_SEM_T semaphore_t
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
#define UV_IO_PRIVATE_PLATFORM_FIELDS \
|
|
34
|
+
int rcount; \
|
|
35
|
+
int wcount; \
|
|
36
|
+
|
|
37
|
+
#define UV_PLATFORM_LOOP_FIELDS \
|
|
38
|
+
uv_thread_t cf_thread; \
|
|
39
|
+
void* _cf_reserved; \
|
|
40
|
+
void* cf_state; \
|
|
41
|
+
uv_mutex_t cf_mutex; \
|
|
42
|
+
uv_sem_t cf_sem; \
|
|
43
|
+
struct uv__queue cf_signals; \
|
|
44
|
+
|
|
45
|
+
#define UV_PLATFORM_FS_EVENT_FIELDS \
|
|
46
|
+
uv__io_t event_watcher; \
|
|
47
|
+
char* realpath; \
|
|
48
|
+
int realpath_len; \
|
|
49
|
+
int cf_flags; \
|
|
50
|
+
uv_async_t* cf_cb; \
|
|
51
|
+
struct uv__queue cf_events; \
|
|
52
|
+
struct uv__queue cf_member; \
|
|
53
|
+
int cf_error; \
|
|
54
|
+
uv_mutex_t cf_mutex; \
|
|
55
|
+
|
|
56
|
+
#define UV_STREAM_PRIVATE_PLATFORM_FIELDS \
|
|
57
|
+
void* select; \
|
|
58
|
+
|
|
59
|
+
#define UV_HAVE_KQUEUE 1
|
|
60
|
+
|
|
61
|
+
#endif /* UV_DARWIN_H */
|