Git 2.32
[git] / unix-stream-server.h
1 #ifndef UNIX_STREAM_SERVER_H
2 #define UNIX_STREAM_SERVER_H
3
4 #include "unix-socket.h"
5
6 struct unix_ss_socket {
7         char *path_socket;
8         struct stat st_socket;
9         int fd_socket;
10 };
11
12 /*
13  * Create a Unix Domain Socket at the given path under the protection
14  * of a '.lock' lockfile.
15  *
16  * Returns 0 on success, -1 on error, -2 if socket is in use.
17  */
18 int unix_ss_create(const char *path,
19                    const struct unix_stream_listen_opts *opts,
20                    long timeout_ms,
21                    struct unix_ss_socket **server_socket);
22
23 /*
24  * Close and delete the socket.
25  */
26 void unix_ss_free(struct unix_ss_socket *server_socket);
27
28 /*
29  * Return 1 if the inode of the pathname to our socket changes.
30  */
31 int unix_ss_was_stolen(struct unix_ss_socket *server_socket);
32
33 #endif /* UNIX_STREAM_SERVER_H */