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