diff --git a/src/libsysprof-capture/sysprof-capture-writer.c b/src/libsysprof-capture/sysprof-capture-writer.c index 1e3f57e4..4b703d3d 100644 --- a/src/libsysprof-capture/sysprof-capture-writer.c +++ b/src/libsysprof-capture/sysprof-capture-writer.c @@ -1704,3 +1704,14 @@ _sysprof_capture_writer_add_raw (SysprofCaptureWriter *self, return true; } + +int +_sysprof_capture_writer_dup_fd (SysprofCaptureWriter *self) +{ + assert (self != NULL); + + if (self->fd == -1) + return -1; + + return dup (self->fd); +} diff --git a/src/libsysprof-capture/sysprof-capture-writer.h b/src/libsysprof-capture/sysprof-capture-writer.h index 6cbbd5ee..bde8c174 100644 --- a/src/libsysprof-capture/sysprof-capture-writer.h +++ b/src/libsysprof-capture/sysprof-capture-writer.h @@ -244,5 +244,7 @@ SYSPROF_INTERNAL bool _sysprof_capture_writer_set_time_range (SysprofCaptureWriter *self, int64_t start_time, int64_t end_time) SYSPROF_INTERNAL; +SYSPROF_INTERNAL +int _sysprof_capture_writer_dup_fd (SysprofCaptureWriter *self); SYSPROF_END_DECLS