head	1.8;
access;
symbols
	RELENG_9_1_0_RELEASE:1.7.2.1.4.2
	RELENG_9_1:1.7.2.1.0.4
	RELENG_9_1_BP:1.7.2.1
	RELENG_9_0_0_RELEASE:1.7.2.1.2.1
	RELENG_9_0:1.7.2.1.0.2
	RELENG_9_0_BP:1.7.2.1
	RELENG_9:1.7.0.2
	RELENG_9_BP:1.7;
locks; strict;
comment	@# @;


1.8
date	2012.11.17.01.50.04;	author svnexp;	state Exp;
branches;
next	1.7;

1.7
date	2010.01.13.18.53.06;	author ed;	state Exp;
branches
	1.7.2.1;
next	1.6;

1.6
date	2010.01.13.17.29.55;	author ed;	state Exp;
branches;
next	1.5;

1.5
date	2010.01.02.09.58.07;	author ed;	state Exp;
branches;
next	1.4;

1.4
date	2009.12.07.05.57.28;	author ed;	state Exp;
branches;
next	1.3;

1.3
date	2009.12.06.20.30.21;	author ed;	state Exp;
branches;
next	1.2;

1.2
date	2009.12.05.19.53.29;	author ed;	state Exp;
branches;
next	1.1;

1.1
date	2009.12.03.15.48.24;	author ed;	state Exp;
branches;
next	;

1.7.2.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.7.2.1.2.1
	1.7.2.1.4.1;
next	1.7.2.2;

1.7.2.2
date	2012.11.17.11.36.26;	author svnexp;	state Exp;
branches;
next	;

1.7.2.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.7.2.1.2.2;

1.7.2.1.2.2
date	2012.11.17.08.36.27;	author svnexp;	state Exp;
branches;
next	;

1.7.2.1.4.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.7.2.1.4.2;

1.7.2.1.4.2
date	2012.11.17.08.47.16;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.8
log
@Switching exporter and resync
@
text
@# $FreeBSD: head/lib/libulog/Makefile 202215 2010-01-13 18:53:06Z ed $

SHLIBDIR?=/lib

.include <bsd.own.mk>

LIB=	ulog
SHLIB_MAJOR= 0
INCS=	ulog.h utempter.h
SRCS=	ulog.h ulog_login.c ulog_login_pseudo.c utempter.c

MAN=	ulog_login.3 utempter_add_record.3
MLINKS+=ulog_login.3 ulog_login_pseudo.3 \
	ulog_login.3 ulog_logout.3 \
	ulog_login.3 ulog_logout_pseudo.3 \
	utempter_add_record.3 utempter_remove_added_record.3 \
	utempter_add_record.3 utempter_remove_record.3 \
	utempter_add_record.3 addToUtmp.3 \
	utempter_remove_added_record.3 removeFromUtmp.3 \
	utempter_remove_record.3 removeLineFromUtmp.3

DPADD=	${LIBMD}
LDADD=	-lmd

VERSION_DEF= ${.CURDIR}/../libc/Versions.def
SYMBOL_MAPS= ${.CURDIR}/Symbol.map

.if ${MK_INSTALLLIB} != "no"
SYMLINKS+=libulog.a ${LIBDIR}/libutempter.a
.endif
.if !defined(NO_PIC)
SYMLINKS+=libulog.so ${LIBDIR}/libutempter.so
.endif
.if ${MK_PROFILE} != "no"
SYMLINKS+=libulog_p.a ${LIBDIR}/libutempter_p.a
.endif

.include <bsd.lib.mk>
@


1.7
log
@SVN rev 202215 on 2010-01-13 18:53:06Z by ed

Remove utmpx stub from libulog.

I'm not increasing the shlib major version for this, because not a
single application outside the base system should have used these
functions in such a short timespan.

Rewrite ulog_login(3) and ulog_logout(3) to build on top of the utmpx
implementation in libc.
@
text
@d1 1
a1 1
# $FreeBSD$
@


1.7.2.1
log
@SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.7.2.2
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242902
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242902 | dteske | 2012-11-11 23:29:45 +0000 (Sun, 11 Nov 2012) | 10 lines
## SVN ##
## SVN ## Fix a regression introduced by SVN r211417 that saw the breakage of a feature
## SVN ## documented in usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## Reviewed by:	adrian (co-mentor)
## SVN ## Approved by:	adrian (co-mentor)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d1 1
a1 1
# $FreeBSD: stable/9/lib/libulog/Makefile 202215 2010-01-13 18:53:06Z ed $
@


1.7.2.1.4.1
log
@SVN rev 239080 on 2012-08-05 23:54:33Z by kensmith

Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.

Approved by:	re (implicit)
@
text
@@


1.7.2.1.4.2
log
@Switch importer
@
text
@d1 1
a1 1
# $FreeBSD: releng/9.1/lib/libulog/Makefile 202215 2010-01-13 18:53:06Z ed $
@


1.7.2.1.2.1
log
@SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)
@
text
@@


1.7.2.1.2.2
log
@Switch importer
@
text
@d1 1
a1 1
# $FreeBSD: releng/9.0/lib/libulog/Makefile 202215 2010-01-13 18:53:06Z ed $
@


1.6
log
@SVN rev 202188 on 2010-01-13 17:29:55Z by ed

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>.
@
text
@d10 1
a10 2
SRCS=	ulog.h ulog_getutxent.c ulog_internal.h ulog_login.c \
	ulog_login_pseudo.c ulog_pututxline.c ulog_util.c utempter.c
d12 2
a13 7
MAN=	ulog_getutxent.3 ulog_login.3 ulog_setutxfile.3 \
	utempter_add_record.3
MLINKS+=ulog_getutxent.3 ulog_endutxent.3 \
	ulog_getutxent.3 ulog_getutxline.3 \
	ulog_getutxent.3 ulog_pututxline.3 \
	ulog_getutxent.3 ulog_setutxent.3 \
	ulog_login.3 ulog_login_pseudo.3 \
a15 1
	ulog_setutxfile.3 ulog_getutxuser.3 \
d22 3
@


1.5
log
@SVN rev 201381 on 2010-01-02 09:58:07Z by ed

Build lib/ with WARNS=6 by default.

Similar to libexec/, do the same with lib/. Make WARNS=6 the norm and
lower it when needed.

I'm setting WARNS?=0 for secure/. It seems secure/ includes the
Makefile.inc provided by lib/. I'm not going to touch that directory.
Most of the code there is contributed anyway.
@
text
@a28 7
# Add links to <utmpx.h>-style functions.
MLINKS+=ulog_endutxent.3 endutxent.3 \
	ulog_getutxent.3 getutxent.3 \
	ulog_getutxline.3 getutxline.3 \
	ulog_pututxline.3 pututxline.3 \
	ulog_setutxent.3 setutxent.3

@


1.4
log
@SVN rev 200203 on 2009-12-07 05:57:28Z by ed

Install libulog in /lib.

Because several applications in /bin use libulog (or may use it in the
nearby future), it must not live inside /usr. It seems like we don't
need to add the copy from /usr/lib to ObsoleteFiles.inc, because it's
cleaned up during installation of libulog automatically.

Reported by:	ume
@
text
@a35 2
WARNS?=	6

@


1.3
log
@SVN rev 200185 on 2009-12-06 20:30:21Z by ed

Add a libutempter compatibility interface to libulog.

The ulog_login_pseudo(3) and ulog_logout_pseudo(3) interfaces provide a
functionality identical to what libutempter has to offer. Just transform
libutempter's calls into the before mentioned functions.

libutempter doesn't work with utmpx, so instead of fixing I thought the
easiest way would be to integrate this functionality. libutempter is
used by applications like xterm and the KDE libraries, so if I ever
change the underlying file format, these applications will keep working
automatically.

Also increase __FreeBSD_version to indicate the addition (as well as the
import of libulog).
@
text
@d3 2
@


1.2
log
@SVN rev 200153 on 2009-12-05 19:53:29Z by ed

Massively extend libulog:

- Just like struct utmp, store strings inside struct utmpx itself. This
  is needed to make things like pututxline() work.
- Add ut_id and ut_pid fields, even though they have little use in our
  implementation.
- It turns out our "reboot" wtmp entries indicate a system boot, so
  remove REBOOT_TIME
- Implement getutxline() and pututxline
- Add getutxuser() and setutxfile(), which allows us to crawl wtmp and
  lastlog files as well.
- Add _ULOG_POSIX_NAMES, so we can already use the POSIX names if we
  really want to.
@
text
@d3 2
d7 1
a7 1
INCS=	ulog.h
d9 1
a9 1
	ulog_login_pseudo.c ulog_pututxline.c ulog_util.c
d11 2
a12 1
MAN=	ulog_getutxent.3 ulog_login.3 ulog_setutxfile.3
d20 6
a25 1
	ulog_setutxfile.3 ulog_getutxuser.3
d39 10
@


1.1
log
@SVN rev 200062 on 2009-12-03 15:48:24Z by ed

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>.
@
text
@d6 2
a7 2
SRCS=	ulog.h ulog_getutxent.c ulog_internal.h \
	ulog_login.c ulog_login_pseudo.c
d9 1
a9 1
MAN=	ulog_getutxent.3 ulog_login.3
d11 2
d16 9
a24 1
	ulog_login.3 ulog_logout_pseudo.3
@

