version 1.41, 2011/06/11 09:36:31
|
version 1.123, 2025/04/15 10:17:49
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.0.prerelease.0 |
RPL/2 (R) version 4.1.36 |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
Copyright (C) 1989-2025 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 61 creation_instruction(struct_processus *s
|
Line 61 creation_instruction(struct_processus *s
|
(*(*s_etat_processus).arbre_instructions).feuille = NULL; |
(*(*s_etat_processus).arbre_instructions).feuille = NULL; |
|
|
if (((*(*s_etat_processus).arbre_instructions).noeuds = |
if (((*(*s_etat_processus).arbre_instructions).noeuds = |
malloc((*s_etat_processus).nombre_caracteres |
malloc(((size_t) (*s_etat_processus).nombre_caracteres) |
* sizeof(struct_instruction))) == NULL) |
* sizeof(struct_instruction))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 101 creation_instruction(struct_processus *s
|
Line 101 creation_instruction(struct_processus *s
|
|
|
if (((*(*l_instruction_courante).noeuds[(*s_etat_processus) |
if (((*(*l_instruction_courante).noeuds[(*s_etat_processus) |
.pointeurs_caracteres[*ptr]]).noeuds = |
.pointeurs_caracteres[*ptr]]).noeuds = |
malloc((*s_etat_processus).nombre_caracteres |
malloc(((size_t) (*s_etat_processus).nombre_caracteres) |
* sizeof(struct_instruction))) == NULL) |
* sizeof(struct_instruction))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 180 initialisation_instructions(struct_proce
|
Line 180 initialisation_instructions(struct_proce
|
} |
} |
|
|
if (((*s_etat_processus).pointeurs_caracteres = |
if (((*s_etat_processus).pointeurs_caracteres = |
malloc(longueur_tableau * sizeof(int))) == NULL) |
malloc(((size_t) longueur_tableau * sizeof(int)))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 323 initialisation_instructions(struct_proce
|
Line 323 initialisation_instructions(struct_proce
|
INSTRUCTION("EGV", instruction_egv); |
INSTRUCTION("EGV", instruction_egv); |
INSTRUCTION("END", instruction_end); |
INSTRUCTION("END", instruction_end); |
INSTRUCTION("ENG", instruction_eng); |
INSTRUCTION("ENG", instruction_eng); |
|
INSTRUCTION("EQV", instruction_eqv); |
INSTRUCTION("EXP", instruction_exp); |
INSTRUCTION("EXP", instruction_exp); |
INSTRUCTION("FC?", instruction_fc_test); |
INSTRUCTION("FC?", instruction_fc_test); |
INSTRUCTION("FFT", instruction_fft); |
INSTRUCTION("FFT", instruction_fft); |
Line 458 initialisation_instructions(struct_proce
|
Line 459 initialisation_instructions(struct_proce
|
INSTRUCTION("INCR", instruction_incr); |
INSTRUCTION("INCR", instruction_incr); |
//INSTRUCTION("ISOL"); |
//INSTRUCTION("ISOL"); |
INSTRUCTION("ISWI", instruction_iswi); |
INSTRUCTION("ISWI", instruction_iswi); |
# ifndef OS2 |
|
INSTRUCTION("KILL", instruction_kill); |
INSTRUCTION("KILL", instruction_kill); |
# endif |
|
INSTRUCTION("KIND", instruction_kind); |
INSTRUCTION("KIND", instruction_kind); |
INSTRUCTION("LAST", instruction_last); |
INSTRUCTION("LAST", instruction_last); |
INSTRUCTION("LEGV", instruction_legv); |
INSTRUCTION("LEGV", instruction_legv); |
Line 488 initialisation_instructions(struct_proce
|
Line 487 initialisation_instructions(struct_proce
|
INSTRUCTION("PLOT", instruction_plot); |
INSTRUCTION("PLOT", instruction_plot); |
INSTRUCTION("PMAX", instruction_pmax); |
INSTRUCTION("PMAX", instruction_pmax); |
INSTRUCTION("PMIN", instruction_pmin); |
INSTRUCTION("PMIN", instruction_pmin); |
# ifndef OS2 |
|
INSTRUCTION("POKE", instruction_poke); |
INSTRUCTION("POKE", instruction_poke); |
# endif |
INSTRUCTION("POLL", instruction_poll); |
INSTRUCTION("PPAR", instruction_ppar); |
INSTRUCTION("PPAR", instruction_ppar); |
INSTRUCTION("PRMD", instruction_prmd); |
INSTRUCTION("PRMD", instruction_prmd); |
INSTRUCTION("PRST", instruction_prst); |
INSTRUCTION("PRST", instruction_prst); |
Line 516 initialisation_instructions(struct_proce
|
Line 514 initialisation_instructions(struct_proce
|
INSTRUCTION("RECV", instruction_recv); |
INSTRUCTION("RECV", instruction_recv); |
INSTRUCTION("REGV", instruction_regv); |
INSTRUCTION("REGV", instruction_regv); |
INSTRUCTION("REPL", instruction_repl); |
INSTRUCTION("REPL", instruction_repl); |
|
INSTRUCTION("RGDL", instruction_rgdl); |
|
INSTRUCTION("RGDR", instruction_rgdr); |
INSTRUCTION("RNRM", instruction_rnrm); |
INSTRUCTION("RNRM", instruction_rnrm); |
INSTRUCTION("ROLL", instruction_roll); |
INSTRUCTION("ROLL", instruction_roll); |
//INSTRUCTION("ROOT") |
//INSTRUCTION("ROOT") |
Line 544 initialisation_instructions(struct_proce
|
Line 544 initialisation_instructions(struct_proce
|
INSTRUCTION("SPAR", instruction_spar); |
INSTRUCTION("SPAR", instruction_spar); |
INSTRUCTION("SQRT", instruction_sqrt); |
INSTRUCTION("SQRT", instruction_sqrt); |
//INSTRUCTION("SRAD"); |
//INSTRUCTION("SRAD"); |
|
INSTRUCTION("SREV", instruction_srev); |
//INSTRUCTION("SRNM") |
//INSTRUCTION("SRNM") |
//Instruction HP48 (renvoie la norme spectrale d'un tableau. Pour une |
//Instruction HP48 (renvoie la norme spectrale d'un tableau. Pour une |
//matrice, |
//matrice, |
Line 556 initialisation_instructions(struct_proce
|
Line 557 initialisation_instructions(struct_proce
|
INSTRUCTION("STO-", instruction_sto_moins); |
INSTRUCTION("STO-", instruction_sto_moins); |
INSTRUCTION("STO/", instruction_sto_division); |
INSTRUCTION("STO/", instruction_sto_division); |
INSTRUCTION("STOF", instruction_stof); |
INSTRUCTION("STOF", instruction_stof); |
# ifndef OS2 |
|
INSTRUCTION("STOP", instruction_stop); |
INSTRUCTION("STOP", instruction_stop); |
# endif |
|
INSTRUCTION("STOS", instruction_stos); |
INSTRUCTION("STOS", instruction_stos); |
INSTRUCTION("STWS", instruction_stws); |
INSTRUCTION("STWS", instruction_stws); |
INSTRUCTION("SWAP", instruction_swap); |
INSTRUCTION("SWAP", instruction_swap); |
Line 652 initialisation_instructions(struct_proce
|
Line 651 initialisation_instructions(struct_proce
|
INSTRUCTION("LCASE", instruction_lcase); |
INSTRUCTION("LCASE", instruction_lcase); |
INSTRUCTION("LCHOL", instruction_lchol); |
INSTRUCTION("LCHOL", instruction_lchol); |
INSTRUCTION("LCD->", instruction_lcd_fleche); |
INSTRUCTION("LCD->", instruction_lcd_fleche); |
|
INSTRUCTION("LIMIT", instruction_limit); |
//INSTRUCTION("NDIST") |
//INSTRUCTION("NDIST") |
//Instruction HP48 (distribution normale, prend la moyenne au niveau 3, |
//Instruction HP48 (distribution normale, prend la moyenne au niveau 3, |
//la variance au niveau 2, un réel x au niveau 1 et renvoie la probabilité |
//la variance au niveau 2, un réel x au niveau 1 et renvoie la probabilité |
Line 680 initialisation_instructions(struct_proce
|
Line 680 initialisation_instructions(struct_proce
|
INSTRUCTION("PSDEV", instruction_psdev); |
INSTRUCTION("PSDEV", instruction_psdev); |
INSTRUCTION("PURGE", instruction_purge); |
INSTRUCTION("PURGE", instruction_purge); |
INSTRUCTION("RDATE", instruction_rdate); |
INSTRUCTION("RDATE", instruction_rdate); |
|
INSTRUCTION("REGEX", instruction_regex); |
INSTRUCTION("RELAX", instruction_relax); |
INSTRUCTION("RELAX", instruction_relax); |
INSTRUCTION("RFUSE", instruction_rfuse); |
INSTRUCTION("RFUSE", instruction_rfuse); |
INSTRUCTION("RSTOP", instruction_rstop); |
INSTRUCTION("RSTOP", instruction_rstop); |
Line 692 initialisation_instructions(struct_proce
|
Line 693 initialisation_instructions(struct_proce
|
INSTRUCTION("SLICE", instruction_slice); |
INSTRUCTION("SLICE", instruction_slice); |
//INSTRUCTION("SLIST") |
//INSTRUCTION("SLIST") |
//Instruction HP48 (somme des termes d'une liste) |
//Instruction HP48 (somme des termes d'une liste) |
# ifndef OS2 |
|
INSTRUCTION("SPAWN", instruction_spawn); |
INSTRUCTION("SPAWN", instruction_spawn); |
# endif |
|
INSTRUCTION("START", instruction_start); |
INSTRUCTION("START", instruction_start); |
INSTRUCTION("STORE", instruction_store); |
INSTRUCTION("STORE", instruction_store); |
INSTRUCTION("STR->", instruction_str_fleche); |
INSTRUCTION("STR->", instruction_str_fleche); |
Line 726 initialisation_instructions(struct_proce
|
Line 725 initialisation_instructions(struct_proce
|
INSTRUCTION("ATEXIT", instruction_atexit); |
INSTRUCTION("ATEXIT", instruction_atexit); |
INSTRUCTION("ATPOKE", instruction_atpoke); |
INSTRUCTION("ATPOKE", instruction_atpoke); |
INSTRUCTION("BESSEL", instruction_bessel); |
INSTRUCTION("BESSEL", instruction_bessel); |
|
INSTRUCTION("CIPHER", instruction_cipher); |
INSTRUCTION("CLRERR", instruction_clrerr); |
INSTRUCTION("CLRERR", instruction_clrerr); |
INSTRUCTION("CLRMTX", instruction_clrmtx); |
INSTRUCTION("CLRMTX", instruction_clrmtx); |
INSTRUCTION("CLRSWI", instruction_clrswi); |
INSTRUCTION("CLRSWI", instruction_clrswi); |
INSTRUCTION("CREATE", instruction_create); |
INSTRUCTION("CREATE", instruction_create); |
INSTRUCTION("DELETE", instruction_delete); |
INSTRUCTION("DELETE", instruction_delete); |
# ifndef OS2 |
# ifdef SHARED_MEMORY |
INSTRUCTION("DETACH", instruction_detach); |
INSTRUCTION("DETACH", instruction_detach); |
|
# else |
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Attention : DETACH est émulé par SPAWN car le système" |
|
" hôte ne supporte\n" |
|
" pas de mémoire partagée !\n"); |
|
} |
|
else |
|
{ |
|
printf("+++Warning : DETACH is replaced by SPAWN as host system" |
|
" does not support\n" |
|
" shared memory !\n"); |
|
} |
|
|
|
INSTRUCTION("DETACH", instruction_spawn); |
# endif |
# endif |
INSTRUCTION("DIAG->", instruction_diag_fleche); |
INSTRUCTION("DIAG->", instruction_diag_fleche); |
|
INSTRUCTION("DIGEST", instruction_digest); |
//INSTRUCTION("DOLIST") |
//INSTRUCTION("DOLIST") |
//Instruction HP48 (application d'une fonction à une liste) |
//Instruction HP48 (application d'une fonction à une liste) |
//liste(s) nombre_de_listes_a_traiter fonction DOLIST |
//liste(s) nombre_de_listes_a_traiter fonction DOLIST |
Line 746 initialisation_instructions(struct_proce
|
Line 762 initialisation_instructions(struct_proce
|
//DOLIST |
//DOLIST |
//=> { 29 42 57 } |
//=> { 29 42 57 } |
INSTRUCTION("ELSEIF", instruction_elseif); |
INSTRUCTION("ELSEIF", instruction_elseif); |
|
INSTRUCTION("FORALL", instruction_forall); |
INSTRUCTION("FORMAT", instruction_format); |
INSTRUCTION("FORMAT", instruction_format); |
//INSTRUCTION("HEIGHT") |
//INSTRUCTION("HEIGHT") |
INSTRUCTION("ITRACE", instruction_itrace); |
INSTRUCTION("ITRACE", instruction_itrace); |
Line 758 initialisation_instructions(struct_proce
|
Line 775 initialisation_instructions(struct_proce
|
INSTRUCTION("RCLSWI", instruction_rclswi); |
INSTRUCTION("RCLSWI", instruction_rclswi); |
INSTRUCTION("RECALL", instruction_recall); |
INSTRUCTION("RECALL", instruction_recall); |
INSTRUCTION("RECODE", instruction_recode); |
INSTRUCTION("RECODE", instruction_recode); |
|
INSTRUCTION("RECORD", instruction_record); |
INSTRUCTION("REDRAW", instruction_redraw); |
INSTRUCTION("REDRAW", instruction_redraw); |
INSTRUCTION("REMOVE", instruction_remove); |
INSTRUCTION("REMOVE", instruction_remove); |
INSTRUCTION("REPEAT", instruction_repeat); |
INSTRUCTION("REPEAT", instruction_repeat); |
Line 789 initialisation_instructions(struct_proce
|
Line 807 initialisation_instructions(struct_proce
|
//INSTRUCTION("BESTFIT") |
//INSTRUCTION("BESTFIT") |
//Instruction HP48 (choisit le meilleur modèle de régression) |
//Instruction HP48 (choisit le meilleur modèle de régression) |
INSTRUCTION("CLRFUSE", instruction_clrfuse); |
INSTRUCTION("CLRFUSE", instruction_clrfuse); |
|
INSTRUCTION("CLRSOCK", instruction_clrsock); |
INSTRUCTION("CONVERT", instruction_convert); |
INSTRUCTION("CONVERT", instruction_convert); |
INSTRUCTION("CRSMPHR", instruction_crsmphr); |
INSTRUCTION("CRSMPHR", instruction_crsmphr); |
INSTRUCTION("CURRENC", instruction_currenc); |
INSTRUCTION("CURRENC", instruction_currenc); |
Line 808 initialisation_instructions(struct_proce
|
Line 827 initialisation_instructions(struct_proce
|
INSTRUCTION("INQUIRE", instruction_inquire); |
INSTRUCTION("INQUIRE", instruction_inquire); |
INSTRUCTION("MEMLOCK", instruction_memlock); |
INSTRUCTION("MEMLOCK", instruction_memlock); |
INSTRUCTION("MTXLOCK", instruction_mtxlock); |
INSTRUCTION("MTXLOCK", instruction_mtxlock); |
|
INSTRUCTION("NBRCPUS", instruction_nbrcpus); |
INSTRUCTION("PERSIST", instruction_persist); |
INSTRUCTION("PERSIST", instruction_persist); |
INSTRUCTION("PLOTTER", instruction_plotter); |
INSTRUCTION("PLOTTER", instruction_plotter); |
INSTRUCTION("PRIVATE", instruction_private); |
INSTRUCTION("PRIVATE", instruction_private); |
INSTRUCTION("PROTECT", instruction_protect); |
INSTRUCTION("PROTECT", instruction_protect); |
INSTRUCTION("PSHPRFL", instruction_pshprfl); |
INSTRUCTION("PSHPRFL", instruction_pshprfl); |
INSTRUCTION("PULPRFL", instruction_pulprfl); |
INSTRUCTION("PULPRFL", instruction_pulprfl); |
|
INSTRUCTION("RESTART", instruction_restart); |
INSTRUCTION("REVLIST", instruction_revlist); |
INSTRUCTION("REVLIST", instruction_revlist); |
INSTRUCTION("SCATTER", instruction_scatter); |
INSTRUCTION("SCATTER", instruction_scatter); |
INSTRUCTION("SUSPEND", instruction_suspend); |
INSTRUCTION("SUSPEND", instruction_suspend); |
Line 827 initialisation_instructions(struct_proce
|
Line 848 initialisation_instructions(struct_proce
|
|
|
INSTRUCTION("CLRCNTXT", instruction_clrcntxt); |
INSTRUCTION("CLRCNTXT", instruction_clrcntxt); |
INSTRUCTION("CLRSMPHR", instruction_clrsmphr); |
INSTRUCTION("CLRSMPHR", instruction_clrsmphr); |
# ifndef OS2 |
INSTRUCTION("COMPRESS", instruction_compress); |
INSTRUCTION("CONTINUE", instruction_continue); |
INSTRUCTION("CONTINUE", instruction_continue); |
# endif |
INSTRUCTION("CRITICAL", instruction_critical); |
INSTRUCTION("DUPCNTXT", instruction_dupcntxt); |
INSTRUCTION("DUPCNTXT", instruction_dupcntxt); |
INSTRUCTION("FUNCTION", instruction_function); |
INSTRUCTION("FUNCTION", instruction_function); |
INSTRUCTION("IMPLICIT", instruction_implicit); |
INSTRUCTION("IMPLICIT", instruction_implicit); |
|
INSTRUCTION("INFINITY", instruction_sensible_infinity); |
INSTRUCTION("KEYLABEL", instruction_keylabel); |
INSTRUCTION("KEYLABEL", instruction_keylabel); |
INSTRUCTION("KEYTITLE", instruction_keytitle); |
INSTRUCTION("KEYTITLE", instruction_keytitle); |
INSTRUCTION("LOGSCALE", instruction_logscale); |
INSTRUCTION("LOGSCALE", instruction_logscale); |
Line 886 initialisation_instructions(struct_proce
|
Line 908 initialisation_instructions(struct_proce
|
//pentes |
//pentes |
//représentent la valeur de la fonction (x,y) en leur milieu. |
//représentent la valeur de la fonction (x,y) en leur milieu. |
//=> utile pour y'=F(x,y) |
//=> utile pour y'=F(x,y) |
|
INSTRUCTION("UNCOMPRESS", instruction_uncompress); |
|
|
INSTRUCTION("LOCALIZATION", instruction_localization); |
INSTRUCTION("LOCALIZATION", instruction_localization); |
INSTRUCTION("SMPHRTRYDECR", instruction_smphrtrydecr); |
INSTRUCTION("SMPHRTRYDECR", instruction_smphrtrydecr); |
Line 947 analyse_instruction(struct_processus *s_
|
Line 970 analyse_instruction(struct_processus *s_
|
void |
void |
analyse(struct_processus *s_etat_processus, void (*fonction)()) |
analyse(struct_processus *s_etat_processus, void (*fonction)()) |
{ |
{ |
static logical1 initialisation = d_faux; |
|
|
|
real8 attente; |
real8 attente; |
real8 pourcentage; |
real8 pourcentage; |
real8 temps_cpu; |
real8 temps_cpu; |
Line 957 analyse(struct_processus *s_etat_process
|
Line 978 analyse(struct_processus *s_etat_process
|
static struct timeval horodatage_initial; |
static struct timeval horodatage_initial; |
struct timeval horodatage_final; |
struct timeval horodatage_final; |
|
|
|
# ifndef OS2 |
static struct rusage usage_initial; |
static struct rusage usage_initial; |
struct rusage usage_final; |
struct rusage usage_final; |
|
# else |
|
static clock_t usage_initial; |
|
clock_t usage_final; |
|
# endif |
|
|
struct timespec temporisation; |
struct timespec temporisation; |
|
|
Line 983 analyse(struct_processus *s_etat_process
|
Line 1009 analyse(struct_processus *s_etat_process
|
*/ |
*/ |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
# ifndef SEMAPHORES_NOMMES |
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 997 analyse(struct_processus *s_etat_process
|
Line 1030 analyse(struct_processus *s_etat_process
|
return; |
return; |
} |
} |
} |
} |
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
/* |
|
* Verrou pour les sections_critiques |
|
*/ |
|
|
|
if (pthread_mutex_lock(&mutex_sections_critiques) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
if (pthread_mutex_unlock(&mutex_sections_critiques) != 0) |
{ |
{ |
if (errno != EINTR) |
(*s_etat_processus).erreur_systeme = d_es_processus; |
{ |
return; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
} |
} |
# endif |
|
|
|
scrutation_injection(s_etat_processus); |
scrutation_injection(s_etat_processus); |
|
|
Line 1076 analyse(struct_processus *s_etat_process
|
Line 1109 analyse(struct_processus *s_etat_process
|
if ((position = index((*s_etat_processus).instruction_courante, '$')) |
if ((position = index((*s_etat_processus).instruction_courante, '$')) |
!= NULL) |
!= NULL) |
{ |
{ |
if ((bibliotheque_candidate = malloc((position + 1 |
if ((bibliotheque_candidate = malloc(((size_t) (position + 1 |
- (*s_etat_processus).instruction_courante) |
- (*s_etat_processus).instruction_courante)) |
* sizeof(unsigned char))) == NULL) |
* sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 1086 analyse(struct_processus *s_etat_process
|
Line 1119 analyse(struct_processus *s_etat_process
|
|
|
(*bibliotheque_candidate) = d_code_fin_chaine; |
(*bibliotheque_candidate) = d_code_fin_chaine; |
strncat(bibliotheque_candidate, |
strncat(bibliotheque_candidate, |
(*s_etat_processus).instruction_courante, |
(*s_etat_processus).instruction_courante, ((size_t) |
position - (*s_etat_processus).instruction_courante); |
(position - (*s_etat_processus).instruction_courante))); |
|
|
position++; |
position++; |
|
|
Line 1132 analyse(struct_processus *s_etat_process
|
Line 1165 analyse(struct_processus *s_etat_process
|
{ |
{ |
if ((*s_etat_processus).test_instruction == 'N') |
if ((*s_etat_processus).test_instruction == 'N') |
{ |
{ |
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
if (pthread_mutex_lock(&(*s_etat_processus).mutex_interruptions) |
|
!= 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
} |
|
else |
{ |
{ |
affectation_interruptions_logicielles(s_etat_processus); |
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
|
{ |
|
affectation_interruptions_logicielles(s_etat_processus); |
|
} |
|
|
|
if (pthread_mutex_unlock(&(*s_etat_processus) |
|
.mutex_interruptions) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
} |
} |
} |
|
|
if (((*s_etat_processus).nombre_interruptions_en_queue != 0) && |
if (((*s_etat_processus).nombre_interruptions_en_queue != 0) && |
Line 1157 analyse(struct_processus *s_etat_process
|
Line 1204 analyse(struct_processus *s_etat_process
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
# ifndef OS2 |
|
if ((*s_etat_processus).pourcentage_maximal_cpu < 100) |
if ((*s_etat_processus).pourcentage_maximal_cpu < 100) |
{ |
{ |
|
# ifndef OS2 |
getrusage(RUSAGE_SELF, &usage_final); |
getrusage(RUSAGE_SELF, &usage_final); |
|
# else |
|
usage_final = clock(); |
|
# endif |
|
|
gettimeofday(&horodatage_final, NULL); |
gettimeofday(&horodatage_final, NULL); |
|
|
if (initialisation == d_vrai) |
if ((*s_etat_processus).initialisation_scheduler == d_vrai) |
{ |
{ |
temps_reel = ((real8) (horodatage_final.tv_sec - |
temps_reel = ((real8) (horodatage_final.tv_sec - |
horodatage_initial.tv_sec)) + |
horodatage_initial.tv_sec)) + |
(((real8) (horodatage_final.tv_usec - |
(((real8) (horodatage_final.tv_usec - |
horodatage_initial.tv_usec)) / ((real8) 1E6)); |
horodatage_initial.tv_usec)) / ((real8) 1E6)); |
|
|
|
// Le temps depuis la dernière limitation est de plus de un |
|
// dixième de seconde. |
|
|
if (temps_reel >= 0.1) |
if (temps_reel >= 0.1) |
{ |
{ |
|
# ifndef OS2 |
temps_cpu = ((real8) ((usage_final.ru_utime.tv_sec + |
temps_cpu = ((real8) ((usage_final.ru_utime.tv_sec + |
usage_final.ru_stime.tv_sec) - |
usage_final.ru_stime.tv_sec) - |
(usage_initial.ru_utime.tv_sec + |
(usage_initial.ru_utime.tv_sec + |
Line 1180 analyse(struct_processus *s_etat_process
|
Line 1235 analyse(struct_processus *s_etat_process
|
usage_final.ru_stime.tv_usec) - |
usage_final.ru_stime.tv_usec) - |
(usage_initial.ru_utime.tv_usec + |
(usage_initial.ru_utime.tv_usec + |
usage_initial.ru_stime.tv_usec))) / ((real8) 1E6)); |
usage_initial.ru_stime.tv_usec))) / ((real8) 1E6)); |
|
# else |
|
temps_cpu = (usage_final - usage_initial) / CLOCKS_PER_SEC; |
|
# endif |
|
|
pourcentage = 100 * temps_cpu / temps_reel; |
pourcentage = 100 * temps_cpu / temps_reel; |
|
|
Line 1194 analyse(struct_processus *s_etat_process
|
Line 1252 analyse(struct_processus *s_etat_process
|
(*s_etat_processus).pourcentage_maximal_cpu) |
(*s_etat_processus).pourcentage_maximal_cpu) |
- (pourcentage * temps_cpu / 100); |
- (pourcentage * temps_cpu / 100); |
|
|
temporisation.tv_sec = floor(attente); |
temporisation.tv_sec = (time_t) floor(attente); |
temporisation.tv_nsec = (attente - temporisation.tv_sec) * |
temporisation.tv_nsec = (suseconds_t) ((attente |
1E9; |
- ((real8) temporisation.tv_sec)) * 1E9); |
|
|
nanosleep(&temporisation, NULL); |
while(nanosleep(&temporisation, &temporisation) == -1) |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
break; |
|
} |
|
} |
} |
} |
|
|
horodatage_initial = horodatage_final; |
horodatage_initial = horodatage_final; |
Line 1207 analyse(struct_processus *s_etat_process
|
Line 1271 analyse(struct_processus *s_etat_process
|
} |
} |
else |
else |
{ |
{ |
initialisation = d_vrai; |
(*s_etat_processus).initialisation_scheduler = d_vrai; |
|
|
horodatage_initial = horodatage_final; |
horodatage_initial = horodatage_final; |
usage_initial = usage_final; |
usage_initial = usage_final; |
} |
} |
} |
} |
# endif |
else |
|
{ |
|
(*s_etat_processus).initialisation_scheduler = d_faux; |
|
} |
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |