#include "common/macros.h"
#include "common/ust-fd.h"
-#include "mmap.h"
+#include "common/compat/mmap.h"
/*
* Ensure we have the required amount of space available by writing 0
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) {
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) {
}
#endif
+#ifdef HAVE_LIBNUMA
struct shm_object *shm_object_table_alloc(struct shm_object_table *table,
size_t memory_map_size,
enum shm_object_type type,
int stream_fd,
int cpu)
+#else
+struct shm_object *shm_object_table_alloc(struct shm_object_table *table,
+ size_t memory_map_size,
+ enum shm_object_type type,
+ int stream_fd,
+ int cpu __attribute__((unused)))
+#endif
{
struct shm_object *shm_object;
#ifdef HAVE_LIBNUMA
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) {