require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_SHM_H_)) {
    eval 'sub _SYS_SHM_H_ () {1;}' unless defined(&_SYS_SHM_H_);
    require 'sys/cdefs.ph';
    require 'sys/featuretest.ph';
    require 'sys/ipc.ph';
    eval 'sub SHM_RDONLY () {010000;}' unless defined(&SHM_RDONLY);
    eval 'sub SHM_RND () {020000;}' unless defined(&SHM_RND);
    if(defined(&_KERNEL)) {
	eval 'sub _SHM_RMLINGER () {040000;}' unless defined(&_SHM_RMLINGER);
    }
    if(defined(&_KERNEL) || defined(&_STANDALONE) || defined(&_MODULE)) {
	eval 'sub SHMLBA () { &PAGE_SIZE;}' unless defined(&SHMLBA);
    } else {
	eval 'sub SHMLBA () {( &__sysconf(28));}' unless defined(&SHMLBA);
    }
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub SHM_LOCK () {3;}' unless defined(&SHM_LOCK);
	eval 'sub SHM_UNLOCK () {4;}' unless defined(&SHM_UNLOCK);
    }
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub SHM_R () { &IPC_R;}' unless defined(&SHM_R);
	eval 'sub SHM_W () { &IPC_W;}' unless defined(&SHM_W);
    }
    if(defined(&_KERNEL)) {
	eval 'sub SHMSEG_FREE () {0x200;}' unless defined(&SHMSEG_FREE);
	eval 'sub SHMSEG_REMOVED () {0x400;}' unless defined(&SHMSEG_REMOVED);
	eval 'sub SHMSEG_ALLOCATED () {0x800;}' unless defined(&SHMSEG_ALLOCATED);
	eval 'sub SHMSEG_WANTED () {0x1000;}' unless defined(&SHMSEG_WANTED);
	eval 'sub SHMSEG_RMLINGER () {0x2000;}' unless defined(&SHMSEG_RMLINGER);
	eval 'sub SHMSEG_WIRED () {0x4000;}' unless defined(&SHMSEG_WIRED);
	eval 'sub SYSCTL_FILL_SHM {
	    my($src, $dst) = @_;
    	    eval q( &do {  &SYSCTL_FILL_PERM(($src). &shm_perm, ($dst). &shm_perm); ($dst). &shm_segsz = ($src). &shm_segsz; ($dst). &shm_lpid = ($src). &shm_lpid; ($dst). &shm_cpid = ($src). &shm_cpid; ($dst). &shm_atime = ($src). &shm_atime; ($dst). &shm_dtime = ($src). &shm_dtime; ($dst). &shm_ctime = ($src). &shm_ctime; ($dst). &shm_nattch = ($src). &shm_nattch; }  &while ( 0));
	}' unless defined(&SYSCTL_FILL_SHM);
    } else {
    }
}
1;
