CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc
CFLAGS_ALL = $(CFLAGS_C99FSE)
-CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
+CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS)
LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS)
struct dso *dso;
};
-void __init_libc(char **, char *);
-
static struct builtin_tls {
char c;
struct pthread pt;
case JT_PHYS_PAGES & 255:
case JT_AVPHYS_PAGES & 255: ;
unsigned long long mem;
- int __lsysinfo(struct sysinfo *);
struct sysinfo si;
__lsysinfo(&si);
if (!si.mem_unit) si.mem_unit = 1;
#include <unistd.h>
#include <crypt.h>
-char *__crypt_r(const char *, const char *, struct crypt_data *);
-
char *crypt(const char *key, const char *salt)
{
/* This buffer is sufficiently large for all
#include <crypt.h>
#include "libc.h"
-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 *);
-
char *__crypt_r(const char *key, const char *salt, struct crypt_data *data)
{
/* Per the crypt_r API, the caller has provided a pointer to
#include <poll.h>
#include <fcntl.h>
#include <signal.h>
+#include <unistd.h>
#include "syscall.h"
#include "atomic.h"
#include "libc.h"
-void __init_tls(size_t *);
-
static void dummy(void) {}
weak_alias(dummy, _init);
#define _GNU_SOURCE
#include <stdlib.h>
+#include <unistd.h>
#include "libc.h"
static void dummy(char *old, char *new) {}
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "libc.h"
-char *__strchrnul(const char *, int);
-
char *getenv(const char *name)
{
size_t l = __strchrnul(name, '=') - name;
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "libc.h"
-char *__strchrnul(const char *, int);
-
static void dummy(char *old, char *new) {}
weak_alias(dummy, __env_rm_add);
#include <string.h>
#include <errno.h>
-char *__strchrnul(const char *, int);
-int __putenv(char *, size_t, char *);
-
void __env_rm_add(char *old, char *new)
{
static char **env_alloced;
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <unistd.h>
#include "libc.h"
-char *__strchrnul(const char *, int);
-
static void dummy(char *old, char *new) {}
weak_alias(dummy, __env_rm_add);
--- /dev/null
+#ifndef ARPA_INET_H
+#define ARPA_INET_H
+
+#include "../../../include/arpa/inet.h"
+
+int __inet_aton(const char *, struct in_addr *);
+
+#endif
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#ifndef LANGINFO_H
+#define LANGINFO_H
+
+#include "../../include/langinfo.h"
+
+char *__nl_langinfo_l(nl_item, locale_t);
+
+#endif
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+#ifndef SYS_SYSINFO_H
+#define SYS_SYSINFO_H
+
+#include "../../../include/sys/sysinfo.h"
+
+int __lsysinfo(struct sysinfo *);
+
+#endif
--- /dev/null
+#ifndef SYS_TIME_H
+#define SYS_TIME_H
+
+#include "../../../include/sys/time.h"
+
+int __futimesat(int, const char *, const struct timeval [2]);
+
+#endif
--- /dev/null
+#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
--- /dev/null
+#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
#define PAGE_SIZE libc.page_size
#endif
-#define weak __attribute__((__weak__))
-#define hidden __attribute__((__visibility__("hidden")))
-
extern hidden struct __libc __libc;
#define libc __libc
+void __init_libc(char **, char *);
+void __init_tls(size_t *);
+void __libc_start_init(void);
+
extern hidden size_t __hwcap;
extern hidden size_t __sysinfo;
extern char *__progname, *__progname_full;
void __synccall(void (*)(void *), void *);
int __setxid(int, int, int, int);
-extern char **__environ;
-
-#undef weak_alias
-#define weak_alias(old, new) \
- extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
-
#undef LFS64_2
#define LFS64_2(x, y) weak_alias(x, y)
#define MALLOC_IMPL_H
#include "libc.h"
-
-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);
+#include <sys/mman.h>
void *__expand_heap(size_t *);
#include <signal.h>
#include <errno.h>
#include <limits.h>
+#include <sys/mman.h>
#include "libc.h"
#include "syscall.h"
#include "atomic.h"
int __libc_sigaction(int, const struct sigaction *, struct sigaction *);
void __unmapself(void *, size_t);
-void __vm_wait(void);
-void __vm_lock(void);
-void __vm_unlock(void);
-
int __timedwait(volatile int *, int, clockid_t, const struct timespec *, int);
int __timedwait_cp(volatile int *, int, clockid_t, const struct timespec *, int);
void __wait(volatile int *, volatile int *, int, int);
void __release_ptc(void);
void __inhibit_ptc(void);
-void __block_all_sigs(void *);
-void __block_app_sigs(void *);
-void __restore_sigs(void *);
-
#define DEFAULT_STACK_SIZE 81920
#define DEFAULT_GUARD_SIZE 4096
#include "fcntl.h"
#include "syscall.h"
-int __futimesat(int, const char *, const struct timeval [2]);
-
int utimes(const char *path, const struct timeval times[2])
{
return __futimesat(AT_FDCWD, path, times);
#include <errno.h>
#include <limits.h>
#include <sys/stat.h>
+#include <sys/mman.h>
#include <ctype.h>
#include "locale_impl.h"
#include "libc.h"
weak_alias(dummy_gettextdomain, __gettextdomain);
-const unsigned char *__map_file(const char *, size_t *);
-int __munmap(void *, size_t);
-
char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n, int category)
{
static struct msgcat *volatile cats;
#include <locale.h>
#include <string.h>
+#include <sys/mman.h>
#include "locale_impl.h"
#include "libc.h"
#include "atomic.h"
return trans ? trans : msg;
}
-const unsigned char *__map_file(const char *, size_t *);
-int __munmap(void *, size_t);
-char *__strchrnul(const char *, int);
-
static const char envvars[][12] = {
"LC_CTYPE",
"LC_NUMERIC",
return lm ? (char *)lm->name : "C";
}
-char *__strchrnul(const char *, int);
-
char *setlocale(int cat, const char *name)
{
static volatile int lock[1];
#include <stdlib.h>
#include <errno.h>
-int __ptsname_r(int, char *, size_t);
-
char *ptsname(int fd)
{
static char buf[9 + sizeof(int)*3 + 1];
#include <limits.h>
#include <pthread.h>
-char *__strchrnul(const char *, int);
-
char *__shm_mapname(const char *name, char *buf)
{
char *p;
#include <arpa/inet.h>
#include <net/if.h>
#include <ctype.h>
+#include <resolv.h>
#include "lookup.h"
#include "stdio_impl.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);
-
#define PTR_MAX (64 + sizeof ".in-addr.arpa")
#define RR_PTR 12
#include <netinet/in.h>
#include <arpa/inet.h>
-int __inet_aton(const char *, struct in_addr *);
-
in_addr_t inet_addr(const char *p)
{
struct in_addr a;
#include <ctype.h>
#include "lookup.h"
-int __inet_aton(const char *, struct in_addr *);
-
int __lookup_ipliteral(struct address buf[static 1], const char *name, int family)
{
struct in_addr a4;
#include <unistd.h>
#include <pthread.h>
#include <errno.h>
+#include <resolv.h>
#include "lookup.h"
#include "stdio_impl.h"
#include "syscall.h"
int cnt;
};
-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);
-
#define RR_A 1
#define RR_CNAME 5
#define RR_AAAA 28
#include <netdb.h>
#include "libc.h"
-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_query(const char *name, int class, int type, unsigned char *dest, int len)
{
unsigned char q[280];
#include <resolv.h>
#include "libc.h"
-int __res_msend(int, const unsigned char *const *, const int *, unsigned char *const *, int *, int);
-
int __res_send(const unsigned char *msg, int msglen, unsigned char *answer, int anslen)
{
int r = __res_msend(1, &msg, &msglen, &answer, &anslen, anslen);
char *const *argv, *const *envp;
};
-void __get_handler_set(sigset_t *);
-
static int __sys_dup2(int old, int new)
{
#ifdef SYS_dup2
#include <spawn.h>
#include <unistd.h>
-int __execvpe(const char *, char *const *, char *const *);
-
int posix_spawnp(pid_t *restrict res, const char *restrict file,
const posix_spawn_file_actions_t *fa,
const posix_spawnattr_t *restrict attr,
#include "syscall.h"
#include "libc.h"
-int __sigaction(int, const struct sigaction *, struct sigaction *);
-
void (*signal(int sig, void (*func)(int)))(int)
{
struct sigaction sa_old, sa = { .sa_handler = func, .sa_flags = SA_RESTART };
#include "stdio_impl.h"
#include <fcntl.h>
+#include <unistd.h>
/* The basic idea of this implementation is to open a new FILE,
* hack the necessary parts of the new FILE into the old one, then
* lock, via flockfile or otherwise, when freopen is called, and in that
* case, freopen cannot act until the lock is released. */
-int __dup3(int, int, int);
-
FILE *freopen(const char *restrict filename, const char *restrict mode, FILE *restrict f)
{
int fl = __fmodeflags(mode);
#include <sys/stat.h>
#include <limits.h>
#include <string.h>
+#include <stdlib.h>
#include "syscall.h"
#define MAXTRIES 100
-char *__randname(char *);
-
char *tempnam(const char *dir, const char *pfx)
{
char s[PATH_MAX];
#include <stdio.h>
#include <fcntl.h>
+#include <stdlib.h>
#include "stdio_impl.h"
#define MAXTRIES 100
-char *__randname(char *);
-
FILE *tmpfile(void)
{
char s[] = "/tmp/tmpfile_XXXXXX";
#include <errno.h>
#include <sys/stat.h>
#include <string.h>
+#include <stdlib.h>
#include "syscall.h"
#define MAXTRIES 100
-char *__randname(char *);
-
char *tmpnam(char *buf)
{
static char internal[L_tmpnam];
#include <string.h>
-char *__strchrnul(const char *, int);
-
char *strchr(const char *s, int c)
{
char *r = __strchrnul(s, c);
#include <string.h>
-char *__stpcpy(char *, const char *);
-
char *strcpy(char *restrict dest, const char *restrict src)
{
__stpcpy(dest, src);
#define BITOP(a,b,op) \
((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a))))
-char *__strchrnul(const char *, int);
-
size_t strcspn(const char *s, const char *c)
{
const char *a = s;
#include <string.h>
-char *__stpncpy(char *, const char *, size_t);
-
char *strncpy(char *restrict d, const char *restrict s, size_t n)
{
__stpncpy(d, s, n);
#include <string.h>
-void *__memrchr(const void *, int, size_t);
-
char *strrchr(const char *s, int c)
{
return __memrchr(s, c, strlen(s) + 1);
#include <time.h>
#include <stdint.h>
-int __clock_gettime(clockid_t, struct timespec *);
-
/* This assumes that a check for the
template size has already been made */
char *__randname(char *template)
#include <errno.h>
#include <sys/stat.h>
-char *__randname(char *);
-
char *mkdtemp(char *template)
{
size_t l = strlen(template);
#include <stdlib.h>
#include "libc.h"
-int __mkostemps(char *, int, int);
-
int mkostemp(char *template, int flags)
{
return __mkostemps(template, 0, flags);
#include <errno.h>
#include "libc.h"
-char *__randname(char *);
-
int __mkostemps(char *template, int len, int flags)
{
size_t l = strlen(template);
#include <stdlib.h>
#include "libc.h"
-int __mkostemps(char *, int, int);
-
int mkstemp(char *template)
{
return __mkostemps(template, 0, 0);
#include <stdlib.h>
#include "libc.h"
-int __mkostemps(char *, int, int);
-
int mkstemps(char *template, int len)
{
return __mkostemps(template, len, 0);
#include <errno.h>
#include <sys/stat.h>
-char *__randname(char *);
-
char *mktemp(char *template)
{
size_t l = strlen(template);
#include "syscall.h"
#include "pthread_impl.h"
-int __pthread_setcancelstate(int, int *);
-int __clock_gettime(clockid_t, struct timespec *);
-
int __timedwait_cp(volatile int *addr, int val,
clockid_t clk, const struct timespec *at, int priv)
{
#include <threads.h>
-
-int __pthread_once(once_flag *, void (*)(void));
+#include <pthread.h>
void call_once(once_flag *flag, void (*func)(void))
{
#include <threads.h>
#include <pthread.h>
-int __private_cond_signal(pthread_cond_t *, int);
-
int cnd_broadcast(cnd_t *c)
{
/* This internal function never fails, and always returns zero,
#include <threads.h>
#include <pthread.h>
-int __private_cond_signal(pthread_cond_t *, int);
-
int cnd_signal(cnd_t *c)
{
/* This internal function never fails, and always returns zero,
#include <pthread.h>
#include <errno.h>
-int __pthread_cond_timedwait(pthread_cond_t *restrict, pthread_mutex_t *restrict, const struct timespec *restrict);
-
int cnd_timedwait(cnd_t *restrict c, mtx_t *restrict m, const struct timespec *restrict ts)
{
int ret = __pthread_cond_timedwait((pthread_cond_t *)c, (pthread_mutex_t *)m, ts);
#include <pthread.h>
#include <errno.h>
-int __pthread_mutex_timedlock(pthread_mutex_t *restrict, const struct timespec *restrict);
-
int mtx_timedlock(mtx_t *restrict m, const struct timespec *restrict ts)
{
int ret = __pthread_mutex_timedlock((pthread_mutex_t *)m, ts);
#include "pthread_impl.h"
#include <threads.h>
-int __pthread_mutex_trylock(pthread_mutex_t *);
-
int mtx_trylock(mtx_t *m)
{
if (m->_m_type == PTHREAD_MUTEX_NORMAL)
#include <threads.h>
#include <pthread.h>
-int __pthread_mutex_unlock(pthread_mutex_t *);
-
int mtx_unlock(mtx_t *mtx)
{
/* The only cases where pthread_mutex_unlock can return an
#include "pthread_impl.h"
-int __private_cond_signal(pthread_cond_t *, int);
-
int pthread_cond_broadcast(pthread_cond_t *c)
{
if (!c->_c_shared) return __private_cond_signal(c, -1);
#include "pthread_impl.h"
-int __private_cond_signal(pthread_cond_t *, int);
-
int pthread_cond_signal(pthread_cond_t *c)
{
if (!c->_c_shared) return __private_cond_signal(c, 1);
#include "pthread_impl.h"
-void __pthread_testcancel(void);
-int __pthread_mutex_lock(pthread_mutex_t *);
-int __pthread_mutex_unlock(pthread_mutex_t *);
-int __pthread_setcancelstate(int, int *);
-
/*
* struct waiter
*
#include <string.h>
#include <stddef.h>
-void *__mmap(void *, size_t, int, int, int, off_t);
-int __munmap(void *, size_t);
-int __mprotect(void *, size_t, int);
-
static void dummy_0()
{
}
#include "pthread_impl.h"
#include <threads.h>
-int __pthread_join(pthread_t, void **);
-
static int __pthread_detach(pthread_t t)
{
/* If the cas fails, detach state is either already-detached
#include "pthread_impl.h"
#include <sys/mman.h>
-int __munmap(void *, size_t);
-void __pthread_testcancel(void);
-int __pthread_setcancelstate(int, int *);
-
static int __pthread_timedjoin_np(pthread_t t, void **res, const struct timespec *at)
{
int state, cs, r = 0;
#include "pthread_impl.h"
-int __pthread_mutex_timedlock(pthread_mutex_t *restrict, const struct timespec *restrict);
-
int __pthread_mutex_lock(pthread_mutex_t *m)
{
if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL
#include "pthread_impl.h"
-int __pthread_mutex_trylock(pthread_mutex_t *);
-
int __pthread_mutex_timedlock(pthread_mutex_t *restrict m, const struct timespec *restrict at)
{
if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL
#include <pthread.h>
#include "libc.h"
-char *__shm_mapname(const char *, char *);
-
static struct {
ino_t ino;
sem_t *sem;
#include "pthread_impl.h"
#include <threads.h>
-int __pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, void *(*)(void *), void *restrict);
-
int thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
{
int ret = __pthread_create(thr, __ATTRP_C11_THREAD, (void *(*)(void *))func, arg);
-#include "pthread_impl.h"
#include <threads.h>
-
-_Noreturn void __pthread_exit(void *);
+#include <pthread.h>
+#include <stdint.h>
_Noreturn void thrd_exit(int result)
{
#include <stdint.h>
#include <threads.h>
-
-int __pthread_join(thrd_t, void**);
+#include <pthread.h>
int thrd_join(thrd_t t, int *res)
{
#include <threads.h>
-
-int __pthread_key_create(tss_t *, void (*)(void *));
+#include <pthread.h>
int tss_create(tss_t *tss, tss_dtor_t dtor)
{
#include <threads.h>
-
-int __pthread_key_delete(tss_t k);
+#include <pthread.h>
void tss_delete(tss_t key)
{
#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;
#include <limits.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/mman.h>
#include "libc.h"
long __timezone = 0;
return y;
}
-int __munmap(void *, size_t);
-
static void do_tzset()
{
char buf[NAME_MAX+25], *pathname=buf+24;
#include <time.h>
-char *__asctime_r(const struct tm *, char *);
-
char *asctime(const struct tm *tm)
{
static char buf[26];
#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",
#include <time.h>
#include <limits.h>
-int __clock_gettime(clockid_t, struct timespec *);
-
clock_t clock()
{
struct timespec ts;
#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;
#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;
#include "libc.h"
#include "time_impl.h"
-char *__nl_langinfo_l(nl_item, locale_t);
-
static int is_leap(int y)
{
/* Avoid overflow */
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;
#include <time.h>
#include "syscall.h"
-int __clock_gettime(clockid_t, struct timespec *);
-
time_t time(time_t *t)
{
struct timespec ts;
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);
#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)