aboutsummaryrefslogtreecommitdiffstats
path: root/src/assuan-pipe-connect.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2007-12-12 16:29:37 +0000
committerWerner Koch <[email protected]>2007-12-12 16:29:37 +0000
commit0d29897055ae5ca5428e8aff3f7e6ac183d0e4b0 (patch)
tree556b044081be347121a1aa3d8321c2e9205f1eb6 /src/assuan-pipe-connect.c
parent2007-11-23 Marcus Brinkmann <[email protected]> (diff)
downloadlibassuan-0d29897055ae5ca5428e8aff3f7e6ac183d0e4b0.tar.gz
libassuan-0d29897055ae5ca5428e8aff3f7e6ac183d0e4b0.zip
Documentaion updates.libassuan-1.0.4
Preparing a release.
Diffstat (limited to 'src/assuan-pipe-connect.c')
-rw-r--r--src/assuan-pipe-connect.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/assuan-pipe-connect.c b/src/assuan-pipe-connect.c
index 6ba3e71..05a3be9 100644
--- a/src/assuan-pipe-connect.c
+++ b/src/assuan-pipe-connect.c
@@ -1,5 +1,6 @@
/* assuan-pipe-connect.c - Establish a pipe connection (client)
- * Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2003, 2005, 2006,
+ * 2007 Free Software Foundation, Inc.
*
* This file is part of Assuan.
*
@@ -181,13 +182,15 @@ pipe_connect_unix (assuan_context_t *ctx,
const char *name, const char *const argv[],
int *fd_child_list,
void (*atfork) (void *opaque, int reserved),
- void *atforkvalue)
+ void *atforkvalue, unsigned int flags)
{
assuan_error_t err;
int rp[2];
int wp[2];
char mypidstr[50];
+ (void)flags;
+
if (!ctx || !name || !argv || !argv[0])
return _assuan_error (ASSUAN_Invalid_Value);
@@ -647,7 +650,7 @@ pipe_connect_w32 (assuan_context_t *ctx,
const char *name, const char *const argv[],
int *fd_child_list,
void (*atfork) (void *opaque, int reserved),
- void *atforkvalue)
+ void *atforkvalue, unsigned int flags)
{
assuan_error_t err;
assuan_fd_t rp[2];
@@ -771,6 +774,7 @@ pipe_connect_w32 (assuan_context_t *ctx,
&sec_attr, /* Thread security attributes. */
TRUE, /* Inherit handles. */
(CREATE_DEFAULT_ERROR_MODE
+ | ((flags & 128)? DETACHED_PROCESS : 0)
| GetPriorityClass (GetCurrentProcess ())
| CREATE_SUSPENDED), /* Creation flags. */
NULL, /* Environment. */
@@ -823,7 +827,7 @@ assuan_error_t
assuan_pipe_connect (assuan_context_t *ctx, const char *name,
const char *const argv[], int *fd_child_list)
{
- return pipe_connect (ctx, name, argv, fd_child_list, NULL, NULL);
+ return pipe_connect (ctx, name, argv, fd_child_list, NULL, NULL, 0);
}
@@ -835,7 +839,7 @@ assuan_pipe_connect2 (assuan_context_t *ctx,
void (*atfork) (void *opaque, int reserved),
void *atforkvalue)
{
- return pipe_connect (ctx, name, argv, fd_child_list, atfork, atforkvalue);
+ return pipe_connect (ctx, name, argv, fd_child_list, atfork, atforkvalue, 0);
}
@@ -848,9 +852,19 @@ assuan_pipe_connect2 (assuan_context_t *ctx,
as the second argument. The ATFORK function should only act if the
second value is 0.
- For now FLAGS may either take the value 0 to behave like
- assuan_pipe_connect2 or 1 to enable the described full-duplex
- socket behaviour.
+ FLAGS is a bit vector and controls how the function acts:
+ Bit 0: If cleared a simple pipe based server is expected and the
+ function behaves similar to `assuan_pipe_connect'.
+
+ If set a server based on full-duplex pipes is expected. Such
+ pipes are usually created using the `socketpair' function.
+ It also enables features only available with such servers.
+
+ Bit 7: If set and there is a need to start ther server it will be
+ started as a background process. This flag is useful under
+ W32 systems, so that no new console is created and pops up a
+ console window when starting the server
+
If NAME as well as ARGV are NULL, no exec is done but the same
process is continued. However all file descriptors are closed and
@@ -874,6 +888,7 @@ assuan_pipe_connect_ext (assuan_context_t *ctx,
#endif
}
else
- return pipe_connect (ctx, name, argv, fd_child_list, atfork, atforkvalue);
+ return pipe_connect (ctx, name, argv, fd_child_list, atfork, atforkvalue,
+ flags);
}