Fixed staticization. buckets[] was staticized but was still declared
extern in <sys/malloc.h> and it should not have been staticized for the !(KMEMSTATS || DIAGNOSTIC) case. Fixed the !(KMEMSTATS || DIAGNOSTIC) case. The MALLOC() and FREE() macros are evil, but code generally doesn't allow for this and some code involving else clauses did not compile. Finished staticization.
This commit is contained in:
parent
514ede0953
commit
043a2f3b8b
@ -31,7 +31,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
|
* @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
|
||||||
* $Id: kern_malloc.c,v 1.28 1997/08/05 00:01:23 dyson Exp $
|
* $Id: kern_malloc.c,v 1.29 1997/09/02 20:05:39 bde Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -52,11 +52,22 @@
|
|||||||
static void kmeminit __P((void *));
|
static void kmeminit __P((void *));
|
||||||
SYSINIT(kmem, SI_SUB_KMEM, SI_ORDER_FIRST, kmeminit, NULL)
|
SYSINIT(kmem, SI_SUB_KMEM, SI_ORDER_FIRST, kmeminit, NULL)
|
||||||
|
|
||||||
static struct kmembuckets bucket[MINBUCKET + 16];
|
#if defined(KMEMSTATS) || defined(DIAGNOSTIC)
|
||||||
struct kmemstats kmemstats[M_LAST];
|
#define MAYBE_STATIC static
|
||||||
struct kmemusage *kmemusage;
|
#else
|
||||||
char *kmembase, *kmemlimit;
|
#define MAYBE_STATIC
|
||||||
char *memname[] = INITKMEMNAMES;
|
#endif
|
||||||
|
|
||||||
|
MAYBE_STATIC struct kmembuckets bucket[MINBUCKET + 16];
|
||||||
|
#ifdef KMEMSTATS
|
||||||
|
static struct kmemstats kmemstats[M_LAST];
|
||||||
|
#endif
|
||||||
|
MAYBE_STATIC struct kmemusage *kmemusage;
|
||||||
|
MAYBE_STATIC char *kmembase;
|
||||||
|
static char *kmemlimit;
|
||||||
|
#if defined(KMEMSTATS) || defined(DIAGNOSTIC)
|
||||||
|
static char *memname[] = INITKMEMNAMES;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DIAGNOSTIC
|
#ifdef DIAGNOSTIC
|
||||||
/*
|
/*
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)malloc.h 8.5 (Berkeley) 5/3/95
|
* @(#)malloc.h 8.5 (Berkeley) 5/3/95
|
||||||
* $Id: malloc.h,v 1.22 1997/08/05 00:01:43 dyson Exp $
|
* $Id: malloc.h,v 1.23 1997/08/16 19:16:10 wollman Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SYS_MALLOC_H_
|
#ifndef _SYS_MALLOC_H_
|
||||||
@ -322,7 +322,7 @@ struct kmembuckets {
|
|||||||
#define FREE(addr, type) free((addr), type)
|
#define FREE(addr, type) free((addr), type)
|
||||||
|
|
||||||
#else /* do not collect statistics */
|
#else /* do not collect statistics */
|
||||||
#define MALLOC(space, cast, size, type, flags) { \
|
#define MALLOC(space, cast, size, type, flags) do { \
|
||||||
register struct kmembuckets *kbp = &bucket[BUCKETINDX(size)]; \
|
register struct kmembuckets *kbp = &bucket[BUCKETINDX(size)]; \
|
||||||
long s = splimp(); \
|
long s = splimp(); \
|
||||||
if (kbp->kb_next == NULL) { \
|
if (kbp->kb_next == NULL) { \
|
||||||
@ -332,9 +332,9 @@ struct kmembuckets {
|
|||||||
kbp->kb_next = *(caddr_t *)(space); \
|
kbp->kb_next = *(caddr_t *)(space); \
|
||||||
} \
|
} \
|
||||||
splx(s); \
|
splx(s); \
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
#define FREE(addr, type) { \
|
#define FREE(addr, type) do { \
|
||||||
register struct kmembuckets *kbp; \
|
register struct kmembuckets *kbp; \
|
||||||
register struct kmemusage *kup = btokup(addr); \
|
register struct kmemusage *kup = btokup(addr); \
|
||||||
long s = splimp(); \
|
long s = splimp(); \
|
||||||
@ -350,13 +350,12 @@ struct kmembuckets {
|
|||||||
kbp->kb_last = (caddr_t)(addr); \
|
kbp->kb_last = (caddr_t)(addr); \
|
||||||
} \
|
} \
|
||||||
splx(s); \
|
splx(s); \
|
||||||
}
|
} while (0)
|
||||||
#endif /* do not collect statistics */
|
|
||||||
|
|
||||||
extern struct kmemstats kmemstats[];
|
|
||||||
extern struct kmemusage *kmemusage;
|
extern struct kmemusage *kmemusage;
|
||||||
extern char *kmembase;
|
extern char *kmembase;
|
||||||
extern struct kmembuckets bucket[];
|
extern struct kmembuckets bucket[];
|
||||||
|
#endif /* do not collect statistics */
|
||||||
|
|
||||||
void *contigmalloc __P((unsigned long size, int type, int flags,
|
void *contigmalloc __P((unsigned long size, int type, int flags,
|
||||||
unsigned long low, unsigned long high,
|
unsigned long low, unsigned long high,
|
||||||
|
Loading…
Reference in New Issue
Block a user