diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:41:07 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:41:07 +0000 |
commit | 3af6d22bb3850ab2bac67287e3a3d3b0e32868e5 (patch) | |
tree | 3ee7a3ec64525911fa865bb984c86d997d855527 /man3/getutent.3 | |
parent | Adding debian version 6.05.01-1. (diff) | |
download | manpages-3af6d22bb3850ab2bac67287e3a3d3b0e32868e5.tar.xz manpages-3af6d22bb3850ab2bac67287e3a3d3b0e32868e5.zip |
Merging upstream version 6.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'man3/getutent.3')
-rw-r--r-- | man3/getutent.3 | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/man3/getutent.3 b/man3/getutent.3 index d2aefcf..f55286f 100644 --- a/man3/getutent.3 +++ b/man3/getutent.3 @@ -10,7 +10,7 @@ .\" Modified Thu Jul 25 14:43:46 MET DST 1996 by Michael Haardt .\" <michael@cantor.informatik.rwth-aachen.de> .\" -.TH getutent 3 2023-07-20 "Linux man-pages 6.05.01" +.TH getutent 3 2023-10-31 "Linux man-pages 6.7" .SH NAME getutent, getutid, getutline, pututline, setutent, endutent, utmpname \- access utmp file entries @@ -20,22 +20,22 @@ Standard C library .SH SYNOPSIS .nf .B #include <utmp.h> -.PP +.P .B struct utmp *getutent(void); .BI "struct utmp *getutid(const struct utmp *" ut ); .BI "struct utmp *getutline(const struct utmp *" ut ); -.PP +.P .BI "struct utmp *pututline(const struct utmp *" ut ); -.PP +.P .B void setutent(void); .B void endutent(void); -.PP +.P .BI "int utmpname(const char *" file ); .fi .SH DESCRIPTION New applications should use the POSIX.1-specified "utmpx" versions of these functions; see STANDARDS. -.PP +.P .BR utmpname () sets the name of the utmp-format file for the other utmp functions to access. @@ -44,24 +44,24 @@ If is not used to set the filename before the other functions are used, they assume \fB_PATH_UTMP\fP, as defined in \fI<paths.h>\fP. -.PP +.P .BR setutent () rewinds the file pointer to the beginning of the utmp file. It is generally a good idea to call it before any of the other functions. -.PP +.P .BR endutent () closes the utmp file. It should be called when the user code is done accessing the file with the other functions. -.PP +.P .BR getutent () reads a line from the current file position in the utmp file. It returns a pointer to a structure containing the fields of the line. The definition of this structure is shown in .BR utmp (5). -.PP +.P .BR getutid () searches forward from the current file position in the utmp file based upon \fIut\fP. @@ -77,7 +77,7 @@ will find the first entry whose .I ut_id field matches \fIut\->ut_id\fP. -.PP +.P .BR getutline () searches forward from the current file position in the utmp file. It scans entries whose @@ -87,7 +87,7 @@ or \fBLOGIN_PROCESS\fP and returns the first one whose .I ut_line field matches \fIut\->ut_line\fP. -.PP +.P .BR pututline () writes the .I utmp @@ -108,16 +108,16 @@ return a pointer to a \fIstruct utmp\fP on success, and NULL on failure (which includes the "record not found" case). This \fIstruct utmp\fP is allocated in static storage, and may be overwritten by subsequent calls. -.PP +.P On success .BR pututline () returns .IR ut ; on failure, it returns NULL. -.PP +.P .BR utmpname () returns 0 if the new name was successfully stored, or \-1 on failure. -.PP +.P On failure, these functions .I errno set to indicate the error. @@ -128,7 +128,7 @@ Out of memory. .TP .B ESRCH Record not found. -.PP +.P .BR setutent (), .BR pututline (), and the @@ -189,7 +189,7 @@ T{ .BR utmpname () T} Thread safety MT-Unsafe race:utent .TE -.sp 1 +.P In the above table, .I utent in @@ -209,7 +209,7 @@ then data races could occur. None. .SH HISTORY XPG2, SVr4. -.PP +.P In XPG2 and SVID 2 the function .BR pututline () is documented to return void, and that is what it does on many systems @@ -218,15 +218,15 @@ HP-UX introduces a new function .BR _pututline () with the prototype given above for .BR pututline (). -.PP +.P All these functions are obsolete now on non-Linux systems. POSIX.1-2001 and POSIX.1-2008, following SUSv1, does not have any of these functions, but instead uses -.PP +.P .RS 4 .EX .B #include <utmpx.h> -.PP +.P .B struct utmpx *getutxent(void); .B struct utmpx *getutxid(const struct utmpx *); .B struct utmpx *getutxline(const struct utmpx *); @@ -235,7 +235,7 @@ does not have any of these functions, but instead uses .B void endutxent(void); .EE .RE -.PP +.P These functions are provided by glibc, and perform the same task as their equivalents without the "x", but use .IR "struct utmpx" , @@ -244,7 +244,7 @@ defined on Linux to be the same as For completeness, glibc also provides .BR utmpxname (), although this function is not specified by POSIX.1. -.PP +.P On some other systems, the \fIutmpx\fP structure is a superset of the \fIutmp\fP structure, with additional fields, and larger versions of the existing fields, @@ -252,7 +252,7 @@ and parallel files are maintained, often .I /var/*/utmpx and .IR /var/*/wtmpx . -.PP +.P Linux glibc on the other hand does not use a parallel \fIutmpx\fP file since its \fIutmp\fP structure is already large enough. The "x" functions listed above are just aliases for @@ -264,20 +264,20 @@ is an alias for .SS glibc notes The above functions are not thread-safe. glibc adds reentrant versions -.PP +.P .nf .B #include <utmp.h> -.PP +.P .BI "int getutent_r(struct utmp *" ubuf ", struct utmp **" ubufp ); .BI "int getutid_r(struct utmp *" ut , .BI " struct utmp *" ubuf ", struct utmp **" ubufp ); .BI "int getutline_r(struct utmp *" ut , .BI " struct utmp *" ubuf ", struct utmp **" ubufp ); .fi -.PP +.P Feature Test Macro Requirements for glibc (see .BR feature_test_macros (7)): -.PP +.P .BR getutent_r (), .BR getutid_r (), .BR getutline_r (): @@ -286,7 +286,7 @@ Feature Test Macro Requirements for glibc (see || /* Since glibc 2.19: */ _DEFAULT_SOURCE || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE .fi -.PP +.P These functions are GNU extensions, analogs of the functions of the same name without the _r suffix. The @@ -305,7 +305,7 @@ should check the return values of .BR getpwuid (3) and .BR ttyname (3). -.PP +.P .\" SRC BEGIN (getutent.c) .EX #include <pwd.h> @@ -327,7 +327,7 @@ main(void) strcpy(entry.ut_line, ttyname(STDIN_FILENO) + strlen("/dev/")); /* only correct for ptys named /dev/tty[pqr][0\-9a\-z] */ strcpy(entry.ut_id, ttyname(STDIN_FILENO) + strlen("/dev/tty")); - time(&entry.ut_time); + entry.ut_time = time(NULL); strcpy(entry.ut_user, getpwuid(getuid())\->pw_name); memset(entry.ut_host, 0, UT_HOSTSIZE); entry.ut_addr = 0; |