]> git.saurik.com Git - apple/network_cmds.git/blob - rpc_lockd.tproj/kern.c
cd4213dab84124a56031ca1379a209baed243a7e
[apple/network_cmds.git] / rpc_lockd.tproj / kern.c
1 /*-
2 * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. Berkeley Software Design Inc's name may not be used to endorse or
13 * promote products derived from this software without specific prior
14 * written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * from BSDI kern.c,v 1.2 1998/11/25 22:38:27 don Exp
29 * $FreeBSD: src/usr.sbin/rpc.lockd/kern.c,v 1.11 2002/08/15 21:52:21 alfred Exp $
30 */
31
32 #include <sys/param.h>
33 #include <sys/mount.h>
34 #include <sys/queue.h>
35 #include <sys/socket.h>
36 #include <sys/stat.h>
37
38 #include <netinet/in.h>
39 #include <arpa/inet.h>
40
41 #include <err.h>
42 #include <errno.h>
43 #include <fcntl.h>
44 #include <pwd.h>
45 #include <stdio.h>
46 #include <stdlib.h>
47 #include <string.h>
48 #include <syslog.h>
49 #include <unistd.h>
50 #include <netdb.h>
51
52 #include "rpcsvc/nlm_prot.h"
53 #include <nfs/rpcv2.h>
54 #include <nfs/nfsproto.h>
55 #include <nfs/nfs_lock.h>
56 #include <nfs/nfs.h>
57
58 #include "lockd.h"
59 #include "lockd_lock.h"
60
61 #define DAEMON_USERNAME "daemon"
62
63 #define nfslockdans(_v, _ansp) \
64 ((_ansp)->la_vers = (_v), \
65 nfsclnt(NFSCLNT_LOCKDANS, (_ansp)))
66
67
68 /* Lock request owner. */
69 typedef struct __owner {
70 pid_t pid; /* Process ID. */
71 time_t tod; /* Time-of-day. */
72 } OWNER;
73 static OWNER owner;
74
75 static char hostname[MAXHOSTNAMELEN + 1]; /* Hostname. */
76
77 static void client_cleanup(void);
78 static void set_auth(CLIENT *cl, struct xucred *ucred);
79 int lock_request(LOCKD_MSG *);
80 int test_request(LOCKD_MSG *);
81 void show(LOCKD_MSG *);
82 int unlock_request(LOCKD_MSG *);
83
84 /*
85 * will break because fifo needs to be repopened when EOF'd
86 */
87 #define lockd_seteuid(uid) seteuid(uid)
88
89 #define d_calls (debug_level > 1)
90 #define d_args (debug_level > 2)
91
92 static const char *
93 from_addr(saddr)
94 struct sockaddr *saddr;
95 {
96 static char inet_buf[INET6_ADDRSTRLEN];
97
98 if (getnameinfo(saddr, saddr->sa_len, inet_buf, sizeof(inet_buf),
99 NULL, 0, NI_NUMERICHOST) == 0)
100 return inet_buf;
101 return "???";
102 }
103
104 /*
105 * client_kern_wait()
106 *
107 * wait for kernel to signal first lock request before starting
108 */
109 void
110 client_kern_wait(void)
111 {
112 if (nfsclnt(NFSCLNT_LOCKDWAIT, NULL))
113 warn("nfsclnt_lockdwait");
114 }
115
116 void
117 client_cleanup(void)
118 {
119 (void)lockd_seteuid(0);
120 (void) nfsclnt(NFSCLNT_LOCKDFD, (struct lockd_ans *)-1);
121 exit(-1);
122 }
123
124 /*
125 * client_request --
126 * Loop around messages from the kernel, forwarding them off to
127 * NLM servers.
128 */
129 pid_t
130 client_request(void)
131 {
132 LOCKD_MSG msg;
133 /*
134 * select on FIFOs can currently hang, so we'll use
135 * the nfslockdwait syscall instead for now.
136 */
137 #define USE_NFSLOCKDWAIT_INSTEAD_OF_SELECT 1
138 #ifndef USE_NFSLOCKDWAIT_INSTEAD_OF_SELECT
139 fd_set rdset;
140 #endif
141 int fd, nr, ret;
142 pid_t child;
143 uid_t daemon_uid;
144 mode_t old_umask;
145 struct passwd *pw;
146
147 /* Recreate the NLM fifo. */
148 (void)unlink(_PATH_LCKFIFO);
149 old_umask = umask(S_IXGRP|S_IXOTH);
150 if (mkfifo(_PATH_LCKFIFO, S_IWUSR | S_IRUSR)) {
151 syslog(LOG_ERR, "mkfifo: %s: %m", _PATH_LCKFIFO);
152 exit (1);
153 }
154 umask(old_umask);
155
156 /*
157 * Create a separate process, the client code is really a separate
158 * daemon that shares a lot of code.
159 */
160 switch (child = fork()) {
161 case -1:
162 err(1, "fork");
163 case 0:
164 break;
165 default:
166 return (child);
167 }
168
169 signal(SIGHUP, (sig_t)client_cleanup);
170 signal(SIGTERM, (sig_t)client_cleanup);
171
172 /* Setup. */
173 (void)time(&owner.tod);
174 owner.pid = getpid();
175 (void)gethostname(hostname, sizeof(hostname) - 1);
176
177 /* Open the fifo for reading. */
178 if ((fd = open(_PATH_LCKFIFO, O_RDONLY | O_NONBLOCK)) == -1) {
179 syslog(LOG_ERR, "open: %s: %m", _PATH_LCKFIFO);
180 goto err;
181 }
182 (void)unlink(_PATH_LCKFIFO);
183 if (nfsclnt(NFSCLNT_LOCKDFD, (struct lockd_ans *)fd)) {
184 syslog(LOG_ERR, "nfsclnt_fd: %d: %m", fd);
185 goto err;
186 }
187 pw = getpwnam(DAEMON_USERNAME);
188 if (pw == NULL) {
189 syslog(LOG_ERR, "getpwnam: %s: %m", DAEMON_USERNAME);
190 goto err;
191 }
192 daemon_uid = pw->pw_uid;
193 /* drop our root priviledges */
194 (void)lockd_seteuid(daemon_uid);
195
196 for (;;) {
197 #ifndef USE_NFSLOCKDWAIT_INSTEAD_OF_SELECT
198 /* Wait for contact... fifo's return EAGAIN when read with
199 * no data
200 */
201 /* Set up the select. */
202 FD_ZERO(&rdset);
203 FD_SET(fd, &rdset);
204 (void)select(fd + 1, &rdset, NULL, NULL, NULL);
205 #endif
206
207 /* Read the fixed length message. */
208 if ((nr = read(fd, &msg, sizeof(msg))) == sizeof(msg)) {
209 if (d_args)
210 show(&msg);
211
212 if (msg.lm_version != LOCKD_MSG_VERSION) {
213 syslog(LOG_ERR,
214 "unknown msg type: %d", msg.lm_version);
215 }
216 /*
217 * Send it to the NLM server and don't grant the lock
218 * if we fail for any reason.
219 */
220 switch (msg.lm_fl.l_type) {
221 case F_RDLCK:
222 case F_WRLCK:
223 if (msg.lm_getlk)
224 ret = test_request(&msg);
225 else
226 ret = lock_request(&msg);
227 break;
228 case F_UNLCK:
229 ret = unlock_request(&msg);
230 break;
231 default:
232 ret = 1;
233 syslog(LOG_ERR,
234 "unknown lock type: %d", msg.lm_fl.l_type);
235 break;
236 }
237 if (ret) {
238 struct lockd_ans ans;
239
240 ans.la_msg_ident = msg.lm_msg_ident;
241 ans.la_errno = ENOTSUP;
242
243 if (nfslockdans(LOCKD_ANS_VERSION, &ans)) {
244 syslog(LOG_DEBUG, "process %lu: %m",
245 (u_long)msg.lm_msg_ident.pid);
246 }
247 }
248 } else if (nr == -1) {
249 if (errno != EAGAIN) {
250 syslog(LOG_ERR, "read: %s: %m", _PATH_LCKFIFO);
251 goto err;
252 }
253 #ifdef USE_NFSLOCKDWAIT_INSTEAD_OF_SELECT
254 else
255 nfsclnt(NFSCLNT_LOCKDWAIT, NULL);
256 #endif
257 } else if (nr != 0) {
258 syslog(LOG_ERR,
259 "%s: discard %d bytes", _PATH_LCKFIFO, nr);
260 }
261 #ifdef USE_NFSLOCKDWAIT_INSTEAD_OF_SELECT
262 else
263 nfsclnt(NFSCLNT_LOCKDWAIT, NULL);
264 #endif
265 }
266
267 /* Reached only on error. */
268 err:
269 (void)lockd_seteuid(0);
270 (void) nfsclnt(NFSCLNT_LOCKDFD, (struct lockd_ans *)-1);
271 _exit (1);
272 return 0;
273 }
274
275 void
276 set_auth(cl, xucred)
277 CLIENT *cl;
278 struct xucred *xucred;
279 {
280 if (cl->cl_auth != NULL)
281 cl->cl_auth->ah_ops->ah_destroy(cl->cl_auth);
282 cl->cl_auth = authunix_create(hostname,
283 xucred->cr_uid,
284 xucred->cr_groups[0],
285 xucred->cr_ngroups - 1,
286 &xucred->cr_groups[1]);
287 }
288
289
290 /*
291 * test_request --
292 * Convert a lock LOCKD_MSG into an NLM request, and send it off.
293 */
294 int
295 test_request(LOCKD_MSG *msg)
296 {
297 CLIENT *cli;
298 struct timeval timeout = {0, 0}; /* No timeout, no response. */
299 char dummy;
300
301 if (d_calls)
302 syslog(LOG_DEBUG, "test request: %s: %s to %s",
303 msg->lm_nfsv3 ? "V4" : "V1/3",
304 msg->lm_fl.l_type == F_WRLCK ? "write" : "read",
305 from_addr((struct sockaddr *)&msg->lm_addr));
306
307 if (msg->lm_nfsv3) {
308 struct nlm4_testargs arg4;
309
310 arg4.cookie.n_bytes = (char *)&msg->lm_msg_ident;
311 arg4.cookie.n_len = sizeof(msg->lm_msg_ident);
312 arg4.exclusive = msg->lm_fl.l_type == F_WRLCK ? 1 : 0;
313 arg4.alock.caller_name = hostname;
314 arg4.alock.fh.n_bytes = (char *)&msg->lm_fh;
315 arg4.alock.fh.n_len = msg->lm_fh_len;
316 arg4.alock.oh.n_bytes = (char *)&owner;
317 arg4.alock.oh.n_len = sizeof(owner);
318 arg4.alock.svid = msg->lm_msg_ident.pid;
319 arg4.alock.l_offset = msg->lm_fl.l_start;
320 arg4.alock.l_len = msg->lm_fl.l_len;
321
322 if ((cli = get_client(
323 (struct sockaddr *)&msg->lm_addr,
324 NLM_VERS4)) == NULL)
325 return (1);
326
327 set_auth(cli, &msg->lm_cred);
328 (void)clnt_call(cli, NLM_TEST_MSG,
329 xdr_nlm4_testargs, &arg4, xdr_void, &dummy, timeout);
330 } else {
331 struct nlm_testargs arg;
332
333 arg.cookie.n_bytes = (char *)&msg->lm_msg_ident;
334 arg.cookie.n_len = sizeof(msg->lm_msg_ident);
335 arg.exclusive = msg->lm_fl.l_type == F_WRLCK ? 1 : 0;
336 arg.alock.caller_name = hostname;
337 arg.alock.fh.n_bytes = (char *)&msg->lm_fh;
338 arg.alock.fh.n_len = msg->lm_fh_len;
339 arg.alock.oh.n_bytes = (char *)&owner;
340 arg.alock.oh.n_len = sizeof(owner);
341 arg.alock.svid = msg->lm_msg_ident.pid;
342 arg.alock.l_offset = msg->lm_fl.l_start;
343 arg.alock.l_len = msg->lm_fl.l_len;
344
345 if ((cli = get_client(
346 (struct sockaddr *)&msg->lm_addr,
347 NLM_VERS)) == NULL)
348 return (1);
349
350 set_auth(cli, &msg->lm_cred);
351 (void)clnt_call(cli, NLM_TEST_MSG,
352 xdr_nlm_testargs, &arg, xdr_void, &dummy, timeout);
353 }
354 return (0);
355 }
356
357 /*
358 * lock_request --
359 * Convert a lock LOCKD_MSG into an NLM request, and send it off.
360 */
361 int
362 lock_request(LOCKD_MSG *msg)
363 {
364 CLIENT *cli;
365 struct nlm4_lockargs arg4;
366 struct nlm_lockargs arg;
367 struct timeval timeout = {0, 0}; /* No timeout, no response. */
368 char dummy;
369
370 if (d_calls)
371 syslog(LOG_DEBUG, "lock request: %s: %s to %s",
372 msg->lm_nfsv3 ? "V4" : "V1/3",
373 msg->lm_fl.l_type == F_WRLCK ? "write" : "read",
374 from_addr((struct sockaddr *)&msg->lm_addr));
375
376 if (msg->lm_nfsv3) {
377 arg4.cookie.n_bytes = (char *)&msg->lm_msg_ident;
378 arg4.cookie.n_len = sizeof(msg->lm_msg_ident);
379 arg4.block = msg->lm_wait ? 1 : 0;
380 arg4.exclusive = msg->lm_fl.l_type == F_WRLCK ? 1 : 0;
381 arg4.alock.caller_name = hostname;
382 arg4.alock.fh.n_bytes = (char *)&msg->lm_fh;
383 arg4.alock.fh.n_len = msg->lm_fh_len;
384 arg4.alock.oh.n_bytes = (char *)&owner;
385 arg4.alock.oh.n_len = sizeof(owner);
386 arg4.alock.svid = msg->lm_msg_ident.pid;
387 arg4.alock.l_offset = msg->lm_fl.l_start;
388 arg4.alock.l_len = msg->lm_fl.l_len;
389 arg4.reclaim = 0;
390 arg4.state = nsm_state;
391
392 if ((cli = get_client(
393 (struct sockaddr *)&msg->lm_addr,
394 NLM_VERS4)) == NULL)
395 return (1);
396
397 set_auth(cli, &msg->lm_cred);
398 (void)clnt_call(cli, NLM_LOCK_MSG,
399 xdr_nlm4_lockargs, &arg4, xdr_void, &dummy, timeout);
400 } else {
401 arg.cookie.n_bytes = (char *)&msg->lm_msg_ident;
402 arg.cookie.n_len = sizeof(msg->lm_msg_ident);
403 arg.block = msg->lm_wait ? 1 : 0;
404 arg.exclusive = msg->lm_fl.l_type == F_WRLCK ? 1 : 0;
405 arg.alock.caller_name = hostname;
406 arg.alock.fh.n_bytes = (char *)&msg->lm_fh;
407 arg.alock.fh.n_len = msg->lm_fh_len;
408 arg.alock.oh.n_bytes = (char *)&owner;
409 arg.alock.oh.n_len = sizeof(owner);
410 arg.alock.svid = msg->lm_msg_ident.pid;
411 arg.alock.l_offset = msg->lm_fl.l_start;
412 arg.alock.l_len = msg->lm_fl.l_len;
413 arg.reclaim = 0;
414 arg.state = nsm_state;
415
416 if ((cli = get_client(
417 (struct sockaddr *)&msg->lm_addr,
418 NLM_VERS)) == NULL)
419 return (1);
420
421 set_auth(cli, &msg->lm_cred);
422 (void)clnt_call(cli, NLM_LOCK_MSG,
423 xdr_nlm_lockargs, &arg, xdr_void, &dummy, timeout);
424 }
425 return (0);
426 }
427
428 /*
429 * unlock_request --
430 * Convert an unlock LOCKD_MSG into an NLM request, and send it off.
431 */
432 int
433 unlock_request(LOCKD_MSG *msg)
434 {
435 CLIENT *cli;
436 struct nlm4_unlockargs arg4;
437 struct nlm_unlockargs arg;
438 struct timeval timeout = {0, 0}; /* No timeout, no response. */
439 char dummy;
440
441 if (d_calls)
442 syslog(LOG_DEBUG, "unlock request: %s: to %s",
443 msg->lm_nfsv3 ? "V4" : "V1/3",
444 from_addr((struct sockaddr *)&msg->lm_addr));
445
446 if (msg->lm_nfsv3) {
447 arg4.cookie.n_bytes = (char *)&msg->lm_msg_ident;
448 arg4.cookie.n_len = sizeof(msg->lm_msg_ident);
449 arg4.alock.caller_name = hostname;
450 arg4.alock.fh.n_bytes = (char *)&msg->lm_fh;
451 arg4.alock.fh.n_len = msg->lm_fh_len;
452 arg4.alock.oh.n_bytes = (char *)&owner;
453 arg4.alock.oh.n_len = sizeof(owner);
454 arg4.alock.svid = msg->lm_msg_ident.pid;
455 arg4.alock.l_offset = msg->lm_fl.l_start;
456 arg4.alock.l_len = msg->lm_fl.l_len;
457
458 if ((cli = get_client(
459 (struct sockaddr *)&msg->lm_addr,
460 NLM_VERS4)) == NULL)
461 return (1);
462
463 set_auth(cli, &msg->lm_cred);
464 (void)clnt_call(cli, NLM_UNLOCK_MSG,
465 xdr_nlm4_unlockargs, &arg4, xdr_void, &dummy, timeout);
466 } else {
467 arg.cookie.n_bytes = (char *)&msg->lm_msg_ident;
468 arg.cookie.n_len = sizeof(msg->lm_msg_ident);
469 arg.alock.caller_name = hostname;
470 arg.alock.fh.n_bytes = (char *)&msg->lm_fh;
471 arg.alock.fh.n_len = msg->lm_fh_len;
472 arg.alock.oh.n_bytes = (char *)&owner;
473 arg.alock.oh.n_len = sizeof(owner);
474 arg.alock.svid = msg->lm_msg_ident.pid;
475 arg.alock.l_offset = msg->lm_fl.l_start;
476 arg.alock.l_len = msg->lm_fl.l_len;
477
478 if ((cli = get_client(
479 (struct sockaddr *)&msg->lm_addr,
480 NLM_VERS)) == NULL)
481 return (1);
482
483 set_auth(cli, &msg->lm_cred);
484 (void)clnt_call(cli, NLM_UNLOCK_MSG,
485 xdr_nlm_unlockargs, &arg, xdr_void, &dummy, timeout);
486 }
487
488 return (0);
489 }
490
491 int
492 lock_answer(int pid, netobj *netcookie, int result, int version,
493 int *pid_p, off_t l_start, off_t l_len)
494 {
495 struct lockd_ans ans;
496
497 if (netcookie->n_len != sizeof(ans.la_msg_ident)) {
498 if (pid == -1) { /* we're screwed */
499 syslog(LOG_ERR, "inedible nlm cookie");
500 return -1;
501 }
502 ans.la_msg_ident.pid = pid;
503 ans.la_msg_ident.msg_seq = -1;
504 } else {
505 memcpy(&ans.la_msg_ident, netcookie->n_bytes,
506 sizeof(ans.la_msg_ident));
507 }
508
509 if (d_calls)
510 syslog(LOG_DEBUG, "lock answer: pid %lu: %s %d",
511 (unsigned long)ans.la_msg_ident.pid,
512 version == NLM_VERS4 ? "nlmv4" : "nlmv3",
513 result);
514
515 ans.la_getlk_set = 0;
516 if (version == NLM_VERS4)
517 switch (result) {
518 case nlm4_granted:
519 ans.la_errno = 0;
520 break;
521 default:
522 ans.la_errno = EACCES;
523 break;
524 case nlm4_denied:
525 if (pid_p == NULL)
526 ans.la_errno = EACCES;
527 else {
528 /* this is an answer to a nlm_test msg */
529 ans.la_getlk_set = 1;
530 ans.la_getlk_pid = *pid_p;
531 ans.la_getlk_start = l_start;
532 ans.la_getlk_len = l_len;
533 ans.la_errno = 0;
534 }
535 break;
536 case nlm4_denied_nolocks:
537 ans.la_errno = ENOLCK;
538 break;
539 case nlm4_blocked:
540 return -1;
541 /* NOTREACHED */
542 case nlm4_denied_grace_period:
543 ans.la_errno = EAGAIN;
544 break;
545 case nlm4_deadlck:
546 ans.la_errno = EDEADLK;
547 break;
548 case nlm4_rofs:
549 ans.la_errno = EROFS;
550 break;
551 case nlm4_stale_fh:
552 ans.la_errno = ESTALE;
553 break;
554 case nlm4_fbig:
555 ans.la_errno = EFBIG;
556 break;
557 case nlm4_failed:
558 ans.la_errno = EACCES;
559 break;
560 }
561 else
562 switch (result) {
563 case nlm_granted:
564 ans.la_errno = 0;
565 break;
566 default:
567 ans.la_errno = EACCES;
568 break;
569 case nlm_denied:
570 if (pid_p == NULL)
571 ans.la_errno = EACCES;
572 else {
573 /* this is an answer to a nlm_test msg */
574 ans.la_getlk_set = 1;
575 ans.la_getlk_pid = *pid_p;
576 ans.la_getlk_start = l_start;
577 ans.la_getlk_len = l_len;
578 ans.la_errno = 0;
579 }
580 break;
581 case nlm_denied_nolocks:
582 ans.la_errno = ENOLCK;
583 break;
584 case nlm_blocked:
585 return -1;
586 /* NOTREACHED */
587 case nlm_denied_grace_period:
588 ans.la_errno = EAGAIN;
589 break;
590 case nlm_deadlck:
591 ans.la_errno = EDEADLK;
592 break;
593 }
594
595 if (nfslockdans(LOCKD_ANS_VERSION, &ans)) {
596 syslog(LOG_DEBUG, "lock_answer(%d): process %lu: %m",
597 result, (u_long)ans.la_msg_ident.pid);
598 return -1;
599 }
600 return 0;
601 }
602
603 /*
604 * show --
605 * Display the contents of a kernel LOCKD_MSG structure.
606 */
607 void
608 show(LOCKD_MSG *mp)
609 {
610 static char hex[] = "0123456789abcdef";
611 struct fid *fidp;
612 fsid_t *fsidp;
613 size_t len;
614 u_int8_t *p, *t, buf[NFS_SMALLFH*3+1];
615
616 syslog(LOG_DEBUG, "process ID: %lu\n", (long)mp->lm_msg_ident.pid);
617
618 fsidp = (fsid_t *)&mp->lm_fh;
619 fidp = (struct fid *)((u_int8_t *)&mp->lm_fh + sizeof(fsid_t));
620
621 for (t = buf, p = (u_int8_t *)mp->lm_fh,
622 len = mp->lm_fh_len;
623 len > 0; ++p, --len) {
624 *t++ = '\\';
625 *t++ = hex[(*p & 0xf0) >> 4];
626 *t++ = hex[*p & 0x0f];
627 }
628 *t = '\0';
629
630 syslog(LOG_DEBUG, "fh_len %d, fh %s\n", mp->lm_fh_len, buf);
631
632 /* Show flock structure. */
633 syslog(LOG_DEBUG, "start %qu; len %qu; pid %lu; type %d; whence %d\n",
634 mp->lm_fl.l_start, mp->lm_fl.l_len, (u_long)mp->lm_fl.l_pid,
635 mp->lm_fl.l_type, mp->lm_fl.l_whence);
636
637 /* Show wait flag. */
638 syslog(LOG_DEBUG, "wait was %s\n", mp->lm_wait ? "set" : "not set");
639 }