@ai-ecoverse/slicc-kernel 1.189.1 → 1.189.2
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/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +53 -7
- package/dist/cloudflare.js.map +3 -3
- package/dist/kernel-worker.js +45 -4
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +45 -4
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/dist/types/cloudflare/images.d.ts +2 -0
- package/dist/types/launcher.d.ts +8 -0
- package/dist/types/mount/mount-fs.d.ts +1 -0
- package/package.json +1 -1
package/dist/cloudflare.js
CHANGED
|
@@ -4821,7 +4821,7 @@ function satisfies(version, range2) {
|
|
|
4821
4821
|
}
|
|
4822
4822
|
|
|
4823
4823
|
// src/version.ts
|
|
4824
|
-
var KERNEL_VERSION = true ? "1.189.
|
|
4824
|
+
var KERNEL_VERSION = true ? "1.189.2" : "0.0.0-dev";
|
|
4825
4825
|
var OS_RELEASE = "6.0.0-slicc";
|
|
4826
4826
|
function procVersion() {
|
|
4827
4827
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -12125,6 +12125,10 @@ var MountTable = class {
|
|
|
12125
12125
|
for (const mount of this.mounts.values()) if (within5(mount.target, path)) return true;
|
|
12126
12126
|
return false;
|
|
12127
12127
|
}
|
|
12128
|
+
readOnlyAt(path) {
|
|
12129
|
+
const found = this.locate(path);
|
|
12130
|
+
return found !== void 0 && readonly(found.mount);
|
|
12131
|
+
}
|
|
12128
12132
|
locate(path) {
|
|
12129
12133
|
let best;
|
|
12130
12134
|
for (const mount of this.mounts.values()) {
|
|
@@ -34918,6 +34922,8 @@ var Launcher = class {
|
|
|
34918
34922
|
tagBases = /* @__PURE__ */ new Map();
|
|
34919
34923
|
links = /* @__PURE__ */ new Map();
|
|
34920
34924
|
freshModules = new FreshModules();
|
|
34925
|
+
imagePaths = /* @__PURE__ */ new WeakMap();
|
|
34926
|
+
imageHolds = /* @__PURE__ */ new Map();
|
|
34921
34927
|
granted = /* @__PURE__ */ new Map();
|
|
34922
34928
|
users;
|
|
34923
34929
|
sudoer;
|
|
@@ -35907,7 +35913,7 @@ var Launcher = class {
|
|
|
35907
35913
|
const pin = await this.pinOf(path, caller);
|
|
35908
35914
|
const sum = Object.values(pin)[0];
|
|
35909
35915
|
const key = sum === void 0 ? await this.cacheKey(path, asked) : `${path}:sha256:${sum}`;
|
|
35910
|
-
|
|
35916
|
+
const loaded = this.cached(this.compiled, key, async () => {
|
|
35911
35917
|
const { bytes: read, key: readKey } = await this.keyed(path, caller, asked);
|
|
35912
35918
|
const bytes = sum === void 0 ? read : await this.pinnedBytes(pin, read);
|
|
35913
35919
|
const memory = importedMemory(bytes);
|
|
@@ -35921,6 +35927,9 @@ var Launcher = class {
|
|
|
35921
35927
|
key: sum === void 0 ? readKey : key
|
|
35922
35928
|
};
|
|
35923
35929
|
});
|
|
35930
|
+
const value2 = await loaded;
|
|
35931
|
+
this.imagePaths.set(value2.module, path);
|
|
35932
|
+
return value2;
|
|
35924
35933
|
}
|
|
35925
35934
|
async checkedSources(planned, caller) {
|
|
35926
35935
|
const { target } = planned;
|
|
@@ -36038,7 +36047,39 @@ var Launcher = class {
|
|
|
36038
36047
|
return {
|
|
36039
36048
|
path,
|
|
36040
36049
|
read: () => this.base.readFileBuffer(path),
|
|
36041
|
-
stale: () => this.forgetCompiled(path)
|
|
36050
|
+
stale: () => this.forgetCompiled(path),
|
|
36051
|
+
kept: () => this.keptCopies(path).map((at) => ({ path: at, read: () => this.base.readFileBuffer(at) }))
|
|
36052
|
+
};
|
|
36053
|
+
}
|
|
36054
|
+
keptCopies(path) {
|
|
36055
|
+
const out = /* @__PURE__ */ new Set();
|
|
36056
|
+
for (const hold of this.imageHolds.get(path) ?? []) {
|
|
36057
|
+
for (const key of hold.holds.held()) out.add(hold.holds.keptAt(key)?.hidden ?? key);
|
|
36058
|
+
}
|
|
36059
|
+
out.delete(path);
|
|
36060
|
+
return [...out];
|
|
36061
|
+
}
|
|
36062
|
+
holdImage(program) {
|
|
36063
|
+
const module = program.abi === "js" ? void 0 : program.module;
|
|
36064
|
+
const path = this.compile && module ? this.imagePaths.get(module) : void 0;
|
|
36065
|
+
if (!module || path === void 0 || this.mounts.readOnlyAt(path)) return (status) => status;
|
|
36066
|
+
const holds3 = this.imageHolds.get(path) ?? /* @__PURE__ */ new Set();
|
|
36067
|
+
this.imageHolds.set(path, holds3);
|
|
36068
|
+
let hold = [...holds3].find((known) => known.module === module);
|
|
36069
|
+
if (!hold) {
|
|
36070
|
+
hold = { module, holds: new HeldPaths(), users: 0 };
|
|
36071
|
+
hold.holds.hold(path, true, true);
|
|
36072
|
+
holds3.add(hold);
|
|
36073
|
+
this.held.add(hold.holds);
|
|
36074
|
+
}
|
|
36075
|
+
const mine = hold;
|
|
36076
|
+
mine.users++;
|
|
36077
|
+
return (status) => {
|
|
36078
|
+
if (--mine.users > 0) return status;
|
|
36079
|
+
holds3.delete(mine);
|
|
36080
|
+
if (holds3.size === 0 && this.imageHolds.get(path) === holds3) this.imageHolds.delete(path);
|
|
36081
|
+
this.held.delete(mine.holds);
|
|
36082
|
+
return status;
|
|
36042
36083
|
};
|
|
36043
36084
|
}
|
|
36044
36085
|
exeId(target) {
|
|
@@ -36450,7 +36491,7 @@ var Launcher = class {
|
|
|
36450
36491
|
handle.onState(
|
|
36451
36492
|
(state) => state === "stopped" ? this.stopped.add(pid) : this.stopped.delete(pid)
|
|
36452
36493
|
);
|
|
36453
|
-
void handle.exited.then((status) => {
|
|
36494
|
+
void handle.exited.then(this.holdImage(req.program)).then((status) => {
|
|
36454
36495
|
this.traceEnded(pid, handle, status);
|
|
36455
36496
|
this.cwds.release(this.cwdSlots.get(pid));
|
|
36456
36497
|
this.cwdSlots.delete(pid);
|
|
@@ -39132,11 +39173,13 @@ var Images = class {
|
|
|
39132
39173
|
async read(image, entry) {
|
|
39133
39174
|
let failed4;
|
|
39134
39175
|
for (const source of [...entry.sources.values()]) {
|
|
39176
|
+
for (const kept of source.kept?.() ?? []) {
|
|
39177
|
+
const bytes = await kept.read().catch(() => void 0);
|
|
39178
|
+
if (bytes && await this.matches(bytes, entry, image)) return bufferOf2(bytes);
|
|
39179
|
+
}
|
|
39135
39180
|
try {
|
|
39136
39181
|
const bytes = await source.read();
|
|
39137
|
-
if (bytes
|
|
39138
|
-
return bufferOf2(bytes);
|
|
39139
|
-
}
|
|
39182
|
+
if (await this.matches(bytes, entry, image)) return bufferOf2(bytes);
|
|
39140
39183
|
failed4 ??= new ImageError("ESTALE", `${source.path} changed since the kernel compiled it`);
|
|
39141
39184
|
} catch (err) {
|
|
39142
39185
|
failed4 ??= unread(source.path, err);
|
|
@@ -39146,6 +39189,9 @@ var Images = class {
|
|
|
39146
39189
|
}
|
|
39147
39190
|
throw failed4 ?? new ImageError("ENOENT", `no file holds program image ${image}`);
|
|
39148
39191
|
}
|
|
39192
|
+
async matches(bytes, entry, image) {
|
|
39193
|
+
return bytes.byteLength === entry.module && await digest(bytes) === image;
|
|
39194
|
+
}
|
|
39149
39195
|
get(image) {
|
|
39150
39196
|
const bytes = this.images.get(image)?.bytes;
|
|
39151
39197
|
if (!bytes) throw new Error(`no program image ${image} kept in memory: load() reads it`);
|