Introduce #include <cosmo.h> to toolchain users

This change improves the way internal APIs are being hidden behind the
`COSMO` define. The cosmo.h header will take care of defining that, so
that a separate define statement isn't needed. This change also does a
lot more to define which APIs are standard, and which belong to Cosmo.
This commit is contained in:
Justine Tunney 2023-06-09 18:02:06 -07:00
parent 9b55dbe417
commit 4a59210008
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
115 changed files with 699 additions and 422 deletions

View file

@ -30,7 +30,7 @@
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/kprintf.h"
#include "libc/log/rop.h"
#include "libc/log/rop.internal.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/at.h"
#include "libc/sysv/consts/o.h"

View file

@ -20,9 +20,9 @@
#include "libc/calls/calls.h"
#include "libc/calls/pledge.internal.h"
#include "libc/calls/prctl.internal.h"
#include "libc/calls/struct/bpf.h"
#include "libc/calls/struct/filter.h"
#include "libc/calls/struct/seccomp.h"
#include "libc/calls/struct/bpf.internal.h"
#include "libc/calls/struct/filter.internal.h"
#include "libc/calls/struct/seccomp.internal.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/syscall_support-sysv.internal.h"
#include "libc/intrin/bsr.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/seccomp.h"
#include "libc/calls/struct/seccomp.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h"

View file

@ -25,7 +25,7 @@ struct sigaction { /* cosmo abi */
sighandler_t signal(int, sighandler_t);
int sigaction(int, const struct sigaction *, struct sigaction *);
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && defined(COSMO)
void _init_onntconsoleevent(void);
void _init_wincrash(void);

View file

@ -1,24 +1,5 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_TIMESPEC_H_
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_TIMESPEC_H_
#ifdef COSMO
#define timespec_get __timespec_get
#define timespec_getres __timespec_getres
#define timespec_cmp __timespec_cmp
#define timespec_tomicros __timespec_tomicros
#define timespec_tomillis __timespec_tomillis
#define timespec_tonanos __timespec_tonanos
#define timespec_add __timespec_add
#define timespec_fromnanos __timespec_fromnanos
#define timespec_frommicros __timespec_frommicros
#define timespec_frommillis __timespec_frommillis
#define timespec_real __timespec_real
#define timespec_mono __timespec_mono
#define timespec_sleep __timespec_sleep
#define timespec_sleep_until __timespec_sleep_until
#define timespec_sub __timespec_sub
#endif /* COSMO */
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
@ -32,7 +13,6 @@ int clock_gettime(int, struct timespec *);
int clock_nanosleep(int, int, const struct timespec *, struct timespec *);
int futimens(int, const struct timespec[2]);
int nanosleep(const struct timespec *, struct timespec *);
int sys_futex(int *, int, int, const struct timespec *, int *);
int utimensat(int, const char *, const struct timespec[2], int);
#ifdef COSMO
@ -55,6 +35,7 @@ struct timespec timespec_mono(void);
struct timespec timespec_sleep(struct timespec);
int timespec_sleep_until(struct timespec);
struct timespec timespec_sub(struct timespec, struct timespec) pureconst;
int sys_futex(int *, int, int, const struct timespec *, int *);
#endif /* COSMO */
COSMOPOLITAN_C_END_

View file

@ -2,17 +2,6 @@
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_TIMEVAL_H_
#include "libc/calls/struct/timespec.h"
#include "libc/time/struct/timezone.h"
#ifdef COSMO
#define timeval_cmp __timeval_cmp
#define timeval_frommicros __timeval_frommicros
#define timeval_frommillis __timeval_frommillis
#define timeval_add __timeval_add
#define timeval_sub __timeval_sub
#define timespec_totimeval __timespec_totimeval
#define timeval_totimespec __timeval_totimespec
#endif /* COSMO */
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_

View file

@ -20,9 +20,9 @@
#include "libc/calls/blockcancel.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/landlock.h"
#include "libc/calls/struct/bpf.h"
#include "libc/calls/struct/filter.h"
#include "libc/calls/struct/seccomp.h"
#include "libc/calls/struct/bpf.internal.h"
#include "libc/calls/struct/filter.internal.h"
#include "libc/calls/struct/seccomp.internal.h"
#include "libc/calls/struct/stat.h"
#include "libc/calls/struct/stat.internal.h"
#include "libc/calls/syscall-sysv.internal.h"