1pub const __bool_true_false_are_defined: u32 = 1;
4pub const true_: u32 = 1;
5pub const false_: u32 = 0;
6pub const NAME_ENTRY_LEN: u32 = 256;
7pub type wchar_t = ::core::ffi::c_int;
8#[repr(C)]
9#[repr(align(16))]
10#[derive(Debug, Copy, Clone)]
11pub struct max_align_t {
12 pub __clang_max_align_nonce1: ::core::ffi::c_longlong,
13 pub __bindgen_padding_0: u64,
14 pub __clang_max_align_nonce2: u128,
15}
16#[allow(clippy::unnecessary_operation, clippy::identity_op)]
17const _: () = {
18 ["Size of max_align_t"][::core::mem::size_of::<max_align_t>() - 32usize];
19 ["Alignment of max_align_t"][::core::mem::align_of::<max_align_t>() - 16usize];
20 ["Offset of field: max_align_t::__clang_max_align_nonce1"]
21 [::core::mem::offset_of!(max_align_t, __clang_max_align_nonce1) - 0usize];
22 ["Offset of field: max_align_t::__clang_max_align_nonce2"]
23 [::core::mem::offset_of!(max_align_t, __clang_max_align_nonce2) - 16usize];
24};
25pub type int_least64_t = i64;
26pub type uint_least64_t = u64;
27pub type int_fast64_t = i64;
28pub type uint_fast64_t = u64;
29pub type int_least32_t = i32;
30pub type uint_least32_t = u32;
31pub type int_fast32_t = i32;
32pub type uint_fast32_t = u32;
33pub type int_least16_t = i16;
34pub type uint_least16_t = u16;
35pub type int_fast16_t = i16;
36pub type uint_fast16_t = u16;
37pub type int_least8_t = i8;
38pub type uint_least8_t = u8;
39pub type int_fast8_t = i8;
40pub type uint_fast8_t = u8;
41pub type intmax_t = ::core::ffi::c_long;
42pub type uintmax_t = ::core::ffi::c_ulong;
43#[doc = " Object ID"]
44pub type objid = __uint128_t;
45#[doc = " Duration, containing seconds and nanoseconds."]
46#[repr(C)]
47#[derive(Debug, Copy, Clone)]
48pub struct duration {
49 pub seconds: u64,
50 pub nanos: u32,
51}
52#[allow(clippy::unnecessary_operation, clippy::identity_op)]
53const _: () = {
54 ["Size of duration"][::core::mem::size_of::<duration>() - 16usize];
55 ["Alignment of duration"][::core::mem::align_of::<duration>() - 8usize];
56 ["Offset of field: duration::seconds"][::core::mem::offset_of!(duration, seconds) - 0usize];
57 ["Offset of field: duration::nanos"][::core::mem::offset_of!(duration, nanos) - 8usize];
58};
59#[doc = " Optional duration."]
60#[repr(C)]
61#[derive(Debug, Copy, Clone)]
62pub struct option_duration {
63 pub dur: duration,
64 pub is_some: i32,
65}
66#[allow(clippy::unnecessary_operation, clippy::identity_op)]
67const _: () = {
68 ["Size of option_duration"][::core::mem::size_of::<option_duration>() - 24usize];
69 ["Alignment of option_duration"][::core::mem::align_of::<option_duration>() - 8usize];
70 ["Offset of field: option_duration::dur"]
71 [::core::mem::offset_of!(option_duration, dur) - 0usize];
72 ["Offset of field: option_duration::is_some"]
73 [::core::mem::offset_of!(option_duration, is_some) - 16usize];
74};
75unsafe extern "C" {
76 pub static NO_DURATION: option_duration;
77}
78pub type twz_error = u64;
79pub type twz_error_code = u16;
80pub type twz_error_category = u16;
81pub const ERROR_CODE_SHIFT: twz_error = 0;
82pub const ERROR_CODE_MASK: twz_error = 65535;
83pub const ERROR_CATEGORY_MASK: twz_error = 281470681743360;
84pub const ERROR_CATEGORY_SHIFT: twz_error = 32;
85pub const SUCCESS: twz_error_code = 0;
86pub const OTHER_ERROR: twz_error_code = 0;
87pub const NOT_SUPPORTED: twz_error_code = 1;
88pub const INTERNAL: twz_error_code = 2;
89pub const WOULD_BLOCK: twz_error_code = 3;
90pub const TIMED_OUT: twz_error_code = 4;
91pub const ACCESS_DENIED: twz_error_code = 5;
92pub const NO_SUCH_OPERATION: twz_error_code = 6;
93pub const INTERRUPTED: twz_error_code = 7;
94pub const IN_PROGRESS: twz_error_code = 8;
95pub const INVALID_ARGUMENT: twz_error_code = 1;
96pub const WRONG_TYPE: twz_error_code = 2;
97pub const INVALID_ADDRESS: twz_error_code = 3;
98pub const BAD_HANDLE: twz_error_code = 4;
99pub const OUT_OF_MEMORY: twz_error_code = 1;
100pub const OUT_OF_RESOURCES: twz_error_code = 2;
101pub const OUT_OF_NAMES: twz_error_code = 3;
102pub const UNAVAILABLE: twz_error_code = 4;
103pub const BUSY: twz_error_code = 5;
104pub const NOT_CONNECTED: twz_error_code = 6;
105pub const UNREACHABLE: twz_error_code = 7;
106pub const REFUSED: twz_error_code = 8;
107pub const NON_ATOMIC: twz_error_code = 9;
108pub const NOT_FOUND: twz_error_code = 1;
109pub const ALREADY_EXISTS: twz_error_code = 2;
110pub const WRONG_NAME_KIND: twz_error_code = 3;
111pub const ALREADY_BOUND: twz_error_code = 4;
112pub const INVALID_NAME: twz_error_code = 5;
113pub const LINK_LOOP: twz_error_code = 6;
114pub const NOT_EMPTY: twz_error_code = 7;
115pub const MAPPING_FAILED: twz_error_code = 1;
116pub const NOT_MAPPED: twz_error_code = 2;
117pub const INVALID_FOTE: twz_error_code = 3;
118pub const INVALID_PTR: twz_error_code = 4;
119pub const INVALID_META: twz_error_code = 5;
120pub const BASETYPE_MISMATCH: twz_error_code = 6;
121pub const NO_SUCH_OBJECT: twz_error_code = 7;
122pub const OTHER_IO_ERROR: twz_error_code = 1;
123pub const DATA_LOSS: twz_error_code = 2;
124pub const DEVICE_ERROR: twz_error_code = 3;
125pub const SEEK_FAILED: twz_error_code = 4;
126pub const RESET: twz_error_code = 5;
127pub const INVALID_KEY: twz_error_code = 1;
128pub const INVALID_SCHEME: twz_error_code = 2;
129pub const SIGNATURE_MISMATCH: twz_error_code = 3;
130pub const GATE_DENIED: twz_error_code = 4;
131pub const INVALID_GATE: twz_error_code = 5;
132pub const UNCATEGORIZED_ERROR: twz_error_category = 0;
133pub const GENERIC_ERROR: twz_error_category = 1;
134pub const ARGUMENT_ERROR: twz_error_category = 2;
135pub const RESOURCE_ERROR: twz_error_category = 3;
136pub const NAMING_ERROR: twz_error_category = 4;
137pub const OBJECT_ERROR: twz_error_category = 5;
138pub const IO_ERROR: twz_error_category = 6;
139pub const SECURITY_ERROR: twz_error_category = 7;
140#[doc = " Error or value"]
141#[repr(C)]
142#[derive(Debug, Copy, Clone)]
143pub struct u32_result {
144 pub err: twz_error,
145 pub val: u32,
146}
147#[allow(clippy::unnecessary_operation, clippy::identity_op)]
148const _: () = {
149 ["Size of u32_result"][::core::mem::size_of::<u32_result>() - 16usize];
150 ["Alignment of u32_result"][::core::mem::align_of::<u32_result>() - 8usize];
151 ["Offset of field: u32_result::err"][::core::mem::offset_of!(u32_result, err) - 0usize];
152 ["Offset of field: u32_result::val"][::core::mem::offset_of!(u32_result, val) - 8usize];
153};
154#[doc = " Error or value"]
155#[repr(C)]
156#[derive(Debug, Copy, Clone)]
157pub struct u64_result {
158 pub err: twz_error,
159 pub val: u64,
160}
161#[allow(clippy::unnecessary_operation, clippy::identity_op)]
162const _: () = {
163 ["Size of u64_result"][::core::mem::size_of::<u64_result>() - 16usize];
164 ["Alignment of u64_result"][::core::mem::align_of::<u64_result>() - 8usize];
165 ["Offset of field: u64_result::err"][::core::mem::offset_of!(u64_result, err) - 0usize];
166 ["Offset of field: u64_result::val"][::core::mem::offset_of!(u64_result, val) - 8usize];
167};
168#[doc = " Error or value"]
169#[repr(C)]
170#[repr(align(16))]
171#[derive(Debug, Copy, Clone)]
172pub struct objid_result {
173 pub err: twz_error,
174 pub __bindgen_padding_0: u64,
175 pub val: objid,
176}
177#[allow(clippy::unnecessary_operation, clippy::identity_op)]
178const _: () = {
179 ["Size of objid_result"][::core::mem::size_of::<objid_result>() - 32usize];
180 ["Alignment of objid_result"][::core::mem::align_of::<objid_result>() - 16usize];
181 ["Offset of field: objid_result::err"][::core::mem::offset_of!(objid_result, err) - 0usize];
182 ["Offset of field: objid_result::val"][::core::mem::offset_of!(objid_result, val) - 16usize];
183};
184#[doc = " Error or value"]
185#[repr(C)]
186#[derive(Debug, Copy, Clone)]
187pub struct ptr_result {
188 pub err: twz_error,
189 pub val: *mut ::core::ffi::c_void,
190}
191#[allow(clippy::unnecessary_operation, clippy::identity_op)]
192const _: () = {
193 ["Size of ptr_result"][::core::mem::size_of::<ptr_result>() - 16usize];
194 ["Alignment of ptr_result"][::core::mem::align_of::<ptr_result>() - 8usize];
195 ["Offset of field: ptr_result::err"][::core::mem::offset_of!(ptr_result, err) - 0usize];
196 ["Offset of field: ptr_result::val"][::core::mem::offset_of!(ptr_result, val) - 8usize];
197};
198#[doc = " Error or value"]
199#[repr(C)]
200#[derive(Debug, Copy, Clone)]
201pub struct io_result {
202 pub err: twz_error,
203 pub val: usize,
204}
205#[allow(clippy::unnecessary_operation, clippy::identity_op)]
206const _: () = {
207 ["Size of io_result"][::core::mem::size_of::<io_result>() - 16usize];
208 ["Alignment of io_result"][::core::mem::align_of::<io_result>() - 8usize];
209 ["Offset of field: io_result::err"][::core::mem::offset_of!(io_result, err) - 0usize];
210 ["Offset of field: io_result::val"][::core::mem::offset_of!(io_result, val) - 8usize];
211};
212#[doc = " Allocation flags"]
213pub type alloc_flags = u32;
214#[doc = " Zero memory during operation"]
215pub const ZERO_MEMORY: alloc_flags = 1;
216unsafe extern "C-unwind" {
217 #[doc = " Allocate memory, zeroing it first if the flag is set."]
218 pub fn twz_rt_malloc(sz: usize, align: usize, flags: alloc_flags) -> *mut ::core::ffi::c_void;
219}
220unsafe extern "C-unwind" {
221 #[doc = " Deallocate memory. If ZERO_MEMORY is set, will clear the memory before freeing."]
222 pub fn twz_rt_dealloc(
223 ptr: *mut ::core::ffi::c_void,
224 sz: usize,
225 align: usize,
226 flags: alloc_flags,
227 );
228}
229unsafe extern "C-unwind" {
230 #[doc = " Reallocate memory. If ZERO_MEMORY is set, will zero new memory before returning and zero to-be-freed memory before freeing."]
231 pub fn twz_rt_realloc(
232 ptr: *mut ::core::ffi::c_void,
233 sz: usize,
234 align: usize,
235 new_size: usize,
236 flags: alloc_flags,
237 ) -> *mut ::core::ffi::c_void;
238}
239#[doc = " Exit code type"]
240pub type exit_code = i32;
241#[doc = " Basic OS information provided to rust libstd"]
242#[repr(C)]
243#[derive(Debug, Copy, Clone)]
244pub struct basic_aux {
245 #[doc = " Number of arguments"]
246 pub argc: usize,
247 #[doc = " Pointer to args"]
248 pub args: *mut *mut ::core::ffi::c_char,
249 #[doc = " Environment pointer"]
250 pub env: *mut *mut ::core::ffi::c_char,
251}
252#[allow(clippy::unnecessary_operation, clippy::identity_op)]
253const _: () = {
254 ["Size of basic_aux"][::core::mem::size_of::<basic_aux>() - 24usize];
255 ["Alignment of basic_aux"][::core::mem::align_of::<basic_aux>() - 8usize];
256 ["Offset of field: basic_aux::argc"][::core::mem::offset_of!(basic_aux, argc) - 0usize];
257 ["Offset of field: basic_aux::args"][::core::mem::offset_of!(basic_aux, args) - 8usize];
258 ["Offset of field: basic_aux::env"][::core::mem::offset_of!(basic_aux, env) - 16usize];
259};
260#[doc = " Return info from rust libstd"]
261#[repr(C)]
262#[derive(Debug, Copy, Clone)]
263pub struct basic_return {
264 pub code: exit_code,
265}
266#[allow(clippy::unnecessary_operation, clippy::identity_op)]
267const _: () = {
268 ["Size of basic_return"][::core::mem::size_of::<basic_return>() - 4usize];
269 ["Alignment of basic_return"][::core::mem::align_of::<basic_return>() - 4usize];
270 ["Offset of field: basic_return::code"][::core::mem::offset_of!(basic_return, code) - 0usize];
271};
272#[repr(C)]
273#[derive(Debug, Copy, Clone)]
274pub struct ctor_set {
275 #[doc = " Fn ptr to _init"]
276 pub legacy_init: ::core::option::Option<unsafe extern "C-unwind" fn()>,
277 #[doc = " Pointer to the init array"]
278 pub init_array: *mut ::core::option::Option<unsafe extern "C-unwind" fn()>,
279 #[doc = " Length of init array"]
280 pub init_array_len: usize,
281}
282#[allow(clippy::unnecessary_operation, clippy::identity_op)]
283const _: () = {
284 ["Size of ctor_set"][::core::mem::size_of::<ctor_set>() - 24usize];
285 ["Alignment of ctor_set"][::core::mem::align_of::<ctor_set>() - 8usize];
286 ["Offset of field: ctor_set::legacy_init"]
287 [::core::mem::offset_of!(ctor_set, legacy_init) - 0usize];
288 ["Offset of field: ctor_set::init_array"]
289 [::core::mem::offset_of!(ctor_set, init_array) - 8usize];
290 ["Offset of field: ctor_set::init_array_len"]
291 [::core::mem::offset_of!(ctor_set, init_array_len) - 16usize];
292};
293#[doc = " Init information for compartments"]
294#[repr(C)]
295#[derive(Debug, Copy, Clone)]
296pub struct comp_init_info {
297 #[doc = " Pointer to ctor_set list"]
298 pub ctor_set_array: *mut ctor_set,
299 #[doc = " Length of ctor_set array"]
300 pub ctor_set_len: usize,
301 #[doc = " Pointer to compartment config info"]
302 pub comp_config_info: *mut ::core::ffi::c_void,
303}
304#[allow(clippy::unnecessary_operation, clippy::identity_op)]
305const _: () = {
306 ["Size of comp_init_info"][::core::mem::size_of::<comp_init_info>() - 24usize];
307 ["Alignment of comp_init_info"][::core::mem::align_of::<comp_init_info>() - 8usize];
308 ["Offset of field: comp_init_info::ctor_set_array"]
309 [::core::mem::offset_of!(comp_init_info, ctor_set_array) - 0usize];
310 ["Offset of field: comp_init_info::ctor_set_len"]
311 [::core::mem::offset_of!(comp_init_info, ctor_set_len) - 8usize];
312 ["Offset of field: comp_init_info::comp_config_info"]
313 [::core::mem::offset_of!(comp_init_info, comp_config_info) - 16usize];
314};
315#[doc = " Init information for minimal runtime"]
316#[repr(C)]
317#[derive(Debug, Copy, Clone)]
318pub struct minimal_init_info {
319 #[doc = " Pointer to program headers"]
320 pub phdrs: *mut ::core::ffi::c_void,
321 #[doc = " Number of program headers"]
322 pub nr_phdrs: usize,
323}
324#[allow(clippy::unnecessary_operation, clippy::identity_op)]
325const _: () = {
326 ["Size of minimal_init_info"][::core::mem::size_of::<minimal_init_info>() - 16usize];
327 ["Alignment of minimal_init_info"][::core::mem::align_of::<minimal_init_info>() - 8usize];
328 ["Offset of field: minimal_init_info::phdrs"]
329 [::core::mem::offset_of!(minimal_init_info, phdrs) - 0usize];
330 ["Offset of field: minimal_init_info::nr_phdrs"]
331 [::core::mem::offset_of!(minimal_init_info, nr_phdrs) - 8usize];
332};
333#[doc = " Possible init info types"]
334#[repr(C)]
335#[derive(Copy, Clone)]
336pub union init_info_ptrs {
337 pub comp: *mut comp_init_info,
338 pub min: *mut minimal_init_info,
339 pub monitor: *mut ::core::ffi::c_void,
340}
341#[allow(clippy::unnecessary_operation, clippy::identity_op)]
342const _: () = {
343 ["Size of init_info_ptrs"][::core::mem::size_of::<init_info_ptrs>() - 8usize];
344 ["Alignment of init_info_ptrs"][::core::mem::align_of::<init_info_ptrs>() - 8usize];
345 ["Offset of field: init_info_ptrs::comp"]
346 [::core::mem::offset_of!(init_info_ptrs, comp) - 0usize];
347 ["Offset of field: init_info_ptrs::min"][::core::mem::offset_of!(init_info_ptrs, min) - 0usize];
348 ["Offset of field: init_info_ptrs::monitor"]
349 [::core::mem::offset_of!(init_info_ptrs, monitor) - 0usize];
350};
351#[doc = " Runtime initialization info."]
352#[repr(C)]
353#[derive(Copy, Clone)]
354pub struct runtime_info {
355 pub flags: i32,
356 #[doc = " Discrim. for init_info."]
357 pub kind: i32,
358 #[doc = " Pointer to args"]
359 pub args: *mut *mut ::core::ffi::c_char,
360 #[doc = " Number of args"]
361 pub argc: usize,
362 #[doc = " Environment pointer"]
363 pub envp: *mut *mut ::core::ffi::c_char,
364 pub init_info: init_info_ptrs,
365}
366#[allow(clippy::unnecessary_operation, clippy::identity_op)]
367const _: () = {
368 ["Size of runtime_info"][::core::mem::size_of::<runtime_info>() - 40usize];
369 ["Alignment of runtime_info"][::core::mem::align_of::<runtime_info>() - 8usize];
370 ["Offset of field: runtime_info::flags"][::core::mem::offset_of!(runtime_info, flags) - 0usize];
371 ["Offset of field: runtime_info::kind"][::core::mem::offset_of!(runtime_info, kind) - 4usize];
372 ["Offset of field: runtime_info::args"][::core::mem::offset_of!(runtime_info, args) - 8usize];
373 ["Offset of field: runtime_info::argc"][::core::mem::offset_of!(runtime_info, argc) - 16usize];
374 ["Offset of field: runtime_info::envp"][::core::mem::offset_of!(runtime_info, envp) - 24usize];
375 ["Offset of field: runtime_info::init_info"]
376 [::core::mem::offset_of!(runtime_info, init_info) - 32usize];
377};
378#[doc = " Minimal runtime info"]
379pub const RUNTIME_INIT_MIN: i32 = 0;
380#[doc = " Info for monitor"]
381pub const RUNTIME_INIT_MONITOR: i32 = 1;
382#[doc = " Info for compartments"]
383pub const RUNTIME_INIT_COMP: i32 = 2;
384#[doc = " Optional exit code"]
385#[repr(C)]
386#[derive(Debug, Copy, Clone)]
387pub struct option_exit_code {
388 pub is_some: i32,
389 pub value: exit_code,
390}
391#[allow(clippy::unnecessary_operation, clippy::identity_op)]
392const _: () = {
393 ["Size of option_exit_code"][::core::mem::size_of::<option_exit_code>() - 8usize];
394 ["Alignment of option_exit_code"][::core::mem::align_of::<option_exit_code>() - 4usize];
395 ["Offset of field: option_exit_code::is_some"]
396 [::core::mem::offset_of!(option_exit_code, is_some) - 0usize];
397 ["Offset of field: option_exit_code::value"]
398 [::core::mem::offset_of!(option_exit_code, value) - 4usize];
399};
400unsafe extern "C-unwind" {
401 #[doc = " Exit with provided code"]
402 pub fn twz_rt_exit(code: exit_code);
403}
404unsafe extern "C-unwind" {
405 #[doc = " Abort immediately"]
406 pub fn twz_rt_abort();
407}
408unsafe extern "C-unwind" {
409 #[doc = " Signal the runtime to prep for entry from another compartment"]
410 pub fn twz_rt_cross_compartment_entry() -> bool;
411}
412unsafe extern "C-unwind" {
413 #[doc = " Set the handler for an upcall from kernel"]
414 pub fn twz_rt_set_upcall_handler(
415 handler: ::core::option::Option<
416 unsafe extern "C-unwind" fn(
417 frame: *mut ::core::ffi::c_void,
418 data: *const ::core::ffi::c_void,
419 ),
420 >,
421 );
422}
423unsafe extern "C-unwind" {
424 pub fn twz_rt_pre_main_hook() -> option_exit_code;
425}
426unsafe extern "C-unwind" {
427 pub fn twz_rt_post_main_hook();
428}
429unsafe extern "C-unwind" {
430 pub fn twz_rt_runtime_entry(
431 arg: *const runtime_info,
432 std_entry: ::core::option::Option<
433 unsafe extern "C-unwind" fn(arg1: basic_aux) -> basic_return,
434 >,
435 );
436}
437#[doc = " Futex type, based on linux futex."]
438pub type futex_word = u32;
439unsafe extern "C-unwind" {
440 #[doc = " If *ptr == expected, wait until signal, optionally timing out."]
441 pub fn twz_rt_futex_wait(
442 ptr: *mut futex_word,
443 expected: futex_word,
444 timeout: option_duration,
445 ) -> bool;
446}
447unsafe extern "C-unwind" {
448 #[doc = " Wake up up to max threads waiting on ptr. If max is set to FUTEX_WAKE_ALL, wake all threads."]
449 pub fn twz_rt_futex_wake(ptr: *mut futex_word, max: i64) -> bool;
450}
451#[doc = " Wake all threads instead of a maximum number"]
452pub const FUTEX_WAKE_ALL: i64 = -1;
453unsafe extern "C-unwind" {
454 #[doc = " Yield the thread now."]
455 pub fn twz_rt_yield_now();
456}
457unsafe extern "C-unwind" {
458 #[doc = " Set the name of the calling thread."]
459 pub fn twz_rt_set_name(name: *const ::core::ffi::c_char);
460}
461unsafe extern "C-unwind" {
462 #[doc = " Sleep the calling thread for specified duration."]
463 pub fn twz_rt_sleep(dur: duration);
464}
465#[doc = " TLS index, module ID and offset."]
466#[repr(C)]
467#[derive(Debug, Copy, Clone)]
468pub struct tls_index {
469 pub mod_id: usize,
470 pub offset: usize,
471}
472#[allow(clippy::unnecessary_operation, clippy::identity_op)]
473const _: () = {
474 ["Size of tls_index"][::core::mem::size_of::<tls_index>() - 16usize];
475 ["Alignment of tls_index"][::core::mem::align_of::<tls_index>() - 8usize];
476 ["Offset of field: tls_index::mod_id"][::core::mem::offset_of!(tls_index, mod_id) - 0usize];
477 ["Offset of field: tls_index::offset"][::core::mem::offset_of!(tls_index, offset) - 8usize];
478};
479unsafe extern "C-unwind" {
480 #[doc = " Resolve the TLS index and get back the TLS data pointer."]
481 pub fn twz_rt_tls_get_addr(index: *mut tls_index) -> *mut ::core::ffi::c_void;
482}
483#[doc = " A TLS desc struct, with a resolver and value"]
484#[repr(C)]
485#[derive(Debug, Copy, Clone)]
486pub struct tls_desc {
487 #[doc = " Pointer to resolver"]
488 pub resolver: *mut ::core::ffi::c_void,
489 #[doc = " Value to pass to the resolver"]
490 pub value: u64,
491}
492#[allow(clippy::unnecessary_operation, clippy::identity_op)]
493const _: () = {
494 ["Size of tls_desc"][::core::mem::size_of::<tls_desc>() - 16usize];
495 ["Alignment of tls_desc"][::core::mem::align_of::<tls_desc>() - 8usize];
496 ["Offset of field: tls_desc::resolver"][::core::mem::offset_of!(tls_desc, resolver) - 0usize];
497 ["Offset of field: tls_desc::value"][::core::mem::offset_of!(tls_desc, value) - 8usize];
498};
499unsafe extern "C-unwind" {
500 #[doc = " Resolver for tls_desc"]
501 pub fn twz_rt_tls_desc_resolve(arg: *mut tls_desc) -> *mut ::core::ffi::c_void;
502}
503#[doc = " Runtime-internal ID of a thread"]
504pub type thread_id = u32;
505#[doc = " Arguments to spawn"]
506#[repr(C)]
507#[derive(Debug, Copy, Clone)]
508pub struct spawn_args {
509 #[doc = " Size of stack to allocate"]
510 pub stack_size: usize,
511 #[doc = " Starting address"]
512 pub start: usize,
513 #[doc = " Starting argument"]
514 pub arg: usize,
515}
516#[allow(clippy::unnecessary_operation, clippy::identity_op)]
517const _: () = {
518 ["Size of spawn_args"][::core::mem::size_of::<spawn_args>() - 24usize];
519 ["Alignment of spawn_args"][::core::mem::align_of::<spawn_args>() - 8usize];
520 ["Offset of field: spawn_args::stack_size"]
521 [::core::mem::offset_of!(spawn_args, stack_size) - 0usize];
522 ["Offset of field: spawn_args::start"][::core::mem::offset_of!(spawn_args, start) - 8usize];
523 ["Offset of field: spawn_args::arg"][::core::mem::offset_of!(spawn_args, arg) - 16usize];
524};
525#[doc = " Spawn result."]
526#[repr(C)]
527#[derive(Debug, Copy, Clone)]
528pub struct spawn_result {
529 #[doc = " Thread id, if err is set to Success."]
530 pub id: thread_id,
531 pub err: twz_error,
532}
533#[allow(clippy::unnecessary_operation, clippy::identity_op)]
534const _: () = {
535 ["Size of spawn_result"][::core::mem::size_of::<spawn_result>() - 16usize];
536 ["Alignment of spawn_result"][::core::mem::align_of::<spawn_result>() - 8usize];
537 ["Offset of field: spawn_result::id"][::core::mem::offset_of!(spawn_result, id) - 0usize];
538 ["Offset of field: spawn_result::err"][::core::mem::offset_of!(spawn_result, err) - 8usize];
539};
540unsafe extern "C-unwind" {
541 #[doc = " Sawn a thread. On success, that thread starts executing concurrently with this function's return."]
542 pub fn twz_rt_spawn_thread(args: spawn_args) -> spawn_result;
543}
544unsafe extern "C-unwind" {
545 #[doc = " Wait for a thread to exit, optionally timing out."]
546 pub fn twz_rt_join_thread(id: thread_id, timeout: option_duration) -> twz_error;
547}
548#[doc = " Mapping flags"]
549pub type map_flags = u32;
550#[doc = " Object handle"]
551#[repr(C)]
552#[repr(align(16))]
553#[derive(Debug, Copy, Clone)]
554pub struct object_handle {
555 #[doc = " ID for this handle"]
556 pub id: objid,
557 #[doc = " Pointer to per-runtime info. The first 64-bits of this data must be an atomic u64 value used for reference counting."]
558 pub runtime_info: *mut ::core::ffi::c_void,
559 #[doc = " Pointer to start of object data."]
560 pub start: *mut ::core::ffi::c_void,
561 #[doc = " Pointer to object meta struct."]
562 pub meta: *mut ::core::ffi::c_void,
563 #[doc = " Mapping flags"]
564 pub map_flags: map_flags,
565 #[doc = " Number of valid bytes after start pointer for this object handle, in multiples of of LEN_MUL"]
566 pub valid_len: u32,
567}
568#[allow(clippy::unnecessary_operation, clippy::identity_op)]
569const _: () = {
570 ["Size of object_handle"][::core::mem::size_of::<object_handle>() - 48usize];
571 ["Alignment of object_handle"][::core::mem::align_of::<object_handle>() - 16usize];
572 ["Offset of field: object_handle::id"][::core::mem::offset_of!(object_handle, id) - 0usize];
573 ["Offset of field: object_handle::runtime_info"]
574 [::core::mem::offset_of!(object_handle, runtime_info) - 16usize];
575 ["Offset of field: object_handle::start"]
576 [::core::mem::offset_of!(object_handle, start) - 24usize];
577 ["Offset of field: object_handle::meta"]
578 [::core::mem::offset_of!(object_handle, meta) - 32usize];
579 ["Offset of field: object_handle::map_flags"]
580 [::core::mem::offset_of!(object_handle, map_flags) - 40usize];
581 ["Offset of field: object_handle::valid_len"]
582 [::core::mem::offset_of!(object_handle, valid_len) - 44usize];
583};
584#[doc = " Multiplier to valid_len."]
585pub const LEN_MUL: usize = 4096;
586#[doc = " An open descriptor for a runtime file handle."]
587pub type descriptor = i32;
588#[doc = " Options for creating the file."]
589#[repr(C)]
590#[repr(align(16))]
591#[derive(Debug, Copy, Clone)]
592pub struct create_options {
593 #[doc = " Object ID to bind the name to, optional. 0 if not present."]
594 pub id: objid,
595 #[doc = " The kind of open/create operation. See CREATE_KIND_*."]
596 pub kind: u8,
597}
598#[allow(clippy::unnecessary_operation, clippy::identity_op)]
599const _: () = {
600 ["Size of create_options"][::core::mem::size_of::<create_options>() - 32usize];
601 ["Alignment of create_options"][::core::mem::align_of::<create_options>() - 16usize];
602 ["Offset of field: create_options::id"][::core::mem::offset_of!(create_options, id) - 0usize];
603 ["Offset of field: create_options::kind"]
604 [::core::mem::offset_of!(create_options, kind) - 16usize];
605};
606#[doc = " Information for opening a file."]
607#[repr(C)]
608#[repr(align(16))]
609#[derive(Debug, Copy, Clone)]
610pub struct open_info {
611 #[doc = " File name pointer."]
612 pub name: *const ::core::ffi::c_char,
613 #[doc = " Length of file name in bytes."]
614 pub len: usize,
615 #[doc = " Creation options"]
616 pub create: create_options,
617 #[doc = " Operation flags"]
618 pub flags: u32,
619}
620#[allow(clippy::unnecessary_operation, clippy::identity_op)]
621const _: () = {
622 ["Size of open_info"][::core::mem::size_of::<open_info>() - 64usize];
623 ["Alignment of open_info"][::core::mem::align_of::<open_info>() - 16usize];
624 ["Offset of field: open_info::name"][::core::mem::offset_of!(open_info, name) - 0usize];
625 ["Offset of field: open_info::len"][::core::mem::offset_of!(open_info, len) - 8usize];
626 ["Offset of field: open_info::create"][::core::mem::offset_of!(open_info, create) - 16usize];
627 ["Offset of field: open_info::flags"][::core::mem::offset_of!(open_info, flags) - 48usize];
628};
629#[doc = " Open the file only if it already exists."]
630pub const CREATE_KIND_EXISTING: u8 = 0;
631#[doc = " Open only if it doesn't exist, and create it."]
632pub const CREATE_KIND_NEW: u8 = 1;
633#[doc = " Open if it already exists, or create it if it doesn't."]
634pub const CREATE_KIND_EITHER: u8 = 2;
635#[doc = " Open the file with read access."]
636pub const OPEN_FLAG_READ: u32 = 1;
637#[doc = " Open the file with write access."]
638pub const OPEN_FLAG_WRITE: u32 = 2;
639#[doc = " Truncate the file on open. Requires write access."]
640pub const OPEN_FLAG_TRUNCATE: u32 = 4;
641#[doc = " Always use the end of the file as the position."]
642pub const OPEN_FLAG_TAIL: u32 = 8;
643#[doc = " If the file is a symlink, open the link instead of the target."]
644pub const OPEN_FLAG_SYMLINK: u32 = 16;
645#[doc = " Result of open call."]
646#[repr(C)]
647#[derive(Debug, Copy, Clone)]
648pub struct open_result {
649 #[doc = " If error is Success, this contains a valid descriptor."]
650 pub fd: descriptor,
651 #[doc = " Error code, or success."]
652 pub err: twz_error,
653}
654#[allow(clippy::unnecessary_operation, clippy::identity_op)]
655const _: () = {
656 ["Size of open_result"][::core::mem::size_of::<open_result>() - 16usize];
657 ["Alignment of open_result"][::core::mem::align_of::<open_result>() - 8usize];
658 ["Offset of field: open_result::fd"][::core::mem::offset_of!(open_result, fd) - 0usize];
659 ["Offset of field: open_result::err"][::core::mem::offset_of!(open_result, err) - 8usize];
660};
661unsafe extern "C-unwind" {
662 #[doc = " Open a file."]
663 pub fn twz_rt_fd_open(info: open_info) -> open_result;
664}
665pub const open_anon_kind_AnonKind_Pipe: open_anon_kind = 0;
666pub const open_anon_kind_AnonKind_SocketConnect: open_anon_kind = 1;
667pub const open_anon_kind_AnonKind_SocketBind: open_anon_kind = 2;
668pub type open_anon_kind = ::core::ffi::c_uint;
669pub const addr_kind_AddrKind_Ipv4: addr_kind = 0;
670pub const addr_kind_AddrKind_Ipv6: addr_kind = 1;
671pub type addr_kind = ::core::ffi::c_uint;
672#[repr(C)]
673#[derive(Copy, Clone)]
674pub union socket_address_addrs {
675 pub v4: [u8; 4usize],
676 pub v6: [u8; 16usize],
677}
678#[allow(clippy::unnecessary_operation, clippy::identity_op)]
679const _: () = {
680 ["Size of socket_address_addrs"][::core::mem::size_of::<socket_address_addrs>() - 16usize];
681 ["Alignment of socket_address_addrs"][::core::mem::align_of::<socket_address_addrs>() - 1usize];
682 ["Offset of field: socket_address_addrs::v4"]
683 [::core::mem::offset_of!(socket_address_addrs, v4) - 0usize];
684 ["Offset of field: socket_address_addrs::v6"]
685 [::core::mem::offset_of!(socket_address_addrs, v6) - 0usize];
686};
687#[repr(C)]
688#[derive(Copy, Clone)]
689pub struct socket_address {
690 pub kind: addr_kind,
691 pub addr_octets: socket_address_addrs,
692 pub port: u16,
693 pub scope_id: u32,
694 pub flowinfo: u32,
695}
696#[allow(clippy::unnecessary_operation, clippy::identity_op)]
697const _: () = {
698 ["Size of socket_address"][::core::mem::size_of::<socket_address>() - 32usize];
699 ["Alignment of socket_address"][::core::mem::align_of::<socket_address>() - 4usize];
700 ["Offset of field: socket_address::kind"]
701 [::core::mem::offset_of!(socket_address, kind) - 0usize];
702 ["Offset of field: socket_address::addr_octets"]
703 [::core::mem::offset_of!(socket_address, addr_octets) - 4usize];
704 ["Offset of field: socket_address::port"]
705 [::core::mem::offset_of!(socket_address, port) - 20usize];
706 ["Offset of field: socket_address::scope_id"]
707 [::core::mem::offset_of!(socket_address, scope_id) - 24usize];
708 ["Offset of field: socket_address::flowinfo"]
709 [::core::mem::offset_of!(socket_address, flowinfo) - 28usize];
710};
711unsafe extern "C-unwind" {
712 #[doc = " Open a non-named file. The value pointed to by bind_info is dependent on the kind specified in the first\n argument. For pipe, bind_info is ignored. For Socket* kinds, bind_info points to a socket_address."]
713 pub fn twz_rt_fd_open_anon(
714 kind: open_anon_kind,
715 flags: u32,
716 bind_info: *mut ::core::ffi::c_void,
717 bind_info_len: usize,
718 ) -> open_result;
719}
720unsafe extern "C-unwind" {
721 #[doc = " Close a file descriptor. If the file descriptor is invalid\n or already closed, this function does nothing."]
722 pub fn twz_rt_fd_close(fd: descriptor);
723}
724#[doc = " Flags a descriptor can have."]
725pub type fd_flags = u32;
726#[doc = " This file descriptor is a terminal."]
727pub const FD_IS_TERMINAL: fd_flags = 1;
728#[doc = " Regular file"]
729pub const fd_kind_FdKind_Regular: fd_kind = 0;
730#[doc = " Directory"]
731pub const fd_kind_FdKind_Directory: fd_kind = 1;
732#[doc = " Symbolic link"]
733pub const fd_kind_FdKind_SymLink: fd_kind = 2;
734#[doc = " Kinds of underlying fd objects"]
735pub type fd_kind = ::core::ffi::c_uint;
736#[doc = " Information about a file descriptor."]
737#[repr(C)]
738#[repr(align(16))]
739#[derive(Debug, Copy, Clone)]
740pub struct fd_info {
741 #[doc = " Underlying root objid."]
742 pub id: objid,
743 #[doc = " Length of underlying object, or 0 if undefined."]
744 pub len: u64,
745 #[doc = " Flags for the descriptor."]
746 pub flags: fd_flags,
747 #[doc = " Underlying fd kind"]
748 pub kind: fd_kind,
749 pub created: duration,
750 pub accessed: duration,
751 pub modified: duration,
752 pub unix_mode: u32,
753}
754#[allow(clippy::unnecessary_operation, clippy::identity_op)]
755const _: () = {
756 ["Size of fd_info"][::core::mem::size_of::<fd_info>() - 96usize];
757 ["Alignment of fd_info"][::core::mem::align_of::<fd_info>() - 16usize];
758 ["Offset of field: fd_info::id"][::core::mem::offset_of!(fd_info, id) - 0usize];
759 ["Offset of field: fd_info::len"][::core::mem::offset_of!(fd_info, len) - 16usize];
760 ["Offset of field: fd_info::flags"][::core::mem::offset_of!(fd_info, flags) - 24usize];
761 ["Offset of field: fd_info::kind"][::core::mem::offset_of!(fd_info, kind) - 28usize];
762 ["Offset of field: fd_info::created"][::core::mem::offset_of!(fd_info, created) - 32usize];
763 ["Offset of field: fd_info::accessed"][::core::mem::offset_of!(fd_info, accessed) - 48usize];
764 ["Offset of field: fd_info::modified"][::core::mem::offset_of!(fd_info, modified) - 64usize];
765 ["Offset of field: fd_info::unix_mode"][::core::mem::offset_of!(fd_info, unix_mode) - 80usize];
766};
767unsafe extern "C-unwind" {
768 #[doc = " Get information about a descriptor. If this returns true, the fd was valid\n and the data pointed to by info is filled with fd_info data."]
769 pub fn twz_rt_fd_get_info(fd: descriptor, info: *mut fd_info) -> bool;
770}
771#[doc = " Commands for descriptors."]
772pub type fd_cmd = u32;
773#[doc = " Duplicate this descriptor. The arg argument is ignored. The ret argument points to a descriptor."]
774pub const FD_CMD_DUP: fd_cmd = 0;
775#[doc = " Sync the underlying storage of the file descriptor."]
776pub const FD_CMD_SYNC: fd_cmd = 1;
777#[doc = " Truncate the underlying storage of the file descriptor. The arg argument points to a u64 length."]
778pub const FD_CMD_TRUNCATE: fd_cmd = 2;
779unsafe extern "C-unwind" {
780 #[doc = " Perform a command on the descriptor. The arguments arg and ret are interpreted according to\n the command specified."]
781 pub fn twz_rt_fd_cmd(
782 fd: descriptor,
783 cmd: fd_cmd,
784 arg: *mut ::core::ffi::c_void,
785 ret: *mut ::core::ffi::c_void,
786 ) -> twz_error;
787}
788#[repr(C)]
789#[repr(align(16))]
790#[derive(Debug, Copy, Clone)]
791pub struct name_entry {
792 pub info: fd_info,
793 pub name_len: u32,
794 pub linkname_len: u32,
795 pub name: [u8; 256usize],
796}
797#[allow(clippy::unnecessary_operation, clippy::identity_op)]
798const _: () = {
799 ["Size of name_entry"][::core::mem::size_of::<name_entry>() - 368usize];
800 ["Alignment of name_entry"][::core::mem::align_of::<name_entry>() - 16usize];
801 ["Offset of field: name_entry::info"][::core::mem::offset_of!(name_entry, info) - 0usize];
802 ["Offset of field: name_entry::name_len"]
803 [::core::mem::offset_of!(name_entry, name_len) - 96usize];
804 ["Offset of field: name_entry::linkname_len"]
805 [::core::mem::offset_of!(name_entry, linkname_len) - 100usize];
806 ["Offset of field: name_entry::name"][::core::mem::offset_of!(name_entry, name) - 104usize];
807};
808unsafe extern "C-unwind" {
809 #[doc = " Enumerate sub-names in an fd (e.g. directory entries). The buf and len arguments form a &mut [name_entry] slice, and the off argument specifies how many names to skip for this read. The return value is the number of entries read, or\n 0 if at end of list."]
810 pub fn twz_rt_fd_enumerate_names(
811 fd: descriptor,
812 buf: *mut name_entry,
813 len: usize,
814 off: usize,
815 ) -> io_result;
816}
817unsafe extern "C-unwind" {
818 #[doc = " Remove a name in the namespace."]
819 pub fn twz_rt_fd_remove(name: *const ::core::ffi::c_char, name_len: usize) -> twz_error;
820}
821unsafe extern "C-unwind" {
822 #[doc = " Create a new namespace."]
823 pub fn twz_rt_fd_mkns(name: *const ::core::ffi::c_char, name_len: usize) -> twz_error;
824}
825unsafe extern "C-unwind" {
826 #[doc = " Create a new symlink."]
827 pub fn twz_rt_fd_symlink(
828 name: *const ::core::ffi::c_char,
829 name_len: usize,
830 target: *const ::core::ffi::c_char,
831 target_len: usize,
832 ) -> twz_error;
833}
834unsafe extern "C-unwind" {
835 #[doc = " Read symlink."]
836 pub fn twz_rt_fd_readlink(
837 name: *const ::core::ffi::c_char,
838 name_len: usize,
839 buf: *mut ::core::ffi::c_char,
840 buf_len: usize,
841 out_buf_len: *mut u64,
842 ) -> twz_error;
843}
844#[doc = " Type of whence values for seek."]
845pub type whence = u32;
846#[doc = " Flags for IO operations"]
847pub type io_flags = u32;
848#[doc = " Non-blocking behavior specified. If the operation would block, return io_result with error set to WouldBlock instead."]
849pub const IO_NONBLOCKING: io_flags = 1;
850#[doc = " Seek offset from start of file"]
851pub const WHENCE_START: whence = 0;
852#[doc = " Seek offset from end of file"]
853pub const WHENCE_END: whence = 1;
854#[doc = " Seek offset from current fd position"]
855pub const WHENCE_CURRENT: whence = 2;
856#[doc = " Optional offset. If value is FD_POS, use the file descriptor position."]
857pub type optional_offset = i64;
858pub const FD_POS: optional_offset = -1;
859#[doc = " Context for I/O operations."]
860#[repr(C)]
861#[derive(Debug, Copy, Clone)]
862pub struct io_ctx {
863 pub flags: io_flags,
864 pub offset: optional_offset,
865 pub timeout: option_duration,
866}
867#[allow(clippy::unnecessary_operation, clippy::identity_op)]
868const _: () = {
869 ["Size of io_ctx"][::core::mem::size_of::<io_ctx>() - 40usize];
870 ["Alignment of io_ctx"][::core::mem::align_of::<io_ctx>() - 8usize];
871 ["Offset of field: io_ctx::flags"][::core::mem::offset_of!(io_ctx, flags) - 0usize];
872 ["Offset of field: io_ctx::offset"][::core::mem::offset_of!(io_ctx, offset) - 8usize];
873 ["Offset of field: io_ctx::timeout"][::core::mem::offset_of!(io_ctx, timeout) - 16usize];
874};
875pub const endpoint_kind_Endpoint_Unspecified: endpoint_kind = 0;
876pub const endpoint_kind_Endpoint_Socket: endpoint_kind = 1;
877pub type endpoint_kind = ::core::ffi::c_uint;
878#[repr(C)]
879#[derive(Copy, Clone)]
880pub union endpoint_addrs {
881 pub socket_addr: socket_address,
882}
883#[allow(clippy::unnecessary_operation, clippy::identity_op)]
884const _: () = {
885 ["Size of endpoint_addrs"][::core::mem::size_of::<endpoint_addrs>() - 32usize];
886 ["Alignment of endpoint_addrs"][::core::mem::align_of::<endpoint_addrs>() - 4usize];
887 ["Offset of field: endpoint_addrs::socket_addr"]
888 [::core::mem::offset_of!(endpoint_addrs, socket_addr) - 0usize];
889};
890#[doc = " Endpoint addresses, for example, socket address."]
891#[repr(C)]
892#[derive(Copy, Clone)]
893pub struct endpoint {
894 pub kind: endpoint_kind,
895 pub addr: endpoint_addrs,
896}
897#[allow(clippy::unnecessary_operation, clippy::identity_op)]
898const _: () = {
899 ["Size of endpoint"][::core::mem::size_of::<endpoint>() - 36usize];
900 ["Alignment of endpoint"][::core::mem::align_of::<endpoint>() - 4usize];
901 ["Offset of field: endpoint::kind"][::core::mem::offset_of!(endpoint, kind) - 0usize];
902 ["Offset of field: endpoint::addr"][::core::mem::offset_of!(endpoint, addr) - 4usize];
903};
904unsafe extern "C-unwind" {
905 #[doc = " Read from a file. May read less than specified len."]
906 pub fn twz_rt_fd_pread(
907 fd: descriptor,
908 buf: *mut ::core::ffi::c_void,
909 len: usize,
910 ctx: *mut io_ctx,
911 ) -> io_result;
912}
913unsafe extern "C-unwind" {
914 #[doc = " Write to a file. May write less than specified len."]
915 pub fn twz_rt_fd_pwrite(
916 fd: descriptor,
917 buf: *const ::core::ffi::c_void,
918 len: usize,
919 ctx: *mut io_ctx,
920 ) -> io_result;
921}
922unsafe extern "C-unwind" {
923 #[doc = " Seek to a specified point in the file."]
924 pub fn twz_rt_fd_seek(fd: descriptor, whence: whence, offset: i64) -> io_result;
925}
926unsafe extern "C-unwind" {
927 #[doc = " Read from a file. May read less than specified len. Fill *ep with information about the source of the I/O (e.g. socket address)."]
928 pub fn twz_rt_fd_pread_from(
929 fd: descriptor,
930 buf: *mut ::core::ffi::c_void,
931 len: usize,
932 ctx: *mut io_ctx,
933 ep: *mut endpoint,
934 ) -> io_result;
935}
936unsafe extern "C-unwind" {
937 #[doc = " Write to a file. May write less than specified len. Send to specified endpoint (e.g. socket address)."]
938 pub fn twz_rt_fd_pwrite_to(
939 fd: descriptor,
940 buf: *const ::core::ffi::c_void,
941 len: usize,
942 ctx: *mut io_ctx,
943 ep: *const endpoint,
944 ) -> io_result;
945}
946#[doc = " Io vec, a buffer and a len."]
947#[repr(C)]
948#[derive(Debug, Copy, Clone)]
949pub struct io_vec {
950 #[doc = " Pointer to buffer."]
951 pub buf: *mut ::core::ffi::c_char,
952 #[doc = " Length of buffer in bytes."]
953 pub len: usize,
954}
955#[allow(clippy::unnecessary_operation, clippy::identity_op)]
956const _: () = {
957 ["Size of io_vec"][::core::mem::size_of::<io_vec>() - 16usize];
958 ["Alignment of io_vec"][::core::mem::align_of::<io_vec>() - 8usize];
959 ["Offset of field: io_vec::buf"][::core::mem::offset_of!(io_vec, buf) - 0usize];
960 ["Offset of field: io_vec::len"][::core::mem::offset_of!(io_vec, len) - 8usize];
961};
962unsafe extern "C-unwind" {
963 #[doc = " Do vectored IO read."]
964 pub fn twz_rt_fd_preadv(
965 fd: descriptor,
966 iovs: *const io_vec,
967 nr_iovs: usize,
968 ctx: *mut io_ctx,
969 ) -> io_result;
970}
971unsafe extern "C-unwind" {
972 #[doc = " Do vectored IO write."]
973 pub fn twz_rt_fd_pwritev(
974 fd: descriptor,
975 iovs: *const io_vec,
976 nr_iovs: usize,
977 ctx: *mut io_ctx,
978 ) -> io_result;
979}
980pub type wait_kind = u32;
981pub const WAIT_READ: wait_kind = 1;
982pub const WAIT_WRITE: wait_kind = 2;
983unsafe extern "C-unwind" {
984 #[doc = " Get a word and value to wait on for determining if reads or writes are available."]
985 pub fn twz_rt_fd_waitpoint(
986 fd: descriptor,
987 ek: wait_kind,
988 point: *mut *mut u64,
989 val: u64,
990 ) -> twz_error;
991}
992unsafe extern "C-unwind" {
993 #[doc = " Get a config value for register reg."]
994 pub fn twz_rt_fd_get_config(
995 fd: descriptor,
996 reg: u32,
997 val: *mut ::core::ffi::c_void,
998 len: usize,
999 ) -> twz_error;
1000}
1001unsafe extern "C-unwind" {
1002 #[doc = " Set a config value for register reg. Setting a register may have side effects."]
1003 pub fn twz_rt_fd_set_config(
1004 fd: descriptor,
1005 reg: u32,
1006 val: *mut ::core::ffi::c_void,
1007 len: usize,
1008 ) -> twz_error;
1009}
1010#[doc = " Result map_object call"]
1011#[repr(C)]
1012#[repr(align(16))]
1013#[derive(Debug, Copy, Clone)]
1014pub struct map_result {
1015 #[doc = " Handle, if error is set to Success."]
1016 pub handle: object_handle,
1017 pub error: twz_error,
1018}
1019#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1020const _: () = {
1021 ["Size of map_result"][::core::mem::size_of::<map_result>() - 64usize];
1022 ["Alignment of map_result"][::core::mem::align_of::<map_result>() - 16usize];
1023 ["Offset of field: map_result::handle"][::core::mem::offset_of!(map_result, handle) - 0usize];
1024 ["Offset of field: map_result::error"][::core::mem::offset_of!(map_result, error) - 48usize];
1025};
1026#[doc = " Map with READ permission."]
1027pub const MAP_FLAG_R: map_flags = 1;
1028#[doc = " Map with WRITE permission."]
1029pub const MAP_FLAG_W: map_flags = 2;
1030#[doc = " Map with EXEC permission."]
1031pub const MAP_FLAG_X: map_flags = 4;
1032#[doc = " Persist changes on flush."]
1033pub const MAP_FLAG_PERSIST: map_flags = 8;
1034#[doc = " Allow the runtime to provide additional safety properties."]
1035pub const MAP_FLAG_INDIRECT: map_flags = 16;
1036#[doc = " Don't map a null page for the object."]
1037pub const MAP_FLAG_NO_NULLPAGE: map_flags = 32;
1038unsafe extern "C-unwind" {
1039 #[doc = " Create a new runtime (volatile, tied to this runtime) object."]
1040 pub fn twz_rt_create_rtobj() -> objid_result;
1041}
1042unsafe extern "C-unwind" {
1043 #[doc = " Map an object with a given ID and flags."]
1044 pub fn twz_rt_map_object(id: objid, flags: map_flags) -> map_result;
1045}
1046unsafe extern "C-unwind" {
1047 #[doc = " Release an object handle. After calling this, the handle may not be used."]
1048 pub fn twz_rt_release_handle(handle: *mut object_handle);
1049}
1050unsafe extern "C-unwind" {
1051 #[doc = " Update an object handle."]
1052 pub fn twz_rt_update_handle(handle: *mut object_handle) -> twz_error;
1053}
1054unsafe extern "C-unwind" {
1055 #[doc = " Given a pointer, find the start of the associated object. The returned pointer and the passed pointer p\n are guaranteed to be in the same object, allowing pointer arithmetic."]
1056 pub fn twz_rt_locate_object_start(p: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void;
1057}
1058unsafe extern "C-unwind" {
1059 #[doc = " Given a pointer, find the associated object. The returned pointer and the passed pointer p\n are guaranteed to be in the same object, allowing pointer arithmetic."]
1060 pub fn twz_rt_get_object_handle(p: *mut ::core::ffi::c_void) -> object_handle;
1061}
1062unsafe extern "C-unwind" {
1063 #[doc = " Resolve an FOT entry, returning an object handle for the target object with at least valid_len bytes of\n addressable memory."]
1064 pub fn twz_rt_resolve_fot(
1065 handle: *mut object_handle,
1066 idx: u64,
1067 valid_len: usize,
1068 flags: map_flags,
1069 ) -> map_result;
1070}
1071unsafe extern "C-unwind" {
1072 #[doc = " Does the same as twz_rt_resolve_fot but optimizes for local pointers and avoids cloning handles if possible. Returns null on failure\n with no error code. Callers should try the twz_rt_resolve_fot function if this one fails."]
1073 pub fn twz_rt_resolve_fot_local(
1074 start: *mut ::core::ffi::c_void,
1075 idx: u64,
1076 valid_len: usize,
1077 flags: map_flags,
1078 ) -> *mut ::core::ffi::c_void;
1079}
1080unsafe extern "C-unwind" {
1081 #[doc = " Insert the given entry into the FOT, or return the existing entry if it already exists in this object's FOT.\n Returns -1 on failure."]
1082 pub fn twz_rt_insert_fot(
1083 handle: *mut object_handle,
1084 entry: *mut ::core::ffi::c_void,
1085 ) -> u32_result;
1086}
1087unsafe extern "C-unwind" {
1088 pub fn __twz_rt_map_two_objects(
1089 id_1: objid,
1090 flags_1: map_flags,
1091 id_2: objid,
1092 flags_2: map_flags,
1093 res_1: *mut map_result,
1094 res_2: *mut map_result,
1095 );
1096}
1097pub const monotonicity_NonMonotonic: monotonicity = 0;
1098pub const monotonicity_WeakMonotonic: monotonicity = 1;
1099pub const monotonicity_StrongMonotonic: monotonicity = 2;
1100#[doc = " Supported monotonicity levels"]
1101pub type monotonicity = ::core::ffi::c_uint;
1102unsafe extern "C-unwind" {
1103 #[doc = " Get time from the monotonic clock"]
1104 pub fn twz_rt_get_monotonic_time() -> duration;
1105}
1106unsafe extern "C-unwind" {
1107 #[doc = " Get time from the system clock"]
1108 pub fn twz_rt_get_system_time() -> duration;
1109}
1110#[doc = " Information about a loaded dynamic object"]
1111#[repr(C)]
1112#[derive(Debug, Copy, Clone)]
1113pub struct dl_phdr_info {
1114 #[doc = " Load address"]
1115 pub addr: usize,
1116 #[doc = " Pointer to name, as a C string"]
1117 pub name: *const ::core::ffi::c_char,
1118 #[doc = " Pointer to program headers"]
1119 pub phdr: *const ::core::ffi::c_void,
1120 #[doc = " Number of program headers"]
1121 pub phnum: u32,
1122 pub adds: ::core::ffi::c_ulonglong,
1123 pub subs: ::core::ffi::c_ulonglong,
1124 pub tls_modid: usize,
1125 pub tls_data: *mut ::core::ffi::c_void,
1126}
1127#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1128const _: () = {
1129 ["Size of dl_phdr_info"][::core::mem::size_of::<dl_phdr_info>() - 64usize];
1130 ["Alignment of dl_phdr_info"][::core::mem::align_of::<dl_phdr_info>() - 8usize];
1131 ["Offset of field: dl_phdr_info::addr"][::core::mem::offset_of!(dl_phdr_info, addr) - 0usize];
1132 ["Offset of field: dl_phdr_info::name"][::core::mem::offset_of!(dl_phdr_info, name) - 8usize];
1133 ["Offset of field: dl_phdr_info::phdr"][::core::mem::offset_of!(dl_phdr_info, phdr) - 16usize];
1134 ["Offset of field: dl_phdr_info::phnum"]
1135 [::core::mem::offset_of!(dl_phdr_info, phnum) - 24usize];
1136 ["Offset of field: dl_phdr_info::adds"][::core::mem::offset_of!(dl_phdr_info, adds) - 32usize];
1137 ["Offset of field: dl_phdr_info::subs"][::core::mem::offset_of!(dl_phdr_info, subs) - 40usize];
1138 ["Offset of field: dl_phdr_info::tls_modid"]
1139 [::core::mem::offset_of!(dl_phdr_info, tls_modid) - 48usize];
1140 ["Offset of field: dl_phdr_info::tls_data"]
1141 [::core::mem::offset_of!(dl_phdr_info, tls_data) - 56usize];
1142};
1143#[repr(C)]
1144#[derive(Debug, Copy, Clone)]
1145pub struct link_map {
1146 pub addr: usize,
1147 pub name: *mut ::core::ffi::c_char,
1148 pub ld: *mut ::core::ffi::c_void,
1149 pub next: *mut ::core::ffi::c_void,
1150 pub prev: *mut ::core::ffi::c_void,
1151}
1152#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1153const _: () = {
1154 ["Size of link_map"][::core::mem::size_of::<link_map>() - 40usize];
1155 ["Alignment of link_map"][::core::mem::align_of::<link_map>() - 8usize];
1156 ["Offset of field: link_map::addr"][::core::mem::offset_of!(link_map, addr) - 0usize];
1157 ["Offset of field: link_map::name"][::core::mem::offset_of!(link_map, name) - 8usize];
1158 ["Offset of field: link_map::ld"][::core::mem::offset_of!(link_map, ld) - 16usize];
1159 ["Offset of field: link_map::next"][::core::mem::offset_of!(link_map, next) - 24usize];
1160 ["Offset of field: link_map::prev"][::core::mem::offset_of!(link_map, prev) - 32usize];
1161};
1162#[doc = " An ID for a loaded program image (or library)"]
1163pub type loaded_image_id = u32;
1164#[doc = " Information about a loaded program image or library"]
1165#[repr(C)]
1166#[repr(align(16))]
1167#[derive(Debug, Copy, Clone)]
1168pub struct loaded_image {
1169 #[doc = " Object handle"]
1170 pub image_handle: object_handle,
1171 #[doc = " Start of full image"]
1172 pub image_start: *const ::core::ffi::c_void,
1173 #[doc = " Length of full image"]
1174 pub image_len: usize,
1175 #[doc = " The dl_info for this loaded image"]
1176 pub dl_info: dl_phdr_info,
1177 #[doc = " The ID for this loaded image"]
1178 pub id: loaded_image_id,
1179}
1180#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1181const _: () = {
1182 ["Size of loaded_image"][::core::mem::size_of::<loaded_image>() - 144usize];
1183 ["Alignment of loaded_image"][::core::mem::align_of::<loaded_image>() - 16usize];
1184 ["Offset of field: loaded_image::image_handle"]
1185 [::core::mem::offset_of!(loaded_image, image_handle) - 0usize];
1186 ["Offset of field: loaded_image::image_start"]
1187 [::core::mem::offset_of!(loaded_image, image_start) - 48usize];
1188 ["Offset of field: loaded_image::image_len"]
1189 [::core::mem::offset_of!(loaded_image, image_len) - 56usize];
1190 ["Offset of field: loaded_image::dl_info"]
1191 [::core::mem::offset_of!(loaded_image, dl_info) - 64usize];
1192 ["Offset of field: loaded_image::id"][::core::mem::offset_of!(loaded_image, id) - 128usize];
1193};
1194unsafe extern "C-unwind" {
1195 #[doc = " Get a loaded image from its ID. All IDs for loaded image are sequential, starting from TWZ_RT_EXEID.\n On success, fill out data pointed to by the li argument and return true."]
1196 pub fn twz_rt_get_loaded_image(id: loaded_image_id, li: *mut loaded_image) -> bool;
1197}
1198unsafe extern "C-unwind" {
1199 pub fn twz_rt_iter_phdr(
1200 cb: ::core::option::Option<
1201 unsafe extern "C-unwind" fn(
1202 arg1: *const dl_phdr_info,
1203 size: usize,
1204 data: *mut ::core::ffi::c_void,
1205 ) -> ::core::ffi::c_int,
1206 >,
1207 data: *mut ::core::ffi::c_void,
1208 ) -> ::core::ffi::c_int;
1209}
1210#[doc = " The loaded image ID for the root loaded image (usually the executable)"]
1211pub const TWZ_RT_EXEID: loaded_image_id = 0;
1212#[doc = " Information about the system"]
1213#[repr(C)]
1214#[derive(Debug, Copy, Clone)]
1215pub struct system_info {
1216 #[doc = " Supported monotonicity"]
1217 pub clock_monotonicity: monotonicity,
1218 #[doc = " Number of CPUs (hardware threads)"]
1219 pub available_parallelism: usize,
1220 #[doc = " Page size"]
1221 pub page_size: usize,
1222}
1223#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1224const _: () = {
1225 ["Size of system_info"][::core::mem::size_of::<system_info>() - 24usize];
1226 ["Alignment of system_info"][::core::mem::align_of::<system_info>() - 8usize];
1227 ["Offset of field: system_info::clock_monotonicity"]
1228 [::core::mem::offset_of!(system_info, clock_monotonicity) - 0usize];
1229 ["Offset of field: system_info::available_parallelism"]
1230 [::core::mem::offset_of!(system_info, available_parallelism) - 8usize];
1231 ["Offset of field: system_info::page_size"]
1232 [::core::mem::offset_of!(system_info, page_size) - 16usize];
1233};
1234unsafe extern "C-unwind" {
1235 #[doc = " Get system information"]
1236 pub fn twz_rt_get_sysinfo() -> system_info;
1237}
1238#[doc = " Flags to get_random"]
1239pub type get_random_flags = u32;
1240#[doc = " Do not block when collecting random data"]
1241pub const GET_RANDOM_NON_BLOCKING: get_random_flags = 1;
1242unsafe extern "C-unwind" {
1243 #[doc = " Collect up to len bytes of randomness, filling buf. Returns the number of bytes\n of random data actually collected."]
1244 pub fn twz_rt_get_random(
1245 buf: *mut ::core::ffi::c_char,
1246 len: usize,
1247 flags: get_random_flags,
1248 ) -> usize;
1249}
1250pub const version: &[u8; 7] = b"0.99.0\0";
1251#[doc = " Object ID"]
1252pub type __uint128_t = u128;