Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • martin/relibc
  • ashton/relibc
  • vincent/relibc
  • boomshroom/relibc
  • gmacd/relibc
  • mati865/relibc
  • nicoan/relibc
  • lmiskiew/relibc
  • devnexen/relibc
  • jamesgraves/relibc
  • oddcoder/relibc
  • andar1an/relibc
  • bitstr0m/relibc
  • gugz0r/relibc
  • matijaskala/relibc
  • redox-os/relibc
  • 4lDO2/relibc
  • arthurpaulino/relibc
  • Majoneza/relibc
  • enygmator/relibc
  • njskalski/relibc
  • JustAnotherDev/relibc
  • doriancodes/relibc
  • adamantinum/relibc
  • wiredtv/relibc
  • stratact/relibc
  • Ramla-I/relibc
  • bpisch/relibc
  • henritel/relibc
  • smckay/relibc
  • xTibor/relibc
  • devajithvs/relibc
  • t-nil/relibc
  • zen3ger/relibc
  • DataTriny/relibc
  • SteveLauC/relibc
  • dlrobertson/relibc
  • josh/relibc
  • TheDarkula/relibc
  • willnode/relibc
  • GrayJack/relibc
  • raffaeleragni/relibc
  • redoxeon/relibc
  • darley/relibc
  • ayf/relibc
  • heghe/relibc
  • Ivan/relibc
  • hasheddan/relibc
  • dahc/relibc
  • auwardoctor/relibc
  • kodicraft/relibc
  • jasonhansel/relibc
  • kel/relibc
  • microcolonel/relibc
  • sahitpj/relibc
  • plimkilde/relibc
  • BjornTheProgrammer/relibc
  • defra/relibc
  • jD91mZM2/relibc
  • Schyrsivochter/relibc
  • ebalalic/relibc
  • adchacon/relibc
  • aaronjanse/relibc
  • josh_williams/relibc
  • andypython/relibc
  • 8tab/relibc
  • AgostonSzepessy/relibc
  • athei/relibc
  • carrot93/relibc
  • bamontan/relibc
  • zhaozhao/relibc
  • JCake/relibc
  • KGrewal1/relibc
  • feliwir/relibc
  • emturner/relibc
  • LuigiPiucco/relibc
  • RA_GM1/relibc
  • bfrascher/relibc
  • kcired/relibc
  • jamespcfrancis/relibc
  • omar-mohamed-khallaf/relibc
  • neallred/relibc
  • rw_van/relibc
  • Skallwar/relibc
  • matt-vdv/relibc
  • SoyaOhnishi/relibc
  • ArniDagur/relibc
  • tlam/relibc
  • glongo/relibc
  • kamirr/relibc
  • abdullah/relibc
  • saeedtabrizi/relibc
  • sajattack/relibc
  • seanpk/relibc
  • MaikuZ/relibc
  • jamadazi/relibc
  • coolreader18/relibc
  • wt/relibc
  • lebensterben/relibc
  • starsheriff/relibc
  • uuuvn/relibc
  • vadorovsky/relibc
  • ids1024/relibc
  • freewilll/relibc
  • LLeny/relibc
  • batonius/relibc
  • alfredoyang/relibc
  • TornaxO7/relibc
  • bjorn3/relibc
  • Arcterus/relibc
  • Tommoa/relibc
  • samuela/relibc
  • mindriot101/relibc
  • lygstate/relibc
114 results
Show changes
Showing
with 290 additions and 51 deletions
#ifndef _ALLOCA_H
#define _ALLOCA_H
#define alloca(size) __builtin_alloca (size)
#endif /* _ALLOCA_H */
#ifndef _ASSERT_H
#define _ASSERT_H
#ifdef NDEBUG
# define assert(cond)
#else
# include <stdio.h>
# define assert(cond) if (!(cond)) { \
fprintf(stderr, "%s: %s:%d: Assertion `%s` failed.\n", __func__, __FILE__, __LINE__, #cond); \
abort(); \
}
#endif
#endif
// Do not use include guard, to ensure assert is always defined
#ifdef assert
#undef assert
#endif
#ifdef NDEBUG
# define assert(cond) (void) 0
#else
# define assert(cond) \
((void)((cond) || (__assert_fail(__func__, __FILE__, __LINE__, #cond), 0)))
#endif
#ifndef _BITS_CTYPE_H
#define _BITS_CTYPE_H
#define _tolower(c) tolower(c)
#define _toupper(c) toupper(c)
#endif /* _BITS_CTYPE_H */
#ifndef _BITS_DIRENT_H
#define _BITS_DIRENT_H
#define _DIRENT_SIZE (sizeof dirent)
// Shamelessly stolen from musl
#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LNK 10
#define DT_SOCK 12
#define DT_WHT 14
#define IFTODT(x) ((x)>>12 & 017)
#define DTTOIF(x) ((x)<<12)
#endif /* _BITS_DIRENT_H */
#ifndef _BITS_ELF_H
#define _BITS_ELF_H
#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
#define ELF32_ST_TYPE(val) ((val) & 0xf)
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
#define ELF32_R_SYM(val) ((val) >> 8)
#define ELF32_R_TYPE(val) ((val) & 0xff)
#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
#define ELF64_R_SYM(i) ((i) >> 32)
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type))
#define DT_VALRNGHI 0x6ffffdff
#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag))
#define DT_ADDRRNGHI 0x6ffffeff
#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag))
#define DT_VERNEEDNUM 0x6fffffff
#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag))
#define ELF32_M_SYM(info) ((info) >> 8)
#define ELF32_M_SIZE(info) ((unsigned char) (info))
#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size))
#define ELF64_M_SYM(info) ELF32_M_SYM (info)
#define ELF64_M_SIZE(info) ELF32_M_SIZE (info)
#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size)
#endif /* ifdef _BITS_ELF_H*/
#ifndef _BITS_ERRNO_H
#define _BITS_ERRNO_H
//TODO extern __thread int errno;
extern int errno;
#ifdef __cplusplus
extern "C" {
#endif
#define errno (*__errno_location())
#define program_invocation_name (*__program_invocation_name())
#define program_invocation_short_name (*__program_invocation_short_name())
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* _BITS_ERRNO_H */
#ifndef _BITS_FCNTL_H
#define _BITS_FCNTL_H
int open(const char* filename, int flags, ...);
int fcntl(int fildes, int cmd, ...);
#endif
......@@ -5,8 +5,6 @@
// Shamelessly copy pasted from musl:
#define FLT_RADIX 2
#define FLT_TRUE_MIN 1.40129846432481707092e-45F
#define FLT_MIN 1.17549435082228750797e-38F
#define FLT_MAX 3.40282346638528859812e+38F
......
#define MB_LEN_MAX 4 // unicode
#ifndef _BITS_LIMIT_H
#define _BITS_LIMIT_H
#define CHAR_BIT __CHAR_BIT__
#ifdef __CHAR_MAX__
......@@ -11,7 +12,7 @@
#define INT_MIN (-INT_MAX - 1)
#define LLONG_MAX __LONG_LONG_MAX__
#define LLONG_MIN (-LLONG_MAX - 1)
#define LONG_BIT __LONG_BIT__
#define LONG_BIT __LONG_WIDTH__
#define LONG_MAX __LONG_MAX__
#define LONG_MIN (-LONG_MAX - 1)
#define SCHAR_MAX __SCHAR_MAX__
......@@ -20,12 +21,12 @@
#define SHRT_MIN (-SHRT_MAX - 1)
// TODO: These might not be accurate on all platforms
#define SSIZE_MAX ((1 << 64 - 1) - 1)
#define SSIZE_MAX 0x7fffffffffffffff
#define UCHAR_MAX 255
#define UINT_MAX ((1 << 32) - 1)
#define ULLONG_MAX ((1 << 64) - 1)
#define ULONG_MAX ((1 << 64) - 1)
#define USHRT_MAX ((1 << 16) - 1)
#define UINT_MAX 0xffffffff
#define ULLONG_MAX 0xffffffffffffffff
#define ULONG_MAX 0xffffffffffffffff
#define USHRT_MAX 0xffff
#define WORD_BIT 32
#define PATH_MAX 4096
#endif
#ifndef _MALLOC_H
#define _MALLOC_H
#ifndef _BITS_MALLOC_H
#define _BITS_MALLOC_H
#include <stddef.h>
// Generated from:
// `grep "malloc\|calloc\|realloc\|free\|valloc\|memalign" target/include/stdlib.h`
#ifdef __cplusplus
extern "C" {
#endif
void *calloc(size_t nelem, size_t elsize);
void free(void *ptr);
void *malloc(size_t size);
......@@ -13,4 +17,8 @@ void *memalign(size_t alignment, size_t size);
void *realloc(void *ptr, size_t size);
void *valloc(size_t size);
#ifdef __cplusplus
} // extern "C"
#endif
#endif
#ifndef _BITS_NETDB_H
#define _BITS_NETDB_H
#ifdef __cplusplus
extern "C" {
#endif
#define h_errno (*__h_errno_location())
# define h_addr h_addr_list[0] /* Address, for backward compatibility.*/
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* _BITS_NETDB_H */
#ifndef _BITS_NETINET_IN_H
#define _BITS_NETINET_IN_H
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
// from musl {
#define IN6_IS_ADDR_UNSPECIFIED(a) \
(((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
#define IN6_IS_ADDR_LOOPBACK(a) \
(((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
((uint32_t *) (a))[2] == 0 && \
((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && \
((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 )
#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
#define IN6_IS_ADDR_LINKLOCAL(a) \
((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)
#define IN6_IS_ADDR_SITELOCAL(a) \
((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
#define IN6_IS_ADDR_V4MAPPED(a) \
(((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && \
((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
#define IN6_IS_ADDR_V4COMPAT(a) \
(((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x1))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x5))
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x8))
#define IN6_IS_ADDR_MC_GLOBAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
#define __ARE_4_EQUAL(a,b) \
(!( (0[a]-0[b]) | (1[a]-1[b]) | (2[a]-2[b]) | (3[a]-3[b]) ))
#define IN6_ARE_ADDR_EQUAL(a,b) \
__ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b))
#define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0)
#define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
#define IN_CLASSA_MAX 128
#define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
#define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
#define IN_CLASSB_MAX 65536
#define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
#define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
#define IN_MULTICAST(a) IN_CLASSD(a)
#define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
#define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
// } from musl
#endif // _BITS_NETINET_IN_H
#define SIG_ERR ((void (*)(int)) -1)
#define SIG_DFL ((void (*)(int)) 0)
#define SIG_IGN ((void (*)(int)) 1)
#ifndef _BITS_SIGNAL_H
#define _BITS_SIGNAL_H
#define SIG_DFL ((void (*)(int))0)
#define SIG_IGN ((void (*)(int))1)
#define SIG_ERR ((void (*)(int))-1)
typedef struct siginfo siginfo_t;
typedef unsigned long long sigset_t;
typedef struct ucontext ucontext_t;
typedef struct mcontext mcontext_t;
struct sigaction {
union {
void (*sa_handler)(int);
void (*sa_sigaction)(int, siginfo_t *, void *);
};
unsigned long sa_flags;
void (*sa_restorer)(void);
sigset_t sa_mask;
};
#endif // _BITS_SIGNAL_H
#ifndef _BITS_STDIO_H
#define _BITS_STDIO_H
#define EOF (-1)
#define BUFSIZ 1024
// XXX: this is only here because cbindgen can't handle string constants
#define P_tmpdir "/tmp"
typedef struct FILE FILE;
int fprintf(FILE * stream, const char * fmt, ...);
int printf(const char * fmt, ...);
int snprintf(char *s, size_t n, const char * fmt, ...);
int sprintf(char *s, const char * fmt, ...);
int fscanf(FILE * stream, const char * fmt, ...);
int scanf(const char * fmt, ...);
int sscanf(const char * input, const char * fmt, ...);
// A typedef doesn't suffice, because libgmp uses this definition to check if
// STDIO was loaded.
#define FILE FILE
#endif /* _BITS_STDIO_H */
#ifndef _BITS_STDLIB_H
#define _BITS_STDLIB_H
#ifdef __cplusplus
extern "C" {
#endif
long double strtold(const char *nptr, char **endptr);
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* _BITS_STDLIB_H */
#ifndef _BITS_SYS_PTRACE_H
#define _BITS_SYS_PTRACE_H
#endif
#ifndef _BITS_SYS_SOCKET_H
#define _BITS_SYS_SOCKET_H
struct sockaddr_storage {
sa_family_t ss_family;
char __ss_padding[128-sizeof(long)-sizeof(sa_family_t)];
unsigned long __ss_align;
};
struct ucred {
pid_t pid;
uid_t uid;
gid_t gid;
};
#endif // _BITS_SYS_SOCKET_H
#ifndef _BITS_STAT_H
#define _BITS_STAT_H
#define S_ISDIR(mode) mode & S_IFMT == S_IFDIR
#define S_ISCHR(mode) mode & S_IFMT == S_IFCHR
#define S_ISBLK(mode) mode & S_IFMT == S_IFBLK
#define S_ISREG(mode) mode & S_IFMT == S_IFREG
#define S_ISFIFO(mode) mode & S_IFMT == S_IFIFO
#define S_ISLNK(mode) mode & S_IFMT == S_IFLNK
#define S_ISSOCK(mode) mode & S_IFMT == S_IFSOCK
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
#define st_atime st_atim.tv_sec
#define st_mtime st_mtim.tv_sec
......
#ifndef _BITS_SYS_TIME
#define _BITS_SYS_TIME
#define timeradd(x,y,res) (void) (\
(res)->tv_sec = (x)->tv_sec + (y)->tv_sec + (((x)->tv_usec + (y)->tv_usec) / 1000000), \
(res)->tv_usec = ((x)->tv_usec + (y)->tv_usec) % 1000000 \
)
#define timersub(x,y,res) (void) ( \
(res)->tv_sec = (x)->tv_sec - (y)->tv_sec, \
(res)->tv_usec = ((x)->tv_usec - (y)->tv_usec), \
((res)->tv_usec < 0) && ((res)->tv_sec -= 1, (res)->tv_usec += 1000000) \
)
#define timerclear(t) (void) ( \
(t)->tv_sec = 0, \
(t)->tv_usec = 0 \
)
#define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
#define timercmp(x,y,op) ((x)->tv_sec == (y)->tv_sec ? \
(x)->tv_usec op (y)->tv_usec \
: \
(x)->tv_sec op (y)->tv_sec)
#endif