diff options
author | Jeff Hostetler <jeffhost@microsoft.com> | 2021-03-22 10:29:47 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-03-22 11:52:54 -0700 |
commit | 7cd5dbcaba44914c07a51377e75c4e8bbe31f319 (patch) | |
tree | fcfcd332b445434970a85c0f6135e7a555e7d8c1 /simple-ipc.h | |
parent | 9fd19027621fc4f8beb2e57ba37d91465d1906f6 (diff) | |
download | git-7cd5dbcaba44914c07a51377e75c4e8bbe31f319.tar.gz |
simple-ipc: add Unix domain socket implementation
Create Unix domain socket based implementation of "simple-ipc".
A set of `ipc_client` routines implement a client library to connect
to an `ipc_server` over a Unix domain socket, send a simple request,
and receive a single response. Clients use blocking IO on the socket.
A set of `ipc_server` routines implement a thread pool to listen for
and concurrently service client connections.
The server creates a new Unix domain socket at a known location. If a
socket already exists with that name, the server tries to determine if
another server is already listening on the socket or if the socket is
dead. If socket is busy, the server exits with an error rather than
stealing the socket. If the socket is dead, the server creates a new
one and starts up.
If while running, the server detects that its socket has been stolen
by another server, it automatically exits.
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'simple-ipc.h')
-rw-r--r-- | simple-ipc.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/simple-ipc.h b/simple-ipc.h index ab5619e3d7..dc3606e30b 100644 --- a/simple-ipc.h +++ b/simple-ipc.h @@ -5,7 +5,7 @@ * See Documentation/technical/api-simple-ipc.txt */ -#if defined(GIT_WINDOWS_NATIVE) +#if defined(GIT_WINDOWS_NATIVE) || !defined(NO_UNIX_SOCKETS) #define SUPPORTS_SIMPLE_IPC #endif @@ -62,11 +62,17 @@ struct ipc_client_connect_options { * the service and need to wait for it to become ready. */ unsigned int wait_if_not_found:1; + + /* + * Disallow chdir() when creating a Unix domain socket. + */ + unsigned int uds_disallow_chdir:1; }; #define IPC_CLIENT_CONNECT_OPTIONS_INIT { \ .wait_if_busy = 0, \ .wait_if_not_found = 0, \ + .uds_disallow_chdir = 0, \ } /* @@ -159,6 +165,11 @@ struct ipc_server_data; struct ipc_server_opts { int nr_threads; + + /* + * Disallow chdir() when creating a Unix domain socket. + */ + unsigned int uds_disallow_chdir:1; }; /* |