diff --git a/arch/sparc/include/asm/io.h b/arch/sparc/include/asm/io.h index f4afa6edaf5816ff22ad0a5793ca0f209f462865..8f13df27aa4d4cd4255731a0f63c275a9f2f1084 100644 --- a/arch/sparc/include/asm/io.h +++ b/arch/sparc/include/asm/io.h @@ -19,7 +19,7 @@ #ifndef _ARCH_SPARC_ASM_IO_H_ #define _ARCH_SPARC_ASM_IO_H_ -#include <stdint.h> +#include <kernel/types.h> #include <uapi/asi.h> /* diff --git a/arch/sparc/include/stack.h b/arch/sparc/include/stack.h index 5f9c76e34654d97b4c091d8e921462af34c91991..42d013e10e316cf01b87298114f8007f48cb8ff9 100644 --- a/arch/sparc/include/stack.h +++ b/arch/sparc/include/stack.h @@ -1,7 +1,7 @@ #ifndef _SPARC_STACK_H_ #define _SPARC_STACK_H_ -#include <stdint.h> +#include <kernel/types.h> /* reg window offset */ #define RW_L0 0x00 diff --git a/arch/sparc/include/stacktrace.h b/arch/sparc/include/stacktrace.h index 26094690ee0539e6bec637e6236b6a52fcf15dc0..978f6aa771026d08ef542ab38d388967d4102145 100644 --- a/arch/sparc/include/stacktrace.h +++ b/arch/sparc/include/stacktrace.h @@ -5,7 +5,7 @@ #ifndef _SPARC_STACKTRACE_H_ #define _SPARC_STACKTRACE_H_ -#include <stdint.h> +#include <kernel/types.h> #include <stack.h> struct stack_trace { diff --git a/arch/sparc/include/traps.h b/arch/sparc/include/traps.h index 1b80d592b189bd8c645582dbe51f768242d1f196..fb45a41fd628c8652bc29d918870a66faea2bf58 100644 --- a/arch/sparc/include/traps.h +++ b/arch/sparc/include/traps.h @@ -20,7 +20,7 @@ #ifndef _ARCH_SPARC_TRAPS_H_ #define _ARCH_SPARC_TRAPS_H_ -#include <stdint.h> +#include <kernel/types.h> void trap_handler_install(uint32_t trap, void (*handler)(void)); diff --git a/include/kernel/ar.h b/include/kernel/ar.h index dde2a9d930e22ad04d2026777fb158e6133290bd..a8334b2d9ad8fc4d6df6566e13e74dacec456a8f 100644 --- a/include/kernel/ar.h +++ b/include/kernel/ar.h @@ -1,7 +1,7 @@ #ifndef _KERNEL_AR_H_ #define _KERNEL_AR_H_ -#include <stdint.h> +#include <kernel/types.h> #define AR_MAG "!<arch>\n" /* AR MAGIC ID */ #define AR_FMAG "`\n" /* AR HDR END MAGIC */ diff --git a/include/kernel/bitops.h b/include/kernel/bitops.h index 43cc84a1c36b5435dfddfbb4eaf99b195f42921e..404953e52960269a95ece9d71f4f13e4dabc6775 100644 --- a/include/kernel/bitops.h +++ b/include/kernel/bitops.h @@ -7,6 +7,7 @@ #ifndef _KERNEL_BITOPS_H_ #define _KERNEL_BITOPS_H_ +#include <kernel/types.h> #ifndef __WORDSIZE #define __WORDSIZE (__SIZEOF_LONG__ * 8) diff --git a/include/kernel/elf.h b/include/kernel/elf.h index d51bde0380432fa61da4628f13cebaae41a5a5ec..883eeaedd40301f3a6c63f0ac2ba6aef4af6f863 100644 --- a/include/kernel/elf.h +++ b/include/kernel/elf.h @@ -2,8 +2,7 @@ #define _KERNEL_ELF_H_ -#include <stdint.h> -#include <stddef.h> +#include <kernel/types.h> /* some ELF constants&stuff ripped from include/uapi/linux/elf.h */ diff --git a/include/kernel/log2.h b/include/kernel/log2.h index 4cc8dc5ed8d0ad4205f7ae1033010000dedd82a2..1d65d0d3ef20d28521c9e4eeae8ce4a22b5c1177 100644 --- a/include/kernel/log2.h +++ b/include/kernel/log2.h @@ -16,8 +16,7 @@ #ifndef _KERNEL_LOG2_H_ #define _KERNEL_LOG2_H_ -#include <stdint.h> -#include <stdbool.h> +#include <kernel/types.h> /** * fls - find last (most-significant) bit set diff --git a/include/kernel/sbrk.h b/include/kernel/sbrk.h index b4a97bc21513a9dde79cd32f17cd70e9d2816a3b..2612c9536ff8c9e17344215cd1ec7bb664393194 100644 --- a/include/kernel/sbrk.h +++ b/include/kernel/sbrk.h @@ -5,7 +5,7 @@ #ifndef _KERNEL_SBRK_H_ #define _KERNEL_SBRK_H_ -#include <stdint.h> +#include <kernel/types.h> void *kernel_sbrk(intptr_t increment); diff --git a/include/kernel/sysctl.h b/include/kernel/sysctl.h index d24ea0792e046a295b92cff096bf7052d99b6042..5b330f63cfcfedb130cf0e7f864bcc5f3fd86302 100644 --- a/include/kernel/sysctl.h +++ b/include/kernel/sysctl.h @@ -5,7 +5,7 @@ #ifndef _KERNEL_SYSCTL_H_ #define _KERNEL_SYSCTL_H_ -#include <sys/types.h> +#include <kernel/types.h> #include <list.h> #include <kernel/kernel.h> diff --git a/include/kernel/types.h b/include/kernel/types.h new file mode 100644 index 0000000000000000000000000000000000000000..4463c12650b340b2cb72d295299fffcfd3208e54 --- /dev/null +++ b/include/kernel/types.h @@ -0,0 +1,47 @@ +/** + * @file include/kernel/types.h + */ + +#ifndef _KERNEL_TYPES_H_ +#define _KERNEL_TYPES_H_ + +#include <stddef.h> + +#include <stdbool.h> + +#ifdef __GNUC__ +#define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) +#endif + + +/* BCC is at least 4.4.2 */ +#if defined(GCC_VERSION) && (GCC_VERSION >= 404020) +#include <stdint.h> +#else +/* this must do... */ +typedef unsigned long uintptr_t; +typedef signed long intptr_t; + +typedef unsigned long long uint64_t; +typedef signed long long int64_t; + +typedef unsigned long uint32_t; +typedef signed long int32_t; + +typedef unsigned short uint16_t; +typedef signed short int16_t; + +typedef unsigned char uint8_t; +typedef signed char int8_t; + +#endif + +#ifndef __SIZEOF_LONG__ +#define __SIZEOF_LONG__ (sizeof(long)) +#endif + + + +#endif /* _KERNEL_TYPES_H_ */ diff --git a/lib/sysctl.c b/lib/sysctl.c index 4cb75bd8d13497aff4a3226f4e093d69504f9e6f..03394426c6bec39ac8ac5651d2c8d99364884039 100644 --- a/lib/sysctl.c +++ b/lib/sysctl.c @@ -50,7 +50,6 @@ #include <stdio.h> #include <stdlib.h> -#include <stdint.h> #include <string.h> #include <errno.h>