require '_h2ph_pre.ph';

unless(defined(&_SYS_MALLOC_H_)) {
    eval 'sub _SYS_MALLOC_H_ () {1;}' unless defined(&_SYS_MALLOC_H_);
    eval 'sub M_WAITOK () {0x0000;}' unless defined(&M_WAITOK);
    eval 'sub M_NOWAIT () {0x0001;}' unless defined(&M_NOWAIT);
    eval 'sub M_FREE () {0;}' unless defined(&M_FREE);
    eval 'sub M_MBUF () {1;}' unless defined(&M_MBUF);
    eval 'sub M_DEVBUF () {2;}' unless defined(&M_DEVBUF);
    eval 'sub M_SOCKET () {3;}' unless defined(&M_SOCKET);
    eval 'sub M_PCB () {4;}' unless defined(&M_PCB);
    eval 'sub M_RTABLE () {5;}' unless defined(&M_RTABLE);
    eval 'sub M_HTABLE () {6;}' unless defined(&M_HTABLE);
    eval 'sub M_FTABLE () {7;}' unless defined(&M_FTABLE);
    eval 'sub M_ZOMBIE () {8;}' unless defined(&M_ZOMBIE);
    eval 'sub M_IFADDR () {9;}' unless defined(&M_IFADDR);
    eval 'sub M_SOOPTS () {10;}' unless defined(&M_SOOPTS);
    eval 'sub M_SONAME () {11;}' unless defined(&M_SONAME);
    eval 'sub M_NAMEI () {12;}' unless defined(&M_NAMEI);
    eval 'sub M_GPROF () {13;}' unless defined(&M_GPROF);
    eval 'sub M_IOCTLOPS () {14;}' unless defined(&M_IOCTLOPS);
    eval 'sub M_MAPMEM () {15;}' unless defined(&M_MAPMEM);
    eval 'sub M_CRED () {16;}' unless defined(&M_CRED);
    eval 'sub M_PGRP () {17;}' unless defined(&M_PGRP);
    eval 'sub M_SESSION () {18;}' unless defined(&M_SESSION);
    eval 'sub M_IOV () {19;}' unless defined(&M_IOV);
    eval 'sub M_MOUNT () {20;}' unless defined(&M_MOUNT);
    eval 'sub M_FHANDLE () {21;}' unless defined(&M_FHANDLE);
    eval 'sub M_NFSREQ () {22;}' unless defined(&M_NFSREQ);
    eval 'sub M_NFSMNT () {23;}' unless defined(&M_NFSMNT);
    eval 'sub M_NFSNODE () {24;}' unless defined(&M_NFSNODE);
    eval 'sub M_VNODE () {25;}' unless defined(&M_VNODE);
    eval 'sub M_CACHE () {26;}' unless defined(&M_CACHE);
    eval 'sub M_DQUOT () {27;}' unless defined(&M_DQUOT);
    eval 'sub M_UFSMNT () {28;}' unless defined(&M_UFSMNT);
    eval 'sub M_SHM () {29;}' unless defined(&M_SHM);
    eval 'sub M_VMMAP () {30;}' unless defined(&M_VMMAP);
    eval 'sub M_VMMAPENT () {31;}' unless defined(&M_VMMAPENT);
    eval 'sub M_VMOBJ () {32;}' unless defined(&M_VMOBJ);
    eval 'sub M_VMOBJHASH () {33;}' unless defined(&M_VMOBJHASH);
    eval 'sub M_VMPMAP () {34;}' unless defined(&M_VMPMAP);
    eval 'sub M_VMPVENT () {35;}' unless defined(&M_VMPVENT);
    eval 'sub M_VMPAGER () {36;}' unless defined(&M_VMPAGER);
    eval 'sub M_VMPGDATA () {37;}' unless defined(&M_VMPGDATA);
    eval 'sub M_FILE () {38;}' unless defined(&M_FILE);
    eval 'sub M_FILEDESC () {39;}' unless defined(&M_FILEDESC);
    eval 'sub M_LOCKF () {40;}' unless defined(&M_LOCKF);
    eval 'sub M_PROC () {41;}' unless defined(&M_PROC);
    eval 'sub M_SUBPROC () {42;}' unless defined(&M_SUBPROC);
    eval 'sub M_SEGMENT () {43;}' unless defined(&M_SEGMENT);
    eval 'sub M_LFSNODE () {44;}' unless defined(&M_LFSNODE);
    eval 'sub M_FFSNODE () {45;}' unless defined(&M_FFSNODE);
    eval 'sub M_MFSNODE () {46;}' unless defined(&M_MFSNODE);
    eval 'sub M_NQLEASE () {47;}' unless defined(&M_NQLEASE);
    eval 'sub M_NQMHOST () {48;}' unless defined(&M_NQMHOST);
    eval 'sub M_NETADDR () {49;}' unless defined(&M_NETADDR);
    eval 'sub M_NFSSVC () {50;}' unless defined(&M_NFSSVC);
    eval 'sub M_NFSUID () {51;}' unless defined(&M_NFSUID);
    eval 'sub M_NFSD () {52;}' unless defined(&M_NFSD);
    eval 'sub M_IPMOPTS () {53;}' unless defined(&M_IPMOPTS);
    eval 'sub M_IPMADDR () {54;}' unless defined(&M_IPMADDR);
    eval 'sub M_IFMADDR () {55;}' unless defined(&M_IFMADDR);
    eval 'sub M_MRTABLE () {56;}' unless defined(&M_MRTABLE);
    eval 'sub M_ISOFSMNT () {57;}' unless defined(&M_ISOFSMNT);
    eval 'sub M_ISOFSNODE () {58;}' unless defined(&M_ISOFSNODE);
    eval 'sub M_MSDOSFSMNT () {59;}' unless defined(&M_MSDOSFSMNT);
    eval 'sub M_MSDOSFSFAT () {60;}' unless defined(&M_MSDOSFSFAT);
    eval 'sub M_MSDOSFSNODE () {61;}' unless defined(&M_MSDOSFSNODE);
    eval 'sub M_TTYS () {62;}' unless defined(&M_TTYS);
    eval 'sub M_EXEC () {63;}' unless defined(&M_EXEC);
    eval 'sub M_MISCFSMNT () {64;}' unless defined(&M_MISCFSMNT);
    eval 'sub M_MISCFSNODE () {65;}' unless defined(&M_MISCFSNODE);
    eval 'sub M_ADOSFSMNT () {66;}' unless defined(&M_ADOSFSMNT);
    eval 'sub M_ADOSFSNODE () {67;}' unless defined(&M_ADOSFSNODE);
    eval 'sub M_ANODE () {68;}' unless defined(&M_ANODE);
    eval 'sub M_IPQ () {69;}' unless defined(&M_IPQ);
    eval 'sub M_AFS () {70;}' unless defined(&M_AFS);
    eval 'sub M_ADOSFSBITMAP () {71;}' unless defined(&M_ADOSFSBITMAP);
    eval 'sub M_EXT2FSNODE () {72;}' unless defined(&M_EXT2FSNODE);
    eval 'sub M_PFIL () {73;}' unless defined(&M_PFIL);
    eval 'sub M_PFKEY () {74;}' unless defined(&M_PFKEY);
    eval 'sub M_TDB () {75;}' unless defined(&M_TDB);
    eval 'sub M_XDATA () {76;}' unless defined(&M_XDATA);
    eval 'sub M_VFS () {77;}' unless defined(&M_VFS);
    eval 'sub M_PAGEDEP () {78;}' unless defined(&M_PAGEDEP);
    eval 'sub M_INODEDEP () {79;}' unless defined(&M_INODEDEP);
    eval 'sub M_NEWBLK () {80;}' unless defined(&M_NEWBLK);
    eval 'sub M_BMSAFEMAP () {81;}' unless defined(&M_BMSAFEMAP);
    eval 'sub M_ALLOCDIRECT () {82;}' unless defined(&M_ALLOCDIRECT);
    eval 'sub M_INDIRDEP () {83;}' unless defined(&M_INDIRDEP);
    eval 'sub M_ALLOCINDIR () {84;}' unless defined(&M_ALLOCINDIR);
    eval 'sub M_FREEFRAG () {85;}' unless defined(&M_FREEFRAG);
    eval 'sub M_FREEBLKS () {86;}' unless defined(&M_FREEBLKS);
    eval 'sub M_FREEFILE () {87;}' unless defined(&M_FREEFILE);
    eval 'sub M_DIRADD () {88;}' unless defined(&M_DIRADD);
    eval 'sub M_MKDIR () {89;}' unless defined(&M_MKDIR);
    eval 'sub M_DIRREM () {90;}' unless defined(&M_DIRREM);
    eval 'sub M_VMPBUCKET () {91;}' unless defined(&M_VMPBUCKET);
    eval 'sub M_VMSWAP () {92;}' unless defined(&M_VMSWAP);
    eval 'sub M_DISCQ () {93;}' unless defined(&M_DISCQ);
    eval 'sub M_FRAGQ () {94;}' unless defined(&M_FRAGQ);
    eval 'sub M_SECA () {95;}' unless defined(&M_SECA);
    eval 'sub M_I6IFP () {96;}' unless defined(&M_I6IFP);
    eval 'sub M_RAIDFRAME () {97;}' unless defined(&M_RAIDFRAME);
    eval 'sub M_UVMAMAP () {98;}' unless defined(&M_UVMAMAP);
    eval 'sub M_UVMAOBJ () {99;}' unless defined(&M_UVMAOBJ);
    eval 'sub M_POOL () {100;}' unless defined(&M_POOL);
    eval 'sub M_USB () {101;}' unless defined(&M_USB);
    eval 'sub M_USBDEV () {102;}' unless defined(&M_USBDEV);
    eval 'sub M_USBHC () {103;}' unless defined(&M_USBHC);
    eval 'sub M_TEMP () {127;}' unless defined(&M_TEMP);
    eval 'sub M_LAST () {128;}' unless defined(&M_LAST);
    eval 'sub INITKMEMNAMES () {{ "free", "mbuf", "devbuf", "socket", "pcb", "routetbl", "hosttbl", "fragtbl", "zombie", "ifaddr", "soopts", "soname", "namei", "gprof", "ioctlops", "mapmem", "cred", "pgrp", "session", "iov", "mount", "fhandle", "NFS req", "NFS mount", "NFS node", "vnodes", "namecache", "UFS quota", "UFS mount", "shm", "VM map", "VM mapent", "VM object", "VM objhash", "VM pmap", "VM pvmap", "VM pager", "VM pgdata", "file", "file desc", "lockf", "proc", "subproc", "LFS segment", "LFS node", "FFS node", "MFS node", "NQNFS Lease", "NQNFS Host", "Export Host", "NFS srvsock", "NFS uid", "NFS daemon", "ip_moptions", "in_multi", "ether_multi", "mrt", "ISOFS mount", "ISOFS node", "MSDOSFS mount", "MSDOSFS fat", "MSDOSFS node", "ttys", "exec", "miscfs mount", "miscfs node", "adosfs mount", "adosfs node", "adosfs anode", "IP queue ent", "afs", "adosfs bitmap", "EXT2FS node", "pfil", "pfkey data", "tdb", "xform_data", "vfs", "pagedep", "inodedep", "newblk", "bmsafemap", "allocdirect", "indirdep", "allocindir", "freefrag", "freeblks", "freefile", "diradd", "mkdir", "dirrem", "VM page bucket", "VM swap", "IPv6 discq", "IPv6 fragq", "Sec Assoc", "IPv6 if info", "RaidFrame data", "UVM amap", "UVM aobj", "pool", "USB", "USB device", "USB HC",  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL,  &NULL, "temp", };}' unless defined(&INITKMEMNAMES);
    eval 'sub ku_freecnt () { ($ku_un->{freecnt});}' unless defined(&ku_freecnt);
    eval 'sub ku_pagecnt () { ($ku_un->{pagecnt});}' unless defined(&ku_pagecnt);
    if(defined(&_KERNEL)) {
	eval 'sub MINALLOCSIZE () {(1<<  &MINBUCKET);}' unless defined(&MINALLOCSIZE);
	eval 'sub BUCKETINDX {
	    local($size) = @_;
    	    eval q((($size) <= ( &MINALLOCSIZE * 128) ? ($size) <= ( &MINALLOCSIZE * 8) ? ($size) <= ( &MINALLOCSIZE * 2) ? ($size) <= ( &MINALLOCSIZE * 1) ? ( &MINBUCKET + 0) : ( &MINBUCKET + 1) : ($size) <= ( &MINALLOCSIZE * 4) ? ( &MINBUCKET + 2) : ( &MINBUCKET + 3) : ($size) <= ( &MINALLOCSIZE* 32) ? ($size) <= ( &MINALLOCSIZE * 16) ? ( &MINBUCKET + 4) : ( &MINBUCKET + 5) : ($size) <= ( &MINALLOCSIZE * 64) ? ( &MINBUCKET + 6) : ( &MINBUCKET + 7) : ($size) <= ( &MINALLOCSIZE * 2048) ? ($size) <= ( &MINALLOCSIZE * 512) ? ($size) <= ( &MINALLOCSIZE * 256) ? ( &MINBUCKET + 8) : ( &MINBUCKET + 9) : ($size) <= ( &MINALLOCSIZE * 1024) ? ( &MINBUCKET + 10) : ( &MINBUCKET + 11) : ($size) <= ( &MINALLOCSIZE * 8192) ? ($size) <= ( &MINALLOCSIZE * 4096) ? ( &MINBUCKET + 12) : ( &MINBUCKET + 13) : ($size) <= ( &MINALLOCSIZE * 16384) ? ( &MINBUCKET + 14) : ( &MINBUCKET + 15)));
	}' unless defined(&BUCKETINDX);
	eval 'sub kmemxtob {
	    local($alloc) = @_;
    	    eval q(( &kmembase + ($alloc) *  &NBPG));
	}' unless defined(&kmemxtob);
	eval 'sub btokmemx {
	    local($addr) = @_;
    	    eval q(((($addr) -  &kmembase) /  &NBPG));
	}' unless defined(&btokmemx);
	eval 'sub btokup {
	    local($addr) = @_;
    	    eval q(( $kmemusage[(($addr) -  &kmembase) >>  &CLSHIFT]));
	}' unless defined(&btokup);
	if(defined( &KMEMSTATS) || defined( &DIAGNOSTIC) || defined( &_LKM)) {
	    eval 'sub MALLOC {
	        local($space, $cast, $size, $type, $flags) = @_;
    		eval q( =  &malloc(($size), $type, $flags));
	    }' unless defined(&MALLOC);
	    eval 'sub FREE {
	        local($addr, $type) = @_;
    		eval q( &free(($addr), $type));
	    }' unless defined(&FREE);
	} else {
	    eval 'sub MALLOC {
	        local($space, $cast, $size, $type, $flags) = @_;
    		eval q( &do {  &register \'struct kmembuckets\' * &kbp =  $bucket[ &BUCKETINDX]; \'long s\' =  &splimp();  &if ( ($kbp->{kb_next}) ==  &NULL) { =  &malloc(, $type, $flags); }  &else { =  ($kbp->{kb_next});  ($kbp->{kb_next}) = *($space); }  &splx( &s); }  &while (0));
	    }' unless defined(&MALLOC);
	    eval 'sub FREE {
	        local($addr, $type) = @_;
    		eval q( &do {  &register \'struct kmembuckets\' * &kbp;  &register \'struct kmemusage\' * &kup =  &btokup; \'long s\' =  &splimp();  &if (1<<  ($kup->{ku_indx}) >  &MAXALLOCSAVE) {  &free(, $type); }  &else {  &kbp =  $bucket[ ($kup->{ku_indx})];  &if ( ($kbp->{kb_next}) ==  &NULL)  ($kbp->{kb_next}) = ;  &else *( ($kbp->{kb_last})) = ; * =  &NULL;  ($kbp->{kb_last}) = ($addr); }  &splx( &s); }  &while(0));
	    }' unless defined(&FREE);
	}
    }
}
1;
