I am calculating a interrupt time in dev.c kernel source code as below :
extern double InterruptTime;
InterruptTime = ktime_get_real(); //timestamp
I am writing a data from kernel space to user space using procfs and using the below api in kernel space for sending data to the user space. PROCFS.c :
struct device {
double array[100];
}chr_arr;
ssize_t dev_read(struct file *filp,const char *buf,size_t count,loff_t *offset)
{
int len;
chr_arr.array =InterruptTime; // Is this possible ??
len = count >= strlen(chr_arr.array) ? strlen(chr_arr.array) : count;
*offset += len;
if (*offset >= strlen(chr_arr.array))
return 0;
if (copy_to_user(buf,chr_arr.array,len))
return -EFAULT;
return len;
}
is it possible to read the InterruptTime from dev.c in PROCFS.c as shown above ?? how the data sent from above kernel code will be received on the user side (i.e InterruptTime)??