summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/pwd.h
blob: 4554888d3aa09ba12d9e9e6df38ad5968ddc116a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <bits/FILE.h>
#include <sys/cdefs.h>
#include <sys/types.h>

__BEGIN_DECLS

struct passwd {
    char* pw_name;
    char* pw_passwd;
    uid_t pw_uid;
    gid_t pw_gid;
    char* pw_gecos;
    char* pw_dir;
    char* pw_shell;
};

struct passwd* getpwent(void);
void setpwent(void);
void endpwent(void);
struct passwd* getpwnam(char const* name);
struct passwd* getpwuid(uid_t);
int putpwent(const struct passwd* p, FILE* stream);

int getpwnam_r(char const* name, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result);
int getpwuid_r(uid_t, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result);

__END_DECLS