grp.h 949 字节
Newer Older
R
Rich Felker 已提交
1 2 3 4 5 6 7
#ifndef	_GRP_H
#define	_GRP_H

#ifdef __cplusplus
extern "C" {
#endif

8 9
#include <features.h>

R
Rich Felker 已提交
10 11 12
#define __NEED_size_t
#define __NEED_gid_t

13 14 15 16
#ifdef _GNU_SOURCE
#define __NEED_FILE
#endif

R
Rich Felker 已提交
17 18
#include <bits/alltypes.h>

19
struct group {
R
Rich Felker 已提交
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
	char *gr_name;
	char *gr_passwd;
	gid_t gr_gid;
	char **gr_mem;
};

struct group  *getgrgid(gid_t);
struct group  *getgrnam(const char *);

int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);

struct group  *getgrent(void);
void           endgrent(void);
void           setgrent(void);

R
Rich Felker 已提交
36 37
#ifdef _GNU_SOURCE
struct group  *fgetgrent(FILE *stream);
38
int putgrent(const struct group *, FILE *);
R
Rich Felker 已提交
39 40
#endif

41
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
42 43 44 45 46
int getgrouplist(const char *, gid_t, gid_t *, int *);
int setgroups(size_t, const gid_t *);
int initgroups(const char *, gid_t);
#endif

R
Rich Felker 已提交
47 48 49 50 51
#ifdef __cplusplus
}
#endif

#endif