Re: [PATCH v3 3/4] nsenter: new applet

2016-03-14 Thread Mike Frysinger
On 14 Mar 2016 16:15, Rich Felker wrote: > On Mon, Mar 14, 2016 at 02:27:56PM -0400, Mike Frysinger wrote: > > On 14 Mar 2016 18:11, Bartosz Gołaszewski wrote: > > > 2016-03-14 15:27 GMT+01:00 Mike Frysinger : > > > > On 14 Mar 2016 11:07, Bartosz Golaszewski wrote: > > > >>

Re: [PATCH v3 3/4] nsenter: new applet

2016-03-14 Thread Rich Felker
On Mon, Mar 14, 2016 at 02:27:56PM -0400, Mike Frysinger wrote: > On 14 Mar 2016 18:11, Bartosz Gołaszewski wrote: > > 2016-03-14 15:27 GMT+01:00 Mike Frysinger : > > > On 14 Mar 2016 11:07, Bartosz Golaszewski wrote: > > >> +#ifndef __BB_NAMESPACE_H > > >> +#define

Re: [PATCH v3 3/4] nsenter: new applet

2016-03-14 Thread Rich Felker
On Mon, Mar 14, 2016 at 10:27:19AM -0400, Mike Frysinger wrote: > On 14 Mar 2016 11:07, Bartosz Golaszewski wrote: > > +#ifndef __BB_NAMESPACE_H > > +#define __BB_NAMESPACE_H > > use a naming style like other busybox headers And in particular, don't use leading underscores, ever. They're not

Re: [PATCH v3 3/4] nsenter: new applet

2016-03-14 Thread Michael Conrad
On 3/14/2016 2:27 PM, Mike Frysinger wrote: the code seems to assume that the byte size scales into the number of chars required to represent the number in base 10 when it's really a log scale. here's a table to show it's wonky: The number of bytes is also a log scale. The ratio of log_256

Re: [PATCH v3 3/4] nsenter: new applet

2016-03-14 Thread Mike Frysinger
On 14 Mar 2016 14:27, Mike Frysinger wrote: > On 14 Mar 2016 18:11, Bartosz Gołaszewski wrote: > > 2016-03-14 15:27 GMT+01:00 Mike Frysinger : > > > On 14 Mar 2016 11:07, Bartosz Golaszewski wrote: > > >> +#ifndef __BB_NAMESPACE_H > > >> +#define __BB_NAMESPACE_H > > > > > > use

Re: [PATCH v3 3/4] nsenter: new applet

2016-03-14 Thread Mike Frysinger
On 14 Mar 2016 18:11, Bartosz Gołaszewski wrote: > 2016-03-14 15:27 GMT+01:00 Mike Frysinger : > > On 14 Mar 2016 11:07, Bartosz Golaszewski wrote: > >> +#ifndef __BB_NAMESPACE_H > >> +#define __BB_NAMESPACE_H > > > > use a naming style like other busybox headers > > > >> +/* >

Re: [PATCH v3 3/4] nsenter: new applet

2016-03-14 Thread Bartosz Gołaszewski
2016-03-14 15:27 GMT+01:00 Mike Frysinger : > On 14 Mar 2016 11:07, Bartosz Golaszewski wrote: >> +#ifndef __BB_NAMESPACE_H >> +#define __BB_NAMESPACE_H > > use a naming style like other busybox headers > >> +/* >> + * Longest possible path to a procfs file used in namespace

Re: [PATCH v2 2/4] unshare: new applet

2016-03-14 Thread Bartosz Gołaszewski
2016-03-14 15:11 GMT+01:00 Mike Frysinger : > On 14 Mar 2016 11:08, Bartosz Gołaszewski wrote: >> 2016-03-11 18:24 GMT+01:00 Mike Frysinger : >> > On 11 Mar 2016 18:10, Bartosz Golaszewski wrote: >> >> +int unshare_main(int argc UNUSED_PARAM, char **argv) >>

[PATCH v4 4/4] namespace utils: code shrink

2016-03-14 Thread Bartosz Golaszewski
Both unshare and nsenter use similar code to fork and have the parent wait for child's completion. Move it to a common library function. function old new delta continue_as_child - 105+105 unshare_main

[PATCH v4 0/4] util-linux: namespace utils

2016-03-14 Thread Bartosz Golaszewski
This series adds two namespaces-related applets reimplementing most arguments supported by their upstream util-linux counterparts. The fourth patch is an optional code shrink. v4: - split the namespace structure into the read-only and modifiable parts - made the read-only definition const and

[PATCH v4 3/4] nsenter: new applet

2016-03-14 Thread Bartosz Golaszewski
Implement a fully featured (sans selinux part) nsenter applet. Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.h | 20 +++ util-linux/nsenter.c | 367 + util-linux/unshare.c | 12 +- 3 files changed, 390

[PATCH v4 2/4] unshare: new applet

2016-03-14 Thread Bartosz Golaszewski
Add a fully featured unshare implementation implementing all arguments supported in the upstream version. Signed-off-by: Bartosz Golaszewski --- util-linux/unshare.c | 464 +++ 1 file changed, 464 insertions(+) create mode

[PATCH v4 1/4] libbb: add BIT() macro

2016-03-14 Thread Bartosz Golaszewski
This macro - taken from the linux kernel source - improves readability of single bit definitions. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index d05ac29..fcad060 100644

Re: [PATCH v3 3/4] nsenter: new applet

2016-03-14 Thread Mike Frysinger
On 14 Mar 2016 11:07, Bartosz Golaszewski wrote: > +#ifndef __BB_NAMESPACE_H > +#define __BB_NAMESPACE_H use a naming style like other busybox headers > +/* > + * Longest possible path to a procfs file used in namespace utils. Must be > + * able to contain the '/proc/' string, the '/ns/user'

Re: [PATCH v2 2/4] unshare: new applet

2016-03-14 Thread Mike Frysinger
On 14 Mar 2016 11:08, Bartosz Gołaszewski wrote: > 2016-03-11 18:24 GMT+01:00 Mike Frysinger : > > On 11 Mar 2016 18:10, Bartosz Golaszewski wrote: > >> +int unshare_main(int argc UNUSED_PARAM, char **argv) > >> +{ > >> + static struct namespace ns_list[] = { > > > > const ?

Re: [PATCH v2 2/4] unshare: new applet

2016-03-14 Thread Bartosz Gołaszewski
2016-03-11 18:24 GMT+01:00 Mike Frysinger : > On 11 Mar 2016 18:10, Bartosz Golaszewski wrote: >> +int unshare_main(int argc UNUSED_PARAM, char **argv) >> +{ >> + static struct namespace ns_list[] = { > > const ? > Nope, we're using char *path to store the mount points. >>

[PATCH v3 4/4] namespace utils: code shrink

2016-03-14 Thread Bartosz Golaszewski
Both unshare and nsenter use similar code to fork and have the parent wait for child's completion. Move it to a common library function. function old new delta continue_as_child - 105+105 unshare_main

[PATCH v3 2/4] unshare: new applet

2016-03-14 Thread Bartosz Golaszewski
Add a fully featured unshare implementation implementing all arguments supported in the upstream version. Signed-off-by: Bartosz Golaszewski --- util-linux/unshare.c | 453 +++ 1 file changed, 453 insertions(+) create mode

[PATCH v3 0/4] util-linux: namespace utils

2016-03-14 Thread Bartosz Golaszewski
This series adds two namespaces-related applets reimplementing most arguments supported by their upstream util-linux counterparts. The fourth patch is an optional code shrink. v3: - moved the namespace positions into an enum for better readability v2: - v1 was badly rebased and patch 3/4 didn't

[PATCH v3 1/4] libbb: add BIT() macro

2016-03-14 Thread Bartosz Golaszewski
This macro - taken from the linux kernel source - improves readability of single bit definitions. Signed-off-by: Bartosz Golaszewski --- include/libbb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index d05ac29..fcad060 100644

[PATCH v3 3/4] nsenter: new applet

2016-03-14 Thread Bartosz Golaszewski
Implement a fully featured (sans selinux part) nsenter applet. Signed-off-by: Bartosz Golaszewski --- util-linux/namespace.h | 20 +++ util-linux/nsenter.c | 362 + util-linux/unshare.c | 12 +- 3 files changed, 385