diff options
Diffstat (limited to 'scripts/basic')
-rw-r--r-- | scripts/basic/fixdep.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index f27a17984..fd2e2375f 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c | |||
@@ -104,7 +104,9 @@ | |||
104 | 104 | ||
105 | #include <sys/types.h> | 105 | #include <sys/types.h> |
106 | #include <sys/stat.h> | 106 | #include <sys/stat.h> |
107 | #ifndef __MINGW32__ | ||
107 | #include <sys/mman.h> | 108 | #include <sys/mman.h> |
109 | #endif | ||
108 | #include <unistd.h> | 110 | #include <unistd.h> |
109 | #include <fcntl.h> | 111 | #include <fcntl.h> |
110 | #include <string.h> | 112 | #include <string.h> |
@@ -112,7 +114,9 @@ | |||
112 | #include <stdio.h> | 114 | #include <stdio.h> |
113 | #include <limits.h> | 115 | #include <limits.h> |
114 | #include <ctype.h> | 116 | #include <ctype.h> |
117 | #ifndef __MINGW32__ | ||
115 | #include <arpa/inet.h> | 118 | #include <arpa/inet.h> |
119 | #endif | ||
116 | 120 | ||
117 | /* bbox: not needed | 121 | /* bbox: not needed |
118 | #define INT_CONF ntohl(0x434f4e46) | 122 | #define INT_CONF ntohl(0x434f4e46) |
@@ -121,6 +125,53 @@ | |||
121 | #define INT_FIG_ ntohl(0x4649475f) | 125 | #define INT_FIG_ ntohl(0x4649475f) |
122 | */ | 126 | */ |
123 | 127 | ||
128 | #ifdef __MINGW32__ | ||
129 | #define UNUSED __attribute__ ((__unused__)) | ||
130 | |||
131 | /* Workaround specifically for fixdep */ | ||
132 | #define PROT_READ 0 | ||
133 | #define MAP_PRIVATE 0 | ||
134 | void *mmap(void *start UNUSED, size_t size, int prot UNUSED, | ||
135 | int flags UNUSED, int fd, off_t offset UNUSED) | ||
136 | { | ||
137 | void *p; | ||
138 | void *curP; | ||
139 | ssize_t readB; | ||
140 | |||
141 | p = malloc(size); | ||
142 | if (!p) | ||
143 | return (void*)((long)-1); | ||
144 | |||
145 | curP = p; | ||
146 | |||
147 | while (size > 0) | ||
148 | { | ||
149 | readB = read(fd, curP, size); | ||
150 | |||
151 | if (readB == 0) | ||
152 | { | ||
153 | /* EOF reached */ | ||
154 | break; | ||
155 | } | ||
156 | else if (readB < 0) | ||
157 | { | ||
158 | perror("fixdep: read config"); | ||
159 | free(p); | ||
160 | return (void*)((long)-1); | ||
161 | } | ||
162 | |||
163 | size -= readB; | ||
164 | curP += readB; | ||
165 | } | ||
166 | |||
167 | return p; | ||
168 | } | ||
169 | void munmap(void *p, size_t size UNUSED) | ||
170 | { | ||
171 | free(p); | ||
172 | } | ||
173 | #endif | ||
174 | |||
124 | char *target; | 175 | char *target; |
125 | char *depfile; | 176 | char *depfile; |
126 | char *cmdline; | 177 | char *cmdline; |