projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup
[lttng-ust.git]
/
libringbuffer
/
shm.c
diff --git
a/libringbuffer/shm.c
b/libringbuffer/shm.c
index 8f158e2f0507feeb8d05e000f08241a0e356b9e9..873e6e87597311ae9a5cc03c3d1c27a53dae025c 100644
(file)
--- a/
libringbuffer/shm.c
+++ b/
libringbuffer/shm.c
@@
-34,7
+34,7
@@
struct shm_object *shm_object_table_append(struct shm_object_table *table,
if (table->allocated_len >= table->size)
return NULL;
if (table->allocated_len >= table->size)
return NULL;
- obj = &table->objects[table->allocated_len
++
];
+ obj = &table->objects[table->allocated_len];
/* wait_fd: create pipe */
ret = pipe(waitfd);
/* wait_fd: create pipe */
ret = pipe(waitfd);
@@
-49,7
+49,13
@@
struct shm_object *shm_object_table_append(struct shm_object_table *table,
goto error_fcntl;
}
}
goto error_fcntl;
}
}
- *obj->wait_fd = *waitfd;
+ /* The write end of the pipe needs to be non-blocking */
+ ret = fcntl(waitfd[1], F_SETFL, O_NONBLOCK);
+ if (ret < 0) {
+ PERROR("fcntl");
+ goto error_fcntl;
+ }
+ memcpy(obj->wait_fd, waitfd, sizeof(waitfd));
/* shm_fd: create shm */
/* shm_fd: create shm */
@@
-92,6
+98,8
@@
struct shm_object *shm_object_table_append(struct shm_object_table *table,
obj->memory_map = memory_map;
obj->memory_map_size = memory_map_size;
obj->allocated_len = 0;
obj->memory_map = memory_map;
obj->memory_map_size = memory_map_size;
obj->allocated_len = 0;
+ obj->index = table->allocated_len++;
+
return obj;
error_mmap:
return obj;
error_mmap:
@@
-112,7
+120,6
@@
error_fcntl:
}
}
error_pipe:
}
}
error_pipe:
- free(obj);
return NULL;
}
return NULL;
}
This page took
0.023246 seconds
and
4
git commands to generate.