| ... | ... | @@ -1,15 +1,8 @@ |
| 1 | 1 | const std = @import("../std.zig"); |
| 2 | | const assert = std.debug.assert; |
| 3 | 2 | const builtin = @import("builtin"); |
| 4 | | const maxInt = std.math.maxInt; |
| 5 | | const iovec = std.posix.iovec; |
| 6 | | const iovec_const = std.posix.iovec_const; |
| 7 | | const socklen_t = std.c.socklen_t; |
| 3 | const assert = std.debug.assert; |
| 8 | 4 | const fd_t = std.c.fd_t; |
| 9 | 5 | const off_t = std.c.off_t; |
| 10 | | const PATH_MAX = std.c.PATH_MAX; |
| 11 | | const uid_t = std.c.uid_t; |
| 12 | | const gid_t = std.c.gid_t; |
| 13 | 6 | const dev_t = std.c.dev_t; |
| 14 | 7 | const ino_t = std.c.ino_t; |
| 15 | 8 | |
| ... | ... | @@ -17,52 +10,20 @@ comptime { |
| 17 | 10 | assert(builtin.os.tag == .haiku); // Prevent access of std.c symbols on wrong OS. |
| 18 | 11 | } |
| 19 | 12 | |
| 20 | | pub extern "root" fn _errnop() *i32; |
| 21 | | pub extern "root" fn find_directory(which: directory_which, volume: i32, createIt: bool, path_ptr: [*]u8, length: i32) u64; |
| 22 | | pub extern "root" fn find_thread(thread_name: ?*anyopaque) i32; |
| 23 | | pub extern "root" fn get_system_info(system_info: *system_info) usize; |
| 24 | | pub extern "root" fn _get_team_info(team: i32, team_info: *team_info, size: usize) i32; |
| 25 | | pub extern "root" fn _get_next_area_info(team: i32, cookie: *i64, area_info: *area_info, size: usize) i32; |
| 26 | | pub extern "root" fn _get_next_image_info(team: i32, cookie: *i32, image_info: *image_info, size: usize) i32; |
| 27 | | pub extern "root" fn _kern_get_current_team() team_id; |
| 13 | pub const B_OS_NAME_LENGTH = 32; |
| 14 | |
| 28 | 15 | pub extern "root" fn _kern_open_dir(fd: fd_t, path: [*:0]const u8) fd_t; |
| 29 | 16 | pub extern "root" fn _kern_read_dir(fd: fd_t, buffer: [*]u8, bufferSize: usize, maxCount: u32) isize; |
| 30 | 17 | pub extern "root" fn _kern_rewind_dir(fd: fd_t) status_t; |
| 31 | 18 | pub extern "root" fn _kern_read_stat(fd: fd_t, path: [*:0]const u8, traverseLink: bool, stat: *std.c.Stat, statSize: usize) status_t; |
| 32 | | pub extern "root" fn readv_pos(fd: fd_t, pos: off_t, vec: [*]const std.c.iovec, count: i32) isize; |
| 33 | | pub extern "root" fn writev_pos(fd: fd_t, pos: off_t, vec: [*]const std.c.iovec_const, count: i32) isize; |
| 34 | 19 | |
| 35 | | pub const area_info = extern struct { |
| 36 | | area: u32, |
| 37 | | name: [32]u8, |
| 38 | | size: usize, |
| 39 | | lock: u32, |
| 40 | | protection: u32, |
| 41 | | team_id: i32, |
| 42 | | ram_size: u32, |
| 43 | | copy_count: u32, |
| 44 | | in_count: u32, |
| 45 | | out_count: u32, |
| 46 | | address: *anyopaque, |
| 47 | | }; |
| 20 | pub extern "root" fn find_thread(name: ?[*:0]const u8) thread_id; |
| 21 | pub extern "root" fn get_system_info(info: *system_info) status_t; |
| 48 | 22 | |
| 49 | | pub const image_info = extern struct { |
| 50 | | id: u32, |
| 51 | | image_type: u32, |
| 52 | | sequence: i32, |
| 53 | | init_order: i32, |
| 54 | | init_routine: *anyopaque, |
| 55 | | term_routine: *anyopaque, |
| 56 | | device: i32, |
| 57 | | node: i64, |
| 58 | | name: [PATH_MAX]u8, |
| 59 | | text: *anyopaque, |
| 60 | | data: *anyopaque, |
| 61 | | text_size: i32, |
| 62 | | data_size: i32, |
| 63 | | api_version: i32, |
| 64 | | abi: i32, |
| 65 | | }; |
| 23 | pub extern "root" fn _errnop() *i32; |
| 24 | |
| 25 | pub extern "root" fn readv_pos(fd: fd_t, pos: off_t, vec: [*]const std.c.iovec, count: i32) isize; |
| 26 | pub extern "root" fn writev_pos(fd: fd_t, pos: off_t, vec: [*]const std.c.iovec_const, count: i32) isize; |
| 66 | 27 | |
| 67 | 28 | pub const system_info = extern struct { |
| 68 | 29 | boot_time: i64, |
| ... | ... | @@ -86,31 +47,12 @@ pub const system_info = extern struct { |
| 86 | 47 | max_teams: u32, |
| 87 | 48 | used_teams: u32, |
| 88 | 49 | kernel_name: [256]u8, |
| 89 | | kernel_build_date: [32]u8, |
| 90 | | kernel_build_time: [32]u8, |
| 50 | kernel_build_date: [B_OS_NAME_LENGTH]u8, |
| 51 | kernel_build_time: [B_OS_NAME_LENGTH]u8, |
| 91 | 52 | kernel_version: i64, |
| 92 | 53 | abi: u32, |
| 93 | 54 | }; |
| 94 | 55 | |
| 95 | | pub const team_info = extern struct { |
| 96 | | team_id: i32, |
| 97 | | thread_count: i32, |
| 98 | | image_count: i32, |
| 99 | | area_count: i32, |
| 100 | | debugger_nub_thread: i32, |
| 101 | | debugger_nub_port: i32, |
| 102 | | argc: i32, |
| 103 | | args: [64]u8, |
| 104 | | uid: uid_t, |
| 105 | | gid: gid_t, |
| 106 | | }; |
| 107 | | |
| 108 | | pub const directory_which = enum(i32) { |
| 109 | | B_USER_SETTINGS_DIRECTORY = 0xbbe, |
| 110 | | |
| 111 | | _, |
| 112 | | }; |
| 113 | | |
| 114 | 56 | pub const area_id = i32; |
| 115 | 57 | pub const port_id = i32; |
| 116 | 58 | pub const sem_id = i32; |