[LTP] [PATCH] sigaction:16-1: leave it untested on the Linux kernel less than 2.6.22

Wanlong Gao
2013-08-05T02:15:33Z

As the Linux signal(7) said:
POSIX semaphore interfaces: sem_wait(3) and sem_timedwait(3) (since Linux 2.6.22; beforehand, always failed with EINTR).

So, on linux, we just leave this untested when the kernel version
is less than 2.6.22.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
---
.../conformance/interfaces/sigaction/16-1.c | 6 +++
testcases/open_posix_testsuite/include/kvercmp.h | 56 ++++++++++++++++++++++
2 files changed, 62 insertions(+)
create mode 100644 testcases/open_posix_testsuite/include/kvercmp.h

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c
index 530b5b6..8241246 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c
@@ -39,6 +39,7 @@
#include <signal.h>
#include <errno.h>
#include <posixtest.h>
+#include "kvercmp.h"

/*
* Define an array of signals we want to test against.
@@ -215,6 +216,11 @@ int main(void)
struct sigaction sa;
struct sigaction sa_org;

+#ifdef __linux__
+ if (tst_kvercmp(2, 6, 22) < 0)
+ return PTS_UNTESTED;
+#endif
+
sa.sa_flags = SA_RESTART;
sa.sa_handler = handler;

diff --git a/testcases/open_posix_testsuite/include/kvercmp.h b/testcases/open_posix_testsuite/include/kvercmp.h
new file mode 100644
index 0000000..688e34a
--- /dev/null
+++ b/testcases/open_posix_testsuite/include/kvercmp.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2003 International Business Machines Corp.
+ * Copyright (c) 2013 Fujitsu Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms in version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef __linux__
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/utsname.h>
+
+static void get_kver(int *k1, int *k2, int *k3)
+{
+ struct utsname uval;
+ char *kver;
+ char *r1, *r2, *r3;
+ extern char *strsep();
+
+ uname(&uval);
+ kver = uval.release;
+ r1 = strsep(&kver, ".");
+ r2 = strsep(&kver, ".");
+ r3 = strsep(&kver, ".");
+
+ *k1 = atoi(r1);
+ *k2 = atoi(r2);
+ *k3 = atoi(r3);
+}
+
+static int tst_kvercmp(int r1, int r2, int r3)
+{
+ int a1, a2, a3;
+ int testver, currver;
+
+ get_kver(&a1, &a2, &a3);
+ testver = (r1 << 16) + (r2 << 8) + r3;
+ currver = (a1 << 16) + (a2 << 8) + a3;
+
+ return currver - testver;
+}
+#endif
--
1.8.4.rc0.11.g35f5eaa

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.