Added M_GZIP for the imgact_gzip code. The gzip-code is likely to be used

for other weird things in the future (hint, hint!)
This commit is contained in:
phk 1994-10-04 06:51:42 +00:00
parent 3c614494a4
commit 3ddce63bb7
2 changed files with 17 additions and 8 deletions

View File

@ -7,7 +7,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: imgact_gzip.c,v 1.2 1994/10/03 23:14:48 phk Exp $
* $Id: imgact_gzip.c,v 1.3 1994/10/04 03:09:13 phk Exp $
*
* This module handles execution of a.out files which have been run through
* "gzip -9".
@ -53,7 +53,7 @@ struct gzip {
int idx;
u_long virtual_offset, file_offset, file_end, bss_size;
unsigned gz_wp;
u_char gz_slide[WSIZE];
u_char *gz_slide;
};
int inflate __P((struct gzip *));
@ -86,11 +86,17 @@ exec_gzip_imgact(iparams)
/* 4-7 Timestamp */
/* 8 Extra flags */
gz = malloc(sizeof *gz,M_TEMP,M_NOWAIT);
gz = malloc(sizeof *gz,M_GZIP,M_NOWAIT);
if (!gz)
return ENOMEM;
bzero(gz,sizeof *gz); /* waste of time ? */
gz->gz_slide = malloc(WSIZE,M_TEMP,M_NOWAIT);
if (!gz->gz_slide) {
free(gz,M_GZIP);
return ENOMEM;
}
gz->ip = iparams;
gz->error = ENOEXEC;
gz->idx = 10;
@ -136,7 +142,8 @@ exec_gzip_imgact(iparams)
done:
error = gz->error;
free(gz,M_TEMP);
free(gz->gz_slide,M_TEMP);
free(gz,M_GZIP);
return error;
}
@ -399,7 +406,7 @@ static
void *
myalloc(u_long size)
{
return malloc(size, M_TEMP, M_NOWAIT);
return malloc(size, M_GZIP, M_NOWAIT);
}
#define malloc myalloc
@ -407,7 +414,7 @@ static
void
myfree(void * ptr)
{
free(ptr,M_TEMP);
free(ptr,M_GZIP);
}
#define free myfree

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)malloc.h 8.3 (Berkeley) 1/12/94
* $Id: malloc.h,v 1.3 1994/08/02 07:53:10 davidg Exp $
* $Id: malloc.h,v 1.4 1994/09/19 15:41:55 dfr Exp $
*/
#ifndef _SYS_MALLOC_H_
@ -112,7 +112,8 @@
#define M_MSDOSFSFAT 61 /* MSDOSFS file allocation table */
#define M_TEMP 74 /* misc temporary data buffers */
#define M_TTYS 75 /* tty data structures */
#define M_LAST 76 /* Must be last type + 1 */
#define M_GZIP 76 /* tty data structures */
#define M_LAST 77 /* Must be last type + 1 */
#define INITKMEMNAMES { \
"free", /* 0 M_FREE */ \
@ -182,6 +183,7 @@
NULL, NULL, \
"temp", /* 74 M_TEMP */ \
"ttys", /* 75 M_TTYS */ \
"Gzip trees", /* 76 M_GZIP */ \
}
struct kmemstats {