/* ================================================================================ RPL/2 (R) version 4.1.32 Copyright (C) 1989-2020 Dr. BERTRAND Joël This file is part of RPL/2. RPL/2 is free software; you can redistribute it and/or modify it under the terms of the CeCILL V2 License as published by the french CEA, CNRS and INRIA. RPL/2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL V2 License for more details. You should have received a copy of the CeCILL License along with RPL/2. If not, write to info@cecill.info. ================================================================================ */ #include "rpl-conv.h" /* ================================================================================ Fonction 'memlock' ================================================================================ Entrées : -------------------------------------------------------------------------------- Sorties : -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ void instruction_memlock(struct_processus *s_etat_processus) { (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') { printf("\n MEMLOCK "); if ((*s_etat_processus).langue == 'F') { printf("(verrouille le processus en mémoire)\n\n"); printf(" Aucun argument\n"); } else { printf("(lock process in memory)\n\n"); printf(" No argument\n"); } return; } else if ((*s_etat_processus).test_instruction == 'Y') { (*s_etat_processus).nombre_arguments = -1; return; } if (test_cfsf(s_etat_processus, 31) == d_vrai) { if (empilement_pile_last(s_etat_processus, 0) == d_erreur) { return; } } # if _POSIX_MEMLOCK > 0 if (mlockall(MCL_CURRENT | MCL_FUTURE) != 0) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } # else if ((*s_etat_processus).langue == 'F') { printf("+++Attention : Verrouillage en mémoire du processus " "indisponible !\n"); } else { printf("+++Warning : Lock process in memory not available !\n"); } fflush(stdout); # endif return; } /* ================================================================================ Fonction 'memunlock' ================================================================================ Entrées : -------------------------------------------------------------------------------- Sorties : -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ void instruction_memunlock(struct_processus *s_etat_processus) { (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') { printf("\n MEMUNLOCK "); if ((*s_etat_processus).langue == 'F') { printf("(déverrouille le processus de la mémoire)\n\n"); printf(" Aucun argument\n"); } else { printf("(unlock process from memory)\n\n"); printf(" No argument\n"); } return; } else if ((*s_etat_processus).test_instruction == 'Y') { (*s_etat_processus).nombre_arguments = -1; return; } if (test_cfsf(s_etat_processus, 31) == d_vrai) { if (empilement_pile_last(s_etat_processus, 0) == d_erreur) { return; } } # if _POSIX_MEMLOCK > 0 if (munlockall() != 0) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } # else if ((*s_etat_processus).langue == 'F') { printf("+++Attention : Verrouillage en mémoire du processus " "indisponible !\n"); } else { printf("+++Warning : Lock process in memory not available !\n"); } fflush(stdout); # endif return; } // vim: ts=4