linux命令cat有一些问题
#cd /sys/class/leds/green
# ls -al
....
-rw-rw-r-- root root 4096 1970-01-02 08:00 duty_pcts
....
#cat duty_pctys
此时发生错误
__/system/bin/sh: cat:duty_pcts:I/O error__
该cat
命令告诉您“嘿,我尝试读取名为 duty_pcts 的文件,但由于某种原因读取失败。我向操作系统询问errno
变量中的错误代码,操作系统告诉我这是一个 I/O 错误( EIO)。”
阅读 errno、open(2)、read(2) 和 close(2) 的手册页 [例如使用man 2 read
] 并查看是否有任何系统调用可以设置errno
为EIO
。例如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 tty, and either it is ignoring or blocking SIGTTIN or its pro- cess group is orphaned. It may also occur when there is a low-level I/O error while reading from a disk or tape.