@ai-ecoverse/slicc-kernel 1.17.3 → 1.17.4
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 +1 -1
- package/dist/kernel-worker.js +29 -4
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +26 -7
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +29 -4
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +26 -7
- package/dist/process-worker.js.map +2 -2
- package/package.json +1 -1
|
@@ -211,7 +211,13 @@ function createHelpers(Fs, ops) {
|
|
|
211
211
|
}
|
|
212
212
|
function truncate(node, size) {
|
|
213
213
|
const s = node.live;
|
|
214
|
-
if (!s.orphan
|
|
214
|
+
if (!s.orphan) {
|
|
215
|
+
const st = statOf(node);
|
|
216
|
+
if (st.readonly) throw new Fs.ErrnoError(ERRNO_BY_CODE.EROFS);
|
|
217
|
+
if (st.maxFile !== void 0 && size > st.maxFile) {
|
|
218
|
+
throw new Fs.ErrnoError(ERRNO_BY_CODE.EFBIG);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
215
221
|
if (s.openCount > 0) {
|
|
216
222
|
if (size > 0) ensureLoaded(node);
|
|
217
223
|
else s.loaded = true;
|
|
@@ -402,7 +408,9 @@ function createStreamOps(h) {
|
|
|
402
408
|
if (!Fs.isFile(stream.node.mode)) return;
|
|
403
409
|
if ((stream.flags & 3) !== 0) {
|
|
404
410
|
try {
|
|
405
|
-
|
|
411
|
+
const st = statOf(stream.node);
|
|
412
|
+
if (st.readonly) throw new Fs.ErrnoError(ERRNO_BY_CODE.EROFS);
|
|
413
|
+
stream.node.live.maxFile = st.maxFile;
|
|
406
414
|
} catch (err) {
|
|
407
415
|
if (stream.fd !== void 0) Fs.closeStream?.(stream.fd);
|
|
408
416
|
throw err;
|
|
@@ -449,9 +457,10 @@ function createStreamOps(h) {
|
|
|
449
457
|
const node = stream.node;
|
|
450
458
|
if (Fs.isDir(node.mode)) throw new Fs.ErrnoError(ERRNO_BY_CODE.EISDIR);
|
|
451
459
|
if (length <= 0) return 0;
|
|
452
|
-
ensureLoaded(node);
|
|
453
460
|
const s = node.live;
|
|
454
461
|
const end = position + length;
|
|
462
|
+
if (s.maxFile !== void 0 && end > s.maxFile) throw new Fs.ErrnoError(ERRNO_BY_CODE.EFBIG);
|
|
463
|
+
ensureLoaded(node);
|
|
455
464
|
const buf = ensureCapacity(node, end);
|
|
456
465
|
if (position > s.len) buf.fill(0, s.len, position);
|
|
457
466
|
buf.set(new Uint8Array(buffer.buffer, buffer.byteOffset + offset, length), position);
|
|
@@ -751,7 +760,8 @@ function parseSyncFsStat(json) {
|
|
|
751
760
|
...typeof s.ctimeMs === "number" ? { ctimeMs: s.ctimeMs } : {},
|
|
752
761
|
...typeof s.ino === "number" ? { ino: s.ino } : {},
|
|
753
762
|
...typeof s.dev === "number" ? { dev: s.dev } : {},
|
|
754
|
-
...s.readonly === true ? { readonly: true } : {}
|
|
763
|
+
...s.readonly === true ? { readonly: true } : {},
|
|
764
|
+
...typeof s.maxFile === "number" ? { maxFile: s.maxFile } : {}
|
|
755
765
|
};
|
|
756
766
|
}
|
|
757
767
|
var SYNC_FS_REQUEST_TIMEOUT_MS;
|
|
@@ -3453,9 +3463,11 @@ var init_wasi_files = __esm({
|
|
|
3453
3463
|
opens = 0;
|
|
3454
3464
|
fs;
|
|
3455
3465
|
path;
|
|
3456
|
-
|
|
3466
|
+
maxFile;
|
|
3467
|
+
constructor(fs, path, empty, maxFile) {
|
|
3457
3468
|
this.fs = fs;
|
|
3458
3469
|
this.path = path;
|
|
3470
|
+
this.maxFile = maxFile;
|
|
3459
3471
|
if (empty) {
|
|
3460
3472
|
this.data = new Uint8Array(0);
|
|
3461
3473
|
this.dirty = true;
|
|
@@ -3477,9 +3489,14 @@ var init_wasi_files = __esm({
|
|
|
3477
3489
|
const n = Math.max(0, Math.min(max, this.length - at));
|
|
3478
3490
|
return bytes.subarray(at, at + n);
|
|
3479
3491
|
}
|
|
3492
|
+
fits(end) {
|
|
3493
|
+
if (this.maxFile !== void 0 && end > this.maxFile) throw new WasiError("EFBIG");
|
|
3494
|
+
}
|
|
3480
3495
|
pwrite(bytes, at) {
|
|
3481
|
-
|
|
3496
|
+
if (bytes.length === 0) return 0;
|
|
3482
3497
|
const end = at + bytes.length;
|
|
3498
|
+
this.fits(end);
|
|
3499
|
+
this.load();
|
|
3483
3500
|
this.ensure(end);
|
|
3484
3501
|
const buf = this.data;
|
|
3485
3502
|
if (at > this.length) buf.fill(0, this.length, at);
|
|
@@ -3489,6 +3506,7 @@ var init_wasi_files = __esm({
|
|
|
3489
3506
|
return bytes.length;
|
|
3490
3507
|
}
|
|
3491
3508
|
truncate(size) {
|
|
3509
|
+
this.fits(size);
|
|
3492
3510
|
this.load();
|
|
3493
3511
|
this.ensure(size);
|
|
3494
3512
|
if (size > this.length) this.data.fill(0, this.length, size);
|
|
@@ -4128,7 +4146,8 @@ var init_wasi_fds = __esm({
|
|
|
4128
4146
|
if (oflags & OFLAGS.TRUNC) buffer.truncate(0);
|
|
4129
4147
|
} else {
|
|
4130
4148
|
if (!existing) this.fs.writeFile(path, new Uint8Array(0));
|
|
4131
|
-
|
|
4149
|
+
const empty = !existing || (oflags & OFLAGS.TRUNC) !== 0;
|
|
4150
|
+
buffer = new FileBuffer(this.fs, path, empty, (existing ?? this.fs.stat(path)).maxFile);
|
|
4132
4151
|
this.buffers.set(path, buffer);
|
|
4133
4152
|
}
|
|
4134
4153
|
buffer.opens++;
|