From owner-freebsd-questions Sat May 24 16:01:39 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id QAA24026 for questions-outgoing; Sat, 24 May 1997 16:01:39 -0700 (PDT) Received: from precipice.shockwave.com (ppp-206-170-32-206.snfc21.pacbell.net [206.170.32.206]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id QAA24019 for ; Sat, 24 May 1997 16:01:37 -0700 (PDT) Received: from shockwave.com (localhost [127.0.0.1]) by precipice.shockwave.com (8.8.5/8.7.3) with ESMTP id QAA19073 for ; Sat, 24 May 1997 16:01:22 -0700 (PDT) Message-Id: <199705242301.QAA19073@precipice.shockwave.com> To: questions@freebsd.org Subject: execve() and the actual name of the image executed Date: Sat, 24 May 1997 16:01:22 -0700 From: Paul Traina Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk The parameters passed to execve include the filename that you wish to exec, followed by the argv and envp structures. A quick perusal of kern_exec.s shows the kernel copying the argv and envp structures to the new process area, but it appears as if the path to the executable is lost. Is there any /absolutely guaranteed/ way to get a pointer to the/a path that was actually used to invoke an image from that image? Why? I'm writing a piece of code where I want to fork/re-exec the image that I'm currently running (or to be more exact, I want to fork/exec an image located at the same place as the one I'm currently running was when I started it). Is this possible?