logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git
commit: 13af4748da15c16c3e213ca8b9261fbe410130d8
parent dfb0752b6b546014ee83e2d4de7910c521719c15
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 27 Sep 2024 10:13:38 +0200

configure: add sendfile_linux conftest

Diffstat:

Mconfigure7++-----
Aconfigure.d/sendfile_linux.c14++++++++++++++
2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/configure b/configure @@ -224,11 +224,8 @@ if ! check_header sys/sysmacros.h; then fi check_conftest configure.d/splice.c && CFLAGS="${CFLAGS} -DHAS_SPLICE" - -if check_conftest configure.d/copy_file_range.c -then - CFLAGS="${CFLAGS} -DHAS_COPY_FILE_RANGE" -fi +check_conftest configure.d/sendfile_linux.c && CFLAGS="${CFLAGS} -DHAS_SENDFILE" +check_conftest configure.d/copy_file_range.c && CFLAGS="${CFLAGS} -DHAS_COPY_FILE_RANGE" if ! check_conftest configure.d/reallocarray.c; then echo 'Disabling cmd/tr cmd/cut' diff --git a/configure.d/sendfile_linux.c b/configure.d/sendfile_linux.c @@ -0,0 +1,14 @@ +// utils-std: Collection of commonly available Unix tools +// SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me> +// SPDX-License-Identifier: MPL-2.0 + +// Because that's what our utilities will use :) +#define _POSIX_C_SOURCE 200809L + +#include <sys/sendfile.h> +ssize_t +test(int in, int out, size_t len) +{ + off_t *offset = NULL; + return sendfile(out, in, offset, len); +}