summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1994-10-04 06:51:42 +0000
committerphk <phk@FreeBSD.org>1994-10-04 06:51:42 +0000
commitddf9ae441960dcf931d0ab91aa12ff5fcb741433 (patch)
tree3960ed549d2e8a38b0297a3cb4688558637da7df
parent094a6feedc9c9beeaa55745a0434c55bacd5f61d (diff)
downloadFreeBSD-src-ddf9ae441960dcf931d0ab91aa12ff5fcb741433.zip
FreeBSD-src-ddf9ae441960dcf931d0ab91aa12ff5fcb741433.tar.gz
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!)
-rw-r--r--sys/kern/imgact_gzip.c19
-rw-r--r--sys/sys/malloc.h6
2 files changed, 17 insertions, 8 deletions
diff --git a/sys/kern/imgact_gzip.c b/sys/kern/imgact_gzip.c
index 3c24a214..8b425a1 100644
--- a/sys/kern/imgact_gzip.c
+++ b/sys/kern/imgact_gzip.c
@@ -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
diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h
index 3d190ed..f9a1597 100644
--- a/sys/sys/malloc.h
+++ b/sys/sys/malloc.h
@@ -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 {
OpenPOWER on IntegriCloud