getpgid01: On Android, pgid(1) is 0 instead of 1
PATCH v3 1/1 getpgid01: On Android, pgid(1) is 0 instead of 1
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.
--- testcases/kernel/syscalls/getpgid/getpgid01.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/getpgid/getpgid01.c +9 -1
@@ -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 ();
Signature · 5 lines
2.42.0.820.g83a721a137-goog -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Edward,
Quoted 15 lines
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 <[email protected]>--- testcases/kernel/syscalls/getpgid/getpgid01.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)testcases/kernel/syscalls/getpgid/getpgid01.c +0
-0
testcases/kernel/syscalls/getpgid/getpgid01.c line 16
Quoted 4 lines
testcases/kernel/syscalls/getpgid/getpgid01.c +1
-0@@ -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
Quoted 19 lines
testcases/kernel/syscalls/getpgid/getpgid01.c +8
-1+{ +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 ();
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Cyril Hrubis
Reviewed-byHi!
Quoted 7 lines
Quoted 1 line
+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:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 4 lines
Hi!
Quoted 2 lines
Quoted 1 line
+static int
get_init_pgid()static int
get_init_pgid(void)
Quoted 8 lines
Quoted 4 lines
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 <[email protected]>
Great, merged.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp