@ai-ecoverse/slicc-kernel 1.100.0 → 1.100.2
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 +12 -5
- package/dist/kernel-worker.js +71 -10
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +59 -6
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +71 -10
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +59 -6
- package/dist/process-worker.js.map +2 -2
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -3030,7 +3030,7 @@ async function runTagged(l, self, requested, tag) {
|
|
|
3030
3030
|
}
|
|
3031
3031
|
function processes(l, self) {
|
|
3032
3032
|
const viewer = credOf(self);
|
|
3033
|
-
return l.list(viewer).map(({ tid: _, cred = viewer, umask: _umask, ...entry }) => ({
|
|
3033
|
+
return l.list(viewer).map(({ tid: _, cred = viewer, umask: _umask, threads: _threads, ...entry }) => ({
|
|
3034
3034
|
...entry,
|
|
3035
3035
|
rss: entry.memory,
|
|
3036
3036
|
uid: cred.euid,
|
|
@@ -10572,6 +10572,13 @@ var ProcessClocks = class {
|
|
|
10572
10572
|
running() {
|
|
10573
10573
|
return this.enabled ? this.all().filter((c) => c.running()).length : 0;
|
|
10574
10574
|
}
|
|
10575
|
+
states() {
|
|
10576
|
+
const state = (c) => c.running() ? "R" : "S";
|
|
10577
|
+
return [
|
|
10578
|
+
{ tid: 1, state: state(this.main) },
|
|
10579
|
+
...[...this.threads].map(([tid, c]) => ({ tid, state: state(c) }))
|
|
10580
|
+
];
|
|
10581
|
+
}
|
|
10575
10582
|
timed(clock, dispatch2) {
|
|
10576
10583
|
const c = clock ?? this.main;
|
|
10577
10584
|
const block = () => c.block();
|
|
@@ -11100,7 +11107,7 @@ var PATH_OPS = new Set(SYNC_FS_OPS);
|
|
|
11100
11107
|
var EARLY_WHOLE_FILE = 64 * 1024;
|
|
11101
11108
|
|
|
11102
11109
|
// src/version.ts
|
|
11103
|
-
var KERNEL_VERSION = true ? "1.100.
|
|
11110
|
+
var KERNEL_VERSION = true ? "1.100.2" : "0.0.0-dev";
|
|
11104
11111
|
var OS_RELEASE = "6.0.0-slicc";
|
|
11105
11112
|
function procVersion() {
|
|
11106
11113
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -11160,11 +11167,11 @@ function pages(bytes) {
|
|
|
11160
11167
|
function ticks(ms) {
|
|
11161
11168
|
return Math.max(0, Math.floor(ms * HZ / 1e3));
|
|
11162
11169
|
}
|
|
11163
|
-
function pidStat(info, boot) {
|
|
11170
|
+
function pidStat(info, boot, state = info.state) {
|
|
11164
11171
|
const fields = [
|
|
11165
11172
|
info.pid,
|
|
11166
11173
|
`(${commOf(info)})`,
|
|
11167
|
-
|
|
11174
|
+
state,
|
|
11168
11175
|
info.ppid,
|
|
11169
11176
|
info.pgid,
|
|
11170
11177
|
info.sid,
|
|
@@ -11202,8 +11209,19 @@ function pidStat(info, boot) {
|
|
|
11202
11209
|
`;
|
|
11203
11210
|
}
|
|
11204
11211
|
var sigMask = (mask = 0) => (mask >>> 1).toString(16).padStart(16, "0");
|
|
11205
|
-
var STATES = {
|
|
11212
|
+
var STATES = {
|
|
11213
|
+
S: "S (sleeping)",
|
|
11214
|
+
T: "T (stopped)",
|
|
11215
|
+
Z: "Z (zombie)"
|
|
11216
|
+
};
|
|
11206
11217
|
var tagLine = (tag) => `Tag: ${tag.replaceAll("\n", "\\n").replaceAll(" ", "\\t").replaceAll("\r", "\\r")}`;
|
|
11218
|
+
function taskStat(info, tid, boot) {
|
|
11219
|
+
const thread = (info.threads ?? [{ tid: 1, state: info.state }]).find((t) => t.tid === tid);
|
|
11220
|
+
return thread && pidStat({ ...info, pid: tid }, boot, thread.state);
|
|
11221
|
+
}
|
|
11222
|
+
function taskIds(info) {
|
|
11223
|
+
return (info.threads ?? [{ tid: 1 }]).map((t) => t.tid);
|
|
11224
|
+
}
|
|
11207
11225
|
function pidStatus(info) {
|
|
11208
11226
|
const state = STATES[info.state];
|
|
11209
11227
|
const c = info.cred ?? ROOT;
|
|
@@ -11381,8 +11399,10 @@ var ProcTree = class {
|
|
|
11381
11399
|
content: () => systemFile(top, this.listing(), Date.now(), this.memory)
|
|
11382
11400
|
};
|
|
11383
11401
|
}
|
|
11384
|
-
if (!/^[1-9]\d*$/.test(top) ||
|
|
11385
|
-
if (leaf ===
|
|
11402
|
+
if (!/^[1-9]\d*$/.test(top) || !this.alive(Number(top))) return void 0;
|
|
11403
|
+
if (leaf === "task") return this.task(Number(top), rest2);
|
|
11404
|
+
if (rest2.length > 0) return void 0;
|
|
11405
|
+
if (leaf === void 0) return { kind: "dir", names: () => [...PID_NAMES, "task"] };
|
|
11386
11406
|
if (!PID_NAMES.includes(leaf)) return void 0;
|
|
11387
11407
|
return {
|
|
11388
11408
|
kind: "file",
|
|
@@ -11394,6 +11414,28 @@ var ProcTree = class {
|
|
|
11394
11414
|
}
|
|
11395
11415
|
};
|
|
11396
11416
|
}
|
|
11417
|
+
info(pid) {
|
|
11418
|
+
return this.listing().processes.find((p) => p.pid === pid);
|
|
11419
|
+
}
|
|
11420
|
+
task(pid, rest2) {
|
|
11421
|
+
const [tid, leaf, ...more] = rest2;
|
|
11422
|
+
const tids = () => taskIds(this.info(pid));
|
|
11423
|
+
if (tid === void 0) return { kind: "dir", names: () => tids().map(String) };
|
|
11424
|
+
if (!/^[1-9]\d*$/.test(tid) || more.length > 0 || !tids().includes(Number(tid)))
|
|
11425
|
+
return void 0;
|
|
11426
|
+
if (leaf === void 0) return { kind: "dir", names: () => ["stat"] };
|
|
11427
|
+
if (leaf !== "stat") return void 0;
|
|
11428
|
+
return {
|
|
11429
|
+
kind: "file",
|
|
11430
|
+
content: () => {
|
|
11431
|
+
const listing = this.listing();
|
|
11432
|
+
const info = listing.processes.find((p) => p.pid === pid);
|
|
11433
|
+
const line = info && taskStat(info, Number(tid), listing.boot);
|
|
11434
|
+
if (line === void 0) throw syncError("ENOENT", `/proc/${pid}/task/${tid}/stat`);
|
|
11435
|
+
return line;
|
|
11436
|
+
}
|
|
11437
|
+
};
|
|
11438
|
+
}
|
|
11397
11439
|
parts(path, follow2) {
|
|
11398
11440
|
const parts2 = path.split("/").filter((p) => p !== "").slice(1);
|
|
11399
11441
|
if (parts2[0] === "self" && (follow2 || parts2.length > 1)) parts2[0] = String(this.pid);
|
|
@@ -14204,6 +14246,13 @@ var SEM_NAMES_MAX = 4096;
|
|
|
14204
14246
|
var SEM_HANDLES_MAX = 256;
|
|
14205
14247
|
var NAME_MAX = 251;
|
|
14206
14248
|
var TIMER_MAX_MS = 2147483647;
|
|
14249
|
+
var deadlines = /* @__PURE__ */ new WeakMap();
|
|
14250
|
+
function timeLeft(req, timeoutMs) {
|
|
14251
|
+
const now = performance.now();
|
|
14252
|
+
const deadline = deadlines.get(req) ?? now + timeoutMs;
|
|
14253
|
+
deadlines.set(req, deadline);
|
|
14254
|
+
return Math.max(0, deadline - now);
|
|
14255
|
+
}
|
|
14207
14256
|
var SEM_OPS = [
|
|
14208
14257
|
"sem-open",
|
|
14209
14258
|
"sem-close",
|
|
@@ -14390,8 +14439,9 @@ async function semSyscall(req, proc) {
|
|
|
14390
14439
|
const sem = handles.get(req.handle);
|
|
14391
14440
|
if (sem.take()) return ok2();
|
|
14392
14441
|
if (req.how === "try") throw new KernelError("EAGAIN");
|
|
14393
|
-
|
|
14394
|
-
|
|
14442
|
+
const timeoutMs = req.how === "block" ? -1 : timeLeft(req, req.timeoutMs);
|
|
14443
|
+
if (timeoutMs === 0) throw new KernelError("ETIMEDOUT");
|
|
14444
|
+
const got = await sem.wait(proc.blocking(), timeoutMs);
|
|
14395
14445
|
if (!got) throw new KernelError("ETIMEDOUT");
|
|
14396
14446
|
return ok2();
|
|
14397
14447
|
}
|
|
@@ -17045,8 +17095,14 @@ function spawnWasmProcess(opts) {
|
|
|
17045
17095
|
umask: () => process2.umask,
|
|
17046
17096
|
cred: () => copyCred(process2.cred),
|
|
17047
17097
|
writesBack: () => opts.program.abi === "wasi" && !done4,
|
|
17098
|
+
...clockViews(clocks)
|
|
17099
|
+
};
|
|
17100
|
+
}
|
|
17101
|
+
function clockViews(clocks) {
|
|
17102
|
+
return {
|
|
17048
17103
|
times: () => clocks.times(),
|
|
17049
|
-
running: () => clocks.running()
|
|
17104
|
+
running: () => clocks.running(),
|
|
17105
|
+
threads: () => clocks.states()
|
|
17050
17106
|
};
|
|
17051
17107
|
}
|
|
17052
17108
|
|
|
@@ -21568,6 +21624,7 @@ var Launcher = class {
|
|
|
21568
21624
|
...described2,
|
|
21569
21625
|
started: (this.described.get(root.pid) ?? described2).started,
|
|
21570
21626
|
state: this.stateOf(member.pid),
|
|
21627
|
+
...this.threadsOf(member.pid),
|
|
21571
21628
|
memory: this.processes.get(member.pid)?.memory() ?? 0,
|
|
21572
21629
|
...this.timesOf(member, members),
|
|
21573
21630
|
...this.childrenOf(root.pid),
|
|
@@ -21579,6 +21636,10 @@ var Launcher = class {
|
|
|
21579
21636
|
}
|
|
21580
21637
|
return listed;
|
|
21581
21638
|
}
|
|
21639
|
+
threadsOf(pid) {
|
|
21640
|
+
const threads = this.stateOf(pid) === "S" ? this.processes.get(pid)?.threads?.() : void 0;
|
|
21641
|
+
return threads ? { threads } : {};
|
|
21642
|
+
}
|
|
21582
21643
|
sudo(pid, call, signal) {
|
|
21583
21644
|
const caller = {
|
|
21584
21645
|
cred: this.credOf(pid),
|