All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] SAFE_MACROS: Add SAFE_UNAME()
@ 2017-05-09 10:05 Guangwen Feng
  2017-05-09 10:05 ` [LTP] [PATCH 2/2] controllers/memcg_test_3: Add new regression test Guangwen Feng
  0 siblings, 1 reply; 12+ messages in thread
From: Guangwen Feng @ 2017-05-09 10:05 UTC (permalink / raw)
  To: ltp

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

diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h
index a25a4f0..c6530e0 100644
--- a/include/tst_safe_macros.h
+++ b/include/tst_safe_macros.h
@@ -24,6 +24,7 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/stat.h>
+#include <sys/utsname.h>
 #include <fcntl.h>
 #include <libgen.h>
 #include <signal.h>
@@ -430,4 +431,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_uname(const char *file, const int lineno, struct utsname *buf);
+#define SAFE_UNAME(buf) safe_uname(__FILE__, __LINE__, (buf))
+
 #endif /* SAFE_MACROS_H__ */
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index bffc5a1..aec0195 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -6,6 +6,7 @@
 #include <sys/wait.h>
 #include <sys/mount.h>
 #include <sys/xattr.h>
+#include <sys/utsname.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <libgen.h>
@@ -888,3 +889,17 @@ int safe_fsync(const char *file, const int lineno, int fd)
 
 	return rval;
 }
+
+int safe_uname(const char *file, const int lineno, struct utsname *buf)
+{
+	int rval;
+
+	rval = uname(buf);
+
+	if (rval) {
+		tst_brkm(TBROK | TERRNO, NULL,
+			 "%s:%d: uname(%p) failed", file, lineno, buf);
+	}
+
+	return rval;
+}
-- 
1.8.4.2




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

end of thread, other threads:[~2017-06-22  9:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09 10:05 [LTP] [PATCH 1/2] SAFE_MACROS: Add SAFE_UNAME() Guangwen Feng
2017-05-09 10:05 ` [LTP] [PATCH 2/2] controllers/memcg_test_3: Add new regression test Guangwen Feng
2017-05-09 11:15   ` Guangwen Feng
2017-05-09 11:21     ` [LTP] [PATCH v2 " Guangwen Feng
2017-05-30 13:02       ` Cyril Hrubis
2017-06-05  9:20         ` Guangwen Feng
2017-06-05  9:23           ` [LTP] [PATCH v3] " Guangwen Feng
2017-06-14  6:10             ` Guangwen Feng
2017-06-14  6:12               ` [LTP] [PATCH v4] " Guangwen Feng
2017-06-21 10:44                 ` Guangwen Feng
2017-06-22  9:27                 ` Cyril Hrubis
2017-06-22  9:43                   ` Guangwen Feng

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.