bitwiseworks / libcx

kLIBC Extension Library
GNU Lesser General Public License v2.1
11 stars 1 forks source link

select: expensive I/O on regular files due to fstat #86

Closed dmik closed 4 years ago

dmik commented 4 years ago

We added support for regular files to select in ce4c91d634258a6d7848ecaf66e2923b228808c6. This uses fstat to check if the file is S_ISREG. However, for real files this ends up in a real disk I/O request (DosQueryFileInfo) while we actually don't need it. If select is running in a tight loop, this will introduce an unnecessary slow down. We may use LIBC handle internals to avoid this potentially lengthy call at all.