Submitted By: William Harrington kb0iic at cross-lfs dot org Date: 2013-01-13 Initial Package Version: 1.3.17 Upstream Status: Unknown Origin: Gentoo x86 sys-boot yaboot files Description: Adds more stub functions for newer e2fsprogs. diff -Naur yaboot-1.3.17.orig/lib/malloc.c yaboot-1.3.17/lib/malloc.c --- yaboot-1.3.17.orig/lib/malloc.c 2011-10-18 04:11:10.000000000 +0000 +++ yaboot-1.3.17/lib/malloc.c 2013-01-13 13:32:27.392764935 +0000 @@ -64,6 +64,15 @@ return caddr; } +/* Calloc wrapper for malloc */ +void *memset(void *s, int c, size_t n); +void *calloc(size_t nmemb, size_t size) { + void *caddr; + caddr = malloc(nmemb * size); + memset(caddr, 0, nmemb * size); + return caddr; +} + /* Do not fall back to the malloc above as posix_memalign is needed by * external libraries not yaboot */ int posix_memalign(void **memptr, size_t alignment, size_t size) diff -Naur yaboot-1.3.17.orig/lib/nonstd.c yaboot-1.3.17/lib/nonstd.c --- yaboot-1.3.17.orig/lib/nonstd.c 2011-10-18 04:11:10.000000000 +0000 +++ yaboot-1.3.17/lib/nonstd.c 2013-01-13 13:32:27.396764906 +0000 @@ -65,3 +65,178 @@ { return NULL; } + +// I tried to use prom functions for these... +int open(const char *pathname, int flags) { + return (int) prom_open((char *)pathname); +} + +int open64(const char *pathname, int flags) { + return (int) prom_open((char *)pathname); +} + +int __open64_2 (__const char *__path, int __oflag) { + return (int) prom_open((char *)__path); +} + +int read(int fd, void *buf, size_t count) { + return prom_read((void *)fd, buf, count); +} + +int write(int fd, void *buf, size_t count) { + return prom_write((void *)fd, buf, count); +} + +int close(int fd) { + prom_close((void *)fd); + return 0; +} + +// No fsync, just assume we've sync'd +int fsync(int fd) { + return 0; +} + +void exit(int status) { + prom_exit(); +} + +int __printf_chk(int flag, const char *format, ...) { + va_list ap; + va_start (ap, format); + prom_vfprintf (prom_stdout, format, ap); + va_end (ap); + + return 0; +} + +int __sprintf_chk(char * str, int flag, size_t strlen, const char * format, ...) { + va_list ap; + va_start(ap, format); + // No sprintf? :( + va_end(ap); + return 0; + +} + +int __fprintf_chk(FILE *stream, int flag, const char *format, ...) { + va_list ap; + va_start (ap, format); + prom_vfprintf (prom_stdout, format, ap); + va_end (ap); + + return 0; +} + +void *memcpy(void *dest, const void *src, size_t n); +void *__memcpy_chk(void *dest, const void *src, size_t n, size_t destlen) { + return memcpy(dest, src, n); +} + +// But these are all dummy functions +int __xstat64 (int __ver, const char *__filename, void *__stat_buf) { + return 0; +} + +int stat64(const char *path, void *stat_buf) { + return 0; +} + +int fstat64(int fildes, void *stat_buf) { + return 0; +} + +int __fxstat64 (int __ver, int __filedesc, void *__stat_buf) { + return 0; +} + +signed int random(void) { + return 0; +} + +void srandom(unsigned int seed) { + return; +} + +int rand(void) { + return 0; +} + +void srand(unsigned int seed) { + return; +} + +unsigned int sleep(unsigned int seconds) { + return 0; +} + +int gettimeofday(void *tv, void *tz) { + return 0; +} + +long sysconf(int name) { + return 0; +} + +int getpagesize(void) { + return 0; +} + +int gethostname(char *name, size_t len) { + return 0; +} + +int getpid(void) { + return 0; +} + +int getuid(void) { + return 0; +} + +void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) { + return; +} + +int * __errno_location(void) { + return 0; +} + +int lseek(int fd, int offset, int whence) { + return prom_lseek ((void *)fd, whence + offset); +} + +int lseek64(int fd, int offset, int whence) { + return prom_lseek ((void *)fd, whence + offset); +} + +size_t fwrite(const void *ptr, size_t size, size_t nmemb, void *stream) { + return 0; +} + +int ioctl(int d, int request, ...) { + return 0; +} + +int fallocate(int fd, int mode, unsigned int offset, unsigned int len) { + return 0; +} + +int uname(void *buf) { + return 0; +} + +int setrlimit(int resource, void *rlim) { + return 0; +} + +unsigned long long int strtoull(const char *nptr, char **endptr, int base) { + return 0; +} + +int getrlimit(int resource, void *rlim) { + return 0; +} + +int stderr = 0; +int perror = 0;