@ai-ecoverse/slicc-kernel 1.110.8 → 1.111.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.
@@ -3188,6 +3188,7 @@ function decodeReceived(raw) {
3188
3188
  const length = view.getUint8(3);
3189
3189
  return {
3190
3190
  truncated: (view.getUint8(0) & 1) !== 0,
3191
+ unix: (view.getUint8(0) & 2) !== 0,
3191
3192
  port: view.getUint16(1),
3192
3193
  host: new TextDecoder().decode(raw.subarray(4, 4 + length)),
3193
3194
  bytes: raw.subarray(4 + length)
@@ -3370,7 +3371,7 @@ function ipv4(host) {
3370
3371
  }
3371
3372
  function openRequest(af, type) {
3372
3373
  if (af !== INET4 && af !== INET6 && af !== UNIX) throw new WasiError("EAFNOSUPPORT");
3373
- if (type !== STREAM && (type !== DGRAM || af === UNIX)) throw new WasiError("EPROTONOSUPPORT");
3374
+ if (type !== STREAM && type !== DGRAM) throw new WasiError("EPROTONOSUPPORT");
3374
3375
  const domain = af === UNIX ? "unix" : "inet";
3375
3376
  return {
3376
3377
  op: "sock-open",
@@ -3378,6 +3379,16 @@ function openRequest(af, type) {
3378
3379
  ...type === DGRAM ? { type: "dgram" } : {}
3379
3380
  };
3380
3381
  }
3382
+ function pairRequest(af, type) {
3383
+ if (af !== UNIX)
3384
+ throw new WasiError(af === INET4 || af === INET6 ? "EOPNOTSUPP" : "EAFNOSUPPORT");
3385
+ if (type !== STREAM && type !== DGRAM) throw new WasiError("EPROTONOSUPPORT");
3386
+ return {
3387
+ op: "sock-pair",
3388
+ domain: "unix",
3389
+ ...type === DGRAM ? { type: "dgram" } : {}
3390
+ };
3391
+ }
3381
3392
  function absolute(cwd, addr) {
3382
3393
  if (addr.family !== "unix" || addr.path === "" || addr.path.startsWith("\0")) return addr;
3383
3394
  return addr.path.startsWith("/") ? addr : { family: "unix", path: `${cwd}/${addr.path}` };
@@ -3398,12 +3409,13 @@ function datagramCalls(host) {
3398
3409
  const view = mem.view();
3399
3410
  view.setUint32(outLen, mem.scatter(iovs, n, got.bytes), true);
3400
3411
  view.setUint16(outFlags, got.truncated ? RECV_DATA_TRUNCATED : 0, true);
3401
- if (outAddr)
3402
- writeAddr(mem.view(), outAddr, { family: "inet", host: got.host, port: got.port });
3412
+ const from = got.unix ? { family: "unix", path: got.host } : { family: "inet", host: got.host, port: got.port };
3413
+ if (outAddr) writeAddr(mem.view(), outAddr, from);
3403
3414
  return E.SUCCESS;
3404
3415
  },
3405
3416
  sendTo(fd, nonblock, iovs, n, addr, out) {
3406
- const to = optionalAddr(mem.view(), addr);
3417
+ const named = optionalAddr(mem.view(), addr);
3418
+ const to = named && absolute(host.cwd, named);
3407
3419
  const body = mem.gather(iovs, n);
3408
3420
  const sent = call2({ op: "sock-sendto", fd, body, ...to ? { addr: to } : {}, nonblock });
3409
3421
  mem.view().setUint32(out, sent, true);
@@ -3437,14 +3449,12 @@ function wasixSocketImports(host, preview1) {
3437
3449
  mem.view().setUint32(out, fd, true);
3438
3450
  },
3439
3451
  sock_pair: (af, type, _proto, out1, out2) => {
3440
- if (af !== UNIX)
3441
- throw new WasiError(af === INET4 || af === INET6 ? "EOPNOTSUPP" : "EAFNOSUPPORT");
3442
- if (type !== STREAM) throw new WasiError("EPROTONOSUPPORT");
3452
+ const req = pairRequest(af, type);
3443
3453
  mem.view().setUint32(out1, 0, true);
3444
3454
  mem.view().setUint32(out2, 0, true);
3445
- const [a, b] = call2({ op: "sock-pair", domain: "unix" });
3446
- fds.adopt(a, "socket", false);
3447
- fds.adopt(b, "socket", false);
3455
+ const [a, b] = call2(req);
3456
+ fds.adopt(a, "socket", false, "type" in req);
3457
+ fds.adopt(b, "socket", false, "type" in req);
3448
3458
  mem.view().setUint32(out1, a, true);
3449
3459
  mem.view().setUint32(out2, b, true);
3450
3460
  },
@@ -5285,7 +5295,7 @@ var KERNEL_VERSION, OS_RELEASE;
5285
5295
  var init_version = __esm({
5286
5296
  "src/version.ts"() {
5287
5297
  "use strict";
5288
- KERNEL_VERSION = true ? "1.110.8" : "0.0.0-dev";
5298
+ KERNEL_VERSION = true ? "1.111.0" : "0.0.0-dev";
5289
5299
  OS_RELEASE = "6.0.0-slicc";
5290
5300
  }
5291
5301
  });