malloc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <limits.h>

Include dependency graph for malloc.c:

Go to the source code of this file.

Data Structures

union  _inf

Defines

#define ASSERT
#define CHECK
#define STORE
#define ALIGNMENT   8
#define LOG_MIN_SIZE   3
#define LOG_MAX_SIZE   24
#define MIN_SIZE   (1<<LOG_MIN_SIZE)
#define MAX_FLIST   (LOG_MAX_SIZE - LOG_MIN_SIZE)
#define align(n)   (((n) + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1))
#define MAL_NULL   ((mallink *)0)
#define OFF_SET   0
#define _log_prev_of(ml)   ((ml)[-1+OFF_SET]).ptr
#define _log_next_of(ml)   ((ml)[-2+OFF_SET]).ptr
#define _phys_prev_of(ml)   ((ml)[-3+OFF_SET]).ptr
#define _this_size_of(ml)   ((ml)[-4+OFF_SET]).ui
#define _checksum_of(ml)   ((ml)[-5+OFF_SET]).ui
#define _print_of(ml)   ((ml)[-6+OFF_SET]).ui
#define _mark_of(ml)   ((ml)[-7+OFF_SET]).ui
#define N_WORDS   7
#define mallink_size()
#define set_mark(ml, e)   (_mark_of(ml) = (e))
#define mark_of(ml)   (_mark_of(ml))
#define set_checksum(ml, e)   (_checksum_of(ml) = (e))
#define checksum_of(ml)   (_checksum_of(ml))
#define new_mallink(ml)
#define block_of_mallink(ml)   ((void *)ml)
#define mallink_of_block(addr)   ((mallink *)addr)
#define public   extern
#define publicdata   extern
#define private   static
#define privatedata   static
#define assert(b)   (!(b) ? m_assert(__FILE__, __LINE__) : 0)
#define in_store(ml)   ((size_type)_phys_prev_of(ml) & STORE_BIT)
#define set_store(ml, e)
#define set_log_prev(ml, e)   (_log_prev_of(ml) = (e))
#define log_prev_of(ml)   (mallink *) (_log_prev_of(ml))
#define set_log_next(ml, e)   (_log_next_of(ml) = (e))
#define log_next_of(ml)   (mallink *) (_log_next_of(ml))
#define FREE_BIT   01
#define STORE_BIT   02
#define BITS   (FREE_BIT|STORE_BIT)
#define __bits(ml)   ((int)((size_type)_phys_prev_of(ml) & BITS))
#define __free_of(ml)   ((int)((size_type)_phys_prev_of(ml) & FREE_BIT))
#define __phys_prev_of(ml)   ((mallink *)((size_type)_phys_prev_of(ml) & ~BITS))
#define prev_size_of(ml)
#define set_phys_prev(ml, e)   (_phys_prev_of(ml) = (mallink *) ((char *)e + __bits(ml)))
#define phys_prev_of(ml)
#define first_mallink(ml)   (int) (__phys_prev_of(ml) == 0)
#define last_mallink(ml)   (int) ((ml) == ml_last)
#define size_of(ml)   (_this_size_of(ml) - mallink_size())
#define set_phys_next(ml, e)   (_this_size_of(ml) = (size_type)((char *)(e) - (char *)(ml)))
#define phys_next_of(ml)   (mallink *) ((char *)(ml) + _this_size_of(ml))
#define set_free(ml, e)
#define free_of(ml)   (__free_of(ml))
#define coalesce_forw(ml, nxt)
#define coalesce_backw(ml, prv)
#define set_print(ml, e)   (_print_of(ml) = (e))
#define print_of(ml)   (_print_of(ml))
#define SBRK   _sbrk
#define ILL_BREAK   (void *)(-1)
#define MAX_STORE   32
#define GRABSIZE   4096
#define for_free_list(i, p)   for (p = free_list_entry(i); p; p = log_next_of(p))
#define for_all_mallinks(ml)
#define IN_ML_LAST   93
#define IN_FREE_LIST   57
#define CLEAR   21
#define VRIJ   1
#define BEZET   2
#define N_COLOUR   10

Typedefs

typedef unsigned int size_type
typedef _inf mallink

Functions

private m_assert (const char *fn, int ln)
private check_mallinks (const char *s)
private calc_checksum (mallink *ml)
private check_work_empty (const char *s)
private started_working_on (mallink *ml)
private stopped_working_on (mallink *ml)
private link_free_chunk (mallink *ml)
private unlink_free_chunk (mallink *ml)
private mallinkfirst_present (int class)
private mallinksearch_free_list (int class, size_t n)
private Error (const char *fmt, const char *s, mallink *ml)
private truncate (mallink *ml, size_t size)
private combine_chunks (register mallink *ml1, register mallink *ml2)
private mallinkcreate_chunk (void *p, size_t n)
void * SBRK (int incr)
private do_free (mallink *ml)
private sell_out (void)
void * malloc (register size_t n)
void free (void *addr)
private do_free (register mallink *ml)
void * realloc (void *addr, register size_t n)
void * calloc (size_t nmemb, size_t size)
private link_free_chunk (register mallink *ml)
private unlink_free_chunk (register mallink *ml)
private mallinkfree_list_entry (int i)
private truncate (register mallink *ml, size_t size)
private acquire_malout (void)
private check_ml_last (const char *s)
private dump_all_mallinks (void)
private dump_free_list (int i)
private dump_mallink (const char *s, mallink *ml)
private print_loop (mallink *ml)
private working_on (mallink *ml)
private size_type checksum (mallink *ml)
 maldump (int n)

Variables

privatedata mallinkml_last
privatedata mallinkstore [MAX_STORE]
void * privious_free = (void *)-1
privatedata mallinkfree_list [MAX_FLIST]
static FILEmalout
static int pr_cnt = 0
static mallinkoff_colour [N_COLOUR]


Define Documentation

#define __bits ml   )     ((int)((size_type)_phys_prev_of(ml) & BITS))
 

Definition at line 296 of file malloc.c.

#define __free_of ml   )     ((int)((size_type)_phys_prev_of(ml) & FREE_BIT))
 

Definition at line 297 of file malloc.c.

#define __phys_prev_of ml   )     ((mallink *)((size_type)_phys_prev_of(ml) & ~BITS))
 

Definition at line 298 of file malloc.c.

#define _checksum_of ml   )     ((ml)[-5+OFF_SET]).ui
 

Definition at line 166 of file malloc.c.

#define _log_next_of ml   )     ((ml)[-2+OFF_SET]).ptr
 

Definition at line 160 of file malloc.c.

Referenced by checksum(), and dump_mallink().

#define _log_prev_of ml   )     ((ml)[-1+OFF_SET]).ptr
 

Definition at line 159 of file malloc.c.

Referenced by checksum(), and dump_mallink().

#define _mark_of ml   )     ((ml)[-7+OFF_SET]).ui
 

Definition at line 168 of file malloc.c.

#define _phys_prev_of ml   )     ((ml)[-3+OFF_SET]).ptr
 

Definition at line 161 of file malloc.c.

#define _print_of ml   )     ((ml)[-6+OFF_SET]).ui
 

Definition at line 167 of file malloc.c.

#define _this_size_of ml   )     ((ml)[-4+OFF_SET]).ui
 

Definition at line 162 of file malloc.c.

Referenced by check_ml_last(), checksum(), and dump_mallink().

#define align n   )     (((n) + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1))
 

Definition at line 140 of file malloc.c.

#define ALIGNMENT   8
 

Definition at line 111 of file malloc.c.

#define assert b   )     (!(b) ? m_assert(__FILE__, __LINE__) : 0)
 

Definition at line 203 of file malloc.c.

Referenced by _new(), _pac(), _udp_recvfrom(), _udp_sendto(), _unp(), _wrf(), ack_emit_init(), ack_emit_instruction(), ack_get_statement(), ack_put_expression(), add_lookback_edge(), addpath(), allocate(), allocset(), another_hunk(), apply_hunk(), arp_getdata(), arp_init(), arp_ioctl(), arp_ip_eth(), arp_main(), arp_putdata(), arp_set_cb(), arp_timeout(), backref(), bas_get_statement(), bf_afree(), bf_align(), bf_append(), bf_bufsize(), bf_cut(), bf_delhead(), bf_memreq(), bf_pack(), bothcases(), cachec(), check_int_events(), check_ipaddrset(), clck_expire_timers(), clck_fast_release(), clck_timer(), compile(), conf_hw(), copy(), copy1(), create_chunk(), create_RST(), data_block(), def(), del_asm86(), del_expr(), delpath(), do_eth_read(), do_getstat(), do_ignore(), do_init(), do_reclist(), do_snd_event(), do_stop(), do_via_isabr(), do_vread(), do_vwrite(), doemit(), dofwd(), doinsert(), doit(), dp_check_ints(), dp_next_iovec(), dp_nic2user(), dp_pio16_getblock(), dp_pio16_nic2user(), dp_pio16_user2nic(), dp_pio8_nic2user(), dp_pio8_user2nic(), dp_user2nic(), dupl(), dz_update(), eeprom_read(), eth_arrive(), eth_cancel(), eth_close(), eth_get_stat(), eth_init(), eth_ioctl(), eth_loop_ev(), eth_read(), eth_rec(), eth_recvev(), eth_restart_write(), eth_sendev(), eth_set_rec_conf(), eth_write(), eth_write_port(), ev_enqueue(), ev_process(), evaluate(), explode(), extract_query(), find_conn_entry(), findmust(), firstch(), free(), free_accs(), free_tags(), fxp_check_ints(), fxp_getstat(), fxp_init(), fxp_init_buf(), fxp_readv(), fxp_writev(), get_eth_data(), get_list(), get_state(), get_time(), get_token(), getpos(), gnu_emit_init(), gnu_emit_instruction(), gnu_get_statement(), gnu_put_expression(), grow(), grow_hunkmax(), hash(), icmp_err_pack(), icmp_getdata(), icmp_init(), icmp_main(), icmp_write(), inf(), initkeys(), insert_empty_rule(), ip_arrived(), ip_arrived_broadcast(), ip_cancel(), ip_chk_hdropt(), ip_close(), ip_get_ifaddr(), ip_init(), ip_ioctl(), ip_packet2user(), ip_port_arrive(), ip_print_frags(), ip_process_loopb(), ip_read(), ip_send(), ip_split_pack(), ip_write(), ipeth_arp_reply(), ipeth_init(), ipeth_restart_send(), ipeth_send(), ipeth_update_ttl(), ipps_get(), ipps_put(), ipps_send(), ipr_destunrch(), ipr_gateway_down(), ipr_init(), ipr_mtu(), ipr_redirect(), ipr_ttl_exc(), job_read_udp(), link_free_chunk(), main(), make_bucket(), make_name(), make_pack(), makenames(), malloc(), map_goto(), mccase(), mcinvert(), mcsub(), merge_frags(), mii_read(), mq_free(), mq_get(), new_conn_for_queue(), nonnewline(), oroute_find_ent(), othercase(), p_bracket(), p_ere_exp(), p_simp_re(), pack_oneCsum(), pack_vector(), packet2user(), partcompress(), pci_ids(), pci_init(), pci_reserve3(), prin1(), proc_ind(), process_advanced_data(), process_arp_pkt(), process_data(), process_opt(), promisc_restart_read(), psip_cancel(), psip_close(), psip_enable(), psip_ioctl(), psip_open(), psip_read(), psip_send(), psip_write(), put_eth_data(), random_getbytes(), random_init(), read_int(), read_ip_packets(), realloc(), reassemble(), recompress(), record_bar(), recvfrom(), regerror(), regexec(), repeat(), reply_thr_get(), reply_thr_put(), restart_write_fd(), ret_to_continue(), rl_check_ints(), rl_getstat(), rl_init(), rl_readv(), rl_reset_hw(), rl_writev(), route_packets(), rtl_init(), scrollf(), set_control(), set_min_tim(), setup_read(), SHA256_End(), SHA256_Final(), SHA256_Update(), SHA384_End(), SHA384_Final(), SHA512_End(), SHA512_Final(), SHA512_Update(), shorten(), skip_to(), skip_token(), sr_add_minor(), sr_cancel(), sr_close(), sr_get_userdata(), sr_getchannel(), sr_put_userdata(), sr_rec(), sr_repl_queue(), sr_reply_(), sr_restart_ioctl(), sr_restart_read(), sr_restart_write(), sr_rwio(), sr_select(), step(), tcp_cancel(), tcp_check_conn(), tcp_close(), tcp_close_connection(), tcp_conn_write(), tcp_connect(), tcp_fd_read(), tcp_fd_write(), tcp_frag2conn(), tcp_get_data(), tcp_init(), tcp_ioctl(), tcp_listen(), tcp_main(), tcp_make_header(), tcp_mtu_incr(), tcp_port_write(), tcp_print_pack(), tcp_put_data(), tcp_read(), tcp_release_retrans(), tcp_reply_ioctl(), tcp_reply_read(), tcp_reply_write(), tcp_restart_connect(), tcp_select(), tcp_send_timeout(), tcp_set_send_timer(), tcp_setconf(), tcp_setopt(), tcp_setup_conn(), tcp_shutdown(), tcp_su4connect(), tcp_write(), tcpip_writeall(), udp_cancel(), udp_close(), udp_get_data(), udp_init(), udp_ioctl(), udp_ip_arrived(), udp_packet2user(), udp_peek(), udp_put_data(), udp_rd_enqueue(), udp_restart_write_port(), udp_select(), udp_setopt(), udp_write(), unlink_free_chunk(), w_transfer(), walk_queue(), we_init(), write_int(), writeall(), and writev().

#define ASSERT
 

Definition at line 77 of file malloc.c.

#define BEZET   2
 

Definition at line 1137 of file malloc.c.

Referenced by check_mallinks().

#define BITS   (FREE_BIT|STORE_BIT)
 

Definition at line 291 of file malloc.c.

Referenced by getcode(), set_uart(), and version().

#define block_of_mallink ml   )     ((void *)ml)
 

Definition at line 188 of file malloc.c.

Referenced by malloc().

#define CHECK
 

Definition at line 84 of file malloc.c.

Referenced by strstatus().

#define checksum_of ml   )     (_checksum_of(ml))
 

Definition at line 180 of file malloc.c.

Referenced by check_mallinks(), and dump_mallink().

#define CLEAR   21
 

Definition at line 1134 of file malloc.c.

Referenced by cl_block(), fast(), matcher(), and slow().

#define coalesce_backw ml,
prv   ) 
 

Value:

Definition at line 341 of file malloc.c.

Referenced by create_chunk(), and do_free().

#define coalesce_forw ml,
nxt   ) 
 

Value:

( unlink_free_chunk(nxt), \
                                  combine_chunks((ml), (nxt)))

Definition at line 338 of file malloc.c.

Referenced by do_free(), and truncate().

#define first_mallink ml   )     (int) (__phys_prev_of(ml) == 0)
 

Definition at line 317 of file malloc.c.

Referenced by check_mallinks(), and do_free().

#define for_all_mallinks ml   ) 
 

Value:

/* backwards! */ \
        for (ml = ml_last; ml; \
                ml = first_mallink(ml) ? MAL_NULL : phys_prev_of(ml))

Definition at line 1017 of file malloc.c.

Referenced by check_mallinks(), and dump_all_mallinks().

#define for_free_list i,
p   )     for (p = free_list_entry(i); p; p = log_next_of(p))
 

Definition at line 1014 of file malloc.c.

Referenced by check_mallinks(), and dump_free_list().

#define FREE_BIT   01
 

Definition at line 288 of file malloc.c.

#define free_of ml   )     (__free_of(ml))
 

Definition at line 336 of file malloc.c.

Referenced by check_mallinks(), checksum(), create_chunk(), do_free(), dump_mallink(), free(), realloc(), and truncate().

#define GRABSIZE   4096
 

Referenced by malloc().

#define ILL_BREAK   (void *)(-1)
 

Definition at line 384 of file malloc.c.

#define IN_FREE_LIST   57
 

Definition at line 1133 of file malloc.c.

Referenced by check_mallinks().

#define IN_ML_LAST   93
 

Definition at line 1132 of file malloc.c.

Referenced by check_mallinks().

#define in_store ml   )     ((size_type)_phys_prev_of(ml) & STORE_BIT)
 

Definition at line 258 of file malloc.c.

Referenced by free(), malloc(), and realloc().

#define last_mallink ml   )     (int) ((ml) == ml_last)
 

Definition at line 318 of file malloc.c.

Referenced by check_mallinks(), combine_chunks(), do_free(), realloc(), and truncate().

#define LOG_MAX_SIZE   24
 

Definition at line 114 of file malloc.c.

Referenced by calloc(), link_free_chunk(), malloc(), and unlink_free_chunk().

#define LOG_MIN_SIZE   3
 

Definition at line 113 of file malloc.c.

Referenced by free(), malloc(), and realloc().

#define log_next_of ml   )     (mallink *) (_log_next_of(ml))
 

Definition at line 268 of file malloc.c.

Referenced by first_present(), malloc(), realloc(), search_free_list(), sell_out(), and unlink_free_chunk().

#define log_prev_of ml   )     (mallink *) (_log_prev_of(ml))
 

Definition at line 265 of file malloc.c.

Referenced by unlink_free_chunk().

#define MAL_NULL   ((mallink *)0)
 

Definition at line 148 of file malloc.c.

Referenced by check_work_empty(), first_present(), link_free_chunk(), malloc(), search_free_list(), started_working_on(), and stopped_working_on().

#define mallink_of_block addr   )     ((mallink *)addr)
 

Definition at line 189 of file malloc.c.

Referenced by free(), and realloc().

 
#define mallink_size  ) 
 

Value:

(size_t) \
        align((N_WORDS - OFF_SET) * sizeof (mallink))

Definition at line 172 of file malloc.c.

Referenced by create_chunk(), malloc(), and realloc().

#define mark_of ml   )     (_mark_of(ml))
 

Definition at line 177 of file malloc.c.

Referenced by check_mallinks().

#define MAX_FLIST   (LOG_MAX_SIZE - LOG_MIN_SIZE)
 

Definition at line 133 of file malloc.c.

Referenced by check_mallinks(), first_present(), maldump(), and malloc().

#define MAX_STORE   32
 

Definition at line 388 of file malloc.c.

Referenced by free(), limits(), lookup(), malloc(), and sell_out().

#define MIN_SIZE   (1<<LOG_MIN_SIZE)
 

Definition at line 132 of file malloc.c.

Referenced by calloc(), check_mallinks(), do_free(), free(), link_free_chunk(), malloc(), realloc(), and unlink_free_chunk().

#define N_COLOUR   10
 

Definition at line 1230 of file malloc.c.

Referenced by check_work_empty(), started_working_on(), stopped_working_on(), and working_on().

#define N_WORDS   7
 

Definition at line 169 of file malloc.c.

#define new_mallink ml   ) 
 

Value:

( _log_prev_of(ml) = 0, \
                                  _log_next_of(ml) = 0, \
                                  _phys_prev_of(ml) = 0, \
                                  _this_size_of(ml) = 0 )

Definition at line 183 of file malloc.c.

Referenced by create_chunk(), and truncate().

#define OFF_SET   0
 

Definition at line 154 of file malloc.c.

Referenced by do_free().

#define phys_next_of ml   )     (mallink *) ((char *)(ml) + _this_size_of(ml))
 

Definition at line 330 of file malloc.c.

Referenced by check_mallinks(), combine_chunks(), create_chunk(), do_free(), realloc(), and truncate().

#define phys_prev_of ml   ) 
 

Value:

(mallink *) \
        (first_mallink(ml) ? \
                (char *)Error("phys_prev_of first_mallink %p", "somewhere", ml) : \
                (char *)__phys_prev_of(ml) \
        )

Definition at line 308 of file malloc.c.

Referenced by check_mallinks(), and do_free().

#define prev_size_of ml   ) 
 

Value:

((char *)(ml) - \
                                 (char *)__phys_prev_of(ml) - \
                                 mallink_size() \
                                )

Definition at line 299 of file malloc.c.

Referenced by checksum(), and dump_mallink().

#define print_of ml   )     (_print_of(ml))
 

Definition at line 348 of file malloc.c.

Referenced by print_loop().

#define private   static
 

Definition at line 194 of file malloc.c.

#define privatedata   static
 

Definition at line 195 of file malloc.c.

#define public   extern
 

Definition at line 191 of file malloc.c.

#define publicdata   extern
 

Definition at line 192 of file malloc.c.

#define SBRK   _sbrk
 

Definition at line 383 of file malloc.c.

Referenced by malloc().

#define set_checksum ml,
 )     (_checksum_of(ml) = (e))
 

Definition at line 179 of file malloc.c.

Referenced by calc_checksum().

#define set_free ml,
 ) 
 

Value:

(_phys_prev_of(ml) = (mallink *) \
                ((e) ? (size_type) _phys_prev_of(ml) | FREE_BIT : \
                       (size_type) _phys_prev_of(ml) & ~FREE_BIT))

Definition at line 332 of file malloc.c.

Referenced by create_chunk(), do_free(), malloc(), realloc(), and truncate().

#define set_log_next ml,
 )     (_log_next_of(ml) = (e))
 

Definition at line 267 of file malloc.c.

Referenced by free(), link_free_chunk(), realloc(), and unlink_free_chunk().

#define set_log_prev ml,
 )     (_log_prev_of(ml) = (e))
 

Definition at line 264 of file malloc.c.

Referenced by first_present(), link_free_chunk(), and unlink_free_chunk().

#define set_mark ml,
 )     (_mark_of(ml) = (e))
 

Definition at line 176 of file malloc.c.

Referenced by check_mallinks().

#define set_phys_next ml,
 )     (_this_size_of(ml) = (size_type)((char *)(e) - (char *)(ml)))
 

Definition at line 328 of file malloc.c.

Referenced by combine_chunks(), create_chunk(), and truncate().

#define set_phys_prev ml,
 )     (_phys_prev_of(ml) = (mallink *) ((char *)e + __bits(ml)))
 

Definition at line 303 of file malloc.c.

Referenced by combine_chunks(), create_chunk(), and truncate().

#define set_print ml,
 )     (_print_of(ml) = (e))
 

Definition at line 347 of file malloc.c.

Referenced by print_loop().

#define set_store ml,
 ) 
 

Value:

(_phys_prev_of(ml) = (mallink *) \
                ((e) ? (size_type) _phys_prev_of(ml) | STORE_BIT : \
                       (size_type) _phys_prev_of(ml) & ~STORE_BIT))

Definition at line 259 of file malloc.c.

Referenced by free(), malloc(), realloc(), and sell_out().

#define size_of ml   )     (_this_size_of(ml) - mallink_size())
 

Definition at line 327 of file malloc.c.

Referenced by create_chunk(), dump_mallink(), free(), link_free_chunk(), malloc(), realloc(), search_free_list(), and unlink_free_chunk().

#define STORE
 

Definition at line 102 of file malloc.c.

Referenced by main().

#define STORE_BIT   02
 

Definition at line 290 of file malloc.c.

#define VRIJ   1
 

Definition at line 1136 of file malloc.c.

Referenced by check_mallinks().


Typedef Documentation

typedef union _inf mallink
 

Definition at line 147 of file malloc.c.

typedef unsigned int size_type
 

Definition at line 44 of file malloc.c.


Function Documentation

private acquire_malout void   ) 
 

Definition at line 1055 of file malloc.c.

References BUFSIZ, freopen(), malout, setbuf(), and stderr.

Referenced by dump_mallink(), Error(), and maldump().

private calc_checksum mallink ml  ) 
 

Definition at line 1226 of file malloc.c.

References checksum(), and set_checksum.

Referenced by combine_chunks(), create_chunk(), do_free(), first_present(), free(), link_free_chunk(), malloc(), realloc(), truncate(), and unlink_free_chunk().

void* calloc size_t  nmemb,
size_t  size
 

Definition at line 687 of file malloc.c.

References align, check_mallinks(), check_work_empty(), L, LOG_MAX_SIZE, malloc(), MIN_SIZE, n, NULL, printf, and ULONG_MAX.

Referenced by atdir_start(), chballoc(), dev_start(), dosrch(), ftime_start(), getln(), gidtb_start(), grp_add(), grptb_start(), lnk_start(), main(), makenew(), name_start(), newwin(), set_scr(), uidtb_start(), usr_add(), usrtb_start(), and zcalloc().

private check_mallinks const char *  s  ) 
 

Definition at line 1140 of file malloc.c.

References BEZET, check_ml_last(), checksum(), checksum_of, Error, first_mallink, for_all_mallinks, for_free_list, free_of, i, IN_FREE_LIST, IN_ML_LAST, last_mallink, mark_of, MAX_FLIST, MIN_SIZE, phys_next_of, phys_prev_of, set_mark, size, VRIJ, and working_on().

Referenced by calloc(), create_chunk(), free(), malloc(), realloc(), and truncate().

private check_ml_last const char *  s  ) 
 

Definition at line 1207 of file malloc.c.

References _this_size_of, Error, and ml_last.

Referenced by check_mallinks().

private check_work_empty const char *  s  ) 
 

Definition at line 1268 of file malloc.c.

References cnt, Error, i, MAL_NULL, N_COLOUR, and off_colour.

Referenced by calloc(), do_free(), malloc(), and realloc().

private size_type checksum mallink ml  ) 
 

Definition at line 1213 of file malloc.c.

References _log_next_of, _log_prev_of, _this_size_of, free_of, prev_size_of, and sum().

Referenced by calc_checksum(), check_mallinks(), dump_mallink(), el3_checksum(), get_header(), wcgetsec(), and wcputsec().

private combine_chunks register mallink ml1,
register mallink ml2
 

Definition at line 972 of file malloc.c.

References calc_checksum(), last_mallink, ml_last, phys_next_of, set_phys_next, and set_phys_prev.

Referenced by realloc().

private mallink * create_chunk void *  p,
size_t  n
 

Definition at line 907 of file malloc.c.

References assert, calc_checksum(), check_mallinks(), coalesce_backw, free_of, mallink_size, ml_last, new_mallink, phys_next_of, set_free, set_phys_next, set_phys_prev, size_of, and started_working_on().

Referenced by malloc().

private do_free register mallink ml  ) 
 

Definition at line 558 of file malloc.c.

References calc_checksum(), check_work_empty(), coalesce_backw, coalesce_forw, first_mallink, free_of, last_mallink, link_free_chunk(), MIN_SIZE, next, OFF_SET, phys_next_of, phys_prev_of, set_free, started_working_on(), and stopped_working_on().

private do_free mallink ml  ) 
 

Referenced by free(), and sell_out().

private dump_all_mallinks void   ) 
 

Definition at line 1065 of file malloc.c.

References dump_mallink(), for_all_mallinks, and print_loop().

Referenced by maldump().

private dump_free_list int  i  ) 
 

Definition at line 1076 of file malloc.c.

References for_free_list, fprintf(), free_list_entry(), malout, and print_loop().

Referenced by maldump().

private dump_mallink const char *  s,
mallink ml
 

Definition at line 1101 of file malloc.c.

References _log_next_of, _log_prev_of, _this_size_of, acquire_malout(), checksum(), checksum_of, fprintf(), free_of, malout, prev_size_of, and size_of.

Referenced by dump_all_mallinks().

private int Error const char *  fmt,
const char *  s,
mallink ml
 

Definition at line 1280 of file malloc.c.

References acquire_malout(), fflush(), fprintf(), maldump(), malout, printf, setbuf(), and stdout.

private mallink * first_present int  class  ) 
 

Definition at line 853 of file malloc.c.

References calc_checksum(), free_list, log_next_of, MAL_NULL, MAX_FLIST, and set_log_prev.

Referenced by malloc().

void free void *  addr  ) 
 

Definition at line 524 of file malloc.c.

References abort(), calc_checksum(), check_mallinks(), do_free(), fflush(), free_of, in_store, LOG_MIN_SIZE, mallink_of_block, MAX_STORE, MIN_SIZE, NULL, printf, privious_free, set_log_next, set_store, size_of, stderr, stdout, and store.

private mallink * free_list_entry int  i  ) 
 

Definition at line 881 of file malloc.c.

References free_list.

Referenced by dump_free_list().

private link_free_chunk register mallink ml  ) 
 

Definition at line 775 of file malloc.c.

References assert, calc_checksum(), free_list, L, LOG_MAX_SIZE, MAL_NULL, MIN_SIZE, n, set_log_next, set_log_prev, and size_of.

private link_free_chunk mallink ml  ) 
 

Referenced by do_free(), and truncate().

private m_assert const char *  fn,
int  ln
 

Definition at line 740 of file malloc.c.

References maldump(), and write.

maldump int  n  ) 
 

Definition at line 1025 of file malloc.c.

References abort(), acquire_malout(), dump_all_mallinks(), dump_free_list(), fclose(), fprintf(), i, malout, MAX_FLIST, ml_last, and pr_cnt.

Referenced by Error(), and m_assert().

void* malloc register size_t  n  ) 
 

Definition at line 395 of file malloc.c.

References align, assert, block_of_mallink, calc_checksum(), check_mallinks(), check_work_empty(), create_chunk(), first_present(), GRABSIZE, ILL_BREAK, in_store, L, LOG_MAX_SIZE, LOG_MIN_SIZE, log_next_of, MAL_NULL, mallink_size, MAX_FLIST, MAX_STORE, MIN_SIZE, ml_last, NULL, p, printf, privious_free, SBRK, search_free_list(), sell_out(), set_free, set_store, size_of, started_working_on(), stopped_working_on(), store, tmp, truncate, and unlink_free_chunk().

private int print_loop mallink ml  ) 
 

Definition at line 1091 of file malloc.c.

References fprintf(), malout, pr_cnt, print_of, and set_print.

Referenced by dump_all_mallinks(), and dump_free_list().

void* realloc void *  addr,
register size_t  n
 

Definition at line 607 of file malloc.c.

References align, assert, calc_checksum(), check_mallinks(), check_work_empty(), combine_chunks(), free, free_of, in_store, last_mallink, LOG_MIN_SIZE, log_next_of, mallink_of_block, mallink_size, malloc(), MIN_SIZE, NULL, phys_next_of, printf, set_free, set_log_next, set_store, size, size_of, started_working_on(), stopped_working_on(), store, truncate, and unlink_free_chunk().

Referenced by addpath(), addpoint(), allocate(), allocset(), build_index(), ckrealloc(), delete_all(), enlarge(), fgetln(), get_line(), getcap(), gettynames(), grow_hunkmax(), growDirCache(), main(), maketree(), map_nocase(), mcadd(), mcsub(), newname(), pr_comment(), putenv(), readline(), reallocate(), reallocf(), show_all(), stripsnug(), strrealloc(), tar_options(), and xrealloc().

void* SBRK int  incr  ) 
 

private mallink * search_free_list int  class,
size_t  n
 

Definition at line 838 of file malloc.c.

References free_list, log_next_of, MAL_NULL, and size_of.

Referenced by malloc().

private sell_out void   ) 
 

Definition at line 719 of file malloc.c.

References do_free(), log_next_of, MAX_STORE, set_store, and store.

Referenced by malloc().

private started_working_on mallink ml  ) 
 

Definition at line 1234 of file malloc.c.

References i, MAL_NULL, N_COLOUR, and off_colour.

Referenced by create_chunk(), do_free(), malloc(), realloc(), and truncate().

private stopped_working_on mallink ml  ) 
 

Definition at line 1246 of file malloc.c.

References i, MAL_NULL, N_COLOUR, and off_colour.

Referenced by do_free(), malloc(), realloc(), and truncate().

private truncate register mallink ml,
size_t  size
 

Definition at line 942 of file malloc.c.

References calc_checksum(), check_mallinks(), coalesce_forw, free_of, last_mallink, link_free_chunk(), ml_last, new_mallink, phys_next_of, set_free, set_phys_next, set_phys_prev, started_working_on(), and stopped_working_on().

private truncate mallink ml,
size_t  size
 

private unlink_free_chunk register mallink ml  ) 
 

Definition at line 806 of file malloc.c.

References assert, calc_checksum(), free_list, L, LOG_MAX_SIZE, log_next_of, log_prev_of, MIN_SIZE, n, next, set_log_next, set_log_prev, and size_of.

private unlink_free_chunk mallink ml  ) 
 

Referenced by malloc(), and realloc().

private int working_on mallink ml  ) 
 

Definition at line 1258 of file malloc.c.

References i, N_COLOUR, and off_colour.

Referenced by check_mallinks().


Variable Documentation

privatedata mallink* free_list[MAX_FLIST]
 

Definition at line 772 of file malloc.c.

Referenced by first_present(), free_list_entry(), link_free_chunk(), search_free_list(), and unlink_free_chunk().

FILE* malout [static]
 

Definition at line 1010 of file malloc.c.

Referenced by acquire_malout(), dump_free_list(), dump_mallink(), Error(), maldump(), and print_loop().

privatedata mallink* ml_last
 

Definition at line 286 of file malloc.c.

Referenced by check_ml_last(), combine_chunks(), create_chunk(), maldump(), malloc(), and truncate().

mallink* off_colour[N_COLOUR] [static]
 

Definition at line 1231 of file malloc.c.

Referenced by check_work_empty(), started_working_on(), stopped_working_on(), and working_on().

int pr_cnt = 0 [static]
 

Definition at line 1023 of file malloc.c.

Referenced by maldump(), and print_loop().

void* privious_free = (void *)-1
 

Definition at line 393 of file malloc.c.

Referenced by free(), and malloc().

privatedata mallink* store[MAX_STORE]
 

Definition at line 390 of file malloc.c.

Referenced by data_store_dmp(), free(), malloc(), realloc(), and sell_out().


Generated on Fri Apr 14 22:59:10 2006 for minix by  doxygen 1.4.6