From 5e15cf931706f9a6ae00d17569b97d636d6f2945 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Fri, 16 Oct 2009 18:24:46 +0000 Subject: 2009-10-16 Marcus Brinkmann * autogen.sh: Remove --with-pth-prefix from configure invocation. * configure.ac (_ASSUAN_IN_LIBASSUAN, PTH_SYSCALL_SOFT): Do not set anymore. (GNUPG_PATH_PTH): Don't invoke. (HAVE_PTH): Remove conditional. (LIBASSUAN_CONFIG_THREAD_MODULES): Removed. doc/ 2009-10-16 Marcus Brinkmann * assuan.texi: Remove documentation for thread support. (assuan_pipe_connect_ext): Update prototype. src/ 2009-10-16 Marcus Brinkmann * conversion.c: Do not include and . * debug.h (TRACE_BEG6, TRACE4): New macros. (TRACE_SYSERR): Pass _assuan_trace_context to _assuan_debug. * context.c (assuan_set_pointer, assuan_get_pointer, assuan_set_flag, assuan_get_flag, assuan_set_io_monitor, assuan_set_error): Add trace messages. * libassuan-config.in, libassuan.m4, Makefile.am: Remove PTH support. * assuan.h (assuan_msghdr_t): New type. (ASSUAN_INVALID_PID): New macro. (ASSUAN_NO_FIXSIGNALS): New flag macro. (ASSUAN_SYSTEM_HOOKS_VERSION): New macro. (struct assuan_system_hooks, assuan_system_hooks_t): New types. (assuan_pipe_connect, assuan_pipe_connect_ext): Don't make ARGV const for name==NULL operation. Make fd_child_list an array of assuan_fd_t. (assuan_sock_init, assuan_sock_deinit, assuan_set_system_hooks, assuan_ctx_set_system_hooks, __assuan_pipe, __assuan_close, __assuan_spawn, __assuan_socketpair): New function prototypes. (_ASSUAN_SYSTEM_PTH_IMPL, ASSUAN_SYSTEM_PTH_DECL, ASSUAN_SYSTEM_PTH): New macros. (_assuan_system_pth): New declaration. * libassuan.vers, libassuan.defs: Add assuan_sock_init, assuan_sock_deinit, __assuan_pipe, __assuan_close, __assuan_spawn, __assuan_socketpair, assuan_set_system_hooks, assuan_ctx_set_system_hooks. * assuan-defs.h (struct assuan_io): Removed, move members to ... (struct assuan_context_s): ... this to ENGINE. New flag no_fixsignals. New member SYSTEM. Remove member IO. (_assuan_pipe, _assuan_read, _assuan_write, _assuan_recvmsg, _assuan_sendmsg, _assuan_spawn, _assuan_socketpair, _assuan_system_hooks, _assuan_system_hooks_copy): New declarations. (_assuan_error_is_eagain, _assuan_waitpid, _assuan_usleep, _assuan_close, _assuan_sock_new, _assuan_sock_connect, _assuan_sock_bind, _assuan_sock_get_nonce, _assuan_sock_check_nonce): Add context argument. (_assuan_io_read, _assuan_io_write, _assuan_simple_sendmsg, _assuan_simple_recvmsg): Removed. * context.c (assuan_ctx_set_system_hooks): New function. * assuan.c (assuan_set_system_hooks): New function. (assuan_new_ext): Initialize CTX->system. (assuan_release): Always output trace message. * assuan-error.c (_assuan_error_is_eagain): Add ctx argument, pass along to _assuan_usleep. * assuan-inquire.c assuan-listen.c, assuan-socket-server.c, assuan-handler.c, assuan-socket-connect.c, assuan-client.c, assuan-pipe-connect.c, assuan-socket.c: Pass CTX argument to functions that need it (_assuan_sock_new, _assuan_sock_check_none, _assuan_close, _assuan_error_is_eagain and many more). * assuan-socket-server.c (assuan_init_socket_server_ext): Update fields in CTX->engine instead of CTX->io. * assuan-socket-connect (assuan_socket_connect_ext): Likewise. * assuan-uds.c (uds_reader, uds_writer, uds_sendfd): Use _assuan_recvmsg and _assuan_sendmsg instead of _assuan_simple_recvmsg and _assuan_simple_sendmsg respectively. (_assuan_init_uds_io): Update fields in CTX->engine instead of CTX->io. * assuan-buffer.c: Use functions in CTX->engine instead of CTX->io. * assuan-pipe-server.c (assuan_init_pipe_server): Update fields in CTX->engine instead of CTX->io. * system.c: Include , , , and resp. . Define MAX_OPEN_FDS. (_assuan_system_hooks_copy, __assuan_usleep, _assuan_usleep, __assuan_pipe, _assuan_pipe, __assuan_close, _assuan_close, __assuan_read, _assuan_read, __assuan_write, _assuan_write, __assuan_recvmsg, _assuan_recvmsg, __assuan_sendmsg, _assuan_sendmsg, __assuan_spawn, _assuan_spawn, __assuan_waitpid, _assuan_waitpid, __assuan_socketpair, _assuan_socketpair): New functions. (_assuan_system_hooks): New singleton. * assuan-io.c (_assuan_waitpid, do_io_read, _assuan_io_read, do_io_write, _assuan_io_write, _assuan_simple_sendmsg, _assuan_simple_recvmsg, _assuan_usleep): Removed. * assuan-pipe-connect (writen, build_w32_commandline, create_inheritable_pipe): Removed (actually moved to system.c). (fix_signals) [_ASSUAN_NO_FIXED_SIGNALS]: Still fix signals. (do_finish): Move waitpid logic to _assuan_waitpid, just call that. (struct at_pipe_fork, struct at_socketpair_fork): New types. (at_pipe_fork_cb, at_socketpair_fork_cb): New callback functions. (pipe_connect_unix, pipe_connect_w32): Replaced by ... (pipe_connect): ... this new function using new system functions. (socketpair_connect): Reimplement to use new system functions. (assuan_pipe_connect, assuan_pipe_connect_ext): Add trace message. * assuan-socket.c (_assuan_close): Removed (moved to system.c). (_assuan_sock_new, _assuan_sock_connect, _assuan_sock_bind, _assuan_sock_get_nonce, _assuan_sock_check_nonce): Add context argument. Use new system interface. (sock_ctx): New singleton. (assuan_sock_init, assuan_sock_deinit): New functions to initialize and deinitialize the singleton. --- doc/ChangeLog | 5 +++++ doc/assuan.texi | 39 +++++++++++++-------------------------- 2 files changed, 18 insertions(+), 26 deletions(-) (limited to 'doc') diff --git a/doc/ChangeLog b/doc/ChangeLog index c567640..6106e35 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-10-16 Marcus Brinkmann + + * assuan.texi: Remove documentation for thread support. + (assuan_pipe_connect_ext): Update prototype. + 2009-10-14 Werner Koch * assuan.texi (Utilities): Describe assuan_get_command_name. diff --git a/doc/assuan.texi b/doc/assuan.texi index adfc86d..5641aa0 100644 --- a/doc/assuan.texi +++ b/doc/assuan.texi @@ -465,10 +465,6 @@ specifying both options to @command{libassuan-config}: gcc -o foo foo.c $(libassuan-config --cflags --libs) @end example -If your application uses Pth or pthread, you need to pass the option -@option{--thread=pth} respective @option{--thread=pthread} to the -invocation of @command{libassuan-config}. - @node Automake @section Building sources using Automake @@ -498,36 +494,27 @@ AM_CPPFLAGS = $(LIBASSUAN_CFLAGS) LDADD = $(LIBASSUAN_LIBS) @end example -@defmac AM_PATH_LIBASSUAN_PTH (@ovar{minimum-version}, @ovar{action-if-found}, @ovar{action-if-not-found}) -Same as @code{AM_PATH_LIBASSUAN} but checks for the GNU Pth enabled -version of the library and defines @code{LIBASSUAN_PTH_CFLAGS} -@code{LIBASSUAN_PTH_LIBS} instead. Use this is you are using GNU Pth. -Note that you also need to pass the appropriate options for Pth to the -compiler and linker. -@end defmac - -@defmac AM_PATH_LIBASSUAN_PTHREAD (@ovar{minimum-version}, @ovar{action-if-found}, @ovar{action-if-not-found}) -Same as @code{AM_PATH_LIBASSUAN} but checks for the pthreads enabled -version of the library and defines @code{LIBASSUAN_PTHREAD_CFLAGS} -@code{LIBASSUAN_PTHREAD_LIBS} instead. Use this is you are using GNU Pth. -Note that you also need to pass the appropriate options for Pth to the -compiler and linker. -@end defmac - - @node Multi Threading @section Multi Threading -The @code{libassuan} library is thread-safe if you adhere to the following -requirements: +The @code{libassuan} library is designed so that it can be used in a +threaded application, if some rules are followed. @itemize @bullet @item Run the initialization functions before you actually start -to use threads. +to use threads. Specifically, the functions +@code{assuan_set_gpg_err_source}, @code{assuan_set_malloc_hooks} and +@code{assuan_set_log_cb} should not be called concurrently with +@code{assuan_new}. Use @code{assuan_new_ext} instead or ensure proper +serialization. @item Only one thread at a time may access an @code{libassuan} context. @item If you use the default log handler, use @code{assuan_set_assuan_log_stream} to setup a default log stream. +@item If you have callback functions shared by multiple functions, +the callback function must be reentrant for that purpose. +@code{libassuan} does not serialize invocation of callback functions +across contexts. @end itemize @@ -950,12 +937,12 @@ If the peer is not a simple pipe server but one using full-duplex sockets, the full-fledged variant of the above function should be used: -@deftypefun gpg_error_t assuan_pipe_connect_ext (@w{assuan_context_t *@var{ctx}},@w{const char *@var{name}}, @w{const char *@var{argv}[]}, @w{int *@var{fd_child_list}}, @w{void (*@var{atfork}) (void *, int)}, @w{void *@var{atforkvalue}}, @w{unsigned int @var{flags}}) +@deftypefun gpg_error_t assuan_pipe_connect_ext (@w{assuan_context_t *@var{ctx}},@w{const char *@var{name}}, @w{const char *@var{argv}[]}, @w{assuan_fd_t *@var{fd_child_list}}, @w{void (*@var{atfork}) (void *, int)}, @w{void *@var{atforkvalue}}, @w{unsigned int @var{flags}}) A call to this functions forks the current process and executes the program @var{name}, passing the arguments given in the NULL-terminated list @var{argv}. A list of file descriptors not to be closed may be -given using the @code{-1} terminated array @var{fd_child_list}. +given using the @code{ASSUAN_INVLID_FD} terminated array @var{fd_child_list}. If @var{name} is a null pointer, only a fork but no exec is done. Thus the child continues to run. However all file descriptors are -- cgit v1.2.1