aboutsummaryrefslogtreecommitdiffstats
path: root/src/posix-io.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-06-13 06:40:33 +0000
committerWerner Koch <[email protected]>2019-06-13 06:40:33 +0000
commit28e620fa169dcbfc2301ae9bea58ebe3ccc3504a (patch)
tree28be2b60116d54a3ba83f8297332bf56e5561728 /src/posix-io.c
parentcore: Use fully correct command args for gpg --verify. (diff)
downloadgpgme-28e620fa169dcbfc2301ae9bea58ebe3ccc3504a.tar.gz
gpgme-28e620fa169dcbfc2301ae9bea58ebe3ccc3504a.zip
core: Refactor the wait code utilizing the new fdtable.
* src/fdtable.c, src/fdtable.h: Largely extend. * src/wait-global.c, src/wait-private.c, src/wait-user.c: Remove and move code to ... * src/wait.c: here. (_gpgme_fd_table_init, fd_table_put): Remove. Do not call them. (_gpgme_add_io_cb, _gpgme_add_io_cb_user): Change to use the fdtable. (_gpgme_remove_io_cb, _gpgme_remove_io_cb_user): Ditto. (_gpgme_wait_global_event_cb): Ditto. (gpgme_wait_ext, _gpgme_wait_on_condition): Ditto. * src/wait.h (struct io_cb_tag_s): Add fields 'serial' and 'desc'. Change 'idx' to 'fd'. (struct fd_table): Remove. * src/context.h (struct gpgme_context): Remoce 'fdt'. Rename io_cbs to user_io_cbs for clarity. * src/engine-gpgsm.c: Unify trace output. (start): Pass a description along with the IO handlers. * src/priv-io.h (struct io_select_fd_s): Rename to io_select_s. (io_select_t): New. * src/gpgme.c (_gpgme_cancel_with_err): Replace arg 'ctx' by 'serial'. (gpgme_cancel): Adjust. -- This is the second part of a larger refactoring of the wait/event code. Does currently only work on Unix and with the private wait functions (i.e. the async operations don't yet work). Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/posix-io.c')
-rw-r--r--src/posix-io.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/posix-io.c b/src/posix-io.c
index b754ac34..5d9edf10 100644
--- a/src/posix-io.c
+++ b/src/posix-io.c
@@ -622,10 +622,14 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
}
-/* Select on the list of fds. Returns: -1 = error, 0 = timeout or
- nothing to select, > 0 = number of signaled fds. */
+/* Select on the list of fds.
+ *
+ * Returns: -1 = error,
+ * 0 = timeout or nothing to select,
+ * > 0 = number of signaled fds.
+ */
int
-_gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
+_gpgme_io_select (io_select_t fds, unsigned int nfds, int nonblock)
{
fd_set readfds;
fd_set writefds;
@@ -638,7 +642,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
struct timeval timeout = { 1, 0 };
void *dbg_help = NULL;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_select", NULL,
- "nfds=%zu, nonblock=%u", nfds, nonblock);
+ "nfds=%u, nonblock=%u", nfds, nonblock);
FD_ZERO (&readfds);
FD_ZERO (&writefds);
@@ -736,6 +740,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
return TRACE_SYSRES (count);
}
+
int
_gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags)