Changeset 936351c1 in mainline for libc/malloc/malloc.c


Ignore:
Timestamp:
2006-03-14T23:48:33Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d73942c
Parents:
4f34b6a
Message:

Completed asynchronous IPC.
Fixed sbrk.
Cleared some unnecessary defines in malloc.
Changed u8 * to char * in list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libc/malloc/malloc.c

    r4f34b6a r936351c1  
    439439*/
    440440
    441 #ifndef WIN32
    442 #ifdef _WIN32
    443 #define WIN32 1
    444 #endif  /* _WIN32 */
    445 #endif  /* WIN32 */
    446 #ifdef WIN32
    447 #define WIN32_LEAN_AND_MEAN
    448 #include <windows.h>
    449 #define HAVE_MMAP 1
    450 #define HAVE_MORECORE 0
    451 #define LACKS_UNISTD_H
     441#include <sys/types.h>  /* For size_t */
     442
     443/** Non-default helenos customizations */
     444#define LACKS_FCNTL_H
     445#define LACKS_SYS_MMAN_H
    452446#define LACKS_SYS_PARAM_H
    453 #define LACKS_SYS_MMAN_H
    454 #define LACKS_STRING_H
    455 #define LACKS_STRINGS_H
    456 #define LACKS_SYS_TYPES_H
     447#undef HAVE_MMAP
     448#define HAVE_MMAP 0
    457449#define LACKS_ERRNO_H
     450/* Set errno? */
     451#undef MALLOC_FAILURE_ACTION
    458452#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 */
    473453
    474454/* The maximum possible size_t value has all bits set */
    475455#define MAX_SIZE_T           (~(size_t)0)
    476456
    477 #ifndef ONLY_MSPACES
    478457#define ONLY_MSPACES 0
    479 #endif  /* ONLY_MSPACES */
    480 #ifndef MSPACES
    481 #if ONLY_MSPACES
    482 #define MSPACES 1
    483 #else   /* ONLY_MSPACES */
    484458#define MSPACES 0
    485 #endif  /* ONLY_MSPACES */
    486 #endif  /* MSPACES */
    487 #ifndef MALLOC_ALIGNMENT
    488459#define MALLOC_ALIGNMENT ((size_t)8U)
    489 #endif  /* MALLOC_ALIGNMENT */
    490 #ifndef FOOTERS
    491460#define FOOTERS 0
    492 #endif  /* FOOTERS */
    493 #ifndef ABORT
    494461#define ABORT  abort()
    495 #endif  /* ABORT */
    496 #ifndef ABORT_ON_ASSERT_FAILURE
    497462#define ABORT_ON_ASSERT_FAILURE 1
    498 #endif  /* ABORT_ON_ASSERT_FAILURE */
    499 #ifndef PROCEED_ON_ERROR
    500463#define PROCEED_ON_ERROR 0
    501 #endif  /* PROCEED_ON_ERROR */
    502 #ifndef USE_LOCKS
    503464#define USE_LOCKS 0
    504 #endif  /* USE_LOCKS */
    505 #ifndef INSECURE
    506465#define INSECURE 0
    507 #endif  /* INSECURE */
    508 #ifndef HAVE_MMAP
    509 #define HAVE_MMAP 1
    510 #endif  /* HAVE_MMAP */
    511 #ifndef MMAP_CLEARS
     466#define HAVE_MMAP 0
     467
    512468#define MMAP_CLEARS 1
    513 #endif  /* MMAP_CLEARS */
    514 #ifndef HAVE_MREMAP
    515 #ifdef linux
    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 */
     469
    528470#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
     471#define MORECORE_CONTIGUOUS 1
    535472#define MORECORE sbrk
    536 #endif  /* MORECORE */
    537 #ifndef MORECORE_CONTIGUOUS
    538 #define MORECORE_CONTIGUOUS 1
    539 #endif  /* MORECORE_CONTIGUOUS */
    540 #endif  /* HAVE_MORECORE */
    541 #ifndef DEFAULT_GRANULARITY
    542 #if MORECORE_CONTIGUOUS
    543473#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
    548475#ifndef DEFAULT_TRIM_THRESHOLD
    549476#ifndef MORECORE_CANNOT_TRIM
     
    584511#define M_MMAP_THRESHOLD     (-3)
    585512
    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 
    598513/*
    599514  ========================================================================
     
    608523/*------------------------------ internal #includes ---------------------- */
    609524
    610 #ifdef WIN32
    611 #pragma warning( disable : 4146 ) /* no "unsigned" warnings */
    612 #endif /* WIN32 */
    613 
    614525#include <stdio.h>       /* for printing in malloc_stats */
     526#include <string.h>
    615527
    616528#ifndef LACKS_ERRNO_H
     
    632544#define assert(x)
    633545#endif /* DEBUG */
    634 #ifndef LACKS_STRING_H
    635 #include <string.h>      /* for memset etc */
    636 #endif  /* LACKS_STRING_H */
    637546#if USE_BUILTIN_FFS
    638547#ifndef LACKS_STRINGS_H
Note: See TracChangeset for help on using the changeset viewer.