What's wrong with vfs_stat() call?
问题 I'm trying to do a stat on files, struct kstat stat; int error = vfs_stat ("/bin/ls", &stat); // /bin/ls exists if (error) { printk (KERN_INFO "error code %d\n", error); } else { printk (KERN_INFO "mode of ls: %o\n", stat.mode); printk (KERN_INFO "owner of ls: %o\n", stat.uid); } return error; But error was always set to 14 (Bad Address), what's wrong with the code? I'm running 3.9 kernel. 回答1: vfs_stat() is defined as: int vfs_stat(const char __user *name, struct kstat *stat); and __user is