prcmd.3n (2010 09)
p
prcmd(3N) prcmd(3N)
prc_conn_status
field is left unchanged.
When the standard error connection is ready for reading,
prcmd() does an
accept() on it, closes the old prc_fp2
and revises the value to a new file
pointer for the new socket/fd, changes
prc_conn_status
to
PRC_CONN3_WAIT
, and sets prc_conn_time
to the current system clock in
seconds.
If only the stdout connection is ready for reading, this indicates a
remshd failure.
prcmd() treats this as a refused connection, as described earlier under Common
Error Handling .
Note that a host is "held" in
PRC_CONN1_WAIT
or PRC_CONN2_WAIT
status if there are no available
file descriptors or reserved ports when one is needed.
PRC_CONN3_WAIT prcmd()
includes this host in the
select() list for read-readiness. If the con-
nection is not ready for reading, the
prc_conn_status
field is left unchanged.
When the connection is ready for reading,
prcmd() consumes the null byte on
stdout from
remshd, sets prc_conn_status
to PRC_READ_WAIT
, and resets
prc_conn_time to the current system clock in seconds for use by the calling pro-
gram during the ensuing conversation. If anything other than a null byte arrives,
this indicates a remshd failure. prcmd() treats this as a refused connection, as
described previously.
PRC_READ_WAIT prcmd()
includes this host in the select() list for read-readiness. When the
connection is not ready for reading, the
prc_conn_status
field is left
unchanged. Note, the remote command might be waiting for the calling program to
write data to it.
When the connection is ready for reading,
prcmd() sets prc_conn_status
to
PRC_READ_READY.
PRC_READ_READY prcmd()
treats a host in this status the same as PRC_READ_WAIT. If the connec-
tion is not ready for reading,
prcmd() sets prc_conn_status
back to
PRC_READ_WAIT.
PRC_CONN_DONE prcmd()
ignores this host’s entry.
prcmd() enters this state from any other state when the prc_conn_close
field
(set by the calling program) is non-zero. It closes the files specified by
prc_fp and
prc_fp2 (if not already null), sets those fields to null, and resets the
prc_conn_close field to 0.
PRC_CONN_NO_IPS
PRC_CONN_FAILED
PRC_CONN_REFUSED
PRC_CONN_TIMEOUT
With any of these failure status values, prcmd() ignores this host’s entry, except
if prc_conn_close is set, the entry’s prc_conn_status
field is set to
PRC_CONN_DONE.
Changes in Host Status
After each
prcmd() call, the prc_prev_status field for each host’s entry is set to the previous
value of its prc_conn_status field. The calling program can use (prc_prev_status !=
prc_conn_status) to quickly check for a new status for any host. This is useful for once-only logging
or display of status values except PRC_READ_WAIT and PRC_READ_READY
— each of these states can
be entered many times during a conversation.
Note that a host can leave and then re-enter
PRC_CONN_NONE status if it has multiple IP addresses, a
connection to one IP fails, and there are no files or ports available to try the host’s next IP address.
The calling program can freely use the
prc_caller_status field to record additional information
about the status of each connection.
Usage Notes
Once a connection is made, and a host is in one of the
PRC_READ_* states, control of the "conversation"
between the calling program and remote host belongs to the calling program. Conversations are of two
types:
4 Hewlett-Packard Company − 4 − HP-UX 11i Version 3: September 2010