summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpc.lockd/kern.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2001-11-08 10:37:32 +0000
committeralfred <alfred@FreeBSD.org>2001-11-08 10:37:32 +0000
commitbf67173885cdd7a276154e2b281f5c892bb3b6b9 (patch)
tree585c4cb0d4148f68a5e7d036f6a371a51b1f9bb1 /usr.sbin/rpc.lockd/kern.c
parent318979eef2dfaa72489dc2cb31fdcb2e560cdae4 (diff)
downloadFreeBSD-src-bf67173885cdd7a276154e2b281f5c892bb3b6b9.zip
FreeBSD-src-bf67173885cdd7a276154e2b281f5c892bb3b6b9.tar.gz
leverage fixed fifo implementation (rev 1.56 of
src/sys/fs/fifofs/fifo_vnops.c) to serve locks better, my previous workaround for lack of decent fifo system wasn't cutting it, particularly the kernel would send a message down the fifo and immediately close it, this would lead to delayed unlock requests being seen by the lockd causing all sorts of badness. Basically, don't reopen the fifo, just select(2) on it.
Diffstat (limited to 'usr.sbin/rpc.lockd/kern.c')
-rw-r--r--usr.sbin/rpc.lockd/kern.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/usr.sbin/rpc.lockd/kern.c b/usr.sbin/rpc.lockd/kern.c
index 46cd378..76d1831 100644
--- a/usr.sbin/rpc.lockd/kern.c
+++ b/usr.sbin/rpc.lockd/kern.c
@@ -138,21 +138,19 @@ client_request(void)
owner.pid = getpid();
(void)gethostname(hostname, sizeof(hostname) - 1);
-reopen:
/* Open the fifo for reading. */
- if ((fd = open(_PATH_LCKFIFO, O_RDONLY /* | O_NONBLOCK */)) < 0)
+ if ((fd = open(_PATH_LCKFIFO, O_RDONLY | O_NONBLOCK)) < 0)
syslog(LOG_ERR, "open: %s: %m", _PATH_LCKFIFO);
/* drop our root priviledges */
(void)lockd_seteuid(daemon_uid);
- /* Set up the select. */
- FD_ZERO(&rdset);
-
for (;;) {
/* Wait for contact... fifo's return EAGAIN when read with
* no data
*/
+ /* Set up the select. */
+ FD_ZERO(&rdset);
FD_SET(fd, &rdset);
(void)select(fd + 1, &rdset, NULL, NULL, NULL);
@@ -206,9 +204,6 @@ reopen:
} else if (nr != 0) {
syslog(LOG_ERR,
"%s: discard %d bytes", _PATH_LCKFIFO, nr);
- } if (nr == 0) {
- close (fd);
- goto reopen;
}
}
OpenPOWER on IntegriCloud