1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-24 07:40:52 +00:00

Clean up makefiles and a manpage.

OK'ed by:	phk
This commit is contained in:
Ruslan Ermilov 2008-04-10 14:02:00 +00:00
parent 9f82379c24
commit a1e0a00fd2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=178068
7 changed files with 106 additions and 115 deletions

View File

@ -1,10 +1,5 @@
# $FreeBSD$
VERSION_MAJOR = 1
VERSION_MINOR = 1
SUBDIR = lib fifolog_create fifolog_writer fifolog_reader
SUBDIR= lib fifolog_create fifolog_writer fifolog_reader
.include <bsd.subdir.mk>
test: _SUBDIR

View File

@ -1,13 +1,10 @@
# $FreeBSD$
LIBFIFOLOG = ${.OBJDIR}/../lib/libfifolog.a
LIBFIFOLOG= ${.OBJDIR}/../lib/libfifolog.a
WARNS?= 6
WARNS ?= 6
# CFLAGS += -O0 -g
# LINT = flint
# LINTFLAGS = ${.CURDIR}/../flint.lnt -I/usr/include
#LINT= flint
#LINTFLAGS= ${.CURDIR}/../flint.lnt -I/usr/include
.include "../Makefile.inc"

View File

@ -1,22 +1,22 @@
# $FreeBSD$
PROG = fifolog_create
PROG= fifolog_create
CFLAGS += -I${.CURDIR}/../lib
CFLAGS+= -I${.CURDIR}/../lib
DPADD = ${LIBFIFOLOG} ${LIBUTIL}
LDADD = ${LIBFIFOLOG} -lutil
DPADD= ${LIBFIFOLOG} ${LIBUTIL}
LDADD= ${LIBFIFOLOG} -lutil
MAN = fifolog.1
MLINKS += fifolog.1 fifolog_create.1
MLINKS += fifolog.1 fifolog_reader.1
MLINKS += fifolog.1 fifolog_writer.1
MAN= fifolog.1
MLINKS= fifolog.1 fifolog_create.1 \
fifolog.1 fifolog_reader.1 \
fifolog.1 fifolog_writer.1
.include <bsd.prog.mk>
test: ${PROG}
regress:
rm -f /tmp/fifolog.?
./${PROG} /tmp/fifolog.0
./${PROG} -s 10m /tmp/fifolog.1
./${PROG} -l 1k /tmp/fifolog.2
./${PROG} -r 1k /tmp/fifolog.3
.include <bsd.prog.mk>

View File

@ -24,18 +24,12 @@
.\"
.\" $FreeBSD$
.\"
.Dd Feb 9, 2008
.Os FreeBSD 8.0
.Dd February 9, 2008
.Os
.Dt FIFOLOG 1
.Sh NAME
.Nm fifolog_create
.Nd Initialize storage for fifolog
.br
.Nm fifolog_write
.Nd Write data to fifolog
.br
.Nm fifolog_read
.Nd Seek and extract data from fifolog
.Nm fifolog_create , fifolog_write , fifolog_read
.Nd "initialize, write, seek and extract data from a fifolog"
.Sh SYNOPSIS
.Nm fifolog_create
.Op Fl l Ar record-size
@ -70,34 +64,39 @@ timestamps before it is written to storage, such that it is possible
to seek out a particular time interval in the stored data, without
having to decompress the entire logfile.
.Pp
.Nm Fifolog_create
The
.Nm fifolog_create
utility
is used to initialize the first sector of a disk device
or filesystem file to make it a fifolog and should be called only
or file system file to make it a fifolog and should be called only
once.
.Pp
Running
.Nm
.Nm fifolog_create
on an existing fifolog will reset it so that
.Nm fifolog_reader
and
.Nm fifolog_writer
will not see the previous contents.
(The previos contents is not physically erased, and with a bit
of hand-work, all but the first record can be easily recovered).
(The previous contents are not physically erased, and with a bit
of hand-work all but the first record can be easily recovered.)
.Pp
If the file does not already exist
If the
.Ar file
does not already exist,
.Nm
will attempt to create and
.Xr ftruncate 3
.Xr ftruncate 2
it to the specified size, defaulting to 86400 records of 512 bytes
if the
.Fl r ,
.Fl l
.Fl r , l
or
.Fl s
arguments do not specify otherwise.
options do not specify otherwise.
.Pp
.Nm Fifolog_writer
The
.Nm fifolog_writer
utility
will read standard input and write it to the end of the fifolog
according to the parameters given.
.Pp
@ -106,7 +105,7 @@ data or when either of two timers expire, forcing a partially filled
buffer to be written.
.Pp
The first and faster timer,
.Fl w write-rate ,
.Fl w Ar write-rate ,
forces available data to be written
but does not flush and reset the compression dictionary.
This timer is intended to minimize the amount of logdata lost in RAM
@ -114,7 +113,7 @@ in case of a crash and by default it fires 10 seconds after
the previous write.
.Pp
The second and slower timer,
.Fl s sync-rate ,
.Fl s Ar sync-rate ,
forces a full flush and reset of the compression
engine and causes the next record written to be a synchronization
point with an uncompressed timestamp, making it possible to start
@ -122,14 +121,16 @@ reading the logfile from that record.
By default this timer fires a minute after the previous sync.
.Pp
The
.Fl z compression
argument controls the
.Fl z Ar compression
option controls the
.Xr zlib 3
compression level, legal values are zero to nine which is the default.
compression level; legal values are zero to nine which is the default.
.Pp
.Nm Fifolog_reader
The
.Nm fifolog_reader
utility
will retrieve records from the fifolog according to the specified
parameters and write them either to stdout or the file specified
parameters and write them either to standard output or the file specified
with
.Fl o .
.Pp
@ -142,56 +143,60 @@ The lower-case variants
and
.Fl e
take a
.Xr time_t
.Vt time_t
value, whereas the upper-case variants
.Fl B
and
.Fl E
take human redable specifications such as "1 hour ago".
take human-readable specifications such as
.Dq Li "1 hour ago" .
.Pp
The
.Fl t
argument forces timestamps to be formatted as "YYYYMMDDhhmmss" instead
of as time_t, and
option forces timestamps to be formatted as
.Dq Li "YYYYMMDDhhmmss"
instead of as
.Vt time_t ,
and
.Fl T
allows the specification of a
allows the specification of an
.Xr strftime 3
formatting string.
.Pp
Finally, records can be filtered such that only records matching the
(REG_BASIC) regular expression specified with
.Pq Dv REG_BASIC
regular expression specified with
.Fl R
is output.
are output.
.Sh IMPLEMENTATION NOTES
The data stored in the fifolog consists of three layers, an outher
The data stored in the fifolog consists of three layers, an outer
layer that allows searches to synchronization points based on timestamps
without having to decompress and decode the actual contents, a
compression layer implemented with
.Xr zlib 3
.Xr zlib 3 ,
and an inner serialization and timestamping layer.
.Pp
The exact encoding is described in the fifolog.h file.
The exact encoding is described in the
.Pa fifolog.h
file.
.Pp
Fifolog is particularly well suited for use on Flash based media, where
it results in much lower write-wear, than a filesystem with regular
logfiles rotated with
it results in much lower write-wear, than a file system with regular
log files rotated with
.Xr newsyslog 8
etc.
.Sh EXAMPLES
Create a fifolog with 1024*1024 records of 512 bytes:
.Bd -literal
fifolog_create -r 10m /tmp/fifolog
.Ed
.Pp
.Dl "fifolog_create -r 10m /tmp/fifolog"
.Pp
Write a single record to this file:
.Bd -literal
date | fifolog_writer /tmp/fifolog
.Ed
.Pp
.Dl "date | fifolog_writer /tmp/fifolog"
.Pp
Read it back with human readable timestamps:
.Bd -literal
fifolog_reader -t /tmp/fifolog
.Ed
.Pp
.Dl "fifolog_reader -t /tmp/fifolog"
.Pp
One particular useful use of
.Nm fifolog_writer
@ -199,12 +204,15 @@ is with
.Xr syslogd 8
using a line such as this in
.Xr /etc/syslog.conf 5 :
.Bd -literal
*.* |fifolog_writer /var/log/syslog_fifolog
.Ed
.Pp
.Dl "*.* |fifolog_writer /var/log/syslog_fifolog"
.Sh HISTORY
The fifolog tools have been liberated from an open source SCADA applications
called "measured", which monitors and controls remote radio navigation
The fifolog tools have been liberated from an open source
.Tn SCADA
applications called
.Dq measured ,
which monitors and controls remote radio navigation
transmitters for the Danish Air Traffic Control system.
.Sh AUTHORS
The fifolog tools were written by Poul-Henning Kamp
The fifolog tools were written by
.An Poul-Henning Kamp .

View File

@ -1,17 +1,15 @@
# $FreeBSD$
PROG = fifolog_reader
PROG= fifolog_reader
CFLAGS += -I${.CURDIR}/../lib -I${.CURDIR}
CFLAGS+= -I${.CURDIR}/../lib
NO_MAN = see ../fifolog_create/fifolog.1
NO_MAN= # see ../fifolog_create/fifolog.1
DPADD = ${LIBFIFOLOG} ${LIBUTIL} ${LIBZ}
LDADD = ${LIBFIFOLOG} -lutil -lz
DPADD= ${LIBFIFOLOG} ${LIBUTIL} ${LIBZ}
LDADD= ${LIBFIFOLOG} -lutil -lz
.include <bsd.prog.mk>
test: ${PROG}
regress:
./${PROG} /tmp/fifolog.0
./${PROG} -t /tmp/fifolog.0
./${PROG} /tmp/fifolog.1
@ -19,5 +17,4 @@ test: ${PROG}
./${PROG} -T "%y%m%d-%H%M%S" /tmp/fifolog.1
./${PROG} -T "" /tmp/fifolog.1
t2:
./${PROG} -t /critter/10.1.29.74.fifolog
.include <bsd.prog.mk>

View File

@ -1,16 +1,16 @@
# $FreeBSD$
PROG = fifolog_writer
PROG= fifolog_writer
CFLAGS += -I${.CURDIR}/../lib
CFLAGS+= -I${.CURDIR}/../lib
NO_MAN = see ../fifolog_create/fifolog.1
NO_MAN= # see ../fifolog_create/fifolog.1
DPADD = ${LIBFIFOLOG} ${LIBUTIL} ${LIBZ}
LDADD = ${LIBFIFOLOG} -lutil -lz
DPADD= ${LIBFIFOLOG} ${LIBUTIL} ${LIBZ}
LDADD= ${LIBFIFOLOG} -lutil -lz
.include <bsd.prog.mk>
test: ${PROG}
regress:
date | ./${PROG} -z 0 /tmp/fifolog.0
lptest 65 | ./${PROG} -z 9 /tmp/fifolog.1
.include <bsd.prog.mk>

View File

@ -1,17 +1,11 @@
# $FreeBSD$
LIB = fifolog
INTERNALLIB = API not published or supported.
LIB= fifolog
INTERNALLIB= # API not published or supported.
SRCS += fifolog_int.c
SRCS += fifolog_create.c
SRCS += fifolog_write_poll.c
SRCS += fifolog_reader.c
SRCS += getdate.y
SRCS= fifolog_int.c fifolog_create.c fifolog_write_poll.c fifolog_reader.c
SRCS+= getdate.y
CFLAGS += -I${.CURDIR}
CFLAGS+= -I${.CURDIR}
.include <bsd.lib.mk>
test:
echo ${HAS_EXPAND_NUMBER}