@ai-ecoverse/slicc-kernel 1.127.0 → 1.127.1
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 +3 -1
- package/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +79 -25
- package/dist/kernel-worker.js.map +3 -3
- 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 +79 -25
- package/dist/node.js.map +3 -3
- 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 +1 -0
- package/dist/types/kernel/proc-info.d.ts +1 -0
- package/package.json +2 -2
package/dist/kernel-worker.js
CHANGED
|
@@ -1330,7 +1330,7 @@ var OpfsFs = class {
|
|
|
1330
1330
|
}
|
|
1331
1331
|
async recounting(handle, target) {
|
|
1332
1332
|
if (this.counted.length === 0) return;
|
|
1333
|
-
const where = await this.root.resolve(handle).catch(() => null);
|
|
1333
|
+
const where = await this.io(this.root.resolve(handle)).catch(() => null);
|
|
1334
1334
|
await this.counting(where ? `/${where.join("/")}` : target);
|
|
1335
1335
|
}
|
|
1336
1336
|
resolvePath(base, path) {
|
|
@@ -1532,9 +1532,17 @@ var OpfsFs = class {
|
|
|
1532
1532
|
}
|
|
1533
1533
|
exact = 0;
|
|
1534
1534
|
calls = 0;
|
|
1535
|
+
others = 0;
|
|
1535
1536
|
opfsCalls() {
|
|
1536
1537
|
return this.calls;
|
|
1537
1538
|
}
|
|
1539
|
+
opfsOps() {
|
|
1540
|
+
return this.calls + this.others;
|
|
1541
|
+
}
|
|
1542
|
+
io(request2) {
|
|
1543
|
+
this.others++;
|
|
1544
|
+
return request2;
|
|
1545
|
+
}
|
|
1538
1546
|
fresh() {
|
|
1539
1547
|
this.changes++;
|
|
1540
1548
|
this.absent.clear();
|
|
@@ -1558,7 +1566,13 @@ var OpfsFs = class {
|
|
|
1558
1566
|
this.absent.set(path, performance.now());
|
|
1559
1567
|
}
|
|
1560
1568
|
remember(path, handle, looked = false) {
|
|
1561
|
-
if (handle.kind !== "file")
|
|
1569
|
+
if (handle.kind !== "file") {
|
|
1570
|
+
if (looked) {
|
|
1571
|
+
this.dirs.set(path, handle);
|
|
1572
|
+
this.checked.set(handle, performance.now());
|
|
1573
|
+
}
|
|
1574
|
+
return handle;
|
|
1575
|
+
}
|
|
1562
1576
|
if (looked) {
|
|
1563
1577
|
this.found.set(handle, performance.now());
|
|
1564
1578
|
this.glances.delete(handle);
|
|
@@ -1939,7 +1953,7 @@ var OpfsFs = class {
|
|
|
1939
1953
|
async readFileBuffer(path) {
|
|
1940
1954
|
const bytes = await this.reading(
|
|
1941
1955
|
path,
|
|
1942
|
-
async (handle) => new Uint8Array(await (await handle.getFile()).arrayBuffer())
|
|
1956
|
+
async (handle) => new Uint8Array(await (await this.io(handle.getFile())).arrayBuffer())
|
|
1943
1957
|
);
|
|
1944
1958
|
await this.refuseNode(path, bytes.length === 0);
|
|
1945
1959
|
return bytes;
|
|
@@ -1947,7 +1961,7 @@ var OpfsFs = class {
|
|
|
1947
1961
|
async readVersioned(path, cached = false) {
|
|
1948
1962
|
return this.reading(path, async (handle) => {
|
|
1949
1963
|
const stamp = await this.stamp(path, cached);
|
|
1950
|
-
const file = await handle.getFile();
|
|
1964
|
+
const file = await this.io(handle.getFile());
|
|
1951
1965
|
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
1952
1966
|
await this.refuseNode(path, bytes.length === 0);
|
|
1953
1967
|
return { bytes, version: `${file.lastModified}:${file.size}:${stamp}` };
|
|
@@ -1956,23 +1970,53 @@ var OpfsFs = class {
|
|
|
1956
1970
|
async version(path, cached = false) {
|
|
1957
1971
|
return this.reading(path, async (handle) => {
|
|
1958
1972
|
const stamp = await this.stamp(path, cached);
|
|
1959
|
-
const file = await handle.getFile();
|
|
1973
|
+
const file = await this.io(handle.getFile());
|
|
1960
1974
|
return `${file.lastModified}:${file.size}:${stamp}`;
|
|
1961
1975
|
});
|
|
1962
1976
|
}
|
|
1963
1977
|
async pread(path, offset, length2) {
|
|
1964
1978
|
return this.reading(path, async (handle) => {
|
|
1965
|
-
const file = await handle.getFile();
|
|
1979
|
+
const file = await this.io(handle.getFile());
|
|
1966
1980
|
await this.refuseNode(path, file.size === 0);
|
|
1967
1981
|
return new Uint8Array(await file.slice(offset, offset + length2).arrayBuffer());
|
|
1968
1982
|
});
|
|
1969
1983
|
}
|
|
1970
1984
|
async pwrite(path, offset, bytes) {
|
|
1971
|
-
const [
|
|
1985
|
+
const [kept, target] = await this.keptFor(path);
|
|
1986
|
+
if (kept) {
|
|
1987
|
+
try {
|
|
1988
|
+
await this.writeAt(kept, target, path, offset, bytes);
|
|
1989
|
+
return;
|
|
1990
|
+
} catch (err) {
|
|
1991
|
+
if (err.code !== "ENOENT") throw err;
|
|
1992
|
+
this.files.delete(target);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
const [handle] = await this.fileFor(path);
|
|
1996
|
+
await this.writeAt(handle, target, path, offset, bytes);
|
|
1997
|
+
}
|
|
1998
|
+
async keptFor(path) {
|
|
1999
|
+
const at = normalizePath(path);
|
|
2000
|
+
const cached = this.files.get(at);
|
|
2001
|
+
const fresh2 = cached && performance.now() - (this.found.get(cached) ?? -CHECK_MS) < CHECK_MS;
|
|
2002
|
+
const [target, existed] = fresh2 ? [at, true] : await this.writeTarget(path);
|
|
2003
|
+
if (!existed) return [void 0, target];
|
|
2004
|
+
this.refuse(target);
|
|
2005
|
+
const [entry] = await this.meta.get([target]);
|
|
2006
|
+
if (entry?.fifo || entry?.socket) throw fsError("ENXIO", path);
|
|
2007
|
+
const kept = fresh2 ? cached : this.files.get(target);
|
|
2008
|
+
const usable2 = kept && performance.now() - (this.found.get(kept) ?? -CHECK_MS) < CHECK_MS;
|
|
2009
|
+
return [usable2 ? kept : void 0, target];
|
|
2010
|
+
}
|
|
2011
|
+
async writeAt(handle, target, path, offset, bytes) {
|
|
1972
2012
|
await this.counting(target);
|
|
1973
2013
|
this.wrote(handle);
|
|
1974
2014
|
try {
|
|
1975
|
-
await this.retrying(
|
|
2015
|
+
await this.retrying(
|
|
2016
|
+
path,
|
|
2017
|
+
() => this.io(positioned(handle, (io) => io.write(offset, bytes))),
|
|
2018
|
+
true
|
|
2019
|
+
);
|
|
1976
2020
|
} finally {
|
|
1977
2021
|
this.wrote(handle);
|
|
1978
2022
|
await this.recounting(handle, target);
|
|
@@ -1981,13 +2025,13 @@ var OpfsFs = class {
|
|
|
1981
2025
|
}
|
|
1982
2026
|
async truncate(path, size) {
|
|
1983
2027
|
const handle = await this.existing(path, true);
|
|
1984
|
-
await this.refuseNode(path, (await handle.getFile()).size === 0);
|
|
2028
|
+
await this.refuseNode(path, (await this.io(handle.getFile())).size === 0);
|
|
1985
2029
|
const resolve2 = this.ranged || this.remote?.watched();
|
|
1986
2030
|
const target = resolve2 || this.counted.length > 0 ? (await this.locate(path, true)).path : path;
|
|
1987
2031
|
await this.counting(target);
|
|
1988
2032
|
this.wrote(handle);
|
|
1989
2033
|
try {
|
|
1990
|
-
await this.retrying(path, () => positioned(handle, (io) => io.truncate(size)), true);
|
|
2034
|
+
await this.retrying(path, () => this.io(positioned(handle, (io) => io.truncate(size))), true);
|
|
1991
2035
|
} finally {
|
|
1992
2036
|
this.wrote(handle);
|
|
1993
2037
|
await this.recounting(handle, target);
|
|
@@ -1998,7 +2042,7 @@ var OpfsFs = class {
|
|
|
1998
2042
|
const [handle, , target] = await this.fileFor(path);
|
|
1999
2043
|
const writable2 = await this.retrying(
|
|
2000
2044
|
path,
|
|
2001
|
-
() => handle.createWritable({ keepExistingData: !truncate }),
|
|
2045
|
+
() => this.io(handle.createWritable({ keepExistingData: !truncate })),
|
|
2002
2046
|
true
|
|
2003
2047
|
);
|
|
2004
2048
|
return {
|
|
@@ -2047,7 +2091,7 @@ var OpfsFs = class {
|
|
|
2047
2091
|
try {
|
|
2048
2092
|
const handle = await this.inDir(
|
|
2049
2093
|
dir,
|
|
2050
|
-
(parent) => parent.getFileHandle(name2, { create: true })
|
|
2094
|
+
(parent) => this.io(parent.getFileHandle(name2, { create: true }))
|
|
2051
2095
|
);
|
|
2052
2096
|
if (!existed) this.touch(Date.now(), parentOf3(target));
|
|
2053
2097
|
return [handle, existed, target];
|
|
@@ -2063,7 +2107,7 @@ var OpfsFs = class {
|
|
|
2063
2107
|
let writable2;
|
|
2064
2108
|
this.wrote(file);
|
|
2065
2109
|
try {
|
|
2066
|
-
writable2 = await file.createWritable();
|
|
2110
|
+
writable2 = await this.io(file.createWritable());
|
|
2067
2111
|
await writable2.write(content);
|
|
2068
2112
|
await writable2.close();
|
|
2069
2113
|
} catch (err) {
|
|
@@ -2079,6 +2123,7 @@ var OpfsFs = class {
|
|
|
2079
2123
|
const handle = found.handle;
|
|
2080
2124
|
if (handle.kind !== "directory") throw fsError("ENOTDIR", path);
|
|
2081
2125
|
const children3 = /* @__PURE__ */ new Map();
|
|
2126
|
+
this.others++;
|
|
2082
2127
|
for await (const child of handle.values()) children3.set(child.name, child);
|
|
2083
2128
|
for (const link2 of await this.meta.links(found.path)) {
|
|
2084
2129
|
const name2 = baseOf(link2.path);
|
|
@@ -2132,7 +2177,7 @@ var OpfsFs = class {
|
|
|
2132
2177
|
const parent = await this.locate(parentOf3(path), true);
|
|
2133
2178
|
if (parent.handle?.kind !== "directory") throw fsError("ENOTDIR", path);
|
|
2134
2179
|
this.refuse(resolvePath(parent.path, baseOf(path)));
|
|
2135
|
-
await parent.handle.getDirectoryHandle(baseOf(path), { create: true });
|
|
2180
|
+
await this.io(parent.handle.getDirectoryHandle(baseOf(path), { create: true }));
|
|
2136
2181
|
const now = Date.now();
|
|
2137
2182
|
const made2 = `${parent.path === "/" ? "" : parent.path}/${baseOf(path)}`;
|
|
2138
2183
|
await this.stampNew(made2, owner, true);
|
|
@@ -2153,7 +2198,7 @@ var OpfsFs = class {
|
|
|
2153
2198
|
if (found !== void 0 && !found.vacated) await this.meta.remove([path]);
|
|
2154
2199
|
this.forget(physical);
|
|
2155
2200
|
this.refuse(physical);
|
|
2156
|
-
await dir.getDirectoryHandle(name2, { create: true });
|
|
2201
|
+
await this.io(dir.getDirectoryHandle(name2, { create: true }));
|
|
2157
2202
|
const now = Date.now();
|
|
2158
2203
|
const made2 = `${parent.path === "/" ? "" : parent.path}/${name2}`;
|
|
2159
2204
|
await this.stampNew(made2, owner, true);
|
|
@@ -2175,9 +2220,10 @@ var OpfsFs = class {
|
|
|
2175
2220
|
if (found !== void 0 && !found.vacated) await this.meta.remove([path]);
|
|
2176
2221
|
this.forget(physical);
|
|
2177
2222
|
this.refuse(physical);
|
|
2178
|
-
await dir.getFileHandle(name2, { create: true });
|
|
2223
|
+
const handle = await this.io(dir.getFileHandle(name2, { create: true }));
|
|
2179
2224
|
const now = Date.now();
|
|
2180
2225
|
const made2 = `${parent.path === "/" ? "" : parent.path}/${name2}`;
|
|
2226
|
+
this.remember(made2, handle, true);
|
|
2181
2227
|
await this.stampNew(made2, owner, false);
|
|
2182
2228
|
this.touch(now, parent.path, made2);
|
|
2183
2229
|
});
|
|
@@ -2209,7 +2255,7 @@ var OpfsFs = class {
|
|
|
2209
2255
|
try {
|
|
2210
2256
|
await this.inDir(
|
|
2211
2257
|
dir,
|
|
2212
|
-
(parent) => parent.removeEntry(name2, { recursive: options.recursive === true })
|
|
2258
|
+
(parent) => this.io(parent.removeEntry(name2, { recursive: options.recursive === true }))
|
|
2213
2259
|
);
|
|
2214
2260
|
} catch (err) {
|
|
2215
2261
|
throw translate(err, path);
|
|
@@ -2450,7 +2496,9 @@ var OpfsFs = class {
|
|
|
2450
2496
|
}
|
|
2451
2497
|
}
|
|
2452
2498
|
async place(handle, dir, name2) {
|
|
2453
|
-
const
|
|
2499
|
+
const move = handle.move;
|
|
2500
|
+
if (move) this.others++;
|
|
2501
|
+
const moved2 = await move?.call(handle, dir, name2).then(
|
|
2454
2502
|
() => true,
|
|
2455
2503
|
() => false
|
|
2456
2504
|
);
|
|
@@ -2460,7 +2508,7 @@ var OpfsFs = class {
|
|
|
2460
2508
|
await this.copy(handle, dir, name2);
|
|
2461
2509
|
} catch (err) {
|
|
2462
2510
|
if (handle.kind === "directory" && this.fileMoves === before) {
|
|
2463
|
-
await dir.removeEntry(name2, { recursive: true });
|
|
2511
|
+
await this.io(dir.removeEntry(name2, { recursive: true }));
|
|
2464
2512
|
}
|
|
2465
2513
|
throw translate(err, name2);
|
|
2466
2514
|
}
|
|
@@ -2469,6 +2517,7 @@ var OpfsFs = class {
|
|
|
2469
2517
|
fileMoves = 0;
|
|
2470
2518
|
async copy(handle, dir, name2) {
|
|
2471
2519
|
if (handle.kind === "file" && movable(handle)) {
|
|
2520
|
+
this.others++;
|
|
2472
2521
|
const moved2 = await handle.move?.(dir, name2).then(
|
|
2473
2522
|
() => true,
|
|
2474
2523
|
() => false
|
|
@@ -2479,12 +2528,14 @@ var OpfsFs = class {
|
|
|
2479
2528
|
}
|
|
2480
2529
|
}
|
|
2481
2530
|
if (handle.kind === "file") {
|
|
2482
|
-
const
|
|
2483
|
-
|
|
2531
|
+
const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
|
|
2532
|
+
const writable2 = await this.io(made2.createWritable());
|
|
2533
|
+
await writable2.write(await this.io(handle.getFile()));
|
|
2484
2534
|
await writable2.close();
|
|
2485
2535
|
return;
|
|
2486
2536
|
}
|
|
2487
|
-
const target = await dir.getDirectoryHandle(name2, { create: true });
|
|
2537
|
+
const target = await this.io(dir.getDirectoryHandle(name2, { create: true }));
|
|
2538
|
+
this.others++;
|
|
2488
2539
|
for await (const child of handle.values()) await this.copy(child, target, child.name);
|
|
2489
2540
|
}
|
|
2490
2541
|
async symlink(target, path, owner) {
|
|
@@ -2557,7 +2608,7 @@ var OpfsFs = class {
|
|
|
2557
2608
|
return;
|
|
2558
2609
|
}
|
|
2559
2610
|
const handle = found.handle;
|
|
2560
|
-
const file = handle.kind === "file" ? await handle.getFile() : void 0;
|
|
2611
|
+
const file = handle.kind === "file" ? await this.io(handle.getFile()) : void 0;
|
|
2561
2612
|
this.dirTimes.delete(found.path);
|
|
2562
2613
|
this.fileTimes.delete(found.path);
|
|
2563
2614
|
const ctimeMs = Date.now();
|
|
@@ -6823,7 +6874,7 @@ function satisfies(version, range2) {
|
|
|
6823
6874
|
}
|
|
6824
6875
|
|
|
6825
6876
|
// src/version.ts
|
|
6826
|
-
var KERNEL_VERSION = true ? "1.127.
|
|
6877
|
+
var KERNEL_VERSION = true ? "1.127.1" : "0.0.0-dev";
|
|
6827
6878
|
var OS_RELEASE = "6.0.0-slicc";
|
|
6828
6879
|
function procVersion() {
|
|
6829
6880
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -13268,6 +13319,8 @@ var SYS_TREE = {
|
|
|
13268
13319
|
slicc_fs_calls: (listing) => `${listing.fsCalls ?? 0}
|
|
13269
13320
|
`,
|
|
13270
13321
|
slicc_opfs_calls: (listing) => `${listing.opfsCalls ?? 0}
|
|
13322
|
+
`,
|
|
13323
|
+
slicc_opfs_ops: (listing) => `${listing.opfsOps ?? 0}
|
|
13271
13324
|
`
|
|
13272
13325
|
}
|
|
13273
13326
|
};
|
|
@@ -26950,7 +27003,8 @@ var Launcher = class {
|
|
|
26950
27003
|
wasm: this.memories.count(),
|
|
26951
27004
|
peers: Number(this.locks.shared?.() === true),
|
|
26952
27005
|
fsCalls: servedFsCalls(),
|
|
26953
|
-
opfsCalls: this.rootFs.opfsCalls?.() ?? 0
|
|
27006
|
+
opfsCalls: this.rootFs.opfsCalls?.() ?? 0,
|
|
27007
|
+
opfsOps: this.rootFs.opfsOps?.() ?? 0
|
|
26954
27008
|
}),
|
|
26955
27009
|
sudo: (call, signal) => this.sudo(pid, call, signal),
|
|
26956
27010
|
crontab: (call) => this.crontab(pid, call),
|