Debian Codegraph @

third_party/rust/libc/src/unix/haiku/native.rs

raw
1 use crate::off_t;
2 use crate::prelude::*;
3
4 // This module contains bindings to the native Haiku API. The Haiku API
5 // originates from BeOS, and it was the original way to perform low level
6 // system and IO operations. The POSIX API was in that era was like a
7 // compatibility layer. In current Haiku development, both the POSIX API and
8 // the Haiku API are considered to be co-equal status. However, they are not
9 // integrated like they are on other UNIX platforms, which means that for many
10 // low level concepts there are two versions, like processes (POSIX) and
11 // teams (Haiku), or pthreads and native threads.
12 //
13 // Both the POSIX API and the Haiku API live in libroot.so, the library that is
14 // linked to any binary by default.
15 //
16 // This file follows the Haiku API for Haiku R1 beta 2. It is organized by the
17 // C/C++ header files in which the concepts can be found, while adhering to the
18 // style guide for this crate.
19
20 // Helper macro to generate u32 constants. The Haiku API uses (non-standard)
21 // multi-character constants (like 'UPDA' or 'MSGM') to represent 32 bit
22 // integer constants.
23
24 macro_rules! haiku_constant {
25 ($a:tt, $b:tt, $c:tt, $d:tt) => {
26 (($a as u32) << 24) + (($b as u32) << 16) + (($c as u32) << 8) + ($d as u32)
27 };
28 }
29
30 // support/SupportDefs.h
31 pub type status_t = i32;
32 pub type bigtime_t = i64;
33 pub type nanotime_t = i64;
34 pub type type_code = u32;
35 pub type perform_code = u32;
36
37 // kernel/OS.h
38 pub type area_id = i32;
39 pub type port_id = i32;
40 pub type sem_id = i32;
41 pub type team_id = i32;
42 pub type thread_id = i32;
43
44 pub type thread_func = extern "C" fn(*mut c_void) -> status_t;
45
46 // kernel/image.h
47 pub type image_id = i32;
48
49 e! {
50 // kernel/OS.h
51 pub enum thread_state {
52 B_THREAD_RUNNING = 1,
53 B_THREAD_READY,
54 B_THREAD_RECEIVING,
55 B_THREAD_ASLEEP,
56 B_THREAD_SUSPENDED,
57 B_THREAD_WAITING,
58 }
59
60 // kernel/image.h
61 pub enum image_type {
62 B_APP_IMAGE = 1,
63 B_LIBRARY_IMAGE,
64 B_ADD_ON_IMAGE,
65 B_SYSTEM_IMAGE,
66 }
67
68 // kernel/scheduler.h
69
70 pub enum be_task_flags {
71 B_DEFAULT_MEDIA_PRIORITY = 0x000,
72 B_OFFLINE_PROCESSING = 0x001,
73 B_STATUS_RENDERING = 0x002,
74 B_USER_INPUT_HANDLING = 0x004,
75 B_LIVE_VIDEO_MANIPULATION = 0x008,
76 B_VIDEO_PLAYBACK = 0x010,
77 B_VIDEO_RECORDING = 0x020,
78 B_LIVE_AUDIO_MANIPULATION = 0x040,
79 B_AUDIO_PLAYBACK = 0x080,
80 B_AUDIO_RECORDING = 0x100,
81 B_LIVE_3D_RENDERING = 0x200,
82 B_NUMBER_CRUNCHING = 0x400,
83 B_MIDI_PROCESSING = 0x800,
84 }
85
86 pub enum schduler_mode {
87 SCHEDULER_MODE_LOW_LATENCY,
88 SCHEDULER_MODE_POWER_SAVING,
89 }
90
91 // FindDirectory.h
92 pub enum path_base_directory {
93 B_FIND_PATH_INSTALLATION_LOCATION_DIRECTORY,
94 B_FIND_PATH_ADD_ONS_DIRECTORY,
95 B_FIND_PATH_APPS_DIRECTORY,
96 B_FIND_PATH_BIN_DIRECTORY,
97 B_FIND_PATH_BOOT_DIRECTORY,
98 B_FIND_PATH_CACHE_DIRECTORY,
99 B_FIND_PATH_DATA_DIRECTORY,
100 B_FIND_PATH_DEVELOP_DIRECTORY,
101 B_FIND_PATH_DEVELOP_LIB_DIRECTORY,
102 B_FIND_PATH_DOCUMENTATION_DIRECTORY,
103 B_FIND_PATH_ETC_DIRECTORY,
104 B_FIND_PATH_FONTS_DIRECTORY,
105 B_FIND_PATH_HEADERS_DIRECTORY,
106 B_FIND_PATH_LIB_DIRECTORY,
107 B_FIND_PATH_LOG_DIRECTORY,
108 B_FIND_PATH_MEDIA_NODES_DIRECTORY,
109 B_FIND_PATH_PACKAGES_DIRECTORY,
110 B_FIND_PATH_PREFERENCES_DIRECTORY,
111 B_FIND_PATH_SERVERS_DIRECTORY,
112 B_FIND_PATH_SETTINGS_DIRECTORY,
113 B_FIND_PATH_SOUNDS_DIRECTORY,
114 B_FIND_PATH_SPOOL_DIRECTORY,
115 B_FIND_PATH_TRANSLATORS_DIRECTORY,
116 B_FIND_PATH_VAR_DIRECTORY,
117 B_FIND_PATH_IMAGE_PATH = 1000,
118 B_FIND_PATH_PACKAGE_PATH,
119 }
120
121 pub enum directory_which {
122 B_DESKTOP_DIRECTORY = 0,
123 B_TRASH_DIRECTORY,
124 B_SYSTEM_DIRECTORY = 1000,
125 B_SYSTEM_ADDONS_DIRECTORY = 1002,
126 B_SYSTEM_BOOT_DIRECTORY,
127 B_SYSTEM_FONTS_DIRECTORY,
128 B_SYSTEM_LIB_DIRECTORY,
129 B_SYSTEM_SERVERS_DIRECTORY,
130 B_SYSTEM_APPS_DIRECTORY,
131 B_SYSTEM_BIN_DIRECTORY,
132 B_SYSTEM_DOCUMENTATION_DIRECTORY = 1010,
133 B_SYSTEM_PREFERENCES_DIRECTORY,
134 B_SYSTEM_TRANSLATORS_DIRECTORY,
135 B_SYSTEM_MEDIA_NODES_DIRECTORY,
136 B_SYSTEM_SOUNDS_DIRECTORY,
137 B_SYSTEM_DATA_DIRECTORY,
138 B_SYSTEM_DEVELOP_DIRECTORY,
139 B_SYSTEM_PACKAGES_DIRECTORY,
140 B_SYSTEM_HEADERS_DIRECTORY,
141 B_SYSTEM_ETC_DIRECTORY = 2008,
142 B_SYSTEM_SETTINGS_DIRECTORY = 2010,
143 B_SYSTEM_LOG_DIRECTORY = 2012,
144 B_SYSTEM_SPOOL_DIRECTORY,
145 B_SYSTEM_TEMP_DIRECTORY,
146 B_SYSTEM_VAR_DIRECTORY,
147 B_SYSTEM_CACHE_DIRECTORY = 2020,
148 B_SYSTEM_NONPACKAGED_DIRECTORY = 2023,
149 B_SYSTEM_NONPACKAGED_ADDONS_DIRECTORY,
150 B_SYSTEM_NONPACKAGED_TRANSLATORS_DIRECTORY,
151 B_SYSTEM_NONPACKAGED_MEDIA_NODES_DIRECTORY,
152 B_SYSTEM_NONPACKAGED_BIN_DIRECTORY,
153 B_SYSTEM_NONPACKAGED_DATA_DIRECTORY,
154 B_SYSTEM_NONPACKAGED_FONTS_DIRECTORY,
155 B_SYSTEM_NONPACKAGED_SOUNDS_DIRECTORY,
156 B_SYSTEM_NONPACKAGED_DOCUMENTATION_DIRECTORY,
157 B_SYSTEM_NONPACKAGED_LIB_DIRECTORY,
158 B_SYSTEM_NONPACKAGED_HEADERS_DIRECTORY,
159 B_SYSTEM_NONPACKAGED_DEVELOP_DIRECTORY,
160 B_USER_DIRECTORY = 3000,
161 B_USER_CONFIG_DIRECTORY,
162 B_USER_ADDONS_DIRECTORY,
163 B_USER_BOOT_DIRECTORY,
164 B_USER_FONTS_DIRECTORY,
165 B_USER_LIB_DIRECTORY,
166 B_USER_SETTINGS_DIRECTORY,
167 B_USER_DESKBAR_DIRECTORY,
168 B_USER_PRINTERS_DIRECTORY,
169 B_USER_TRANSLATORS_DIRECTORY,
170 B_USER_MEDIA_NODES_DIRECTORY,
171 B_USER_SOUNDS_DIRECTORY,
172 B_USER_DATA_DIRECTORY,
173 B_USER_CACHE_DIRECTORY,
174 B_USER_PACKAGES_DIRECTORY,
175 B_USER_HEADERS_DIRECTORY,
176 B_USER_NONPACKAGED_DIRECTORY,
177 B_USER_NONPACKAGED_ADDONS_DIRECTORY,
178 B_USER_NONPACKAGED_TRANSLATORS_DIRECTORY,
179 B_USER_NONPACKAGED_MEDIA_NODES_DIRECTORY,
180 B_USER_NONPACKAGED_BIN_DIRECTORY,
181 B_USER_NONPACKAGED_DATA_DIRECTORY,
182 B_USER_NONPACKAGED_FONTS_DIRECTORY,
183 B_USER_NONPACKAGED_SOUNDS_DIRECTORY,
184 B_USER_NONPACKAGED_DOCUMENTATION_DIRECTORY,
185 B_USER_NONPACKAGED_LIB_DIRECTORY,
186 B_USER_NONPACKAGED_HEADERS_DIRECTORY,
187 B_USER_NONPACKAGED_DEVELOP_DIRECTORY,
188 B_USER_DEVELOP_DIRECTORY,
189 B_USER_DOCUMENTATION_DIRECTORY,
190 B_USER_SERVERS_DIRECTORY,
191 B_USER_APPS_DIRECTORY,
192 B_USER_BIN_DIRECTORY,
193 B_USER_PREFERENCES_DIRECTORY,
194 B_USER_ETC_DIRECTORY,
195 B_USER_LOG_DIRECTORY,
196 B_USER_SPOOL_DIRECTORY,
197 B_USER_VAR_DIRECTORY,
198 B_APPS_DIRECTORY = 4000,
199 B_PREFERENCES_DIRECTORY,
200 B_UTILITIES_DIRECTORY,
201 B_PACKAGE_LINKS_DIRECTORY,
202 }
203
204 // kernel/OS.h
205
206 pub enum topology_level_type {
207 B_TOPOLOGY_UNKNOWN,
208 B_TOPOLOGY_ROOT,
209 B_TOPOLOGY_SMT,
210 B_TOPOLOGY_CORE,
211 B_TOPOLOGY_PACKAGE,
212 }
213
214 pub enum cpu_platform {
215 B_CPU_UNKNOWN,
216 B_CPU_x86,
217 B_CPU_x86_64,
218 B_CPU_PPC,
219 B_CPU_PPC_64,
220 B_CPU_M68K,
221 B_CPU_ARM,
222 B_CPU_ARM_64,
223 B_CPU_ALPHA,
224 B_CPU_MIPS,
225 B_CPU_SH,
226 B_CPU_SPARC,
227 B_CPU_RISC_V,
228 }
229
230 pub enum cpu_vendor {
231 B_CPU_VENDOR_UNKNOWN,
232 B_CPU_VENDOR_AMD,
233 B_CPU_VENDOR_CYRIX,
234 B_CPU_VENDOR_IDT,
235 B_CPU_VENDOR_INTEL,
236 B_CPU_VENDOR_NATIONAL_SEMICONDUCTOR,
237 B_CPU_VENDOR_RISE,
238 B_CPU_VENDOR_TRANSMETA,
239 B_CPU_VENDOR_VIA,
240 B_CPU_VENDOR_IBM,
241 B_CPU_VENDOR_MOTOROLA,
242 B_CPU_VENDOR_NEC,
243 B_CPU_VENDOR_HYGON,
244 B_CPU_VENDOR_SUN,
245 B_CPU_VENDOR_FUJITSU,
246 }
247 }
248
249 s! {
250 // kernel/OS.h
251 pub struct area_info {
252 pub area: area_id,
253 pub name: [c_char; B_OS_NAME_LENGTH],
254 pub size: usize,
255 pub lock: u32,
256 pub protection: u32,
257 pub team: team_id,
258 pub ram_size: u32,
259 pub copy_count: u32,
260 pub in_count: u32,
261 pub out_count: u32,
262 pub address: *mut c_void,
263 }
264
265 pub struct port_info {
266 pub port: port_id,
267 pub team: team_id,
268 pub name: [c_char; B_OS_NAME_LENGTH],
269 pub capacity: i32,
270 pub queue_count: i32,
271 pub total_count: i32,
272 }
273
274 pub struct port_message_info {
275 pub size: size_t,
276 pub sender: crate::uid_t,
277 pub sender_group: crate::gid_t,
278 pub sender_team: crate::team_id,
279 }
280
281 pub struct team_info {
282 pub team: team_id,
283 pub thread_count: i32,
284 pub image_count: i32,
285 pub area_count: i32,
286 pub debugger_nub_thread: thread_id,
287 pub debugger_nub_port: port_id,
288 pub argc: i32,
289 pub args: [c_char; 64],
290 pub uid: crate::uid_t,
291 pub gid: crate::gid_t,
292 }
293
294 pub struct sem_info {
295 pub sem: sem_id,
296 pub team: team_id,
297 pub name: [c_char; B_OS_NAME_LENGTH],
298 pub count: i32,
299 pub latest_holder: thread_id,
300 }
301
302 pub struct team_usage_info {
303 pub user_time: bigtime_t,
304 pub kernel_time: bigtime_t,
305 }
306
307 pub struct thread_info {
308 pub thread: thread_id,
309 pub team: team_id,
310 pub name: [c_char; B_OS_NAME_LENGTH],
311 pub state: thread_state,
312 pub priority: i32,
313 pub sem: sem_id,
314 pub user_time: bigtime_t,
315 pub kernel_time: bigtime_t,
316 pub stack_base: *mut c_void,
317 pub stack_end: *mut c_void,
318 }
319
320 pub struct cpu_info {
321 pub active_time: bigtime_t,
322 pub enabled: bool,
323 pub current_frequency: u64,
324 }
325
326 pub struct system_info {
327 pub boot_time: bigtime_t,
328 pub cpu_count: u32,
329 pub max_pages: u64,
330 pub used_pages: u64,
331 pub cached_pages: u64,
332 pub block_cache_pages: u64,
333 pub ignored_pages: u64,
334 pub needed_memory: u64,
335 pub free_memory: u64,
336 pub max_swap_pages: u64,
337 pub free_swap_pages: u64,
338 pub page_faults: u32,
339 pub max_sems: u32,
340 pub used_sems: u32,
341 pub max_ports: u32,
342 pub used_ports: u32,
343 pub max_threads: u32,
344 pub used_threads: u32,
345 pub max_teams: u32,
346 pub used_teams: u32,
347 pub kernel_name: [c_char; B_FILE_NAME_LENGTH],
348 pub kernel_build_date: [c_char; B_OS_NAME_LENGTH],
349 pub kernel_build_time: [c_char; B_OS_NAME_LENGTH],
350 pub kernel_version: i64,
351 pub abi: u32,
352 }
353
354 pub struct object_wait_info {
355 pub object: i32,
356 pub type_: u16,
357 pub events: u16,
358 }
359
360 pub struct cpu_topology_root_info {
361 pub platform: cpu_platform,
362 }
363
364 pub struct cpu_topology_package_info {
365 pub vendor: cpu_vendor,
366 pub cache_line_size: u32,
367 }
368
369 pub struct cpu_topology_core_info {
370 pub model: u32,
371 pub default_frequency: u64,
372 }
373 // kernel/fs_attr.h
374 pub struct attr_info {
375 pub type_: u32,
376 pub size: off_t,
377 }
378
379 // kernel/fs_index.h
380 pub struct index_info {
381 pub type_: u32,
382 pub size: off_t,
383 pub modification_time: crate::time_t,
384 pub creation_time: crate::time_t,
385 pub uid: crate::uid_t,
386 pub gid: crate::gid_t,
387 }
388
389 //kernel/fs_info.h
390 pub struct fs_info {
391 pub dev: crate::dev_t,
392 pub root: crate::ino_t,
393 pub flags: u32,
394 pub block_size: off_t,
395 pub io_size: off_t,
396 pub total_blocks: off_t,
397 pub free_blocks: off_t,
398 pub total_nodes: off_t,
399 pub free_nodes: off_t,
400 pub device_name: [c_char; 128],
401 pub volume_name: [c_char; B_FILE_NAME_LENGTH],
402 pub fsh_name: [c_char; B_OS_NAME_LENGTH],
403 }
404
405 // kernel/image.h
406 pub struct image_info {
407 pub id: image_id,
408 pub image_type: c_int,
409 pub sequence: i32,
410 pub init_order: i32,
411 pub init_routine: extern "C" fn(),
412 pub term_routine: extern "C" fn(),
413 pub device: crate::dev_t,
414 pub node: crate::ino_t,
415 pub name: [c_char; crate::PATH_MAX as usize],
416 pub text: *mut c_void,
417 pub data: *mut c_void,
418 pub text_size: i32,
419 pub data_size: i32,
420 pub api_version: i32,
421 pub abi: i32,
422 }
423
424 pub struct __c_anonymous_eax_0 {
425 pub max_eax: u32,
426 pub vendor_id: [c_char; 12],
427 }
428
429 pub struct __c_anonymous_eax_1 {
430 pub stepping: u32,
431 pub model: u32,
432 pub family: u32,
433 pub tpe: u32,
434 __reserved_0: u32,
435 pub extended_model: u32,
436 pub extended_family: u32,
437 __reserved_1: u32,
438 pub brand_index: u32,
439 pub clflush: u32,
440 pub logical_cpus: u32,
441 pub apic_id: u32,
442 pub features: u32,
443 pub extended_features: u32,
444 }
445
446 pub struct __c_anonymous_eax_2 {
447 pub call_num: u8,
448 pub cache_descriptors: [u8; 15],
449 }
450
451 pub struct __c_anonymous_eax_3 {
452 __reserved: [u32; 2],
453 pub serial_number_high: u32,
454 pub serial_number_low: u32,
455 }
456
457 pub struct __c_anonymous_regs {
458 pub eax: u32,
459 pub ebx: u32,
460 pub edx: u32,
461 pub ecx: u32,
462 }
463 }
464
465 s_no_extra_traits! {
466 pub union cpuid_info {
467 pub eax_0: __c_anonymous_eax_0,
468 pub eax_1: __c_anonymous_eax_1,
469 pub eax_2: __c_anonymous_eax_2,
470 pub eax_3: __c_anonymous_eax_3,
471 pub as_chars: [c_char; 16],
472 pub regs: __c_anonymous_regs,
473 }
474
475 pub union __c_anonymous_cpu_topology_info_data {
476 pub root: cpu_topology_root_info,
477 pub package: cpu_topology_package_info,
478 pub core: cpu_topology_core_info,
479 }
480
481 pub struct cpu_topology_node_info {
482 pub id: u32,
483 pub type_: topology_level_type,
484 pub level: u32,
485 pub data: __c_anonymous_cpu_topology_info_data,
486 }
487 }
488
489 cfg_if! {
490 if #[cfg(feature = "extra_traits")] {
491 impl PartialEq for cpuid_info {
492 fn eq(&self, other: &cpuid_info) -> bool {
493 unsafe {
494 self.eax_0 == other.eax_0
495 || self.eax_1 == other.eax_1
496 || self.eax_2 == other.eax_2
497 || self.eax_3 == other.eax_3
498 || self.as_chars == other.as_chars
499 || self.regs == other.regs
500 }
501 }
502 }
503 impl Eq for cpuid_info {}
504
505 impl PartialEq for __c_anonymous_cpu_topology_info_data {
506 fn eq(&self, other: &__c_anonymous_cpu_topology_info_data) -> bool {
507 unsafe {
508 self.root == other.root
509 || self.package == other.package
510 || self.core == other.core
511 }
512 }
513 }
514 impl Eq for __c_anonymous_cpu_topology_info_data {}
515
516 impl PartialEq for cpu_topology_node_info {
517 fn eq(&self, other: &cpu_topology_node_info) -> bool {
518 self.id == other.id && self.type_ == other.type_ && self.level == other.level
519 }
520 }
521
522 impl Eq for cpu_topology_node_info {}
523 impl fmt::Debug for cpu_topology_node_info {
524 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
525 f.debug_struct("cpu_topology_node_info")
526 .field("id", &self.id)
527 .field("type", &self.type_)
528 .field("level", &self.level)
529 .finish()
530 }
531 }
532 }
533 }
534
535 // kernel/OS.h
536 pub const B_OS_NAME_LENGTH: usize = 32;
537 pub const B_PAGE_SIZE: usize = 4096;
538 pub const B_INFINITE_TIMEOUT: usize = 9223372036854775807;
539
540 pub const B_RELATIVE_TIMEOUT: u32 = 0x8;
541 pub const B_ABSOLUTE_TIMEOUT: u32 = 0x10;
542 pub const B_TIMEOUT_REAL_TIME_BASE: u32 = 0x40;
543 pub const B_ABSOLUTE_REAL_TIME_TIMEOUT: u32 = B_ABSOLUTE_TIMEOUT | B_TIMEOUT_REAL_TIME_BASE;
544
545 pub const B_NO_LOCK: u32 = 0;
546 pub const B_LAZY_LOCK: u32 = 1;
547 pub const B_FULL_LOCK: u32 = 2;
548 pub const B_CONTIGUOUS: u32 = 3;
549 pub const B_LOMEM: u32 = 4;
550 pub const B_32_BIT_FULL_LOCK: u32 = 5;
551 pub const B_32_BIT_CONTIGUOUS: u32 = 6;
552
553 pub const B_ANY_ADDRESS: u32 = 0;
554 pub const B_EXACT_ADDRESS: u32 = 1;
555 pub const B_BASE_ADDRESS: u32 = 2;
556 pub const B_CLONE_ADDRESS: u32 = 3;
557 pub const B_ANY_KERNEL_ADDRESS: u32 = 4;
558 pub const B_RANDOMIZED_ANY_ADDRESS: u32 = 6;
559 pub const B_RANDOMIZED_BASE_ADDRESS: u32 = 7;
560
561 pub const B_READ_AREA: u32 = 1 << 0;
562 pub const B_WRITE_AREA: u32 = 1 << 1;
563 pub const B_EXECUTE_AREA: u32 = 1 << 2;
564 pub const B_STACK_AREA: u32 = 1 << 3;
565 pub const B_CLONEABLE_AREA: u32 = 1 << 8;
566
567 pub const B_CAN_INTERRUPT: u32 = 0x01;
568 pub const B_CHECK_PERMISSION: u32 = 0x04;
569 pub const B_KILL_CAN_INTERRUPT: u32 = 0x20;
570 pub const B_DO_NOT_RESCHEDULE: u32 = 0x02;
571 pub const B_RELEASE_ALL: u32 = 0x08;
572 pub const B_RELEASE_IF_WAITING_ONLY: u32 = 0x10;
573
574 pub const B_CURRENT_TEAM: team_id = 0;
575 pub const B_SYSTEM_TEAM: team_id = 1;
576
577 pub const B_TEAM_USAGE_SELF: i32 = 0;
578 pub const B_TEAM_USAGE_CHILDREN: i32 = -1;
579
580 pub const B_IDLE_PRIORITY: i32 = 0;
581 pub const B_LOWEST_ACTIVE_PRIORITY: i32 = 1;
582 pub const B_LOW_PRIORITY: i32 = 5;
583 pub const B_NORMAL_PRIORITY: i32 = 10;
584 pub const B_DISPLAY_PRIORITY: i32 = 15;
585 pub const B_URGENT_DISPLAY_PRIORITY: i32 = 20;
586 pub const B_REAL_TIME_DISPLAY_PRIORITY: i32 = 100;
587 pub const B_URGENT_PRIORITY: i32 = 110;
588 pub const B_REAL_TIME_PRIORITY: i32 = 120;
589
590 pub const B_SYSTEM_TIMEBASE: i32 = 0;
591 pub const B_FIRST_REAL_TIME_PRIORITY: i32 = B_REAL_TIME_DISPLAY_PRIORITY;
592
593 pub const B_ONE_SHOT_ABSOLUTE_ALARM: u32 = 1;
594 pub const B_ONE_SHOT_RELATIVE_ALARM: u32 = 2;
595 pub const B_PERIODIC_ALARM: u32 = 3;
596
597 pub const B_OBJECT_TYPE_FD: u16 = 0;
598 pub const B_OBJECT_TYPE_SEMAPHORE: u16 = 1;
599 pub const B_OBJECT_TYPE_PORT: u16 = 2;
600 pub const B_OBJECT_TYPE_THREAD: u16 = 3;
601
602 pub const B_EVENT_READ: u16 = 0x0001;
603 pub const B_EVENT_WRITE: u16 = 0x0002;
604 pub const B_EVENT_ERROR: u16 = 0x0004;
605 pub const B_EVENT_PRIORITY_READ: u16 = 0x0008;
606 pub const B_EVENT_PRIORITY_WRITE: u16 = 0x0010;
607 pub const B_EVENT_HIGH_PRIORITY_READ: u16 = 0x0020;
608 pub const B_EVENT_HIGH_PRIORITY_WRITE: u16 = 0x0040;
609 pub const B_EVENT_DISCONNECTED: u16 = 0x0080;
610 pub const B_EVENT_ACQUIRE_SEMAPHORE: u16 = 0x0001;
611 pub const B_EVENT_INVALID: u16 = 0x1000;
612
613 // kernel/fs_info.h
614 pub const B_FS_IS_READONLY: u32 = 0x00000001;
615 pub const B_FS_IS_REMOVABLE: u32 = 0x00000002;
616 pub const B_FS_IS_PERSISTENT: u32 = 0x00000004;
617 pub const B_FS_IS_SHARED: u32 = 0x00000008;
618 pub const B_FS_HAS_MIME: u32 = 0x00010000;
619 pub const B_FS_HAS_ATTR: u32 = 0x00020000;
620 pub const B_FS_HAS_QUERY: u32 = 0x00040000;
621 pub const B_FS_HAS_SELF_HEALING_LINKS: u32 = 0x00080000;
622 pub const B_FS_HAS_ALIASES: u32 = 0x00100000;
623 pub const B_FS_SUPPORTS_NODE_MONITORING: u32 = 0x00200000;
624 pub const B_FS_SUPPORTS_MONITOR_CHILDREN: u32 = 0x00400000;
625
626 // kernel/fs_query.h
627 pub const B_LIVE_QUERY: u32 = 0x00000001;
628 pub const B_QUERY_NON_INDEXED: u32 = 0x00000002;
629
630 // kernel/fs_volume.h
631 pub const B_MOUNT_READ_ONLY: u32 = 1;
632 pub const B_MOUNT_VIRTUAL_DEVICE: u32 = 2;
633 pub const B_FORCE_UNMOUNT: u32 = 1;
634
635 // kernel/image.h
636 pub const B_FLUSH_DCACHE: u32 = 0x0001;
637 pub const B_FLUSH_ICACHE: u32 = 0x0004;
638 pub const B_INVALIDATE_DCACHE: u32 = 0x0002;
639 pub const B_INVALIDATE_ICACHE: u32 = 0x0008;
640
641 pub const B_SYMBOL_TYPE_DATA: i32 = 0x1;
642 pub const B_SYMBOL_TYPE_TEXT: i32 = 0x2;
643 pub const B_SYMBOL_TYPE_ANY: i32 = 0x5;
644
645 // storage/StorageDefs.h
646 pub const B_DEV_NAME_LENGTH: usize = 128;
647 pub const B_FILE_NAME_LENGTH: usize = crate::FILENAME_MAX as usize;
648 pub const B_PATH_NAME_LENGTH: usize = crate::PATH_MAX as usize;
649 pub const B_ATTR_NAME_LENGTH: usize = B_FILE_NAME_LENGTH - 1;
650 pub const B_MIME_TYPE_LENGTH: usize = B_ATTR_NAME_LENGTH - 15;
651 pub const B_MAX_SYMLINKS: usize = 16;
652
653 // Haiku open modes in BFile are passed as u32
654 pub const B_READ_ONLY: u32 = crate::O_RDONLY as u32;
655 pub const B_WRITE_ONLY: u32 = crate::O_WRONLY as u32;
656 pub const B_READ_WRITE: u32 = crate::O_RDWR as u32;
657
658 pub const B_FAIL_IF_EXISTS: u32 = crate::O_EXCL as u32;
659 pub const B_CREATE_FILE: u32 = crate::O_CREAT as u32;
660 pub const B_ERASE_FILE: u32 = crate::O_TRUNC as u32;
661 pub const B_OPEN_AT_END: u32 = crate::O_APPEND as u32;
662
663 pub const B_FILE_NODE: u32 = 0x01;
664 pub const B_SYMLINK_NODE: u32 = 0x02;
665 pub const B_DIRECTORY_NODE: u32 = 0x04;
666 pub const B_ANY_NODE: u32 = 0x07;
667
668 // support/Errors.h
669 pub const B_GENERAL_ERROR_BASE: status_t = core::i32::MIN;
670 pub const B_OS_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x1000;
671 pub const B_APP_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x2000;
672 pub const B_INTERFACE_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x3000;
673 pub const B_MEDIA_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x4000;
674 pub const B_TRANSLATION_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x4800;
675 pub const B_MIDI_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x5000;
676 pub const B_STORAGE_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x6000;
677 pub const B_POSIX_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x7000;
678 pub const B_MAIL_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x8000;
679 pub const B_PRINT_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x9000;
680 pub const B_DEVICE_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0xa000;
681 pub const B_ERRORS_END: status_t = B_GENERAL_ERROR_BASE + 0xffff;
682
683 // General errors
684 pub const B_NO_MEMORY: status_t = B_GENERAL_ERROR_BASE + 0;
685 pub const B_IO_ERROR: status_t = B_GENERAL_ERROR_BASE + 1;
686 pub const B_PERMISSION_DENIED: status_t = B_GENERAL_ERROR_BASE + 2;
687 pub const B_BAD_INDEX: status_t = B_GENERAL_ERROR_BASE + 3;
688 pub const B_BAD_TYPE: status_t = B_GENERAL_ERROR_BASE + 4;
689 pub const B_BAD_VALUE: status_t = B_GENERAL_ERROR_BASE + 5;
690 pub const B_MISMATCHED_VALUES: status_t = B_GENERAL_ERROR_BASE + 6;
691 pub const B_NAME_NOT_FOUND: status_t = B_GENERAL_ERROR_BASE + 7;
692 pub const B_NAME_IN_USE: status_t = B_GENERAL_ERROR_BASE + 8;
693 pub const B_TIMED_OUT: status_t = B_GENERAL_ERROR_BASE + 9;
694 pub const B_INTERRUPTED: status_t = B_GENERAL_ERROR_BASE + 10;
695 pub const B_WOULD_BLOCK: status_t = B_GENERAL_ERROR_BASE + 11;
696 pub const B_CANCELED: status_t = B_GENERAL_ERROR_BASE + 12;
697 pub const B_NO_INIT: status_t = B_GENERAL_ERROR_BASE + 13;
698 pub const B_NOT_INITIALIZED: status_t = B_GENERAL_ERROR_BASE + 13;
699 pub const B_BUSY: status_t = B_GENERAL_ERROR_BASE + 14;
700 pub const B_NOT_ALLOWED: status_t = B_GENERAL_ERROR_BASE + 15;
701 pub const B_BAD_DATA: status_t = B_GENERAL_ERROR_BASE + 16;
702 pub const B_DONT_DO_THAT: status_t = B_GENERAL_ERROR_BASE + 17;
703
704 pub const B_ERROR: status_t = -1;
705 pub const B_OK: status_t = 0;
706 pub const B_NO_ERROR: status_t = 0;
707
708 // Kernel kit errors
709 pub const B_BAD_SEM_ID: status_t = B_OS_ERROR_BASE + 0;
710 pub const B_NO_MORE_SEMS: status_t = B_OS_ERROR_BASE + 1;
711
712 pub const B_BAD_THREAD_ID: status_t = B_OS_ERROR_BASE + 0x100;
713 pub const B_NO_MORE_THREADS: status_t = B_OS_ERROR_BASE + 0x101;
714 pub const B_BAD_THREAD_STATE: status_t = B_OS_ERROR_BASE + 0x102;
715 pub const B_BAD_TEAM_ID: status_t = B_OS_ERROR_BASE + 0x103;
716 pub const B_NO_MORE_TEAMS: status_t = B_OS_ERROR_BASE + 0x104;
717
718 pub const B_BAD_PORT_ID: status_t = B_OS_ERROR_BASE + 0x200;
719 pub const B_NO_MORE_PORTS: status_t = B_OS_ERROR_BASE + 0x201;
720
721 pub const B_BAD_IMAGE_ID: status_t = B_OS_ERROR_BASE + 0x300;
722 pub const B_BAD_ADDRESS: status_t = B_OS_ERROR_BASE + 0x301;
723 pub const B_NOT_AN_EXECUTABLE: status_t = B_OS_ERROR_BASE + 0x302;
724 pub const B_MISSING_LIBRARY: status_t = B_OS_ERROR_BASE + 0x303;
725 pub const B_MISSING_SYMBOL: status_t = B_OS_ERROR_BASE + 0x304;
726 pub const B_UNKNOWN_EXECUTABLE: status_t = B_OS_ERROR_BASE + 0x305;
727 pub const B_LEGACY_EXECUTABLE: status_t = B_OS_ERROR_BASE + 0x306;
728
729 pub const B_DEBUGGER_ALREADY_INSTALLED: status_t = B_OS_ERROR_BASE + 0x400;
730
731 // Application kit errors
732 pub const B_BAD_REPLY: status_t = B_APP_ERROR_BASE + 0;
733 pub const B_DUPLICATE_REPLY: status_t = B_APP_ERROR_BASE + 1;
734 pub const B_MESSAGE_TO_SELF: status_t = B_APP_ERROR_BASE + 2;
735 pub const B_BAD_HANDLER: status_t = B_APP_ERROR_BASE + 3;
736 pub const B_ALREADY_RUNNING: status_t = B_APP_ERROR_BASE + 4;
737 pub const B_LAUNCH_FAILED: status_t = B_APP_ERROR_BASE + 5;
738 pub const B_AMBIGUOUS_APP_LAUNCH: status_t = B_APP_ERROR_BASE + 6;
739 pub const B_UNKNOWN_MIME_TYPE: status_t = B_APP_ERROR_BASE + 7;
740 pub const B_BAD_SCRIPT_SYNTAX: status_t = B_APP_ERROR_BASE + 8;
741 pub const B_LAUNCH_FAILED_NO_RESOLVE_LINK: status_t = B_APP_ERROR_BASE + 9;
742 pub const B_LAUNCH_FAILED_EXECUTABLE: status_t = B_APP_ERROR_BASE + 10;
743 pub const B_LAUNCH_FAILED_APP_NOT_FOUND: status_t = B_APP_ERROR_BASE + 11;
744 pub const B_LAUNCH_FAILED_APP_IN_TRASH: status_t = B_APP_ERROR_BASE + 12;
745 pub const B_LAUNCH_FAILED_NO_PREFERRED_APP: status_t = B_APP_ERROR_BASE + 13;
746 pub const B_LAUNCH_FAILED_FILES_APP_NOT_FOUND: status_t = B_APP_ERROR_BASE + 14;
747 pub const B_BAD_MIME_SNIFFER_RULE: status_t = B_APP_ERROR_BASE + 15;
748 pub const B_NOT_A_MESSAGE: status_t = B_APP_ERROR_BASE + 16;
749 pub const B_SHUTDOWN_CANCELLED: status_t = B_APP_ERROR_BASE + 17;
750 pub const B_SHUTTING_DOWN: status_t = B_APP_ERROR_BASE + 18;
751
752 // Storage kit errors
753 pub const B_FILE_ERROR: status_t = B_STORAGE_ERROR_BASE + 0;
754 pub const B_FILE_EXISTS: status_t = B_STORAGE_ERROR_BASE + 2;
755 pub const B_ENTRY_NOT_FOUND: status_t = B_STORAGE_ERROR_BASE + 3;
756 pub const B_NAME_TOO_LONG: status_t = B_STORAGE_ERROR_BASE + 4;
757 pub const B_NOT_A_DIRECTORY: status_t = B_STORAGE_ERROR_BASE + 5;
758 pub const B_DIRECTORY_NOT_EMPTY: status_t = B_STORAGE_ERROR_BASE + 6;
759 pub const B_DEVICE_FULL: status_t = B_STORAGE_ERROR_BASE + 7;
760 pub const B_READ_ONLY_DEVICE: status_t = B_STORAGE_ERROR_BASE + 8;
761 pub const B_IS_A_DIRECTORY: status_t = B_STORAGE_ERROR_BASE + 9;
762 pub const B_NO_MORE_FDS: status_t = B_STORAGE_ERROR_BASE + 10;
763 pub const B_CROSS_DEVICE_LINK: status_t = B_STORAGE_ERROR_BASE + 11;
764 pub const B_LINK_LIMIT: status_t = B_STORAGE_ERROR_BASE + 12;
765 pub const B_BUSTED_PIPE: status_t = B_STORAGE_ERROR_BASE + 13;
766 pub const B_UNSUPPORTED: status_t = B_STORAGE_ERROR_BASE + 14;
767 pub const B_PARTITION_TOO_SMALL: status_t = B_STORAGE_ERROR_BASE + 15;
768 pub const B_PARTIAL_READ: status_t = B_STORAGE_ERROR_BASE + 16;
769 pub const B_PARTIAL_WRITE: status_t = B_STORAGE_ERROR_BASE + 17;
770
771 // Mapped posix errors
772 pub const B_BUFFER_OVERFLOW: status_t = crate::EOVERFLOW;
773 pub const B_TOO_MANY_ARGS: status_t = crate::E2BIG;
774 pub const B_FILE_TOO_LARGE: status_t = crate::EFBIG;
775 pub const B_RESULT_NOT_REPRESENTABLE: status_t = crate::ERANGE;
776 pub const B_DEVICE_NOT_FOUND: status_t = crate::ENODEV;
777 pub const B_NOT_SUPPORTED: status_t = crate::EOPNOTSUPP;
778
779 // Media kit errors
780 pub const B_STREAM_NOT_FOUND: status_t = B_MEDIA_ERROR_BASE + 0;
781 pub const B_SERVER_NOT_FOUND: status_t = B_MEDIA_ERROR_BASE + 1;
782 pub const B_RESOURCE_NOT_FOUND: status_t = B_MEDIA_ERROR_BASE + 2;
783 pub const B_RESOURCE_UNAVAILABLE: status_t = B_MEDIA_ERROR_BASE + 3;
784 pub const B_BAD_SUBSCRIBER: status_t = B_MEDIA_ERROR_BASE + 4;
785 pub const B_SUBSCRIBER_NOT_ENTERED: status_t = B_MEDIA_ERROR_BASE + 5;
786 pub const B_BUFFER_NOT_AVAILABLE: status_t = B_MEDIA_ERROR_BASE + 6;
787 pub const B_LAST_BUFFER_ERROR: status_t = B_MEDIA_ERROR_BASE + 7;
788
789 pub const B_MEDIA_SYSTEM_FAILURE: status_t = B_MEDIA_ERROR_BASE + 100;
790 pub const B_MEDIA_BAD_NODE: status_t = B_MEDIA_ERROR_BASE + 101;
791 pub const B_MEDIA_NODE_BUSY: status_t = B_MEDIA_ERROR_BASE + 102;
792 pub const B_MEDIA_BAD_FORMAT: status_t = B_MEDIA_ERROR_BASE + 103;
793 pub const B_MEDIA_BAD_BUFFER: status_t = B_MEDIA_ERROR_BASE + 104;
794 pub const B_MEDIA_TOO_MANY_NODES: status_t = B_MEDIA_ERROR_BASE + 105;
795 pub const B_MEDIA_TOO_MANY_BUFFERS: status_t = B_MEDIA_ERROR_BASE + 106;
796 pub const B_MEDIA_NODE_ALREADY_EXISTS: status_t = B_MEDIA_ERROR_BASE + 107;
797 pub const B_MEDIA_BUFFER_ALREADY_EXISTS: status_t = B_MEDIA_ERROR_BASE + 108;
798 pub const B_MEDIA_CANNOT_SEEK: status_t = B_MEDIA_ERROR_BASE + 109;
799 pub const B_MEDIA_CANNOT_CHANGE_RUN_MODE: status_t = B_MEDIA_ERROR_BASE + 110;
800 pub const B_MEDIA_APP_ALREADY_REGISTERED: status_t = B_MEDIA_ERROR_BASE + 111;
801 pub const B_MEDIA_APP_NOT_REGISTERED: status_t = B_MEDIA_ERROR_BASE + 112;
802 pub const B_MEDIA_CANNOT_RECLAIM_BUFFERS: status_t = B_MEDIA_ERROR_BASE + 113;
803 pub const B_MEDIA_BUFFERS_NOT_RECLAIMED: status_t = B_MEDIA_ERROR_BASE + 114;
804 pub const B_MEDIA_TIME_SOURCE_STOPPED: status_t = B_MEDIA_ERROR_BASE + 115;
805 pub const B_MEDIA_TIME_SOURCE_BUSY: status_t = B_MEDIA_ERROR_BASE + 116;
806 pub const B_MEDIA_BAD_SOURCE: status_t = B_MEDIA_ERROR_BASE + 117;
807 pub const B_MEDIA_BAD_DESTINATION: status_t = B_MEDIA_ERROR_BASE + 118;
808 pub const B_MEDIA_ALREADY_CONNECTED: status_t = B_MEDIA_ERROR_BASE + 119;
809 pub const B_MEDIA_NOT_CONNECTED: status_t = B_MEDIA_ERROR_BASE + 120;
810 pub const B_MEDIA_BAD_CLIP_FORMAT: status_t = B_MEDIA_ERROR_BASE + 121;
811 pub const B_MEDIA_ADDON_FAILED: status_t = B_MEDIA_ERROR_BASE + 122;
812 pub const B_MEDIA_ADDON_DISABLED: status_t = B_MEDIA_ERROR_BASE + 123;
813 pub const B_MEDIA_CHANGE_IN_PROGRESS: status_t = B_MEDIA_ERROR_BASE + 124;
814 pub const B_MEDIA_STALE_CHANGE_COUNT: status_t = B_MEDIA_ERROR_BASE + 125;
815 pub const B_MEDIA_ADDON_RESTRICTED: status_t = B_MEDIA_ERROR_BASE + 126;
816 pub const B_MEDIA_NO_HANDLER: status_t = B_MEDIA_ERROR_BASE + 127;
817 pub const B_MEDIA_DUPLICATE_FORMAT: status_t = B_MEDIA_ERROR_BASE + 128;
818 pub const B_MEDIA_REALTIME_DISABLED: status_t = B_MEDIA_ERROR_BASE + 129;
819 pub const B_MEDIA_REALTIME_UNAVAILABLE: status_t = B_MEDIA_ERROR_BASE + 130;
820
821 // Mail kit errors
822 pub const B_MAIL_NO_DAEMON: status_t = B_MAIL_ERROR_BASE + 0;
823 pub const B_MAIL_UNKNOWN_USER: status_t = B_MAIL_ERROR_BASE + 1;
824 pub const B_MAIL_WRONG_PASSWORD: status_t = B_MAIL_ERROR_BASE + 2;
825 pub const B_MAIL_UNKNOWN_HOST: status_t = B_MAIL_ERROR_BASE + 3;
826 pub const B_MAIL_ACCESS_ERROR: status_t = B_MAIL_ERROR_BASE + 4;
827 pub const B_MAIL_UNKNOWN_FIELD: status_t = B_MAIL_ERROR_BASE + 5;
828 pub const B_MAIL_NO_RECIPIENT: status_t = B_MAIL_ERROR_BASE + 6;
829 pub const B_MAIL_INVALID_MAIL: status_t = B_MAIL_ERROR_BASE + 7;
830
831 // Print kit errors
832 pub const B_NO_PRINT_SERVER: status_t = B_PRINT_ERROR_BASE + 0;
833
834 // Device kit errors
835 pub const B_DEV_INVALID_IOCTL: status_t = B_DEVICE_ERROR_BASE + 0;
836 pub const B_DEV_NO_MEMORY: status_t = B_DEVICE_ERROR_BASE + 1;
837 pub const B_DEV_BAD_DRIVE_NUM: status_t = B_DEVICE_ERROR_BASE + 2;
838 pub const B_DEV_NO_MEDIA: status_t = B_DEVICE_ERROR_BASE + 3;
839 pub const B_DEV_UNREADABLE: status_t = B_DEVICE_ERROR_BASE + 4;
840 pub const B_DEV_FORMAT_ERROR: status_t = B_DEVICE_ERROR_BASE + 5;
841 pub const B_DEV_TIMEOUT: status_t = B_DEVICE_ERROR_BASE + 6;
842 pub const B_DEV_RECALIBRATE_ERROR: status_t = B_DEVICE_ERROR_BASE + 7;
843 pub const B_DEV_SEEK_ERROR: status_t = B_DEVICE_ERROR_BASE + 8;
844 pub const B_DEV_ID_ERROR: status_t = B_DEVICE_ERROR_BASE + 9;
845 pub const B_DEV_READ_ERROR: status_t = B_DEVICE_ERROR_BASE + 10;
846 pub const B_DEV_WRITE_ERROR: status_t = B_DEVICE_ERROR_BASE + 11;
847 pub const B_DEV_NOT_READY: status_t = B_DEVICE_ERROR_BASE + 12;
848 pub const B_DEV_MEDIA_CHANGED: status_t = B_DEVICE_ERROR_BASE + 13;
849 pub const B_DEV_MEDIA_CHANGE_REQUESTED: status_t = B_DEVICE_ERROR_BASE + 14;
850 pub const B_DEV_RESOURCE_CONFLICT: status_t = B_DEVICE_ERROR_BASE + 15;
851 pub const B_DEV_CONFIGURATION_ERROR: status_t = B_DEVICE_ERROR_BASE + 16;
852 pub const B_DEV_DISABLED_BY_USER: status_t = B_DEVICE_ERROR_BASE + 17;
853 pub const B_DEV_DOOR_OPEN: status_t = B_DEVICE_ERROR_BASE + 18;
854
855 pub const B_DEV_INVALID_PIPE: status_t = B_DEVICE_ERROR_BASE + 19;
856 pub const B_DEV_CRC_ERROR: status_t = B_DEVICE_ERROR_BASE + 20;
857 pub const B_DEV_STALLED: status_t = B_DEVICE_ERROR_BASE + 21;
858 pub const B_DEV_BAD_PID: status_t = B_DEVICE_ERROR_BASE + 22;
859 pub const B_DEV_UNEXPECTED_PID: status_t = B_DEVICE_ERROR_BASE + 23;
860 pub const B_DEV_DATA_OVERRUN: status_t = B_DEVICE_ERROR_BASE + 24;
861 pub const B_DEV_DATA_UNDERRUN: status_t = B_DEVICE_ERROR_BASE + 25;
862 pub const B_DEV_FIFO_OVERRUN: status_t = B_DEVICE_ERROR_BASE + 26;
863 pub const B_DEV_FIFO_UNDERRUN: status_t = B_DEVICE_ERROR_BASE + 27;
864 pub const B_DEV_PENDING: status_t = B_DEVICE_ERROR_BASE + 28;
865 pub const B_DEV_MULTIPLE_ERRORS: status_t = B_DEVICE_ERROR_BASE + 29;
866 pub const B_DEV_TOO_LATE: status_t = B_DEVICE_ERROR_BASE + 30;
867
868 // translation kit errors
869 pub const B_TRANSLATION_BASE_ERROR: status_t = B_TRANSLATION_ERROR_BASE + 0;
870 pub const B_NO_TRANSLATOR: status_t = B_TRANSLATION_ERROR_BASE + 1;
871 pub const B_ILLEGAL_DATA: status_t = B_TRANSLATION_ERROR_BASE + 2;
872
873 // support/TypeConstants.h
874 pub const B_AFFINE_TRANSFORM_TYPE: u32 = haiku_constant!('A', 'M', 'T', 'X');
875 pub const B_ALIGNMENT_TYPE: u32 = haiku_constant!('A', 'L', 'G', 'N');
876 pub const B_ANY_TYPE: u32 = haiku_constant!('A', 'N', 'Y', 'T');
877 pub const B_ATOM_TYPE: u32 = haiku_constant!('A', 'T', 'O', 'M');
878 pub const B_ATOMREF_TYPE: u32 = haiku_constant!('A', 'T', 'M', 'R');
879 pub const B_BOOL_TYPE: u32 = haiku_constant!('B', 'O', 'O', 'L');
880 pub const B_CHAR_TYPE: u32 = haiku_constant!('C', 'H', 'A', 'R');
881 pub const B_COLOR_8_BIT_TYPE: u32 = haiku_constant!('C', 'L', 'R', 'B');
882 pub const B_DOUBLE_TYPE: u32 = haiku_constant!('D', 'B', 'L', 'E');
883 pub const B_FLOAT_TYPE: u32 = haiku_constant!('F', 'L', 'O', 'T');
884 pub const B_GRAYSCALE_8_BIT_TYPE: u32 = haiku_constant!('G', 'R', 'Y', 'B');
885 pub const B_INT16_TYPE: u32 = haiku_constant!('S', 'H', 'R', 'T');
886 pub const B_INT32_TYPE: u32 = haiku_constant!('L', 'O', 'N', 'G');
887 pub const B_INT64_TYPE: u32 = haiku_constant!('L', 'L', 'N', 'G');
888 pub const B_INT8_TYPE: u32 = haiku_constant!('B', 'Y', 'T', 'E');
889 pub const B_LARGE_ICON_TYPE: u32 = haiku_constant!('I', 'C', 'O', 'N');
890 pub const B_MEDIA_PARAMETER_GROUP_TYPE: u32 = haiku_constant!('B', 'M', 'C', 'G');
891 pub const B_MEDIA_PARAMETER_TYPE: u32 = haiku_constant!('B', 'M', 'C', 'T');
892 pub const B_MEDIA_PARAMETER_WEB_TYPE: u32 = haiku_constant!('B', 'M', 'C', 'W');
893 pub const B_MESSAGE_TYPE: u32 = haiku_constant!('M', 'S', 'G', 'G');
894 pub const B_MESSENGER_TYPE: u32 = haiku_constant!('M', 'S', 'N', 'G');
895 pub const B_MIME_TYPE: u32 = haiku_constant!('M', 'I', 'M', 'E');
896 pub const B_MINI_ICON_TYPE: u32 = haiku_constant!('M', 'I', 'C', 'N');
897 pub const B_MONOCHROME_1_BIT_TYPE: u32 = haiku_constant!('M', 'N', 'O', 'B');
898 pub const B_OBJECT_TYPE: u32 = haiku_constant!('O', 'P', 'T', 'R');
899 pub const B_OFF_T_TYPE: u32 = haiku_constant!('O', 'F', 'F', 'T');
900 pub const B_PATTERN_TYPE: u32 = haiku_constant!('P', 'A', 'T', 'N');
901 pub const B_POINTER_TYPE: u32 = haiku_constant!('P', 'N', 'T', 'R');
902 pub const B_POINT_TYPE: u32 = haiku_constant!('B', 'P', 'N', 'T');
903 pub const B_PROPERTY_INFO_TYPE: u32 = haiku_constant!('S', 'C', 'T', 'D');
904 pub const B_RAW_TYPE: u32 = haiku_constant!('R', 'A', 'W', 'T');
905 pub const B_RECT_TYPE: u32 = haiku_constant!('R', 'E', 'C', 'T');
906 pub const B_REF_TYPE: u32 = haiku_constant!('R', 'R', 'E', 'F');
907 pub const B_RGB_32_BIT_TYPE: u32 = haiku_constant!('R', 'G', 'B', 'B');
908 pub const B_RGB_COLOR_TYPE: u32 = haiku_constant!('R', 'G', 'B', 'C');
909 pub const B_SIZE_TYPE: u32 = haiku_constant!('S', 'I', 'Z', 'E');
910 pub const B_SIZE_T_TYPE: u32 = haiku_constant!('S', 'I', 'Z', 'T');
911 pub const B_SSIZE_T_TYPE: u32 = haiku_constant!('S', 'S', 'Z', 'T');
912 pub const B_STRING_TYPE: u32 = haiku_constant!('C', 'S', 'T', 'R');
913 pub const B_STRING_LIST_TYPE: u32 = haiku_constant!('S', 'T', 'R', 'L');
914 pub const B_TIME_TYPE: u32 = haiku_constant!('T', 'I', 'M', 'E');
915 pub const B_UINT16_TYPE: u32 = haiku_constant!('U', 'S', 'H', 'T');
916 pub const B_UINT32_TYPE: u32 = haiku_constant!('U', 'L', 'N', 'G');
917 pub const B_UINT64_TYPE: u32 = haiku_constant!('U', 'L', 'L', 'G');
918 pub const B_UINT8_TYPE: u32 = haiku_constant!('U', 'B', 'Y', 'T');
919 pub const B_VECTOR_ICON_TYPE: u32 = haiku_constant!('V', 'I', 'C', 'N');
920 pub const B_XATTR_TYPE: u32 = haiku_constant!('X', 'A', 'T', 'R');
921 pub const B_NETWORK_ADDRESS_TYPE: u32 = haiku_constant!('N', 'W', 'A', 'D');
922 pub const B_MIME_STRING_TYPE: u32 = haiku_constant!('M', 'I', 'M', 'S');
923 pub const B_ASCII_TYPE: u32 = haiku_constant!('T', 'E', 'X', 'T');
924 pub const B_APP_IMAGE_SYMBOL: *const c_void = core::ptr::null();
925
926 extern "C" {
927 // kernel/OS.h
928 pub fn create_area(
929 name: *const c_char,
930 startAddress: *mut *mut c_void,
931 addressSpec: u32,
932 size: usize,
933 lock: u32,
934 protection: u32,
935 ) -> area_id;
936 pub fn clone_area(
937 name: *const c_char,
938 destAddress: *mut *mut c_void,
939 addressSpec: u32,
940 protection: u32,
941 source: area_id,
942 ) -> area_id;
943 pub fn find_area(name: *const c_char) -> area_id;
944 pub fn area_for(address: *mut c_void) -> area_id;
945 pub fn delete_area(id: area_id) -> status_t;
946 pub fn resize_area(id: area_id, newSize: usize) -> status_t;
947 pub fn set_area_protection(id: area_id, newProtection: u32) -> status_t;
948 pub fn _get_area_info(id: area_id, areaInfo: *mut area_info, size: usize) -> status_t;
949 pub fn _get_next_area_info(
950 team: team_id,
951 cookie: *mut isize,
952 areaInfo: *mut area_info,
953 size: usize,
954 ) -> status_t;
955
956 pub fn create_port(capacity: i32, name: *const c_char) -> port_id;
957 pub fn find_port(name: *const c_char) -> port_id;
958 pub fn read_port(
959 port: port_id,
960 code: *mut i32,
961 buffer: *mut c_void,
962 bufferSize: size_t,
963 ) -> ssize_t;
964 pub fn read_port_etc(
965 port: port_id,
966 code: *mut i32,
967 buffer: *mut c_void,
968 bufferSize: size_t,
969 flags: u32,
970 timeout: bigtime_t,
971 ) -> ssize_t;
972 pub fn write_port(
973 port: port_id,
974 code: i32,
975 buffer: *const c_void,
976 bufferSize: size_t,
977 ) -> status_t;
978 pub fn write_port_etc(
979 port: port_id,
980 code: i32,
981 buffer: *const c_void,
982 bufferSize: size_t,
983 flags: u32,
984 timeout: bigtime_t,
985 ) -> status_t;
986 pub fn close_port(port: port_id) -> status_t;
987 pub fn delete_port(port: port_id) -> status_t;
988 pub fn port_buffer_size(port: port_id) -> ssize_t;
989 pub fn port_buffer_size_etc(port: port_id, flags: u32, timeout: bigtime_t) -> ssize_t;
990 pub fn port_count(port: port_id) -> ssize_t;
991 pub fn set_port_owner(port: port_id, team: team_id) -> status_t;
992
993 pub fn _get_port_info(port: port_id, buf: *mut port_info, portInfoSize: size_t) -> status_t;
994 pub fn _get_next_port_info(
995 port: port_id,
996 cookie: *mut i32,
997 portInfo: *mut port_info,
998 portInfoSize: size_t,
999 ) -> status_t;
1000 pub fn _get_port_message_info_etc(
1001 port: port_id,
1002 info: *mut port_message_info,
1003 infoSize: size_t,
1004 flags: u32,
1005 timeout: bigtime_t,
1006 ) -> status_t;
1007
1008 pub fn create_sem(count: i32, name: *const c_char) -> sem_id;
1009 pub fn delete_sem(id: sem_id) -> status_t;
1010 pub fn acquire_sem(id: sem_id) -> status_t;
1011 pub fn acquire_sem_etc(id: sem_id, count: i32, flags: u32, timeout: bigtime_t) -> status_t;
1012 pub fn release_sem(id: sem_id) -> status_t;
1013 pub fn release_sem_etc(id: sem_id, count: i32, flags: u32) -> status_t;
1014 pub fn switch_sem(semToBeReleased: sem_id, id: sem_id) -> status_t;
1015 pub fn switch_sem_etc(
1016 semToBeReleased: sem_id,
1017 id: sem_id,
1018 count: i32,
1019 flags: u32,
1020 timeout: bigtime_t,
1021 ) -> status_t;
1022 pub fn get_sem_count(id: sem_id, threadCount: *mut i32) -> status_t;
1023 pub fn set_sem_owner(id: sem_id, team: team_id) -> status_t;
1024 pub fn _get_sem_info(id: sem_id, info: *mut sem_info, infoSize: size_t) -> status_t;
1025 pub fn _get_next_sem_info(
1026 team: team_id,
1027 cookie: *mut i32,
1028 info: *mut sem_info,
1029 infoSize: size_t,
1030 ) -> status_t;
1031
1032 pub fn kill_team(team: team_id) -> status_t;
1033 pub fn _get_team_info(team: team_id, info: *mut team_info, size: size_t) -> status_t;
1034 pub fn _get_next_team_info(cookie: *mut i32, info: *mut team_info, size: size_t) -> status_t;
1035
1036 pub fn spawn_thread(
1037 func: thread_func,
1038 name: *const c_char,
1039 priority: i32,
1040 data: *mut c_void,
1041 ) -> thread_id;
1042 pub fn kill_thread(thread: thread_id) -> status_t;
1043 pub fn resume_thread(thread: thread_id) -> status_t;
1044 pub fn suspend_thread(thread: thread_id) -> status_t;
1045
1046 pub fn rename_thread(thread: thread_id, newName: *const c_char) -> status_t;
1047 pub fn set_thread_priority(thread: thread_id, newPriority: i32) -> status_t;
1048 pub fn suggest_thread_priority(
1049 what: u32,
1050 period: i32,
1051 jitter: crate::bigtime_t,
1052 length: crate::bigtime_t,
1053 ) -> i32;
1054 pub fn estimate_max_scheduling_latency(th: crate::thread_id) -> crate::bigtime_t;
1055 pub fn exit_thread(status: status_t);
1056 pub fn wait_for_thread(thread: thread_id, returnValue: *mut status_t) -> status_t;
1057 pub fn on_exit_thread(callback: extern "C" fn(*mut c_void), data: *mut c_void) -> status_t;
1058
1059 pub fn find_thread(name: *const c_char) -> thread_id;
1060
1061 pub fn get_scheduler_mode() -> i32;
1062 pub fn set_scheduler_mode(mode: i32) -> status_t;
1063
1064 pub fn send_data(
1065 thread: thread_id,
1066 code: i32,
1067 buffer: *const c_void,
1068 bufferSize: size_t,
1069 ) -> status_t;
1070 pub fn receive_data(sender: *mut thread_id, buffer: *mut c_void, bufferSize: size_t) -> i32;
1071 pub fn has_data(thread: thread_id) -> bool;
1072
1073 pub fn snooze(amount: bigtime_t) -> status_t;
1074 pub fn snooze_etc(amount: bigtime_t, timeBase: c_int, flags: u32) -> status_t;
1075 pub fn snooze_until(time: bigtime_t, timeBase: c_int) -> status_t;
1076
1077 pub fn _get_thread_info(id: thread_id, info: *mut thread_info, size: size_t) -> status_t;
1078 pub fn _get_next_thread_info(
1079 team: team_id,
1080 cookie: *mut i32,
1081 info: *mut thread_info,
1082 size: size_t,
1083 ) -> status_t;
1084
1085 pub fn get_pthread_thread_id(thread: crate::pthread_t) -> thread_id;
1086
1087 pub fn _get_team_usage_info(
1088 team: team_id,
1089 who: i32,
1090 info: *mut team_usage_info,
1091 size: size_t,
1092 ) -> status_t;
1093
1094 pub fn real_time_clock() -> c_ulong;
1095 pub fn set_real_time_clock(secsSinceJan1st1970: c_ulong);
1096 pub fn real_time_clock_usecs() -> bigtime_t;
1097 pub fn system_time() -> bigtime_t;
1098 pub fn system_time_nsecs() -> nanotime_t;
1099 // set_timezone() is deprecated and a no-op
1100
1101 pub fn set_alarm(when: bigtime_t, flags: u32) -> bigtime_t;
1102 pub fn debugger(message: *const c_char);
1103 pub fn disable_debugger(state: c_int) -> c_int;
1104
1105 pub fn get_system_info(info: *mut system_info) -> status_t;
1106 pub fn _get_cpu_info_etc(
1107 firstCPU: u32,
1108 cpuCount: u32,
1109 info: *mut cpu_info,
1110 size: size_t,
1111 ) -> status_t;
1112 pub fn get_cpu_topology_info(
1113 topologyInfos: *mut cpu_topology_node_info,
1114 topologyInfoCount: *mut u32,
1115 ) -> status_t;
1116 pub fn is_computer_on() -> i32;
1117 pub fn is_computer_on_fire() -> c_double;
1118 pub fn send_signal(threadID: thread_id, signal: c_uint) -> c_int;
1119 pub fn set_signal_stack(base: *mut c_void, size: size_t);
1120
1121 pub fn wait_for_objects(infos: *mut object_wait_info, numInfos: c_int) -> ssize_t;
1122 pub fn wait_for_objects_etc(
1123 infos: *mut object_wait_info,
1124 numInfos: c_int,
1125 flags: u32,
1126 timeout: bigtime_t,
1127 ) -> ssize_t;
1128
1129 // kernel/fs_attr.h
1130 pub fn fs_read_attr(
1131 fd: c_int,
1132 attribute: *const c_char,
1133 type_: u32,
1134 pos: off_t,
1135 buffer: *mut c_void,
1136 readBytes: size_t,
1137 ) -> ssize_t;
1138 pub fn fs_write_attr(
1139 fd: c_int,
1140 attribute: *const c_char,
1141 type_: u32,
1142 pos: off_t,
1143 buffer: *const c_void,
1144 writeBytes: size_t,
1145 ) -> ssize_t;
1146 pub fn fs_remove_attr(fd: c_int, attribute: *const c_char) -> c_int;
1147 pub fn fs_stat_attr(fd: c_int, attribute: *const c_char, attrInfo: *mut attr_info) -> c_int;
1148
1149 pub fn fs_open_attr(
1150 path: *const c_char,
1151 attribute: *const c_char,
1152 type_: u32,
1153 openMode: c_int,
1154 ) -> c_int;
1155 pub fn fs_fopen_attr(fd: c_int, attribute: *const c_char, type_: u32, openMode: c_int)
1156 -> c_int;
1157 pub fn fs_close_attr(fd: c_int) -> c_int;
1158
1159 pub fn fs_open_attr_dir(path: *const c_char) -> *mut crate::DIR;
1160 pub fn fs_lopen_attr_dir(path: *const c_char) -> *mut crate::DIR;
1161 pub fn fs_fopen_attr_dir(fd: c_int) -> *mut crate::DIR;
1162 pub fn fs_close_attr_dir(dir: *mut crate::DIR) -> c_int;
1163 pub fn fs_read_attr_dir(dir: *mut crate::DIR) -> *mut crate::dirent;
1164 pub fn fs_rewind_attr_dir(dir: *mut crate::DIR);
1165
1166 // kernel/fs_image.h
1167 pub fn fs_create_index(
1168 device: crate::dev_t,
1169 name: *const c_char,
1170 type_: u32,
1171 flags: u32,
1172 ) -> c_int;
1173 pub fn fs_remove_index(device: crate::dev_t, name: *const c_char) -> c_int;
1174 pub fn fs_stat_index(
1175 device: crate::dev_t,
1176 name: *const c_char,
1177 indexInfo: *mut index_info,
1178 ) -> c_int;
1179
1180 pub fn fs_open_index_dir(device: crate::dev_t) -> *mut crate::DIR;
1181 pub fn fs_close_index_dir(indexDirectory: *mut crate::DIR) -> c_int;
1182 pub fn fs_read_index_dir(indexDirectory: *mut crate::DIR) -> *mut crate::dirent;
1183 pub fn fs_rewind_index_dir(indexDirectory: *mut crate::DIR);
1184
1185 // kernel/fs_info.h
1186 pub fn dev_for_path(path: *const c_char) -> crate::dev_t;
1187 pub fn next_dev(pos: *mut i32) -> crate::dev_t;
1188 pub fn fs_stat_dev(dev: crate::dev_t, info: *mut fs_info) -> c_int;
1189
1190 // kernel/fs_query.h
1191 pub fn fs_open_query(device: crate::dev_t, query: *const c_char, flags: u32)
1192 -> *mut crate::DIR;
1193 pub fn fs_open_live_query(
1194 device: crate::dev_t,
1195 query: *const c_char,
1196 flags: u32,
1197 port: port_id,
1198 token: i32,
1199 ) -> *mut crate::DIR;
1200 pub fn fs_close_query(d: *mut crate::DIR) -> c_int;
1201 pub fn fs_read_query(d: *mut crate::DIR) -> *mut crate::dirent;
1202 pub fn get_path_for_dirent(dent: *mut crate::dirent, buf: *mut c_char, len: size_t)
1203 -> status_t;
1204
1205 // kernel/fs_volume.h
1206 pub fn fs_mount_volume(
1207 where_: *const c_char,
1208 device: *const c_char,
1209 filesystem: *const c_char,
1210 flags: u32,
1211 parameters: *const c_char,
1212 ) -> crate::dev_t;
1213 pub fn fs_unmount_volume(path: *const c_char, flags: u32) -> status_t;
1214
1215 // kernel/image.h
1216 pub fn load_image(
1217 argc: i32,
1218 argv: *mut *const c_char,
1219 environ: *mut *const c_char,
1220 ) -> thread_id;
1221 pub fn load_add_on(path: *const c_char) -> image_id;
1222 pub fn unload_add_on(image: image_id) -> status_t;
1223 pub fn get_image_symbol(
1224 image: image_id,
1225 name: *const c_char,
1226 symbolType: i32,
1227 symbolLocation: *mut *mut c_void,
1228 ) -> status_t;
1229 pub fn get_nth_image_symbol(
1230 image: image_id,
1231 n: i32,
1232 nameBuffer: *mut c_char,
1233 nameLength: *mut i32,
1234 symbolType: *mut i32,
1235 symbolLocation: *mut *mut c_void,
1236 ) -> status_t;
1237 pub fn clear_caches(address: *mut c_void, length: size_t, flags: u32);
1238 pub fn _get_image_info(image: image_id, info: *mut image_info, size: size_t) -> status_t;
1239 pub fn _get_next_image_info(
1240 team: team_id,
1241 cookie: *mut i32,
1242 info: *mut image_info,
1243 size: size_t,
1244 ) -> status_t;
1245 pub fn find_path(
1246 codePointer: *const c_void,
1247 baseDirectory: path_base_directory,
1248 subPath: *const c_char,
1249 pathBuffer: *mut c_char,
1250 bufferSize: usize,
1251 ) -> status_t;
1252 pub fn find_path_etc(
1253 codePointer: *const c_void,
1254 dependency: *const c_char,
1255 architecture: *const c_char,
1256 baseDirectory: path_base_directory,
1257 subPath: *const c_char,
1258 flags: u32,
1259 pathBuffer: *mut c_char,
1260 bufferSize: size_t,
1261 ) -> status_t;
1262 pub fn find_path_for_path(
1263 path: *const c_char,
1264 baseDirectory: path_base_directory,
1265 subPath: *const c_char,
1266 pathBuffer: *mut c_char,
1267 bufferSize: size_t,
1268 ) -> status_t;
1269 pub fn find_path_for_path_etc(
1270 path: *const c_char,
1271 dependency: *const c_char,
1272 architecture: *const c_char,
1273 baseDirectory: path_base_directory,
1274 subPath: *const c_char,
1275 flags: u32,
1276 pathBuffer: *mut c_char,
1277 bufferSize: size_t,
1278 ) -> status_t;
1279 pub fn find_paths(
1280 baseDirectory: path_base_directory,
1281 subPath: *const c_char,
1282 _paths: *mut *mut *mut c_char,
1283 pathCount: *mut size_t,
1284 ) -> status_t;
1285 pub fn find_paths_etc(
1286 architecture: *const c_char,
1287 baseDirectory: path_base_directory,
1288 subPath: *const c_char,
1289 flags: u32,
1290 _paths: *mut *mut *mut c_char,
1291 pathCount: *mut size_t,
1292 ) -> status_t;
1293 pub fn find_directory(
1294 which: directory_which,
1295 volume: crate::dev_t,
1296 createIt: bool,
1297 pathString: *mut c_char,
1298 length: i32,
1299 ) -> status_t;
1300
1301 pub fn get_cpuid(info: *mut cpuid_info, eaxRegister: u32, cpuNum: u32) -> status_t;
1302 }
1303
1304 // The following functions are defined as macros in C/C++
1305 #[inline]
1306 pub unsafe fn get_cpu_info(firstCPU: u32, cpuCount: u32, info: *mut cpu_info) -> status_t {
1307 _get_cpu_info_etc(
1308 firstCPU,
1309 cpuCount,
1310 info,
1311 core::mem::size_of::<cpu_info>() as size_t,
1312 )
1313 }
1314
1315 #[inline]
1316 pub unsafe fn get_area_info(id: area_id, info: *mut area_info) -> status_t {
1317 _get_area_info(id, info, core::mem::size_of::<area_info>() as usize)
1318 }
1319
1320 #[inline]
1321 pub unsafe fn get_next_area_info(
1322 team: team_id,
1323 cookie: *mut isize,
1324 info: *mut area_info,
1325 ) -> status_t {
1326 _get_next_area_info(
1327 team,
1328 cookie,
1329 info,
1330 core::mem::size_of::<area_info>() as usize,
1331 )
1332 }
1333
1334 #[inline]
1335 pub unsafe fn get_port_info(port: port_id, buf: *mut port_info) -> status_t {
1336 _get_port_info(port, buf, core::mem::size_of::<port_info>() as size_t)
1337 }
1338
1339 #[inline]
1340 pub unsafe fn get_next_port_info(
1341 port: port_id,
1342 cookie: *mut i32,
1343 portInfo: *mut port_info,
1344 ) -> status_t {
1345 _get_next_port_info(
1346 port,
1347 cookie,
1348 portInfo,
1349 core::mem::size_of::<port_info>() as size_t,
1350 )
1351 }
1352
1353 #[inline]
1354 pub unsafe fn get_port_message_info_etc(
1355 port: port_id,
1356 info: *mut port_message_info,
1357 flags: u32,
1358 timeout: bigtime_t,
1359 ) -> status_t {
1360 _get_port_message_info_etc(
1361 port,
1362 info,
1363 core::mem::size_of::<port_message_info>() as size_t,
1364 flags,
1365 timeout,
1366 )
1367 }
1368
1369 #[inline]
1370 pub unsafe fn get_sem_info(id: sem_id, info: *mut sem_info) -> status_t {
1371 _get_sem_info(id, info, core::mem::size_of::<sem_info>() as size_t)
1372 }
1373
1374 #[inline]
1375 pub unsafe fn get_next_sem_info(team: team_id, cookie: *mut i32, info: *mut sem_info) -> status_t {
1376 _get_next_sem_info(
1377 team,
1378 cookie,
1379 info,
1380 core::mem::size_of::<sem_info>() as size_t,
1381 )
1382 }
1383
1384 #[inline]
1385 pub unsafe fn get_team_info(team: team_id, info: *mut team_info) -> status_t {
1386 _get_team_info(team, info, core::mem::size_of::<team_info>() as size_t)
1387 }
1388
1389 #[inline]
1390 pub unsafe fn get_next_team_info(cookie: *mut i32, info: *mut team_info) -> status_t {
1391 _get_next_team_info(cookie, info, core::mem::size_of::<team_info>() as size_t)
1392 }
1393
1394 #[inline]
1395 pub unsafe fn get_team_usage_info(team: team_id, who: i32, info: *mut team_usage_info) -> status_t {
1396 _get_team_usage_info(
1397 team,
1398 who,
1399 info,
1400 core::mem::size_of::<team_usage_info>() as size_t,
1401 )
1402 }
1403
1404 #[inline]
1405 pub unsafe fn get_thread_info(id: thread_id, info: *mut thread_info) -> status_t {
1406 _get_thread_info(id, info, core::mem::size_of::<thread_info>() as size_t)
1407 }
1408
1409 #[inline]
1410 pub unsafe fn get_next_thread_info(
1411 team: team_id,
1412 cookie: *mut i32,
1413 info: *mut thread_info,
1414 ) -> status_t {
1415 _get_next_thread_info(
1416 team,
1417 cookie,
1418 info,
1419 core::mem::size_of::<thread_info>() as size_t,
1420 )
1421 }
1422
1423 // kernel/image.h
1424 #[inline]
1425 pub unsafe fn get_image_info(image: image_id, info: *mut image_info) -> status_t {
1426 _get_image_info(image, info, core::mem::size_of::<image_info>() as size_t)
1427 }
1428
1429 #[inline]
1430 pub unsafe fn get_next_image_info(
1431 team: team_id,
1432 cookie: *mut i32,
1433 info: *mut image_info,
1434 ) -> status_t {
1435 _get_next_image_info(
1436 team,
1437 cookie,
1438 info,
1439 core::mem::size_of::<image_info>() as size_t,
1440 )
1441 }