mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Change kernel internal build macro to __is_sortix_kernel.
This commit is contained in:
parent
752bdab798
commit
ad84bc75c8
13 changed files with 26 additions and 26 deletions
|
@ -486,7 +486,7 @@ INSTALLHEADERDIRS:=$(addprefix $(DESTDIR)$(INCLUDEDIR),$(patsubst preproc%,%,$(H
|
|||
INSTALLHEADERS:=$(addprefix $(DESTDIR)$(INCLUDEDIR),$(patsubst preproc%,%,$(HEADERS)))
|
||||
|
||||
SORTIXOBJS:=$(addprefix sortix/,$(FREEOBJS))
|
||||
SORTIXCPPFLAGS:=$(CPPFLAGS) -DSORTIX_KERNEL
|
||||
SORTIXCPPFLAGS:=$(CPPFLAGS) -D__is_sortix_kernel=1
|
||||
SORTIXFLAGS:=$(FLAGS) -ffreestanding
|
||||
SORTIXCFLAGS:=$(CFLAGS)
|
||||
SORTIXCXXFLAGS:=$(CXXFLAGS)
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#if !defined(SORTIX_KERNEL)
|
||||
#if !defined(__is_sortix_kernel)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#if defined(SORTIX_KERNEL)
|
||||
#if defined(__is_sortix_kernel)
|
||||
#include <sortix/kernel/decl.h>
|
||||
#include <sortix/kernel/panic.h>
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@
|
|||
void _assert(const char* filename, unsigned int line, const char* functionname,
|
||||
const char* expression)
|
||||
{
|
||||
#if !defined(SORTIX_KERNEL)
|
||||
#if !defined(__is_sortix_kernel)
|
||||
fprintf(stderr, "Assertion failure: %s:%u: %s: %s\n", filename, line,
|
||||
functionname, expression);
|
||||
abort();
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
#define __SORTIX_STDLIB_REDIRECTS 0
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#ifndef SORTIX_KERNEL
|
||||
#ifndef __is_sortix_kernel
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
extern "C" { int global_errno = 0; }
|
||||
extern "C" { errno_location_func_t errno_location_func = NULL; }
|
||||
|
||||
#ifndef SORTIX_KERNEL
|
||||
#ifndef __is_sortix_kernel
|
||||
extern "C" void init_error_functions()
|
||||
{
|
||||
global_errno = 0;
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#endif
|
||||
|
||||
/* Sortix system components implicitly use the native API. */
|
||||
#if __is_sortix_libc || defined(SORTIX_KERNEL)
|
||||
#if __is_sortix_libc || __is_sortix_kernel
|
||||
#define _SORTIX_SOURCE 1
|
||||
#endif
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ __BEGIN_DECLS
|
|||
|
||||
/* Only define these constant macros in C++ if requested. */
|
||||
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) || \
|
||||
defined(__is_sortix_libc) || defined(SORTIX_KERNEL) /* TODO: HACK! */
|
||||
defined(__is_sortix_libc) || defined(__is_sortix_kernel) /* TODO: HACK! */
|
||||
|
||||
#define INT8_C(c) __INT8_C(c)
|
||||
#define INT16_C(c) __INT16_C(c)
|
||||
|
@ -51,7 +51,7 @@ __BEGIN_DECLS
|
|||
|
||||
/* Only define these limit macros in C++ if requested. */
|
||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) || \
|
||||
defined(__is_sortix_libc) || defined(SORTIX_KERNEL) /* TODO: HACK! */
|
||||
defined(__is_sortix_libc) || defined(__is_sortix_kernel) /* TODO: HACK! */
|
||||
|
||||
#define INT8_MIN __INT8_MIN
|
||||
#define INT16_MIN __INT16_MIN
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
*******************************************************************************/
|
||||
|
||||
#if defined(SORTIX_KERNEL)
|
||||
#if defined(__is_sortix_kernel)
|
||||
#error "This file is part of user-space and should not be built in kernel mode"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ __BEGIN_DECLS
|
|||
@include(uid_t.h)
|
||||
@include(useconds_t.h)
|
||||
|
||||
#if !defined(SORTIX_KERNEL)
|
||||
#if !defined(__is_sortix_kernel)
|
||||
/* TODO: pthread*_t */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ extern "C" int fsetdefaultbuf(FILE* fp)
|
|||
|
||||
// Determine the buffering semantics depending on whether the destination is
|
||||
// an interactive device or not.
|
||||
#ifdef SORTIX_KERNEL
|
||||
#ifdef __is_sortix_kernel
|
||||
int mode = _IOLBF; // TODO: Detect this?
|
||||
#else
|
||||
int mode = fp->buffer_mode != -1 ? fp->buffer_mode
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <calltrace.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(SORTIX_KERNEL)
|
||||
#if defined(__is_sortix_kernel)
|
||||
|
||||
#include <sortix/kernel/platform.h>
|
||||
#include <sortix/kernel/panic.h>
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
#include <sys/mman.h>
|
||||
|
||||
#ifdef SORTIX_KERNEL
|
||||
#ifdef __is_sortix_kernel
|
||||
#define HEAP_GROWS_DOWNWARDS
|
||||
#endif
|
||||
|
||||
#ifndef SORTIX_KERNEL
|
||||
#ifndef __is_sortix_kernel
|
||||
#include <error.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
@ -43,7 +43,7 @@
|
|||
|
||||
#define PARANOIA 1
|
||||
|
||||
#ifdef SORTIX_KERNEL
|
||||
#ifdef __is_sortix_kernel
|
||||
#include <sortix/kernel/decl.h>
|
||||
#include <sortix/kernel/addralloc.h>
|
||||
#include <sortix/kernel/kthread.h>
|
||||
|
@ -70,7 +70,7 @@ const size_t NUMBINS = 8UL * sizeof(size_t);
|
|||
|
||||
static uintptr_t wilderness;
|
||||
|
||||
#ifdef SORTIX_KERNEL
|
||||
#ifdef __is_sortix_kernel
|
||||
static uintptr_t GetHeapStart()
|
||||
{
|
||||
return Sortix::GetHeapUpper();
|
||||
|
@ -205,7 +205,7 @@ inline size_t BSF(size_t Value)
|
|||
struct Chunk;
|
||||
struct Trailer;
|
||||
|
||||
#ifdef SORTIX_KERNEL
|
||||
#ifdef __is_sortix_kernel
|
||||
Sortix::kthread_mutex_t heaplock;
|
||||
#endif
|
||||
|
||||
|
@ -427,7 +427,7 @@ extern "C" void _init_heap()
|
|||
wildernesssize = 0;
|
||||
for ( size_t i = 0; i < NUMBINS; i++ ) { bins[i] = NULL; }
|
||||
bincontainschunks = 0;
|
||||
#ifdef SORTIX_KERNEL
|
||||
#ifdef __is_sortix_kernel
|
||||
heaplock = Sortix::KTHREAD_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ static bool ExpandWilderness(size_t bytesneeded)
|
|||
|
||||
extern "C" void* malloc(size_t size)
|
||||
{
|
||||
#ifdef SORTIX_KERNEL
|
||||
#ifdef __is_sortix_kernel
|
||||
Sortix::ScopedLock scopedlock(&heaplock);
|
||||
#endif
|
||||
|
||||
|
@ -655,7 +655,7 @@ static void UnifyNeighbors(Chunk** chunk)
|
|||
|
||||
extern "C" void free(void* addr)
|
||||
{
|
||||
#ifdef SORTIX_KERNEL
|
||||
#ifdef __is_sortix_kernel
|
||||
Sortix::ScopedLock scopedlock(&heaplock);
|
||||
#endif
|
||||
|
||||
|
@ -665,7 +665,7 @@ extern "C" void free(void* addr)
|
|||
|
||||
if ( !addr) { return; }
|
||||
Chunk* chunk = (Chunk*) ((uintptr_t) addr - sizeof(Chunk));
|
||||
#ifndef SORTIX_KERNEL
|
||||
#ifndef __is_sortix_kernel
|
||||
if ( !IsGoodHeapPointer(addr, 1) ||
|
||||
!IsGoodHeapPointer(chunk, sizeof(*chunk)) )
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ CXXFLAGS?=$(OPTLEVEL)
|
|||
|
||||
# Base compiler options and definitions.
|
||||
|
||||
CPPFLAGS:=$(CPPFLAGS) -I. -Iinclude -DSORTIX_KERNEL
|
||||
CPPFLAGS:=$(CPPFLAGS) -I. -Iinclude -D__is_sortix_kernel
|
||||
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -ffreestanding -fbuiltin -std=gnu++11 \
|
||||
-fno-exceptions -fno-rtti
|
||||
|
||||
|
|
|
@ -57,10 +57,10 @@ typedef int __ssize_t;
|
|||
typedef __uintptr_t __timer_t;
|
||||
typedef __SIZE_TYPE__ __socklen_t;
|
||||
|
||||
#if defined(SORTIX_KERNEL) || defined(__is_sortix_libc)
|
||||
#if defined(__is_sortix_kernel) || defined(__is_sortix_libc)
|
||||
#define OFF_MIN __OFF_MIN
|
||||
#endif
|
||||
#if defined(SORTIX_KERNEL) || defined(__is_sortix_libc)
|
||||
#if defined(__is_sortix_kernel) || defined(__is_sortix_libc)
|
||||
#define OFF_MAX __OFF_MAX
|
||||
#endif
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ struct rlimit
|
|||
#define RLIMIT_STACK 6
|
||||
#define __RLIMIT_NUM_DECLARED 7 /* index of highest constant plus 1. */
|
||||
|
||||
#if !__STDC_HOSTED__ && defined(SORTIX_KERNEL)
|
||||
#if !__STDC_HOSTED__ && defined(__is_sortix_kernel)
|
||||
#define RLIMIT_NUM_DECLARED __RLIMIT_NUM_DECLARED
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue