嵌入式Linux2038问题内核时间time_t跟踪笔记

2019-07-12 15:59发布

在Linux 2.6内核是这样子 cd include grep -irn timer_t . ./asm-generic/posix_types.h:94:typedef int __kernel_timer_t; ./asm-generic/siginfo.h:64: __kernel_timer_t _tid; /* timer id */ ./linux/compat.h:523: timer_t __user *created_timer_id); ./linux/compat.h:524:asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags, ./linux/compat.h:527:asmlinkage long compat_sys_timer_gettime(timer_t timer_id, ./linux/types.h:34:typedef __kernel_timer_t timer_t; ./linux/syscalls.h:308: timer_t __user * created_timer_id); ./linux/syscalls.h:309:asmlinkage long sys_timer_gettime(timer_t timer_id, ./linux/syscalls.h:311:asmlinkage long sys_timer_getoverrun(timer_t timer_id); ./linux/syscalls.h:312:asmlinkage long sys_timer_settime(timer_t timer_id, int flags, ./linux/syscalls.h:315:asmlinkage long sys_timer_delete(timer_t timer_id); ./linux/xfrm.h:288: XFRMA_ETIMER_THRESH, ./linux/ibmtr.h:312: unsigned char timer_t1; ./linux/ibmtr.h:313: unsigned char timer_t2; ./linux/ibmtr.h:314: unsigned char timer_ti; ./linux/netfilter/xt_IDLETIMER.h:36:struct idletimer_tg_info { ./linux/netfilter/xt_IDLETIMER.h:42: struct idletimer_tg *timer __attribute__((aligned(8))); ./linux/hrtimer.h:367:extern int hrtimer_try_to_cancel(struct hrtimer *timer); ./linux/alarmtimer.h:9:enum alarmtimer_type { ./linux/alarmtimer.h:39: enum alarmtimer_type type; ./linux/alarmtimer.h:44:void alarm_init(struct alarm *alarm, enum alarmtimer_type type, ./linux/posix-timers.h:60: timer_t it_id; /* timer id */ ./linux/sfi.h:138:struct sfi_timer_table_entry { ./linux/sched.h:276:extern int get_nohz_timer_target(void); ./drm/nouveau_drm.h:79:#define NOUVEAU_GETPARAM_PTIMER_TIME 14 ./xen/interface/vcpu.h:134:#define VCPUOP_set_periodic_timer 6 /* arg == vcpu_set_periodic_timer_t */ ./xen/interface/vcpu.h:145:#define VCPUOP_set_singleshot_timer 8 /* arg == vcpu_set_singleshot_timer_t */ ./sound/ymfpci.h:334: unsigned int timer_ticks; ./sound/asound.h:697:struct snd_timer_tread { ./rxrpc/types.h:34:typedef struct rxrpc_timer rxrpc_timer_t; 找到 ./linux/types.h:34:typedef __kernel_timer_t timer_t; 搜索__kernel_timer_t ./asm-generic/posix_types.h:94:typedef int __kernel_timer_t; ./asm-generic/siginfo.h:64: __kernel_timer_t _tid; /* timer id */ ./linux/types.h:34:typedef int __kernel_timer_t; typedef __kernel_timer_t timer_t; :typedef int __kernel_timer_t; timer_t 是int类型 hecong@tdk:include$ grep -irn __kernel_time_t . ./asm-generic/posix_types.h:92:typedef __kernel_long_t __kernel_time_t; ./asm-generic/sembuf.h:15: * 64 bit architectures typically define a 64 bit __kernel_time_t, ./asm-generic/sembuf.h:25: __kernel_time_t sem_otime; /* last semop time */ ./asm-generic/sembuf.h:29: __kernel_time_t sem_ctime; /* last change time */ ./asm-generic/shmbuf.h:15: * 64 bit architectures typically define a 64 bit __kernel_time_t, ./asm-generic/shmbuf.h:28: __kernel_time_t shm_atime; /* last attach time */ ./asm-generic/shmbuf.h:32: __kernel_time_t shm_dtime; /* last detach time */ ./asm-generic/shmbuf.h:36: __kernel_time_t shm_ctime; /* last change time */ ./asm-generic/msgbuf.h:15: * 64 bit architectures typically define a 64 bit __kernel_time_t, ./asm-generic/msgbuf.h:26: __kernel_time_t msg_stime; /* last msgsnd time */ ./asm-generic/msgbuf.h:30: __kernel_time_t msg_rtime; /* last msgrcv time */ ./asm-generic/msgbuf.h:34: __kernel_time_t msg_ctime; /* last change time */ ./linux/utime.h:7: __kernel_time_t actime; ./linux/utime.h:8: __kernel_time_t modtime; ./linux/sem.h:25: __kernel_time_t sem_otime; /* last semop time */ ./linux/sem.h:26: __kernel_time_t sem_ctime; /* last change time */ ./linux/msg.h:19: __kernel_time_t msg_stime; /* last msgsnd time */ ./linux/msg.h:20: __kernel_time_t msg_rtime; /* last msgrcv time */ ./linux/msg.h:21: __kernel_time_t msg_ctime; /* last change time */ ./linux/dvb/video.h:140: __kernel_time_t timestamp; ./linux/cyclades.h:85: __kernel_time_t in_use; /* Time device has been in use (secs) */ ./linux/cyclades.h:86: __kernel_time_t recv_idle; /* Time since last char received (secs) */ ./linux/cyclades.h:87: __kernel_time_t xmit_idle; /* Time since last char transmitted (secs) */ ./linux/types.h:78:typedef __kernel_time_t time_t; ./linux/time.h:15: __kernel_time_t tv_sec; /* seconds */ ./linux/time.h:21: __kernel_time_t tv_sec; /* seconds */ ./linux/ppp_defs.h:150: __kernel_time_t xmit_idle; /* time since last NP packet sent */ ./linux/ppp_defs.h:151: __kernel_time_t recv_idle; /* time since last NP packet received */ ./linux/shm.h:35: __kernel_time_t shm_atime; /* last attach time */ ./linux/shm.h:36: __kernel_time_t shm_dtime; /* last detach time */ ./linux/shm.h:37: __kernel_time_t shm_ctime; /* last change time */ hecong@tdk:include$ typedef __kernel_long_t __kernel_time_t time_t 是long类型 4.0内核及以下32位机制都有2038问题.4.0以上没有看