@ai-ecoverse/slicc-kernel 1.102.3 → 1.102.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 +1 -1
- package/dist/kernel-worker.js +73 -7
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +8 -4
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +73 -7
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +8 -4
- package/dist/process-worker.js.map +2 -2
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -1550,6 +1550,7 @@ var KernelSocket = class _KernelSocket {
|
|
|
1550
1550
|
backlog = 0;
|
|
1551
1551
|
boundAt;
|
|
1552
1552
|
changes = new Changes();
|
|
1553
|
+
room = new Changes();
|
|
1553
1554
|
options = /* @__PURE__ */ new Map();
|
|
1554
1555
|
constructor(net, domain) {
|
|
1555
1556
|
this.net = net;
|
|
@@ -1634,7 +1635,10 @@ var KernelSocket = class _KernelSocket {
|
|
|
1634
1635
|
for (; ; ) {
|
|
1635
1636
|
if (this.state !== "listening") throw new KernelError("EINVAL");
|
|
1636
1637
|
const next2 = this.queue.shift();
|
|
1637
|
-
if (next2)
|
|
1638
|
+
if (next2) {
|
|
1639
|
+
this.room.wake();
|
|
1640
|
+
return next2;
|
|
1641
|
+
}
|
|
1638
1642
|
if (nonblock) throw new KernelError("EAGAIN");
|
|
1639
1643
|
await this.changes.wait(signal);
|
|
1640
1644
|
}
|
|
@@ -1645,7 +1649,13 @@ var KernelSocket = class _KernelSocket {
|
|
|
1645
1649
|
this.changes.wake();
|
|
1646
1650
|
return true;
|
|
1647
1651
|
}
|
|
1648
|
-
|
|
1652
|
+
get full() {
|
|
1653
|
+
return this.state === "listening" && this.queue.length >= this.backlog;
|
|
1654
|
+
}
|
|
1655
|
+
waitRoom(signal) {
|
|
1656
|
+
return this.room.wait(signal);
|
|
1657
|
+
}
|
|
1658
|
+
connect(addr, viaUplink = true, cred, stamp, waits = true) {
|
|
1649
1659
|
if (this.state === "connected") throw new KernelError("EISCONN");
|
|
1650
1660
|
if (this.state === "connecting") throw new KernelError("EALREADY");
|
|
1651
1661
|
if (this.state !== "open") throw new KernelError("EINVAL");
|
|
@@ -1660,6 +1670,11 @@ var KernelSocket = class _KernelSocket {
|
|
|
1660
1670
|
this.boundAt = this.local;
|
|
1661
1671
|
} else this.local = { family: "unix", path: "" };
|
|
1662
1672
|
}
|
|
1673
|
+
if (waits && target.full) return this.queued(addr, target, cred, stamp);
|
|
1674
|
+
this.join(addr, target, cred, stamp);
|
|
1675
|
+
return void 0;
|
|
1676
|
+
}
|
|
1677
|
+
join(addr, target, cred, stamp) {
|
|
1663
1678
|
const server = new _KernelSocket(this.net, this.domain);
|
|
1664
1679
|
server.local = addr.family === "inet" ? { ...addr, host: canonicalHost(addr.host) } : addr;
|
|
1665
1680
|
server.peer = this.local;
|
|
@@ -1673,7 +1688,34 @@ var KernelSocket = class _KernelSocket {
|
|
|
1673
1688
|
server.close();
|
|
1674
1689
|
throw new KernelError("ECONNREFUSED");
|
|
1675
1690
|
}
|
|
1676
|
-
|
|
1691
|
+
}
|
|
1692
|
+
async queued(addr, target, cred, stamp) {
|
|
1693
|
+
this.state = "connecting";
|
|
1694
|
+
const abort = new AbortController();
|
|
1695
|
+
this.dialing = abort;
|
|
1696
|
+
const timer = setTimeout(
|
|
1697
|
+
() => abort.abort(new KernelError("ETIMEDOUT")),
|
|
1698
|
+
this.net.backlogWaitMs
|
|
1699
|
+
);
|
|
1700
|
+
try {
|
|
1701
|
+
while (target.full) await target.waitRoom(abort.signal);
|
|
1702
|
+
if (abort.signal.aborted) throw abort.signal.reason;
|
|
1703
|
+
this.state = "open";
|
|
1704
|
+
this.join(addr, target, cred, stamp);
|
|
1705
|
+
this.dialing = void 0;
|
|
1706
|
+
} catch (e) {
|
|
1707
|
+
const reason = abort.signal.aborted ? abort.signal.reason : e;
|
|
1708
|
+
const error = reason instanceof KernelError ? reason : new KernelError("ECONNREFUSED");
|
|
1709
|
+
if (this.dialing === abort) {
|
|
1710
|
+
this.dialing = void 0;
|
|
1711
|
+
this.failed = error.code;
|
|
1712
|
+
if (this.state === "connecting") this.state = "open";
|
|
1713
|
+
this.changes.wake();
|
|
1714
|
+
}
|
|
1715
|
+
throw error;
|
|
1716
|
+
} finally {
|
|
1717
|
+
clearTimeout(timer);
|
|
1718
|
+
}
|
|
1677
1719
|
}
|
|
1678
1720
|
dial(addr, route) {
|
|
1679
1721
|
this.state = "connecting";
|
|
@@ -1774,6 +1816,7 @@ var KernelSocket = class _KernelSocket {
|
|
|
1774
1816
|
this.dialing = void 0;
|
|
1775
1817
|
if (was === "listening") {
|
|
1776
1818
|
for (const pending of this.queue.splice(0)) pending.close();
|
|
1819
|
+
this.room.wake();
|
|
1777
1820
|
}
|
|
1778
1821
|
if (this.link) {
|
|
1779
1822
|
if (!this.readShut) this.link.rx.closeRead();
|
|
@@ -1871,9 +1914,10 @@ var LoopbackNet = class {
|
|
|
1871
1914
|
socket.listen(backlog);
|
|
1872
1915
|
return socket;
|
|
1873
1916
|
}
|
|
1917
|
+
backlogWaitMs = DIAL_TIMEOUT_MS;
|
|
1874
1918
|
connect(addr) {
|
|
1875
1919
|
const socket = this.socket(addr.family);
|
|
1876
|
-
void socket.connect(addr, false);
|
|
1920
|
+
void socket.connect(addr, false, void 0, void 0, false);
|
|
1877
1921
|
return socket;
|
|
1878
1922
|
}
|
|
1879
1923
|
bind(socket, addr, kernel = false) {
|
|
@@ -7303,7 +7347,8 @@ var GEN = 0;
|
|
|
7303
7347
|
var RING = 1;
|
|
7304
7348
|
var RING_SIZE = 4096;
|
|
7305
7349
|
var SLOT = 2;
|
|
7306
|
-
var
|
|
7350
|
+
var DIRTY = RING + RING_SIZE * SLOT;
|
|
7351
|
+
var CHANGES_BYTES = (DIRTY + 1) * 4;
|
|
7307
7352
|
function changeHash(path) {
|
|
7308
7353
|
let h = 2166136261;
|
|
7309
7354
|
for (let i = 0; i < path.length; i++) {
|
|
@@ -7328,6 +7373,9 @@ var FileChanges = class {
|
|
|
7328
7373
|
this.sab = sab;
|
|
7329
7374
|
this.view = new Int32Array(sab);
|
|
7330
7375
|
}
|
|
7376
|
+
dirtied(delta) {
|
|
7377
|
+
Atomics.add(this.view, DIRTY, delta);
|
|
7378
|
+
}
|
|
7331
7379
|
publish(...paths) {
|
|
7332
7380
|
for (const path of paths) {
|
|
7333
7381
|
const g = Atomics.add(this.view, GEN, 1) + 1 | 0;
|
|
@@ -11129,7 +11177,7 @@ var PATH_OPS = new Set(SYNC_FS_OPS);
|
|
|
11129
11177
|
var EARLY_WHOLE_FILE = 64 * 1024;
|
|
11130
11178
|
|
|
11131
11179
|
// src/version.ts
|
|
11132
|
-
var KERNEL_VERSION = true ? "1.102.
|
|
11180
|
+
var KERNEL_VERSION = true ? "1.102.5" : "0.0.0-dev";
|
|
11133
11181
|
var OS_RELEASE = "6.0.0-slicc";
|
|
11134
11182
|
function procVersion() {
|
|
11135
11183
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -12384,7 +12432,8 @@ var KernelLoopback = class {
|
|
|
12384
12432
|
{ family: "inet", host: "127.0.0.1", port },
|
|
12385
12433
|
false,
|
|
12386
12434
|
this.cred(),
|
|
12387
|
-
this.stamp ? await this.stamp() : void 0
|
|
12435
|
+
this.stamp ? await this.stamp() : void 0,
|
|
12436
|
+
false
|
|
12388
12437
|
);
|
|
12389
12438
|
} catch (err) {
|
|
12390
12439
|
socket.close();
|
|
@@ -14674,6 +14723,15 @@ var VfsNode = class {
|
|
|
14674
14723
|
orphaned;
|
|
14675
14724
|
id;
|
|
14676
14725
|
onDirty;
|
|
14726
|
+
onDirtyState;
|
|
14727
|
+
counted = false;
|
|
14728
|
+
recount() {
|
|
14729
|
+
if (!this.onDirtyState) return;
|
|
14730
|
+
const on = this.dirty && !this.orphaned;
|
|
14731
|
+
if (on === this.counted) return;
|
|
14732
|
+
this.counted = on;
|
|
14733
|
+
this.onDirtyState?.(on);
|
|
14734
|
+
}
|
|
14677
14735
|
constructor(fs, path, contents2, orphaned = false, dirty = false, pin) {
|
|
14678
14736
|
this.fs = fs;
|
|
14679
14737
|
this.pin = pin;
|
|
@@ -14823,6 +14881,7 @@ var VfsNode = class {
|
|
|
14823
14881
|
}
|
|
14824
14882
|
markDirty() {
|
|
14825
14883
|
this.dirty = true;
|
|
14884
|
+
this.recount();
|
|
14826
14885
|
if (!this.orphaned) this.onDirty?.();
|
|
14827
14886
|
if (this.writeBack !== void 0 || this.orphaned) return;
|
|
14828
14887
|
const delay = Math.max(WRITEBACK_MS, this.writeBackCost * WRITEBACK_COST_FACTOR);
|
|
@@ -14850,6 +14909,8 @@ var VfsNode = class {
|
|
|
14850
14909
|
} catch (err) {
|
|
14851
14910
|
this.dirty = true;
|
|
14852
14911
|
throw err;
|
|
14912
|
+
} finally {
|
|
14913
|
+
this.recount();
|
|
14853
14914
|
}
|
|
14854
14915
|
this.writeBackCost = performance.now() - started;
|
|
14855
14916
|
}
|
|
@@ -14860,6 +14921,7 @@ var VfsNodes = class {
|
|
|
14860
14921
|
byId = /* @__PURE__ */ new Map();
|
|
14861
14922
|
keepsOnDisk = false;
|
|
14862
14923
|
changed;
|
|
14924
|
+
dirtied;
|
|
14863
14925
|
fs;
|
|
14864
14926
|
entries;
|
|
14865
14927
|
onClosed;
|
|
@@ -14943,6 +15005,7 @@ var VfsNodes = class {
|
|
|
14943
15005
|
}
|
|
14944
15006
|
orphan(node) {
|
|
14945
15007
|
node.orphaned = true;
|
|
15008
|
+
node.recount();
|
|
14946
15009
|
this.forget(node);
|
|
14947
15010
|
}
|
|
14948
15011
|
dropName(path, node) {
|
|
@@ -14997,6 +15060,8 @@ var VfsNodes = class {
|
|
|
14997
15060
|
create(path, id2, node) {
|
|
14998
15061
|
this.reshaped();
|
|
14999
15062
|
node.onDirty = () => this.changed?.(node.path);
|
|
15063
|
+
node.onDirtyState = (on) => this.dirtied?.(on ? 1 : -1);
|
|
15064
|
+
node.recount();
|
|
15000
15065
|
this.byPath.set(path, node);
|
|
15001
15066
|
if (id2 !== void 0) this.know(node, id2);
|
|
15002
15067
|
return node;
|
|
@@ -22316,6 +22381,7 @@ var Launcher = class {
|
|
|
22316
22381
|
}
|
|
22317
22382
|
processChain(fs, nodes, unlinked) {
|
|
22318
22383
|
nodes.changed = (path) => this.changes.publish(path);
|
|
22384
|
+
nodes.dirtied = (delta) => this.changes.dirtied(delta);
|
|
22319
22385
|
return unlinked.wrap(keepingOpen(fs, nodes, (path) => this.changes.publish(path)));
|
|
22320
22386
|
}
|
|
22321
22387
|
async starting(argv, dir, account, tag) {
|