17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7b209c2cSacruz  * Common Development and Distribution License (the "License").
6*7b209c2cSacruz  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*7b209c2cSacruz  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #include <sys/ctfs.h>
277c478bd9Sstevel@tonic-gate #include <sys/contract.h>
287c478bd9Sstevel@tonic-gate #include <sys/contract/process.h>
297c478bd9Sstevel@tonic-gate #include <errno.h>
307c478bd9Sstevel@tonic-gate #include <unistd.h>
317c478bd9Sstevel@tonic-gate #include <libnvpair.h>
327c478bd9Sstevel@tonic-gate #include <libcontract.h>
337c478bd9Sstevel@tonic-gate #include "libcontract_impl.h"
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Process contract template routines
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_set_transfer(int fd,ctid_t ctid)407c478bd9Sstevel@tonic-gate ct_pr_tmpl_set_transfer(int fd, ctid_t ctid)
417c478bd9Sstevel@tonic-gate {
427c478bd9Sstevel@tonic-gate 	return (ct_tmpl_set_internal(fd, CTPP_SUBSUME, ctid));
437c478bd9Sstevel@tonic-gate }
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_set_fatal(int fd,uint_t events)467c478bd9Sstevel@tonic-gate ct_pr_tmpl_set_fatal(int fd, uint_t events)
477c478bd9Sstevel@tonic-gate {
487c478bd9Sstevel@tonic-gate 	return (ct_tmpl_set_internal(fd, CTPP_EV_FATAL, events));
497c478bd9Sstevel@tonic-gate }
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_set_param(int fd,uint_t param)527c478bd9Sstevel@tonic-gate ct_pr_tmpl_set_param(int fd, uint_t param)
537c478bd9Sstevel@tonic-gate {
547c478bd9Sstevel@tonic-gate 	return (ct_tmpl_set_internal(fd, CTPP_PARAMS, param));
557c478bd9Sstevel@tonic-gate }
567c478bd9Sstevel@tonic-gate 
57*7b209c2cSacruz int
ct_pr_tmpl_set_svc_fmri(int fd,const char * fmri)58*7b209c2cSacruz ct_pr_tmpl_set_svc_fmri(int fd, const char *fmri)
59*7b209c2cSacruz {
60*7b209c2cSacruz 	return (ct_tmpl_set_internal_string(fd, CTPP_SVC_FMRI, fmri));
61*7b209c2cSacruz }
62*7b209c2cSacruz 
63*7b209c2cSacruz int
ct_pr_tmpl_set_svc_aux(int fd,const char * desc)64*7b209c2cSacruz ct_pr_tmpl_set_svc_aux(int fd, const char *desc)
65*7b209c2cSacruz {
66*7b209c2cSacruz 	return (ct_tmpl_set_internal_string(fd, CTPP_CREATOR_AUX, desc));
67*7b209c2cSacruz }
68*7b209c2cSacruz 
697c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_get_transfer(int fd,ctid_t * ctid)707c478bd9Sstevel@tonic-gate ct_pr_tmpl_get_transfer(int fd, ctid_t *ctid)
717c478bd9Sstevel@tonic-gate {
727c478bd9Sstevel@tonic-gate 	return (ct_tmpl_get_internal(fd, CTPP_SUBSUME, (uint_t *)ctid));
737c478bd9Sstevel@tonic-gate }
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_get_fatal(int fd,uint_t * events)767c478bd9Sstevel@tonic-gate ct_pr_tmpl_get_fatal(int fd, uint_t *events)
777c478bd9Sstevel@tonic-gate {
787c478bd9Sstevel@tonic-gate 	return (ct_tmpl_get_internal(fd, CTPP_EV_FATAL, events));
797c478bd9Sstevel@tonic-gate }
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_get_param(int fd,uint_t * param)827c478bd9Sstevel@tonic-gate ct_pr_tmpl_get_param(int fd, uint_t *param)
837c478bd9Sstevel@tonic-gate {
847c478bd9Sstevel@tonic-gate 	return (ct_tmpl_get_internal(fd, CTPP_PARAMS, param));
857c478bd9Sstevel@tonic-gate }
867c478bd9Sstevel@tonic-gate 
87*7b209c2cSacruz int
ct_pr_tmpl_get_svc_fmri(int fd,char * fmri,size_t size)88*7b209c2cSacruz ct_pr_tmpl_get_svc_fmri(int fd, char *fmri, size_t size)
89*7b209c2cSacruz {
90*7b209c2cSacruz 	return (ct_tmpl_get_internal_string(fd, CTPP_SVC_FMRI, fmri, size));
91*7b209c2cSacruz }
92*7b209c2cSacruz 
93*7b209c2cSacruz int
ct_pr_tmpl_get_svc_aux(int fd,char * desc,size_t size)94*7b209c2cSacruz ct_pr_tmpl_get_svc_aux(int fd, char *desc, size_t size)
95*7b209c2cSacruz {
96*7b209c2cSacruz 	return (ct_tmpl_get_internal_string(fd, CTPP_CREATOR_AUX, desc, size));
97*7b209c2cSacruz }
98*7b209c2cSacruz 
997c478bd9Sstevel@tonic-gate /*
1007c478bd9Sstevel@tonic-gate  * Process contract event routines
1017c478bd9Sstevel@tonic-gate  */
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate int
ct_pr_event_get_pid(ct_evthdl_t evthdl,pid_t * pid)1047c478bd9Sstevel@tonic-gate ct_pr_event_get_pid(ct_evthdl_t evthdl, pid_t *pid)
1057c478bd9Sstevel@tonic-gate {
1067c478bd9Sstevel@tonic-gate 	struct ctlib_event_info *info = evthdl;
1077c478bd9Sstevel@tonic-gate 	if (info->event.ctev_cttype != CTT_PROCESS)
1087c478bd9Sstevel@tonic-gate 		return (EINVAL);
1097c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
1107c478bd9Sstevel@tonic-gate 		return (ENOENT);
1117c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_uint32(info->nvl, CTPE_PID, (uint_t *)pid));
1127c478bd9Sstevel@tonic-gate }
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate int
ct_pr_event_get_ppid(ct_evthdl_t evthdl,pid_t * ppid)1157c478bd9Sstevel@tonic-gate ct_pr_event_get_ppid(ct_evthdl_t evthdl, pid_t *ppid)
1167c478bd9Sstevel@tonic-gate {
1177c478bd9Sstevel@tonic-gate 	struct ctlib_event_info *info = evthdl;
1187c478bd9Sstevel@tonic-gate 	if (info->event.ctev_cttype != CTT_PROCESS)
1197c478bd9Sstevel@tonic-gate 		return (EINVAL);
1207c478bd9Sstevel@tonic-gate 	if (info->event.ctev_type != CT_PR_EV_FORK)
1217c478bd9Sstevel@tonic-gate 		return (EINVAL);
1227c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
1237c478bd9Sstevel@tonic-gate 		return (ENOENT);
1247c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_uint32(info->nvl, CTPE_PPID, (uint_t *)ppid));
1257c478bd9Sstevel@tonic-gate }
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate int
ct_pr_event_get_signal(ct_evthdl_t evthdl,int * signal)1287c478bd9Sstevel@tonic-gate ct_pr_event_get_signal(ct_evthdl_t evthdl, int *signal)
1297c478bd9Sstevel@tonic-gate {
1307c478bd9Sstevel@tonic-gate 	struct ctlib_event_info *info = evthdl;
1317c478bd9Sstevel@tonic-gate 	if (info->event.ctev_cttype != CTT_PROCESS)
1327c478bd9Sstevel@tonic-gate 		return (EINVAL);
1337c478bd9Sstevel@tonic-gate 	if (info->event.ctev_type != CT_PR_EV_SIGNAL)
1347c478bd9Sstevel@tonic-gate 		return (EINVAL);
1357c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
1367c478bd9Sstevel@tonic-gate 		return (ENOENT);
1377c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_uint32(info->nvl, CTPE_SIGNAL, (uint_t *)signal));
1387c478bd9Sstevel@tonic-gate }
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate int
ct_pr_event_get_sender(ct_evthdl_t evthdl,pid_t * sender)1417c478bd9Sstevel@tonic-gate ct_pr_event_get_sender(ct_evthdl_t evthdl, pid_t *sender)
1427c478bd9Sstevel@tonic-gate {
1437c478bd9Sstevel@tonic-gate 	struct ctlib_event_info *info = evthdl;
1447c478bd9Sstevel@tonic-gate 	if (info->event.ctev_cttype != CTT_PROCESS)
1457c478bd9Sstevel@tonic-gate 		return (EINVAL);
1467c478bd9Sstevel@tonic-gate 	if (info->event.ctev_type != CT_PR_EV_SIGNAL)
1477c478bd9Sstevel@tonic-gate 		return (EINVAL);
1487c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
1497c478bd9Sstevel@tonic-gate 		return (ENOENT);
1507c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_uint32(info->nvl, CTPE_SENDER, (uint_t *)sender));
1517c478bd9Sstevel@tonic-gate }
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate int
ct_pr_event_get_senderct(ct_evthdl_t evthdl,ctid_t * sendct)1547c478bd9Sstevel@tonic-gate ct_pr_event_get_senderct(ct_evthdl_t evthdl, ctid_t *sendct)
1557c478bd9Sstevel@tonic-gate {
1567c478bd9Sstevel@tonic-gate 	struct ctlib_event_info *info = evthdl;
1577c478bd9Sstevel@tonic-gate 	if (info->event.ctev_cttype != CTT_PROCESS)
1587c478bd9Sstevel@tonic-gate 		return (EINVAL);
1597c478bd9Sstevel@tonic-gate 	if (info->event.ctev_type != CT_PR_EV_SIGNAL)
1607c478bd9Sstevel@tonic-gate 		return (EINVAL);
1617c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
1627c478bd9Sstevel@tonic-gate 		return (ENOENT);
1637c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_uint32(info->nvl, CTPE_SENDCT, (uint_t *)sendct));
1647c478bd9Sstevel@tonic-gate }
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate int
ct_pr_event_get_exitstatus(ct_evthdl_t evthdl,int * exitstatus)1677c478bd9Sstevel@tonic-gate ct_pr_event_get_exitstatus(ct_evthdl_t evthdl, int *exitstatus)
1687c478bd9Sstevel@tonic-gate {
1697c478bd9Sstevel@tonic-gate 	struct ctlib_event_info *info = evthdl;
1707c478bd9Sstevel@tonic-gate 	if (info->event.ctev_cttype != CTT_PROCESS)
1717c478bd9Sstevel@tonic-gate 		return (EINVAL);
1727c478bd9Sstevel@tonic-gate 	if (info->event.ctev_type != CT_PR_EV_EXIT)
1737c478bd9Sstevel@tonic-gate 		return (EINVAL);
1747c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
1757c478bd9Sstevel@tonic-gate 		return (ENOENT);
1767c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_int32(info->nvl, CTPE_EXITSTATUS, exitstatus));
1777c478bd9Sstevel@tonic-gate }
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate int
ct_pr_event_get_pcorefile(ct_evthdl_t evthdl,const char ** pcorefile)1807c478bd9Sstevel@tonic-gate ct_pr_event_get_pcorefile(ct_evthdl_t evthdl, const char **pcorefile)
1817c478bd9Sstevel@tonic-gate {
1827c478bd9Sstevel@tonic-gate 	struct ctlib_event_info *info = evthdl;
1837c478bd9Sstevel@tonic-gate 	if (info->event.ctev_cttype != CTT_PROCESS)
1847c478bd9Sstevel@tonic-gate 		return (EINVAL);
1857c478bd9Sstevel@tonic-gate 	if (info->event.ctev_type != CT_PR_EV_CORE)
1867c478bd9Sstevel@tonic-gate 		return (EINVAL);
1877c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
1887c478bd9Sstevel@tonic-gate 		return (ENOENT);
1897c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_string(info->nvl, CTPE_PCOREFILE,
1907c478bd9Sstevel@tonic-gate 	    (char **)pcorefile));
1917c478bd9Sstevel@tonic-gate }
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate int
ct_pr_event_get_gcorefile(ct_evthdl_t evthdl,const char ** gcorefile)1947c478bd9Sstevel@tonic-gate ct_pr_event_get_gcorefile(ct_evthdl_t evthdl, const char **gcorefile)
1957c478bd9Sstevel@tonic-gate {
1967c478bd9Sstevel@tonic-gate 	struct ctlib_event_info *info = evthdl;
1977c478bd9Sstevel@tonic-gate 	if (info->event.ctev_cttype != CTT_PROCESS)
1987c478bd9Sstevel@tonic-gate 		return (EINVAL);
1997c478bd9Sstevel@tonic-gate 	if (info->event.ctev_type != CT_PR_EV_CORE)
2007c478bd9Sstevel@tonic-gate 		return (EINVAL);
2017c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
2027c478bd9Sstevel@tonic-gate 		return (ENOENT);
2037c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_string(info->nvl, CTPE_GCOREFILE,
2047c478bd9Sstevel@tonic-gate 	    (char **)gcorefile));
2057c478bd9Sstevel@tonic-gate }
2067c478bd9Sstevel@tonic-gate 
2077c478bd9Sstevel@tonic-gate int
ct_pr_event_get_zcorefile(ct_evthdl_t evthdl,const char ** zcorefile)2087c478bd9Sstevel@tonic-gate ct_pr_event_get_zcorefile(ct_evthdl_t evthdl, const char **zcorefile)
2097c478bd9Sstevel@tonic-gate {
2107c478bd9Sstevel@tonic-gate 	struct ctlib_event_info *info = evthdl;
2117c478bd9Sstevel@tonic-gate 	if (info->event.ctev_cttype != CTT_PROCESS)
2127c478bd9Sstevel@tonic-gate 		return (EINVAL);
2137c478bd9Sstevel@tonic-gate 	if (info->event.ctev_type != CT_PR_EV_CORE)
2147c478bd9Sstevel@tonic-gate 		return (EINVAL);
2157c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
2167c478bd9Sstevel@tonic-gate 		return (ENOENT);
2177c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_string(info->nvl, CTPE_ZCOREFILE,
2187c478bd9Sstevel@tonic-gate 	    (char **)zcorefile));
2197c478bd9Sstevel@tonic-gate }
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate /*
2227c478bd9Sstevel@tonic-gate  * Process contract status routines
2237c478bd9Sstevel@tonic-gate  */
2247c478bd9Sstevel@tonic-gate 
2257c478bd9Sstevel@tonic-gate int
ct_pr_status_get_param(ct_stathdl_t stathdl,uint_t * param)2267c478bd9Sstevel@tonic-gate ct_pr_status_get_param(ct_stathdl_t stathdl, uint_t *param)
2277c478bd9Sstevel@tonic-gate {
2287c478bd9Sstevel@tonic-gate 	struct ctlib_status_info *info = stathdl;
2297c478bd9Sstevel@tonic-gate 	if (info->status.ctst_type != CTT_PROCESS)
2307c478bd9Sstevel@tonic-gate 		return (EINVAL);
2317c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
2327c478bd9Sstevel@tonic-gate 		return (ENOENT);
2337c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_uint32(info->nvl, CTPS_PARAMS, param));
2347c478bd9Sstevel@tonic-gate }
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate int
ct_pr_status_get_fatal(ct_stathdl_t stathdl,uint_t * fatal)2377c478bd9Sstevel@tonic-gate ct_pr_status_get_fatal(ct_stathdl_t stathdl, uint_t *fatal)
2387c478bd9Sstevel@tonic-gate {
2397c478bd9Sstevel@tonic-gate 	struct ctlib_status_info *info = stathdl;
2407c478bd9Sstevel@tonic-gate 	if (info->status.ctst_type != CTT_PROCESS)
2417c478bd9Sstevel@tonic-gate 		return (EINVAL);
2427c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
2437c478bd9Sstevel@tonic-gate 		return (ENOENT);
2447c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_uint32(info->nvl, CTPS_EV_FATAL, fatal));
2457c478bd9Sstevel@tonic-gate }
2467c478bd9Sstevel@tonic-gate 
2477c478bd9Sstevel@tonic-gate int
ct_pr_status_get_members(ct_stathdl_t stathdl,pid_t ** members,uint_t * n)2487c478bd9Sstevel@tonic-gate ct_pr_status_get_members(ct_stathdl_t stathdl, pid_t **members, uint_t *n)
2497c478bd9Sstevel@tonic-gate {
2507c478bd9Sstevel@tonic-gate 	struct ctlib_status_info *info = stathdl;
2517c478bd9Sstevel@tonic-gate 	if (info->status.ctst_type != CTT_PROCESS)
2527c478bd9Sstevel@tonic-gate 		return (EINVAL);
2537c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
2547c478bd9Sstevel@tonic-gate 		return (ENOENT);
2557c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_uint32_array(info->nvl, CTPS_MEMBERS,
2567c478bd9Sstevel@tonic-gate 	    (uint_t **)members, n));
2577c478bd9Sstevel@tonic-gate }
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate int
ct_pr_status_get_contracts(ct_stathdl_t stathdl,ctid_t ** contracts,uint_t * n)2607c478bd9Sstevel@tonic-gate ct_pr_status_get_contracts(ct_stathdl_t stathdl, ctid_t **contracts,
2617c478bd9Sstevel@tonic-gate     uint_t *n)
2627c478bd9Sstevel@tonic-gate {
2637c478bd9Sstevel@tonic-gate 	struct ctlib_status_info *info = stathdl;
2647c478bd9Sstevel@tonic-gate 	if (info->status.ctst_type != CTT_PROCESS)
2657c478bd9Sstevel@tonic-gate 		return (EINVAL);
2667c478bd9Sstevel@tonic-gate 	if (info->nvl == NULL)
2677c478bd9Sstevel@tonic-gate 		return (ENOENT);
2687c478bd9Sstevel@tonic-gate 	return (nvlist_lookup_uint32_array(info->nvl, CTPS_CONTRACTS,
2697c478bd9Sstevel@tonic-gate 	    (uint_t **)contracts, n));
2707c478bd9Sstevel@tonic-gate }
271*7b209c2cSacruz 
272*7b209c2cSacruz int
ct_pr_status_get_svc_fmri(ct_stathdl_t stathdl,char ** svc_fmri)273*7b209c2cSacruz ct_pr_status_get_svc_fmri(ct_stathdl_t stathdl, char **svc_fmri)
274*7b209c2cSacruz {
275*7b209c2cSacruz 	struct ctlib_status_info *info = stathdl;
276*7b209c2cSacruz 	if (info->status.ctst_type != CTT_PROCESS)
277*7b209c2cSacruz 		return (EINVAL);
278*7b209c2cSacruz 	if (info->nvl == NULL)
279*7b209c2cSacruz 		return (ENOENT);
280*7b209c2cSacruz 	return (nvlist_lookup_string(info->nvl, CTPS_SVC_FMRI, svc_fmri));
281*7b209c2cSacruz }
282*7b209c2cSacruz 
283*7b209c2cSacruz int
ct_pr_status_get_svc_aux(ct_stathdl_t stathdl,char ** svc_aux)284*7b209c2cSacruz ct_pr_status_get_svc_aux(ct_stathdl_t stathdl, char **svc_aux)
285*7b209c2cSacruz {
286*7b209c2cSacruz 	struct ctlib_status_info *info = stathdl;
287*7b209c2cSacruz 	if (info->status.ctst_type != CTT_PROCESS)
288*7b209c2cSacruz 		return (EINVAL);
289*7b209c2cSacruz 	if (info->nvl == NULL)
290*7b209c2cSacruz 		return (ENOENT);
291*7b209c2cSacruz 	return (nvlist_lookup_string(info->nvl, CTPS_CREATOR_AUX, svc_aux));
292*7b209c2cSacruz }
293*7b209c2cSacruz 
294*7b209c2cSacruz int
ct_pr_status_get_svc_ctid(ct_stathdl_t stathdl,ctid_t * ctid)295*7b209c2cSacruz ct_pr_status_get_svc_ctid(ct_stathdl_t stathdl, ctid_t *ctid)
296*7b209c2cSacruz {
297*7b209c2cSacruz 	struct ctlib_status_info *info = stathdl;
298*7b209c2cSacruz 	if (info->status.ctst_type != CTT_PROCESS)
299*7b209c2cSacruz 		return (EINVAL);
300*7b209c2cSacruz 	if (info->nvl == NULL)
301*7b209c2cSacruz 		return (ENOENT);
302*7b209c2cSacruz 	return (nvlist_lookup_int32(info->nvl, CTPS_SVC_CTID,
303*7b209c2cSacruz 	    (int32_t *)ctid));
304*7b209c2cSacruz }
305*7b209c2cSacruz 
306*7b209c2cSacruz int
ct_pr_status_get_svc_creator(ct_stathdl_t stathdl,char ** svc_creator)307*7b209c2cSacruz ct_pr_status_get_svc_creator(ct_stathdl_t stathdl, char **svc_creator)
308*7b209c2cSacruz {
309*7b209c2cSacruz 	struct ctlib_status_info *info = stathdl;
310*7b209c2cSacruz 	if (info->status.ctst_type != CTT_PROCESS)
311*7b209c2cSacruz 		return (EINVAL);
312*7b209c2cSacruz 	if (info->nvl == NULL)
313*7b209c2cSacruz 		return (ENOENT);
314*7b209c2cSacruz 	return (nvlist_lookup_string(info->nvl, CTPS_SVC_CREATOR, svc_creator));
315*7b209c2cSacruz }
316