2022-03-31 12:28:07 +00:00
|
|
|
import { SyscallContext, SysCallMapping } from "../system";
|
2022-03-25 11:03:06 +00:00
|
|
|
|
2022-04-05 15:02:17 +00:00
|
|
|
export function proxySyscalls(
|
2022-03-25 11:03:06 +00:00
|
|
|
names: string[],
|
2022-03-31 12:28:07 +00:00
|
|
|
transportCall: (
|
|
|
|
ctx: SyscallContext,
|
|
|
|
name: string,
|
|
|
|
...args: any[]
|
|
|
|
) => Promise<any>
|
2022-03-25 11:03:06 +00:00
|
|
|
): SysCallMapping {
|
|
|
|
let syscalls: SysCallMapping = {};
|
|
|
|
|
|
|
|
for (let name of names) {
|
|
|
|
syscalls[name] = (ctx, ...args: any[]) => {
|
2022-03-31 12:28:07 +00:00
|
|
|
return transportCall(ctx, name, ...args);
|
2022-03-25 11:03:06 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return syscalls;
|
|
|
|
}
|