about summary refs log tree commit diff
path: root/src/time
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-09-10 23:26:40 -0400
committerRich Felker <dalias@aerifal.cx>2018-09-12 14:34:33 -0400
commit13d1afa46f8098df290008c681816c9eb89ffbdb (patch)
tree01ec1581298b49f20848f9c5ce61bfa9bccd7e1a /src/time
parent8c1ac426e15b27d2879afa26a500fd80010b33b9 (diff)
downloadmusl-13d1afa46f8098df290008c681816c9eb89ffbdb.tar.gz
musl-13d1afa46f8098df290008c681816c9eb89ffbdb.tar.xz
musl-13d1afa46f8098df290008c681816c9eb89ffbdb.zip
overhaul internally-public declarations using wrapper headers
commits leading up to this one have moved the vast majority of
libc-internal interface declarations to appropriate internal headers,
allowing them to be type-checked and setting the stage to limit their
visibility. the ones that have not yet been moved are mostly
namespace-protected aliases for standard/public interfaces, which
exist to facilitate implementing plain C functions in terms of POSIX
functionality, or C or POSIX functionality in terms of extensions that
are not standardized. some don't quite fit this description, but are
"internally public" interfacs between subsystems of libc.

rather than create a number of newly-named headers to declare these
functions, and having to add explicit include directives for them to
every source file where they're needed, I have introduced a method of
wrapping the corresponding public headers.

parallel to the public headers in $(srcdir)/include, we now have
wrappers in $(srcdir)/src/include that come earlier in the include
path order. they include the public header they're wrapping, then add
declarations for namespace-protected versions of the same interfaces
and any "internally public" interfaces for the subsystem they
correspond to.

along these lines, the wrapper for features.h is now responsible for
the definition of the hidden, weak, and weak_alias macros. this means
source files will no longer need to include any special headers to
access these features.

over time, it is my expectation that the scope of what is "internally
public" will expand, reducing the number of source files which need to
include *_impl.h and related headers down to those which are actually
implementing the corresponding subsystems, not just using them.
Diffstat (limited to 'src/time')
-rw-r--r--src/time/__map_file.c2
-rw-r--r--src/time/__tz.c3
-rw-r--r--src/time/asctime.c2
-rw-r--r--src/time/asctime_r.c2
-rw-r--r--src/time/clock.c2
-rw-r--r--src/time/gmtime.c2
-rw-r--r--src/time/localtime.c2
-rw-r--r--src/time/strftime.c4
-rw-r--r--src/time/time.c2
-rw-r--r--src/time/time_impl.h1
-rw-r--r--src/time/timespec_get.c2
11 files changed, 1 insertions, 23 deletions
diff --git a/src/time/__map_file.c b/src/time/__map_file.c
index b91eb8ed..750d1958 100644
--- a/src/time/__map_file.c
+++ b/src/time/__map_file.c
@@ -3,8 +3,6 @@
 #include <sys/stat.h>
 #include "syscall.h"
 
-void *__mmap(void *, size_t, int, int, int, off_t);
-
 const char unsigned *__map_file(const char *pathname, size_t *size)
 {
 	struct stat st;
diff --git a/src/time/__tz.c b/src/time/__tz.c
index 814edcdf..a2afe92a 100644
--- a/src/time/__tz.c
+++ b/src/time/__tz.c
@@ -3,6 +3,7 @@
 #include <limits.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/mman.h>
 #include "libc.h"
 
 long  __timezone = 0;
@@ -113,8 +114,6 @@ static size_t zi_dotprod(const unsigned char *z, const unsigned char *v, size_t
 	return y;
 }
 
-int __munmap(void *, size_t);
-
 static void do_tzset()
 {
 	char buf[NAME_MAX+25], *pathname=buf+24;
diff --git a/src/time/asctime.c b/src/time/asctime.c
index 57d15fe0..1febe544 100644
--- a/src/time/asctime.c
+++ b/src/time/asctime.c
@@ -1,7 +1,5 @@
 #include <time.h>
 
-char *__asctime_r(const struct tm *, char *);
-
 char *asctime(const struct tm *tm)
 {
 	static char buf[26];
diff --git a/src/time/asctime_r.c b/src/time/asctime_r.c
index d1639ab0..af2618de 100644
--- a/src/time/asctime_r.c
+++ b/src/time/asctime_r.c
@@ -5,8 +5,6 @@
 #include "atomic.h"
 #include "libc.h"
 
-char *__nl_langinfo_l(nl_item, locale_t);
-
 char *__asctime_r(const struct tm *restrict tm, char *restrict buf)
 {
 	if (snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
diff --git a/src/time/clock.c b/src/time/clock.c
index c348e398..6724012b 100644
--- a/src/time/clock.c
+++ b/src/time/clock.c
@@ -1,8 +1,6 @@
 #include <time.h>
 #include <limits.h>
 
-int __clock_gettime(clockid_t, struct timespec *);
-
 clock_t clock()
 {
 	struct timespec ts;
diff --git a/src/time/gmtime.c b/src/time/gmtime.c
index 3791b24c..6320b637 100644
--- a/src/time/gmtime.c
+++ b/src/time/gmtime.c
@@ -1,8 +1,6 @@
 #include "time_impl.h"
 #include <errno.h>
 
-struct tm *__gmtime_r(const time_t *restrict, struct tm *restrict);
-
 struct tm *gmtime(const time_t *t)
 {
 	static struct tm tm;
diff --git a/src/time/localtime.c b/src/time/localtime.c
index bb6718c3..52104232 100644
--- a/src/time/localtime.c
+++ b/src/time/localtime.c
@@ -1,7 +1,5 @@
 #include "time_impl.h"
 
-struct tm *__localtime_r(const time_t *restrict, struct tm *restrict);
-
 struct tm *localtime(const time_t *t)
 {
 	static struct tm tm;
diff --git a/src/time/strftime.c b/src/time/strftime.c
index ddb47772..ba18a27c 100644
--- a/src/time/strftime.c
+++ b/src/time/strftime.c
@@ -9,8 +9,6 @@
 #include "libc.h"
 #include "time_impl.h"
 
-char *__nl_langinfo_l(nl_item, locale_t);
-
 static int is_leap(int y)
 {
 	/* Avoid overflow */
@@ -45,8 +43,6 @@ static int week_num(const struct tm *tm)
 	return val;
 }
 
-size_t __strftime_l(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t);
-
 const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc, int pad)
 {
 	nl_item item;
diff --git a/src/time/time.c b/src/time/time.c
index 4b95e752..ad0480f9 100644
--- a/src/time/time.c
+++ b/src/time/time.c
@@ -1,8 +1,6 @@
 #include <time.h>
 #include "syscall.h"
 
-int __clock_gettime(clockid_t, struct timespec *);
-
 time_t time(time_t *t)
 {
 	struct timespec ts;
diff --git a/src/time/time_impl.h b/src/time/time_impl.h
index 5cc2fe2f..50afe156 100644
--- a/src/time/time_impl.h
+++ b/src/time/time_impl.h
@@ -7,5 +7,4 @@ long long __tm_to_secs(const struct tm *);
 const char *__tm_to_tzname(const struct tm *);
 int __secs_to_tm(long long, struct tm *);
 void __secs_to_zone(long long, int, int *, long *, long *, const char **);
-const unsigned char *__map_file(const char *, size_t *);
 const char *__strftime_fmt_1(char (*)[100], size_t *, int, const struct tm *, locale_t, int);
diff --git a/src/time/timespec_get.c b/src/time/timespec_get.c
index 03c5a77b..40ea9c1c 100644
--- a/src/time/timespec_get.c
+++ b/src/time/timespec_get.c
@@ -1,7 +1,5 @@
 #include <time.h>
 
-int __clock_gettime(clockid_t, struct timespec *);
-
 /* There is no other implemented value than TIME_UTC; all other values
  * are considered erroneous. */
 int timespec_get(struct timespec * ts, int base)