From owner-freebsd-arch@FreeBSD.ORG Mon Jun 23 15:22:53 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B8D8B37B401; Mon, 23 Jun 2003 15:22:53 -0700 (PDT) Received: from kientzle.com (h-66-166-149-50.SNVACAID.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 306D543F3F; Mon, 23 Jun 2003 15:22:53 -0700 (PDT) (envelope-from kientzle@acm.org) Received: from acm.org (big.x.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id h5NMMqtJ078254; Mon, 23 Jun 2003 15:22:52 -0700 (PDT) (envelope-from kientzle@acm.org) Message-ID: <3EF77E52.6070007@acm.org> Date: Mon, 23 Jun 2003 15:25:22 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.0.1) Gecko/20021005 X-Accept-Language: en-us, en MIME-Version: 1.0 To: arch@freebsd.org, ru@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Proposal: execvP X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: kientzle@acm.org List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jun 2003 22:22:54 -0000 I've encountered a couple of places now where I could really use an exec* function that is identical to execvp(3), except that it accepts a path specification instead of automatically using the PATH environment variable. For lack of a better name, I propose adding the following to lib/libc/gen/exec.c: /* Exec 'file', searching the specified path. */ int execvP(const char *file, const char *path, char *const argv[]); The implementation itself is trivial; a three-line edit converts the existing execvp() into execvP(), and then execvp() gets a new implementation as follows: int execvp(const char *file, char *const argv[]) { const char *path; path = getenv("PATH"); if(!path) path = _PATH_DEFPATH; return execvP(file,path,argv); } In essence, execvP() is merely publishing an already-existing capability within the library by breaking execvp() into two very natural pieces. Without this, I basically will have to copy a slightly modified version of execvp() into several utilities, which seems a rather pointless exercise. Thoughts? Tim Kientzle