From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 16 10:44:29 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 8FD2010656C9 for ; Fri, 16 Jan 2009 10:44:29 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-bw0-f20.google.com (mail-bw0-f20.google.com [209.85.218.20]) by mx1.freebsd.org (Postfix) with ESMTP id E06898FC17 for ; Fri, 16 Jan 2009 10:44:28 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by bwz13 with SMTP id 13so5312812bwz.19 for ; Fri, 16 Jan 2009 02:44:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Oj1sHaYNc8PPbkrWZlRx6ZX7en2h6FeyO1CDZCG+giI=; b=unCdPoGMrhVZciNmsA+v4E6T4cNOTyeRYATTKkGLS/FrM6lj9rbI5z6IrmwHIPTWzZ ns0Kf+NbNQZUL50dvfZjp1oZgn5elqvr0Q8AsmZ/FzXd1KCCZo3ibDPyZH+fBPM1StK8 Fusvcdf0n3fc0ejWv0ZMVVPl1k0GlRmlf0eNw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Ik8mxFCME5N9KDBSD5zhs2S7S0XcmdQEhgAbG8qhlvsL3snhEK5CvyrilgGLOQiUMu K6XPfBNzYYLzffVHZyrDbxJk0Y74OZziLP4rylavE3XU6Q4QVPgEZbwkYdMekrKmTKd9 wr913tQzVPbA7W2I6ljL20m0Fs3intMccy1lQ= MIME-Version: 1.0 Received: by 10.181.145.6 with SMTP id x6mr800934bkn.94.1232102667426; Fri, 16 Jan 2009 02:44:27 -0800 (PST) In-Reply-To: <7d6fde3d0901160235o6aa1f096q11c5096b70f3577@mail.gmail.com> References: <7d6fde3d0901160041n55466290l55f737d274a40895@mail.gmail.com> <49704AEC.3080709@gmx.de> <200901161039.00232.christian.kandeler@hob.de> <49705FA2.2020605@gmx.de> <7d6fde3d0901160235o6aa1f096q11c5096b70f3577@mail.gmail.com> Date: Fri, 16 Jan 2009 02:44:27 -0800 Message-ID: <7d6fde3d0901160244r6d72a3f1k5c27ea03fbc37ef5@mail.gmail.com> From: Garrett Cooper To: Christoph Mallon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Christian Kandeler , freebsd-hackers@freebsd.org 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 10:44:30 -0000 On Fri, Jan 16, 2009 at 2:35 AM, Garrett Cooper wrote: > On Fri, Jan 16, 2009 at 2:21 AM, Christoph Mallon > wrote: >> Christian Kandeler schrieb: >>> >>> On Friday 16 January 2009 09:53, Christoph Mallon wrote: >>> >>>>> int >>>>> main() { >>>>> >>>>> int mib[4]; >>>>> >>>>> size_t len; >>>>> >>>>> if (sysctlnametomib("kern.ipc.shmmax", mib, &len) !=3D 0) { >>>>> printf("Errno: %d\n", errno); >>>>> errx(errno, "Error: %s", strerror(errno)); >>>> >>>> The use of errno is wrong. printf might change errno. >>> >>> I don't think printf() can set errno. And even if it could, it >> >> Of course it can. See ISO/IEC 9899:1999 (E) =A77.5:3. >> >>> wouldn't matter, because C has call-by-value semantics. >> >> This has nothing to do with call-by-value. errno is read (even twice!) >> *after* the call to printf(). > > Ok, I just installworld'ed, recompiled the program with the > following modifications, and I still get segfaults. And the question > of the night is: why amd64 on a VERY recent CURRENT? > I'm going to try the same app on an amd64 freebsd VMware instance > with RELENG_7. > Remember: just because a bunch of other people aren't reporting > issues with CURRENT/amd64 doesn't mean that it isn't environmental, > related to my hardware or compile options ;). > Cheers, > -Garrett Ugh... I pasted it twice by accident. Sorry. -Garrett