Subversion Repositories HelenOS-historic

Rev

Rev 985 | Rev 1143 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 985 Rev 999
Line 436... Line 436...
436
  empirically derived value that works well in most systems. You can
436
  empirically derived value that works well in most systems. You can
437
  disable mmap by setting to MAX_SIZE_T.
437
  disable mmap by setting to MAX_SIZE_T.
438
 
438
 
439
*/
439
*/
440
 
440
 
441
#ifndef WIN32
-
 
442
#ifdef _WIN32
-
 
443
#define WIN32 1
-
 
444
#endif  /* _WIN32 */
441
#include <sys/types.h>  /* For size_t */
445
#endif  /* WIN32 */
-
 
446
#ifdef WIN32
442
 
447
#define WIN32_LEAN_AND_MEAN
443
/** Non-default helenos customizations */
448
#include <windows.h>
-
 
449
#define HAVE_MMAP 1
-
 
450
#define HAVE_MORECORE 0
-
 
451
#define LACKS_UNISTD_H
444
#define LACKS_FCNTL_H
452
#define LACKS_SYS_PARAM_H
-
 
453
#define LACKS_SYS_MMAN_H
445
#define LACKS_SYS_MMAN_H
454
#define LACKS_STRING_H
446
#define LACKS_SYS_PARAM_H
455
#define LACKS_STRINGS_H
447
#undef HAVE_MMAP
456
#define LACKS_SYS_TYPES_H
448
#define HAVE_MMAP 0
457
#define LACKS_ERRNO_H
449
#define LACKS_ERRNO_H
-
 
450
/* Set errno? */
-
 
451
#undef MALLOC_FAILURE_ACTION
458
#define MALLOC_FAILURE_ACTION
452
#define MALLOC_FAILURE_ACTION
459
#define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */
-
 
460
#endif  /* WIN32 */
-
 
461
 
-
 
462
#if defined(DARWIN) || defined(_DARWIN)
-
 
463
/* Mac OSX docs advise not to use sbrk; it seems better to use mmap */
-
 
464
#ifndef HAVE_MORECORE
-
 
465
#define HAVE_MORECORE 0
-
 
466
#define HAVE_MMAP 1
-
 
467
#endif  /* HAVE_MORECORE */
-
 
468
#endif  /* DARWIN */
-
 
469
 
-
 
470
#ifndef LACKS_SYS_TYPES_H
-
 
471
#include <sys/types.h>  /* For size_t */
-
 
472
#endif  /* LACKS_SYS_TYPES_H */
-
 
473
 
453
 
474
/* The maximum possible size_t value has all bits set */
454
/* The maximum possible size_t value has all bits set */
475
#define MAX_SIZE_T           (~(size_t)0)
455
#define MAX_SIZE_T           (~(size_t)0)
476
 
456
 
477
#ifndef ONLY_MSPACES
-
 
478
#define ONLY_MSPACES 0
457
#define ONLY_MSPACES 0
479
#endif  /* ONLY_MSPACES */
-
 
480
#ifndef MSPACES
-
 
481
#if ONLY_MSPACES
-
 
482
#define MSPACES 1
-
 
483
#else   /* ONLY_MSPACES */
-
 
484
#define MSPACES 0
458
#define MSPACES 0
485
#endif  /* ONLY_MSPACES */
-
 
486
#endif  /* MSPACES */
-
 
487
#ifndef MALLOC_ALIGNMENT
-
 
488
#define MALLOC_ALIGNMENT ((size_t)8U)
459
#define MALLOC_ALIGNMENT ((size_t)8U)
489
#endif  /* MALLOC_ALIGNMENT */
-
 
490
#ifndef FOOTERS
-
 
491
#define FOOTERS 0
460
#define FOOTERS 0
492
#endif  /* FOOTERS */
-
 
493
#ifndef ABORT
-
 
494
#define ABORT  abort()
461
#define ABORT  abort()
495
#endif  /* ABORT */
-
 
496
#ifndef ABORT_ON_ASSERT_FAILURE
-
 
497
#define ABORT_ON_ASSERT_FAILURE 1
462
#define ABORT_ON_ASSERT_FAILURE 1
498
#endif  /* ABORT_ON_ASSERT_FAILURE */
-
 
499
#ifndef PROCEED_ON_ERROR
-
 
500
#define PROCEED_ON_ERROR 0
463
#define PROCEED_ON_ERROR 0
501
#endif  /* PROCEED_ON_ERROR */
-
 
502
#ifndef USE_LOCKS
-
 
503
#define USE_LOCKS 0
464
#define USE_LOCKS 0
504
#endif  /* USE_LOCKS */
-
 
505
#ifndef INSECURE
-
 
506
#define INSECURE 0
465
#define INSECURE 0
507
#endif  /* INSECURE */
-
 
508
#ifndef HAVE_MMAP
-
 
509
#define HAVE_MMAP 1
466
#define HAVE_MMAP 0
510
#endif  /* HAVE_MMAP */
-
 
511
#ifndef MMAP_CLEARS
-
 
-
 
467
 
512
#define MMAP_CLEARS 1
468
#define MMAP_CLEARS 1
513
#endif  /* MMAP_CLEARS */
-
 
514
#ifndef HAVE_MREMAP
-
 
515
#ifdef linux
469
 
516
#define HAVE_MREMAP 1
-
 
517
#else   /* linux */
-
 
518
#define HAVE_MREMAP 0
-
 
519
#endif  /* linux */
-
 
520
#endif  /* HAVE_MREMAP */
-
 
521
#ifndef MALLOC_FAILURE_ACTION
-
 
522
#define MALLOC_FAILURE_ACTION  errno = ENOMEM;
-
 
523
#endif  /* MALLOC_FAILURE_ACTION */
-
 
524
#ifndef HAVE_MORECORE
-
 
525
#if ONLY_MSPACES
-
 
526
#define HAVE_MORECORE 0
-
 
527
#else   /* ONLY_MSPACES */
-
 
528
#define HAVE_MORECORE 1
470
#define HAVE_MORECORE 1
529
#endif  /* ONLY_MSPACES */
-
 
530
#endif  /* HAVE_MORECORE */
-
 
531
#if !HAVE_MORECORE
-
 
532
#define MORECORE_CONTIGUOUS 0
-
 
533
#else   /* !HAVE_MORECORE */
-
 
534
#ifndef MORECORE
-
 
535
#define MORECORE sbrk
-
 
536
#endif  /* MORECORE */
-
 
537
#ifndef MORECORE_CONTIGUOUS
-
 
538
#define MORECORE_CONTIGUOUS 1
471
#define MORECORE_CONTIGUOUS 1
539
#endif  /* MORECORE_CONTIGUOUS */
-
 
540
#endif  /* HAVE_MORECORE */
472
#define MORECORE sbrk
541
#ifndef DEFAULT_GRANULARITY
-
 
542
#if MORECORE_CONTIGUOUS
-
 
543
#define DEFAULT_GRANULARITY (0)  /* 0 means to compute in init_mparams */
473
#define DEFAULT_GRANULARITY (0)  /* 0 means to compute in init_mparams */
544
#else   /* MORECORE_CONTIGUOUS */
-
 
545
#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U)
-
 
546
#endif  /* MORECORE_CONTIGUOUS */
-
 
547
#endif  /* DEFAULT_GRANULARITY */
-
 
-
 
474
 
548
#ifndef DEFAULT_TRIM_THRESHOLD
475
#ifndef DEFAULT_TRIM_THRESHOLD
549
#ifndef MORECORE_CANNOT_TRIM
476
#ifndef MORECORE_CANNOT_TRIM
550
#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U)
477
#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U)
551
#else   /* MORECORE_CANNOT_TRIM */
478
#else   /* MORECORE_CANNOT_TRIM */
552
#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T
479
#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T
Line 581... Line 508...
581
 
508
 
582
#define M_TRIM_THRESHOLD     (-1)
509
#define M_TRIM_THRESHOLD     (-1)
583
#define M_GRANULARITY        (-2)
510
#define M_GRANULARITY        (-2)
584
#define M_MMAP_THRESHOLD     (-3)
511
#define M_MMAP_THRESHOLD     (-3)
585
 
512
 
586
/** Non-default helenos customizations */
-
 
587
#define LACKS_FCNTL_H
-
 
588
#define LACKS_SYS_MMAN_H
-
 
589
#define LACKS_SYS_PARAM_H
-
 
590
#undef HAVE_MMAP
-
 
591
#define HAVE_MMAP 0
-
 
592
#define LACKS_ERRNO_H
-
 
593
/* Set errno? */
-
 
594
#undef MALLOC_FAILURE_ACTION
-
 
595
#define MALLOC_FAILURE_ACTION 
-
 
596
 
-
 
597
 
-
 
598
/*
513
/*
599
  ========================================================================
514
  ========================================================================
600
  To make a fully customizable malloc.h header file, cut everything
515
  To make a fully customizable malloc.h header file, cut everything
601
  above this line, put into file malloc.h, edit to suit, and #include it
516
  above this line, put into file malloc.h, edit to suit, and #include it
602
  on the next line, as well as in programs that use this malloc.
517
  on the next line, as well as in programs that use this malloc.
Line 605... Line 520...
605
 
520
 
606
#include "malloc.h"
521
#include "malloc.h"
607
 
522
 
608
/*------------------------------ internal #includes ---------------------- */
523
/*------------------------------ internal #includes ---------------------- */
609
 
524
 
610
#ifdef WIN32
-
 
611
#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
-
 
612
#endif /* WIN32 */
-
 
613
 
-
 
614
#include <stdio.h>       /* for printing in malloc_stats */
525
#include <stdio.h>       /* for printing in malloc_stats */
-
 
526
#include <string.h>
615
 
527
 
616
#ifndef LACKS_ERRNO_H
528
#ifndef LACKS_ERRNO_H
617
#include <errno.h>       /* for MALLOC_FAILURE_ACTION */
529
#include <errno.h>       /* for MALLOC_FAILURE_ACTION */
618
#endif /* LACKS_ERRNO_H */
530
#endif /* LACKS_ERRNO_H */
619
#if FOOTERS
531
#if FOOTERS
Line 629... Line 541...
629
#include <assert.h>
541
#include <assert.h>
630
#endif /* ABORT_ON_ASSERT_FAILURE */
542
#endif /* ABORT_ON_ASSERT_FAILURE */
631
#else  /* DEBUG */
543
#else  /* DEBUG */
632
#define assert(x)
544
#define assert(x)
633
#endif /* DEBUG */
545
#endif /* DEBUG */
634
#ifndef LACKS_STRING_H
-
 
635
#include <string.h>      /* for memset etc */
-
 
636
#endif  /* LACKS_STRING_H */
-
 
637
#if USE_BUILTIN_FFS
546
#if USE_BUILTIN_FFS
638
#ifndef LACKS_STRINGS_H
547
#ifndef LACKS_STRINGS_H
639
#include <strings.h>     /* for ffs */
548
#include <strings.h>     /* for ffs */
640
#endif /* LACKS_STRINGS_H */
549
#endif /* LACKS_STRINGS_H */
641
#endif /* USE_BUILTIN_FFS */
550
#endif /* USE_BUILTIN_FFS */