summaryrefslogtreecommitdiff
path: root/src/include
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/include
parent8c1ac426e15b27d2879afa26a500fd80010b33b9 (diff)
downloadmusl-13d1afa46f8098df290008c681816c9eb89ffbdb.tar.gz
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/include')
-rw-r--r--src/include/arpa/inet.h8
-rw-r--r--src/include/crypt.h14
-rw-r--r--src/include/features.h11
-rw-r--r--src/include/langinfo.h8
-rw-r--r--src/include/pthread.h22
-rw-r--r--src/include/resolv.h12
-rw-r--r--src/include/signal.h14
-rw-r--r--src/include/stdlib.h11
-rw-r--r--src/include/string.h11
-rw-r--r--src/include/sys/mman.h20
-rw-r--r--src/include/sys/sysinfo.h8
-rw-r--r--src/include/sys/time.h8
-rw-r--r--src/include/time.h14
-rw-r--r--src/include/unistd.h12
14 files changed, 173 insertions, 0 deletions
diff --git a/src/include/arpa/inet.h b/src/include/arpa/inet.h
new file mode 100644
index 00000000..2da6ddbc
--- /dev/null
+++ b/src/include/arpa/inet.h
@@ -0,0 +1,8 @@
+#ifndef ARPA_INET_H
+#define ARPA_INET_H
+
+#include "../../../include/arpa/inet.h"
+
+int __inet_aton(const char *, struct in_addr *);
+
+#endif
diff --git a/src/include/crypt.h b/src/include/crypt.h
new file mode 100644
index 00000000..6e5c2d30
--- /dev/null
+++ b/src/include/crypt.h
@@ -0,0 +1,14 @@
+#ifndef CRYPT_H
+#define CRYPT_H
+
+#include "../../include/crypt.h"
+
+char *__crypt_r(const char *, const char *, struct crypt_data *);
+
+char *__crypt_des(const char *, const char *, char *);
+char *__crypt_md5(const char *, const char *, char *);
+char *__crypt_blowfish(const char *, const char *, char *);
+char *__crypt_sha256(const char *, const char *, char *);
+char *__crypt_sha512(const char *, const char *, char *);
+
+#endif
diff --git a/src/include/features.h b/src/include/features.h
new file mode 100644
index 00000000..f17bd151
--- /dev/null
+++ b/src/include/features.h
@@ -0,0 +1,11 @@
+#ifndef FEATURES_H
+#define FEATURES_H
+
+#include "../../include/features.h"
+
+#define weak __attribute__((__weak__))
+#define hidden __attribute__((__visibility__("hidden")))
+#define weak_alias(old, new) \
+ extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
+
+#endif
diff --git a/src/include/langinfo.h b/src/include/langinfo.h
new file mode 100644
index 00000000..ab32b880
--- /dev/null
+++ b/src/include/langinfo.h
@@ -0,0 +1,8 @@
+#ifndef LANGINFO_H
+#define LANGINFO_H
+
+#include "../../include/langinfo.h"
+
+char *__nl_langinfo_l(nl_item, locale_t);
+
+#endif
diff --git a/src/include/pthread.h b/src/include/pthread.h
new file mode 100644
index 00000000..2beaa444
--- /dev/null
+++ b/src/include/pthread.h
@@ -0,0 +1,22 @@
+#ifndef PTHREAD_H
+#define PTHREAD_H
+
+#include "../../include/pthread.h"
+
+int __pthread_once(pthread_once_t *, void (*)(void));
+void __pthread_testcancel(void);
+int __pthread_setcancelstate(int, int *);
+int __pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, void *(*)(void *), void *restrict);
+_Noreturn void __pthread_exit(void *);
+int __pthread_join(pthread_t, void **);
+int __pthread_mutex_lock(pthread_mutex_t *);
+int __pthread_mutex_trylock(pthread_mutex_t *);
+int __pthread_mutex_trylock_owner(pthread_mutex_t *);
+int __pthread_mutex_timedlock(pthread_mutex_t *restrict, const struct timespec *restrict);
+int __pthread_mutex_unlock(pthread_mutex_t *);
+int __private_cond_signal(pthread_cond_t *, int);
+int __pthread_cond_timedwait(pthread_cond_t *restrict, pthread_mutex_t *restrict, const struct timespec *restrict);
+int __pthread_key_create(pthread_key_t *, void (*)(void *));
+int __pthread_key_delete(pthread_key_t);
+
+#endif
diff --git a/src/include/resolv.h b/src/include/resolv.h
new file mode 100644
index 00000000..a66669b2
--- /dev/null
+++ b/src/include/resolv.h
@@ -0,0 +1,12 @@
+#ifndef RESOLV_H
+#define RESOLV_H
+
+#include "../../include/resolv.h"
+
+int __dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
+
+int __res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
+int __res_send(const unsigned char *, int, unsigned char *, int);
+int __res_msend(int, const unsigned char *const *, const int *, unsigned char *const *, int *, int);
+
+#endif
diff --git a/src/include/signal.h b/src/include/signal.h
new file mode 100644
index 00000000..116c0ddd
--- /dev/null
+++ b/src/include/signal.h
@@ -0,0 +1,14 @@
+#ifndef SIGNAL_H
+#define SIGNAL_H
+
+#include "../../include/signal.h"
+
+int __sigaction(int, const struct sigaction *, struct sigaction *);
+
+void __block_all_sigs(void *);
+void __block_app_sigs(void *);
+void __restore_sigs(void *);
+
+void __get_handler_set(sigset_t *);
+
+#endif
diff --git a/src/include/stdlib.h b/src/include/stdlib.h
new file mode 100644
index 00000000..6e0dbda9
--- /dev/null
+++ b/src/include/stdlib.h
@@ -0,0 +1,11 @@
+#ifndef STDLIB_H
+#define STDLIB_H
+
+#include "../../include/stdlib.h"
+
+int __putenv(char *, size_t, char *);
+int __mkostemps(char *, int, int);
+int __ptsname_r(int, char *, size_t);
+char *__randname(char *);
+
+#endif
diff --git a/src/include/string.h b/src/include/string.h
new file mode 100644
index 00000000..1d10be70
--- /dev/null
+++ b/src/include/string.h
@@ -0,0 +1,11 @@
+#ifndef STRING_H
+#define STRING_H
+
+#include "../../include/string.h"
+
+void *__memrchr(const void *, int, size_t);
+char *__stpcpy(char *, const char *);
+char *__stpncpy(char *, const char *, size_t);
+char *__strchrnul(const char *, int);
+
+#endif
diff --git a/src/include/sys/mman.h b/src/include/sys/mman.h
new file mode 100644
index 00000000..28394dd5
--- /dev/null
+++ b/src/include/sys/mman.h
@@ -0,0 +1,20 @@
+#ifndef SYS_MMAN_H
+#define SYS_MMAN_H
+
+#include "../../../include/sys/mman.h"
+
+void __vm_wait(void);
+void __vm_lock(void);
+void __vm_unlock(void);
+
+void *__mmap(void *, size_t, int, int, int, off_t);
+int __munmap(void *, size_t);
+void *__mremap(void *, size_t, size_t, int, ...);
+int __madvise(void *, size_t, int);
+int __mprotect(void *, size_t, int);
+
+const unsigned char *__map_file(const char *, size_t *);
+
+char *__shm_mapname(const char *, char *);
+
+#endif
diff --git a/src/include/sys/sysinfo.h b/src/include/sys/sysinfo.h
new file mode 100644
index 00000000..c3d60bfd
--- /dev/null
+++ b/src/include/sys/sysinfo.h
@@ -0,0 +1,8 @@
+#ifndef SYS_SYSINFO_H
+#define SYS_SYSINFO_H
+
+#include "../../../include/sys/sysinfo.h"
+
+int __lsysinfo(struct sysinfo *);
+
+#endif
diff --git a/src/include/sys/time.h b/src/include/sys/time.h
new file mode 100644
index 00000000..79c5fcbc
--- /dev/null
+++ b/src/include/sys/time.h
@@ -0,0 +1,8 @@
+#ifndef SYS_TIME_H
+#define SYS_TIME_H
+
+#include "../../../include/sys/time.h"
+
+int __futimesat(int, const char *, const struct timeval [2]);
+
+#endif
diff --git a/src/include/time.h b/src/include/time.h
new file mode 100644
index 00000000..991f0b4d
--- /dev/null
+++ b/src/include/time.h
@@ -0,0 +1,14 @@
+#ifndef TIME_H
+#define TIME_H
+
+#include "../../include/time.h"
+
+int __clock_gettime(clockid_t, struct timespec *);
+
+char *__asctime_r(const struct tm *, char *);
+struct tm *__gmtime_r(const time_t *restrict, struct tm *restrict);
+struct tm *__localtime_r(const time_t *restrict, struct tm *restrict);
+
+size_t __strftime_l(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t);
+
+#endif
diff --git a/src/include/unistd.h b/src/include/unistd.h
new file mode 100644
index 00000000..9cdf1d3e
--- /dev/null
+++ b/src/include/unistd.h
@@ -0,0 +1,12 @@
+#ifndef UNISTD_H
+#define UNISTD_H
+
+#include "../../include/unistd.h"
+
+extern char **__environ;
+
+int __dup3(int, int, int);
+int __mkostemps(char *, int, int);
+int __execvpe(const char *, char *const *, char *const *);
+
+#endif