Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6502

Linux SocketCAN behaviour of recvmsg

$
0
0

I'm writing a CAN logger program. The way I log the data is similar to the way the candump-tool is doing it when invoking candump like candump any:https://github.com/linux-can/can-utils/blob/master/candump.c

candump any makes candump bind to any device, i.e. addr.can_ifindex = 0; then it uses recvmsg to obtain a CAN frame, then it gets the on the struct msghdr msg; attached timestamp to write it into the log file or onto the screen.

My question here is, does the kernel ensures that the following assert is always valid?

struct msghdr msg;// init stuff// ...s[0] = _skt_1; // can0s[1] = _skt_2; // can1// configure and bind sockets// ...select(s[1]+1, &rdfs, NULL, NULL, NULL));recvmsg(s[0], &msg, 0); // https://linux.die.net/man/2/recvmsgtimestamp_1 = getTimestamp(msg);recvmsg(s[1], &msg, 0); // https://linux.die.net/man/2/recvmsgtimestamp_2 = getTimestamp(msg);// Always valid?assert(timestamp_1 < timestamp_2);

A hint to the source code location in the SocketCAN driver would be helpful too.


Viewing all articles
Browse latest Browse all 6502

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>