1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
####################################################################
# This file defines probes for local features that vmalloc requires.
# Such probes are interpreted by the "iffe" language interpreter.
# Results are stored in the FEATURE directory.
# Written by Kiem-Phong Vo (08/15/95).
####################################################################
lib atexit
lib onexit
lib getpagesize
hdr stat
hdr stdlib
sys stat
typ ssize_t
hdr malloc
lib mallopt
lib mallinfo
lib mstats
hdr alloca
std malloc note{ stuck with standard malloc }end noexecute{
_BEGIN_EXTERNS_
extern void _exit _ARG_((int));
extern char* strdup _ARG_((const char*));
#if _STD_
char* malloc(unsigned n) { _exit(0); return 0; }
#else
char* malloc(n) unsigned n; { _exit(0); return 0; }
#endif
_END_EXTERNS_
main() { strdup("yo"); _exit(1); }
}end
lib alloca note{ alloca exists }end compile{
#include "FEATURE/vmalloc"
#if _hdr_alloca
#include <alloca.h>
#endif
main()
{ alloca(10);
}
}end
mal alloca note{ alloca is based on malloc() }end execute{
#include "FEATURE/vmalloc"
#if _hdr_alloca
#include <alloca.h>
#endif
#if _STD_
void* malloc(unsigned int size)
#else
void* malloc(size) unsigned int size;
#endif
{ exit(0);
return 0;
}
main()
{ alloca(10);
return 1;
}
}end
stk down note{ stack grows downward }end execute{
static growdown()
{ static char* addr = 0;
char array[4];
if(!addr)
{ addr = &array[0];
return growdown();
}
else if(addr < &array[0])
return 0;
else return 1;
}
main() { return growdown() ? 0 : 1; }
}end
exit cleanup note{ stuck with standard _cleanup }end execute{
#include <stdio.h>
_BEGIN_EXTERNS_
extern void exit _ARG_((int));
extern void _exit _ARG_((int));
extern void _cleanup();
void _cleanup() { _exit(0); }
_END_EXTERNS_
main() { printf("cleanup\n"); exit(1); }
}end
|