Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 2008 01:04:57 -0700
From:      "Garrett Cooper" <yanefbsd@gmail.com>
To:        "Antoine Brodin" <antoine@freebsd.org>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: bin/125680: atacontrol(8): atacontrol depends on executable in /usr
Message-ID:  <7d6fde3d0807210104t188b6ab5hc61dc67c49d27188@mail.gmail.com>
In-Reply-To: <f19c444a0807210039v99e8701g6c9c1fcb4f3e7b5@mail.gmail.com>
References:  <200807202210.m6KMA4cm032331@freefall.freebsd.org> <7d6fde3d0807201714g49eb4a80ncfcc1cc800ad595e@mail.gmail.com> <f19c444a0807210039v99e8701g6c9c1fcb4f3e7b5@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 21, 2008 at 12:39 AM, Antoine Brodin <antoine@freebsd.org> wrote:
> On Mon, Jul 21, 2008 at 2:14 AM, Garrett Cooper <yanefbsd@gmail.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7d6fde3d0807210104t188b6ab5hc61dc67c49d27188>