Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpda!hpcuhb!hpcllla!hpclisp!hpclscu!shankar From: shankar@hpclscu.HP.COM (Shankar Unni) Newsgroups: comp.sys.hp Subject: Re: question regarding how hpux uses /etc/utmp. Message-ID: <1340049@hpclscu.HP.COM> Date: 27 Mar 89 21:39:46 GMT References: <1256@special-k.ai.mit.edu> Organization: Hewlett-Packard Calif. Language Lab Lines: 39 > I am trying to port a finger program to the hp's (hpux version 6.2) and > notice that the utmp file in the hp's often contains more entries than > the number of users logged in. However, the "who" program distributed by hp > seems to do the right thing. Since I dont have sources, could someone Check the man page on utmp (4). struct utmp { char ut_user[8]; /* User login name */ char ut_id[4]; /* /etc/inittab id (usually line #) */ char ut_line[12]; /* device name (console, lnxx) */ short ut_pid; /* process id */ short ut_type; /* type of entry */ struct exit_status { short e_termination; /* Process termination status */ short e_exit; /* Process exit status */ } ut_exit; /* The exit status of a process */ /* marked as DEAD_PROCESS. */ time_t ut_time; /* time entry was made */ }; The field "ut_type" tells you what kind of an entry this is: /* Definitions for ut_type */ #define EMPTY 0 /* ..... */ #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 /* ... */ There are many more types: SysVish utmp's are cluttered with all kinds of fascinating stuff. Read the man page for full details. The ones you are interested in are the "USER_PROCESS" entries. --- Shankar Unni. HP Computer Language Lab.