Debian Codegraph @

lib_pypy/_pwdgrp_build.py

raw symbols SCIP
1 from cffi import FFI
2
3 ffi = FFI()
4
5 ffi.set_source("_pwdgrp_cffi", """
6 #include <sys/types.h>
7 #include <pwd.h>
8 #include <grp.h>
9 """)
10
11
12 ffi.cdef("""
13
14 typedef int... uid_t;
15 typedef int... gid_t;
16
17 struct passwd {
18 char *pw_name;
19 char *pw_passwd;
20 uid_t pw_uid;
21 gid_t pw_gid;
22 char *pw_gecos;
23 char *pw_dir;
24 char *pw_shell;
25 ...;
26 };
27
28 struct group {
29 char *gr_name; /* group name */
30 char *gr_passwd; /* group password */
31 gid_t gr_gid; /* group ID */
32 char **gr_mem; /* group members */
33 };
34
35 struct passwd *getpwuid(uid_t uid);
36 struct passwd *getpwnam(const char *name);
37
38 struct passwd *getpwent(void);
39 void setpwent(void);
40 void endpwent(void);
41
42 struct group *getgrgid(gid_t gid);
43 struct group *getgrnam(const char *name);
44
45 struct group *getgrent(void);
46 void setgrent(void);
47 void endgrent(void);
48
49 """)
50
51
52 if __name__ == "__main__":
53 ffi.compile()