compat_ioctl: handle PPPIOCGIDLE for 64-bit time_t
The ppp_idle structure is defined in terms of __kernel_time_t, which is defined as 'long' on all architectures, and this usage is not affected by the y2038 problem since it transports a time interval rather than an absolute time. However, the ppp user space defines the same structure as time_t, which may be 64-bit wide on new libc versions even on 32-bit architectures. It's easy enough to just handle both possible structure layouts on all architectures, to deal with the possibility that a user space ppp implementation comes with its own ppp_idle structure definition, as well as to document the fact that the driver is y2038-safe. Doing this also avoids the need for a special compat mode translation, since 32-bit and 64-bit kernels now support the same interfaces. The old 32-bit structure is also available on native 64-bit architectures now, but this is harmless. Cc: netdev@vger.kernel.org Cc: linux-ppp@vger.kernel.org Cc: Paul Mackerras <paulus@samba.org> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
@@ -142,10 +142,24 @@ struct ppp_comp_stats {
|
||||
/*
|
||||
* The following structure records the time in seconds since
|
||||
* the last NP packet was sent or received.
|
||||
*
|
||||
* Linux implements both 32-bit and 64-bit time_t versions
|
||||
* for compatibility with user space that defines ppp_idle
|
||||
* based on the libc time_t.
|
||||
*/
|
||||
struct ppp_idle {
|
||||
__kernel_time_t xmit_idle; /* time since last NP packet sent */
|
||||
__kernel_time_t recv_idle; /* time since last NP packet received */
|
||||
};
|
||||
|
||||
struct ppp_idle32 {
|
||||
__s32 xmit_idle; /* time since last NP packet sent */
|
||||
__s32 recv_idle; /* time since last NP packet received */
|
||||
};
|
||||
|
||||
struct ppp_idle64 {
|
||||
__s64 xmit_idle; /* time since last NP packet sent */
|
||||
__s64 recv_idle; /* time since last NP packet received */
|
||||
};
|
||||
|
||||
#endif /* _UAPI_PPP_DEFS_H_ */
|
||||
|
Reference in New Issue
Block a user