diff options
author | Ruslan Ermilov <ru@FreeBSD.org> | 2008-04-10 14:02:00 +0000 |
---|---|---|
committer | Ruslan Ermilov <ru@FreeBSD.org> | 2008-04-10 14:02:00 +0000 |
commit | a1e0a00fd282d194858e57fb08d9efd4ed01102d (patch) | |
tree | 08171cd5f7f3cfcc90cd88fcd154a1b62c030992 | |
parent | 9f82379c24da01a791b10154df1948893d56c3c0 (diff) | |
download | src-test2-a1e0a00fd282d194858e57fb08d9efd4ed01102d.tar.gz src-test2-a1e0a00fd282d194858e57fb08d9efd4ed01102d.zip |
Notes
-rw-r--r-- | usr.sbin/fifolog/Makefile | 7 | ||||
-rw-r--r-- | usr.sbin/fifolog/Makefile.inc | 11 | ||||
-rw-r--r-- | usr.sbin/fifolog/fifolog_create/Makefile | 22 | ||||
-rw-r--r-- | usr.sbin/fifolog/fifolog_create/fifolog.1 | 132 | ||||
-rw-r--r-- | usr.sbin/fifolog/fifolog_reader/Makefile | 17 | ||||
-rw-r--r-- | usr.sbin/fifolog/fifolog_writer/Makefile | 16 | ||||
-rw-r--r-- | usr.sbin/fifolog/lib/Makefile | 16 |
7 files changed, 106 insertions, 115 deletions
diff --git a/usr.sbin/fifolog/Makefile b/usr.sbin/fifolog/Makefile index 596410c06e57..59ac9fe80701 100644 --- a/usr.sbin/fifolog/Makefile +++ b/usr.sbin/fifolog/Makefile @@ -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 diff --git a/usr.sbin/fifolog/Makefile.inc b/usr.sbin/fifolog/Makefile.inc index f62f5895fc34..7fb2a9e805c0 100644 --- a/usr.sbin/fifolog/Makefile.inc +++ b/usr.sbin/fifolog/Makefile.inc @@ -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" diff --git a/usr.sbin/fifolog/fifolog_create/Makefile b/usr.sbin/fifolog/fifolog_create/Makefile index 0c4bd65492c6..8b59b25ed251 100644 --- a/usr.sbin/fifolog/fifolog_create/Makefile +++ b/usr.sbin/fifolog/fifolog_create/Makefile @@ -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> diff --git a/usr.sbin/fifolog/fifolog_create/fifolog.1 b/usr.sbin/fifolog/fifolog_create/fifolog.1 index 91d1877abc47..e75457790e55 100644 --- a/usr.sbin/fifolog/fifolog_create/fifolog.1 +++ b/usr.sbin/fifolog/fifolog_create/fifolog.1 @@ -24,18 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd Feb 9, 2008 -.Os FreeBSD 8.0 -.Dt FIFOLOG 1 +.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 @@ -43,7 +37,7 @@ .Op Fl s Ar size .Ar file .Nm fifolog_reader -.Op Fl t +.Op Fl t .Op Fl b Ar tstart .Op Fl B Ar Tstart .Op Fl e Ar tend @@ -70,35 +64,40 @@ 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. +.Fl s +options do not specify otherwise. .Pp -.Nm Fifolog_writer -will read standard input and write it to the end of the fifolog +The +.Nm fifolog_writer +utility +will read standard input and write it to the end of the fifolog according to the parameters given. .Pp Writes happen whenever the output buffer is filled with compressed @@ -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,27 +113,29 @@ 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 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 +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 It is possible to specify a start and end time to limit the amount -of data +of data .Nm fifolog_reader will report. The lower-case variants @@ -142,69 +143,76 @@ 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 is with -.Xr syslogd 8 +.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 . diff --git a/usr.sbin/fifolog/fifolog_reader/Makefile b/usr.sbin/fifolog/fifolog_reader/Makefile index 07c5b7dbf9e4..7dcc8c2e2f17 100644 --- a/usr.sbin/fifolog/fifolog_reader/Makefile +++ b/usr.sbin/fifolog/fifolog_reader/Makefile @@ -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> diff --git a/usr.sbin/fifolog/fifolog_writer/Makefile b/usr.sbin/fifolog/fifolog_writer/Makefile index 76130851bd5e..b6ceb6312319 100644 --- a/usr.sbin/fifolog/fifolog_writer/Makefile +++ b/usr.sbin/fifolog/fifolog_writer/Makefile @@ -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> diff --git a/usr.sbin/fifolog/lib/Makefile b/usr.sbin/fifolog/lib/Makefile index fedfc50de3d5..c10126fd1d24 100644 --- a/usr.sbin/fifolog/lib/Makefile +++ b/usr.sbin/fifolog/lib/Makefile @@ -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} |