X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=visor;a=blobdiff_plain;f=libvisor%2Fsrc%2Fvilibc.h;fp=libvisor%2Fsrc%2Fvilibc.h;h=881c6ede9d0e58c70c23c4de76b381fe012412df;hp=0000000000000000000000000000000000000000;hb=4f957b16f77eb7761afd9e0b9064c7f08deb45be;hpb=dc83bdff56d4dd7454559f5e918652f32f7e9d6d diff --git a/libvisor/src/vilibc.h b/libvisor/src/vilibc.h new file mode 100644 index 0000000..881c6ed --- /dev/null +++ b/libvisor/src/vilibc.h @@ -0,0 +1,41 @@ +#ifndef VISOR_LIBC_H_ +#define VISOR_LIBC_H_ + +/* XXX let's pretend we don't have a libc to test our own code +#ifdef __STDC_HOSTED__ +#define HAVE_LIBC +#endif +*/ + +#ifdef HAVE_LIBC +#include +#include +#include +#else + +void *memset(void *s, int c, unsigned long n); +void *memcpy(void *dest, const void *src, unsigned long n); +void *memmove(void *dest, const void *src, unsigned long n); +unsigned long strlen(const char *s); +int strcmp(const char *s1, const char *s2); + +#ifdef __GNUC__ +typedef __builtin_va_list va_list; +#define va_start(v,l) __builtin_va_start(v,l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v,l) __builtin_va_arg(v,l) +#else /* !def __GNUC__ */ +#error "stdargs implementation for this compiler missing (libvisor/src/vilibc.h)" +#endif + +int sprintf(char *buf, const char *fmt, ...); +int vsprintf(char *buf, const char *fmt, va_list ap); +int snprintf(char *buf, unsigned long sz, const char *fmt, ...); +int vsnprintf(char *buf, unsigned long sz, const char *fmt, va_list ap); + +#endif /* !HAVE_LIBC */ + +struct visor; +void vi_error(struct visor *vi, const char *fmt, ...); + +#endif /* VISOR_LIBC_H_ */