summaryrefslogtreecommitdiff
path: root/lib/libc/compat/include
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2009-01-11 02:45:45 +0000
committerchristos <christos@NetBSD.org>2009-01-11 02:45:45 +0000
commit461a86f9bdbf4658bc4b37796e978427095f94a7 (patch)
treeeb340680ec500c8117744dbb3ea43074544ef572 /lib/libc/compat/include
parent6bbe77565e03756efac493ed9189b441a5eeffba (diff)
merge christos-time_t
Diffstat (limited to 'lib/libc/compat/include')
-rw-r--r--lib/libc/compat/include/aio.h51
-rw-r--r--lib/libc/compat/include/lwp.h46
-rw-r--r--lib/libc/compat/include/mqueue.h52
-rw-r--r--lib/libc/compat/include/pwd.h99
-rw-r--r--lib/libc/compat/include/signal.h10
-rw-r--r--lib/libc/compat/include/stdlib.h8
-rw-r--r--lib/libc/compat/include/time.h40
-rw-r--r--lib/libc/compat/include/utime.h51
-rw-r--r--lib/libc/compat/include/utmp.h68
-rw-r--r--lib/libc/compat/include/utmpx.h69
10 files changed, 485 insertions, 9 deletions
diff --git a/lib/libc/compat/include/aio.h b/lib/libc/compat/include/aio.h
new file mode 100644
index 00000000000..60d80ee204f
--- /dev/null
+++ b/lib/libc/compat/include/aio.h
@@ -0,0 +1,51 @@
+/* $NetBSD: aio.h,v 1.2 2009/01/11 02:46:25 christos Exp $ */
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _COMPAT_AIO_H_
+#define _COMPAT_AIO_H_
+
+__BEGIN_DECLS
+struct aiocb;
+struct timespec50;
+struct timespec;
+int aio_suspend(const struct aiocb * const [], int,
+ const struct timespec50 *);
+int __aio_suspend50(const struct aiocb * const [], int,
+ const struct timespec *);
+__END_DECLS
+
+#endif /* _COMPAT_AIO_H_ */
diff --git a/lib/libc/compat/include/lwp.h b/lib/libc/compat/include/lwp.h
new file mode 100644
index 00000000000..bdad6335b4a
--- /dev/null
+++ b/lib/libc/compat/include/lwp.h
@@ -0,0 +1,46 @@
+/* $NetBSD: lwp.h,v 1.2 2009/01/11 02:46:25 christos Exp $ */
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _COMPAT_LWP_H_
+#define _COMPAT_LWP_H_
+
+__BEGIN_DECLS
+int _lwp_park(const struct timespec50 *, lwpid_t, const void *, const void *);
+int ___lwp_park50(const struct timespec *, lwpid_t, const void *, const void *);
+__END_DECLS
+
+#endif /* !_COMPAT_LWP_H_ */
diff --git a/lib/libc/compat/include/mqueue.h b/lib/libc/compat/include/mqueue.h
new file mode 100644
index 00000000000..dd0cf61d8e1
--- /dev/null
+++ b/lib/libc/compat/include/mqueue.h
@@ -0,0 +1,52 @@
+/* $NetBSD: mqueue.h,v 1.2 2009/01/11 02:46:25 christos Exp $ */
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _COMPAT_MQUEUE_H_
+#define _COMPAT_MQUEUE_H_
+
+__BEGIN_DECLS
+ssize_t mq_timedreceive(mqd_t, char * __restrict, size_t,
+ unsigned * __restrict, const struct timespec50 * __restrict);
+int mq_timedsend(mqd_t, const char *, size_t, unsigned,
+ const struct timespec50 *);
+ssize_t __mq_timedreceive50(mqd_t, char * __restrict, size_t,
+ unsigned * __restrict, const struct timespec * __restrict);
+int __mq_timedsend50(mqd_t, const char *, size_t, unsigned,
+ const struct timespec *);
+__END_DECLS
+
+#endif /* _COMPAT_MQUEUE_H_ */
diff --git a/lib/libc/compat/include/pwd.h b/lib/libc/compat/include/pwd.h
new file mode 100644
index 00000000000..b9a805aaa32
--- /dev/null
+++ b/lib/libc/compat/include/pwd.h
@@ -0,0 +1,99 @@
+/* $NetBSD: pwd.h,v 1.2 2009/01/11 02:46:25 christos Exp $ */
+
+#ifndef _COMPAT_PWD_H_
+#define _COMPAT_PWD_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+struct passwd;
+struct passwd50 {
+ __aconst char *pw_name; /* user name */
+ __aconst char *pw_passwd; /* encrypted password */
+ uid_t pw_uid; /* user uid */
+ gid_t pw_gid; /* user gid */
+ int32_t pw_change; /* password change time */
+ __aconst char *pw_class; /* user login class */
+ __aconst char *pw_gecos; /* general information */
+ __aconst char *pw_dir; /* home directory */
+ __aconst char *pw_shell; /* default shell */
+ int32_t pw_expire; /* account expiration */
+};
+
+__BEGIN_DECLS
+static __inline void
+passwd_to_passwd50(const struct passwd *p, struct passwd50 *q)
+{
+ q->pw_name = p->pw_name;
+ q->pw_passwd = p->pw_passwd;
+ q->pw_uid = p->pw_uid;
+ q->pw_gid = p->pw_gid;
+ q->pw_change = (int32_t)p->pw_change;
+ q->pw_class = p->pw_class;
+ q->pw_gecos = p->pw_gecos;
+ q->pw_dir = p->pw_dir;
+ q->pw_shell = p->pw_shell;
+ q->pw_expire = (int32_t)p->pw_expire;
+}
+
+static __inline void
+passwd50_to_passwd(const struct passwd50 *p, struct passwd *q)
+{
+ q->pw_name = p->pw_name;
+ q->pw_passwd = p->pw_passwd;
+ q->pw_uid = p->pw_uid;
+ q->pw_gid = p->pw_gid;
+ q->pw_change = p->pw_change;
+ q->pw_class = p->pw_class;
+ q->pw_gecos = p->pw_gecos;
+ q->pw_dir = p->pw_dir;
+ q->pw_shell = p->pw_shell;
+ q->pw_expire = p->pw_expire;
+}
+
+struct passwd50 *getpwuid(uid_t);
+struct passwd50 *getpwnam(const char *);
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+ defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+int getpwnam_r(const char *, struct passwd50 *, char *, size_t,
+ struct passwd50 **);
+int getpwuid_r(uid_t, struct passwd50 *, char *, size_t,
+ struct passwd50 **);
+#endif
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+struct passwd50 *getpwent(void);
+#endif
+#if defined(_NETBSD_SOURCE)
+int pw_scan(char *, struct passwd50 *, int *);
+int getpwent_r(struct passwd50 *, char *, size_t, struct passwd50 **);
+#endif
+#if defined(_NETBSD_SOURCE)
+int pwcache_userdb(int (*)(int), void (*)(void),
+ struct passwd50 * (*)(const char *), struct passwd50 * (*)(uid_t));
+#endif
+
+struct passwd *__getpwuid50(uid_t);
+struct passwd *__getpwnam50(const char *);
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+ defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+int __getpwnam_r50(const char *, struct passwd *, char *, size_t,
+ struct passwd **);
+int __getpwuid_r50(uid_t, struct passwd *, char *, size_t,
+ struct passwd **);
+#endif
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+struct passwd *__getpwent50(void);
+#endif
+#if defined(_NETBSD_SOURCE)
+int __pw_scan50(char *, struct passwd *, int *);
+int __getpwent_r50(struct passwd *, char *, size_t, struct passwd **);
+#endif
+int setpassent(int);
+#if defined(_NETBSD_SOURCE)
+int __pwcache_userdb50(int (*)(int), void (*)(void),
+ struct passwd * (*)(const char *), struct passwd * (*)(uid_t));
+#endif
+__END_DECLS
+
+#endif /* !_COMPAT_PWD_H_ */
diff --git a/lib/libc/compat/include/signal.h b/lib/libc/compat/include/signal.h
index b7eebce6a7c..e78a2a906c0 100644
--- a/lib/libc/compat/include/signal.h
+++ b/lib/libc/compat/include/signal.h
@@ -1,4 +1,4 @@
-/* $NetBSD: signal.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
+/* $NetBSD: signal.h,v 1.2 2009/01/11 02:46:25 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -60,6 +60,14 @@ int __sigprocmask14(int, const sigset_t * __restrict,
int sigsuspend(const sigset13_t *);
int __sigsuspend14(const sigset_t *);
+int sigtimedwait(const sigset_t * __restrict,
+ siginfo_t * __restrict, const struct timespec50 * __restrict);
+int __sigtimedwait(const sigset_t * __restrict,
+ siginfo_t * __restrict, struct timespec50 * __restrict);
+int __sigtimedwait50(const sigset_t * __restrict,
+ siginfo_t * __restrict, const struct timespec * __restrict);
+int ____sigtimedwait50(const sigset_t * __restrict,
+ siginfo_t * __restrict, struct timespec * __restrict);
/*
* X/Open CAE Specification Issue 4 Version 2
*/
diff --git a/lib/libc/compat/include/stdlib.h b/lib/libc/compat/include/stdlib.h
index 7ddf31dd2b9..b403214602b 100644
--- a/lib/libc/compat/include/stdlib.h
+++ b/lib/libc/compat/include/stdlib.h
@@ -1,4 +1,4 @@
-/* $NetBSD: stdlib.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
+/* $NetBSD: stdlib.h,v 1.2 2009/01/11 02:46:25 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -35,8 +35,14 @@
#define _COMPAT_STDLIB_H_
__BEGIN_DECLS
+
void unsetenv(const char *);
int __unsetenv13(const char *);
+__aconst char *devname(int32_t, mode_t);
+__aconst char *__devname50(dev_t, mode_t);
+int32_t getdevmajor(const char *, mode_t);
+dev_t __getdevmajor50(const char *, mode_t);
+
__END_DECLS
#endif /* !_COMPAT_STDLIB_H_ */
diff --git a/lib/libc/compat/include/time.h b/lib/libc/compat/include/time.h
index b8854dcfa3c..c93ec7e3ac8 100644
--- a/lib/libc/compat/include/time.h
+++ b/lib/libc/compat/include/time.h
@@ -1,4 +1,4 @@
-/* $NetBSD: time.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
+/* $NetBSD: time.h,v 1.2 2009/01/11 02:46:25 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -39,6 +39,7 @@
#ifndef _COMPAT_TIME_H_
#define _COMPAT_TIME_H_
+#include <compat/sys/time.h>
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
defined(_NETBSD_SOURCE)
#define CLK_TCK 100
@@ -48,11 +49,46 @@ __BEGIN_DECLS
#if (_XOPEN_SOURCE - 0) >= 4 || defined(_NETBSD_SOURCE)
char *strptime(const char * __restrict, const char * __restrict,
struct tm * __restrict);
+#if 0
#if defined(_NETBSD_SOURCE)
char *timezone(int, int);
#endif /* _NETBSD_SOURCE */
+#endif
#endif /* !_ANSI_SOURCE */
-__END_DECLS
+char *ctime(const int32_t *);
+double difftime(int32_t, int32_t);
+struct tm *gmtime(const int32_t *);
+struct tm *localtime(const int32_t *);
+int32_t time(int32_t *);
+int32_t mktime(struct tm *);
+void tzset(void);
+void tzsetwall(void);
+void __tzset50(void);
+void __tzsetwall50(void);
+int clock_getres(clockid_t, struct timespec50 *);
+int clock_gettime(clockid_t, struct timespec50 *);
+int clock_settime(clockid_t, const struct timespec50 *);
+int __clock_getres50(clockid_t, struct timespec *);
+int __clock_gettime50(clockid_t, struct timespec *);
+int __clock_settime50(clockid_t, const struct timespec *);
+int nanosleep(const struct timespec50 *, struct timespec50 *);
+int __nanosleep50(const struct timespec *, struct timespec *);
+int timer_gettime(timer_t, struct itimerspec50 *);
+int timer_settime(timer_t, int, const struct itimerspec50 * __restrict,
+ struct itimerspec50 * __restrict);
+int __timer_gettime50(timer_t, struct itimerspec *);
+int __timer_settime50(timer_t, int, const struct itimerspec * __restrict,
+ struct itimerspec * __restrict);
+int __timer_getres50(timer_t, struct itimerspec *);
+char *ctime_r(const int32_t *, char *);
+struct tm *gmtime_r(const int32_t * __restrict, struct tm * __restrict);
+struct tm *localtime_r(const int32_t * __restrict, struct tm * __restrict);
+struct tm *offtime(const int32_t *, long);
+int32_t timelocal(struct tm *);
+int32_t timegm(struct tm *);
+int32_t timeoff(struct tm *, long);
+int32_t time2posix(int32_t);
+int32_t posix2time(int32_t);
#endif /* !_COMPAT_TIME_H_ */
diff --git a/lib/libc/compat/include/utime.h b/lib/libc/compat/include/utime.h
new file mode 100644
index 00000000000..33be9e926ce
--- /dev/null
+++ b/lib/libc/compat/include/utime.h
@@ -0,0 +1,51 @@
+/* $NetBSD: utime.h,v 1.2 2009/01/11 02:46:25 christos Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)utime.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _COMPAT_UTIME_H_
+#define _COMPAT_UTIME_H_
+
+#include <machine/ansi.h>
+
+struct utimbuf50 {
+ int32_t actime; /* Access time */
+ int32_t modtime; /* Modification time */
+};
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int utime(const char *, const struct utimbuf50 *);
+int __utime50(const char *, const struct utimbuf *);
+__END_DECLS
+
+#endif /* !_COMPAT_UTIME_H_ */
diff --git a/lib/libc/compat/include/utmp.h b/lib/libc/compat/include/utmp.h
new file mode 100644
index 00000000000..f6b7f13d407
--- /dev/null
+++ b/lib/libc/compat/include/utmp.h
@@ -0,0 +1,68 @@
+/* $NetBSD: utmp.h,v 1.2 2009/01/11 02:46:25 christos Exp $ */
+
+/*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)utmp.h 8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _COMPAT_UTMP_H_
+#define _COMPAT_UTMP_H_
+
+struct utmp50 {
+ char ut_line[UT_LINESIZE];
+ char ut_name[UT_NAMESIZE];
+ char ut_host[UT_HOSTSIZE];
+ int32_t ut_time;
+};
+
+__BEGIN_DECLS
+static __inline void
+utmp_to_utmp50(const struct utmp *ut, struct utmp50 *ut50)
+{
+ (void)memcpy(ut50, ut, sizeof(*ut50));
+ ut50->ut_time = (int32_t)ut->ut_time;
+}
+
+static __inline void
+utmp50_to_utmp(const struct utmp50 *ut50, struct utmp *ut)
+{
+ (void)memcpy(ut, ut50, sizeof(*ut50));
+ ut->ut_time = ut50->ut_time;
+}
+
+struct utmp50 *getutent(void);
+struct utmp *__getutent50(void);
+__END_DECLS
+
+#endif /* !_COMPAT_UTMP_H_ */
diff --git a/lib/libc/compat/include/utmpx.h b/lib/libc/compat/include/utmpx.h
index 83fd7f08368..ee201964c3d 100644
--- a/lib/libc/compat/include/utmpx.h
+++ b/lib/libc/compat/include/utmpx.h
@@ -1,4 +1,4 @@
-/* $NetBSD: utmpx.h,v 1.2 2008/04/28 20:22:59 martin Exp $ */
+/* $NetBSD: utmpx.h,v 1.3 2009/01/11 02:46:25 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,12 +31,71 @@
#ifndef _COMPAT_UTMPX_H_
#define _COMPAT_UTMPX_H_
+#include <compat/sys/time.h>
+
+struct utmpx50 {
+ char ut_name[_UTX_USERSIZE]; /* login name */
+ char ut_id[_UTX_IDSIZE]; /* inittab id */
+ char ut_line[_UTX_LINESIZE]; /* tty name */
+ char ut_host[_UTX_HOSTSIZE]; /* host name */
+ uint16_t ut_session; /* session id used for windowing */
+ uint16_t ut_type; /* type of this entry */
+ pid_t ut_pid; /* process id creating the entry */
+ struct {
+ uint16_t e_termination; /* process termination signal */
+ uint16_t e_exit; /* process exit status */
+ } ut_exit;
+ struct sockaddr_storage ut_ss; /* address where entry was made from */
+ struct timeval50 ut_tv; /* time entry was created */
+ uint32_t ut_pad[10]; /* reserved for future use */
+};
+
+struct lastlogx50 {
+ struct timeval50 ll_tv; /* time entry was created */
+ char ll_line[_UTX_LINESIZE]; /* tty name */
+ char ll_host[_UTX_HOSTSIZE]; /* host name */
+ struct sockaddr_storage ll_ss; /* address where entry was made from */
+};
+
__BEGIN_DECLS
-#if defined(_NETBSD_SOURCE)
+
+static __inline void
+utmpx50_to_utmpx(const struct utmpx50 *ut50, struct utmpx *ut)
+{
+ (void)memcpy(ut, ut50, sizeof(*ut));
+ timeval50_to_timeval(&ut50->ut_tv, &ut->ut_tv);
+}
+
+static __inline void
+utmpx_to_utmpx50(const struct utmpx *ut, struct utmpx50 *ut50)
+{
+ (void)memcpy(ut50, ut, sizeof(*ut50));
+ timeval_to_timeval50(&ut->ut_tv, &ut50->ut_tv);
+}
+
+struct utmpx50 *getutxent(void);
+struct utmpx *__getutxent50(void);
+struct utmpx50 *getutxid(const struct utmpx50 *);
+struct utmpx *__getutxid50(const struct utmpx *);
+struct utmpx50 *getutxline(const struct utmpx50 *);
+struct utmpx *__getutxline50(const struct utmpx *);
+struct utmpx50 *pututxline(const struct utmpx50 *);
+struct utmpx *__pututxline50(const struct utmpx *);
+int updwtmpx(const char *, const struct utmpx50 *);
+int __updwtmpx50(const char *, const struct utmpx *);
+int updlastlogx(const char *, uid_t, struct lastlogx50 *);
+int __updlastlogx50(const char *, uid_t, struct lastlogx *);
+struct utmp;
+void getutmp(const struct utmpx50 *, struct utmp *);
+void __getutmp50(const struct utmpx *, struct utmp *);
+void getutmpx(const struct utmp *, struct utmpx50 *);
+void __getutmpx50(const struct utmp *, struct utmpx *);
+
int lastlogxname(const char *);
-struct lastlogx *getlastlogx(uid_t, struct lastlogx *);
-struct lastlogx *__getlastlogx13(const char *, uid_t, struct lastlogx *);
-#endif /* _NETBSD_SOURCE */
+struct lastlogx50 *getlastlogx(uid_t, struct lastlogx50 *);
+struct lastlogx50 *__getlastlogx13(const char *, uid_t, struct lastlogx50 *);
+struct lastlogx *__getlastlogx50(const char *, uid_t, struct lastlogx *);
+
__END_DECLS
#endif /* !_COMPAT_UTMPX_H_ */