OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
stacksize_c.c
Go to the documentation of this file.
1//Copyright> OpenRadioss
2//Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3//Copyright>
4//Copyright> This program is free software: you can redistribute it and/or modify
5//Copyright> it under the terms of the GNU Affero General Public License as published by
6//Copyright> the Free Software Foundation, either version 3 of the License, or
7//Copyright> (at your option) any later version.
8//Copyright>
9//Copyright> This program is distributed in the hope that it will be useful,
10//Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11//Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12//Copyright> GNU Affero General Public License for more details.
13//Copyright>
14//Copyright> You should have received a copy of the GNU Affero General Public License
15//Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16//Copyright>
17//Copyright>
18//Copyright> Commercial Alternative: Altair Radioss Software
19//Copyright>
20//Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21//Copyright> software under a commercial license. Contact Altair to discuss further if the
22//Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23#include "hardware.inc"
24
25#if CPP_mach == CPP_w95 || CPP_mach == CPP_win64_spmd || CPP_mach == CPP_p4win64_spmd || CPP_mach == CPP_wnt || CPP_mach == CPP_wmr || CPP_mach == CPP_p4win64 || CPP_mach == CPP_p4win32
26
27#define _FCALL
28
29#elif 1
30#define _FCALL
31#endif
32
33
34
35#if CPP_mach==CPP_linux || CPP_mach == CPP_linux64_spmd || CPP_mach == CPP_p4linux964_spmd || CPP_mach == CPP_il_spmd || CPP_mach == CPP_il || CPP_mach == CPP_linux_spmd || CPP_mach == CPP_linux || CPP_mach == CPP_linux964 || CPP_mach == CPP_p4linux964
36
37#include <stdio.h>
38#include <sys/resource.h>
39
40void set_stack_c_(int * stack){
41
42 const rlim_t kStackSize = -1L; // -1L = Unlimited
43 struct rlimit rl;
44 long int StMB;
45 int result;
46
47 result = getrlimit(RLIMIT_STACK, &rl);
48
49 if (rl.rlim_cur != -1){
50 /* Current Stacksize not unlimited */
51
52 /* Set the Stacksize to the Max possible value (best is unlimited : -1) */
53 if (rl.rlim_max != -1L){
54 rl.rlim_cur = rl.rlim_max;
55 }else{
56 rl.rlim_cur = kStackSize;
57 }
58
59 result = setrlimit(RLIMIT_STACK, &rl);
60
61 }
62 StMB = rl.rlim_cur / (1024*1024);
63 *stack = StMB;
64}
65
66#elif 1
67void set_stack_c_(int * stack){
68 *stack = 0;
69 }
70#endif
71
72
73void set_stack_c__(int * stack){
74 set_stack_c_(stack);
75
76 }
77
78void _FCALL SET_STACK_C (int * stack){
79 set_stack_c_(stack);
80
81 }
#define _FCALL
void set_stack_c__(int *stack)
Definition stacksize_c.c:73
void _FCALL SET_STACK_C(int *stack)
Definition stacksize_c.c:78
void set_stack_c_(int *stack)
Definition stacksize_c.c:40