capture: use _sp_sendfile() on non-Linux platforms

We still generally only build on Linux from the Sysprof
project, but we can start to support other systems in the
capture format (with the possibility of being more general
for the UI later on too).
This commit is contained in:
Christian Hergert
2019-05-06 16:21:43 -07:00
parent 0580b4ef0d
commit 8ec9fea5cb
2 changed files with 5 additions and 5 deletions

View File

@ -19,12 +19,12 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <sys/sendfile.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include "capture/sp-capture-reader.h" #include "capture/sp-capture-reader.h"
#include "capture/sp-capture-util-private.h"
#include "capture/sp-capture-writer.h" #include "capture/sp-capture-writer.h"
struct _SpCaptureReader struct _SpCaptureReader
@ -842,7 +842,7 @@ sp_capture_reader_save_as (SpCaptureReader *self,
{ {
gssize written; gssize written;
written = sendfile (fd, self->fd, &in_off, to_write); written = _sp_sendfile (fd, self->fd, &in_off, to_write);
if (written < 0) if (written < 0)
goto handle_errno; goto handle_errno;

View File

@ -24,12 +24,12 @@
#include <fcntl.h> #include <fcntl.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <string.h> #include <string.h>
#include <sys/sendfile.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include "capture/sp-capture-reader.h" #include "capture/sp-capture-reader.h"
#include "capture/sp-capture-util-private.h"
#include "capture/sp-capture-writer.h" #include "capture/sp-capture-writer.h"
#define DEFAULT_BUFFER_SIZE (getpagesize() * 64L) #define DEFAULT_BUFFER_SIZE (getpagesize() * 64L)
@ -829,7 +829,7 @@ sp_capture_writer_save_as (SpCaptureWriter *self,
{ {
gssize written; gssize written;
written = sendfile (fd, self->fd, &in_off, pos); written = _sp_sendfile (fd, self->fd, &in_off, pos);
if (written < 0) if (written < 0)
goto handle_errno; goto handle_errno;
@ -908,7 +908,7 @@ _sp_capture_writer_splice_from_fd (SpCaptureWriter *self,
{ {
gssize written; gssize written;
written = sendfile (self->fd, fd, &in_off, to_write); written = _sp_sendfile (self->fd, fd, &in_off, to_write);
if (written < 0) if (written < 0)
goto handle_errno; goto handle_errno;