From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 16 11:50:48 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF8AD106566B for ; Fri, 16 Jan 2009 11:50:48 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.16.84]) by mx1.freebsd.org (Postfix) with ESMTP id 91AD18FC14 for ; Fri, 16 Jan 2009 11:50:48 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from pampa.cs.huji.ac.il ([132.65.80.32]) by kabab.cs.huji.ac.il with esmtp id 1LNnDr-000PbR-Dm; Fri, 16 Jan 2009 13:50:47 +0200 X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 To: Christoph Mallon , Christian Kandeler , Garrett Cooper , freebsd-hackers@freebsd.org In-reply-to: <20090116113928.GA1361@lizard.fafoe.narf.at> References: <7d6fde3d0901160041n55466290l55f737d274a40895@mail.gmail.com> <49704AEC.3080709@gmx.de> <200901161039.00232.christian.kandeler@hob.de> <49705FA2.2020605@gmx.de> <7d6fde3d0901160235o6aa1f096q11c5096b70f3577@mail.gmail.com> <497065ED.7050705@gmx.de> <20090116113928.GA1361@lizard.fafoe.narf.at> Comments: In-reply-to Stefan Farfeleder message dated "Fri, 16 Jan 2009 12:39:28 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 16 Jan 2009 13:50:47 +0200 From: Danny Braniss Message-ID: Cc: Subject: Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jan 2009 11:50:49 -0000 > On Fri, Jan 16, 2009 at 01:33:38PM +0200, Danny Braniss wrote: > > some facts: > > #include > > int > > main() > > { > > printf("%s\n", strerror(2)); > > return 0; > > } > > > > 1- it works fine on i386 > > 2- it bombs on amd64 > > 3- with a local strerror.c (instead of the one in libc) > > works fine > > so, there is something realy wrong going on here! > > (and it gows back to at least 7.0-stable) > > The compiler thinks strerror returns an int. Include . ahh, RTFM ALL THE WAY! I just saw the top few lines: LIBRARY Standard C Library (libc, -lc) SYNOPSIS #include but later it shows: #include char * strerror(int errnum); on the other hand, compiling with -static workes ok, which sent me on the wrong trail. danny