AFS-Monitor
view release on metacpan or search on metacpan
src/Monitor.xs view on Meta::CPAN
}
hv_store(RETVAL, "interfaceAddr", 13, newRV_inc((SV*)ADDRESSES), 0);
}
hv_store(RETVAL, "host", 4, newSVpv(inet_ntoa(inhostAddr), 0), 0);
hv_store(RETVAL, "now", 3, newSViv(udebug.now), 0);
/* UBIK skips the voting if 1 server - so we fudge it here */
if ( udebug.amSyncSite && (udebug.nServers == 1) ) {
udebug.lastYesHost = hostAddr;
udebug.lastYesTime = udebug.now;
udebug.lastYesState = 1;
udebug.lastYesClaim = udebug.now;
udebug.syncVersion.epoch = udebug.localVersion.epoch;
udebug.syncVersion.counter = udebug.localVersion.counter;
}
/* sockaddr is always in net-order */
if ( udebug.lastYesHost != 0xffffffff ) {
inhostAddr.s_addr = htonl(udebug.lastYesHost);
hv_store(RETVAL, "lastYesHost", 11, newSVpv(inet_ntoa(inhostAddr), 0), 0);
hv_store(RETVAL, "lastYesTime", 11, newSViv(udebug.lastYesTime), 0);
hv_store(RETVAL, "lastYesState", 12, newSViv(udebug.lastYesState), 0);
hv_store(RETVAL, "lastYesClaim", 12, newSViv(udebug.lastYesClaim), 0);
}
LOCALVERSION = newHV();
hv_store(LOCALVERSION, "epoch", 5, newSViv(udebug.localVersion.epoch), 0);
hv_store(LOCALVERSION, "counter", 7, newSViv(udebug.localVersion.counter), 0);
hv_store(RETVAL, "localVersion", 12, newRV_inc((SV*)LOCALVERSION), 0);
hv_store(RETVAL, "amSyncSite", 10, newSViv(udebug.amSyncSite), 0);
hv_store(RETVAL, "epochTime", 9, newSViv(udebug.epochTime), 0);
if (udebug.amSyncSite) {
hv_store(RETVAL, "syncSiteUntil", 13, newSViv(udebug.syncSiteUntil), 0);
hv_store(RETVAL, "nServers", 8, newSViv(udebug.nServers), 0);
hv_store(RETVAL, "recoveryState", 13, newSViv(udebug.recoveryState), 0);
if (udebug.activeWrite) {
hv_store(RETVAL, "tidCounter", 10, newSViv(udebug.tidCounter), 0);
}
}
else {
hv_store(RETVAL, "isClone", 7, newSViv(isClone), 0);
inhostAddr.s_addr = htonl(udebug.lowestHost);
hv_store(RETVAL, "lowestHost", 10, newSVpv(inet_ntoa(inhostAddr), 0), 0);
hv_store(RETVAL, "lowestTime", 10, newSViv(udebug.lowestTime), 0);
inhostAddr.s_addr = htonl(udebug.syncHost);
hv_store(RETVAL, "syncHost", 8, newSVpv(inet_ntoa(inhostAddr), 0), 0);
hv_store(RETVAL, "syncTime", 8, newSViv(udebug.syncTime), 0);
}
SYNCVERSION = newHV();
hv_store(SYNCVERSION, "epoch", 5, newSViv(udebug.syncVersion.epoch), 0);
hv_store(SYNCVERSION, "counter", 7, newSViv(udebug.syncVersion.counter), 0);
hv_store(RETVAL, "syncVersion", 11, newRV_inc((SV*)SYNCVERSION), 0);
hv_store(RETVAL, "lockedPages", 11, newSViv(udebug.lockedPages), 0);
hv_store(RETVAL, "writeLockedPages", 16, newSViv(udebug.writeLockedPages), 0);
hv_store(RETVAL, "anyReadLocks", 12, newSViv(udebug.anyReadLocks), 0);
hv_store(RETVAL, "anyWriteLocks", 13, newSViv(udebug.anyWriteLocks), 0);
hv_store(RETVAL, "currentTrans", 12, newSViv(udebug.currentTrans), 0);
if (udebug.currentTrans) {
hv_store(RETVAL, "writeTrans", 10, newSViv(udebug.writeTrans), 0);
SYNCTID = newHV();
hv_store(SYNCTID, "epoch", 5, newSViv(udebug.syncTid.epoch), 0);
hv_store(SYNCTID, "counter", 7, newSViv(udebug.syncTid.counter), 0);
hv_store(RETVAL, "syncTid", 7, newRV_inc((SV*)SYNCTID), 0);
}
if (int32p || udebug.amSyncSite) {
/* now do the subcalls */
SERVERS = newAV();
for ( i=0; ; i++ ) {
#ifdef USE_VOTEXDEBUG
isClone = 0;
code = VOTE_XSDebug(tconn, i, &usdebug, &isClone);
if (code < 0) {
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);
}
#else
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);
( run in 0.662 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )