From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1340 Path: news.gmane.org!not-for-mail From: Isaac Dunham Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH 2/10] splice Date: Sun, 22 Jul 2012 18:17:31 -0700 Message-ID: <20120722181731.051d67d5@newbook> References: <20120722181332.191d4fa5@newbook> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/imkxeqOUCUHMuPra/W2PQS5" X-Trace: dough.gmane.org 1343006274 4390 80.91.229.3 (23 Jul 2012 01:17:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 23 Jul 2012 01:17:54 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1341-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jul 23 03:17:51 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1St7HS-0007xc-Ek for gllmg-musl@plane.gmane.org; Mon, 23 Jul 2012 03:17:50 +0200 Original-Received: (qmail 11613 invoked by uid 550); 23 Jul 2012 01:17:49 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11604 invoked from network); 23 Jul 2012 01:17:49 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=q6cjCnQBVrt3FArxnnuyZ8PcAfrnUpj1OTUx4+wDi8KAX+po6OOP1RaD7XqmHM63FFs9H8vDkInz12/y1J+8C4YSD6CyX4F63wIq+k3Of09Vg1ZvM4wMfyDOc7P52SPD0a1xbhJRSPOs2kgx9nayPoJ2ibgbcG8WWeXHV1/ixaA=; h=Date:From:To:Subject:Message-ID:In-Reply-To:References:X-Mailer:Mime-Version:Content-Type; In-Reply-To: <20120722181332.191d4fa5@newbook> X-Mailer: Claws Mail 3.7.4 (GTK+ 2.20.1; i486-pc-linux-gnu) Xref: news.gmane.org gmane.linux.lib.musl.general:1340 Archived-At: --MP_/imkxeqOUCUHMuPra/W2PQS5 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline This adds a syscall wrapper for splice. I trusted git apply too much, so there are two parts to this patch: one to add the syscall, one to fix the header back up... Isaac Dunham --MP_/imkxeqOUCUHMuPra/W2PQS5 Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=2-splice.diff diff --git a/include/fcntl.h b/include/fcntl.h index fcb622a..b014662 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -9,6 +9,11 @@ extern "C" { #define __NEED_pid_t #define __NEED_mode_t +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_size_t +#define __NEED_ssize_t +#endif + #include #include @@ -97,6 +102,7 @@ int posix_fallocate(int, off_t, off_t); #define F_TEST 3 int lockf(int, int, off_t); +ssize_t splice(int, off_t, int, off_t, size_t, unsigned int); #endif #if defined(_GNU_SOURCE) diff --git a/src/linux/splice.c b/src/linux/splice.c new file mode 100644 index 0000000..63e4593 --- /dev/null +++ b/src/linux/splice.c @@ -0,0 +1,9 @@ +#define _GNU_SOURCE +#include +#include +#include "syscall.h" + +ssize_t splice(int fd_in, off_t *off_in, int fd_out, off_t *off_out, size_t len, unsigned int flags) +{ + return syscall(SYS_splice, fd_in, off_in, fd_out, off_out, len, flags); +} --MP_/imkxeqOUCUHMuPra/W2PQS5 Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=2.5-splice.diff diff --git a/include/fcntl.h b/include/fcntl.h index b014662..27ca147 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -9,7 +9,7 @@ extern "C" { #define __NEED_pid_t #define __NEED_mode_t +#ifdef _GNU_SOURCE +#define __NEED_size_t #define __NEED_ssize_t #endif @@ -102,10 +102,10 @@ int posix_fallocate(int, off_t, off_t); #define F_TEST 3 int lockf(int, int, off_t); -ssize_t splice(int, off_t, int, off_t, size_t, unsigned int); #endif #if defined(_GNU_SOURCE) +ssize_t splice(int, off_t, int, off_t, size_t, unsigned int); #define F_OWNER_TID 0 #define F_OWNER_PID 1 #define F_OWNER_PGRP 2 --MP_/imkxeqOUCUHMuPra/W2PQS5--