1: /*
2: ================================================================================
3: RPL/2 (R) version 4.1.36
4: Copyright (C) 1989-2025 Dr. BERTRAND Joël
5:
6: This file is part of RPL/2.
7:
8: RPL/2 is free software; you can redistribute it and/or modify it
9: under the terms of the CeCILL V2 License as published by the french
10: CEA, CNRS and INRIA.
11:
12: RPL/2 is distributed in the hope that it will be useful, but WITHOUT
13: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14: FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL V2 License
15: for more details.
16:
17: You should have received a copy of the CeCILL License
18: along with RPL/2. If not, write to info@cecill.info.
19: ================================================================================
20: */
21:
22:
23: #include "rpl-conv.h"
24:
25:
26: /*
27: ================================================================================
28: Fonction 'memlock'
29: ================================================================================
30: Entrées :
31: --------------------------------------------------------------------------------
32: Sorties :
33: --------------------------------------------------------------------------------
34: Effets de bord : néant
35: ================================================================================
36: */
37:
38: void
39: instruction_memlock(struct_processus *s_etat_processus)
40: {
41: (*s_etat_processus).erreur_execution = d_ex;
42:
43: if ((*s_etat_processus).affichage_arguments == 'Y')
44: {
45: printf("\n MEMLOCK ");
46:
47: if ((*s_etat_processus).langue == 'F')
48: {
49: printf("(verrouille le processus en mémoire)\n\n");
50: printf(" Aucun argument\n");
51: }
52: else
53: {
54: printf("(lock process in memory)\n\n");
55: printf(" No argument\n");
56: }
57:
58: return;
59: }
60: else if ((*s_etat_processus).test_instruction == 'Y')
61: {
62: (*s_etat_processus).nombre_arguments = -1;
63: return;
64: }
65:
66: if (test_cfsf(s_etat_processus, 31) == d_vrai)
67: {
68: if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
69: {
70: return;
71: }
72: }
73:
74: # if _POSIX_MEMLOCK > 0
75: if (mlockall(MCL_CURRENT | MCL_FUTURE) != 0)
76: {
77: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
78: return;
79: }
80: # else
81: if ((*s_etat_processus).langue == 'F')
82: {
83: printf("+++Attention : Verrouillage en mémoire du processus "
84: "indisponible !\n");
85: }
86: else
87: {
88: printf("+++Warning : Lock process in memory not available !\n");
89: }
90:
91: fflush(stdout);
92: # endif
93:
94: return;
95: }
96:
97:
98: /*
99: ================================================================================
100: Fonction 'memunlock'
101: ================================================================================
102: Entrées :
103: --------------------------------------------------------------------------------
104: Sorties :
105: --------------------------------------------------------------------------------
106: Effets de bord : néant
107: ================================================================================
108: */
109:
110: void
111: instruction_memunlock(struct_processus *s_etat_processus)
112: {
113: (*s_etat_processus).erreur_execution = d_ex;
114:
115: if ((*s_etat_processus).affichage_arguments == 'Y')
116: {
117: printf("\n MEMUNLOCK ");
118:
119: if ((*s_etat_processus).langue == 'F')
120: {
121: printf("(déverrouille le processus de la mémoire)\n\n");
122: printf(" Aucun argument\n");
123: }
124: else
125: {
126: printf("(unlock process from memory)\n\n");
127: printf(" No argument\n");
128: }
129:
130: return;
131: }
132: else if ((*s_etat_processus).test_instruction == 'Y')
133: {
134: (*s_etat_processus).nombre_arguments = -1;
135: return;
136: }
137:
138: if (test_cfsf(s_etat_processus, 31) == d_vrai)
139: {
140: if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
141: {
142: return;
143: }
144: }
145:
146: # if _POSIX_MEMLOCK > 0
147: if (munlockall() != 0)
148: {
149: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
150: return;
151: }
152: # else
153: if ((*s_etat_processus).langue == 'F')
154: {
155: printf("+++Attention : Verrouillage en mémoire du processus "
156: "indisponible !\n");
157: }
158: else
159: {
160: printf("+++Warning : Lock process in memory not available !\n");
161: }
162:
163: fflush(stdout);
164: # endif
165:
166: return;
167: }
168:
169: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>