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

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



On 23.08.2009 00:04, Alasdair G Kergon wrote:
> Can you give URL references to save people reading this having to hunt them
> down?
> 
> Alasdair
Sure, here's an updated patch with URLs.
>From f3ac04006530d4e2b7965e80aaf3ea5bf95e6444 Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze impulze org>
Date: Mon, 17 Aug 2009 21:51:22 +0200
Subject: [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.

The relevant POSIX.1-2008 bits and implementation can be found here:
http://www.opengroup.org/onlinepubs/9699919799/functions/siginterrupt.html

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;
-- 
1.6.4


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