Git 2.32
[git] / compat / simple-ipc / ipc-shared.c
1 #include "cache.h"
2 #include "simple-ipc.h"
3 #include "strbuf.h"
4 #include "pkt-line.h"
5 #include "thread-utils.h"
6
7 #ifndef SUPPORTS_SIMPLE_IPC
8 /*
9  * This source file should only be compiled when Simple IPC is supported.
10  * See the top-level Makefile.
11  */
12 #error SUPPORTS_SIMPLE_IPC not defined
13 #endif
14
15 int ipc_server_run(const char *path, const struct ipc_server_opts *opts,
16                    ipc_server_application_cb *application_cb,
17                    void *application_data)
18 {
19         struct ipc_server_data *server_data = NULL;
20         int ret;
21
22         ret = ipc_server_run_async(&server_data, path, opts,
23                                    application_cb, application_data);
24         if (ret)
25                 return ret;
26
27         ret = ipc_server_await(server_data);
28
29         ipc_server_free(server_data);
30
31         return ret;
32 }