HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

p
prcmd(3N) prcmd(3N)
NAME
prcmd(), prcmd_init() - return streams to parallel remote commands
SYNOPSIS
#include <prcmd.h>
void prcmd_init (
struct prc_host *hostp,
int num_hosts,
int caller_status,
char *command,
time_t timeout
);
int prcmd (
struct prc_host *hostp,
int num_hosts
);
Remarks
These functions reside in libdc and are linked using the -ldc option to the ld or cc
command.
DESCRIPTION
prcmd() is an interface similar to rcmd() that allows a client-side calling program to use an existing
rcmd() server side daemon. prcmd(), however, performs in parallel across multiple systems, the time
consuming steps associated with executing commands remotely (connection, command invocation, and com-
mand execution/interaction). With
rcmd(), only command execution and interaction is under the control
of the calling program, and it requires the calling program to perform its own
select() calls in order to
manage multiple (parallel) connections.
Features of the existing server-side remote-shell daemon (
remshd) include: well known service, access
control, and shell processing of the command line.
The calling program passes
prcmd() a pointer (hostp) to the first node in a list of hosts for which to ini-
tiate, or continue, remote command processing via Internet socket connections. It also supplies the number
of hosts in the list (num_hosts).
The calling program makes repeated calls to prcmd() to advance the status of the host connections.
Each call to prcmd() causes a single call of select() to check the status of all connections that
require checking (if there are any). Once a connection (to a remote command) is ready for reading, the cal-
ling program can read data from it, optionally write data to it, and then wait for more data to be ready to
read back from it.
Header File
The <prcmd.h> header file defines a prc_host structure containing the following fields of interest:
char *prc_hostid; /* host name or IP address */
int prc_prev_status; /* previous connection status */
int prc_conn_status; /* connection status */
time_t prc_conn_time; /* time of connection */
int prc_errno; /* for failed connections */
char *prc_errmsg; /* string from remshd */
FILE *prc_fp; /* file ptr to stdin/stdout */
FILE *prc_fp2; /* file pointer to stderr */
int prc_conn_close; /* flag: close connection */
int prc_caller_status; /* caller’s info about conn */
The calling program should change only the prc_hostid , prc_conn_close,
prc_caller_status, and possibly prc_conn_time
fields, as explained below. The other fields
should be considered read-only.
The header file also defines the following macros of interest:
PRC_OK /* function succeeded, check entries */
PRC_ERR_NETWORKING /* no networking on calling program’s system */
PRC_ERR_NOFILE /* cannot get even one file descriptor */
PRC_ERR_RCMD /* cannot get "shell" service num, etc. */
150 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: December 2007 Update