@componentor/fs 3.0.41 → 3.0.42

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.
@@ -1362,6 +1362,40 @@ var VFSEngine = class {
1362
1362
  this.handle.flush();
1363
1363
  return { status: 0 };
1364
1364
  }
1365
+ // ---- FCHMOD ----
1366
+ // fd-based chmod: look up the inode directly from the fd table and mutate
1367
+ // its mode bits. Native Node does the same thing at the libuv layer.
1368
+ fchmod(fd, mode) {
1369
+ const entry = this.fdTable.get(fd);
1370
+ if (!entry) return { status: CODE_TO_STATUS.EBADF };
1371
+ const inode = this.readInode(entry.inodeIdx);
1372
+ inode.mode = inode.mode & S_IFMT | mode & 4095;
1373
+ inode.ctime = Date.now();
1374
+ this.writeInode(entry.inodeIdx, inode);
1375
+ return { status: 0 };
1376
+ }
1377
+ // ---- FCHOWN ----
1378
+ fchown(fd, uid, gid) {
1379
+ const entry = this.fdTable.get(fd);
1380
+ if (!entry) return { status: CODE_TO_STATUS.EBADF };
1381
+ const inode = this.readInode(entry.inodeIdx);
1382
+ inode.uid = uid;
1383
+ inode.gid = gid;
1384
+ inode.ctime = Date.now();
1385
+ this.writeInode(entry.inodeIdx, inode);
1386
+ return { status: 0 };
1387
+ }
1388
+ // ---- FUTIMES ----
1389
+ futimes(fd, atime, mtime) {
1390
+ const entry = this.fdTable.get(fd);
1391
+ if (!entry) return { status: CODE_TO_STATUS.EBADF };
1392
+ const inode = this.readInode(entry.inodeIdx);
1393
+ inode.atime = atime;
1394
+ inode.mtime = mtime;
1395
+ inode.ctime = Date.now();
1396
+ this.writeInode(entry.inodeIdx, inode);
1397
+ return { status: 0 };
1398
+ }
1365
1399
  // ---- OPENDIR ----
1366
1400
  opendir(path, tabId) {
1367
1401
  path = this.normalizePath(path);
@@ -1510,7 +1544,10 @@ var OP = {
1510
1544
  FTRUNCATE: 27,
1511
1545
  FSYNC: 28,
1512
1546
  OPENDIR: 29,
1513
- MKDTEMP: 30
1547
+ MKDTEMP: 30,
1548
+ FCHMOD: 31,
1549
+ FCHOWN: 32,
1550
+ FUTIMES: 33
1514
1551
  };
1515
1552
  var encoder2 = new TextEncoder();
1516
1553
  var decoder2 = new TextDecoder();
@@ -1720,6 +1757,41 @@ function handleRequest(tabId, buffer) {
1720
1757
  case OP.MKDTEMP:
1721
1758
  result = engine.mkdtemp(path);
1722
1759
  break;
1760
+ case OP.FCHMOD: {
1761
+ if (!data || data.byteLength < 8) {
1762
+ result = { status: 7 };
1763
+ break;
1764
+ }
1765
+ const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
1766
+ const fd = dv.getUint32(0, true);
1767
+ const mode = dv.getUint32(4, true);
1768
+ result = engine.fchmod(fd, mode);
1769
+ break;
1770
+ }
1771
+ case OP.FCHOWN: {
1772
+ if (!data || data.byteLength < 12) {
1773
+ result = { status: 7 };
1774
+ break;
1775
+ }
1776
+ const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
1777
+ const fd = dv.getUint32(0, true);
1778
+ const uid = dv.getUint32(4, true);
1779
+ const gid = dv.getUint32(8, true);
1780
+ result = engine.fchown(fd, uid, gid);
1781
+ break;
1782
+ }
1783
+ case OP.FUTIMES: {
1784
+ if (!data || data.byteLength < 24) {
1785
+ result = { status: 7 };
1786
+ break;
1787
+ }
1788
+ const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
1789
+ const fd = dv.getUint32(0, true);
1790
+ const atime = dv.getFloat64(8, true);
1791
+ const mtime = dv.getFloat64(16, true);
1792
+ result = engine.futimes(fd, atime, mtime);
1793
+ break;
1794
+ }
1723
1795
  default:
1724
1796
  result = { status: 7 };
1725
1797
  }