Skip to content

Commit

Permalink
y2038: socket: remove timespec reference in timestamping
Browse files Browse the repository at this point in the history
In order to remove the 'struct timespec' definition and the
timespec64_to_timespec() helper function, change over the in-kernel
definition of 'struct scm_timestamping' to use the __kernel_old_timespec
replacement and open-code the assignment.

Acked-by: Deepa Dinamani <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
  • Loading branch information
arndb committed Nov 15, 2019
1 parent 75d319c commit 0309f98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions include/uapi/linux/errqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@ struct sock_extended_err {
* The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_*
* communicate network timestamps by passing this struct in a cmsg with
* recvmsg(). See Documentation/networking/timestamping.txt for details.
* User space sees a timespec definition that matches either
* __kernel_timespec or __kernel_old_timespec, in the kernel we
* require two structure definitions to provide both.
*/
struct scm_timestamping {
#ifdef __KERNEL__
struct __kernel_old_timespec ts[3];
#else
struct timespec ts[3];
#endif
};

struct scm_timestamping64 {
Expand Down
6 changes: 4 additions & 2 deletions net/core/scm.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,10 @@ void put_cmsg_scm_timestamping(struct msghdr *msg, struct scm_timestamping_inter
struct scm_timestamping tss;
int i;

for (i = 0; i < ARRAY_SIZE(tss.ts); i++)
tss.ts[i] = timespec64_to_timespec(tss_internal->ts[i]);
for (i = 0; i < ARRAY_SIZE(tss.ts); i++) {
tss.ts[i].tv_sec = tss_internal->ts[i].tv_sec;
tss.ts[i].tv_nsec = tss_internal->ts[i].tv_nsec;
}

put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMPING_OLD, sizeof(tss), &tss);
}
Expand Down

0 comments on commit 0309f98

Please sign in to comment.