[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

srcstat Subroutine

Purpose

Gets short status on a subsystem.

Library

System Resource Controller Library (libsrc.a)

Syntax

#include <spc.h>
int srcstat(Host, 
SubsystemName,SubsystemPID, ReplyLength, StatusReply,Continued)
char *Host, *SubsystemName;
int SubsystemPID, *Continued;
short *ReplyLength;
struct statrep *StatusReply;

Description

The srcstat subroutine sends a short status request to the System Resource Controller (SRC) and returns status for one or more subsystems to the caller.

Parameters

Host Specifies the foreign host on which this status action is requested. If the host is null, the status request is sent to the SRC on the local host. The local user must be running as "root". The remote system must be configured to accept remote System Resource Controller requests. That is, the srcmstr daemon (see /etc/inittab) must be started with the -r flag and the /etc/hosts.equiv or .rhosts file must be configured to allow remote requests.
SubsystemName Specifies the name of the subsystem on which to get short status. To get status of all subsystems, use the SRCALLSUBSYS constant. To get status of a group of subsystems, the SubsystemName parameter must start with the SRCGROUP constant, followed by the name of the group for which you want status appended. If you specify a null SubsystemName parameter, you must specify a SubsystemPID parameter.
SubsystemPID Specifies the PID of the subsystem on which to get status as returned by the srcstat subroutine. You must specify the SubsystemPID parameter if multiple instances of the subsystem are active and you request a long subsystem status or subserver status. If you specify a null SubsystemPID parameter, you must specify a SubsystemName parameter.
ReplyLength Specifies size of a srchdr structure plus the number of statcode structures times the size of one statcode structure. On return from the srcstat subroutine, this value is updated.
StatusReply Specifies a pointer to a statrep code structure containing a statcode array that receives the status reply for the requested subsystem. The first element of the returned statcode array contains the status title line. The statcode structure is defined in the spc.h file.
Continued Specifies whether this call to the srcstat subroutine is a continuation of a previous status request. If the Continued parameter is set to NEWREQUEST, a request for short subsystem status is sent to the SRC and srcstat waits for the first status response. The calling process should never set Continued to a value other than NEWREQUEST. The last response for the SRC sets Continued to END.

Return Values

If the srcstat subroutine succeeds, it returns a value of 0. An error code is returned if the subroutine is unsuccessful.

Error Codes

The srcstat subroutine fails if one or more of the following are true:

SRC_DMNA The SRC daemon is not active.
SRC_INET_AUTHORIZED_HOST The local host is not in the remote /etc/hosts.equiv file.
SRC_INET_INVALID_HOST On the remote host, the local host is not known.
SRC_INVALID_USER The user is not root or group system.
SRC_MMRY An SRC component could not allocate the memory it needs.
SRC_NOCONTINUE Continued was not set to NEWREQUEST and no continuation is currently active.
SRC_NORPLY The request timed out waiting for a response.
SRC_SOCK There is a problem with SRC socket communications.
SRC_UDP The SRC port is not defined in the /etc/services file.
SRC_UHOST The foreign host is not known.

Examples

  1. To request the status of a subsystem, enter:
    intcont=NEWREQUEST;
    struct statcode statcode[20];
    short replen=sizeof(statcode);
     
    srcstat("MaryC","srctest",0,&replen,statcode,&cont);

    This entry requests short status of all instances of the subsystem srctest on the MaryC machine.

  2. To request the status of all subsystems, enter:
    intcont=NEWREQUEST;
    struct statcode statcode[20];
    short replen=sizeof(statcode);
     
    srcstat("",SRCALLSUBSYS,0,&replen,statcode,&cont);

    This entry requests short status of all subsystems on the local machine.

  3. To request the status for a group of subsystems, enter:
    intcont=NEWREQUEST;
    struct statcode statcode[20];
    short replen=sizeof(statcode);
    char subsysname[30];
     
    strcpy(subsysname,SRCGROUP);
    strcat(subsysname,"tcpip");
    srcstat("",subsysname,0,&replen,statcode,  &cont);

    This entry requests short status of all members of the subsystem group tcpip on the local machine.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Files

/etc/services Defines the sockets and protocols used for Internet services.
/dev/SRC Specifies the AF_UNIX socket file.
/dev/.SRC-unix Specifies the location for temporary socket files.

Related Information

The srcrrqs subroutine, srcsbuf subroutine, srcsrpy subroutine, srcsrqt subroutine, srcstathdr subroutine, srcstattxt subroutine, srcstop subroutine, srcstrt subroutine.

List of SRC Subroutines, Programming Subsystem Communication with the SRC, System Resource Controller (SRC) Overview for Programmers in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Contents | Glossary | Home | Search ]