projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove gettid warning
[lttng-ust.git]
/
liblttng-ust-comm
/
lttng-ust-comm.c
diff --git
a/liblttng-ust-comm/lttng-ust-comm.c
b/liblttng-ust-comm/lttng-ust-comm.c
index 0781f4cecb4408f0746d8e1f3586f740d09aae4a..078b56a01bb68c49c2322fc2a8f454d597305314 100644
(file)
--- a/
liblttng-ust-comm/lttng-ust-comm.c
+++ b/
liblttng-ust-comm/lttng-ust-comm.c
@@
-29,6
+29,7
@@
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
+#include <fcntl.h>
#include <ust-comm.h>
#include <ust-comm.h>
@@
-119,12
+120,17
@@
int ustcomm_connect_unix_sock(const char *pathname)
* libust threads require the close-on-exec flag for all
* resources so it does not leak file descriptors upon exec.
*/
* libust threads require the close-on-exec flag for all
* resources so it does not leak file descriptors upon exec.
*/
- fd = socket(PF_UNIX, SOCK_STREAM
| SOCK_CLOEXEC
, 0);
+ fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
perror("socket");
ret = fd;
goto error;
}
if (fd < 0) {
perror("socket");
ret = fd;
goto error;
}
+ ret = fcntl(fd, F_SETFD, FD_CLOEXEC);
+ if (ret < 0) {
+ perror("fcntl");
+ goto error_fcntl;
+ }
memset(&sun, 0, sizeof(sun));
sun.sun_family = AF_UNIX;
memset(&sun, 0, sizeof(sun));
sun.sun_family = AF_UNIX;
@@
-144,6
+150,7
@@
int ustcomm_connect_unix_sock(const char *pathname)
return fd;
error_connect:
return fd;
error_connect:
+error_fcntl:
close(fd);
error:
return ret;
close(fd);
error:
return ret;
@@
-284,7
+291,9
@@
ssize_t ustcomm_send_unix_sock(int sock, void *buf, size_t len)
* by ignoring SIGPIPE, but we don't have this luxury on the
* libust side.
*/
* by ignoring SIGPIPE, but we don't have this luxury on the
* libust side.
*/
- ret = sendmsg(sock, &msg, MSG_NOSIGNAL);
+ do {
+ ret = sendmsg(sock, &msg, MSG_NOSIGNAL);
+ } while (ret < 0 && errno == EINTR);
if (ret < 0 && errno != EPIPE) {
perror("sendmsg");
}
if (ret < 0 && errno != EPIPE) {
perror("sendmsg");
}
@@
-301,10
+310,9
@@
int ustcomm_close_unix_sock(int sock)
{
int ret;
{
int ret;
- /* Shutdown receptions and transmissions */
- ret = shutdown(sock, SHUT_RDWR);
+ ret = close(sock);
if (ret < 0) {
if (ret < 0) {
- perror("
shutdown
");
+ perror("
close
");
}
return ret;
}
return ret;
@@
-348,7
+356,9
@@
ssize_t ustcomm_send_fds_unix_sock(int sock, void *buf, int *fds, size_t nb_fd,
msg.msg_iov = iov;
msg.msg_iovlen = 1;
msg.msg_iov = iov;
msg.msg_iovlen = 1;
- ret = sendmsg(sock, &msg, 0);
+ do {
+ ret = sendmsg(sock, &msg, MSG_NOSIGNAL);
+ } while (ret < 0 && errno == EINTR);
if (ret < 0 && errno != EPIPE) {
perror("sendmsg");
}
if (ret < 0 && errno != EPIPE) {
perror("sendmsg");
}
This page took
0.025923 seconds
and
4
git commands to generate.