xref: /illumos-gate/usr/src/cmd/lastcomm/lastcomm.h (revision d48be21240dfd051b689384ce2b23479d757f2d8)
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 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/acct.h>
35 #include <sys/file.h>
36 #include <sys/fcntl.h>
37 #include <sys/mkdev.h>
38 #include <sys/param.h>
39 #include <sys/stat.h>
40 #include <sys/types.h>
41 
42 #include <fcntl.h>
43 #include <unistd.h>
44 #include <stdlib.h>
45 #include <strings.h>
46 #include <limits.h>
47 #include <stdio.h>
48 #include <utmpx.h>
49 #include <ctype.h>
50 #include <pwd.h>
51 #include <dirent.h>
52 #include <libintl.h>
53 #include <exacct.h>
54 
55 #define	AHZ	64
56 #define	fldsiz(str, fld)	(sizeof (((struct str *)0)->fld))
57 
58 #define	BUF_MAX		4096
59 #define	NACCT		(BUF_MAX / sizeof (struct acct))
60 #define	BUF_SIZ		(NACCT * sizeof (struct acct))
61 #define	PATHNAMLEN	32
62 #define	EXACCT_CREATOR	"SunOS"
63 
64 /*
65  * utmpx defines wider fields for user and line.  For compatibility of output,
66  * we are limiting these to the old maximums in utmp. Define UTMPX_NAMELEN
67  * to use the full lengths.
68  */
69 #ifndef UTMPX_NAMELEN
70 /* XXX - utmp - fix name length */
71 #define	NMAX		(_POSIX_LOGIN_NAME_MAX - 1)
72 #define	LMAX		12
73 #else   /* UTMPX_NAMELEN */
74 static struct utmpx dummy;
75 #define	NMAX		(sizeof (dummy.ut_user))
76 #define	LMAX		(sizeof (dummy.ut_line))
77 #endif /* UTMPX_NAMELEN */
78 
79 extern char *getdev(dev_t);
80 extern char *getname(uid_t);
81 extern char *flagbits(int);
82 
83 extern int lc_pacct(char *, int, char **, int);
84 extern int lc_exacct(char *, int, char **, int);
85 
86 #ifdef	__cplusplus
87 }
88 #endif
89 
90 #endif	/* _LASTCOMM_H */
91