version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
GETUTENT |
|
|
2 |
!!!GETUTENT |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
ERRORS |
|
|
8 |
EXAMPLE |
|
|
9 |
FILES |
|
|
10 |
CONFORMING TO |
|
|
11 |
SEE ALSO |
|
|
12 |
---- |
|
|
13 |
!!NAME |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
getutent, getutid, getutline, pututline, setutent, endutent, utmpname - access utmp file entries |
|
|
17 |
!!SYNOPSIS |
|
|
18 |
|
|
|
19 |
|
|
|
20 |
__#include __ |
|
|
21 |
|
|
|
22 |
|
|
|
23 |
__struct utmp *getutent(void); |
|
|
24 |
struct utmp *getutid(struct utmp *__''ut''__); |
|
|
25 |
struct utmp *getutline(struct utmp |
|
|
26 |
*__''ut''__);__ |
|
|
27 |
|
|
|
28 |
|
|
|
29 |
__void pututline(struct utmp |
|
|
30 |
*__''ut''__);__ |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
__void setutent(void); |
|
|
34 |
void endutent(void);__ |
|
|
35 |
|
|
|
36 |
|
|
|
37 |
__void utmpname(const char |
|
|
38 |
*__''file''__);__ |
|
|
39 |
!!DESCRIPTION |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
__utmpname__() sets the name of the utmp-format file for |
|
|
43 |
the other utmp functions to access. If __utmpname__() is |
|
|
44 |
not used to set the filename before the other functions are |
|
|
45 |
used, they assume ___PATH_UTMP__, as defined in |
|
|
46 |
''''. |
|
|
47 |
|
|
|
48 |
|
|
|
49 |
__setutent__() rewinds the file pointer to the beginning |
|
|
50 |
of the utmp file. It is generally a Good Idea to call it |
|
|
51 |
before any of the other functions. |
|
|
52 |
|
|
|
53 |
|
|
|
54 |
__endutent__() closes the utmp file. It should be called |
|
|
55 |
when the user code is done accessing the file with the other |
|
|
56 |
functions. |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
__getutent__() reads a line from the current file |
|
|
60 |
position in the utmp file. It returns a pointer to a |
|
|
61 |
structure containing the fields of the line. |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
__getutid__() searches forward from the current file |
|
|
65 |
position in the utmp file based upon ''ut''. If |
|
|
66 |
''ut''__-__ is __RUN_LVL__, |
|
|
67 |
__BOOT_TIME__, __NEW_TIME__, or __OLD_TIME__, |
|
|
68 |
__getutid__() will find the first entry whose |
|
|
69 |
__ut_type__ field matches ''ut''__-__. |
|
|
70 |
If ''ut''__-__ is one of |
|
|
71 |
__INIT_PROCESS__, __LOGIN_PROCESS__, |
|
|
72 |
__USER_PROCESS__, or __DEAD_PROCESS__, |
|
|
73 |
__getutid__() will find the first entry whose |
|
|
74 |
__ut_id__ field matches |
|
|
75 |
''ut''__-__. |
|
|
76 |
|
|
|
77 |
|
|
|
78 |
__getutline__() searches forward from the current file |
|
|
79 |
position in the utmp file. It scans entries whose ut_type is |
|
|
80 |
__USER_PROCESS__ or __LOGIN_PROCESS__ and returns the |
|
|
81 |
first one whose __ut_line__ field matches |
|
|
82 |
''ut''__-__. |
|
|
83 |
|
|
|
84 |
|
|
|
85 |
__pututline__() writes the utmp structure ''ut'' into |
|
|
86 |
the utmp file. It uses __getutid__() to search for the |
|
|
87 |
proper place in the file to insert the new entry. If it |
|
|
88 |
cannot find an appropriate slot for ''ut'', |
|
|
89 |
__pututline__() will append the new entry to the end of |
|
|
90 |
the file. |
|
|
91 |
!!RETURN VALUE |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
__getutent__(), __getutid__(), and __getutline__() |
|
|
95 |
return a pointer to a __static struct |
|
|
96 |
utmp__. |
|
|
97 |
!!ERRORS |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
On error, __(struct utmp*)0__ will be |
|
|
101 |
returned. |
|
|
102 |
!!EXAMPLE |
|
|
103 |
|
|
|
104 |
|
|
|
105 |
The following example adds and removes a utmp record, |
|
|
106 |
assuming it is run from within a pseudo terminal. For usage |
|
|
107 |
in a real application, you should check the return values of |
|
|
108 |
getpwuid() and ttyname(). |
|
|
109 |
|
|
|
110 |
|
|
|
111 |
#include |
|
|
112 |
!!FILES |
|
|
113 |
|
|
|
114 |
|
|
|
115 |
/var/run/utmp database of currently logged-in users |
|
|
116 |
/var/log/wtmp database of past user logins |
|
|
117 |
!!CONFORMING TO |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
XPG 2, SVID 2, Linux FSSTND 1.2 |
|
|
121 |
!!SEE ALSO |
|
|
122 |
|
|
|
123 |
|
|
|
124 |
utmp(5) |
|
|
125 |
---- |