@ai-ecoverse/slicc-kernel 1.116.2 → 1.117.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.
@@ -39,6 +39,7 @@ export interface KernelFile {
39
39
  clipboard?: ClipboardChannel;
40
40
  held?: true;
41
41
  heldMeta?: HeldMeta;
42
+ identity?: object;
42
43
  fifo?: string;
43
44
  }
44
45
  export type HeldMeta = {
@@ -1,5 +1,5 @@
1
1
  import type { SyncFsResult } from '../realm/sync-fs-wire.js';
2
- import { type LockKind, type LockTable } from './locks.js';
2
+ import { type FlockKind, type LockKind, type LockTable } from './locks.js';
3
3
  export interface LockTarget {
4
4
  path?: string;
5
5
  fd?: number;
@@ -26,6 +26,11 @@ export type HostSyscall = {
26
26
  } & LockTarget) | ({
27
27
  op: 'lk-close';
28
28
  } & LockTarget) | {
29
+ op: 'flock';
30
+ fd: number;
31
+ kind: FlockKind | 'unlock';
32
+ wait?: boolean;
33
+ } | {
29
34
  op: 'async-submit';
30
35
  req: {
31
36
  op: string;
@@ -87,6 +92,10 @@ export interface HostOpsContext {
87
92
  pid: number;
88
93
  owner?: () => number;
89
94
  fileKey?: (target: LockTarget, kind: LockKind | 'unlock' | 'close', setting?: boolean) => Promise<string>;
95
+ flockOf?: (fd: number) => Promise<{
96
+ key: string;
97
+ owner: object;
98
+ }>;
90
99
  locks: LockTable | undefined;
91
100
  ops: AsyncOps;
92
101
  blocking: () => AbortSignal;
@@ -15,7 +15,18 @@ export declare function lockRange(start: number, len: number): {
15
15
  start: number;
16
16
  end: number;
17
17
  };
18
+ export type FlockKind = 'shared' | 'exclusive';
19
+ export declare class FlockTable {
20
+ private readonly held;
21
+ private readonly keys;
22
+ private readonly wakers;
23
+ private free;
24
+ set(key: string, owner: object, kind: FlockKind | 'unlock'): boolean;
25
+ wait(key: string, owner: object, kind: FlockKind, blocking: () => AbortSignal): Promise<void>;
26
+ drop(owner: object): void;
27
+ }
18
28
  export declare class LockTable {
29
+ readonly flocks: FlockTable;
19
30
  private readonly records;
20
31
  private readonly blocked;
21
32
  private readonly wakers;
@@ -475,6 +475,8 @@ export declare class WasmProcess {
475
475
  private readonly pathKeys;
476
476
  private lockPath;
477
477
  private lockKey;
478
+ private flockOf;
479
+ private objectKeyOf;
478
480
  private dropRecordLocks;
479
481
  private refuseIfPending;
480
482
  private procWait;
@@ -12,15 +12,18 @@ export interface LockedFile {
12
12
  offset(): number;
13
13
  size(): number;
14
14
  }
15
+ export type FlockKind = 'shared' | 'exclusive' | 'unlock';
15
16
  export interface LockCalls {
16
17
  set(target: LockTarget, kind: LockKind | 'unlock', start: number, len: number, wait: boolean): void;
17
18
  get(target: LockTarget, kind: LockKind, start: number, len: number): LockHeld | null;
19
+ flock(fd: number, kind: FlockKind, wait: boolean): void;
18
20
  }
19
21
  export interface LockHost {
20
22
  mem: WasiMemory;
21
23
  file(fd: number): LockedFile;
22
24
  flush(file: LockedFile): void;
23
25
  locked(): void;
26
+ promote(fd: number): void;
24
27
  calls: LockCalls;
25
28
  }
26
29
  export declare function lockImports(host: LockHost): Record<string, WasiFunction>;
@@ -2,7 +2,7 @@ import { type DeviceAccess, type DeviceMeta, type KernelFdKind } from '../../ker
2
2
  import type { WasmSyscall } from '../../kernel/process.js';
3
3
  import { type SyncFsBridgeStat, type SyncFsPosixBridge } from '../../realm/sync-fs-wire.js';
4
4
  import type { ProcessSys } from '../kernel-streams.js';
5
- import { type WasiEntry } from './wasi-files.js';
5
+ import { FileBuffer, type WasiEntry } from './wasi-files.js';
6
6
  export interface WasiKernel {
7
7
  sys: ProcessSys;
8
8
  call(req: WasmSyscall): unknown;
@@ -77,7 +77,8 @@ export declare class WasiFds {
77
77
  dup(fd: number, min: number, cloexec: boolean): number;
78
78
  pipe(): [number, number];
79
79
  chdir(path: string): void;
80
- promoteFiles(): void;
80
+ promote(fd: number): void;
81
+ promoteFiles(only?: FileBuffer): void;
81
82
  snapshot(): WasiForkFd[];
82
83
  restore(fds: readonly WasiForkFd[], cloexec: readonly number[]): void;
83
84
  inheritable(): Map<number, number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-kernel",
3
- "version": "1.116.2",
3
+ "version": "1.117.0",
4
4
  "description": "SLICC's wasm-realm kernel: run Emscripten programs in the browser against OPFS, with fork, spawn, pipes and waitpid",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",