Resource forks are inherently non-portable; POSIX doesn't legislate for the behaviour of things it knows nothing about. You can look at any given platform to find platform-specific alternatives that do what you want, but they won't be portable. Also, there are so many possible behaviours that it would be hard to design the API. Does it copy modification times? What if the target file already exists? Is a symlink? ACL security information?
As others have noted, if you need more elaborate behaviour, you can invoke the system utilities that support it with fork and exec. Those programs, however, also have to be coded to handle what you need — so someone has to do the work. POSIX tends to provide a lowest common denominator so that systems can support it more easily. Technically, POSIX doesn't support ACLs; they were a proposed extension, but never got finalized, though most implementations hew close to the last draft of the proposed extensioin.
This code will quietly stop on a read error. You should really be checking feof f1 at the end of the function.
Show 2 more comments. The Overflow Blog. Stack Gives Back Improve this question. Eddie Janis Veinbergs Janis Veinbergs 6, 5 5 gold badges 45 45 silver badges 77 77 bronze badges. Add a comment. Active Oldest Votes. Things like this are trivial to determine using tools like strace. Improve this answer. Chris Not anymore. Source: pubs. I think you want utime 2. Johannes Weiss Johannes Weiss Follow Following.
Parallel File Systems. Sign me up. Already have a WordPress. Log in now. Loading Comments Email Required Name Required Website. That way the page cache will only be used to the extent needed to keep the data flowing, and the pages will be recycled as soon as the data has been consumed written to disk.
The sendfile will not push file data over to the user space, so it further relaxes some of the pressure from memory and processor cache. That's about the only other sensible improvement you can make for copying of files that's not device-specific.
Choosing a sensible chunk size is also desirable. Read parallelization, as you propose it, only makes sense on RAID 0 volumes, and only when both the input and output files straddle the physical disks. You can then have one thread per the lesser of the number of source and destination volume physical disks straddled by the file.
There's no sense for parallelization of a single file copy on SSDs, unless you were on some very odd system indeed. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more.
0コメント