aboutsummaryrefslogtreecommitdiffstats
path: root/gpgme/priv-io.h
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2008-06-25 16:52:31 +0000
committerMarcus Brinkmann <[email protected]>2008-06-25 16:52:31 +0000
commit0560f3089b5d1f24fd9625612921ceffc995fff8 (patch)
tree40b86f1540d69cbfea674ad41aa6cb23524797bc /gpgme/priv-io.h
parentUpdated example. (diff)
downloadgpgme-0560f3089b5d1f24fd9625612921ceffc995fff8.tar.gz
gpgme-0560f3089b5d1f24fd9625612921ceffc995fff8.zip
assuan/
2008-06-25 Marcus Brinkmann <[email protected]> * assuan-pipe-connect.c (struct spawn_fd_item_s): Add new members. (HANDLE_TRANSLATION): New macro. (pipe_connect_gpgme): Adjust caller of _gpgme_io_spawn. [HANDLE_TRANSLATION]: Return translated handles. gpgme/ 2008-06-25 Marcus Brinkmann <[email protected]> * gpgme-w32spawn.c: New file. * Makefile.am (libexec_PROGRAMS) [HAVE_W32_SYSTEM]: New variable with gpgme-w32spawn. * engine-gpgsm.c (gpgsm_new): Use server translated handles. (gpgsm_set_locale): Return early if locale value is NULL. * util.h (_gpgme_mkstemp) (_gpgme_get_w32spawn_path) [HAVE_W32_SYSTEM]: New function prototypes. * w32-util.c: Include <stdint.h>, <sys/stat.h> and <unistd.h>. (letters, mkstemp, _gpgme_mkstemp, _gpgme_get_w32spawn_path): New functions. * rungpg.c (gpg_decrypt, gpg_encrypt, gpg_encrypt_sign) (gpg_genkey, gpg_import, gpg_verify, gpg_sign): Pass data over special filename FD rather than stdin. (struct arg_and_data_s): Add member ARG_LOCP. (struct fd_data_map_s): Add member ARG_LOC. (struct engine_gpg): Add member ARG_LOC to status and colon. (_add_arg, add_arg_with_locp): New function. (add_arg_ext): Reimplement in terms of _add_arg. (gpg_new): Remember argument location for status FD. (build_argv): Set argument location if requested. Also set argument location of fd_data_map for data items. (start): Adjust caller of _gpgme_io_spawn. * priv-io.h (struct spawn_fd_item_s): Add members peer_name and arg_loc. (_gpgme_io_spawn): Remove parent fd list argument. * posix-io.c (get_max_fds): New function. (_gpgme_io_dup): Add tracing. (_gpgme_io_spawn): Remove parent fd list. Change meaning of child fd list to contain all child fds that should be inherited. Close all other file descriptors after fork. * w32-io.c, w32-glib-io.c, w32-qt-io.c(_gpgme_io_spawn): Remove parent fd list. Change meaning of child fd list to contain all child fds that should be inherited. Do not inherit any file descriptors, but DuplicateHandle them. Spawn process through wrapper process. Provide wrapper process with a temporary file containing handle translation data. Return translated handle names. * w32-io.c (reader): Add more tracing output. (_gpgme_io_read): Likewise. * engine-gpgconf.c (gpgconf_read): Adjust caller of _gpgme_io_spawn. * version.c (_gpgme_get_program_version): Likewise.
Diffstat (limited to '')
-rw-r--r--gpgme/priv-io.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/gpgme/priv-io.h b/gpgme/priv-io.h
index b0bc367d..90a385da 100644
--- a/gpgme/priv-io.h
+++ b/gpgme/priv-io.h
@@ -24,11 +24,19 @@
/* A single file descriptor passed to spawn. For child fds, dup_to
- specifies the fd it should become in the child. */
+ specifies the fd it should become in the child, but only 0, 1 and 2
+ are valid values (due to a limitation in the W32 code). As return
+ value, the PEER_NAME fields specify the name of the file
+ descriptor in the spawned process, or -1 if no change. If ARG_LOC
+ is not 0, it specifies the index in the argument vector of the
+ program which contains a numerical representation of the file
+ descriptor for translation purposes. */
struct spawn_fd_item_s
{
int fd;
int dup_to;
+ int peer_name;
+ int arg_loc;
};
struct io_select_fd_s
@@ -51,12 +59,13 @@ int _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler,
void *value);
int _gpgme_io_set_nonblocking (int fd);
-/* Spawn the executable PATH with ARGV as arguments, after forking
- close all fds in FD_PARENT_LIST in the parent and close or dup all
- fds in FD_CHILD_LIST in the child. */
+/* Spawn the executable PATH with ARGV as arguments. After forking
+ close all fds except for those in FD_LIST in the child, then
+ optionally dup() the child fds. Finally, all fds in the list are
+ closed in the parent. */
int _gpgme_io_spawn (const char *path, char **argv,
- struct spawn_fd_item_s *fd_child_list,
- struct spawn_fd_item_s *fd_parent_list, pid_t *r_pid);
+ struct spawn_fd_item_s *fd_list, pid_t *r_pid);
+
int _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock);
/* Write the printable version of FD to the buffer BUF of length