18159N/A@@ -951,6 +951,14 @@ if test "x$enable_rbac_shutdown" != "xno
18159N/A+dnl ---------------------------------------------------------------------------
18159N/A+dnl check for Solaris SMF contract support
18159N/A+dnl ---------------------------------------------------------------------------
18159N/A+AC_MSG_CHECKING(for Solaris SMF contract support)
18159N/A+AC_CHECK_LIB(contract, ct_tmpl_activate, [
18159N/A+ EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lcontract" ])
18159N/A dnl ---------------------------------------------------------------------------
18159N/A dnl check for backtrace support
18159N/A@@ -129,9 +136,145 @@ typedef struct {
18159N/A+ const char *errmsg = "opening process contract template";
18159N/A+ * On failure, just continue since it is better to start with
18159N/A+ * children in the same contract than to not start them at all.
18159N/A+ errmsg = "setting contract terms";
18159N/A+ if ((errno = ct_pr_tmpl_set_param (contracts_fd, CT_PR_PGRPONLY)))
18159N/A+ if ((errno = ct_tmpl_set_informative (contracts_fd, CT_PR_EV_HWERR)))
18159N/A+ if ((errno = ct_pr_tmpl_set_fatal (contracts_fd, CT_PR_EV_HWERR)))
18159N/A+ if ((errno = ct_tmpl_set_critical (contracts_fd, 0)))
18159N/A+ errmsg = "setting active template";
18159N/A+ if ((errno = ct_tmpl_activate (contracts_fd)))
18159N/A+ g_debug ("Set active contract");
18159N/A+ "Error setting up active contract template: %s while %s",
18159N/A+ /* Clear active template so no new contracts are created on fork */
18159N/A+ if ((errno = (ct_tmpl_clear (contracts_fd)))) {
18159N/A+ "Error clearing active contract template (child): %s",
18159N/A+ g_debug ("Cleared active contract template (child)");
18159N/A+contracts_post_fork_parent (int fork_succeeded)
18159N/A+ /* Clear active template, abandon latest contract. */
18159N/A+ if ((errno = ct_tmpl_clear (contracts_fd)))
18159N/A+ g_debug ("Error while clearing active contract template: %s",
18159N/A+ g_debug ("Cleared active contract template (parent)");
18159N/A+ g_debug ("Error getting latest contract: %s",
18159N/A+ if ((errno = ct_status_read (cfd, CTD_COMMON, &status)) != 0) {
18159N/A+ g_debug ("Error getting latest contract ID: %s",
18159N/A+ latest = ct_status_get_id (status);
18159N/A+ if ((snprintf (path, PATH_MAX, CTFS_ROOT "/all/%
ld/ctl", latest)) >=
18159N/A+ g_debug ("Error opening the latest contract ctl file: %s",
18159N/A+ cfd = open64 (path, O_WRONLY);
18159N/A+ g_debug ("Error opening the latest contract ctl file: %s",
18159N/A+ if ((errno = ct_ctl_abandon (cfd)))
18159N/A+ g_debug ("Error abandoning latest contract: %s",
18159N/A+ g_debug ("Abandoned latest contract");
18159N/A spawn_child_setup (SpawnChildData *data)
18159N/A@@ -174,6 +317,10 @@ spawn_command_line_async (const char *co
18159N/A@@ -190,6 +337,10 @@ spawn_command_line_async (const char *co
18749N/A+ contracts_post_fork_parent ((*child_pid > 0));