xref: /titanic_53/usr/src/lib/libcontract/common/libcontract.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_LIBCONTRACT_H
28*7c478bd9Sstevel@tonic-gate #define	_LIBCONTRACT_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
33*7c478bd9Sstevel@tonic-gate #include <sys/contract.h>
34*7c478bd9Sstevel@tonic-gate 
35*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
36*7c478bd9Sstevel@tonic-gate extern "C" {
37*7c478bd9Sstevel@tonic-gate #endif
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate typedef void *ct_stathdl_t;
40*7c478bd9Sstevel@tonic-gate typedef void *ct_evthdl_t;
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate /*
43*7c478bd9Sstevel@tonic-gate  * Common routines
44*7c478bd9Sstevel@tonic-gate  */
45*7c478bd9Sstevel@tonic-gate extern int ct_tmpl_activate(int);
46*7c478bd9Sstevel@tonic-gate extern int ct_tmpl_clear(int);
47*7c478bd9Sstevel@tonic-gate extern int ct_tmpl_create(int, ctid_t *);
48*7c478bd9Sstevel@tonic-gate extern int ct_tmpl_set_cookie(int, uint64_t);
49*7c478bd9Sstevel@tonic-gate extern int ct_tmpl_get_cookie(int, uint64_t *);
50*7c478bd9Sstevel@tonic-gate extern int ct_tmpl_set_critical(int, uint_t);
51*7c478bd9Sstevel@tonic-gate extern int ct_tmpl_get_critical(int, uint_t *);
52*7c478bd9Sstevel@tonic-gate extern int ct_tmpl_set_informative(int, uint_t);
53*7c478bd9Sstevel@tonic-gate extern int ct_tmpl_get_informative(int, uint_t *);
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate extern int ct_ctl_adopt(int);
56*7c478bd9Sstevel@tonic-gate extern int ct_ctl_abandon(int);
57*7c478bd9Sstevel@tonic-gate extern int ct_ctl_ack(int, ctevid_t);
58*7c478bd9Sstevel@tonic-gate extern int ct_ctl_qack(int, ctevid_t);
59*7c478bd9Sstevel@tonic-gate extern int ct_ctl_newct(int, ctevid_t, int);
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate extern int ct_status_read(int, int, ct_stathdl_t *);
62*7c478bd9Sstevel@tonic-gate extern void ct_status_free(ct_stathdl_t);
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate extern ctid_t ct_status_get_id(ct_stathdl_t);
65*7c478bd9Sstevel@tonic-gate extern zoneid_t ct_status_get_zoneid(ct_stathdl_t);
66*7c478bd9Sstevel@tonic-gate extern const char *ct_status_get_type(ct_stathdl_t);
67*7c478bd9Sstevel@tonic-gate extern id_t ct_status_get_holder(ct_stathdl_t);
68*7c478bd9Sstevel@tonic-gate extern ctstate_t ct_status_get_state(ct_stathdl_t);
69*7c478bd9Sstevel@tonic-gate extern int ct_status_get_nevents(ct_stathdl_t);
70*7c478bd9Sstevel@tonic-gate extern int ct_status_get_ntime(ct_stathdl_t);
71*7c478bd9Sstevel@tonic-gate extern int ct_status_get_qtime(ct_stathdl_t);
72*7c478bd9Sstevel@tonic-gate extern ctevid_t ct_status_get_nevid(ct_stathdl_t);
73*7c478bd9Sstevel@tonic-gate extern uint_t ct_status_get_informative(ct_stathdl_t);
74*7c478bd9Sstevel@tonic-gate extern uint_t ct_status_get_critical(ct_stathdl_t);
75*7c478bd9Sstevel@tonic-gate extern uint64_t ct_status_get_cookie(ct_stathdl_t);
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate extern int ct_event_read(int, ct_evthdl_t *);
78*7c478bd9Sstevel@tonic-gate extern int ct_event_read_critical(int, ct_evthdl_t *);
79*7c478bd9Sstevel@tonic-gate extern int ct_event_reset(int);
80*7c478bd9Sstevel@tonic-gate extern int ct_event_reliable(int);
81*7c478bd9Sstevel@tonic-gate extern void ct_event_free(ct_evthdl_t);
82*7c478bd9Sstevel@tonic-gate 
83*7c478bd9Sstevel@tonic-gate extern uint_t ct_event_get_flags(ct_evthdl_t);
84*7c478bd9Sstevel@tonic-gate extern ctid_t ct_event_get_ctid(ct_evthdl_t);
85*7c478bd9Sstevel@tonic-gate extern ctevid_t ct_event_get_evid(ct_evthdl_t);
86*7c478bd9Sstevel@tonic-gate extern uint_t ct_event_get_type(ct_evthdl_t);
87*7c478bd9Sstevel@tonic-gate extern int ct_event_get_nevid(ct_evthdl_t, ctevid_t *);
88*7c478bd9Sstevel@tonic-gate extern int ct_event_get_newct(ct_evthdl_t, ctid_t *);
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate /*
91*7c478bd9Sstevel@tonic-gate  * Process contract routines
92*7c478bd9Sstevel@tonic-gate  */
93*7c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_set_transfer(int, ctid_t);
94*7c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_set_fatal(int, uint_t);
95*7c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_set_param(int, uint_t);
96*7c478bd9Sstevel@tonic-gate 
97*7c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_get_transfer(int, ctid_t *);
98*7c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_get_fatal(int, uint_t *);
99*7c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_get_param(int, uint_t *);
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_pid(ct_evthdl_t, pid_t *);
102*7c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_ppid(ct_evthdl_t, pid_t *);
103*7c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_signal(ct_evthdl_t, int *);
104*7c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_sender(ct_evthdl_t, pid_t *);
105*7c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_senderct(ct_evthdl_t, ctid_t *);
106*7c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_exitstatus(ct_evthdl_t, int *);
107*7c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_pcorefile(ct_evthdl_t, const char **);
108*7c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_gcorefile(ct_evthdl_t, const char **);
109*7c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_zcorefile(ct_evthdl_t, const char **);
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate extern int ct_pr_status_get_param(ct_stathdl_t, uint_t *);
112*7c478bd9Sstevel@tonic-gate extern int ct_pr_status_get_fatal(ct_stathdl_t, uint_t *);
113*7c478bd9Sstevel@tonic-gate extern int ct_pr_status_get_members(ct_stathdl_t, pid_t **, uint_t *);
114*7c478bd9Sstevel@tonic-gate extern int ct_pr_status_get_contracts(ct_stathdl_t, ctid_t **, uint_t *);
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
117*7c478bd9Sstevel@tonic-gate }
118*7c478bd9Sstevel@tonic-gate #endif
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate #endif /* _LIBCONTRACT_H */
121