summaryrefslogtreecommitdiff
path: root/src/dlfcn/dlopen.c
blob: a8929781f0533ea8e1c6fd203aee9de4c6f8e8af (plain)
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
#if 0

#include <dlfcn.h>
#include <fcntl.h>
#include <stdlib.h>
#include "_dlfcn.h"

void *dlopen(const char *file, int mode)
{
	if ((mode & (RTLD_LAZY | RTLD_NOW)) == (RTLD_LAZY | RTLD_NOW)) {
		return NULL;
	}

	if ((mode & (RTLD_GLOBAL | RTLD_LOCAL)) == (RTLD_GLOBAL | RTLD_LOCAL)) {
		return NULL;
	}

	struct dlhandle *h = malloc(sizeof(*h));
	if (h == NULL) {
		return NULL;
	}

	h->fd = open(file, O_RDONLY | O_EXEC);
	if (h->fd == -1) {
		free(h);
		return NULL;
	}

	/* map and verify file header */

	return h;
}

/*
XOPEN(500)
*/


#endif