dev-prajnoha-selout - locking: use sigaction signal handling
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=04b29a3587737375303f2f37b41a33e181ac8623 Commit: 04b29a3587737375303f2f37b41a33e181ac8623 Parent: 9d64573da135b489e1b3079612e77363526ca44d Author: Zdenek Kabelac <[email protected]> AuthorDate: Fri May 2 17:27:51 2014 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Wed May 7 14:01:13 2014 +0200
locking: use sigaction signal handling
Use sigint_allow/restore function instead of duplicating code and switch to use only sigactiction based signal handling.
--- WHATS_NEW | 1 + lib/locking/file_locking.c | 3 -- lib/misc/lvm-flock.c | 9 +++++-- lib/misc/lvm-signal.c | 54 -------------------------------------------- 4 files changed, 7 insertions(+), 60 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.107 - ================================== + Use only sigaction handler and drop duplicate signal handler. Separate signal handling and flock code out into lib/misc. Don't start dmeventd checking seg_monitor and monitoring is disabled. Catch CTRL-c during pvremove prompts.
lib/locking/file_locking.c +0 -3
@@ -160,8 +160,5 @@ int init_file_locking(struct locking_type *locking, struct cmd_context *cmd,if ((access (_lock_dir,R_OK |W_OK |X_OK ) ==-1 ) && (errno ==EROFS ))return 0 ; -if (!init_signals (suppress_messages)) - return_0; -return 1 ; }
lib/misc/lvm-flock.c +6 -3
@@ -111,12 +111,15 @@ static int _do_flock(const char *file, int *fd, int operation, uint32_t nonblockif (nonblock) operation |=LOCK_NB ;else -install_ctrl_c_handler (); +sigint_allow (); r =flock (*fd, operation); old_errno = errno; -if (!nonblock) -remove_ctrl_c_handler (); +if (!nonblock) { +sigint_restore (); +if (sigint_caught ()) +log_error ("Giving up waiting for lock." ); + }if (r) { errno = old_errno;
lib/misc/lvm-signal.c +0 -54
66 lines not on this page · raw message