I'm not sure that's a good way to construct documentation examples personally, but here is an example program demonstrating that my claim is correct, as I agree that's useful for you to have. Feel free to edit it as you see fit. #define _GNU_SOURCE #define _FILE_OFFSET_BITS 64 #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main() { int fd = open("example_file.dat", O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd < 0) { printf("couldn't create example file"); exit(1); } int pipefd[2]; pipe(pipefd); char ch = '\1'; write(pipefd[1], &ch, 1); off_t offset = 0x10; if (splice(pipefd[0], NULL, fd, &offset, 0x10, 0) < 0) { printf("splice FAILED"); exit(1); } close(fd); printf("done - new offset is %lld", (long long) offset); } On Mon, Aug 26, 2024 at 1:12 PM Alejandro Colomar <alx@xxxxxxxxxx> wrote: > > Hi Absee, > > On Mon, Aug 26, 2024 at 07:40:37AM GMT, Absee Seeab wrote: > > Hi. > > Not sure I have an idea for an example program. > > > > As for a paragraph documenting it, here is a patch of one suggestion, > > though feel free to modify it or change it as needed. > > Maybe write a program that demonstrates that the statement is true > without having to look at the kernel source? That will probably serve > for the EXAMPLES section. :) > > Have a lovely day! > Alex > > > > > --- splice.2 2024-08-26 07:39:07.553952939 +0300 > > +++ splice.2 2024-08-26 07:38:36.503953192 +0300 > > @@ -63,7 +63,9 @@ > > .IR fd_in ; > > in this case, the file offset of > > .I fd_in > > -is not changed. > > +is not changed, and the offset pointed to by > > +.I off_in > > +is adjusted appropriately instead.. > > .P > > Analogous statements apply for > > .I fd_out > > > > On Sun, Aug 25, 2024 at 12:08 PM Alejandro Colomar <alx@xxxxxxxxxx> wrote: > > > > > > Hello Absee, > > > > > > On Sun, Aug 25, 2024 at 07:22:43AM GMT, Absee Seeab wrote: > > > > Hello, > > > > > > > > The splice(2) manpage (at least the version at man7.org) does not > > > > specify that off_in/off_out are written to after the operation. > > > > > > > > This, however, is done by the kernel (observed both by behaviour and > > > > source code). > > > > > > > > Plus I see similar functions (like copy_file_range and send_file) do > > > > document this fact, but splice does not, so it seems like a > > > > documentation omission. > > > > > > > > (This caused me a bit of a debugging headache today) > > > > > > Would you mind adding an example program to that page, and also some > > > paragraph that documents that? > > > > > > Cheers, > > > Alex > > > > > > > > > > > Thanks > > > > > > > > > > -- > > > <https://www.alejandro-colomar.es/> > > > > -- > <https://www.alejandro-colomar.es/>