forked from opnsense/src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utmpx.h
88 lines (79 loc) · 2.98 KB
/
utmpx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*-
* Copyright (c) 2010 Ed Schouten <[email protected]>
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* $FreeBSD$
*/
#ifndef _UTMPX_H_
#define _UTMPX_H_
#include <sys/cdefs.h>
#include <sys/_timeval.h>
#include <sys/_types.h>
#ifndef _PID_T_DECLARED
typedef __pid_t pid_t;
#define _PID_T_DECLARED
#endif
struct utmpx {
short ut_type; /* Type of entry. */
struct timeval ut_tv; /* Time entry was made. */
char ut_id[8]; /* Record identifier. */
pid_t ut_pid; /* Process ID. */
char ut_user[32]; /* User login name. */
char ut_line[16]; /* Device name. */
#if __BSD_VISIBLE
char ut_host[128]; /* Remote hostname. */
#else
char __ut_host[128];
#endif
char __ut_spare[64];
};
#define EMPTY 0 /* No valid user accounting information. */
#define BOOT_TIME 1 /* Time of system boot. */
#define OLD_TIME 2 /* Time when system clock changed. */
#define NEW_TIME 3 /* Time after system clock changed. */
#define USER_PROCESS 4 /* A process. */
#define INIT_PROCESS 5 /* A process spawned by the init process. */
#define LOGIN_PROCESS 6 /* The session leader of a logged-in user. */
#define DEAD_PROCESS 7 /* A session leader who has exited. */
#if __BSD_VISIBLE
#define SHUTDOWN_TIME 8 /* Time of system shutdown. */
#endif
#if __BSD_VISIBLE
#define UTXDB_ACTIVE 0 /* Active login sessions. */
#define UTXDB_LASTLOGIN 1 /* Last login sessions. */
#define UTXDB_LOG 2 /* Log indexed by time. */
#endif
__BEGIN_DECLS
void endutxent(void);
struct utmpx *getutxent(void);
struct utmpx *getutxid(const struct utmpx *);
struct utmpx *getutxline(const struct utmpx *);
struct utmpx *pututxline(const struct utmpx *);
void setutxent(void);
#if __BSD_VISIBLE
struct utmpx *getutxuser(const char *);
int setutxdb(int, const char *);
#endif
__END_DECLS
#endif /* !_UTMPX_H_ */