X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fringbuffer%2Fshm.c;h=a1ef3d69f0602544f9335a9f1d59843e14208c55;hb=8a8c2117fb26a42b19975b8745d4333c7aa1a061;hp=a3235b6961ad6e0b6c13677c84bd78bb5207b954;hpb=495b8381eb4348cdad015e3c324bc4edccfd53d3;p=lttng-ust.git diff --git a/src/common/ringbuffer/shm.c b/src/common/ringbuffer/shm.c index a3235b69..a1ef3d69 100644 --- a/src/common/ringbuffer/shm.c +++ b/src/common/ringbuffer/shm.c @@ -97,18 +97,11 @@ struct shm_object *_shm_object_table_alloc_shm(struct shm_object_table *table, obj = &table->objects[table->allocated_len]; /* wait_fd: create pipe */ - ret = pipe(waitfd); + ret = pipe2(waitfd, O_CLOEXEC); if (ret < 0) { PERROR("pipe"); goto error_pipe; } - for (i = 0; i < 2; i++) { - ret = fcntl(waitfd[i], F_SETFD, FD_CLOEXEC); - if (ret < 0) { - PERROR("fcntl"); - goto error_fcntl; - } - } /* The write end of the pipe needs to be non-blocking */ ret = fcntl(waitfd[1], F_SETFL, O_NONBLOCK); if (ret < 0) { @@ -200,18 +193,11 @@ struct shm_object *_shm_object_table_alloc_mem(struct shm_object_table *table, goto alloc_error; /* wait_fd: create pipe */ - ret = pipe(waitfd); + ret = pipe2(waitfd, O_CLOEXEC); if (ret < 0) { PERROR("pipe"); goto error_pipe; } - for (i = 0; i < 2; i++) { - ret = fcntl(waitfd[i], F_SETFD, FD_CLOEXEC); - if (ret < 0) { - PERROR("fcntl"); - goto error_fcntl; - } - } /* The write end of the pipe needs to be non-blocking */ ret = fcntl(waitfd[1], F_SETFL, O_NONBLOCK); if (ret < 0) { @@ -380,11 +366,6 @@ struct shm_object *shm_object_table_append_mem(struct shm_object_table *table, obj->shm_fd = -1; obj->shm_fd_ownership = 0; - ret = fcntl(obj->wait_fd[1], F_SETFD, FD_CLOEXEC); - if (ret < 0) { - PERROR("fcntl"); - goto error_fcntl; - } /* The write end of the pipe needs to be non-blocking */ ret = fcntl(obj->wait_fd[1], F_SETFL, O_NONBLOCK); if (ret < 0) {