Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
utmpname(3)
Edit
PageHistory
Diff
Info
LikePages
GETUTENT !!!GETUTENT NAME SYNOPSIS DESCRIPTION RETURN VALUE ERRORS EXAMPLE FILES CONFORMING TO SEE ALSO ---- !!NAME getutent, getutid, getutline, pututline, setutent, endutent, utmpname - access utmp file entries !!SYNOPSIS __#include __ __struct utmp *getutent(void); struct utmp *getutid(struct utmp *__''ut''__); struct utmp *getutline(struct utmp *__''ut''__);__ __void pututline(struct utmp *__''ut''__);__ __void setutent(void); void endutent(void);__ __void utmpname(const char *__''file''__);__ !!DESCRIPTION __utmpname__() sets the name of the utmp-format file for the other utmp functions to access. If __utmpname__() is not used to set the filename before the other functions are used, they assume ___PATH_UTMP__, as defined in ''''. __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. __endutent__() closes the utmp file. It should be called when the user code is done accessing the file with the other functions. __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. __getutid__() searches forward from the current file position in the utmp file based upon ''ut''. If ''ut''__-__ is __RUN_LVL__, __BOOT_TIME__, __NEW_TIME__, or __OLD_TIME__, __getutid__() will find the first entry whose __ut_type__ field matches ''ut''__-__. If ''ut''__-__ is one of __INIT_PROCESS__, __LOGIN_PROCESS__, __USER_PROCESS__, or __DEAD_PROCESS__, __getutid__() will find the first entry whose __ut_id__ field matches ''ut''__-__. __getutline__() searches forward from the current file position in the utmp file. It scans entries whose ut_type is __USER_PROCESS__ or __LOGIN_PROCESS__ and returns the first one whose __ut_line__ field matches ''ut''__-__. __pututline__() writes the utmp structure ''ut'' into the utmp file. It uses __getutid__() to search for the proper place in the file to insert the new entry. If it cannot find an appropriate slot for ''ut'', __pututline__() will append the new entry to the end of the file. !!RETURN VALUE __getutent__(), __getutid__(), and __getutline__() return a pointer to a __static struct utmp__. !!ERRORS On error, __(struct utmp*)0__ will be returned. !!EXAMPLE The following example adds and removes a utmp record, assuming it is run from within a pseudo terminal. For usage in a real application, you should check the return values of getpwuid() and ttyname(). #include !!FILES /var/run/utmp database of currently logged-in users /var/log/wtmp database of past user logins !!CONFORMING TO XPG 2, SVID 2, Linux FSSTND 1.2 !!SEE ALSO utmp(5) ----
One page links to
utmpname(3)
:
Man3u
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.