diff options
| author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2014-11-13 10:33:48 -0800 |
|---|---|---|
| committer | Robert Mustacchi <rm@joyent.com> | 2014-12-05 14:57:33 -0800 |
| commit | bafd1f1462c49949e0251d74b4fbfa24d29bc79a (patch) | |
| tree | 03049033757285b88f8fb6ace7da16e061199c5c /usr/src/lib | |
| parent | 156d6b3a5d0ba06e75f7973c6ba994107ae8df0e (diff) | |
| download | illumos-joyent-bafd1f1462c49949e0251d74b4fbfa24d29bc79a.tar.gz | |
5330 zone brands could control init restart behavior
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/lib')
| -rw-r--r-- | usr/src/lib/libbrand/common/libbrand.c | 17 | ||||
| -rw-r--r-- | usr/src/lib/libbrand/common/libbrand.h | 2 | ||||
| -rw-r--r-- | usr/src/lib/libbrand/common/mapfile-vers | 2 | ||||
| -rw-r--r-- | usr/src/lib/libbrand/dtd/brand.dtd.1 | 18 |
4 files changed, 37 insertions, 2 deletions
diff --git a/usr/src/lib/libbrand/common/libbrand.c b/usr/src/lib/libbrand/common/libbrand.c index 6cbc90eb59..7d34df9e58 100644 --- a/usr/src/lib/libbrand/common/libbrand.c +++ b/usr/src/lib/libbrand/common/libbrand.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Joyent, Inc. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ @@ -61,6 +62,7 @@ #define DTD_ELEM_FORCELOGIN_CMD ((const xmlChar *) "forcedlogin_cmd") #define DTD_ELEM_MODNAME ((const xmlChar *) "modname") #define DTD_ELEM_MOUNT ((const xmlChar *) "mount") +#define DTD_ELEM_RESTARTINIT ((const xmlChar *) "restartinit") #define DTD_ELEM_POSTATTACH ((const xmlChar *) "postattach") #define DTD_ELEM_POSTCLONE ((const xmlChar *) "postclone") #define DTD_ELEM_POSTINSTALL ((const xmlChar *) "postinstall") @@ -520,6 +522,21 @@ brand_get_initname(brand_handle_t bh, char *buf, size_t len) buf, len, DTD_ELEM_INITNAME, B_FALSE, B_FALSE)); } +boolean_t +brand_restartinit(brand_handle_t bh) +{ + struct brand_handle *bhp = (struct brand_handle *)bh; + char val[80]; + + if (brand_get_value(bhp, NULL, NULL, NULL, NULL, + val, sizeof (val), DTD_ELEM_RESTARTINIT, B_FALSE, B_FALSE) != 0) + return (B_TRUE); + + if (strcmp(val, "false") == 0) + return (B_FALSE); + return (B_TRUE); +} + int brand_get_login_cmd(brand_handle_t bh, const char *username, char *buf, size_t len) diff --git a/usr/src/lib/libbrand/common/libbrand.h b/usr/src/lib/libbrand/common/libbrand.h index 6e8a596b3a..5c5fb1b42e 100644 --- a/usr/src/lib/libbrand/common/libbrand.h +++ b/usr/src/lib/libbrand/common/libbrand.h @@ -21,6 +21,7 @@ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Joyent, Inc. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ @@ -60,6 +61,7 @@ extern int brand_get_shutdown(brand_handle_t, const char *, const char *, extern int brand_get_halt(brand_handle_t, const char *, const char *, char *, size_t); extern int brand_get_initname(brand_handle_t, char *, size_t); +extern boolean_t brand_restartinit(brand_handle_t); extern int brand_get_install(brand_handle_t, const char *, const char *, char *, size_t); extern int brand_get_installopts(brand_handle_t, char *, size_t); diff --git a/usr/src/lib/libbrand/common/mapfile-vers b/usr/src/lib/libbrand/common/mapfile-vers index 7b932b927f..be79ae12b7 100644 --- a/usr/src/lib/libbrand/common/mapfile-vers +++ b/usr/src/lib/libbrand/common/mapfile-vers @@ -20,6 +20,7 @@ # # # Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, Joyent, Inc. All rights reserved. # Copyright 2014 Nexenta Systems, Inc. All rights reserved. # @@ -78,6 +79,7 @@ SYMBOL_VERSION SUNWprivate { brand_platform_iter_gmounts; brand_platform_iter_link; brand_platform_iter_mounts; + brand_restartinit; local: *; }; diff --git a/usr/src/lib/libbrand/dtd/brand.dtd.1 b/usr/src/lib/libbrand/dtd/brand.dtd.1 index 86c0085d51..a579bee93c 100644 --- a/usr/src/lib/libbrand/dtd/brand.dtd.1 +++ b/usr/src/lib/libbrand/dtd/brand.dtd.1 @@ -21,6 +21,7 @@ CDDL HEADER END Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2011, Joyent, Inc. All rights reserved. DO NOT EDIT THIS FILE. @@ -211,6 +212,19 @@ <!ATTLIST initname> <!-- + restartinit + + Boolean indicating that the program specified by the initname attr + should be restarted, or not, if it exits. By default, the init program + will be restarted if this attribute is not provided. Specifying false + for this attr will prevent that. + + It has no attributes. +--> +<!ELEMENT restartinit (#PCDATA) > +<!ATTLIST restartinit> + +<!-- login_cmd Path to the initial login binary that should be executed when @@ -628,8 +642,8 @@ directory in which the configuration file is stored. --> -<!ELEMENT brand (modname?, initname, login_cmd, forcedlogin_cmd, - user_cmd, install, +<!ELEMENT brand (modname?, initname, restartinit?, login_cmd, + forcedlogin_cmd, user_cmd, install, installopts?, boot?, sysboot?, halt?, shutdown?, verify_cfg?, verify_adm?, postattach?, postclone?, postinstall?, predetach?, attach?, detach?, clone?, |
