casaroli opened a new pull request, #20718:
URL: https://github.com/apache/nuttx/pull/20718

   ## Summary
   
   Adds `copy_file_range()`, which copies a range of one file to another, at 
given offsets or at the file offsets. glibc, musl and FreeBSD have it, and 
programs that use it did not build.
   
   It copies through a small buffer with `read()`/`write()`, or 
`pread()`/`pwrite()` when an offset is given. Like the other implementations, 
it returns the number of bytes copied, which can be less than asked, and 0 at 
the end of the input.
   
   ## Impact
   
   New function in `unistd.h`; nothing else changes.
   
   ## Testing
   
   Builds: `qemu-armv8a:nsh`, `qemu-armv8a:knsh`, `lm3s6965-ek:qemu-flat`.
   
   Runtime, QEMU 11 with HVF on an Apple M4: `ostest` on `qemu-armv8a:knsh` 
(kernel build) and `qemu-armv8a:nsh` (flat build) ends with `ostest_main: 
Exiting with status 0`.
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   
   A test program on `qemu-armv8a:knsh` (file offsets, given offsets, short 
copy at the end of the input, 0 at the end, `flags != 0`):
   
   ```
   cfrtest: NULL offsets: 1500 bytes copied              PASS
   cfrtest: NULL offsets: input offset 1500              PASS
   cfrtest: NULL offsets: output offset 1500             PASS
   cfrtest: NULL offsets: data                           PASS
   cfrtest: offsets: 1000 bytes copied                   PASS
   cfrtest: offsets: *inoff 1100, *outoff 1000           PASS
   cfrtest: offsets: input file offset unchanged         PASS
   cfrtest: offsets: output file offset unchanged        PASS
   cfrtest: offsets: data                                PASS
   cfrtest: short: 100 bytes copied at the end           PASS
   cfrtest: end of input: returns 0                      PASS
   cfrtest: flags 1: -1 with EINVAL                      PASS
   cfrtest: done, 0 failed
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to