From owner-freebsd-bugs@FreeBSD.ORG Mon Jul 21 08:04:59 2008 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DA53106566C for ; Mon, 21 Jul 2008 08:04:59 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.155]) by mx1.freebsd.org (Postfix) with ESMTP id DF1C48FC28 for ; Mon, 21 Jul 2008 08:04:58 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so825147fgb.35 for ; Mon, 21 Jul 2008 01:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=yHjBt4huYZ8FuLULbmbKZWSMzK9ZyryB1ugGB6W7mKY=; b=hsOv3wwV2zkKpWtBPXxcQLD+6TyGIdZldnE6gtt8TmXOQ3GUDmYaUkPtrtD3967xwE khfbCwItmiwDRWoB28jE3nNKhlKvpid5ENp1c8DBx/Ywh0f92nL3ojpg0Riz3hAwbixH l4Nzzz8HbdRY9LHn85BXWWsizHIJzd+rLDgrE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=RtHpIBnDL4qvpeqZe+byp1NkvQFycUQfPZECBhPWemSWU9GRjRKfm5t4wYLLeGXbX8 Bs08+s9PLxr8roIlXEsESLuhJEgxVc7wY//HXZtpZu+nD4Py4i1mZOwLoe+gd+sHkN/k Okjr5sMb3jqWhP4eDUxwxIWhSf1tEOaQ3CFJs= Received: by 10.86.93.19 with SMTP id q19mr1640501fgb.67.1216627497396; Mon, 21 Jul 2008 01:04:57 -0700 (PDT) Received: by 10.86.51.1 with HTTP; Mon, 21 Jul 2008 01:04:57 -0700 (PDT) Message-ID: <7d6fde3d0807210104t188b6ab5hc61dc67c49d27188@mail.gmail.com> Date: Mon, 21 Jul 2008 01:04:57 -0700 From: "Garrett Cooper" To: "Antoine Brodin" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200807202210.m6KMA4cm032331@freefall.freebsd.org> <7d6fde3d0807201714g49eb4a80ncfcc1cc800ad595e@mail.gmail.com> Cc: freebsd-bugs@freebsd.org Subject: Re: bin/125680: atacontrol(8): atacontrol depends on executable in /usr X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2008 08:04:59 -0000 On Mon, Jul 21, 2008 at 12:39 AM, Antoine Brodin wrote: > On Mon, Jul 21, 2008 at 2:14 AM, Garrett Cooper wrote: >> Good catch. C apps shouldn't depend on other commands' existence for >> security and performance reasons. >> >> A few comments: >> 1. Why is forking another process necessary? In your patch above >> you're forcing the parent to do the work while the child goes and >> dies, so there really isn't any benefit to forking at all other than >> just exercise fork a bit. >> 2. If you're going to fork another process, wouldn't it be wiser to >> waitpid(2) until the child's done? > > Hi, > > In the patch, the child does the work and the parent dies. > The "/usr/bin/nice -n 20 /bin/dd if=/dev/ar%d of=/dev/null bs=1m &" > was launched in the background (notice the "&"). > > Cheers, > > Antoine Antoine, You're right. I flip-flopped parent and child there in my original statement. I also saw the async ('&') terminal command. But what is ultimately gained by forking another process to read a device other than just resuming control for the terminal to the user? It seems like all this does is create potential for additional zombie processes on the system... Just as an experiment, could you insert another printf or some statement to ensure that the read is deterministically completed every time? Thanks, -Garrett