From owner-freebsd-questions Wed Sep 29 17:13:55 1999 Delivered-To: freebsd-questions@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id 3D79F14FD0 for ; Wed, 29 Sep 1999 17:13:30 -0700 (PDT) (envelope-from ben@scientia.demon.co.uk) Received: from lithium.scientia.demon.co.uk ([192.168.0.3] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.032 #1) id 11WTSi-000IDF-00; Thu, 30 Sep 1999 00:48:40 +0100 Received: (from ben) by lithium.scientia.demon.co.uk (Exim 3.032 #1) id 11WTBn-0002oz-00; Thu, 30 Sep 1999 00:31:11 +0100 Date: Thu, 30 Sep 1999 00:31:11 +0100 From: Ben Smithurst To: James Snow Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Weird segfault Message-ID: <19990930003111.B10799@lithium.scientia.demon.co.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.6i In-Reply-To: Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG James Snow wrote: > int main() { > printf("a:"); > uptime(); > printf("b:"); > loadavg(); > printf("c:\n"); > return 0; > } > silver:~> gcc ut.c > silver:~> ./a.out > a:6d 19h:29m:11s > b:0.11 0.06 0.01 > c: > Segmentation fault(core dumped) > silver:~> Have you tried compiling it with -g and analyzing the core file with gdb? (Also, you probably meant int mib[2], rather than int mib[1], given that you try to access mib[1], but it doesn't look like that's causing this problem.) -- Ben Smithurst | PGP: 0x99392F7D ben@scientia.demon.co.uk | key available from keyservers and | ben+pgp@scientia.demon.co.uk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message