Gentoo Archives: gentoo-commits

From: "Joseph Jezak (josejx)" <josejx@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-boot/yaboot/files: yaboot-stubfuncs.patch
Date: Wed, 02 May 2012 06:10:28
Message-Id: 20120502060957.4FCD42004C@flycatcher.gentoo.org
1 josejx 12/05/02 06:09:57
2
3 Added: yaboot-stubfuncs.patch
4 Log:
5 Added stubbed function patch to fix building with e2fsprogs-1.42.
6
7 (Portage version: 2.1.10.57/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 sys-boot/yaboot/files/yaboot-stubfuncs.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/yaboot/files/yaboot-stubfuncs.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/yaboot/files/yaboot-stubfuncs.patch?rev=1.1&content-type=text/plain
14
15 Index: yaboot-stubfuncs.patch
16 ===================================================================
17 diff --git a/lib/malloc.c b/lib/malloc.c
18 index 0121112..d077630 100644
19 --- a/lib/malloc.c
20 +++ b/lib/malloc.c
21 @@ -64,6 +64,17 @@ void *malloc (unsigned int size)
22 return caddr;
23 }
24
25 +/* Calloc wrapper for malloc */
26 +void *memset(void *s, int c, size_t n);
27 +void *calloc(size_t nmemb, size_t size) {
28 + void *caddr;
29 + caddr = malloc(nmemb * size);
30 + memset(caddr, 0, nmemb * size);
31 + return caddr;
32 +}
33 +
34 +
35 +
36 /* Do not fall back to the malloc above as posix_memalign is needed by
37 * external libraries not yaboot */
38 int posix_memalign(void **memptr, size_t alignment, size_t size)
39 diff --git a/lib/nonstd.c b/lib/nonstd.c
40 index 5aeb0cb..0a13246 100644
41 --- a/lib/nonstd.c
42 +++ b/lib/nonstd.c
43 @@ -65,3 +65,131 @@ char *getenv(const char *name)
44 {
45 return NULL;
46 }
47 +
48 +int open(const char *pathname, int flags) {
49 + return (int) prom_open((char *)pathname);
50 +}
51 +
52 +int open64(const char *pathname, int flags) {
53 + return (int) prom_open((char *)pathname);
54 +}
55 +
56 +int __open64_2 (__const char *__path, int __oflag) {
57 + return (int) prom_open((char *)__path);
58 +}
59 +
60 +int __xstat64 (int __ver, const char *__filename, struct stat64 *__stat_buf) {
61 + return 0;
62 +}
63 +
64 +int __fxstat64 (int __ver, int __filedesc, struct stat64 *__stat_buf) {
65 + return 0;
66 +}
67 +
68 +int read(int fd, void *buf, size_t count) {
69 + return prom_read((void *)fd, buf, count);
70 +}
71 +
72 +int close(int fd) {
73 + prom_close((void *)fd);
74 + return 0;
75 +}
76 +
77 +void exit(int status) {
78 + prom_exit();
79 +}
80 +
81 +int __printf_chk(int flag, const char *format, ...) {
82 + va_list ap;
83 + va_start (ap, format);
84 + prom_vfprintf (prom_stdout, format, ap);
85 + va_end (ap);
86 +
87 + return 0;
88 +}
89 +
90 +int __sprintf_chk(char * str, int flag, size_t strlen, const char * format, ...) {
91 + va_list ap;
92 + va_start(ap, format);
93 + // No sprintf? :(
94 + va_end(ap);
95 + return 0;
96 +
97 +}
98 +
99 +int __fprintf_chk(FILE *stream, int flag, const char *format, ...) {
100 + va_list ap;
101 + va_start (ap, format);
102 + prom_vfprintf (prom_stdout, format, ap);
103 + va_end (ap);
104 +
105 + return 0;
106 +}
107 +
108 +void *memcpy(void *dest, const void *src, size_t n);
109 +void *__memcpy_chk(void *dest, const void *src, size_t n, size_t destlen) {
110 + return memcpy(dest, src, n);
111 +}
112 +
113 +
114 +// Dummy functions
115 +signed int random(void) {
116 + return 0;
117 +}
118 +
119 +void srandom(unsigned int seed) {
120 + return;
121 +}
122 +
123 +unsigned int sleep(unsigned int seconds) {
124 + return 0;
125 +}
126 +
127 +int gettimeofday(void *tv, void *tz) {
128 + return 0;
129 +}
130 +
131 +long sysconf(int name) {
132 + return 0;
133 +}
134 +
135 +int getpagesize(void) {
136 + return 0;
137 +}
138 +
139 +int gethostname(char *name, size_t len) {
140 + return 0;
141 +}
142 +
143 +int getpid(void) {
144 + return 0;
145 +}
146 +
147 +int getuid(void) {
148 + return 0;
149 +}
150 +
151 +void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) {
152 + return;
153 +}
154 +
155 +int * __errno_location(void) {
156 + return 0;
157 +}
158 +
159 +int lseek(int fd, int offset, int whence) {
160 + return prom_lseek ((void *)fd, whence + offset);
161 +}
162 +
163 +int lseek64(int fd, int offset, int whence) {
164 + return prom_lseek ((void *)fd, whence + offset);
165 +}
166 +
167 +// Stubbed ...
168 +size_t fwrite(const void *ptr, size_t size, size_t nmemb, void *stream) {
169 + return 0;
170 +}
171 +
172 +
173 +int stderr = 0;
174 +int perror = 0;