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