X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust-comm%2Flttng-ust-comm.c;h=7ba23c527ce0e9b3c2c621e4fe66acf3af33c37d;hb=8f62fbe3204b1f7c6c91401c38f2d30cfc644906;hp=ecc23821fb6fa29624dcbc25564c5011eed4aafb;hpb=a3b964ebc0510bacc9af2d729f1a68c2e3ccc95d;p=lttng-ust.git diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c index ecc23821..7ba23c52 100644 --- a/liblttng-ust-comm/lttng-ust-comm.c +++ b/liblttng-ust-comm/lttng-ust-comm.c @@ -95,7 +95,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; @@ -110,6 +110,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");