@ai-ecoverse/slicc-kernel 1.89.0 → 1.90.0
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 +31 -4
- package/dist/driver-worker.js +89 -1
- package/dist/driver-worker.js.map +3 -3
- package/dist/index.js +135 -5
- package/dist/index.js.map +3 -3
- package/dist/kernel-worker.js +287 -26
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-driver-worker.js +89 -1
- package/dist/node-driver-worker.js.map +3 -3
- package/dist/node-process-worker.js +76 -2
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +4436 -4102
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +76 -2
- package/dist/process-worker.js.map +3 -3
- package/package.json +2 -2
package/dist/process-worker.js
CHANGED
|
@@ -1942,6 +1942,50 @@ function useLiveChown(Fs) {
|
|
|
1942
1942
|
Fs.chown(target, uid, gid);
|
|
1943
1943
|
};
|
|
1944
1944
|
}
|
|
1945
|
+
function flushOne(Fs, node) {
|
|
1946
|
+
const s = node.live;
|
|
1947
|
+
if (!s.dirty || s.orphan || !(s.data || s.ranged)) return;
|
|
1948
|
+
try {
|
|
1949
|
+
if (s.ranged) s.ranged.flush();
|
|
1950
|
+
else {
|
|
1951
|
+
const bytes = s.data.slice(0, s.len);
|
|
1952
|
+
pinnedIo(node.mount.opts.bridge, s.handle).writeFile(liveNodePath(node), bytes, true);
|
|
1953
|
+
}
|
|
1954
|
+
} catch (err) {
|
|
1955
|
+
throw toErrno(Fs, err);
|
|
1956
|
+
}
|
|
1957
|
+
s.dirty = false;
|
|
1958
|
+
s.stat = void 0;
|
|
1959
|
+
}
|
|
1960
|
+
function linkable(bridge, path) {
|
|
1961
|
+
try {
|
|
1962
|
+
return bridge.lstat(path).linkable === true;
|
|
1963
|
+
} catch {
|
|
1964
|
+
return false;
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
function linkLive(Fs, from, to, follow2) {
|
|
1968
|
+
const target = to.replace(/\/+$/, "");
|
|
1969
|
+
const slash = target.lastIndexOf("/");
|
|
1970
|
+
const name2 = target.slice(slash + 1);
|
|
1971
|
+
const source = Fs.lookupPath(from, { follow: follow2 }).node;
|
|
1972
|
+
const parent = Fs.lookupPath(target.slice(0, slash) || "/", { follow: true }).node;
|
|
1973
|
+
if (!source.live || !parent.live) return false;
|
|
1974
|
+
flushOne(Fs, source);
|
|
1975
|
+
const base = liveNodePath(parent);
|
|
1976
|
+
const bridge = source.mount.opts.bridge;
|
|
1977
|
+
const path = liveNodePath(source);
|
|
1978
|
+
try {
|
|
1979
|
+
bridge.link(path, base === "/" ? `/${name2}` : `${base}/${name2}`);
|
|
1980
|
+
} catch (err) {
|
|
1981
|
+
const refused = toErrno(Fs, err);
|
|
1982
|
+
if (refused.errno !== wasiErrno("EPERM") || linkable(bridge, path)) throw refused;
|
|
1983
|
+
throw new Fs.ErrnoError(wasiErrno("EMLINK"));
|
|
1984
|
+
}
|
|
1985
|
+
source.live.stat = void 0;
|
|
1986
|
+
parent.live.listed = void 0;
|
|
1987
|
+
return true;
|
|
1988
|
+
}
|
|
1945
1989
|
function readingLinks(Fs) {
|
|
1946
1990
|
const readlink = Fs.readlink?.bind(Fs);
|
|
1947
1991
|
if (!readlink) return;
|
|
@@ -3302,6 +3346,32 @@ function kernelAccess(imports, fs, memory, glue) {
|
|
|
3302
3346
|
}
|
|
3303
3347
|
});
|
|
3304
3348
|
}
|
|
3349
|
+
function kernelLink(imports, fs, memory, glue) {
|
|
3350
|
+
wrapImport(
|
|
3351
|
+
imports,
|
|
3352
|
+
"linkat",
|
|
3353
|
+
glue,
|
|
3354
|
+
(own) => (olddirfd, oldpath, newdirfd, newpath, flags) => {
|
|
3355
|
+
const Fs = fs();
|
|
3356
|
+
const heap = memory();
|
|
3357
|
+
if (!Fs?.lookupPath || !heap) return own(olddirfd, oldpath, newdirfd, newpath, flags);
|
|
3358
|
+
const at = (dirfd, ptr) => {
|
|
3359
|
+
const name2 = cString(heap, ptr);
|
|
3360
|
+
return name2.startsWith("/") ? name2 : `${baseOf(Fs, dirfd)}/${name2}`;
|
|
3361
|
+
};
|
|
3362
|
+
try {
|
|
3363
|
+
const from = at(olddirfd, oldpath);
|
|
3364
|
+
const to = at(newdirfd, newpath);
|
|
3365
|
+
const follow2 = (flags & AT_SYMLINK_FOLLOW) !== 0;
|
|
3366
|
+
if (linkLive(Fs, from, to, follow2)) return 0;
|
|
3367
|
+
} catch (err) {
|
|
3368
|
+
return -errnoOf(err);
|
|
3369
|
+
}
|
|
3370
|
+
return own(olddirfd, oldpath, newdirfd, newpath, flags);
|
|
3371
|
+
},
|
|
3372
|
+
true
|
|
3373
|
+
);
|
|
3374
|
+
}
|
|
3305
3375
|
function kernelChdir(Fs) {
|
|
3306
3376
|
const { chdir, lookupPath, ErrnoError } = Fs;
|
|
3307
3377
|
if (!chdir || !lookupPath || !ErrnoError) return;
|
|
@@ -3329,7 +3399,7 @@ function linuxDevices(Fs) {
|
|
|
3329
3399
|
}
|
|
3330
3400
|
}
|
|
3331
3401
|
}
|
|
3332
|
-
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE2, O_CREAT2, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS, W_ACCESS, X_ACCESS, DEVICE_MODES;
|
|
3402
|
+
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE2, O_CREAT2, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, DEVICE_MODES;
|
|
3333
3403
|
var init_process_fds = __esm({
|
|
3334
3404
|
"src/process/process-fds.ts"() {
|
|
3335
3405
|
"use strict";
|
|
@@ -3364,6 +3434,7 @@ var init_process_fds = __esm({
|
|
|
3364
3434
|
mknodat: "__syscall_mknodat",
|
|
3365
3435
|
umask: "__syscall_umask",
|
|
3366
3436
|
faccessat: "__syscall_faccessat",
|
|
3437
|
+
linkat: "__syscall_linkat",
|
|
3367
3438
|
utimensat: "__syscall_utimensat",
|
|
3368
3439
|
getppid: "slicc_getppid_js",
|
|
3369
3440
|
resizeHeap: "emscripten_resize_heap",
|
|
@@ -3390,6 +3461,7 @@ var init_process_fds = __esm({
|
|
|
3390
3461
|
AT_EACCESS = 512;
|
|
3391
3462
|
W_ACCESS = 2;
|
|
3392
3463
|
X_ACCESS = 1;
|
|
3464
|
+
AT_SYMLINK_FOLLOW = 1024;
|
|
3393
3465
|
DEVICE_MODES = [
|
|
3394
3466
|
["/", 493],
|
|
3395
3467
|
["/dev", 493],
|
|
@@ -4213,7 +4285,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
4213
4285
|
var init_version = __esm({
|
|
4214
4286
|
"src/version.ts"() {
|
|
4215
4287
|
"use strict";
|
|
4216
|
-
KERNEL_VERSION = true ? "1.
|
|
4288
|
+
KERNEL_VERSION = true ? "1.90.0" : "0.0.0-dev";
|
|
4217
4289
|
OS_RELEASE = "6.0.0-slicc";
|
|
4218
4290
|
}
|
|
4219
4291
|
});
|
|
@@ -4884,6 +4956,7 @@ function kernelWrappers(imports, module, deps) {
|
|
|
4884
4956
|
const fsOf = () => ownValue(module, "FS");
|
|
4885
4957
|
noFollowUtimes(imports, fsOf, kernelGlue?.utimensat ?? utimensatOf(module), memory);
|
|
4886
4958
|
kernelAccess(imports, fsOf, memory, kernelGlue);
|
|
4959
|
+
kernelLink(imports, fsOf, memory, kernelGlue);
|
|
4887
4960
|
const glue = ownValue(module, "sliccFdImports");
|
|
4888
4961
|
syncFsync(imports, fsOf, glue);
|
|
4889
4962
|
positionalIo(imports, { glue, fs: fsOf, sys, memory });
|
|
@@ -5182,6 +5255,7 @@ var init_process_runtime = __esm({
|
|
|
5182
5255
|
" mknodat: typeof ___syscall_mknodat === 'function' ? ___syscall_mknodat : undefined,",
|
|
5183
5256
|
" umask: typeof ___syscall_umask === 'function' ? ___syscall_umask : undefined,",
|
|
5184
5257
|
" faccessat: typeof ___syscall_faccessat === 'function' ? ___syscall_faccessat : undefined,",
|
|
5258
|
+
" linkat: typeof ___syscall_linkat === 'function' ? ___syscall_linkat : undefined,",
|
|
5185
5259
|
" utimensat: typeof ___syscall_utimensat === 'function' ? ___syscall_utimensat : undefined,",
|
|
5186
5260
|
" getppid: typeof _slicc_getppid_js === 'function' ? _slicc_getppid_js : undefined,",
|
|
5187
5261
|
" resizeHeap: typeof _emscripten_resize_heap === 'function' ? _emscripten_resize_heap : undefined,",
|