libutil: add O_NOCTTY back to old pty open code
[minix.git] / lib / libc / compat / include / pwd.h
blobb9a805aaa328b8c3637f2d3a3db6e91671d2fbd9
1 /* $NetBSD: pwd.h,v 1.2 2009/01/11 02:46:25 christos Exp $ */
3 #ifndef _COMPAT_PWD_H_
4 #define _COMPAT_PWD_H_
6 #include <sys/cdefs.h>
7 #include <sys/featuretest.h>
8 #include <sys/types.h>
10 struct passwd;
11 struct passwd50 {
12 __aconst char *pw_name; /* user name */
13 __aconst char *pw_passwd; /* encrypted password */
14 uid_t pw_uid; /* user uid */
15 gid_t pw_gid; /* user gid */
16 int32_t pw_change; /* password change time */
17 __aconst char *pw_class; /* user login class */
18 __aconst char *pw_gecos; /* general information */
19 __aconst char *pw_dir; /* home directory */
20 __aconst char *pw_shell; /* default shell */
21 int32_t pw_expire; /* account expiration */
24 __BEGIN_DECLS
25 static __inline void
26 passwd_to_passwd50(const struct passwd *p, struct passwd50 *q)
28 q->pw_name = p->pw_name;
29 q->pw_passwd = p->pw_passwd;
30 q->pw_uid = p->pw_uid;
31 q->pw_gid = p->pw_gid;
32 q->pw_change = (int32_t)p->pw_change;
33 q->pw_class = p->pw_class;
34 q->pw_gecos = p->pw_gecos;
35 q->pw_dir = p->pw_dir;
36 q->pw_shell = p->pw_shell;
37 q->pw_expire = (int32_t)p->pw_expire;
40 static __inline void
41 passwd50_to_passwd(const struct passwd50 *p, struct passwd *q)
43 q->pw_name = p->pw_name;
44 q->pw_passwd = p->pw_passwd;
45 q->pw_uid = p->pw_uid;
46 q->pw_gid = p->pw_gid;
47 q->pw_change = p->pw_change;
48 q->pw_class = p->pw_class;
49 q->pw_gecos = p->pw_gecos;
50 q->pw_dir = p->pw_dir;
51 q->pw_shell = p->pw_shell;
52 q->pw_expire = p->pw_expire;
55 struct passwd50 *getpwuid(uid_t);
56 struct passwd50 *getpwnam(const char *);
57 #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
58 defined(_REENTRANT) || defined(_NETBSD_SOURCE)
59 int getpwnam_r(const char *, struct passwd50 *, char *, size_t,
60 struct passwd50 **);
61 int getpwuid_r(uid_t, struct passwd50 *, char *, size_t,
62 struct passwd50 **);
63 #endif
64 #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
65 struct passwd50 *getpwent(void);
66 #endif
67 #if defined(_NETBSD_SOURCE)
68 int pw_scan(char *, struct passwd50 *, int *);
69 int getpwent_r(struct passwd50 *, char *, size_t, struct passwd50 **);
70 #endif
71 #if defined(_NETBSD_SOURCE)
72 int pwcache_userdb(int (*)(int), void (*)(void),
73 struct passwd50 * (*)(const char *), struct passwd50 * (*)(uid_t));
74 #endif
76 struct passwd *__getpwuid50(uid_t);
77 struct passwd *__getpwnam50(const char *);
78 #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
79 defined(_REENTRANT) || defined(_NETBSD_SOURCE)
80 int __getpwnam_r50(const char *, struct passwd *, char *, size_t,
81 struct passwd **);
82 int __getpwuid_r50(uid_t, struct passwd *, char *, size_t,
83 struct passwd **);
84 #endif
85 #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
86 struct passwd *__getpwent50(void);
87 #endif
88 #if defined(_NETBSD_SOURCE)
89 int __pw_scan50(char *, struct passwd *, int *);
90 int __getpwent_r50(struct passwd *, char *, size_t, struct passwd **);
91 #endif
92 int setpassent(int);
93 #if defined(_NETBSD_SOURCE)
94 int __pwcache_userdb50(int (*)(int), void (*)(void),
95 struct passwd * (*)(const char *), struct passwd * (*)(uid_t));
96 #endif
97 __END_DECLS
99 #endif /* !_COMPAT_PWD_H_ */