|
|
Subscribe / Log in / New account

How useful should copy_file_range() be?

How useful should copy_file_range() be?

Posted Feb 20, 2021 14:45 UTC (Sat) by smurf (subscriber, #17840)
In reply to: How useful should copy_file_range() be? by jengelh
Parent article: How useful should copy_file_range() be?

Those fake kernel files don't have POSIX semantics, period. Their reported size doesn't correspond to the number of readable bytes, if they're writeable you can't just write '1' and then '23' when you intend to write '123', and so on.

So the bug is on the user. If you treat these things like ordinary files and expect all the posicky corner cases to work "correctly", you're SOL. These files will never have POSIX semantics. No, you can't use libc to emulate it. Deal.

Yes there should be a way to ask the kernel whether a file conforms to 100% posix. Well, we don't have that. Deal.

One possible workaround is to check the file size. If it's smaller than pagesize*4 or so then it's probably cheaper to copy its data the old-fashioned way anyway.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds