ia64/xen-unstable

diff extras/mini-os/include/lib.h @ 16838:945820bfedb6

minios: POSIX fixes
Fixes some functions which are POSIX. Also make them ifndef HAVE_LIBC.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jan 22 14:20:22 2008 +0000 (2008-01-22)
parents 10101bc8181f
children 01e178f7ec6d
line diff
     1.1 --- a/extras/mini-os/include/lib.h	Tue Jan 22 11:35:26 2008 +0000
     1.2 +++ b/extras/mini-os/include/lib.h	Tue Jan 22 14:20:22 2008 +0000
     1.3 @@ -59,6 +59,9 @@
     1.4  #include <stddef.h>
     1.5  #include <console.h>
     1.6  
     1.7 +#ifdef HAVE_LIBC
     1.8 +#include <stdio.h>
     1.9 +#else
    1.10  /* printing */
    1.11  #define _p(_x) ((void *)(unsigned long)(_x))
    1.12  int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
    1.13 @@ -69,13 +72,16 @@ int vsprintf(char *buf, const char *fmt,
    1.14  int sprintf(char * buf, const char *fmt, ...);
    1.15  int vsscanf(const char * buf, const char * fmt, va_list args);
    1.16  int sscanf(const char * buf, const char * fmt, ...);
    1.17 +#endif
    1.18  
    1.19  long simple_strtol(const char *cp,char **endp,unsigned int base);
    1.20  unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
    1.21  long long simple_strtoll(const char *cp,char **endp,unsigned int base);
    1.22  unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base);
    1.23  
    1.24 -
    1.25 +#ifdef HAVE_LIBC
    1.26 +#include <string.h>
    1.27 +#else
    1.28  /* string and memory manipulation */
    1.29  int    memcmp(const void *cs, const void *ct, size_t count);
    1.30  void  *memcpy(void *dest, const void *src, size_t count);
    1.31 @@ -91,7 +97,11 @@ char  *strrchr(const char *s, int c);
    1.32  char  *strstr(const char *s1, const char *s2);
    1.33  char * strcat(char * dest, const char * src);
    1.34  char  *strdup(const char *s);
    1.35 +#endif
    1.36  
    1.37 +#define RAND_MIX 2654435769U
    1.38 +
    1.39 +int rand(void);
    1.40  
    1.41  #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
    1.42