home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $RCSfile: sysmon.h,v $
- ** $Filename: sysmon.h $
- ** $Revision: 0.6 $
- ** $Date: 1995/11/04 14:08:55 $
- **
- ** sysmon.library C header file (version 0.6)
- **
- ** (C) Copyright 1995 by Etienne Vogt
- */
-
- #ifndef LIBRARIES_SYSMON_H
- #define LIBRARIES_SYSMON_H
-
- #ifndef EXEC_TYPES_H
- #include <exec/types.h>
- #endif
-
- #ifndef EXEC_LIBRARIES_H
- #include <exec/libraries.h>
- #endif
-
- #ifndef DEVICES_TIMER_H
- #include <devices/timer.h>
- #endif
-
- #ifndef DOS_DATETIME_H
- #include <dos/datetime.h>
- #endif
-
- /* Library data structure
- ** All field in the SysmonBase structure are PRIVATE !!!
- ** Don't access these directly as they will change in future versions.
- ** You have been warned !!!
- */
-
- #define HASHSIZE 32
- #define HASHMASK 0xf8
-
- struct SysmonBase
- { struct Library sb_Lib; /* Standard lib node */
- UBYTE sb_Flags; /* Some flags here */
- UBYTE sb_pad; /* We are now longword aligned */
- struct ExecBase *sb_ExecBase; /* Pointer to exec */
- struct Library *sb_UtilityBase; /* Pointer to utility */
- BPTR sb_SegList; /* SegList BCPL pointer */
- struct TaskInfo *sb_CurrTaskInfo; /* Current TaskInfo Structure */
- APTR sb_Switch; /* Original Switch() entry point */
- APTR sb_Dispatch; /* Original Dispatch() entry point */
- APTR sb_AddTask; /* Original AddTask() entry point */
- APTR sb_RemTask; /* Original RemTask() entry point */
- APTR sb_TaskExit; /* Original ExecBase->TaskExitCode */
- struct timerequest sb_TimeReq; /* Time Request */
- struct EClockVal sb_TempTime; /* Temporary EClock Time */
- struct List sb_TaskFrozen; /* Frozen task list */
- UWORD sb_Reserved0; /* For longword alignment */
- struct TaskInfo *sb_TaskInfoHash[HASHSIZE]; /* TaskInfo hash table */
- APTR sb_FindTask; /* Original FindTask() entry point */
- APTR sb_ServerEntry; /* Server process entry point */
- STRPTR sb_ServerName; /* Server process name */
- STRPTR sb_SyslogFile; /* SysLog file name */
- STRPTR sb_SyslogWindow; /* Syslog Window Name */
- UBYTE sb_FilePri; /* File logging priority */
- UBYTE sb_WindowPri; /* Window logging priority */
- UBYTE sb_ConsolePri; /* Console logging priority */
- UBYTE sb_NumLogBuffers; /* Number of allocated Buffers */
- struct SysLogMsg *sb_Buffers; /* Pointer to allocated buffers */
- struct Library *sb_DOSBase; /* Pointer to dos */
- struct DateTime *sb_DateTime; /* SysLog DateTime structure */
- ULONG sb_StampPeriod; /* Period for syslog file stamp */
- BPTR sb_LogWindowHandle; /* LogWindow file handle */
- struct Library *sb_IntuitionBase; /* Pointer to intuition */
- ULONG sb_LastGuru; /* Guru Meditation code after crash */
- struct MsgPort *sb_SyslogPort; /* Pointer to Syslog MsgPort */
- };
-
- /* The TaskInfo structure contains the CPU usage information in EClock ticks.
- ** The link pointers are private and should not be used. Use the smNextTaskInfo()
- ** function to traverse the list.
- ** This structure may be extended later with new fields.
- */
-
- struct TaskInfo
- { struct TaskInfo *ti_Link; /* PRIVATE pointer to next TaskInfo */
- struct TaskInfo *ti_Pred; /* PRIVATE pointer to previous TaskInfo */
- struct Task *ti_Task; /* pointer to Task Control Block */
- ULONG ti_DispCount; /* Task Dispatch counter */
- struct EClockVal ti_StartTime; /* Starting EClock Time */
- struct EClockVal ti_LaunchTime; /* Last Launch Time */
- struct EClockVal ti_CPUTime; /* Cumulated CPU Time */
- };
-
- /* This is the private structure used by smVSysLog() to communicate with the
- ** Sysmon.server process.
- */
-
- #define SM_MAXLOGCHARS 256 /* Max bytes in SysLog message */
-
- struct SysLogMsg
- { struct Message slm_MsgHead; /* Message header */
- ULONG slm_Priority; /* SysLog priority and flags */
- UBYTE slm_Text[SM_MAXLOGCHARS]; /* Syslog Message body */
- };
-
- #define SYSMONNAME "sysmon.library"
- #define SERVERNAME "Sysmon.server"
-
- /* Definition of sb_Flags bits */
-
- #define SBFB_FPU 0 /* System has a FPU */
- #define SBFF_FPU (1L << 0)
- #define SBFB_IDLELED 1 /* Dim power LED when CPU is idle */
- #define SBFF_IDLELED (1L << 1)
-
- /* Alert Definitions
- ** These are the Guru codes that sysmon.library can spit out in a panic
- ** condition.
- */
-
- #define AN_Sysmon 0x40000000 /* SubSystem ID */
- #define AN_smNoTaskInfo 0xC0000001 /* No TaskInfo at Dispatch() time */
- #define AN_smNoTIMem 0x40010002 /* No mem for TaskInfo at startup */
- #define AN_smSysLogBuf 0x40010003 /* No memory for syslog buffers */
- #define AN_BadSysLogMsg 0x40000004 /* Bad SysLogMsg received by server */
- #define AO_Sysmon 0x00008040 /* Alert object */
-
- /* New Task States Definitions
- ** TS_STOP is not a real state. It is used by ShowSys to identify tasks that
- ** are stuck in a Wait(0) call, such as crashed tasks that have been suspended.
- */
-
- #define TS_FROZENW 0x80 /* Frozen task previously in WAIT state */
- #define TS_STOP TS_FROZENW /* Stopped task (Wait(0L)) */
- #define TS_FROZEN 0x81 /* Frozen task */
-
- /* SysLog Priorities and flags
- ** The priorities are similar to that used on UNIX systems. This means that
- ** the values use the UNIX ordering that is reversed from the Amiga one.
- ** The flags are Amiga and sysmon specifics.
- */
-
- #define LOG_EMERG 0 /* Panic condition (Guru time) */
- #define LOG_ALERT 1 /* Very serious problem */
- #define LOG_CRIT 2 /* Critical error */
- #define LOG_ERR 3 /* General error condition */
- #define LOG_WARN 4 /* Warning condition */
- #define LOG_NOTICE 5 /* Noticeable event */
- #define LOG_INFO 6 /* General informational event */
- #define LOG_DEBUG 7 /* Debugging information */
- #define LOG_PRI 0x07 /* Mask for priority field */
-
- #define LOG_INUSE 0x80000000 /* Message is in use (private !) */
- #define LOG_NOHEAD 0x40000000 /* Don't prepend header */
- #define LOG_NOWIN 0x20000000 /* Don't output to window */
- #define LOG_NOFILE 0x10000000 /* Don't output to file */
-
- #define LOGB_INUSE 31 /* Bit numbers for flags */
- #define LOGB_NOHEAD 30
- #define LOGB_NOWIN 29
- #define LOGB_NOFILE 28
-
- /* Flags definitions for smHalt() */
-
- #define HALTB_REBOOT 0 /* Reboot immediately */
- #define HALTF_REBOOT (1L << 0)
- #define HALTB_REKICK 1 /* Reload kickstart on MMU-Kicked systems. */
- #define HALTF_REKICK (1L << 1)
-
- #endif /* LIBRARIES_SYSMON_H */
-