Re: Feature request: exec self for NOMMU.

2006-12-27 Thread Rob Landley
On Wednesday 27 December 2006 9:48 pm, Denis Vlasenko wrote: > Yes Rob, I know it can be done like this. But we don't want this. > In the tar example, we want : > > 'Run my own binary again, with parameters: "zcat" "a.tar.gz", > even if there is no [/usr][/local]/bin/zcat -> busybox link anywhere'

Re: Feature request: exec self for NOMMU.

2006-12-27 Thread Denis Vlasenko
On Wednesday 27 December 2006 22:03, Rob Landley wrote: > On Wednesday 27 December 2006 1:35 pm, Denis Vlasenko wrote: > > This solves chroot problem. How to find path-to-yourself reliably > > (for one, without using /proc/self/exe) is not obvious to me. > > Been there, done that. Both my toybox

Re: Feature request: exec self for NOMMU.

2006-12-27 Thread Rob Landley
On Wednesday 27 December 2006 1:49 pm, Ray Lee wrote: > >>> I haven't got a man page for fexecve. Does libc have it? > >> It's implemented inside glibc, and uses /proc to execve() the file that > >> the fd points to. > > Oh, hmm. Then I think it won't work, will it? I'd assumed fexecve was > impl

Re: Feature request: exec self for NOMMU.

2006-12-27 Thread Rob Landley
On Wednesday 27 December 2006 1:35 pm, Denis Vlasenko wrote: > This solves chroot problem. How to find path-to-yourself reliably > (for one, without using /proc/self/exe) is not obvious to me. Been there, done that. Both my toybox and Firmware Linux projects do this. In FWL it's line 115 of thi

Re: Feature request: exec self for NOMMU.

2006-12-27 Thread Ray Lee
Rob Landley wrote: > On Wednesday 27 December 2006 1:08 am, Vadim Lobanov wrote: >> On Wed, 2006-12-27 at 00:51 -0500, Rob Landley wrote: >>> On Wednesday 27 December 2006 12:13 am, Ray Lee wrote: How about openning an fd to yourself at the beginning of execution, then calling fexecve lat

Re: Feature request: exec self for NOMMU.

2006-12-27 Thread Denis Vlasenko
On Wednesday 27 December 2006 06:13, Ray Lee wrote: > On 12/26/06, Rob Landley <[EMAIL PROTECTED]> wrote: > > I'm trying to make some nommu-friendly busybox-like tools, which means using > > vfork() instead of fork(). This means that after I fork I have to exec in > > the child to unblock the pare

Re: Feature request: exec self for NOMMU.

2006-12-27 Thread Rob Landley
On Wednesday 27 December 2006 1:08 am, Vadim Lobanov wrote: > On Wed, 2006-12-27 at 00:51 -0500, Rob Landley wrote: > > On Wednesday 27 December 2006 12:13 am, Ray Lee wrote: > > > How about openning an fd to yourself at the beginning of execution, then > > > calling fexecve later? > > > > I haven

Re: Feature request: exec self for NOMMU.

2006-12-26 Thread Vadim Lobanov
On Wed, 2006-12-27 at 00:51 -0500, Rob Landley wrote: > On Wednesday 27 December 2006 12:13 am, Ray Lee wrote: > > How about openning an fd to yourself at the beginning of execution, then > > calling fexecve later? > > I haven't got a man page for fexecve. Does libc have it? It's implemented ins

Re: Feature request: exec self for NOMMU.

2006-12-26 Thread Rob Landley
On Wednesday 27 December 2006 12:13 am, Ray Lee wrote: > How about openning an fd to yourself at the beginning of execution, then > calling fexecve later? I haven't got a man page for fexecve. Does libc have it? In the 2.6.19 kernel: "find . | xargs grep fexecve" produces no hits. Are you sure

Re: Feature request: exec self for NOMMU.

2006-12-26 Thread Rob Landley
On Tuesday 26 December 2006 11:24 pm, Denis Vlasenko wrote: > busybox needs it in order to spawn, for example, gzip/bzip2 helper > for tar. We know that our own executable has this function. > How to execute _our own executable_? exec("/proc/self/exe") > works only if /proc is mounted. I can imagin

Re: Feature request: exec self for NOMMU.

2006-12-26 Thread Ray Lee
On 12/26/06, Rob Landley <[EMAIL PROTECTED]> wrote: I'm trying to make some nommu-friendly busybox-like tools, which means using vfork() instead of fork(). This means that after I fork I have to exec in the child to unblock the parent, and if I want to exec my current executable I have to find o

Re: Feature request: exec self for NOMMU.

2006-12-26 Thread Denis Vlasenko
On Wednesday 27 December 2006 00:55, David Lang wrote: > On Tue, 26 Dec 2006, Rob Landley wrote: > > > I'm trying to make some nommu-friendly busybox-like tools, which means using > > vfork() instead of fork(). This means that after I fork I have to exec in > > the child to unblock the parent, an

Re: Feature request: exec self for NOMMU.

2006-12-26 Thread Rob Landley
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

Re: Feature request: exec self for NOMMU.

2006-12-26 Thread David Lang
On Tue, 26 Dec 2006, Rob Landley wrote: I'm trying to make some nommu-friendly busybox-like tools, which means using vfork() instead of fork(). This means that after I fork I have to exec in the child to unblock the parent, and if I want to exec my current executable I have to find out where it

Feature request: exec self for NOMMU.

2006-12-26 Thread Rob Landley
I'm trying to make some nommu-friendly busybox-like tools, which means using vfork() instead of fork(). This means that after I fork I have to exec in the child to unblock the parent, and if I want to exec my current executable I have to find out where it lives so I can feed the path to exec().