Print this page
2594 implement graceful shutdown for local zones in zoneadm

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libbrand/common/libbrand.c
          +++ new/usr/src/lib/libbrand/common/libbrand.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  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  /*
  23   23   * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
  24   25   */
  25   26  
  26   27  #include <assert.h>
  27   28  #include <dirent.h>
  28   29  #include <errno.h>
  29   30  #include <fnmatch.h>
  30   31  #include <signal.h>
  31   32  #include <stdlib.h>
  32   33  #include <unistd.h>
  33   34  #include <strings.h>
↓ open down ↓ 30 lines elided ↑ open up ↑
  64   65  #define DTD_ELEM_POSTCLONE      ((const xmlChar *) "postclone")
  65   66  #define DTD_ELEM_POSTINSTALL    ((const xmlChar *) "postinstall")
  66   67  #define DTD_ELEM_POSTSNAP       ((const xmlChar *) "postsnap")
  67   68  #define DTD_ELEM_POSTSTATECHG   ((const xmlChar *) "poststatechange")
  68   69  #define DTD_ELEM_PREDETACH      ((const xmlChar *) "predetach")
  69   70  #define DTD_ELEM_PRESNAP        ((const xmlChar *) "presnap")
  70   71  #define DTD_ELEM_PRESTATECHG    ((const xmlChar *) "prestatechange")
  71   72  #define DTD_ELEM_PREUNINSTALL   ((const xmlChar *) "preuninstall")
  72   73  #define DTD_ELEM_PRIVILEGE      ((const xmlChar *) "privilege")
  73   74  #define DTD_ELEM_QUERY          ((const xmlChar *) "query")
       75 +#define DTD_ELEM_SHUTDOWN       ((const xmlChar *) "shutdown")
  74   76  #define DTD_ELEM_SYMLINK        ((const xmlChar *) "symlink")
  75   77  #define DTD_ELEM_SYSBOOT        ((const xmlChar *) "sysboot")
  76   78  #define DTD_ELEM_UNINSTALL      ((const xmlChar *) "uninstall")
  77   79  #define DTD_ELEM_USER_CMD       ((const xmlChar *) "user_cmd")
  78   80  #define DTD_ELEM_VALIDSNAP      ((const xmlChar *) "validatesnap")
  79   81  #define DTD_ELEM_VERIFY_CFG     ((const xmlChar *) "verify_cfg")
  80   82  #define DTD_ELEM_VERIFY_ADM     ((const xmlChar *) "verify_adm")
  81   83  
  82   84  #define DTD_ATTR_ALLOWEXCL      ((const xmlChar *) "allow-exclusive-ip")
  83   85  #define DTD_ATTR_ARCH           ((const xmlChar *) "arch")
↓ open down ↓ 410 lines elided ↑ open up ↑
 494  496  
 495  497  int
 496  498  brand_get_halt(brand_handle_t bh, const char *zonename,
 497  499      const char *zonepath, char *buf, size_t len)
 498  500  {
 499  501          struct brand_handle *bhp = (struct brand_handle *)bh;
 500  502          return (brand_get_value(bhp, zonename, zonepath, NULL, NULL,
 501  503              buf, len, DTD_ELEM_HALT, B_TRUE, B_TRUE));
 502  504  }
 503  505  
      506 +int
      507 +brand_get_shutdown(brand_handle_t bh, const char *zonename,
      508 +    const char *zonepath, char *buf, size_t len)
      509 +{
      510 +        struct brand_handle *bhp = (struct brand_handle *)bh;
      511 +        return (brand_get_value(bhp, zonename, zonepath, NULL, NULL,
      512 +            buf, len, DTD_ELEM_SHUTDOWN, B_TRUE, B_TRUE));
      513 +}
      514 +
 504  515  int
 505  516  brand_get_initname(brand_handle_t bh, char *buf, size_t len)
 506  517  {
 507  518          struct brand_handle *bhp = (struct brand_handle *)bh;
 508  519          return (brand_get_value(bhp, NULL, NULL, NULL, NULL,
 509  520              buf, len, DTD_ELEM_INITNAME, B_FALSE, B_FALSE));
 510  521  }
 511  522  
 512  523  int
 513  524  brand_get_login_cmd(brand_handle_t bh, const char *username,
↓ open down ↓ 503 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX