@ai-ecoverse/slicc-kernel 1.176.0 → 1.176.1
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/README.md +1 -1
- package/dist/kernel-worker.js +10 -4
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.cjs +84 -19
- package/dist/node-process-worker.cjs.map +3 -3
- package/dist/node-process-worker.js +84 -19
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +10 -4
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +84 -19
- package/dist/process-worker.js.map +3 -3
- package/dist/types/realm/live-vfs-fs.d.ts +5 -0
- package/package.json +3 -3
package/dist/process-worker.js
CHANGED
|
@@ -578,6 +578,9 @@ function normalizePath(path) {
|
|
|
578
578
|
}
|
|
579
579
|
return `/${parts.join("/")}`;
|
|
580
580
|
}
|
|
581
|
+
function resolvePath(base, path) {
|
|
582
|
+
return normalizePath(path.startsWith("/") ? path : `${base}/${path}`);
|
|
583
|
+
}
|
|
581
584
|
function inodeOf(path) {
|
|
582
585
|
let h1 = 3735928559;
|
|
583
586
|
let h2 = 1103547991;
|
|
@@ -2694,6 +2697,7 @@ function liveRoot(Fs, bridge) {
|
|
|
2694
2697
|
plugin.mounts.add(root.mount);
|
|
2695
2698
|
invalidateLiveVfs(Fs, plugin);
|
|
2696
2699
|
guardRenames(Fs);
|
|
2700
|
+
guardCreateParents(Fs, bridge);
|
|
2697
2701
|
guardKeptNodes(Fs, plugin.handled);
|
|
2698
2702
|
guardStaleNodes(Fs, plugin);
|
|
2699
2703
|
guardVanished(Fs);
|
|
@@ -2851,6 +2855,62 @@ function guardRenames(Fs) {
|
|
|
2851
2855
|
rename(from, to);
|
|
2852
2856
|
};
|
|
2853
2857
|
}
|
|
2858
|
+
function createParentRefreshCount() {
|
|
2859
|
+
return createParentRefresh;
|
|
2860
|
+
}
|
|
2861
|
+
function aboveOf(path) {
|
|
2862
|
+
const norm = path.replace(/\/+$/, "") || "/";
|
|
2863
|
+
if (norm === "/") return "/";
|
|
2864
|
+
const slash = norm.lastIndexOf("/");
|
|
2865
|
+
const parent = slash <= 0 ? "/" : norm.slice(0, slash);
|
|
2866
|
+
if (parent === "/") return "/";
|
|
2867
|
+
const above = parent.lastIndexOf("/");
|
|
2868
|
+
return above <= 0 ? "/" : parent.slice(0, above);
|
|
2869
|
+
}
|
|
2870
|
+
function absoluteCreatePath(Fs, path) {
|
|
2871
|
+
if (typeof path !== "string" || path.length === 0) return void 0;
|
|
2872
|
+
if (path.startsWith("/")) return normalizePath(path);
|
|
2873
|
+
const cwd = Fs.cwd?.();
|
|
2874
|
+
if (typeof cwd !== "string") return void 0;
|
|
2875
|
+
return resolvePath(cwd, path);
|
|
2876
|
+
}
|
|
2877
|
+
function refreshCreateParent(Fs, bridge, path) {
|
|
2878
|
+
const abs = absoluteCreatePath(Fs, path);
|
|
2879
|
+
if (abs === void 0) return;
|
|
2880
|
+
createParentRefresh++;
|
|
2881
|
+
try {
|
|
2882
|
+
bridge.readdir(aboveOf(abs));
|
|
2883
|
+
} catch {
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
function oncePastStaleParent(Fs, bridge, path, op) {
|
|
2887
|
+
try {
|
|
2888
|
+
return op();
|
|
2889
|
+
} catch (err) {
|
|
2890
|
+
if (err.errno !== wasiErrno("ENOENT")) throw err;
|
|
2891
|
+
refreshCreateParent(Fs, bridge, path);
|
|
2892
|
+
return op();
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
function guardCreateParents(Fs, bridge) {
|
|
2896
|
+
if (Fs.sliccCreateParent) return;
|
|
2897
|
+
Fs.sliccCreateParent = true;
|
|
2898
|
+
const mkdir = Fs.mkdir?.bind(Fs);
|
|
2899
|
+
if (mkdir) {
|
|
2900
|
+
Fs.mkdir = (path, mode) => oncePastStaleParent(Fs, bridge, path, () => mkdir(path, mode));
|
|
2901
|
+
}
|
|
2902
|
+
const symlink = Fs.symlink?.bind(Fs);
|
|
2903
|
+
if (symlink) {
|
|
2904
|
+
Fs.symlink = (target, path) => oncePastStaleParent(Fs, bridge, path, () => symlink(target, path));
|
|
2905
|
+
}
|
|
2906
|
+
const open = Fs.open?.bind(Fs);
|
|
2907
|
+
if (open) {
|
|
2908
|
+
Fs.open = (path, flags, mode) => {
|
|
2909
|
+
if ((flags & O_CREAT) === 0) return open(path, flags, mode);
|
|
2910
|
+
return oncePastStaleParent(Fs, bridge, path, () => open(path, flags, mode));
|
|
2911
|
+
};
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2854
2914
|
function idOf(value2) {
|
|
2855
2915
|
return value2 === -1 || value2 === 4294967295 ? void 0 : value2 >>> 0;
|
|
2856
2916
|
}
|
|
@@ -2955,7 +3015,7 @@ function readingLinks(Fs) {
|
|
|
2955
3015
|
}
|
|
2956
3016
|
};
|
|
2957
3017
|
}
|
|
2958
|
-
var S_IFDIR, S_IFREG, S_IFLNK, S_IFSOCK, S_IFIFO, S_IFMT, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR, SEEK_END, EARLY_WHOLE_FILE, O_APPEND, O_ACCMODE, O_TRUNC, O_PATH, stale, opening, O_NOFOLLOW, RESOLVING;
|
|
3018
|
+
var S_IFDIR, S_IFREG, S_IFLNK, S_IFSOCK, S_IFIFO, S_IFMT, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR, SEEK_END, EARLY_WHOLE_FILE, O_APPEND, O_ACCMODE, O_TRUNC, O_PATH, stale, opening, O_NOFOLLOW, RESOLVING, O_CREAT, createParentRefresh;
|
|
2959
3019
|
var init_live_vfs_fs = __esm({
|
|
2960
3020
|
"src/realm/live-vfs-fs.ts"() {
|
|
2961
3021
|
"use strict";
|
|
@@ -2995,6 +3055,8 @@ var init_live_vfs_fs = __esm({
|
|
|
2995
3055
|
["readlink", () => false],
|
|
2996
3056
|
["truncate", () => true]
|
|
2997
3057
|
];
|
|
3058
|
+
O_CREAT = 64;
|
|
3059
|
+
createParentRefresh = 0;
|
|
2998
3060
|
}
|
|
2999
3061
|
});
|
|
3000
3062
|
|
|
@@ -3118,7 +3180,7 @@ var init_version = __esm({
|
|
|
3118
3180
|
"src/version.ts"() {
|
|
3119
3181
|
"use strict";
|
|
3120
3182
|
init_captured_globals();
|
|
3121
|
-
KERNEL_VERSION = true ? "1.176.
|
|
3183
|
+
KERNEL_VERSION = true ? "1.176.1" : "0.0.0-dev";
|
|
3122
3184
|
OS_RELEASE = "6.0.0-slicc";
|
|
3123
3185
|
}
|
|
3124
3186
|
});
|
|
@@ -3484,7 +3546,7 @@ function kernelUmask(imports, deps) {
|
|
|
3484
3546
|
const { glue } = deps;
|
|
3485
3547
|
wrapImport(imports, "openat", glue, (openat) => (dirfd, path, flags, varargs) => {
|
|
3486
3548
|
const memory = deps.memory();
|
|
3487
|
-
if (flags &
|
|
3549
|
+
if (flags & O_CREAT2 && varargs && memory) new capturedInt32Array(memory.buffer)[varargs >> 2] &= ~umask;
|
|
3488
3550
|
return openat(dirfd, path, flags, varargs);
|
|
3489
3551
|
});
|
|
3490
3552
|
wrapImport(
|
|
@@ -3919,7 +3981,7 @@ function useMounts(Fs, env = {}, live = false) {
|
|
|
3919
3981
|
const seed = (path, text) => {
|
|
3920
3982
|
let stream;
|
|
3921
3983
|
try {
|
|
3922
|
-
stream = open(path, O_WRONLY2 |
|
|
3984
|
+
stream = open(path, O_WRONLY2 | O_CREAT2 | O_EXCL, 420);
|
|
3923
3985
|
} catch {
|
|
3924
3986
|
return;
|
|
3925
3987
|
}
|
|
@@ -3933,8 +3995,8 @@ function useMounts(Fs, env = {}, live = false) {
|
|
|
3933
3995
|
Fs.open = (path, flags, mode) => {
|
|
3934
3996
|
const instead = backing[path];
|
|
3935
3997
|
const text = defaults[path];
|
|
3936
|
-
if (text !== void 0 && (flags & (O_ACCMODE3 |
|
|
3937
|
-
if (!instead || (flags & (O_ACCMODE3 |
|
|
3998
|
+
if (text !== void 0 && (flags & (O_ACCMODE3 | O_CREAT2)) !== 0) seed(path, text);
|
|
3999
|
+
if (!instead || (flags & (O_ACCMODE3 | O_CREAT2)) !== 0) return open(path, flags, mode);
|
|
3938
4000
|
try {
|
|
3939
4001
|
return open(path, flags, mode);
|
|
3940
4002
|
} catch (e) {
|
|
@@ -4051,7 +4113,7 @@ function devCreations(imports, fs, memory, glue) {
|
|
|
4051
4113
|
imports,
|
|
4052
4114
|
"openat",
|
|
4053
4115
|
glue,
|
|
4054
|
-
(own) => (dirfd, path, flags, varargs) => flags &
|
|
4116
|
+
(own) => (dirfd, path, flags, varargs) => flags & O_CREAT2 && check(dirfd, path) || own(dirfd, path, flags, varargs),
|
|
4055
4117
|
true
|
|
4056
4118
|
);
|
|
4057
4119
|
wrapImport(
|
|
@@ -4127,7 +4189,7 @@ function linuxDevices(Fs, owners = true) {
|
|
|
4127
4189
|
}
|
|
4128
4190
|
}
|
|
4129
4191
|
}
|
|
4130
|
-
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY2, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_TRUNC2, S_IFMT_BITS, S_IFIFO_BITS, REFUSED, OWN_ERRORS, O_ACCMODE3,
|
|
4192
|
+
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY2, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_TRUNC2, S_IFMT_BITS, S_IFIFO_BITS, REFUSED, OWN_ERRORS, O_ACCMODE3, O_CREAT2, O_EXCL, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, CHAR_DEVICES, DEVICE_MODES;
|
|
4131
4193
|
var init_process_fds = __esm({
|
|
4132
4194
|
"src/process/process-fds.ts"() {
|
|
4133
4195
|
"use strict";
|
|
@@ -4194,7 +4256,7 @@ var init_process_fds = __esm({
|
|
|
4194
4256
|
REFUSED = new capturedSet([wasiErrno("EACCES"), wasiErrno("EPERM")]);
|
|
4195
4257
|
OWN_ERRORS = 128 | 131072;
|
|
4196
4258
|
O_ACCMODE3 = 3;
|
|
4197
|
-
|
|
4259
|
+
O_CREAT2 = 64;
|
|
4198
4260
|
O_EXCL = 128;
|
|
4199
4261
|
field = (text) => (text || "none").replace(/[\s\\]/g, (c) => `\\${c.charCodeAt(0).toString(8).padStart(3, "0")}`);
|
|
4200
4262
|
rootKind = () => capturedGlobalThis.navigator?.storage ? "opfs" : "memory";
|
|
@@ -4354,7 +4416,7 @@ function datesOf(real) {
|
|
|
4354
4416
|
dates[key] = new capturedDate(value2);
|
|
4355
4417
|
return dates;
|
|
4356
4418
|
}
|
|
4357
|
-
var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, TCSETSF, O_NONBLOCK, SOCKET_MODE, PTY_PATH, TTY_PATH, PTS_MAJOR, TTY_NAME, SEALED_PATH, STRERROR, CLIPBOARD_PATH, EMBEDDER_PATH, DEVICE_INO,
|
|
4419
|
+
var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, TCSETSF, O_NONBLOCK, SOCKET_MODE, PTY_PATH, TTY_PATH, PTS_MAJOR, TTY_NAME, SEALED_PATH, STRERROR, CLIPBOARD_PATH, EMBEDDER_PATH, DEVICE_INO, O_CREAT3, O_EXCL2, O_NOCTTY, O_TRUNC3, O_DIRECTORY, KILLED_BY_SIGPIPE, ProcessExit, SyscallError, KernelStreams;
|
|
4358
4420
|
var init_kernel_streams = __esm({
|
|
4359
4421
|
"src/process/kernel-streams.ts"() {
|
|
4360
4422
|
"use strict";
|
|
@@ -4387,7 +4449,7 @@ var init_kernel_streams = __esm({
|
|
|
4387
4449
|
CLIPBOARD_PATH = "/dev/clipboard";
|
|
4388
4450
|
EMBEDDER_PATH = "/dev/embedder";
|
|
4389
4451
|
DEVICE_INO = { 250: 1, 251: 2, 252: 3 };
|
|
4390
|
-
|
|
4452
|
+
O_CREAT3 = 64;
|
|
4391
4453
|
O_EXCL2 = 128;
|
|
4392
4454
|
O_NOCTTY = 256;
|
|
4393
4455
|
O_TRUNC3 = 512;
|
|
@@ -4771,7 +4833,7 @@ var init_kernel_streams = __esm({
|
|
|
4771
4833
|
}
|
|
4772
4834
|
}
|
|
4773
4835
|
refuseExclusiveLink(path, flags) {
|
|
4774
|
-
if ((flags & (
|
|
4836
|
+
if ((flags & (O_CREAT3 | O_EXCL2)) !== (O_CREAT3 | O_EXCL2)) return;
|
|
4775
4837
|
let mode = 0;
|
|
4776
4838
|
try {
|
|
4777
4839
|
mode = this.Fs.stat?.(path, true)?.mode ?? 0;
|
|
@@ -4814,7 +4876,7 @@ var init_kernel_streams = __esm({
|
|
|
4814
4876
|
vessel(open, kfd, at, terminal) {
|
|
4815
4877
|
let stream;
|
|
4816
4878
|
try {
|
|
4817
|
-
stream = open("/dev/null", at.flags & ~(
|
|
4879
|
+
stream = open("/dev/null", at.flags & ~(O_CREAT3 | O_EXCL2 | O_TRUNC3), at.mode);
|
|
4818
4880
|
} catch (e) {
|
|
4819
4881
|
this.sys.close(kfd);
|
|
4820
4882
|
throw e;
|
|
@@ -5132,7 +5194,7 @@ function placeholder(Fs, streams2, entry) {
|
|
|
5132
5194
|
if (entry.kind === "tty") return Fs.open("/dev/tty", O_RDWR);
|
|
5133
5195
|
if (entry.kind === "stream" || DEVICE_KINDS.has(entry.kind)) return Fs.open("/dev/null", access);
|
|
5134
5196
|
Fs.mkdirTree(PLACEHOLDER_DIR);
|
|
5135
|
-
return Fs.open(`${PLACEHOLDER_DIR}/${entry.fd}`, access |
|
|
5197
|
+
return Fs.open(`${PLACEHOLDER_DIR}/${entry.fd}`, access | O_CREAT4);
|
|
5136
5198
|
}
|
|
5137
5199
|
function asFifo(stream, streams2, identity) {
|
|
5138
5200
|
const inos = streamInos.get(streams2) ?? new capturedMap();
|
|
@@ -5174,7 +5236,7 @@ function restoreForkedStreams(Fs, streams2, table) {
|
|
|
5174
5236
|
} else {
|
|
5175
5237
|
const placed = place(
|
|
5176
5238
|
Fs,
|
|
5177
|
-
Fs.open(entry.path, entry.flags & ~(
|
|
5239
|
+
Fs.open(entry.path, entry.flags & ~(O_CREAT4 | O_EXCL3 | O_TRUNC4)),
|
|
5178
5240
|
entry.fd
|
|
5179
5241
|
);
|
|
5180
5242
|
setCloseOnExec(placed, (entry.flags & O_CLOEXEC) !== 0);
|
|
@@ -5183,7 +5245,7 @@ function restoreForkedStreams(Fs, streams2, table) {
|
|
|
5183
5245
|
}
|
|
5184
5246
|
}
|
|
5185
5247
|
}
|
|
5186
|
-
var O_RDWR, O_ACCMODE4,
|
|
5248
|
+
var O_RDWR, O_ACCMODE4, O_CREAT4, O_EXCL3, O_TRUNC4, PLACEHOLDER_DIR, NAMED_DEVICES, DEVICE_KINDS, ACCESS, DEVICES, FIFO_MODE, nextStreamIno, streamInos;
|
|
5187
5249
|
var init_process_fork = __esm({
|
|
5188
5250
|
"src/process/process-fork.ts"() {
|
|
5189
5251
|
"use strict";
|
|
@@ -5191,7 +5253,7 @@ var init_process_fork = __esm({
|
|
|
5191
5253
|
init_process_fds();
|
|
5192
5254
|
O_RDWR = 2;
|
|
5193
5255
|
O_ACCMODE4 = 3;
|
|
5194
|
-
|
|
5256
|
+
O_CREAT4 = 64;
|
|
5195
5257
|
O_EXCL3 = 128;
|
|
5196
5258
|
O_TRUNC4 = 512;
|
|
5197
5259
|
PLACEHOLDER_DIR = "/dev/slicc-fd";
|
|
@@ -6255,6 +6317,7 @@ var init_procfs = __esm({
|
|
|
6255
6317
|
init_captured_globals();
|
|
6256
6318
|
init_cred();
|
|
6257
6319
|
init_proc_info();
|
|
6320
|
+
init_live_vfs_fs();
|
|
6258
6321
|
init_version();
|
|
6259
6322
|
init_process_fds();
|
|
6260
6323
|
HZ = 100;
|
|
@@ -6283,6 +6346,8 @@ var init_procfs = __esm({
|
|
|
6283
6346
|
slicc_opfs_calls: (listing2) => `${listing2.opfsCalls ?? 0}
|
|
6284
6347
|
`,
|
|
6285
6348
|
slicc_opfs_ops: (listing2) => `${listing2.opfsOps ?? 0}
|
|
6349
|
+
`,
|
|
6350
|
+
slicc_create_parent_refresh: (_listing) => `${createParentRefreshCount()}
|
|
6286
6351
|
`,
|
|
6287
6352
|
slicc_meta_transactions: ({ meta }) => `${meta?.reads ?? 0} ${meta?.writes ?? 0}
|
|
6288
6353
|
`,
|
|
@@ -18814,7 +18879,7 @@ function signalNumber(signal) {
|
|
|
18814
18879
|
}
|
|
18815
18880
|
return SIG[name2];
|
|
18816
18881
|
}
|
|
18817
|
-
function
|
|
18882
|
+
function resolvePath2(cwd, path) {
|
|
18818
18883
|
const parts = [];
|
|
18819
18884
|
for (const part of (path.startsWith("/") ? path : `${cwd}/${path}`).split("/")) {
|
|
18820
18885
|
if (part === "" || part === ".") continue;
|
|
@@ -19146,7 +19211,7 @@ function createContext(o) {
|
|
|
19146
19211
|
const pending = new capturedSet();
|
|
19147
19212
|
const random = o.random ?? cryptoRandom;
|
|
19148
19213
|
let held2;
|
|
19149
|
-
const resolve = (path) =>
|
|
19214
|
+
const resolve = (path) => resolvePath2(cwdFor(o.cwd, held2, path), path);
|
|
19150
19215
|
const tryDev = (abs) => resolveDevAsync(kernel, abs);
|
|
19151
19216
|
const clean = cleanOf(o.changes);
|
|
19152
19217
|
let exiting;
|