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*25e8c5aaSvikram * Common Development and Distribution License (the "License"). 6*25e8c5aaSvikram * 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*25e8c5aaSvikram * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _LIBCONTRACT_H 277c478bd9Sstevel@tonic-gate #define _LIBCONTRACT_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <sys/types.h> 327c478bd9Sstevel@tonic-gate #include <sys/contract.h> 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate typedef void *ct_stathdl_t; 397c478bd9Sstevel@tonic-gate typedef void *ct_evthdl_t; 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * Common routines 437c478bd9Sstevel@tonic-gate */ 447c478bd9Sstevel@tonic-gate extern int ct_tmpl_activate(int); 457c478bd9Sstevel@tonic-gate extern int ct_tmpl_clear(int); 467c478bd9Sstevel@tonic-gate extern int ct_tmpl_create(int, ctid_t *); 477c478bd9Sstevel@tonic-gate extern int ct_tmpl_set_cookie(int, uint64_t); 487c478bd9Sstevel@tonic-gate extern int ct_tmpl_get_cookie(int, uint64_t *); 497c478bd9Sstevel@tonic-gate extern int ct_tmpl_set_critical(int, uint_t); 507c478bd9Sstevel@tonic-gate extern int ct_tmpl_get_critical(int, uint_t *); 517c478bd9Sstevel@tonic-gate extern int ct_tmpl_set_informative(int, uint_t); 527c478bd9Sstevel@tonic-gate extern int ct_tmpl_get_informative(int, uint_t *); 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate extern int ct_ctl_adopt(int); 557c478bd9Sstevel@tonic-gate extern int ct_ctl_abandon(int); 567c478bd9Sstevel@tonic-gate extern int ct_ctl_ack(int, ctevid_t); 57*25e8c5aaSvikram extern int ct_ctl_nack(int, ctevid_t); 587c478bd9Sstevel@tonic-gate extern int ct_ctl_qack(int, ctevid_t); 597c478bd9Sstevel@tonic-gate extern int ct_ctl_newct(int, ctevid_t, int); 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate extern int ct_status_read(int, int, ct_stathdl_t *); 627c478bd9Sstevel@tonic-gate extern void ct_status_free(ct_stathdl_t); 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate extern ctid_t ct_status_get_id(ct_stathdl_t); 657c478bd9Sstevel@tonic-gate extern zoneid_t ct_status_get_zoneid(ct_stathdl_t); 667c478bd9Sstevel@tonic-gate extern const char *ct_status_get_type(ct_stathdl_t); 677c478bd9Sstevel@tonic-gate extern id_t ct_status_get_holder(ct_stathdl_t); 687c478bd9Sstevel@tonic-gate extern ctstate_t ct_status_get_state(ct_stathdl_t); 697c478bd9Sstevel@tonic-gate extern int ct_status_get_nevents(ct_stathdl_t); 707c478bd9Sstevel@tonic-gate extern int ct_status_get_ntime(ct_stathdl_t); 717c478bd9Sstevel@tonic-gate extern int ct_status_get_qtime(ct_stathdl_t); 727c478bd9Sstevel@tonic-gate extern ctevid_t ct_status_get_nevid(ct_stathdl_t); 737c478bd9Sstevel@tonic-gate extern uint_t ct_status_get_informative(ct_stathdl_t); 747c478bd9Sstevel@tonic-gate extern uint_t ct_status_get_critical(ct_stathdl_t); 757c478bd9Sstevel@tonic-gate extern uint64_t ct_status_get_cookie(ct_stathdl_t); 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate extern int ct_event_read(int, ct_evthdl_t *); 787c478bd9Sstevel@tonic-gate extern int ct_event_read_critical(int, ct_evthdl_t *); 797c478bd9Sstevel@tonic-gate extern int ct_event_reset(int); 807c478bd9Sstevel@tonic-gate extern int ct_event_reliable(int); 817c478bd9Sstevel@tonic-gate extern void ct_event_free(ct_evthdl_t); 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate extern uint_t ct_event_get_flags(ct_evthdl_t); 847c478bd9Sstevel@tonic-gate extern ctid_t ct_event_get_ctid(ct_evthdl_t); 857c478bd9Sstevel@tonic-gate extern ctevid_t ct_event_get_evid(ct_evthdl_t); 867c478bd9Sstevel@tonic-gate extern uint_t ct_event_get_type(ct_evthdl_t); 877c478bd9Sstevel@tonic-gate extern int ct_event_get_nevid(ct_evthdl_t, ctevid_t *); 887c478bd9Sstevel@tonic-gate extern int ct_event_get_newct(ct_evthdl_t, ctid_t *); 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate /* 917c478bd9Sstevel@tonic-gate * Process contract routines 927c478bd9Sstevel@tonic-gate */ 937c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_set_transfer(int, ctid_t); 947c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_set_fatal(int, uint_t); 957c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_set_param(int, uint_t); 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_get_transfer(int, ctid_t *); 987c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_get_fatal(int, uint_t *); 997c478bd9Sstevel@tonic-gate extern int ct_pr_tmpl_get_param(int, uint_t *); 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_pid(ct_evthdl_t, pid_t *); 1027c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_ppid(ct_evthdl_t, pid_t *); 1037c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_signal(ct_evthdl_t, int *); 1047c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_sender(ct_evthdl_t, pid_t *); 1057c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_senderct(ct_evthdl_t, ctid_t *); 1067c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_exitstatus(ct_evthdl_t, int *); 1077c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_pcorefile(ct_evthdl_t, const char **); 1087c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_gcorefile(ct_evthdl_t, const char **); 1097c478bd9Sstevel@tonic-gate extern int ct_pr_event_get_zcorefile(ct_evthdl_t, const char **); 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate extern int ct_pr_status_get_param(ct_stathdl_t, uint_t *); 1127c478bd9Sstevel@tonic-gate extern int ct_pr_status_get_fatal(ct_stathdl_t, uint_t *); 1137c478bd9Sstevel@tonic-gate extern int ct_pr_status_get_members(ct_stathdl_t, pid_t **, uint_t *); 1147c478bd9Sstevel@tonic-gate extern int ct_pr_status_get_contracts(ct_stathdl_t, ctid_t **, uint_t *); 1157c478bd9Sstevel@tonic-gate 116*25e8c5aaSvikram /* 117*25e8c5aaSvikram * Device contract routines 118*25e8c5aaSvikram */ 119*25e8c5aaSvikram int ct_dev_tmpl_set_minor(int, char *); 120*25e8c5aaSvikram int ct_dev_tmpl_set_aset(int, uint_t); 121*25e8c5aaSvikram int ct_dev_tmpl_set_noneg(int); 122*25e8c5aaSvikram int ct_dev_tmpl_clear_noneg(int); 123*25e8c5aaSvikram int ct_dev_tmpl_get_minor(int, char *, size_t *); 124*25e8c5aaSvikram int ct_dev_tmpl_get_aset(int, uint_t *); 125*25e8c5aaSvikram int ct_dev_tmpl_get_noneg(int, uint_t *); 126*25e8c5aaSvikram int ct_dev_status_get_aset(ct_stathdl_t, uint_t *); 127*25e8c5aaSvikram int ct_dev_status_get_noneg(ct_stathdl_t, uint_t *); 128*25e8c5aaSvikram int ct_dev_status_get_dev_state(ct_stathdl_t, uint_t *); 129*25e8c5aaSvikram int ct_dev_status_get_minor(ct_stathdl_t, char **); 130*25e8c5aaSvikram 131*25e8c5aaSvikram 132*25e8c5aaSvikram 1337c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1347c478bd9Sstevel@tonic-gate } 1357c478bd9Sstevel@tonic-gate #endif 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate #endif /* _LIBCONTRACT_H */ 138