Ignore:
Timestamp:
Jun 18, 2009, 11:53:26 AM (16 years ago)
Author:
ydario
Message:

Kernel32 updates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/heapshared.cpp

    r9667 r21302  
    1717#define INCL_BASE
    1818#define INCL_DOSMEMMGR
     19#define INCL_DOSPROCESS
    1920#include <os2wrap.h>
    2021#include <string.h>
    2122#include <dbglog.h>
    22 #include <heapshared.h>
     23#include <stddef.h>
     24#include <stdlib.h>
     25#include <umalloc.h>
    2326#include "initterm.h"
     27
     28#define PAGE_SIZE               4096
    2429
    2530#define DBG_LOCALLOG    DBG_heapshared
     
    102107//******************************************************************************
    103108//******************************************************************************
     109#ifdef DEBUG
     110int _LNK_CONV callback_function(const void *pentry, size_t sz, int useflag, int status,
     111                                const char *filename, size_t line)
     112{
     113    if (_HEAPOK != status) {
     114       dprintf(("status is not _HEAPOK."));
     115       return 1;
     116    }
     117    if (_USEDENTRY == useflag && sz && filename && line) {
     118         dprintf(("allocated  %08x %u at %s %d\n", pentry, sz, filename, line));
     119    }
     120    else dprintf(("allocated  %08x %u", pentry, sz));
     121
     122    return 0;
     123}
     124#endif
     125//******************************************************************************
     126//******************************************************************************
    104127void SYSTEM DestroySharedHeap()
    105128{
     
    108131        return;
    109132    }
     133
     134#ifdef DEBUG
     135    _uheap_walk(sharedHeap, callback_function);
     136    dprintf((NULL));
     137#endif
     138
    110139    if(--refCount == 0) {
    111140            if(sharedHeap) {
     
    200229
    201230    chunk = _umalloc(sharedHeap, size);
    202     dprintf2(("_smalloc %x returned %x", size, chunk));
     231    dprintf(("_smalloc %x returned %x", size, chunk));
    203232    return chunk;
    204233}
     
    213242        memset(chunk, 0, size);
    214243    }
    215     dprintf2(("_smallocfill %x %x returned %x", size, filler, chunk));
    216     return chunk;
    217 }
    218 //******************************************************************************
    219 //******************************************************************************
     244    dprintf(("_smallocfill %x %x returned %x", size, filler, chunk));
     245    return chunk;
     246}
     247//******************************************************************************
     248//******************************************************************************
     249void SYSTEM _sfree(void *block)
     250{
     251    dprintf(("_sfree %x", block));
     252    free(block);
     253}
     254//******************************************************************************
     255//******************************************************************************
     256void * _System _debug_smalloc(int size, char *pszFile, int linenr)
     257{
     258    void *chunk;
     259
     260#ifdef __DEBUG_ALLOC__
     261    chunk = _debug_umalloc(sharedHeap, size, pszFile, linenr);
     262#else
     263    chunk = _umalloc(sharedHeap, size);
     264#endif
     265    dprintf(("_smalloc %x returned %x", size, chunk));
     266    return chunk;
     267}
     268//******************************************************************************
     269//******************************************************************************
     270void * _System _debug_smallocfill(int size, int filler, char *pszFile, int linenr)
     271{
     272    void *chunk;
     273
     274#ifdef __DEBUG_ALLOC__
     275    chunk =  _debug_umalloc(sharedHeap, size, pszFile, linenr);
     276#else
     277    chunk =  _umalloc(sharedHeap, size);
     278#endif
     279    if(chunk) {
     280        memset(chunk, 0, size);
     281    }
     282    dprintf(("_smallocfill %x %x returned %x", size, filler, chunk));
     283    return chunk;
     284}
     285//******************************************************************************
     286//******************************************************************************
     287void   _System _debug_sfree(void *chunk, char *pszFile, int linenr)
     288{
     289    dprintf(("_sfree %x", chunk));
     290#ifdef __DEBUG_ALLOC__
     291    _debug_free(chunk, pszFile, linenr);
     292#else
     293    free(chunk);
     294#endif
     295}
     296//******************************************************************************
     297//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.