[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Pexec mode 0



In MiNT I get a return value of 255, in MagiC I get -1.

So MiNT seems to trim the value to a byte. It is most definitely not
my code trimming it!

Could anyone with more C experience than me look into this one?

k_exec.c, sys_pwaitpid() - where the return walue for Pexec(0) comes from:

        /* OK, we've found our child
         * calculate the return code from the child's exit code and pid and
         * the possibly fatal signal that caused it to die.
         */
        r = (((unsigned long)p->pid) << 16) | (p->wait_cond & 0x0000ffff);
        /* This assumes that NSIG is 32, i. e. the highest possible
           signal is 31.  We have to use 0x9f instead of 0x1f to be
           prepared for a possible core dump flag.  */
        if (p->signaled)
                r = (r & 0xffff00ff) | ((p->last_sig << 8) & 0x00009f00);
        else if (p->wait_q != STOP_Q && (p->wait_cond & 0x1f00) != SIGTRAP << 8)
                /* Strip down the return code of the child down to 8 bits.
                   Some misbehaving programs exceed this limit which could
                   cause a misinterpretation of the wait status signaled
                   (with possible memory faults if the signal would be
                   > NSIG).  */
                r &= 0xffff00ff;

KMK