Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 527974 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-1 / +10 lines)
Line  Link Here
0
-- lib/malloc.c
0
++ lib/malloc.c
Lines 64-69 void *malloc (unsigned int size) Link Here
64
    return caddr;
64
    return caddr;
65
}
65
}
66
66
67
/* Calloc wrapper for malloc */
68
void *memset(void *s, int c, size_t n);
69
void *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
67
/* Do not fall back to the malloc above as posix_memalign is needed by
76
/* Do not fall back to the malloc above as posix_memalign is needed by
68
 * external libraries not yaboot */
77
 * external libraries not yaboot */
69
int posix_memalign(void **memptr, size_t alignment, size_t size)
78
int posix_memalign(void **memptr, size_t alignment, size_t size)
(-)lib/nonstd.c.bak (+193 lines)
Lines 65-67 Link Here
65
{
65
{
66
	return NULL;
66
	return NULL;
67
}
67
}
68
69
// I tried to use prom functions for these...
70
int open(const char *pathname, int flags) {
71
	return (int) prom_open((char *)pathname);
72
}
73
74
int open64(const char *pathname, int flags) {
75
	return (int) prom_open((char *)pathname);
76
}
77
78
int __open64_2 (__const char *__path, int __oflag) {
79
	return (int) prom_open((char *)__path);
80
}
81
82
int read(int fd, void *buf, size_t count) {
83
	return prom_read((void *)fd, buf, count);
84
}
85
86
int write(int fd, void *buf, size_t count) {
87
	return prom_write((void *)fd, buf, count);
88
}
89
90
int close(int fd) {
91
	prom_close((void *)fd);
92
	return 0;
93
}
94
95
// There are just wrapped read/write functions
96
uint64_t pread64(int fd, void *buf, uint64_t count, uint64_t offset) {
97
	return prom_read((void *)fd, buf, count);
98
}
99
uint64_t pwrite64(int fd, void *buf, uint64_t count, uint64_t offset) {
100
	return prom_write((void *)fd, buf, count);
101
}
102
103
// No fsync, just assume we've sync'd
104
int fsync(int fd) {
105
	return 0;
106
}
107
108
void exit(int status) {
109
	prom_exit();
110
}
111
112
int __printf_chk(int flag, const char *format, ...) {
113
	va_list ap;
114
	va_start (ap, format);
115
	prom_vfprintf (prom_stdout, format, ap);
116
	va_end (ap);
117
118
	return 0;
119
}
120
121
int __sprintf_chk(char * str, int flag, size_t strlen, const char * format, ...) {
122
	va_list ap;
123
	va_start(ap, format);
124
	// No sprintf? :(
125
	va_end(ap);
126
	return 0;
127
128
}
129
130
int __fprintf_chk(FILE *stream, int flag, const char *format, ...) {
131
	va_list ap;
132
	va_start (ap, format);
133
	prom_vfprintf (prom_stdout, format, ap);
134
	va_end (ap);
135
136
	return 0;
137
}
138
139
void *memcpy(void *dest, const void *src, size_t n);
140
void *__memcpy_chk(void *dest, const void *src, size_t n, size_t destlen) {
141
	return memcpy(dest, src, n);
142
}
143
144
// Terminate a function in case of stack overflow
145
void __stack_chk_fail(void) {
146
	prom_printf("Stack overflow detected!\n");
147
	prom_exit();
148
}
149
150
// But these are all dummy functions
151
int __xstat64 (int __ver, const char *__filename, void *__stat_buf) {
152
	return 0;
153
}
154
155
int stat64(const char *path, void *stat_buf) {
156
	return 0;
157
}
158
159
int fstat64(int fildes, void *stat_buf) {
160
	return 0;
161
}
162
163
int __fxstat64 (int __ver, int __filedesc, void *__stat_buf) {
164
	return 0;
165
}
166
167
signed int random(void) {
168
	return 0;
169
}
170
171
void srandom(unsigned int seed) {
172
	return;
173
}
174
175
int rand(void) {
176
	return 0;
177
}
178
179
void srand(unsigned int seed) {
180
	return;
181
}
182
183
unsigned int sleep(unsigned int seconds) {
184
	return 0;
185
}
186
187
int gettimeofday(void *tv, void *tz) {
188
	return 0;
189
}
190
191
long sysconf(int name) {
192
	return 0;
193
}
194
195
int getpagesize(void) {
196
	return 0;
197
}
198
199
int gethostname(char *name, size_t len) {
200
	return 0;
201
}
202
203
int getpid(void) {
204
	return 0;
205
}
206
207
int getuid(void) {
208
	return 0;
209
}
210
211
void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) {
212
	return;
213
}
214
215
int * __errno_location(void) {
216
	return 0;
217
}
218
219
int lseek(int fd, int offset, int whence) {
220
	return prom_lseek ((void *)fd, whence + offset);
221
}
222
223
int lseek64(int fd, int offset, int whence) {
224
	return prom_lseek ((void *)fd, whence + offset);
225
}
226
227
size_t fwrite(const void *ptr, size_t size, size_t nmemb, void *stream) {
228
	return 0;
229
}
230
231
int ioctl(int d, int request, ...) {
232
	return 0;
233
}
234
235
int fallocate(int fd, int mode, unsigned int offset, unsigned int len) {
236
	return 0;
237
}
238
239
int uname(void *buf) {
240
	return 0;
241
}
242
243
int setrlimit(int resource, void *rlim) {
244
	return 0;
245
}
246
247
unsigned long long int strtoull(const char *nptr, char **endptr, int base) {
248
	return 0;
249
}
250
251
int getrlimit(int resource, void *rlim) {
252
	return 0;
253
}
254
255
int fcntl(int fd, int cmd, ...) {
256
	return 0;
257
}
258
259
int stderr = 0;
260
int perror = 0;

Return to bug 527974