resource
|
 |
The current process has a set of
resources restricted by the following limits.
- Hard limit-Maximum
amount of resources a process can use before it is forcibly terminated.
- Soft limit-Maximum
amount of resources a process can use before receiving a signal; the process
can continue to execute after receiving the signal.
The os_this_process
class has several functions that return limits associated with a particular
resource. To change a resource limit, a process must perform these steps.
- Obtain the resource.
- Change the resource.
- Set the resource.
Only an object with superuser
privileges can change the hard limit of a resource.
Conversions permit os_resource
, and os_rlimit_t to be used interchangeably.
Library
Platform<ToolKit> for
UNIX
Declaration
#include <ospace/unix/resource.h>
class os_resource
Typedefs
typedef struct rlimit os_rlimit_t
Interface
Constructor
os_resource(
const os_resource& resource )
Constructs an object that
is a copy of resource .
Constructor
os_resource(
const os_rlimit_t& resource )
Constructs an object from
resource .
Constructor
os_resource()
Constructs an object with
zero hard and soft limits.
=
os_resource&
operator=( const os_rlimit_t& resource )
Assigns an object from resource
.
=
os_resource&
operator=( const os_resource& resource )
Assigns an object from resource
.
==
bool
operator==( const os_resource& resource
) const
Returns true
if the object is the same as resource .
(os_rlimit_t)
operator
os_rlimit_t() const
Returns an object as an os_rlimit_t
structure.
hard_limit
os_lim_t
hard_limit() const
Returns hard limit.
hard_limit
void
hard_limit( os_lim_t limit )
Sets the hard limit to limit
.
print
void
print( ostream& stream )
const
Prints to stream
.
soft_limit
void
soft_limit( os_lim_t limit )
Sets the soft limit to limit
.
soft_limit
os_lim_t
soft_limit() const
Returns the soft limit.
Non-Member Functions
<<
ostream&
operator<<( ostream& stream ,
const os_resource& resource )
Prints resource
to stream .
Universal Streaming Service
#include <ospace/uss/unix.h>
<<
os_bstream&
operator<<( os_bstream& stream ,
const os_resource& resource )
Writes resource
to stream .
>>
os_bstream&
operator>>( os_bstream& stream ,
os_resource& resource )
Reads resource
from stream .
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only. - For use by licensed
users only.