public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] SAFE_MACROS: Add SAFE_SETSID()
@ 2017-06-15  9:57 Guangwen Feng
  2017-06-15  9:57 ` [LTP] [PATCH 2/2] sched/autogroup01: Add new regression test Guangwen Feng
  0 siblings, 1 reply; 5+ messages in thread
From: Guangwen Feng @ 2017-06-15  9:57 UTC (permalink / raw)
  To: ltp

Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
---
 include/tst_safe_macros.h |  3 +++
 lib/safe_macros.c         | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h
index a25a4f0..09745c1 100644
--- a/include/tst_safe_macros.h
+++ b/include/tst_safe_macros.h
@@ -430,4 +430,7 @@ int safe_removexattr(const char *file, const int lineno, const char *path,
 int safe_fsync(const char *file, const int lineno, int fd);
 #define SAFE_FSYNC(fd) safe_fsync(__FILE__, __LINE__, (fd))
 
+int safe_setsid(const char *file, const int lineno);
+#define SAFE_SETSID() safe_setsid(__FILE__, __LINE__)
+
 #endif /* SAFE_MACROS_H__ */
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index a6b4ff7..3ef9266 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -895,3 +895,16 @@ int safe_fsync(const char *file, const int lineno, int fd)
 
 	return rval;
 }
+
+pid_t safe_setsid(const char *file, const int lineno)
+{
+	pid_t rval;
+
+	rval = setsid();
+	if (rval == -1) {
+		tst_brkm(TBROK | TERRNO, NULL,
+			 "%s:%d: setsid() failed", file, lineno);
+	}
+
+	return rval;
+}
-- 
1.8.4.2




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

end of thread, other threads:[~2017-06-19 17:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-15  9:57 [LTP] [PATCH 1/2] SAFE_MACROS: Add SAFE_SETSID() Guangwen Feng
2017-06-15  9:57 ` [LTP] [PATCH 2/2] sched/autogroup01: Add new regression test Guangwen Feng
2017-06-15 14:31   ` Cyril Hrubis
2017-06-16  1:43     ` [LTP] [PATCH v2] " Guangwen Feng
2017-06-19 17:45       ` Cyril Hrubis

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