@@ -260,106 +260,6 @@ int main()
260
260
261
261
AC_MSG_RESULT ( done )
262
262
263
- dnl test for memory allocation using mmap(MAP_ANON)
264
- AC_MSG_CHECKING ( for memory allocation using mmap ( MAP_ANON ))
265
-
266
- AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [ [
267
- #include <sys/types.h>
268
- #include <sys/stat.h>
269
- #include <fcntl.h>
270
- #include <sys/mman.h>
271
- #include <stdlib.h>
272
- #include <stdio.h>
273
- #ifndef MAP_ANON
274
- # ifdef MAP_ANONYMOUS
275
- # define MAP_ANON MAP_ANONYMOUS
276
- # endif
277
- #endif
278
- #ifndef MREMAP_MAYMOVE
279
- # define MREMAP_MAYMOVE 0
280
- #endif
281
- #ifndef MAP_FAILED
282
- # define MAP_FAILED ((void*)-1)
283
- #endif
284
-
285
- #define SEG_SIZE (256*1024)
286
-
287
- int main()
288
- {
289
- void *seg = mmap(NULL, SEG_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
290
- if (seg == MAP_FAILED) {
291
- return 1;
292
- }
293
- if (munmap(seg, SEG_SIZE) != 0) {
294
- return 2;
295
- }
296
- return 0;
297
- }
298
- ] ] ) ] , [
299
- AC_DEFINE ( [ HAVE_MEM_MMAP_ANON] , 1 , [ Define if the target system has support for memory allocation using mmap(MAP_ANON)] )
300
- AC_MSG_RESULT ( yes )
301
- ] , [
302
- AC_MSG_RESULT ( no )
303
- ] , [
304
- dnl cross-compile needs something here
305
- AC_MSG_RESULT ( no )
306
- ] )
307
-
308
- dnl test for memory allocation using mmap("/dev/zero")
309
- AC_MSG_CHECKING ( for memory allocation using mmap ( "/dev/zero" ))
310
-
311
- AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [ [
312
- #include <sys/types.h>
313
- #include <sys/stat.h>
314
- #include <fcntl.h>
315
- #include <sys/mman.h>
316
- #include <stdlib.h>
317
- #include <stdio.h>
318
- #ifndef MAP_ANON
319
- # ifdef MAP_ANONYMOUS
320
- # define MAP_ANON MAP_ANONYMOUS
321
- # endif
322
- #endif
323
- #ifndef MREMAP_MAYMOVE
324
- # define MREMAP_MAYMOVE 0
325
- #endif
326
- #ifndef MAP_FAILED
327
- # define MAP_FAILED ((void*)-1)
328
- #endif
329
-
330
- #define SEG_SIZE (256*1024)
331
-
332
- int main()
333
- {
334
- int fd;
335
- void *seg;
336
-
337
- fd = open("/dev/zero", O_RDWR, S_IRUSR | S_IWUSR);
338
- if (fd < 0) {
339
- return 1;
340
- }
341
- seg = mmap(NULL, SEG_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
342
- if (seg == MAP_FAILED) {
343
- return 2;
344
- }
345
- if (munmap(seg, SEG_SIZE) != 0) {
346
- return 3;
347
- }
348
- if (close(fd) != 0) {
349
- return 4;
350
- }
351
- return 0;
352
- }
353
- ] ] ) ] , [
354
- AC_DEFINE ( [ HAVE_MEM_MMAP_ZERO] , 1 , [ Define if the target system has support for memory allocation using mmap("/dev/zero")] )
355
- AC_MSG_RESULT ( yes )
356
- ] , [
357
- AC_MSG_RESULT ( no )
358
- ] , [
359
- dnl cross-compile needs something here
360
- AC_MSG_RESULT ( no )
361
- ] )
362
-
363
263
AC_CHECK_FUNCS ( mremap )
364
264
365
265
0 commit comments