Topic : TOS - The Operating System Author : Version : tos.hyp (December 19, 2008) Subject : Programmieren/Atari Nodes : 3010 Index Size : 93790 HCP-Version : 5 Compiled on : Atari @charset : atarist @lang : @default : Title @help : @options : +g -i -s +x +zz -t4 @width : 70 View Ref-File5.12.26 Psetlimit TOS Name: »Psetlimit« - Set or obtain allocation limits of the system resources. Opcode: 287 Syntax: int32_t Psetlimit ( int16_t lim, int32_t value ); Description: The function Psetlimit serves for setting or obtaining resource allocation limits for the current process. The parameter lim determines the desired resource type: lim Meaning 1 Max. CPU-time for the process (milliseconds) 2 Max. total memory allowed for process in bytes 3 Max. allocatable memory for the process (in bytes) The difference between 2 and 3 is that the total memory also includes the TEXT, DATA and BSS segments of the process. With the help of this function the resource allocation limits are set both for the current process as well as individually for all child processes created later. So if a process sets a CPU limit and later creates several child processes, then this CPU limit applies also for each individual child process, and not, say, for all child processes together. The parameter value determines the maximum value that a resource is allowed to take. A value of 0 here means that the resource is unlimited. A negative value here returns the current value, leaving it unaltered. Note: There are no restrictions on increasing the limits. Each process may alter any of its limits or even set it to unlimited. Memory allocation limits do not apply for Pexec. If, say, a process is limited to 256 kbyte, it can nevertheless use Pexec to launch a child process that uses more memory. Warning: This does not apply in MagiC; here memory limits are inherited at Pexec! Memory limitations are not valid retrospectively. If, for instance, a process owns 256 kbyte and then calls Psetlimit to reduce its requirements to 128 kbyte, then though it will not be terminated, it can not allocate any memory any more until its size falls under the specified 128 kbyte. Limitations of the CPU-time on the other hand do act retrospectively. If a process reduces its CPU-time below the previously valid value, then it will receive a SIGXCPU signal immediately. Warning: Invalid function numbers and those that are not supported by MagiC return EINVFN. Note about MagiC: If a program has been modified with the utility program LIMITMEM, then this setting takes precedence over the calling process' memory limit. Psetlimit is supported by the extended shel_write mode; due to this, memory-limited applications may also be started in parallel. Return value: The function returns the old limit value. Availability: MagiC from Version 4.0 (17.09.1996) onwards and as of the first in MultiTOS integrated MiNT version 1.04. Group: Process functions See also: Binding Prusage Signals