Print this page
195 Need replacement for nfs/lockd+klm

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fs.d/nfs/statd/sm_svc.c
          +++ new/usr/src/cmd/fs.d/nfs/statd/sm_svc.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  23   24   */
  24   25  
  25   26  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  26   27  /*        All Rights Reserved   */
  27   28  
  28   29  /*
  29   30   * University Copyright- Copyright (c) 1982, 1986, 1988
  30   31   * The Regents of the University of California
  31   32   * All Rights Reserved
  32   33   *
  33   34   * University Acknowledgment- Portions of this document are derived from
  34   35   * software developed by the University of California, Berkeley, and its
  35   36   * contributors.
  36   37   */
  37   38  
       39 +/*
       40 + * Copyright (c) 2012 by Delphix. All rights reserved.
       41 + */
       42 +
  38   43  #include <stdio.h>
  39   44  #include <stdio_ext.h>
  40   45  #include <stdlib.h>
  41   46  #include <ftw.h>
  42   47  #include <signal.h>
  43   48  #include <string.h>
  44   49  #include <syslog.h>
  45   50  #include <netconfig.h>
  46   51  #include <unistd.h>
  47   52  #include <netdb.h>
↓ open down ↓ 164 lines elided ↑ open up ↑
 212  217                  case NULLPROC:
 213  218                          svc_sendreply(transp, xdr_void, (caddr_t)NULL);
 214  219                          return;
 215  220  
 216  221                  case NSMADDRPROC1_REG:
 217  222                          xdr_argument = xdr_reg1args;
 218  223                          xdr_result = xdr_reg1res;
 219  224                          local = (char *(*)()) nsmaddrproc1_reg;
 220  225                          break;
 221  226  
      227 +                case NSMADDRPROC1_UNREG: /* Not impl. */
 222  228                  default:
 223  229                          svcerr_noproc(transp);
 224  230                          return;
 225  231                  }
 226  232          } else {
      233 +                /* Must be SM_PROG */
 227  234                  switch (rqstp->rq_proc) {
 228  235                  case NULLPROC:
 229  236                          svc_sendreply(transp, xdr_void, (caddr_t)NULL);
 230  237                          return;
 231  238  
 232  239                  case SM_STAT:
 233  240                          xdr_argument = xdr_sm_name;
 234  241                          xdr_result = xdr_sm_stat_res;
 235      -                        local = (char *(*)()) sm_status;
      242 +                        local = (char *(*)()) sm_stat_svc;
 236  243                          break;
 237  244  
 238  245                  case SM_MON:
 239  246                          xdr_argument = xdr_mon;
 240  247                          xdr_result = xdr_sm_stat_res;
 241      -                        local = (char *(*)()) sm_mon;
      248 +                        local = (char *(*)()) sm_mon_svc;
 242  249                          break;
 243  250  
 244  251                  case SM_UNMON:
 245  252                          xdr_argument = xdr_mon_id;
 246  253                          xdr_result = xdr_sm_stat;
 247      -                        local = (char *(*)()) sm_unmon;
      254 +                        local = (char *(*)()) sm_unmon_svc;
 248  255                          break;
 249  256  
 250  257                  case SM_UNMON_ALL:
 251  258                          xdr_argument = xdr_my_id;
 252  259                          xdr_result = xdr_sm_stat;
 253      -                        local = (char *(*)()) sm_unmon_all;
      260 +                        local = (char *(*)()) sm_unmon_all_svc;
 254  261                          break;
 255  262  
 256  263                  case SM_SIMU_CRASH:
 257  264                          xdr_argument = xdr_void;
 258  265                          xdr_result = xdr_void;
 259      -                        local = (char *(*)()) sm_simu_crash;
      266 +                        local = (char *(*)()) sm_simu_crash_svc;
 260  267                          break;
 261  268  
 262  269                  case SM_NOTIFY:
 263  270                          xdr_argument = xdr_stat_chge;
 264  271                          xdr_result = xdr_void;
 265      -                        local = (char *(*)()) sm_notify;
      272 +                        local = (char *(*)()) sm_notify_svc;
 266  273                          break;
 267  274  
 268  275                  default:
 269  276                          svcerr_noproc(transp);
 270  277                          return;
 271  278                  }
 272  279          }
 273  280  
 274  281          (void) memset(&argument, 0, sizeof (argument));
 275  282          if (!svc_getargs(transp, xdr_argument, (caddr_t)&argument)) {
↓ open down ↓ 1 lines elided ↑ open up ↑
 277  284                  return;
 278  285          }
 279  286  
 280  287          (void) memset(&result, 0, sizeof (result));
 281  288          (*local)(&argument, &result);
 282  289          if (!svc_sendreply(transp, xdr_result, (caddr_t)&result)) {
 283  290                  svcerr_systemerr(transp);
 284  291          }
 285  292  
 286  293          if (!svc_freeargs(transp, xdr_argument, (caddr_t)&argument)) {
 287      -                        syslog(LOG_ERR, "statd: unable to free arguments\n");
 288      -                }
      294 +                syslog(LOG_ERR, "statd: unable to free arguments\n");
      295 +        }
 289  296  }
 290  297  
 291  298  /*
 292  299   * Remove all files under directory path_dir.
 293  300   */
 294  301  static int
 295  302  remove_dir(path_dir)
 296  303  char *path_dir;
 297  304  {
 298  305          DIR     *dp;
↓ open down ↓ 278 lines elided ↑ open up ↑
 577  584                      strerror(errno));
 578  585                  exit(2);
 579  586          default:
 580  587                  /* daemon was already running */
 581  588                  exit(0);
 582  589          }
 583  590  
 584  591          /* Get other aliases from each interface. */
 585  592          merge_hosts();
 586  593  
      594 +        /* Get all of the configured IP addresses. */
      595 +        merge_ips();
      596 +
 587  597          /*
 588  598           * Set to automatic mode such that threads are automatically
 589  599           * created
 590  600           */
 591  601          mode = RPC_SVC_MT_AUTO;
 592  602          if (!rpc_control(RPC_SVC_MTMODE_SET, &mode)) {
 593  603                  syslog(LOG_ERR,
 594  604                      "statd:unable to set automatic MT mode.");
 595  605                  exit(1);
 596  606          }
↓ open down ↓ 237 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX