@ai-ecoverse/slicc-kernel 1.147.3 → 1.147.5
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/dist/kernel-worker.js +46 -16
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +46 -16
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/dist/types/kernel/vfs-file.d.ts +3 -1
- package/dist/types/launcher.d.ts +2 -0
- package/package.json +1 -1
package/dist/kernel-worker.js
CHANGED
|
@@ -7785,7 +7785,7 @@ function satisfies(version, range2) {
|
|
|
7785
7785
|
}
|
|
7786
7786
|
|
|
7787
7787
|
// src/version.ts
|
|
7788
|
-
var KERNEL_VERSION = true ? "1.147.
|
|
7788
|
+
var KERNEL_VERSION = true ? "1.147.5" : "0.0.0-dev";
|
|
7789
7789
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7790
7790
|
function procVersion() {
|
|
7791
7791
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -22314,6 +22314,17 @@ var VfsNode = class {
|
|
|
22314
22314
|
this.queue = next3.catch(() => void 0);
|
|
22315
22315
|
return next3;
|
|
22316
22316
|
}
|
|
22317
|
+
named = 0;
|
|
22318
|
+
byName(op) {
|
|
22319
|
+
return this.serial(async () => {
|
|
22320
|
+
this.named++;
|
|
22321
|
+
try {
|
|
22322
|
+
return await op();
|
|
22323
|
+
} finally {
|
|
22324
|
+
this.named--;
|
|
22325
|
+
}
|
|
22326
|
+
});
|
|
22327
|
+
}
|
|
22317
22328
|
revoke() {
|
|
22318
22329
|
this.revoked = true;
|
|
22319
22330
|
clearTimeout(this.writeBack);
|
|
@@ -22321,7 +22332,7 @@ var VfsNode = class {
|
|
|
22321
22332
|
this.data = void 0;
|
|
22322
22333
|
this.ranged = void 0;
|
|
22323
22334
|
}
|
|
22324
|
-
async prepare() {
|
|
22335
|
+
async prepare(onFd = this.named === 0) {
|
|
22325
22336
|
if (this.revoked) throw new KernelError("EIO");
|
|
22326
22337
|
if (this.ranged || this.data) return this.ranged;
|
|
22327
22338
|
const io = rangedOps(this.fs);
|
|
@@ -22336,15 +22347,15 @@ var VfsNode = class {
|
|
|
22336
22347
|
this.ranged = new AsyncRangedFile(io, this.path, st.size ?? 0, st.version);
|
|
22337
22348
|
return this.ranged;
|
|
22338
22349
|
}
|
|
22339
|
-
await this.load();
|
|
22350
|
+
await this.load(onFd);
|
|
22340
22351
|
return void 0;
|
|
22341
22352
|
}
|
|
22342
22353
|
async keep() {
|
|
22343
|
-
const ranged2 = await this.prepare();
|
|
22344
|
-
if (ranged2) await this.followed(() => ranged2.pin());
|
|
22354
|
+
const ranged2 = await this.prepare(false);
|
|
22355
|
+
if (ranged2) await this.followed(() => ranged2.pin(), false);
|
|
22345
22356
|
}
|
|
22346
22357
|
moving = /* @__PURE__ */ new Set();
|
|
22347
|
-
async followed(op) {
|
|
22358
|
+
async followed(op, onFd = this.named === 0) {
|
|
22348
22359
|
for (; ; ) {
|
|
22349
22360
|
const at = this.path;
|
|
22350
22361
|
try {
|
|
@@ -22352,11 +22363,11 @@ var VfsNode = class {
|
|
|
22352
22363
|
} catch (err) {
|
|
22353
22364
|
if (!isMissing(err)) throw err;
|
|
22354
22365
|
while (this.moving.size > 0) await Promise.all(this.moving);
|
|
22355
|
-
if (this.path === at) throw err;
|
|
22366
|
+
if (this.path === at) throw onFd && !this.made ? new KernelError("EIO") : err;
|
|
22356
22367
|
}
|
|
22357
22368
|
}
|
|
22358
22369
|
}
|
|
22359
|
-
async load() {
|
|
22370
|
+
async load(onFd = this.named === 0) {
|
|
22360
22371
|
if (this.revoked) throw new KernelError("EIO");
|
|
22361
22372
|
while (!this.data) {
|
|
22362
22373
|
const at = this.path;
|
|
@@ -22366,7 +22377,7 @@ var VfsNode = class {
|
|
|
22366
22377
|
if (!isMissing(err)) throw err;
|
|
22367
22378
|
while (this.moving.size > 0) await Promise.all(this.moving);
|
|
22368
22379
|
if (this.path !== at) continue;
|
|
22369
|
-
if (!this.made) throw new KernelError("ENOENT");
|
|
22380
|
+
if (!this.made) throw new KernelError(onFd ? "EIO" : "ENOENT");
|
|
22370
22381
|
this.data = new Uint8Array(0);
|
|
22371
22382
|
this.missing = true;
|
|
22372
22383
|
}
|
|
@@ -22871,7 +22882,7 @@ function heldIo(fs, nodes, changed) {
|
|
|
22871
22882
|
const write = async (path, op, fallback) => {
|
|
22872
22883
|
const held = await node(path);
|
|
22873
22884
|
if (!held) return fallback();
|
|
22874
|
-
const out = await held.
|
|
22885
|
+
const out = await held.byName(async () => {
|
|
22875
22886
|
const done5 = await op(held);
|
|
22876
22887
|
await held.flush();
|
|
22877
22888
|
return done5;
|
|
@@ -22903,22 +22914,22 @@ function heldIo(fs, nodes, changed) {
|
|
|
22903
22914
|
async stat(path) {
|
|
22904
22915
|
const st = await fs.stat(path);
|
|
22905
22916
|
const held = st.isFile ? await node(path) : void 0;
|
|
22906
|
-
return held ? { ...st, size: await held.
|
|
22917
|
+
return held ? { ...st, size: await held.byName(() => held.size()) } : st;
|
|
22907
22918
|
},
|
|
22908
22919
|
async lstat(path) {
|
|
22909
22920
|
const st = await fs.lstat(path);
|
|
22910
22921
|
const held = st.isFile && !st.isSymbolicLink ? await node(path) : void 0;
|
|
22911
|
-
return held ? { ...st, size: await held.
|
|
22922
|
+
return held ? { ...st, size: await held.byName(() => held.size()) } : st;
|
|
22912
22923
|
},
|
|
22913
22924
|
async readFileBuffer(path) {
|
|
22914
22925
|
const held = await node(path);
|
|
22915
22926
|
if (!held) return fs.readFileBuffer(path);
|
|
22916
|
-
return held.
|
|
22927
|
+
return held.byName(async () => held.pread(await held.size(), 0));
|
|
22917
22928
|
},
|
|
22918
22929
|
...ranged2 ? {
|
|
22919
22930
|
pread: async (path, at, n, version) => {
|
|
22920
22931
|
const held = await node(path);
|
|
22921
|
-
return held ? held.
|
|
22932
|
+
return held ? held.byName(() => held.pread(n, at)) : ranged2.pread(path, at, n, version);
|
|
22922
22933
|
},
|
|
22923
22934
|
pwrite: (path, at, bytes, transfer) => write(
|
|
22924
22935
|
path,
|
|
@@ -22971,7 +22982,7 @@ function keepingOpen(fs, nodes, changed = () => {
|
|
|
22971
22982
|
const held = await heldAt(fs, nodes, at);
|
|
22972
22983
|
if (!held) return nodes.onEntry(at, () => fs.writeFile(path, content, owner));
|
|
22973
22984
|
const bytes = typeof content === "string" ? new TextEncoder().encode(content) : content;
|
|
22974
|
-
return held.
|
|
22985
|
+
return held.byName(async () => {
|
|
22975
22986
|
await held.truncate(0);
|
|
22976
22987
|
await held.pwrite(bytes, 0);
|
|
22977
22988
|
await held.flush();
|
|
@@ -30075,6 +30086,25 @@ var Launcher = class {
|
|
|
30075
30086
|
const optional = `${root}-names${beside.slice(root.length)}`;
|
|
30076
30087
|
return await this.base.exists(optional) ? optional : void 0;
|
|
30077
30088
|
}
|
|
30089
|
+
loaded(target, env, caller) {
|
|
30090
|
+
const read = () => this.program(target, env, caller);
|
|
30091
|
+
const id2 = () => this.exeId(target);
|
|
30092
|
+
return id2().then(
|
|
30093
|
+
(before) => read().then(
|
|
30094
|
+
(first) => id2().then(
|
|
30095
|
+
(after) => after.exeId === before.exeId ? [first, after] : this.reread(target, read).then(
|
|
30096
|
+
(again) => id2().then((last) => [again, last])
|
|
30097
|
+
)
|
|
30098
|
+
)
|
|
30099
|
+
)
|
|
30100
|
+
);
|
|
30101
|
+
}
|
|
30102
|
+
reread(target, read) {
|
|
30103
|
+
for (const key of this.compiled.keys()) {
|
|
30104
|
+
if (key.startsWith(`${target.wasm}:`)) this.compiled.delete(key);
|
|
30105
|
+
}
|
|
30106
|
+
return read();
|
|
30107
|
+
}
|
|
30078
30108
|
exeId(target) {
|
|
30079
30109
|
if (target.abi !== "wasi" || (target.copy ?? target.glue) !== target.wasm) {
|
|
30080
30110
|
return Promise.resolve({});
|
|
@@ -30137,7 +30167,7 @@ var Launcher = class {
|
|
|
30137
30167
|
try {
|
|
30138
30168
|
const caller = { pid: req.ppid ?? 0, uid: req.cred.euid, tag: req.tags?.[0] };
|
|
30139
30169
|
if (this.integrity) await this.checkedSources(planned, caller);
|
|
30140
|
-
[program, exeId] = await
|
|
30170
|
+
[program, exeId] = await this.loaded(target, env, caller);
|
|
30141
30171
|
if (readsEtcHostname(program)) setOrDrop(env, "HOSTNAME", own);
|
|
30142
30172
|
} catch (err) {
|
|
30143
30173
|
await req.fds.closeAll();
|