diff options
Diffstat (limited to 'klibc/include')
-rw-r--r-- | klibc/include/klibc/compiler.h | 4 | ||||
-rw-r--r-- | klibc/include/klibc/extern.h | 2 | ||||
-rw-r--r-- | klibc/include/malloc.h | 21 | ||||
-rw-r--r-- | klibc/include/stdlib.h | 6 | ||||
-rw-r--r-- | klibc/include/string.h | 2 | ||||
-rw-r--r-- | klibc/include/sys/inotify.h | 16 |
6 files changed, 47 insertions, 4 deletions
diff --git a/klibc/include/klibc/compiler.h b/klibc/include/klibc/compiler.h index ee697adf08..7ff6ff7d51 100644 --- a/klibc/include/klibc/compiler.h +++ b/klibc/include/klibc/compiler.h @@ -116,4 +116,8 @@ # define __bitwise #endif +/* Compiler pragma to make an alias symbol */ +#define __ALIAS(__t, __f, __p, __a) \ + __t __f __p __attribute__((weak, alias(#__a))); + #endif diff --git a/klibc/include/klibc/extern.h b/klibc/include/klibc/extern.h index f9c3467211..8a73d19358 100644 --- a/klibc/include/klibc/extern.h +++ b/klibc/include/klibc/extern.h @@ -11,4 +11,6 @@ #define __extern extern #endif +#define __alias(x) __attribute__((weak, alias(x))) + #endif /* _KLIBC_EXTERN_H */ diff --git a/klibc/include/malloc.h b/klibc/include/malloc.h new file mode 100644 index 0000000000..5beca8d068 --- /dev/null +++ b/klibc/include/malloc.h @@ -0,0 +1,21 @@ +/* + * malloc.h + * + * Apparently people haven't caught on to use <stdlib.h>, which is the + * standard place for this crap since the 1980's... + */ + +#ifndef _MALLOC_H +#define _MALLOC_H + +#include <klibc/extern.h> +#include <klibc/compiler.h> +#include <stddef.h> + +__extern void free(void *); + +__extern __mallocfunc void *malloc(size_t); +__extern __mallocfunc void *calloc(size_t, size_t); +__extern __mallocfunc void *realloc(void *, size_t); + +#endif /* _MALLOC_H */ diff --git a/klibc/include/stdlib.h b/klibc/include/stdlib.h index 54d45043f7..17efc30e5a 100644 --- a/klibc/include/stdlib.h +++ b/klibc/include/stdlib.h @@ -9,6 +9,8 @@ #include <klibc/compiler.h> #include <stddef.h> +#include <malloc.h> + #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 @@ -28,7 +30,6 @@ __extern int atoi(const char *); __extern long atol(const char *); __extern long long atoll(const char *); __extern __noreturn exit(int); -__extern void free(void *); static __inline__ long labs(long __n) { return (__n < 0L) ? -__n : __n; } @@ -37,9 +38,6 @@ static __inline__ long long llabs(long long __n) { return (__n < 0LL) ? -__n : __n; } -__extern __mallocfunc void *malloc(size_t); -__extern __mallocfunc void *calloc(size_t, size_t); -__extern __mallocfunc void *realloc(void *, size_t); __extern long strtol(const char *, char **, int); __extern long long strtoll(const char *, char **, int); __extern unsigned long strtoul(const char *, char **, int); diff --git a/klibc/include/string.h b/klibc/include/string.h index 5608a3c963..319be4eb85 100644 --- a/klibc/include/string.h +++ b/klibc/include/string.h @@ -21,7 +21,9 @@ __extern int strcasecmp(const char *, const char *); __extern int strncasecmp(const char *, const char *, size_t); __extern char *strcat(char *, const char *); __extern char *strchr(const char *, int); +__extern char *index(const char *, int); __extern char *strrchr(const char *, int); +__extern char *rindex(const char *, int); __extern int strcmp(const char *, const char *); __extern char *strcpy(char *, const char *); __extern size_t strcspn(const char *, const char *); diff --git a/klibc/include/sys/inotify.h b/klibc/include/sys/inotify.h new file mode 100644 index 0000000000..74fc714190 --- /dev/null +++ b/klibc/include/sys/inotify.h @@ -0,0 +1,16 @@ +/* + * sys/inotify.h + */ + +#ifndef _SYS_INOTIFY_H +#define _SYS_INOTIFY_H + +#include <sys/types.h> +#include <linux/inotify.h> +#include <klibc/extern.h> + +__extern int inotify_init(void); +__extern int inotify_add_watch(int, const char *, __u32); +__extern int inotify_rm_watch(int, __u32); + +#endif /* _SYS_INOTIFY_H */ |