[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH] replace siginterrupt with conforming sigaction



POSIX.1-2008 marks siginterrupt obsolete, use sigaction instead.
Implementation taken from online documents which already did the
transition.

Signed-off-by: Daniel Mierswa <impulze impulze org>
---
 lib/locking/file_locking.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)


diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c
index e205577..fa12a6b 100644
--- a/lib/locking/file_locking.c
+++ b/lib/locking/file_locking.c
@@ -30,6 +30,17 @@
 #include <fcntl.h>
 #include <signal.h>
 
+#define siginterrupt(sig, flag) \
+	int ret; \
+	struct sigaction act; \
+	(void) sigaction(sig, NULL, &act); \
+	if (flag) \
+		act.sa_flags &=  SA_RESTART; \
+	else \
+		act.sa_flags |= SA_RESTART; \
+	ret = sigaction(sig, &act, NULL); \
+	return ret;
+
 struct lock_list {
 	struct dm_list list;
 	int lf;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]