Description

These functions operate on contract status file descriptors obtained from the contract(4) file system and status object handles returned by ct_status_read
().

The ct_status_read() function reads the contract's status and initializes the status object handle pointed to by stathdlp. After a successful call to ct_status_read(), the caller is responsible for calling ct_status_free()
on this status object handle when it has finished using it. Because the amount of information available for a contract might be large, the detail argument allows the caller to specify how much information ct_status_read() should obtain. A value of CTD_COMMON
fetches only those data accessible by the functions on this manual page. CTD_FIXED fetches CTD_COMMON data as well as fixed-size contract type-specific data. CTD_ALL fetches CTD_FIXED data as well as variable lengthed
data, such as arrays. See the manual pages for contract type-specific status accessor functions for information concerning which data are fetched by CTD_FIXED and CTD_ALL.

The ct_status_free() function frees any storage associated with the specified status object handle.

The remaining functions all return contract information obtained from a status object.

The ct_status_get_id() function returns the contract's ID.

The ct_status_get_zoneid() function returns the contract's creator's zone ID, or −1 if the creator's zone no longer exists.

The ct_status_get_type() function returns the contract's type. The string should be neither modified nor freed.

The ct_status_get_state() function returns the state of the contract. Valid state values are:

CTS_OWNED

a contract that is currently owned by a process

CTS_INHERITED

a contract that has been inherited by a regent process contract

CTS_ORPHAN

a contract that has no owner and has not been inherited

CTS_DEAD

a contract that is no longer in effect and will be automatically removed from the system as soon as the last reference to it is release (for example, an open status file descriptor)

The ct_status_get_holder() function returns the process ID of the contract's owner if the contract is in the CTS_OWNED state, or the ID of the regent process contract if the contract is in the CTS_INHERITED state.

The ct_status_get_nevents() function returns the number of unacknowledged critical events on the contract's event queue.

The ct_status_get_ntime() function returns the amount of time remaining (in seconds) before the ongoing exit negotiation times out, or -1 if there is no negotiation ongoing.

The ct_status_get_qtime() function returns the amount of time remaining (in seconds) in the quantum before the ongoing exit negotiation times out, or -1 if there is no negotiation ongoing.

The ct_status_get_nevid() function returns the event ID of the ongoing negotiation, or 0 if there are none.

The ct_status_get_cookie() function returns the cookie term of the contract.

The ct_status_get_critical() function is used to read the critical event set term. The value is a collection of bits as described in the contract type's manual page.

The ct_status_get_informative() function is used to read the informative event set term. The value is a collection of bits as described in the contract type's manual page.