libusual.git
16 years agoReorg of compat code.
Marko Kreen [Wed, 2 Sep 2009 12:19:05 +0000 (15:19 +0300)]
Reorg of compat code.

Instead if usual/compat.[ch] and usual/win32.h, the compat code is
now merged with 'theme' modules:

  <usual/base.h>
  <usual/fileutil.h>
  <usual/signal.h>
  <usual/socket.h>
  <usual/string.h>
  <usual/time.h>

New 'theme include' concept mean those include bunch of related
system includes, provide compat funtions for missing system
functionality in addition to providing new APIs.

End result should be that user code does not need have several
'#ifdef HAVE..H' around system includes, instead it can just
include theme include to get all related functionality.

16 years agocfparser: allow * section that matches any name
Marko Kreen [Wed, 2 Sep 2009 12:18:30 +0000 (15:18 +0300)]
cfparser: allow * section that matches any name

16 years agoevent: allow use of real libevent
Marko Kreen [Wed, 2 Sep 2009 12:03:40 +0000 (15:03 +0300)]
event: allow use of real libevent

16 years agoheap: instead macro, use inline for elem comparision
Marko Kreen [Wed, 2 Sep 2009 12:02:42 +0000 (15:02 +0300)]
heap: instead macro, use inline for elem comparision

16 years agousual.m4: detect real libevent
Marko Kreen [Wed, 2 Sep 2009 12:00:47 +0000 (15:00 +0300)]
usual.m4: detect real libevent

16 years agofind_modules: automatic detection of used modules.
Marko Kreen [Wed, 2 Sep 2009 09:14:55 +0000 (12:14 +0300)]
find_modules: automatic detection of used modules.

It's a shell script to parse out used libusual modules
from user source files.  So instead:

  USUAL_DIR =
  USUAL_MODULES =

user can do

  USUAL_DIR =
  USUAL_LOCAL_SRCS =

where USUAL_LOCAL_SRCS contains source files, both .c and .h,
that include libusual files.  Then Setup.mk will launch find_modules
to get actually used list of modules.

16 years agosocket: Undefined variable when setting SO_NOSIGPIPE
Marko Kreen [Thu, 27 Aug 2009 08:19:43 +0000 (11:19 +0300)]
socket: Undefined variable when setting SO_NOSIGPIPE

Reshuffle code to have val defined only when SO_NOSIGPIPE
is available.

Reported-by: Khee Chin
16 years agoAdapt compat.c to newer debian sid glibc, per comment from Marko
Dimitri Fontaine [Wed, 8 Jul 2009 14:55:52 +0000 (16:55 +0200)]
Adapt compat.c to newer debian sid glibc, per comment from Marko

16 years agostring: strlist, parse_word_list
Marko Kreen [Wed, 13 May 2009 11:51:43 +0000 (14:51 +0300)]
string: strlist, parse_word_list

16 years agombuf: memory buffer
Marko Kreen [Wed, 15 Apr 2009 07:48:12 +0000 (10:48 +0300)]
mbuf: memory buffer

16 years agobase: unused, noinline attribs
Marko Kreen [Mon, 20 Apr 2009 03:56:21 +0000 (06:56 +0300)]
base: unused, noinline attribs

16 years agoevent: disable signals when executing handler
Marko Kreen [Mon, 20 Apr 2009 03:53:31 +0000 (06:53 +0300)]
event: disable signals when executing handler

16 years agocfparser: allow both abs and relative pointers
Marko Kreen [Sun, 19 Apr 2009 08:39:35 +0000 (11:39 +0300)]
cfparser: allow both abs and relative pointers

16 years agoPrepare libusual for pgbouncer: autoconf/win32
Marko Kreen [Sat, 18 Apr 2009 22:02:51 +0000 (01:02 +0300)]
Prepare libusual for pgbouncer: autoconf/win32

- Generate usual/config.h via autoconf.
- m4/usual.m4 for common autoconf macros
- include base.h in all headers
- base.h includes config.h
- Import win32 compat from pgbouncer: usual/compat.[ch] + usual/win32.h
- time.[ch] uses usec_t instead of timeval now
- md5 detects endianess via AC_BIGENDIAN
- Include <usual/compat.h> where needed.

16 years agoevent: use new heap
Marko Kreen [Wed, 15 Apr 2009 16:10:55 +0000 (19:10 +0300)]
event: use new heap

Heap is better structure for keeping track of timeouts than tree.

16 years agoheap: small binary heap implementation
Marko Kreen [Wed, 15 Apr 2009 12:43:11 +0000 (15:43 +0300)]
heap: small binary heap implementation

Useful for keeping track of timeouts.

16 years agoevent: simplify timeout handling by using usec_t internally
Marko Kreen [Tue, 14 Apr 2009 21:52:40 +0000 (00:52 +0300)]
event: simplify timeout handling by using usec_t internally

Using usec_t for internal timeout handling gets rid of
lot of complex code for managing 'struct timeval'.

Also use per-base cached time to get rid of useless
gettimeofday() calls.

16 years agoevent: Cleanups and more comments
Marko Kreen [Tue, 14 Apr 2009 20:59:40 +0000 (23:59 +0300)]
event: Cleanups and more comments

- more comments
- event_add: dont allow flags=0 and no timeout
- signal callback: dont do sig_close() there on random errors,
  seems too dangerous.
- signal callback: just in case, drain the socket in loop

16 years agocomplain once when unable to open log file.
Martin Pihlak [Tue, 14 Apr 2009 11:58:43 +0000 (14:58 +0300)]
complain once when unable to open log file.

16 years agofileutil: missing stdlib.h include
Marko Kreen [Mon, 13 Apr 2009 11:25:23 +0000 (14:25 +0300)]
fileutil: missing stdlib.h include

It was not needed when debugging as base.h
includes it then.

16 years agoYet another utility library
Marko Kreen [Mon, 13 Apr 2009 09:59:18 +0000 (12:59 +0300)]
Yet another utility library