From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 2 03:25:47 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 97A44E83 for ; Tue, 2 Jul 2013 03:25:47 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-oa0-x22b.google.com (mail-oa0-x22b.google.com [IPv6:2607:f8b0:4003:c02::22b]) by mx1.freebsd.org (Postfix) with ESMTP id 67C9611FB for ; Tue, 2 Jul 2013 03:25:47 +0000 (UTC) Received: by mail-oa0-f43.google.com with SMTP id i7so5825432oag.16 for ; Mon, 01 Jul 2013 20:25:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=05ehRY34tSzR8XJLky6UzrA0xcot074tvncIQp8ludE=; b=xVyaWFa3ro7cEcVT/3HTdoup76rpczKsmBLSefd3WWqJkR+QpdJQGfmBMeD39Sf/Uf /HGcCSK2SmTz8No+nReFIwq4fvJFaKVyVREiUmuoyt8Ol6K/jAsOU56XorhN61JijMTu /QBkuK2qpSsxGJkAljiEb6x+WMflPAE+D/hUEaIMsguQbcrDBKlijPOzXdqSaEkZK7zG QGcOacurdQ01i77YPZa2FdTEQY1Cprhb/ObCMPaZv3qwjziiCLnhmWDf3m0Sbheo8EXp pPN6whXnc3wU2JUblY3a8oODzvlez0SWGlFEA+6nHuLJX6aN6kRF52sL5EnlFoiCREZw QMug== MIME-Version: 1.0 X-Received: by 10.60.42.101 with SMTP id n5mr10871663oel.4.1372735546897; Mon, 01 Jul 2013 20:25:46 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.182.162.65 with HTTP; Mon, 1 Jul 2013 20:25:46 -0700 (PDT) In-Reply-To: <20130702004207.5510@gmx.com> References: <20130702004207.5510@gmx.com> Date: Mon, 1 Jul 2013 20:25:46 -0700 X-Google-Sender-Auth: w1DZ94dwXfpNrvT_vjN2c-E-Rwg Message-ID: Subject: Re: another question From: mdf@FreeBSD.org To: David Sanford Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-hackers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jul 2013 03:25:47 -0000 On Mon, Jul 1, 2013 at 5:42 PM, David Sanford wrote: > Hi, > > Thanks for your responses to my first question. They were very helpful. > > In looking at the code, I ran across the functions setprogname and > getprogname. According to the man page: > In FreeBSD, the name of the program is set by the start-up code that is > run before *main*(); thus, running *setprogname*() is not necessary. > I'm confused by how this is done. Where is this "start-up code" defined? > Is this included in all executables compiled on FreeBSD? Even the programs > released under the GNU GPL? I believe the code that does this is in lib/csu/common/ignore_init.c; see handle_argv() and the use of __progname[]. This will run for anything that links against csu, which is anything compiled on FreeBSD. The same csu library sets the ABI note.tag, which tells the kernel which syscall table to use when the binary is executed. Cheers, matthew