summaryrefslogtreecommitdiffstats
path: root/lib/waiter/waiter.c
Commit message (Collapse)AuthorAgeFilesLines
* lib/waiter: handle -EINTRJeremy Kerr2013-08-191-2/+5
| | | | | | | Now that we're handing non-fatal signals (i.e., SIGCHLD in the process lib), we need to gracefully handle -EINTR from poll(). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: remove waitset_destroyJeremy Kerr2013-08-191-5/+0
| | | | | | We can rely on the ctx free to destroy the waitset. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: talloc waiters from waitset contextJeremy Kerr2013-08-161-1/+1
| | | | | | | We can lose a reference to the first waiter allocated, as set->waiters may be NULL. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: fix talloc_realloc contextJeremy Kerr2013-08-161-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: merge time & io waiter init loopsJeremy Kerr2013-08-161-24/+22
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: move type-specific members to a unionJeremy Kerr2013-08-161-9/+13
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: Defer free of removed waitersJeremy Kerr2013-07-231-3/+27
| | | | | | | | | We may end up calling remove()-d time waiters if the timeout expires as we're processing an IO waiter. Instead of freeing the waiter in waiter_remove, mark the waiter as inactive, and defer the free until the end of waiter_poll(). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: Add timeout waitersJeremy Kerr2013-06-241-33/+142
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: Ensure waiters are consistent during waiter_pollJeremy Kerr2013-05-211-19/+43
| | | | | | | | | | | | | | | | We have a bug at the moment: if the waitset's->waiters array is updated duing waiter_poll() (eg, a client connection is closed, and the client's callback performs a waiter_remove()), then we may invoke callbacks for incorrect waiters. This change uses a consistent waiters array duing execution of waiter_poll, so that any pollfds returned from poll() will result in correct callback invocations. This assumes that a waiter will only ever remove *itself* from the waitset; otherwise, we may call a free()ed waiter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: allocate waiters separately from set->waitersJeremy Kerr2013-05-211-13/+22
| | | | | | | | | | Since we reallocate set->waiters, we can't hand out pointers to within that array. Instead, this change allocates the 'struct waiter's separately from the set->waiters array. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* waiter: Don't rely on global variables to keep waiter stateJeremy Kerr2013-04-101-32/+51
| | | | | | | | | Rather than defining the set of waiters (and pollfds) in waiter.c, add a struct waitset to contain these. A waitset is created with waitset_create, which is passed to the waiter_* functions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* Fix waiter_register return valueGeoff Levand2011-11-031-1/+5
|
* Fix memmove sizeGeoff Levand2009-06-301-1/+2
| | | | | | | Correct the byte count for several memmove calls. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Fix waiter allocGeoff Levand2009-02-011-1/+2
| | | | | | | | Add the missing assignment of the global n_pollfds variable. Fix a minor memory leak in waiter_poll(). Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Move waiter to libraryGeoff Levand2009-02-011-0/+83
Move the waiter routines into the petitboot library. The waiter routines are generic enough to be used for both server and client. Does not change the waiter source. jk: move to lib/waiter/ instead of lib/ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud