public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH V3 1/6] tst_safe_macros: SAFE_GETPGID
@ 2016-08-04 14:16 Stanislav Kholmanskikh
  2016-08-04 14:16 ` [LTP] [PATCH V3 2/6] tst_test: make reap_children() part of the test API Stanislav Kholmanskikh
  0 siblings, 1 reply; 9+ messages in thread
From: Stanislav Kholmanskikh @ 2016-08-04 14:16 UTC (permalink / raw)
  To: ltp

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
No changes since V1


 include/tst_safe_macros.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h
index 540fcb2..3cf154e 100644
--- a/include/tst_safe_macros.h
+++ b/include/tst_safe_macros.h
@@ -135,6 +135,22 @@ static inline int safe_setpgid(const char *file, const int lineno,
 #define SAFE_SETPGID(pid, pgid) \
 	safe_setpgid(__FILE__, __LINE__, (pid), (pgid));
 
+static inline pid_t safe_getpgid(const char *file, const int lineno,
+				 pid_t pid)
+{
+	pid_t pgid;
+
+	pgid = getpgid(pid);
+	if (pgid == -1) {
+		tst_brk_(file, lineno, TBROK | TERRNO,
+			 "getpgid(%i) failed", pid);
+	}
+
+	return pgid;
+}
+#define SAFE_GETPGID(pid) \
+	safe_getpgid(__FILE__, __LINE__, (pid))
+
 #define SAFE_UNLINK(pathname) \
 	safe_unlink(__FILE__, __LINE__, NULL, (pathname))
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-08-05  8:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-04 14:16 [LTP] [PATCH V3 1/6] tst_safe_macros: SAFE_GETPGID Stanislav Kholmanskikh
2016-08-04 14:16 ` [LTP] [PATCH V3 2/6] tst_test: make reap_children() part of the test API Stanislav Kholmanskikh
2016-08-04 14:16   ` [LTP] [PATCH V3 3/6] waitpid06: use the new API Stanislav Kholmanskikh
2016-08-04 14:16     ` [LTP] [PATCH V3 4/6] waitpid07: " Stanislav Kholmanskikh
2016-08-04 14:16       ` [LTP] [PATCH V3 5/6] waitpid08: " Stanislav Kholmanskikh
2016-08-04 14:16         ` [LTP] [PATCH V3 6/6] waitpid11: " Stanislav Kholmanskikh
2016-08-04 16:13   ` [LTP] [PATCH V3 2/6] tst_test: make reap_children() part of the test API Cyril Hrubis
2016-08-05  8:30     ` Cyril Hrubis
2016-08-05  8:56     ` Stanislav Kholmanskikh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox