diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2023-05-17 10:55:17 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2023-05-17 10:55:17 +0900 |
commit | 6350f796fdd1c7519c35a9cd71b33b6dafc5ed3a (patch) | |
tree | b95049d835579972a6f0236b018d68a2f5082aac /src/assuan.h.in | |
parent | f3b3ddfd7ffbf74ae91ce0f8f9908915974cf2c6 (diff) | |
download | libassuan-6350f796fdd1c7519c35a9cd71b33b6dafc5ed3a.tar.gz |
w32: Cleaner semantics for PID and Process handle.
* src/assuan-defs.h (struct assuan_context_s): Introduce SERVER_PROC
member. Clarify the use of PROCESS_ID and PID.
Introduce assuan_pid_t for internal use of process id or handle.
* src/assuan.h.in: Follow the change.
* src/assuan.c (assuan_new_ext): Likewise.
* src/client.c (_assuan_client_finish): Likewise.
* src/assuan-pipe-connect.c (pipe_connect): Likewise.
* src/server.c (_assuan_server_finish): Likewise.
* src/system-posix.c: Likewise.
* src/system-w32.c: Likewise.
* src/system.c: Likewise.
* src/assuan-pipe-server.c (assuan_init_pipe_server)
[HAVE_W32_SYSTEM]: Exclude the use of _assuan_pipe_connect_pid.
* src/assuan-socket-server.c (accept_connection_bottom)
[HAVE_W32_SYSTEM]: Exclude the use of the member peercred.pid.
* src/assuan-socket.c (_assuan_sock_check_nonce): Support Cygwin
Unix domain emulation for having valid client process ID.
* src/context.c (assuan_get_pid): Clarify the use cases.
* src/posix-types.inc.h, src/w32-types.inc.h: Introduce assuan_pid_t.
--
GnuPG-bug-id: 6487
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'src/assuan.h.in')
-rw-r--r-- | src/assuan.h.in | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/assuan.h.in b/src/assuan.h.in index 2f89f10..10917c9 100644 --- a/src/assuan.h.in +++ b/src/assuan.h.in @@ -255,7 +255,7 @@ struct assuan_system_hooks /* If NAME is NULL, don't exec, just fork. FD_CHILD_LIST is modified to reflect the value of the FD in the peer process (on Windows). */ - int (*spawn) (assuan_context_t ctx, pid_t *r_pid, const char *name, + int (*spawn) (assuan_context_t ctx, assuan_pid_t *r_pid, const char *name, const char **argv, assuan_fd_t fd_in, assuan_fd_t fd_out, assuan_fd_t *fd_child_list, @@ -263,8 +263,8 @@ struct assuan_system_hooks void *atforkvalue, unsigned int flags); /* If action is 0, like waitpid. If action is 1, just release the PID? */ - pid_t (*waitpid) (assuan_context_t ctx, pid_t pid, - int action, int *status, int options); + assuan_pid_t (*waitpid) (assuan_context_t ctx, assuan_pid_t pid, + int action, int *status, int options); int (*socketpair) (assuan_context_t ctx, int _namespace, int style, int protocol, assuan_fd_t filedes[2]); assuan_fd_t (*socket) (assuan_context_t ctx, int _namespace, @@ -529,7 +529,7 @@ void assuan_sock_set_system_hooks (assuan_system_hooks_t system_hooks); void __assuan_usleep (assuan_context_t ctx, unsigned int usec); int __assuan_pipe (assuan_context_t ctx, assuan_fd_t fd[2], int inherit_idx); int __assuan_close (assuan_context_t ctx, assuan_fd_t fd); -int __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, +int __assuan_spawn (assuan_context_t ctx, assuan_pid_t *r_pid, const char *name, const char **argv, assuan_fd_t fd_in, assuan_fd_t fd_out, assuan_fd_t *fd_child_list, void (*atfork) (void *opaque, int reserved), @@ -548,8 +548,8 @@ int __assuan_recvmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, int flags); int __assuan_sendmsg (assuan_context_t ctx, assuan_fd_t fd, const assuan_msghdr_t msg, int flags); -pid_t __assuan_waitpid (assuan_context_t ctx, pid_t pid, - int nowait, int *status, int options); +assuan_pid_t __assuan_waitpid (assuan_context_t ctx, assuan_pid_t pid, + int nowait, int *status, int options); #ifdef ASSUAN_REALLY_REQUIRE_OLD_WAY_OF_SYSTEM_NPTH /* Standard system hooks for nPth. */ @@ -578,9 +578,10 @@ pid_t __assuan_waitpid (assuan_context_t ctx, pid_t pid, { int res; (void) ctx; npth_unprotect(); \ res = __assuan_sendmsg (ctx, fd, msg, flags); \ npth_protect(); return res; } \ - static pid_t _assuan_npth_waitpid (assuan_context_t ctx, pid_t pid, \ - int nowait, int *status, int options) \ - { pid_t res; (void) ctx; npth_unprotect(); \ + static assuan_pid_t _assuan_npth_waitpid (assuan_context_t ctx, \ + assuan_pid_t pid, int nowait, \ + int *status, int options) \ + { assuan_pid_t res; (void) ctx; npth_unprotect(); \ res = __assuan_waitpid (ctx, pid, nowait, status, options); \ npth_protect(); return res; } \ static int _assuan_npth_connect (assuan_context_t ctx, assuan_fd_t sock, \ |