SystemMonitor Monitor certain critical c-tree Server events. Short Name SYSMON() Type Server only function Declaration COUNT SystemMonitor(COUNT mode, LONG timeout, pTEXT buffer, VRLEN buflen) Description SystemMonitor() provides the ability for a client to monitor certain critical c-tree Server events. Each event causes a message to be written to an internal queue. Each call to SystemMonitor() reads a message from this queue. If no message is available, it waits for a message or times out. mode can take on two values:
timeout specifies the time in seconds for a forced return of SystemMonitor() in the event that no event occurs. A value of -1L indicates an unlimited wait: SystemMonitor returns only when an event occurs or the Server stops. Note that the monitor is still in effect after a timeout return. For another process to start monitoring, the client currently monitoring must disconnect from the Server or call SystemMonitor() with the SYSMON_OFF mode. buffer points to the buffer which receives a descriptive Server monitor message. buflen is the length of the buffer. Return SystemMonitor() returns one of the following values. More events may be added in future releases.
When coding the “switch” or other constructs to handle the SystemMonitor() return codes, be sure to provide a default to handle return codes which may be added in future implementations. See “c-tree Plus Error Codes” in the c-tree Plus Programmer’s Reference Guide for a complete listing of valid c-tree Plus error values. Example VRLEN buflen=128; TEXT buffer[128]; /* input buffer */ LONG timeout = 10;
switch(uerr_cod){
case NSUP_ERR: printf("No monitor support\n");
StopUser(); exit(0); case NTIM_ERR: break; case PREA_ERR: case PWRT_ERR: case PSAV_ERR: printf("Primary file not operational (%d)\n%s\n", uerr_cod,buffer);
break; case CWRT_ERR: case CSAV_ERR: printf("Mirror file not operational (%d)\n%s\n", uerr_cod,buffer);
break; default: printf("other monitor event(%d)\n%s\n", uerr_cod, buffer);
break; } /* end of switch */ } /* end of while */
StopUser(); exit(0); Limitations Available only with the c-tree Server. A call to SystemMonitor() on a non-server system results in error return NSUP_ERR (454). Only one application connected to each Server may have SystemMonitor() active. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||