LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Rob Landley <rob@landley.net>
To: David Lang <david.lang@digitalinsight.com>
Cc: linux-kernel@vger.kernel.org,
	David McCullough <david_mccullough@au.securecomputing.com>
Subject: Re: Feature request: exec self for NOMMU.
Date: Tue, 26 Dec 2006 19:39:56 -0500
Message-ID: <200612261939.57359.rob@landley.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0612261549050.24795@qynat.qvtvafvgr.pbz>

On Tuesday 26 December 2006 6:55 pm, David Lang wrote:
> > Worse, it's not always possible.  If chroot() has happened since the 
program
> > started, there may not _be_ a path to my current executable available from
> > this process's current or root directories.
> 
> does this even make sense (as a general purpose function)? if the executable 
> isn't available in your path it's likly that any config files it needs are
> not available either.

For a statically linked busybox it makes sense, but you're right that a 
dynamically linked one is going to suck however you do it...

I guess what I really want to do is promote a vfork() to a real fork() after 
the fact.  Which sounds painful.

For the daemonize() case I want to unblock the parent and have it exit.  Too 
bad I can't call clone() with some kind of CLONE_VFORK_BACKWARDS so it blocks 
the child until the parent exits.  (Hmmm...  CLONE_STOPPED doesn't help, just 
moves the race...)

For the "new process runs code out of this executable" case what I really want 
is an actual fork, hideously expensive as that is on nommu systems.  (There 
are things I can do to minimize that.)  Maybe I can call clone() directly on 
a nommu system to get it to fork, even when the C library hasn't got it?  
Hmmm...

> for something like busybox/toolbox where you have different functions based
> on the name used to execute the program, which name would you use?

The one from argv[0].  (Notice how exec has a "path to executable" and then an 
argv array?  Nobody said that the path to executable and argv[0] had to point 
to the same string...)

Rob
-- 
"Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away." - Antoine de Saint-Exupery

  reply index

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-26 23:23 Rob Landley
2006-12-26 23:55 ` David Lang
2006-12-27  0:39   ` Rob Landley [this message]
2006-12-27  4:24   ` Denis Vlasenko
2006-12-27  5:44     ` Rob Landley
2006-12-27  5:13 ` Ray Lee
2006-12-27  5:51   ` Rob Landley
2006-12-27  6:08     ` Vadim Lobanov
2006-12-27  8:29       ` Rob Landley
2006-12-27 18:49         ` Ray Lee
2006-12-27 21:13           ` Rob Landley
2006-12-27 18:35   ` Denis Vlasenko
2006-12-27 21:03     ` Rob Landley
2006-12-28  2:48       ` Denis Vlasenko
2006-12-28  5:32         ` Rob Landley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200612261939.57359.rob@landley.net \
    --to=rob@landley.net \
    --cc=david.lang@digitalinsight.com \
    --cc=david_mccullough@au.securecomputing.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git