Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/vndcompress Move block_signals/restore_sigmask to ut...
details: https://anonhg.NetBSD.org/src/rev/3f9c2cbb3b58
branches: trunk
changeset: 326195:3f9c2cbb3b58
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jan 22 06:15:04 2014 +0000
description:
Move block_signals/restore_sigmask to utils.c
diffstat:
usr.bin/vndcompress/utils.c | 21 +++++++++++++++++++--
usr.bin/vndcompress/utils.h | 4 +++-
usr.bin/vndcompress/vndcompress.c | 22 ++--------------------
3 files changed, 24 insertions(+), 23 deletions(-)
diffs (113 lines):
diff -r 236e1ee8ef5b -r 3f9c2cbb3b58 usr.bin/vndcompress/utils.c
--- a/usr.bin/vndcompress/utils.c Wed Jan 22 06:14:55 2014 +0000
+++ b/usr.bin/vndcompress/utils.c Wed Jan 22 06:15:04 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: utils.c,v 1.1 2014/01/22 06:14:20 riastradh Exp $ */
+/* $NetBSD: utils.c,v 1.2 2014/01/22 06:15:04 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: utils.c,v 1.1 2014/01/22 06:14:20 riastradh Exp $");
+__RCSID("$NetBSD: utils.c,v 1.2 2014/01/22 06:15:04 riastradh Exp $");
#include <sys/types.h>
@@ -39,6 +39,7 @@
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -145,3 +146,19 @@
(void)write(STDERR_FILENO, buf, strlen(buf));
}
}
+
+void
+block_signals(sigset_t *old_sigmask)
+{
+ sigset_t block;
+
+ (void)sigfillset(&block);
+ (void)sigprocmask(SIG_BLOCK, &block, old_sigmask);
+}
+
+void
+restore_sigmask(const sigset_t *sigmask)
+{
+
+ (void)sigprocmask(SIG_SETMASK, sigmask, NULL);
+}
diff -r 236e1ee8ef5b -r 3f9c2cbb3b58 usr.bin/vndcompress/utils.h
--- a/usr.bin/vndcompress/utils.h Wed Jan 22 06:14:55 2014 +0000
+++ b/usr.bin/vndcompress/utils.h Wed Jan 22 06:15:04 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: utils.h,v 1.1 2014/01/22 06:14:20 riastradh Exp $ */
+/* $NetBSD: utils.h,v 1.2 2014/01/22 06:15:04 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -47,5 +47,7 @@
void warn_ss(const char *);
void warnx_ss(const char *, ...) __printflike(1, 2);
void vwarnx_ss(const char *, va_list) __printflike(1, 0);
+void block_signals(sigset_t *);
+void restore_sigmask(const sigset_t *);
#endif /* VNDCOMPRESS_UTILS_H */
diff -r 236e1ee8ef5b -r 3f9c2cbb3b58 usr.bin/vndcompress/vndcompress.c
--- a/usr.bin/vndcompress/vndcompress.c Wed Jan 22 06:14:55 2014 +0000
+++ b/usr.bin/vndcompress/vndcompress.c Wed Jan 22 06:15:04 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vndcompress.c,v 1.15 2014/01/22 06:14:46 riastradh Exp $ */
+/* $NetBSD: vndcompress.c,v 1.16 2014/01/22 06:15:04 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: vndcompress.c,v 1.15 2014/01/22 06:14:46 riastradh Exp $");
+__RCSID("$NetBSD: vndcompress.c,v 1.16 2014/01/22 06:15:04 riastradh Exp $");
#include <sys/endian.h>
@@ -101,8 +101,6 @@
void (*)(int));
static void info_signal_handler(int);
static void checkpoint_signal_handler(int);
-static void block_signals(sigset_t *);
-static void restore_sigmask(const sigset_t *);
static void compress_progress(struct compress_state *);
static void compress_init(int, char **, const struct options *,
struct compress_state *);
@@ -370,22 +368,6 @@
errno = error;
}
-static void
-block_signals(sigset_t *old_sigmask)
-{
- sigset_t block;
-
- (void)sigfillset(&block);
- (void)sigprocmask(SIG_BLOCK, &block, old_sigmask);
-}
-
-static void
-restore_sigmask(const sigset_t *sigmask)
-{
-
- (void)sigprocmask(SIG_SETMASK, sigmask, NULL);
-}
-
/*
* Report progress.
*
Home |
Main Index |
Thread Index |
Old Index