Hello,

ip/ping -r -f www.google.com
io% ip/ping -r -f www.google.com
sending 32 64 byte messages 0 ms apart to icmp!www.google.com!1
ping 34691: suicide: sys: trap: divide error pc=0x00003953
0: rtt 9797 µs, avg rtt 9797 µs, ttl = 245
io% ps
...
arisawa       34679    0:00   0:00      128K Pread    tcp17010
arisawa       34691    0:00   0:00      140K Broken   ping
arisawa       34695    0:00   0:00      140K Pread    ping
arisawa       34696    0:00   0:00      192K Pread    ps
io% acid 34691
/proc/34691/text:386 plan 9 executable

/sys/lib/acid/port
/sys/lib/acid/386
acid: lstk()
nrand(n=0x0)+0x18 /sys/src/libc/port/nrand.c:13
        slop=0xa39fb2cf
sender(msglen=0x40,n=0x20,interval=0x0,fd=0x6)+0x151 /sys/src/cmd/ip/ ping.c:268
        seq=0xef0c4ef8
        buf=0x0
        icmp=0xdffeed0e
        me=0x0
        mev4=0x501a8c0
        i=0x1
        r=0x22b78
main(argv=0xdfffefa0,argc=0x1)+0x212 /sys/src/cmd/ip/ping.c:571
        interval=0x0
        msglen=0x40
        nmsg=0x20
        _argc=0x66
        _args=0xdfffefb8
        ds=0x11534
        fd=0x6
_main+0x31 /sys/src/libc/386/main9.s:16
acid: 
echo kill > /proc/34691/ctl
io% cat /sys/src/libc/port/nrand.c
#include        <u.h>
#include        <libc.h>

#define MASK    0x7fffffffL

int
nrand(int n)
{
        long slop, v;

        if(n < 0)
                return n;
        slop = MASK % n;
        do
                v = lrand();
        while(v <= slop);
        return v % n;
}


Think that where and why nrand(0) is executed and fix the problem.

Kenji Arisawa


On 2009/03/09, at 18:38, ROuNIN wrote:

Hello all,
I would like to learn how to fix this in the ping C code, I am new to
plan9 and C

ip/ping -r -f www.google.com
sending 32 64 bytes messages 0 ms apart  to icmp!www.google.com!1
ping 238: suicide: sys: trap: divide error  pc=0x00003953
term% 0: rrt 38841 us, avg rtt 38841 us, ttl = 128

ROuNIN



Reply via email to