LibC: Rewrite all the headers.

We now have more or less posix issue 2018 conforming libc headers.

This was a really time consuming and boring operation but it had to
be done.

Now we get to actually start implementing libc :)
This commit is contained in:
Bananymous
2023-05-26 22:21:07 +03:00
parent 78b62776d2
commit f79250c4d4
91 changed files with 4402 additions and 596 deletions

View File

@@ -0,0 +1,15 @@
#ifndef _BITS_PRINTF_H
#define _BITS_PRINTF_H 1
#include <sys/cdefs.h>
__BEGIN_DECLS
#include <stdarg.h>
#include <stddef.h>
int printf_impl(const char* format, va_list arguments, int (*putc_fun)(int, void*), void* data);
__END_DECLS
#endif

View File

@@ -0,0 +1,85 @@
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
#include <sys/cdefs.h>
__BEGIN_DECLS
#if !defined(__pthread_attr_t_defined) && (defined(__need_all_types) || defined(__need_pthread_attr_t))
#define __pthread_attr_t_defined 1
typedef int pthread_attr_t;
#endif
#undef __need_pthread_attr_t
#if !defined(__pthread_barrier_t_defined) && (defined(__need_all_types) || defined(__need_pthread_barrier_t))
#define __pthread_barrier_t_defined 1
typedef int pthread_barrier_t;
#endif
#undef __need_pthread_barrier_t
#if !defined(__pthread_barrierattr_t_defined) && (defined(__need_all_types) || defined(__need_pthread_barrierattr_t))
#define __pthread_barrierattr_t_defined 1
typedef int pthread_barrierattr_t;
#endif
#undef __need_pthread_barrierattr_t
#if !defined(__pthread_cond_t_defined) && (defined(__need_all_types) || defined(__need_pthread_cond_t))
#define __pthread_cond_t_defined 1
typedef int pthread_cond_t;
#endif
#undef __need_pthread_cond_t
#if !defined(__pthread_condattr_t_defined) && (defined(__need_all_types) || defined(__need_pthread_condattr_t))
#define __pthread_condattr_t_defined 1
typedef int pthread_condattr_t;
#endif
#undef __need_pthread_condattr_t
#if !defined(__pthread_key_t_defined) && (defined(__need_all_types) || defined(__need_pthread_key_t))
#define __pthread_key_t_defined 1
typedef int pthread_key_t;
#endif
#undef __need_pthread_key_t
#if !defined(__pthread_mutex_t_defined) && (defined(__need_all_types) || defined(__need_pthread_mutex_t))
#define __pthread_mutex_t_defined 1
typedef int pthread_mutex_t;
#endif
#undef __need_pthread_mutex_t
#if !defined(__pthread_mutexattr_t_defined) && (defined(__need_all_types) || defined(__need_pthread_mutexattr_t))
#define __pthread_mutexattr_t_defined 1
typedef int pthread_mutexattr_t;
#endif
#undef __need_pthread_mutexattr_t
#if !defined(__pthread_once_t_defined) && (defined(__need_all_types) || defined(__need_pthread_once_t))
#define __pthread_once_t_defined 1
typedef int pthread_once_t;
#endif
#undef __need_pthread_once_t
#if !defined(__pthread_rwlock_t_defined) && (defined(__need_all_types) || defined(__need_pthread_rwlock_t))
#define __pthread_rwlock_t_defined 1
typedef int pthread_rwlock_t;
#endif
#undef __need_pthread_rwlock_t
#if !defined(__pthread_rwlockattr_t_defined) && (defined(__need_all_types) || defined(__need_pthread_rwlockattr_t))
#define __pthread_rwlockattr_t_defined 1
typedef int pthread_rwlockattr_t;
#endif
#undef __need_pthread_rwlockattr_t
#if !defined(__pthread_spinlock_t_defined) && (defined(__need_all_types) || defined(__need_pthread_spinlock_t))
#define __pthread_spinlock_t_defined 1
typedef int pthread_spinlock_t;
#endif
#undef __need_pthread_spinlock_t
#if !defined(__pthread_t_defined) && (defined(__need_all_types) || defined(__need_pthread_t))
#define __pthread_t_defined 1
typedef int pthread_t;
#endif
#undef __need_pthread_t
__END_DECLS

View File

@@ -0,0 +1,18 @@
#ifndef _BITS_TYPES_FILE_H
#define _BITS_TYPES_FILE_H 1
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifndef __FILE_defined
#define __FILE_defined 1
struct FILE;
typedef struct FILE FILE;
#endif
__END_DECLS
#endif

View File

@@ -0,0 +1,17 @@
#ifndef _BITS_LOCALE_T_H
#define _BITS_LOCALE_T_H 1
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifndef __locale_t_defined
#define __locale_t_defined 1
typedef int locale_t;
#endif
__END_DECLS
#endif

View File

@@ -0,0 +1,17 @@
#ifndef _BITS_TYPES_SA_FAMILY_T_H
#define _BITS_TYPES_SA_FAMILY_T_H 1
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifndef __sa_family_t_defined
#define __sa_family_t_defined 1
typedef unsigned int sa_family_t;
#endif
__END_DECLS
#endif