Commit Graph

58 Commits

Author SHA1 Message Date
Jan Pokorný
aed01bb452
maint: replace 0xffffffff constants with UNIT32_MAX
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2017-12-20 22:17:07 +01:00
Christine Caulfield
59eacf07dd loop: Fix splint error
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2017-03-06 14:31:57 +00:00
Christine Caulfield
e336b716cc loop: Also set signals changed in qb_loop_signal_mod() back to SIG_DFL
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2017-02-24 16:36:35 +00:00
Christine Caulfield
c751993c90 loop: don't override external signal handlers
qb_loop_signal_add() used to set any signals it wasn't managing
back to SIG_DFL. This is unfriendly behaviour in a library.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Pokorný <jpokorny@redhat.com>
2017-02-24 16:23:43 +00:00
Jan Pokorný
28341438f4
build: make the code splint-friendly where not already 2016-03-17 15:13:58 +01:00
David Vossel
b6f000f237 High: loop: fixes resource starvation in mainloop code 2015-04-14 11:52:59 -04:00
David Vossel
67f63be685 Detect the max signal value that can be used using NSIG macro 2013-08-19 20:44:10 -05:00
Michael van der Westhuizen
4509500e5e Use a system-supplied maximum number of signals on Mac OS X. This gets SIGUSR2 (#31) working. 2013-08-11 21:51:17 +02:00
Takeshi MIZUTA
4d1a98ad76 Unify to QB_TRUE/QB_FALSE a boolean value 2013-01-11 02:01:06 +09:00
Angus Salkeld
481b354794 Fix kqueue on freebsd.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 20:55:37 +10:00
Angus Salkeld
7a09cdae67 Fix kqueue compiling.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 01:37:00 +10:00
Angus Salkeld
26491555ef POLL: seperate out the poll/epoll and add kqueue
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 00:26:20 +10:00
Angus Salkeld
4f5d55a48e LOOP: remove some old timerfd code.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 20:20:04 +11:00
Angus Salkeld
98e97129d8 LOOP: fix deletion of signal handlers when they are pending
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-06 22:28:09 +11:00
Angus Salkeld
ab5da6ff1f LOOP: signal handlers were always added as high priority.
This now adds them as requested by the user.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-06 22:01:12 +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
0d21be245b ARRAY: save memory (in the bins array) and allow holes in the array
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-22 17:30:19 +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
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
42de03038e clang: Remove unused code
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-14 17:27:26 +11:00
Angus Salkeld
1e4b33c9cf LOOP: make it possible to pass in NULL as the default loop instance
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-10 14:47:49 +11:00
Angus Salkeld
b602680e1d LOOP: make the item type applicable to jobs too.
Mainly for diagnostics

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-07 10:07:17 +11:00
Angus Salkeld
a95618ddd3 Fix some issues found by clang
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-03 14:37:37 +11:00
Angus Salkeld
29d193112a LOOP: allow a timer to be created without returning the handle
This is if the user does not plan to delete the timer.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-23 16:04:49 +11:00
Fabio M. Di Nitto
d823a480dc Fix a compile warning on sparc (epoll_create1)
The problem is that sys/epoll.h was broken on sparc and alpha for a
bunch of glibc releases.

glibc has the symbol correctly exported, that's why ./configure finds
it, but the header is not always correct. Recent versions of glibc have
the correct header, so we simply workaround the broken ones.

This fix is only necessary to build with --enable-fatal-warnings,
otherwise you simply see a build warning, but there are no runtime
issues at any stage.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-22 22:55:27 +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
Angus Salkeld
ee50e90fc2 LOOP: free up the signal list when qb_loop_destory() is called
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-10 21:30:37 +11:00
Angus Salkeld
99311d24fe LOOP: close opened pipe if function fails
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:43:21 +11:00
miz-take
fcd96fc8e0 Improve the error handling esp. after failed malloc's
Reviewed-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 09:50:38 +11:00
Angus Salkeld
98493d9ae8 Change Lindent options to break the procedure type.
so change:
int foo(void)

to

int
foo(void)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-22 14:19:14 +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
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
Jim Meyering
9c467cb150 add FIXME comments for other NULL-deref-upon-OOM problems
* lib/ipc_us.c (handle_new_connection):
* lib/loop_job.c (qb_loop_jobs_create):
* lib/loop_poll.c (qb_loop_poll_create):
* lib/loop_timerlist.c (qb_loop_timer_create):
* lib/ringbuffer.c (qb_rb_open):
* lib/ipcc.c (qb_ipcc_connect): Likewise.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-17 21:32:29 +10:00
Angus Salkeld
45fa3b045d TESTS: use new logging API
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 16:05:46 +10: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
6b96fdcbf1 LOOP: check read() return value
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
8d96ea05bc LOOP: make static functions like _<name>_()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-22 09:12:56 +11:00
Angus Salkeld
8c28e4558a LOOP: reduce the number of for loops
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-22 09:12:56 +11:00
Angus Salkeld
bba1f150d1 LOOP: change entry type enum
This to avoid QB_POLL been equal to 0, which could
hide some bugs.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-22 09:12:17 +11:00
Angus Salkeld
6c6486204b LOOP: add per-level todo counters
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-22 09:12:04 +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
a80fde39ef LOOP: remove unneccessary event array
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-12-10 09:46:47 +11:00
Angus Salkeld
d8a433b0b3 LOOP: fix compile warning when we don't have timerfd.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-16 20:58:49 +11:00
Angus Salkeld
668eb0a2d5 LOOP: move pipe creation into qb_loop_signals_create()
Also make sure the pipe is non blocking.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-16 14:38:34 +11:00
Angus Salkeld
1a073f7b29 LOOP: prevent timers from deleting them selves.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-15 16:03:31 +11:00
Angus Salkeld
f7a28f1be2 LOOP: add some debug to log slow jobs
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-12 22:39:59 +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
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
dc08661297 LOOP: add support for timerfd
If available use timerfd_create() as it is
much more accurate than tlist.h

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-11-01 10:14:08 +11:00