X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust-comm%2Flttng-ust-comm.c;fp=liblttng-ust-comm%2Flttng-ust-comm.c;h=d065499a246320f9dc2e00c7403471d3a35123e1;hb=27d8df8abdd6b40203be18365146889d88a28e11;hp=cee1b694333c8a264955c079692908ff6b49d792;hpb=18f50698292ff3b917e715922cb12626212b138f;p=lttng-ust.git diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c index cee1b694..d065499a 100644 --- a/liblttng-ust-comm/lttng-ust-comm.c +++ b/liblttng-ust-comm/lttng-ust-comm.c @@ -86,7 +86,7 @@ const char *lttng_ust_strerror(int code) * * Connect to unix socket using the path name. */ -int ustcomm_connect_unix_sock(const char *pathname) +int ustcomm_connect_unix_sock(const char *pathname, long timeout) { struct sockaddr_un sun; int fd, ret; @@ -101,6 +101,15 @@ int ustcomm_connect_unix_sock(const char *pathname) ret = -errno; goto error; } + if (timeout >= 0) { + /* Give at least 10ms. */ + if (timeout < 10) + timeout = 10; + ret = ustcomm_setsockopt_snd_timeout(fd, timeout); + if (ret < 0) { + WARN("Error setting connect socket send timeout"); + } + } ret = fcntl(fd, F_SETFD, FD_CLOEXEC); if (ret < 0) { PERROR("fcntl");