Skip to content

Commit 0309f98

Browse files
committed
y2038: socket: remove timespec reference in timestamping
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]>
1 parent 75d319c commit 0309f98

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

include/uapi/linux/errqueue.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,16 @@ struct sock_extended_err {
3737
* The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_*
3838
* communicate network timestamps by passing this struct in a cmsg with
3939
* recvmsg(). See Documentation/networking/timestamping.txt for details.
40+
* User space sees a timespec definition that matches either
41+
* __kernel_timespec or __kernel_old_timespec, in the kernel we
42+
* require two structure definitions to provide both.
4043
*/
4144
struct scm_timestamping {
45+
#ifdef __KERNEL__
46+
struct __kernel_old_timespec ts[3];
47+
#else
4248
struct timespec ts[3];
49+
#endif
4350
};
4451

4552
struct scm_timestamping64 {

net/core/scm.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,10 @@ void put_cmsg_scm_timestamping(struct msghdr *msg, struct scm_timestamping_inter
268268
struct scm_timestamping tss;
269269
int i;
270270

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

274276
put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMPING_OLD, sizeof(tss), &tss);
275277
}

0 commit comments

Comments
 (0)