All of lore.kernel.org
 help / color / mirror / Atom feed
From: Edward Liaw via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Cc: kernel-team@android.com
Subject: [LTP] [PATCH v3] getpgid01: On Android, pgid(1) is 0 instead of 1
Date: Fri, 27 Oct 2023 19:00:29 +0000	[thread overview]
Message-ID: <20231027190029.3820505-1-edliaw@google.com> (raw)

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

             reply	other threads:[~2023-10-27 19:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27 19:00 Edward Liaw via ltp [this message]
2023-10-30  7:40 ` [LTP] [PATCH v3] getpgid01: On Android, pgid(1) is 0 instead of 1 Petr Vorel
2023-10-30 10:06   ` Cyril Hrubis
2023-10-30 11:06     ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231027190029.3820505-1-edliaw@google.com \
    --to=ltp@lists.linux.it \
    --cc=edliaw@google.com \
    --cc=kernel-team@android.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.