aboutsummaryrefslogtreecommitdiffstats
path: root/xen-2.4.16/include/xeno/lib.h
blob: cd40d119f00ec7bc1d28ee45787f68ad6bbbafb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef __LIB_H__
#define __LIB_H__

#include <stdarg.h>
#include <xeno/types.h>

#ifndef NDEBUG
#define ASSERT(_p) if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , __LINE__, __FILE__); *(int*)0=0; }
#else
#define ASSERT(_p) ((void)0)
#endif

#define reserve_bootmem(_p,_l) \
printk("Memory Reservation 0x%lx, %lu bytes\n", (_p), (_l))

/* lib.c */
int memcmp(const void * cs,const void * ct,size_t count);
void * memcpy(void * dest,const void *src,size_t count);
int strncmp(const char * cs,const char * ct,size_t count);
int strcmp(const char * cs,const char * ct);
char * strcpy(char * dest,const char *src);
char * strncpy(char * dest,const char *src,size_t count);
void * memset(void * s,int c,size_t count);
size_t strnlen(const char * s, size_t count);
size_t strlen(const char * s);
char * strchr(const char *,int);
char * strstr(const char * s1,const char * s2);
unsigned long str_to_quad(unsigned char *s);
unsigned char *quad_to_str(unsigned long q, unsigned char *s);

/* kernel.c */
#define printk printf
void printf (const char *format, ...);
void cls(void);
void panic(const char *format, ...);

/* vsprintf.c */
extern int sprintf(char * buf, const char * fmt, ...)
	__attribute__ ((format (printf, 2, 3)));
extern int vsprintf(char *buf, const char *, va_list);
extern int snprintf(char * buf, size_t size, const char * fmt, ...)
	__attribute__ ((format (printf, 3, 4)));
extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);

extern int sscanf(const char *, const char *, ...)
	__attribute__ ((format (scanf,2,3)));
extern int vsscanf(const char *, const char *, va_list);
long simple_strtol(const char *cp,char **endp,unsigned int base);
long long simple_strtoll(const char *cp,char **endp,unsigned int base);

#endif /* __LIB_H__ */