#include <babeltrace/object-internal.h>
#include <babeltrace/ref.h>
#include <babeltrace/compiler.h>
+#include <babeltrace/compat/fcntl.h>
#define PACKET_LEN_INCREMENT (getpagesize() * 8 * CHAR_BIT)
{
struct bt_ctf_field *field = NULL;
enum ctf_type_id type_id;
+ int ret;
if (!type) {
goto error;
}
type_id = bt_ctf_field_type_get_type_id(type);
- if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES ||
- bt_ctf_field_type_validate(type)) {
+ if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) {
+ goto error;
+ }
+
+ /* Field class MUST be valid */
+ ret = bt_ctf_field_type_validate(type);
+
+ if (ret) {
+ /* Invalid */
goto error;
}
}
pos->packet_size += PACKET_LEN_INCREMENT;
- ret = posix_fallocate(pos->fd, pos->mmap_offset,
- pos->packet_size / CHAR_BIT);
+ do {
+ ret = bt_posix_fallocate(pos->fd, pos->mmap_offset,
+ pos->packet_size / CHAR_BIT);
+ } while (ret == EINTR);
if (ret) {
+ errno = EINTR;
+ ret = -1;
goto end;
}