summaryrefslogtreecommitdiff
path: root/legacy/escape/src/lib/escape_mman.c
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-12-02 22:35:45 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-12-02 22:35:45 +0000
commit7d6010b12c47a20e492da808e3192c3f87dab619 (patch)
tree26c6fd189e046a76560c0bc740b85f4d767ae399 /legacy/escape/src/lib/escape_mman.c
parent53fc441d5475155965d92da89502fe4634a561b2 (diff)
merge: add escape ecore, fix several bugs
SVN revision: 79995
Diffstat (limited to 'legacy/escape/src/lib/escape_mman.c')
-rw-r--r--legacy/escape/src/lib/escape_mman.c67
1 files changed, 0 insertions, 67 deletions
diff --git a/legacy/escape/src/lib/escape_mman.c b/legacy/escape/src/lib/escape_mman.c
deleted file mode 100644
index 995c72e7f4..0000000000
--- a/legacy/escape/src/lib/escape_mman.c
+++ /dev/null
@@ -1,67 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif /* HAVE_CONFIG_H */
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <sys/types.h>
8#include <unistd.h>
9
10#include "sys/mman.h"
11
12/***** API *****/
13
14void *
15mmap(void *addr __UNUSED__,
16 size_t len,
17 int prot,
18 int flags,
19 int fd,
20 off_t offset)
21{
22 void *data;
23 size_t size;
24
25 data = malloc(len);
26 if (!data)
27 {
28 fprintf (stderr, "[Escape] [mmap] malloc failed\n");
29 return MAP_FAILED;
30 }
31
32 size = read(fd, data, len);
33 if (size != len)
34 {
35 fprintf (stderr, "[Escape] [mmap] read failed\n");
36 free(data);
37 return MAP_FAILED;
38 }
39
40 if (lseek(fd, -len, SEEK_CUR) == -1)
41 {
42 fprintf (stderr, "[Escape] [mmap] lseek failed\n");
43 free(data);
44 return MAP_FAILED;
45 }
46
47 return data;
48}
49
50int
51munmap(void *addr,
52 size_t len __UNUSED__)
53{
54 if (addr && (addr != MAP_FAILED))
55 free(addr);
56
57 return 0;
58}
59
60int
61madvise(void *addr __UNUSED__,
62 size_t length __UNUSED__,
63 int advice __UNUSED__)
64{
65 return 0;
66}
67