projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use lttng_read/lttng_write wrappers
[lttng-tools.git]
/
src
/
common
/
index
/
index.c
diff --git
a/src/common/index/index.c
b/src/common/index/index.c
index 89b4fd769eab98a49137fb08087388caec4469e4..cddc58c09de1726b8322816b4eb3f308dace03f3 100644
(file)
--- a/
src/common/index/index.c
+++ b/
src/common/index/index.c
@@
-35,6
+35,7
@@
int index_create_file(char *path_name, char *stream_name, int uid, int gid,
uint64_t size, uint64_t count)
{
int ret, fd = -1;
uint64_t size, uint64_t count)
{
int ret, fd = -1;
+ ssize_t size_ret;
struct lttng_packet_index_file_hdr hdr;
char fullpath[PATH_MAX];
struct lttng_packet_index_file_hdr hdr;
char fullpath[PATH_MAX];
@@
-65,11
+66,10
@@
int index_create_file(char *path_name, char *stream_name, int uid, int gid,
hdr.index_major = htobe32(INDEX_MAJOR);
hdr.index_minor = htobe32(INDEX_MINOR);
hdr.index_major = htobe32(INDEX_MAJOR);
hdr.index_minor = htobe32(INDEX_MINOR);
- do {
- ret = write(fd, &hdr, sizeof(hdr));
- } while (ret < 0 && errno == EINTR);
- if (ret < 0) {
+ size_ret = lttng_write(fd, &hdr, sizeof(hdr));
+ if (size_ret < sizeof(hdr)) {
PERROR("write index header");
PERROR("write index header");
+ ret = -1;
goto error;
}
goto error;
}
@@
-90,19
+90,18
@@
error:
/*
* Write index values to the given fd of size len.
*
/*
* Write index values to the given fd of size len.
*
- * Return 0 on success or else a negative value on error.
+ * Return "len" on success or else < len on error. errno contains error
+ * details.
*/
*/
-
in
t index_write(int fd, struct lttng_packet_index *index, size_t len)
+
ssize_
t index_write(int fd, struct lttng_packet_index *index, size_t len)
{
{
-
in
t ret;
+
ssize_
t ret;
assert(fd >= 0);
assert(index);
assert(fd >= 0);
assert(index);
- do {
- ret = write(fd, index, len);
- } while (ret < 0 && errno == EINTR);
- if (ret < 0) {
+ ret = lttng_write(fd, index, len);
+ if (ret < len) {
PERROR("writing index file");
}
PERROR("writing index file");
}
This page took
0.024653 seconds
and
4
git commands to generate.