xref: /titanic_44/usr/src/lib/libcontract/common/libcontract.h (revision 3d0479833b8db89da4bca3e8e8e88f996686aa8e)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_LIBCONTRACT_H
27 #define	_LIBCONTRACT_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/types.h>
32 #include <sys/contract.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 typedef void *ct_stathdl_t;
39 typedef void *ct_evthdl_t;
40 
41 /*
42  * Common routines
43  */
44 extern int ct_tmpl_activate(int);
45 extern int ct_tmpl_clear(int);
46 extern int ct_tmpl_create(int, ctid_t *);
47 extern int ct_tmpl_set_cookie(int, uint64_t);
48 extern int ct_tmpl_get_cookie(int, uint64_t *);
49 extern int ct_tmpl_set_critical(int, uint_t);
50 extern int ct_tmpl_get_critical(int, uint_t *);
51 extern int ct_tmpl_set_informative(int, uint_t);
52 extern int ct_tmpl_get_informative(int, uint_t *);
53 
54 extern int ct_ctl_adopt(int);
55 extern int ct_ctl_abandon(int);
56 extern int ct_ctl_ack(int, ctevid_t);
57 extern int ct_ctl_nack(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 /*
117  * Device contract routines
118  */
119 int ct_dev_tmpl_set_minor(int, char *);
120 int ct_dev_tmpl_set_aset(int, uint_t);
121 int ct_dev_tmpl_set_noneg(int);
122 int ct_dev_tmpl_clear_noneg(int);
123 int ct_dev_tmpl_get_minor(int, char *, size_t *);
124 int ct_dev_tmpl_get_aset(int, uint_t *);
125 int ct_dev_tmpl_get_noneg(int, uint_t *);
126 int ct_dev_status_get_aset(ct_stathdl_t, uint_t *);
127 int ct_dev_status_get_noneg(ct_stathdl_t, uint_t *);
128 int ct_dev_status_get_dev_state(ct_stathdl_t, uint_t *);
129 int ct_dev_status_get_minor(ct_stathdl_t, char **);
130 
131 
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 
137 #endif /* _LIBCONTRACT_H */
138