• Salert | Outputs alerts or error-messages. |
• Sconfig | Obtains/Sets operating system configuration. |
• Scookie | Controls cookie jar. |
• Shutdown | Kills all processes, syncs file-systems then halts or reboots the system. |
• Slbclose | Closes a shared library |
• Slbopen | Opens a shared library. |
• Srealloc | Allocates screen memory. |
• Ssystem | Controls cookie jar, memory access and various system settings. |
• STEFcntrl | STEmulator control functions. |
• Super | Obtains or alters supervisor-mode. |
• Suptime | Obtains the current uptime and load averages for the system. |
• Sversion | Obtains the version number of GEMDOS. |
• Syield | Releases CPU for other processes. |
• Sync | Synchronises all mounted file-systems. |
• Sysconf | Checks operating system configuration. |
See also: File functions Process functions
Name: | »Salert« - Output alert or error-message.
|
Opcode: | 316
|
Syntax: | void Salert ( int8_t *msg );
|
Description: | The function Salert outputs an alert or error-message that is
written to the alert pipeline U:\PIPE\ALERT.
The message msg should not contain any escape or control characters, linefeeds etc. It should be a simple one-line NULL-terminated character string alert- or error-message. The function formats the message itself and sends it to the user. The exact format of the output however depends on the system configuration in use. |
Return value: | The function has no direct result.
|
Availability: | Available when a 'MiNT' cookie with a version of at least 0.98
exists.
|
Group: | System functions
|
See also: | Binding Cconws Test for pipes
|
C: | void Salert ( int8_t *msg );
|
Assembler: |
pea msg ; Offset 2 move.w #316,-(sp) ; Offset 0 trap #1 ; GEMDOS addq.l #6,sp ; Correct stack |
Name: | »Sconfig« - Configuration of parts of the operating system.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Opcode: | 51
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Syntax: | int32_t Sconfig ( int16_t mode, int32_t flags );
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description: | The function Sconfig permits the configuration of parts of the
operating system. The following apply:
Note: Set bits switch the relevant function on, cleared bits switch in off again. Bit 11 is only available as of MagiC 3.0. The setting of the configuration is only possible with TOS-compatibility switched off. The function is also present in KAOS, though with a somewhat different assignment of the bit-vector. For mode, KAOS 1.2 only knows the first two subfunctions.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Return value: | The function returns, depending on the parameter mode,
the currently valid configuration or a pointer to a DOSVARS structure.
In case of error the function will return EINVFN or EACCDN. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Availability: | As of KAOS Version 1.2, and MagiC Version 1.0.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Group: | System functions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See also: | Binding Sysconf
|
C: | int32_t Sconfig ( int16_t mode, int32_t flags );
|
Assembler: |
move.l flags,-(sp) ; Offset 4 move.w mode,-(sp) ; Offset 2 move.w #51,-(sp) ; Offset 0 trap #1 ; GEMDOS addq.l #8,sp ; Correct stack |
Name: | »Scookie« - Cookie jar management.
| ||||||||||||||||
Opcode: | 330 (0x014a)
| ||||||||||||||||
Syntax: | int32_t Scookie ( int16_t action, COOKIE *cookie );
| ||||||||||||||||
Description: | The function Scookie permits the management of the cookie jar.
The following apply:
| ||||||||||||||||
Return value: | The return value depends on the parameter action
In case of invalid action value the function will return EINVFN. | ||||||||||||||||
Availability: | This function is not available, use Ssystem() instead to manage
cookies.
This function has been disabled as of FreeMiNT 1.12.4. Opcode 330 is now assigned to Dchroot(). | ||||||||||||||||
Group: | System functions
| ||||||||||||||||
See also: | Binding Ssystem
|
C: | int32_t Scookie ( int16_t action, COOKIE *cookie );
|
Assembler: |
pea cookie ; Offset 4 move.w action,-(sp) ; Offset 2 move.w #330,-(sp) ; Offset 0 trap #1 ; GEMDOS addq.l #8,sp ; Correct stack |
Name: | »Shutdown« - Kill all processes, sync file-systems then halt
or reboot the system.
|
Opcode: | 337 (0x0151)
|
Syntax: | int32_t Shutdown ( int32_t mode );
|
Description: | The function Shutdown kills all processes, syncs file-systems
then halts or reboots the system.
On mode equal to SHUT_POWER (0L), the system will turn the power off. The only hardware that supports it at present is CT60 and the FireBee. If the hardware does not support it, SHUT_HALT will be performed. SHUT_POWER mode is recognized as of FreeMiNT version 1.16a; older versions of the kernel will treat the SHUT_POWER mode as SHUT_COLD. On mode equal to SHUT_BOOT (1L), the system will reboot the machine after shutting everything down. On mode equal to SHUT_COLD (2L), the system will act the same as with the SHUT_BOOT mode, except that a cold start rather than the warm start will be performed. SHUT_COLD mode is recognized as of FreeMiNT version 1.15.5; older versions of the kernel will treat the SHUT_COLD mode as SHUT_BOOT. On mode equal to SHUT_HALT (3L), the system will shut down, then enter a halted condition. All other values of mode are reserved for future definition. Older versions of MiNT contained a bug that might cause the system to crash if you called Shutdown while both GEM AES and virtual console daemon were present. You need root privileges to shut the system down. |
Return value: | Returns a negative GEMDOS error-code if it fails. On success
this call obviously never returns.
|
Availability: | As of the first in MultiTOS integrated MiNT version 1.04.
|
Group: | System functions
|
See also: | Binding Sync
|
C: | void Shutdown ( int32_t mode );
|
Assembler: |
move.l mode,-(sp) ; Offset 2 move.w #337,-(sp) ; Offset 0 trap #1 ; GEMDOS addq.l #6,sp ; Correct stack |
Name: | »Slbclose« - Close a shared library
|
Opcode: | 23 (0x017)
|
Syntax: | int32_t Slbclose( SHARED_LIB *sl );
|
Description: | The function Slbclose closes a shared library.
The parameter sl is the descriptor that is obtained with Slbopen. Since MagiC 6: Is sl=-1, then all shared library will be closed. |
Return value: | E_OK = All OK else a negative GEMDOS error-number.
|
Availability: | As of MagiC 5.20 and FreeMiNT 1.15.4.
|
Group: | System functions
|
See also: | Binding Slbopen Shared libraries
|
C: | int32_t Slbclose( SHARED_LIB *sl );
|
Assembler: |
pea sl ; Offset 2 move.w #23,-(sp) ; Offset 0 trap #1 ; GEMDOS addq.l #6,sp ; Correct stack |
Name: | »Slbopen« - Open a shared library
| ||||||||||||
Opcode: | 22 (0x016)
| ||||||||||||
Syntax: | int32_t Slbopen( int8_t *name, int8_t *path, int32_t min_ver,
SHARED_LIB *sl, SLB_EXEC *fn );
| ||||||||||||
Description: | The function Slbopen opens a shared library.
| ||||||||||||
Return value: |
| ||||||||||||
Availability: | As of MagiC 5.20 and FreeMiNT 1.15.4.
| ||||||||||||
Group: | System functions
| ||||||||||||
See also: | Binding Slbclose Shared libraries
|
C: | int32_t Slbopen( int8_t *name, int8_t *path, int32_t min_ver,
SHARED_LIB *sl, SLB_EXEC *fn );
|
Assembler: |
pea fn ; Offset 18 pea sl ; Offset 14 move.l minver,-(sp) ; Offset 10 pea path ; Offset 6 pea name ; Offset 2 move.w #22,-(sp) ; Offset 0 trap #1 ; GEMDOS lea 22(sp),sp ; Correct stack |
Name: | »Srealloc« - Allocate screen memory.
|
Opcode: | 21
|
Syntax: | int32_t Srealloc ( int32_t len );
|
Description: | The GEMDOS routine Srealloc allocates a block of length
len bytes for the screen memory.
The screen memory is a block of the ST-RAM whose owner is the boot process. The address of the screen memory (logbase or physbase) is not affected by this function. |
Return value: | The function returns (if len has the value -1) the
maximum possible size of the screen memory.
|
Availability: | As of GEMDOS 0.30 (TOS 4).
|
Group: | System functions
|
See also: | Binding
|
C: | int32_t Srealloc ( int32_t len );
|
Assembler: |
move.l len,-(sp) ; Offset 2 move.w #21,-(sp) ; Offset 0 trap #1 ; GEMDOS addq.l #6,sp ; Correct stack |
Name: | »Ssystem« - Control cookie jar, memory access and various
system settings.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Opcode: | 340 (0x0154)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Syntax: | int32_t Ssystem ( int16_t mode, int32_t arg1, int32_t arg2 );
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description: | The Ssystem call has been designed to make your life easier.
Using this you can get some closer control of the system and the kernel
itself. Via this call the kernel now supports e.g. an easy cookie jar
management and provides a safe access to supervisor memory. It's
strictly encouraged to access GEMDOS variables and system vectors via
the Ssystem, because this way is considered safe for multi-user
setups.
arg1 and arg2 are LONG parameters specific to a particular mode. If a mode doesn't use a parameter, it is usually ignored, but should be set to zero for future compatibility. mode specifies a particular action as follows:
Ssystem was first introduced as of MiNT version 1.14.6, but it is considered fully functional as of MiNT version 1.15.0 release. The S_OSHEADER opcode should be only used for fetching the TOS version number when running MiNT versions below 1.15.0 release. The S_FLUSHCACHE, S_CTRLCACHE, S_DEBUGLEVEL and S_DEBUGDEV are supported as of MiNT version 1.15.1 release. You should never use Ssystem(S_TIOCMGET, ...); in your own programs. The Ssystem behaviour does not depend on the S_SECLEVEL settings. Any values returned by the kernel on reserved fields should be considered undocumented and no software should rely on them. It's strictly encouraged to access GEMDOS variables and system vectors via the Ssystem, because this way is considered safe for multi-user setups. For example, you can access the cookie jar pointer using the call Ssystem(S_GETLVAL, 0x05a0, NULL), though if TOS-compatibility is the issue you should rather use (2, -1). Prior to any further Ssystem usage, your application should first check if the kernel supports this call. If it does, the Ssystem(-1, 0L, 0L); should return a zero. Ssystem is used and supported by the MiNT Library as of patchlevel 48. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Return value: |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Availability: | Available when a 'MiNT' cookie with a version of at least 1.15
exists.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Group: | System functions
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See also: | Binding Tgettimeofday Tsettimeofday
|
C: | int32_t Ssystem ( int16_t mode, int32_t arg1, int32_t arg2 );
|
Assembler: |
move.l arg2,-(sp) ; Offset 8 move.l arg1,-(sp) ; Offset 4 move.w mode,-(sp) ; Offset 2 move.w #340,-(sp) ; Offset 0 trap #1 ; GEMDOS lea $0c(sp),sp ; Correct stack |
Name: | »STEFcntrl« - STEmulator control functions
|
Opcode: | 24000 (0x5DC0)
|
Syntax: | int32_t STEFcntrl ( int16_t func, int32_t special1, int32_t
special2 );
|
Description: |
SET_INFOTEXT (1) special1 = (int8_t *) Pointer to new info-line special2 = (int8_t *) Pointer to old info-line The string pointed to be special1 will be adopted as the new info-line in the status-line of the STEmulator. A value of NULL switches back to the standard display again. If a valid pointer to a buffer is passed in special2, this will contain the old text of the info-line after the function call. With NULL, nothing happens. SET_WINDOWTITLE (2) special1 = (int8_t *) Pointer to new title-line special2 = (int8_t *) Pointer to old title-line The string pointed to by special1 will be adopted as the new title-line of the STEmulator window. If a valid pointer to a buffer is passed in special2, this will contain the old text of the window title after the function call. With NULL, nothing happens. |
Return value: | EINVFN = Unknown function.
ERANGE = Invalid parameter. |
Availability: | STEmulator
|
Group: | System functions
|
See also: | Binding
|
C: | int32_t STEFcntrl ( int16_t func, int32_t special1, int32_t
special2 );
|
Assembler: |
move.l special2,-(sp) ; Offset 8 move.l special1,-(sp) ; Offset 4 move.w func,-(sp) ; Offset 2 move.w #24000,-(sp) ; Offset 0 trap #1 ; GEMDOS lea $0c(sp),sp ; Correct stack |
Name: | »supervisor« - Switch supervisor-mode.
|
Opcode: | 32 (0x0020)
|
Syntax: | int32_t Super ( void *stack );
|
Description: | The GEMDOS routine Super switches between user- and
supervisor-mode, or interrogates the current operating
The address of the supervisor stack may be altered during switching. If one passes the value 1 for the parameter stack, then the current mode will be interrogated. The value 0 switches between user- and supervisor-mode. All other values will be regarded as the new address for the supervisor stack. In the supervisor-mode one can access all protected memory blocks. Note: With regard to future operating system versions, you should avoid use of the Super function. This function gives rise to major problems in conjunction with virtual memory and interruptible (and re-entrant) file-systems in a multitasking system. If neccesary, alter your code so that you can use the BIOS function Supexec. For MiNT the following applies: If you are in SECURELEVEL > 1, you must have root privileges to get into supervisor-mode. If you don't have them and call Super, the SIGSYS signal (12) will be raised. |
Return value: | If the state is to be obtained, one gets the value 0 for the
user-mode and -1 for the supervisor-mode. Else the function returns
the address of the old supervisor stack, provided one had switched to
the supervisor-mode.
|
Availability: | All GEMDOS versions.
|
Group: | System functions
|
See also: | Binding Supexec
|
C: | int32_t Super ( void *stack );
|
Assembler: |
pea stack ; Offset 2 move.w #32,-(sp) ; Offset 0 trap #1 ; GEMDOS addq.l #6,sp ; Correct stack |
The function Super in switching to the supervisor-mode sets the Super stack pointer to the user-stack of the program. This can be fatal, as the program can not know how large a super stack block has to be. Too small a stack can lead to faulty behaviour, crashes or similar. The super stack no longer lies in a block that is possibly protected by memory protection mechanisms, so it can be destroyed by the program.
A part of the user stack could have been laid-off by virtual memory mechanisms. A laid-off super stack as seen from the processor means that the MC-680x0 processor can no longer save its CPU status to the super stack as usual for exceptions, and then stop intentionally. No applications programmer should be so arrogant as to burden the system with any kind of restriction to the supervisor stack size.
Name: | »Suptime« - Return the current uptime and load averages from
the system.
|
Opcode: | 319 (0x013f)
|
Syntax: | int32_t Suptime ( int32_t *uptime, int32_t *loadaverage );
|
Description: | The function Suptime returns the current uptime and load
averages from the system.
uptime is a pointer to a LONG value that will be filled with the current amount of seconds elapsed since the last reboot. loadaverage is a pointer to a three LONGword array, that will be filled with the current load averages (for the last 1, 5 and 15 minutes). The load average value is calculated using the following formula: sum += (new_load - old_load) * LOAD_SCALE; load_avg = sum / MAX_SIZE; where LOAD_SCALE is 2048, MAX_SIZE is the number of 5 second periods in the specified amount of time (12 for 1 min., 60 for 5 min. and 180 for 15 min). new_load is the number of currently running processes, old_load is the number of processes running previous time. A 'running' process is considered the one which is put onto run or ready queue. |
Return value: | Returns E_OK if successful, or a negative GEMDOS error-code
otherwise (actually it may be only ENOSYS if the call is not
supported...).
|
Availability: | Available when a 'MiNT' cookie with a version of at least 1.11
exists.
|
Group: | System functions
|
See also: | Binding
|
C: | int32_t Suptime ( int32_t *uptime, int32_t *loadaverage );
|
Assembler: |
pea loadaverage ; Offset 6 pea uptime ; Offset 4 move.w #48,-(sp) ; Offset 0 trap #1 ; GEMDOS lea $0a(sp),sp ; Correct stack |
Name: | »Operating system version« - Obtain the number of the current
GEMDOS version.
| ||||||||||||||||||||||||||
Opcode: | 48
| ||||||||||||||||||||||||||
Syntax: | uint16_t Sversion ( void );
| ||||||||||||||||||||||||||
Description: | The GEMDOS routine Sversion obtains the version number of the
GEMDOS. At the present time, the following versions are known:
| ||||||||||||||||||||||||||
Return value: | The function returns the named version number, in the following
manner:
The value is BCD coded. | ||||||||||||||||||||||||||
Availability: | All GEMDOS versions.
| ||||||||||||||||||||||||||
Group: | System functions
| ||||||||||||||||||||||||||
See also: | Binding Sysconf TOS list
|
C: | uint16_t Sversion ( void );
|
Assembler: |
move.w #48,-(sp) ; Offset 0 trap #1 ; GEMDOS addq.l #2,sp ; Correct stack |
Name: | »Syield« - Release CPU for other processes.
|
Opcode: | 255
|
Syntax: | void Syield ( void );
|
Description: | By calling the Syield function a process releases the CPU, so
that it can be allocated to other processes (possibly earlier than
planned).
Note: Under MagiC this function directly calls the AES routine appl_yield, and will be ignored in the Auto folder. |
Return value: | The function does not return a result.
|
Availability: | In MagiC as of Version 3.0, and when the MiNT cookie is
present.
|
Group: | System functions
|
See also: | Binding Pause Fselect
|
C: | void Syield ( void );
|
Assembler: |
move.w #255,-(sp) ; Offset 0 trap #1 ; GEMDOS addq.l #2,sp ; Correct stack |
Name: | »Sync« - Synchronise all mounted file-systems.
|
Opcode: | 336 (0x0150)
|
Syntax: | void Sync ( void );
|
Description: | The function Sync synchronises all mounted file-systems.
Warning: In MagiC this function is called Ssync. |
Return value: | The function does not return a result.
|
Availability: | MagiC as of Version 4.01, and under all MiNT versions
integrated with MultiTOS.
|
Group: | System functions
|
See also: | Binding Shutdown
|
C: | void Sync ( void );
|
Assembler: |
move.w #336,-(sp) ; Offset 0 trap #1 ; GEMDOS addq.l #2,sp ; Correct stack |
Name: | »Sysconf« - Obtain information about the operating system
configuration.
| ||||||||||||||||||||||||||
Opcode: | 290
| ||||||||||||||||||||||||||
Syntax: | int32_t Sysconf ( int16_t n );
| ||||||||||||||||||||||||||
Description: | The function Sysconf returns information about the capabilities
(or the configuration) of the operating system. With the parameter
n various values can be interrogated:
A return value of 0x7fffffff (2^31 - 1) means that the corresponding value is unlimited. Note: MagiC may return -1 for unlimited values. | ||||||||||||||||||||||||||
Return value: | Return value: The function returns the information
specified by the parameter n.
| ||||||||||||||||||||||||||
Availability: | As of the first in MultiTOS integrated MiNT version 1.04.
| ||||||||||||||||||||||||||
Group: | System functions
| ||||||||||||||||||||||||||
See also: | Binding Dpathconf
|
C: | int32_t Sysconf ( int16_t n );
|
Assembler: |
move.w n,-(sp) ; Offset 2 move.w #290,-(sp) ; Offset 0 trap #1 ; GEMDOS addq.l #4,sp ; Correct stack |