sessreg.h revision 96834ec3
1/* 2 * Copyright 1990, 1998 The Open Group 3 * 4 * Permission to use, copy, modify, distribute, and sell this software and its 5 * documentation for any purpose is hereby granted without fee, provided that 6 * the above copyright notice appear in all copies and that both that 7 * copyright notice and this permission notice appear in supporting 8 * documentation. 9 * 10 * The above copyright notice and this permission notice shall be included 11 * in all copies or substantial portions of the Software. 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 15 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 * IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 17 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 18 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19 * OTHER DEALINGS IN THE SOFTWARE. 20 * 21 * Except as contained in this notice, the name of The Open Group shall 22 * not be used in advertising or otherwise to promote the sale, use or 23 * other dealings in this Software without prior written authorization 24 * from The Open Group. 25 * 26 */ 27 28/* 29 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. 30 * 31 * Permission is hereby granted, free of charge, to any person obtaining a 32 * copy of this software and associated documentation files (the "Software"), 33 * to deal in the Software without restriction, including without limitation 34 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 35 * and/or sell copies of the Software, and to permit persons to whom the 36 * Software is furnished to do so, subject to the following conditions: 37 * 38 * The above copyright notice and this permission notice (including the next 39 * paragraph) shall be included in all copies or substantial portions of the 40 * Software. 41 * 42 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 43 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 44 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 45 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 46 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 47 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 48 * DEALINGS IN THE SOFTWARE. 49 */ 50 51#include "config.h" 52 53#include <sys/types.h> 54#include <time.h> 55 56/* Prefer POSIX standard utmpx interfaces if present, otherwise use utmp */ 57#ifdef HAVE_UTMP_H 58# include <utmp.h> 59# ifndef HAVE_UTMPX_H 60# define USE_UTMP 61# endif 62#endif 63 64#ifdef HAVE_UTMPX_H 65# include <utmpx.h> 66# define USE_UTMPX 67#endif 68 69#ifdef HAVE_SYS_PARAM_H 70# include <sys/param.h> 71#endif 72 73#if defined(HAVE_STRUCT_LASTLOG) && defined(HAVE_PWD_H) 74# ifdef HAVE_LASTLOG_H 75# include <lastlog.h> 76# endif 77# include <pwd.h> 78# define USE_LASTLOG 79#endif 80 81#ifndef WTMP_FILE 82# ifdef _PATH_WTMP 83# define WTMP_FILE _PATH_WTMP 84# else 85# define WTMP_FILE "/usr/adm/wtmp" 86# endif 87#endif 88#ifndef UTMP_FILE 89# ifdef _PATH_UTMP 90# define UTMP_FILE _PATH_UTMP 91# else 92# define UTMP_FILE "/etc/utmp" 93# endif 94#endif 95#ifndef LLOG_FILE 96# ifdef _PATH_LASTLOG 97# define LLOG_FILE _PATH_LASTLOG 98# else 99# define LLOG_FILE "/usr/adm/lastlog" 100# endif 101#endif 102#ifndef TTYS_FILE 103# define TTYS_FILE "/etc/ttys" 104#endif 105 106#ifndef _PATH_WTMPX 107# define _PATH_WTMPX "/var/log/wtmp" 108#endif 109#ifndef _PATH_UTMPX 110# define _PATH_UTMPX "/var/log/utmp" 111#endif 112 113#ifndef WTMPX_FILE 114# define WTMPX_FILE _PATH_WTMPX 115#endif 116#ifndef UTMPX_FILE 117# define UTMPX_FILE _PATH_UTMPX 118#endif 119