Questions tagged [splice]

splice copies data between two file descriptors of which one must be a pipe. Effectively, this is equivalent to a userland function that performs a read/write operation to and from a kernel-owned buffer.

splice copies data between two file descriptors of which one must be a pipe. Effectively, this is equivalent to a userland function that performs a read/write operation to and from a kernel-owned buffer.

The splice system call can be used to implement , as described in Zero-Copy in Linux with sendfile() and splice().

619 questions
24
votes
3 answers

A question about JavaScript's slice and splice methods

I came across the following code: var f = function () { var args = Array.prototype.slice.call(arguments).splice(1); // some more code }; Basically, the result in args is an array that is a copy of the arguments without its first…
Andreas Grech
  • 98,643
  • 98
  • 284
  • 354
20
votes
1 answer

vmsplice() and TCP

In the original vmsplice() implementation, it was suggested that if you had a user-land buffer 2x the maximum number of pages that could fit in a pipe, a successful vmsplice() on the second half of the buffer would guarantee that the kernel was done…
user239558
  • 6,096
  • 1
  • 25
  • 33
20
votes
1 answer

Linux Zero-Copy: Transfer memory pages between two processes with vmsplice

Currently, I am trying to understand the value of splice/vmsplice. Regarding the use case of IPC, I stumbled upon the following answer on stackoverflow: https://stackoverflow.com/a/1350550/1305501 Question: How to transfer memory pages from one…
nosid
  • 45,370
  • 13
  • 104
  • 134
18
votes
2 answers

Which file systems support splicing via Linux's splice(2)?

The man page for the splice system call says that splice may fail and set errno to EINVAL if: Target file system doesn't support splicing; neither of the descriptors refers to a pipe; or offset given for non-seekable device Which file systems…
Daniel Trebbien
  • 35,770
  • 14
  • 104
  • 182
17
votes
1 answer

Linux splice() + kernel AIO when writing to disk

With kernel AIO and O_DIRECT|O_SYNC, there is no copying into kernel buffers and it is possible to get fine grained notification when data is actually flushed to disk. However, it requires data to be held in user space buffers for…
jop
  • 2,130
  • 12
  • 15
16
votes
5 answers

Remove object in array using filter and splice which one is best approach in JavaScript?

Hi I delete an object in an array using two approaches:- splice and filter. splice code here:- (this.myArray).splice((this.myArray).indexOf(myobject), 1); filter code here:- (this.myArray).filter(obj => obj !== myobject); Please tell us…
Harleen Kaur Arora
  • 1,466
  • 2
  • 14
  • 49
14
votes
2 answers

Zero-copy user-space TCP send of dma_mmap_coherent() mapped memory

I'm running Linux 5.1 on a Cyclone V SoC, which is an FPGA with two ARMv7 cores in one chip. My goal is to gather lots of data from an external interface and stream (part of) this data out through a TCP socket. The challenge here is that the data…
rem
  • 1,165
  • 2
  • 7
  • 12
10
votes
1 answer

Understanding sendfile() and splice()

sendfile() can be used to transmit data from a "file" descriptor to a "socket" descriptor in order to get data from machine A to machine B. Is it possible to get the data at the receiving end from the "socket" descriptor to a file with similar…
user880946
  • 339
  • 1
  • 3
  • 5
9
votes
1 answer

Why is there not a no-throw guarantee in the standard for std::set::extract() and std::set::insert(nh)?

In C++20 (N4849), there is no exception safety wording for associative containers' extract() and insert(node_handle)/insert(hint, node_handle) methods. But for merge(), there is this wording though: Throws: Nothing unless the comparison object…
zwhconst
  • 847
  • 5
  • 16
7
votes
2 answers

Determining whether a readable file descriptor is the read end of a pipe

I would like to use splice to zero-copy data from STDIN_FILENO to a file descriptor (which could be to a regular file, char or block device, FIFO, or anything that can be opened with open). In order to use splice, either the from file descriptor or…
Daniel Trebbien
  • 35,770
  • 14
  • 104
  • 182
7
votes
2 answers

What are the semantics of vmsplice(2), with and without gifting?

I'm trying to understand the functionality of the vmsplice(2) syscall (man page here). I have two questions about the effect of the SPLICE_F_GIFT flag: The man page says that once you gift pages to the kernel, you must never modify the memory…
jacobsa
  • 3,901
  • 1
  • 18
  • 43
7
votes
3 answers

How can I use Linux's splice() function to copy a file to another file?

here's another question about splice(). I'm hoping to use it to copy files, and am trying to use two splice calls joined by a pipe like the example on splice's Wikipedia page. I wrote a simple test case which only tries to read the first 32K bytes…
user191513
7
votes
2 answers

Using GNU/Linux system call `splice` for zero-copy Socket to Socket data transfers in Haskell

Update: Mr. Nemo's answer helped solve the problem! The code below contains the fix! See the nb False and nb True calls below. There is also a new Haskell package called splice (, which has OS-specific and portable implementations of best known…
Cetin Sert
  • 4,112
  • 4
  • 32
  • 69
6
votes
2 answers

kernel-based (Linux) data relay between two TCP sockets

I wrote TCP relay server which works like peer-to-peer router (supernode). The simplest case are two opened sockets and data relay between them: clientA <---> server <---> clientB However the server have to serve about 2000 such A-B pairs, ie. 4000…
nopsoft
  • 929
  • 6
  • 10
5
votes
1 answer

how to use splice in angular 5

I have created a table that displays data fetched from the database. The TS part that fetches the data looks something like: this._appService.getVisitData().subscribe((data) => { this.checkinTemp = data; // Calling the DT trigger to manually…
Atul Stha
  • 1,116
  • 5
  • 18
  • 36
1
2 3
41 42