projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Port: Add OSX clock_gettime compat
[lttng-tools.git]
/
src
/
common
/
sessiond-comm
/
inet6.c
diff --git
a/src/common/sessiond-comm/inet6.c
b/src/common/sessiond-comm/inet6.c
index 52e2f8e5853d9abdb6b6bc059998fb8a92e3057c..1413c35172a32bfda2293bbe8aae6fd8acba6c1a 100644
(file)
--- a/
src/common/sessiond-comm/inet6.c
+++ b/
src/common/sessiond-comm/inet6.c
@@
-15,7
+15,7
@@
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _
GNU
_SOURCE
+#define _
LGPL
_SOURCE
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <assert.h>
#include <limits.h>
#include <stdio.h>
@@
-26,7
+26,7
@@
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
-#include <time.h>
+#include <
common/compat/
time.h>
#include <poll.h>
#include <common/common.h>
#include <poll.h>
#include <common/common.h>
@@
-57,6
+57,7
@@
LTTNG_HIDDEN
int lttcomm_create_inet6_sock(struct lttcomm_sock *sock, int type, int proto)
{
int val = 1, ret;
int lttcomm_create_inet6_sock(struct lttcomm_sock *sock, int type, int proto)
{
int val = 1, ret;
+ unsigned long timeout;
/* Create server socket */
if ((sock->fd = socket(PF_INET6, type, proto)) < 0) {
/* Create server socket */
if ((sock->fd = socket(PF_INET6, type, proto)) < 0) {
@@
-74,6
+75,17
@@
int lttcomm_create_inet6_sock(struct lttcomm_sock *sock, int type, int proto)
PERROR("setsockopt inet6");
goto error;
}
PERROR("setsockopt inet6");
goto error;
}
+ timeout = lttcomm_get_network_timeout();
+ if (timeout) {
+ ret = lttcomm_setsockopt_rcv_timeout(sock->fd, timeout);
+ if (ret) {
+ goto error;
+ }
+ ret = lttcomm_setsockopt_snd_timeout(sock->fd, timeout);
+ if (ret) {
+ goto error;
+ }
+ }
return 0;
return 0;
@@
-89,7
+101,7
@@
int lttcomm_bind_inet6_sock(struct lttcomm_sock *sock)
{
int ret;
{
int ret;
- ret = bind(sock->fd, &sock->sockaddr.addr.sin6,
+ ret = bind(sock->fd,
(const struct sockaddr *)
&sock->sockaddr.addr.sin6,
sizeof(sock->sockaddr.addr.sin6));
if (ret < 0) {
PERROR("bind inet6");
sizeof(sock->sockaddr.addr.sin6));
if (ret < 0) {
PERROR("bind inet6");
@@
-145,7
+157,7
@@
int connect_with_timeout(struct lttcomm_sock *sock)
return -1;
}
return -1;
}
- ret = clock_gettime(CLOCK_MONOTONIC, &orig_time);
+ ret =
lttng_
clock_gettime(CLOCK_MONOTONIC, &orig_time);
if (ret == -1) {
PERROR("clock_gettime");
return -1;
if (ret == -1) {
PERROR("clock_gettime");
return -1;
@@
-199,7
+211,7
@@
int connect_with_timeout(struct lttcomm_sock *sock)
}
}
/* ret == 0: timeout */
}
}
/* ret == 0: timeout */
- ret = clock_gettime(CLOCK_MONOTONIC, &cur_time);
+ ret =
lttng_
clock_gettime(CLOCK_MONOTONIC, &cur_time);
if (ret == -1) {
PERROR("clock_gettime");
connect_ret = ret;
if (ret == -1) {
PERROR("clock_gettime");
connect_ret = ret;
@@
-374,7
+386,7
@@
ssize_t lttcomm_recvmsg_inet6_sock(struct lttcomm_sock *sock, void *buf,
* Return the size of sent data.
*/
LTTNG_HIDDEN
* Return the size of sent data.
*/
LTTNG_HIDDEN
-ssize_t lttcomm_sendmsg_inet6_sock(struct lttcomm_sock *sock, void *buf,
+ssize_t lttcomm_sendmsg_inet6_sock(struct lttcomm_sock *sock,
const
void *buf,
size_t len, int flags)
{
struct msghdr msg;
size_t len, int flags)
{
struct msghdr msg;
@@
-383,7
+395,7
@@
ssize_t lttcomm_sendmsg_inet6_sock(struct lttcomm_sock *sock, void *buf,
memset(&msg, 0, sizeof(msg));
memset(&msg, 0, sizeof(msg));
- iov[0].iov_base = buf;
+ iov[0].iov_base =
(void *)
buf;
iov[0].iov_len = len;
msg.msg_iov = iov;
msg.msg_iovlen = 1;
iov[0].iov_len = len;
msg.msg_iov = iov;
msg.msg_iovlen = 1;
This page took
0.025798 seconds
and
5
git commands to generate.