remove runit/runit_lib.c
function old new delta
runsv_main 1770 1786 +16
svstatus_get 176 188 +12
sv_main 1180 1186 +6
runsvdir_main 683 689 +6
processorstart 385 391 +6
control 126 132 +6
logdir_open 1184 1187 +3
lock_exnb 14 - -14
lock_ex 14 - -14
open_write 17 - -17
open_read 17 - -17
------------------------------------------------------------------------------
(add/remove: 0/5 grow/shrink: 7/0 up/down: 55/-62) Total: -7 bytes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
diff --git a/runit/runsv.c b/runit/runsv.c
index 6bb6ec8..ebb0318 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -524,7 +524,7 @@
}
svd[0].fdlock = xopen3("log/supervise/lock"+4,
O_WRONLY|O_NDELAY|O_APPEND|O_CREAT, 0600);
- if (lock_exnb(svd[0].fdlock) == -1)
+ if (flock(svd[0].fdlock, LOCK_EX | LOCK_NB) == -1)
fatal_cannot("lock supervise/lock");
close_on_exec_on(svd[0].fdlock);
if (haslog) {
@@ -548,7 +548,7 @@
}
svd[1].fdlock = xopen3("log/supervise/lock",
O_WRONLY|O_NDELAY|O_APPEND|O_CREAT, 0600);
- if (lock_ex(svd[1].fdlock) == -1)
+ if (flock(svd[1].fdlock, LOCK_EX) == -1)
fatal_cannot("lock log/supervise/lock");
close_on_exec_on(svd[1].fdlock);
}
@@ -618,7 +618,7 @@
pidchanged = 1;
svd[0].ctrl &= ~C_TERM;
if (svd[0].state != S_FINISH) {
- fd = open_read("finish");
+ fd = open("finish", O_RDONLY|O_NDELAY);
if (fd != -1) {
close(fd);
svd[0].state = S_FINISH;