Martin Mares [Fri, 13 Feb 2009 23:36:27 +0000 (00:36 +0100)]
Logging: Introduce use counts on streams.
It turned out to be quite inconvenient to have to close the substreams in
topological order. I have introduced use counts on all streams: A newly
created stream has use count of 1, whenever it is used as a substream,
the use count increases; when the count drops to 0, the stream is
automatically destroyed.
A slightly unpleasant side-effect is that the default log stream
can no longer be constant, since we modify its counter.
I have also extended log_rm_substream() to remove all substreams
when what==NULL. This is useful in log_close_stream() and also
in log_file().
Martin Mares [Fri, 13 Feb 2009 18:47:00 +0000 (19:47 +0100)]
Logging: Introduced struct log_msg.
The logging handlers and filters are often interested in various properties
of the message in their raw form. I have modified the hooks to accept
a single pointer to `struct log_msg', which contains all needed information.
An immediate consequence is that we no longer need the calls to time() in
log-file, so a message is always timestamped at a single place when entering
the log machinery.
Martin Mares [Fri, 13 Feb 2009 18:32:48 +0000 (19:32 +0100)]
Logging: Resurrected the log_file() interface.
It is still useful for programs that use just a single log file. It creates
a new file stream and connects it as a substream of stream #0, replacing
the previous substreams.
Also keep fd #2 as a duplicate of the log file fd, so that errors of exec'd
programs will not be lost.
Martin Mares [Fri, 13 Feb 2009 18:20:47 +0000 (19:20 +0100)]
Logging: Rewritten the log-file module to implement log switching.
o log-file is a cross between the old libucw code and Tom's version.
o Introduced log_stream->udata for backend's flags.
o log_fork() moved to log.c.
o log_switch() and log_file() are not implemented yet.
Martin Mares [Fri, 13 Feb 2009 17:12:39 +0000 (18:12 +0100)]
Logging: Clean up log-stream.c.
o Simplified log_new_stream() -- recycling of closed streams
and allocation of new streams are two different code paths now.
o The calls to log_init_module() need not be conditional.
o Use clist_init() for initializing clists.
o The usual coding style and namespace cleanups.
Also added an explanatory comment about the uninitialized state to log.c.
Martin Mares [Fri, 13 Feb 2009 16:52:31 +0000 (17:52 +0100)]
Logging: Cleanup of log.c
o log_progname[] moved to log_init()
o Both vmsg() and log_pass_msg() now allocate the buffer on the stack
if the message is smaller than 256 bytes.
o log_pid is used instead of repeated calls to getpid()
o sizeof(array) always preferred over repeated constants
o Many coding style cleanups to make the old and new code fit together.
o Namespace cleanups
o Updated comments
Martin Mares [Fri, 13 Feb 2009 16:22:43 +0000 (17:22 +0100)]
Logging: The Great Shuffle
I have split the new logging machinery to several files and started merging
it with the old logger.
The intention behind the split is that programs which do not create their
own log streams should include only <ucw/lib.h> (which brings only the minimum
set of symbols) and link only a minimalistic library module, while the programs
in need of the full power of the new logger include <ucw/log.h> and link with
all log-* modules.
I have also started renaming `ls_*' to `log_*', but so far only at a couple
of places.
(Beware, most parts of the trees are currently left in an uncompilable
state. Use `make obj/ucw/log-t' for a working test program.)
Martin Mares [Mon, 9 Feb 2009 20:04:13 +0000 (21:04 +0100)]
LibUCW: Let cf_reload() reload all configuration files.
When a program is started with `-C' and/or `-S' switches to override the
default configuration and cf_reload() was called afterwards, it destroyed
the custom configuration and loaded the default instead.
To avoid this problem, I have added a list of configuration entries which
remembers all config files loaded and all configuration fragments executed,
as long as they are performed in the `postpone_commit' mode. The reloader
then re-executes all these operations and it records them in the new pool.
Martin Mares [Sun, 25 Jan 2009 15:54:52 +0000 (16:54 +0100)]
UCW Configure: Evaluate INSTALL_xxx at time of configuration.
It is often necessary to substitute the paths to C sources and config
files, so they must be fully expanded and free of constructs specific
for the makefile language.
Also, we need CONFIG_DIR at the time of configuration.
Michal Vaner [Tue, 16 Dec 2008 13:53:49 +0000 (14:53 +0100)]
Fix config directory names in build system
The destination directory does not have to have the same name as the
source one and the source one does not have to be 'cf' all the time (in
the libsonly package, it isn't).
Robert Spalek [Thu, 27 Nov 2008 15:51:41 +0000 (07:51 -0800)]
make Sherlock compilable on Darwin without hacks due to missing direct IO
I define O_DIRECT flag to be 0 on Darwin, hence enabling direct IO will
have no effect. This ignoring will be silent. A clean solution (with
failure when enabled by the user) would be much more complicated and I just
wanna make Sherlock compilable on Darwin for desktop/debugging usage.
Robert Spalek [Thu, 27 Nov 2008 16:24:52 +0000 (08:24 -0800)]
make regex and asciidoc work on Darwin without hacking
- use $(PREFIX) when accessing files in /etc/asciidoc/...
on Darwin, we use /sw
- remove obsolete reference to internal regex library
- configure script makes sure the BSD library isn't used on Darwin due to
incompatibility
- document dependency on asciidoc
Robert Spalek [Thu, 27 Nov 2008 15:51:41 +0000 (07:51 -0800)]
make Sherlock compilable on Darwin without hacks due to missing direct IO
I define O_DIRECT flag to be 0 on Darwin, hence enabling direct IO will
have no effect. This ignoring will be silent. A clean solution (with
failure when enabled by the user) would be much more complicated and I just
wanna make Sherlock compilable on Darwin for desktop/debugging usage.
Robert Spalek [Thu, 27 Nov 2008 15:39:50 +0000 (07:39 -0800)]
allow libucw to depend on other libraries
I need it when CONFIG_PCRE is enabled. After the internal copy of a
reliable regexp library has been deleted from Sherlock source codes, I
cannot compile Sherlock on Darwin with the default libraries. Therefore I
have installed pcre, but it isn't automatically linked to everything yet.
Michal Vaner [Sun, 23 Nov 2008 16:31:50 +0000 (17:31 +0100)]
Options to include separate libraries in build
Added new options CONFIG_CHARSET and CONFIG_SHERLOCK_LIB to makefiles &
configure. CONFIG_UCW_ONLY now works only as a shortcut for excluding
all other libraries.
Updated libs-only distribution and libsonly custom to use these
switches.
Martin Mares [Fri, 21 Nov 2008 19:24:53 +0000 (20:24 +0100)]
Shared library building features from Ego.
(1) SO_RUNDIR can be used to choose the place in the run tree where
the .so should be installed.
(2) lib-flags is used, so shared libs can directly depend on other shared
libs if needed. (This is useful for building shared libs that do not
use pkgconfig themselves -- e.g., Perl/Python modules.)
Michal Vaner [Mon, 17 Nov 2008 15:00:35 +0000 (16:00 +0100)]
Libucw logo
The web contains rendered png version, since it is nightmare to force a
browser to resize a svg image. One could think it should be the other way
around...