xref: /minix3/minix/tests/mod.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc 
2*433d6423SLionel Sambuc /* Code for module to be loaded by test63. */
3*433d6423SLionel Sambuc 
4*433d6423SLionel Sambuc #include <stdlib.h>
5*433d6423SLionel Sambuc #include <stdio.h>
6*433d6423SLionel Sambuc #include <dlfcn.h>
7*433d6423SLionel Sambuc 
8*433d6423SLionel Sambuc #include "magic.h"
9*433d6423SLionel Sambuc 
10*433d6423SLionel Sambuc long cookie = 0;
11*433d6423SLionel Sambuc 
12*433d6423SLionel Sambuc void exithandler(void);
13*433d6423SLionel Sambuc 
modfunction(long v1,long * argcookie,long v2)14*433d6423SLionel Sambuc long modfunction(long v1, long *argcookie, long v2) {
15*433d6423SLionel Sambuc   if(v1 != MAGIC4 || v2 != MAGIC5) {
16*433d6423SLionel Sambuc 	fprintf(stderr, "wrong args to modfunction\n");
17*433d6423SLionel Sambuc 	exit(1);
18*433d6423SLionel Sambuc   }
19*433d6423SLionel Sambuc   *argcookie = MAGIC3;
20*433d6423SLionel Sambuc   cookie = MAGIC2;
21*433d6423SLionel Sambuc   return MAGIC1;
22*433d6423SLionel Sambuc }
23*433d6423SLionel Sambuc 
exithandler(void)24*433d6423SLionel Sambuc void exithandler(void) {
25*433d6423SLionel Sambuc 	/* OK */
26*433d6423SLionel Sambuc }
27