mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 14:31:28 +00:00
add prestat struct
This commit is contained in:
@ -164,7 +164,7 @@ export declare function fd_prestat_get(
|
||||
/** Input: The file descriptor about which to retrieve information. */
|
||||
fd: fd,
|
||||
/** Input: The buffer where the description is stored. */
|
||||
buf: usize // TODO: struct<prestat>
|
||||
buf: struct<prestat>
|
||||
): errno;
|
||||
|
||||
/** Return a description of the given preopened file descriptor. */
|
||||
@ -1085,6 +1085,23 @@ export namespace oflags {
|
||||
}
|
||||
export type oflags = u16;
|
||||
|
||||
// TODO: undocumented
|
||||
export namespace preopentype {
|
||||
@inline
|
||||
export const DIR: preopentype = 0;
|
||||
}
|
||||
export type preopentype = u8;
|
||||
|
||||
// TODO: undocumented
|
||||
export abstract class prestat {
|
||||
type: preopentype;
|
||||
}
|
||||
|
||||
// TODO: undocumented
|
||||
export class dirprestat extends prestat {
|
||||
name_len: usize;
|
||||
}
|
||||
|
||||
/** Flags provided to `sock_recv`. */
|
||||
export namespace riflags {
|
||||
/** Returns the message without removing it from the socket's receive queue. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { dirent, rwevent, fdstat, filestat, iovec, clocksubscription, fdsubscription, signal } from "bindings/wasi";
|
||||
import { dirent, rwevent, fdstat, filestat, iovec, clocksubscription, fdsubscription, signal, dirprestat } from "bindings/wasi";
|
||||
|
||||
// TODO: WASM64
|
||||
|
||||
@ -49,6 +49,10 @@ assert(offsetof<fdsubscription>("type") == 8);
|
||||
assert(offsetof<fdsubscription>("fd") == 16);
|
||||
assert(offsetof<fdsubscription>() == 20);
|
||||
|
||||
assert(offsetof<dirprestat>("type") == 0);
|
||||
assert(offsetof<dirprestat>("name_len") == 4);
|
||||
assert(offsetof<dirprestat>() == 8);
|
||||
|
||||
// check assignability of mimicked typed enums
|
||||
var sig: signal = signal.HUP;
|
||||
sig = signal.KILL;
|
||||
|
@ -492,6 +492,42 @@
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.eq
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 52
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 4
|
||||
i32.const 4
|
||||
i32.eq
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 53
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 8
|
||||
i32.const 8
|
||||
i32.eq
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 54
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 9
|
||||
global.set $wasi/sig
|
||||
)
|
||||
|
Reference in New Issue
Block a user