Re: [dev][ubase] Implement switch_root

From: sin <sin_AT_2f30.org>
Date: Thu, 17 Apr 2014 12:57:24 +0100

On Thu, Apr 17, 2014 at 12:26:09PM +0200, FRIGN wrote:
> On Wed, 16 Apr 2014 23:10:23 +0100
> Dimitris Papastamos <dp_AT_spl9.org> wrote:
>
> > > i just note that pivot_root is a linux system call
> > > so implementing that tool is a one-liner in c
>
> We don't need this here, given we don't give a damn about preserving
> the initramfs somewhere.
> I would agree on using syscalls to avoid long hacks and system-specific
> behaviour, but wiping / and mounting something over it is trivial.
> Besides, I often made the experience that syscalls can turn out to be
> very complex and intransparent.
> It may be a one-liner in C, but who knows what happens behind closed
> doors?

http://git.suckless.org/ubase/tree/pivot_root.c

I am pretty sure you've seen this, but this is our implementation. It is
very trivial.

> > We already have pivot_root in ubase. Markus is basically asking
> > why we implemented switch_root in C instead of in sh (as demonstrated
> > in his e-mail).
>
> Well, sh doesn't work when you don't have a shell on your initrd (like
> I do), but you already explained that to him afaik.
> However, I think Markus just sketched the functionality in sh and
> implied it to be implemented in C regardless.

But, you implemented it :)

In any case as already mentioned, ubase-box breaks if we add shell scripts
to ubase and this cannot be fixed. Someome might suggest adding some useful
shell scripts in a directory misc/ or so in ubase but that's not the
right place and I'd like to keep sbase and ubase free of non-C code
and external runtime dependencies.
Received on Thu Apr 17 2014 - 13:57:24 CEST

This archive was generated by hypermail 2.3.0 : Thu Apr 17 2014 - 14:00:13 CEST