1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2015-01-04 23:49+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
20 #: build/C/man3/getutent.3:31
26 #: build/C/man3/getutent.3:31 build/C/man3/updwtmp.3:29 build/C/man5/utmp.5:30
32 #: build/C/man3/getutent.3:31 build/C/man3/getutmp.3:26 build/C/man3/login.3:25 build/C/man3/updwtmp.3:29 build/C/man5/utmp.5:30
34 msgid "Linux Programmer's Manual"
38 #: build/C/man3/getutent.3:32 build/C/man3/getutmp.3:27 build/C/man3/login.3:26 build/C/man3/updwtmp.3:30 build/C/man5/utmp.5:31
44 #: build/C/man3/getutent.3:35
46 "getutent, getutid, getutline, pututline, setutent, endutent, utmpname - "
47 "access utmp file entries"
51 #: build/C/man3/getutent.3:35 build/C/man3/getutmp.3:29 build/C/man3/login.3:28 build/C/man3/updwtmp.3:32 build/C/man5/utmp.5:33
57 #: build/C/man3/getutent.3:37 build/C/man3/login.3:30 build/C/man5/utmp.5:35
58 msgid "B<#include E<lt>utmp.hE<gt>>"
62 #: build/C/man3/getutent.3:39
63 msgid "B<struct utmp *getutent(void);>"
67 #: build/C/man3/getutent.3:41
68 msgid "B<struct utmp *getutid(const struct utmp *>I<ut>B<);>"
72 #: build/C/man3/getutent.3:43
73 msgid "B<struct utmp *getutline(const struct utmp *>I<ut>B<);>"
77 #: build/C/man3/getutent.3:45
78 msgid "B<struct utmp *pututline(const struct utmp *>I<ut>B<);>"
82 #: build/C/man3/getutent.3:47
83 msgid "B<void setutent(void);>"
87 #: build/C/man3/getutent.3:49
88 msgid "B<void endutent(void);>"
92 #: build/C/man3/getutent.3:51
93 msgid "B<int utmpname(const char *>I<file>B<);>"
97 #: build/C/man3/getutent.3:51 build/C/man3/getutmp.3:37 build/C/man3/login.3:36 build/C/man3/updwtmp.3:45 build/C/man5/utmp.5:35
103 #: build/C/man3/getutent.3:54
105 "New applications should use the POSIX.1-specified \"utmpx\" versions of "
106 "these functions; see CONFORMING TO."
110 #: build/C/man3/getutent.3:63
112 "B<utmpname>() sets the name of the utmp-format file for the other utmp "
113 "functions to access. If B<utmpname>() is not used to set the filename "
114 "before the other functions are used, they assume B<_PATH_UTMP>, as defined "
115 "in I<E<lt>paths.hE<gt>>."
119 #: build/C/man3/getutent.3:68
121 "B<setutent>() rewinds the file pointer to the beginning of the utmp file. "
122 "It is generally a good idea to call it before any of the other functions."
126 #: build/C/man3/getutent.3:73
128 "B<endutent>() closes the utmp file. It should be called when the user code "
129 "is done accessing the file with the other functions."
133 #: build/C/man3/getutent.3:80
135 "B<getutent>() reads a line from the current file position in the utmp "
136 "file. It returns a pointer to a structure containing the fields of the "
137 "line. The definition of this structure is shown in B<utmp>(5)."
141 #: build/C/man3/getutent.3:96
143 "B<getutid>() searches forward from the current file position in the utmp "
144 "file based upon I<ut>. If I<ut-E<gt>ut_type> is one of B<RUN_LVL>, "
145 "B<BOOT_TIME>, B<NEW_TIME>, or B<OLD_TIME>, B<getutid>() will find the first "
146 "entry whose I<ut_type> field matches I<ut-E<gt>ut_type>. If "
147 "I<ut-E<gt>ut_type> is one of B<INIT_PROCESS>, B<LOGIN_PROCESS>, "
148 "B<USER_PROCESS>, or B<DEAD_PROCESS>, B<getutid>() will find the first entry "
149 "whose I<ut_id> field matches I<ut-E<gt>ut_id>."
153 #: build/C/man3/getutent.3:106
155 "B<getutline>() searches forward from the current file position in the utmp "
156 "file. It scans entries whose I<ut_type> is B<USER_PROCESS> or "
157 "B<LOGIN_PROCESS> and returns the first one whose I<ut_line> field matches "
158 "I<ut-E<gt>ut_line>."
162 #: build/C/man3/getutent.3:118
164 "B<pututline>() writes the I<utmp> structure I<ut> into the utmp file. It "
165 "uses B<getutid>() to search for the proper place in the file to insert the "
166 "new entry. If it cannot find an appropriate slot for I<ut>, B<pututline>() "
167 "will append the new entry to the end of the file."
171 #: build/C/man3/getutent.3:118 build/C/man3/getutmp.3:51 build/C/man3/login.3:94
177 #: build/C/man3/getutent.3:127
179 "B<getutent>(), B<getutid>(), and B<getutline>() return a pointer to a "
180 "I<struct utmp> on success, and NULL on failure (which includes the \"record "
181 "not found\" case). This I<struct utmp> is allocated in static storage, and "
182 "may be overwritten by subsequent calls."
186 #: build/C/man3/getutent.3:133
187 msgid "On success B<pututline>() returns I<ut>; on failure, it returns NULL."
191 #: build/C/man3/getutent.3:136
193 "B<utmpname>() returns 0 if the new name was successfully stored, or -1 on "
198 #: build/C/man3/getutent.3:140
200 "In the event of an error, these functions I<errno> set to indicate the "
205 #: build/C/man3/getutent.3:140
211 #: build/C/man3/getutent.3:141
217 #: build/C/man3/getutent.3:144
218 msgid "Out of memory."
222 #: build/C/man3/getutent.3:144
228 #: build/C/man3/getutent.3:147
229 msgid "Record not found."
233 #: build/C/man3/getutent.3:154
235 "B<setutent>(), B<pututline>(), and the B<getut*>() functions can also fail "
236 "for the reasons described in B<open>(2)."
240 #: build/C/man3/getutent.3:154 build/C/man3/login.3:99 build/C/man3/updwtmp.3:58 build/C/man5/utmp.5:224
246 #: build/C/man3/getutent.3:156
247 msgid "/var/run/utmp\tdatabase of currently logged-in users"
251 #: build/C/man3/getutent.3:158
252 msgid "/var/log/wtmp\tdatabase of past user logins"
256 #: build/C/man3/getutent.3:158 build/C/man3/getutmp.3:62 build/C/man3/login.3:112 build/C/man3/updwtmp.3:62 build/C/man5/utmp.5:228
258 msgid "CONFORMING TO"
262 #: build/C/man3/getutent.3:160
267 #: build/C/man3/getutent.3:169
269 "In XPG2 and SVID 2 the function B<pututline>() is documented to return "
270 "void, and that is what it does on many systems (AIX, HP-UX). HP-UX "
271 "introduces a new function B<_pututline>() with the prototype given above "
272 "for B<pututline>()."
276 #: build/C/man3/getutent.3:173
278 "All these functions are obsolete now on non-Linux systems. POSIX.1-2001, "
279 "following SUSv1, does not have any of these functions, but instead uses"
283 #: build/C/man3/getutent.3:175
284 msgid "B<#include E<lt>utmpx.hE<gt>>"
288 #: build/C/man3/getutent.3:177
289 msgid "B<struct utmpx *getutxent(void);>"
293 #: build/C/man3/getutent.3:179
294 msgid "B<struct utmpx *getutxid(const struct utmpx *);>"
298 #: build/C/man3/getutent.3:181
299 msgid "B<struct utmpx *getutxline(const struct utmpx *);>"
303 #: build/C/man3/getutent.3:183
304 msgid "B<struct utmpx *pututxline(const struct utmpx *);>"
308 #: build/C/man3/getutent.3:185
309 msgid "B<void setutxent(void);>"
313 #: build/C/man3/getutent.3:187
314 msgid "B<void endutxent(void);>"
318 #: build/C/man3/getutent.3:196
320 "These functions are provided by glibc, and perform the same task as their "
321 "equivalents without the \"x\", but use I<struct utmpx>, defined on Linux to "
322 "be the same as I<struct utmp>. For completeness, glibc also provides "
323 "B<utmpxname>(), although this function is not specified by POSIX.1."
327 #: build/C/man3/getutent.3:204
329 "On some other systems, the I<utmpx> structure is a superset of the I<utmp> "
330 "structure, with additional fields, and larger versions of the existing "
331 "fields, and parallel files are maintained, often I</var/*/utmpx> and "
336 #: build/C/man3/getutent.3:212
338 "Linux glibc on the other hand does not use a parallel I<utmpx> file since "
339 "its I<utmp> structure is already large enough. The \"x\" functions listed "
340 "above are just aliases for their counterparts without the \"x\" (e.g., "
341 "B<getutxent>() is an alias for B<getutent>())."
345 #: build/C/man3/getutent.3:212 build/C/man3/getutmp.3:65 build/C/man3/login.3:115 build/C/man3/updwtmp.3:65 build/C/man5/utmp.5:280
351 #: build/C/man3/getutent.3:213
357 #: build/C/man3/getutent.3:216
358 msgid "The above functions are not thread-safe. Glibc adds reentrant versions"
362 #: build/C/man3/getutent.3:221
365 "B<#define _GNU_SOURCE> /* or _SVID_SOURCE or _BSD_SOURCE;\n"
366 "\\& see B<feature_test_macros>(7) */\n"
367 "B<#include E<lt>utmp.hE<gt>>\n"
371 #: build/C/man3/getutent.3:223
373 msgid "B<int getutent_r(struct utmp *>I<ubuf>B<, struct utmp **>I<ubufp>B<);>\n"
377 #: build/C/man3/getutent.3:226
380 "B<int getutid_r(struct utmp *>I<ut>B<,>\n"
381 "B< struct utmp *>I<ubuf>B<, struct utmp **>I<ubufp>B<);>\n"
385 #: build/C/man3/getutent.3:229
388 "B<int getutline_r(struct utmp *>I<ut>B<,>\n"
389 "B< struct utmp *>I<ubuf>B<, struct utmp **>I<ubufp>B<);>\n"
393 #: build/C/man3/getutent.3:241
395 "These functions are GNU extensions, analogs of the functions of the same "
396 "name without the _r suffix. The I<ubuf> argument gives these functions a "
397 "place to store their result. On success they return 0, and a pointer to the "
398 "result is written in I<*ubufp>. On error, these functions return -1. There "
399 "are no utmpx equivalents of the above functions. (POSIX.1 does not specify "
404 #: build/C/man3/getutent.3:241
410 #: build/C/man3/getutent.3:249
412 "The following example adds and removes a utmp record, assuming it is run "
413 "from within a pseudo terminal. For usage in a real application, you should "
414 "check the return values of B<getpwuid>(3) and B<ttyname>(3)."
418 #: build/C/man3/getutent.3:256
421 "#include E<lt>string.hE<gt>\n"
422 "#include E<lt>stdlib.hE<gt>\n"
423 "#include E<lt>pwd.hE<gt>\n"
424 "#include E<lt>unistd.hE<gt>\n"
425 "#include E<lt>utmp.hE<gt>\n"
429 #: build/C/man3/getutent.3:261
433 "main(int argc, char *argv[])\n"
435 " struct utmp entry;\n"
439 #: build/C/man3/getutent.3:263
441 msgid " system(\"echo before adding entry:;who\");\n"
445 #: build/C/man3/getutent.3:275
448 " entry.ut_type = USER_PROCESS;\n"
449 " entry.ut_pid = getpid();\n"
450 " strcpy(entry.ut_line, ttyname(STDIN_FILENO) + strlen(\"/dev/\"));\n"
451 " /* only correct for ptys named /dev/tty[pqr][0-9a-z] */\n"
452 " strcpy(entry.ut_id, ttyname(STDIN_FILENO) + strlen(\"/dev/tty\"));\n"
453 " time(&entry.ut_time);\n"
454 " strcpy(entry.ut_user, getpwuid(getuid())-E<gt>pw_name);\n"
455 " memset(entry.ut_host, 0, UT_HOSTSIZE);\n"
456 " entry.ut_addr = 0;\n"
458 " pututline(&entry);\n"
462 #: build/C/man3/getutent.3:277
464 msgid " system(\"echo after adding entry:;who\");\n"
468 #: build/C/man3/getutent.3:284
471 " entry.ut_type = DEAD_PROCESS;\n"
472 " memset(entry.ut_line, 0, UT_LINESIZE);\n"
473 " entry.ut_time = 0;\n"
474 " memset(entry.ut_user, 0, UT_NAMESIZE);\n"
476 " pututline(&entry);\n"
480 #: build/C/man3/getutent.3:286
482 msgid " system(\"echo after removing entry:;who\");\n"
486 #: build/C/man3/getutent.3:290
490 " exit(EXIT_SUCCESS);\n"
495 #. Note that the \fIutmp\fP struct from libc5 has changed in libc6.
497 #. binaries using the old libc5 struct will corrupt
498 #. .IR /var/run/utmp " and/or " /var/log/wtmp .
500 #. This man page is based on the libc5 one, things may work differently now.
502 #: build/C/man3/getutent.3:291 build/C/man3/getutmp.3:76 build/C/man3/login.3:130 build/C/man3/updwtmp.3:81 build/C/man5/utmp.5:338
508 #: build/C/man3/getutent.3:294
509 msgid "B<getutmp>(3), B<utmp>(5)"
513 #: build/C/man3/getutent.3:294 build/C/man3/getutmp.3:80 build/C/man3/login.3:133 build/C/man3/updwtmp.3:84 build/C/man5/utmp.5:352
519 #: build/C/man3/getutent.3:302 build/C/man3/getutmp.3:88 build/C/man3/login.3:141 build/C/man3/updwtmp.3:92 build/C/man5/utmp.5:360
521 "This page is part of release 3.76 of the Linux I<man-pages> project. A "
522 "description of the project, information about reporting bugs, and the latest "
523 "version of this page, can be found at "
524 "\\%http://www.kernel.org/doc/man-pages/."
528 #: build/C/man3/getutmp.3:26
534 #: build/C/man3/getutmp.3:26
540 #: build/C/man3/getutmp.3:26 build/C/man5/utmp.5:30
546 #: build/C/man3/getutmp.3:29
547 msgid "getutmp, getutmpx - copy utmp structure to utmpx, and vice versa"
551 #: build/C/man3/getutmp.3:33
554 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
555 "B<#include E<lt>utmpx.hE<gt>>\n"
559 #: build/C/man3/getutmp.3:36
562 "B< void getutmp(const struct utmpx *>I<ux>B<, struct utmp *>I<u>B<);>\n"
563 "B< void getutmpx(const struct utmp *>I<u>B<, struct utmpx *>I<ux>B<);>\n"
567 #: build/C/man3/getutmp.3:51
569 "The B<getutmp>() function copies the fields of the I<utmpx> structure "
570 "pointed to by I<ux> to the corresponding fields of the I<utmp> structure "
571 "pointed to by I<u>. The B<getutmpx>() function performs the converse "
576 #: build/C/man3/getutmp.3:53
577 msgid "These functions do not return a value."
581 #: build/C/man3/getutmp.3:53
587 #: build/C/man3/getutmp.3:55
588 msgid "These functions first appeared in glibc in version 2.1.1."
592 #: build/C/man3/getutmp.3:55
598 #: build/C/man3/getutmp.3:56
600 msgid "Multithreading (see pthreads(7))"
604 #: build/C/man3/getutmp.3:62
605 msgid "The B<getutmp>() and B<getutmpx>() functions are thread-safe."
609 #: build/C/man3/getutmp.3:65
611 "These functions are nonstandard, but appear on a few other systems, such as "
612 "Solaris and NetBSD."
615 #. e.g., on Solaris, the utmpx structure is rather larger than utmp.
617 #: build/C/man3/getutmp.3:76
619 "These functions exist primarily for compatibility with other systems where "
620 "the I<utmp> and I<utmpx> structures contain different fields, or the size of "
621 "corresponding fields differs. On Linux, the two structures contain the same "
622 "fields, and the fields have the same sizes."
626 #: build/C/man3/getutmp.3:80
627 msgid "B<utmpdump>(1), B<getutent>(3), B<utmp>(5)"
631 #: build/C/man3/login.3:25
637 #: build/C/man3/login.3:25
643 #: build/C/man3/login.3:25 build/C/man3/updwtmp.3:29
649 #: build/C/man3/login.3:28
650 msgid "login, logout - write utmp and wtmp entries"
654 #: build/C/man3/login.3:32
655 msgid "B<void login(const struct utmp *>I<ut>B<);>"
659 #: build/C/man3/login.3:34
660 msgid "B<int logout(const char *>I<ut_line>B<);>"
664 #: build/C/man3/login.3:36
665 msgid "Link with I<-lutil>."
669 #: build/C/man3/login.3:41
671 "The utmp file records who is currently using the system. The wtmp file "
672 "records all logins and logouts. See B<utmp>(5)."
676 #: build/C/man3/login.3:48
678 "The function B<login>() takes the supplied I<struct utmp>, I<ut>, and "
679 "writes it to both the utmp and the wtmp file."
683 #: build/C/man3/login.3:52
684 msgid "The function B<logout>() clears the entry in the utmp file again."
688 #: build/C/man3/login.3:52
694 #: build/C/man3/login.3:78
696 "More precisely, B<login>() takes the argument I<ut> struct, fills the field "
697 "I<ut-E<gt>ut_type> (if there is such a field) with the value "
698 "B<USER_PROCESS>, and fills the field I<ut-E<gt>ut_pid> (if there is such a "
699 "field) with the process ID of the calling process. Then it tries to fill "
700 "the field I<ut-E<gt>ut_line>. It takes the first of I<stdin>, I<stdout>, "
701 "I<stderr> that is a terminal, and stores the corresponding pathname minus a "
702 "possible leading I</dev/> into this field, and then writes the struct to the "
703 "utmp file. On the other hand, if no terminal name was found, this field is "
704 "filled with \"???\" and the struct is not written to the utmp file. After "
705 "this, the struct is written to the wtmp file."
709 #: build/C/man3/login.3:94
711 "The B<logout>() function searches the utmp file for an entry matching the "
712 "I<ut_line> argument. If a record is found, it is updated by zeroing out the "
713 "I<ut_name> and I<ut_host> fields, updating the I<ut_tv> timestamp field and "
714 "setting I<ut_type> (if there is such a field) to B<DEAD_PROCESS>."
718 #: build/C/man3/login.3:99
720 "The B<logout>() function returns 1 if the entry was successfully written to "
721 "the database, or 0 if an error occurred."
725 #: build/C/man3/login.3:100
727 msgid "I</var/run/utmp>"
731 #: build/C/man3/login.3:106
733 "user accounting database, configured through B<_PATH_UTMP> in "
734 "I<E<lt>paths.hE<gt>>"
738 #: build/C/man3/login.3:106 build/C/man3/updwtmp.3:59
740 msgid "I</var/log/wtmp>"
744 #: build/C/man3/login.3:112
746 "user accounting log file, configured through B<_PATH_WTMP> in "
747 "I<E<lt>paths.hE<gt>>"
751 #: build/C/man3/login.3:115
752 msgid "Not in POSIX.1-2001. Present on the BSDs."
756 #: build/C/man3/login.3:130
758 "Note that the member I<ut_user> of I<struct utmp> is called I<ut_name> in "
759 "BSD. Therefore, I<ut_name> is defined as an alias for I<ut_user> in "
760 "I<E<lt>utmp.hE<gt>>."
764 #: build/C/man3/login.3:133
765 msgid "B<getutent>(3), B<utmp>(5)"
769 #: build/C/man3/updwtmp.3:29
775 #: build/C/man3/updwtmp.3:32
776 msgid "updwtmp, logwtmp - append an entry to the wtmp file"
780 #: build/C/man3/updwtmp.3:35
782 msgid "B<#include E<lt>utmp.hE<gt>>\n"
786 #: build/C/man3/updwtmp.3:37
788 msgid "B<void updwtmp(const char *>I<wtmp_file>B<, const struct utmp *>I<ut>B<);>\n"
792 #: build/C/man3/updwtmp.3:40
795 "B<void logwtmp(const char *>I<line>B<, const char *>I<name>B<, const char "
800 #: build/C/man3/updwtmp.3:45
801 msgid "For B<logwtmp>(), link with I<-lutil>."
805 #: build/C/man3/updwtmp.3:50
806 msgid "B<updwtmp>() appends the utmp structure I<ut> to the wtmp file."
810 #: build/C/man3/updwtmp.3:58
812 "B<logwtmp>() constructs a utmp structure using I<line>, I<name>, I<host>, "
813 "current time and current process ID. Then it calls B<updwtmp>() to append "
814 "the structure to the wtmp file."
818 #: build/C/man3/updwtmp.3:62
819 msgid "database of past user logins"
823 #: build/C/man3/updwtmp.3:65
824 msgid "Not in POSIX.1-2001. Present on Solaris, NetBSD, and perhaps other systems."
828 #: build/C/man3/updwtmp.3:69
830 "For consistency with the other \"utmpx\" functions (see B<getutxent>(3)), "
831 "glibc provides (since version 2.1):"
835 #: build/C/man3/updwtmp.3:72
837 msgid "B<#include E<lt>utmpx.hE<gt>>\n"
841 #: build/C/man3/updwtmp.3:74
844 "B<void updwtmpx (const char *>I<wtmpx_file>B<, const struct utmpx "
849 #: build/C/man3/updwtmp.3:81
851 "This function performs the same task as B<updwtmp>(), but differs in that it "
852 "takes a I<utmpx> structure as its last argument."
856 #: build/C/man3/updwtmp.3:84
857 msgid "B<getutxent>(3), B<wtmp>(5)"
861 #: build/C/man5/utmp.5:30
867 #: build/C/man5/utmp.5:33
868 msgid "utmp, wtmp - login records"
872 #: build/C/man5/utmp.5:42
874 "The I<utmp> file allows one to discover information about who is currently "
875 "using the system. There may be more users currently using the system, "
876 "because not all programs use utmp logging."
880 #: build/C/man5/utmp.5:52
882 "B<Warning:> I<utmp> must not be writable by the user class \"other\", "
883 "because many system programs (foolishly) depend on its integrity. You risk "
884 "faked system logfiles and modifications of system files if you leave I<utmp> "
885 "writable to any user other than the owner and group owner of the file."
889 #: build/C/man5/utmp.5:60
891 "The file is a sequence of I<utmp> structures, declared as follows in "
892 "I<E<lt>utmp.hE<gt>> (note that this is only one of several definitions "
893 "around; details depend on the version of libc):"
897 #: build/C/man5/utmp.5:64
899 msgid "/* Values for ut_type field, below */\n"
903 #: build/C/man5/utmp.5:79
906 "#define EMPTY 0 /* Record does not contain valid info\n"
907 " (formerly known as UT_UNKNOWN on Linux) */\n"
908 "#define RUN_LVL 1 /* Change in system run-level (see\n"
910 "#define BOOT_TIME 2 /* Time of system boot (in I<ut_tv>) */\n"
911 "#define NEW_TIME 3 /* Time after system clock change\n"
912 " (in I<ut_tv>) */\n"
913 "#define OLD_TIME 4 /* Time before system clock change\n"
914 " (in I<ut_tv>) */\n"
915 "#define INIT_PROCESS 5 /* Process spawned by B<init>(8) */\n"
916 "#define LOGIN_PROCESS 6 /* Session leader process for user login */\n"
917 "#define USER_PROCESS 7 /* Normal process */\n"
918 "#define DEAD_PROCESS 8 /* Terminated process */\n"
919 "#define ACCOUNTING 9 /* Not implemented */\n"
923 #: build/C/man5/utmp.5:83
926 "#define UT_LINESIZE 32\n"
927 "#define UT_NAMESIZE 32\n"
928 "#define UT_HOSTSIZE 256\n"
932 #: build/C/man5/utmp.5:88
935 "struct exit_status { /* Type for ut_exit, below */\n"
936 " short int e_termination; /* Process termination status */\n"
937 " short int e_exit; /* Process exit status */\n"
942 #: build/C/man5/utmp.5:116
946 " short ut_type; /* Type of record */\n"
947 " pid_t ut_pid; /* PID of login process */\n"
948 " char ut_line[UT_LINESIZE]; /* Device name of tty - \"/dev/\" */\n"
949 " char ut_id[4]; /* Terminal name suffix,\n"
950 " or inittab(5) ID */\n"
951 " char ut_user[UT_NAMESIZE]; /* Username */\n"
952 " char ut_host[UT_HOSTSIZE]; /* Hostname for remote login, or\n"
953 " kernel version for run-level\n"
955 " struct exit_status ut_exit; /* Exit status of a process\n"
956 " marked as DEAD_PROCESS; not\n"
957 " used by Linux init (1 */\n"
958 " /* The ut_session and ut_tv fields must be the same size when\n"
959 " compiled 32- and 64-bit. This allows data files and shared\n"
960 " memory to be shared between 32- and 64-bit applications. */\n"
961 "#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32\n"
962 " int32_t ut_session; /* Session ID (B<getsid>(2)),\n"
963 " used for windowing */\n"
965 " int32_t tv_sec; /* Seconds */\n"
966 " int32_t tv_usec; /* Microseconds */\n"
967 " } ut_tv; /* Time entry was made */\n"
969 " long ut_session; /* Session ID */\n"
970 " struct timeval ut_tv; /* Time entry was made */\n"
975 #: build/C/man5/utmp.5:122
978 " int32_t ut_addr_v6[4]; /* Internet address of remote\n"
979 " host; IPv4 address uses\n"
980 " just ut_addr_v6[0] */\n"
981 " char __unused[20]; /* Reserved for future use */\n"
986 #: build/C/man5/utmp.5:130
989 "/* Backward compatibility hacks */\n"
990 "#define ut_name ut_user\n"
991 "#ifndef _NO_UT_TIME\n"
992 "#define ut_time ut_tv.tv_sec\n"
994 "#define ut_xtime ut_tv.tv_sec\n"
995 "#define ut_addr ut_addr_v6[0]\n"
999 #: build/C/man5/utmp.5:140
1001 "This structure gives the name of the special file associated with the user's "
1002 "terminal, the user's login name, and the time of login in the form of "
1003 "B<time>(2). String fields are terminated by a null byte (\\(aq\\e0\\(aq) "
1004 "if they are shorter than the size of the field."
1008 #: build/C/man5/utmp.5:157
1010 "The first entries ever created result from B<init>(1) processing "
1011 "B<inittab>(5). Before an entry is processed, though, B<init>(1) cleans up "
1012 "utmp by setting I<ut_type> to B<DEAD_PROCESS>, clearing I<ut_user>, "
1013 "I<ut_host>, and I<ut_time> with null bytes for each record which I<ut_type> "
1014 "is not B<DEAD_PROCESS> or B<RUN_LVL> and where no process with PID I<ut_pid> "
1015 "exists. If no empty record with the needed I<ut_id> can be found, "
1016 "B<init>(1) creates a new one. It sets I<ut_id> from the inittab, I<ut_pid> "
1017 "and I<ut_time> to the current values, and I<ut_type> to B<INIT_PROCESS>."
1021 #: build/C/man5/utmp.5:176
1023 "B<mingetty>(8) (or B<agetty>(8)) locates the entry by the PID, changes "
1024 "I<ut_type> to B<LOGIN_PROCESS>, changes I<ut_time>, sets I<ut_line>, and "
1025 "waits for connection to be established. B<login>(1), after a user has been "
1026 "authenticated, changes I<ut_type> to B<USER_PROCESS>, changes I<ut_time>, "
1027 "and sets I<ut_host> and I<ut_addr>. Depending on B<mingetty>(8) (or "
1028 "B<agetty>(8)) and B<login>(1), records may be located by I<ut_line> instead "
1029 "of the preferable I<ut_pid>."
1033 #: build/C/man5/utmp.5:182
1035 "When B<init>(1) finds that a process has exited, it locates its utmp entry "
1036 "by I<ut_pid>, sets I<ut_type> to B<DEAD_PROCESS>, and clears I<ut_user>, "
1037 "I<ut_host> and I<ut_time> with null bytes."
1041 #: build/C/man5/utmp.5:194
1043 "B<xterm>(1) and other terminal emulators directly create a B<USER_PROCESS> "
1044 "record and generate the I<ut_id> by using the string that suffix part of the "
1045 "terminal name (the characters following I</dev/[pt]ty>). If they find a "
1046 "B<DEAD_PROCESS> for this ID, they recycle it, otherwise they create a new "
1047 "entry. If they can, they will mark it as B<DEAD_PROCESS> on exiting and it "
1048 "is advised that they null I<ut_line>, I<ut_time>, I<ut_user>, and I<ut_host> "
1053 #: build/C/man5/utmp.5:202
1055 "B<telnetd>(8) sets up a B<LOGIN_PROCESS> entry and leaves the rest to "
1056 "B<login>(1) as usual. After the telnet session ends, B<telnetd>(8) cleans "
1057 "up utmp in the described way."
1061 #: build/C/man5/utmp.5:224
1063 "The I<wtmp> file records all logins and logouts. Its format is exactly like "
1064 "I<utmp> except that a null username indicates a logout on the associated "
1065 "terminal. Furthermore, the terminal name B<~> with username B<shutdown> or "
1066 "B<reboot> indicates a system shutdown or reboot and the pair of terminal "
1067 "names B<|>/B<}> logs the old/new system time when B<date>(1) changes it. "
1068 "I<wtmp> is maintained by B<login>(1), B<init>(1), and some versions of "
1069 "B<getty>(8) (e.g., B<mingetty>(8) or B<agetty>(8)). None of these "
1070 "programs creates the file, so if it is removed, record-keeping is turned "
1075 #: build/C/man5/utmp.5:226
1076 msgid "/var/run/utmp"
1080 #: build/C/man5/utmp.5:228
1081 msgid "/var/log/wtmp"
1085 #: build/C/man5/utmp.5:247
1087 "POSIX.1 does not specify a I<utmp> structure, but rather one named I<utmpx>, "
1088 "with specifications for the fields I<ut_type>, I<ut_pid>, I<ut_line>, "
1089 "I<ut_id>, I<ut_user>, and I<ut_tv>. POSIX.1 does not specify the lengths of "
1090 "the I<ut_line> and I<ut_user> fields."
1094 #: build/C/man5/utmp.5:253
1096 "Linux defines the I<utmpx> structure to be the same as the I<utmp> "
1101 #: build/C/man5/utmp.5:253
1103 msgid "Comparison with historical systems"
1107 #: build/C/man5/utmp.5:256
1109 "Linux utmp entries conform neither to v7/BSD nor to System V; they are a mix "
1114 #: build/C/man5/utmp.5:263
1116 "v7/BSD has fewer fields; most importantly it lacks I<ut_type>, which causes "
1117 "native v7/BSD-like programs to display (for example) dead or login entries. "
1118 "Further, there is no configuration file which allocates slots to sessions. "
1119 "BSD does so because it lacks I<ut_id> fields."
1123 #: build/C/man5/utmp.5:275
1125 "In Linux (as in System V), the I<ut_id> field of a record will never change "
1126 "once it has been set, which reserves that slot without needing a "
1127 "configuration file. Clearing I<ut_id> may result in race conditions leading "
1128 "to corrupted utmp entries and potential security holes. Clearing the "
1129 "abovementioned fields by filling them with null bytes is not required by "
1130 "System V semantics, but makes it possible to run many programs which assume "
1131 "BSD semantics and which do not modify utmp. Linux uses the BSD conventions "
1132 "for line contents, as documented above."
1135 #. mtk: What is the referrent of "them" in the following sentence?
1136 #. System V only uses the type field to mark them and logs
1137 #. informative messages such as \fB"new time"\fP in the line field.
1139 #: build/C/man5/utmp.5:280
1140 msgid "System V has no I<ut_host> or I<ut_addr_v6> fields."
1144 #: build/C/man5/utmp.5:288
1146 "Unlike various other systems, where utmp logging can be disabled by removing "
1147 "the file, utmp must always exist on Linux. If you want to disable "
1148 "B<who>(1), then do not make utmp world readable."
1152 #: build/C/man5/utmp.5:291
1154 "The file format is machine-dependent, so it is recommended that it be "
1155 "processed only on the machine architecture where it was created."
1159 #: build/C/man5/utmp.5:312
1161 "Note that on I<biarch> platforms, that is, systems which can run both 32-bit "
1162 "and 64-bit applications (x86-64, ppc64, s390x, etc.), I<ut_tv> is the same "
1163 "size in 32-bit mode as in 64-bit mode. The same goes for I<ut_session> and "
1164 "I<ut_time> if they are present. This allows data files and shared memory to "
1165 "be shared between 32-bit and 64-bit applications. This is achieved by "
1166 "changing the type of I<ut_session> to I<int32_t>, and that of I<ut_tv> to a "
1167 "struct with two I<int32_t> fields I<tv_sec> and I<tv_usec>. Since I<ut_tv> "
1168 "may not be the same as I<struct timeval>, then instead of the call:"
1172 #: build/C/man5/utmp.5:316
1174 msgid "gettimeofday((struct timeval *) &ut.ut_tv, NULL);\n"
1178 #: build/C/man5/utmp.5:320
1179 msgid "the following method of setting this field is recommended:"
1183 #: build/C/man5/utmp.5:325
1187 "struct timeval tv;\n"
1191 #: build/C/man5/utmp.5:329
1194 "gettimeofday(&tv, NULL);\n"
1195 "ut.ut_tv.tv_sec = tv.tv_sec;\n"
1196 "ut.ut_tv.tv_usec = tv.tv_usec;\n"
1200 #: build/C/man5/utmp.5:352
1202 "B<ac>(1), B<date>(1), B<last>(1), B<login>(1), B<utmpdump>(1), B<who>(1), "
1203 "B<getutent>(3), B<getutmp>(3), B<login>(3), B<logout>(3), B<logwtmp>(3), "
1204 "B<updwtmp>(3), B<init>(1)"