diff options
author | Jeremy Katz <katzj@redhat.com> | 2002-09-11 16:47:32 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2002-09-11 16:47:32 +0000 |
commit | 4f3492ea7ce32b20203682598d5a05e70d05c884 (patch) | |
tree | ea1f49e2c609a663f330c6d56cd5a3c182ddc812 | |
parent | 0ea720379caa008c4d99f1021bb85baa07d0bd93 (diff) | |
download | anaconda-4f3492ea7ce32b20203682598d5a05e70d05c884.tar.gz anaconda-4f3492ea7ce32b20203682598d5a05e70d05c884.tar.xz anaconda-4f3492ea7ce32b20203682598d5a05e70d05c884.zip |
x86_64 minilibc fixups
* fix prototypes to be correct (mostly int/size_t differences)
* x86_64 just has a single select and socket syscall instead of new and old
* the sigset_t declaration is just true for i386
-rw-r--r-- | loader/minilibc.c | 13 | ||||
-rw-r--r-- | loader/minilibc.h | 20 |
2 files changed, 21 insertions, 12 deletions
diff --git a/loader/minilibc.c b/loader/minilibc.c index 3103855bc..dbecd75d5 100644 --- a/loader/minilibc.c +++ b/loader/minilibc.c @@ -57,17 +57,17 @@ inline int accept(int a, void * addr, void * addr2) { return socketcall(SYS_ACCEPT, args); } -int strlen(const char * string) { - int i = 0; +size_t strlen(const char * string) { + size_t i = 0; while (*string++) i++; return i; } -char * strncpy(char * dst, const char * src, int len) { +char * strncpy(char * dst, const char * src, size_t len) { char * chptr = dst; - int i = 0; + size_t i = 0; while (*src && i < len) *dst++ = *src++, i++; if (i < len) *dst = '\0'; @@ -122,7 +122,7 @@ int strcmp(const char * a, const char * b) { return 1; } -int strncmp(const char * a, const char * b, int len) { +int strncmp(const char * a, const char * b, size_t len) { char buf1[1000], buf2[1000]; strncpy(buf1, a, len); @@ -169,7 +169,7 @@ char * strchr(char * str, int ch) { return NULL; } -void printf(char * fmt, ...) { +int printf(char * fmt, ...) { char buf[2048]; char * start = buf; char * chptr = buf; @@ -205,4 +205,5 @@ void printf(char * fmt, ...) { start = NULL; } } + return 0; } diff --git a/loader/minilibc.h b/loader/minilibc.h index 32bf3307a..f013ebb66 100644 --- a/loader/minilibc.h +++ b/loader/minilibc.h @@ -22,7 +22,7 @@ extern int errno; /* from /usr/include/bits/sigset.h */ /* A `sigset_t' has a bit for each signal. */ - +#if defined(__i386__) #define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) typedef struct { @@ -31,6 +31,7 @@ typedef struct /* from /usr/include/signal.h */ typedef __sigset_t sigset_t; +#endif /* Aieee, gcc 2.95+ creates a stub for posix_types.h on i386 which brings glibc headers in and thus makes __FD_SET etc. not defined with 2.3+ kernels. */ @@ -50,9 +51,16 @@ typedef __sigset_t sigset_t; #include <asm/signal.h> #include <asm/stat.h> -void * alloca(int size); +void * alloca(size_t size); void exit(int arg); +/* x86_64 doesn't have some old crufty syscalls */ +#if defined(__x86_64__) +#define __NR__newselect __NR_select +#define __NR_socketcall __NR_socket +#endif + + #ifndef MINILIBC_INTERNAL static inline _syscall5(int,mount,const char *,spec,const char *,dir,const char *,type,unsigned long,rwflag,const void *,data); static inline _syscall5(int,_newselect,int,n,fd_set *,rd,fd_set *,wr,fd_set *,ex,struct timeval *,timeval); @@ -123,15 +131,15 @@ inline int socket(int a, int b, int c); inline int bind(int a, void * b, int c); inline int listen(int a, int b); inline int accept(int a, void * addr, void * addr2); -int strlen(const char * string); +size_t strlen(const char * string); char * strcpy(char * dst, const char * src); void * memcpy(void * dst, const void * src, size_t count); void sleep(int secs); int strcmp(const char * a, const char * b); -int strncmp(const char * a, const char * b, int len); +int strncmp(const char * a, const char * b, size_t len); void printint(int i); -void printf(char * fmt, ...); +int printf(char * fmt, ...); char * strchr(char * str, int ch); -char * strncpy(char * dst, const char * src, int len); +char * strncpy(char * dst, const char * src, size_t len); void printstr(char * string); |