unix: add non block send and receive flavors for fd passing
[lttng-tools.git] / src / common / unix.h
1 /*
2 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8 #ifndef _LTTCOMM_UNIX_H
9 #define _LTTCOMM_UNIX_H
10
11 #include <limits.h>
12 #include <sys/un.h>
13
14 #include <common/compat/socket.h>
15 #include <common/macros.h>
16
17 LTTNG_HIDDEN
18 int lttcomm_create_unix_sock(const char *pathname);
19 LTTNG_HIDDEN
20 int lttcomm_create_anon_unix_socketpair(int *fds);
21 LTTNG_HIDDEN
22 int lttcomm_connect_unix_sock(const char *pathname);
23 LTTNG_HIDDEN
24 int lttcomm_accept_unix_sock(int sock);
25 LTTNG_HIDDEN
26 int lttcomm_listen_unix_sock(int sock);
27 LTTNG_HIDDEN
28 int lttcomm_close_unix_sock(int sock);
29
30 /* Send a message accompanied by fd(s) over a unix socket. */
31 LTTNG_HIDDEN
32 ssize_t lttcomm_send_fds_unix_sock(int sock, const int *fds, size_t nb_fd);
33 LTTNG_HIDDEN
34 ssize_t lttcomm_send_fds_unix_sock_non_block(
35 int sock, const int *fds, size_t nb_fd);
36 /* Recv a message accompanied by fd(s) from a unix socket */
37 LTTNG_HIDDEN
38 ssize_t lttcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd);
39 LTTNG_HIDDEN
40 ssize_t lttcomm_recv_fds_unix_sock_non_block(int sock, int *fds, size_t nb_fd);
41
42 LTTNG_HIDDEN
43 ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len);
44 LTTNG_HIDDEN
45 ssize_t lttcomm_recv_unix_sock_non_block(int sock, void *buf, size_t len);
46 LTTNG_HIDDEN
47 ssize_t lttcomm_send_unix_sock(int sock, const void *buf, size_t len);
48 LTTNG_HIDDEN
49 ssize_t lttcomm_send_unix_sock_non_block(int sock, const void *buf, size_t len);
50
51 LTTNG_HIDDEN
52 ssize_t lttcomm_send_creds_unix_sock(int sock, void *buf, size_t len);
53 LTTNG_HIDDEN
54 ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len,
55 lttng_sock_cred *creds);
56
57 LTTNG_HIDDEN
58 int lttcomm_setsockopt_creds_unix_sock(int sock);
59
60 #endif /* _LTTCOMM_UNIX_H */
This page took 0.040418 seconds and 4 git commands to generate.