Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux kernel 读取系统调用给出错误的计数大小?_Linux Kernel_Linux Device Driver - Fatal编程技术网

Linux kernel 读取系统调用给出错误的计数大小?

Linux kernel 读取系统调用给出错误的计数大小?,linux-kernel,linux-device-driver,Linux Kernel,Linux Device Driver,我创建了一个misc驱动程序,并制作了一个类似这样的示例读取函数 static ssize_t test_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { pr_info("Count arg : %d\n",count); return ret; } 我现在尝试使用如下所示的用户空间代码读取设备 uint64_t read_buff; fread(&r

我创建了一个misc驱动程序,并制作了一个类似这样的示例读取函数

static ssize_t test_read(struct file *file, char __user *buffer,
        size_t count, loff_t *ppos)
{
    pr_info("Count arg : %d\n",count);

    return ret;
}
我现在尝试使用如下所示的用户空间代码读取设备

uint64_t read_buff;
fread(&read_buff, sizeof(read_buff), 1, fp)
我得到的dmesg日志是

[ 1593.273163] Count arg : 4096
我原以为它会有uint64的大小。有人能告诉我为什么会得到一个意外的值吗?

似乎
fread()
试图为userland缓冲一些数据。我发现缓存数据(在
\uu srefill()
中)。因此,
fread()
可以这样做

如果您想避免这种意外的结果,请降低一级并使用userland中的
read()
函数。

似乎
fread()
试图为userland缓冲一些数据。我发现缓存数据(在
\uu srefill()
中)。因此,
fread()
可以这样做

如果您想避免这种意外的结果,请降低一级并使用userland中的
read()
函数。

似乎
fread()
试图为userland缓冲一些数据。我发现缓存数据(在
\uu srefill()
中)。因此,
fread()
可以这样做

如果您想避免这种意外的结果,请降低一级并使用userland中的
read()
函数。

似乎
fread()
试图为userland缓冲一些数据。我发现缓存数据(在
\uu srefill()
中)。因此,
fread()
可以这样做

如果您想避免这种意外的结果,请降低一级并使用userland中的
read()
函数