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