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 #pragma ident "%Z%%M% %I% %E% SMI"
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gate #include <sys/ctfs.h>
297c478bd9Sstevel@tonic-gate #include <sys/contract.h>
307c478bd9Sstevel@tonic-gate #include <sys/contract/process.h>
317c478bd9Sstevel@tonic-gate #include <errno.h>
327c478bd9Sstevel@tonic-gate #include <unistd.h>
337c478bd9Sstevel@tonic-gate #include <libnvpair.h>
347c478bd9Sstevel@tonic-gate #include <libcontract.h>
357c478bd9Sstevel@tonic-gate #include "libcontract_impl.h"
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate * Process contract template routines
397c478bd9Sstevel@tonic-gate */
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_set_transfer(int fd,ctid_t ctid)427c478bd9Sstevel@tonic-gate ct_pr_tmpl_set_transfer(int fd, ctid_t ctid)
437c478bd9Sstevel@tonic-gate {
447c478bd9Sstevel@tonic-gate return (ct_tmpl_set_internal(fd, CTPP_SUBSUME, ctid));
457c478bd9Sstevel@tonic-gate }
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_set_fatal(int fd,uint_t events)487c478bd9Sstevel@tonic-gate ct_pr_tmpl_set_fatal(int fd, uint_t events)
497c478bd9Sstevel@tonic-gate {
507c478bd9Sstevel@tonic-gate return (ct_tmpl_set_internal(fd, CTPP_EV_FATAL, events));
517c478bd9Sstevel@tonic-gate }
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_set_param(int fd,uint_t param)547c478bd9Sstevel@tonic-gate ct_pr_tmpl_set_param(int fd, uint_t param)
557c478bd9Sstevel@tonic-gate {
567c478bd9Sstevel@tonic-gate return (ct_tmpl_set_internal(fd, CTPP_PARAMS, param));
577c478bd9Sstevel@tonic-gate }
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_set_svc_fmri(int fd,const char * fmri)60*7b209c2cSacruz ct_pr_tmpl_set_svc_fmri(int fd, const char *fmri)
61*7b209c2cSacruz {
62*7b209c2cSacruz return (ct_tmpl_set_internal_string(fd, CTPP_SVC_FMRI, fmri));
63*7b209c2cSacruz }
64*7b209c2cSacruz
65*7b209c2cSacruz int
ct_pr_tmpl_set_svc_aux(int fd,const char * desc)66*7b209c2cSacruz ct_pr_tmpl_set_svc_aux(int fd, const char *desc)
67*7b209c2cSacruz {
68*7b209c2cSacruz return (ct_tmpl_set_internal_string(fd, CTPP_CREATOR_AUX, desc));
69*7b209c2cSacruz }
70*7b209c2cSacruz
71*7b209c2cSacruz int
ct_pr_tmpl_get_transfer(int fd,ctid_t * ctid)727c478bd9Sstevel@tonic-gate ct_pr_tmpl_get_transfer(int fd, ctid_t *ctid)
737c478bd9Sstevel@tonic-gate {
747c478bd9Sstevel@tonic-gate return (ct_tmpl_get_internal(fd, CTPP_SUBSUME, (uint_t *)ctid));
757c478bd9Sstevel@tonic-gate }
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_get_fatal(int fd,uint_t * events)787c478bd9Sstevel@tonic-gate ct_pr_tmpl_get_fatal(int fd, uint_t *events)
797c478bd9Sstevel@tonic-gate {
807c478bd9Sstevel@tonic-gate return (ct_tmpl_get_internal(fd, CTPP_EV_FATAL, events));
817c478bd9Sstevel@tonic-gate }
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate int
ct_pr_tmpl_get_param(int fd,uint_t * param)847c478bd9Sstevel@tonic-gate ct_pr_tmpl_get_param(int fd, uint_t *param)
857c478bd9Sstevel@tonic-gate {
867c478bd9Sstevel@tonic-gate return (ct_tmpl_get_internal(fd, CTPP_PARAMS, param));
877c478bd9Sstevel@tonic-gate }
887c478bd9Sstevel@tonic-gate
89*7b209c2cSacruz int
ct_pr_tmpl_get_svc_fmri(int fd,char * fmri,size_t size)90*7b209c2cSacruz ct_pr_tmpl_get_svc_fmri(int fd, char *fmri, size_t size)
91*7b209c2cSacruz {
92*7b209c2cSacruz return (ct_tmpl_get_internal_string(fd, CTPP_SVC_FMRI, fmri, size));
93*7b209c2cSacruz }
94*7b209c2cSacruz
95*7b209c2cSacruz int
ct_pr_tmpl_get_svc_aux(int fd,char * desc,size_t size)96*7b209c2cSacruz ct_pr_tmpl_get_svc_aux(int fd, char *desc, size_t size)
97*7b209c2cSacruz {
98*7b209c2cSacruz return (ct_tmpl_get_internal_string(fd, CTPP_CREATOR_AUX, desc, size));
99*7b209c2cSacruz }
100*7b209c2cSacruz
1017c478bd9Sstevel@tonic-gate /*
1027c478bd9Sstevel@tonic-gate * Process contract event routines
1037c478bd9Sstevel@tonic-gate */
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gate int
ct_pr_event_get_pid(ct_evthdl_t evthdl,pid_t * pid)1067c478bd9Sstevel@tonic-gate ct_pr_event_get_pid(ct_evthdl_t evthdl, pid_t *pid)
1077c478bd9Sstevel@tonic-gate {
1087c478bd9Sstevel@tonic-gate struct ctlib_event_info *info = evthdl;
1097c478bd9Sstevel@tonic-gate if (info->event.ctev_cttype != CTT_PROCESS)
1107c478bd9Sstevel@tonic-gate return (EINVAL);
1117c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
1127c478bd9Sstevel@tonic-gate return (ENOENT);
1137c478bd9Sstevel@tonic-gate return (nvlist_lookup_uint32(info->nvl, CTPE_PID, (uint_t *)pid));
1147c478bd9Sstevel@tonic-gate }
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gate int
ct_pr_event_get_ppid(ct_evthdl_t evthdl,pid_t * ppid)1177c478bd9Sstevel@tonic-gate ct_pr_event_get_ppid(ct_evthdl_t evthdl, pid_t *ppid)
1187c478bd9Sstevel@tonic-gate {
1197c478bd9Sstevel@tonic-gate struct ctlib_event_info *info = evthdl;
1207c478bd9Sstevel@tonic-gate if (info->event.ctev_cttype != CTT_PROCESS)
1217c478bd9Sstevel@tonic-gate return (EINVAL);
1227c478bd9Sstevel@tonic-gate if (info->event.ctev_type != CT_PR_EV_FORK)
1237c478bd9Sstevel@tonic-gate return (EINVAL);
1247c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
1257c478bd9Sstevel@tonic-gate return (ENOENT);
1267c478bd9Sstevel@tonic-gate return (nvlist_lookup_uint32(info->nvl, CTPE_PPID, (uint_t *)ppid));
1277c478bd9Sstevel@tonic-gate }
1287c478bd9Sstevel@tonic-gate
1297c478bd9Sstevel@tonic-gate int
ct_pr_event_get_signal(ct_evthdl_t evthdl,int * signal)1307c478bd9Sstevel@tonic-gate ct_pr_event_get_signal(ct_evthdl_t evthdl, int *signal)
1317c478bd9Sstevel@tonic-gate {
1327c478bd9Sstevel@tonic-gate struct ctlib_event_info *info = evthdl;
1337c478bd9Sstevel@tonic-gate if (info->event.ctev_cttype != CTT_PROCESS)
1347c478bd9Sstevel@tonic-gate return (EINVAL);
1357c478bd9Sstevel@tonic-gate if (info->event.ctev_type != CT_PR_EV_SIGNAL)
1367c478bd9Sstevel@tonic-gate return (EINVAL);
1377c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
1387c478bd9Sstevel@tonic-gate return (ENOENT);
1397c478bd9Sstevel@tonic-gate return (nvlist_lookup_uint32(info->nvl, CTPE_SIGNAL, (uint_t *)signal));
1407c478bd9Sstevel@tonic-gate }
1417c478bd9Sstevel@tonic-gate
1427c478bd9Sstevel@tonic-gate int
ct_pr_event_get_sender(ct_evthdl_t evthdl,pid_t * sender)1437c478bd9Sstevel@tonic-gate ct_pr_event_get_sender(ct_evthdl_t evthdl, pid_t *sender)
1447c478bd9Sstevel@tonic-gate {
1457c478bd9Sstevel@tonic-gate struct ctlib_event_info *info = evthdl;
1467c478bd9Sstevel@tonic-gate if (info->event.ctev_cttype != CTT_PROCESS)
1477c478bd9Sstevel@tonic-gate return (EINVAL);
1487c478bd9Sstevel@tonic-gate if (info->event.ctev_type != CT_PR_EV_SIGNAL)
1497c478bd9Sstevel@tonic-gate return (EINVAL);
1507c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
1517c478bd9Sstevel@tonic-gate return (ENOENT);
1527c478bd9Sstevel@tonic-gate return (nvlist_lookup_uint32(info->nvl, CTPE_SENDER, (uint_t *)sender));
1537c478bd9Sstevel@tonic-gate }
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gate int
ct_pr_event_get_senderct(ct_evthdl_t evthdl,ctid_t * sendct)1567c478bd9Sstevel@tonic-gate ct_pr_event_get_senderct(ct_evthdl_t evthdl, ctid_t *sendct)
1577c478bd9Sstevel@tonic-gate {
1587c478bd9Sstevel@tonic-gate struct ctlib_event_info *info = evthdl;
1597c478bd9Sstevel@tonic-gate if (info->event.ctev_cttype != CTT_PROCESS)
1607c478bd9Sstevel@tonic-gate return (EINVAL);
1617c478bd9Sstevel@tonic-gate if (info->event.ctev_type != CT_PR_EV_SIGNAL)
1627c478bd9Sstevel@tonic-gate return (EINVAL);
1637c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
1647c478bd9Sstevel@tonic-gate return (ENOENT);
1657c478bd9Sstevel@tonic-gate return (nvlist_lookup_uint32(info->nvl, CTPE_SENDCT, (uint_t *)sendct));
1667c478bd9Sstevel@tonic-gate }
1677c478bd9Sstevel@tonic-gate
1687c478bd9Sstevel@tonic-gate int
ct_pr_event_get_exitstatus(ct_evthdl_t evthdl,int * exitstatus)1697c478bd9Sstevel@tonic-gate ct_pr_event_get_exitstatus(ct_evthdl_t evthdl, int *exitstatus)
1707c478bd9Sstevel@tonic-gate {
1717c478bd9Sstevel@tonic-gate struct ctlib_event_info *info = evthdl;
1727c478bd9Sstevel@tonic-gate if (info->event.ctev_cttype != CTT_PROCESS)
1737c478bd9Sstevel@tonic-gate return (EINVAL);
1747c478bd9Sstevel@tonic-gate if (info->event.ctev_type != CT_PR_EV_EXIT)
1757c478bd9Sstevel@tonic-gate return (EINVAL);
1767c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
1777c478bd9Sstevel@tonic-gate return (ENOENT);
1787c478bd9Sstevel@tonic-gate return (nvlist_lookup_int32(info->nvl, CTPE_EXITSTATUS, exitstatus));
1797c478bd9Sstevel@tonic-gate }
1807c478bd9Sstevel@tonic-gate
1817c478bd9Sstevel@tonic-gate int
ct_pr_event_get_pcorefile(ct_evthdl_t evthdl,const char ** pcorefile)1827c478bd9Sstevel@tonic-gate ct_pr_event_get_pcorefile(ct_evthdl_t evthdl, const char **pcorefile)
1837c478bd9Sstevel@tonic-gate {
1847c478bd9Sstevel@tonic-gate struct ctlib_event_info *info = evthdl;
1857c478bd9Sstevel@tonic-gate if (info->event.ctev_cttype != CTT_PROCESS)
1867c478bd9Sstevel@tonic-gate return (EINVAL);
1877c478bd9Sstevel@tonic-gate if (info->event.ctev_type != CT_PR_EV_CORE)
1887c478bd9Sstevel@tonic-gate return (EINVAL);
1897c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
1907c478bd9Sstevel@tonic-gate return (ENOENT);
1917c478bd9Sstevel@tonic-gate return (nvlist_lookup_string(info->nvl, CTPE_PCOREFILE,
1927c478bd9Sstevel@tonic-gate (char **)pcorefile));
1937c478bd9Sstevel@tonic-gate }
1947c478bd9Sstevel@tonic-gate
1957c478bd9Sstevel@tonic-gate int
ct_pr_event_get_gcorefile(ct_evthdl_t evthdl,const char ** gcorefile)1967c478bd9Sstevel@tonic-gate ct_pr_event_get_gcorefile(ct_evthdl_t evthdl, const char **gcorefile)
1977c478bd9Sstevel@tonic-gate {
1987c478bd9Sstevel@tonic-gate struct ctlib_event_info *info = evthdl;
1997c478bd9Sstevel@tonic-gate if (info->event.ctev_cttype != CTT_PROCESS)
2007c478bd9Sstevel@tonic-gate return (EINVAL);
2017c478bd9Sstevel@tonic-gate if (info->event.ctev_type != CT_PR_EV_CORE)
2027c478bd9Sstevel@tonic-gate return (EINVAL);
2037c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
2047c478bd9Sstevel@tonic-gate return (ENOENT);
2057c478bd9Sstevel@tonic-gate return (nvlist_lookup_string(info->nvl, CTPE_GCOREFILE,
2067c478bd9Sstevel@tonic-gate (char **)gcorefile));
2077c478bd9Sstevel@tonic-gate }
2087c478bd9Sstevel@tonic-gate
2097c478bd9Sstevel@tonic-gate int
ct_pr_event_get_zcorefile(ct_evthdl_t evthdl,const char ** zcorefile)2107c478bd9Sstevel@tonic-gate ct_pr_event_get_zcorefile(ct_evthdl_t evthdl, const char **zcorefile)
2117c478bd9Sstevel@tonic-gate {
2127c478bd9Sstevel@tonic-gate struct ctlib_event_info *info = evthdl;
2137c478bd9Sstevel@tonic-gate if (info->event.ctev_cttype != CTT_PROCESS)
2147c478bd9Sstevel@tonic-gate return (EINVAL);
2157c478bd9Sstevel@tonic-gate if (info->event.ctev_type != CT_PR_EV_CORE)
2167c478bd9Sstevel@tonic-gate return (EINVAL);
2177c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
2187c478bd9Sstevel@tonic-gate return (ENOENT);
2197c478bd9Sstevel@tonic-gate return (nvlist_lookup_string(info->nvl, CTPE_ZCOREFILE,
2207c478bd9Sstevel@tonic-gate (char **)zcorefile));
2217c478bd9Sstevel@tonic-gate }
2227c478bd9Sstevel@tonic-gate
2237c478bd9Sstevel@tonic-gate /*
2247c478bd9Sstevel@tonic-gate * Process contract status routines
2257c478bd9Sstevel@tonic-gate */
2267c478bd9Sstevel@tonic-gate
2277c478bd9Sstevel@tonic-gate int
ct_pr_status_get_param(ct_stathdl_t stathdl,uint_t * param)2287c478bd9Sstevel@tonic-gate ct_pr_status_get_param(ct_stathdl_t stathdl, uint_t *param)
2297c478bd9Sstevel@tonic-gate {
2307c478bd9Sstevel@tonic-gate struct ctlib_status_info *info = stathdl;
2317c478bd9Sstevel@tonic-gate if (info->status.ctst_type != CTT_PROCESS)
2327c478bd9Sstevel@tonic-gate return (EINVAL);
2337c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
2347c478bd9Sstevel@tonic-gate return (ENOENT);
2357c478bd9Sstevel@tonic-gate return (nvlist_lookup_uint32(info->nvl, CTPS_PARAMS, param));
2367c478bd9Sstevel@tonic-gate }
2377c478bd9Sstevel@tonic-gate
2387c478bd9Sstevel@tonic-gate int
ct_pr_status_get_fatal(ct_stathdl_t stathdl,uint_t * fatal)2397c478bd9Sstevel@tonic-gate ct_pr_status_get_fatal(ct_stathdl_t stathdl, uint_t *fatal)
2407c478bd9Sstevel@tonic-gate {
2417c478bd9Sstevel@tonic-gate struct ctlib_status_info *info = stathdl;
2427c478bd9Sstevel@tonic-gate if (info->status.ctst_type != CTT_PROCESS)
2437c478bd9Sstevel@tonic-gate return (EINVAL);
2447c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
2457c478bd9Sstevel@tonic-gate return (ENOENT);
2467c478bd9Sstevel@tonic-gate return (nvlist_lookup_uint32(info->nvl, CTPS_EV_FATAL, fatal));
2477c478bd9Sstevel@tonic-gate }
2487c478bd9Sstevel@tonic-gate
2497c478bd9Sstevel@tonic-gate int
ct_pr_status_get_members(ct_stathdl_t stathdl,pid_t ** members,uint_t * n)2507c478bd9Sstevel@tonic-gate ct_pr_status_get_members(ct_stathdl_t stathdl, pid_t **members, uint_t *n)
2517c478bd9Sstevel@tonic-gate {
2527c478bd9Sstevel@tonic-gate struct ctlib_status_info *info = stathdl;
2537c478bd9Sstevel@tonic-gate if (info->status.ctst_type != CTT_PROCESS)
2547c478bd9Sstevel@tonic-gate return (EINVAL);
2557c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
2567c478bd9Sstevel@tonic-gate return (ENOENT);
2577c478bd9Sstevel@tonic-gate return (nvlist_lookup_uint32_array(info->nvl, CTPS_MEMBERS,
2587c478bd9Sstevel@tonic-gate (uint_t **)members, n));
2597c478bd9Sstevel@tonic-gate }
2607c478bd9Sstevel@tonic-gate
2617c478bd9Sstevel@tonic-gate int
ct_pr_status_get_contracts(ct_stathdl_t stathdl,ctid_t ** contracts,uint_t * n)2627c478bd9Sstevel@tonic-gate ct_pr_status_get_contracts(ct_stathdl_t stathdl, ctid_t **contracts,
2637c478bd9Sstevel@tonic-gate uint_t *n)
2647c478bd9Sstevel@tonic-gate {
2657c478bd9Sstevel@tonic-gate struct ctlib_status_info *info = stathdl;
2667c478bd9Sstevel@tonic-gate if (info->status.ctst_type != CTT_PROCESS)
2677c478bd9Sstevel@tonic-gate return (EINVAL);
2687c478bd9Sstevel@tonic-gate if (info->nvl == NULL)
2697c478bd9Sstevel@tonic-gate return (ENOENT);
2707c478bd9Sstevel@tonic-gate return (nvlist_lookup_uint32_array(info->nvl, CTPS_CONTRACTS,
2717c478bd9Sstevel@tonic-gate (uint_t **)contracts, n));
2727c478bd9Sstevel@tonic-gate }
273*7b209c2cSacruz
274*7b209c2cSacruz int
ct_pr_status_get_svc_fmri(ct_stathdl_t stathdl,char ** svc_fmri)275*7b209c2cSacruz ct_pr_status_get_svc_fmri(ct_stathdl_t stathdl, char **svc_fmri)
276*7b209c2cSacruz {
277*7b209c2cSacruz struct ctlib_status_info *info = stathdl;
278*7b209c2cSacruz if (info->status.ctst_type != CTT_PROCESS)
279*7b209c2cSacruz return (EINVAL);
280*7b209c2cSacruz if (info->nvl == NULL)
281*7b209c2cSacruz return (ENOENT);
282*7b209c2cSacruz return (nvlist_lookup_string(info->nvl, CTPS_SVC_FMRI, svc_fmri));
283*7b209c2cSacruz }
284*7b209c2cSacruz
285*7b209c2cSacruz int
ct_pr_status_get_svc_aux(ct_stathdl_t stathdl,char ** svc_aux)286*7b209c2cSacruz ct_pr_status_get_svc_aux(ct_stathdl_t stathdl, char **svc_aux)
287*7b209c2cSacruz {
288*7b209c2cSacruz struct ctlib_status_info *info = stathdl;
289*7b209c2cSacruz if (info->status.ctst_type != CTT_PROCESS)
290*7b209c2cSacruz return (EINVAL);
291*7b209c2cSacruz if (info->nvl == NULL)
292*7b209c2cSacruz return (ENOENT);
293*7b209c2cSacruz return (nvlist_lookup_string(info->nvl, CTPS_CREATOR_AUX, svc_aux));
294*7b209c2cSacruz }
295*7b209c2cSacruz
296*7b209c2cSacruz int
ct_pr_status_get_svc_ctid(ct_stathdl_t stathdl,ctid_t * ctid)297*7b209c2cSacruz ct_pr_status_get_svc_ctid(ct_stathdl_t stathdl, ctid_t *ctid)
298*7b209c2cSacruz {
299*7b209c2cSacruz struct ctlib_status_info *info = stathdl;
300*7b209c2cSacruz if (info->status.ctst_type != CTT_PROCESS)
301*7b209c2cSacruz return (EINVAL);
302*7b209c2cSacruz if (info->nvl == NULL)
303*7b209c2cSacruz return (ENOENT);
304*7b209c2cSacruz return (nvlist_lookup_int32(info->nvl, CTPS_SVC_CTID,
305*7b209c2cSacruz (int32_t *)ctid));
306*7b209c2cSacruz }
307*7b209c2cSacruz
308*7b209c2cSacruz int
ct_pr_status_get_svc_creator(ct_stathdl_t stathdl,char ** svc_creator)309*7b209c2cSacruz ct_pr_status_get_svc_creator(ct_stathdl_t stathdl, char **svc_creator)
310*7b209c2cSacruz {
311*7b209c2cSacruz struct ctlib_status_info *info = stathdl;
312*7b209c2cSacruz if (info->status.ctst_type != CTT_PROCESS)
313*7b209c2cSacruz return (EINVAL);
314*7b209c2cSacruz if (info->nvl == NULL)
315*7b209c2cSacruz return (ENOENT);
316*7b209c2cSacruz return (nvlist_lookup_string(info->nvl, CTPS_SVC_CREATOR, svc_creator));
317*7b209c2cSacruz }
318