- if (fd >= 0) {
- int flags = fcntl(fd, F_GETFL, 0);
-
- switch (flags & O_ACCMODE) {
- case O_RDONLY:
- pos->prot = PROT_READ;
- pos->flags = MAP_PRIVATE;
- pos->parent.rw_table = read_dispatch_table;
- break;
- case O_WRONLY:
- case O_RDWR:
- pos->prot = PROT_WRITE; /* Write has priority */
- pos->flags = MAP_SHARED;
- pos->parent.rw_table = write_dispatch_table;
- ctf_move_pos_slow(pos, 0); /* position for write */
- break;
- default:
- assert(0);
- }
+ if (fd >= 0)
+ pos->packet_index = g_array_new(FALSE, TRUE,
+ sizeof(struct packet_index));
+ else
+ pos->packet_index = NULL;