9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Charles Forsyth <forsyth@terzarima.net>
To: fernanbolando@mailc.net, 9fans@9fans.net
Subject: Re: [9fans] signal.h in APE for newbies
Date: Fri,  4 Jul 2008 10:59:30 +0100	[thread overview]
Message-ID: <ac4210fe8560e9c8511064fefd908a10@terzarima.net> (raw)
In-Reply-To: <1d5d51400807040117i242cae83y6d65e8972748ea47@mail.gmail.com>

> 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.




  reply	other threads:[~2008-07-04  9:59 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 [this message]
     [not found] ` <a85d07977219d1010dd930280d4b013e@terzarima.net>
2008-07-04 14:17   ` Fernan Bolando
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=ac4210fe8560e9c8511064fefd908a10@terzarima.net \
    --to=forsyth@terzarima.net \
    --cc=9fans@9fans.net \
    --cc=fernanbolando@mailc.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).