Subject: Re: sample utmpx implementation
To: Christos Zoulas <email@example.com>
From: John Nemeth <firstname.lastname@example.org>
Date: 11/21/2001 02:51:29
On Mar 24, 8:41am, Christos Zoulas wrote:
I meant to respond to this some time ago, but anyways...
} This code is just WIP of a utmpx implementation... It is posted just for
} feedback; I am not planning to commit anything until it is done. This
} code has not been tested and I don't know if it works.
} - The utmpx file does not have a version
} I am thinking of implementing utmpx file versioning by using the
} first utmpx entry in the file: Define a new ut_type `VERSION' and
} put the version number and magic in the ut_name field.
How would you deal with wtmpx? Since it is often rotated, you
can't depend on a special record being first in the file. I suppose
you could make people read utmpx to get the version, but I'm not sure
that would work in practice.
} - The lastlog stuff is missing
} I am thinking of implementing lastlog using db, so that it does not
} become huge like it is now.
lastlog is a constant size. It also has holes, so it isn't any
larger then needed. Making it a db would greatly increase the size and
considerably complicate access. I really don't like this idea. Also,
any reason you didn't add any padding to struct lastlogx? Off the top
of my head, I can't think of any other fields that are needed, but that
is the whole reason for padding.
} - utmp_update is supposed to be a program that is setuid or setgid to
} something that can write the utmpx file. This is similar I believe
} to what some svr4 systems do.
} - I also don't know what to do about utmpd. pututent() is supposed to
} register utmpx entries with utmpd, and utmpd is supposed to detect
} that processes have died and change the ut_type field appropriately.
} Is that something we want?
Is this something we really need? Or, could we just have init
reap the entry when it reaps the process?
I didn't see any functions for handling wtmpx records. Solaris
2.5 provides these functions:
Checks the existence of wfile and its parallel file, whose
name is obtained by appending an ``x'' to wfile. If only
one of them exists, the second one is created and initial-
ized to reflect the state of the existing file. utmp is
written to wfile and the corresponding utmpx structure is
written to the parallel file.
Checks the existence of wfilex and its parallel file, whose
name is obtained by truncating the final ``x'' from wfilex.
If only one of them exists, the second one is created and
initialized to reflect the state of the existing file. utmpx
is written to wfilex, and the corresponding utmp structure
is written to the parallel file.
I'm not sure what else should be provided. Although something to get
the most recent login/logout pair for a user would probably be good.
}-- End of excerpt from Christos Zoulas