Home | History | Annotate | Line # | Download | only in include
      1  1.3  christos /*	$NetBSD: utmpx.h,v 1.3 2009/01/11 02:46:25 christos Exp $	 */
      2  1.1  christos 
      3  1.1  christos /*-
      4  1.1  christos  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5  1.1  christos  * All rights reserved.
      6  1.1  christos  *
      7  1.1  christos  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  christos  * by Christos Zoulas.
      9  1.1  christos  *
     10  1.1  christos  * Redistribution and use in source and binary forms, with or without
     11  1.1  christos  * modification, are permitted provided that the following conditions
     12  1.1  christos  * are met:
     13  1.1  christos  * 1. Redistributions of source code must retain the above copyright
     14  1.1  christos  *    notice, this list of conditions and the following disclaimer.
     15  1.1  christos  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  christos  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  christos  *    documentation and/or other materials provided with the distribution.
     18  1.1  christos  *
     19  1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.1  christos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.1  christos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.1  christos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.1  christos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.1  christos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.1  christos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.1  christos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.1  christos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.1  christos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.1  christos  * POSSIBILITY OF SUCH DAMAGE.
     30  1.1  christos  */
     31  1.1  christos #ifndef	_COMPAT_UTMPX_H_
     32  1.1  christos #define	_COMPAT_UTMPX_H_
     33  1.1  christos 
     34  1.3  christos #include <compat/sys/time.h>
     35  1.3  christos 
     36  1.3  christos struct utmpx50 {
     37  1.3  christos 	char ut_name[_UTX_USERSIZE];	/* login name */
     38  1.3  christos 	char ut_id[_UTX_IDSIZE];	/* inittab id */
     39  1.3  christos 	char ut_line[_UTX_LINESIZE];	/* tty name */
     40  1.3  christos 	char ut_host[_UTX_HOSTSIZE];	/* host name */
     41  1.3  christos 	uint16_t ut_session;		/* session id used for windowing */
     42  1.3  christos 	uint16_t ut_type;		/* type of this entry */
     43  1.3  christos 	pid_t ut_pid;			/* process id creating the entry */
     44  1.3  christos 	struct {
     45  1.3  christos 		uint16_t e_termination;	/* process termination signal */
     46  1.3  christos 		uint16_t e_exit;	/* process exit status */
     47  1.3  christos 	} ut_exit;
     48  1.3  christos 	struct sockaddr_storage ut_ss;	/* address where entry was made from */
     49  1.3  christos 	struct timeval50 ut_tv;		/* time entry was created */
     50  1.3  christos 	uint32_t ut_pad[10];		/* reserved for future use */
     51  1.3  christos };
     52  1.3  christos 
     53  1.3  christos struct lastlogx50 {
     54  1.3  christos 	struct timeval50 ll_tv;		/* time entry was created */
     55  1.3  christos 	char ll_line[_UTX_LINESIZE];	/* tty name */
     56  1.3  christos 	char ll_host[_UTX_HOSTSIZE];	/* host name */
     57  1.3  christos 	struct sockaddr_storage ll_ss;	/* address where entry was made from */
     58  1.3  christos };
     59  1.3  christos 
     60  1.1  christos __BEGIN_DECLS
     61  1.3  christos 
     62  1.3  christos static __inline void
     63  1.3  christos utmpx50_to_utmpx(const struct utmpx50 *ut50, struct utmpx *ut)
     64  1.3  christos {
     65  1.3  christos 	(void)memcpy(ut, ut50, sizeof(*ut));
     66  1.3  christos 	timeval50_to_timeval(&ut50->ut_tv, &ut->ut_tv);
     67  1.3  christos }
     68  1.3  christos 
     69  1.3  christos static __inline void
     70  1.3  christos utmpx_to_utmpx50(const struct utmpx *ut, struct utmpx50 *ut50)
     71  1.3  christos {
     72  1.3  christos 	(void)memcpy(ut50, ut, sizeof(*ut50));
     73  1.3  christos 	timeval_to_timeval50(&ut->ut_tv, &ut50->ut_tv);
     74  1.3  christos }
     75  1.3  christos 
     76  1.3  christos struct utmpx50 *getutxent(void);
     77  1.3  christos struct utmpx *__getutxent50(void);
     78  1.3  christos struct utmpx50 *getutxid(const struct utmpx50 *);
     79  1.3  christos struct utmpx *__getutxid50(const struct utmpx *);
     80  1.3  christos struct utmpx50 *getutxline(const struct utmpx50 *);
     81  1.3  christos struct utmpx *__getutxline50(const struct utmpx *);
     82  1.3  christos struct utmpx50 *pututxline(const struct utmpx50 *);
     83  1.3  christos struct utmpx *__pututxline50(const struct utmpx *);
     84  1.3  christos int updwtmpx(const char *, const struct utmpx50 *);
     85  1.3  christos int __updwtmpx50(const char *, const struct utmpx *);
     86  1.3  christos int updlastlogx(const char *, uid_t, struct lastlogx50 *);
     87  1.3  christos int __updlastlogx50(const char *, uid_t, struct lastlogx *);
     88  1.3  christos struct utmp;
     89  1.3  christos void getutmp(const struct utmpx50 *, struct utmp *);
     90  1.3  christos void __getutmp50(const struct utmpx *, struct utmp *);
     91  1.3  christos void getutmpx(const struct utmp *, struct utmpx50 *);
     92  1.3  christos void __getutmpx50(const struct utmp *, struct utmpx *);
     93  1.3  christos 
     94  1.1  christos int lastlogxname(const char *);
     95  1.3  christos struct lastlogx50 *getlastlogx(uid_t, struct lastlogx50 *);
     96  1.3  christos struct lastlogx50 *__getlastlogx13(const char *, uid_t, struct lastlogx50 *);
     97  1.3  christos struct lastlogx *__getlastlogx50(const char *, uid_t, struct lastlogx *);
     98  1.3  christos 
     99  1.1  christos __END_DECLS
    100  1.1  christos 
    101  1.1  christos #endif /* !_COMPAT_UTMPX_H_ */
    102