简体   繁体   中英

how to access or receive the data from kernel by user program in rt linux?

client and server communication in rt linux. client is sending the data and server is the receiver.UDP is used for communication between client and the server. When the server(rt linux) receives the data from the client the kernel should stop what it is doing and start executing the newly arrived data. I want to calculate the time when the interrupt occurs in kernel (timestamp). In rt-linux all the operating system operation takes place in kernel. So i am calculating the interrupt time in kernel source code. So i modified the kernel source code in the location /usr/src/linux-version/net/core/dev.c as shown below : I am calculating the time and storing in a buffer skb.

//this code is at network device driver level.

int netif_rx(struct sk_buff *skb) 
{
    __net_timestamp(skb);//I modify the code in kernel to get the timestamp and store in buffer
}

// after storing the data to the buffer kernel will send it to the upper layers like IP, UDP, INET and finally SOCKET of the kernel space.

but I want to read the timestamp packet from the kernel space by the user space. ie my program .

I am using recvfrom api to receive the data from kernel spacce. kernel is sending the timestamp.

QUESTION : could someone tell me how to receive the data by the user program from kernel space ??

Do you have some particular reason for modifying the kernel code to produce the timestamp?

What kernel version are you on? If it is anything but ancient, I suggest you look at: https://www.kernel.org/doc/Documentation/networking/timestamping.txt and some nice example code in: https://www.kernel.org/doc/Documentation/networking/timestamping/

I am not at all familiar with RT Linux, so excuse me if I my suggestion is not applicable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM