@ai-ecoverse/slicc-kernel 1.58.0 → 1.58.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.
|
@@ -8420,7 +8420,7 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
8420
8420
|
const pidContent = (target, name2, own = false) => () => {
|
|
8421
8421
|
const listing = procList();
|
|
8422
8422
|
const info = find(listing.processes, target, own);
|
|
8423
|
-
if (!info) throw error(
|
|
8423
|
+
if (!info) throw error();
|
|
8424
8424
|
return pidFile(name2, info, listing.boot);
|
|
8425
8425
|
};
|
|
8426
8426
|
const pidNames = (names) => [.../* @__PURE__ */ new Set([...names, ...PID_FILES])];
|
|
@@ -8433,14 +8433,29 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
8433
8433
|
dir.node_ops.readdir = () => [".", "..", ...PID_FILES];
|
|
8434
8434
|
return dir;
|
|
8435
8435
|
};
|
|
8436
|
+
const scans = /* @__PURE__ */ new Map();
|
|
8437
|
+
const listed = (target) => {
|
|
8438
|
+
let found = false;
|
|
8439
|
+
for (const [stream, pids] of scans) {
|
|
8440
|
+
if (Fs.streams && Fs.streams[stream.fd ?? -1] !== stream) scans.delete(stream);
|
|
8441
|
+
else found ||= pids.has(target);
|
|
8442
|
+
}
|
|
8443
|
+
return found;
|
|
8444
|
+
};
|
|
8436
8445
|
const procOps = proc.node_ops;
|
|
8437
8446
|
const lookup = procOps.lookup?.bind(procOps);
|
|
8438
8447
|
const readdir = procOps.readdir?.bind(procOps);
|
|
8448
|
+
const listAll = (node) => {
|
|
8449
|
+
const names = new Set(readdir ? readdir(node) : [".", ".."]);
|
|
8450
|
+
for (const name2 of [...SYSTEM_FILES, "mounts"]) names.add(name2);
|
|
8451
|
+
for (const p of procList().processes) names.add(String(p.pid));
|
|
8452
|
+
return [...names];
|
|
8453
|
+
};
|
|
8439
8454
|
proc.node_ops = {
|
|
8440
8455
|
...procOps,
|
|
8441
8456
|
lookup: (parent, name2) => {
|
|
8442
8457
|
if (/^[1-9]\d*$/.test(name2)) {
|
|
8443
|
-
if (!infoOf(Number(name2))) throw error();
|
|
8458
|
+
if (!infoOf(Number(name2)) && !listed(Number(name2))) throw error();
|
|
8444
8459
|
return pidDir(name2, Number(name2));
|
|
8445
8460
|
}
|
|
8446
8461
|
if (name2 === "mounts") return file(parent, name2, () => mountTable(sys.mountList?.() ?? []));
|
|
@@ -8454,11 +8469,36 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
8454
8469
|
if (!lookup) throw error();
|
|
8455
8470
|
return lookup(parent, name2);
|
|
8456
8471
|
},
|
|
8457
|
-
readdir: (node) =>
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8472
|
+
readdir: (node) => listAll(node)
|
|
8473
|
+
};
|
|
8474
|
+
const track = (stream, names) => {
|
|
8475
|
+
let current = names;
|
|
8476
|
+
const remember = (list) => scans.set(stream, new Set(list.filter((n) => /^[1-9]\d*$/.test(n)).map(Number)));
|
|
8477
|
+
remember(current ?? []);
|
|
8478
|
+
Object.defineProperty(stream, "getdents", {
|
|
8479
|
+
configurable: true,
|
|
8480
|
+
enumerable: true,
|
|
8481
|
+
get: () => current,
|
|
8482
|
+
set: (next2) => {
|
|
8483
|
+
current = next2;
|
|
8484
|
+
if (next2) remember(next2);
|
|
8485
|
+
}
|
|
8486
|
+
});
|
|
8487
|
+
};
|
|
8488
|
+
const dirOps = proc.stream_ops ?? {};
|
|
8489
|
+
proc.stream_ops = {
|
|
8490
|
+
...dirOps,
|
|
8491
|
+
open: (stream) => {
|
|
8492
|
+
dirOps.open?.(stream);
|
|
8493
|
+
track(stream, listAll(proc));
|
|
8494
|
+
},
|
|
8495
|
+
dup: (stream) => {
|
|
8496
|
+
dirOps.dup?.(stream);
|
|
8497
|
+
track(stream, stream.getdents);
|
|
8498
|
+
},
|
|
8499
|
+
close: (stream) => {
|
|
8500
|
+
scans.delete(stream);
|
|
8501
|
+
dirOps.close?.(stream);
|
|
8462
8502
|
}
|
|
8463
8503
|
};
|
|
8464
8504
|
hashRemoveNode.call(Fs, self);
|
|
@@ -8482,7 +8522,7 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
8482
8522
|
readdir: (node) => pidNames(selfReaddir ? selfReaddir(node) : [".", ".."])
|
|
8483
8523
|
};
|
|
8484
8524
|
}
|
|
8485
|
-
var HZ, DIR_MODE2, FILE_MODE, LINK_MODE2, ENOENT,
|
|
8525
|
+
var HZ, DIR_MODE2, FILE_MODE, LINK_MODE2, ENOENT, EINVAL, UID2, KIB, FALLBACK_MEMORY, PID_FILES, SYSTEM_FILES, sigMask;
|
|
8486
8526
|
var init_procfs = __esm({
|
|
8487
8527
|
"src/process/procfs.ts"() {
|
|
8488
8528
|
"use strict";
|
|
@@ -8493,7 +8533,6 @@ var init_procfs = __esm({
|
|
|
8493
8533
|
FILE_MODE = 33060;
|
|
8494
8534
|
LINK_MODE2 = 41471;
|
|
8495
8535
|
ENOENT = 44;
|
|
8496
|
-
ESRCH = 71;
|
|
8497
8536
|
EINVAL = 28;
|
|
8498
8537
|
UID2 = 1e3;
|
|
8499
8538
|
KIB = 1024;
|