Annotation of rpl/src/instructions_m5.c, revision 1.1

1.1     ! bertrand    1: /*
        !             2: ================================================================================
        !             3:   RPL/2 (R) version 4.0.15
        !             4:   Copyright (C) 1989-2010 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:    {
        !            76:        if (mlockall(MCL_CURRENT | MCL_FUTURE) != 0)
        !            77:        {
        !            78:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !            79:            return;
        !            80:        }
        !            81:    }
        !            82:    else
        !            83:    {
        !            84:        if ((*s_etat_processus).langue == 'F')
        !            85:        {
        !            86:            printf("+++Attention : Verrouillage en mémoire du processus "
        !            87:                    "indisponible !\n");
        !            88:        }
        !            89:        else
        !            90:        {
        !            91:            printf("+++Warning : Lock process in memory not available !\n");
        !            92:        }
        !            93: 
        !            94:        fflush(stdout);
        !            95:    }
        !            96: 
        !            97:    return;
        !            98: }
        !            99: 
        !           100: 
        !           101: /*
        !           102: ================================================================================
        !           103:   Fonction 'memunlock'
        !           104: ================================================================================
        !           105:   Entrées :
        !           106: --------------------------------------------------------------------------------
        !           107:   Sorties :
        !           108: --------------------------------------------------------------------------------
        !           109:   Effets de bord : néant
        !           110: ================================================================================
        !           111: */
        !           112: 
        !           113: void
        !           114: instruction_memunlock(struct_processus *s_etat_processus)
        !           115: {
        !           116:    (*s_etat_processus).erreur_execution = d_ex;
        !           117: 
        !           118:    if ((*s_etat_processus).affichage_arguments == 'Y')
        !           119:    {
        !           120:        printf("\n  MEMLOCK ");
        !           121: 
        !           122:        if ((*s_etat_processus).langue == 'F')
        !           123:        {
        !           124:            printf("(déverrouille le processus de la mémoire)\n\n");
        !           125:            printf("  Aucun argument\n");
        !           126:        }
        !           127:        else
        !           128:        {
        !           129:            printf("(unlock process from memory)\n\n");
        !           130:            printf("  No argument\n");
        !           131:        }
        !           132: 
        !           133:        return;
        !           134:    }
        !           135:    else if ((*s_etat_processus).test_instruction == 'Y')
        !           136:    {
        !           137:        (*s_etat_processus).nombre_arguments = -1;
        !           138:        return;
        !           139:    }
        !           140: 
        !           141:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
        !           142:    {
        !           143:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
        !           144:        {
        !           145:            return;
        !           146:        }
        !           147:    }
        !           148: 
        !           149:    if (_POSIX_MEMLOCK > 0)
        !           150:    {
        !           151:        if (munlockall() != 0)
        !           152:        {
        !           153:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           154:            return;
        !           155:        }
        !           156:    }
        !           157:    else
        !           158:    {
        !           159:        if ((*s_etat_processus).langue == 'F')
        !           160:        {
        !           161:            printf("+++Attention : Verrouillage en mémoire du processus "
        !           162:                    "indisponible !\n");
        !           163:        }
        !           164:        else
        !           165:        {
        !           166:            printf("+++Warning : Lock process in memory not available !\n");
        !           167:        }
        !           168: 
        !           169:        fflush(stdout);
        !           170:    }
        !           171: 
        !           172:    return;
        !           173: }
        !           174: 
        !           175: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>