Date: Fri, 29 May 2009 11:49:21 +0200 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> To: Alfred Perlstein <alfred@freebsd.org> Cc: Nate Eldredge <neldredge@math.ucsd.edu>, yuri@rawbw.com, freebsd-hackers@freebsd.org Subject: Re: Why kernel kills processes that run out of memory instead of just failing memory allocation system calls? Message-ID: <863aaow866.fsf@ds4.des.no> In-Reply-To: <20090528213017.GX67847@elvis.mu.org> (Alfred Perlstein's message of "Thu, 28 May 2009 14:30:17 -0700") References: <4A14F58F.8000801@rawbw.com> <Pine.GSO.4.64.0905202344420.1483@zeno.ucsd.edu> <4A1594DA.2010707@rawbw.com> <86ljoig08o.fsf@ds4.des.no> <20090528213017.GX67847@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Alfred Perlstein <alfred@freebsd.org> writes: > Dag-Erling Sm=C3=B8rgrav <des@des.no> writes: > > Usually, what you see is closer to this: > >=20 > > if ((pid =3D fork()) =3D=3D 0) { > > for (int fd =3D 3; fd < getdtablesize(); ++fd) > > (void)close(fd); > > execve(path, argv, envp); > > _exit(1); > > } > > I'm probably missing something, but couldn't you iterate=20 > in the parent setting the close-on-exec flag then vfork? This is an example, Alfred. Like most examples, it is greatly simplified. I invite you to peruse the source to find real-world instances of non-trivial fork() / execve() usage. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?863aaow866.fsf>