Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.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/1/visual-studio-2012/2.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
如何用c语言从另一个程序中读取数据?_C_Linux_Struct_Linux Kernel_Interrupt - Fatal编程技术网

如何用c语言从另一个程序中读取数据?

如何用c语言从另一个程序中读取数据?,c,linux,struct,linux-kernel,interrupt,C,Linux,Struct,Linux Kernel,Interrupt,交流 //这里我计算时间戳并将其存储在中断时间变量中 不列颠哥伦比亚省 //将数据从内核空间复制到用户空间 extern double interrupttime; interrupttime = timestamp(); 上面是内核代码,我想从B.c读取中断时间(A.c),我想在B.c程序api中复制中断时间,然后将其发送到用户空间。所以请有人帮我读一下B.c程序的数据 您可以使用debugfs(例如)在内核和用户空间之间传递数据。您可以使用proc fs或sysfs传递信息,但我想从B.c

交流

//这里我计算时间戳并将其存储在中断时间变量中

不列颠哥伦比亚省 //将数据从内核空间复制到用户空间

extern double interrupttime;
interrupttime = timestamp();

上面是内核代码,我想从B.c读取中断时间(A.c),我想在B.c程序api中复制中断时间,然后将其发送到用户空间。所以请有人帮我读一下B.c程序的数据

您可以使用debugfs(例如)在内核和用户空间之间传递数据。您可以使用proc fs或sysfs传递信息,但我想从B.c(procfs api)程序传输在A.c中计算的中断时间。怎么做??A.c是内核代码,B.c是procfsapi。
read(struct file *fp, char *buf, size_t count, loff_t *ppos)
{

copy_to_user(userbuffer, kernelbuffer, count);
// this is the api used to send data from kernel buffer to user buffer
}