Commit Graph

21 Commits

Author SHA1 Message Date
Baptiste Daroussin
7acd8260b5 Escape "Ed" 2015-04-26 10:29:43 +00:00
Baptiste Daroussin
8fbf3d50e3 use .Mt to mark up email addresses consistently (part4)
PR:		191174
Submitted by:	Franco Fichtner  <franco at lastsummer.de>
2014-06-23 08:25:03 +00:00
Ed Schouten
71d8432f98 Replace utxrm(8) by utx(8).
At first, I added a utility called utxrm(8) to remove stale entries from
the user accounting database. It seems there are cases in which we need
to perform different operations on the database as well. Simply rename
utxrm(8) to utx(8) and place the old code under the "rm" command.

In addition to "rm", this tool supports "boot" and "shutdown", which are
going to be used by an rc-script which I am going to commit separately.
2012-02-11 20:28:42 +00:00
Ed Schouten
f9d9bcd45e Remove wtmpcvt(1).
The wtmpcvt(1) utility converts wtmp files to the new format used by
utmpx(3). Now that HEAD has been branched to stable/9 and 9.0 is
released, there is no need for it in HEAD.

MFC after:	never
2012-01-13 15:40:49 +00:00
Ed Schouten
ad033677ea Don't forget to kick the man page date. 2011-10-27 17:21:41 +00:00
Ed Schouten
c5cf53fc3e Make our utmpx more like System V.
When booting the system, truncate the utx.active file, but do write the
BOOT_TIME record into it afterwards. This allows one to obtain the boot
time of the system as follows:

	struct utmpx u1 = { .ut_type = BOOT_TIME }, *u2;

	setutxent();
	u2 = getutxid(&u1);

Now, the boot time is stored in u2->ut_tv, just like on Linux and other
systems.

We don't open the utx.active file with O_EXLOCK. It's rather unlikely
that other applications use this database at the same time and I want to
prevent the possibility of deadlocks in init(8).

Discussed with:	pluknet
2011-10-27 17:05:18 +00:00
Sergey Kandaurov
7112398c93 Fix the manual section number for a cross-reference to open(2) and sort it.
Reviewed by:	ed
MFC after:	3 days
2011-10-27 13:17:42 +00:00
Eitan Adler
36daf0495a - change "is is" to "is" or "it is"
- change "the the" to "the"

Approved by:	lstewart
Approved by:	sahil (mentor)
MFC after:	3 days
2011-10-16 14:30:28 +00:00
Ed Schouten
1d9a9b79d0 Fix whitespace inconsistencies in libc in files copyrighted by me. 2011-06-26 18:27:17 +00:00
Ed Schouten
b30bfd4339 Add a utility, utxrm(8).
Most of the ports I broke when I imported utmpx, were simple management
utilities for the utmp database, allowing you to add/remove entries
manually.

Add a small tool called utxrm(8), which allows you to remove an entry
from the utmpx database by hand. This is useful when a login daemon
crashes or fails to remove the entry during shutdown.
2011-02-19 11:44:04 +00:00
Ed Schouten
1ae6a21db9 Properly styleify utmpx code and document error codes in man page.
Submitted by:	Garrett Cooper
2011-02-19 11:31:56 +00:00
Joel Dahl
edfa427cf1 Spelling fixes. 2010-08-02 16:01:45 +00:00
Ulrich Spörlein
aa12cea2cc mdoc: order prologue macros consistently by Dd/Dt/Os
Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by:	ru
Approved by:	philip, ed (mentors)
2010-04-14 19:08:06 +00:00
Ed Schouten
1e7a08440a Also add a cross-reference to NetBSD updlastlogx(). 2010-02-03 19:31:02 +00:00
Ed Schouten
9d98195dc3 EMPTY records don't have a timestamp. 2010-01-23 17:58:40 +00:00
Ed Schouten
a7607816bf Just ignore the timestamps given to pututxline().
I've noticed many applications do a bad job at timekeeping, for several
reasons:

- Applications like screen(1) don't update time records when restoring
  the old user login record.
- Many applications only set ut_tv.tv_sec, not ut_tv.tv_usec.

This causes many problems for tools such as ac(8), which require the
timestamps to be properly ordered. This is why I've decided to let the
utmpx code obtain valid timestamps itself.
2010-01-23 08:43:21 +00:00
Ed Schouten
f5ec5ddec2 English nitpicking.
Submitted by:	jmallett
2010-01-22 05:19:51 +00:00
Ed Schouten
5b2e6b2a90 Describe why pututxline() doesn't entirely conform to standards. 2010-01-22 05:09:10 +00:00
Ed Schouten
98c63a48e9 Perform several small cleanups to the utmpx code.
- Massively reduce BSS usage. Let futx_to_utx() dynamically allocate the
  structure. There is only a very small amount of applications out there
  that needs to use the utmpx database. Wasting 1 KB on unused
  structures makes little sense.

- Just let getutxid() search for matching ut_id's for any *PROCESS-type.
  This makes the code a bit more future-proof.

- Fix a POSIX-mistake: when reading POSIX and the OpenSolaris
  implementation, getutxline() must return USER_PROCESS and
  LOGIN_PROCESS records whose ut_lines match. When reading POSIX, it
  seems LOGIN_PROCESS should not use ut_line at the first place. I have
  reported this issue.
2010-01-17 21:40:05 +00:00
Ed Schouten
5ab7f1fc40 Add wtmpcvt(1).
This utility allows users to convert their wtmp databases to the new
format. It makes no sense for users to keep their wtmp log files if they
are unable to view them.

It basically copies ut_line into ut_id as well. This makes it possible
for last(1) and ac(8) to match login records with their corresponding
logout record.
2010-01-14 20:58:45 +00:00
Ed Schouten
a627ac61ab Implement <utmpx.h>.
The utmpx interface is the standardized interface of the user accounting
database. The standard only defines a subset of the functions that were
present in System V-like systems.

I'd like to highlight some of the traits my implementation has:

- The standard allows the on-disk format to be different than the
  in-memory representation (struct utmpx). Most operating systems don't
  do this, but we do. This allows us to keep our ABI more stable, while
  giving us the opportunity to modify the on-disk format. It also allows
  us to use a common file format across different architectures (i.e.
  byte ordering).

- Our implementation of pututxline() also updates wtmp and lastlog (now
  called utx.log and utx.lastlogin). This means the databases are more
  likely to be in sync.

- Care must be taken that our implementation discard any fields that are
  not applicable. For example, our DEAD_PROCESS records do not hold a
  TTY name. Just a time stamp, a record identifier and a process
  identifier. It also guarantees that strings (ut_host, ut_line and
  ut_user) are null terminated. ut_id is obviously not null terminated,
  because it's not a string.

- The API and its behaviour should be conformant to POSIX, but there may
  be things that slightly deviate from the standard. This implementation
  uses separate file descriptors when writing to the log files. It also
  doesn't use getutxid() to search for a field to overwrite. It uses an
  allocation strategy similar to getutxid(), but prevents DEAD_PROCESS
  records from accumulating.

Make sure libulog doesn't overwrite the manpages shipped with our C
library. Also keep the symbol list in Symbol.map sorted.

I'll bump __FreeBSD_version later this evening. I first want to convert
everything to <utmpx.h> and get rid of <utmp.h>.
2010-01-13 17:29:55 +00:00