Commit Graph

316 Commits

Author SHA1 Message Date
Angus Salkeld
908bdfd172 IPC: add a new function to get (and alloc) the extended stats.
This should handle any further additions to the stats
as the library allocs the struct.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 20:20:29 +10:00
Angus Salkeld
c221922291 Revert "Add the event queue length to the connection stats."
This reverts commit 6b7da3f531.
2012-05-10 16:09:48 +10:00
Angus Salkeld
8ed5f55990 Cleanup the .gitignore files
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-09 21:43:58 +10:00
Angus Salkeld
916440d08d Remove HZ and use sysconf instead.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-09 21:38:38 +10:00
Angus Salkeld
259021414a SUN_LEN() macro is present if __EXTENSIONS__ is defined on Illumos
A bit reworked but originally from Igor Pashev:
84c47f8160

Note: __EXTENSIONS__ also defines _GNU_SOURCE, so removing it as well.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-09 21:37:04 +10:00
Angus Salkeld
6b7da3f531 Add the event queue length to the connection stats.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-01 13:22:16 +10:00
Angus Salkeld
b29326a363 IPC: add a is_connected client side function.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-01 12:43:22 +10:00
Angus Salkeld
154ccabdb5 docs: clarify the need to use request/response headers
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-01 12:14:58 +10:00
Angus Salkeld
1af214d91d Try and improve the portability on bsd variants.
Also add a QB_IPC_NATIVE type that selects the best ipc type available.

Signed-off-by: Angus <angus@anguss-mac-mini>
2012-03-24 22:43:37 +11:00
Angus Salkeld
d327ef7928 LOG: expose the mechanism to get a dynamic callsite.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-05 16:11:30 +11:00
Angus Salkeld
002f009941 Remove timerfd usage and go back to timelist.
timefd is using too much cpu and it is using up
file descriptors.

timelist is also more portable and now I have less
code to maintain.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-24 11:40:45 +11:00
Angus Salkeld
e37f801170 LOOP: add qb_loop_timer_is_running()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-22 11:08:42 +11:00
Angus Salkeld
446700aa66 LOOP: fix doxygen parameter comment
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-20 14:46:43 +11:00
Angus Salkeld
4dbfebbdbc LOG: add stdout target
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-20 14:46:43 +11:00
Angus Salkeld
70f1eb8130 LOOP: add a function to delete jobs
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 22:18:43 +11:00
Angus Salkeld
32fed9540a LOG: remove an old/incorrect doxygen comment.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 17:35:24 +11:00
Angus Salkeld
504e000cb8 LOG: add a hostname %H format specifier.
This is useful when logging to file on a cluster.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 17:34:45 +11:00
Angus Salkeld
ff0d89721f LOG: Add qb_log_filter_fn_set()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 15:40:58 +11:00
Angus Salkeld
7a6382f0b6 Use safer versions of string functions (strcpy -> strlcpy)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:49 +11:00
Angus Salkeld
ad4efc2005 LOG: pass the result of qb_log_thread_start() back to the user
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-03 14:37:37 +11:00
Angus Salkeld
63bdfd1b71 Add a split timer to the stopwatch.
This is just a re-work of Steve's sample patch.

You set the number of splits and whether they overwrite using
qb_util_stopwatch_split_ctl().

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-01 13:46:27 +11:00
Angus Salkeld
f6c5c5179d Deprecate qb_util_set_log_function()
And remove uses of it from the test programs

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-24 16:00:05 +11:00
Angus Salkeld
2f99276d16 IPC: add a context to the client interface
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-18 15:24:34 +11:00
Angus Salkeld
2d3d3eaae0 Make all headers self standing
So the user does not have to include any required headers.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-16 22:21:03 +11:00
Angus Salkeld
b5b9763459 make header protection more consistent.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-16 22:19:38 +11:00
Angus Salkeld
7eaa3dc09a LOG: add %P (pid) as a format option.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-09 16:03:15 +11:00
Angus Salkeld
b711f73ce7 LOG: add %N (log name) as a format option
This will log the name passed into qb_log_init()

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-09 16:02:53 +11:00
Angus Salkeld
5d8c96314e Allow the array to automatically grow.
this makes it a bit friendlier to use, as
the user will not have to call qb_array_grow().

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-04 21:40:03 +11:00
Angus Salkeld
f9200807eb map: add some introductory doxygen
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-04 17:35:24 +11:00
Andrew Beekhof
d90d56baf5 LOG: pass args directly into qb_log_from_external_source()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-21 14:42:12 +11:00
Angus Salkeld
ab3dc60f7f Merge some portability changes from the mingw branch
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-21 14:23:43 +11:00
Andrew Beekhof
61d166abbc Support compilation on Mac OSX
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-19 22:16:30 +11:00
Angus Salkeld
9efc82f4b2 trie: add a way to get node count and mem usage
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-18 22:52:29 +11:00
Angus Salkeld
e0c5187023 IPC: provide finer grained flowcontrol
this will allow the user to control the behaviour better.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-14 00:55:06 +11:00
Angus Salkeld
2da98acd42 MAP: add a notifier purely to allow the user to free memory.
At the moment if you have multiple notifiers it becomes impossible
to figure out when it is safe to free the values.

This new callback can only be added once and is called
once, making it better suited to freeing memory. It is
also called after the deleted and replaced notifiers.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-14 00:26:01 +11:00
Angus Salkeld
c9909f8cda Improve the stopwatch doxygen comments.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-07 12:24:47 +11:00
Angus Salkeld
ef77398738 Fix errors found by api-sanity-autotest
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 17:16:19 +11:00
Angus Salkeld
2d92af61c5 map: add qb_map_notify_del_2() which includes the userdata.
This allows you to match on the same fields that you provided
in the add. Now including the userdata.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 11:28:14 +11:00
Angus Salkeld
dfe624f5a9 examples: add ipc client/server
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-23 22:40:26 +11:00
Angus Salkeld
b9dc96e40b examples: Add tcpclient.c/tcpserver.c
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-23 22:40:26 +11:00
Angus Salkeld
e1e83aa746 Move simple-log.c to examples/
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-23 22:40:26 +11:00
Angus Salkeld
864e5c9c32 LOG: add stdarg to qblog.h
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-23 13:36:07 +11:00
Angus Salkeld
dc3a061e98 MAP: pass user_data to the callback correctly
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-16 13:31:31 +10:00
Angus Salkeld
d6e352fda5 MAP: add a more generic notification system
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-15 21:14:49 +10:00
Angus Salkeld
4780308fea MAP: add prefix iteration for the trie
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 20:54:39 +10:00
Angus Salkeld
61268e3cb9 MAP: improve the storage in the trie
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 17:09:20 +10:00
Angus Salkeld
57212c0e94 MAP: add a trie implementation
http://en.wikipedia.org/wiki/Trie

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-12 23:01:15 +10:00
Angus Salkeld
0a1c464514 LOG: add qb_log_filter_ctl2() so we can filter a range of priorities
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-09 14:09:02 +10:00
Angus Salkeld
46a8903826 LOG: fix QB_LOG_INIT_DATA
this is weird, but now it actually works

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-09 12:07:57 +10:00
Angus Salkeld
f5fcf2a30b LOG: add a way of getting the target state
This is so we can do the following:

for (t = 0; t < QB_LOG_TARGET_MAX; t++) {
    if (qb_log_ctl(t, QB_LOG_CONF_STATE_GET, 0) == QB_LOG_STATE_ENABLED) {
        // bla bla
    }
}

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-08 16:40:02 +10:00
Angus Salkeld
86f004d1ec map: add iterator that does't use a callback
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-07 12:05:15 +10:00
Angus Salkeld
4b594b522d MAP: change the keys from void* to char*
I think this is the most common usage and greatly
simplifies the api.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-07 09:47:49 +10:00
Angus Salkeld
0a50fe57e7 LOG: add facility conversion functions
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-07 09:47:49 +10:00
Angus Salkeld
2b7edd508d defs: better define va_copy
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-26 09:39:26 +10:00
Angus Salkeld
e1be00130c LOG: fix ansi build
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 14:11:43 +10:00
Angus Salkeld
94767b18b8 Initial map using either a skiplist or a hashtable
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 14:11:43 +10:00
Angus Salkeld
8f954cd115 Add a stop watch
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 13:28:15 +10:00
Angus Salkeld
1591075873 LOG: serialize the va_list, don't snprintf
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 10:29:48 +10:00
Angus Salkeld
e3b167819c atomic: fix qb_atomic_pointer macros
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-19 10:21:02 +10:00
Angus Salkeld
ea8dfea7a0 LOG: allow the thread priority to be set.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-07 22:37:42 +10:00
Angus Salkeld
bb1140fbd9 Add a qb_strerror_r wrapper.
This is to make the calling code more portable

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-07-14 10:41:46 +10:00
Angus Salkeld
638f75dbc5 LOG: add string.h to qblog.h
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-07-13 10:31:17 +10:00
Angus Salkeld
f4e2705e95 LOG: use strerror_r instead of strerror in qb_perror()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-27 15:57:51 +10:00
Angus Salkeld
001b4a078c LOOP: make the return more consistent in qb_loop_timer_expire_time_get()
If there is any error return 0
 (meaning the timer is or has expired)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-22 13:13:34 +10:00
Виноградов Василий
c3688ab19c Provide some helpful macros for iterating over lists.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-27 20:43:51 +10:00
Angus Salkeld
7ffd10326a Correct the declarations of some inlines
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-26 10:42:15 +10:00
Angus Salkeld
ebe8cd7008 Add support for ansi inline and typeof
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-26 10:41:06 +10:00
Angus Salkeld
048edde19c LOG: add custom targets
This is partly to make the tests more robusts and
to add some more flexibility to the logging.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-23 20:28:18 +10:00
Angus Salkeld
943b1c646b fix the FIXME's Jim pointed out
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-18 11:11:14 +10:00
Angus Salkeld
acf8c0e94f LOG: make the "entering" and "leaving" capital
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-13 10:05:12 +10:00
Angus Salkeld
2a83aa8dfe LOG: add an enter and leave trace function
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-06 10:54:20 +10:00
Angus Salkeld
46102fe43a LOG: include needed stdio.h
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-18 22:54:13 +10:00
Angus Salkeld
6f73dd2993 LOG: make all priorities uint8_t
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-18 22:54:13 +10:00
Angus Salkeld
ea2d5d4058 Add qbconfig.h to the list of headers to be installed.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 22:23:01 +10:00
Angus Salkeld
b7e83fd3b2 LOG: add dynamic callsites (for platforms that don't support __attribute__(section)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 16:05:38 +10:00
Angus Salkeld
4de5ff927f ARRAY: add getter's to retrieve number of bins and elms/bin
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 09:55:57 +10:00
Angus Salkeld
568befd3f1 LOG: add LOG_TRACE
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-12 22:21:57 +10:00
Angus Salkeld
78541f5198 LOG: add the ability to adjust the priority sent to syslog()
If you have:
qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD,
		  QB_LOG_FILTER_FILE, "hack.c", LOG_DEBUG);
these logs will not make there way to /var/log/messags
without reconfiguring syslog.

So to help on the fly debugging do the following:
qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_PRIORITY_BUMP,
	   LOG_INFO - LOG_DEBUG);

Now all messages that have the QB_LOG_SYSLOG target set
will have their priority bumped before going to syslog().

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-12 22:20:50 +10:00
Angus Salkeld
58697dbcc6 LOG: change the target type from uint32_t to int32_t.
This is so that you won't get warnings from mixing integer types.

I have updated the input checks in log.c to check for invalid
targets.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-09 23:11:44 +10:00
Angus Salkeld
249546a9e7 LOG: teach filter_ctl() to write tags
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:27:53 +10:00
Angus Salkeld
b5d27ad250 LOG: remove the tags arument from qb_log() and add qb_logt() which has the tags argument.
I think in most cases tags will not be used and it will
just be a pain inserting ", 0". But if someone wants to use
tags like this then they still can via qb_logt()

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:27:41 +10:00
Angus Salkeld
9aa50b2ece LOG: fix shared library callsites
This finds all the callsites in shared libraries
(using dl_iterate_phdr()) at the time qb_log_init()
is called.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>

Conflicts:

	lib/log.c
2011-04-06 22:09:46 +10:00
Angus Salkeld
9b18614473 LOG: add a callsite_dump() function to see what callsite are avaliable.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:06:01 +10:00
Angus Salkeld
aefae42937 LOG: support dynamically loaded modules
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 21:41:13 +10:00
Angus Salkeld
51a1153ecb Add required include to qbloop.h
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-04 11:09:16 +10:00
Angus Salkeld
b81d75fab5 LOG: make the documentation more meaningful
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-01 22:42:43 +11:00
Angus Salkeld
7f0d983f49 LOG: add a qb_log_fini() to cleanup
This replaces qb_log_thread_stop() but also release shared mem

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-01 14:50:51 +11:00
Angus Salkeld
e390613036 LOG: fix mapping from priority to name
Remove qb_log_priority_name_get() as we have the
formatting.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:38:08 +11:00
Angus Salkeld
191b71a8b7 LOG: add a new "tags" field
this is a tags that is used by the caller to:
- define the message as an external message (needs free'ing)
- define a feature or susbsytem that can be printed in the log message.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:37:44 +11:00
Angus Salkeld
9d159ab87f LOG: change "tags" field to "targets"
This is it's new meaning, so makes things clearer

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:33:37 +11:00
Angus Salkeld
34ee74db55 LOG: add a format option to each target.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 23:06:41 +11:00
Angus Salkeld
764fd0284b LOG: improve the docs
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 21:33:07 +11:00
Angus Salkeld
da28f16dd8 LOG: add qb_log_file_close()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 21:22:27 +11:00
Angus Salkeld
2836e5bcf9 LOG: add the ability to import logs from other sources.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 21:17:50 +11:00
Angus Salkeld
1a9c549eb5 Be more consistent with the C++ protection
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 19:53:41 +11:00
Angus Salkeld
32817adb15 LOG: re-work the API to be easier to use.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 11:46:36 +11:00
Angus Salkeld
dd4d21472c LOG: add qb_log_priority_name_get()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-28 12:25:26 +11:00
Angus Salkeld
04b76a0f27 LOG: fix make install and distcheck
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-28 12:25:06 +11:00
Angus Salkeld
3452d162d2 LOG: add a qb_perror() function
- Add an internal version too
- Update the library code to use it.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-28 11:12:47 +11:00
Angus Salkeld
2956f9ef29 LOG: add a timestamp to the log handler
This makes sure that the timestamp is correct at the time
the call to qb_log() was called.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-27 22:57:58 +11:00
Angus Salkeld
6eddcfc26e LOG: split the tag function out into tag and untag
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-27 22:03:33 +11:00
Angus Salkeld
fcf4ddfd59 LOG: improve the doxygen overview.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-27 21:56:59 +11:00
Angus Salkeld
a215e856d8 LOG: fix splint warnings
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-27 21:01:11 +11:00
Angus Salkeld
f86c96bee1 LOG: add a blackbox
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-25 23:40:53 +11:00
Angus Salkeld
5bddb0fe68 LOG: add threaded logging (non-blocking)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-25 23:35:35 +11:00
Angus Salkeld
e910f8bc18 Add logging infrastructure.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-25 23:34:12 +11:00
Angus Salkeld
3c742eb761 DOCS: add missing @param on new timeout argument
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-01-09 17:23:45 +11:00
Angus Salkeld
8431910be0 LOOP: change timer handle from pointer to index + check.
This changes the timer hande from a live pointer to a handle
more like hdb handles (minus the ref counting).

What i like about this is it is not neccessary to clear
the applications handle using memset().

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-01-05 10:52:30 +11:00
Angus Salkeld
324580f5c2 LOOP: remove tlist absolute timer
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-01-05 09:21:15 +11:00
Angus Salkeld
fa892f679c RB: add a function to get the reference count.
Really handy to see if the peer is "connected".

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-16 22:09:52 +11:00
Angus Salkeld
43181d5a95 IPC: add a timeout to the client recv functions
Also allow the ringbuffer to pass ETIMEDOUT back to the
client applications.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-16 21:47:47 +11:00
Angus Salkeld
859006bb14 IPC: rename _ref_inc() to _ref()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-13 16:18:19 +11:00
Angus Salkeld
45ff679934 LOOP: change timers to be nano second based
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-13 12:23:45 +11:00
Angus Salkeld
fa72adc5be DOCS: fix some doxygen warnings for missing comments.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-13 10:43:35 +11:00
Angus Salkeld
47cedda894 IPC: export qb_ipcs_disconnect()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-03 11:19:09 +11:00
Angus Salkeld
f7f6c89591 TLIST: use qb_util_nano_monotonic_hz() instead of HZ
also add a test for under running.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-12 15:15:31 +11:00
Angus Salkeld
e7d2dd9646 LOOP: add signal support to main loop
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-09 11:51:22 +11:00
Angus Salkeld
c516965fbb IPC: add connection_closed() callback.
- added another callback closed() and use this as the current
  destroyed_connection() has been used.
- the destroyed() event changes meaning to
  "the connection object is about to be free'ed"
  and the user can free the context memory.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-04 10:16:58 +11:00
Angus Salkeld
b07b65df42 IPC: change service instance from handle to pointer.
Mainly to be consistent with the other objects.

Also:
- splint warnings(-weak) are now zero.
- Added a reference counter to replace the handle.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-03 21:41:05 +11:00
Angus Salkeld
0207003da5 RB: don't be so timid on shutdown
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-02 23:19:26 +11:00
Angus Salkeld
920a927116 Cleanup config defines & add a check_all script
Run:
./check_all
to build with and without some common configurations.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-01 22:05:46 +11:00
Angus Salkeld
fbf4a50141 UTIL: move mmap helpers into private header
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-01 10:39:18 +11:00
Angus Salkeld
970a4bc6d5 LOOP: add qb_loop_destroy()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-30 20:51:36 +11:00
Angus Salkeld
e390a373d5 IPC: add server connection states for better shutdown.
This also fixes the refcounting, which was not quite right.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-27 11:48:56 +11:00
Angus Salkeld
90beaae095 IPC: add qb_ipcs_response_sendv()
iovec friendly response function

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-27 11:36:13 +11:00
Angus Salkeld
d4ad56b8b7 TIME: move tlist_nano_ functions into util
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-27 11:36:13 +11:00
Angus Salkeld
36d1171e2a IPC: add job_add() API to the poll abstraction.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-27 11:33:00 +11:00
Angus Salkeld
cf12f09b31 fix some build issues on FreeBSD
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-22 14:49:54 +11:00
Angus Salkeld
2549e5c24a IPC: add a connection iterator.
So we can iterate over all connections on a service.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-21 21:48:29 +11:00
Angus Salkeld
c5ed1450a1 IPC: add stats to server end.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-21 21:43:26 +11:00
Angus Salkeld
875a4f8d53 ATOMIC: fix the memory barrier setup.
This was horribly broken.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-20 11:31:44 +11:00
Angus Salkeld
9d8d6bfdce LINT: get the lint target working.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 22:36:08 +11:00
Angus Salkeld
f780aaea2d HDB: remove locks and use atomic.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 10:24:04 +11:00
Angus Salkeld
84488fdb85 HDB: use qb_array.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 09:54:12 +11:00
Angus Salkeld
f0efc457db DOCS: add some doxygen comments to array & hdb.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 08:59:51 +11:00
Angus Salkeld
9745d4feb7 Add a resizable array that doesn't move memory.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:54 +11:00
Angus Salkeld
e7b46822d5 ATOMIC: fix make distcheck
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:54 +11:00
Angus Salkeld
ec61d212d5 LIST/LOOP: allow empty list items but don't splice an empty head.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:54 +11:00
Angus Salkeld
43d8b36518 Add atomic operations.
This was initially copied from glib. How ever I have
simplified it to only support proper atomic operations
with gcc builtin __sync calls. The backup is pthread_spin_lock().
I have also obviously namespaced the code to qb_.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-18 11:24:07 +11:00
Angus Salkeld
47443a5b63 DOCS: do some work on the doxygen output.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-17 19:31:24 +11:00
Angus Salkeld
31ca215188 IPC: add support for unix sockets
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-17 14:23:53 +11:00
Angus Salkeld
ab3cc42537 LIST: fix logic in qb_list_splice()
this fixes "make check"

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-16 21:42:50 +11:00
Steven Dake
9e5385b885 qb_list_splice: don't splice an empty list
An empty list passed to splice will damage the target splice list.  This patch
prevents that from happening by checking for an empty list and not merging
in that case.

Signed-off-by: Steven Dake <sdake@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-15 07:36:35 +11:00
Angus Salkeld
e9d10dfdbe IPC: remove flow control API and move functionality into send()
There is no point in a separate API.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-14 09:16:00 +11:00
Angus Salkeld
0d9f8720b9 IPC: add qb_ipcc_sendv_recv() convenience function.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-13 10:01:30 +11:00
Angus Salkeld
e1686dbd6a IPC: add support for flowcontrol & rate limiting
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:53 +11:00
Angus Salkeld
8d3ec80c19 RB: add support for shared user data.
(I need this for flow control)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:53 +11:00
Angus Salkeld
8df21458f5 IPC: get the poll independent functions working.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
1f6c42b098 IPC: make msg_process return type int
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00
Angus Salkeld
57af215a96 Remove timer.c (rather use mainloop)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-12 21:53:52 +11:00