Date: Mon, 1 Jul 2013 20:25:46 -0700 From: mdf@FreeBSD.org To: David Sanford <david.lee.tn@programmer.net> Cc: freebsd-hackers <freebsd-hackers@freebsd.org> Subject: Re: another question Message-ID: <CAMBSHm_LcJPainj2Go0B63JP0qQ0QuuP3CmN5ruaiGVPOCoH=A@mail.gmail.com> In-Reply-To: <20130702004207.5510@gmx.com> References: <20130702004207.5510@gmx.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 1, 2013 at 5:42 PM, David Sanford <david.lee.tn@programmer.net>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMBSHm_LcJPainj2Go0B63JP0qQ0QuuP3CmN5ruaiGVPOCoH=A>