minix/test/mod.c
Ben Gras 6a6b7b5769 ld.so: be more mmap()-behaviour-independent
. if the layout of virtual address regions as returned
	  by mmap() without a location hint changes, ld.so could
	  trip itself up (under minix). this change allocates
	  the full size it needs for every object that's loaded
	  so that if that succeeds, it's sure there's virtual address
	  space for the whole thing no matter what other bits happen
	  to be there already.

	. this fix exposed a bug in the test; at atexit() execution
	  time the loaded object is unmapped, so that part of the
	  test is removed.
2012-06-25 14:13:07 +02:00

26 lines
423 B
C

/* Code for module to be loaded by test63. */
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include "magic.h"
long cookie = 0;
void exithandler(void);
long modfunction(long v1, long *argcookie, long v2) {
if(v1 != MAGIC4 || v2 != MAGIC5) {
fprintf(stderr, "wrong args to modfunction\n");
exit(1);
}
*argcookie = MAGIC3;
cookie = MAGIC2;
return MAGIC1;
}
void exithandler(void) {
/* OK */
}