diff options
| author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2013-10-25 20:31:36 +0000 |
|---|---|---|
| committer | Robert Mustacchi <rm@joyent.com> | 2014-08-20 15:24:37 -0700 |
| commit | ac0324d26eb303fa7f174e9ed0543767cca4ad95 (patch) | |
| tree | 1d5198ff5fa5724d4075e688b38f984aef9bf696 /usr/src/lib/librestart/common/librestart.c | |
| parent | 37b40227c992afc6bf6acdd1854ccd2e42a45028 (diff) | |
| download | illumos-joyent-ac0324d26eb303fa7f174e9ed0543767cca4ad95.tar.gz | |
5024 Want svcadm restart -d [...] for taking cores before restart
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Albert Lee <trisk@nexenta.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/lib/librestart/common/librestart.c')
| -rw-r--r-- | usr/src/lib/librestart/common/librestart.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/usr/src/lib/librestart/common/librestart.c b/usr/src/lib/librestart/common/librestart.c index 54fcafd6ce..671cdf99ea 100644 --- a/usr/src/lib/librestart/common/librestart.c +++ b/usr/src/lib/librestart/common/librestart.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, Joyent, Inc. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ #include <libintl.h> @@ -3857,6 +3857,55 @@ out: return (ret); } +/* + * If the instance's dump-on-restart property exists, remove it and return true, + * otherwise return false. + */ +int +restarter_inst_dump(scf_instance_t *inst) +{ + scf_handle_t *h; + scf_propertygroup_t *pg; + scf_property_t *prop; + scf_value_t *val; + int ret = 0; + + h = scf_instance_handle(inst); + pg = scf_pg_create(h); + prop = scf_property_create(h); + val = scf_value_create(h); + if (pg == NULL || prop == NULL || val == NULL) + goto out; + + if (scf_instance_get_pg(inst, SCF_PG_RESTARTER_ACTIONS, pg) != + SCF_SUCCESS) { + if (scf_error() == SCF_ERROR_CONNECTION_BROKEN) + uu_die(rcbroken); + goto out; + } + + if (scf_pg_get_property(pg, SCF_PROPERTY_DODUMP, prop) != SCF_SUCCESS) { + if (scf_error() == SCF_ERROR_CONNECTION_BROKEN) + uu_die(rcbroken); + goto out; + } + + ret = 1; + + if (scf_instance_delete_prop(inst, SCF_PG_RESTARTER_ACTIONS, + SCF_PROPERTY_DODUMP) != SCF_SUCCESS) { + if (scf_error() == SCF_ERROR_CONNECTION_BROKEN) + uu_die(rcbroken); + goto out; + } + +out: + scf_value_destroy(val); + scf_property_destroy(prop); + scf_pg_destroy(pg); + return (ret); +} + static int restarter_inst_set_astring_prop(scf_instance_t *inst, const char *pgname, const char *pgtype, uint32_t pgflags, const char *pname, const char *str) |
