aboutsummaryrefslogtreecommitdiff
path: root/lib/std/process.zig
diff options
context:
space:
mode:
authorStephen Gregoratto <dev@sgregoratto.me>2023-10-01 23:09:14 +1100
committerRyan Zezeski <ryan@zinascii.com>2023-10-02 15:31:49 -0600
commit285970982a662ae1882858ab8076b8c20609b9bb (patch)
tree5141c17d8bbb44b401bbda3cbbfdf7dc73106a8a /lib/std/process.zig
parent51fa7ef1c43c2b159cfba15ee06cd6f3fab3e556 (diff)
downloadzig-285970982a662ae1882858ab8076b8c20609b9bb.tar.gz
zig-285970982a662ae1882858ab8076b8c20609b9bb.zip
Add illumos OS tag
- Adds `illumos` to the `Target.Os.Tag` enum. A new function, `isSolarish` has been added that returns true if the tag is either Solaris or Illumos. This matches the naming convention found in Rust's `libc` crate[1]. - Add the tag wherever `.solaris` is being checked against. - Check for the C pre-processor macro `__illumos__` in CMake to set the proper target tuple. Illumos distros patch their compilers to have this in the "built-in" set (verified with `echo | cc -dM -E -`). Alternatively you could check the output of `uname -o`. Right now, both Solaris and Illumos import from `c/solaris.zig`. In the future it may be worth putting the shared ABI bits in a base file, and mixing that in with specific `c/solaris.zig`/`c/illumos.zig` files. [1]: https://github.com/rust-lang/libc/tree/6e02a329a2a27f6887ea86952f389ca11e06448c/src/unix/solarish
Diffstat (limited to 'lib/std/process.zig')
-rw-r--r--lib/std/process.zig13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/std/process.zig b/lib/std/process.zig
index fe5a44d3ad..a7f9d8d9d8 100644
--- a/lib/std/process.zig
+++ b/lib/std/process.zig
@@ -959,7 +959,18 @@ pub const UserInfo = struct {
/// POSIX function which gets a uid from username.
pub fn getUserInfo(name: []const u8) !UserInfo {
return switch (builtin.os.tag) {
- .linux, .macos, .watchos, .tvos, .ios, .freebsd, .netbsd, .openbsd, .haiku, .solaris => posixGetUserInfo(name),
+ .linux,
+ .macos,
+ .watchos,
+ .tvos,
+ .ios,
+ .freebsd,
+ .netbsd,
+ .openbsd,
+ .haiku,
+ .solaris,
+ .illumos,
+ => posixGetUserInfo(name),
else => @compileError("Unsupported OS"),
};
}