partition_init.c 796 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * partition_init.c
  3. */
  4. #include <stdlib.h>
  5. #include <assert.h>
  6. #include "private.h"
  7. /*-------------------------------------------------------- */
  8. void lub_partition_kill(lub_partition_t * this)
  9. {
  10. this->m_dying = BOOL_TRUE;
  11. /* try and die immediately... */
  12. lub_partition_time_to_die(this);
  13. }
  14. /*-------------------------------------------------------- */
  15. void
  16. lub_partition_init(lub_partition_t * this, const lub_partition_spec_t * spec)
  17. {
  18. this->m_spec = *spec;
  19. if (!this->m_spec.sysalloc) {
  20. this->m_spec.sysalloc = malloc;
  21. }
  22. this->m_partition_ceiling =
  23. spec->memory_limit ? (spec->memory_limit -
  24. sizeof(lub_partition_t)) : -1;
  25. this->m_dying = BOOL_FALSE;
  26. this->m_global_heap = 0; /* do this on demand */
  27. }
  28. /*-------------------------------------------------------- */