21 lines
431 B
TypeScript
21 lines
431 B
TypeScript
import { SyscallContext, SysCallMapping } from "../system";
|
|
|
|
export function transportSyscalls(
|
|
names: string[],
|
|
transportCall: (
|
|
ctx: SyscallContext,
|
|
name: string,
|
|
...args: any[]
|
|
) => Promise<any>
|
|
): SysCallMapping {
|
|
let syscalls: SysCallMapping = {};
|
|
|
|
for (let name of names) {
|
|
syscalls[name] = (ctx, ...args: any[]) => {
|
|
return transportCall(ctx, name, ...args);
|
|
};
|
|
}
|
|
|
|
return syscalls;
|
|
}
|