X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fsessiond-comm%2Finet.h;h=2db8c0890da184a0f429d13710977e507aede0e8;hb=235493868254e943513c6552c6821236284f00ac;hp=89716b8bafdb0b19cfaa1cca503e34af140711dc;hpb=6364a07adde1072d595044a19359e61fc27940dd;p=lttng-tools.git diff --git a/src/common/sessiond-comm/inet.h b/src/common/sessiond-comm/inet.h index 89716b8ba..2db8c0890 100644 --- a/src/common/sessiond-comm/inet.h +++ b/src/common/sessiond-comm/inet.h @@ -1,28 +1,37 @@ /* - * Copyright (C) 2012 - David Goulet + * Copyright (C) 2012 David Goulet * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License, version 2 only, as - * published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _LTTCOMM_INET_H #define _LTTCOMM_INET_H -#define _GNU_SOURCE #include #include "sessiond-comm.h" +/* See man tcp(7) for more detail about this value. */ +#define LTTCOMM_INET_PROC_SYN_RETRIES_PATH "/proc/sys/net/ipv4/tcp_syn_retries" +#define LTTCOMM_INET_PROC_FIN_TIMEOUT_PATH "/proc/sys/net/ipv4/tcp_fin_timeout" + +/* + * The timeout value of a connect() is computed with an algorithm inside the + * kernel using the defined TCP SYN retries so the end value in time is + * approximative. According to tcp(7) man page, a value of 5 is roughly 180 + * seconds of timeout. With that information, we've computed a factor of 36 + * (180/5) by considering that it grows linearly. This is of course uncertain + * but this is the best approximation we can do at runtime. + */ +#define LTTCOMM_INET_SYN_TIMEOUT_FACTOR 36 + +/* + * Maximum timeout value in seconds of a TCP connection for both send/recv and + * connect operations. + */ +extern unsigned long lttcomm_inet_tcp_timeout; + /* Stub */ struct lttcomm_sock; @@ -38,7 +47,10 @@ extern int lttcomm_listen_inet_sock(struct lttcomm_sock *sock, int backlog); extern ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf, size_t len, int flags); -extern ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, void *buf, - size_t len, int flags); +extern ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, + const void *buf, size_t len, int flags); + +/* Initialize inet communication layer. */ +extern void lttcomm_inet_init(void); #endif /* _LTTCOMM_INET_H */