Martin Mares [Thu, 7 Oct 2010 14:58:43 +0000 (16:58 +0200)]
UCW::Configure::C: de-reference CPU_ARCH in COPT
Originally, when CONFIG_EXACT_CPU was enabled, COPT contained `-march=$(CPU_ARCH)',
which worked when it was used in a Makefile, but not when doing a test
compile in the configure script.
I changed it to dereference the variable immediately.
Martin Mares [Fri, 1 Oct 2010 18:57:25 +0000 (20:57 +0200)]
Added a clean way for building of static PIC libraries
Defining CONFIG_STATIC_PIC adds a dependency on *-pic.a
to every pkg-config file. In addition to that, the .pc
files now contain a "picsuffix" variable which can be
overridden by the user to enable the PIC mode.
Martin Mares [Mon, 19 Jul 2010 15:27:12 +0000 (17:27 +0200)]
UCW::CGI: Support multiple argument tables
(1) parse_args() can be called multiple times with different
argument tables, so that different parts of a single script
can fetch their own arguments without cluttering the main
argument table. The only catch is that uploaded files must
be defined in the main argument table (i.e., the first one used).
(2) self_ref() and self_form() accepts optional argument tables
which are merged to the main one.
Daniel Fiala [Mon, 2 Aug 2010 17:54:13 +0000 (19:54 +0200)]
Minor fixes to strtonum.
* Removed nested function from strtonum-gen.h .
* Error messages are not saved in separate static variables.
* Octal numbers can be detected by prefix '0[0-7]...' (this feature is enabled by STN_OCT0).
* One-command blocks are not enclosed by { ... } .
* STN_ZCHAR renamed to STN_WHOLE.
Martin Mares [Thu, 22 Jul 2010 13:32:49 +0000 (15:32 +0200)]
Use thread-local storage of GCC 4.x
ucw/threads.c can now work in three different modes:
o non-threaded
o threaded with context in pthread per-thread storage
o threaded with context stored as __thread
I had to make a backward-incompatible change: ucwlib_context->thread_id
is no longer accessible directly (because I do not know of any way how
to initialize it in the __thread mode) and a wrapper function should
be used.
Pavel Charvat [Wed, 16 Jun 2010 18:10:25 +0000 (20:10 +0200)]
mainloop: Improved deletion and insertion of hooks.
It is now guaranted that:
* You can safely remove hook anytime, even from other hook.
* Newly inserted hook will be called at least once before next sleep.
Daniel Fiala [Fri, 14 May 2010 15:11:23 +0000 (17:11 +0200)]
strtonum: Fixed minor errors.
* Removed declarations of undefined conversion functions.
* Added inline conversion functions for signed integers.
* Moved branche for checking whether number is terminated by 0 character.
Pavel Charvat [Sat, 4 Jul 2009 14:27:00 +0000 (16:27 +0200)]
Improved building of centrum-sherlock-* packages.
* Added sherlock build system to centrum-sherlock-lib-dev.
* We now use custom INSTALL_*_DIR options to avoid replacing of paths everywhere.
* Resulting .tar.gz contains entire sherlock tree.
Martin Mares [Sun, 22 Feb 2009 10:41:13 +0000 (11:41 +0100)]
Config: If cf_def_file is NULL, initialize the configuration.
Otherwise we end up uninitialized clists and other nasty stuff. (The problems
were rarely visible, but the recent changes to conf-input.c have caused some
extra commits, which crashed when no configuration was loaded.)
This is a departure from the behavior of LibUCW 3.12, but I think we should
guarantee that after cf_getopt(), the configuration is always in a consistent
state, meaning that it has been initialized and committed. This should not
depend on whether the default config file was loaded or not.
On the other hand, program which avoid cf_getopt() and call cf_load() are on
their own, there is no implicit commit for them yet. Maybe this should be
fixed, too.
Martin Mares [Sat, 21 Feb 2009 21:05:29 +0000 (22:05 +0100)]
Logging: Let log_new_file() and log_new_fd() accept flags.
This way, we can request a stream cloned to stderr (originally, this was
available only via log_file()) or a FD-based stream which closes the FD
upon closing.
Martin Mares [Sat, 21 Feb 2009 19:31:30 +0000 (20:31 +0100)]
Logging: Write a note when some messages fall victim to limiting.
I was considering various shapes of this message. It is tempting to mention
the number of dropped messages, but that has to be done at the time of
an accepted message, which could be too late (the user might already have
wondered about the fate of the missing messages).
Second, I wanted to include a message type, but it would be misleading,
since a single limiter can apply to more types at once with a common bucket.
Martin Mares [Fri, 20 Feb 2009 15:54:09 +0000 (16:54 +0100)]
Logging: L_SIGHANDLER should be really safe.
I have realized that many operations performed by the log stream code are
either unsafe to call from signal handlers, subject to races between the
main program and its signal handlers, or subject to deadlocks when the
ucwlib_lock is taken.
I have therefore changed the semantics of L_SIGHANDLER to provide only
the minimal logging service: All sighandler messages are now logged to
stderr (which usually follows the main log file) and they are limited
to 255 characters (so that no dynamic allocation is performed).
Martin Mares [Thu, 19 Feb 2009 17:48:23 +0000 (18:48 +0100)]
Logging: Report logging errors.
Introduce an analogue of the infamous "Error while printing error message" :-)
When logging to a stream fails, the error is reported to the default stream,
but there are two precautions against infinite loops and floods of error
messages. First, we never report an error when logging of an error fails.
Second, we report only the first failure of a stream.
It is also possible to request program termination when logging fails.
Martin Mares [Thu, 19 Feb 2009 17:03:14 +0000 (18:03 +0100)]
Logging: Fixed a bug in log_close_all().
Under some circumstances (involving loops in substream structure),
log_close_all() crashed, because a stream could have become freed
when removing its substreams.
I have changed log_close_all() to unlink all substreams first and
then proceed with deallocating memory.
The same problem can never occur in simple log_close_stream(),
because a stream that is a part of a loop never gets a use count of 0.