1998-09-06 23:45:24 +00:00
|
|
|
#ifndef _TIME_H
|
Installed-header hygiene (BZ#20366): time.h types.
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.
2016-08-24 15:54:34 +00:00
|
|
|
#include <time/time.h>
|
|
|
|
|
|
|
|
#ifndef _ISOMAC
|
Rename xlocale.h to bits/types/__locale_t.h.
xlocale.h is already a single-type micro-header, defining struct
__locale_struct and the typedefs __locale_t and locale_t. This patch
brings it into the bits/types/ scheme: there are now
bits/types/__locale_t.h which defines only __locale_struct and
__locale_t, and bits/types/locale_t.h which defines locale_t as well
as the other two. None of *our* headers need __locale_t.h, but it
appears to me that libstdc++ could make use of it.
There are a lot of external uses of xlocale.h, but all the uses I
checked had an autoconf test or equivalent for its existence. It has
never been available from other C libraries, and it has always
contained a comment reading "This file is not standardized, don't rely
on it, it can go away without warning" so I think dropping it is
pretty safe.
I also took the opportunity to clean up comments in various public
header files that still talk about the *_l interfaces as though they
were completely nonstandard. There are a few of them, notably the
strtoX_l and wcstoX_l families, that haven't been standardized, but
the bulk are in POSIX.1-2008.
* locale/xlocale.h: Rename to...
* locale/bits/types/__locale_t.h: ...here. Adjust commentary.
Only define struct __locale_struct and __locale_t, not locale_t.
* locale/bits/types/locale_t.h: New file; define locale_t here.
* locale/Makefile (headers): Update to match.
* include/xlocale.h: Delete wrapper.
* include/bits/types/__locale_t.h: New wrapper.
* include/bits/types/locale_t.h: New wrapper.
* ctype/ctype.h, include/printf.h, include/time.h
* locale/langinfo.h, locale/locale.h, stdlib/monetary.h
* stdlib/stdlib.h, string/string.h, string/strings.h, time/time.h
* wcsmbs/wchar.h, wctype/wctype.h: Use bits/types/locale_t.h.
Correct outdated comments regarding the standardization status of
the functions that take locale_t arguments.
* stdlib/strtod_l.c, stdlib/strtof_l.c, stdlib/strtol_l.c
* stdlib/strtold_l.c, stdlib/strtoul_l.c, stdlib/strtoull_l.c
* sysdeps/ieee754/ldbl-128ibm/strtold_l.c
* sysdeps/ieee754/ldbl-64-128/strtold_l.c
* wcsmbs/wcstod.c, wcsmbs/wcstod_l.c, wcsmbs/wcstof.c
* wcsmbs/wcstof_l.c, wcsmbs/wcstold.c, wcsmbs/wcstold_l.c:
Don't include xlocale.h. If necessary, include locale.h instead.
* stdlib/strtold_l.c: Unconditionally include wchar.h.
2017-06-09 16:02:06 +00:00
|
|
|
# include <bits/types/locale_t.h>
|
1998-08-09 17:39:48 +00:00
|
|
|
|
2002-08-27 23:36:31 +00:00
|
|
|
extern __typeof (strftime_l) __strftime_l;
|
2002-12-31 23:13:55 +00:00
|
|
|
libc_hidden_proto (__strftime_l)
|
2002-08-27 23:36:31 +00:00
|
|
|
extern __typeof (strptime_l) __strptime_l;
|
|
|
|
|
2002-08-03 12:09:37 +00:00
|
|
|
libc_hidden_proto (time)
|
|
|
|
libc_hidden_proto (asctime)
|
|
|
|
libc_hidden_proto (mktime)
|
|
|
|
libc_hidden_proto (timelocal)
|
|
|
|
libc_hidden_proto (localtime)
|
|
|
|
libc_hidden_proto (strftime)
|
|
|
|
libc_hidden_proto (strptime)
|
|
|
|
|
2012-10-24 21:50:46 +00:00
|
|
|
extern __typeof (clock_getres) __clock_getres;
|
|
|
|
extern __typeof (clock_gettime) __clock_gettime;
|
2013-06-11 05:41:11 +00:00
|
|
|
libc_hidden_proto (__clock_gettime)
|
2012-10-24 21:50:46 +00:00
|
|
|
extern __typeof (clock_settime) __clock_settime;
|
|
|
|
extern __typeof (clock_nanosleep) __clock_nanosleep;
|
|
|
|
extern __typeof (clock_getcpuclockid) __clock_getcpuclockid;
|
2005-07-13 06:26:17 +00:00
|
|
|
|
1998-08-09 17:39:48 +00:00
|
|
|
/* Now define the internal interfaces. */
|
|
|
|
struct tm;
|
|
|
|
|
1998-12-08 16:10:10 +00:00
|
|
|
/* Defined in mktime.c. */
|
Update.
* ctype/ctype-info.c: Declare _nl_C_LC_CTYPE_class,
_nl_C_LC_CTYPE_class32, _nl_C_LC_CTYPE_toupper, _nl_C_LC_CTYPE_tolower,
_nl_C_LC_CTYPE_class_upper, _nl_C_LC_CTYPE_class_lower,
_nl_C_LC_CTYPE_class_alpha, _nl_C_LC_CTYPE_class_digit,
_nl_C_LC_CTYPE_class_xdigit, _nl_C_LC_CTYPE_class_space,
_nl_C_LC_CTYPE_class_print, _nl_C_LC_CTYPE_class_graph,
_nl_C_LC_CTYPE_class_blank, _nl_C_LC_CTYPE_class_cntrl,
_nl_C_LC_CTYPE_class_punct, _nl_C_LC_CTYPE_class_alnum,
_nl_C_LC_CTYPE_map_toupper, _nl_C_LC_CTYPE_map_tolower, and
_nl_C_LC_CTYPE_width: Declare as hidden.
* include/locale.h: Declare _nl_locale_file_list.
* locale/C-address.c: Define _nl_C_LC_ADDRESS as hidden.
* locale/C-collate.c: Define _nl_C_LC_COLLATE as hidden.
* locale/C-identification.c: Define _nl_C_LC_IDENTIFICATION as hidden.
* locale/C-measurement.c: Define _nl_C_LC_MEASUREMENT as hidden.
* locale/C-messages.c: Define _nl_C_LC_MESSAGES as hidden.
* locale/C-monetary.c: Define _nl_C_LC_MONETARY as hidden.
* locale/C-name.c: Define _nl_C_LC_NAME as hidden.
* locale/C-numeric.c: Define _nl_C_LC_NUMERIC as hidden.
* locale/C-paper.c: Define _nl_C_LC_PAPER as hidden.
* locale/C-telephone.c: Define _nl_C_LC_TELEPHONE as hidden.
* locale/C-time.c: Define _nl_C_LC_TIME as hidden.
* locale/C-ctype.c: Define _nl_C_LC_CTYPE_class,
_nl_C_LC_CTYPE_class32, _nl_C_LC_CTYPE_toupper, _nl_C_LC_CTYPE_tolower,
_nl_C_LC_CTYPE_class_upper, _nl_C_LC_CTYPE_class_lower,
_nl_C_LC_CTYPE_class_alpha, _nl_C_LC_CTYPE_class_digit,
_nl_C_LC_CTYPE_class_xdigit, _nl_C_LC_CTYPE_class_space,
_nl_C_LC_CTYPE_class_print, _nl_C_LC_CTYPE_class_graph,
_nl_C_LC_CTYPE_class_blank, _nl_C_LC_CTYPE_class_cntrl,
_nl_C_LC_CTYPE_class_punct, _nl_C_LC_CTYPE_class_alnum,
_nl_C_LC_CTYPE_map_toupper, _nl_C_LC_CTYPE_map_tolower,
_nl_C_LC_CTYPE_width, and as hidden.
* locale/findlocale.c: Declare _nl_C as hidden.
* locale/newlocale.c: Likewise.
* locale/setlocale.c: Define _nl_C as hidden. Remove declaration of
_nl_locale_file_list.
* locale/xlocale.c: Declare _nl_C_LC_CTYPE_class,
_nl_C_LC_CTYPE_toupper, and _nl_C_LC_CTYPE_tolower as hidden.
Define _nl_C_locobj as hidden.
* malloc/mtrace.c (_mtrace_file): Define as hidden.
(_mtrace_line): Likewise.
* include/time.h: Declare __mon_yday as hidden.
* time/strptime.c [_LIBC] (__mon_yday): Remove declaration.
* libio/libioP.h: Declare __libio_codecvt as hidden.
* libio/fileops.c: Declare __libio_translit as hidden.
* libio/iofwide.c: Define __libio_translit as hidden.
* login/getutent_r.c: Define __libc_utmp_lock as hidden.
* login/getutid_r.c: Declare __libc_utmp_lock as hidden.
* login/getutline_r.c: Likewise.
* login/utmpname.c: Likewise.
* login/utmp-private.h: Declare __libc_utmp_file_functions,
__libc_utmp_unknown_functions, __libc_utmp_jump_table, and
__libc_utmp_file_name as hidden.
* locale/setlocale.c (__libc_setlocale_lock): Define as hidden.
* locale/duplocale.c (__libc_setlocale_lock): Declare as hidden.
* locale/freelocale.c: Likewise.
* locale/lc-time.c: Likewise.
* sysdeps/unix/bsd/getpt.c (__libc_ptyname1): Define as hidden.
(__libc_ptyname2): Likewise.
* sysdeps/unix/sysv/linux/ptsname.c (__libc_ptyname1): Declare as
hidden.
(__libc_ptyname2): Likewise.
* sysdeps/generic/sbrk.c: Declare __libc_multiple_libcs as hidden.
* sysdeps/arm/init-first.c (__libc_multiple_libcs): Define as hidden.
* sysdeps/generic/init-first.c: Likewise.
* sysdeps/i386/init-first.c: Likewise.
* sysdeps/mach/hurd/i386/init-first.c: Likewise.
* sysdeps/mach/hurd/mips/init-first.c: Likewise.
* sysdeps/mach/hurd/powerpc/init-first.c: Likewise.
* sysdeps/sh/init-first.c: Likewise.
* sysdeps/unix/sysv/aix/init-first.c: Likewise.
* sysdeps/unix/sysv/linux/init-first.c: Likewise.
2002-03-13 06:33:52 +00:00
|
|
|
extern const unsigned short int __mon_yday[2][13] attribute_hidden;
|
1998-12-08 16:10:10 +00:00
|
|
|
|
|
|
|
/* Defined in localtime.c. */
|
2002-03-12 10:25:36 +00:00
|
|
|
extern struct tm _tmbuf attribute_hidden;
|
1998-12-08 16:10:10 +00:00
|
|
|
|
|
|
|
/* Defined in tzset.c. */
|
1999-11-23 17:22:17 +00:00
|
|
|
extern char *__tzstring (const char *string);
|
1998-12-08 16:10:10 +00:00
|
|
|
|
2002-03-12 10:25:36 +00:00
|
|
|
extern int __use_tzfile attribute_hidden;
|
1998-12-08 16:10:10 +00:00
|
|
|
|
1999-10-19 13:53:34 +00:00
|
|
|
extern void __tzfile_read (const char *file, size_t extra,
|
1999-11-23 17:22:17 +00:00
|
|
|
char **extrap);
|
2003-02-01 20:53:16 +00:00
|
|
|
extern void __tzfile_compute (time_t timer, int use_localtime,
|
|
|
|
long int *leap_correct, int *leap_hit,
|
|
|
|
struct tm *tp);
|
1999-10-19 13:53:34 +00:00
|
|
|
extern void __tzfile_default (const char *std, const char *dst,
|
1999-11-23 17:22:17 +00:00
|
|
|
long int stdoff, long int dstoff);
|
2007-10-14 09:15:45 +00:00
|
|
|
extern void __tzset_parse_tz (const char *tz);
|
|
|
|
extern void __tz_compute (time_t timer, struct tm *tm, int use_localtime)
|
|
|
|
__THROW internal_function;
|
1998-12-08 16:10:10 +00:00
|
|
|
|
1998-08-09 17:39:48 +00:00
|
|
|
/* Subroutine of `mktime'. Return the `time_t' representation of TP and
|
|
|
|
normalize TP, given that a `struct tm *' maps to a `time_t' as performed
|
|
|
|
by FUNC. Keep track of next guess for time_t offset in *OFFSET. */
|
1999-10-19 13:53:34 +00:00
|
|
|
extern time_t __mktime_internal (struct tm *__tp,
|
|
|
|
struct tm *(*__func) (const time_t *,
|
|
|
|
struct tm *),
|
1999-11-23 17:22:17 +00:00
|
|
|
time_t *__offset);
|
2012-01-08 04:57:22 +00:00
|
|
|
extern struct tm *__localtime_r (const time_t *__timer,
|
2002-03-15 09:30:44 +00:00
|
|
|
struct tm *__tp) attribute_hidden;
|
1998-08-09 17:39:48 +00:00
|
|
|
|
2012-01-08 04:57:22 +00:00
|
|
|
extern struct tm *__gmtime_r (const time_t *__restrict __timer,
|
1999-11-23 17:22:17 +00:00
|
|
|
struct tm *__restrict __tp);
|
2002-08-04 23:32:14 +00:00
|
|
|
libc_hidden_proto (__gmtime_r)
|
1999-10-06 03:46:48 +00:00
|
|
|
|
1998-08-09 17:39:48 +00:00
|
|
|
/* Compute the `struct tm' representation of *T,
|
|
|
|
offset OFFSET seconds east of UTC,
|
|
|
|
and store year, yday, mon, mday, wday, hour, min, sec into *TP.
|
|
|
|
Return nonzero if successful. */
|
2012-01-08 04:57:22 +00:00
|
|
|
extern int __offtime (const time_t *__timer,
|
1999-10-19 13:53:34 +00:00
|
|
|
long int __offset,
|
1999-11-23 17:22:17 +00:00
|
|
|
struct tm *__tp);
|
1998-08-09 17:39:48 +00:00
|
|
|
|
2012-01-08 04:57:22 +00:00
|
|
|
extern char *__asctime_r (const struct tm *__tp, char *__buf);
|
1999-11-23 17:22:17 +00:00
|
|
|
extern void __tzset (void);
|
1998-08-09 17:39:48 +00:00
|
|
|
|
1998-12-08 16:10:10 +00:00
|
|
|
/* Prototype for the internal function to get information based on TZ. */
|
1999-11-23 17:22:17 +00:00
|
|
|
extern struct tm *__tz_convert (const time_t *timer, int use_localtime, struct tm *tp);
|
1998-12-08 16:10:10 +00:00
|
|
|
|
2012-01-08 04:57:22 +00:00
|
|
|
extern int __nanosleep (const struct timespec *__requested_time,
|
1999-11-23 17:22:17 +00:00
|
|
|
struct timespec *__remaining);
|
2006-07-31 05:57:52 +00:00
|
|
|
libc_hidden_proto (__nanosleep)
|
2012-01-08 04:57:22 +00:00
|
|
|
extern int __nanosleep_nocancel (const struct timespec *__requested_time,
|
2006-07-31 05:57:52 +00:00
|
|
|
struct timespec *__remaining)
|
|
|
|
attribute_hidden;
|
2012-01-08 04:57:22 +00:00
|
|
|
extern int __getdate_r (const char *__string, struct tm *__resbufp);
|
2000-11-01 08:10:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Determine CLK_TCK value. */
|
|
|
|
extern int __getclktck (void);
|
2003-06-25 00:00:50 +00:00
|
|
|
|
|
|
|
|
2004-03-14 21:12:06 +00:00
|
|
|
/* strptime support. */
|
|
|
|
extern char * __strptime_internal (const char *rp, const char *fmt,
|
2007-07-28 19:08:57 +00:00
|
|
|
struct tm *tm, void *statep,
|
Use locale_t, not __locale_t, throughout glibc
<locale.h> is specified to define locale_t in POSIX.1-2008, and so are
all of the headers that define functions that take locale_t arguments.
Under _GNU_SOURCE, the additional headers that define such functions
have also always defined locale_t. Therefore, there is no need to use
__locale_t in public function prototypes, nor in any internal code.
* ctype/ctype-c99_l.c, ctype/ctype.h, ctype/ctype_l.c
* include/monetary.h, include/stdlib.h, include/time.h
* include/wchar.h, locale/duplocale.c, locale/freelocale.c
* locale/global-locale.c, locale/langinfo.h, locale/locale.h
* locale/localeinfo.h, locale/newlocale.c
* locale/nl_langinfo_l.c, locale/uselocale.c
* localedata/bug-usesetlocale.c, localedata/tst-xlocale2.c
* stdio-common/vfscanf.c, stdlib/monetary.h, stdlib/stdlib.h
* stdlib/strfmon_l.c, stdlib/strtod_l.c, stdlib/strtof_l.c
* stdlib/strtol.c, stdlib/strtol_l.c, stdlib/strtold_l.c
* stdlib/strtoll_l.c, stdlib/strtoul_l.c, stdlib/strtoull_l.c
* string/strcasecmp.c, string/strcoll_l.c, string/string.h
* string/strings.h, string/strncase.c, string/strxfrm_l.c
* sysdeps/ieee754/float128/strtof128_l.c
* sysdeps/ieee754/float128/wcstof128.c
* sysdeps/ieee754/float128/wcstof128_l.c
* sysdeps/ieee754/ldbl-128ibm/strtold_l.c
* sysdeps/ieee754/ldbl-64-128/strtold_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
* sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
* sysdeps/powerpc/powerpc32/power7/strcasecmp.S
* sysdeps/powerpc/powerpc64/power7/strcasecmp.S
* sysdeps/x86_64/strcasecmp_l-nonascii.c
* sysdeps/x86_64/strncase_l-nonascii.c, time/strftime_l.c
* time/strptime_l.c, time/time.h, wcsmbs/mbsrtowcs_l.c
* wcsmbs/wchar.h, wcsmbs/wcscasecmp.c, wcsmbs/wcsncase.c
* wcsmbs/wcstod.c, wcsmbs/wcstod_l.c, wcsmbs/wcstof.c
* wcsmbs/wcstof_l.c, wcsmbs/wcstol_l.c, wcsmbs/wcstold.c
* wcsmbs/wcstold_l.c, wcsmbs/wcstoll_l.c, wcsmbs/wcstoul_l.c
* wcsmbs/wcstoull_l.c, wctype/iswctype_l.c
* wctype/towctrans_l.c, wctype/wcfuncs_l.c
* wctype/wctrans_l.c, wctype/wctype.h, wctype/wctype_l.c:
Change all uses of __locale_t to locale_t.
2017-06-20 13:26:43 +00:00
|
|
|
locale_t locparam)
|
2004-03-14 21:12:06 +00:00
|
|
|
internal_function;
|
|
|
|
|
2004-04-04 00:41:39 +00:00
|
|
|
extern double __difftime (time_t time1, time_t time0);
|
2004-03-14 21:12:06 +00:00
|
|
|
|
|
|
|
|
2003-06-25 00:00:50 +00:00
|
|
|
/* Use in the clock_* functions. Size of the field representing the
|
|
|
|
actual clock ID. */
|
2012-02-26 04:18:39 +00:00
|
|
|
#define CLOCK_IDFIELD_SIZE 3
|
2005-12-23 01:55:26 +00:00
|
|
|
|
1998-08-09 17:39:48 +00:00
|
|
|
#endif
|
1998-09-06 23:45:24 +00:00
|
|
|
#endif
|