aboutsummaryrefslogtreecommitdiffstats
path: root/src/assuan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/assuan.c')
-rw-r--r--src/assuan.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/assuan.c b/src/assuan.c
index b6dec93..772e892 100644
--- a/src/assuan.c
+++ b/src/assuan.c
@@ -36,6 +36,14 @@
/* Global default state. */
+/* Functions called before and after blocking syscalls. */
+static void (*pre_syscall_func) (void);
+static void (*post_syscall_func) (void);
+
+/* Variable to see if functions above are initialized. */
+static int _assuan_syscall_func_initialized;
+
+
/* The default error source gor generated error codes. */
static gpg_err_source_t _assuan_default_err_source = GPG_ERR_SOURCE_USER_1;
@@ -106,6 +114,23 @@ assuan_set_system_hooks (assuan_system_hooks_t system_hooks)
}
+/* Used before blocking system calls. */
+void
+_assuan_pre_syscall (void)
+{
+ if (pre_syscall_func)
+ pre_syscall_func ();
+}
+
+
+/* Used after blocking system calls. */
+void
+_assuan_post_syscall (void)
+{
+ if (post_syscall_func)
+ post_syscall_func ();
+}
+
/* Create a new Assuan context. The initial parameters are all needed
in the creation of the context. */
gpg_error_t
@@ -116,6 +141,12 @@ assuan_new_ext (assuan_context_t *r_ctx, gpg_err_source_t err_source,
struct assuan_context_s wctx;
assuan_context_t ctx;
+ if (!_assuan_syscall_func_initialized)
+ {
+ gpgrt_get_syscall_clamp (&pre_syscall_func, &post_syscall_func);
+ _assuan_syscall_func_initialized = 1;
+ }
+
/* Set up a working context so we can use standard functions. */
memset (&wctx, 0, sizeof (wctx));
wctx.err_source = err_source;