resource |
A current process has a set of resources restricted by the following limits.
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.
Only an object with superuser privileges can change the hard limit of a resource.
The following example displays the CPU and open file resource limits. The soft limit of open file descriptors is also increased.
#include <iostream>
#include <ospace/unix.h>
int
main()
{
os_unix_toolkit initialize;
cout << "core_resource(): " << os_this_process::core_resource();
cout << endl;
os_resource max_files = os_this_process::open_file_resource();
cout << "open_file_resource(): " << max_files << endl;
max_files.soft_limit( 150 );
os_this_process::open_file_resource( max_files );
cout << "open_file_resource(): ";
cout << os_this_process::open_file_resource() << endl;
return 0;
}
core_resource(): os_resource( infinity out of infinity )
open_file_resource(): os_resource( 64 out of 1024 )
open_file_resource(): os_resource( 150 out of 1024 )
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.