diff options
Diffstat (limited to '')
-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 19f82df09..f012551af 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 | //bbox disabled: #include <alloca.h> | 120 | //bbox disabled: #include <alloca.h> |
117 | 121 | ||
118 | /* bbox: not needed | 122 | /* bbox: not needed |
@@ -122,6 +126,53 @@ | |||
122 | #define INT_FIG_ ntohl(0x4649475f) | 126 | #define INT_FIG_ ntohl(0x4649475f) |
123 | */ | 127 | */ |
124 | 128 | ||
129 | #ifdef __MINGW32__ | ||
130 | #define UNUSED __attribute__ ((__unused__)) | ||
131 | |||
132 | /* Workaround specifically for fixdep */ | ||
133 | #define PROT_READ 0 | ||
134 | #define MAP_PRIVATE 0 | ||
135 | void *mmap(void *start UNUSED, size_t size, int prot UNUSED, | ||
136 | int flags UNUSED, int fd, off_t offset UNUSED) | ||
137 | { | ||
138 | void *p; | ||
139 | void *curP; | ||
140 | ssize_t readB; | ||
141 | |||
142 | p = malloc(size); | ||
143 | if (!p) | ||
144 | return (void*)((long)-1); | ||
145 | |||
146 | curP = p; | ||
147 | |||
148 | while (size > 0) | ||
149 | { | ||
150 | readB = read(fd, curP, size); | ||
151 | |||
152 | if (readB == 0) | ||
153 | { | ||
154 | /* EOF reached */ | ||
155 | break; | ||
156 | } | ||
157 | else if (readB < 0) | ||
158 | { | ||
159 | perror("fixdep: read config"); | ||
160 | free(p); | ||
161 | return (void*)((long)-1); | ||
162 | } | ||
163 | |||
164 | size -= readB; | ||
165 | curP += readB; | ||
166 | } | ||
167 | |||
168 | return p; | ||
169 | } | ||
170 | void munmap(void *p, size_t size UNUSED) | ||
171 | { | ||
172 | free(p); | ||
173 | } | ||
174 | #endif | ||
175 | |||
125 | char *target; | 176 | char *target; |
126 | char *depfile; | 177 | char *depfile; |
127 | char *cmdline; | 178 | char *cmdline; |