@ai-ecoverse/slicc-kernel 1.110.8 → 1.112.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.
@@ -2515,7 +2515,7 @@ var KERNEL_VERSION, OS_RELEASE;
2515
2515
  var init_version = __esm({
2516
2516
  "src/version.ts"() {
2517
2517
  "use strict";
2518
- KERNEL_VERSION = true ? "1.110.8" : "0.0.0-dev";
2518
+ KERNEL_VERSION = true ? "1.112.0" : "0.0.0-dev";
2519
2519
  OS_RELEASE = "6.0.0-slicc";
2520
2520
  }
2521
2521
  });
@@ -8344,6 +8344,7 @@ function decodeReceived(raw) {
8344
8344
  const length = view.getUint8(3);
8345
8345
  return {
8346
8346
  truncated: (view.getUint8(0) & 1) !== 0,
8347
+ unix: (view.getUint8(0) & 2) !== 0,
8347
8348
  port: view.getUint16(1),
8348
8349
  host: new TextDecoder().decode(raw.subarray(4, 4 + length)),
8349
8350
  bytes: raw.subarray(4 + length)
@@ -8480,7 +8481,7 @@ function ipv4(host) {
8480
8481
  }
8481
8482
  function openRequest(af, type) {
8482
8483
  if (af !== INET4 && af !== INET6 && af !== UNIX) throw new WasiError("EAFNOSUPPORT");
8483
- if (type !== STREAM && (type !== DGRAM || af === UNIX)) throw new WasiError("EPROTONOSUPPORT");
8484
+ if (type !== STREAM && type !== DGRAM) throw new WasiError("EPROTONOSUPPORT");
8484
8485
  const domain = af === UNIX ? "unix" : "inet";
8485
8486
  return {
8486
8487
  op: "sock-open",
@@ -8488,6 +8489,16 @@ function openRequest(af, type) {
8488
8489
  ...type === DGRAM ? { type: "dgram" } : {}
8489
8490
  };
8490
8491
  }
8492
+ function pairRequest(af, type) {
8493
+ if (af !== UNIX)
8494
+ throw new WasiError(af === INET4 || af === INET6 ? "EOPNOTSUPP" : "EAFNOSUPPORT");
8495
+ if (type !== STREAM && type !== DGRAM) throw new WasiError("EPROTONOSUPPORT");
8496
+ return {
8497
+ op: "sock-pair",
8498
+ domain: "unix",
8499
+ ...type === DGRAM ? { type: "dgram" } : {}
8500
+ };
8501
+ }
8491
8502
  function absolute(cwd, addr) {
8492
8503
  if (addr.family !== "unix" || addr.path === "" || addr.path.startsWith("\0")) return addr;
8493
8504
  return addr.path.startsWith("/") ? addr : { family: "unix", path: `${cwd}/${addr.path}` };
@@ -8508,12 +8519,13 @@ function datagramCalls(host) {
8508
8519
  const view = mem.view();
8509
8520
  view.setUint32(outLen, mem.scatter(iovs, n, got.bytes), true);
8510
8521
  view.setUint16(outFlags, got.truncated ? RECV_DATA_TRUNCATED : 0, true);
8511
- if (outAddr)
8512
- writeAddr(mem.view(), outAddr, { family: "inet", host: got.host, port: got.port });
8522
+ const from = got.unix ? { family: "unix", path: got.host } : { family: "inet", host: got.host, port: got.port };
8523
+ if (outAddr) writeAddr(mem.view(), outAddr, from);
8513
8524
  return E.SUCCESS;
8514
8525
  },
8515
8526
  sendTo(fd, nonblock, iovs, n, addr, out) {
8516
- const to = optionalAddr(mem.view(), addr);
8527
+ const named = optionalAddr(mem.view(), addr);
8528
+ const to = named && absolute(host.cwd, named);
8517
8529
  const body = mem.gather(iovs, n);
8518
8530
  const sent = call2({ op: "sock-sendto", fd, body, ...to ? { addr: to } : {}, nonblock });
8519
8531
  mem.view().setUint32(out, sent, true);
@@ -8547,14 +8559,12 @@ function wasixSocketImports(host, preview1) {
8547
8559
  mem.view().setUint32(out, fd, true);
8548
8560
  },
8549
8561
  sock_pair: (af, type, _proto, out1, out2) => {
8550
- if (af !== UNIX)
8551
- throw new WasiError(af === INET4 || af === INET6 ? "EOPNOTSUPP" : "EAFNOSUPPORT");
8552
- if (type !== STREAM) throw new WasiError("EPROTONOSUPPORT");
8562
+ const req = pairRequest(af, type);
8553
8563
  mem.view().setUint32(out1, 0, true);
8554
8564
  mem.view().setUint32(out2, 0, true);
8555
- const [a, b] = call2({ op: "sock-pair", domain: "unix" });
8556
- fds.adopt(a, "socket", false);
8557
- fds.adopt(b, "socket", false);
8565
+ const [a, b] = call2(req);
8566
+ fds.adopt(a, "socket", false, "type" in req);
8567
+ fds.adopt(b, "socket", false, "type" in req);
8558
8568
  mem.view().setUint32(out1, a, true);
8559
8569
  mem.view().setUint32(out2, b, true);
8560
8570
  },