Skip to content

Commit

Permalink
Remove the unused signal blocking code.
Browse files Browse the repository at this point in the history
According to cl/README.signal, so far, no signal can unintentionally
interrupt a database write without stopping the process and leaving
a file to recover.  Let's keep the never enabled signal blocking code
in the commit history and see what feedback we get.

From [email protected]

Closes #30
  • Loading branch information
bentley authored and lichray committed Mar 31, 2015
1 parent 35c5f91 commit 31fc24d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 32 deletions.
3 changes: 0 additions & 3 deletions common/exf.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,6 @@ file_write(
return (1);

/* Open the file. */
SIGBLOCK;
if ((fd = open(name, oflags,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) < 0) {
if (errno == EACCES && LF_ISSET(FS_FORCE)) {
Expand Down Expand Up @@ -873,11 +872,9 @@ file_write(
errno = EACCES;
}
msgq_str(sp, M_SYSERR, name, "%s");
SIGUNBLOCK;
return (1);
}
success_open:
SIGUNBLOCK;

/* Try and get a lock. */
if (!noname && file_lock(sp, NULL, fd, 0) == LOCK_UNAVAIL)
Expand Down
18 changes: 0 additions & 18 deletions common/gs.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,21 +196,3 @@ struct _gs {
/* Print usage message. */
void (*scr_usage)(void);
};

/*
* XXX
* Block signals if there are asynchronous events. Used to keep DB system calls
* from being interrupted and not restarted, as that will result in consistency
* problems. This should be handled by DB.
*/
#ifdef BLOCK_SIGNALS
#include <signal.h>
extern sigset_t __sigblockset;
#define SIGBLOCK \
(void)sigprocmask(SIG_BLOCK, &__sigblockset, NULL)
#define SIGUNBLOCK \
(void)sigprocmask(SIG_UNBLOCK, &__sigblockset, NULL);
#else
#define SIGBLOCK
#define SIGUNBLOCK
#endif
8 changes: 0 additions & 8 deletions common/line.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,11 @@ db_delete(
/* Update file. */
key.data = &lno;
key.size = sizeof(lno);
SIGBLOCK;
if (ep->db->del(ep->db, &key, 0) == 1) {
msgq(sp, M_SYSERR,
"003|unable to delete line %lu", (u_long)lno);
return (1);
}
SIGUNBLOCK;

/* Flush the cache, update line count, before screen update. */
if (lno <= ep->c_lno)
Expand Down Expand Up @@ -297,13 +295,11 @@ db_append(
key.size = sizeof(lno);
data.data = fp;
data.size = flen;
SIGBLOCK;
if (ep->db->put(ep->db, &key, &data, R_IAFTER) == -1) {
msgq(sp, M_SYSERR,
"004|unable to append to line %lu", (u_long)lno);
return (1);
}
SIGUNBLOCK;

/* Flush the cache, update line count, before screen update. */
if (lno < ep->c_lno)
Expand Down Expand Up @@ -375,13 +371,11 @@ db_insert(
key.size = sizeof(lno);
data.data = fp;
data.size = flen;
SIGBLOCK;
if (ep->db->put(ep->db, &key, &data, R_IBEFORE) == -1) {
msgq(sp, M_SYSERR,
"005|unable to insert at line %lu", (u_long)lno);
return (1);
}
SIGUNBLOCK;

/* Flush the cache, update line count, before screen update. */
if (lno >= ep->c_lno)
Expand Down Expand Up @@ -446,13 +440,11 @@ db_set(
key.size = sizeof(lno);
data.data = fp;
data.size = flen;
SIGBLOCK;
if (ep->db->put(ep->db, &key, &data, 0) == -1) {
msgq(sp, M_SYSERR,
"006|unable to store line %lu", (u_long)lno);
return (1);
}
SIGUNBLOCK;

/* Flush the cache, before logging or screen update. */
if (lno == ep->c_lno)
Expand Down
3 changes: 0 additions & 3 deletions common/recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,12 @@ rcv_sync(

/* Sync the file if it's been modified. */
if (F_ISSET(ep, F_MODIFIED)) {
SIGBLOCK;
if (ep->db->sync(ep->db, R_RECNOSYNC)) {
F_CLR(ep, F_RCV_ON | F_RCV_NORM);
msgq_str(sp, M_SYSERR,
ep->rcv_path, "060|File backup failed: %s");
SIGUNBLOCK;
return (1);
}
SIGUNBLOCK;

/* REQUEST: don't remove backing file on exit. */
if (LF_ISSET(RCV_PRESERVE))
Expand Down

0 comments on commit 31fc24d

Please sign in to comment.