when the interrupt occurs in the kernel and If I am reading a timestamp in the kernel. I am reading the timestamp from kernel to the user via procfs. where that interrupt time value will be stored ?? how should the user read that value from the user space ??
ssize_t dev_read(struct file *filp,const char *buf,size_t count,loff_t *offset)
{
if ( count < sizeof(InterruptTime) ) {
// Not enough space provided.
return 0; // Or some error code maybe.
}
if (copy_to_user(buf,&InterruptTime,sizeof(InterruptTime)) {
return -EFAULT;
} else {
return sizeof(InterruptTime); // Number of bytes we copied.
}
}
this is the code I modified in /linuxversion/net/core/dev.c
int netif_rx(struct sk_buff *skb)
{
skb->tstamp = ktime_get_real(); //this will give a timestamp and it will be stored in //skb buffer
//I am calculating a timestamp here. because whenever kernel receive the data then the kernel is
//interrupted and start executing the newly arrived task but I have to read the time when the
//interrupt occurs and get the value of it.
}
but how to copy this value stored in skb->tstamp
to procfs
driver ??
finally I want to send this timestamp value to the user ??