AFS-Monitor
view release on metacpan or search on metacpan
src/Monitor.xs view on Meta::CPAN
{
AV *RETVAL = va_arg(argp, AV *);
HV *HOSTINFO = newHV();
hv_store(HOSTINFO, "probeOK", 7, newSViv(xstat_cm_Results.probeOK ? 0 : 1),
0);
hv_store(HOSTINFO, "hostName", 8,
newSVpv(xstat_cm_Results.connP->hostName, 0), 0);
hv_store(HOSTINFO, "collectionNumber", 16,
newSViv(xstat_cm_Results.collectionNumber), 0);
hv_store(HOSTINFO, "probeTime", 9, newSViv(xstat_cm_Results.probeTime), 0);
if (xstat_cm_Results.probeOK == 0) {
switch (xstat_cm_Results.collectionNumber) {
/* Why are so many things commented out? -EC */
case AFSCB_XSTATSCOLL_CALL_INFO:
/* Why was this commented out in 3.3 ? */
/* PrintCallInfo(); */
my_print_cmCallStats(&xstat_cm_Results, HOSTINFO);
break;
case AFSCB_XSTATSCOLL_PERF_INFO:
/* we will do nothing here */
/* PrintPerfInfo(); */
my_cm_PrintPerfInfo(&xstat_cm_Results, HOSTINFO);
break;
case AFSCB_XSTATSCOLL_FULL_PERF_INFO:
my_cm_PrintFullPerfInfo(&xstat_cm_Results, HOSTINFO);
break;
default:
sprintf(buffer, "** Unknown collection: %d",
xstat_cm_Results.collectionNumber);
return (-1);
}
}
av_store(RETVAL, index, newRV_inc((SV *) HOSTINFO));
return (0);
}
/* end of xstat_cm_test helper functions */
MODULE = AFS::Monitor PACKAGE = AFS::Monitor PREFIX = afs_
PROTOTYPES: ENABLE
BOOT:
initialize_rxk_error_table();
void
afs_do_xstat_cm_test(args)
HV* args = (HV*) SvRV($arg);
PREINIT:
PPCODE:
{
SV *value;
I32 keylen = 0;
char *key;
int num_args = 0;
char buffer[256] = "";
AV *host_array=0;
AV *coll_array=0;
int code; /*Return code*/
int numCMs=0; /*# Cache Managers to monitor*/
int numCollIDs=0; /*# collections to fetch*/
int currCM; /*Loop index*/
int currCollIDIdx; /*Index of current collection ID*/
afs_int32 *collIDP; /*Ptr to array of collection IDs*/
afs_int32 *currCollIDP; /*Ptr to current collection ID*/
struct sockaddr_in *CMSktArray; /*Cache Manager socket array */
struct hostent *he; /*Host entry*/
AV *RETVAL = newAV();
/* parse arguments */
num_args = hv_iterinit(args);
while (num_args--) {
value = hv_iternextsv(args, &key, &keylen);
if(strncmp(key, "collID", keylen) == 0 && keylen <= 6) {
if (SvROK(value))
coll_array = (AV*) SvRV(value);
else {
coll_array = av_make(1, &value);
sv_2mortal((SV *) coll_array);
}
numCollIDs = av_len(coll_array) + 1;
}
else if(strncmp(key, "cmname", keylen) == 0 && keylen <= 6) {
if (SvROK(value))
host_array = (AV*) SvRV(value);
else {
host_array = av_make(1, &value);
sv_2mortal((SV *) host_array);
}
numCMs = av_len(host_array) + 1;
}
else {
sprintf(buffer, "Unrecognized flag: %s", key);
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
} /* end ifs */
} /* end while */
/* done parsing arguments */
if (host_array == 0) {
sprintf(buffer, "Missing required parameter 'cmname'");
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
else if (numCMs == 0) {
sprintf(buffer, "The field 'cmname' isn't completed properly");
src/Monitor.xs view on Meta::CPAN
XSRETURN_UNDEF;
}
else if (numCollIDs == 0) {
sprintf(buffer, "The field 'collID' isn't completed properly");
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
CMSktArray = (struct sockaddr_in *)
malloc(numCMs * sizeof(struct sockaddr_in));
if (CMSktArray == (struct sockaddr_in *) NULL) {
sprintf(buffer, "Can't allocate socket array for %d Cache Managers",
numCMs);
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
for (currCM = 0; currCM < numCMs; currCM++) {
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
CMSktArray[currCM].sin_family = AF_INET; /*Internet family */
#else
CMSktArray[currCM].sin_family = htons(AF_INET); /*Internet family */
#endif
CMSktArray[currCM].sin_port = htons(7001); /*Cache Manager port */
he = hostutil_GetHostByName((char *) SvPV(*av_fetch(host_array, currCM, 0), PL_na));
if (he == (struct hostent *) NULL) {
sprintf(buffer,
"Can't get host info for '%s'\n",
(char *) SvPV(*av_fetch(host_array, currCM, 0), PL_na));
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
memcpy(&(CMSktArray[currCM].sin_addr.s_addr), he->h_addr, 4);
} /*Get socket info for each Cache Manager*/
collIDP = (afs_int32 *) malloc(numCollIDs * sizeof(afs_int32));
currCollIDP = collIDP;
for (currCollIDIdx = 0; currCollIDIdx < numCollIDs; currCollIDIdx++) {
*currCollIDP = (afs_int32) SvIV(*av_fetch(coll_array, currCollIDIdx, 0));
currCollIDP++;
}
code = my_xstat_cm_Init(my_xstat_CM_Handler, numCMs, CMSktArray,
numCollIDs, collIDP, buffer, RETVAL);
if(code) {
BSETCODE(code, buffer);
XSRETURN_UNDEF;
}
ST(0) = sv_2mortal(newRV_inc((SV*)RETVAL));
SETCODE(0);
XSRETURN(1);
}
void
afs_do_xstat_fs_test(args)
HV* args = (HV*) SvRV($arg);
PREINIT:
PPCODE:
{
SV *value;
I32 keylen = 0;
char *key;
int num_args = 0;
char buffer[256] = "";
AV *host_array=0;
AV *coll_array=0;
int code; /*Return code*/
int numFSs=0; /*# File Servers to monitor*/
int numCollIDs=0; /*# collections to fetch*/
int currFS; /*Loop index*/
int currCollIDIdx; /*Index of current collection ID*/
afs_int32 *collIDP; /*Ptr to array of collection IDs*/
afs_int32 *currCollIDP; /*Ptr to current collection ID*/
struct sockaddr_in *FSSktArray; /*File Server socket array */
int sktbytes;
struct hostent *he; /*Host entry*/
AV *RETVAL = newAV();
/* parse arguments */
num_args = hv_iterinit(args);
while (num_args--) {
value = hv_iternextsv(args, &key, &keylen);
switch (*key) {
case 'c':
if(strncmp(key, "collID", keylen) == 0 && keylen <= 6) {
if (SvROK(value))
coll_array = (AV*) SvRV(value);
else {
coll_array = av_make(1, &value);
sv_2mortal((SV *) coll_array);
}
numCollIDs = av_len(coll_array) + 1;
} else goto unrecognized;
break;
case 'f':
if(strncmp(key, "fsname", keylen) == 0 && keylen <= 6) {
if (SvROK(value))
host_array = (AV*) SvRV(value);
else {
host_array = av_make(1, &value);
sv_2mortal((SV *) host_array);
}
numFSs = av_len(host_array) + 1;
} else goto unrecognized;
break;
default:
unrecognized:
sprintf(buffer, "Unrecognized flag: %s", key);
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
break;
src/Monitor.xs view on Meta::CPAN
}
sktbytes = numFSs * sizeof(struct sockaddr_in);
FSSktArray = (struct sockaddr_in *) malloc(sktbytes);
if (FSSktArray == (struct sockaddr_in *) NULL) {
sprintf(buffer,
"Can't malloc() %d sockaddrs (%d bytes) for the given file servers",
numFSs, sktbytes);
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
memset(FSSktArray, 0, sktbytes);
/*
* Fill in the socket array for each of the File Servers listed.
*/
for (currFS = 0; currFS < numFSs; currFS++) {
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
FSSktArray[currFS].sin_family = AF_INET; /*Internet family */
#else
FSSktArray[currFS].sin_family = htons(AF_INET); /*Internet family */
#endif
FSSktArray[currFS].sin_port = htons(7000); /*FileServer port*/
he = hostutil_GetHostByName((char *) SvPV(*av_fetch(host_array, currFS, 0), PL_na));
if (he == (struct hostent *) NULL) {
sprintf(buffer,
"Can't get host info for '%s'",
(char *) SvPV(*av_fetch(host_array, currFS, 0), PL_na));
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
memcpy(&(FSSktArray[currFS].sin_addr.s_addr), he->h_addr, 4);
} /*Get socket info for each File Server*/
collIDP = (afs_int32 *) malloc(numCollIDs * sizeof(afs_int32));
currCollIDP = collIDP;
for (currCollIDIdx = 0; currCollIDIdx < numCollIDs; currCollIDIdx++) {
*currCollIDP = (afs_int32) SvIV(*av_fetch(coll_array, currCollIDIdx, 0));
currCollIDP++;
}
code = my_xstat_fs_Init(my_xstat_FS_Handler, numFSs, FSSktArray,
numCollIDs, collIDP, buffer, RETVAL);
if(code) {
BSETCODE(code, buffer);
XSRETURN_UNDEF;
}
ST(0) = sv_2mortal(newRV_inc((SV*)RETVAL));
SETCODE(0);
XSRETURN(1);
}
void
afs_do_scout(args)
HV* args = (HV*) SvRV($arg);
PREINIT:
PPCODE:
{
static char rn[] = "afs_do_scout";
SV *value;
I32 keylen = 0;
char *key;
int num_args = 0;
char buffer[256] = "";
struct fsprobe_ProbeResults fsprobe_Results;
struct fsprobe_ConnectionInfo *fsprobe_ConnInfo; /*Ptr to connection array*/
char buff2[256] = "";
char basename[64] = "";
int numservers = 0;
char fullsrvname[128] = "";
struct sockaddr_in *FSSktArray;
struct sockaddr_in *curr_skt;
struct hostent *he;
int i, code;
int sktbytes;
FILE *scout_debugfd = (FILE *) NULL;
char *debug_filename = (char *) NULL;
AV *host_array = (AV *) NULL;
AV *RETVAL = newAV();
/* parse arguments */
num_args = hv_iterinit(args);
while (num_args--) {
value = hv_iternextsv(args, &key, &keylen);
switch (*key) {
case 'b':
if(strncmp(key, "basename", keylen) == 0 && keylen <= 8) {
sprintf(basename, "%s", SvPV(value, PL_na));
} else goto unrecognized;
break;
case 'd':
if(strncmp(key, "debug", keylen) == 0 && keylen <= 5) {
debug_filename = (char *) SvPV(value, PL_na);
} else goto unrecognized;
break;
case 's':
if(strncmp(key, "servers", keylen) == 0 && keylen <= 7) {
if (SvROK(value))
host_array = (AV*) SvRV(value);
else {
host_array = av_make(1, &value);
sv_2mortal((SV *) host_array);
}
numservers = av_len(host_array) + 1;
} else goto unrecognized;
break;
default:
unrecognized:
src/Monitor.xs view on Meta::CPAN
else
sprintf(fullsrvname, "%s.%s", (char *) SvPV(*av_fetch(host_array, i, 0), PL_na), basename);
he = hostutil_GetHostByName(fullsrvname);
if(he == (struct hostent *) NULL) {
sprintf(buffer, "Can't get host info for '%s'", fullsrvname);
BSETCODE(-1, buffer);
if (scout_debugfd != (FILE *) NULL) {
fprintf(scout_debugfd, "[%s] Closing debugging file\n", rn);
fclose(scout_debugfd);
}
XSRETURN_UNDEF;
}
memcpy(&(curr_skt->sin_addr.s_addr), he->h_addr, 4);
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
curr_skt->sin_family = AF_INET; /*Internet family */
#else
curr_skt->sin_family = htons(AF_INET); /*Internet family */
#endif
curr_skt->sin_port = htons(7000); /* FileServer port */
curr_skt++;
}
code = my_fsprobe_Init(&fsprobe_Results, &fsprobe_ConnInfo, numservers,
FSSktArray, RETVAL, scout_debugfd, buffer);
if(code) {
if(buffer == "") {
sprintf(buffer, "Error returned by fsprobe_Init: %d", code);
}
BSETCODE(code, buffer);
if (scout_debugfd != (FILE *) NULL) {
fprintf(scout_debugfd, "[%s] Closing debugging file\n", rn);
fclose(scout_debugfd);
}
XSRETURN_UNDEF;
}
code = my_FS_Handler(fsprobe_Results, numservers, fsprobe_ConnInfo,
scout_debugfd, RETVAL, buff2);
if (code) {
sprintf(buffer, "[%s] Handler routine returned error code %d. %s", rn, code, buff2);
BSETCODE(code, buffer);
if (scout_debugfd != (FILE *) NULL) {
fprintf(scout_debugfd, "[%s] Closing debugging file\n", rn);
fclose(scout_debugfd);
}
XSRETURN_UNDEF;
}
if (scout_debugfd != (FILE *) NULL) {
fprintf(scout_debugfd, "[%s] Closing debugging file\n", rn);
fclose(scout_debugfd);
}
ST(0) = sv_2mortal(newRV_inc((SV*)RETVAL));
SETCODE(0);
XSRETURN(1);
}
void
afs_do_udebug(args)
HV* args = (HV*) SvRV($arg);
PREINIT:
PPCODE:
{
SV *value;
I32 keylen = 0;
char *key;
int num_args = 0;
char buffer[256] = "";
char *hostName = (char *) NULL;
char *portName = (char *) NULL;
afs_int32 hostAddr;
struct in_addr inhostAddr;
register afs_int32 i, j, code;
short port;
int int32p = 0;
struct hostent *th;
struct rx_connection *tconn;
struct rx_securityClass *sc;
struct ubik_debug udebug;
struct ubik_sdebug usdebug;
int oldServer = 0; /* are we talking to a pre 3.5 server? */
afs_int32 isClone = 0;
HV *RETVAL = newHV();
AV *ADDRESSES;
HV *LOCALVERSION;
HV *SYNCVERSION;
HV *SYNCTID;
AV *SERVERS;
HV *USDEBUG;
AV *ALTADDR;
HV *REMOTEVERSION;
/* parse arguments */
num_args = hv_iterinit(args);
while (num_args--) {
value = hv_iternextsv(args, &key, &keylen);
switch (*key) {
case 'l':
if(strncmp(key, "long", keylen) == 0 && keylen <= 4) {
int32p = (int) SvIV(value);
} else goto unrecognized;
break;
case 'p':
if(strncmp(key, "port", keylen) == 0 && keylen <= 4) {
portName = (char *) SvPV(value, PL_na);
} else goto unrecognized;
break;
case 's':
if(strncmp(key, "server", keylen) == 0 && keylen <= 6) {
hostName = (char *) SvPV(value, PL_na);
} else goto unrecognized;
break;
default:
src/Monitor.xs view on Meta::CPAN
if ( oldServer ) { /* pre 3.5 server */
ubik_sdebug * ptr = &usdebug;
memset(&usdebug, 0, sizeof(usdebug));
code = VOTE_SDebugOld(tconn, i, (struct ubik_sdebug_old *) ptr);
}
else
code = VOTE_SDebug(tconn, i, &usdebug);
#endif
if (code > 0)
break; /* done */
if (code < 0) {
warn("error code %d from VOTE_SDebug\n", code);
break;
}
/* otherwise print the structure */
USDEBUG = newHV();
inhostAddr.s_addr = htonl(usdebug.addr);
hv_store(USDEBUG, "addr", 4, newSVpv(afs_inet_ntoa(htonl(usdebug.addr)), 0), 0);
ALTADDR = newAV();
for ( j=0;((usdebug.altAddr[j]) && (j<UBIK_MAX_INTERFACE_ADDR-1)); j++) {
av_store(ALTADDR, j, newSVpv(afs_inet_ntoa(htonl(usdebug.altAddr[j])), 0));
}
if (j) hv_store(USDEBUG, "altAddr", 7, newRV_inc((SV*)ALTADDR), 0);
REMOTEVERSION = newHV();
hv_store(REMOTEVERSION, "epoch", 5, newSViv(usdebug.remoteVersion.epoch), 0);
hv_store(REMOTEVERSION, "counter", 7, newSViv(usdebug.remoteVersion.counter), 0);
hv_store(USDEBUG, "remoteVersion", 13, newRV_inc((SV*)REMOTEVERSION), 0);
hv_store(USDEBUG, "isClone", 7, newSViv(isClone), 0);
hv_store(USDEBUG, "lastVoteTime", 12, newSViv(usdebug.lastVoteTime), 0);
hv_store(USDEBUG, "lastBeaconSent", 14, newSViv(usdebug.lastBeaconSent), 0);
hv_store(USDEBUG, "lastVote", 8, newSViv(usdebug.lastVote), 0);
hv_store(USDEBUG, "currentDB", 9, newSViv(usdebug.currentDB), 0);
hv_store(USDEBUG, "up", 2, newSViv(usdebug.up), 0);
hv_store(USDEBUG, "beaconSinceDown", 15, newSViv(usdebug.beaconSinceDown), 0);
av_store(SERVERS, i, newRV_inc((SV*)USDEBUG));
}
hv_store(RETVAL, "servers", 7, newRV_inc((SV*)SERVERS), 0);
}
/* return RETVAL */
ST(0) = sv_2mortal(newRV_inc((SV*)RETVAL));
SETCODE(0);
XSRETURN(1);
}
void
afs_do_cmdebug(args)
HV* args = (HV*) SvRV($arg);
PREINIT:
PPCODE:
{
SV *value;
I32 keylen = 0;
char *key;
int num_args = 0;
int code = 0;
int aint32 = 0;
struct rx_connection *conn;
register char *hostName = "";
register struct hostent *thp;
struct rx_securityClass *secobj;
afs_int32 addr = 0;
afs_int32 port = 7001;
char buffer[256] = "";
AV *LOCKS = newAV(); /* return */
AV *CACHE_ENTRIES = newAV(); /* values */
/* parse arguments */
num_args = hv_iterinit(args);
while (num_args--) {
value = hv_iternextsv(args, &key, &keylen);
switch (*key) {
case 'l':
if(strncmp(key, "long", keylen) == 0 && keylen <= 4) {
aint32 = (int) SvIV(value);
} else goto unrecognized;
break;
case 'p':
if(strncmp(key, "port", keylen) == 0 && keylen <= 4) {
port = (int) SvIV(value);
} else goto unrecognized;
break;
case 's':
if(strncmp(key, "servers", keylen) == 0 && keylen <= 7) {
hostName = (char *) SvPV(value, PL_na);
} else goto unrecognized;
break;
default:
unrecognized:
sprintf(buffer, "Unrecognized flag: %s", key);
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
break;
} /* end switch */
} /* end while */
/* done parsing arguments */
rx_Init(0);
thp = hostutil_GetHostByName(hostName);
if (!thp) {
sprintf(buffer, "can't resolve address for host %s", hostName);
BSETCODE(1, buffer);
XSRETURN_UNDEF;
}
memcpy(&addr, thp->h_addr, sizeof(afs_int32));
secobj = rxnull_NewServerSecurityObject();
conn = rx_NewConnection(addr, htons(port), 1, secobj, 0);
if (!conn) {
sprintf(buffer, "failed to create connection for host %s", hostName);
BSETCODE(1, buffer);
XSRETURN_UNDEF;
}
code = my_PrintLocks(conn, aint32, LOCKS, buffer);
if(code) {
BSETCODE(code, buffer);
XSRETURN_UNDEF;
}
code = my_PrintCacheEntries(conn, aint32, CACHE_ENTRIES, buffer);
if(code) {
BSETCODE(code, buffer);
XSRETURN_UNDEF;
}
SETCODE(0);
EXTEND(SP, 2);
PUSHs(sv_2mortal(newRV_inc((SV*)LOCKS)));
PUSHs(sv_2mortal(newRV_inc((SV*)CACHE_ENTRIES)));
}
void
afs_do_afsmonitor(args)
HV* args = (HV*) SvRV($arg);
PREINIT:
PPCODE:
{
I32 keylen = 0;
char* key = 0;
SV* value = 0;
char* host = 0;
AV* host_array = 0;
AV* show_array = 0;
AV* fsthresh_array = 0;
AV* cmthresh_array = 0;
HV* thresh_entry = 0;
int global_fsThreshCount = 0;
int global_cmThreshCount = 0;
int found = 0;
int numBytes = 0;
char* thresh_name = "";
char* thresh_value = 0;
char* thresh_host = "";
char* thresh_handler = "";
int num_args = 0;
int detailed = 0;
char* config_filename = 0;
char* output_filename = 0;
FILE *outputFD = 0;
struct afsmon_hostEntry *temp_host = 0;
int numFS = 0;
int numCM = 0;
struct afsmon_hostEntry *last_hostEntry = 0;
int lastHostType = 0;
short fs_showFlags[NUM_FS_STAT_ENTRIES];
short cm_showFlags[NUM_CM_STAT_ENTRIES];
int fs_showDefault = 1;
int cm_showDefault = 1;
int num = 0;
int i = 0;
int j = 0;
int code = 0;
char buffer[256] = "";
char buff2[256] = "";
/* from afsmon_execute() */
static char fullhostname[128] = ""; /* full host name */
struct sockaddr_in *FSSktArray = 0; /* fs socket array */
int FSsktbytes = 0; /* num bytes in above */
struct sockaddr_in *CMSktArray = 0; /* cm socket array */
int CMsktbytes = 0; /* num bytes in above */
struct sockaddr_in *curr_skt = 0; /* ptr to current socket*/
struct afsmon_hostEntry *curr_FS = 0; /* ptr to FS name list */
struct afsmon_hostEntry *curr_CM = 0; /* ptr to CM name list */
struct hostent *he = 0; /* host entry */
afs_int32 *collIDP = 0; /* ptr to collection ID */
int numCollIDs = 0; /* number of collection IDs */
/* end of from afsmon_execute() */
AV* FILESERV = newAV(); /* File Servers */
AV* CACHEMAN = newAV(); /* Cache Managers */
struct afsmon_hostEntry *FSnameList=0;
struct afsmon_hostEntry *CMnameList=0;
src/Monitor.xs view on Meta::CPAN
curr_CM = CMnameList; /* CM name list header */
while (curr_CM) {
strncpy(fullhostname,curr_CM->hostName,sizeof(fullhostname));
he = GetHostByName(fullhostname);
if (he == (struct hostent *) NULL) {
sprintf(buffer,"Cannot get host info for %s", fullhostname);
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
strncpy(curr_CM->hostName,he->h_name,HOST_NAME_LEN); /* complete name*/
memcpy(&(curr_skt->sin_addr.s_addr), he->h_addr, 4);
curr_skt->sin_family = htons(AF_INET); /*Internet family*/
curr_skt->sin_port = htons(7001); /*Cache Manager port */
#ifdef STRUCT_SOCKADDR_HAS_SA_LEN
curr_skt->sin_len = sizeof(struct sockaddr_in);
#endif
/* get the next dude */
curr_skt++;
curr_CM = curr_CM->next;
}
/* initialize collection IDs. We need only one entry since we collect
all the information from xstat */
numCollIDs = 1;
collIDP = (afs_int32 *) malloc (sizeof (afs_int32));
if (collIDP == (afs_int32 *) NULL) {
sprintf(buffer,"failed to allocate a measely afs_int32 word. Argh!");
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
*collIDP = 2; /* USE A macro for this */
code = my_xstat_cm_Init(my_afsmon_CM_Handler, numCM, CMSktArray, numCollIDs,
collIDP, buff2, output_filename, detailed, CACHEMAN,
CMnameList, cm_showFlags, cm_showDefault);
if (code) {
sprintf(buffer,"my_xstat_cm_Init() returned error. %s", buff2);
BSETCODE(130, buffer);
XSRETURN_UNDEF;
}
} /* end of process fileserver entries */
/* end from afsmon_execute() */
SETCODE(0);
EXTEND(SP, 2);
PUSHs(sv_2mortal(newRV_inc((SV*)FILESERV)));
PUSHs(sv_2mortal(newRV_inc((SV*)CACHEMAN)));
}
void
afs_do_rxdebug(args)
HV* args = (HV*) SvRV($arg);
PREINIT:
PPCODE:
{
int size;
I32 keylen;
char *key;
HE* entry;
SV* value;
HV* RETVAL = newHV(); /* return value */
HV* TSTATS;
HV* RXSTATS;
AV* CONNECTIONS;
HV* TCONN;
AV* CALLSTATE;
AV* CALLMODE;
AV* CALLFLAGS;
AV* CALLOTHER;
AV* CALLNUMBER;
AV* PEERS;
HV* TPEER;
HV* BYTESSENT;
HV* BYTESRECEIVED;
HV* TIMEOUT;
int index;
register int i;
int s;
int j;
struct sockaddr_in taddr;
afs_int32 host;
struct in_addr hostAddr;
short port;
struct hostent *th;
register afs_int32 code;
int nodally=0;
int allconns=0;
int rxstats=0;
int onlyClient=0;
int onlyServer=0;
afs_int32 onlyHost = -1;
short onlyPort = -1;
int onlyAuth = 999;
int flag;
int dallyCounter;
int withSecStats;
int withAllConn;
int withRxStats;
int withWaiters;
int withIdleThreads;
int withPeers;
struct rx_debugStats tstats;
char *portName = (char *) NULL;
char *hostName = (char *) NULL;
struct rx_debugConn tconn;
short noConns=0;
short showPeers=0;
short showLong=0;
int version_flag=0;
afs_int32 length=64;
char version[64];
char buffer[240]; /* for error messages */
src/Monitor.xs view on Meta::CPAN
hv_store(TPEER, "maxMTU", 6, newSViv(tpeer.maxMTU), 0);
hv_store(TPEER, "nSent", 5, newSViv(tpeer.nSent), 0);
hv_store(TPEER, "reSends", 7, newSViv(tpeer.reSends), 0);
BYTESSENT = newHV();
hv_store(BYTESSENT, "high", 4, newSViv(tpeer.bytesSent.high), 0);
hv_store(BYTESSENT, "low", 3, newSViv(tpeer.bytesSent.low), 0);
hv_store(TPEER, "bytesSent", 9, newRV_inc((SV*)(BYTESSENT)), 0);
BYTESRECEIVED = newHV();
hv_store(BYTESRECEIVED, "high", 4, newSViv(tpeer.bytesReceived.high), 0);
hv_store(BYTESRECEIVED, "low", 3, newSViv(tpeer.bytesReceived.low), 0);
hv_store(TPEER, "bytesReceived", 13, newRV_inc((SV*)(BYTESRECEIVED)), 0);
hv_store(TPEER, "rtt", 3, newSViv(tpeer.rtt), 0);
hv_store(TPEER, "rtt_dev", 7, newSViv(tpeer.rtt_dev), 0);
TIMEOUT = newHV();
hv_store(TIMEOUT, "sec", 3, newSViv(tpeer.timeout.sec), 0);
hv_store(TIMEOUT, "usec", 4, newSViv(tpeer.timeout.usec), 0);
hv_store(TPEER, "timeout", 7, newRV_inc((SV*)(TIMEOUT)), 0);
if (showLong) {
hv_store(TPEER, "inPacketSkew", 12,
newSViv(tpeer.inPacketSkew), 0);
hv_store(TPEER, "outPacketSkew", 13,
newSViv(tpeer.outPacketSkew), 0);
hv_store(TPEER, "cwind", 5,
newSViv(tpeer.cwind), 0);
hv_store(TPEER, "MTU", 3,
newSViv(tpeer.MTU), 0);
hv_store(TPEER, "nDgramPackets", 13,
newSViv(tpeer.nDgramPackets), 0);
hv_store(TPEER, "ifDgramPackets", 14,
newSViv(tpeer.ifDgramPackets), 0);
hv_store(TPEER, "maxDgramPackets", 15,
newSViv(tpeer.maxDgramPackets), 0);
}
av_store(PEERS, index, newRV_inc((SV*)(TPEER)));
index++;
}
hv_store(RETVAL, "peers", 5, newRV_inc((SV*)(PEERS)), 0);
}
done:
/* return RETVAL */
ST(0) = sv_2mortal(newRV_inc((SV*)RETVAL));
SETCODE(0);
XSRETURN(1);
}
void
afs_error_message(code)
int32 code
PPCODE:
{
ST(0) = sv_newmortal();
sv_setpv(ST(0), (char *) error_message(code));
XSRETURN(1);
}
/* this function is generated automatically by constant_gen */
/* You didn't think I would type in this crap did you? */
/* thats what perl is for :-) */
void
constant(name, arg=0)
char * name
int arg
PPCODE:
{
ST(0) = sv_newmortal();
errno = EINVAL;
switch (name[0]) {
case 'A':
switch (name[1]) {
case 'F':
switch (name[2]) {
case 'S':
if (strEQ(name,"AFSCB_MAX_XSTAT_LONGS"))
sv_setiv(ST(0),AFSCB_MAX_XSTAT_LONGS);
else if (strEQ(name,"AFSCB_XSTATSCOLL_CALL_INFO"))
sv_setiv(ST(0),AFSCB_XSTATSCOLL_CALL_INFO);
else if (strEQ(name,"AFSCB_XSTATSCOLL_FULL_PERF_INFO"))
sv_setiv(ST(0),AFSCB_XSTATSCOLL_FULL_PERF_INFO);
else if (strEQ(name,"AFSCB_XSTATSCOLL_PERF_INFO"))
sv_setiv(ST(0),AFSCB_XSTATSCOLL_PERF_INFO);
else if (strEQ(name,"AFSCB_XSTAT_VERSION"))
sv_setiv(ST(0),AFSCB_XSTAT_VERSION);
else if (strEQ(name,"AFSCONF_VOLUMEPORT"))
sv_setiv(ST(0),AFSCONF_VOLUMEPORT);
else if (strEQ(name,"AFS_MAX_XSTAT_LONGS"))
sv_setiv(ST(0),AFS_MAX_XSTAT_LONGS);
else if (strEQ(name,"AFS_STATS_NUM_CM_RPC_OPS"))
sv_setiv(ST(0),AFS_STATS_NUM_CM_RPC_OPS);
else if (strEQ(name,"AFS_STATS_NUM_FS_RPC_OPS"))
sv_setiv(ST(0),AFS_STATS_NUM_FS_RPC_OPS);
else if (strEQ(name,"AFS_STATS_NUM_FS_XFER_OPS"))
sv_setiv(ST(0),AFS_STATS_NUM_FS_XFER_OPS);
else if (strEQ(name,"AFS_XSTATSCOLL_CALL_INFO"))
sv_setiv(ST(0),AFS_XSTATSCOLL_CALL_INFO);
#ifndef NOAFS_XSTATSCOLL_CBSTATS
else if (strEQ(name,"AFS_XSTATSCOLL_CBSTATS"))
sv_setiv(ST(0),AFS_XSTATSCOLL_CBSTATS);
#endif
else if (strEQ(name,"AFS_XSTATSCOLL_FULL_PERF_INFO"))
sv_setiv(ST(0),AFS_XSTATSCOLL_FULL_PERF_INFO);
else if (strEQ(name,"AFS_XSTATSCOLL_PERF_INFO"))
sv_setiv(ST(0),AFS_XSTATSCOLL_PERF_INFO);
else if (strEQ(name,"AFS_XSTAT_VERSION"))
sv_setiv(ST(0),AFS_XSTAT_VERSION);
else {
ST(0) = ST(1) = &PL_sv_undef;
return;
}
break;
case '_':
if (strEQ(name,"AF_INET")) sv_setiv(ST(0),AF_INET);
else {
ST(0) = ST(1) = &PL_sv_undef;
return;
}
break;
default:
ST(0) = ST(1) = &PL_sv_undef;
return;
}
break;
( run in 1.208 second using v1.01-cache-2.11-cpan-71847e10f99 )