Skip to contentSkip to conversation

Rewrite sigrelse01.c with new APIs

PATCH In review lufei 2 participants 2 messages Oct 22, 2025 – Jan 6

lore
Share & tools
lore

lufei

author
#0 lore raw

PATCH 1/1 Rewrite sigrelse01.c with new APIs

Update sigrelse01.c with new APIs (using tst_test.h), fix the make check errors and warnings, keep the test steps/phases as possible.

---
 testcases/kernel/syscalls/sigrelse/sigrelse.h |  78 ++
 .../kernel/syscalls/sigrelse/sigrelse01.c     | 824 +++---------------
 2 files changed, 210 insertions(+), 692 deletions(-)
 create mode 100644 testcases/kernel/syscalls/sigrelse/sigrelse.h
testcases/kernel/syscalls/sigrelse/sigrelse.h new file +78 -0
new file mode 100644
index 000000000..a3ba6a773
@@ -0,0 +1,78 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2025 lufei <[email protected]>
+ */
+
+
+
+/* Needed for NPTL */
+#define SIGCANCEL 32
+#define SIGTIMER 33
+
+/* child exit values */
+#define EXIT_OK    0
+#define SIG_CAUGHT 8
+#define HANDLE_ERR 32
+
+/* ensure that NUMSIGS is defined. */
+#ifndef NUMSIGS
+#define NUMSIGS NSIG
+#endif
+
+
+#ifdef __linux__
+/* glibc2.2 definition needs -D_XOPEN_SOURCE, which breaks other things. */
+extern int sighold(int __sig);
+extern int sigrelse(int __sig);
+#endif
+
+static int choose_sig(int sig)
+{
+	switch (sig) {
+	case SIGKILL:
+	case SIGSTOP:
+	case SIGTSTP:
+	case SIGCONT:
+	case SIGALRM:
+	case SIGUSR1:
+	case SIGTERM:
+	case SIGINT:
+	case SIGCANCEL:
+	case SIGTIMER:
+#ifdef SIGNOBDM
+	case SIGNOBDM:
+#endif
+#ifdef SIGTTIN
+	case SIGTTIN:
+#endif
+#ifdef SIGTTOU
+	case SIGTTOU:
+#endif
+#ifdef SIGPTINTR
+	case SIGPTINTR:
+#endif
+#ifdef SIGSWAP
+	case SIGSWAP:
+#endif
+		return 0;
+	}
+
+	if (sig < 32)
+		return 1;
+
+	return sig >= SIGRTMIN && sig <= SIGRTMAX;
+}
+
+static char *read_pipe(int fd)
+{
+	static char buf[4096];	/* buffer for pipe read */
+	int ret;
+
+	ret = read(fd, buf, sizeof(buf));
+	if (ret <= 0)
+		return NULL;
+
+	return buf;
+}
+
testcases/kernel/syscalls/sigrelse/sigrelse01.c +132 -692

916 lines not on this page · raw message

Signature · 5 lines
2.39.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi!

Sorry for the late reply.

Before starting a review, can we ask you why this test needs to be refactored? It's always good to refactoring old tests, but this one in particular is testing a feature that has been deprecated since POSIX.1-2008 (~2016) and replaced by sigaction. We usually give low priority to these patches in this case.

Thanks :)

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp