@ai-ecoverse/slicc-kernel 1.61.1 → 1.62.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/README.md +20 -6
- package/dist/index.js +15 -12
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +616 -260
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-process-worker.js +40 -5
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +714 -358
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +40 -5
- package/dist/process-worker.js.map +2 -2
- package/package.json +2 -2
package/dist/process-worker.js
CHANGED
|
@@ -5661,9 +5661,34 @@ var init_wasi_fds = __esm({
|
|
|
5661
5661
|
}
|
|
5662
5662
|
if (!s && !(oflags & OFLAGS.CREAT)) throw new WasiError("ENOENT");
|
|
5663
5663
|
refuseWrite(s, oflags, rights);
|
|
5664
|
-
|
|
5664
|
+
return this.regular(path, s, oflags, rights, fdflags);
|
|
5665
|
+
}
|
|
5666
|
+
regular(path, s, oflags, rights, fdflags) {
|
|
5667
|
+
if (this.shared || this.kernelHolds(path, s)) {
|
|
5668
|
+
return this.kernelFile(path, s, oflags, rights, fdflags);
|
|
5669
|
+
}
|
|
5665
5670
|
return this.install({ type: "file", file: this.file(path, s, oflags, rights, fdflags) });
|
|
5666
5671
|
}
|
|
5672
|
+
kernelHolds(path, st) {
|
|
5673
|
+
for (const [fd, e] of this.table) {
|
|
5674
|
+
if (e.type !== "kernel" || this.kind(fd, e) !== "file") continue;
|
|
5675
|
+
this.named(fd, e);
|
|
5676
|
+
if (e.path === path || st?.ino !== void 0 && e.ino === st.ino) return true;
|
|
5677
|
+
}
|
|
5678
|
+
return false;
|
|
5679
|
+
}
|
|
5680
|
+
learned = /* @__PURE__ */ new WeakSet();
|
|
5681
|
+
named(fd, e) {
|
|
5682
|
+
if (e.path !== void 0 || this.learned.has(e)) return;
|
|
5683
|
+
this.learned.add(e);
|
|
5684
|
+
try {
|
|
5685
|
+
const vfs = this.kernel.call({ op: "fd-vfs-stat", fd });
|
|
5686
|
+
if (vfs.orphan || vfs.path === void 0) return;
|
|
5687
|
+
e.path = vfs.path;
|
|
5688
|
+
e.ino = this.inoOf(vfs.path);
|
|
5689
|
+
} catch {
|
|
5690
|
+
}
|
|
5691
|
+
}
|
|
5667
5692
|
file(path, existing, oflags, rights, fdflags) {
|
|
5668
5693
|
const { readable: readable2, writable: writable2 } = openAccess(existing, oflags, rights);
|
|
5669
5694
|
let buffer = this.buffers.get(path);
|
|
@@ -7155,6 +7180,12 @@ function importsContext({
|
|
|
7155
7180
|
if (path === void 0) throw new WasiError("EBADF");
|
|
7156
7181
|
return path;
|
|
7157
7182
|
};
|
|
7183
|
+
const owners = fs.owners === true;
|
|
7184
|
+
const live = () => {
|
|
7185
|
+
if (!owners) return { uid: UID2, gid: UID2 };
|
|
7186
|
+
const cred = call2({ op: "proc-cred" });
|
|
7187
|
+
return { uid: cred.euid, gid: cred.egid };
|
|
7188
|
+
};
|
|
7158
7189
|
const fds = {
|
|
7159
7190
|
open(path, o = {}) {
|
|
7160
7191
|
const abs = host.fds.resolve(3, path);
|
|
@@ -7175,7 +7206,7 @@ function importsContext({
|
|
|
7175
7206
|
const path = pathOf(fd);
|
|
7176
7207
|
if (path === void 0) {
|
|
7177
7208
|
const kind = e.type === "device" ? "device" : "stream";
|
|
7178
|
-
return { kind, mode: kind === "device" ? 8630 : 4480,
|
|
7209
|
+
return { kind, mode: kind === "device" ? 8630 : 4480, ...live(), size: 0 };
|
|
7179
7210
|
}
|
|
7180
7211
|
host.fds.flushPath(path);
|
|
7181
7212
|
const s = fs.stat(path);
|
|
@@ -7183,8 +7214,7 @@ function importsContext({
|
|
|
7183
7214
|
kind: s.isDirectory ? "dir" : "file",
|
|
7184
7215
|
path,
|
|
7185
7216
|
mode: s.mode ?? (s.isDirectory ? 16877 : 33188),
|
|
7186
|
-
uid:
|
|
7187
|
-
gid: UID2,
|
|
7217
|
+
...s.uid !== void 0 && s.gid !== void 0 ? { uid: s.uid, gid: s.gid } : live(),
|
|
7188
7218
|
size: s.size,
|
|
7189
7219
|
...s.ino !== void 0 ? { ino: s.ino } : {},
|
|
7190
7220
|
...s.mtimeMs !== void 0 ? { mtimeMs: s.mtimeMs } : {}
|
|
@@ -7207,7 +7237,7 @@ function importsContext({
|
|
|
7207
7237
|
call2({ op: "unlock", path: requirePath(fd) });
|
|
7208
7238
|
}
|
|
7209
7239
|
};
|
|
7210
|
-
|
|
7240
|
+
const ctx = {
|
|
7211
7241
|
memory,
|
|
7212
7242
|
instance,
|
|
7213
7243
|
tid,
|
|
@@ -7246,6 +7276,11 @@ function importsContext({
|
|
|
7246
7276
|
},
|
|
7247
7277
|
errno: (err) => wasiErrnoOf(code(err))
|
|
7248
7278
|
};
|
|
7279
|
+
if (!owners) return ctx;
|
|
7280
|
+
return Object.defineProperties(ctx, {
|
|
7281
|
+
uid: { get: () => live().uid, enumerable: true },
|
|
7282
|
+
gid: { get: () => live().gid, enumerable: true }
|
|
7283
|
+
});
|
|
7249
7284
|
}
|
|
7250
7285
|
function processes(host, call2, inThread) {
|
|
7251
7286
|
const close = (fd) => void call2({ op: "fd-close", fd });
|