9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Fernan Bolando" <fernanbolando@mailc.net>
To: "Charles Forsyth" <forsyth@terzarima.net>
Cc: 9fans@9fans.net
Subject: Re: [9fans] signal.h in APE for newbies
Date: Fri,  4 Jul 2008 22:17:38 +0800	[thread overview]
Message-ID: <1d5d51400807040717xbf9fbf7v7466ae0394b77255@mail.gmail.com> (raw)
In-Reply-To: <a85d07977219d1010dd930280d4b013e@terzarima.net>

On 7/4/08, Charles Forsyth <forsyth@terzarima.net> wrote:
> > When I trigger a division by zero the handler is not called, I just
>  > get trap 19 message.
>
>
> if i do a floating-point division by zero, the SIGFPE signal handler is called,
>  because ape's signal recognises the initial "sys: fp: ".  (ie, it works for me.)
>
>  it doesn't work for an integer division by zero, which produces a different message for the underlying notify:
>
>  8.out 205840: suicide: sys: trap: divide error pc=0x00001089
>
>  but that's fine too! Linux's signal(2) says, apparently referring to POSIX rules:
>
>         ....  Integer division by zero  has  undefined  result.
>        On some architectures it will generate a SIGFPE signal.  (Also dividing
>        the most negative integer by -1 may generate  SIGFPE.)   Ignoring  this
>        signal might lead to an endless loop.
>
>  Linux might not be particularly good at documenting this particular area,
>  so perhaps the standard(s) have useful hints or advice that APE could follow.
>
>

Any chance this is some 9vx issue? I tried the test code below it
worked in 9grid.jp ,but gave the following message in 9vx

8.out 89: suicide: sys: trap: 19 (reserved) pc=0x00001067


#include <stdio.h>
#include <signal.h>

void e_hand(int sig)
{
	printf("Signal");
	return;
}
int main()
{
double a, d;

                  d = 5.0;

	signal(SIGFPE, e_hand);
	a = 1/(d-5);
	return 0;
}


--
http://www.fernski.com



  parent reply	other threads:[~2008-07-04 14:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-04  8:17 Fernan Bolando
2008-07-04  9:59 ` Charles Forsyth
     [not found] ` <a85d07977219d1010dd930280d4b013e@terzarima.net>
2008-07-04 14:17   ` Fernan Bolando [this message]
2008-07-04 15:54     ` Russ Cox
2008-07-04 17:19     ` Charles Forsyth
2008-07-04 17:21       ` erik quanstrom
2008-07-04 18:04         ` Charles Forsyth
2008-07-04 18:14           ` erik quanstrom
2008-07-04 19:22       ` Russ Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1d5d51400807040717xbf9fbf7v7466ae0394b77255@mail.gmail.com \
    --to=fernanbolando@mailc.net \
    --cc=9fans@9fans.net \
    --cc=forsyth@terzarima.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).