Skip to content

Commit ff59c45

Browse files
devnexenVexu
authored andcommitted
std.c: darwin add host_info based data.
1 parent e8cc101 commit ff59c45

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

lib/std/c/darwin.zig

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
39173917
pub 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;
39183918
pub 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+
3920+
pub const cpu_type_t = integer_t;
3921+
pub const cpu_subtype_t = integer_t;
3922+
pub const cpu_threadtype_t = integer_t;
3923+
pub const host_flavor_t = integer_t;
3924+
pub const host_info_t = *integer_t;
3925+
pub const host_can_has_debugger_info = extern struct {
3926+
can_has_debugger: boolean_t,
3927+
};
3928+
pub const host_can_has_debugger_info_data_t = host_can_has_debugger_info;
3929+
pub const host_can_has_debugger_info_t = *host_can_has_debugger_info;
3930+
3931+
pub const host_sched_info = extern struct {
3932+
min_timeout: integer_t,
3933+
min_quantum: integer_t,
3934+
};
3935+
pub const host_sched_info_data_t = host_sched_info;
3936+
pub const host_sched_info_t = *host_sched_info;
3937+
3938+
pub 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+
3946+
pub const kernel_resource_sizes_data_t = kernel_resource_sizes;
3947+
pub const kernel_resource_sizes_t = *kernel_resource_sizes;
3948+
3949+
pub 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+
3960+
pub const host_priority_info_data_t = host_priority_info;
3961+
pub const host_priority_info_t = *host_priority_info;
3962+
3963+
pub const CPU_STATE_MAX = 4;
3964+
3965+
pub const host_cpu_load_info = extern struct {
3966+
cpu_ticks: [CPU_STATE_MAX]natural_t,
3967+
};
3968+
3969+
pub const host_cpu_load_info_data_t = host_cpu_load_info;
3970+
pub const host_cpu_load_info_t = *host_cpu_load_info;
3971+
3972+
pub 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+
3990+
pub 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+
4004+
pub 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;

0 commit comments

Comments
 (0)