xref: /titanic_50/usr/src/cmd/lastcomm/lastcomm.h (revision 142c9f13e148d687426ed2d4e8bd93717eeaebbc)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_LASTCOMM_H
28 #define	_LASTCOMM_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/acct.h>
37 #include <sys/file.h>
38 #include <sys/fcntl.h>
39 #include <sys/mkdev.h>
40 #include <sys/param.h>
41 #include <sys/stat.h>
42 #include <sys/types.h>
43 
44 #include <fcntl.h>
45 #include <unistd.h>
46 #include <stdlib.h>
47 #include <strings.h>
48 #include <limits.h>
49 #include <stdio.h>
50 #include <utmpx.h>
51 #include <ctype.h>
52 #include <pwd.h>
53 #include <dirent.h>
54 #include <libintl.h>
55 #include <exacct.h>
56 
57 #define	AHZ	64
58 #define	fldsiz(str, fld)	(sizeof (((struct str *)0)->fld))
59 
60 #define	BUF_MAX		4096
61 #define	NACCT		(BUF_MAX / sizeof (struct acct))
62 #define	BUF_SIZ		(NACCT * sizeof (struct acct))
63 #define	PATHNAMLEN	32
64 #define	EXACCT_CREATOR	"SunOS"
65 
66 /*
67  * utmpx defines wider fields for user and line.  For compatibility of output,
68  * we are limiting these to the old maximums in utmp. Define UTMPX_NAMELEN
69  * to use the full lengths.
70  */
71 #ifndef UTMPX_NAMELEN
72 /* XXX - utmp - fix name length */
73 #define	NMAX		(_POSIX_LOGIN_NAME_MAX - 1)
74 #define	LMAX		12
75 #else   /* UTMPX_NAMELEN */
76 static struct utmpx dummy;
77 #define	NMAX		(sizeof (dummy.ut_user))
78 #define	LMAX		(sizeof (dummy.ut_line))
79 #endif /* UTMPX_NAMELEN */
80 
81 extern char *getdev(dev_t);
82 extern char *getname(uid_t);
83 extern char *flagbits(int);
84 
85 extern int lc_pacct(char *, int, char **, int);
86 extern int lc_exacct(char *, int, char **, int);
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif	/* _LASTCOMM_H */
93