3 ms·
If you look at the thread, readfile() would be pretty specifically for extremely short files e.g. procfs and sysfs. It would not be intended as a convenience A
by masklinn 7y ago
If you look at the thread, readfile() would be pretty specifically for extremely short files e.g. procfs and sysfs.
It would not be intended as a convenience API for slurping an entire file but as a performance API for very short reads (straight open(); read(); close() where the syscall overhead is enormous).
The implementation(s) by Greg Kroah-Hartman don't even bother looping until read returns empty or the buffer is full.
- tyingq 7y agoSure, but it would be simple to add, and perhaps then useful for lots of small reads from bigger files. Or things like /proc/pid/mem.