home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
AACD
/
System
/
Sysmon
/
autodocs
/
sysmon_lib.doc
Wrap
Text File
|
2000-08-01
|
32KB
|
1,010 lines
TABLE OF CONTENTS
sysmon.library/smAddBroadcastPort
sysmon.library/smAllowExcept
sysmon.library/smDisallowExcept
sysmon.library/smEndExcept
sysmon.library/smFindNode
sysmon.library/smFindTaskInfo
sysmon.library/smFreeze
sysmon.library/smGetTaskInfo
sysmon.library/smGetVBR
sysmon.library/smHalt
sysmon.library/smHibernate
sysmon.library/smLockTaskTable
sysmon.library/smNextTaskInfo
sysmon.library/smRemBroadcastPort
sysmon.library/smScheduleWakeUp
sysmon.library/smSendBroadcastMsg
sysmon.library/smSleep
sysmon.library/smUnFreeze
sysmon.library/smUnLockTaskTable
sysmon.library/smVKPrintf
sysmon.library/smVSnPrintf
sysmon.library/smVSPrintf
sysmon.library/smVSysLog
sysmon.library/smWaitAnd
sysmon.library/smWakeUp
sysmon.library/smAddBroadcastPort sysmon.library/smAddBroadcastPort
NAME
smAddBroadcastPort -- Add a Port to receive Broadcast Messages (V1)
SYNOPSIS
smAddBroadcastPort( port )
A1
void smAddBroadcastPort(struct MsgPort *port);
FUNCTION
This function registers a message port for reception of broadcast
messages send via smSendBroadcastMsg().
The Message port must be initialized and the ln_Pri and ln_Name fields
should be filled with appropriate values.
INPUTS
port - A pointer to a properly initialized message port structure.
RESULT
none.
NOTES
The Broadcast Messages are sent in turn to each client, so your
application must be ready to process them quickly. If you are
unable to retrieve the message in the time specified in the
bcm_TimeOut field, the smSendBroadcastMsg() function will remove it
transparently from your port and pass it to the next one (be prepared
for an empty port when you receive a signal !).
When you have retrieved the message, you MUST reply it as quickly
as possible (make a copy if necessary). In particular, NEVER EVER
wait for user interaction when holding the message. This is parti-
cularly true for a BCM_SHUTDOWN message with the BCMB_DOOMSDAY bit set
in the bcm_Flags field as the shutdown procedure must be able to
complete in the 10 seconds time allowed by the keyboard.device
When you receive a BCM_SHUTDOWN message with a zero bcm_CountDown, you
should smRemBroadcastPort() your port and exit.
BUGS
SEE ALSO
sysmon.library/smRemBroadcastPort(),
sysmon.library/smSendBroadcastMsg()
sysmon.library/smAllowExcept sysmon.library/smAllowExcept
NAME
smAllowExcept -- Restore exception processing. (V1)
SYNOPSIS
smAllowExcept()
void smAllowExcept( void );
FUNCTION
Allow signal exceptions to be delivered to the task after they have
been disabled by smDisallowExcept().
If an exception signal has been received while exceptions were
disabled, the exception will be delivered now. You must execute
exactly one call to smAllowExcept() for each call to
smDisallowExcept().
NOTES
This call is guaranteed to preserve all registers.
BUGS
SEE ALSO
sysmon.library/smDisallowExcept(), exec.library/Permit(),
exec.library/SetExcept().
sysmon.library/smDisallowExcept sysmon.library/smDisallowExcept
NAME
smDisallowExcept -- Prevents exception processing. (V1)
SYNOPSIS
smDisallowExcept()
void smDisallowExcept( void );
FUNCTION
Prevents signal exceptions from being delivered to the task until a
matching call to smAllowExcept() is made. An Exception received while
disallowed will be delivered when allowed again.
Task switches, interrupts and processor exceptions are not concerned.
This call is used to protect access to resources that are shared with
the exception code.
Calls to smDisallowExcept() nest. You must execute exactly one call to
smAllowExcept() for each call to smDisallowExcept().
WARNINGS
You can't arbitrate resources shared with exception code via
semaphore locking. You have to use this function (recommended),
Forbid() (which also prevents exception delivery) or SetExcept()
(turns off the exception signals manually).
The original exception mechanism in exec is quite broken, so it is
better to not use signal exceptions at all unless sysmon.library V1+
is installed.
NOTES
This call is guaranteed to preserve all registers.
BUGS
SEE ALSO
sysmon.library/smAllowExcept(), exec.library/Forbid(),
exec.library/SetExcept(), exec.library/ObtainSemaphore().
sysmon.library/smEndExcept sysmon.library/smEndExcept
NAME
smEndExcept -- End exception routine without returning to normal task
code. (V1)
SYNOPSIS
smEndExcept( cleanup )
D0
void smEndExcept( BOOL cleanup );
FUNCTION
This function allows to continue execution of the task exception code
as if it was normal code, allowing to terminate cleanly by calling the
compiler's exit() function.
It calls smDisallowExcept() to avoid entering the exception code
recursively, so before exiting, you must call smAllowExcept() after
deactivating the exception signals and restoring the initial
exception code.
INPUTS
cleanup - a boolean flag that, if set, will clean the user stack of
what was saved there by the exception processing code. This
must only be used from the main exception code, not from a
subroutine.
NOTES
This function is mainly intended to prepare for exit inside exception
code. If you want to continue running as normal code, you can call
this function with the cleanup flag set from main exception code, but
this is not recommended.
If this function is not called from exception code, it will not do
anything.
BUGS
SEE ALSO
ANSI-C exit(), dos.library/Exit(), sysmon.library/smDisallowExcept()
sysmon.library/smFindNode sysmon.library/smFindNode
NAME
smFindNode -- Check if a Node is part of a List. (V1)
SYNOPSIS
node = smFindNode( list, node )
D0 A0 A1
struct Node *smFindNode(struct List *list, struct Node *node);
FUNCTION
Check if a Node is linked in a List.
INPUTS
list - A pointer to a List structure
node - A pointer to the node you want to check for beeing part of
the list
RESULT
node - If the node is linked in the List, its address is returned
else the function returns NULL.
NOTES
No arbitration is done for access to the list! If multiple tasks
access the same list, an arbitration mechanism such as
SignalSemaphores must be used.
BUGS
SEE ALSO
exec.library/FindName()
sysmon.library/smFindTaskInfo sysmon.library/smFindTaskInfo
NAME
smFindTaskInfo -- Find TaskInfo structure by Task Name. (V0)
SYNOPSIS
tinfo = smFindTaskInfo( name )
D0 A1
struct TaskInfo *smFindTaskInfo( STRPTR name );
FUNCTION
This function will search the TaskInfo Hash Table for a task with the
given name, and return a pointer to its TaskInfo structure. If a NULL
name pointer is given, a pointer to the TaskInfo of the current task
will be returned.
INPUTS
name - pointer to a NULL terminated string.
RESULT
tinfo - A pointer to the corresponding TaskInfo structure or NULL
for an error (TaskInfo structure not found).
NOTES
Unlike the original exec.library/FindTask() function, this call does
not need to Disable() interrupts during search. It will call the
smLockTaskTable() function with read access under V1 or higher (under
V0, it used Forbid()).
exec.library/FindTask() is now rerouted through this function for
efficiency when sysmon.library is active.
Unnamed tasks (NULL ln_Name) can't be found by this function, but at
least, then won't cause Enforcer/muForce hits during search (V1).
BUGS
SEE ALSO
exec.library/FindTask(), sysmon.library/smGetTaskInfo(),
sysmon.library/smNextTaskInfo(), sysmon.library/smLockTaskTable(),
sysmon.library/smUnLockTaskTable().
sysmon.library/smFreeze sysmon.library/smFreeze
NAME
smFreeze -- Put a task out of schedule. (V0)
SYNOPSIS
success = smFreeze( task )
D0 A1
BOOL smFreeze( struct Task *task );
FUNCTION
Put a task into the TaskFrozen list. The task will no longer be
dispatched and exception signals will not be processed.
However, received signals are not lost; they will be processed
when the task comes out of the frozen state.
INPUTS
task - A pointer to a Task structure. If NULL, the current task
will be frozen.
Passing an invalid task pointer will result in an alert.
RESULT
success - A boolean value indicating the success of the operation.
This call will fail if the Task is in a state that does
not allow it to be frozen (including the case when it is
already frozen).
NOTES
This call is potentially dangerous. Freezing another task may lead
to deadlocks if the task was performing critical operations under
semaphore protection when it was frozen. So do not freeze another
task without good reasons.
When freezing yourself, make sure someone will bring you back to
life by calling smUnFreeze() on you.
BUGS
SEE ALSO
sysmon.library/smUnFreeze() , sysmon.library/smHibernate() ,
exec.library/Wait()
sysmon.library/smGetTaskInfo sysmon.library/smGetTaskInfo
NAME
smGetTaskInfo -- Get pointer to TaskInfo structure. (V0)
SYNOPSIS
tinfo = smGetTaskInfo( task )
D0 A0
struct TaskInfo *smGetTaskInfo( struct Task *task );
FUNCTION
Get a pointer to the TaskInfo structure associated to a given
Task.
INPUTS
task - A pointer to a Task structure. If NULL, the TaskInfo
structure of the current task will be returned.
RESULT
tinfo - A pointer to the corresponding TaskInfo structure or NULL
for an error (TaskInfo structure not found).
NOTES
BUGS
SEE ALSO
sysmon.library/smFindTaskInfo(), sysmon.library/smNextTaskInfo().
sysmon.library/smGetVBR sysmon.library/smGetVBR
NAME
smGetVBR -- Get the value of the 680x0 VBR. (V1)
SYNOPSIS
base = smGetVBR()
D0
APTR smGetVBR(void);
FUNCTION
Retrieves the value of the 68010+ vector base register in D0.
On a 68000 system, the hard coded value of $0 is returned.
INPUTS
none
RESULT
base - The base address of the 680x0 exception and interrupt vector
table.
NOTES
BUGS
SEE ALSO
sysmon.library/smHalt sysmon.library/smHalt
NAME
smHalt -- Halts the system for safe power down. (V0)
SYNOPSIS
smHalt( flags )
D0
void smHalt( ULONG flags );
FUNCTION
This function will disable multitasking, blink the power LED, freeze
all tasks except the caller, then display a guru like deadend alert
saying 'System Shutdown Complete' (without time out).
It is then safe to turn the power off.
If the user presses a mouse button to cancel the alert, the system
will be reset, generally via exec.library/ColdReboot().
If the DEL key (ASCII $7f) is pressed on a serial port terminal while
the power LED is blinking, control will be transfered to the ROM
debugger (ROM-Wack for V37, SAD for V39+)
If a keyboard reset is pending, the keyboard.device will be notified
that reset proceeding may continue and the caller task will be frozen,
awaiting doom. (V1 or higher)
In any case, this function never returns.
INPUT
flags - A bit pattern specifying options. Currently defined are :
HALTB_REBOOT : The alert is not displayed, causing the system
to reboot immediately.
HALTB_REKICK : Forces MMU-SoftKicked machines to reload
KickStart by disabling the MMU before rebooting (requires
mmu.library). The reset capture vectors and kicktags are
also cleared, wiping out reset resident modules (V1).
WARNING
This function does not care about filesystem consistency or whatever
other tasks are doing when it is called. It is the responsability of
the caller to take appropriate precautions before calling this
function.
BUGS
In V0, this function used RemTask() to stop the other tasks. This
could cause problems with still active interrupt routines.
The SBRSTB_OLDMMU flag (activated by the OLDMMURESET config option)
requires that the KBD_RESETHANDLERDONE keyboard command is sent
from supervisor mode under the boot MMU configuration (mmu.library
V42+ is required). This may not work under all configurations and
thus should only be used on systems that require it from proper
reset operation.
The exact way to perform a reset depends on the SBRSTB_CACHEREBOOT
and SBRSTB_OLDMMU reset flags. If SBRSTB_CACHEREBOOT is set, a cached
copy of the exec ColdReboot() function is used instead of the current
routine in the library vector, so as to avoid creative patches that
try to defer the reset. If SBRSTB_OLDMMU is set and the mmu.library
V42+ is available, a special reboot code is called with the MMU reset
to its boot configuration (mmu.library/RunOldConfig()) to avoid
reloading the kickstart on soft booting A3000s, unless HALTB_REKICK
was specified.
SEE ALSO
exec.library/ColdReboot(), exec.library/Alert(),
mmu.library/RunOldConfig().
sysmon.library/smHibernate sysmon.library/smHibernate
NAME
smHibernate -- Put the current task into hibernation. (V1)
SYNOPSIS
smHibernate()
void smHibernate( void );
FUNCTION
Put the current task into the TaskWait list. The task will no longer
be dispatched but exception signals will still be processed. When an
exception arrives, the task will be temporarily scheduled and will
return to hibernation on return from the exception routine.
The task will return from hibernation when a smWakeUp() call is
executed on it.
If the task already has a wake up request pending when calling
smHibernate(), it will return immediately without going to sleep.
INPUTS
none - Hibernation is a voluntary wait state.
NOTES
If you want to also block exceptions, either smDisallowExcept() before
calling smHibernate() or call smFreeze(NULL).
BUGS
SEE ALSO
sysmon.library/smFreeze() , sysmon.library/smWakeUp() ,
exec.library/Wait(), sysmon.library/smScheduleWakeUp()
sysmon.library/smLockTaskTable sysmon.library/smLockTaskTable
NAME
smLockTaskTable -- Lock TaskInfo Table for access. (V1)
SYNOPSIS
smLockTaskTable( flags )
D0
void smLockTaskTable( ULONG flags );
FUNCTION
This function will lock the TaskInfo table for access via semaphore
arbitration.
INPUTS
flags - a bit pattern specifying the type of access.
LTTB_READ for read access to the table (to scan the table via
smNextTaskInfo() for example). This lock can be shared.
LTTB_WRITE is for write access (task creation and removal) and
is *PRIVATE* to the sysmon.library
LTTB_REMOVE will prevent task removal to occur while the lock
is held. This allows system monitors to catch short life
tasks CPU usage.
NOTES
Don't call any OS function that may spawn a new task or stop an
existing one (like dos.library I/O for example) while holding a
TaskInfo table lock.
BUGS
SEE ALSO
sysmon.library/smUnLockTaskTable(), sysmon.library/smFindTaskInfo(),
sysmon.library/smNextTaskInfo()
sysmon.library/smNextTaskInfo sysmon.library/smNextTaskInfo
NAME
smNextTaskInfo -- Get the next TaskInfo entry. (V0)
SYNOPSIS
newtinfo = smNextTaskInfo( tinfo )
D0 A1
struct TaskInfo *smNextTaskInfo( struct TaskInfo *tinfo );
FUNCTION
This function returns the next TaskInfo structure in the Hash Table,
or NULL if there is no next entry.
INPUT
tinfo - Pointer to the current TaskInfo structure. If NULL, the
first TaskInfo structure will be returned.
RESULT
newtinfo - A pointer to the next TaskInfo in the table, or NULL if
the end has been reached.
WARNING
This function does not arbitrate for access to the TaskInfo HashTable.
You must call smLockTaskTable(LTTF_READ) before scanning with this
function (Use Forbid() for sysmon.library V0).
BUGS
SEE ALSO
exec.library/FindTask(), sysmon.library/smGetTaskInfo(),
sysmon.library/smFindTaskInfo(), sysmon.library/smLockTaskTable(),
sysmon.library/smUnLockTaskTable().
sysmon.library/smRemBroadcastPort sysmon.library/smRemBroadcastPort
NAME
smRemBroadcastPort -- Remove a BroadcastPort from the list (V1)
SYNOPSIS
smRemBroadcastPort( port )
A1
void smRemBroadcastPort(struct MsgPort *port);
FUNCTION
This function removes a port that was previously enabled for reception
of system broadcast messages. No resource deallocation is done, the
port is just removed from the broadcast list.
You should call this function when you received a BCM_SHUTDOWN message
with a zero value in the bcm_CountDown field, and your application
should then exit (reply the message first, of course !)
INPUTS
port - A pointer to a message port previously registered via
smAddBroadcastPort().
RESULT
none.
NOTES
Never call this function while holding a broadcast message or a
deadlock will occur.
BUGS
SEE ALSO
sysmon.library/smAddBroadcastPort(),
sysmon.library/smSendBroadcastMsg()
sysmon.library/smScheduleWakeUp sysmon.library/smScheduleWakeUp
NAME
smScheduleWakeUp -- Ask for a WakeUp call after a certain time. (V1)
SYNOPSIS
smScheduleWakeUp( timereq )
A1
void smScheduleWakeUp( struct timerequest *timereq );
FUNCTION
This function sends a request to the timer.device to wake up the
task after a specified time.
INPUTS
timereq - An initialized timerequest structure. You must open the
timer.device with the desired unit and fill in the fields
for the desired time delay before calling this function.
NOTES
This function is totally asynchronous. You must call smHibernate()
yourself if you want to go to sleep. The smSleep() function
provides a complete synchronous call using the VBLANK timer.
As this function does not need a signal bit, you should allocate
and initialize the message port for the device yourself using
AllocVec() and NewList(). This function will set up the port to
call smWakeUp() on message arrival by itself. A public message
port cannot be used.
BUGS
The mechanism used to call a subroutine on message arrival at a port
(mp_Flags = 3) is not officially documented. However, I don't expect
exec internals to change in the near future ;-)
SEE ALSO
timer.library/TR_ADDREQUEST, sysmon.library/smWakeUp(),
sysmon.library/smSleep(), exec.library/AllocVec(), amiga.lib/NewList()
sysmon.library/smSendBroadcastMsg sysmon.library/smSendBroadcastMsg
NAME
smSendBroadcastMsg -- Send a Broadcast Message to registered ports (V1)
SYNOPSIS
smSendBroadcastMsg( bcmsg )
A1
LONG smSendBroadcastMsg(struct BroadcastMsg *bcmsg);
FUNCTION
This function sends a properly initialized broadcast message to all
registered clients in turn.
INPUTS
bcmsg - A pointer to a properly initialized struct BroadcastMsg
bcm_Level indicates the severity of the reported event :
BCM_DEBUG is a debug message that can generally be ignored.
BCM_NORMAL is for general messages.
BCM_URGENT is for urgent conditions.
BCM_SHUTDOWN signals an incoming system shutdown. When
bcm_CountDown is zero, the shutdown is imminent.
BCM_UNMOUNT signals clients that have not exited yet that
filesystem access is no longer possible.
BCM_HALT is the last gasp before system halt/reboot. Power
supply monitors could use this to turn the power off.
bcm_Flags contains additional flags. Currently defined are :
BCMF_DOOMSDAY : a keyboard reset is pending. The system
will reset in at most 10 seconds. This flag will be set
automatically.
BCMF_CANCEL : a previously announced event has been cancelled.
bcm_TimeOut is the time out value in 1/50th second ticks. If a
client does not retrieve the message from its port in this
time period, it will be removed from the port, bcm_TimeOutCount
will be incremented and the message will be passed to the next
client. If a keyboard reset is pending, the timeout value will
be maxed at 5 ticks (1/10th second).
bcm_CountDown is a countdown in seconds for the announced event.
a zero value indicates an imminent event.
bcm_ReplyCount and bcm_TimeOutCount are return values and must be
set to zero.
bcm_SenderTask is the address of the calling task and is filled
by this function.
bcm_EventTxt is a descriptive ASCII text for the announced event.
bcm_Reserved are reserved fields that must be set to zero.
RESULT
The value of the bcm_ReplyCount is returned in D0. A negative value
indicates an error condition.
NOTES
The Broadcast Messages are sent in turn to each client, so your
application must be ready to process them quickly. If you are
unable to retrieve the message in the time specified in the
bcm_TimeOut field, the smSendBroadcastMsg() function will remove it
transparently from your port and pass it to the next one (be prepared
for an empty port when you receive a signal !).
When you have retrieved the message, you MUST reply it as quickly
as possible (make a copy if necessary). In particular, NEVER EVER
wait for user interaction when holding the message. This is parti-
cularly true for a BCM_SHUTDOWN message with the BCMB_DOOMSDAY bit set
in the bcm_Flags field as the shutdown procedure must be able to
complete in the 10 seconds time allowed by the keyboard.device
When you receive a BCM_SHUTDOWN message with a zero bcm_CountDown, you
should smRemBroadcastPort() your port and exit.
BUGS
SEE ALSO
sysmon.library/smAddBroadcastPort(),
sysmon.library/smRemBroadcastPort()
sysmon.library/smSleep sysmon.library/smSleep
NAME
smSleep -- Put a task into hibernation for a specified time. (V0)
SYNOPSIS
success = smSleep( ticks )
D0 D0
BOOL smSleep( ULONG ticks );
FUNCTION
This function makes the current task hibernate for the specified
period of time.
INPUTS
ticks - The number of ticks (50 per second) the task will sleep.
If ZERO, the function will return immediately.
RESULT
success - A boolean value indicating the success of the operation.
It may fail in very low memory conditions, in that case
the function returns immediately.
NOTES
This function uses the VBLANK unit of the timer.device with the
smScheduleWakeUp() and smHibernate() functions in V1.
In V0, smFreeze() was used.
BUGS
SEE ALSO
dos.library/Delay(), sysmon.library/smScheduleWakeUp(),
sysmon.library/smHibernate(), sysmon.library/smFreeze()
sysmon.library/smUnFreeze sysmon.library/smUnFreeze
NAME
smUnFreeze -- Put a frozen task back to life. (V0)
SYNOPSIS
success = smUnFreeze( task )
D0 A1
BOOL smUnFreeze( struct Task *task );
FUNCTION
Put a frozen task back into its previous state. If the task was
previously waiting or hibernating and signals or wakeup requests
have arrived, they will be precessed now.
INPUTS
task - A pointer to a Task structure. An invalid task pointer will
result in an alert.
RESULT
success - A boolean value indicating the success of the operation.
This call will fail if the Task was not frozen.
NOTES
This function may be called from interrupts.
BUGS
SEE ALSO
sysmon.library/smFreeze(), exec.library/Wait(), exec.library/Signal()
sysmon.library/smUnLockTaskTable sysmon.library/smUnLockTaskTable
NAME
smUnLockTaskTable -- UnLock TaskInfo Table. (V1)
SYNOPSIS
smUnLockTaskTable( flags )
D0
void smUnLockTaskTable( ULONG flags );
FUNCTION
This function will release the TaskInfo table lock obtained via a
previous call to smLockTaskTable().
INPUTS
flags - a bit pattern specifying the type of lock. Must match the
flags previously passed to smLockTaskTable().
NOTES
Don't call any OS function that may spawn a new task or stop an
existing one (like dos.library I/O for example) while holding a
TaskInfo table lock.
BUGS
SEE ALSO
sysmon.library/smLockTaskTable(), sysmon.library/smFindTaskInfo(),
sysmon.library/smNextTaskInfo()
sysmon.library/smVKPrintf sysmon.library/smVKPrintf
NAME
smVKPrintf -- print formatted data to the debugging console. (V0)
(defaults to the serial port at 9600 baud)
SYNOPSIS
smVKPrintf( format, values )
A0 A1
void smVKPrintf(STRPTR format, APTR values);
void smKPrintf(STRPTR format, ...);
FUNCTION
Print a formatted C-type string to the debugging console.
See the exec.library/RawDoFmt() call for the supported % formatting
commands.
INPUTS
format - A C style string with % commands to indicate where parameters
are to be inserted.
values - A pointer to an array of parameters, to be inserted into
specified places in the string.
RESULT
NONE
NOTES
RawDoFmt assumes 16 bit ints, so you will usually need 'l's in your
formats (ex: %ld versus %d).
This function may be called from interrupts.
BUGS
The exec.library/RawPutChar() called by this function will busy wait
when a ^S character is typed at the remote console. This will hang
the system if smVKPrintf() was called from a Forbid()/Disable()
section or from supervisor mode. Type ^Q at the remote terminal to
resume output.
SEE ALSO
dos.library/VPrintf(), exec.library/RawDoFmt(), debug.lib/KPrintF()
sysmon.library/smVSnPrintf sysmon.library/smVSnPrintf
NAME
smVSnPrintf -- format data to a sized character buffer. (V1)
SYNOPSIS
endstr = smVSnPrintf( buffer, len, format, values )
D0 A3 D0 A0 A1
APTR smVSnPrintf(STRPTR buffer, ULONG len, STRPTR format, APTR values);
APTR smSnPrintf(STRPTR buffer, ULONG len, STRPTR format, ...);
FUNCTION
Print a formatted C-type string to a sized character buffer to prevent
overflows. Unlike strncpy(), it guarantees a null-terminated buffer
so at most (len - 1) characters will be in the output string.
See the exec.library/RawDoFmt() call for the supported % formatting
commands.
INPUTS
buffer - A pointer to a buffer large enough to contain the resulting
string.
len - The size of the output buffer in bytes.
format - A C style string with % commands to indicate where parameters
are to be inserted.
values - A pointer to an array of parameters, to be inserted into
specified places in the string.
RESULT
endstr - A pointer to the end of the formatted data.
NOTES
RawDoFmt assumes 16 bit ints, so you will usually need 'l's in your
formats (ex: %ld versus %d).
This function may be called from interrupts.
This function is adapted from an article posted on csa.programmer
by Ty Sarna (tsarna@endicor.com).
BUGS
Before V1.8, this function was not reentrant.
SEE ALSO
dos.library/VPrintf(), exec.library/RawDoFmt(), ANSI-C sprintf()
sysmon.library/smVSPrintf()
sysmon.library/smVSPrintf sysmon.library/smVSPrintf
NAME
smVSPrintf -- format data to a character buffer. (V0)
SYNOPSIS
endstr = smVSPrintf( buffer, format, values )
D0 A3 A0 A1
APTR smVSPrintf(STRPTR buffer, STRPTR format, APTR values);
APTR smSPrintf(STRPTR buffer, STRPTR format, ...);
FUNCTION
Print a formatted C-type string to a character buffer.
See the exec.library/RawDoFmt() call for the supported % formatting
commands.
INPUTS
buffer - A pointer to a buffer large enough to contain the resulting
string.
format - A C style string with % commands to indicate where parameters
are to be inserted.
values - A pointer to an array of parameters, to be inserted into
specified places in the string.
RESULT
endstr - A pointer to the end of the formatted data.
NOTES
RawDoFmt assumes 16 bit ints, so you will usually need 'l's in your
formats (ex: %ld versus %d).
This function may be called from interrupts.
BUGS
SEE ALSO
dos.library/VPrintf(), exec.library/RawDoFmt(), ANSI-C sprintf()
sysmon.library/smVSnPrintf()
sysmon.library/smVSysLog sysmon.library/smVSysLog
NAME
smVSysLog -- Logs system messages to file or console. (V0)
SYNOPSIS
success = smVSysLog( priority, format, values )
D0 D0 A0 A1
BOOL smVSysLog(ULONG priority, STRPTR format, APTR values);
BOOL smSysLog(ULONG priority, STRPTR format, ...);
FUNCTION
Formats a system message via exec.library/RawDoFmt() and logs it
into a disk file and/or window and/or serial terminal based on
it's priority value and user defined thresholds.
INPUTS
priority - A priority value and optional facility code and flags as
defined in sysmon.i .
Low priority values mean high severity.
An optional facility code can also be used to identify the
system component or application logging this message.
LOG_NOHEAD can be used to write long messages in several
parts by skipping the header for subsequent calls.
LOG_NOWIN and LOG_NOFILE disable window and file logging
respectively in cases where it is not appropriate to have
file or window output.
format - A C style string with % commands to indicate where parameters
are to be inserted.
values - A pointer to an array of parameters, to be inserted into
specified places in the string.
RESULT
success - A boolean value. TRUE for success, FALSE for an error.
NOTES
The Sysmon.server process must be running for this call to succeed.
The format buffer is limited to SM_MAXLOGCHARS chars, so make sure
your formatted string will not cause it to overflow. Starting with V1,
the formatted string will be silently truncated to the SM_MAXLOGCHARS
limit.
The higher severity codes (LOG_EMERG and LOG_ALERT) are reserved for
system failures and should not be used by applications.
This function may return before logging is complete.
This function may be called from interrupts.
BUGS
In V0, there was no check for buffer overflow.
SEE ALSO
exec.library/RawDoFmt(), sysmon.library/smVKPrintf(),
sysmon.library/smVSnPrintf()
sysmon.library/smWaitAnd sysmon.library/smWaitAnd
NAME
smWaitAnd -- wait for a set of signals to be set together
SYNOPSIS
signals = smWaitAnd( signalSet )
D0 D0
ULONG smWaitAnd( ULONG signalSet );
FUNCTION
This function will cause the current task to wait for a set of
signals. The task will only be made ready again when all of the
specified signals are set. The signals are cleared in the received
signal mask and returned to the caller. While waiting, the task will
be put in the new TS_WAITAND state.
If less than two signals are to be waited for, this function will
fallback to the normal TS_WAIT state.
If the signals are already set before calling smWaitAnd(), the wait
condition will be immediately satisfied, and the task will continue
to run without delay.
INPUT
signalSet - The set of signals for which to wait.
Each bit represents a particular signal.
RESULTS
signals - the set of signals that were active. Since this functions
waits until all signals are set, this is the same as the
input mask.
WARNING
This function cannot be called while in supervisor mode or
interrupts! This function will break the action of a Forbid() or
Disable() call.
BUGS
SEE ALSO
exec.library/Wait(),
sysmon.library/smWakeUp sysmon.library/smWakeUp
NAME
smWakeUp -- Wake Up an Hibernating task. (V1)
SYNOPSIS
smWakeUp( task )
A1
void smWakeUp( struct Task *task );
FUNCTION
Put an hibernating task out of sleep. If the task is not currently
hibernating, set the wakeup pending flag.
INPUTS
task - A pointer to a Task structure. An invalid task pointer will
result in an alert.
NOTES
This function may be called from interrupts.
BUGS
SEE ALSO
sysmon.library/smHibernate(), sysmon.library/smUnFreeze(),
sysmon.library/smScheduleWakeUp(), exec.library/Signal()