* [LTP] [PATCH v3] getpgid01: On Android, pgid(1) is 0 instead of 1
@ 2023-10-27 19:00 Edward Liaw via ltp
2023-10-30 7:40 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Edward Liaw via ltp @ 2023-10-27 19:00 UTC (permalink / raw)
To: ltp; +Cc: kernel-team
Android's init does not call setpgid(0, 0) so it does not have pgid=1.
In either case, the pgid should match /proc/1/stat, so compare
getpgid(1) against that.
Signed-off-by: Edward Liaw <edliaw@google.com>
---
testcases/kernel/syscalls/getpgid/getpgid01.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/getpgid/getpgid01.c b/testcases/kernel/syscalls/getpgid/getpgid01.c
index 479fe5dcb..de05a434b 100644
--- a/testcases/kernel/syscalls/getpgid/getpgid01.c
+++ b/testcases/kernel/syscalls/getpgid/getpgid01.c
@@ -13,6 +13,14 @@
#include "tst_test.h"
+static int get_init_pgid()
+{
+ int pgid;
+
+ SAFE_FILE_SCANF("/proc/1/stat", "%*d %*s %*c %*d %d", &pgid);
+ return pgid;
+}
+
static void run(void)
{
pid_t pid_1, child_pid, pgid;
@@ -37,7 +45,7 @@ static void run(void)
TST_EXP_EQ_LI(TST_RET, pgid);
TST_EXP_PID(getpgid(1));
- TST_EXP_EQ_LI(TST_RET, 1);
+ TST_EXP_EQ_LI(TST_RET, get_init_pgid());
}
tst_reap_children();
--
2.42.0.820.g83a721a137-goog
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH v3] getpgid01: On Android, pgid(1) is 0 instead of 1
2023-10-27 19:00 [LTP] [PATCH v3] getpgid01: On Android, pgid(1) is 0 instead of 1 Edward Liaw via ltp
@ 2023-10-30 7:40 ` Petr Vorel
2023-10-30 10:06 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2023-10-30 7:40 UTC (permalink / raw)
To: Edward Liaw; +Cc: kernel-team, ltp
Hi Edward,
> Android's init does not call setpgid(0, 0) so it does not have pgid=1.
> In either case, the pgid should match /proc/1/stat, so compare
> getpgid(1) against that.
> Signed-off-by: Edward Liaw <edliaw@google.com>
> ---
> testcases/kernel/syscalls/getpgid/getpgid01.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
> diff --git a/testcases/kernel/syscalls/getpgid/getpgid01.c b/testcases/kernel/syscalls/getpgid/getpgid01.c
> index 479fe5dcb..de05a434b 100644
> --- a/testcases/kernel/syscalls/getpgid/getpgid01.c
> +++ b/testcases/kernel/syscalls/getpgid/getpgid01.c
> @@ -13,6 +13,14 @@
> #include "tst_test.h"
> +static int get_init_pgid()
static int get_init_pgid(void)
We still use -std=gnu99, thus we need that otherwise compiler complains
warning: old-style function definition [-Wold-style-definition].
It can be fixed during merge.
Kind regards,
Petr
> +{
> + int pgid;
> +
> + SAFE_FILE_SCANF("/proc/1/stat", "%*d %*s %*c %*d %d", &pgid);
> + return pgid;
> +}
> +
> static void run(void)
> {
> pid_t pid_1, child_pid, pgid;
> @@ -37,7 +45,7 @@ static void run(void)
> TST_EXP_EQ_LI(TST_RET, pgid);
> TST_EXP_PID(getpgid(1));
> - TST_EXP_EQ_LI(TST_RET, 1);
> + TST_EXP_EQ_LI(TST_RET, get_init_pgid());
> }
> tst_reap_children();
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH v3] getpgid01: On Android, pgid(1) is 0 instead of 1
2023-10-30 7:40 ` Petr Vorel
@ 2023-10-30 10:06 ` Cyril Hrubis
2023-10-30 11:06 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2023-10-30 10:06 UTC (permalink / raw)
To: Petr Vorel; +Cc: kernel-team, ltp
Hi!
> > +static int get_init_pgid()
> static int get_init_pgid(void)
>
> We still use -std=gnu99, thus we need that otherwise compiler complains
> warning: old-style function definition [-Wold-style-definition].
>
> It can be fixed during merge.
With that fixed:
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH v3] getpgid01: On Android, pgid(1) is 0 instead of 1
2023-10-30 10:06 ` Cyril Hrubis
@ 2023-10-30 11:06 ` Petr Vorel
0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2023-10-30 11:06 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: kernel-team, ltp
> Hi!
> > > +static int get_init_pgid()
> > static int get_init_pgid(void)
> > We still use -std=gnu99, thus we need that otherwise compiler complains
> > warning: old-style function definition [-Wold-style-definition].
> > It can be fixed during merge.
> With that fixed:
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Great, merged.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-30 11:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-27 19:00 [LTP] [PATCH v3] getpgid01: On Android, pgid(1) is 0 instead of 1 Edward Liaw via ltp
2023-10-30 7:40 ` Petr Vorel
2023-10-30 10:06 ` Cyril Hrubis
2023-10-30 11:06 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox