|
|
1.1 root 1: /* (-lgl
2: * COHERENT Version 4.0
3: * Copyright (c) 1982, 1992 by Mark Williams Company.
4: * All rights reserved. May not be copied without permission.
5: -lgl) */
6: /*
7: * /usr/include/sys/malloc.h
8: * Header file for malloc.c, notmem.c, realloc.c.
9: */
10:
11: #ifndef MALLOC_H
12: #define MALLOC_H
13:
14: /* Manifest constants. */
15: /*
16: * N.B. 1<<ARENASIZE must be greater than sizeof(struct mblock)
17: * so that malloc.c/newarena() does not cause trouble when it combines arenas.
18: */
19: #if _I386
20: #define ARENASIZE 12 /* round arena sizes up to 1<<12==4096 */
21: #define BLOCKSIZE 2 /* round block sizes up to 1<<2==4 */
22: #else
23: #define ARENASIZE 11 /* round arena sizes up to 1<<11==2048 */
24: #define BLOCKSIZE 1 /* round block sizes up to 1<<1==2 */
25: #endif
26: #define ALIGNMENT (1<<BLOCKSIZE) /* maximum alignment for any data type */
27: #define BADSBRK ((char *)-1) /* sbrk() failure return value */
28: #define DECRSIZE 256 /* arena size decrement at end */
29: #define FREE 1 /* free block marker */
30: #define LEASTFREE (2*sizeof(unsigned)) /* free nothing smaller */
31:
32: /* Macros. */
33: #define bumpp(p,n) (((char *)(p))+(n)) /* bump pointer p by n bytes */
34: #define isfree(x) (((unsigned)(x))&FREE)
35: #define mblockp(p) ((char *)(p)-sizeof(unsigned)) /* convert malloc ptr */
36: #define realsize(x) ((x) & ~FREE)
37: #define roundup(i,j) (((i) + (1 << (j)) - 1) & ~((1 << (j)) - 1))
38:
39: /* Memory block structure. */
40: typedef struct mblock {
41: unsigned blksize;
42: union {
43: char *next;
44: unsigned usera[];
45: } uval;
46: } MBLOCK;
47:
48: /* Globals common to malloc/realloc/memok/notmem. */
49: extern unsigned __a_count;
50: extern MBLOCK *__a_scanp, *__a_first, *__a_top;
51:
52: #endif
53:
54: /* end of /usr/include/sys/malloc.h */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.