feat(booter): complete P2P POSIX roadmap items and doc alignment
- ADRs under docs/adr/; KERNEL_CONTRACT + env appendix + handbook updates - socketMsgSurface schema 5; replication_snapshot schema 2; syscall/example + tests - MBR pacing docs/microbench; export mbrReadTimeoutMsForDisk; shell passthrough envs - verify-ctx-api-feature-bits: syscall schema vs posix-compliance-matrix - Wasm hostname import, disk.os snapshot hints, kernel-ext resolution docs - coreutils nice + matrix/dashboard; syscalls.example ctxApiVersion 1.51.1 - Seeder kernel rsync parity; assorted booter/protocol doc fixes
This commit is contained in:
@@ -81,6 +81,7 @@ export const COREUTILS_COMMANDS = [
|
||||
'mount',
|
||||
'mv',
|
||||
'nano',
|
||||
'nice',
|
||||
'nl',
|
||||
'nohup',
|
||||
'nproc',
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "nice",
|
||||
"section": 1,
|
||||
"title": "invoke a utility with an altered scheduling priority (simulated)",
|
||||
"synopsis": [
|
||||
"nice [-n increment] utility [argument...]"
|
||||
],
|
||||
"description": "Bare OS implementation: records BARE_OS_SIMULATED_NICE on the session env and runs the utility via ctx.runBinCommand. The host JavaScript runtime does not change OS niceness; scripts use this for POSIX script compatibility.",
|
||||
"options": [],
|
||||
"keywords": [
|
||||
"nice",
|
||||
"bare-os",
|
||||
"coreutils"
|
||||
],
|
||||
"examples": [
|
||||
{
|
||||
"caption": "run with default increment",
|
||||
"code": "nice make"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
async function run(ctx, argv) {
|
||||
let inc = 10
|
||||
let i = 1
|
||||
if (argv[i] === '-n') {
|
||||
const n = Number.parseInt(String(argv[i + 1] ?? ''), 10)
|
||||
if (!Number.isFinite(n) || n < 0 || n > 39) {
|
||||
ctx.console.error('nice: invalid adjustment')
|
||||
ctx.exitCode = 125
|
||||
return
|
||||
}
|
||||
inc = n
|
||||
i += 2
|
||||
} else if (argv[i] && /^-\d+$/.test(argv[i])) {
|
||||
const n = Number.parseInt(argv[i].slice(1), 10)
|
||||
if (!Number.isFinite(n) || n < 0 || n > 39) {
|
||||
ctx.console.error('nice: invalid adjustment')
|
||||
ctx.exitCode = 125
|
||||
return
|
||||
}
|
||||
inc = n
|
||||
i++
|
||||
}
|
||||
const cmd = argv.slice(i)
|
||||
if (!cmd.length) {
|
||||
ctx.console.error('usage: nice [-n increment] utility [argument...]')
|
||||
ctx.exitCode = 125
|
||||
return
|
||||
}
|
||||
if (typeof ctx.runBinCommand !== 'function') {
|
||||
ctx.console.error('nice: runBinCommand is not available')
|
||||
ctx.exitCode = 125
|
||||
return
|
||||
}
|
||||
const env = ctx.vfs?.env
|
||||
if (env && typeof env === 'object') {
|
||||
env.BARE_OS_SIMULATED_NICE = String(inc)
|
||||
}
|
||||
await ctx.runBinCommand(cmd)
|
||||
}
|
||||
Reference in New Issue
Block a user