public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Kamal Dasu" <kdasu.kdev@gmail.com>
To: xfs@oss.sgi.com, cernekee@gmail.com
Cc: Kamal Dasu <kdasu.kdev@gmail.com>
Subject: [PATCH 1/1] xfsprogs: Use Posix signal API sigprocmask instead of sigrelse/sighold in xfs_copy.c
Date: Wed, 14 Mar 2012 16:09:28 -0400	[thread overview]
Message-ID: <1331755768-14681-2-git-send-email-kdasu.kdev@gmail.com> (raw)
In-Reply-To: <1331755768-14681-1-git-send-email-kdasu.kdev@gmail.com>

From sigrelse and sighold man page

DESCRIPTION
       These  functions are provided in glibc as a compatibility interface for
       programs that make use of the historical System V signal API.  This API
       is  obsolete:  new applications should use the POSIX signal API (sigac‐
       tion(2), sigprocmask(2), etc.)

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
---
 copy/xfs_copy.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index c01e0b9..800f4fd 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -71,6 +71,16 @@ xfs_off_t write_log_header(int fd, wbuf *w, xfs_mount_t *mp);
 #define PRE	0x08		/* append strerror string */
 #define LAST	0x10		/* final message we print */
 
+static void
+signal_maskfunc(int sig, int how) 
+{
+	sigset_t set;
+
+	sigemptyset(&set);
+	sigaddset(&set, sig);
+	sigprocmask(how, &set, NULL);
+}
+
 void
 do_message(int flags, int code, const char *fmt, ...)
 {
@@ -478,9 +488,9 @@ write_wbuf(void)
 		if (target[i].state != INACTIVE)
 			pthread_mutex_unlock(&targ[i].wait);	/* wake up */
 
-	sigrelse(SIGCHLD);
+	signal_maskfunc(SIGCHLD, SIG_UNBLOCK);
 	pthread_mutex_lock(&mainwait);
-	sighold(SIGCHLD);
+	signal_maskfunc(SIGCHLD, SIG_BLOCK);
 }
 
 
@@ -847,7 +857,7 @@ main(int argc, char **argv)
 	/* set up sigchild signal handler */
 
 	signal(SIGCHLD, handler);
-	sighold(SIGCHLD);
+	signal_maskfunc(SIGCHLD, SIG_BLOCK);
 
 	/* make children */
 
-- 
1.7.5.4


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2012-03-14 20:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-14 20:09 [PATCH 0/1] : xfsprogs: Use Posix signal API sigprocmask V2 Kamal Dasu
2012-03-14 20:09 ` Kamal Dasu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331755768-14681-2-git-send-email-kdasu.kdev@gmail.com \
    --to=kdasu.kdev@gmail.com \
    --cc=cernekee@gmail.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox