From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 21 11:21:41 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3C55D37B401 for ; Mon, 21 Jul 2003 11:21:41 -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 89CF843FA3 for ; Mon, 21 Jul 2003 11:21:40 -0700 (PDT) (envelope-from kientzle@acm.org) Received: from acm.org ([66.166.149.53]) by kientzle.com (8.12.9/8.12.9) with ESMTP id h6LILasE020622; Mon, 21 Jul 2003 11:21:40 -0700 (PDT) (envelope-from kientzle@acm.org) Message-ID: <3F1C2FEB.4070801@acm.org> Date: Mon, 21 Jul 2003 11:24:43 -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: Chad David References: <3F1B0610.90803@acm.org> <20030720225041.GA26277@ussenterprise.ufp.org> <3F1C0C91.6050203@acm.org> <20030721165735.GA56766@ussenterprise.ufp.org> <20030721171538.GA21656@colnta.acns.ab.ca> <20030721172321.GA57666@ussenterprise.ufp.org> <20030721174206.GA21892@colnta.acns.ab.ca> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: hackers@freebsd.org Subject: Re: Correct way to call execve? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: kientzle@acm.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2003 18:21:41 -0000 Chad David wrote: > I assumed it was obvious that you could copy the data, but I believe > the intent of the original question was to find an alternative. As > far as I know there isn't one. A const is a const, except in C++. Yes, the intent was to find a way to avoid copying the data. I was hoping that someone knew a standard way to say "yes, I really do mean to cast away that const," akin to C++ const_cast. As far as I can tell, the POSIX-mandated declaration of execvp is simply wrong. (SUSv3 even has a comment that essentially admits this fact and then vainly tries to rationalize it. ) Basically, there is no const-correct way to invoke execvp using literal strings for argv except to copy the strings. In particular, the FreeBSD implementation of popen(), for example, cannot be compiled with strict warnings. Tim