authorgravatar for dalal.chinmay.0101@gmail.comChinmay Dalal <dalal.chinmay.0101@gmail.com> 2025-07-27 12:34:40+05:30
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-30 21:28:42-07:00
loge941ce3e689991081d0ae726bfa1ccccf4fc196f
tree13c3799f5c9c9d4ff9918c46a4faba88485b8e78
parent032bbd68a7a17b4f8167f9644430c375f43da60c

add grp.h functions to c.zig


1 files changed, 19 insertions(+), 2 deletions(-)

lib/std/c.zig+19-2
...@@ -207,6 +207,16 @@ pub const passwd = switch (native_os) {...@@ -207,6 +207,16 @@ pub const passwd = switch (native_os) {
207 else => void,207 else => void,
208};208};
209209
210pub const group = switch (native_os) {
211 .linux, .freebsd, .openbsd, .dragonfly, .netbsd, .macos => extern struct {
212 name: ?[*:0]const u8,
213 passwd: ?[*:0]const u8,
214 gid: gid_t,
215 mem: [*:null]?[*:0]const u8,
216 },
217 else => void,
218};
219
210pub const blkcnt_t = switch (native_os) {220pub const blkcnt_t = switch (native_os) {
211 .linux => linux.blkcnt_t,221 .linux => linux.blkcnt_t,
212 .emscripten => emscripten.blkcnt_t,222 .emscripten => emscripten.blkcnt_t,
...@@ -3291,8 +3301,8 @@ pub const T = switch (native_os) {...@@ -3291,8 +3301,8 @@ pub const T = switch (native_os) {
3291 .macos, .ios, .tvos, .watchos, .visionos => struct {3301 .macos, .ios, .tvos, .watchos, .visionos => struct {
3292 pub const IOCGWINSZ = ior(0x40000000, 't', 104, @sizeOf(winsize));3302 pub const IOCGWINSZ = ior(0x40000000, 't', 104, @sizeOf(winsize));
32933303
3294 fn ior(inout: u32, group: usize, num: usize, len: usize) usize {3304 fn ior(inout: u32, group_arg: usize, num: usize, len: usize) usize {
3295 return (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num));3305 return (inout | ((len & IOCPARM_MASK) << 16) | ((group_arg) << 8) | (num));
3296 }3306 }
3297 },3307 },
3298 .freebsd => struct {3308 .freebsd => struct {
...@@ -10264,6 +10274,13 @@ pub const fstatat = switch (native_os) {...@@ -10264,6 +10274,13 @@ pub const fstatat = switch (native_os) {
1026410274
10265pub extern "c" fn getpwnam(name: [*:0]const u8) ?*passwd;10275pub extern "c" fn getpwnam(name: [*:0]const u8) ?*passwd;
10266pub extern "c" fn getpwuid(uid: uid_t) ?*passwd;10276pub extern "c" fn getpwuid(uid: uid_t) ?*passwd;
10277pub extern "c" fn getgrent() ?*group;
10278pub extern "c" fn setgrent() void;
10279pub extern "c" fn endgrent() void;
10280pub extern "c" fn getgrnam(name: [*:0]const u8) ?*passwd;
10281pub extern "c" fn getgrnam_r(name: [*:0]const u8, grp: *group, buf: [*]u8, buflen: usize, result: *?*group) c_int;
10282pub extern "c" fn getgrgid(gid: gid_t) ?*group;
10283pub extern "c" fn getgrgid_r(gid: gid_t, grp: *group, buf: [*]u8, buflen: usize, result: *?*group) c_int;
10267pub extern "c" fn getrlimit64(resource: rlimit_resource, rlim: *rlimit) c_int;10284pub extern "c" fn getrlimit64(resource: rlimit_resource, rlim: *rlimit) c_int;
10268pub extern "c" fn lseek64(fd: fd_t, offset: i64, whence: c_int) i64;10285pub extern "c" fn lseek64(fd: fd_t, offset: i64, whence: c_int) i64;
10269pub extern "c" fn mmap64(addr: ?*align(page_size) anyopaque, len: usize, prot: c_uint, flags: c_uint, fd: fd_t, offset: i64) *anyopaque;10286pub extern "c" fn mmap64(addr: ?*align(page_size) anyopaque, len: usize, prot: c_uint, flags: c_uint, fd: fd_t, offset: i64) *anyopaque;