#define DBEGIN_TY unsigned long
extern DBEGIN_TY _dbegin;
-
-
-/* define if there is no _cleanup, do here what needs
- to be done before calling unexec
- */
-#define CLEANUP_CODE \
- setbuf(stdin,0); \
- setbuf(stdout,0);
-
/* size to use for mallocs done */
/* #define BABY_MALLOC_SIZE 0x5000 */
#define DBEGIN_TY unsigned int
extern DBEGIN_TY _stacktop, _stackbottom, _dbegin;
-/* define if there is no _cleanup, do here what needs
- to be done before calling unexec
- */
-#define CLEANUP_CODE \
- setbuf(stdin,0); \
- setbuf(stdout,0);
-
#define NO_SYS_PARAM_H
#define NO_SYS_TIMES_H
if (!gcl_alloc_initialized)
gcl_init_alloc(&size);
+#ifdef CAN_UNRANDOMIZE_SBRK
+ else if (!gcl_unrandomized)
+ return sbrk(size);
+#endif
CHECK_INTERRUPT;
#define HAVE_GCL_CLEANUP
+#ifdef CAN_UNRANDOMIZE_SBRK
+bool gcl_unrandomized=FALSE;
+#endif
+
void
gcl_cleanup(int gc) {
if (getenv("GCL_WAIT"))
sleep(30);
-#ifdef CLEANUP_CODE
- CLEANUP_CODE
-#elif defined(USE_CLEANUP)
- {extern void _cleanup(void);_cleanup();}
+#if defined(USE_CLEANUP)
+ {extern void _cleanup(void);_cleanup();}
#endif
#ifdef GCL_GPROF
cs_org=0;
initial_sbrk=core_end;
+#ifdef CAN_UNRANDOMIZE_SBRK
+ gcl_unrandomized=FALSE;
+#endif
+
}
close_pool();
int
main(int argc, char **argv, char **envp) {
+#ifdef CAN_UNRANDOMIZE_SBRK
+#include <stdio.h>
+#include <stdlib.h>
+#include "unrandomize.h"
+ gcl_unrandomized=TRUE;
+#endif
+
gcl_init_alloc(&argv);
#ifdef GET_FULL_PATH_SELF
#endif
*argv=kcl_self;
-#ifdef CAN_UNRANDOMIZE_SBRK
-#include <stdio.h>
-#include <stdlib.h>
-#include "unrandomize.h"
-#endif
-
setbuf(stdin, stdin_buf);
setbuf(stdout, stdout_buf);
#ifdef _WIN32