From 69ed661a488c0e02bf5fee3dc21e6a31a99a8d85 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 17 Oct 2015 00:58:39 +0200 Subject: fix errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- include/ctype.h | 5 +++++ include/errno.h | 11 ++++++++++- include/malloc.h | 4 ++-- include/slibc/features.h | 4 ++-- include/unistd.h | 7 +++++++ 5 files changed, 26 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/ctype.h b/include/ctype.h index 20fbb4a..96b94b9 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -27,6 +27,11 @@ +#define __NEED_locale_t + +#include + + /** * Check whether a character is an alphabetical * character or a decimal digit. diff --git a/include/errno.h b/include/errno.h index 18afa72..deb17d8 100644 --- a/include/errno.h +++ b/include/errno.h @@ -23,7 +23,16 @@ /* TODO include error definitions */ -#define ERANGE 34 +#define ENOMEM 1 +#define EINVAL 1 +#define ERANGE 1 +#define ENOENT 1 +#define EBADF 1 +#define ENOSYS 1 +#define ELOOP 1 +#define EISDIR 1 +#define EACCES 1 +#define ENOTSUP 1 diff --git a/include/malloc.h b/include/malloc.h index 6373668..c1d4a85 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -84,7 +84,7 @@ void* calloc(size_t, size_t) * @throws ENOMEM The process cannot allocate more memory. */ void* zalloc(size_t) - __warning("'zalloc' is klibc extension, use 'calloc(1, n)' instead of 'zalloc(n)'."), + __warning("'zalloc' is klibc extension, use 'calloc(1, n)' instead of 'zalloc(n)'.") __GCC_ONLY(__attribute__((malloc, warn_unused_result))); #endif @@ -235,7 +235,7 @@ void* pvalloc(size_t) __deprecated("'pvalloc' is deprecated, use 'memalign' or 'posix_memalign' instead."); #endif -#ifdef __C11__ +#if defined(__C11__) || defined(__BUILDING_SLIBC) /** * This function is identical to `memalign`, * except it can be freed with `free`. diff --git a/include/slibc/features.h b/include/slibc/features.h index b5b28eb..6951ea4 100644 --- a/include/slibc/features.h +++ b/include/slibc/features.h @@ -48,7 +48,7 @@ * @param ... The rest of the arguments. * @return The result casted to the same type as `first`. */ -#if defined(__CONST_CORRECT) +#ifdef __CONST_CORRECT # undef __CONST_CORRECT # undef __const_correct #endif @@ -70,7 +70,7 @@ # define __const_correct(function, first, ...) \ (_Generic(&(first), \ const wchar_t(*)[]: (const wchar_t*)function(first, __VA_ARGS__), \ - const char(*)[]: (const char*) function(first, __VA_ARGS__), \ + const char(*)[]: (const char*) function(first, __VA_ARGS__), \ const wchar_t**: (const wchar_t*)function(first, __VA_ARGS__), \ const char**: (const char*) function(first, __VA_ARGS__), \ const void**: (const void*) function(first, __VA_ARGS__), \ diff --git a/include/unistd.h b/include/unistd.h index fb4992d..5377e28 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -61,6 +61,13 @@ #define STDERR_FILENO 2 +/* TODO temporary values */ +#define F_OK 0 +#define X_OK 1 +#define W_OK 2 +#define R_OK 4 + + /** * Set the high end of the calling process's * data segment. -- cgit v1.2.3-70-g09d2