linux伪造一个损坏文件,在Linux上伪造IO错误

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.

因此ÿ

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值