inflate.h revision 3417
13417Scsgr/* 23417Scsgr * Parts of this file are not covered by: 33417Scsgr * ---------------------------------------------------------------------------- 43417Scsgr * "THE BEER-WARE LICENSE" (Revision 42): 53417Scsgr * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you 63417Scsgr * can do whatever you want with this stuff. If we meet some day, and you think 73417Scsgr * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 83417Scsgr * ---------------------------------------------------------------------------- 93417Scsgr * 103417Scsgr * $Id: imgact_gzip.c,v 1.4 1994/10/04 06:51:42 phk Exp $ 113417Scsgr * 123417Scsgr * This module handles execution of a.out files which have been run through 133417Scsgr * "gzip -9". 143417Scsgr * 153417Scsgr * For now you need to use exactly this command to compress the binaries: 163417Scsgr * 173417Scsgr * gzip -9 -v < /bin/sh > /tmp/sh 183417Scsgr * 193417Scsgr * TODO: 203417Scsgr * text-segments should be made R/O after being filled 213417Scsgr * is the vm-stuff safe ? 223417Scsgr * should handle the entire header of gzip'ed stuff. 233417Scsgr * inflate isn't quite reentrant yet... 243417Scsgr * error-handling is a mess... 253417Scsgr * so is the rest... 263417Scsgr * tidy up unnecessary includes 273417Scsgr */ 283417Scsgr 293417Scsgr 303417Scsgr#ifndef _SYS_INFLATE_H_ 313417Scsgr#define _SYS_INFLATE_H_ 323417Scsgr 333417Scsgr#ifdef KERNEL 343417Scsgr 353417Scsgr#include <sys/param.h> 363417Scsgr#include <sys/systm.h> 373417Scsgr#include <sys/resourcevar.h> 383417Scsgr#include <sys/exec.h> 393417Scsgr#include <sys/mman.h> 403417Scsgr#include <sys/malloc.h> 413417Scsgr#include <sys/imgact.h> 423417Scsgr#include <sys/imgact_aout.h> 433417Scsgr#include <sys/kernel.h> 443417Scsgr#include <sys/sysent.h> 453417Scsgr 463417Scsgr#include <vm/vm.h> 473417Scsgr#include <vm/vm_kern.h> 483417Scsgr 493417Scsgr#define WSIZE 0x8000 503417Scsgr 513417Scsgrstruct gzip { 523417Scsgr struct image_params *ip; 533417Scsgr struct exec a_out; 543417Scsgr int error; 553417Scsgr int where; 563417Scsgr u_char *inbuf; 573417Scsgr u_long offset; 583417Scsgr u_long output; 593417Scsgr u_long len; 603417Scsgr int idx; 613417Scsgr u_long virtual_offset, file_offset, file_end, bss_size; 623417Scsgr unsigned gz_wp; 633417Scsgr u_char *gz_slide; 643417Scsgr}; 653417Scsgr 663417Scsgr/* 673417Scsgr * Global variables used by inflate and friends. 683417Scsgr * This structure is used in order to make inflate() reentrant. 693417Scsgr */ 703417Scsgrstruct gz_global { 713417Scsgr int foo; 723417Scsgr}; 733417Scsgr 743417Scsgrint inflate __P((struct gzip *, struct gz_global *)); 753417Scsgr 763417Scsgr#define slide (gz->gz_slide) 773417Scsgr#define wp (gz->gz_wp) 783417Scsgr 793417Scsgr#endif /* KERNEL */ 803417Scsgr 813417Scsgr#endif /* ! _SYS_INFLATE_H_ */ 82