| ... | @@ -14,8 +14,12 @@ pub extern "c" fn find_thread(thread_name: ?*c_void) i32; | ... | @@ -14,8 +14,12 @@ pub extern "c" fn find_thread(thread_name: ?*c_void) i32; |
| 14 | | 14 | |
| 15 | pub extern "c" fn get_system_info(system_info: *system_info) usize; | 15 | pub extern "c" fn get_system_info(system_info: *system_info) usize; |
| 16 | | 16 | |
| | 17 | pub extern "c" fn _get_team_info(team: c_int, team_info: *team_info, size: usize) i32; |
| | 18 | |
| | 19 | pub extern "c" fn _get_next_area_info(team: c_int, cookie: *i64, area_info: *area_info, size: usize) i32; |
| | 20 | |
| 17 | // TODO revisit if abi changes or better option becomes apparent | 21 | // TODO revisit if abi changes or better option becomes apparent |
| 18 | pub extern "c" fn _get_next_image_info(team: c_int, cookie: *i32, image_info: *image_info) usize; | 22 | pub extern "c" fn _get_next_image_info(team: c_int, cookie: *i32, image_info: *image_info, size: usize) i32; |
| 19 | | 23 | |
| 20 | pub extern "c" fn _kern_read_dir(fd: c_int, buf_ptr: [*]u8, nbytes: usize, maxcount: u32) usize; | 24 | pub extern "c" fn _kern_read_dir(fd: c_int, buf_ptr: [*]u8, nbytes: usize, maxcount: u32) usize; |
| 21 | | 25 | |
| ... | @@ -112,6 +116,12 @@ pub const EAI = enum(c_int) { | ... | @@ -112,6 +116,12 @@ pub const EAI = enum(c_int) { |
| 112 | | 116 | |
| 113 | pub const EAI_MAX = 15; | 117 | pub const EAI_MAX = 15; |
| 114 | | 118 | |
| | 119 | pub const AI = struct { |
| | 120 | pub const NUMERICSERV = 0x00000008; |
| | 121 | }; |
| | 122 | |
| | 123 | pub const AI_NUMERICSERV = AI.NUMERICSERV; |
| | 124 | |
| 115 | pub const fd_t = c_int; | 125 | pub const fd_t = c_int; |
| 116 | pub const pid_t = c_int; | 126 | pub const pid_t = c_int; |
| 117 | pub const uid_t = u32; | 127 | pub const uid_t = u32; |
| ... | @@ -282,15 +292,29 @@ pub const dirent = extern struct { | ... | @@ -282,15 +292,29 @@ pub const dirent = extern struct { |
| 282 | } | 292 | } |
| 283 | }; | 293 | }; |
| 284 | | 294 | |
| | 295 | pub const area_info = extern struct { |
| | 296 | area: u32, |
| | 297 | name: [32]u8, |
| | 298 | size: usize, |
| | 299 | lock: u32, |
| | 300 | protection: u32, |
| | 301 | team_id: i32, |
| | 302 | ram_size: u32, |
| | 303 | copy_count: u32, |
| | 304 | in_count: u32, |
| | 305 | out_count: u32, |
| | 306 | address: *c_void, |
| | 307 | }; |
| | 308 | |
| 285 | pub const image_info = extern struct { | 309 | pub const image_info = extern struct { |
| 286 | id: u32, | 310 | id: u32, |
| 287 | type: u32, | 311 | image_type: u32, |
| 288 | sequence: i32, | 312 | sequence: i32, |
| 289 | init_order: i32, | 313 | init_order: i32, |
| 290 | init_routine: *c_void, | 314 | init_routine: *c_void, |
| 291 | term_routine: *c_void, | 315 | term_routine: *c_void, |
| 292 | device: i32, | 316 | device: i32, |
| 293 | node: i32, | 317 | node: i64, |
| 294 | name: [1024]u8, | 318 | name: [1024]u8, |
| 295 | text: *c_void, | 319 | text: *c_void, |
| 296 | data: *c_void, | 320 | data: *c_void, |
| ... | @@ -328,6 +352,19 @@ pub const system_info = extern struct { | ... | @@ -328,6 +352,19 @@ pub const system_info = extern struct { |
| 328 | abi: u32, | 352 | abi: u32, |
| 329 | }; | 353 | }; |
| 330 | | 354 | |
| | 355 | pub const team_info = extern struct { |
| | 356 | team_id: i32, |
| | 357 | thread_count: i32, |
| | 358 | image_count: i32, |
| | 359 | area_count: i32, |
| | 360 | debugger_nub_thread: i32, |
| | 361 | debugger_nub_port: i32, |
| | 362 | argc: i32, |
| | 363 | args: [64]u8, |
| | 364 | uid: uid_t, |
| | 365 | gid: gid_t, |
| | 366 | }; |
| | 367 | |
| 331 | pub const in_port_t = u16; | 368 | pub const in_port_t = u16; |
| 332 | pub const sa_family_t = u8; | 369 | pub const sa_family_t = u8; |
| 333 | | 370 | |
| ... | @@ -374,8 +411,11 @@ pub const CTL = struct { | ... | @@ -374,8 +411,11 @@ pub const CTL = struct { |
| 374 | pub const KERN = struct { | 411 | pub const KERN = struct { |
| 375 | pub const PROC = 14; // struct: process entries | 412 | pub const PROC = 14; // struct: process entries |
| 376 | pub const PROC_PATHNAME = 12; // path to executable | 413 | pub const PROC_PATHNAME = 12; // path to executable |
| | 414 | pub const IOV_MAX = 1024; |
| 377 | }; | 415 | }; |
| 378 | | 416 | |
| | 417 | pub const IOV_MAX = KERN.IOV_MAX; |
| | 418 | |
| 379 | pub const PATH_MAX = 1024; | 419 | pub const PATH_MAX = 1024; |
| 380 | | 420 | |
| 381 | pub const STDIN_FILENO = 0; | 421 | pub const STDIN_FILENO = 0; |
| ... | @@ -400,18 +440,13 @@ pub const MAP = struct { | ... | @@ -400,18 +440,13 @@ pub const MAP = struct { |
| 400 | pub const FAILED = @intToPtr(*c_void, maxInt(usize)); | 440 | pub const FAILED = @intToPtr(*c_void, maxInt(usize)); |
| 401 | pub const SHARED = 0x0001; | 441 | pub const SHARED = 0x0001; |
| 402 | pub const PRIVATE = 0x0002; | 442 | pub const PRIVATE = 0x0002; |
| 403 | pub const FIXED = 0x0010; | 443 | pub const FIXED = 0x0004; |
| 404 | pub const STACK = 0x0400; | 444 | pub const STACK = 0x0400; |
| 405 | pub const NOSYNC = 0x0800; | 445 | pub const NOSYNC = 0x0800; |
| 406 | pub const ANON = 0x1000; | 446 | pub const ANON = 0x0008; |
| 407 | pub const ANONYMOUS = ANON; | 447 | pub const ANONYMOUS = ANON; |
| 408 | pub const FILE = 0; | 448 | pub const FILE = 0; |
| 409 | | 449 | |
| 410 | pub const GUARD = 0x00002000; | | |
| 411 | pub const EXCL = 0x00004000; | | |
| 412 | pub const NOCORE = 0x00020000; | | |
| 413 | pub const PREFAULT_READ = 0x00040000; | | |
| 414 | pub const @"32BIT" = 0x00080000; | | |
| 415 | }; | 450 | }; |
| 416 | | 451 | |
| 417 | pub const W = struct { | 452 | pub const W = struct { |
| ... | @@ -535,8 +570,6 @@ pub const O = struct { | ... | @@ -535,8 +570,6 @@ pub const O = struct { |
| 535 | pub const RDWR = 0x0002; | 570 | pub const RDWR = 0x0002; |
| 536 | pub const ACCMODE = 0x0003; | 571 | pub const ACCMODE = 0x0003; |
| 537 | | 572 | |
| 538 | pub const SHLOCK = 0x0010; | | |
| 539 | pub const EXLOCK = 0x0020; | | |
| 540 | | 573 | |
| 541 | pub const CREAT = 0x0200; | 574 | pub const CREAT = 0x0200; |
| 542 | pub const EXCL = 0x0800; | 575 | pub const EXCL = 0x0800; |
| ... | @@ -549,7 +582,7 @@ pub const O = struct { | ... | @@ -549,7 +582,7 @@ pub const O = struct { |
| 549 | pub const RSYNC = 0o4010000; | 582 | pub const RSYNC = 0o4010000; |
| 550 | pub const DIRECTORY = 0x20000; | 583 | pub const DIRECTORY = 0x20000; |
| 551 | pub const NOFOLLOW = 0x0100; | 584 | pub const NOFOLLOW = 0x0100; |
| 552 | pub const CLOEXEC = 0x00100000; | 585 | pub const CLOEXEC = 0x00000040; |
| 553 | | 586 | |
| 554 | pub const ASYNC = 0x0040; | 587 | pub const ASYNC = 0x0040; |
| 555 | pub const DIRECT = 0x00010000; | 588 | pub const DIRECT = 0x00010000; |
| ... | @@ -1405,3 +1438,6 @@ pub const termios = extern struct { | ... | @@ -1405,3 +1438,6 @@ pub const termios = extern struct { |
| 1405 | c_ospeed: speed_t, | 1438 | c_ospeed: speed_t, |
| 1406 | cc_t: [NCCS]cc_t, | 1439 | cc_t: [NCCS]cc_t, |
| 1407 | }; | 1440 | }; |
| | 1441 | |
| | 1442 | pub const MSG_NOSIGNAL = 0x0800; |
| | 1443 | |