JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 4: File Formats     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

File Formats

addresses(4)

admin(4)

ai_manifest(4)

alias(4)

aliases(4)

a.out(4)

au(4)

audit_class(4)

audit_event(4)

audit.log(4)

auth_attr(4)

autofs(4)

bart_manifest(4)

bart_rules(4)

bootparams(4)

cardbus(4)

compver(4)

contents(4)

contract(4)

copyright(4)

core(4)

crypt.conf(4)

crypto_certs(4)

dacf.conf(4)

dat.conf(4)

dc_manifest(4)

defaultdomain(4)

default_fs(4)

defaultrouter(4)

depend(4)

device_allocate(4)

device_contract(4)

device_maps(4)

devices(4)

devid_cache(4)

devname_cache(4)

dfstab(4)

dhcp_inittab(4)

dhcp_network(4)

dhcpsvc.conf(4)

dhcptab(4)

dialups(4)

dir(4)

dir_ufs(4)

d_passwd(4)

driver(4)

driver.conf(4)

ds.log(4)

dumpdates(4)

ethers(4)

exec_attr(4)

fbtab(4)

fd(4)

fdi(4)

flash_archive(4)

format.dat(4)

forward(4)

fs(4)

fspec(4)

fstypes(4)

ftp(4)

ftpusers(4)

fx_dptbl(4)

gateways(4)

geniconvtbl(4)

group(4)

gsscred.conf(4)

hba.conf(4)

holidays(4)

hosts(4)

hosts.equiv(4)

ib(4)

idnkit.pc(4)

ike.config(4)

ike.preshared(4)

inetd.conf(4)

inet_type(4)

infiniband_hca_persistent_cache(4)

init.d(4)

inittab(4)

ipaddrsel.conf(4)

ipf(4)

ipf.conf(4)

ipnat(4)

ipnat.conf(4)

ipnodes(4)

ippool(4)

ippool.conf(4)

isa(4)

issue(4)

kadm5.acl(4)

kdc.conf(4)

keytables(4)

krb5.conf(4)

label_encodings(4)

ldapfilter.conf(4)

ldapsearchprefs.conf(4)

ldaptemplates.conf(4)

llc2(4)

logadm.conf(4)

logindevperm(4)

loginlog(4)

magic(4)

md.cf(4)

mddb.cf(4)

mdi_ib_cache(4)

mdi_scsi_vhci_cache(4)

md.tab(4)

mech(4)

meddb(4)

mnttab(4)

mod_ipp(4)

mpapi.conf(4)

named.conf(4)

ncad_addr(4)

nca.if(4)

ncakmod.conf(4)

ncalogd.conf(4)

ncaport.conf(4)

ndmp(4)

ndpd.conf(4)

netconfig(4)

netgroup(4)

netid(4)

netmasks(4)

netrc(4)

networks(4)

nfs(4)

nfslog.conf(4)

nfssec.conf(4)

NISLDAPmapping(4)

nodename(4)

nologin(4)

note(4)

notrouter(4)

nscd.conf(4)

nss(4)

nsswitch.conf(4)

packingrules(4)

pam.conf(4)

pam.d(4)

passwd(4)

path_to_inst(4)

pci(4)

pcie(4)

pci_unitaddr_persistent(4)

phones(4)

pkginfo(4)

pkgmap(4)

plot(4B)

policy.conf(4)

priv_names(4)

proc(4)

process(4)

prof_attr(4)

profile(4)

project(4)

protocols(4)

prototype(4)

pseudo(4)

publickey(4)

qop(4)

queuedefs(4)

rcmscript(4)

rdc.cf(4)

registration_profile(4)

remote(4)

resolv.conf(4)

rhosts(4)

rmtab(4)

rndc.conf(4)

rpc(4)

rt_dptbl(4)

sasl_appname.conf(4)

sbus(4)

sccsfile(4)

scsi(4)

securenets(4)

sel_config(4)

sendmail(4)

sendmail.cf(4)

service_bundle(4)

service_provider.conf(4)

services(4)

shadow(4)

sharetab(4)

shells(4)

slp.conf(4)

slpd.reg(4)

smb(4)

smbautohome(4)

smhba.conf(4)

snapshot_cache(4)

sndr(4)

sock2path.d(4)

space(4)

ssh_config(4)

sshd_config(4)

submit.cf(4)

sulog(4)

sysbus(4)

syslog.conf(4)

system(4)

telnetrc(4)

term(4)

terminfo(4)

TIMEZONE(4)

timezone(4)

TrustedExtensionsPolicy(4)

ts_dptbl(4)

ttydefs(4)

ttysrch(4)

ufsdump(4)

updaters(4)

user_attr(4)

utmp(4)

utmpx(4)

vfstab(4)

volume-config(4)

volume-defaults(4)

volume-request(4)

wanboot.conf(4)

warn.conf(4)

wtmp(4)

wtmpx(4)

ypfiles(4)

yppasswdd(4)

ypserv(4)

zoneinfo(4)

device_contract

- device contract type

Synopsis

/system/contract/device

Description

Device contracts allow processes to monitor events involving a device of interest and to react and/or block state changes involving such devices.

Device contracts are managed using the contract(4) file system and the libcontract(3LIB) library. The process contract type directory is /system/contract/device.

Creation

A device contract may be created in one of two ways:

States, Breaks and Events

A state refers to the state of the device which is the subject of the contract. Currently, three states are defined for device contracts:

CT_DEV_EV_ONLINE

The device is online and functioning normally.

CT_DEV_EV_DEGRADED

The device is online, but functioning in a degraded capacity.

CT_DEV_EV_OFFLINE

The device is offline and is not configured for use.

A process creates a device contract with the kernel to get a guarantee that the device is in an acceptable set of states as long as the contract is valid. This acceptable set (or “A-set”, for short) is specified as one of the terms of the contract when the contract is created.

When a device moves to a state outside the “A-set”, the contract is broken. The breaking of the contract may be either asynchronous or synchronous, depending on whether the transition that led to the breaking of the contract is synchronous or asynchronous.

If the breaking of a contract is asynchronous, then a critical event is generated and sent to the contract holder. The event is generated even if the contract holder has not subscribed to the event via the critical or informative event sets.

If the breaking of the contract is synchronous, a critical contract event is generated with the CTE_NEG flag set to indicate that this is a negotiation event. The contract holder is expected to either acknowledge (ACK) this change and allow the state change to occur or it may negatively acknowledge (NACK) the change to block it (if it has sufficient privileges).

The term “event” refers to the transition of a device from one state to another. The event is named by the state to which the device is transitioning. For instance, if a device is transitioning to the OFFLINE state, the name of the event is CT_DEV_EV_OFFLINE. An event may have no consequence for a contract, or it may result in the asynchronous breaking of a contract or it may result in a synchronous (that is, negotiated) breaking of a contract. Events are delivered to a contract holder in three cases:

In the last two cases, a critical event is delivered even if the holder has not subscribed to the event via the critical or informative event sets.

NEGOTIATION

If the breaking of a contract is synchronous, the kernel begins negotiations with the contract holder by generating a critical event before the device changes state. The event has the CTE_NEG flag set indicating that this is a negotiation event. The contract owner is allowed a limited period of time in which to either ACK the contract event (thus, allowing the state change) or if it has appropriate privileges, NACK the state change (thus, blocking the state change). ACKs may be sent by the holder via ct_ctl_ack(3CONTRACT) and NACKs may be sent via ct_ctl_nack(3CONTRACT). If a contract holder does not send either a NACK or ACK within a specified period of time, an ACK is assumed and the kernel proceeds with the state change.

Once the device state change is finalized, the contract subsystem sends negotiation end (NEGEND) critical messages to the contract owner indicating the final disposition of the state transition. That is, either success or failure.

Once a contract is broken, a contract owner may choose to create a replacement contract. It may do this after the contract is broken or it may choose to do this synchronously with the breaking of the old contract via ct_ctl_newct(3CONTRACT).

TERMS

The following common contract terms, defined in contract(4), have device-contract specific attributes:

informative set

The default value for the informative set is CT_DEV_EV_DEGRADE that is, transitions to the DEGRADED state will by default result in informative events. Use ct_tmpl_set_informative(3CONTRACT) to set this term.

critical set

The default value for the informative set is CT_DEV_EV_OFFLINE. That is, transitions to the OFFLINE state will by default result in critical events. Use ct_tmpl_set_critical(3CONTRACT) to set this term.

The following contract terms can be read from or written to a device contract template using the named libcontract(3LIB) interfaces. These contract terms are in addition to those described in contract(4).

CTDP_ACCEPT

Acceptable set or “A-set”.

This term is required for every device contract. It defines the set of device states which the contract owner expects to exist as long as the contract is valid. If a device transitions to a state outside this “A-set”, then the contract breaks and is no longer valid. A critical contract event is sent to the contract owner to signal this break.

Use ct_dev_tmpl_set_aset() to set this term. The default “A-set” is CT_DEV_EV_ONLINE | CT_DEV_EV_DEGRADE. This term is mandatory. Use ct_dev_tmpl_get_aset() to query a template for this term.

CTDP_MINOR

Specifies the devfs path to a minor node that is the subject of the contract. Used to specify the minor node to be used for creating a contract when contract creation takes place other than at open time.

If the contract is created synchronously at open(2) time, then this term is implied to be the minor node being opened. In this case, this term need not be explicitly be set.

Use ct_dev_tmpl_set_minor() to set this term. The default setting for this term is NULL. That is, no minor node is specified.

Use ct_dev_tmpl_get_noneg() to query a template for the setting of this term.

CTDP_NONEG

If set, this term indicates that any negotiable departure from the contract terms should be NACKed. That is, the contract subsystem should assume a NACK for any negotiated breaking of the contract. This term is ignored for asynchronous contract breaks.

Use ct_dev_tmpl_set_noneg() to set this term. The default setting is off.

Use ct_dev_tmpl_get_noneg() to query a template for the setting of this term.

STATUS

In addition to the standard items, the status object read from a status file descriptor contains the following items if CTD_FIXED is specified:

CTDS_STATE

Returns the current state of the device. One of the following states is returned:

  • CT_DEV_EV_ONLINE

  • CT_DEV_EV_DEGRADED

  • CT_DEV_EV_OFFLINE

    Use ct_dev_status_get_dev_state() to obtain this information.

CTDS_ASET

Returns the acceptable states (“A-set”) of the device contract. The return value is a bitset of device states and may include one or more of the following:

  • CT_DEV_EV_ONLINE

  • CT_DEV_EV_DEGRADED

  • CT_DEV_EV_OFFLINE

    Use ct_dev_status_get_aset() to obtain this information.

CTDS_NONEG

Returns the current setting of the noneg flag. Returns 1 if the noneg flag is set, or 0 if the flag is not set. Use ct_dev_status_get_noneg() to obtain this information.

If CTD_ALL is specified, the following items are also available:

CTDS_MINOR

The devfs path of the device which is the subject of the device contract. Use ct_dev_status_get_minor() to obtain this information.

EVENTS

No new event related interfaces (beyond the standard contract event interfaces) are defined for device contract events.

Files

/usr/include/sys/contract/device.h

Contains definitions of events, status fields and event fields

See Also

ctrun(1), ctstat(1), ctwatch(1), open(2), ct_tmpl_set_critical(3CONTRACT), ct_tmpl_set_informative(3CONTRACT), ct_dev_tmpl_set_aset(3CONTRACT), ct_dev_tmpl_get_aset(3CONTRACT), ct_dev_tmpl_set_minor(3CONTRACT), ct_dev_tmpl_get_minor(3CONTRACT), ct_dev_tmpl_set_noneg(3CONTRACT), ct_dev_tmpl_get_noneg(3CONTRACT), ct_dev_status_get_dev_state(3CONTRACT), ct_dev_status_get_aset(3CONTRACT), ct_dev_status_get_minor(3CONTRACT), libcontract(3LIB), contract(4), privileges(5)