Skip to content

Commit 31fc24d

Browse files
bentleylichray
authored andcommitted
Remove the unused signal blocking code.
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
1 parent 35c5f91 commit 31fc24d

File tree

4 files changed

+0
-32
lines changed

4 files changed

+0
-32
lines changed

common/exf.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,6 @@ file_write(
841841
return (1);
842842

843843
/* Open the file. */
844-
SIGBLOCK;
845844
if ((fd = open(name, oflags,
846845
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) < 0) {
847846
if (errno == EACCES && LF_ISSET(FS_FORCE)) {
@@ -873,11 +872,9 @@ file_write(
873872
errno = EACCES;
874873
}
875874
msgq_str(sp, M_SYSERR, name, "%s");
876-
SIGUNBLOCK;
877875
return (1);
878876
}
879877
success_open:
880-
SIGUNBLOCK;
881878

882879
/* Try and get a lock. */
883880
if (!noname && file_lock(sp, NULL, fd, 0) == LOCK_UNAVAIL)

common/gs.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -196,21 +196,3 @@ struct _gs {
196196
/* Print usage message. */
197197
void (*scr_usage)(void);
198198
};
199-
200-
/*
201-
* XXX
202-
* Block signals if there are asynchronous events. Used to keep DB system calls
203-
* from being interrupted and not restarted, as that will result in consistency
204-
* problems. This should be handled by DB.
205-
*/
206-
#ifdef BLOCK_SIGNALS
207-
#include <signal.h>
208-
extern sigset_t __sigblockset;
209-
#define SIGBLOCK \
210-
(void)sigprocmask(SIG_BLOCK, &__sigblockset, NULL)
211-
#define SIGUNBLOCK \
212-
(void)sigprocmask(SIG_UNBLOCK, &__sigblockset, NULL);
213-
#else
214-
#define SIGBLOCK
215-
#define SIGUNBLOCK
216-
#endif

common/line.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,11 @@ db_delete(
238238
/* Update file. */
239239
key.data = &lno;
240240
key.size = sizeof(lno);
241-
SIGBLOCK;
242241
if (ep->db->del(ep->db, &key, 0) == 1) {
243242
msgq(sp, M_SYSERR,
244243
"003|unable to delete line %lu", (u_long)lno);
245244
return (1);
246245
}
247-
SIGUNBLOCK;
248246

249247
/* Flush the cache, update line count, before screen update. */
250248
if (lno <= ep->c_lno)
@@ -297,13 +295,11 @@ db_append(
297295
key.size = sizeof(lno);
298296
data.data = fp;
299297
data.size = flen;
300-
SIGBLOCK;
301298
if (ep->db->put(ep->db, &key, &data, R_IAFTER) == -1) {
302299
msgq(sp, M_SYSERR,
303300
"004|unable to append to line %lu", (u_long)lno);
304301
return (1);
305302
}
306-
SIGUNBLOCK;
307303

308304
/* Flush the cache, update line count, before screen update. */
309305
if (lno < ep->c_lno)
@@ -375,13 +371,11 @@ db_insert(
375371
key.size = sizeof(lno);
376372
data.data = fp;
377373
data.size = flen;
378-
SIGBLOCK;
379374
if (ep->db->put(ep->db, &key, &data, R_IBEFORE) == -1) {
380375
msgq(sp, M_SYSERR,
381376
"005|unable to insert at line %lu", (u_long)lno);
382377
return (1);
383378
}
384-
SIGUNBLOCK;
385379

386380
/* Flush the cache, update line count, before screen update. */
387381
if (lno >= ep->c_lno)
@@ -446,13 +440,11 @@ db_set(
446440
key.size = sizeof(lno);
447441
data.data = fp;
448442
data.size = flen;
449-
SIGBLOCK;
450443
if (ep->db->put(ep->db, &key, &data, 0) == -1) {
451444
msgq(sp, M_SYSERR,
452445
"006|unable to store line %lu", (u_long)lno);
453446
return (1);
454447
}
455-
SIGUNBLOCK;
456448

457449
/* Flush the cache, before logging or screen update. */
458450
if (lno == ep->c_lno)

common/recover.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,12 @@ rcv_sync(
252252

253253
/* Sync the file if it's been modified. */
254254
if (F_ISSET(ep, F_MODIFIED)) {
255-
SIGBLOCK;
256255
if (ep->db->sync(ep->db, R_RECNOSYNC)) {
257256
F_CLR(ep, F_RCV_ON | F_RCV_NORM);
258257
msgq_str(sp, M_SYSERR,
259258
ep->rcv_path, "060|File backup failed: %s");
260-
SIGUNBLOCK;
261259
return (1);
262260
}
263-
SIGUNBLOCK;
264261

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

0 commit comments

Comments
 (0)