Commit a78e61acf9

Andrew Kelley <andrew@ziglang.org>
2021-11-01 23:55:22
std: expose rusage constants under rusage namespace
1 parent 63f4778
Changed files (3)
lib/std/c/darwin.zig
@@ -1703,8 +1703,6 @@ pub const CLOCK = struct {
 /// Max open files per process
 /// https://opensource.apple.com/source/xnu/xnu-4903.221.2/bsd/sys/syslimits.h.auto.html
 pub const OPEN_MAX = 10240;
-pub const RUSAGE_SELF = 0;
-pub const RUSAGE_CHILDREN = -1;
 
 pub const rusage = extern struct {
     utime: timeval,
@@ -1723,6 +1721,9 @@ pub const rusage = extern struct {
     nsignals: isize,
     nvcsw: isize,
     nivcsw: isize,
+
+    pub const SELF = 0;
+    pub const CHILDREN = -1;
 };
 
 pub const rlimit_resource = enum(c_int) {
lib/std/c/solaris.zig
@@ -1550,10 +1550,6 @@ pub const rlimit = extern struct {
     max: rlim_t,
 };
 
-pub const RUSAGE_SELF = 0;
-pub const RUSAGE_CHILDREN = -1;
-pub const RUSAGE_THREAD = 1;
-
 pub const rusage = extern struct {
     utime: timeval,
     stime: timeval,
@@ -1571,6 +1567,10 @@ pub const rusage = extern struct {
     nsignals: isize,
     nvcsw: isize,
     nivcsw: isize,
+
+    pub const SELF = 0;
+    pub const CHILDREN = -1;
+    pub const THREAD = 1;
 };
 
 pub const SHUT = struct {
lib/std/os/linux.zig
@@ -3798,10 +3798,6 @@ pub const MFD_HUGE_1GB = HUGETLB_FLAG_ENCODE_1GB;
 pub const MFD_HUGE_2GB = HUGETLB_FLAG_ENCODE_2GB;
 pub const MFD_HUGE_16GB = HUGETLB_FLAG_ENCODE_16GB;
 
-pub const RUSAGE_SELF = 0;
-pub const RUSAGE_CHILDREN = -1;
-pub const RUSAGE_THREAD = 1;
-
 pub const rusage = extern struct {
     utime: timeval,
     stime: timeval,
@@ -3820,6 +3816,10 @@ pub const rusage = extern struct {
     nvcsw: isize,
     nivcsw: isize,
     __reserved: [16]isize = [1]isize{0} ** 16,
+
+    pub const SELF = 0;
+    pub const CHILDREN = -1;
+    pub const THREAD = 1;
 };
 
 pub const cc_t = u8;
@@ -5199,4 +5199,6 @@ pub const PERF = struct {
         pub const QUERY_BPF = 3221758986;
         pub const MODIFY_ATTRIBUTES = 1074275339;
     };
+
+    pub const IOC_FLAG_GROUP = 1;
 };