[LTP] [PATCH] getpgid01: On Android, pgid(1) is 0 instead of 1

Edward Liaw edliaw@google.com
Sat Sep 30 02:05:16 CEST 2023


Android's init does not call setpgid(0, 0) so it does not have pgid=1.
0 is functionally equivalent, since pgid 0 means the pgid is the same as
the process pid.

Signed-off-by: Edward Liaw <edliaw@google.com>
---
 testcases/kernel/syscalls/getpgid/getpgid01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/getpgid/getpgid01.c b/testcases/kernel/syscalls/getpgid/getpgid01.c
index 479fe5dcb..8640f2c93 100644
--- a/testcases/kernel/syscalls/getpgid/getpgid01.c
+++ b/testcases/kernel/syscalls/getpgid/getpgid01.c
@@ -37,7 +37,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_EXPR(TST_RET == 1 || TST_RET == 0, "getpgid(1) == 1 or 0");
 	}
 
 	tst_reap_children();
-- 
2.42.0.582.g8ccd20d70d-goog



More information about the ltp mailing list