about summary refs log tree commit diff
path: root/time/bits
Commit message (Collapse)AuthorAgeFilesLines
* Always define __USE_TIME_BITS64 when 64 bit time_t is usedAdhemerval Zanella2024-04-023-4/+4
| | | | | | | | | | | | | | | | | | | | It was raised on libc-help [1] that some Linux kernel interfaces expect the libc to define __USE_TIME_BITS64 to indicate the time_t size for the kABI. Different than defined by the initial y2038 design document [2], the __USE_TIME_BITS64 is only defined for ABIs that support more than one time_t size (by defining the _TIME_BITS for each module). The 64 bit time_t redirects are now enabled using a different internal define (__USE_TIME64_REDIRECTS). There is no expected change in semantic or code generation. Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, and arm-linux-gnueabi [1] https://sourceware.org/pipermail/libc-help/2024-January/006557.html [2] https://sourceware.org/glibc/wiki/Y2038ProofnessDesign Reviewed-by: DJ Delorie <dj@redhat.com>
* y2038: Add __USE_TIME_BITS64 support for struct timespecAdhemerval Zanella2021-06-151-1/+6
| | | | | | | | The __USE_TIME_BITS64 is not defined internally yet. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* y2038: Add __USE_TIME_BITS64 support for struct timevalAdhemerval Zanella2021-06-151-0/+5
| | | | | | | | The __USE_TIME_BITS64 is not defined internally yet. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* y2038: Add __USE_TIME_BITS64 support for time_tAdhemerval Zanella2021-06-151-0/+4
| | | | | | | | The __USE_TIME_BITS64 is not defined internally yet. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* time: Add 64-bit time_t support for ftimeAdhemerval Zanella2020-10-271-0/+15
| | | | | | | | | It basically calls the 64-bit __clock_gettime64 and adds the overflow check. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* time: Add padding for the timespec if requiredAlistair Francis2019-10-011-0/+13
| | | | | | | | | If we are running on a 32-bit system with a 64-bit time_t we need to ensure there is padding around the tv_nsec variable. This is requried as the timespec is #defined to the __timespec64 struct. * time/bits/types/struct_timespec.h: Add padding for the timespec if required.
* Use _STRUCT_TIMESPEC as guard in <bits/types/struct_timespec.h> [BZ #23349]Florian Weimer2018-06-281-2/+3
| | | | | | | | | | After commit d76d3703551a362b472c866b5b6089f66f8daa8e ("Fix missing timespec definition for sys/stat.h (BZ #21371)") in combination with kernel UAPI changes, GCC sanitizer builds start to fail due to a conflicting definition of struct timespec in <linux/time.h>. Use _STRUCT_TIMESPEC as the header file inclusion guard, which is already checked in the kernel header, to support including <linux/time.h> and <sys/stat.h> in the same translation unit.
* Remove C++ namespace handling from glibc headers.Joseph Myers2017-03-163-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glibc headers include some code (not particularly consistent or systematic) to put various declarations in C++ namespaces std and __c99, if _GLIBCPP_USE_NAMESPACES is defined. As noted in <https://gcc.gnu.org/ml/libstdc++/2017-03/msg00025.html>, this macro was removed from libstdc++ in 2000. I don't expect compilation with such old versions of libstdc++ to work with current glibc headers anyway (whereas old *binaries* are expected to stay working with current glibc); this patch (which should be a no-op with any libstdc++ version postdating that removal) removes all this code from the glibc headers. The begin-end-check.pl test, whose comments say it is about checking these namespace macro calls, is also removed. The code in that test would have covered __BEGIN_DECLS / __END_DECLS as well, but if those weren't properly matched it would show up with the check-installed-headers-cxx tests, so I don't think there is an actual use for keeping begin-end-check.pl with the namespace code removed. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by the patch). * misc/sys/cdefs.h (__BEGIN_NAMESPACE_STD): Remove macro. (__END_NAMESPACE_STD): Likewise. (__USING_NAMESPACE_STD): Likewise. (__BEGIN_NAMESPACE_C99): Likewise. (__END_NAMESPACE_C99): Likewise. (__USING_NAMESPACE_C99): Likewise. * math/math.h (_Mdouble_BEGIN_NAMESPACE): Do not define and undefine macro. (_Mdouble_END_NAMESPACE): Likewise. * ctype/ctype.h: Do not handle C++ namespaces. * libio/bits/stdio-ldbl.h: Likewise. * libio/stdio.h: Likewise. * locale/locale.h: Likewise. * math/bits/mathcalls.h: Likewise. * setjmp/setjmp.h: Likewise. * signal/signal.h: Likewise. * stdlib/bits/stdlib-float.h: Likewise. * stdlib/bits/stdlib-ldbl.h: Likewise. * stdlib/stdlib.h: Likewise. * string/string.h: Likewise. * sysdeps/x86/fpu/bits/mathinline.h: Likewise. * time/bits/types/clock_t.h: Likewise. * time/bits/types/struct_tm.h: Likewise. * time/bits/types/time_t.h: Likewise. * time/time.h: Likewise. * wcsmbs/bits/wchar-ldbl.h: Likewise. * wcsmbs/uchar.h: Likewise. * wcsmbs/wchar.h: Likewise. [_GLIBCPP_USE_NAMESPACES] (wint_t): Remove conditional definition. * wctype/wctype.h: Do not handle C++ namespaces. * scripts/begin-end-check.pl: Remove. * Makefile (installed-headers): Likewise. (tests-special): Do not add $(objpfx)begin-end-check.out. ($(objpfx)begin-end-check.out): Remove.
* Installed-header hygiene (BZ#20366): time.h types.Zack Weinberg2016-09-238-0/+121
Many headers are expected to expose a subset of the type definitions in time.h. time.h has a whole bunch of messy logic for conditionally defining some its types and structs, but, as best I can tell, this has never worked 100%. In particular, __need_timespec is ineffective if _TIME_H has already been defined, which means that if you compile #include <time.h> #include <sched.h> with e.g. -fsyntax-only -std=c89 -Wall -Wsystem-headers, you will get In file included from test.c:2:0: /usr/include/sched.h:74:57: warning: "struct timespec" declared inside parameter list will not be visible outside of this definition or declaration extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW; ^~~~~~~~ And if you want to _use_ sched_rr_get_interval in a TU compiled that way, you're hosed. This patch replaces all of that with small bits/types/TYPE.h headers as introduced earlier. time.h and bits/time.h are now *much* simpler, and a lot of other headers are slightly simpler. * time/time.h, bits/time.h, sysdeps/unix/sysv/linux/bits/time.h: Remove all logic conditional on __need macros. Move all the conditionally defined types to their own headers... * time/bits/types/clock_t.h: Define clock_t here. * time/bits/types/clockid_t.h: Define clockid_t here. * time/bits/types/struct_itimerspec.h: Define struct itimerspec here. * time/bits/types/struct_timespec.h: Define struct timespec here. * time/bits/types/struct_timeval.h: Define struct timeval here. * time/bits/types/struct_tm.h: Define struct tm here. * time/bits/types/time_t.h: Define time_t here. * time/bits/types/timer_t.h: Define timer_t here. * time/Makefile: Install the new headers. * bits/resource.h, io/fcntl.h, io/sys/poll.h, io/sys/stat.h * io/utime.h, misc/sys/select.h, posix/sched.h, posix/sys/times.h * posix/sys/types.h, resolv/netdb.h, rt/aio.h, rt/mqueue.h * signal/signal.h, pthread/semaphore.h, sysdeps/nptl/pthread.h * sysdeps/unix/sysv/linux/alpha/bits/resource.h * sysdeps/unix/sysv/linux/alpha/sys/acct.h * sysdeps/unix/sysv/linux/bits/resource.h * sysdeps/unix/sysv/linux/bits/timex.h * sysdeps/unix/sysv/linux/mips/bits/resource.h * sysdeps/unix/sysv/linux/net/ppp_defs.h * sysdeps/unix/sysv/linux/sparc/bits/resource.h * sysdeps/unix/sysv/linux/sys/acct.h * sysdeps/unix/sysv/linux/sys/timerfd.h * sysvipc/sys/msg.h, sysvipc/sys/sem.h, sysvipc/sys/shm.h * time/sys/time.h, time/sys/timeb.h Use the new bits/types headers. * include/time.h: Remove __need logic. * include/bits/time.h * include/bits/types/clock_t.h, include/bits/types/clockid_t.h * include/bits/types/time_t.h, include/bits/types/timer_t.h * include/bits/types/struct_itimerspec.h * include/bits/types/struct_timespec.h * include/bits/types/struct_timeval.h * include/bits/types/struct_tm.h: New wrapper headers.