1N/A# This file defines probes for local features that vmalloc requires.
1N/A# Such probes are interpreted by the "iffe" language interpreter.
1N/A# Results are stored in the FEATURE directory. Some of the
1N/A# repeating them here allows for single standalone and AST sources.
1N/Alib atexit,getpagesize,mallinfo,mallopt,memalign,mstats
1N/Alib onexit,pvalloc,strdup,valloc,vmalloc
1N/Alib _malloc,__malloc,__libc_malloc
1N/Ahdr alloca,malloc,stat,stdlib,unistd
1N/Atst mem_sbrk note{ brk()/sbrk() work as expected }end execute{
1N/A #define uchar unsigned char
1N/A { uchar *brk0, *brk1;
1N/A /* allocate a big chunk */
1N/A if(!(brk0 = (uchar*)sbrk(0)) || brk0 == (uchar*)(-1))
1N/A if((brk1 = (uchar*)sbrk(0)) != brk0)
1N/A /* now return half of it */
1N/A if((brk0 = (uchar*)sbrk(0)) != brk1)
1N/Atst map_malloc note{ map malloc to _ast_malloc }end noexecute{
1N/A int main() { return 1; }
1N/A static int user = 0;
1N/A extern char* strdup _ARG_((const char*));
1N/A #define LOCAL() strdup("s")
1N/A extern void* calloc _ARG_((unsigned int, unsigned int));
1N/A #define LOCAL() calloc(1,1)
1N/A #define extern __declspec(dllexport)
1N/A static HT heap[1024 * 4];
1N/A static HT* hp = &heap[1];
1N/A #define MALLOC(n) if(user)return&heap[0];op=hp;hp+=(n+sizeof(HT)-1)/sizeof(HT);return(void*)op;
1N/A #define INTERCEPTED(p) (((char*)(p))==((char*)&heap[0]))
1N/A extern void free(void* p) { }
1N/A extern void _free(void* p) { }
1N/A extern void __free(void* p) { }
1N/A extern void __libc_free(void* p) { }
1N/A extern void* malloc(unsigned int n) { MALLOC(n); }
1N/A extern void* _malloc(unsigned int n) { MALLOC(n); }
1N/A extern void* __malloc(unsigned int n) { MALLOC(n); }
1N/A extern void* __libc_malloc(unsigned int n) { MALLOC(n); }
1N/A extern void free(p) char* p; { }
1N/A extern void _free(p) char* p; { }
1N/A extern void __free(p) char* p; { }
1N/A extern void __libc_free(p) char* p; { }
1N/A extern void* malloc(n) unsigned int n; { MALLOC(n); }
1N/A extern void* _malloc(n) unsigned int n; { MALLOC(n); }
1N/A extern void* __malloc(n) unsigned int n; { MALLOC(n); }
1N/A extern void* __libc_malloc(n) unsigned int n; { MALLOC(n); }
1N/A int main() { user = 1; return !INTERCEPTED(LOCAL()); }
1N/Atst map_malloc note{ map malloc to _ast_malloc -- wimp-o mach? }end noexecute{
1N/A int main() { return 0; }
1N/A void* calloc(unsigned n, unsigned m) { exit(1); }
1N/A void* calloc(n, m) unsigned n, m; { exit(1); }
1N/A int main() { return 0; }
1N/Alib alloca note{ alloca exists }end link{
1N/Atst mal_alloca note{ alloca is based on malloc() }end execute{
1N/A int main() { return 1; }
1N/A void* malloc(unsigned int size)
1N/A void* malloc(size) unsigned int size;
1N/Atst stk_down note{ stack grows downward }end execute{
1N/A { static char* addr = 0;
1N/A else if(addr < &array[0])
1N/A int main() { return growdown() ? 0 : 1; }
1N/A #if _BLD_INSTRUMENT || cray || _UWIN && _BLD_ast
1N/A #define _std_malloc 1 /* defer to standard malloc */
1N/A #define _mem_mmap_anon 1
1N/A #define _mem_mmap_zero 1