OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
machine_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 }
82
83
84#if CPP_mach == CPP_p4win64 || CPP_mach == CPP_p4win32
85#include <windows.h>
86#include <stdio.h>
87#include <tchar.h>
88
89
90void _FCALL RAD2RAD_CREATEPROCESS(char* command_line, int * len,int * ID,int * err )
91{
92 char* line;
93 int i,size;
94 STARTUPINFO si;
95 PROCESS_INFORMATION pi;
96
97 size= * len;
98 line = malloc(sizeof(char)*size+1);
99 for (i=0;i<size;i++) line[i] = command_line[i];
100 line[size] ='\0';
101
102 ZeroMemory(&si,sizeof(si) );
103 si.cb = sizeof(si);
104 ZeroMemory (&pi, sizeof(pi) );
105
106 * err = 0;
107 * ID = 0;
108 if ( ! CreateProcess (NULL,
109 line,
110 NULL,
111 NULL,
112 FALSE,
113 0,
114 NULL,
115 NULL,
116 &si,
117 &pi ) ){
118 printf("ERROR CREATING CHILD PROCESS : %i \n",GetLastError() );
119 *err = 1;
120 } else {
121 * err = 0;
122 * ID = (int) pi.hProcess;
123 }
124
125}
126#endif
#define FALSE
Definition cblas_test.h:14
void set_stack_c__(int *stack)
Definition machine_c.c:73
void _FCALL SET_STACK_C(int *stack)
Definition machine_c.c:78
void set_stack_c_(int *stack)
Definition machine_c.c:40
void _FCALL RAD2RAD_CREATEPROCESS(char *command_line, int *len, int *ID, int *err)
Definition machine_c.c:90
#define _FCALL