authorgravatar for devnexen@gmail.comDavid Carlier <devnexen@gmail.com> 2023-05-07 08:19:59+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-05-07 17:05:03+03:00
logff59c4584041517a2ee07cccf923ef5460032d68
tree1b3cce7d622bf6902a37a5485980600221a0508b
parente8cc1017dabed9e735ff5e6a682329afb7480461

std.c: darwin add host_info based data.


1 files changed, 86 insertions(+), 0 deletions(-)

lib/std/c/darwin.zig+86
......@@ -3916,3 +3916,89 @@ pub const THREAD_AFFINITY = struct {
39163916/// individual cpus (high performance cpus group and low consumption one), thus the pthread QOS api is more appropriate in this case.
39173917pub extern "c" fn thread_affinity_get(thread: thread_act_t, flavor: thread_policy_flavor_t, info: thread_policy_t, infocnt: [*]mach_msg_type_number_t, default: *boolean_t) kern_return_t;
39183918pub extern "c" fn thread_affinity_set(thread: thread_act_t, flavor: thread_policy_flavor_t, info: thread_policy_t, infocnt: mach_msg_type_number_t) kern_return_t;
3919
3920pub const cpu_type_t = integer_t;
3921pub const cpu_subtype_t = integer_t;
3922pub const cpu_threadtype_t = integer_t;
3923pub const host_flavor_t = integer_t;
3924pub const host_info_t = *integer_t;
3925pub const host_can_has_debugger_info = extern struct {
3926 can_has_debugger: boolean_t,
3927};
3928pub const host_can_has_debugger_info_data_t = host_can_has_debugger_info;
3929pub const host_can_has_debugger_info_t = *host_can_has_debugger_info;
3930
3931pub const host_sched_info = extern struct {
3932 min_timeout: integer_t,
3933 min_quantum: integer_t,
3934};
3935pub const host_sched_info_data_t = host_sched_info;
3936pub const host_sched_info_t = *host_sched_info;
3937
3938pub const kernel_resource_sizes = extern struct {
3939 task: natural_t,
3940 thread: natural_t,
3941 port: natural_t,
3942 memory_region: natural_t,
3943 memory_object: natural_t,
3944};
3945
3946pub const kernel_resource_sizes_data_t = kernel_resource_sizes;
3947pub const kernel_resource_sizes_t = *kernel_resource_sizes;
3948
3949pub const host_priority_info = extern struct {
3950 kernel_priority: integer_t,
3951 system_priority: integer_t,
3952 server_priority: integer_t,
3953 user_priority: integer_t,
3954 depress_priority: integer_t,
3955 idle_priority: integer_t,
3956 minimum_priority: integer_t,
3957 maximum_priority: integer_t,
3958};
3959
3960pub const host_priority_info_data_t = host_priority_info;
3961pub const host_priority_info_t = *host_priority_info;
3962
3963pub const CPU_STATE_MAX = 4;
3964
3965pub const host_cpu_load_info = extern struct {
3966 cpu_ticks: [CPU_STATE_MAX]natural_t,
3967};
3968
3969pub const host_cpu_load_info_data_t = host_cpu_load_info;
3970pub const host_cpu_load_info_t = *host_cpu_load_info;
3971
3972pub const HOST = struct {
3973 pub const BASIC_INFO = 1;
3974 pub const SCHED_INFO = 3;
3975 pub const RESOURCE_SIZES = 4;
3976 pub const PRIORITY_INFO = 5;
3977 pub const SEMAPHORE_TRAPS = 7;
3978 pub const MACH_MSG_TRAPS = 8;
3979 pub const VM_PURGEABLE = 9;
3980 pub const DEBUG_INFO_INTERNAL = 10;
3981 pub const CAN_HAS_DEBUGGER = 11;
3982 pub const PREFERRED_USER_ARCH = 12;
3983 pub const CAN_HAS_DEBUGGER_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_can_has_debugger_info_data_t) / @sizeOf(integer_t));
3984 pub const SCHED_INFO_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_sched_info_data_t) / @sizeOf(integer_t));
3985 pub const RESOURCES_SIZES_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(kernel_resource_sizes_data_t) / @sizeOf(integer_t));
3986 pub const PRIORITY_INFO_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_priority_info_data_t) / @sizeOf(integer_t));
3987 pub const CPU_LOAD_INFO_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_cpu_load_info_data_t) / @sizeOf(integer_t));
3988};
3989
3990pub const host_basic_info = packed struct(u32) {
3991 max_cpus: integer_t,
3992 avail_cpus: integer_t,
3993 memory_size: natural_t,
3994 cpu_type: cpu_type_t,
3995 cpu_subtype: cpu_subtype_t,
3996 cpu_threadtype: cpu_threadtype_t,
3997 physical_cpu: integer_t,
3998 physical_cpu_max: integer_t,
3999 logical_cpu: integer_t,
4000 logical_cpu_max: integer_t,
4001 max_mem: u64,
4002};
4003
4004pub extern "c" fn host_info(host: host_t, flavor: host_flavor_t, info_out: host_info_t, info_outCnt: [*]mach_msg_type_number_t) kern_return_t;