From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,ec1f27c608d74f9e,start X-Google-Attributes: gidfc89c,public X-Google-Thread: fee84,ec1f27c608d74f9e,start X-Google-Attributes: gidfee84,public From: pedwards@valhalla.cs.wright.edu (Phil Edwards) Subject: VERY low-level question Date: 1995/06/29 Message-ID: <3susoh$lhg@valhalla.cs.wright.edu>#1/1 X-Deja-AN: 105262877 followup-to: poster organization: the top of Solsbury Hill. keywords: utmp newsgroups: comp.unix.osf.osf1,comp.unix.programmer (Followups set to reply by mail to me; I'll post a summary of any good information.) The utmp.h file on OSF/1 3.0 #defines ten different values for the ut_type member of the utmp structure, namely: #define EMPTY 0 #define RUN_LVL 1 #define BOOT_TIME 2 #define OLD_TIME 3 #define NEW_TIME 4 #define INIT_PROCESS 5 /* Process spawned by "init" */ #define LOGIN_PROCESS 6 /* A "getty" process waiting for login */ #define USER_PROCESS 7 /* A user process */ #define DEAD_PROCESS 8 #define ACCOUNTING 9 I need to figure out what the ut_type is set to when a user logs out. On Linux, it's DEAD_PROCESS, but then Linux doesn't even define a value for zero. I've been trying to write some code that would go through the utmp file and do a formatted dump of the entries, but I have yet to succeed (plagued with stupid mistakes and not very much time). The end question is: if I have just forcibly logged somebody out (via untamo) and I wish to make certain that the utmp entry hasn't been corrupted, what do I need to set in order to let the system know that such-and-such a tty is free for use again? I am assuming that the ut_type is the only thing I need to set. We have varying types of connections (LAT ports, ptys, etc), and it's my understanding that different connections might need to get a different "all-clear, this is unused" ut_type set. Unfortunately, I'm rather new at this part of it: detecting which type of connection is no problem (check the ut_line string), but I don't know what the new ut_type would need to be. (This code will also be used to manually clear a utmp entry when a user logs out "ungracefully" and leaves the dead entry behind, racking up fake "idle time".) Any advice or suggestions you might have are welcome. Please reply by mail and I'll try to post a summary. -- Phil Edwards #include pedwards@cs.wright.edu http://www.cs.wright.edu/people/students/pedwards/ The gods do not protect fools. Fools are protected by more capable fools.