Port NetBSD libc functions to Minix.

This patch contains changes to NetBSD libc code base to make it
compile and work on Minix. Some of them are due to actual NetBSD
libc bugs, as we're compiling it in non-reentrant mode and with
a.out support, something not exactly frequent in NetBSD.
Others are proper fixes to port it to Minix (mostly sa_len
parameter missing in socket and a few mmap from files).
This commit is contained in:
Gianluca Guida
2011-02-15 12:19:40 +00:00
parent 58153774b1
commit ad4dda469f
62 changed files with 730 additions and 72 deletions

View File

@@ -65,8 +65,10 @@
# define malloc_pageshift 12U
# define malloc_minsize 16U
# endif
#ifndef __minix
# define HAS_UTRACE
# define UTRACE_LABEL
#endif /* __minix */
#include <sys/cdefs.h>
void utrace(struct ut *, int);
@@ -210,9 +212,11 @@ static size_t malloc_pagemask;
#define INIT_MMAP()
#endif
#ifndef __minix
#ifndef MADV_FREE
#define MADV_FREE MADV_DONTNEED
#endif
#endif /* !__minix */
/* Number of free pages we cache */
static size_t malloc_cache = 16;
@@ -485,8 +489,10 @@ malloc_init(void)
case '<': malloc_cache >>= 1; break;
case 'a': malloc_abort = 0; break;
case 'A': malloc_abort = 1; break;
#ifndef __minix
case 'h': malloc_hint = 0; break;
case 'H': malloc_hint = 1; break;
#endif /* !__minix */
case 'r': malloc_realloc = 0; break;
case 'R': malloc_realloc = 1; break;
case 'j': malloc_junk = 0; break;
@@ -932,8 +938,10 @@ free_pages(void *ptr, size_t idx, struct pginfo *info)
if (malloc_junk)
memset(ptr, SOME_JUNK, l);
#ifndef __minix
if (malloc_hint)
madvise(ptr, l, MADV_FREE);
#endif /* !__minix */
tail = (char *)ptr+l;