require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_SIGNALVAR_H_)) {
    eval 'sub _SYS_SIGNALVAR_H_ () {1;}' unless defined(&_SYS_SIGNALVAR_H_);
    require 'sys/siginfo.ph';
    require 'sys/queue.ph';
    require 'sys/mutex.ph';
    require 'sys/stdbool.ph';
    unless(defined(&_KERNEL)) {
	require 'string.ph';
    }
    eval 'sub SIG_CATCH () {2;}' unless defined(&SIG_CATCH);
    eval 'sub SIGACTION {
        my($p, $sig) = @_;
	    eval q(( ($p->{p_sigacts}->{sa_sigdesc[&(sig)]}->{sd_sigact})));
    }' unless defined(&SIGACTION);
    eval 'sub SIGACTION_PS {
        my($ps, $sig) = @_;
	    eval q(( ($ps->{sa_sigdesc[&(sig)]}->{sd_sigact})));
    }' unless defined(&SIGACTION_PS);
    eval 'sub SA_KILL () {0x1;}' unless defined(&SA_KILL);
    eval 'sub SA_CORE () {0x2;}' unless defined(&SA_CORE);
    eval 'sub SA_STOP () {0x4;}' unless defined(&SA_STOP);
    eval 'sub SA_TTYSTOP () {0x8;}' unless defined(&SA_TTYSTOP);
    eval 'sub SA_IGNORE () {0x10;}' unless defined(&SA_IGNORE);
    eval 'sub SA_CONT () {0x20;}' unless defined(&SA_CONT);
    eval 'sub SA_CANTMASK () {0x40;}' unless defined(&SA_CANTMASK);
    eval 'sub SA_NORESET () {0x80;}' unless defined(&SA_NORESET);
    eval 'sub SA_TOLWP () {0x100;}' unless defined(&SA_TOLWP);
    eval 'sub SA_TOALL () {0x200;}' unless defined(&SA_TOALL);
    if(defined(&_KERNEL)) {
	require 'sys/systm.ph';
	if((defined(&NSIG) ? &NSIG : undef) > 33) {
	}
	if((defined(&NSIG) ? &NSIG : undef) > 65) {
	}
	if((defined(&NSIG) ? &NSIG : undef) > 97) {
	}
	eval 'sub ksiginfo_queue_init {
	    my($kq) = @_;
    	    eval q({  &TAILQ_INIT($kq); });
	}' unless defined(&ksiginfo_queue_init);
	eval 'sub ksiginfo_queue_drain {
	    my($kq) = @_;
    	    eval q({  &if (! &TAILQ_EMPTY($kq))  &ksiginfo_queue_drain0($kq); });
	}' unless defined(&ksiginfo_queue_drain);
    }
    if(defined(&_KERNEL)) {
	if(defined(&SIGPROP)) {
	    undef(&SIGPROP) if defined(&SIGPROP);
	} else {
	}
    }
}
1;
