t (gpgrt_spawn_actions_t, int, int, int);
void gpgrt_spawn_actions_set_inherit_fds (gpgrt_spawn_actions_t, const int *);
void gpgrt_spawn_actions_set_atfork (gpgrt_spawn_actions_t, void (*)(void *), void *);

enum gpgrt_process_requests
  {
    /* Portable requests */
    GPGRT_PROCESS_NOP           = 0,
    GPGRT_PROCESS_GET_PROC_ID   = 1,
    GPGRT_PROCESS_GET_EXIT_ID   = 2,

    /* POSIX only */
    GPGRT_PROCESS_GET_PID       = 16,
    GPGRT_PROCESS_GET_WSTATUS   = 17,
    GPGRT_PROCESS_KILL          = 18,

    /* Windows only */
    GPGRT_PROCESS_GET_P_HANDLE  = 32,
    GPGRT_PROCESS_GET_HANDLES   = 33,
    GPGRT_PROCESS_GET_EXIT_CODE = 34,
    GPGRT_PROCESS_KILL_WITH_EC  = 35
  };

#if 0
/* Function and convenience macros to create pipes.  */
gpg_err_code_t gpgrt_make_pipe (int filedes[2], gpgrt_stream_t *r_fp,
                                int direction, int nonblock);
#define gpgrt_create_pipe(a)              gpgrt_make_pipe ((a),NULL,  0,  0);
#define gpgrt_create_inbound_pipe(a,b,c)  gpgrt_make_pipe ((a), (b), -1,(c));
#define gpgrt_create_outbound_pipe(a,b,c) gpgrt_make_pipe ((a), (b),  1,(c));

/* Close all file resources (descriptors), except KEEP_FDS. */
void gpgrt_close_all_fds (int from, int *keep_fds);
#endif /*0*/

gpg_err_code_t gpgrt_process_spawn (const char *pgmname, const char *argv1[],
                                    unsigned int flags,
                                    gpgrt_spawn_actions_t act,
                                    gpgrt_process_t *r_process);

gpg_err_code_t gpgrt_process_terminate (gpgrt_process_t process);

gpg_err_code_t gpgrt_process_get_fds (gpgrt_process_t process,
                                      unsigned int flags,
                                      int *r_fd_in, int *r_fd_out,
                                      int *r_fd_err);

gpg_err_code_t gpgrt_process_get_streams (gpgrt_process_t process,
                                          unsigned int flags,
                                          gpgrt_stream_t *r_fp_in,
                                          gpgrt_stream_t *r_fp_out,
                                          gpgrt_stream_t *r_fp_err);

gpg_err_code_t gpgrt_process_ctl (gpgrt_process_t process,
                                  unsigned int request, ...);

gpg_err_code_t gpgrt_process_wait (gpgrt_process_t process, int hang);

void gpgrt_process_release (gpgrt_process_t process);
