Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
.\" Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2009-12-05 19:53:29 +00:00
|
|
|
.Dd December 5, 2009
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
.Os
|
|
|
|
.Dt ULOG_GETUTXENT 3
|
|
|
|
.Sh NAME
|
|
|
|
.Nm ulog_getutxent ,
|
2009-12-05 19:53:29 +00:00
|
|
|
.Nm ulog_getutxline ,
|
|
|
|
.Nm ulog_pututxline ,
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
.Nm ulog_setutxent ,
|
|
|
|
.Nm ulog_endutxent
|
|
|
|
.Nd read user login records
|
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libulog
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In ulog.h
|
|
|
|
.Ft struct ulog_utmpx *
|
|
|
|
.Fn ulog_getutxent "void"
|
2009-12-05 19:53:29 +00:00
|
|
|
.Ft struct ulog_utmpx *
|
|
|
|
.Fn ulog_getutxline "const struct ulog_utmpx *line"
|
|
|
|
.Ft struct ulog_utmpx *
|
|
|
|
.Fn ulog_pututxline "const struct ulog_utmpx *utmpx"
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
.Ft void
|
|
|
|
.Fn ulog_setutxent "void"
|
|
|
|
.Ft void
|
|
|
|
.Fn ulog_endutxent "void"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Fn ulog_getutxent
|
|
|
|
function returns a pointer to an object, with the following structure,
|
|
|
|
containing stored information of an active user login session.
|
|
|
|
.Bd -literal
|
|
|
|
struct ulog_utmpx {
|
2009-12-05 19:53:29 +00:00
|
|
|
char ut_user[]; /* Username. */
|
|
|
|
char ut_id[]; /* Private data. */
|
|
|
|
char ut_line[]; /* TTY device. */
|
|
|
|
char ut_host[]; /* Remote hostname. */
|
|
|
|
pid_t ut_pid; /* Process identifier. */
|
|
|
|
short ut_type; /* Type of entry. */
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
struct timeval ut_tv; /* Timestamp. */
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
The fields are as follows:
|
|
|
|
.Bl -tag -width ut_user
|
|
|
|
.It Fa ut_user
|
|
|
|
The username of the logged in user.
|
2009-12-05 19:53:29 +00:00
|
|
|
.It Fa ut_id
|
|
|
|
Private data that can be used to later identify the record.
|
|
|
|
This implementation is not capable of storing this value on disk.
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
.It Fa ut_line
|
|
|
|
The pathname of the TTY device, without the leading
|
|
|
|
.Pa /dev/
|
|
|
|
directory.
|
|
|
|
.It Fa ut_host
|
|
|
|
An optional hostname of a remote system, if the login session is
|
|
|
|
provided through a networked login service.
|
2009-12-05 19:53:29 +00:00
|
|
|
.It Fa ut_pid
|
|
|
|
Process identifier of the session leader of the login session.
|
|
|
|
This implementation is not capable of storing this value on disk.
|
2009-12-03 16:33:47 +00:00
|
|
|
.It Fa ut_type
|
|
|
|
The
|
|
|
|
.Fa ut_type
|
|
|
|
field contains the type of the message, which may have one of the
|
|
|
|
following values:
|
2009-12-03 17:05:36 +00:00
|
|
|
.Bl -tag -width SHUTDOWN_TIME
|
2009-12-03 16:33:47 +00:00
|
|
|
.It Dv EMPTY
|
|
|
|
No valid user accounting information.
|
2009-12-05 19:53:29 +00:00
|
|
|
.It Dv BOOT_TIME
|
|
|
|
Identifies time of system boot.
|
2009-12-03 16:33:47 +00:00
|
|
|
.It Dv OLD_TIME
|
|
|
|
Identifies time when system clock changed.
|
|
|
|
.It Dv NEW_TIME
|
|
|
|
Identifies time after system clock changed.
|
2009-12-03 17:05:36 +00:00
|
|
|
.It Dv USER_PROCESS
|
|
|
|
Identifies a process.
|
2009-12-05 19:53:29 +00:00
|
|
|
.It Dv INIT_PROCESS
|
|
|
|
Identifies a process spawned by the init process.
|
|
|
|
.It Dv LOGIN_PROCESS
|
|
|
|
Identifies the session leader of a logged-in user.
|
2009-12-03 16:33:47 +00:00
|
|
|
.It Dv DEAD_PROCESS
|
|
|
|
Identifies a session leader who has exited.
|
|
|
|
.It Dv SHUTDOWN_TIME
|
|
|
|
Identifies time when system was shut down.
|
|
|
|
.El
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
.It Fa ut_tv
|
|
|
|
Timestamp indicating when the entry was last modified.
|
|
|
|
.El
|
|
|
|
.Pp
|
2009-12-05 19:53:29 +00:00
|
|
|
This implementation guarantees all strings returned in the structure to
|
|
|
|
be null terminated.
|
|
|
|
.Pp
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
The
|
|
|
|
.Fn ulog_getutxent
|
|
|
|
function reads the next entry from the utmp file, opening the file if
|
|
|
|
necessary.
|
|
|
|
The
|
2009-12-05 19:53:29 +00:00
|
|
|
.Fn ulog_getutxline
|
|
|
|
function reads entries from the utmp file, until finding an entry which
|
|
|
|
shares the same
|
|
|
|
.Fa ut_line
|
|
|
|
as the structure
|
|
|
|
.Fa line .
|
|
|
|
The
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
.Fn ulog_setutxent
|
|
|
|
opens the file, closing it first if already opened.
|
|
|
|
The
|
|
|
|
.Fn ulog_endutxent
|
|
|
|
function closes any open files.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn ulog_getutxent
|
2009-12-05 19:53:29 +00:00
|
|
|
and
|
|
|
|
.Fn ulog_getutxline
|
|
|
|
functions read from the beginning of the file until and EOF is
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
encountered.
|
2009-12-05 19:53:29 +00:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn ulog_pututxline
|
|
|
|
function writes a new entry to the file.
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
.Sh RETURN VALUES
|
|
|
|
The
|
|
|
|
.Fn ulog_getutxent
|
2009-12-05 19:53:29 +00:00
|
|
|
and
|
|
|
|
.Fn ulog_getutxline
|
|
|
|
functions return a null pointer on EOF or error.
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr ulog_login 3 ,
|
2009-12-05 19:53:29 +00:00
|
|
|
.Xr ulog_setutxfile 3 ,
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
.Xr utmp 5
|
2009-12-05 19:53:29 +00:00
|
|
|
.Sh STANDARDS
|
|
|
|
This interface is similar to
|
|
|
|
.In utmpx.h
|
|
|
|
described in
|
|
|
|
.St -p1003.1-2008 ,
|
|
|
|
but incompatible.
|
|
|
|
The underlying file format does not allow a correctly behaving
|
|
|
|
implementation of the standardized interface.
|
|
|
|
.Pp
|
|
|
|
This programming interface has been designed to ease the migration
|
|
|
|
towards
|
|
|
|
.In utmpx.h .
|
|
|
|
If
|
|
|
|
.Dv _ULOG_POSIX_NAMES
|
|
|
|
is set before inclusion of
|
|
|
|
.In ulog.h ,
|
|
|
|
it is also possible to use the
|
|
|
|
.Vt utmpx
|
|
|
|
structure and the
|
|
|
|
.Fn getutxent ,
|
|
|
|
.Fn getutxline ,
|
|
|
|
.Fn pututxline ,
|
|
|
|
.Fn setutxent
|
|
|
|
and
|
|
|
|
.Fn endutxent
|
|
|
|
functions.
|
Add a new library: libulog.
One of the things I really want to do, is to get rid of the limitations
of our current utmp(5) mechanism:
- It only allows 8 byte TTY device names.
- The hostname only allows 16 bytes of storage.
I'm not a big fan of <utmpx.h>, but I think we should at least try to
add parts of it. Unfortunately we cannot implement <utmpx.h>, because we
miss various fields, such as ut_id, ut_pid, etc. The API provided by
libulog shares some similarities with <utmpx.h>, so it shouldn't be too
hard to port these applications eventually. In most simple cases, it
should just be a matter of removing the ulog_ prefix everywhere.
As a bonus, it also implements a function called ulog_login_pseudo(),
which allows unprivileged applications to write log entries, provided
they have a valid file descriptor to a pseudo-terminal master device.
libulog will allow a smoother transition to a new file format by adding
a library interface to deal with utmp/wtmp/lastlog files. I initially
thought about adding the functionality to libutil, but because I'm not
planning on keeping this library around forever, we'd better keep it
separated.
Next items on the todo list:
1. Port applications in the base system (and ports) to libulog, instead
of letting them use <utmp.h>.
2. Remove <utmp.h>, implement <utmpx.h> and reimplement this library on
top.
3. Port as many applications as possible back to <utmpx.h>.
2009-12-03 15:48:24 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
These functions appeared in
|
|
|
|
.Fx 9.0 .
|