projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests: user space context: remove unneeded test import
[lttng-tools.git]
/
src
/
common
/
sessiond-comm
/
inet.cpp
diff --git
a/src/common/sessiond-comm/inet.cpp
b/src/common/sessiond-comm/inet.cpp
index 20eb613a82aa2182662f65062cc6f8119871bb1d..633685799aad448f352adfac358c5214269dfa05 100644
(file)
--- a/
src/common/sessiond-comm/inet.cpp
+++ b/
src/common/sessiond-comm/inet.cpp
@@
-6,25
+6,25
@@
*/
#define _LGPL_SOURCE
*/
#define _LGPL_SOURCE
+#include "inet.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/errno.hpp>
+#include <common/compat/time.hpp>
+#include <common/time.hpp>
+
#include <algorithm>
#include <algorithm>
+#include <fcntl.h>
#include <limits.h>
#include <limits.h>
+#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <common/compat/time.h>
-#include <poll.h>
-
-#include <common/common.h>
-#include <common/time.h>
-#include <common/compat/errno.h>
-
-#include "inet.h"
-#define RECONNECT_DELAY
200
/* ms */
+#define RECONNECT_DELAY
200
/* ms */
/*
* INET protocol operations.
/*
* INET protocol operations.
@@
-93,16
+93,14
@@
int lttcomm_bind_inet_sock(struct lttcomm_sock *sock)
return bind(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
}
return bind(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
}
-static
-int connect_no_timeout(struct lttcomm_sock *sock)
+static int connect_no_timeout(struct lttcomm_sock *sock)
{
struct sockaddr_in sockaddr = sock->sockaddr.addr.sin;
return connect(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
}
{
struct sockaddr_in sockaddr = sock->sockaddr.addr.sin;
return connect(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
}
-static
-int connect_with_timeout(struct lttcomm_sock *sock)
+static int connect_with_timeout(struct lttcomm_sock *sock)
{
unsigned long timeout = lttcomm_get_network_timeout();
int ret, flags, connect_ret;
{
unsigned long timeout = lttcomm_get_network_timeout();
int ret, flags, connect_ret;
@@
-132,8
+130,7
@@
int connect_with_timeout(struct lttcomm_sock *sock)
sockaddr = sock->sockaddr.addr.sin;
connect_ret = connect(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
sockaddr = sock->sockaddr.addr.sin;
connect_ret = connect(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
- if (connect_ret == -1 && errno != EAGAIN && errno != EWOULDBLOCK &&
- errno != EINPROGRESS) {
+ if (connect_ret == -1 && errno != EAGAIN && errno != EWOULDBLOCK && errno != EINPROGRESS) {
goto error;
} else if (!connect_ret) {
/* Connect succeeded */
goto error;
} else if (!connect_ret) {
/* Connect succeeded */
@@
-141,7
+138,9
@@
int connect_with_timeout(struct lttcomm_sock *sock)
}
DBG("Asynchronous connect for sock %d, performing polling with"
}
DBG("Asynchronous connect for sock %d, performing polling with"
- " timeout: %lums", sock->fd, timeout);
+ " timeout: %lums",
+ sock->fd,
+ timeout);
/*
* Perform poll loop following EINPROGRESS recommendation from
* connect(2) man page.
/*
* Perform poll loop following EINPROGRESS recommendation from
* connect(2) man page.
@@
-165,8
+164,7
@@
int connect_with_timeout(struct lttcomm_sock *sock)
goto error;
}
/* got something */
goto error;
}
/* got something */
- ret = getsockopt(sock->fd, SOL_SOCKET,
- SO_ERROR, &optval, &optval_len);
+ ret = getsockopt(sock->fd, SOL_SOCKET, SO_ERROR, &optval, &optval_len);
if (ret) {
PERROR("getsockopt");
goto error;
if (ret) {
PERROR("getsockopt");
goto error;
@@
-258,7
+256,7
@@
struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock)
}
new_sock = lttcomm_alloc_sock(sock->proto);
}
new_sock = lttcomm_alloc_sock(sock->proto);
- if (new_sock ==
NULL
) {
+ if (new_sock ==
nullptr
) {
goto error;
}
goto error;
}
@@
-298,7
+296,7
@@
error_close:
error:
free(new_sock);
error:
free(new_sock);
- return
NULL
;
+ return
nullptr
;
}
/*
}
/*
@@
-334,8
+332,7
@@
end:
*
* Return the size of received data.
*/
*
* Return the size of received data.
*/
-ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf,
- size_t len, int flags)
+ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf, size_t len, int flags)
{
struct msghdr msg;
struct iovec iov[1];
{
struct msghdr msg;
struct iovec iov[1];
@@
-390,8
+387,7
@@
end:
*
* Return the size of sent data.
*/
*
* Return the size of sent data.
*/
-ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, const void *buf,
- size_t len, int flags)
+ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, const void *buf, size_t len, int flags)
{
struct msghdr msg;
struct iovec iov[1];
{
struct msghdr msg;
struct iovec iov[1];
@@
-484,7
+480,7
@@
static unsigned long read_proc_value(const char *path)
buf[size_ret] = '\0';
errno = 0;
buf[size_ret] = '\0';
errno = 0;
- r_val = strtol(buf,
NULL
, 10);
+ r_val = strtol(buf,
nullptr
, 10);
if (errno != 0 || r_val < -1L) {
val = 0;
goto error_close;
if (errno != 0 || r_val < -1L) {
val = 0;
goto error_close;
@@
-503,7
+499,7
@@
error:
return val;
}
return val;
}
-void lttcomm_inet_init(
void
)
+void lttcomm_inet_init()
{
unsigned long syn_retries, fin_timeout, syn_timeout, env;
{
unsigned long syn_retries, fin_timeout, syn_timeout, env;
@@
-525,8
+521,8
@@
void lttcomm_inet_init(void)
* Get the maximum between the two possible timeout value and use that to
* get the maximum with the default timeout.
*/
* Get the maximum between the two possible timeout value and use that to
* get the maximum with the default timeout.
*/
- lttcomm_inet_tcp_timeout =
std::max(std::max(syn_timeout, fin_timeout),
-
lttcomm_inet_tcp_timeout);
+ lttcomm_inet_tcp_timeout =
+
std::max(std::max(syn_timeout, fin_timeout),
lttcomm_inet_tcp_timeout);
end:
DBG("TCP inet operation timeout set to %lu sec", lttcomm_inet_tcp_timeout);
end:
DBG("TCP inet operation timeout set to %lu sec", lttcomm_inet_tcp_timeout);
This page took
0.025208 seconds
and
4
git commands to generate.