authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-12-03 03:39:23+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-12-04 03:46:36+01:00
log44543800a59968a4c7a2cdcf10837bc17b52553d
tree29d04d5232ce85fb2f636f76d9fb64cf6cf6c153
parent2659fadb959b8ad0a5db374b3d7b3892ea0ee4f7
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.process.Child: enable rusage collection for dragonfly, netbsd, openbsd


1 files changed, 7 insertions(+), 1 deletions(-)

lib/std/process/Child.zig+7-1
...@@ -122,7 +122,7 @@ pub const ResourceUsageStatistics = struct {...@@ -122,7 +122,7 @@ pub const ResourceUsageStatistics = struct {
122 /// if available.122 /// if available.
123 pub inline fn getMaxRss(rus: ResourceUsageStatistics) ?usize {123 pub inline fn getMaxRss(rus: ResourceUsageStatistics) ?usize {
124 switch (native_os) {124 switch (native_os) {
125 .freebsd, .illumos, .linux, .serenity => {125 .dragonfly, .freebsd, .netbsd, .openbsd, .illumos, .linux, .serenity => {
126 if (rus.rusage) |ru| {126 if (rus.rusage) |ru| {
127 return @as(usize, @intCast(ru.maxrss)) * 1024;127 return @as(usize, @intCast(ru.maxrss)) * 1024;
128 } else {128 } else {
...@@ -149,7 +149,10 @@ pub const ResourceUsageStatistics = struct {...@@ -149,7 +149,10 @@ pub const ResourceUsageStatistics = struct {
149 }149 }
150150
151 const rusage_init = switch (native_os) {151 const rusage_init = switch (native_os) {
152 .dragonfly,
152 .freebsd,153 .freebsd,
154 .netbsd,
155 .openbsd,
153 .illumos,156 .illumos,
154 .linux,157 .linux,
155 .serenity,158 .serenity,
...@@ -497,7 +500,10 @@ fn waitUnwrappedPosix(self: *ChildProcess) void {...@@ -497,7 +500,10 @@ fn waitUnwrappedPosix(self: *ChildProcess) void {
497 const res: posix.WaitPidResult = res: {500 const res: posix.WaitPidResult = res: {
498 if (self.request_resource_usage_statistics) {501 if (self.request_resource_usage_statistics) {
499 switch (native_os) {502 switch (native_os) {
503 .dragonfly,
500 .freebsd,504 .freebsd,
505 .netbsd,
506 .openbsd,
501 .illumos,507 .illumos,
502 .linux,508 .linux,
503 .serenity,509 .serenity,