Changeset 268


Ignore:
Timestamp:
Dec 9, 2002, 5:08:57 PM (18 years ago)
Author:
pooh
Message:
  • Bug fixes.
  • Added a method get_start_addr().
Location:
to-imperative/trunk/libp++
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/libp++/pxx_heap.cc

    r264 r268  
    3535  size_t const _max_size /* = 0 */, // Maximum size, not limited by default
    3636  void* const _start /* = null */,
    37   int _fd /* = 0 */
     37  int _fd /* = -1 */
    3838) throw (SysError) :
    3939  start_addr (_start),
     
    6262    mmap(start_addr, current_size, PROT_READ | PROT_WRITE, mmap_flags, fd, 0);
    6363  if (res == MAP_FAILED) throw_sys_error(errno);
     64  start_addr = res;
    6465}
    6566
     
    8182  cur_size_log += _order;
    8283  current_size = new_size;
    83   if (fd != 0) {
     84  if (fd != -1) {
    8485    int res = ftruncate(fd, current_size);
    8586    if (res != 0) throw_sys_error(errno);
  • to-imperative/trunk/libp++/pxx_heap.hh

    r266 r268  
    3535{
    3636
    37 private:
     37protected:
    3838  //
    3939  // Heap start address, if zero then address will be chosen by mmap()
    40   void* const start_addr ;
     40  void* start_addr ;
    4141  //
    4242  // Maximum heap size, if zero then heap may grow without limits
     
    6565    size_t const _max_size = 0, // Maximum size, not limited by default
    6666    void* const _start = null,
    67     int _fd = 0
     67    int _fd = -1
    6868  ) throw (SysError) ;
    6969  //
     
    7373  // Expand a heap
    7474  void expand (unsigned _order = 1) throw (SysError) ;
     75  //
     76  // Get heap start address
     77  inline void* get_start_addr () const ;
    7578
    7679};
  • to-imperative/trunk/libp++/pxx_heap.ih

    r264 r268  
    2626#include "pxx_heap.hh"
    2727
    28 //
    29 // This file is empty due to absence of inline methods in the class Heap.
     28namespace pxx
     29{
     30
     31inline void* Heap::get_start_addr () const
     32{
     33  return start_addr ;
     34}
     35
     36}
    3037
    3138#endif // __pxx_heap_ih__
Note: See TracChangeset for help on using the changeset viewer.