This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Year 2038 problem
- From: Clemens Ladisch <clemens at ladisch dot de>
- To: newlib at sourceware dot org
- Date: Sun, 13 Dec 2015 15:43:08 +0100
- Subject: Re: Year 2038 problem
- Authentication-results: sourceware.org; auth=none
- References: <298571211 dot 10499346 dot 1447832835018 dot JavaMail dot yahoo dot ref at mail dot yahoo dot com> <298571211 dot 10499346 dot 1447832835018 dot JavaMail dot yahoo at mail dot yahoo dot com> <20151118094331 dot GQ6402 at calimero dot vinschen dot de> <564C569B dot 4080308 at ladisch dot de> <20151118205314 dot GZ6402 at calimero dot vinschen dot de> <564D8537 dot 20103 at ladisch dot de> <20151119102037 dot GC6402 at calimero dot vinschen dot de> <564EEEE3 dot 7010501 at gmx dot de> <564EFBAA dot 4080703 at ladisch dot de> <564F29C2 dot 9030701 at gmx dot de> <564F33C0 dot 5020204 at ladisch dot de>
I wrote:
> Stefan Heinzmann wrote:
>> Would it not be better to adopt the custom of the system newlib is
>> used with? Maybe it should not be up to the C library to define what
>> time_t should be, but the underlying system's relevant system calls
>> suggest the decision.
>
> Cygwin and Linux have 64-bit system calls. Practically everything else
> is embedded, where newlib must define what the custom is.
... except that there is some code that uses time_t in the system call
interfaces:
$ grep -rw -e SYS_time -e SYS_gettimeofday -e SYS_utime | grep -v '#define'
libgloss/arm/redboot-syscalls.c: err = __syscall(SYS_gettimeofday, tp, tzp);
libgloss/bfin/syscalls.c: tv->tv_sec = do_syscall (SYS_time, 0);
libgloss/d30v/syscalls.c: result = (time_t) __syscall (time_ptr, 0, 0, 0, SYS_time);
libgloss/d30v/syscalls.c: return __syscall (filename, packet, 0, 0, SYS_utime);
libgloss/epiphany/gettimeofday.c: return asm_syscall (tp, tzp, NULL, SYS_gettimeofday);
libgloss/iq2000/gettime.c: return TRAP0 (SYS_gettimeofday, tp, tzp, 0);
libgloss/iq2000/time.c: return TRAP0 (SYS_time, tloc, 0, 0);
libgloss/iq2000/utime.c: return TRAP0 (SYS_utime, path, times, 0);
libgloss/m32r/m32r-stub.c: SYS_time,
libgloss/m32r/m32r-stub.c: SYS_utime,
libgloss/m32r/utime.c: return TRAP0 (SYS_utime, path, times, 0);
libgloss/mn10200/gettime.c: return TRAP0 (SYS_gettimeofday, tp, tzp, 0);
libgloss/mn10200/time.c: return TRAP0 (SYS_time, tloc, 0, 0);
libgloss/mn10200/utime.c: return TRAP0 (SYS_utime, path, times, 0);
libgloss/mn10300/gettime.c: return TRAP0 (SYS_gettimeofday, tp, tzp, 0);
libgloss/mn10300/time.c: res = TRAP0 (SYS_time, 0, 0, 0);
libgloss/mn10300/utime.c: return TRAP0 (SYS_utime, path, times, 0);
libgloss/mt/gettime.c: return TRAP0 (SYS_gettimeofday, tp, tzp, 0);
libgloss/mt/time.c: return TRAP0 (SYS_time, tloc, 0, 0);
libgloss/mt/utime.c: return TRAP0 (SYS_utime, path, times, 0);
libgloss/nds32/_gettimeofday.S: syscall SYS_gettimeofday
libgloss/nds32/_time.S:SYS_WRAPPER _time, SYS_time
libgloss/nds32/_utime.S:SYS_WRAPPER _utime, SYS_utime
libgloss/rs6000/sol-syscall.S:SYSCALL(SYS_gettimeofday,gettimeofday)
libgloss/rs6000/sol-syscall.S:SYSCALL(SYS_time,time)
libgloss/v850/gettime.c: return TRAP0 (SYS_gettimeofday, tp, tzp, 0);
libgloss/v850/time.c: return TRAP0 (SYS_time, tloc, 0, 0);
libgloss/v850/utime.c: return TRAP0 (SYS_utime, path, times, 0);
libgloss/visium/syscalls.c: status = do_syscall (SYS_gettimeofday, (unsigned) >v, 0, 0, 0, &error);
libgloss/xstormy16/syscalls.S: mov r1,#SYS_gettimeofday
libgloss/xstormy16/syscalls.S: mov r1,#SYS_time
libgloss/xstormy16/syscalls.S: mov r1,#SYS_utime
newlib/libc/sys/d10v/trap.S: ldi r4, SYS_time
newlib/libc/sys/sh/syscalls.c: return __trap34 (SYS_utime, path, times);
newlib/libc/sys/sh/syscalls.c: tv->tv_sec = __trap34 (SYS_time);
newlib/libc/sys/sparc64/utime.S: defsyscall (utime, SYS_utime)
newlib/libc/sys/sysmec/gettime.c: return TRAP0 (SYS_gettimeofday, tp, tzp, 0);
newlib/libc/sys/sysmec/time.c: return TRAP0 (SYS_time, tloc, 0, 0);
newlib/libc/sys/sysmec/utime.c: return TRAP0 (SYS_utime, path, times, 0);
newlib/libc/sys/sysnecv850/gettime.c: return TRAP0 (SYS_gettimeofday, tp, tzp, 0);
newlib/libc/sys/sysnecv850/time.c: return TRAP0 (SYS_time, tloc, 0, 0);
newlib/libc/sys/sysnecv850/utime.c: return TRAP0 (SYS_utime, path, times, 0);
newlib/libc/sys/w65/syscalls.c: return _trap3 (SYS_utime, path, times);
newlib/libc/sys/z8ksim/glue.c: MACRO(SYS_time);
Do we know what code (if any) implements those system calls?
Do we care about breaking it?
Regards,
Clemens