[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 2

srcstat Subroutine

Purpose

Gets short status on one or more subsystems.

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;
void * 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 structure containing first element as struct srchdr and secondary element as struct statcode (both defined in spc.h file) array that receives the status reply for the requested subsystem. The first element of the returned statcode array contains the status title line. The number of statcode structures array items depends on the number of subsystems user queried.
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 {
               struct srchdr srchdr
               struct statcode statcode[6];
    } status;
    short replen=sizeof(status);
     
    srcstat("MaryC","srctest",0,&replen,&status,&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:
    int cont=NEWREQUEST;
    struct {
        struct srchdr srchdr;
        struct statcode statcode[80];
    } status;
    short replen=sizeof(status);
     
    srcstat("",SRCALLSUBSYS,0,&replen,&status,&cont);

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

  3. To request the status for a group of subsystems, enter:
    int cont=NEWREQUEST;
    struct struct {
        struct srchdr srchdr;
    struct statcode statcode[30];
    } status;
    short replen=sizeof(status), rep_num;
    char subsysname[30];
     
    strcpy(subsysname,SRCGROUP);
    strcat(subsysname,"tcpip");
    srcstat("",subsysname,0,&replen,&status, &cont);
    
    rep_num = (replen - sizeof(strcut srchdr)) / sizeof(strcut statcode);
    
    for (i = 0; i < rep_num; i++)
        printf("objtype %d status %d objname %s objtext %s\n",
                status.statcode[i].objtype, status.statcode[i].status,
                status.statcode[i].objname, status.statcode[i].objtext);
    

    This entry requests short status of all members of the subsystem group tcpip on the local machine , and displays the query results on stdout.

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 (srcrrqs Subroutine) subroutine, srcsbuf (srcsbuf Subroutine) subroutine, srcsrpy (srcsrpy Subroutine) subroutine, srcsrqt (srcsrqt Subroutine) subroutine, srcstathdr (srcstathdr Subroutine) subroutine, srcstattxt (srcstattxt Subroutine) subroutine, srcstop (srcstop Subroutine) subroutine, srcstrt (srcstrt Subroutine) subroutine.

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

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]