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. */
|
2017-10-01 22:17:19 +00:00
|
|
|
extern char *__tzstring (const char *string) attribute_hidden;
|
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,
|
2017-10-01 22:17:19 +00:00
|
|
|
char **extrap) attribute_hidden;
|
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,
|
2017-10-01 22:17:19 +00:00
|
|
|
struct tm *tp) attribute_hidden;
|
1999-10-19 13:53:34 +00:00
|
|
|
extern void __tzfile_default (const char *std, const char *dst,
|
2017-10-01 22:17:19 +00:00
|
|
|
long int stdoff, long int dstoff)
|
|
|
|
attribute_hidden;
|
|
|
|
extern void __tzset_parse_tz (const char *tz) attribute_hidden;
|
2007-10-14 09:15:45 +00:00
|
|
|
extern void __tz_compute (time_t timer, struct tm *tm, int use_localtime)
|
2017-10-01 22:07:06 +00:00
|
|
|
__THROW attribute_hidden;
|
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 *),
|
2017-10-01 21:33:26 +00:00
|
|
|
time_t *__offset) attribute_hidden;
|
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,
|
2017-10-01 22:17:19 +00:00
|
|
|
struct tm *__tp) attribute_hidden;
|
1998-08-09 17:39:48 +00:00
|
|
|
|
2017-10-01 22:17:19 +00:00
|
|
|
extern char *__asctime_r (const struct tm *__tp, char *__buf)
|
|
|
|
attribute_hidden;
|
|
|
|
extern void __tzset (void) attribute_hidden;
|
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. */
|
2017-10-01 22:17:19 +00:00
|
|
|
extern struct tm *__tz_convert (const time_t *timer, int use_localtime,
|
|
|
|
struct tm *tp) attribute_hidden;
|
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);
|
Clean pthread functions namespaces for C11 threads
This patch adds internal definition (through {libc_}hidden_{proto,def}) and
also change some strong to weak alias for symbols that might be used by C11
threads implementations.
The patchset should not change libc/libpthread functional, although object
changes are expected (since now internal symbols are used instead) and final
exported symbols through GLIBC_PRIVATE is also expanded (to cover libpthread
usage of __mmap{64}, __munmap, __mprotect).
Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
tile{pro,gx}-linux-gnu, and x86_64-linux-gnu).
* include/sched.h (__sched_get_priority_max): Add libc hidden proto.
(__sched_get_prioriry_min): Likewise.
* include/sys/mman.h (__mmap): Likewise.
(__mmap64): Likewise.
(__munmap): Likewise.
(__mprotect): Likewise.
* include/termios.h (__tcsetattr): Likewise.
* include/time.h (__nanosleep): Use hidden_proto instead of
libc_hidden_proto.
* posix/nanosleep.c (__nanosleep): Likewise.
* misc/Versions (libc): Export __mmap, __munmap, __mprotect,
__sched_get_priority_min, and __sched_get_priority_max under
GLIBC_PRIVATE.
* nptl/allocatestack.c (__free_stacks): Use internal definition for
libc symbols.
(change_stack_perm): Likewise.
(allocate_stack): Likewise.
* sysdeps/posix/gethostname.c: Likewise.
* nptl/tpp.c (__init_sched_fifo_prio): Likewise.
* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
* sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise.
* nptl/pthreadP.h (__pthread_mutex_timedlock): Add definition.
(__pthread_key_delete): Likewise.
(__pthread_detach): Likewise.
(__pthread_cancel): Likewise.
(__pthread_mutex_trylock): Likewise.
(__pthread_mutexattr_init): Likewise.
(__pthread_mutexattr_settype): Likewise.
* nptl/pthread_cancel.c (pthread_cancel): Change to internal name and
create alias for exported one.
* nptl/pthread_join.c (pthread_join): Likewise.
* nptl/pthread_detach.c (pthread_detach): Likewise.
* nptl/pthread_key_delete.c (pthread_key_delete): Likewise.
* nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise.
* nptl/pthread_create.c: Change static requirements for pthread
symbols.
* nptl/pthread_equal.c (__pthread_equal): Change strong alias to weak
for internal definition.
* nptl/pthread_exit.c (__pthread_exit): Likewise.
* nptl/pthread_getspecific.c (__pthread_getspecific): Likewise.
* nptl/pthread_key_create.c (__pthread_key_create): Likewise.
* nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy): Likewise.
* nptl/pthread_mutex_init.c (__pthread_mutex_init): Likewise.
* nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Likewise.
* nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock): Likewise.
* nptl/pthread_mutexattr_init.c (__pthread_mutexattr_init): Likwise.
* nptl/pthread_mutexattr_settype.c (__pthread_mutexattr_settype):
Likewise.
* nptl/pthread_self.c (__pthread_self): Likewise.
* nptl/pthread_setspecific.c (__pthread_setspecific): Likewise.
* sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise.
* misc/mmap.c (__mmap): Add internal symbol definition.
* misc/mmap.c (__mmap64): Likewise.
* sysdeps/unix/sysv/linux/mmap.c (__mmap): Likewise.
* sysdeps/unix/sysv/linux/mmap64.c (__mmap): Likewise.
(__mmap64): Likewise.
* sysdeps/unix/sysv/linux/i386/Versions (libc) [GLIBC_PRIVATE):
Add __uname.
2016-12-02 18:32:28 +00:00
|
|
|
hidden_proto (__nanosleep)
|
2017-10-01 22:17:19 +00:00
|
|
|
extern int __getdate_r (const char *__string, struct tm *__resbufp)
|
|
|
|
attribute_hidden;
|
2000-11-01 08:10:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Determine CLK_TCK value. */
|
2017-10-01 22:17:19 +00:00
|
|
|
extern int __getclktck (void) attribute_hidden;
|
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,
|
2017-10-01 22:07:06 +00:00
|
|
|
locale_t locparam) attribute_hidden;
|
2004-03-14 21:12:06 +00:00
|
|
|
|
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
|