@ai-ecoverse/slicc-kernel 1.124.4 → 1.124.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/README.md +17 -5
- package/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +56 -15
- package/dist/kernel-worker.js.map +2 -2
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.js +3 -1
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +56 -15
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +3 -1
- package/dist/process-worker.js.map +2 -2
- package/dist/types/fs/opfs.d.ts +5 -0
- package/dist/types/fs/types.d.ts +2 -0
- package/dist/types/kernel/lock-service.d.ts +3 -0
- package/dist/types/kernel/proc-info.d.ts +1 -0
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -4505,9 +4505,13 @@ var OpfsFs = class {
|
|
|
4505
4505
|
if (this.remote) this.remote.quiet = () => this.quiet().then(() => this.settle?.());
|
|
4506
4506
|
if (this.channel) {
|
|
4507
4507
|
const remote = this.remote;
|
|
4508
|
-
meta.listen?.(
|
|
4509
|
-
(
|
|
4510
|
-
|
|
4508
|
+
meta.listen?.((c) => {
|
|
4509
|
+
for (const path of [...c.paths ?? [], ...c.trees ?? []]) this.forget(path);
|
|
4510
|
+
remote?.emit({ paths: c.paths ?? [], trees: c.trees ?? [] });
|
|
4511
|
+
});
|
|
4512
|
+
remote?.listen((c) => {
|
|
4513
|
+
for (const path of [...c.paths, ...c.trees]) this.forget(path);
|
|
4514
|
+
});
|
|
4511
4515
|
this.channel.onmessage = ({ data }) => {
|
|
4512
4516
|
for (const path of data) this.forget(path);
|
|
4513
4517
|
remote?.emit({ paths: data, trees: [] });
|
|
@@ -4668,9 +4672,13 @@ var OpfsFs = class {
|
|
|
4668
4672
|
joined: () => remote.peered(),
|
|
4669
4673
|
crowded: () => remote.crowded(),
|
|
4670
4674
|
watch: (listener) => {
|
|
4671
|
-
remote.crowd =
|
|
4675
|
+
remote.crowd = (crowded) => {
|
|
4676
|
+
this.fresh();
|
|
4677
|
+
listener(crowded);
|
|
4678
|
+
};
|
|
4672
4679
|
listener(remote.crowded());
|
|
4673
|
-
}
|
|
4680
|
+
},
|
|
4681
|
+
fresh: () => this.fresh()
|
|
4674
4682
|
};
|
|
4675
4683
|
}
|
|
4676
4684
|
quiet() {
|
|
@@ -4723,6 +4731,7 @@ var OpfsFs = class {
|
|
|
4723
4731
|
async walk(parts2, from, start2) {
|
|
4724
4732
|
let dir = start2;
|
|
4725
4733
|
for (let at = from; at < parts2.length; at++) {
|
|
4734
|
+
this.calls++;
|
|
4726
4735
|
dir = await dir.getDirectoryHandle(parts2[at]);
|
|
4727
4736
|
this.dirs.set(`/${parts2.slice(0, at + 1).join("/")}`, dir);
|
|
4728
4737
|
this.checked.set(dir, performance.now());
|
|
@@ -4751,11 +4760,29 @@ var OpfsFs = class {
|
|
|
4751
4760
|
async current(path, dir) {
|
|
4752
4761
|
if (dir === this.root) return path === "/";
|
|
4753
4762
|
if (performance.now() - (this.checked.get(dir) ?? -CHECK_MS) < CHECK_MS) return true;
|
|
4763
|
+
this.calls++;
|
|
4754
4764
|
const where = await this.root.resolve(dir).catch(() => null);
|
|
4755
4765
|
if (where === null || `/${where.join("/")}` !== path) return false;
|
|
4756
4766
|
this.checked.set(dir, performance.now());
|
|
4757
4767
|
return true;
|
|
4758
4768
|
}
|
|
4769
|
+
exact = 0;
|
|
4770
|
+
calls = 0;
|
|
4771
|
+
opfsCalls() {
|
|
4772
|
+
return this.calls;
|
|
4773
|
+
}
|
|
4774
|
+
fresh() {
|
|
4775
|
+
this.changes++;
|
|
4776
|
+
this.absent.clear();
|
|
4777
|
+
}
|
|
4778
|
+
async exactly(op) {
|
|
4779
|
+
this.exact++;
|
|
4780
|
+
try {
|
|
4781
|
+
return await op();
|
|
4782
|
+
} finally {
|
|
4783
|
+
this.exact--;
|
|
4784
|
+
}
|
|
4785
|
+
}
|
|
4759
4786
|
forget(path) {
|
|
4760
4787
|
this.changes++;
|
|
4761
4788
|
this.dirs.deleteTree(path);
|
|
@@ -4790,6 +4817,7 @@ var OpfsFs = class {
|
|
|
4790
4817
|
}
|
|
4791
4818
|
}
|
|
4792
4819
|
async child(parent, name2, kind) {
|
|
4820
|
+
this.calls++;
|
|
4793
4821
|
return kind === "file" ? parent.getFileHandle(name2) : parent.getDirectoryHandle(name2);
|
|
4794
4822
|
}
|
|
4795
4823
|
async parent(path) {
|
|
@@ -4818,7 +4846,7 @@ var OpfsFs = class {
|
|
|
4818
4846
|
const kept = this.dirs.get(path);
|
|
4819
4847
|
if (kept && await this.current(path, kept)) return kept;
|
|
4820
4848
|
const gone = this.absent.get(path);
|
|
4821
|
-
if (gone !== void 0 &&
|
|
4849
|
+
if (gone !== void 0 && this.exact === 0 && performance.now() - gone < ABSENT_MS) {
|
|
4822
4850
|
throw translate({ name: "NotFoundError" }, path);
|
|
4823
4851
|
}
|
|
4824
4852
|
const seen = this.changes;
|
|
@@ -4979,6 +5007,7 @@ var OpfsFs = class {
|
|
|
4979
5007
|
flushing = {};
|
|
4980
5008
|
touch(now, ...dirs) {
|
|
4981
5009
|
this.changes++;
|
|
5010
|
+
if (this.shared()) this.channel?.postMessage(dirs);
|
|
4982
5011
|
for (const dir of dirs) {
|
|
4983
5012
|
this.absent.deleteTree(dir);
|
|
4984
5013
|
this.dirTimes.set(dir, now);
|
|
@@ -5010,7 +5039,7 @@ var OpfsFs = class {
|
|
|
5010
5039
|
return this.remote?.crowded() === true;
|
|
5011
5040
|
}
|
|
5012
5041
|
glanced(handle) {
|
|
5013
|
-
if (this.
|
|
5042
|
+
if (this.exact > 0) return void 0;
|
|
5014
5043
|
const seen = this.glances.get(handle);
|
|
5015
5044
|
const fresh2 = seen && seen.changes === this.changes && performance.now() - seen.at < GLANCE_MS;
|
|
5016
5045
|
return fresh2 ? seen.file : void 0;
|
|
@@ -5018,6 +5047,7 @@ var OpfsFs = class {
|
|
|
5018
5047
|
async glance(handle) {
|
|
5019
5048
|
const at = performance.now();
|
|
5020
5049
|
const before = this.changes;
|
|
5050
|
+
this.calls++;
|
|
5021
5051
|
const file = await handle.getFile();
|
|
5022
5052
|
if (before === this.changes) this.glances.set(handle, { at, file, changes: before });
|
|
5023
5053
|
else this.glances.delete(handle);
|
|
@@ -5303,7 +5333,7 @@ var OpfsFs = class {
|
|
|
5303
5333
|
if (!options.recursive) return this.mkdirExcl(path, options.owner);
|
|
5304
5334
|
let found;
|
|
5305
5335
|
try {
|
|
5306
|
-
found = await this.locate(path, true);
|
|
5336
|
+
found = await this.exactly(() => this.locate(path, true));
|
|
5307
5337
|
} catch (err) {
|
|
5308
5338
|
if (!missing2(err)) throw err;
|
|
5309
5339
|
}
|
|
@@ -5376,6 +5406,7 @@ var OpfsFs = class {
|
|
|
5376
5406
|
});
|
|
5377
5407
|
}
|
|
5378
5408
|
async handleExists(dir, name2) {
|
|
5409
|
+
this.calls++;
|
|
5379
5410
|
try {
|
|
5380
5411
|
await dir.getDirectoryHandle(name2);
|
|
5381
5412
|
return true;
|
|
@@ -5430,7 +5461,7 @@ var OpfsFs = class {
|
|
|
5430
5461
|
async link(from, to, follow2) {
|
|
5431
5462
|
await (follow2 ? this.stat(from) : this.lstat(from));
|
|
5432
5463
|
if (!(await this.stat(parentOf4(to))).isDirectory) throw fsError("ENOTDIR", to);
|
|
5433
|
-
const taken = await this.lstat(to).then(
|
|
5464
|
+
const taken = await this.exactly(() => this.lstat(to)).then(
|
|
5434
5465
|
() => true,
|
|
5435
5466
|
(err) => {
|
|
5436
5467
|
if (missing2(err)) return false;
|
|
@@ -5453,7 +5484,7 @@ var OpfsFs = class {
|
|
|
5453
5484
|
async moveTo(source, parent, destination, to) {
|
|
5454
5485
|
const sourceStat = await this.describe(source);
|
|
5455
5486
|
if (sourceStat.isDirectory && within3(destination, source.path)) throw fsError("EINVAL", to);
|
|
5456
|
-
const target = await this.locate(destination, false).catch((err) => {
|
|
5487
|
+
const target = await this.exactly(() => this.locate(destination, false)).catch((err) => {
|
|
5457
5488
|
if (missing2(err)) return null;
|
|
5458
5489
|
throw err;
|
|
5459
5490
|
});
|
|
@@ -5572,7 +5603,7 @@ var OpfsFs = class {
|
|
|
5572
5603
|
if (parent.handle?.kind !== "directory") throw fsError("ENOTDIR", path);
|
|
5573
5604
|
const at = resolvePath(parent.path, baseOf(path));
|
|
5574
5605
|
this.refuse(at);
|
|
5575
|
-
if (await this.locate(at, false).then(
|
|
5606
|
+
if (await this.exactly(() => this.locate(at, false)).then(
|
|
5576
5607
|
() => true,
|
|
5577
5608
|
(err) => !missing2(err)
|
|
5578
5609
|
)) {
|
|
@@ -6994,7 +7025,7 @@ function satisfies(version, range2) {
|
|
|
6994
7025
|
}
|
|
6995
7026
|
|
|
6996
7027
|
// src/version.ts
|
|
6997
|
-
var KERNEL_VERSION = true ? "1.124.
|
|
7028
|
+
var KERNEL_VERSION = true ? "1.124.5" : "0.0.0-dev";
|
|
6998
7029
|
var OS_RELEASE = "6.0.0-slicc";
|
|
6999
7030
|
function procVersion() {
|
|
7000
7031
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -12876,6 +12907,8 @@ var SYS_TREE = {
|
|
|
12876
12907
|
slicc_shared_root: (listing) => `${listing.peers ?? 0}
|
|
12877
12908
|
`,
|
|
12878
12909
|
slicc_fs_calls: (listing) => `${listing.fsCalls ?? 0}
|
|
12910
|
+
`,
|
|
12911
|
+
slicc_opfs_calls: (listing) => `${listing.opfsCalls ?? 0}
|
|
12879
12912
|
`
|
|
12880
12913
|
}
|
|
12881
12914
|
};
|
|
@@ -14047,9 +14080,13 @@ async function flock(req, ctx) {
|
|
|
14047
14080
|
if (req.kind !== "unlock" && req.wait)
|
|
14048
14081
|
await locks.flocks.wait(key, owner, req.kind, ctx.blocking);
|
|
14049
14082
|
else if (!await locks.flocks.set(key, owner, req.kind)) throw new KernelError("EAGAIN");
|
|
14050
|
-
if (shared && granted2) await ctx
|
|
14083
|
+
if (shared && granted2) await grantedAcross(ctx, req.fd);
|
|
14051
14084
|
return shared ? json3(true) : done2;
|
|
14052
14085
|
}
|
|
14086
|
+
async function grantedAcross(ctx, fd) {
|
|
14087
|
+
ctx.locks?.fresh?.();
|
|
14088
|
+
if (fd !== void 0) await ctx.settle?.(fd, true);
|
|
14089
|
+
}
|
|
14053
14090
|
async function recordLock2(req, ctx) {
|
|
14054
14091
|
const { locks, fileKey } = ctx;
|
|
14055
14092
|
if (!locks || !fileKey) throw new KernelError("ENOLCK");
|
|
@@ -14079,7 +14116,7 @@ async function recordLock2(req, ctx) {
|
|
|
14079
14116
|
await locks.wait(key, owner, req.kind, range2, ctx.blocking);
|
|
14080
14117
|
else if (!await locks.set(key, owner, req.kind, range2.start, range2.end))
|
|
14081
14118
|
throw new KernelError("EAGAIN");
|
|
14082
|
-
if (granted2 &&
|
|
14119
|
+
if (granted2 && shared) await grantedAcross(ctx, fd);
|
|
14083
14120
|
return shared ? json3(true) : done2;
|
|
14084
14121
|
}
|
|
14085
14122
|
|
|
@@ -20580,6 +20617,9 @@ var LockService = class {
|
|
|
20580
20617
|
};
|
|
20581
20618
|
}
|
|
20582
20619
|
peers;
|
|
20620
|
+
fresh() {
|
|
20621
|
+
this.peers?.fresh?.();
|
|
20622
|
+
}
|
|
20583
20623
|
shared() {
|
|
20584
20624
|
if (!this.leader || this.ownerOf.size > 0 || this.tokens.size > 0) return true;
|
|
20585
20625
|
return this.peers?.crowded() === true;
|
|
@@ -25380,7 +25420,8 @@ var Launcher = class {
|
|
|
25380
25420
|
cpu: this.cpuTotal(),
|
|
25381
25421
|
wasm: this.memories.count(),
|
|
25382
25422
|
peers: Number(this.locks.shared?.() === true),
|
|
25383
|
-
fsCalls: servedFsCalls()
|
|
25423
|
+
fsCalls: servedFsCalls(),
|
|
25424
|
+
opfsCalls: this.rootFs.opfsCalls?.() ?? 0
|
|
25384
25425
|
}),
|
|
25385
25426
|
sudo: (call, signal) => this.sudo(pid, call, signal),
|
|
25386
25427
|
crontab: (call) => this.crontab(pid, call),
|