From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <0C884056-DAC1-484D-880A-30012762C49C@ar.aichi-u.ac.jp> From: Kenji Arisawa To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v930.3) Date: Mon, 9 Mar 2009 20:11:28 +0900 References: Subject: Re: [9fans] ping suicide: sys: trap: divide error pc=0x00003953c Topicbox-Message-UUID: b671f8c0-ead4-11e9-9d60-3106f5b1d025 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=3D0x00003953 0: rtt 9797 =B5s, avg rtt 9797 =B5s, ttl =3D 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=3D0x0)+0x18 /sys/src/libc/port/nrand.c:13 slop=3D0xa39fb2cf sender(msglen=3D0x40,n=3D0x20,interval=3D0x0,fd=3D0x6)+0x151 = /sys/src/cmd/ip/=20 ping.c:268 seq=3D0xef0c4ef8 buf=3D0x0 icmp=3D0xdffeed0e me=3D0x0 mev4=3D0x501a8c0 i=3D0x1 r=3D0x22b78 main(argv=3D0xdfffefa0,argc=3D0x1)+0x212 /sys/src/cmd/ip/ping.c:571 interval=3D0x0 msglen=3D0x40 nmsg=3D0x20 _argc=3D0x66 _args=3D0xdfffefb8 ds=3D0x11534 fd=3D0x6 _main+0x31 /sys/src/libc/386/main9.s:16 acid: =04 echo kill > /proc/34691/ctl io% cat /sys/src/libc/port/nrand.c #include #include #define MASK 0x7fffffffL int nrand(int n) { long slop, v; if(n < 0) return n; slop =3D MASK % n; do v =3D lrand(); while(v <=3D 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=3D0x00003953 > term% 0: rrt 38841 us, avg rtt 38841 us, ttl =3D 128 > > ROuNIN >