- long ru_maxrss; /* max resident set size (PL) */
-#define ru_first ru_ixrss /* internal: ruadd() range start */
- long ru_ixrss; /* integral shared memory size (NU) */
- long ru_idrss; /* integral unshared data (NU) */
- long ru_isrss; /* integral unshared stack (NU) */
- long ru_minflt; /* page reclaims (NU) */
- long ru_majflt; /* page faults (NU) */
- long ru_nswap; /* swaps (NU) */
- long ru_inblock; /* block input operations (atomic) */
- long ru_oublock; /* block output operations (atomic) */
- long ru_msgsnd; /* messages sent (atomic) */
- long ru_msgrcv; /* messages received (atomic) */
- long ru_nsignals; /* signals received (atomic) */
- long ru_nvcsw; /* voluntary context switches (atomic) */
- long ru_nivcsw; /* involuntary " */
-#define ru_last ru_nivcsw /* internal: ruadd() range end */
-#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
+ long ru_maxrss; /* max resident set size (PL) */
+#define ru_first ru_ixrss /* internal: ruadd() range start */
+ long ru_ixrss; /* integral shared memory size (NU) */
+ long ru_idrss; /* integral unshared data (NU) */
+ long ru_isrss; /* integral unshared stack (NU) */
+ long ru_minflt; /* page reclaims (NU) */
+ long ru_majflt; /* page faults (NU) */
+ long ru_nswap; /* swaps (NU) */
+ long ru_inblock; /* block input operations (atomic) */
+ long ru_oublock; /* block output operations (atomic) */
+ long ru_msgsnd; /* messages sent (atomic) */
+ long ru_msgrcv; /* messages received (atomic) */
+ long ru_nsignals; /* signals received (atomic) */
+ long ru_nvcsw; /* voluntary context switches (atomic) */
+ long ru_nivcsw; /* involuntary " */
+#define ru_last ru_nivcsw /* internal: ruadd() range end */
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
+};
+
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+/*
+ * Flavors for proc_pid_rusage().
+ */
+#define RUSAGE_INFO_V0 0
+#define RUSAGE_INFO_V1 1
+#define RUSAGE_INFO_V2 2
+#define RUSAGE_INFO_V3 3
+#define RUSAGE_INFO_V4 4
+#define RUSAGE_INFO_CURRENT RUSAGE_INFO_V4
+
+typedef void *rusage_info_t;
+
+struct rusage_info_v0 {
+ uint8_t ri_uuid[16];
+ uint64_t ri_user_time;
+ uint64_t ri_system_time;
+ uint64_t ri_pkg_idle_wkups;
+ uint64_t ri_interrupt_wkups;
+ uint64_t ri_pageins;
+ uint64_t ri_wired_size;
+ uint64_t ri_resident_size;
+ uint64_t ri_phys_footprint;
+ uint64_t ri_proc_start_abstime;
+ uint64_t ri_proc_exit_abstime;
+};
+
+struct rusage_info_v1 {
+ uint8_t ri_uuid[16];
+ uint64_t ri_user_time;
+ uint64_t ri_system_time;
+ uint64_t ri_pkg_idle_wkups;
+ uint64_t ri_interrupt_wkups;
+ uint64_t ri_pageins;
+ uint64_t ri_wired_size;
+ uint64_t ri_resident_size;
+ uint64_t ri_phys_footprint;
+ uint64_t ri_proc_start_abstime;
+ uint64_t ri_proc_exit_abstime;
+ uint64_t ri_child_user_time;
+ uint64_t ri_child_system_time;
+ uint64_t ri_child_pkg_idle_wkups;
+ uint64_t ri_child_interrupt_wkups;
+ uint64_t ri_child_pageins;
+ uint64_t ri_child_elapsed_abstime;
+};
+
+struct rusage_info_v2 {
+ uint8_t ri_uuid[16];
+ uint64_t ri_user_time;
+ uint64_t ri_system_time;
+ uint64_t ri_pkg_idle_wkups;
+ uint64_t ri_interrupt_wkups;
+ uint64_t ri_pageins;
+ uint64_t ri_wired_size;
+ uint64_t ri_resident_size;
+ uint64_t ri_phys_footprint;
+ uint64_t ri_proc_start_abstime;
+ uint64_t ri_proc_exit_abstime;
+ uint64_t ri_child_user_time;
+ uint64_t ri_child_system_time;
+ uint64_t ri_child_pkg_idle_wkups;
+ uint64_t ri_child_interrupt_wkups;
+ uint64_t ri_child_pageins;
+ uint64_t ri_child_elapsed_abstime;
+ uint64_t ri_diskio_bytesread;
+ uint64_t ri_diskio_byteswritten;
+};
+
+struct rusage_info_v3 {
+ uint8_t ri_uuid[16];
+ uint64_t ri_user_time;
+ uint64_t ri_system_time;
+ uint64_t ri_pkg_idle_wkups;
+ uint64_t ri_interrupt_wkups;
+ uint64_t ri_pageins;
+ uint64_t ri_wired_size;
+ uint64_t ri_resident_size;
+ uint64_t ri_phys_footprint;
+ uint64_t ri_proc_start_abstime;
+ uint64_t ri_proc_exit_abstime;
+ uint64_t ri_child_user_time;
+ uint64_t ri_child_system_time;
+ uint64_t ri_child_pkg_idle_wkups;
+ uint64_t ri_child_interrupt_wkups;
+ uint64_t ri_child_pageins;
+ uint64_t ri_child_elapsed_abstime;
+ uint64_t ri_diskio_bytesread;
+ uint64_t ri_diskio_byteswritten;
+ uint64_t ri_cpu_time_qos_default;
+ uint64_t ri_cpu_time_qos_maintenance;
+ uint64_t ri_cpu_time_qos_background;
+ uint64_t ri_cpu_time_qos_utility;
+ uint64_t ri_cpu_time_qos_legacy;
+ uint64_t ri_cpu_time_qos_user_initiated;
+ uint64_t ri_cpu_time_qos_user_interactive;
+ uint64_t ri_billed_system_time;
+ uint64_t ri_serviced_system_time;