diff mbox series

[OpenWrt-Devel,2/2] procd: add notification if running in container

Message ID 20190522172419.20630-2-mail@aparcar.org
State Changes Requested
Delegated to: Petr Štetiar
Headers show
Series None | expand

Commit Message

Paul Spooren May 22, 2019, 5:24 p.m. UTC
Signed-off-by: Paul Spooren <mail@aparcar.org>
---
 state.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Petr Štetiar May 23, 2019, 8:42 a.m. UTC | #1
Paul Spooren <mail@aparcar.org> [2019-05-22 19:24:19]:

> Signed-off-by: Paul Spooren <mail@aparcar.org>
> ---
>  state.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/state.c b/state.c
> index ff1734f..9f196ee 100644
> --- a/state.c
> +++ b/state.c
> @@ -101,6 +101,9 @@ static void state_enter(void)
>  	switch (state) {
>  	case STATE_EARLY:
>  		LOG("- early -\n");
> +		if (is_container())
> +			LOG("This isn't real life. I'm running in a container.\n");

your commit message is missing (it's required BTW), so I don't know the reason
why do you need this change. Anyway, I don't see any valid reason to have
this in procd.

-- ynezz
Paul Spooren May 23, 2019, 11:38 a.m. UTC | #2
On 5/23/19 10:42 AM, Petr Štetiar wrote:
> Paul Spooren <mail@aparcar.org> [2019-05-22 19:24:19]:
>
>> Signed-off-by: Paul Spooren <mail@aparcar.org>
>> ---
>>  state.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/state.c b/state.c
>> index ff1734f..9f196ee 100644
>> --- a/state.c
>> +++ b/state.c
>> @@ -101,6 +101,9 @@ static void state_enter(void)
>>  	switch (state) {
>>  	case STATE_EARLY:
>>  		LOG("- early -\n");
>> +		if (is_container())
>> +			LOG("This isn't real life. I'm running in a container.\n");
> your commit message is missing (it's required BTW), so I don't know the reason
> why do you need this change. 
I can amend the patch if it's of interest.
> Anyway, I don't see any valid reason to have
> this in procd.

My motivation was to log when procd detects a container and therefore
don't mount stuff. Anyway, if it bloats the log, reject this patch.

Best,
Paul
Petr Štetiar May 23, 2019, 12:03 p.m. UTC | #3
Paul Spooren <mail@aparcar.org> [2019-05-23 13:38:52]:

> >> +++ b/state.c
> >> @@ -101,6 +101,9 @@ static void state_enter(void)
> >>  	switch (state) {
> >>  	case STATE_EARLY:
> >>  		LOG("- early -\n");
> >> +		if (is_container())
> >> +			LOG("This isn't real life. I'm running in a container.\n");
> > your commit message is missing (it's required BTW), so I don't know the reason
> > why do you need this change. 
> I can amend the patch if it's of interest.

Yes, you should include commit message if you want to continue with this in v2.

> > Anyway, I don't see any valid reason to have
> > this in procd.
> 
> My motivation was to log when procd detects a container and therefore
> don't mount stuff. Anyway, if it bloats the log, reject this patch.

Then I think, that your approach is wrong. You should output "not doing foo"
at the place where you're "not doing foo", so this LOG line belongs probably
to initd/early.c (but I'm not saying, that you should do that) where you're
not mounting the stuff in case you detect container.

Please note, that procd is used by all targets, even those tiny ones so it
would make sense to add more logging (increasing the binary size) if it's
really necessary and it provides any valuable clue during the debugging
session.

-- ynezz
diff mbox series

Patch

diff --git a/state.c b/state.c
index ff1734f..9f196ee 100644
--- a/state.c
+++ b/state.c
@@ -101,6 +101,9 @@  static void state_enter(void)
 	switch (state) {
 	case STATE_EARLY:
 		LOG("- early -\n");
+		if (is_container())
+			LOG("This isn't real life. I'm running in a container.\n");
+
 		watchdog_init(0);
 		hotplug("/etc/hotplug.json");
 		procd_coldplug();