Merge pull request #609 from dphipps-qnx/fix_cmsg_types

candump: Use SCM_* consts instead of SO_* for cmsg_type
master
Marc Kleine-Budde 2025-12-05 16:26:30 +01:00 committed by GitHub
commit 88a0417a6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -72,6 +72,9 @@
#ifndef SO_TIMESTAMPING
#define SO_TIMESTAMPING 37
#endif
#ifndef SCM_TIMESTAMPING
#define SCM_TIMESTAMPING SO_TIMESTAMPING
#endif
#define TIMESTAMPSZ 50 /* string 'absolute with date' requires max 49 bytes */
@ -807,13 +810,13 @@ int main(int argc, char **argv)
for (cmsg = CMSG_FIRSTHDR(&msg);
cmsg && (cmsg->cmsg_level == SOL_SOCKET);
cmsg = CMSG_NXTHDR(&msg,cmsg)) {
if (cmsg->cmsg_type == SO_TIMESTAMP) {
if (cmsg->cmsg_type == SCM_TIMESTAMP) {
struct timeval tv;
memcpy(&tv, CMSG_DATA(cmsg), sizeof(tv));
ts.tv_sec = tv.tv_sec;
ts.tv_nsec = tv.tv_usec;
ts.tv_nsec *= 1000;
} else if (cmsg->cmsg_type == SO_TIMESTAMPING) {
} else if (cmsg->cmsg_type == SCM_TIMESTAMPING) {
struct timespec *stamp = (struct timespec *)CMSG_DATA(cmsg);
/*