1 /* $NetBSD: lockd.c,v 1.7 2000/08/12 18:08:44 thorpej Exp $ */
6 * A.R. Gordon (andrew.gordon@net-tel.co.uk). All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed for the FreeBSD project
19 * 4. Neither the name of the author nor the names of any co-contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY ANDREW GORDON AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 #include <sys/cdefs.h>
39 __RCSID("$NetBSD: lockd.c,v 1.7 2000/08/12 18:08:44 thorpej Exp $");
43 * main() function for NFS lock daemon. Most of the code in this
44 * file was generated by running rpcgen /usr/include/rpcsvc/nlm_prot.x.
46 * The actual program logic is in the file lock_proc.c
49 #include <sys/param.h>
50 #include <sys/linker.h>
51 #include <sys/module.h>
52 #include <sys/socket.h>
55 #include <netinet/in.h>
56 #include <arpa/inet.h>
67 #include <netconfig.h>
71 #include <rpc/rpc_com.h>
72 #include <rpcsvc/sm_inter.h>
75 #include <rpcsvc/nlm_prot.h>
77 #define GETPORT_MAXTRY 20 /* Max tries to get a port # */
79 int debug_level = 0; /* 0 = no debugging syslog() calls */
85 int kernel_lockd_client;
88 char **hosts, *svcport_str = NULL;
89 static int mallocd_svcport = 0;
91 static int sock_fdcnt;
92 static int sock_fdpos;
95 char **addrs; /* actually (netid, uaddr) pairs */
96 int naddrs; /* count of how many (netid, uaddr) pairs */
98 static int create_service(struct netconfig *nconf);
99 static void complete_service(struct netconfig *nconf, char *port_str);
100 static void clearout_service(void);
101 void lookup_addresses(struct netconfig *nconf);
103 void nlm_prog_0(struct svc_req *, SVCXPRT *);
104 void nlm_prog_1(struct svc_req *, SVCXPRT *);
105 void nlm_prog_3(struct svc_req *, SVCXPRT *);
106 void nlm_prog_4(struct svc_req *, SVCXPRT *);
107 void out_of_mem(void);
110 void sigalarm_handler(void);
113 * XXX move to some header file.
115 #define _PATH_RPCLOCKDSOCK "/var/run/rpclockd.sock"
118 main(int argc, char **argv)
122 char *endptr, **hosts_bak;
123 struct sigaction sigalarm;
124 int grace_period = 30;
125 struct netconfig *nconf;
127 int maxrec = RPC_MAXDATASIZE;
128 in_port_t svcport = 0;
129 int attempt_cnt, port_len, port_pos, ret;
132 while ((ch = getopt(argc, argv, "d:g:h:p:")) != (-1)) {
135 debug_level = atoi(optarg);
142 grace_period = atoi(optarg);
151 hosts_bak = realloc(hosts, nhosts * sizeof(char *));
152 if (hosts_bak == NULL) {
154 for (i = 0; i < nhosts; i++)
161 hosts[nhosts - 1] = strdup(optarg);
162 if (hosts[nhosts - 1] == NULL) {
163 for (i = 0; i < (nhosts - 1); i++)
171 svcport = (in_port_t)strtoul(optarg, &endptr, 10);
172 if (endptr == NULL || *endptr != '\0' ||
173 svcport == 0 || svcport >= IPPORT_MAX)
175 svcport_str = strdup(optarg);
183 if (geteuid()) { /* This command allowed only to root */
184 fprintf(stderr, "Sorry. You are not superuser\n");
188 kernel_lockd = FALSE;
189 kernel_lockd_client = FALSE;
190 if (modfind("nfslockd") < 0) {
191 if (kldload("nfslockd") < 0) {
192 fprintf(stderr, "Can't find or load kernel support for rpc.lockd - using non-kernel implementation\n");
200 if (getosreldate() >= 800040)
201 kernel_lockd_client = TRUE;
204 (void)rpcb_unset(NLM_PROG, NLM_SM, NULL);
205 (void)rpcb_unset(NLM_PROG, NLM_VERS, NULL);
206 (void)rpcb_unset(NLM_PROG, NLM_VERSX, NULL);
207 (void)rpcb_unset(NLM_PROG, NLM_VERS4, NULL);
210 * Check if IPv6 support is present.
212 s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
218 rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);
221 * If no hosts were specified, add a wildcard entry to bind to
222 * INADDR_ANY. Otherwise make sure 127.0.0.1 and ::1 are added to the
226 hosts = malloc(sizeof(char**));
235 hosts_bak = realloc(hosts, (nhosts + 2) *
237 if (hosts_bak == NULL) {
238 for (i = 0; i < nhosts; i++)
246 hosts[nhosts - 2] = "::1";
248 hosts_bak = realloc(hosts, (nhosts + 1) * sizeof(char *));
249 if (hosts_bak == NULL) {
250 for (i = 0; i < nhosts; i++)
260 hosts[nhosts - 1] = "127.0.0.1";
264 if (!kernel_lockd_client) {
266 * For the case where we have a kernel lockd but it
267 * doesn't provide client locking, we run a cut-down
268 * RPC service on a local-domain socket. The kernel's
269 * RPC server will pass what it can't handle (mainly
270 * client replies) down to us.
272 struct sockaddr_un sun;
276 memset(&sun, 0, sizeof sun);
277 sun.sun_family = AF_LOCAL;
278 unlink(_PATH_RPCLOCKDSOCK);
279 strcpy(sun.sun_path, _PATH_RPCLOCKDSOCK);
280 sun.sun_len = SUN_LEN(&sun);
281 fd = socket(AF_LOCAL, SOCK_STREAM, 0);
283 err(1, "Can't create local lockd socket");
285 oldmask = umask(S_IXUSR|S_IRWXG|S_IRWXO);
286 if (bind(fd, (struct sockaddr *) &sun, sun.sun_len) < 0) {
287 err(1, "Can't bind local lockd socket");
290 if (listen(fd, SOMAXCONN) < 0) {
291 err(1, "Can't listen on local lockd socket");
293 xprt = svc_vc_create(fd, RPC_MAXDATASIZE, RPC_MAXDATASIZE);
295 err(1, "Can't create transport for local lockd socket");
297 if (!svc_reg(xprt, NLM_PROG, NLM_VERS4, nlm_prog_4, NULL)) {
298 err(1, "Can't register service for local lockd socket");
303 * We need to look up the addresses so that we can
304 * hand uaddrs (ascii encoded address+port strings) to
307 nc_handle = setnetconfig();
308 while ((nconf = getnetconfig(nc_handle))) {
309 /* We want to listen only on udp6, tcp6, udp, tcp transports */
310 if (nconf->nc_flag & NC_VISIBLE) {
311 /* Skip if there's no IPv6 support */
312 if (have_v6 == 0 && strcmp(nconf->nc_protofmly, "inet6") == 0) {
315 lookup_addresses(nconf);
319 endnetconfig(nc_handle);
326 nc_handle = setnetconfig();
327 while ((nconf = getnetconfig(nc_handle))) {
328 /* We want to listen only on udp6, tcp6, udp, tcp transports */
329 if (nconf->nc_flag & NC_VISIBLE) {
330 /* Skip if there's no IPv6 support */
331 if (have_v6 == 0 && strcmp(nconf->nc_protofmly, "inet6") == 0) {
334 ret = create_service(nconf);
336 /* Ignore this call */
340 * Failed to bind port, so close
341 * off all sockets created and
342 * try again if the port# was
343 * dynamically assigned via
347 if (mallocd_svcport != 0 &&
356 "bindresvport_sa: %m");
361 * Start over at the first
367 nc_handle = setnetconfig();
369 } else if (mallocd_svcport != 0 &&
370 attempt_cnt == GETPORT_MAXTRY) {
372 * For the last attempt, allow
373 * different port #s for each
374 * nconf by saving the
375 * svcport_str and setting it
378 port_list = realloc(port_list,
381 if (port_list == NULL)
383 port_list[port_len++] =
393 * Successfully bound the ports, so call complete_service() to
394 * do the rest of the setup on the service(s).
398 nc_handle = setnetconfig();
399 while ((nconf = getnetconfig(nc_handle))) {
400 /* We want to listen only on udp6, tcp6, udp, tcp transports */
401 if (nconf->nc_flag & NC_VISIBLE) {
402 /* Skip if there's no IPv6 support */
403 if (have_v6 == 0 && strcmp(nconf->nc_protofmly, "inet6") == 0) {
405 } else if (port_list != NULL) {
406 if (port_pos >= port_len) {
411 complete_service(nconf,
412 port_list[port_pos++]);
414 complete_service(nconf, svcport_str);
417 endnetconfig(nc_handle);
419 if (port_list != NULL) {
420 for (port_pos = 0; port_pos < port_len; port_pos++)
421 free(port_list[port_pos]);
427 * Note that it is NOT sensible to run this program from inetd - the
428 * protocol assumes that it will run immediately at boot time.
430 if (daemon(0, debug_level > 0)) {
431 err(1, "cannot fork");
435 openlog("rpc.lockd", 0, LOG_DAEMON);
437 syslog(LOG_INFO, "Starting, debug level %d", debug_level);
439 syslog(LOG_INFO, "Starting");
441 sigalarm.sa_handler = (sig_t) sigalarm_handler;
442 sigemptyset(&sigalarm.sa_mask);
443 sigalarm.sa_flags = SA_RESETHAND; /* should only happen once */
444 sigalarm.sa_flags |= SA_RESTART;
445 if (sigaction(SIGALRM, &sigalarm, NULL) != 0) {
446 syslog(LOG_WARNING, "sigaction(SIGALRM) failed: %s",
452 if (!kernel_lockd_client) {
454 client_pid = client_request();
457 * Create a child process to enter the kernel and then
458 * wait for RPCs on our local domain socket.
461 nlm_syscall(debug_level, grace_period,
467 * The kernel lockd implementation provides
468 * both client and server so we don't need to
471 nlm_syscall(debug_level, grace_period, naddrs, addrs);
479 client_pid = client_request();
481 svc_run(); /* Should never return */
487 * This routine creates and binds sockets on the appropriate
488 * addresses. It gets called one time for each transport.
489 * It returns 0 upon success, 1 for ingore the call and -1 to indicate
490 * bind failed with EADDRINUSE.
491 * Any file descriptors that have been created are stored in sock_fd and
492 * the total count of them is maintained in sock_fdcnt.
495 create_service(struct netconfig *nconf)
497 struct addrinfo hints, *res = NULL;
498 struct sockaddr_in *sin;
499 struct sockaddr_in6 *sin6;
500 struct __rpc_sockinfo si;
505 u_int32_t host_addr[4]; /* IPv4 or IPv6 */
508 if ((nconf->nc_semantics != NC_TPI_CLTS) &&
509 (nconf->nc_semantics != NC_TPI_COTS) &&
510 (nconf->nc_semantics != NC_TPI_COTS_ORD))
511 return (1); /* not my type */
514 * XXX - using RPC library internal functions.
516 if (!__rpc_nconf2sockinfo(nconf, &si)) {
517 syslog(LOG_ERR, "cannot get information for %s",
522 /* Get rpc.statd's address on this transport */
523 memset(&hints, 0, sizeof hints);
524 hints.ai_flags = AI_PASSIVE;
525 hints.ai_family = si.si_af;
526 hints.ai_socktype = si.si_socktype;
527 hints.ai_protocol = si.si_proto;
530 * Bind to specific IPs if asked to
533 while (nhostsbak > 0) {
535 sock_fd = realloc(sock_fd, (sock_fdcnt + 1) * sizeof(int));
538 sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */
542 * XXX - using RPC library internal functions.
544 if ((fd = __rpc_nconf2fd(nconf)) < 0) {
545 syslog(LOG_ERR, "cannot create socket for %s",
550 switch (hints.ai_family) {
552 if (inet_pton(AF_INET, hosts[nhostsbak],
554 hints.ai_flags |= AI_NUMERICHOST;
557 * Skip if we have an AF_INET6 address.
559 if (inet_pton(AF_INET6, hosts[nhostsbak],
567 if (inet_pton(AF_INET6, hosts[nhostsbak],
569 hints.ai_flags |= AI_NUMERICHOST;
572 * Skip if we have an AF_INET address.
574 if (inet_pton(AF_INET, hosts[nhostsbak],
586 * If no hosts were specified, just bind to INADDR_ANY
588 if (strcmp("*", hosts[nhostsbak]) == 0) {
589 if (svcport_str == NULL) {
590 res = malloc(sizeof(struct addrinfo));
594 res->ai_flags = hints.ai_flags;
595 res->ai_family = hints.ai_family;
596 res->ai_protocol = hints.ai_protocol;
597 switch (res->ai_family) {
599 sin = malloc(sizeof(struct sockaddr_in));
602 sin->sin_family = AF_INET;
603 sin->sin_port = htons(0);
604 sin->sin_addr.s_addr = htonl(INADDR_ANY);
605 res->ai_addr = (struct sockaddr*) sin;
606 res->ai_addrlen = (socklen_t)
607 sizeof(struct sockaddr_in);
610 sin6 = malloc(sizeof(struct sockaddr_in6));
613 sin6->sin6_family = AF_INET6;
614 sin6->sin6_port = htons(0);
615 sin6->sin6_addr = in6addr_any;
616 res->ai_addr = (struct sockaddr*) sin6;
617 res->ai_addrlen = (socklen_t)
618 sizeof(struct sockaddr_in6);
627 if ((aicode = getaddrinfo(NULL, svcport_str,
628 &hints, &res)) != 0) {
630 "cannot get local address for %s: %s",
632 gai_strerror(aicode));
638 if ((aicode = getaddrinfo(hosts[nhostsbak], svcport_str,
639 &hints, &res)) != 0) {
641 "cannot get local address for %s: %s",
642 nconf->nc_netid, gai_strerror(aicode));
650 sock_fd[sock_fdcnt - 1] = fd;
652 /* Now, attempt the bind. */
653 r = bindresvport_sa(fd, res->ai_addr);
655 if (errno == EADDRINUSE && mallocd_svcport != 0) {
656 if (mallocd_res != 0) {
663 syslog(LOG_ERR, "bindresvport_sa: %m");
667 if (svcport_str == NULL) {
668 svcport_str = malloc(NI_MAXSERV * sizeof(char));
669 if (svcport_str == NULL)
673 if (getnameinfo(res->ai_addr,
674 res->ai_addr->sa_len, NULL, NI_MAXHOST,
675 svcport_str, NI_MAXSERV * sizeof(char),
676 NI_NUMERICHOST | NI_NUMERICSERV))
677 errx(1, "Cannot get port number");
679 if (mallocd_res != 0) {
690 * Called after all the create_service() calls have succeeded, to complete
691 * the setup and registration.
694 complete_service(struct netconfig *nconf, char *port_str)
696 struct addrinfo hints, *res = NULL;
697 struct __rpc_sockinfo si;
698 struct netbuf servaddr;
699 SVCXPRT *transp = NULL;
700 int aicode, fd, nhostsbak;
703 if ((nconf->nc_semantics != NC_TPI_CLTS) &&
704 (nconf->nc_semantics != NC_TPI_COTS) &&
705 (nconf->nc_semantics != NC_TPI_COTS_ORD))
706 return; /* not my type */
709 * XXX - using RPC library internal functions.
711 if (!__rpc_nconf2sockinfo(nconf, &si)) {
712 syslog(LOG_ERR, "cannot get information for %s",
718 while (nhostsbak > 0) {
720 if (sock_fdpos >= sock_fdcnt) {
721 /* Should never happen. */
722 syslog(LOG_ERR, "Ran out of socket fd's");
725 fd = sock_fd[sock_fdpos++];
729 if (nconf->nc_semantics != NC_TPI_CLTS)
730 listen(fd, SOMAXCONN);
732 transp = svc_tli_create(fd, nconf, NULL,
733 RPC_MAXDATASIZE, RPC_MAXDATASIZE);
735 if (transp != (SVCXPRT *) NULL) {
736 if (!svc_reg(transp, NLM_PROG, NLM_SM, nlm_prog_0,
739 "can't register %s NLM_PROG, NLM_SM service",
742 if (!svc_reg(transp, NLM_PROG, NLM_VERS, nlm_prog_1,
745 "can't register %s NLM_PROG, NLM_VERS service",
748 if (!svc_reg(transp, NLM_PROG, NLM_VERSX, nlm_prog_3,
751 "can't register %s NLM_PROG, NLM_VERSX service",
754 if (!svc_reg(transp, NLM_PROG, NLM_VERS4, nlm_prog_4,
757 "can't register %s NLM_PROG, NLM_VERS4 service",
761 syslog(LOG_WARNING, "can't create %s services",
764 if (registered == 0) {
766 memset(&hints, 0, sizeof hints);
767 hints.ai_flags = AI_PASSIVE;
768 hints.ai_family = si.si_af;
769 hints.ai_socktype = si.si_socktype;
770 hints.ai_protocol = si.si_proto;
772 if ((aicode = getaddrinfo(NULL, port_str, &hints,
774 syslog(LOG_ERR, "cannot get local address: %s",
775 gai_strerror(aicode));
779 servaddr.buf = malloc(res->ai_addrlen);
780 memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen);
781 servaddr.len = res->ai_addrlen;
783 rpcb_set(NLM_PROG, NLM_SM, nconf, &servaddr);
784 rpcb_set(NLM_PROG, NLM_VERS, nconf, &servaddr);
785 rpcb_set(NLM_PROG, NLM_VERSX, nconf, &servaddr);
786 rpcb_set(NLM_PROG, NLM_VERS4, nconf, &servaddr);
795 * Clear out sockets after a failure to bind one of them, so that the
796 * cycle of socket creation/binding can start anew.
799 clearout_service(void)
803 for (i = 0; i < sock_fdcnt; i++) {
804 if (sock_fd[i] >= 0) {
805 shutdown(sock_fd[i], SHUT_RDWR);
812 * Look up addresses for the kernel to create transports for.
815 lookup_addresses(struct netconfig *nconf)
817 struct addrinfo hints, *res = NULL;
818 struct sockaddr_in *sin;
819 struct sockaddr_in6 *sin6;
820 struct __rpc_sockinfo si;
821 struct netbuf servaddr;
822 SVCXPRT *transp = NULL;
827 u_int32_t host_addr[4]; /* IPv4 or IPv6 */
830 if ((nconf->nc_semantics != NC_TPI_CLTS) &&
831 (nconf->nc_semantics != NC_TPI_COTS) &&
832 (nconf->nc_semantics != NC_TPI_COTS_ORD))
833 return; /* not my type */
836 * XXX - using RPC library internal functions.
838 if (!__rpc_nconf2sockinfo(nconf, &si)) {
839 syslog(LOG_ERR, "cannot get information for %s",
844 /* Get rpc.statd's address on this transport */
845 memset(&hints, 0, sizeof hints);
846 hints.ai_flags = AI_PASSIVE;
847 hints.ai_family = si.si_af;
848 hints.ai_socktype = si.si_socktype;
849 hints.ai_protocol = si.si_proto;
852 * Bind to specific IPs if asked to
855 while (nhostsbak > 0) {
858 switch (hints.ai_family) {
860 if (inet_pton(AF_INET, hosts[nhostsbak],
862 hints.ai_flags &= AI_NUMERICHOST;
865 * Skip if we have an AF_INET6 address.
867 if (inet_pton(AF_INET6, hosts[nhostsbak],
874 if (inet_pton(AF_INET6, hosts[nhostsbak],
876 hints.ai_flags &= AI_NUMERICHOST;
879 * Skip if we have an AF_INET address.
881 if (inet_pton(AF_INET, hosts[nhostsbak],
892 * If no hosts were specified, just bind to INADDR_ANY
894 if (strcmp("*", hosts[nhostsbak]) == 0) {
895 if (svcport_str == NULL) {
896 res = malloc(sizeof(struct addrinfo));
899 res->ai_flags = hints.ai_flags;
900 res->ai_family = hints.ai_family;
901 res->ai_protocol = hints.ai_protocol;
902 switch (res->ai_family) {
904 sin = malloc(sizeof(struct sockaddr_in));
907 sin->sin_family = AF_INET;
908 sin->sin_port = htons(0);
909 sin->sin_addr.s_addr = htonl(INADDR_ANY);
910 res->ai_addr = (struct sockaddr*) sin;
911 res->ai_addrlen = (socklen_t)
912 sizeof(res->ai_addr);
915 sin6 = malloc(sizeof(struct sockaddr_in6));
918 sin6->sin6_family = AF_INET6;
919 sin6->sin6_port = htons(0);
920 sin6->sin6_addr = in6addr_any;
921 res->ai_addr = (struct sockaddr*) sin6;
922 res->ai_addrlen = (socklen_t) sizeof(res->ai_addr);
928 if ((aicode = getaddrinfo(NULL, svcport_str,
929 &hints, &res)) != 0) {
931 "cannot get local address for %s: %s",
933 gai_strerror(aicode));
938 if ((aicode = getaddrinfo(hosts[nhostsbak], svcport_str,
939 &hints, &res)) != 0) {
941 "cannot get local address for %s: %s",
942 nconf->nc_netid, gai_strerror(aicode));
947 servaddr.len = servaddr.maxlen = res->ai_addr->sa_len;
948 servaddr.buf = res->ai_addr;
949 uaddr = taddr2uaddr(nconf, &servaddr);
951 addrs = realloc(addrs, 2 * (naddrs + 1) * sizeof(char *));
954 addrs[2 * naddrs] = strdup(nconf->nc_netid);
955 addrs[2 * naddrs + 1] = uaddr;
961 sigalarm_handler(void)
970 errx(1, "usage: rpc.lockd [-d <debuglevel>]"
971 " [-g <grace period>] [-h <bindip>] [-p <port>]");
976 * Reset the NSM state-of-the-world and acquire its state.
984 char name[] = "NFS NLM";
985 char localhost[] = "localhost";
989 * The my_id structure isn't used by the SM_UNMON_ALL call, as far
990 * as I know. Leave it empty for now.
992 memset(&id, 0, sizeof(id));
997 * The statd program must already be registered when lockd runs.
1000 ret = callrpc("localhost", SM_PROG, SM_VERS, SM_UNMON_ALL,
1001 (xdrproc_t)xdr_my_id, &id, (xdrproc_t)xdr_sm_stat, &stat);
1002 if (ret == RPC_PROGUNAVAIL) {
1003 syslog(LOG_WARNING, "%lu %s", SM_PROG,
1012 syslog(LOG_ERR, "%lu %s", SM_PROG, clnt_sperrno(ret));
1016 nsm_state = stat.state;
1018 /* setup constant data for SM_MON calls */
1019 mon_host.mon_id.my_id.my_name = localhost;
1020 mon_host.mon_id.my_id.my_prog = NLM_PROG;
1021 mon_host.mon_id.my_id.my_vers = NLM_SM;
1022 mon_host.mon_id.my_id.my_proc = NLM_SM_NOTIFY; /* bsdi addition */
1026 * Out of memory, fatal
1030 syslog(LOG_ERR, "out of memory");