The Linux Programming Interface
Chapter 40: Login Accounting Login accounting is concerned with recording which users are currently logged in to the system, and ...
818 Chapter 40 On Linux, the utmp file resides at /var/run/utmp, and the wtmp file resides at /var/ log/wtmp. In general, applic ...
Login Accounting 819 The SUSv3 specification of the utmpx structure doesn’t include the ut_host, ut_exit, ut_session, or ut_addr ...
820 Chapter 40 The ut_type field is an integer defining the type of record being written to the file. The following set of const ...
Login Accounting 821 creates a child for each terminal line and virtual console, and each child execs the getty program. The get ...
822 Chapter 40 The getutxent(), getutxid(), and getutxline() functions read a record from the utmp file and return a pointer to ...
Login Accounting 823 The glibc implementation doesn’t perform this type of caching, but we should never- theless employ this tec ...
824 Chapter 40 the other output produced by the program.) By searching sequentially through the wtmp file (using getutxline()), ...
Login Accounting 825 40.5 Retrieving the Login Name: getlogin() The getlogin() function returns the name of the user logged in o ...
826 Chapter 40 sample runs of the program in Listing 40-2.) A record containing exactly the same information is appended to the ...
Login Accounting 827 When updating the wtmp file, we simply open the file and append a record to it. Because this is a standard ...
828 Chapter 40 Next we use our program to examine the contents of the wtmp file: # ./dump_utmpx /var/log/wtmp user type PID line ...
Login Accounting 829 int main(int argc, char argv[]) { struct utmpx ut; char devName; if (argc < 2 || strcmp(argv[1], "--help ...
830 Chapter 40 printf("Creating logout entries in utmp and wtmp\n"); setutxent(); /* Rewind to start of utmp file */ if (pututxl ...
Login Accounting 831 Since the lastlog file is indexed by user ID, it is not possible to distinguish log- ins under different us ...
832 Chapter 40 40.8 Summary Login accounting records the users currently logged in, as well as all past logins. This information ...
FUNDAMENTALS OF SHARED LIBRARIES Shared libraries are a technique for placing library functions into a single unit that can be s ...
834 Chapter 41 just once, and then link them into different executables as required. Although this technique saves us compilatio ...
Fundamentals of Shared Libraries 835 The options argument consists of a series of letters, one of which is the operation code, w ...
836 Chapter 41 Having linked the program, we can run it in the usual way: $ ./prog Called mod1-x1 Called mod2-x2 Chapter 41: Fun ...
«
39
40
41
42
43
44
45
46
47
48
»
Free download pdf