Gets status for a subserver or a subsystem and returns status text to be printed.
System Resource Controller Library (libsrc.a)
#include <spc.h> int srcsbuf_r(Host, Type, SubsystemName, SubserverObject, SubsystemPID, StatusType, StatusFrom, StatusText, Continued, SRCHandle) char *Host, *SubsystemName; char *SubserverObject, **StatusText; short Type, StatusType; pid_t SubsystemPID; int StatusFrom *Continued; char **SRCHandle;
The srcsbuf_r subroutine gets the status of a subserver or subsystem and returns printable text for the status in the address pointed to by the StatusText parameter. The srcsbuf_r subroutine supports all the functions of the srcbuf subroutine except the StatusFrom parameter.
When the StatusType parameter is SHORTSTAT and the Type parameter is SUBSYSTEM, the srcstat_r subroutine is called to get the status of one or more subsystems. When the StatusType parameter is LONGSTAT and the Type parameter is SUBSYSTEM, the srcrsqt_r subroutine is called to get the long status of one subsystem. When the Type parameter is not SUBSYSTEM, the srcsrqt_r subroutine is called to get the long or short status of a subserver.
This routine is threadsafe and reentrant.
If the srcsbuf_r subroutine succeeds, it returns the size (in bytes) of printable text pointed to by the StatusText parameter.
The srcsbuf_r subroutine fails and returns the corresponding error code if one of the following error conditions is detected:
SRC_BADSOCK | The request could not be passed to the subsystem because of some socket failure. |
SRC_CONT | The subsystem uses signals. The request cannot complete. |
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 | The Continued parameter was not set to NEWREQUEST, and no continuation is currently active. |
SRC_NORPLY | The request timed out waiting for a response. |
SRC_NSVR | The subsystem is not active. |
SRC_SOCK | There is a problem with SRC socket communications. |
SRC_STPG | The request was not passed to the subsystem. The subsystem is stopping. |
SRC_UDP | The SRC port is not defined in the /etc/services file. |
SRC_UHOST | The foreign host is not known. |
SRC_WICH | There are multiple instances of the subsystem active. |
char *status; int continued=NEWREQUEST; int rc; char *handle do { rc=srcsbuf_r("MaryC", SUBSYSTEM, "srctest", "", 0, SHORTSTAT, SDAEMON, &status, continued, &handle); if (status!=0) { printf(status); free(status); status=0; } } while (rc>0); if (rc<0) { ...handle error from srcsbuf_r... }
This gets short status of the srctest subsystem on the MaryC machine and prints the formatted status to standard output.
Caution: In a multithreaded environment, the caller must manage the sharing of standard output between threads. Set the StatusFrom parameter to SDAEMON to prevent unexpected error messages from being printed to standard output.
char *status; int continued=NEWREQUEST; int rc; char *handle do { rc=srcsbuf_r("", 12345, "srctest", "", 0, LONGSTAT, SDAEMON, &status, continued, &handle); if (status!=0) { printf(status); free(status); status=0; } } while (rc>0); if (rc<0) { ...handle error from srcsbuf_r... }
This gets long status for a specific subserver belonging to subsystem srctest. The subserver is the one having code point 12345. This request is processed on the local machine. The formatted status is printed to standard output.
Caution: In a multithreaded environment, the caller must manage the sharing of standard output between threads. Set the StatusFrom parameter to SDAEMON to prevent unexpected error messages from being printed to standard output.
This subroutine is part of Base Operating System (BOS) Runtime.
The src_err_msg_r, srcsrqt_r, srcrrqs_r, srcstat_r, and srcstattxt_r subroutines.
List of SRC Subroutines in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.
Programming Subsystem Communication with the SRC in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.
System Resource Controller (SRC) Overview for Programmers in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.