From 84bd92d3a6a6ac1366714b641466f62767dc0a75 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Thu, 6 Jun 2024 14:18:31 +0900 Subject: Remove system hooks API. Signed-off-by: NIIBE Yutaka --- src/assuan-defs.h | 36 +++++--- src/assuan-socket.c | 7 -- src/assuan.c | 8 -- src/assuan.h.in | 150 ------------------------------- src/context.c | 13 --- src/system-posix.c | 20 ----- src/system.c | 250 +++++++++++++--------------------------------------- 7 files changed, 87 insertions(+), 397 deletions(-) diff --git a/src/assuan-defs.h b/src/assuan-defs.h index faf9aae..3f64f7f 100644 --- a/src/assuan-defs.h +++ b/src/assuan-defs.h @@ -111,9 +111,6 @@ struct assuan_context_s assuan_io_monitor_t io_monitor; void *io_monitor_data; - /* Callback handlers replacing system I/O functions. */ - struct assuan_system_hooks system; - int peercred_valid; /* Whether this structure has valid information. */ struct _assuan_peercred peercred; @@ -318,15 +315,30 @@ assuan_fd_t _assuan_socket (assuan_context_t ctx, int namespace, int _assuan_connect (assuan_context_t ctx, assuan_fd_t sock, struct sockaddr *addr, socklen_t length); -extern struct assuan_system_hooks _assuan_system_hooks; - -/* Copy the system hooks struct, paying attention to version - differences. SRC is usually from the user, DST MUST be from the - library. */ -void -_assuan_system_hooks_copy (assuan_system_hooks_t dst, - assuan_system_hooks_t src); - +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, 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), + void *atforkvalue, unsigned int flags); +int __assuan_socketpair (assuan_context_t ctx, int _namespace, int style, + int protocol, assuan_fd_t filedes[2]); +assuan_fd_t __assuan_socket (assuan_context_t ctx, int _namespace, + int style, int protocol); +int __assuan_connect (assuan_context_t ctx, assuan_fd_t sock, + struct sockaddr *addr, socklen_t length); +ssize_t __assuan_read (assuan_context_t ctx, assuan_fd_t fd, + void *buffer, size_t size); +ssize_t __assuan_write (assuan_context_t ctx, assuan_fd_t fd, + const void *buffer, size_t size); +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); +assuan_pid_t __assuan_waitpid (assuan_context_t ctx, assuan_pid_t pid, + int nowait, int *status, int options); /*-- assuan-pipe-server.c --*/ void _assuan_release_context (assuan_context_t ctx); diff --git a/src/assuan-socket.c b/src/assuan-socket.c index 8e757b9..54cd8a7 100644 --- a/src/assuan-socket.c +++ b/src/assuan-socket.c @@ -1589,10 +1589,3 @@ assuan_sock_check_nonce (assuan_fd_t fd, assuan_sock_nonce_t *nonce) { return _assuan_sock_check_nonce (sock_ctx, fd, nonce); } - -void -assuan_sock_set_system_hooks (assuan_system_hooks_t system_hooks) -{ - if (sock_ctx) - _assuan_system_hooks_copy (&sock_ctx->system, system_hooks); -} diff --git a/src/assuan.c b/src/assuan.c index 0332a24..b72df65 100644 --- a/src/assuan.c +++ b/src/assuan.c @@ -106,13 +106,6 @@ assuan_get_log_cb (assuan_log_cb_t *log_cb, void **log_cb_data) *log_cb_data = _assuan_default_log_cb_data; } - -void -assuan_set_system_hooks (assuan_system_hooks_t system_hooks) -{ - _assuan_system_hooks_copy (&_assuan_system_hooks, system_hooks); -} - gpg_error_t assuan_control (enum assuan_ctl_cmds cmd, void *arg) @@ -190,7 +183,6 @@ assuan_new_ext (assuan_context_t *r_ctx, gpg_err_source_t err_source, return TRACE_ERR (gpg_err_code_from_syserror ()); memcpy (ctx, &wctx, sizeof (*ctx)); - ctx->system = _assuan_system_hooks; /* FIXME: Delegate to subsystems/engines, as the FDs are not our responsibility (we don't deallocate them, for example). */ diff --git a/src/assuan.h.in b/src/assuan.h.in index 462ec37..c8d0bed 100644 --- a/src/assuan.h.in +++ b/src/assuan.h.in @@ -233,58 +233,7 @@ typedef unsigned int (*assuan_io_monitor_t) (assuan_context_t ctx, void *hook, void assuan_set_io_monitor (assuan_context_t ctx, assuan_io_monitor_t io_monitor, void *hook_data); -/* The system hooks. See assuan_set_system_hooks et al. */ -#define ASSUAN_SYSTEM_HOOKS_VERSION 2 #define ASSUAN_SPAWN_DETACHED 128 -struct assuan_system_hooks -{ - /* Always set to ASSUAN_SYTEM_HOOKS_VERSION. */ - int version; - - /* Sleep for the given number of microseconds. */ - void (*usleep) (assuan_context_t ctx, unsigned int usec); - - /* Create a pipe with an inheritable end. */ - int (*pipe) (assuan_context_t ctx, assuan_fd_t fd[2], int inherit_idx); - - /* Close the given file descriptor, created with _assuan_pipe or one - of the socket functions. */ - int (*close) (assuan_context_t ctx, assuan_fd_t fd); - - - ssize_t (*read) (assuan_context_t ctx, assuan_fd_t fd, void *buffer, - size_t size); - ssize_t (*write) (assuan_context_t ctx, assuan_fd_t fd, - const void *buffer, size_t size); - - int (*recvmsg) (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, - int flags); - int (*sendmsg) (assuan_context_t ctx, assuan_fd_t fd, - const assuan_msghdr_t msg, int flags); - - /* 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, 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), - void *atforkvalue, unsigned int flags); - - /* If action is 0, like waitpid. If action is 1, just release the PID? */ - 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, - int style, int protocol); - int (*connect) (assuan_context_t ctx, assuan_fd_t sock, - struct sockaddr *addr, socklen_t length); -}; -typedef struct assuan_system_hooks *assuan_system_hooks_t; - - /* * Configuration of the default log handler. @@ -522,110 +471,11 @@ int assuan_sock_set_sockaddr_un (const char *fname, struct sockaddr *addr, int assuan_sock_get_nonce (struct sockaddr *addr, int addrlen, assuan_sock_nonce_t *nonce); int assuan_sock_check_nonce (assuan_fd_t fd, assuan_sock_nonce_t *nonce); -void assuan_sock_set_system_hooks (assuan_system_hooks_t system_hooks); gpg_error_t assuan_pipe_wait_server_termination (assuan_context_t ctx, int *status, int no_hang); gpg_error_t assuan_pipe_kill_server (assuan_context_t ctx); - -/* Set the default system callbacks. This is irreversible. */ -void assuan_set_system_hooks (assuan_system_hooks_t system_hooks); - -/* Set the per context system callbacks. This is irreversible. */ -void assuan_ctx_set_system_hooks (assuan_context_t ctx, - assuan_system_hooks_t system_hooks); - -/* Change the system hooks for the socket interface. - * This is not thread-safe. */ -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, 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), - void *atforkvalue, unsigned int flags); -int __assuan_socketpair (assuan_context_t ctx, int _namespace, int style, - int protocol, assuan_fd_t filedes[2]); -assuan_fd_t __assuan_socket (assuan_context_t ctx, int _namespace, - int style, int protocol); -int __assuan_connect (assuan_context_t ctx, assuan_fd_t sock, - struct sockaddr *addr, socklen_t length); -ssize_t __assuan_read (assuan_context_t ctx, assuan_fd_t fd, - void *buffer, size_t size); -ssize_t __assuan_write (assuan_context_t ctx, assuan_fd_t fd, - const void *buffer, size_t size); -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); -assuan_pid_t __assuan_waitpid (assuan_context_t ctx, assuan_pid_t pid, - int nowait, int *status, int options); - -#if defined(LIBASSUAN_API_REQUESTED) && LIBASSUAN_API_REQUESTED >= 3 -#defined ASSUAN_NO_NPTH_SYSTEM_HOOKS_ANY_MORE 1 -#endif - -#if defined(ASSUAN_REALLY_REQUIRE_V2_NPTH_SYSTEM_HOOKS) \ - || !defined(ASSUAN_NO_NPTH_SYSTEM_HOOKS_ANY_MORE) -/* Standard system hooks for nPth. */ -#define ASSUAN_SYSTEM_NPTH_IMPL \ - static void _assuan_npth_usleep (assuan_context_t ctx, unsigned int usec) \ - { npth_unprotect(); \ - __assuan_usleep (ctx, usec); \ - npth_protect(); } \ - static ssize_t _assuan_npth_read (assuan_context_t ctx, assuan_fd_t fd, \ - void *buffer, size_t size) \ - { ssize_t res; (void) ctx; npth_unprotect(); \ - res = __assuan_read (ctx, fd, buffer, size); \ - npth_protect(); return res; } \ - static ssize_t _assuan_npth_write (assuan_context_t ctx, assuan_fd_t fd, \ - const void *buffer, size_t size) \ - { ssize_t res; (void) ctx; npth_unprotect(); \ - res = __assuan_write (ctx, fd, buffer, size); \ - npth_protect(); return res; } \ - static int _assuan_npth_recvmsg (assuan_context_t ctx, assuan_fd_t fd, \ - assuan_msghdr_t msg, int flags) \ - { int res; (void) ctx; npth_unprotect(); \ - res = __assuan_recvmsg (ctx, fd, msg, flags); \ - npth_protect(); return res; } \ - static int _assuan_npth_sendmsg (assuan_context_t ctx, assuan_fd_t fd, \ - const assuan_msghdr_t msg, int flags) \ - { int res; (void) ctx; npth_unprotect(); \ - res = __assuan_sendmsg (ctx, fd, msg, flags); \ - npth_protect(); return res; } \ - 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, \ - struct sockaddr *addr, socklen_t len)\ - { int res; npth_unprotect(); \ - res = __assuan_connect (ctx, sock, addr, len); \ - npth_protect(); return res; } \ - static int _assuan_npth_close (assuan_context_t ctx, assuan_fd_t fd) \ - { int res; npth_unprotect(); \ - res = __assuan_close (ctx, fd); \ - npth_protect(); return res; } \ - \ - struct assuan_system_hooks _assuan_system_npth = \ - { ASSUAN_SYSTEM_HOOKS_VERSION, _assuan_npth_usleep, __assuan_pipe, \ - _assuan_npth_close, _assuan_npth_read, _assuan_npth_write, \ - _assuan_npth_recvmsg, _assuan_npth_sendmsg, \ - __assuan_spawn, _assuan_npth_waitpid, __assuan_socketpair, \ - __assuan_socket, _assuan_npth_connect } - -extern struct assuan_system_hooks _assuan_system_npth; -#define ASSUAN_SYSTEM_NPTH &_assuan_system_npth -#else -#define ASSUAN_SYSTEM_NPTH_IMPL /**/ -#define ASSUAN_SYSTEM_NPTH NULL -#endif #ifdef __cplusplus } diff --git a/src/context.c b/src/context.c index 78b4eb5..4246039 100644 --- a/src/context.c +++ b/src/context.c @@ -158,19 +158,6 @@ assuan_end_confidential (assuan_context_t ctx) assuan_set_flag (ctx, ASSUAN_CONFIDENTIAL, 0); } - -/* Set the system callbacks. */ -void -assuan_ctx_set_system_hooks (assuan_context_t ctx, - assuan_system_hooks_t system_hooks) -{ - TRACE2 (ctx, ASSUAN_LOG_CTX, "assuan_set_system_hooks", ctx, - "system_hooks=%p (version %i)", system_hooks, - system_hooks->version); - - _assuan_system_hooks_copy (&ctx->system, system_hooks); -} - /* Set the IO monitor function. */ void assuan_set_io_monitor (assuan_context_t ctx, diff --git a/src/system-posix.c b/src/system-posix.c index 7952907..3312523 100644 --- a/src/system-posix.c +++ b/src/system-posix.c @@ -430,23 +430,3 @@ __assuan_connect (assuan_context_t ctx, int sock, struct sockaddr *addr, { return connect (sock, addr, length); } - - - -/* The default system hooks for assuan contexts. */ -struct assuan_system_hooks _assuan_system_hooks = - { - 0, - __assuan_usleep, - __assuan_pipe, - __assuan_close, - __assuan_read, - __assuan_write, - __assuan_recvmsg, - __assuan_sendmsg, - __assuan_spawn, - __assuan_waitpid, - __assuan_socketpair, - __assuan_socket, - __assuan_connect - }; diff --git a/src/system.c b/src/system.c index 9807d9d..c6f0b3d 100644 --- a/src/system.c +++ b/src/system.c @@ -94,48 +94,6 @@ assuan_free (assuan_context_t ctx, void *ptr) } - -/* Copy the system hooks struct, paying attention to version - differences. SRC is usually from the user, DST MUST be from the - library. */ -void -_assuan_system_hooks_copy (assuan_system_hooks_t dst, - assuan_system_hooks_t src) - -{ - if (src == NULL) - return; - - /* Reset the defaults. */ - if (dst != &_assuan_system_hooks) - memcpy (dst, &_assuan_system_hooks, sizeof (*dst)); - - dst->version = ASSUAN_SYSTEM_HOOKS_VERSION; - if (src->version >= 1) - { - dst->usleep = src->usleep; - dst->pipe = src->pipe; - dst->close = src->close; - dst->read = src->read; - dst->write = src->write; - dst->sendmsg = src->sendmsg; - dst->recvmsg = src->recvmsg; - dst->spawn = src->spawn; - dst->waitpid = src->waitpid; - dst->socketpair = src->socketpair; - } - if (src->version >= 2) - { - dst->socket = src->socket; - dst->connect = src->connect; - } - if (src->version > 2) - /* FIXME. Application uses newer version of the library. What to - do? */ - ; -} - - /* Sleep for the given number of microseconds. */ void @@ -144,14 +102,9 @@ _assuan_usleep (assuan_context_t ctx, unsigned int usec) TRACE1 (ctx, ASSUAN_LOG_SYSIO, "_assuan_usleep", ctx, "usec=%u", usec); - if (ctx->system.version) - (ctx->system.usleep) (ctx, usec); - else - { - _assuan_pre_syscall (); - __assuan_usleep (ctx, usec); - _assuan_post_syscall (); - } + _assuan_pre_syscall (); + __assuan_usleep (ctx, usec); + _assuan_post_syscall (); } @@ -165,10 +118,7 @@ _assuan_pipe (assuan_context_t ctx, assuan_fd_t fd[2], int inherit_idx) "inherit_idx=%i (Assuan uses it for %s)", inherit_idx, inherit_idx ? "reading" : "writing"); - if (ctx->system.version) - err = (ctx->system.pipe) (ctx, fd, inherit_idx); - else - err = __assuan_pipe (ctx, fd, inherit_idx); + err = __assuan_pipe (ctx, fd, inherit_idx); if (err) return TRACE_SYSRES (err); @@ -182,19 +132,15 @@ _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 res; + TRACE1 (ctx, ASSUAN_LOG_SYSIO, "_assuan_close", ctx, "fd=0x%x", fd); - if (ctx->system.version) - return (ctx->system.close) (ctx, fd); - else - { - int res; - _assuan_pre_syscall (); - res = __assuan_close (ctx, fd); - _assuan_post_syscall (); - return res; - } + _assuan_pre_syscall (); + res = __assuan_close (ctx, fd); + _assuan_post_syscall (); + return res; } @@ -203,19 +149,15 @@ _assuan_close (assuan_context_t ctx, assuan_fd_t fd) int _assuan_close_inheritable (assuan_context_t ctx, assuan_fd_t fd) { + int res; + TRACE1 (ctx, ASSUAN_LOG_SYSIO, "_assuan_close_inheritable", ctx, "fd=0x%x", fd); - if (ctx->system.version) - return (ctx->system.close) (ctx, fd); - else - { - int res; - _assuan_pre_syscall (); - res = __assuan_close (ctx, fd); - _assuan_post_syscall (); - return res; - } + _assuan_pre_syscall (); + res = __assuan_close (ctx, fd); + _assuan_post_syscall (); + return res; } @@ -227,26 +169,16 @@ _assuan_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size) ssize_t res; TRACE_BEG3 (ctx, ASSUAN_LOG_SYSIO, "_assuan_read", ctx, "fd=0x%x, buffer=%p, size=%i", fd, buffer, size); - if (ctx->system.version) - res = (ctx->system.read) (ctx, fd, buffer, size); - else - { - _assuan_pre_syscall (); - res = __assuan_read (ctx, fd, buffer, size); - _assuan_post_syscall (); - } + _assuan_pre_syscall (); + res = __assuan_read (ctx, fd, buffer, size); + _assuan_post_syscall (); return TRACE_SYSRES (res); #else - if (ctx->system.version) - return (ctx->system.read) (ctx, fd, buffer, size); - else - { - ssize_t res; - _assuan_pre_syscall (); - res = __assuan_read (ctx, fd, buffer, size); - _assuan_post_syscall (); - return res; - } + ssize_t res; + _assuan_pre_syscall (); + res = __assuan_read (ctx, fd, buffer, size); + _assuan_post_syscall (); + return res; #endif } @@ -260,26 +192,16 @@ _assuan_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer, ssize_t res; TRACE_BEG3 (ctx, ASSUAN_LOG_SYSIO, "_assuan_write", ctx, "fd=0x%x, buffer=%p, size=%i", fd, buffer, size); - if (ctx->system.version) - res = (ctx->system.write) (ctx, fd, buffer, size); - else - { - _assuan_pre_syscall (); - res = __assuan_write (ctx, fd, buffer, size); - _assuan_post_syscall (); - } + _assuan_pre_syscall (); + res = __assuan_write (ctx, fd, buffer, size); + _assuan_post_syscall (); return TRACE_SYSRES (res); #else - if (ctx->system.version) - return (ctx->system.write) (ctx, fd, buffer, size); - else - { - ssize_t res; - _assuan_pre_syscall (); - res = __assuan_write (ctx, fd, buffer, size); - _assuan_post_syscall (); - return res; - } + ssize_t res; + _assuan_pre_syscall (); + res = __assuan_write (ctx, fd, buffer, size); + _assuan_post_syscall (); + return res; #endif } @@ -293,14 +215,9 @@ _assuan_recvmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, int res; TRACE_BEG3 (ctx, ASSUAN_LOG_SYSIO, "_assuan_recvmsg", ctx, "fd=0x%x, msg=%p, flags=0x%x", fd, msg, flags); - if (ctx->system.version) - res = (ctx->system.recvmsg) (ctx, fd, msg, flags); - else - { - _assuan_pre_syscall (); - res = __assuan_recvmsg (ctx, fd, msg, flags); - _assuan_post_syscall (); - } + _assuan_pre_syscall (); + res = __assuan_recvmsg (ctx, fd, msg, flags); + _assuan_post_syscall (); if (res > 0) { struct cmsghdr *cmptr; @@ -321,16 +238,11 @@ _assuan_recvmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, } return TRACE_SYSRES (res); #else - if (ctx->system.version) - return (ctx->system.recvmsg) (ctx, fd, msg, flags); - else - { - int res; - _assuan_pre_syscall (); - res = __assuan_recvmsg (ctx, fd, msg, flags); - _assuan_post_syscall (); - return res; - } + int res; + _assuan_pre_syscall (); + res = __assuan_recvmsg (ctx, fd, msg, flags); + _assuan_post_syscall (); + return res; #endif } @@ -361,26 +273,16 @@ _assuan_sendmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, cmptr->cmsg_level, cmptr->cmsg_type, *(int *)data); } } - if (ctx->system.version) - res = (ctx->system.sendmsg) (ctx, fd, msg, flags); - else - { - _assuan_pre_syscall (); - res = __assuan_sendmsg (ctx, fd, msg, flags); - _assuan_post_syscall (); - } + _assuan_pre_syscall (); + res = __assuan_sendmsg (ctx, fd, msg, flags); + _assuan_post_syscall (); return TRACE_SYSRES (res); #else - if (ctx->system.version) - return (ctx->system.sendmsg) (ctx, fd, msg, flags); - else - { - int res; - _assuan_pre_syscall (); - res = __assuan_sendmsg (ctx, fd, msg, flags); - _assuan_post_syscall (); - return res; - } + int res; + _assuan_pre_syscall (); + res = __assuan_sendmsg (ctx, fd, msg, flags); + _assuan_post_syscall (); + return res; #endif } @@ -425,12 +327,8 @@ _assuan_spawn (assuan_context_t ctx, assuan_pid_t *r_pid, const char *name, } } - if (ctx->system.version) - res = (ctx->system.spawn) (ctx, r_pid, name, argv, fd_in, fd_out, - fd_child_list, atfork, atforkvalue, flags); - else - res = __assuan_spawn (ctx, r_pid, name, argv, fd_in, fd_out, - fd_child_list, atfork, atforkvalue, flags); + res = __assuan_spawn (ctx, r_pid, name, argv, fd_in, fd_out, + fd_child_list, atfork, atforkvalue, flags); if (name) { @@ -457,26 +355,15 @@ _assuan_waitpid (assuan_context_t ctx, assuan_pid_t pid, int action, TRACE_BEG4 (ctx, ASSUAN_LOG_SYSIO, "_assuan_waitpid", ctx, "pid=%i, action=%i, status=%p, options=%i", pid, action, status, options); - if (ctx->system.version) - res = (ctx->system.waitpid) (ctx, pid, action, status, options); - else - { - _assuan_pre_syscall (); - res = __assuan_waitpid (ctx, pid, action, status, options); - _assuan_post_syscall (); - } - return TRACE_SYSRES (res); + _assuan_pre_syscall (); + res = __assuan_waitpid (ctx, pid, action, status, options); + _assuan_post_syscall (); #else - if (ctx->system.version) - return (ctx->system.waitpid) (ctx, pid, action, status, options); - else - { - assuan_pid_t res; - _assuan_pre_syscall (); - res = __assuan_waitpid (ctx, pid, action, status, options); - _assuan_post_syscall (); - return res; - } + assuan_pid_t res; + _assuan_pre_syscall (); + res = __assuan_waitpid (ctx, pid, action, status, options); + _assuan_post_syscall (); + return res; #endif } @@ -491,10 +378,7 @@ _assuan_socketpair (assuan_context_t ctx, int namespace, int style, "namespace=%i,style=%i,protocol=%i,filedes=%p", namespace, style, protocol, filedes); - if (ctx->system.version) - res = (ctx->system.socketpair) (ctx, namespace, style, protocol, filedes); - else - res = __assuan_socketpair (ctx, namespace, style, protocol, filedes); + res = __assuan_socketpair (ctx, namespace, style, protocol, filedes); if (res == 0) TRACE_LOG2 ("filedes = { 0x%x, 0x%x }", filedes[0], filedes[1]); @@ -511,10 +395,7 @@ _assuan_socket (assuan_context_t ctx, int namespace, int style, int protocol) "namespace=%i,style=%i,protocol=%i", namespace, style, protocol); - if (ctx->system.version) - res = (ctx->system.socket) (ctx, namespace, style, protocol); - else - res = __assuan_socket (ctx, namespace, style, protocol); + res = __assuan_socket (ctx, namespace, style, protocol); return TRACE_SYSRES (res); } @@ -527,13 +408,8 @@ _assuan_connect (assuan_context_t ctx, assuan_fd_t sock, TRACE_BEG3 (ctx, ASSUAN_LOG_SYSIO, "_assuan_connect", ctx, "socket=%i,addr=%p,length=%i", sock, addr, length); - if (ctx->system.version) - res = (ctx->system.connect) (ctx, sock, addr, length); - else - { - _assuan_pre_syscall (); - res = __assuan_connect (ctx, sock, addr, length); - _assuan_post_syscall (); - } + _assuan_pre_syscall (); + res = __assuan_connect (ctx, sock, addr, length); + _assuan_post_syscall (); return TRACE_SYSRES (res); } -- cgit v1.2.3