errno(3)设置为EIO仅用于EIO Input/output error (POSIX.1)
此外,根据read(2)为:EIO I/O error. This will happen for example when the process is
in a background process group, tries to read from its
controlling terminal, and either it is ignoring or blocking
SIGTTIN or its process group is orphaned. It may also occur
when there is a low-level I/O error while reading from a
disk or tape.EIO A low-level I/O error occurred while modifying the inode.
因此,模拟特定的错误代码可能很困难;请注意,还有其他针对I/O的系统调用,特别是writev(2)和(间接地)mmap(2),但是{}和{}是最常见的。在
还要注意file systems和Linux kernel(例如其VFS层)是caching数据。你可以迟一点得到EIO,也可以永远不要。见sync(2)和{a11}
然而,一般来说,大多数软件不处理EIO特别是w.r.t.其他错误代码;您可能通过获取另一个错误代码来进行足够的测试,例如EDQUOT The user's quota of disk blocks on the filesystem containing
the file referred to by fd has been exhausted.
因此ÿ