Created
June 29, 2021 19:52
-
-
Save Jarred-Sumner/8e37958611617212ced3524c858e098f to your computer and use it in GitHub Desktop.
show-ulimit.zig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
pub fn main() anyerror!void { | |
var out = std.io.getStdOut(); | |
var writer = out.writer(); | |
var str: [256]u8 = undefined; | |
var len = str.len; | |
var os_version = try std.os.sysctlbynameZ("kern.osproductversion"[0.. :0], &str, &len, null, 0); | |
try writer.print("macOS: {s}\nFile Descriptor Limit\n", .{str[0..len]}); | |
if (std.os.getrlimit(.NOFILE)) |limit| { | |
try writer.print("Soft (current): {d}\nHard (max): {d}", .{ limit.cur, limit.max }); | |
} else |err| { | |
std.log.crit("getrlimit failed: {s}", .{@errorName(err)}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment