xref: /onnv-gate/usr/src/lib/libcontract/common/libcontract.h (revision 6073:47f6aa7a8077)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
54845Svikram  * Common Development and Distribution License (the "License").
64845Svikram  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*6073Sacruz  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_LIBCONTRACT_H
270Sstevel@tonic-gate #define	_LIBCONTRACT_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #include <sys/types.h>
320Sstevel@tonic-gate #include <sys/contract.h>
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #ifdef __cplusplus
350Sstevel@tonic-gate extern "C" {
360Sstevel@tonic-gate #endif
370Sstevel@tonic-gate 
380Sstevel@tonic-gate typedef void *ct_stathdl_t;
390Sstevel@tonic-gate typedef void *ct_evthdl_t;
400Sstevel@tonic-gate 
410Sstevel@tonic-gate /*
420Sstevel@tonic-gate  * Common routines
430Sstevel@tonic-gate  */
440Sstevel@tonic-gate extern int ct_tmpl_activate(int);
450Sstevel@tonic-gate extern int ct_tmpl_clear(int);
460Sstevel@tonic-gate extern int ct_tmpl_create(int, ctid_t *);
470Sstevel@tonic-gate extern int ct_tmpl_set_cookie(int, uint64_t);
480Sstevel@tonic-gate extern int ct_tmpl_get_cookie(int, uint64_t *);
490Sstevel@tonic-gate extern int ct_tmpl_set_critical(int, uint_t);
500Sstevel@tonic-gate extern int ct_tmpl_get_critical(int, uint_t *);
510Sstevel@tonic-gate extern int ct_tmpl_set_informative(int, uint_t);
520Sstevel@tonic-gate extern int ct_tmpl_get_informative(int, uint_t *);
530Sstevel@tonic-gate 
540Sstevel@tonic-gate extern int ct_ctl_adopt(int);
550Sstevel@tonic-gate extern int ct_ctl_abandon(int);
560Sstevel@tonic-gate extern int ct_ctl_ack(int, ctevid_t);
574845Svikram extern int ct_ctl_nack(int, ctevid_t);
580Sstevel@tonic-gate extern int ct_ctl_qack(int, ctevid_t);
590Sstevel@tonic-gate extern int ct_ctl_newct(int, ctevid_t, int);
600Sstevel@tonic-gate 
610Sstevel@tonic-gate extern int ct_status_read(int, int, ct_stathdl_t *);
620Sstevel@tonic-gate extern void ct_status_free(ct_stathdl_t);
630Sstevel@tonic-gate 
640Sstevel@tonic-gate extern ctid_t ct_status_get_id(ct_stathdl_t);
650Sstevel@tonic-gate extern zoneid_t ct_status_get_zoneid(ct_stathdl_t);
660Sstevel@tonic-gate extern const char *ct_status_get_type(ct_stathdl_t);
670Sstevel@tonic-gate extern id_t ct_status_get_holder(ct_stathdl_t);
680Sstevel@tonic-gate extern ctstate_t ct_status_get_state(ct_stathdl_t);
690Sstevel@tonic-gate extern int ct_status_get_nevents(ct_stathdl_t);
700Sstevel@tonic-gate extern int ct_status_get_ntime(ct_stathdl_t);
710Sstevel@tonic-gate extern int ct_status_get_qtime(ct_stathdl_t);
720Sstevel@tonic-gate extern ctevid_t ct_status_get_nevid(ct_stathdl_t);
730Sstevel@tonic-gate extern uint_t ct_status_get_informative(ct_stathdl_t);
740Sstevel@tonic-gate extern uint_t ct_status_get_critical(ct_stathdl_t);
750Sstevel@tonic-gate extern uint64_t ct_status_get_cookie(ct_stathdl_t);
760Sstevel@tonic-gate 
770Sstevel@tonic-gate extern int ct_event_read(int, ct_evthdl_t *);
780Sstevel@tonic-gate extern int ct_event_read_critical(int, ct_evthdl_t *);
790Sstevel@tonic-gate extern int ct_event_reset(int);
800Sstevel@tonic-gate extern int ct_event_reliable(int);
810Sstevel@tonic-gate extern void ct_event_free(ct_evthdl_t);
820Sstevel@tonic-gate 
830Sstevel@tonic-gate extern uint_t ct_event_get_flags(ct_evthdl_t);
840Sstevel@tonic-gate extern ctid_t ct_event_get_ctid(ct_evthdl_t);
850Sstevel@tonic-gate extern ctevid_t ct_event_get_evid(ct_evthdl_t);
860Sstevel@tonic-gate extern uint_t ct_event_get_type(ct_evthdl_t);
870Sstevel@tonic-gate extern int ct_event_get_nevid(ct_evthdl_t, ctevid_t *);
880Sstevel@tonic-gate extern int ct_event_get_newct(ct_evthdl_t, ctid_t *);
890Sstevel@tonic-gate 
900Sstevel@tonic-gate /*
910Sstevel@tonic-gate  * Process contract routines
920Sstevel@tonic-gate  */
930Sstevel@tonic-gate extern int ct_pr_tmpl_set_transfer(int, ctid_t);
940Sstevel@tonic-gate extern int ct_pr_tmpl_set_fatal(int, uint_t);
950Sstevel@tonic-gate extern int ct_pr_tmpl_set_param(int, uint_t);
96*6073Sacruz extern int ct_pr_tmpl_set_svc_fmri(int, const char *);
97*6073Sacruz extern int ct_pr_tmpl_set_svc_aux(int, const char *);
980Sstevel@tonic-gate 
990Sstevel@tonic-gate extern int ct_pr_tmpl_get_transfer(int, ctid_t *);
1000Sstevel@tonic-gate extern int ct_pr_tmpl_get_fatal(int, uint_t *);
1010Sstevel@tonic-gate extern int ct_pr_tmpl_get_param(int, uint_t *);
102*6073Sacruz extern int ct_pr_tmpl_get_svc_fmri(int, char *, size_t);
103*6073Sacruz extern int ct_pr_tmpl_get_svc_aux(int, char *, size_t);
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate extern int ct_pr_event_get_pid(ct_evthdl_t, pid_t *);
1060Sstevel@tonic-gate extern int ct_pr_event_get_ppid(ct_evthdl_t, pid_t *);
1070Sstevel@tonic-gate extern int ct_pr_event_get_signal(ct_evthdl_t, int *);
1080Sstevel@tonic-gate extern int ct_pr_event_get_sender(ct_evthdl_t, pid_t *);
1090Sstevel@tonic-gate extern int ct_pr_event_get_senderct(ct_evthdl_t, ctid_t *);
1100Sstevel@tonic-gate extern int ct_pr_event_get_exitstatus(ct_evthdl_t, int *);
1110Sstevel@tonic-gate extern int ct_pr_event_get_pcorefile(ct_evthdl_t, const char **);
1120Sstevel@tonic-gate extern int ct_pr_event_get_gcorefile(ct_evthdl_t, const char **);
1130Sstevel@tonic-gate extern int ct_pr_event_get_zcorefile(ct_evthdl_t, const char **);
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate extern int ct_pr_status_get_param(ct_stathdl_t, uint_t *);
1160Sstevel@tonic-gate extern int ct_pr_status_get_fatal(ct_stathdl_t, uint_t *);
1170Sstevel@tonic-gate extern int ct_pr_status_get_members(ct_stathdl_t, pid_t **, uint_t *);
1180Sstevel@tonic-gate extern int ct_pr_status_get_contracts(ct_stathdl_t, ctid_t **, uint_t *);
119*6073Sacruz extern int ct_pr_status_get_svc_fmri(ct_stathdl_t, char **);
120*6073Sacruz extern int ct_pr_status_get_svc_aux(ct_stathdl_t, char **);
121*6073Sacruz extern int ct_pr_status_get_svc_ctid(ct_stathdl_t, ctid_t *);
122*6073Sacruz extern int ct_pr_status_get_svc_creator(ct_stathdl_t, char **);
1230Sstevel@tonic-gate 
1244845Svikram /*
1254845Svikram  * Device contract routines
1264845Svikram  */
1274845Svikram int ct_dev_tmpl_set_minor(int, char *);
1284845Svikram int ct_dev_tmpl_set_aset(int, uint_t);
1294845Svikram int ct_dev_tmpl_set_noneg(int);
1304845Svikram int ct_dev_tmpl_clear_noneg(int);
1314845Svikram int ct_dev_tmpl_get_minor(int, char *, size_t *);
1324845Svikram int ct_dev_tmpl_get_aset(int, uint_t *);
1334845Svikram int ct_dev_tmpl_get_noneg(int, uint_t *);
1344845Svikram int ct_dev_status_get_aset(ct_stathdl_t, uint_t *);
1354845Svikram int ct_dev_status_get_noneg(ct_stathdl_t, uint_t *);
1364845Svikram int ct_dev_status_get_dev_state(ct_stathdl_t, uint_t *);
1374845Svikram int ct_dev_status_get_minor(ct_stathdl_t, char **);
1384845Svikram 
1394845Svikram 
1400Sstevel@tonic-gate #ifdef __cplusplus
1410Sstevel@tonic-gate }
1420Sstevel@tonic-gate #endif
1430Sstevel@tonic-gate 
1440Sstevel@tonic-gate #endif /* _LIBCONTRACT_H */
145