From 8e2cfec1cdf34068f2378aae9fe8f5ec0f821e21 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 12 Mar 2008 23:19:35 +0000 Subject: libbb: introduse and use signal_[no_]SA_RESTART_empty_mask and sigaction_set signal_SA_RESTART_empty_mask - 65 +65 signal_no_SA_RESTART_empty_mask - 54 +54 dd_main 1325 1369 +44 sigaction_set - 19 +19 dname_enc 373 377 +4 UNSPEC_print 64 66 +2 setsignal 296 294 -2 bb_signals_recursive 95 92 -3 bb_askpass 367 361 -6 inetd_main 1810 1797 -13 rx_main 912 883 -29 sigdelset 32 - -32 __sigdelset 32 - -32 __GI_sigdelset 32 - -32 sighup_handler 84 37 -47 arping_main 1844 1797 -47 fsck_main 1869 1807 -62 run_list 1917 1844 -73 vlock_main 492 409 -83 progressmeter 883 798 -85 handle_incoming_and_exit 2737 2651 -86 ------------------------------------------------------------------------------ (add/remove: 3/3 grow/shrink: 3/12 up/down: 188/-632) Total: -444 bytes --- loginutils/vlock.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'loginutils') diff --git a/loginutils/vlock.c b/loginutils/vlock.c index 846733e..ff60d78 100644 --- a/loginutils/vlock.c +++ b/loginutils/vlock.c @@ -34,7 +34,6 @@ static void acquire_vt(int signo) int vlock_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int vlock_main(int argc, char **argv) { - struct sigaction sa; struct vt_mode vtm; struct termios term; struct termios oterm; @@ -63,17 +62,11 @@ int vlock_main(int argc, char **argv) /* We will use SIGUSRx for console switch control: */ /* 1: set handlers */ - sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_RESTART; - sa.sa_handler = release_vt; - sigaction(SIGUSR1, &sa, NULL); - sa.sa_handler = acquire_vt; - sigaction(SIGUSR2, &sa, NULL); + signal_SA_RESTART_empty_mask(SIGUSR1, release_vt); + signal_SA_RESTART_empty_mask(SIGUSR2, acquire_vt); /* 2: unmask them */ - sigprocmask(SIG_SETMASK, NULL, &sa.sa_mask); - sigdelset(&sa.sa_mask, SIGUSR1); - sigdelset(&sa.sa_mask, SIGUSR2); - sigprocmask(SIG_SETMASK, &sa.sa_mask, NULL); + sig_unblock(SIGUSR1); + sig_unblock(SIGUSR2); /* Revert stdin/out to our controlling tty * (or die if we have none) */ -- cgit v1.1