aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-01-23 20:03:32 +0700
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-01-23 20:03:32 +0700
commit894c533c044a98b21cce9d3a3929077fa142f4fb (patch)
treea7bfc029e7f483385886e831d135004e30e7a199
parenteb28f737c24d7ff3bb3d6407f5aacb7bd62b6edf (diff)
downloadbusybox-w32-894c533c044a98b21cce9d3a3929077fa142f4fb.tar.gz
busybox-w32-894c533c044a98b21cce9d3a3929077fa142f4fb.tar.bz2
busybox-w32-894c533c044a98b21cce9d3a3929077fa142f4fb.zip
win32: fixdep: workaround mmap()
-rw-r--r--scripts/basic/fixdep.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index f27a17984..02678a4cc 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,31 @@
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
134void *mmap(void *start UNUSED, size_t size, int prot UNUSED,
135 int flags UNUSED, int fd, off_t offset UNUSED)
136{
137 void *p = malloc(size);
138 if (!p)
139 return NULL;
140 if (read(fd, p, size) != size) {
141 perror("fixdep: read config");
142 free(p);
143 return NULL;
144 }
145 return p;
146}
147void munmap(void *p, size_t size UNUSED)
148{
149 free(p);
150}
151#endif
152
124char *target; 153char *target;
125char *depfile; 154char *depfile;
126char *cmdline; 155char *cmdline;