Em Tue, 19 Feb 2013 14:06:26 +0100 Borislav Petkov <bp@xxxxxxxxx> escreveu: > > No, on both cases, open() will return an error (-ENOENT against -EPERM). > > What if it is a shell script doing: > > cat /sys/devices/system/edac/mc/mc0/sdram_scrub_rate > > or similar? Well, cat will return "1" if an error is found, no matter what error happened. With an existing file (-ENOSYS): $ cat /sys/devices/system/edac/mc/mc0/sdram_scrub_rate; echo $? cat: /sys/devices/system/edac/mc/mc0/sdram_scrub_rate: No such device 1 When the file doesn't exist (-ENOENT): $ cat /sys/devices/system/edac/mc/mc0/sdram_scrub_rate_not_exist; echo $? cat: /sys/devices/system/edac/mc/mc0/sdram_scrub_rate_not_exist: No such file or directory 1 When permission doesn't match (-EPERM): $ cat /sys/devices/system/cpu/probe; echo $? cat: /sys/devices/system/cpu/probe: Permission denied 1 When everything is ok, it will return 0 $ cat /sys/devices/system/edac/mc/mc0/ce_count; echo $? >/dev/null 0 A script ready to handle -ENOSYS would be doing, instead: RATE=$(cat /sys/devices/system/edac/mc/mc0/ce_count 2>/dev/null) if [ "$?" == "0" ]; then echo "Scrub rate: $RATE"; fi So, a bash script won't notice any difference. The only difference will be noticed if the script is written on some other language and the script is dumb enough to assume success if the errno is different than -ENOSYS. -- Cheers, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html