std: fix linux uid_t, use uid_t/gid_t in std.os

- correct uid_t from i32 to u32 on linux
- define uid_t and gid_t for OSes missing definitions
- use uid_t/gid_t instead of plain u32s throughout std.os
This commit is contained in:
Isaac Freund
2020-09-03 15:08:37 +02:00
parent 26140678a5
commit e8a2aecd2f
9 changed files with 65 additions and 49 deletions

View File

@@ -578,8 +578,8 @@ fn testWindowsCmdLine(input_cmd_line: [*]const u8, expected_args: []const []cons
}
pub const UserInfo = struct {
uid: u32,
gid: u32,
uid: os.uid_t,
gid: os.gid_t,
};
/// POSIX function which gets a uid from username.
@@ -607,8 +607,8 @@ pub fn posixGetUserInfo(name: []const u8) !UserInfo {
var buf: [std.mem.page_size]u8 = undefined;
var name_index: usize = 0;
var state = State.Start;
var uid: u32 = 0;
var gid: u32 = 0;
var uid: os.uid_t = 0;
var gid: os.gid_t = 0;
while (true) {
const amt_read = try reader.read(buf[0..]);