Skip to content

Commit c097209

Browse files
linusgVexu
authored andcommitted
std.c.linux: Add getpw{nam,uid}()
1 parent b642bb9 commit c097209

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/std/c/linux.zig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,19 @@ pub const EAI = enum(c_int) {
226226
_,
227227
};
228228

229+
pub const passwd = extern struct {
230+
pw_name: ?[*:0]const u8, // username
231+
pw_passwd: ?[*:0]const u8, // user password
232+
pw_uid: uid_t, // user ID
233+
pw_gid: gid_t, // group ID
234+
pw_gecos: ?[*:0]const u8, // user information
235+
pw_dir: ?[*:0]const u8, // home directory
236+
pw_shell: ?[*:0]const u8, // shell program
237+
};
238+
239+
pub extern "c" fn getpwnam(name: [*:0]const u8) ?*passwd;
240+
pub extern "c" fn getpwuid(uid: uid_t) ?*passwd;
241+
229242
pub extern "c" fn fallocate64(fd: fd_t, mode: c_int, offset: off_t, len: off_t) c_int;
230243
pub extern "c" fn fopen64(noalias filename: [*:0]const u8, noalias modes: [*:0]const u8) ?*FILE;
231244
pub extern "c" fn fstat64(fd: fd_t, buf: *Stat) c_int;

0 commit comments

Comments
 (0)