Commit 912d35f8 authored by Jens Axboe's avatar Jens Axboe

[PATCH] Add support for the sys_vmsplice syscall

sys_splice() moves data to/from pipes with a file input/output. sys_vmsplice()
moves data to a pipe, with the input being a user address range instead.

This uses an approach suggested by Linus, where we can hold partial ranges
inside the pages[] map. Hopefully this will be useful for network
receive support as well.
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
parent 016b661e
...@@ -1610,5 +1610,6 @@ sys_call_table: ...@@ -1610,5 +1610,6 @@ sys_call_table:
data8 sys_get_robust_list data8 sys_get_robust_list
data8 sys_sync_file_range // 1300 data8 sys_sync_file_range // 1300
data8 sys_tee data8 sys_tee
data8 sys_vmsplice
.org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
...@@ -324,6 +324,7 @@ COMPAT_SYS(ppoll) ...@@ -324,6 +324,7 @@ COMPAT_SYS(ppoll)
SYSCALL(unshare) SYSCALL(unshare)
SYSCALL(splice) SYSCALL(splice)
SYSCALL(tee) SYSCALL(tee)
SYSCALL(vmsplice)
/* /*
* please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c
......
...@@ -318,6 +318,7 @@ void *spu_syscall_table[] = { ...@@ -318,6 +318,7 @@ void *spu_syscall_table[] = {
[__NR_unshare] sys_unshare, [__NR_unshare] sys_unshare,
[__NR_splice] sys_splice, [__NR_splice] sys_splice,
[__NR_tee] sys_tee, [__NR_tee] sys_tee,
[__NR_vmsplice] sys_vmsplice,
}; };
long spu_sys_callback(struct spu_syscall_block *s) long spu_sys_callback(struct spu_syscall_block *s)
......
This diff is collapsed.
...@@ -321,8 +321,9 @@ ...@@ -321,8 +321,9 @@
#define __NR_splice 313 #define __NR_splice 313
#define __NR_sync_file_range 314 #define __NR_sync_file_range 314
#define __NR_tee 315 #define __NR_tee 315
#define __NR_vmsplice 316
#define NR_syscalls 316 #define NR_syscalls 317
/* /*
* user-visible error numbers are in the range -1 - -128: see * user-visible error numbers are in the range -1 - -128: see
......
...@@ -290,12 +290,13 @@ ...@@ -290,12 +290,13 @@
#define __NR_get_robust_list 1299 #define __NR_get_robust_list 1299
#define __NR_sync_file_range 1300 #define __NR_sync_file_range 1300
#define __NR_tee 1301 #define __NR_tee 1301
#define __NR_vmsplice 1302
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/config.h> #include <linux/config.h>
#define NR_syscalls 278 /* length of syscall table */ #define NR_syscalls 279 /* length of syscall table */
#define __ARCH_WANT_SYS_RT_SIGACTION #define __ARCH_WANT_SYS_RT_SIGACTION
......
...@@ -303,8 +303,9 @@ ...@@ -303,8 +303,9 @@
#define __NR_unshare 282 #define __NR_unshare 282
#define __NR_splice 283 #define __NR_splice 283
#define __NR_tee 284 #define __NR_tee 284
#define __NR_vmsplice 285
#define __NR_syscalls 285 #define __NR_syscalls 286
#ifdef __KERNEL__ #ifdef __KERNEL__
#define __NR__exit __NR_exit #define __NR__exit __NR_exit
......
...@@ -615,8 +615,10 @@ __SYSCALL(__NR_splice, sys_splice) ...@@ -615,8 +615,10 @@ __SYSCALL(__NR_splice, sys_splice)
__SYSCALL(__NR_tee, sys_tee) __SYSCALL(__NR_tee, sys_tee)
#define __NR_sync_file_range 277 #define __NR_sync_file_range 277
__SYSCALL(__NR_sync_file_range, sys_sync_file_range) __SYSCALL(__NR_sync_file_range, sys_sync_file_range)
#define __NR_vmsplice 278
__SYSCALL(__NR_vmsplice, sys_vmsplice)
#define __NR_syscall_max __NR_sync_file_range #define __NR_syscall_max __NR_vmsplice
#ifndef __NO_STUBS #ifndef __NO_STUBS
......
...@@ -574,6 +574,9 @@ asmlinkage long sys_splice(int fd_in, loff_t __user *off_in, ...@@ -574,6 +574,9 @@ asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
int fd_out, loff_t __user *off_out, int fd_out, loff_t __user *off_out,
size_t len, unsigned int flags); size_t len, unsigned int flags);
asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
unsigned long nr_segs, unsigned int flags);
asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags); asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags);
asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment