source: patches/yaboot-1.3.17-stubfuncs-1.patch @ 7ffbb9c

clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 7ffbb9c was 5c734c5, checked in by William Harrington <kb0iic@…>, 11 years ago

Add yaboot stubfuncs patch for ppc and ppc64 builds.

  • Property mode set to 100644
File size: 4.2 KB
  • lib/malloc.c

    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
    old new  
    6464    return caddr;
    6565}
    6666
     67/* Calloc wrapper for malloc */
     68void *memset(void *s, int c, size_t n);
     69void *calloc(size_t nmemb, size_t size) {
     70        void *caddr;
     71        caddr = malloc(nmemb * size);
     72        memset(caddr, 0, nmemb * size);
     73        return caddr;
     74}
     75
    6776/* Do not fall back to the malloc above as posix_memalign is needed by
    6877 * external libraries not yaboot */
    6978int posix_memalign(void **memptr, size_t alignment, size_t size)
  • lib/nonstd.c

    diff -Naur yaboot-1.3.17.orig/lib/nonstd.c yaboot-1.3.17/lib/nonstd.c
    old new  
    6565{
    6666        return NULL;
    6767}
     68
     69// I tried to use prom functions for these...
     70int open(const char *pathname, int flags) {
     71        return (int) prom_open((char *)pathname);
     72}
     73
     74int open64(const char *pathname, int flags) {
     75        return (int) prom_open((char *)pathname);
     76}
     77
     78int __open64_2 (__const char *__path, int __oflag) {
     79        return (int) prom_open((char *)__path);
     80}
     81
     82int read(int fd, void *buf, size_t count) {
     83        return prom_read((void *)fd, buf, count);
     84}
     85
     86int write(int fd, void *buf, size_t count) {
     87        return prom_write((void *)fd, buf, count);
     88}
     89
     90int close(int fd) {
     91        prom_close((void *)fd);
     92        return 0;
     93}
     94
     95// No fsync, just assume we've sync'd
     96int fsync(int fd) {
     97        return 0;
     98}
     99
     100void exit(int status) {
     101        prom_exit();
     102}
     103
     104int __printf_chk(int flag, const char *format, ...) {
     105        va_list ap;
     106        va_start (ap, format);
     107        prom_vfprintf (prom_stdout, format, ap);
     108        va_end (ap);
     109
     110        return 0;
     111}
     112
     113int __sprintf_chk(char * str, int flag, size_t strlen, const char * format, ...) {
     114        va_list ap;
     115        va_start(ap, format);
     116        // No sprintf? :(
     117        va_end(ap);
     118        return 0;
     119
     120}
     121
     122int __fprintf_chk(FILE *stream, int flag, const char *format, ...) {
     123        va_list ap;
     124        va_start (ap, format);
     125        prom_vfprintf (prom_stdout, format, ap);
     126        va_end (ap);
     127
     128        return 0;
     129}
     130
     131void *memcpy(void *dest, const void *src, size_t n);
     132void *__memcpy_chk(void *dest, const void *src, size_t n, size_t destlen) {
     133        return memcpy(dest, src, n);
     134}
     135
     136// But these are all dummy functions
     137int __xstat64 (int __ver, const char *__filename, void *__stat_buf) {
     138        return 0;
     139}
     140
     141int stat64(const char *path, void *stat_buf) {
     142        return 0;
     143}
     144
     145int fstat64(int fildes, void *stat_buf) {
     146        return 0;
     147}
     148
     149int __fxstat64 (int __ver, int __filedesc, void *__stat_buf) {
     150        return 0;
     151}
     152
     153signed int random(void) {
     154        return 0;
     155}
     156
     157void srandom(unsigned int seed) {
     158        return;
     159}
     160
     161int rand(void) {
     162        return 0;
     163}
     164
     165void srand(unsigned int seed) {
     166        return;
     167}
     168
     169unsigned int sleep(unsigned int seconds) {
     170        return 0;
     171}
     172
     173int gettimeofday(void *tv, void *tz) {
     174        return 0;
     175}
     176
     177long sysconf(int name) {
     178        return 0;
     179}
     180
     181int getpagesize(void) {
     182        return 0;
     183}
     184
     185int gethostname(char *name, size_t len) {
     186        return 0;
     187}
     188
     189int getpid(void) {
     190        return 0;
     191}
     192
     193int getuid(void) {
     194        return 0;
     195}
     196
     197void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) {
     198        return;
     199}
     200
     201int * __errno_location(void) {
     202        return 0;
     203}
     204
     205int lseek(int fd, int offset, int whence) {
     206        return prom_lseek ((void *)fd, whence + offset);
     207}
     208
     209int lseek64(int fd, int offset, int whence) {
     210        return prom_lseek ((void *)fd, whence + offset);
     211}
     212
     213size_t fwrite(const void *ptr, size_t size, size_t nmemb, void *stream) {
     214        return 0;
     215}
     216
     217int ioctl(int d, int request, ...) {
     218        return 0;
     219}
     220
     221int fallocate(int fd, int mode, unsigned int offset, unsigned int len) {
     222        return 0;
     223}
     224
     225int uname(void *buf) {
     226        return 0;
     227}
     228
     229int setrlimit(int resource, void *rlim) {
     230        return 0;
     231}
     232
     233unsigned long long int strtoull(const char *nptr, char **endptr, int base) {
     234        return 0;
     235}
     236
     237int getrlimit(int resource, void *rlim) {
     238        return 0;
     239}
     240
     241int stderr = 0;
     242int perror = 0;
Note: See TracBrowser for help on using the repository browser.