File:
[local] /
rpl /
src /
rpl.c
Revision
1.150:
download - view:
text,
annotated -
select for diffs -
revision graph
Fri Oct 4 07:54:50 2013 UTC (11 years, 7 months ago) by
bertrand
Branches:
MAIN
CVS tags:
rpl-4_1_16,
HEAD
Correction d'un problème du fichier rpl.inc permettant de lier librpl.a à des
programmes tiers. Changement de du prototype d'appel du RPL/2 depuis le C.
Il est maintenant possible de passer des paramètres à une fonction RPL/2.
1: /*
2: ================================================================================
3: RPL/2 (R) version 4.1.16
4: Copyright (C) 1989-2013 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: #define MAIN_RPL
24: #include "rpl-conv.h"
25:
26:
27: /*
28: ================================================================================
29: Programme principal
30: ================================================================================
31: */
32:
33: int
34: rplinit(int argc, char *argv[], char *envp[],
35: unsigned char ***resultats, char *rpl_home)
36: {
37: # include "copyright-conv.h"
38: # include "licence-conv.h"
39:
40: char **arg_exec;
41:
42: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
43: char pile_signaux[SIGSTKSZ];
44: # endif
45:
46: # define RPL_PATH_MAX 1024
47: char repertoire_initial[RPL_PATH_MAX];
48:
49: file *f_source;
50:
51: int erreur_historique;
52: int option_P;
53:
54: integer8 i;
55:
56: logical1 core;
57: logical1 debug;
58: logical1 erreur_fichier;
59: logical1 existence;
60: logical1 mode_interactif;
61: logical1 option_a;
62: logical1 option_A;
63: logical1 option_c;
64: logical1 option_d;
65: logical1 option_D;
66: logical1 option_h;
67: logical1 option_i;
68: logical1 option_l;
69: logical1 option_n;
70: logical1 option_p;
71: logical1 option_s;
72: logical1 option_S;
73: logical1 option_t;
74: logical1 option_v;
75: logical1 ouverture;
76:
77: pthread_mutexattr_t attributs_mutex;
78:
79: ssize_t longueur_ecriture;
80:
81: struct_objet *s_objet;
82:
83: struct_processus *s_etat_processus;
84:
85: struct_liste_variables_partagees *l_element_partage_courant;
86: struct_liste_variables_partagees *l_element_partage_suivant;
87:
88: struct_liste_variables_statiques *l_element_statique_courant;
89: struct_liste_variables_statiques *l_element_statique_suivant;
90:
91: struct_arbre_variables_partagees *s_arbre_variables_partagees;
92: struct_liste_variables_partagees *l_liste_variables_partagees;
93:
94: struct sigaction action;
95: struct sigaction registre;
96:
97: struct timespec attente;
98:
99: unsigned char *arguments;
100: unsigned char drapeau_encart;
101: unsigned char *type_debug;
102: unsigned char *home;
103: unsigned char *langue;
104: unsigned char *message;
105: unsigned char *nom_fichier_temporaire;
106: unsigned char option;
107: unsigned char presence_definition;
108: unsigned char *ptr;
109: unsigned char *tampon;
110:
111: unsigned long unite_fichier;
112:
113: void *l_element_courant;
114: void *l_element_suivant;
115:
116: volatile int erreur;
117: volatile unsigned char traitement_fichier_temporaire;
118:
119: errno = 0;
120: s_queue_signaux = NULL;
121: routine_recursive = 0;
122: pid_processus_pere = getpid();
123:
124: # ifdef DEBUG_MEMOIRE
125: debug_memoire_initialisation();
126: # endif
127:
128: setvbuf(stdout, NULL, _IOLBF, 0);
129: setvbuf(stderr, NULL, _IOLBF, 0);
130:
131: # ifndef SEMAPHORES_NOMMES
132: sem_init(&semaphore_gestionnaires_signaux, 0, 0);
133: # else
134: semaphore_gestionnaires_signaux = sem_init2(0, getpid(), SEM_SIGNAUX);
135:
136: if (semaphore_gestionnaires_signaux == SEM_FAILED)
137: {
138: erreur = d_es_allocation_memoire;
139:
140: if ((langue = getenv("LANG")) != NULL)
141: {
142: if (strncmp(langue, "fr", 2) == 0)
143: {
144: uprintf("+++Système : Mémoire insuffisante\n");
145: }
146: else
147: {
148: uprintf("+++System : Not enough memory\n");
149: }
150: }
151: else
152: {
153: uprintf("+++System : Not enough memory\n");
154: }
155:
156: return(EXIT_FAILURE);
157: }
158: # endif
159:
160: if ((s_etat_processus = malloc(sizeof(struct_processus))) == NULL)
161: {
162: # ifndef SEMAPHORES_NOMMES
163: sem_post(&semaphore_gestionnaires_signaux);
164: sem_destroy(&semaphore_gestionnaires_signaux);
165: # else
166: sem_post(semaphore_gestionnaires_signaux);
167: sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX);
168: # endif
169:
170: erreur = d_es_allocation_memoire;
171:
172: if ((langue = getenv("LANG")) != NULL)
173: {
174: if (strncmp(langue, "fr", 2) == 0)
175: {
176: uprintf("+++Système : Mémoire insuffisante\n");
177: }
178: else
179: {
180: uprintf("+++System : Not enough memory\n");
181: }
182: }
183: else
184: {
185: uprintf("+++System : Not enough memory\n");
186: }
187:
188: return(EXIT_FAILURE);
189: }
190:
191: if ((langue = getenv("LANG")) != NULL)
192: {
193: (*s_etat_processus).langue = (strncmp(langue, "fr", 2) == 0)
194: ? 'F' : 'E';
195: }
196: else
197: {
198: (*s_etat_processus).langue = 'E';
199: }
200:
201: if (getcwd(repertoire_initial, RPL_PATH_MAX) == NULL)
202: {
203: # ifndef SEMAPHORES_NOMMES
204: sem_post(&semaphore_gestionnaires_signaux);
205: sem_destroy(&semaphore_gestionnaires_signaux);
206: # else
207: sem_post(semaphore_gestionnaires_signaux);
208: sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX);
209: # endif
210:
211: if ((*s_etat_processus).langue == 'F')
212: {
213: uprintf("+++Système : Mémoire insuffisante\n");
214: }
215: else
216: {
217: uprintf("+++System : Not enough memory\n");
218: }
219:
220: return(EXIT_FAILURE);
221: }
222:
223: if ((arg_exec = malloc((((size_t) argc) + 1) * sizeof(char *))) == NULL)
224: {
225: # ifndef SEMAPHORES_NOMMES
226: sem_post(&semaphore_gestionnaires_signaux);
227: sem_destroy(&semaphore_gestionnaires_signaux);
228: # else
229: sem_post(semaphore_gestionnaires_signaux);
230: sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX);
231: # endif
232:
233: if ((*s_etat_processus).langue == 'F')
234: {
235: uprintf("+++Système : Mémoire insuffisante\n");
236: }
237: else
238: {
239: uprintf("+++System : Not enough memory\n");
240: }
241:
242: return(EXIT_FAILURE);
243: }
244:
245: for(i = 0; i < argc; i++)
246: {
247: arg_exec[i] = argv[i];
248: }
249:
250: argv[argc] = NULL;
251:
252: initialisation_contexte_cas(s_etat_processus);
253:
254: (*s_etat_processus).exception = d_ep;
255: (*s_etat_processus).erreur_systeme = d_es;
256: (*s_etat_processus).erreur_execution = d_ex;
257:
258: (*s_etat_processus).requete_redemarrage = d_faux;
259: (*s_etat_processus).rpl_home = rpl_home;
260:
261: pthread_mutexattr_init(&attributs_mutex);
262: pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
263: pthread_mutex_init(&((*s_etat_processus).mutex_pile_processus),
264: &attributs_mutex);
265: pthread_mutexattr_destroy(&attributs_mutex);
266:
267: pthread_mutexattr_init(&attributs_mutex);
268: pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
269: pthread_mutex_init(&((*s_etat_processus).mutex_interruptions),
270: &attributs_mutex);
271: pthread_mutexattr_destroy(&attributs_mutex);
272:
273: pthread_mutexattr_init(&attributs_mutex);
274: pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
275: pthread_mutex_init(&((*s_etat_processus).mutex_signaux),
276: &attributs_mutex);
277: pthread_mutexattr_destroy(&attributs_mutex);
278:
279: pthread_mutexattr_init(&attributs_mutex);
280: pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
281: pthread_mutex_init(&((*s_etat_processus).mutex_allocation),
282: &attributs_mutex);
283: pthread_mutexattr_destroy(&attributs_mutex);
284:
285: pthread_mutexattr_init(&attributs_mutex);
286: pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE);
287: pthread_mutex_init(&mutex_sections_critiques, &attributs_mutex);
288: pthread_mutexattr_destroy(&attributs_mutex);
289:
290: pthread_mutexattr_init(&attributs_mutex);
291: pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE);
292: pthread_mutex_init(&mutex_liste_variables_partagees, &attributs_mutex);
293: pthread_mutexattr_destroy(&attributs_mutex);
294:
295: # ifndef SEMAPHORES_NOMMES
296: sem_init(&((*s_etat_processus).semaphore_fork), 0, 0);
297: # else
298: if (((*s_etat_processus).semaphore_fork = sem_init3(0, getpid(),
299: pthread_self(), SEM_FORK)) == SEM_FAILED)
300: {
301: # ifndef SEMAPHORES_NOMMES
302: sem_post(&semaphore_gestionnaires_signaux);
303: sem_destroy(&semaphore_gestionnaires_signaux);
304: # else
305: sem_post(semaphore_gestionnaires_signaux);
306: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
307: SEM_SIGNAUX);
308: # endif
309:
310: liberation(contexte_cas(s_etat_processus);
311:
312: if ((*s_etat_processus).langue == 'F')
313: {
314: uprintf("+++Système : Mémoire insuffisante\n");
315: }
316: else
317: {
318: uprintf("+++System : Not enough memory\n");
319: }
320:
321: return(EXIT_FAILURE);
322: }
323: # endif
324:
325: pthread_mutexattr_init(&attributs_mutex);
326: pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
327: pthread_mutex_init(&((*s_etat_processus).protection_liste_mutexes),
328: &attributs_mutex);
329: pthread_mutexattr_destroy(&attributs_mutex);
330:
331: (*s_etat_processus).chemin_fichiers_temporaires =
332: recherche_chemin_fichiers_temporaires(s_etat_processus);
333:
334: insertion_thread(s_etat_processus, d_vrai);
335: creation_queue_signaux(s_etat_processus);
336:
337: if ((*s_etat_processus).erreur_systeme != d_es)
338: {
339: # ifndef SEMAPHORES_NOMMES
340: sem_post(&((*s_etat_processus).semaphore_fork));
341: sem_post(&semaphore_gestionnaires_signaux);
342: sem_destroy(&semaphore_gestionnaires_signaux);
343: sem_destroy(&((*s_etat_processus).semaphore_fork));
344: # else
345: sem_post((*s_etat_processus).semaphore_fork);
346: sem_post(semaphore_gestionnaires_signaux);
347: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
348: SEM_SIGNAUX);
349: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
350: pthread_self(), SEM_FORK);
351: # endif
352:
353: liberation_contexte_cas(s_etat_processus);
354:
355: if ((*s_etat_processus).langue == 'F')
356: {
357: uprintf("+++Système : Mémoire insuffisante\n");
358: }
359: else
360: {
361: uprintf("+++System : Not enough memory\n");
362: }
363:
364: return(EXIT_FAILURE);
365: }
366:
367: if (d_forced_locale == 0)
368: {
369: localisation_courante(s_etat_processus);
370: }
371: else
372: {
373: if (((*s_etat_processus).localisation = malloc((strlen(d_locale)
374: + 1) * sizeof(unsigned char))) == NULL)
375: {
376: # ifndef SEMAPHORES_NOMMES
377: sem_post(&((*s_etat_processus).semaphore_fork));
378: sem_post(&semaphore_gestionnaires_signaux);
379: sem_destroy(&semaphore_gestionnaires_signaux);
380: sem_destroy(&((*s_etat_processus).semaphore_fork));
381: # else
382: sem_post((*s_etat_processus).semaphore_fork);
383: sem_post(semaphore_gestionnaires_signaux);
384: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
385: SEM_SIGNAUX);
386: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
387: pthread_self(), SEM_FORK);
388: # endif
389:
390: liberation_contexte_cas(s_etat_processus);
391: liberation_queue_signaux(s_etat_processus);
392:
393: if ((*s_etat_processus).langue == 'F')
394: {
395: uprintf("+++Système : Mémoire insuffisante\n");
396: }
397: else
398: {
399: uprintf("+++System : Not enough memory\n");
400: }
401:
402: return(EXIT_FAILURE);
403: }
404:
405: strcpy((*s_etat_processus).localisation, d_locale);
406: }
407:
408: (*s_etat_processus).erreur_systeme = d_es;
409:
410: if ((*s_etat_processus).localisation == NULL)
411: {
412: if (((*s_etat_processus).localisation = malloc((strlen(d_locale) + 1) *
413: sizeof(unsigned char))) == NULL)
414: {
415: # ifndef SEMAPHORES_NOMMES
416: sem_post(&((*s_etat_processus).semaphore_fork));
417: sem_post(&semaphore_gestionnaires_signaux);
418: sem_destroy(&semaphore_gestionnaires_signaux);
419: sem_destroy(&((*s_etat_processus).semaphore_fork));
420: # else
421: sem_post((*s_etat_processus).semaphore_fork);
422: sem_post(semaphore_gestionnaires_signaux);
423: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
424: SEM_SIGNAUX);
425: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
426: pthread_self(), SEM_FORK);
427: # endif
428:
429: liberation_contexte_cas(s_etat_processus);
430: liberation_queue_signaux(s_etat_processus);
431:
432: if ((*s_etat_processus).langue == 'F')
433: {
434: uprintf("+++Système : Mémoire insuffisante\n");
435: }
436: else
437: {
438: uprintf("+++System : Not enough memory\n");
439: }
440:
441: return(EXIT_FAILURE);
442: }
443:
444: strcpy((*s_etat_processus).localisation, d_locale);
445: }
446:
447: if (resultats == NULL) // Appel direct
448: {
449: printf("+++RPL/2 (R) version %s (%s)\n", d_version_rpl,
450: ((*s_etat_processus).langue == 'F')
451: ? d_date_rpl : d_date_en_rpl);
452:
453: if ((*s_etat_processus).langue == 'F')
454: {
455: printf("+++Copyright (C) 1989 à 2012, 2013 BERTRAND Joël\n");
456: }
457: else
458: {
459: printf("+++Copyright (C) 1989 to 2012, 2013 BERTRAND Joel\n");
460: }
461: }
462:
463: if (getenv("HOME") != NULL)
464: {
465: home = getenv("HOME");
466: }
467: else if ((getenv("USER") != NULL) && (getpwnam(getenv("USER")) != NULL))
468: {
469: home = getpwnam(getenv("USER"))->pw_dir;
470: }
471: else if ((getenv("LOGNAME") != NULL) && (getpwnam(getenv("LOGNAME"))
472: != NULL))
473: {
474: home = getpwnam(getenv("LOGNAME"))->pw_dir;
475: }
476: else if ((getuid() != ((uid_t) -1)) && (getpwuid(getuid()) != NULL))
477: {
478: home = getpwuid(getuid())->pw_dir;
479: }
480: else
481: {
482: home = "";
483: }
484:
485: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
486: if (stackoverflow_install_handler(interruption_depassement_pile,
487: pile_signaux, sizeof(pile_signaux)) != 0)
488: {
489: # ifndef SEMAPHORES_NOMMES
490: sem_post(&((*s_etat_processus).semaphore_fork));
491: sem_post(&semaphore_gestionnaires_signaux);
492: sem_destroy(&semaphore_gestionnaires_signaux);
493: sem_destroy(&((*s_etat_processus).semaphore_fork));
494: # else
495: sem_post((*s_etat_processus).semaphore_fork);
496: sem_post(semaphore_gestionnaires_signaux);
497: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
498: SEM_SIGNAUX);
499: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
500: pthread_self(), SEM_FORK);
501: # endif
502:
503: liberation_contexte_cas(s_etat_processus);
504: liberation_queue_signaux(s_etat_processus);
505:
506: erreur = d_es_signal;
507:
508: if ((*s_etat_processus).langue == 'F')
509: {
510: printf("+++Système : Initialisation de la pile alternative "
511: "impossible\n");
512: }
513: else
514: {
515: printf("+++System : Initialization of alternate "
516: "stack failed\n");
517: }
518:
519: return(EXIT_FAILURE);
520: }
521: # else
522: if ((*s_etat_processus).langue == 'F')
523: {
524: printf("+++Attention : Le système ne supporte pas de pile "
525: "alternative\n");
526: }
527: else
528: {
529: printf("+++Warning : Operating system does not support alternate "
530: "stack\n");
531: }
532: # endif
533:
534: if (lancement_thread_signaux(s_etat_processus) != d_absence_erreur)
535: {
536: # ifndef SEMAPHORES_NOMMES
537: sem_post(&((*s_etat_processus).semaphore_fork));
538: sem_post(&semaphore_gestionnaires_signaux);
539: sem_destroy(&semaphore_gestionnaires_signaux);
540: sem_destroy(&((*s_etat_processus).semaphore_fork));
541: # else
542: sem_post((*s_etat_processus).semaphore_fork);
543: sem_post(semaphore_gestionnaires_signaux);
544: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
545: SEM_SIGNAUX);
546: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
547: pthread_self(), SEM_FORK);
548: # endif
549:
550: liberation_contexte_cas(s_etat_processus);
551: liberation_queue_signaux(s_etat_processus);
552:
553: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
554: stackoverflow_deinstall_handler();
555: # endif
556:
557: erreur = d_es_signal;
558:
559: if ((*s_etat_processus).langue == 'F')
560: {
561: printf("+++Système : Initialisation des signaux POSIX "
562: "impossible\n");
563: }
564: else
565: {
566: printf("+++System : Initialization of POSIX signals failed\n");
567: }
568:
569: return(EXIT_FAILURE);
570: }
571:
572: action.sa_handler = interruption1;
573: action.sa_flags = 0;
574:
575: if (sigaction(SIGINT, &action, NULL) != 0)
576: {
577: # ifndef SEMAPHORES_NOMMES
578: sem_post(&((*s_etat_processus).semaphore_fork));
579: sem_post(&semaphore_gestionnaires_signaux);
580: sem_destroy(&semaphore_gestionnaires_signaux);
581: sem_destroy(&((*s_etat_processus).semaphore_fork));
582: # else
583: sem_post((*s_etat_processus).semaphore_fork);
584: sem_post(semaphore_gestionnaires_signaux);
585: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
586: SEM_SIGNAUX);
587: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
588: pthread_self(), SEM_FORK);
589: # endif
590:
591: liberation_contexte_cas(s_etat_processus);
592: liberation_queue_signaux(s_etat_processus);
593:
594: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
595: stackoverflow_deinstall_handler();
596: # endif
597:
598: erreur = d_es_signal;
599:
600: if ((*s_etat_processus).langue == 'F')
601: {
602: printf("+++Système : Initialisation des signaux POSIX "
603: "impossible\n");
604: }
605: else
606: {
607: printf("+++System : Initialization of POSIX signals failed\n");
608: }
609:
610: return(EXIT_FAILURE);
611: }
612:
613: signal_test = SIGTEST;
614: raise(SIGINT);
615:
616: attente.tv_sec = 0;
617: attente.tv_nsec = 1000000;
618:
619: for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
620: {
621: nanosleep(&attente, NULL);
622: }
623:
624: if (signal_test != SIGINT)
625: {
626: # ifndef SEMAPHORES_NOMMES
627: sem_post(&((*s_etat_processus).semaphore_fork));
628: sem_post(&semaphore_gestionnaires_signaux);
629: sem_destroy(&semaphore_gestionnaires_signaux);
630: sem_destroy(&((*s_etat_processus).semaphore_fork));
631: # else
632: sem_post((*s_etat_processus).semaphore_fork);
633: sem_post(semaphore_gestionnaires_signaux);
634: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
635: SEM_SIGNAUX);
636: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
637: pthread_self(), SEM_FORK);
638: # endif
639:
640: liberation_contexte_cas(s_etat_processus);
641: liberation_queue_signaux(s_etat_processus);
642:
643: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
644: stackoverflow_deinstall_handler();
645: # endif
646:
647: erreur = d_es_signal;
648:
649: if ((*s_etat_processus).langue == 'F')
650: {
651: printf("+++Système : Initialisation des signaux POSIX "
652: "impossible\n");
653: }
654: else
655: {
656: printf("+++System : Initialization of POSIX signals failed\n");
657: }
658:
659: return(EXIT_FAILURE);
660: }
661:
662: if (sigaction(SIGTERM, &action, NULL) != 0)
663: {
664: # ifndef SEMAPHORES_NOMMES
665: sem_post(&((*s_etat_processus).semaphore_fork));
666: sem_post(&semaphore_gestionnaires_signaux);
667: sem_destroy(&semaphore_gestionnaires_signaux);
668: sem_destroy(&((*s_etat_processus).semaphore_fork));
669: # else
670: sem_post((*s_etat_processus).semaphore_fork);
671: sem_post(semaphore_gestionnaires_signaux);
672: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
673: SEM_SIGNAUX);
674: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
675: pthread_self(), SEM_FORK);
676: # endif
677:
678: liberation_contexte_cas(s_etat_processus);
679: liberation_queue_signaux(s_etat_processus);
680:
681: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
682: stackoverflow_deinstall_handler();
683: # endif
684:
685: erreur = d_es_signal;
686:
687: if ((*s_etat_processus).langue == 'F')
688: {
689: printf("+++Système : Initialisation des signaux POSIX "
690: "impossible\n");
691: }
692: else
693: {
694: printf("+++System : Initialization of POSIX signals failed\n");
695: }
696:
697: return(EXIT_FAILURE);
698: }
699:
700: signal_test = SIGTEST;
701: raise(SIGTERM);
702:
703: attente.tv_sec = 0;
704: attente.tv_nsec = 1000000;
705:
706: for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
707: {
708: nanosleep(&attente, NULL);
709: }
710:
711: if (signal_test != SIGTERM)
712: {
713: # ifndef SEMAPHORES_NOMMES
714: sem_post(&((*s_etat_processus).semaphore_fork));
715: sem_post(&semaphore_gestionnaires_signaux);
716: sem_destroy(&semaphore_gestionnaires_signaux);
717: sem_destroy(&((*s_etat_processus).semaphore_fork));
718: # else
719: sem_post((*s_etat_processus).semaphore_fork);
720: sem_post(semaphore_gestionnaires_signaux);
721: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
722: SEM_SIGNAUX);
723: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
724: pthread_self(), SEM_FORK);
725: # endif
726:
727: liberation_contexte_cas(s_etat_processus);
728: liberation_queue_signaux(s_etat_processus);
729:
730: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
731: stackoverflow_deinstall_handler();
732: # endif
733:
734: erreur = d_es_signal;
735:
736: if ((*s_etat_processus).langue == 'F')
737: {
738: printf("+++Système : Initialisation des signaux POSIX "
739: "impossible\n");
740: }
741: else
742: {
743: printf("+++System : Initialization of POSIX signals failed\n");
744: }
745:
746: return(EXIT_FAILURE);
747: }
748:
749: if (sigaction(SIGALRM, &action, NULL) != 0)
750: {
751: # ifndef SEMAPHORES_NOMMES
752: sem_post(&((*s_etat_processus).semaphore_fork));
753: sem_post(&semaphore_gestionnaires_signaux);
754: sem_destroy(&semaphore_gestionnaires_signaux);
755: sem_destroy(&((*s_etat_processus).semaphore_fork));
756: # else
757: sem_post((*s_etat_processus).semaphore_fork);
758: sem_post(semaphore_gestionnaires_signaux);
759: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
760: SEM_SIGNAUX);
761: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
762: pthread_self(), SEM_FORK);
763: # endif
764:
765: liberation_contexte_cas(s_etat_processus);
766: liberation_queue_signaux(s_etat_processus);
767:
768: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
769: stackoverflow_deinstall_handler();
770: # endif
771:
772: erreur = d_es_signal;
773:
774: if ((*s_etat_processus).langue == 'F')
775: {
776: printf("+++Système : Initialisation des signaux POSIX "
777: "impossible\n");
778: }
779: else
780: {
781: printf("+++System : Initialization of POSIX signals failed\n");
782: }
783:
784: return(EXIT_FAILURE);
785: }
786:
787: signal_test = SIGTEST;
788: raise(SIGALRM);
789:
790: attente.tv_sec = 0;
791: attente.tv_nsec = 1000000;
792:
793: for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
794: {
795: nanosleep(&attente, NULL);
796: }
797:
798: if (signal_test != SIGALRM)
799: {
800: # ifndef SEMAPHORES_NOMMES
801: sem_post(&((*s_etat_processus).semaphore_fork));
802: sem_post(&semaphore_gestionnaires_signaux);
803: sem_destroy(&semaphore_gestionnaires_signaux);
804: sem_destroy(&((*s_etat_processus).semaphore_fork));
805: # else
806: sem_post((*s_etat_processus).semaphore_fork);
807: sem_post(semaphore_gestionnaires_signaux);
808: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
809: SEM_SIGNAUX);
810: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
811: pthread_self(), SEM_FORK);
812: # endif
813:
814: liberation_contexte_cas(s_etat_processus);
815: liberation_queue_signaux(s_etat_processus);
816:
817: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
818: stackoverflow_deinstall_handler();
819: # endif
820:
821: erreur = d_es_signal;
822:
823: if ((*s_etat_processus).langue == 'F')
824: {
825: printf("+++Système : Initialisation des signaux POSIX "
826: "impossible\n");
827: }
828: else
829: {
830: printf("+++System : Initialization of POSIX signals failed\n");
831: }
832:
833: return(EXIT_FAILURE);
834: }
835:
836: action.sa_handler = interruption2;
837: action.sa_flags = 0;
838:
839: if (sigaction(SIGTSTP, &action, NULL) != 0)
840: {
841: # ifndef SEMAPHORES_NOMMES
842: sem_post(&((*s_etat_processus).semaphore_fork));
843: sem_post(&semaphore_gestionnaires_signaux);
844: sem_destroy(&semaphore_gestionnaires_signaux);
845: sem_destroy(&((*s_etat_processus).semaphore_fork));
846: # else
847: sem_post((*s_etat_processus).semaphore_fork);
848: sem_post(semaphore_gestionnaires_signaux);
849: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
850: SEM_SIGNAUX);
851: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
852: pthread_self(), SEM_FORK);
853: # endif
854:
855: liberation_contexte_cas(s_etat_processus);
856: liberation_queue_signaux(s_etat_processus);
857:
858: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
859: stackoverflow_deinstall_handler();
860: # endif
861:
862: if ((*s_etat_processus).langue == 'F')
863: {
864: printf("+++Système : Initialisation des signaux POSIX "
865: "impossible\n");
866: }
867: else
868: {
869: printf("+++System : Initialization of POSIX signals failed\n");
870: }
871:
872: return(EXIT_FAILURE);
873: }
874:
875: signal_test = SIGTEST;
876: raise(SIGTSTP);
877:
878: attente.tv_sec = 0;
879: attente.tv_nsec = 1000000;
880:
881: for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
882: {
883: nanosleep(&attente, NULL);
884: }
885:
886: if (signal_test != SIGTSTP)
887: {
888: # ifndef SEMAPHORES_NOMMES
889: sem_post(&((*s_etat_processus).semaphore_fork));
890: sem_post(&semaphore_gestionnaires_signaux);
891: sem_destroy(&semaphore_gestionnaires_signaux);
892: sem_destroy(&((*s_etat_processus).semaphore_fork));
893: # else
894: sem_post((*s_etat_processus).semaphore_fork);
895: sem_post(semaphore_gestionnaires_signaux);
896: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
897: SEM_SIGNAUX);
898: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
899: pthread_self(), SEM_FORK);
900: # endif
901:
902: liberation_contexte_cas(s_etat_processus);
903: liberation_queue_signaux(s_etat_processus);
904:
905: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
906: stackoverflow_deinstall_handler();
907: # endif
908:
909: erreur = d_es_signal;
910:
911: if ((*s_etat_processus).langue == 'F')
912: {
913: printf("+++Système : Initialisation des signaux POSIX "
914: "impossible\n");
915: }
916: else
917: {
918: printf("+++System : Initialization of POSIX signals failed\n");
919: }
920:
921: return(EXIT_FAILURE);
922: }
923:
924: action.sa_handler = interruption5;
925: action.sa_flags = 0;
926:
927: if (sigaction(SIGPIPE, &action, NULL) != 0)
928: {
929: # ifndef SEMAPHORES_NOMMES
930: sem_post(&((*s_etat_processus).semaphore_fork));
931: sem_post(&semaphore_gestionnaires_signaux);
932: sem_destroy(&semaphore_gestionnaires_signaux);
933: sem_destroy(&((*s_etat_processus).semaphore_fork));
934: # else
935: sem_post((*s_etat_processus).semaphore_fork);
936: sem_post(semaphore_gestionnaires_signaux);
937: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
938: SEM_SIGNAUX);
939: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
940: pthread_self(), SEM_FORK);
941: # endif
942:
943: liberation_contexte_cas(s_etat_processus);
944: liberation_queue_signaux(s_etat_processus);
945:
946: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
947: stackoverflow_deinstall_handler();
948: # endif
949:
950: erreur = d_es_signal;
951:
952: if ((*s_etat_processus).langue == 'F')
953: {
954: printf("+++Système : Initialisation des signaux POSIX "
955: "impossible\n");
956: }
957: else
958: {
959: printf("+++System : Initialization of POSIX signals failed\n");
960: }
961:
962: return(EXIT_FAILURE);
963: }
964:
965: signal_test = SIGTEST;
966: raise(SIGPIPE);
967:
968: attente.tv_sec = 0;
969: attente.tv_nsec = 1000000;
970:
971: for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
972: {
973: nanosleep(&attente, NULL);
974: }
975:
976: if (signal_test != SIGPIPE)
977: {
978: # ifndef SEMAPHORES_NOMMES
979: sem_post(&((*s_etat_processus).semaphore_fork));
980: sem_post(&semaphore_gestionnaires_signaux);
981: sem_destroy(&semaphore_gestionnaires_signaux);
982: sem_destroy(&((*s_etat_processus).semaphore_fork));
983: # else
984: sem_post((*s_etat_processus).semaphore_fork);
985: sem_post(semaphore_gestionnaires_signaux);
986: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
987: SEM_SIGNAUX);
988: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
989: pthread_self(), SEM_FORK);
990: # endif
991:
992: liberation_contexte_cas(s_etat_processus);
993: liberation_queue_signaux(s_etat_processus);
994:
995: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
996: stackoverflow_deinstall_handler();
997: # endif
998:
999: erreur = d_es_signal;
1000:
1001: if ((*s_etat_processus).langue == 'F')
1002: {
1003: printf("+++Système : Initialisation des signaux POSIX "
1004: "impossible\n");
1005: }
1006: else
1007: {
1008: printf("+++System : Initialization of POSIX signals failed\n");
1009: }
1010:
1011: return(EXIT_FAILURE);
1012: }
1013:
1014: action.sa_handler = interruption1;
1015: action.sa_flags = 0;
1016:
1017: if (sigaction(SIGUSR1, &action, NULL) != 0)
1018: {
1019: # ifndef SEMAPHORES_NOMMES
1020: sem_post(&((*s_etat_processus).semaphore_fork));
1021: sem_post(&semaphore_gestionnaires_signaux);
1022: sem_destroy(&semaphore_gestionnaires_signaux);
1023: sem_destroy(&((*s_etat_processus).semaphore_fork));
1024: # else
1025: sem_post((*s_etat_processus).semaphore_fork);
1026: sem_post(semaphore_gestionnaires_signaux);
1027: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
1028: SEM_SIGNAUX);
1029: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
1030: pthread_self(), SEM_FORK);
1031: # endif
1032:
1033: liberation_contexte_cas(s_etat_processus);
1034: liberation_queue_signaux(s_etat_processus);
1035:
1036: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1037: stackoverflow_deinstall_handler();
1038: # endif
1039:
1040: erreur = d_es_signal;
1041:
1042: if ((*s_etat_processus).langue == 'F')
1043: {
1044: printf("+++Système : Initialisation des signaux POSIX "
1045: "impossible\n");
1046: }
1047: else
1048: {
1049: printf("+++System : Initialization of POSIX signals failed\n");
1050: }
1051:
1052: return(EXIT_FAILURE);
1053: }
1054:
1055: signal_test = SIGTEST;
1056: raise(SIGUSR1);
1057:
1058: attente.tv_sec = 0;
1059: attente.tv_nsec = 1000000;
1060:
1061: for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
1062: {
1063: nanosleep(&attente, NULL);
1064: }
1065:
1066: if (signal_test != SIGUSR1)
1067: {
1068: # ifndef SEMAPHORES_NOMMES
1069: sem_post(&((*s_etat_processus).semaphore_fork));
1070: sem_post(&semaphore_gestionnaires_signaux);
1071: sem_destroy(&semaphore_gestionnaires_signaux);
1072: sem_destroy(&((*s_etat_processus).semaphore_fork));
1073: # else
1074: sem_post((*s_etat_processus).semaphore_fork);
1075: sem_post(semaphore_gestionnaires_signaux);
1076: sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
1077: SEM_SIGNAUX);
1078: sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
1079: pthread_self(), SEM_FORK);
1080: # endif
1081:
1082: liberation_contexte_cas(s_etat_processus);
1083: liberation_queue_signaux(s_etat_processus);
1084:
1085: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1086: stackoverflow_deinstall_handler();
1087: # endif
1088:
1089: erreur = d_es_signal;
1090:
1091: if ((*s_etat_processus).langue == 'F')
1092: {
1093: printf("+++Système : Initialisation des signaux POSIX "
1094: "impossible\n");
1095: }
1096: else
1097: {
1098: printf("+++System : Initialization of POSIX signals failed\n");
1099: }
1100:
1101: return(EXIT_FAILURE);
1102: }
1103:
1104: signal_test = SIGTEST + 1;
1105:
1106: erreur = d_absence_erreur;
1107: core = d_faux;
1108: mode_interactif = d_faux;
1109: (*s_etat_processus).nom_fichier_source = NULL;
1110: (*s_etat_processus).definitions_chainees = NULL;
1111: (*s_etat_processus).type_debug = 0;
1112: traitement_fichier_temporaire = 'N';
1113: option = ' ';
1114: drapeau_encart = 'Y';
1115: debug = d_faux;
1116: arguments = NULL;
1117:
1118: (*s_etat_processus).s_fichiers = NULL;
1119: (*s_etat_processus).s_sockets = NULL;
1120: (*s_etat_processus).s_connecteurs_sql = NULL;
1121:
1122: setlogmask(LOG_MASK(LOG_NOTICE));
1123: openlog(argv[0], LOG_ODELAY | LOG_PID, LOG_USER);
1124:
1125: if (argc == 1)
1126: {
1127: erreur = d_erreur;
1128: informations(s_etat_processus);
1129: }
1130: else
1131: {
1132: presence_definition = 'N';
1133: (*s_etat_processus).debug = d_faux;
1134: (*s_etat_processus).lancement_interactif = d_faux;
1135:
1136: option_a = d_faux;
1137: option_A = d_faux;
1138: option_c = d_faux;
1139: option_d = d_faux;
1140: option_D = d_faux;
1141: option_h = d_faux;
1142: option_i = d_faux;
1143: option_l = d_faux;
1144: option_n = d_faux;
1145: option_p = d_faux;
1146: option_P = 0;
1147: option_s = d_faux;
1148: option_S = d_faux;
1149: option_t = d_faux;
1150: option_v = d_faux;
1151:
1152: // Lorsque le programme est appelé depuis un shebang, argv[0] contient
1153: // le chemin du programme et argv[1] tous les arguments.
1154: // argv[2] contient quant à lui le nom du script RPL/2.
1155: //
1156: // Exemple :
1157: // argv[0] : /usr/local/bin/rpl
1158: // argv[1] : -csdp -t 800
1159: // argv[2] : ./on_exit.rpl
1160:
1161: while((--argc) > 0)
1162: {
1163: if ((*(++argv))[0] == '-')
1164: {
1165: while((option = *(++argv[0])) != '\0')
1166: {
1167: switch(option)
1168: {
1169: case 'a' :
1170: {
1171: if (option_a == d_vrai)
1172: {
1173: # ifndef SEMAPHORES_NOMMES
1174: sem_post(&((*s_etat_processus).semaphore_fork));
1175: sem_post(&semaphore_gestionnaires_signaux);
1176: sem_destroy(&semaphore_gestionnaires_signaux);
1177: sem_destroy(&((*s_etat_processus)
1178: .semaphore_fork));
1179: # else
1180: sem_post((*s_etat_processus).semaphore_fork);
1181: sem_post(semaphore_gestionnaires_signaux);
1182: sem_destroy2(semaphore_gestionnaires_signaux,
1183: getpid(), SEM_SIGNAUX);
1184: sem_destroy3((*s_etat_processus).semphore_fork,
1185: getpid(), pthread_self(), SEM_FORK);
1186: # endif
1187:
1188: liberation_contexte_cas(s_etat_processus);
1189: liberation_queue_signaux(s_etat_processus);
1190:
1191: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1192: stackoverflow_deinstall_handler();
1193: # endif
1194:
1195: if ((*s_etat_processus).langue == 'F')
1196: {
1197: printf("+++Erreur : option -a présente "
1198: "plus d'une fois\n");
1199: }
1200: else
1201: {
1202: printf("+++Error : more than one -a "
1203: "on command line");
1204: }
1205:
1206: return(EXIT_FAILURE);
1207: }
1208:
1209: option_a = d_vrai;
1210: break;
1211: }
1212:
1213: case 'A' :
1214: {
1215: if (option_A == d_vrai)
1216: {
1217: # ifndef SEMAPHORES_NOMMES
1218: sem_post(&((*s_etat_processus).semaphore_fork));
1219: sem_post(&semaphore_gestionnaires_signaux);
1220: sem_destroy(&semaphore_gestionnaires_signaux);
1221: sem_destroy(&((*s_etat_processus)
1222: .semaphore_fork));
1223: # else
1224: sem_post((*s_etat_processus).semaphore_fork);
1225: sem_post(semaphore_gestionnaires_signaux);
1226: sem_destroy2(semaphore_gestionnaires_signaux,
1227: getpid(), SEM_SIGNAUX);
1228: sem_destroy3((*s_etat_processus).semphore_fork,
1229: getpid(), pthread_self(), SEM_FORK);
1230: # endif
1231:
1232: liberation_contexte_cas(s_etat_processus);
1233: liberation_queue_signaux(s_etat_processus);
1234:
1235: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1236: stackoverflow_deinstall_handler();
1237: # endif
1238:
1239: if ((*s_etat_processus).langue == 'F')
1240: {
1241: printf("+++Erreur : option -A présente "
1242: "plus d'une fois\n");
1243: }
1244: else
1245: {
1246: printf("+++Error : more than one -A "
1247: "on command line");
1248: }
1249:
1250: return(EXIT_FAILURE);
1251: }
1252:
1253: option_A = d_vrai;
1254:
1255: while(*(++argv[0]) == ' ');
1256: argv[0]--;
1257:
1258: if ((*(++argv[0])) != '\0')
1259: {
1260: if ((arguments = malloc((strlen(argv[0]) + 7) *
1261: sizeof(unsigned char))) == NULL)
1262: {
1263: # ifndef SEMAPHORES_NOMMES
1264: sem_post(&((*s_etat_processus)
1265: .semaphore_fork));
1266: sem_post(&semaphore_gestionnaires_signaux);
1267: sem_destroy(
1268: &semaphore_gestionnaires_signaux);
1269: sem_destroy(&((*s_etat_processus)
1270: .semaphore_fork));
1271: # else
1272: sem_post((*s_etat_processus)
1273: .semaphore_fork);
1274: sem_post(semaphore_gestionnaires_signaux);
1275: sem_destroy2(
1276: semaphore_gestionnaires_signaux,
1277: getpid(), SEM_SIGNAUX);
1278: sem_destroy3((*s_etat_processus)
1279: .semphore_fork, getpid(),
1280: pthread_self(), SEM_FORK);
1281: # endif
1282:
1283: liberation_contexte_cas(s_etat_processus);
1284: liberation_queue_signaux(s_etat_processus);
1285:
1286: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1287: stackoverflow_deinstall_handler();
1288: # endif
1289:
1290: if ((*s_etat_processus).langue == 'F')
1291: {
1292: printf("+++Système : Mémoire "
1293: "insuffisante\n");
1294: }
1295: else
1296: {
1297: printf("+++System : Not enough "
1298: "memory\n");
1299: }
1300:
1301: return(EXIT_FAILURE);
1302: }
1303:
1304: ptr = arguments;
1305: (*ptr) = d_code_fin_chaine;
1306: strcat(ptr, "<< ");
1307: ptr += 3;
1308:
1309: while(*(argv[0]) != '\0')
1310: {
1311: *(ptr++) = *(argv[0]++);
1312: }
1313:
1314: (*ptr) = '\0';
1315:
1316: strcat(arguments, " >>");
1317: argv[0]--;
1318: }
1319: else if ((--argc) > 0)
1320: {
1321: argv++;
1322:
1323: if ((arguments = malloc((strlen(argv[0]) + 7) *
1324: sizeof(unsigned char))) == NULL)
1325: {
1326: # ifndef SEMAPHORES_NOMMES
1327: sem_post(&((*s_etat_processus)
1328: .semaphore_fork));
1329: sem_post(&semaphore_gestionnaires_signaux);
1330: sem_destroy(
1331: &semaphore_gestionnaires_signaux);
1332: sem_destroy(&((*s_etat_processus)
1333: .semaphore_fork));
1334: # else
1335: sem_post((*s_etat_processus)
1336: .semaphore_fork);
1337: sem_post(semaphore_gestionnaires_signaux);
1338: sem_destroy2(
1339: semaphore_gestionnaires_signaux,
1340: getpid(), SEM_SIGNAUX);
1341: sem_destroy3((*s_etat_processus)
1342: .semphore_fork, getpid(),
1343: pthread_self(), SEM_FORK);
1344: # endif
1345:
1346: liberation_contexte_cas(s_etat_processus);
1347: liberation_queue_signaux(s_etat_processus);
1348:
1349: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1350: stackoverflow_deinstall_handler();
1351: # endif
1352:
1353: if ((*s_etat_processus).langue == 'F')
1354: {
1355: printf("+++Système : Mémoire "
1356: "insuffisante\n");
1357: }
1358: else
1359: {
1360: printf("+++System : Not enough "
1361: "memory\n");
1362: }
1363:
1364: return(EXIT_FAILURE);
1365: }
1366:
1367: ptr = arguments;
1368: (*ptr) = d_code_fin_chaine;
1369: strcat(ptr, "<< ");
1370: ptr += 3;
1371:
1372: while(*(argv[0]) != '\0')
1373: {
1374: *(ptr++) = *(argv[0]++);
1375: }
1376:
1377: (*ptr) = '\0';
1378:
1379: strcat(arguments, " >>");
1380: argv[0]--;
1381: }
1382: else
1383: {
1384: # ifndef SEMAPHORES_NOMMES
1385: sem_post(&((*s_etat_processus).semaphore_fork));
1386: sem_post(&semaphore_gestionnaires_signaux);
1387: sem_destroy(&semaphore_gestionnaires_signaux);
1388: sem_destroy(&((*s_etat_processus)
1389: .semaphore_fork));
1390: # else
1391: sem_post((*s_etat_processus).semaphore_fork);
1392: sem_post(semaphore_gestionnaires_signaux);
1393: sem_destroy2(semaphore_gestionnaires_signaux,
1394: getpid(), SEM_SIGNAUX);
1395: sem_destroy3((*s_etat_processus).semphore_fork,
1396: getpid(), pthread_self(), SEM_FORK);
1397: # endif
1398:
1399: liberation_contexte_cas(s_etat_processus);
1400: liberation_queue_signaux(s_etat_processus);
1401:
1402: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1403: stackoverflow_deinstall_handler();
1404: # endif
1405:
1406: if ((*s_etat_processus).langue == 'F')
1407: {
1408: printf("+++Erreur : Aucune donnée "
1409: "spécifié après l'option -A\n");
1410: }
1411: else
1412: {
1413: printf("+++Error : Data required after "
1414: "-A option\n");
1415: }
1416:
1417: return(EXIT_FAILURE);
1418: }
1419:
1420: break;
1421: }
1422:
1423: case 'c' :
1424: {
1425: if (option_c == d_vrai)
1426: {
1427: # ifndef SEMAPHORES_NOMMES
1428: sem_post(&((*s_etat_processus).semaphore_fork));
1429: sem_post(&semaphore_gestionnaires_signaux);
1430: sem_destroy(&semaphore_gestionnaires_signaux);
1431: sem_destroy(&((*s_etat_processus)
1432: .semaphore_fork));
1433: # else
1434: sem_post((*s_etat_processus).semaphore_fork);
1435: sem_post(semaphore_gestionnaires_signaux);
1436: sem_destroy2(semaphore_gestionnaires_signaux,
1437: getpid(), SEM_SIGNAUX);
1438: sem_destroy3((*s_etat_processus).semphore_fork,
1439: getpid(), pthread_self(), SEM_FORK);
1440: # endif
1441:
1442: liberation_contexte_cas(s_etat_processus);
1443: liberation_queue_signaux(s_etat_processus);
1444:
1445: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1446: stackoverflow_deinstall_handler();
1447: # endif
1448:
1449: if ((*s_etat_processus).langue == 'F')
1450: {
1451: printf("+++Erreur : option -c présente "
1452: "plus d'une fois\n");
1453: }
1454: else
1455: {
1456: printf("+++Error : more than one -c "
1457: "on command line");
1458: }
1459:
1460: return(EXIT_FAILURE);
1461: }
1462:
1463: option_c = d_vrai;
1464: core = d_vrai;
1465: break;
1466: }
1467:
1468: case 'd' :
1469: {
1470: if (option_d == d_vrai)
1471: {
1472: # ifndef SEMAPHORES_NOMMES
1473: sem_post(&((*s_etat_processus).semaphore_fork));
1474: sem_post(&semaphore_gestionnaires_signaux);
1475: sem_destroy(&semaphore_gestionnaires_signaux);
1476: sem_destroy(&((*s_etat_processus)
1477: .semaphore_fork));
1478: # else
1479: sem_post((*s_etat_processus).semaphore_fork);
1480: sem_post(semaphore_gestionnaires_signaux);
1481: sem_destroy2(semaphore_gestionnaires_signaux,
1482: getpid(), SEM_SIGNAUX);
1483: sem_destroy3((*s_etat_processus).semphore_fork,
1484: getpid(), pthread_self(), SEM_FORK);
1485: # endif
1486:
1487: liberation_contexte_cas(s_etat_processus);
1488: liberation_queue_signaux(s_etat_processus);
1489:
1490: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1491: stackoverflow_deinstall_handler();
1492: # endif
1493:
1494: if ((*s_etat_processus).langue == 'F')
1495: {
1496: printf("+++Erreur : option -d présente "
1497: "plus d'une fois\n");
1498: }
1499: else
1500: {
1501: printf("+++Error : more than one -d "
1502: "on command line");
1503: }
1504:
1505: return(EXIT_FAILURE);
1506: }
1507:
1508: option_d = d_vrai;
1509: debug = d_vrai;
1510: break;
1511: }
1512:
1513: case 'D' :
1514: {
1515: if (option_D == d_vrai)
1516: {
1517: # ifndef SEMAPHORES_NOMMES
1518: sem_post(&((*s_etat_processus).semaphore_fork));
1519: sem_post(&semaphore_gestionnaires_signaux);
1520: sem_destroy(&semaphore_gestionnaires_signaux);
1521: sem_destroy(&((*s_etat_processus)
1522: .semaphore_fork));
1523: # else
1524: sem_post((*s_etat_processus).semaphore_fork);
1525: sem_post(semaphore_gestionnaires_signaux);
1526: sem_destroy2(semaphore_gestionnaires_signaux,
1527: getpid(), SEM_SIGNAUX);
1528: sem_destroy3((*s_etat_processus).semphore_fork,
1529: getpid(), pthread_self(), SEM_FORK);
1530: # endif
1531:
1532: liberation_contexte_cas(s_etat_processus);
1533: liberation_queue_signaux(s_etat_processus);
1534:
1535: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1536: stackoverflow_deinstall_handler();
1537: # endif
1538:
1539: if ((*s_etat_processus).langue == 'F')
1540: {
1541: printf("+++Erreur : option -D présente "
1542: "plus d'une fois\n");
1543: }
1544: else
1545: {
1546: printf("+++Error : more than one -D "
1547: "on command line");
1548: }
1549:
1550: return(EXIT_FAILURE);
1551: }
1552:
1553: option_D = d_vrai;
1554: break;
1555: }
1556:
1557: case 'h' :
1558: {
1559: if (option_h == d_vrai)
1560: {
1561: # ifndef SEMAPHORES_NOMMES
1562: sem_post(&((*s_etat_processus).semaphore_fork));
1563: sem_post(&semaphore_gestionnaires_signaux);
1564: sem_destroy(&semaphore_gestionnaires_signaux);
1565: sem_destroy(&((*s_etat_processus)
1566: .semaphore_fork));
1567: # else
1568: sem_post((*s_etat_processus).semaphore_fork);
1569: sem_post(semaphore_gestionnaires_signaux);
1570: sem_destroy2(semaphore_gestionnaires_signaux,
1571: getpid(), SEM_SIGNAUX);
1572: sem_destroy3((*s_etat_processus).semphore_fork,
1573: getpid(), pthread_self(), SEM_FORK);
1574: # endif
1575:
1576: liberation_contexte_cas(s_etat_processus);
1577: liberation_queue_signaux(s_etat_processus);
1578:
1579: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1580: stackoverflow_deinstall_handler();
1581: # endif
1582:
1583: if ((*s_etat_processus).langue == 'F')
1584: {
1585: printf("+++Erreur : option -h présente "
1586: "plus d'une fois\n");
1587: }
1588: else
1589: {
1590: printf("+++Error : more than one -h "
1591: "on command line");
1592: }
1593:
1594: return(EXIT_FAILURE);
1595: }
1596:
1597: option_h = d_vrai;
1598: informations(s_etat_processus);
1599: break;
1600: }
1601:
1602: case 'i' :
1603: {
1604: if (option_i == d_vrai)
1605: {
1606: # ifndef SEMAPHORES_NOMMES
1607: sem_post(&((*s_etat_processus).semaphore_fork));
1608: sem_post(&semaphore_gestionnaires_signaux);
1609: sem_destroy(&semaphore_gestionnaires_signaux);
1610: sem_destroy(&((*s_etat_processus)
1611: .semaphore_fork));
1612: # else
1613: sem_post((*s_etat_processus).semaphore_fork);
1614: sem_post(semaphore_gestionnaires_signaux);
1615: sem_destroy2(semaphore_gestionnaires_signaux,
1616: getpid(), SEM_SIGNAUX);
1617: sem_destroy3((*s_etat_processus).semphore_fork,
1618: getpid(), pthread_self(), SEM_FORK);
1619: # endif
1620:
1621: liberation_contexte_cas(s_etat_processus);
1622: liberation_queue_signaux(s_etat_processus);
1623:
1624: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1625: stackoverflow_deinstall_handler();
1626: # endif
1627:
1628: if ((*s_etat_processus).langue == 'F')
1629: {
1630: printf("+++Erreur : option -i présente "
1631: "plus d'une fois\n");
1632: }
1633: else
1634: {
1635: printf("+++Error : more than one -i "
1636: "on command line");
1637: }
1638:
1639: return(EXIT_FAILURE);
1640: }
1641: else if (option_S == d_vrai)
1642: {
1643: # ifndef SEMAPHORES_NOMMES
1644: sem_post(&((*s_etat_processus).semaphore_fork));
1645: sem_post(&semaphore_gestionnaires_signaux);
1646: sem_destroy(&semaphore_gestionnaires_signaux);
1647: sem_destroy(&((*s_etat_processus)
1648: .semaphore_fork));
1649: # else
1650: sem_post((*s_etat_processus).semaphore_fork);
1651: sem_post(semaphore_gestionnaires_signaux);
1652: sem_destroy2(semaphore_gestionnaires_signaux,
1653: getpid(), SEM_SIGNAUX);
1654: sem_destroy3((*s_etat_processus).semphore_fork,
1655: getpid(), pthread_self(), SEM_FORK);
1656: # endif
1657:
1658: liberation_contexte_cas(s_etat_processus);
1659: liberation_queue_signaux(s_etat_processus);
1660:
1661: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1662: stackoverflow_deinstall_handler();
1663: # endif
1664:
1665: if ((*s_etat_processus).langue == 'F')
1666: {
1667: printf("+++Erreur : options -i et -S "
1668: "incompatibles\n");
1669: }
1670: else
1671: {
1672: printf("+++Error : incompatible options -i "
1673: "and -S\n");
1674: }
1675:
1676: return(EXIT_FAILURE);
1677: }
1678: else if (option_p == d_vrai)
1679: {
1680: # ifndef SEMAPHORES_NOMMES
1681: sem_post(&((*s_etat_processus).semaphore_fork));
1682: sem_post(&semaphore_gestionnaires_signaux);
1683: sem_destroy(&semaphore_gestionnaires_signaux);
1684: sem_destroy(&((*s_etat_processus)
1685: .semaphore_fork));
1686: # else
1687: sem_post((*s_etat_processus).semaphore_fork);
1688: sem_post(semaphore_gestionnaires_signaux);
1689: sem_destroy2(semaphore_gestionnaires_signaux,
1690: getpid(), SEM_SIGNAUX);
1691: sem_destroy3((*s_etat_processus).semphore_fork,
1692: getpid(), pthread_self(), SEM_FORK);
1693: # endif
1694:
1695: liberation_contexte_cas(s_etat_processus);
1696: liberation_queue_signaux(s_etat_processus);
1697:
1698: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1699: stackoverflow_deinstall_handler();
1700: # endif
1701:
1702: if ((*s_etat_processus).langue == 'F')
1703: {
1704: printf("+++Erreur : options -i et -p "
1705: "incompatibles\n");
1706: }
1707: else
1708: {
1709: printf("+++Error : incompatible options -i "
1710: "and -p\n");
1711: }
1712:
1713: return(EXIT_FAILURE);
1714: }
1715:
1716: option_i = d_vrai;
1717: mode_interactif = d_vrai;
1718: presence_definition = 'O';
1719: break;
1720: }
1721:
1722: case 'l' :
1723: {
1724: if (option_l == d_vrai)
1725: {
1726: # ifndef SEMAPHORES_NOMMES
1727: sem_post(&((*s_etat_processus).semaphore_fork));
1728: sem_post(&semaphore_gestionnaires_signaux);
1729: sem_destroy(&semaphore_gestionnaires_signaux);
1730: sem_destroy(&((*s_etat_processus)
1731: .semaphore_fork));
1732: # else
1733: sem_post((*s_etat_processus).semaphore_fork);
1734: sem_post(semaphore_gestionnaires_signaux);
1735: sem_destroy2(semaphore_gestionnaires_signaux,
1736: getpid(), SEM_SIGNAUX);
1737: sem_destroy3((*s_etat_processus).semphore_fork,
1738: getpid(), pthread_self(), SEM_FORK);
1739: # endif
1740:
1741: liberation_contexte_cas(s_etat_processus);
1742: liberation_queue_signaux(s_etat_processus);
1743:
1744: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1745: stackoverflow_deinstall_handler();
1746: # endif
1747:
1748: if ((*s_etat_processus).langue == 'F')
1749: {
1750: printf("+++Erreur : option -l présente "
1751: "plus d'une fois\n");
1752: }
1753: else
1754: {
1755: printf("+++Error : more than one -l "
1756: "on command line");
1757: }
1758:
1759: return(EXIT_FAILURE);
1760: }
1761:
1762: option_l = d_vrai;
1763:
1764: if ((*s_etat_processus).langue == 'F')
1765: {
1766: printf("%s\n\n", CeCILL_fr);
1767: }
1768: else
1769: {
1770: printf("%s\n\n", CeCILL_en);
1771: }
1772:
1773: break;
1774: }
1775:
1776: case 'n' :
1777: {
1778: if (option_n == d_vrai)
1779: {
1780: # ifndef SEMAPHORES_NOMMES
1781: sem_post(&((*s_etat_processus).semaphore_fork));
1782: sem_post(&semaphore_gestionnaires_signaux);
1783: sem_destroy(&semaphore_gestionnaires_signaux);
1784: sem_destroy(&((*s_etat_processus)
1785: .semaphore_fork));
1786: # else
1787: sem_post((*s_etat_processus).semaphore_fork);
1788: sem_post(semaphore_gestionnaires_signaux);
1789: sem_destroy2(semaphore_gestionnaires_signaux,
1790: getpid(), SEM_SIGNAUX);
1791: sem_destroy3((*s_etat_processus).semphore_fork,
1792: getpid(), pthread_self(), SEM_FORK);
1793: # endif
1794:
1795: liberation_contexte_cas(s_etat_processus);
1796: liberation_queue_signaux(s_etat_processus);
1797:
1798: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1799: stackoverflow_deinstall_handler();
1800: # endif
1801:
1802: if ((*s_etat_processus).langue == 'F')
1803: {
1804: printf("+++Erreur : option -n présente "
1805: "plus d'une fois\n");
1806: }
1807: else
1808: {
1809: printf("+++Error : more than one -n "
1810: "on command line");
1811: }
1812:
1813: return(EXIT_FAILURE);
1814: }
1815:
1816: option_n = d_vrai;
1817:
1818: break;
1819: }
1820:
1821: case 'p' :
1822: {
1823: if (option_p == d_vrai)
1824: {
1825: # ifndef SEMAPHORES_NOMMES
1826: sem_post(&((*s_etat_processus).semaphore_fork));
1827: sem_post(&semaphore_gestionnaires_signaux);
1828: sem_destroy(&semaphore_gestionnaires_signaux);
1829: sem_destroy(&((*s_etat_processus)
1830: .semaphore_fork));
1831: # else
1832: sem_post((*s_etat_processus).semaphore_fork);
1833: sem_post(semaphore_gestionnaires_signaux);
1834: sem_destroy2(semaphore_gestionnaires_signaux,
1835: getpid(), SEM_SIGNAUX);
1836: sem_destroy3((*s_etat_processus).semphore_fork,
1837: getpid(), pthread_self(), SEM_FORK);
1838: # endif
1839:
1840: liberation_contexte_cas(s_etat_processus);
1841: liberation_queue_signaux(s_etat_processus);
1842:
1843: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1844: stackoverflow_deinstall_handler();
1845: # endif
1846:
1847: if ((*s_etat_processus).langue == 'F')
1848: {
1849: printf("+++Erreur : option -p présente "
1850: "plus d'une fois\n");
1851: }
1852: else
1853: {
1854: printf("+++Error : more than one -p "
1855: "on command line");
1856: }
1857:
1858: return(EXIT_FAILURE);
1859: }
1860: else if (option_i == d_vrai)
1861: {
1862: # ifndef SEMAPHORES_NOMMES
1863: sem_post(&((*s_etat_processus).semaphore_fork));
1864: sem_post(&semaphore_gestionnaires_signaux);
1865: sem_destroy(&semaphore_gestionnaires_signaux);
1866: sem_destroy(&((*s_etat_processus)
1867: .semaphore_fork));
1868: # else
1869: sem_post((*s_etat_processus).semaphore_fork);
1870: sem_post(semaphore_gestionnaires_signaux);
1871: sem_destroy2(semaphore_gestionnaires_signaux,
1872: getpid(), SEM_SIGNAUX);
1873: sem_destroy3((*s_etat_processus).semphore_fork,
1874: getpid(), pthread_self(), SEM_FORK);
1875: # endif
1876:
1877: liberation_contexte_cas(s_etat_processus);
1878: liberation_queue_signaux(s_etat_processus);
1879:
1880: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1881: stackoverflow_deinstall_handler();
1882: # endif
1883:
1884: if ((*s_etat_processus).langue == 'F')
1885: {
1886: printf("+++Erreur : options -i et -p "
1887: "incompatibles\n");
1888: }
1889: else
1890: {
1891: printf("+++Error : incompatible options -i "
1892: "and -p\n");
1893: }
1894:
1895: return(EXIT_FAILURE);
1896: }
1897:
1898: option_p = d_vrai;
1899:
1900: break;
1901: }
1902:
1903: case 'P' :
1904: {
1905: if (option_P > 2)
1906: {
1907: # ifndef SEMAPHORES_NOMMES
1908: sem_post(&((*s_etat_processus).semaphore_fork));
1909: sem_post(&semaphore_gestionnaires_signaux);
1910: sem_destroy(&semaphore_gestionnaires_signaux);
1911: sem_destroy(&((*s_etat_processus)
1912: .semaphore_fork));
1913: # else
1914: sem_post((*s_etat_processus).semaphore_fork);
1915: sem_post(semaphore_gestionnaires_signaux);
1916: sem_destroy2(semaphore_gestionnaires_signaux,
1917: getpid(), SEM_SIGNAUX);
1918: sem_destroy3((*s_etat_processus).semphore_fork,
1919: getpid(), pthread_self(), SEM_FORK);
1920: # endif
1921:
1922: liberation_contexte_cas(s_etat_processus);
1923: liberation_queue_signaux(s_etat_processus);
1924:
1925: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1926: stackoverflow_deinstall_handler();
1927: # endif
1928:
1929: if ((*s_etat_processus).langue == 'F')
1930: {
1931: printf("+++Erreur : option -P présente "
1932: "plus de deux fois\n");
1933: }
1934: else
1935: {
1936: printf("+++Error : more than two -P "
1937: "on command line");
1938: }
1939:
1940: return(EXIT_FAILURE);
1941: }
1942:
1943: option_P++;
1944:
1945: break;
1946: }
1947:
1948: case 's' :
1949: {
1950: if (option_s == d_vrai)
1951: {
1952: # ifndef SEMAPHORES_NOMMES
1953: sem_post(&((*s_etat_processus).semaphore_fork));
1954: sem_post(&semaphore_gestionnaires_signaux);
1955: sem_destroy(&semaphore_gestionnaires_signaux);
1956: sem_destroy(&((*s_etat_processus)
1957: .semaphore_fork));
1958: # else
1959: sem_post((*s_etat_processus).semaphore_fork);
1960: sem_post(semaphore_gestionnaires_signaux);
1961: sem_destroy2(semaphore_gestionnaires_signaux,
1962: getpid(), SEM_SIGNAUX);
1963: sem_destroy3((*s_etat_processus).semphore_fork,
1964: getpid(), pthread_self(), SEM_FORK);
1965: # endif
1966:
1967: liberation_contexte_cas(s_etat_processus);
1968: liberation_queue_signaux(s_etat_processus);
1969:
1970: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
1971: stackoverflow_deinstall_handler();
1972: # endif
1973:
1974: if ((*s_etat_processus).langue == 'F')
1975: {
1976: printf("+++Erreur : option -s présente "
1977: "plus d'une fois\n");
1978: }
1979: else
1980: {
1981: printf("+++Error : more than one -s "
1982: "on command line");
1983: }
1984:
1985: return(EXIT_FAILURE);
1986: }
1987:
1988: option_s = d_vrai;
1989: drapeau_encart = 'N';
1990: break;
1991: }
1992:
1993: case 'S' :
1994: {
1995: if (option_S == d_vrai)
1996: {
1997: # ifndef SEMAPHORES_NOMMES
1998: sem_post(&((*s_etat_processus).semaphore_fork));
1999: sem_post(&semaphore_gestionnaires_signaux);
2000: sem_destroy(&semaphore_gestionnaires_signaux);
2001: sem_destroy(&((*s_etat_processus)
2002: .semaphore_fork));
2003: # else
2004: sem_post((*s_etat_processus).semaphore_fork);
2005: sem_post(semaphore_gestionnaires_signaux);
2006: sem_destroy2(semaphore_gestionnaires_signaux,
2007: getpid(), SEM_SIGNAUX);
2008: sem_destroy3((*s_etat_processus).semphore_fork,
2009: getpid(), pthread_self(), SEM_FORK);
2010: # endif
2011:
2012: liberation_contexte_cas(s_etat_processus);
2013: liberation_queue_signaux(s_etat_processus);
2014:
2015: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2016: stackoverflow_deinstall_handler();
2017: # endif
2018:
2019: if ((*s_etat_processus).langue == 'F')
2020: {
2021: printf("+++Erreur : option -S présente "
2022: "plus d'une fois\n");
2023: }
2024: else
2025: {
2026: printf("+++Error : more than one -S "
2027: "on command line");
2028: }
2029:
2030: return(EXIT_FAILURE);
2031: }
2032: else if (option_i == d_vrai)
2033: {
2034: # ifndef SEMAPHORES_NOMMES
2035: sem_post(&((*s_etat_processus).semaphore_fork));
2036: sem_post(&semaphore_gestionnaires_signaux);
2037: sem_destroy(&semaphore_gestionnaires_signaux);
2038: sem_destroy(&((*s_etat_processus)
2039: .semaphore_fork));
2040: # else
2041: sem_post((*s_etat_processus).semaphore_fork);
2042: sem_post(semaphore_gestionnaires_signaux);
2043: sem_destroy2(semaphore_gestionnaires_signaux,
2044: getpid(), SEM_SIGNAUX);
2045: sem_destroy3((*s_etat_processus).semphore_fork,
2046: getpid(), pthread_self(), SEM_FORK);
2047: # endif
2048:
2049: liberation_contexte_cas(s_etat_processus);
2050: liberation_queue_signaux(s_etat_processus);
2051:
2052: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2053: stackoverflow_deinstall_handler();
2054: # endif
2055:
2056: if ((*s_etat_processus).langue == 'F')
2057: {
2058: printf("+++Erreur : options -i et -S "
2059: "incompatibles\n");
2060: }
2061: else
2062: {
2063: printf("+++Error : incompatible options -S "
2064: "and -i\n");
2065: }
2066:
2067: return(EXIT_FAILURE);
2068: }
2069:
2070: option_S = d_vrai;
2071:
2072: while(*(++argv[0]) == ' ');
2073: argv[0]--;
2074:
2075: if ((*(++argv[0])) != '\0')
2076: {
2077: if (((*s_etat_processus).definitions_chainees =
2078: malloc((strlen(argv[0]) + 1) *
2079: sizeof(unsigned char))) == NULL)
2080: {
2081: # ifndef SEMAPHORES_NOMMES
2082: sem_post(&((*s_etat_processus)
2083: .semaphore_fork));
2084: sem_post(&semaphore_gestionnaires_signaux);
2085: sem_destroy(
2086: &semaphore_gestionnaires_signaux);
2087: sem_destroy(&((*s_etat_processus)
2088: .semaphore_fork));
2089: # else
2090: sem_post((*s_etat_processus)
2091: .semaphore_fork);
2092: sem_post(semaphore_gestionnaires_signaux);
2093: sem_destroy2(
2094: semaphore_gestionnaires_signaux,
2095: getpid(), SEM_SIGNAUX);
2096: sem_destroy3((*s_etat_processus)
2097: .semphore_fork, getpid(),
2098: pthread_self(), SEM_FORK);
2099: # endif
2100:
2101: liberation_contexte_cas(s_etat_processus);
2102: liberation_queue_signaux(s_etat_processus);
2103:
2104: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2105: stackoverflow_deinstall_handler();
2106: # endif
2107:
2108: if ((*s_etat_processus).langue == 'F')
2109: {
2110: printf("+++Système : Mémoire "
2111: "insuffisante\n");
2112: }
2113: else
2114: {
2115: printf("+++System : Not enough "
2116: "memory\n");
2117: }
2118:
2119: return(EXIT_FAILURE);
2120: }
2121:
2122: ptr = (*s_etat_processus).definitions_chainees;
2123:
2124: while(*(argv[0]) != '\0')
2125: {
2126: *(ptr++) = *(argv[0]++);
2127: }
2128:
2129: (*ptr) = '\0';
2130:
2131: argv[0]--;
2132: presence_definition = 'O';
2133: }
2134: else if ((--argc) > 0)
2135: {
2136: argv++;
2137:
2138: if (((*s_etat_processus).definitions_chainees =
2139: malloc((strlen(argv[0]) + 1) *
2140: sizeof(unsigned char))) == NULL)
2141: {
2142: # ifndef SEMAPHORES_NOMMES
2143: sem_post(&((*s_etat_processus)
2144: .semaphore_fork));
2145: sem_post(&semaphore_gestionnaires_signaux);
2146: sem_destroy(
2147: &semaphore_gestionnaires_signaux);
2148: sem_destroy(&((*s_etat_processus)
2149: .semaphore_fork));
2150: # else
2151: sem_post((*s_etat_processus)
2152: .semaphore_fork);
2153: sem_post(semaphore_gestionnaires_signaux);
2154: sem_destroy2(
2155: semaphore_gestionnaires_signaux,
2156: getpid(), SEM_SIGNAUX);
2157: sem_destroy3((*s_etat_processus)
2158: .semphore_fork, getpid(),
2159: pthread_self(), SEM_FORK);
2160: # endif
2161:
2162: liberation_contexte_cas(s_etat_processus);
2163: liberation_queue_signaux(s_etat_processus);
2164:
2165: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2166: stackoverflow_deinstall_handler();
2167: # endif
2168:
2169: if ((*s_etat_processus).langue == 'F')
2170: {
2171: printf("+++Système : Mémoire "
2172: "insuffisante\n");
2173: }
2174: else
2175: {
2176: printf("+++System : Not enough "
2177: "memory\n");
2178: }
2179:
2180: return(EXIT_FAILURE);
2181: }
2182:
2183: ptr = (*s_etat_processus).definitions_chainees;
2184:
2185: while(*(argv[0]) != '\0')
2186: {
2187: *(ptr++) = *(argv[0]++);
2188: }
2189:
2190: (*ptr) = '\0';
2191:
2192: argv[0]--;
2193: presence_definition = 'O';
2194: }
2195: else
2196: {
2197: # ifndef SEMAPHORES_NOMMES
2198: sem_post(&((*s_etat_processus).semaphore_fork));
2199: sem_post(&semaphore_gestionnaires_signaux);
2200: sem_destroy(&semaphore_gestionnaires_signaux);
2201: sem_destroy(&((*s_etat_processus)
2202: .semaphore_fork));
2203: # else
2204: sem_post((*s_etat_processus).semaphore_fork);
2205: sem_post(semaphore_gestionnaires_signaux);
2206: sem_destroy2(semaphore_gestionnaires_signaux,
2207: getpid(), SEM_SIGNAUX);
2208: sem_destroy3((*s_etat_processus).semphore_fork,
2209: getpid(), pthread_self(), SEM_FORK);
2210: # endif
2211:
2212: liberation_contexte_cas(s_etat_processus);
2213: liberation_queue_signaux(s_etat_processus);
2214:
2215: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2216: stackoverflow_deinstall_handler();
2217: # endif
2218:
2219: if ((*s_etat_processus).langue == 'F')
2220: {
2221: printf("+++Erreur : Aucun script "
2222: "spécifié après l'option -S\n");
2223: }
2224: else
2225: {
2226: printf("+++Error : Script required after "
2227: "-S option\n");
2228: }
2229:
2230: return(EXIT_FAILURE);
2231: }
2232:
2233: if (((*s_etat_processus).definitions_chainees =
2234: compactage((*s_etat_processus)
2235: .definitions_chainees)) == NULL)
2236: {
2237: # ifndef SEMAPHORES_NOMMES
2238: sem_post(&((*s_etat_processus).semaphore_fork));
2239: sem_post(&semaphore_gestionnaires_signaux);
2240: sem_destroy(&semaphore_gestionnaires_signaux);
2241: sem_destroy(&((*s_etat_processus)
2242: .semaphore_fork));
2243: # else
2244: sem_post((*s_etat_processus).semaphore_fork);
2245: sem_post(semaphore_gestionnaires_signaux);
2246: sem_destroy2(semaphore_gestionnaires_signaux,
2247: getpid(), SEM_SIGNAUX);
2248: sem_destroy3((*s_etat_processus).semphore_fork,
2249: getpid(), pthread_self(), SEM_FORK);
2250: # endif
2251:
2252: liberation_contexte_cas(s_etat_processus);
2253: liberation_queue_signaux(s_etat_processus);
2254:
2255: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2256: stackoverflow_deinstall_handler();
2257: # endif
2258:
2259: if ((*s_etat_processus).langue == 'F')
2260: {
2261: printf("+++Système : Mémoire "
2262: "insuffisante\n");
2263: }
2264: else
2265: {
2266: printf("+++System : Not enough "
2267: "memory\n");
2268: }
2269:
2270: return(EXIT_FAILURE);
2271: }
2272:
2273: (*s_etat_processus).longueur_definitions_chainees =
2274: (integer8) strlen((*s_etat_processus)
2275: .definitions_chainees);
2276:
2277: break;
2278: }
2279:
2280: case 't' :
2281: {
2282: if (option_t == d_vrai)
2283: {
2284: # ifndef SEMAPHORES_NOMMES
2285: sem_post(&((*s_etat_processus).semaphore_fork));
2286: sem_post(&semaphore_gestionnaires_signaux);
2287: sem_destroy(&semaphore_gestionnaires_signaux);
2288: sem_destroy(&((*s_etat_processus)
2289: .semaphore_fork));
2290: # else
2291: sem_post((*s_etat_processus).semaphore_fork);
2292: sem_post(semaphore_gestionnaires_signaux);
2293: sem_destroy2(semaphore_gestionnaires_signaux,
2294: getpid(), SEM_SIGNAUX);
2295: sem_destroy3((*s_etat_processus).semphore_fork,
2296: getpid(), pthread_self(), SEM_FORK);
2297: # endif
2298:
2299: liberation_contexte_cas(s_etat_processus);
2300: liberation_queue_signaux(s_etat_processus);
2301:
2302: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2303: stackoverflow_deinstall_handler();
2304: # endif
2305:
2306: if ((*s_etat_processus).langue == 'F')
2307: {
2308: printf("+++Erreur : option -t présente "
2309: "plus d'une fois\n");
2310: }
2311: else
2312: {
2313: printf("+++Error : more than one -t "
2314: "on command line");
2315: }
2316:
2317: return(EXIT_FAILURE);
2318: }
2319:
2320: option_t = d_vrai;
2321: (*s_etat_processus).debug = d_vrai;
2322:
2323: while(*(++argv[0]) == ' ');
2324: argv[0]--;
2325:
2326: if ((*(++argv[0])) != '\0')
2327: {
2328: if ((type_debug = malloc((strlen(argv[0]) + 1) *
2329: sizeof(unsigned char))) == NULL)
2330: {
2331: # ifndef SEMAPHORES_NOMMES
2332: sem_post(&((*s_etat_processus)
2333: .semaphore_fork));
2334: sem_post(&semaphore_gestionnaires_signaux);
2335: sem_destroy(
2336: &semaphore_gestionnaires_signaux);
2337: sem_destroy(&((*s_etat_processus)
2338: .semaphore_fork));
2339: # else
2340: sem_post((*s_etat_processus)
2341: .semaphore_fork);
2342: sem_post(semaphore_gestionnaires_signaux);
2343: sem_destroy2(
2344: semaphore_gestionnaires_signaux,
2345: getpid(), SEM_SIGNAUX);
2346: sem_destroy3((*s_etat_processus)
2347: .semphore_fork, getpid(),
2348: pthread_self(), SEM_FORK);
2349: # endif
2350:
2351: liberation_contexte_cas(s_etat_processus);
2352: liberation_queue_signaux(s_etat_processus);
2353:
2354: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2355: stackoverflow_deinstall_handler();
2356: # endif
2357:
2358: if ((*s_etat_processus).langue == 'F')
2359: {
2360: printf("+++Système : Mémoire "
2361: "insuffisante\n");
2362: }
2363: else
2364: {
2365: printf("+++System : Not enough "
2366: "memory\n");
2367: }
2368:
2369: return(EXIT_FAILURE);
2370: }
2371:
2372: ptr = type_debug;
2373:
2374: while((*(argv[0]) != '\0') &&
2375: (*(argv[0]) != ' '))
2376: {
2377: *(ptr++) = *(argv[0]++);
2378: }
2379:
2380: (*ptr) = '\0';
2381:
2382: argv[0]--;
2383: }
2384: else if ((--argc) > 0)
2385: {
2386: argv++;
2387:
2388: if ((type_debug =
2389: malloc((strlen(argv[0]) + 1) *
2390: sizeof(unsigned char))) == NULL)
2391: {
2392: # ifndef SEMAPHORES_NOMMES
2393: sem_post(&((*s_etat_processus)
2394: .semaphore_fork));
2395: sem_post(&semaphore_gestionnaires_signaux);
2396: sem_destroy(
2397: &semaphore_gestionnaires_signaux);
2398: sem_destroy(&((*s_etat_processus)
2399: .semaphore_fork));
2400: # else
2401: sem_post((*s_etat_processus)
2402: .semaphore_fork);
2403: sem_post(semaphore_gestionnaires_signaux);
2404: sem_destroy2(
2405: semaphore_gestionnaires_signaux,
2406: getpid(), SEM_SIGNAUX);
2407: sem_destroy3((*s_etat_processus)
2408: .semphore_fork, getpid(),
2409: pthread_self(), SEM_FORK);
2410: # endif
2411:
2412: liberation_contexte_cas(s_etat_processus);
2413: liberation_queue_signaux(s_etat_processus);
2414:
2415: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2416: stackoverflow_deinstall_handler();
2417: # endif
2418:
2419: if ((*s_etat_processus).langue == 'F')
2420: {
2421: printf("+++Système : Mémoire "
2422: "insuffisante\n");
2423: }
2424: else
2425: {
2426: printf("+++System : Not enough "
2427: "memory\n");
2428: }
2429:
2430: return(EXIT_FAILURE);
2431: }
2432:
2433: ptr = type_debug;
2434:
2435: while(*(argv[0]) != '\0')
2436: {
2437: *(ptr++) = *(argv[0]++);
2438: }
2439:
2440: (*ptr) = '\0';
2441:
2442: argv[0]--;
2443: }
2444: else
2445: {
2446: # ifndef SEMAPHORES_NOMMES
2447: sem_post(&((*s_etat_processus).semaphore_fork));
2448: sem_post(&semaphore_gestionnaires_signaux);
2449: sem_destroy(&semaphore_gestionnaires_signaux);
2450: sem_destroy(&((*s_etat_processus)
2451: .semaphore_fork));
2452: # else
2453: sem_post((*s_etat_processus).semaphore_fork);
2454: sem_post(semaphore_gestionnaires_signaux);
2455: sem_destroy2(semaphore_gestionnaires_signaux,
2456: getpid(), SEM_SIGNAUX);
2457: sem_destroy3((*s_etat_processus).semphore_fork,
2458: getpid(), pthread_self(), SEM_FORK);
2459: # endif
2460:
2461: liberation_contexte_cas(s_etat_processus);
2462: liberation_queue_signaux(s_etat_processus);
2463:
2464: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2465: stackoverflow_deinstall_handler();
2466: # endif
2467:
2468: if ((*s_etat_processus).langue == 'F')
2469: {
2470: printf("+++Erreur : Aucun niveau "
2471: "de débogage spécifié après "
2472: "l'option -t\n");
2473: }
2474: else
2475: {
2476: printf("+++Error : Debug level not "
2477: "specified after -t option\n");
2478: }
2479:
2480: return(EXIT_FAILURE);
2481: }
2482:
2483: ptr = type_debug;
2484:
2485: while(*ptr != '\0')
2486: {
2487: switch(*ptr)
2488: {
2489: case '0':
2490: case '1':
2491: case '2':
2492: case '3':
2493: case '4':
2494: case '5':
2495: case '6':
2496: case '7':
2497: case '8':
2498: case '9':
2499: case 'A':
2500: case 'B':
2501: case 'C':
2502: case 'D':
2503: case 'E':
2504: case 'F':
2505: {
2506: break;
2507: }
2508:
2509: default:
2510: {
2511: # ifndef SEMAPHORES_NOMMES
2512: sem_post(&((*s_etat_processus)
2513: .semaphore_fork));
2514: sem_post(
2515: &semaphore_gestionnaires_signaux
2516: );
2517: sem_destroy(
2518: &semaphore_gestionnaires_signaux
2519: );
2520: sem_destroy(&((*s_etat_processus)
2521: .semaphore_fork));
2522: # else
2523: sem_post((*s_etat_processus)
2524: .semaphore_fork);
2525: sem_post(
2526: semaphore_gestionnaires_signaux
2527: );
2528: sem_destroy2(
2529: semaphore_gestionnaires_signaux,
2530: getpid(), SEM_SIGNAUX);
2531: sem_destroy3((*s_etat_processus)
2532: .semphore_fork, getpid(),
2533: pthread_self(), SEM_FORK);
2534: # endif
2535:
2536: liberation_contexte_cas(
2537: s_etat_processus);
2538: liberation_queue_signaux(
2539: s_etat_processus);
2540:
2541: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2542: stackoverflow_deinstall_handler();
2543: # endif
2544:
2545: if ((*s_etat_processus).langue == 'F')
2546: {
2547: printf("+++Erreur : Niveau "
2548: "de débogage non "
2549: "hexadécimal\n");
2550: }
2551: else
2552: {
2553: printf("+++Error : Debug level must"
2554: " be hexadecimal "
2555: "integer\n");
2556: }
2557:
2558: return(EXIT_FAILURE);
2559: }
2560: }
2561:
2562: ptr++;
2563: }
2564:
2565: if (sscanf(type_debug, "%llX",
2566: &((*s_etat_processus).type_debug)) != 1)
2567: {
2568: # ifndef SEMAPHORES_NOMMES
2569: sem_post(&((*s_etat_processus).semaphore_fork));
2570: sem_post(&semaphore_gestionnaires_signaux);
2571: sem_destroy(&semaphore_gestionnaires_signaux);
2572: sem_destroy(&((*s_etat_processus)
2573: .semaphore_fork));
2574: # else
2575: sem_post((*s_etat_processus).semaphore_fork);
2576: sem_post(semaphore_gestionnaires_signaux);
2577: sem_destroy2(semaphore_gestionnaires_signaux,
2578: getpid(), SEM_SIGNAUX);
2579: sem_destroy3((*s_etat_processus).semphore_fork,
2580: getpid(), pthread_self(), SEM_FORK);
2581: # endif
2582:
2583: liberation_contexte_cas(s_etat_processus);
2584: liberation_queue_signaux(s_etat_processus);
2585:
2586: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2587: stackoverflow_deinstall_handler();
2588: # endif
2589:
2590: if ((*s_etat_processus).langue == 'F')
2591: {
2592: printf("+++Erreur : Niveau "
2593: "de débogage non entier\n");
2594: }
2595: else
2596: {
2597: printf("+++Error : Debug level must"
2598: " be integer\n");
2599: }
2600:
2601: return(EXIT_FAILURE);
2602: }
2603:
2604: free(type_debug);
2605: break;
2606: }
2607:
2608: case 'v' :
2609: {
2610: if (option_v == d_vrai)
2611: {
2612: # ifndef SEMAPHORES_NOMMES
2613: sem_post(&((*s_etat_processus).semaphore_fork));
2614: sem_post(&semaphore_gestionnaires_signaux);
2615: sem_destroy(&semaphore_gestionnaires_signaux);
2616: sem_destroy(&((*s_etat_processus)
2617: .semaphore_fork));
2618: # else
2619: sem_post((*s_etat_processus).semaphore_fork);
2620: sem_post(semaphore_gestionnaires_signaux);
2621: sem_destroy2(semaphore_gestionnaires_signaux,
2622: getpid(), SEM_SIGNAUX);
2623: sem_destroy3((*s_etat_processus).semphore_fork,
2624: getpid(), pthread_self(), SEM_FORK);
2625: # endif
2626:
2627: liberation_contexte_cas(s_etat_processus);
2628: liberation_queue_signaux(s_etat_processus);
2629:
2630: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2631: stackoverflow_deinstall_handler();
2632: # endif
2633:
2634: if ((*s_etat_processus).langue == 'F')
2635: {
2636: printf("+++Erreur : option -v présente "
2637: "plus d'une fois\n");
2638: }
2639: else
2640: {
2641: printf("+++Error : more than one -v "
2642: "on command line");
2643: }
2644:
2645: return(EXIT_FAILURE);
2646: }
2647:
2648: option_v = d_vrai;
2649: printf("\n");
2650:
2651: if ((*s_etat_processus).langue == 'F')
2652: {
2653: printf(" Reverse Polish Lisp/2 version %s "
2654: "pour systèmes "
2655: "POSIX\n", d_version_rpl);
2656: printf(" Langage procédural de très haut "
2657: "niveau, semi-compilé, "
2658: "extensible,\n");
2659: printf(" destiné principalement aux "
2660: "calculs scientifiques et "
2661: "symboliques\n");
2662: printf("%s\n", copyright);
2663: }
2664: else
2665: {
2666: printf(" Reverse Polish Lisp/2 version %s "
2667: "for POSIX operating systems\n",
2668: d_version_rpl);
2669: printf(" Half-compiled, high-level "
2670: "procedural language,\n");
2671: printf(" mainly aiming at scientific "
2672: "calculations\n");
2673: printf("%s\n", copyright_anglais);
2674: }
2675:
2676: printf("\n");
2677: break;
2678: }
2679:
2680: case '-':
2681: case ' ':
2682: {
2683: break;
2684: }
2685:
2686: default :
2687: {
2688: if ((*s_etat_processus).langue == 'F')
2689: {
2690: printf("+++Information : Option -%c inconnue\n",
2691: option);
2692: }
2693: else
2694: {
2695: printf("+++Warning : -%c option unknown\n",
2696: option);
2697: }
2698:
2699: informations(s_etat_processus);
2700: break;
2701: }
2702: }
2703: }
2704: }
2705: else
2706: {
2707: if (presence_definition == 'O')
2708: {
2709: argc = 0;
2710:
2711: if ((*s_etat_processus).langue == 'F')
2712: {
2713: printf("+++Erreur : Plusieurs définitions\n");
2714: }
2715: else
2716: {
2717: printf("+++Error : More than one definition\n");
2718: }
2719:
2720: erreur = d_erreur;
2721: }
2722: else
2723: {
2724: (*s_etat_processus).nom_fichier_source = argv[0];
2725: presence_definition = 'O';
2726: }
2727: }
2728: }
2729:
2730: /*
2731: * Dans le cas où le programme est appelé avec l'option -d,
2732: * on ne récupère par les signaux de violation d'accès. On
2733: * tente simplement la récupération des dépassements de pile.
2734: */
2735:
2736: if (debug == d_faux)
2737: {
2738: # ifdef HAVE_SIGSEGV_RECOVERY
2739: if (sigsegv_install_handler(interruption_violation_access) != 0)
2740: {
2741: # ifndef SEMAPHORES_NOMMES
2742: sem_post(&((*s_etat_processus).semaphore_fork));
2743: sem_post(&semaphore_gestionnaires_signaux);
2744: sem_destroy(&semaphore_gestionnaires_signaux);
2745: sem_destroy(&((*s_etat_processus)
2746: .semaphore_fork));
2747: # else
2748: sem_post((*s_etat_processus).semaphore_fork);
2749: sem_post(semaphore_gestionnaires_signaux);
2750: sem_destroy2(semaphore_gestionnaires_signaux,
2751: getpid(), SEM_SIGNAUX);
2752: sem_destroy3((*s_etat_processus).semphore_fork,
2753: getpid(), pthread_self(), SEM_FORK);
2754: # endif
2755:
2756: liberation_contexte_cas(s_etat_processus);
2757: liberation_queue_signaux(s_etat_processus);
2758:
2759: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2760: stackoverflow_deinstall_handler();
2761: # endif
2762:
2763: erreur = d_es_signal;
2764:
2765: if ((*s_etat_processus).langue == 'F')
2766: {
2767: printf("+++Système : Initialisation de la pile alternative "
2768: "impossible\n");
2769: }
2770: else
2771: {
2772: printf("+++System : Initialization of alternate "
2773: "stack failed\n");
2774: }
2775:
2776: return(EXIT_FAILURE);
2777: }
2778: # else
2779: action.sa_handler = interruption3;
2780: action.sa_flags = 0;
2781:
2782: if (sigaction(SIGSEGV, &action, NULL) != 0)
2783: {
2784: # ifndef SEMAPHORES_NOMMES
2785: sem_post(&((*s_etat_processus).semaphore_fork));
2786: sem_post(&semaphore_gestionnaires_signaux);
2787: sem_destroy(&semaphore_gestionnaires_signaux);
2788: sem_destroy(&((*s_etat_processus)
2789: .semaphore_fork));
2790: # else
2791: sem_post((*s_etat_processus).semaphore_fork);
2792: sem_post(semaphore_gestionnaires_signaux);
2793: sem_destroy2(semaphore_gestionnaires_signaux,
2794: getpid(), SEM_SIGNAUX);
2795: sem_destroy3((*s_etat_processus).semphore_fork,
2796: getpid(), pthread_self(), SEM_FORK);
2797: # endif
2798:
2799: liberation_contexte_cas(s_etat_processus);
2800: liberation_queue_signaux(s_etat_processus);
2801:
2802: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2803: stackoverflow_deinstall_handler();
2804: # endif
2805:
2806: if ((*s_etat_processus).langue == 'F')
2807: {
2808: printf("+++Système : Initialisation des signaux POSIX "
2809: "impossible\n");
2810: }
2811: else
2812: {
2813: printf("+++System : Initialization of POSIX signals "
2814: "failed\n");
2815: }
2816:
2817: return(EXIT_FAILURE);
2818: }
2819:
2820: signal_test = SIGTEST;
2821: raise(SIGSEGV);
2822:
2823: attente.tv_sec = 0;
2824: attente.tv_nsec = 1000000;
2825:
2826: for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
2827: {
2828: nanosleep(&attente, NULL);
2829: }
2830:
2831: if (signal_test != SIGSEGV)
2832: {
2833: # ifndef SEMAPHORES_NOMMES
2834: sem_post(&((*s_etat_processus).semaphore_fork));
2835: sem_post(&semaphore_gestionnaires_signaux);
2836: sem_destroy(&semaphore_gestionnaires_signaux);
2837: sem_destroy(&((*s_etat_processus)
2838: .semaphore_fork));
2839: # else
2840: sem_post((*s_etat_processus).semaphore_fork);
2841: sem_post(semaphore_gestionnaires_signaux);
2842: sem_destroy2(semaphore_gestionnaires_signaux,
2843: getpid(), SEM_SIGNAUX);
2844: sem_destroy3((*s_etat_processus).semphore_fork,
2845: getpid(), pthread_self(), SEM_FORK);
2846: # endif
2847:
2848: liberation_contexte_cas(s_etat_processus);
2849: liberation_queue_signaux(s_etat_processus);
2850:
2851: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2852: stackoverflow_deinstall_handler();
2853: # endif
2854:
2855: erreur = d_es_signal;
2856:
2857: if ((*s_etat_processus).langue == 'F')
2858: {
2859: printf("+++Système : Initialisation des signaux POSIX "
2860: "impossible\n");
2861: }
2862: else
2863: {
2864: printf("+++System : Initialization of POSIX signals "
2865: "failed\n");
2866: }
2867:
2868: return(EXIT_FAILURE);
2869: }
2870: # endif
2871:
2872: action.sa_handler = interruption3;
2873: action.sa_flags = 0;
2874:
2875: if (sigaction(SIGBUS, &action, NULL) != 0)
2876: {
2877: # ifndef SEMAPHORES_NOMMES
2878: sem_post(&((*s_etat_processus).semaphore_fork));
2879: sem_post(&semaphore_gestionnaires_signaux);
2880: sem_destroy(&semaphore_gestionnaires_signaux);
2881: sem_destroy(&((*s_etat_processus)
2882: .semaphore_fork));
2883: # else
2884: sem_post((*s_etat_processus).semaphore_fork);
2885: sem_post(semaphore_gestionnaires_signaux);
2886: sem_destroy2(semaphore_gestionnaires_signaux,
2887: getpid(), SEM_SIGNAUX);
2888: sem_destroy3((*s_etat_processus).semphore_fork,
2889: getpid(), pthread_self(), SEM_FORK);
2890: # endif
2891:
2892: liberation_contexte_cas(s_etat_processus);
2893: liberation_queue_signaux(s_etat_processus);
2894:
2895: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2896: stackoverflow_deinstall_handler();
2897: # endif
2898:
2899: # ifdef HAVE_SIGSEGV_RECOVERY
2900: if (debug == d_faux)
2901: {
2902: sigsegv_deinstall_handler();
2903: }
2904: # endif
2905:
2906: if ((*s_etat_processus).langue == 'F')
2907: {
2908: printf("+++Système : Initialisation des signaux POSIX "
2909: "impossible\n");
2910: }
2911: else
2912: {
2913: printf("+++System : Initialization of POSIX signals "
2914: "failed\n");
2915: }
2916:
2917: return(EXIT_FAILURE);
2918: }
2919:
2920: signal_test = SIGTEST;
2921: raise(SIGBUS);
2922:
2923: attente.tv_sec = 0;
2924: attente.tv_nsec = 1000000;
2925:
2926: for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
2927: {
2928: nanosleep(&attente, NULL);
2929: }
2930:
2931: if (signal_test != SIGBUS)
2932: {
2933: # ifndef SEMAPHORES_NOMMES
2934: sem_post(&((*s_etat_processus).semaphore_fork));
2935: sem_post(&semaphore_gestionnaires_signaux);
2936: sem_destroy(&semaphore_gestionnaires_signaux);
2937: sem_destroy(&((*s_etat_processus)
2938: .semaphore_fork));
2939: # else
2940: sem_post((*s_etat_processus).semaphore_fork);
2941: sem_post(semaphore_gestionnaires_signaux);
2942: sem_destroy2(semaphore_gestionnaires_signaux,
2943: getpid(), SEM_SIGNAUX);
2944: sem_destroy3((*s_etat_processus).semphore_fork,
2945: getpid(), pthread_self(), SEM_FORK);
2946: # endif
2947:
2948: liberation_contexte_cas(s_etat_processus);
2949: liberation_queue_signaux(s_etat_processus);
2950:
2951: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
2952: stackoverflow_deinstall_handler();
2953: # endif
2954:
2955: # ifdef HAVE_SIGSEGV_RECOVERY
2956: if (debug == d_faux)
2957: {
2958: sigsegv_deinstall_handler();
2959: }
2960: # endif
2961:
2962: erreur = d_es_signal;
2963:
2964: if ((*s_etat_processus).langue == 'F')
2965: {
2966: printf("+++Système : Initialisation des signaux POSIX "
2967: "impossible\n");
2968: }
2969: else
2970: {
2971: printf("+++System : Initialization of POSIX signals "
2972: "failed\n");
2973: }
2974:
2975: return(EXIT_FAILURE);
2976: }
2977:
2978: }
2979:
2980: if (option_n == d_vrai)
2981: {
2982: action.sa_handler = interruption4;
2983: action.sa_flags = 0;
2984:
2985: if (sigaction(SIGHUP, &action, NULL) != 0)
2986: {
2987: # ifndef SEMAPHORES_NOMMES
2988: sem_post(&((*s_etat_processus).semaphore_fork));
2989: sem_post(&semaphore_gestionnaires_signaux);
2990: sem_destroy(&semaphore_gestionnaires_signaux);
2991: sem_destroy(&((*s_etat_processus)
2992: .semaphore_fork));
2993: # else
2994: sem_post((*s_etat_processus).semaphore_fork);
2995: sem_post(semaphore_gestionnaires_signaux);
2996: sem_destroy2(semaphore_gestionnaires_signaux,
2997: getpid(), SEM_SIGNAUX);
2998: sem_destroy3((*s_etat_processus).semphore_fork,
2999: getpid(), pthread_self(), SEM_FORK);
3000: # endif
3001:
3002: liberation_contexte_cas(s_etat_processus);
3003: liberation_queue_signaux(s_etat_processus);
3004:
3005: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3006: stackoverflow_deinstall_handler();
3007: # endif
3008:
3009: # ifdef HAVE_SIGSEGV_RECOVERY
3010: if (debug == d_faux)
3011: {
3012: sigsegv_deinstall_handler();
3013: }
3014: # endif
3015:
3016: if ((*s_etat_processus).langue == 'F')
3017: {
3018: printf("+++Système : Initialisation des signaux POSIX "
3019: "impossible\n");
3020: }
3021: else
3022: {
3023: printf("+++System : Initialization of POSIX signals "
3024: "failed\n");
3025: }
3026:
3027: return(EXIT_FAILURE);
3028: }
3029: }
3030:
3031: if (mode_interactif == d_vrai)
3032: {
3033: printf("\n");
3034:
3035: if ((*s_etat_processus).langue == 'F')
3036: {
3037: printf("+++Ce logiciel est un logiciel libre"
3038: " sans aucune garantie de "
3039: "fonctionnement.\n");
3040: printf("+++Pour plus de détails, utilisez la "
3041: "commande 'warranty'.\n");
3042: }
3043: else
3044: {
3045: printf("+++This is a free software with "
3046: "absolutely no warranty.\n");
3047: printf("+++For details, type 'warranty'.\n");
3048: }
3049:
3050: printf("\n");
3051:
3052: traitement_fichier_temporaire = 'Y';
3053:
3054: if ((nom_fichier_temporaire =
3055: creation_nom_fichier(s_etat_processus, (*s_etat_processus)
3056: .chemin_fichiers_temporaires)) == NULL)
3057: {
3058: # ifndef SEMAPHORES_NOMMES
3059: sem_post(&((*s_etat_processus).semaphore_fork));
3060: sem_post(&semaphore_gestionnaires_signaux);
3061: sem_destroy(&semaphore_gestionnaires_signaux);
3062: sem_destroy(&((*s_etat_processus)
3063: .semaphore_fork));
3064: # else
3065: sem_post((*s_etat_processus).semaphore_fork);
3066: sem_post(semaphore_gestionnaires_signaux);
3067: sem_destroy2(semaphore_gestionnaires_signaux,
3068: getpid(), SEM_SIGNAUX);
3069: sem_destroy3((*s_etat_processus).semphore_fork,
3070: getpid(), pthread_self(), SEM_FORK);
3071: # endif
3072:
3073: liberation_contexte_cas(s_etat_processus);
3074: liberation_queue_signaux(s_etat_processus);
3075:
3076: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3077: stackoverflow_deinstall_handler();
3078: # endif
3079:
3080: # ifdef HAVE_SIGSEGV_RECOVERY
3081: if (debug == d_faux)
3082: {
3083: sigsegv_deinstall_handler();
3084: }
3085: # endif
3086:
3087: if ((*s_etat_processus).langue == 'F')
3088: {
3089: printf("+++Système : Fichier indisponible\n");
3090: }
3091: else
3092: {
3093: printf("+++System : File unavailable\n");
3094: }
3095:
3096: return(EXIT_FAILURE);
3097: }
3098:
3099: if ((f_source = fopen(nom_fichier_temporaire, "w"))
3100: == NULL)
3101: {
3102: # ifndef SEMAPHORES_NOMMES
3103: sem_post(&((*s_etat_processus).semaphore_fork));
3104: sem_post(&semaphore_gestionnaires_signaux);
3105: sem_destroy(&semaphore_gestionnaires_signaux);
3106: sem_destroy(&((*s_etat_processus)
3107: .semaphore_fork));
3108: # else
3109: sem_post((*s_etat_processus).semaphore_fork);
3110: sem_post(semaphore_gestionnaires_signaux);
3111: sem_destroy2(semaphore_gestionnaires_signaux,
3112: getpid(), SEM_SIGNAUX);
3113: sem_destroy3((*s_etat_processus).semphore_fork,
3114: getpid(), pthread_self(), SEM_FORK);
3115: # endif
3116:
3117: liberation_contexte_cas(s_etat_processus);
3118: liberation_queue_signaux(s_etat_processus);
3119:
3120: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3121: stackoverflow_deinstall_handler();
3122: # endif
3123:
3124: # ifdef HAVE_SIGSEGV_RECOVERY
3125: if (debug == d_faux)
3126: {
3127: sigsegv_deinstall_handler();
3128: }
3129: # endif
3130:
3131: if ((*s_etat_processus).langue == 'F')
3132: {
3133: printf("+++Système : Fichier introuvable\n");
3134: }
3135: else
3136: {
3137: printf("+++System : File not found\n");
3138: }
3139:
3140: return(EXIT_FAILURE);
3141: }
3142:
3143: if (fprintf(f_source, "MODE_INTERACTIF\n") < 0)
3144: {
3145: # ifndef SEMAPHORES_NOMMES
3146: sem_post(&((*s_etat_processus).semaphore_fork));
3147: sem_post(&semaphore_gestionnaires_signaux);
3148: sem_destroy(&semaphore_gestionnaires_signaux);
3149: sem_destroy(&((*s_etat_processus)
3150: .semaphore_fork));
3151: # else
3152: sem_post((*s_etat_processus).semaphore_fork);
3153: sem_post(semaphore_gestionnaires_signaux);
3154: sem_destroy2(semaphore_gestionnaires_signaux,
3155: getpid(), SEM_SIGNAUX);
3156: sem_destroy3((*s_etat_processus).semphore_fork,
3157: getpid(), pthread_self(), SEM_FORK);
3158: # endif
3159:
3160: liberation_contexte_cas(s_etat_processus);
3161: liberation_queue_signaux(s_etat_processus);
3162:
3163: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3164: stackoverflow_deinstall_handler();
3165: # endif
3166:
3167: # ifdef HAVE_SIGSEGV_RECOVERY
3168: if (debug == d_faux)
3169: {
3170: sigsegv_deinstall_handler();
3171: }
3172: # endif
3173:
3174: if ((*s_etat_processus).langue == 'F')
3175: {
3176: printf("+++Système : Erreur d'écriture dans un fichier\n");
3177: }
3178: else
3179: {
3180: printf("+++System : Cannot write in file\n");
3181: }
3182:
3183: return(EXIT_FAILURE);
3184: }
3185:
3186: if (fprintf(f_source,
3187: "<< DO HALT UNTIL FALSE END >>\n") < 0)
3188: {
3189: # ifndef SEMAPHORES_NOMMES
3190: sem_post(&((*s_etat_processus).semaphore_fork));
3191: sem_post(&semaphore_gestionnaires_signaux);
3192: sem_destroy(&semaphore_gestionnaires_signaux);
3193: sem_destroy(&((*s_etat_processus)
3194: .semaphore_fork));
3195: # else
3196: sem_post((*s_etat_processus).semaphore_fork);
3197: sem_post(semaphore_gestionnaires_signaux);
3198: sem_destroy2(semaphore_gestionnaires_signaux,
3199: getpid(), SEM_SIGNAUX);
3200: sem_destroy3((*s_etat_processus).semphore_fork,
3201: getpid(), pthread_self(), SEM_FORK);
3202: # endif
3203:
3204: liberation_contexte_cas(s_etat_processus);
3205: liberation_queue_signaux(s_etat_processus);
3206:
3207: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3208: stackoverflow_deinstall_handler();
3209: # endif
3210:
3211: # ifdef HAVE_SIGSEGV_RECOVERY
3212: if (debug == d_faux)
3213: {
3214: sigsegv_deinstall_handler();
3215: }
3216: # endif
3217:
3218: if ((*s_etat_processus).langue == 'F')
3219: {
3220: printf("+++Système : Erreur d'écriture dans un fichier\n");
3221: }
3222: else
3223: {
3224: printf("+++System : Cannot write in file\n");
3225: }
3226:
3227: return(EXIT_FAILURE);
3228: }
3229:
3230: if (fclose(f_source) != 0)
3231: {
3232: # ifndef SEMAPHORES_NOMMES
3233: sem_post(&((*s_etat_processus).semaphore_fork));
3234: sem_post(&semaphore_gestionnaires_signaux);
3235: sem_destroy(&semaphore_gestionnaires_signaux);
3236: sem_destroy(&((*s_etat_processus)
3237: .semaphore_fork));
3238: # else
3239: sem_post((*s_etat_processus).semaphore_fork);
3240: sem_post(semaphore_gestionnaires_signaux);
3241: sem_destroy2(semaphore_gestionnaires_signaux,
3242: getpid(), SEM_SIGNAUX);
3243: sem_destroy3((*s_etat_processus).semphore_fork,
3244: getpid(), pthread_self(), SEM_FORK);
3245: # endif
3246:
3247: liberation_contexte_cas(s_etat_processus);
3248: liberation_queue_signaux(s_etat_processus);
3249:
3250: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3251: stackoverflow_deinstall_handler();
3252: # endif
3253:
3254: # ifdef HAVE_SIGSEGV_RECOVERY
3255: if (debug == d_faux)
3256: {
3257: sigsegv_deinstall_handler();
3258: }
3259: # endif
3260:
3261: if ((*s_etat_processus).langue == 'F')
3262: {
3263: printf("+++Système : Fichier indisponible\n");
3264: }
3265: else
3266: {
3267: printf("+++System : File unavailable\n");
3268: }
3269:
3270: return(EXIT_FAILURE);
3271: }
3272:
3273: (*s_etat_processus).lancement_interactif = d_vrai;
3274: (*s_etat_processus).nom_fichier_source =
3275: nom_fichier_temporaire;
3276:
3277: presence_definition = 'O';
3278: }
3279: else
3280: {
3281: nom_fichier_temporaire = NULL;
3282: }
3283:
3284: if ((*s_etat_processus).nom_fichier_source == NULL)
3285: {
3286: erreur_fichier = d_erreur;
3287: }
3288: else
3289: {
3290: erreur_fichier = caracteristiques_fichier(s_etat_processus,
3291: (*s_etat_processus).nom_fichier_source,
3292: &existence, &ouverture, &unite_fichier);
3293: }
3294:
3295: if (((existence == d_faux) || (erreur_fichier != d_absence_erreur)) &&
3296: (option_S == d_faux))
3297: {
3298: # ifndef SEMAPHORES_NOMMES
3299: sem_post(&((*s_etat_processus).semaphore_fork));
3300: sem_post(&semaphore_gestionnaires_signaux);
3301: sem_destroy(&semaphore_gestionnaires_signaux);
3302: sem_destroy(&((*s_etat_processus).semaphore_fork));
3303: # else
3304: sem_post((*s_etat_processus).semaphore_fork);
3305: sem_post(semaphore_gestionnaires_signaux);
3306: sem_destroy2(semaphore_gestionnaires_signaux,
3307: getpid(), SEM_SIGNAUX);
3308: sem_destroy3((*s_etat_processus).semphore_fork,
3309: getpid(), pthread_self(), SEM_FORK);
3310: # endif
3311:
3312: liberation_contexte_cas(s_etat_processus);
3313: liberation_queue_signaux(s_etat_processus);
3314:
3315: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3316: stackoverflow_deinstall_handler();
3317: # endif
3318:
3319: # ifdef HAVE_SIGSEGV_RECOVERY
3320: if (debug == d_faux)
3321: {
3322: sigsegv_deinstall_handler();
3323: }
3324: # endif
3325:
3326: if (presence_definition == 'O')
3327: {
3328: if ((*s_etat_processus).langue == 'F')
3329: {
3330: printf("+++Erreur : Fichier %s inexistant\n",
3331: (*s_etat_processus).nom_fichier_source);
3332: }
3333: else
3334: {
3335: printf("+++Error : File %s not found\n",
3336: (*s_etat_processus).nom_fichier_source);
3337: }
3338:
3339: erreur = d_erreur;
3340: }
3341: else
3342: {
3343: if ((*s_etat_processus).langue == 'F')
3344: {
3345: printf("+++Erreur : Absence de définition à exécuter\n");
3346: }
3347: else
3348: {
3349: printf("+++Error : Any executable definition\n");
3350: }
3351: }
3352:
3353: return(EXIT_FAILURE);
3354: }
3355:
3356: if ((*s_etat_processus).chemin_fichiers_temporaires == NULL)
3357: {
3358: # ifndef SEMAPHORES_NOMMES
3359: sem_post(&((*s_etat_processus).semaphore_fork));
3360: sem_post(&semaphore_gestionnaires_signaux);
3361: sem_destroy(&semaphore_gestionnaires_signaux);
3362: sem_destroy(&((*s_etat_processus).semaphore_fork));
3363: # else
3364: sem_post((*s_etat_processus).semaphore_fork);
3365: sem_post(semaphore_gestionnaires_signaux);
3366: sem_destroy2(semaphore_gestionnaires_signaux,
3367: getpid(), SEM_SIGNAUX);
3368: sem_destroy3((*s_etat_processus).semphore_fork,
3369: getpid(), pthread_self(), SEM_FORK);
3370: # endif
3371:
3372: liberation_contexte_cas(s_etat_processus);
3373: liberation_queue_signaux(s_etat_processus);
3374:
3375: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3376: stackoverflow_deinstall_handler();
3377: # endif
3378:
3379: # ifdef HAVE_SIGSEGV_RECOVERY
3380: if (debug == d_faux)
3381: {
3382: sigsegv_deinstall_handler();
3383: }
3384: # endif
3385:
3386: if ((*s_etat_processus).langue == 'F')
3387: {
3388: printf("+++Système : Chemin des fichiers temporaires nul\n");
3389: }
3390: else
3391: {
3392: printf("+++System : Null temporary files path\n");
3393: }
3394:
3395: return(EXIT_FAILURE);
3396: }
3397:
3398: if ((*s_etat_processus).debug == d_vrai)
3399: {
3400: if ((*s_etat_processus).langue == 'F')
3401: {
3402: printf("[%d] Chemin des fichiers temporaires %s\n\n",
3403: (int) getpid(),
3404: (*s_etat_processus).chemin_fichiers_temporaires);
3405: }
3406: else
3407: {
3408: printf("[%d] Temporary files path %s\n\n",
3409: (int) getpid(),
3410: (*s_etat_processus).chemin_fichiers_temporaires);
3411: }
3412: }
3413:
3414: if ((erreur == d_absence_erreur) && (presence_definition == 'O'))
3415: {
3416: (*s_etat_processus).profilage = (option_P != 0) ? d_vrai : d_faux;
3417: (*s_etat_processus).niveau_profilage = option_P;
3418: (*s_etat_processus).pile_profilage = NULL;
3419: (*s_etat_processus).pile_profilage_fonctions = NULL;
3420: gettimeofday(&((*s_etat_processus).horodatage_profilage), NULL);
3421:
3422: (*s_etat_processus).liste_mutexes = NULL;
3423: (*s_etat_processus).sections_critiques = 0;
3424: (*s_etat_processus).initialisation_scheduler = d_faux;
3425:
3426: (*s_etat_processus).test_instruction = 'N';
3427: (*s_etat_processus).nombre_arguments = 0;
3428: (*s_etat_processus).affichage_arguments = 'N';
3429: (*s_etat_processus).autorisation_conversion_chaine = 'Y';
3430: (*s_etat_processus).autorisation_evaluation_nom = 'Y';
3431:
3432: if (mode_interactif == d_vrai)
3433: {
3434: (*s_etat_processus).autorisation_nom_implicite = 'Y';
3435: }
3436: else
3437: {
3438: (*s_etat_processus).autorisation_nom_implicite = 'N';
3439: }
3440:
3441: (*s_etat_processus).autorisation_empilement_programme = 'N';
3442: (*s_etat_processus).requete_arret = 'N';
3443: (*s_etat_processus).evaluation_forcee = 'N';
3444: (*s_etat_processus).recherche_type = 'N';
3445:
3446: (*s_etat_processus).constante_symbolique = 'N';
3447: (*s_etat_processus).traitement_symbolique = 'N';
3448:
3449: (*s_etat_processus).expression_courante = NULL;
3450: (*s_etat_processus).objet_courant = NULL;
3451: (*s_etat_processus).evaluation_expression_compilee = 'N';
3452:
3453: (*s_etat_processus).l_base_pile = NULL;
3454: (*s_etat_processus).l_base_pile_last = NULL;
3455:
3456: (*s_etat_processus).s_arbre_variables = NULL;
3457: (*s_etat_processus).l_liste_variables_par_niveau = NULL;
3458: (*s_etat_processus).l_liste_variables_statiques = NULL;
3459: (*s_etat_processus).gel_liste_variables = d_faux;
3460: s_arbre_variables_partagees = NULL;
3461: l_liste_variables_partagees = NULL;
3462: (*s_etat_processus).s_arbre_variables_partagees =
3463: &s_arbre_variables_partagees;
3464: (*s_etat_processus).l_liste_variables_partagees =
3465: &l_liste_variables_partagees;
3466: (*s_etat_processus).pointeur_variable_courante = NULL;
3467: (*s_etat_processus).pointeur_variable_statique_courante = NULL;
3468: (*s_etat_processus).pointeur_variable_partagee_courante = NULL;
3469: (*s_etat_processus).niveau_courant = 0;
3470: (*s_etat_processus).niveau_initial = 0;
3471: (*s_etat_processus).creation_variables_statiques = d_faux;
3472: (*s_etat_processus).creation_variables_partagees = d_faux;
3473:
3474: (*s_etat_processus).s_bibliotheques = NULL;
3475: (*s_etat_processus).s_instructions_externes = NULL;
3476: (*s_etat_processus).nombre_instructions_externes = 0;
3477:
3478: (*s_etat_processus).systeme_axes = 0;
3479:
3480: (*s_etat_processus).x_min = -10.;
3481: (*s_etat_processus).x_max = 10.;
3482: (*s_etat_processus).y_min = -10.;
3483: (*s_etat_processus).y_max = 10.;
3484: (*s_etat_processus).z_min = -10.;
3485: (*s_etat_processus).z_max = 10.;
3486:
3487: (*s_etat_processus).x2_min = -10.;
3488: (*s_etat_processus).x2_max = 10.;
3489: (*s_etat_processus).y2_min = -10.;
3490: (*s_etat_processus).y2_max = 10.;
3491: (*s_etat_processus).z2_min = -10.;
3492: (*s_etat_processus).z2_max = 10.;
3493:
3494: (*s_etat_processus).resolution = .01;
3495:
3496: (*s_etat_processus).souris_active = d_faux;
3497:
3498: (*s_etat_processus).echelle_automatique_x = d_faux;
3499: (*s_etat_processus).echelle_automatique_y = d_faux;
3500: (*s_etat_processus).echelle_automatique_z = d_faux;
3501:
3502: (*s_etat_processus).echelle_automatique_x2 = d_faux;
3503: (*s_etat_processus).echelle_automatique_y2 = d_faux;
3504: (*s_etat_processus).echelle_automatique_z2 = d_faux;
3505:
3506: (*s_etat_processus).echelle_log_x = d_faux;
3507: (*s_etat_processus).echelle_log_y = d_faux;
3508: (*s_etat_processus).echelle_log_z = d_faux;
3509:
3510: (*s_etat_processus).echelle_log_x2 = d_faux;
3511: (*s_etat_processus).echelle_log_y2 = d_faux;
3512: (*s_etat_processus).echelle_log_z2 = d_faux;
3513:
3514: (*s_etat_processus).point_de_vue_theta = 4 * atan((real8) 1) / 6;
3515: (*s_etat_processus).point_de_vue_phi = 4 * atan((real8) 1) / 3;
3516: (*s_etat_processus).echelle_3D = 1;
3517:
3518: strcpy((*s_etat_processus).type_trace_eq, "FONCTION");
3519: strcpy((*s_etat_processus).type_trace_sigma, "POINTS");
3520: (*s_etat_processus).fichiers_graphiques = NULL;
3521: (*s_etat_processus).nom_fichier_impression = NULL;
3522: strcpy((*s_etat_processus).format_papier, "a4paper");
3523: (*s_etat_processus).entree_standard = NULL;
3524: (*s_etat_processus).s_marques = NULL;
3525: (*s_etat_processus).requete_nouveau_plan = d_vrai;
3526: (*s_etat_processus).mise_a_jour_trace_requise = d_faux;
3527:
3528: (*s_etat_processus).l_base_pile = NULL;
3529: (*s_etat_processus).hauteur_pile_operationnelle = 0;
3530: (*s_etat_processus).l_base_pile_contextes = NULL;
3531: (*s_etat_processus).l_base_pile_taille_contextes = NULL;
3532:
3533: (*s_etat_processus).position_courante = 0;
3534:
3535: (*s_etat_processus).l_base_pile_systeme = NULL;
3536: (*s_etat_processus).hauteur_pile_systeme = 0;
3537:
3538: (*s_etat_processus).l_base_pile_processus = NULL;
3539: (*s_etat_processus).presence_pipes = d_faux;
3540: (*s_etat_processus).pipe_donnees = 0;
3541: (*s_etat_processus).pipe_acquittement = 0;
3542: (*s_etat_processus).pipe_injections = 0;
3543: (*s_etat_processus).pipe_nombre_injections = 0;
3544: (*s_etat_processus).nombre_objets_injectes = 0;
3545: (*s_etat_processus).nombre_objets_envoyes_non_lus = 0;
3546: (*s_etat_processus).pourcentage_maximal_cpu = 100;
3547: (*s_etat_processus).temps_maximal_cpu = 0;
3548: (*s_etat_processus).thread_fusible = 0;
3549: (*s_etat_processus).presence_fusible = d_faux;
3550:
3551: (*s_etat_processus).niveau_recursivite = 0;
3552: (*s_etat_processus).generateur_aleatoire = NULL;
3553: (*s_etat_processus).type_generateur_aleatoire = NULL;
3554:
3555: (*s_etat_processus).colonne_statistique_1 = 1;
3556: (*s_etat_processus).colonne_statistique_2 = 2;
3557:
3558: (*s_etat_processus).debug_programme = d_faux;
3559: (*s_etat_processus).execution_pas_suivant = d_faux;
3560: (*s_etat_processus).traitement_instruction_halt = d_faux;
3561:
3562: (*s_etat_processus).derniere_exception = d_ep;
3563: (*s_etat_processus).derniere_erreur_systeme = d_es;
3564: (*s_etat_processus).derniere_erreur_execution = d_ex;
3565: (*s_etat_processus).derniere_erreur_evaluation = d_ex;
3566: (*s_etat_processus).derniere_erreur_fonction_externe = 0;
3567:
3568: (*s_etat_processus).erreur_processus_fils = d_faux;
3569: (*s_etat_processus).erreur_systeme_processus_fils = d_es;
3570: (*s_etat_processus).erreur_execution_processus_fils = d_ex;
3571: (*s_etat_processus).pid_erreur_processus_fils = 0;
3572: (*s_etat_processus).exception_processus_fils = d_ep;
3573: (*s_etat_processus).core = core;
3574: (*s_etat_processus).invalidation_message_erreur = d_faux;
3575: (*s_etat_processus).s_objet_errone = NULL;
3576: (*s_etat_processus).s_objet_erreur = NULL;
3577:
3578: (*s_etat_processus).retour_routine_evaluation = 'N';
3579:
3580: (*s_etat_processus).traitement_interruption = 'N';
3581: (*s_etat_processus).traitement_interruptible = 'Y';
3582: (*s_etat_processus).nombre_interruptions_en_queue = 0;
3583: (*s_etat_processus).nombre_interruptions_non_affectees = 0;
3584:
3585: for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
3586: {
3587: (*s_etat_processus).masque_interruptions[i] = 'N';
3588: (*s_etat_processus).queue_interruptions[i] = 0;
3589: (*s_etat_processus).corps_interruptions[i] = NULL;
3590: (*s_etat_processus).pile_origine_interruptions[i] = NULL;
3591: }
3592:
3593: (*s_etat_processus).at_exit = NULL;
3594: (*s_etat_processus).at_poke = NULL;
3595: (*s_etat_processus).traitement_at_poke = 'N';
3596:
3597: (*s_etat_processus).pointeurs_caracteres = NULL;
3598: (*s_etat_processus).arbre_instructions = NULL;
3599:
3600: (*s_etat_processus).tid_processus_pere = pthread_self();
3601: (*s_etat_processus).tid = pthread_self();
3602: (*s_etat_processus).pid_processus_pere = getpid();
3603: (*s_etat_processus).processus_detache = d_vrai;
3604: (*s_etat_processus).var_volatile_processus_pere = -1;
3605: (*s_etat_processus).var_volatile_processus_racine = -1;
3606: (*s_etat_processus).var_volatile_traitement_retarde_stop = 0;
3607: (*s_etat_processus).var_volatile_alarme = 0;
3608: (*s_etat_processus).var_volatile_requete_arret = 0;
3609: (*s_etat_processus).var_volatile_requete_arret2 = 0;
3610: (*s_etat_processus).var_volatile_traitement_retarde_stop = 0;
3611: (*s_etat_processus).var_volatile_traitement_sigint = 0;
3612: (*s_etat_processus).var_volatile_recursivite = 0;
3613: (*s_etat_processus).var_volatile_exception_gsl = 0;
3614: (*s_etat_processus).arret_depuis_abort = 0;
3615: (*s_etat_processus).pointeur_signal_lecture = 0;
3616: (*s_etat_processus).pointeur_signal_ecriture = 0;
3617:
3618: initialisation_allocateur(s_etat_processus);
3619: initialisation_drapeaux(s_etat_processus);
3620: initialisation_variables(s_etat_processus);
3621: initialisation_instructions(s_etat_processus);
3622:
3623: if ((*s_etat_processus).erreur_systeme != d_es)
3624: {
3625: # ifndef SEMAPHORES_NOMMES
3626: sem_post(&((*s_etat_processus).semaphore_fork));
3627: sem_post(&semaphore_gestionnaires_signaux);
3628: sem_destroy(&semaphore_gestionnaires_signaux);
3629: sem_destroy(&((*s_etat_processus).semaphore_fork));
3630: # else
3631: sem_post((*s_etat_processus).semaphore_fork);
3632: sem_post(semaphore_gestionnaires_signaux);
3633: sem_destroy2(semaphore_gestionnaires_signaux,
3634: getpid(), SEM_SIGNAUX);
3635: sem_destroy3((*s_etat_processus).semphore_fork,
3636: getpid(), pthread_self(), SEM_FORK);
3637: # endif
3638:
3639: liberation_contexte_cas(s_etat_processus);
3640: liberation_queue_signaux(s_etat_processus);
3641:
3642: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3643: stackoverflow_deinstall_handler();
3644: # endif
3645:
3646: # ifdef HAVE_SIGSEGV_RECOVERY
3647: if (debug == d_faux)
3648: {
3649: sigsegv_deinstall_handler();
3650: }
3651: # endif
3652:
3653: if ((*s_etat_processus).langue == 'F')
3654: {
3655: printf("+++Système : Mémoire insuffisante\n");
3656: }
3657: else
3658: {
3659: printf("+++System : Not enough memory\n");
3660: }
3661:
3662: return(EXIT_FAILURE);
3663: }
3664:
3665: if (((*s_etat_processus).instruction_derniere_erreur =
3666: malloc(sizeof(unsigned char))) == NULL)
3667: {
3668: # ifndef SEMAPHORES_NOMMES
3669: sem_post(&((*s_etat_processus).semaphore_fork));
3670: sem_post(&semaphore_gestionnaires_signaux);
3671: sem_destroy(&semaphore_gestionnaires_signaux);
3672: sem_destroy(&((*s_etat_processus).semaphore_fork));
3673: # else
3674: sem_post((*s_etat_processus).semaphore_fork);
3675: sem_post(semaphore_gestionnaires_signaux);
3676: sem_destroy2(semaphore_gestionnaires_signaux,
3677: getpid(), SEM_SIGNAUX);
3678: sem_destroy3((*s_etat_processus).semphore_fork,
3679: getpid(), pthread_self(), SEM_FORK);
3680: # endif
3681:
3682: liberation_contexte_cas(s_etat_processus);
3683: liberation_queue_signaux(s_etat_processus);
3684:
3685: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3686: stackoverflow_deinstall_handler();
3687: # endif
3688:
3689: # ifdef HAVE_SIGSEGV_RECOVERY
3690: if (debug == d_faux)
3691: {
3692: sigsegv_deinstall_handler();
3693: }
3694: # endif
3695:
3696: erreur = d_es_allocation_memoire;
3697:
3698: if ((*s_etat_processus).langue == 'F')
3699: {
3700: printf("+++Système : Mémoire insuffisante\n");
3701: }
3702: else
3703: {
3704: printf("+++System : Not enough memory\n");
3705: }
3706:
3707: return(EXIT_FAILURE);
3708: }
3709:
3710: strcpy((*s_etat_processus).instruction_derniere_erreur, "");
3711: (*s_etat_processus).niveau_derniere_erreur = 0;
3712:
3713: if (traitement_fichier_temporaire == 'Y')
3714: {
3715: (*s_etat_processus).mode_interactif = 'Y';
3716: }
3717: else
3718: {
3719: (*s_etat_processus).mode_interactif = 'N';
3720: }
3721:
3722: if (((*s_etat_processus).instruction_courante = (unsigned char *)
3723: malloc(sizeof(unsigned char))) == NULL)
3724: {
3725: # ifndef SEMAPHORES_NOMMES
3726: sem_post(&((*s_etat_processus).semaphore_fork));
3727: sem_post(&semaphore_gestionnaires_signaux);
3728: sem_destroy(&semaphore_gestionnaires_signaux);
3729: sem_destroy(&((*s_etat_processus).semaphore_fork));
3730: # else
3731: sem_post((*s_etat_processus).semaphore_fork);
3732: sem_post(semaphore_gestionnaires_signaux);
3733: sem_destroy2(semaphore_gestionnaires_signaux,
3734: getpid(), SEM_SIGNAUX);
3735: sem_destroy3((*s_etat_processus).semphore_fork,
3736: getpid(), pthread_self(), SEM_FORK);
3737: # endif
3738:
3739: liberation_contexte_cas(s_etat_processus);
3740: liberation_queue_signaux(s_etat_processus);
3741:
3742: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3743: stackoverflow_deinstall_handler();
3744: # endif
3745:
3746: # ifdef HAVE_SIGSEGV_RECOVERY
3747: if (debug == d_faux)
3748: {
3749: sigsegv_deinstall_handler();
3750: }
3751: # endif
3752:
3753: erreur = d_es_allocation_memoire;
3754:
3755: if ((*s_etat_processus).langue == 'F')
3756: {
3757: printf("+++Système : Mémoire insuffisante\n");
3758: }
3759: else
3760: {
3761: printf("+++System : Not enough memory\n");
3762: }
3763:
3764: return(EXIT_FAILURE);
3765: }
3766:
3767: (*s_etat_processus).instruction_courante[0] = d_code_fin_chaine;
3768:
3769: empilement_pile_systeme(s_etat_processus);
3770:
3771: free((*s_etat_processus).instruction_courante);
3772:
3773: if ((*s_etat_processus).erreur_systeme != d_es)
3774: {
3775: erreur = d_es_allocation_memoire;
3776: }
3777: else
3778: {
3779: (*((*s_etat_processus).l_base_pile_systeme))
3780: .retour_definition = 'Y';
3781:
3782: (*s_etat_processus).indep = allocation(s_etat_processus, NON);
3783: (*s_etat_processus).depend = allocation(s_etat_processus, NON);
3784: (*s_etat_processus).parametres_courbes_de_niveau =
3785: allocation(s_etat_processus, NON);
3786:
3787: if (((*s_etat_processus).indep != NULL) &&
3788: ((*s_etat_processus).depend != NULL) &&
3789: ((*s_etat_processus).parametres_courbes_de_niveau
3790: != NULL))
3791: {
3792: (*((*s_etat_processus).indep)).type = NOM;
3793: (*((*s_etat_processus).depend)).type = NOM;
3794: (*((*s_etat_processus).
3795: parametres_courbes_de_niveau)).type = LST;
3796:
3797: initialisation_objet((*s_etat_processus).indep);
3798: initialisation_objet((*s_etat_processus).depend);
3799: initialisation_objet((*s_etat_processus)
3800: .parametres_courbes_de_niveau);
3801:
3802: (*((*s_etat_processus).indep)).objet = (struct_nom *)
3803: malloc(sizeof(struct_nom));
3804: (*((*s_etat_processus).depend)).objet = (struct_nom *)
3805: malloc(sizeof(struct_nom));
3806: (*((*s_etat_processus).parametres_courbes_de_niveau))
3807: .objet = (struct_liste_chainee *)
3808: malloc(sizeof(struct_liste_chainee));
3809:
3810: if (((*((*s_etat_processus).depend)).objet == NULL) ||
3811: ((*((*s_etat_processus).depend)).objet == NULL) ||
3812: ((*((*s_etat_processus).
3813: parametres_courbes_de_niveau)).objet == NULL))
3814: {
3815: # ifndef SEMAPHORES_NOMMES
3816: sem_post(&((*s_etat_processus).semaphore_fork));
3817: sem_post(&semaphore_gestionnaires_signaux);
3818: sem_destroy(&semaphore_gestionnaires_signaux);
3819: sem_destroy(&((*s_etat_processus).semaphore_fork));
3820: # else
3821: sem_post((*s_etat_processus).semaphore_fork);
3822: sem_post(semaphore_gestionnaires_signaux);
3823: sem_destroy2(semaphore_gestionnaires_signaux,
3824: getpid(), SEM_SIGNAUX);
3825: sem_destroy3((*s_etat_processus).semphore_fork,
3826: getpid(), pthread_self(), SEM_FORK);
3827: # endif
3828:
3829: liberation_contexte_cas(s_etat_processus);
3830: liberation_queue_signaux(s_etat_processus);
3831:
3832: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3833: stackoverflow_deinstall_handler();
3834: # endif
3835:
3836: # ifdef HAVE_SIGSEGV_RECOVERY
3837: if (debug == d_faux)
3838: {
3839: sigsegv_deinstall_handler();
3840: }
3841: # endif
3842:
3843: erreur = d_es_allocation_memoire;
3844:
3845: if ((*s_etat_processus).langue == 'F')
3846: {
3847: printf("+++Système : Mémoire insuffisante\n");
3848: }
3849: else
3850: {
3851: printf("+++System : Not enough memory\n");
3852: }
3853:
3854: return(EXIT_FAILURE);
3855: }
3856:
3857: (*((struct_nom *) (*((*s_etat_processus).indep)).objet))
3858: .nom = malloc(2 * sizeof(unsigned char));
3859: (*((struct_nom *) (*((*s_etat_processus).depend)).objet))
3860: .nom = malloc(2 * sizeof(unsigned char));
3861:
3862: if (((*((struct_nom *) (*((*s_etat_processus).indep))
3863: .objet)).nom == NULL) || ((*((struct_nom *)
3864: (*((*s_etat_processus).depend)).objet)).nom ==
3865: NULL))
3866: {
3867: # ifndef SEMAPHORES_NOMMES
3868: sem_post(&((*s_etat_processus).semaphore_fork));
3869: sem_post(&semaphore_gestionnaires_signaux);
3870: sem_destroy(&semaphore_gestionnaires_signaux);
3871: sem_destroy(&((*s_etat_processus).semaphore_fork));
3872: # else
3873: sem_post((*s_etat_processus).semaphore_fork);
3874: sem_post(semaphore_gestionnaires_signaux);
3875: sem_destroy2(semaphore_gestionnaires_signaux,
3876: getpid(), SEM_SIGNAUX);
3877: sem_destroy3((*s_etat_processus).semphore_fork,
3878: getpid(), pthread_self(), SEM_FORK);
3879: # endif
3880:
3881: liberation_contexte_cas(s_etat_processus);
3882: liberation_queue_signaux(s_etat_processus);
3883:
3884: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3885: stackoverflow_deinstall_handler();
3886: # endif
3887:
3888: # ifdef HAVE_SIGSEGV_RECOVERY
3889: if (debug == d_faux)
3890: {
3891: sigsegv_deinstall_handler();
3892: }
3893: # endif
3894:
3895: erreur = d_es_allocation_memoire;
3896:
3897: if ((*s_etat_processus).langue == 'F')
3898: {
3899: printf("+++Système : Mémoire insuffisante\n");
3900: }
3901: else
3902: {
3903: printf("+++System : Not enough memory\n");
3904: }
3905:
3906: return(EXIT_FAILURE);
3907: }
3908:
3909: strcpy((*((struct_nom *) (*((*s_etat_processus).indep))
3910: .objet)).nom, "X");
3911: strcpy((*((struct_nom *) (*((*s_etat_processus).depend))
3912: .objet)).nom, "Y");
3913:
3914: (*((struct_nom *) (*((*s_etat_processus).indep))
3915: .objet)).symbole = d_vrai;
3916: (*((struct_nom *) (*((*s_etat_processus).depend))
3917: .objet)).symbole = d_vrai;
3918:
3919: (*((struct_liste_chainee *) (*((*s_etat_processus)
3920: .parametres_courbes_de_niveau)).objet)).suivant
3921: = NULL;
3922:
3923: (*((struct_liste_chainee *) (*((*s_etat_processus)
3924: .parametres_courbes_de_niveau)).objet)).donnee
3925: = malloc(sizeof(struct_objet));
3926:
3927: (*s_etat_processus).legende =
3928: malloc(sizeof(unsigned char));
3929: (*s_etat_processus).label_x =
3930: malloc(sizeof(unsigned char));
3931: (*s_etat_processus).label_y =
3932: malloc(sizeof(unsigned char));
3933: (*s_etat_processus).label_z =
3934: malloc(sizeof(unsigned char));
3935: (*s_etat_processus).titre =
3936: malloc(sizeof(unsigned char));
3937:
3938: if (((*s_etat_processus).label_x == NULL) ||
3939: ((*s_etat_processus).label_y == NULL) ||
3940: ((*s_etat_processus).label_z == NULL) ||
3941: ((*s_etat_processus).titre == NULL) ||
3942: ((*s_etat_processus).legende == NULL) ||
3943: ((*((struct_liste_chainee *) (*((*s_etat_processus)
3944: .parametres_courbes_de_niveau)).objet)).donnee
3945: == NULL))
3946: {
3947: # ifndef SEMAPHORES_NOMMES
3948: sem_post(&((*s_etat_processus).semaphore_fork));
3949: sem_post(&semaphore_gestionnaires_signaux);
3950: sem_destroy(&semaphore_gestionnaires_signaux);
3951: sem_destroy(&((*s_etat_processus).semaphore_fork));
3952: # else
3953: sem_post((*s_etat_processus).semaphore_fork);
3954: sem_post(semaphore_gestionnaires_signaux);
3955: sem_destroy2(semaphore_gestionnaires_signaux,
3956: getpid(), SEM_SIGNAUX);
3957: sem_destroy3((*s_etat_processus).semphore_fork,
3958: getpid(), pthread_self(), SEM_FORK);
3959: # endif
3960:
3961: liberation_contexte_cas(s_etat_processus);
3962: liberation_queue_signaux(s_etat_processus);
3963:
3964: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
3965: stackoverflow_deinstall_handler();
3966: # endif
3967:
3968: # ifdef HAVE_SIGSEGV_RECOVERY
3969: if (debug == d_faux)
3970: {
3971: sigsegv_deinstall_handler();
3972: }
3973: # endif
3974:
3975: erreur = d_es_allocation_memoire;
3976:
3977: if ((*s_etat_processus).langue == 'F')
3978: {
3979: printf("+++Système : Mémoire insuffisante\n");
3980: }
3981: else
3982: {
3983: printf("+++System : Not enough memory\n");
3984: }
3985:
3986: return(EXIT_FAILURE);
3987: }
3988:
3989: (*(*((struct_liste_chainee *) (*((*s_etat_processus)
3990: .parametres_courbes_de_niveau)).objet)).donnee)
3991: .type = CHN;
3992:
3993: initialisation_objet((*((struct_liste_chainee *)
3994: (*((*s_etat_processus)
3995: .parametres_courbes_de_niveau))
3996: .objet)).donnee);
3997:
3998: if (((*(*((struct_liste_chainee *) (*((*s_etat_processus)
3999: .parametres_courbes_de_niveau)).objet)).donnee)
4000: .objet = malloc(10 * sizeof(unsigned char)))
4001: == NULL)
4002: {
4003: # ifndef SEMAPHORES_NOMMES
4004: sem_post(&((*s_etat_processus).semaphore_fork));
4005: sem_post(&semaphore_gestionnaires_signaux);
4006: sem_destroy(&semaphore_gestionnaires_signaux);
4007: sem_destroy(&((*s_etat_processus).semaphore_fork));
4008: # else
4009: sem_post((*s_etat_processus).semaphore_fork);
4010: sem_post(semaphore_gestionnaires_signaux);
4011: sem_destroy2(semaphore_gestionnaires_signaux,
4012: getpid(), SEM_SIGNAUX);
4013: sem_destroy3((*s_etat_processus).semphore_fork,
4014: getpid(), pthread_self(), SEM_FORK);
4015: # endif
4016:
4017: liberation_contexte_cas(s_etat_processus);
4018: liberation_queue_signaux(s_etat_processus);
4019:
4020: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4021: stackoverflow_deinstall_handler();
4022: # endif
4023:
4024: # ifdef HAVE_SIGSEGV_RECOVERY
4025: if (debug == d_faux)
4026: {
4027: sigsegv_deinstall_handler();
4028: }
4029: # endif
4030:
4031: erreur = d_es_allocation_memoire;
4032:
4033: if ((*s_etat_processus).langue == 'F')
4034: {
4035: printf("+++Système : Mémoire insuffisante\n");
4036: }
4037: else
4038: {
4039: printf("+++System : Not enough memory\n");
4040: }
4041:
4042: return(EXIT_FAILURE);
4043: }
4044:
4045: strcpy((unsigned char *) (*(*((struct_liste_chainee *)
4046: (*((*s_etat_processus)
4047: .parametres_courbes_de_niveau))
4048: .objet)).donnee).objet, "AUTOMATIC");
4049:
4050: (*s_etat_processus).label_x[0] = d_code_fin_chaine;
4051: (*s_etat_processus).label_y[0] = d_code_fin_chaine;
4052: (*s_etat_processus).label_z[0] = d_code_fin_chaine;
4053: (*s_etat_processus).titre[0] = d_code_fin_chaine;
4054: (*s_etat_processus).legende[0] = d_code_fin_chaine;
4055:
4056: (*s_etat_processus).nom_fichier_gnuplot = NULL;
4057: (*s_etat_processus).type_fichier_gnuplot = NULL;
4058:
4059: (*s_etat_processus).x_tics = 0;
4060: (*s_etat_processus).y_tics = 0;
4061: (*s_etat_processus).z_tics = 0;
4062:
4063: (*s_etat_processus).x_lines = d_vrai;
4064: (*s_etat_processus).y_lines = d_vrai;
4065: (*s_etat_processus).z_lines = d_vrai;
4066:
4067: (*s_etat_processus).mx_tics = -1;
4068: (*s_etat_processus).my_tics = -1;
4069: (*s_etat_processus).mz_tics = -1;
4070:
4071: (*s_etat_processus).mx_lines = d_faux;
4072: (*s_etat_processus).my_lines = d_faux;
4073: (*s_etat_processus).mz_lines = d_faux;
4074:
4075: (*s_etat_processus).x2_tics = -1;
4076: (*s_etat_processus).y2_tics = -1;
4077: (*s_etat_processus).z2_tics = -1;
4078:
4079: (*s_etat_processus).x2_lines = d_faux;
4080: (*s_etat_processus).y2_lines = d_faux;
4081: (*s_etat_processus).z2_lines = d_faux;
4082:
4083: (*s_etat_processus).mx2_tics = -1;
4084: (*s_etat_processus).my2_tics = -1;
4085: (*s_etat_processus).mz2_tics = -1;
4086:
4087: (*s_etat_processus).mx2_lines = d_faux;
4088: (*s_etat_processus).my2_lines = d_faux;
4089: (*s_etat_processus).mz2_lines = d_faux;
4090:
4091: (*s_etat_processus).mode_evaluation_expression = 'N';
4092: (*s_etat_processus).mode_execution_programme = 'Y';
4093:
4094: if ((*s_etat_processus).definitions_chainees == NULL)
4095: {
4096: if ((erreur = chainage(s_etat_processus)) !=
4097: d_absence_erreur)
4098: {
4099: # ifndef SEMAPHORES_NOMMES
4100: sem_post(&((*s_etat_processus).semaphore_fork));
4101: sem_post(&semaphore_gestionnaires_signaux);
4102: sem_destroy(&semaphore_gestionnaires_signaux);
4103: sem_destroy(&((*s_etat_processus)
4104: .semaphore_fork));
4105: # else
4106: sem_post((*s_etat_processus).semaphore_fork);
4107: sem_post(semaphore_gestionnaires_signaux);
4108: sem_destroy2(semaphore_gestionnaires_signaux,
4109: getpid(), SEM_SIGNAUX);
4110: sem_destroy3((*s_etat_processus).semphore_fork,
4111: getpid(), pthread_self(), SEM_FORK);
4112: # endif
4113:
4114: liberation_contexte_cas(s_etat_processus);
4115: liberation_queue_signaux(s_etat_processus);
4116:
4117: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4118: stackoverflow_deinstall_handler();
4119: # endif
4120:
4121: # ifdef HAVE_SIGSEGV_RECOVERY
4122: if (debug == d_faux)
4123: {
4124: sigsegv_deinstall_handler();
4125: }
4126: # endif
4127:
4128: if ((*s_etat_processus).langue == 'F')
4129: {
4130: printf("+++Fatal :"
4131: " Chaînage des définitions"
4132: " impossible\n");
4133: }
4134: else
4135: {
4136: printf("+++Fatal : Error in "
4137: "compilation\n");
4138: }
4139:
4140: if (traitement_fichier_temporaire == 'Y')
4141: {
4142: if (destruction_fichier(
4143: nom_fichier_temporaire)
4144: == d_erreur)
4145: {
4146: return(EXIT_FAILURE);
4147: }
4148:
4149: free(nom_fichier_temporaire);
4150: }
4151:
4152: return(EXIT_FAILURE);
4153: }
4154: }
4155:
4156: if ((erreur = compilation(s_etat_processus)) !=
4157: d_absence_erreur)
4158: {
4159: # ifndef SEMAPHORES_NOMMES
4160: sem_post(&((*s_etat_processus).semaphore_fork));
4161: sem_post(&semaphore_gestionnaires_signaux);
4162: sem_destroy(&semaphore_gestionnaires_signaux);
4163: sem_destroy(&((*s_etat_processus).semaphore_fork));
4164: # else
4165: sem_post((*s_etat_processus).semaphore_fork);
4166: sem_post(semaphore_gestionnaires_signaux);
4167: sem_destroy2(semaphore_gestionnaires_signaux,
4168: getpid(), SEM_SIGNAUX);
4169: sem_destroy3((*s_etat_processus).semphore_fork,
4170: getpid(), pthread_self(), SEM_FORK);
4171: # endif
4172:
4173: liberation_contexte_cas(s_etat_processus);
4174: liberation_queue_signaux(s_etat_processus);
4175:
4176: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4177: stackoverflow_deinstall_handler();
4178: # endif
4179:
4180: # ifdef HAVE_SIGSEGV_RECOVERY
4181: if (debug == d_faux)
4182: {
4183: sigsegv_deinstall_handler();
4184: }
4185: # endif
4186:
4187: if (traitement_fichier_temporaire == 'Y')
4188: {
4189: if (destruction_fichier(nom_fichier_temporaire)
4190: == d_erreur)
4191: {
4192: return(EXIT_FAILURE);
4193: }
4194:
4195: free(nom_fichier_temporaire);
4196: }
4197:
4198: printf("%s [%d]\n", message =
4199: messages(s_etat_processus), (int) getpid());
4200: free(message);
4201:
4202: if (test_cfsf(s_etat_processus, 51) == d_faux)
4203: {
4204: printf("%s", ds_beep);
4205: }
4206:
4207: if ((*s_etat_processus).core == d_vrai)
4208: {
4209: printf("\n");
4210:
4211: if ((*s_etat_processus).langue == 'F')
4212: {
4213: printf("+++Information : Génération du fichier "
4214: "rpl-core [%d]\n", (int) getpid());
4215: }
4216: else
4217: {
4218: printf("+++Information : Writing rpl-core "
4219: "file [%d]\n", (int) getpid());
4220: }
4221:
4222: rplcore(s_etat_processus);
4223:
4224: if ((*s_etat_processus).langue == 'F')
4225: {
4226: printf("+++Information : Processus tracé "
4227: "[%d]\n", (int) getpid());
4228: }
4229: else
4230: {
4231: printf("+++Information : Done [%d]\n",
4232: (int) getpid());
4233: }
4234:
4235: printf("\n");
4236: }
4237:
4238: return(EXIT_FAILURE);
4239: }
4240:
4241: (*s_etat_processus).position_courante = 0;
4242: (*s_etat_processus).traitement_cycle_exit = 'N';
4243:
4244: if ((*s_etat_processus).s_arbre_variables == NULL)
4245: {
4246: # ifndef SEMAPHORES_NOMMES
4247: sem_post(&((*s_etat_processus).semaphore_fork));
4248: sem_post(&semaphore_gestionnaires_signaux);
4249: sem_destroy(&semaphore_gestionnaires_signaux);
4250: sem_destroy(&((*s_etat_processus).semaphore_fork));
4251: # else
4252: sem_post((*s_etat_processus).semaphore_fork);
4253: sem_post(semaphore_gestionnaires_signaux);
4254: sem_destroy2(semaphore_gestionnaires_signaux,
4255: getpid(), SEM_SIGNAUX);
4256: sem_destroy3((*s_etat_processus).semphore_fork,
4257: getpid(), pthread_self(), SEM_FORK);
4258: # endif
4259:
4260: liberation_contexte_cas(s_etat_processus);
4261: liberation_queue_signaux(s_etat_processus);
4262:
4263: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4264: stackoverflow_deinstall_handler();
4265: # endif
4266:
4267: # ifdef HAVE_SIGSEGV_RECOVERY
4268: if (debug == d_faux)
4269: {
4270: sigsegv_deinstall_handler();
4271: }
4272: # endif
4273:
4274: if ((*s_etat_processus).langue == 'F')
4275: {
4276: printf("+++Fatal : Aucun point d'entrée\n");
4277: }
4278: else
4279: {
4280: printf("+++Fatal : Any entry point\n");
4281: }
4282:
4283: if (test_cfsf(s_etat_processus, 51) == d_faux)
4284: {
4285: printf("%s", ds_beep);
4286: }
4287:
4288: return(EXIT_FAILURE);
4289: }
4290:
4291: if (recherche_instruction_suivante(s_etat_processus)
4292: == d_erreur)
4293: {
4294: # ifndef SEMAPHORES_NOMMES
4295: sem_post(&((*s_etat_processus).semaphore_fork));
4296: sem_post(&semaphore_gestionnaires_signaux);
4297: sem_destroy(&semaphore_gestionnaires_signaux);
4298: sem_destroy(&((*s_etat_processus).semaphore_fork));
4299: # else
4300: sem_post((*s_etat_processus).semaphore_fork);
4301: sem_post(semaphore_gestionnaires_signaux);
4302: sem_destroy2(semaphore_gestionnaires_signaux,
4303: getpid(), SEM_SIGNAUX);
4304: sem_destroy3((*s_etat_processus).semphore_fork,
4305: getpid(), pthread_self(), SEM_FORK);
4306: # endif
4307:
4308: liberation_contexte_cas(s_etat_processus);
4309: liberation_queue_signaux(s_etat_processus);
4310:
4311: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4312: stackoverflow_deinstall_handler();
4313: # endif
4314:
4315: # ifdef HAVE_SIGSEGV_RECOVERY
4316: if (debug == d_faux)
4317: {
4318: sigsegv_deinstall_handler();
4319: }
4320: # endif
4321:
4322: if ((*s_etat_processus).langue == 'F')
4323: {
4324: printf("+++Fatal : Aucun point d'entrée\n");
4325: }
4326: else
4327: {
4328: printf("+++Fatal : Any entry point\n");
4329: }
4330:
4331: if (test_cfsf(s_etat_processus, 51) == d_faux)
4332: {
4333: printf("%s", ds_beep);
4334: }
4335:
4336: return(EXIT_FAILURE);
4337: }
4338:
4339: if (recherche_variable(s_etat_processus,
4340: (*s_etat_processus)
4341: .instruction_courante) == d_faux)
4342: {
4343: # ifndef SEMAPHORES_NOMMES
4344: sem_post(&((*s_etat_processus).semaphore_fork));
4345: sem_post(&semaphore_gestionnaires_signaux);
4346: sem_destroy(&semaphore_gestionnaires_signaux);
4347: sem_destroy(&((*s_etat_processus).semaphore_fork));
4348: # else
4349: sem_post((*s_etat_processus).semaphore_fork);
4350: sem_post(semaphore_gestionnaires_signaux);
4351: sem_destroy2(semaphore_gestionnaires_signaux,
4352: getpid(), SEM_SIGNAUX);
4353: sem_destroy3((*s_etat_processus).semphore_fork,
4354: getpid(), pthread_self(), SEM_FORK);
4355: # endif
4356:
4357: liberation_contexte_cas(s_etat_processus);
4358: liberation_queue_signaux(s_etat_processus);
4359:
4360: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4361: stackoverflow_deinstall_handler();
4362: # endif
4363:
4364: # ifdef HAVE_SIGSEGV_RECOVERY
4365: if (debug == d_faux)
4366: {
4367: sigsegv_deinstall_handler();
4368: }
4369: # endif
4370:
4371: if ((*s_etat_processus).langue == 'F')
4372: {
4373: printf("+++Fatal : Aucun point d'entrée\n");
4374: }
4375: else
4376: {
4377: printf("+++Fatal : Any entry point\n");
4378: }
4379:
4380: if (test_cfsf(s_etat_processus, 51) == d_faux)
4381: {
4382: printf("%s", ds_beep);
4383: }
4384:
4385: return(EXIT_FAILURE);
4386: }
4387:
4388: if ((*(*s_etat_processus).pointeur_variable_courante)
4389: .niveau != 0)
4390: {
4391: # ifndef SEMAPHORES_NOMMES
4392: sem_post(&((*s_etat_processus).semaphore_fork));
4393: sem_post(&semaphore_gestionnaires_signaux);
4394: sem_destroy(&semaphore_gestionnaires_signaux);
4395: sem_destroy(&((*s_etat_processus).semaphore_fork));
4396: # else
4397: sem_post((*s_etat_processus).semaphore_fork);
4398: sem_post(semaphore_gestionnaires_signaux);
4399: sem_destroy2(semaphore_gestionnaires_signaux,
4400: getpid(), SEM_SIGNAUX);
4401: sem_destroy3((*s_etat_processus).semphore_fork,
4402: getpid(), pthread_self(), SEM_FORK);
4403: # endif
4404:
4405: liberation_contexte_cas(s_etat_processus);
4406: liberation_queue_signaux(s_etat_processus);
4407:
4408: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4409: stackoverflow_deinstall_handler();
4410: # endif
4411:
4412: # ifdef HAVE_SIGSEGV_RECOVERY
4413: if (debug == d_faux)
4414: {
4415: sigsegv_deinstall_handler();
4416: }
4417: # endif
4418:
4419: if ((*s_etat_processus).langue == 'F')
4420: {
4421: printf("+++Fatal : Aucun point d'entrée\n");
4422: }
4423: else
4424: {
4425: printf("+++Fatal : Any entry point\n");
4426: }
4427:
4428: if (test_cfsf(s_etat_processus, 51) == d_faux)
4429: {
4430: printf("%s", ds_beep);
4431: }
4432:
4433: return(EXIT_FAILURE);
4434: }
4435:
4436: free((*s_etat_processus).instruction_courante);
4437: (*s_etat_processus).position_courante = 0;
4438:
4439: if (((*s_etat_processus).nom_fichier_historique =
4440: malloc((strlen(home) +
4441: strlen(ds_fichier_historique) + 2) *
4442: sizeof(unsigned char))) == NULL)
4443: {
4444: # ifndef SEMAPHORES_NOMMES
4445: sem_post(&((*s_etat_processus).semaphore_fork));
4446: sem_post(&semaphore_gestionnaires_signaux);
4447: sem_destroy(&semaphore_gestionnaires_signaux);
4448: sem_destroy(&((*s_etat_processus).semaphore_fork));
4449: # else
4450: sem_post((*s_etat_processus).semaphore_fork);
4451: sem_post(semaphore_gestionnaires_signaux);
4452: sem_destroy2(semaphore_gestionnaires_signaux,
4453: getpid(), SEM_SIGNAUX);
4454: sem_destroy3((*s_etat_processus).semphore_fork,
4455: getpid(), pthread_self(), SEM_FORK);
4456: # endif
4457:
4458: liberation_contexte_cas(s_etat_processus);
4459: liberation_queue_signaux(s_etat_processus);
4460:
4461: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4462: stackoverflow_deinstall_handler();
4463: # endif
4464:
4465: # ifdef HAVE_SIGSEGV_RECOVERY
4466: if (debug == d_faux)
4467: {
4468: sigsegv_deinstall_handler();
4469: }
4470: # endif
4471:
4472: erreur = d_es_allocation_memoire;
4473:
4474: if ((*s_etat_processus).langue == 'F')
4475: {
4476: printf("+++Système : Mémoire insuffisante\n");
4477: }
4478: else
4479: {
4480: printf("+++System : Not enough memory\n");
4481: }
4482:
4483: return(EXIT_FAILURE);
4484: }
4485:
4486: sprintf((*s_etat_processus).nom_fichier_historique, "%s/%s",
4487: home, ds_fichier_historique);
4488:
4489: using_history();
4490:
4491: // Pour pouvoir utiliser le keymap avant le premier
4492: // appel à readline().
4493: rl_initialize();
4494:
4495: erreur_historique = read_history(
4496: (*s_etat_processus).nom_fichier_historique);
4497:
4498: gsl_set_error_handler(&traitement_exceptions_gsl);
4499:
4500: if (drapeau_encart == 'Y')
4501: {
4502: (*s_etat_processus).erreur_systeme = d_es;
4503: encart(s_etat_processus,
4504: (integer8) (5 * 1000000));
4505:
4506: if ((*s_etat_processus).erreur_systeme != d_es)
4507: {
4508: if ((message = messages(s_etat_processus))
4509: == NULL)
4510: {
4511: # ifndef SEMAPHORES_NOMMES
4512: sem_post(&((*s_etat_processus)
4513: .semaphore_fork));
4514: sem_post(&semaphore_gestionnaires_signaux);
4515: sem_destroy(
4516: &semaphore_gestionnaires_signaux);
4517: sem_destroy(&((*s_etat_processus)
4518: .semaphore_fork));
4519: # else
4520: sem_post((*s_etat_processus)
4521: .semaphore_fork);
4522: sem_post(semaphore_gestionnaires_signaux);
4523: sem_destroy2(
4524: semaphore_gestionnaires_signaux,
4525: getpid(), SEM_SIGNAUX);
4526: sem_destroy3((*s_etat_processus)
4527: .semphore_fork,
4528: getpid(), pthread_self(), SEM_FORK);
4529: # endif
4530:
4531: liberation_contexte_cas(s_etat_processus);
4532: liberation_queue_signaux(s_etat_processus);
4533:
4534: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4535: stackoverflow_deinstall_handler();
4536: # endif
4537:
4538: # ifdef HAVE_SIGSEGV_RECOVERY
4539: if (debug == d_faux)
4540: {
4541: sigsegv_deinstall_handler();
4542: }
4543: # endif
4544:
4545: erreur = d_es_allocation_memoire;
4546:
4547: if ((*s_etat_processus).langue == 'F')
4548: {
4549: printf("+++Système : Mémoire "
4550: "insuffisante\n");
4551: }
4552: else
4553: {
4554: printf("+++System : Not enough "
4555: "memory\n");
4556: }
4557:
4558: return(EXIT_FAILURE);
4559: }
4560:
4561: printf("%s [%d]\n", message, (int) getpid());
4562: free(message);
4563:
4564: return(EXIT_FAILURE);
4565: }
4566: }
4567:
4568: fflush(stdout);
4569:
4570: if (arguments != NULL)
4571: {
4572: tampon = (*s_etat_processus).definitions_chainees;
4573: (*s_etat_processus).definitions_chainees =
4574: arguments;
4575:
4576: if (analyse_syntaxique(s_etat_processus) ==
4577: d_erreur)
4578: {
4579: if ((*s_etat_processus).erreur_systeme != d_es)
4580: {
4581: # ifndef SEMAPHORES_NOMMES
4582: sem_post(&((*s_etat_processus)
4583: .semaphore_fork));
4584: sem_post(&semaphore_gestionnaires_signaux);
4585: sem_destroy(
4586: &semaphore_gestionnaires_signaux);
4587: sem_destroy(&((*s_etat_processus)
4588: .semaphore_fork));
4589: # else
4590: sem_post((*s_etat_processus)
4591: .semaphore_fork);
4592: sem_post(semaphore_gestionnaires_signaux);
4593: sem_destroy2(
4594: semaphore_gestionnaires_signaux,
4595: getpid(), SEM_SIGNAUX);
4596: sem_destroy3((*s_etat_processus)
4597: .semphore_fork,
4598: getpid(), pthread_self(), SEM_FORK);
4599: # endif
4600:
4601: liberation_contexte_cas(s_etat_processus);
4602: liberation_queue_signaux(s_etat_processus);
4603:
4604: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4605: stackoverflow_deinstall_handler();
4606: # endif
4607:
4608: # ifdef HAVE_SIGSEGV_RECOVERY
4609: if (debug == d_faux)
4610: {
4611: sigsegv_deinstall_handler();
4612: }
4613: # endif
4614:
4615: erreur = d_es_allocation_memoire;
4616:
4617: if ((*s_etat_processus).langue == 'F')
4618: {
4619: printf("+++Système : Mémoire "
4620: "insuffisante\n");
4621: }
4622: else
4623: {
4624: printf("+++System : Not enough "
4625: "memory\n");
4626: }
4627:
4628: return(EXIT_FAILURE);
4629: }
4630: else
4631: {
4632: # ifndef SEMAPHORES_NOMMES
4633: sem_post(&((*s_etat_processus)
4634: .semaphore_fork));
4635: sem_post(&semaphore_gestionnaires_signaux);
4636: sem_destroy(
4637: &semaphore_gestionnaires_signaux);
4638: sem_destroy(&((*s_etat_processus)
4639: .semaphore_fork));
4640: # else
4641: sem_post((*s_etat_processus)
4642: .semaphore_fork);
4643: sem_post(semaphore_gestionnaires_signaux);
4644: sem_destroy2(
4645: semaphore_gestionnaires_signaux,
4646: getpid(), SEM_SIGNAUX);
4647: sem_destroy3((*s_etat_processus)
4648: .semphore_fork,
4649: getpid(), pthread_self(), SEM_FORK);
4650: # endif
4651:
4652: liberation_contexte_cas(s_etat_processus);
4653: liberation_queue_signaux(s_etat_processus);
4654:
4655: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4656: stackoverflow_deinstall_handler();
4657: # endif
4658:
4659: # ifdef HAVE_SIGSEGV_RECOVERY
4660: if (debug == d_faux)
4661: {
4662: sigsegv_deinstall_handler();
4663: }
4664: # endif
4665:
4666: if ((*s_etat_processus).langue == 'F')
4667: {
4668: printf("+++Erreur : Erreur de "
4669: "syntaxe\n");
4670: }
4671: else
4672: {
4673: printf("+++Error : Syntax error\n");
4674: }
4675:
4676: return(EXIT_FAILURE);
4677: }
4678: }
4679:
4680: (*s_etat_processus).instruction_courante
4681: = arguments;
4682: (*s_etat_processus).definitions_chainees = tampon;
4683: (*s_etat_processus).position_courante = 0;
4684:
4685: recherche_type(s_etat_processus);
4686:
4687: if ((*s_etat_processus).erreur_systeme != d_es)
4688: {
4689: # ifndef SEMAPHORES_NOMMES
4690: sem_post(&((*s_etat_processus).semaphore_fork));
4691: sem_post(&semaphore_gestionnaires_signaux);
4692: sem_destroy(&semaphore_gestionnaires_signaux);
4693: sem_destroy(&((*s_etat_processus)
4694: .semaphore_fork));
4695: # else
4696: sem_post((*s_etat_processus).semaphore_fork);
4697: sem_post(semaphore_gestionnaires_signaux);
4698: sem_destroy2(semaphore_gestionnaires_signaux,
4699: getpid(), SEM_SIGNAUX);
4700: sem_destroy3((*s_etat_processus).semphore_fork,
4701: getpid(), pthread_self(), SEM_FORK);
4702: # endif
4703:
4704: liberation_contexte_cas(s_etat_processus);
4705: liberation_queue_signaux(s_etat_processus);
4706:
4707: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4708: stackoverflow_deinstall_handler();
4709: # endif
4710:
4711: # ifdef HAVE_SIGSEGV_RECOVERY
4712: if (debug == d_faux)
4713: {
4714: sigsegv_deinstall_handler();
4715: }
4716: # endif
4717:
4718: if ((message = messages(s_etat_processus))
4719: == NULL)
4720: {
4721: erreur = d_es_allocation_memoire;
4722:
4723: if ((*s_etat_processus).langue == 'F')
4724: {
4725: printf("+++Système : Mémoire "
4726: "insuffisante\n");
4727: }
4728: else
4729: {
4730: printf("+++System : Not enough "
4731: "memory\n");
4732: }
4733:
4734: return(EXIT_FAILURE);
4735: }
4736:
4737: printf("%s [%d]\n", message, (int) getpid());
4738: free(message);
4739:
4740: return(EXIT_FAILURE);
4741: }
4742:
4743: if ((*s_etat_processus).erreur_execution != d_ex)
4744: {
4745: if ((message = messages(s_etat_processus))
4746: == NULL)
4747: {
4748: # ifndef SEMAPHORES_NOMMES
4749: sem_post(&((*s_etat_processus)
4750: .semaphore_fork));
4751: sem_post(&semaphore_gestionnaires_signaux);
4752: sem_destroy(
4753: &semaphore_gestionnaires_signaux);
4754: sem_destroy(&((*s_etat_processus)
4755: .semaphore_fork));
4756: # else
4757: sem_post((*s_etat_processus)
4758: .semaphore_fork);
4759: sem_post(semaphore_gestionnaires_signaux);
4760: sem_destroy2(
4761: semaphore_gestionnaires_signaux,
4762: getpid(), SEM_SIGNAUX);
4763: sem_destroy3((*s_etat_processus)
4764: .semphore_fork,
4765: getpid(), pthread_self(), SEM_FORK);
4766: # endif
4767:
4768: liberation_contexte_cas(s_etat_processus);
4769: liberation_queue_signaux(s_etat_processus);
4770:
4771: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4772: stackoverflow_deinstall_handler();
4773: # endif
4774:
4775: # ifdef HAVE_SIGSEGV_RECOVERY
4776: if (debug == d_faux)
4777: {
4778: sigsegv_deinstall_handler();
4779: }
4780: # endif
4781:
4782: erreur = d_es_allocation_memoire;
4783:
4784: if ((*s_etat_processus).langue == 'F')
4785: {
4786: printf("+++Erreur : Mémoire "
4787: "insuffisante\n");
4788: }
4789: else
4790: {
4791: printf("+++Error : Not enough "
4792: "memory\n");
4793: }
4794:
4795: return(EXIT_FAILURE);
4796: }
4797:
4798: printf("%s [%d]\n", message, (int) getpid());
4799: free(message);
4800:
4801: # ifndef SEMAPHORES_NOMMES
4802: sem_post(&((*s_etat_processus).semaphore_fork));
4803: sem_post(&semaphore_gestionnaires_signaux);
4804: sem_destroy(&semaphore_gestionnaires_signaux);
4805: sem_destroy(&((*s_etat_processus)
4806: .semaphore_fork));
4807: # else
4808: sem_post((*s_etat_processus).semaphore_fork);
4809: sem_post(semaphore_gestionnaires_signaux);
4810: sem_destroy2(semaphore_gestionnaires_signaux,
4811: getpid(), SEM_SIGNAUX);
4812: sem_destroy3((*s_etat_processus).semphore_fork,
4813: getpid(), pthread_self(), SEM_FORK);
4814: # endif
4815:
4816: liberation_contexte_cas(s_etat_processus);
4817: liberation_queue_signaux(s_etat_processus);
4818:
4819: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4820: stackoverflow_deinstall_handler();
4821: # endif
4822:
4823: # ifdef HAVE_SIGSEGV_RECOVERY
4824: if (debug == d_faux)
4825: {
4826: sigsegv_deinstall_handler();
4827: }
4828: # endif
4829:
4830: return(EXIT_FAILURE);
4831: }
4832:
4833: if (depilement(s_etat_processus,
4834: &((*s_etat_processus).l_base_pile),
4835: &s_objet) == d_erreur)
4836: {
4837: if ((message = messages(s_etat_processus))
4838: == NULL)
4839: {
4840: # ifndef SEMAPHORES_NOMMES
4841: sem_post(&((*s_etat_processus)
4842: .semaphore_fork));
4843: sem_post(&semaphore_gestionnaires_signaux);
4844: sem_destroy(
4845: &semaphore_gestionnaires_signaux);
4846: sem_destroy(&((*s_etat_processus)
4847: .semaphore_fork));
4848: # else
4849: sem_post((*s_etat_processus)
4850: .semaphore_fork);
4851: sem_post(semaphore_gestionnaires_signaux);
4852: sem_destroy2(
4853: semaphore_gestionnaires_signaux,
4854: getpid(), SEM_SIGNAUX);
4855: sem_destroy3((*s_etat_processus)
4856: .semphore_fork,
4857: getpid(), pthread_self(), SEM_FORK);
4858: # endif
4859:
4860: liberation_contexte_cas(s_etat_processus);
4861: liberation_queue_signaux(s_etat_processus);
4862:
4863: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4864: stackoverflow_deinstall_handler();
4865: # endif
4866:
4867: # ifdef HAVE_SIGSEGV_RECOVERY
4868: if (debug == d_faux)
4869: {
4870: sigsegv_deinstall_handler();
4871: }
4872: # endif
4873:
4874: erreur = d_es_allocation_memoire;
4875: erreur = d_es_allocation_memoire;
4876:
4877: if ((*s_etat_processus).langue == 'F')
4878: {
4879: printf("+++Erreur : Mémoire "
4880: "insuffisante\n");
4881: }
4882: else
4883: {
4884: printf("+++Error : Not enough "
4885: "memory\n");
4886: }
4887:
4888: return(EXIT_FAILURE);
4889: }
4890:
4891: printf("%s [%d]\n", message, (int) getpid());
4892: free(message);
4893:
4894: # ifndef SEMAPHORES_NOMMES
4895: sem_post(&((*s_etat_processus).semaphore_fork));
4896: sem_post(&semaphore_gestionnaires_signaux);
4897: sem_destroy(&semaphore_gestionnaires_signaux);
4898: sem_destroy(&((*s_etat_processus)
4899: .semaphore_fork));
4900: # else
4901: sem_post((*s_etat_processus).semaphore_fork);
4902: sem_post(semaphore_gestionnaires_signaux);
4903: sem_destroy2(semaphore_gestionnaires_signaux,
4904: getpid(), SEM_SIGNAUX);
4905: sem_destroy3((*s_etat_processus).semphore_fork,
4906: getpid(), pthread_self(), SEM_FORK);
4907: # endif
4908:
4909: liberation_contexte_cas(s_etat_processus);
4910: liberation_queue_signaux(s_etat_processus);
4911:
4912: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4913: stackoverflow_deinstall_handler();
4914: # endif
4915:
4916: # ifdef HAVE_SIGSEGV_RECOVERY
4917: if (debug == d_faux)
4918: {
4919: sigsegv_deinstall_handler();
4920: }
4921: # endif
4922:
4923: return(EXIT_FAILURE);
4924: }
4925:
4926: empilement_pile_systeme(s_etat_processus);
4927:
4928: if (evaluation(s_etat_processus, s_objet, 'E')
4929: == d_erreur)
4930: {
4931: if ((*s_etat_processus).erreur_systeme != d_es)
4932: {
4933: if ((message = messages(s_etat_processus))
4934: == NULL)
4935: {
4936: # ifndef SEMAPHORES_NOMMES
4937: sem_post(&((*s_etat_processus)
4938: .semaphore_fork));
4939: sem_post(
4940: &semaphore_gestionnaires_signaux
4941: );
4942: sem_destroy(
4943: &semaphore_gestionnaires_signaux
4944: );
4945: sem_destroy(&((*s_etat_processus)
4946: .semaphore_fork));
4947: # else
4948: sem_post((*s_etat_processus)
4949: .semaphore_fork);
4950: sem_post(
4951: semaphore_gestionnaires_signaux
4952: );
4953: sem_destroy2(
4954: semaphore_gestionnaires_signaux,
4955: getpid(), SEM_SIGNAUX);
4956: sem_destroy3((*s_etat_processus)
4957: .semphore_fork, getpid(),
4958: pthread_self(), SEM_FORK);
4959: # endif
4960:
4961: liberation_contexte_cas(s_etat_processus);
4962: liberation_queue_signaux(s_etat_processus);
4963:
4964: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
4965: stackoverflow_deinstall_handler();
4966: # endif
4967:
4968: # ifdef HAVE_SIGSEGV_RECOVERY
4969: if (debug == d_faux)
4970: {
4971: sigsegv_deinstall_handler();
4972: }
4973: # endif
4974:
4975: erreur = d_es_allocation_memoire;
4976:
4977: if ((*s_etat_processus).langue == 'F')
4978: {
4979: printf("+++Système : Mémoire "
4980: "insuffisante\n");
4981: }
4982: else
4983: {
4984: printf("+++System : Not enough "
4985: "memory\n");
4986: }
4987:
4988: return(EXIT_FAILURE);
4989: }
4990:
4991: printf("%s [%d]\n", message,
4992: (int) getpid());
4993: free(message);
4994:
4995: # ifndef SEMAPHORES_NOMMES
4996: sem_post(&((*s_etat_processus)
4997: .semaphore_fork));
4998: sem_post(&semaphore_gestionnaires_signaux);
4999: sem_destroy(
5000: &semaphore_gestionnaires_signaux);
5001: sem_destroy(&((*s_etat_processus)
5002: .semaphore_fork));
5003: # else
5004: sem_post((*s_etat_processus)
5005: .semaphore_fork);
5006: sem_post(semaphore_gestionnaires_signaux);
5007: sem_destroy2(
5008: semaphore_gestionnaires_signaux,
5009: getpid(), SEM_SIGNAUX);
5010: sem_destroy3((*s_etat_processus)
5011: .semphore_fork,
5012: getpid(), pthread_self(), SEM_FORK);
5013: # endif
5014:
5015: liberation_contexte_cas(s_etat_processus);
5016: liberation_queue_signaux(s_etat_processus);
5017:
5018: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
5019: stackoverflow_deinstall_handler();
5020: # endif
5021:
5022: # ifdef HAVE_SIGSEGV_RECOVERY
5023: if (debug == d_faux)
5024: {
5025: sigsegv_deinstall_handler();
5026: }
5027: # endif
5028:
5029: erreur = d_es_allocation_memoire;
5030: return(EXIT_FAILURE);
5031: }
5032:
5033: if ((*s_etat_processus).erreur_execution
5034: != d_ex)
5035: {
5036: if ((message = messages(s_etat_processus))
5037: == NULL)
5038: {
5039: # ifndef SEMAPHORES_NOMMES
5040: sem_post(&((*s_etat_processus)
5041: .semaphore_fork));
5042: sem_post(
5043: &semaphore_gestionnaires_signaux
5044: );
5045: sem_destroy(
5046: &semaphore_gestionnaires_signaux
5047: );
5048: sem_destroy(&((*s_etat_processus)
5049: .semaphore_fork));
5050: # else
5051: sem_post((*s_etat_processus)
5052: .semaphore_fork);
5053: sem_post(
5054: semaphore_gestionnaires_signaux
5055: );
5056: sem_destroy2(
5057: semaphore_gestionnaires_signaux,
5058: getpid(), SEM_SIGNAUX);
5059: sem_destroy3((*s_etat_processus)
5060: .semphore_fork, getpid(),
5061: pthread_self(), SEM_FORK);
5062: # endif
5063:
5064: liberation_contexte_cas(s_etat_processus);
5065: liberation_queue_signaux(s_etat_processus);
5066:
5067: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
5068: stackoverflow_deinstall_handler();
5069: # endif
5070:
5071: # ifdef HAVE_SIGSEGV_RECOVERY
5072: if (debug == d_faux)
5073: {
5074: sigsegv_deinstall_handler();
5075: }
5076: # endif
5077:
5078: erreur = d_es_allocation_memoire;
5079:
5080: if ((*s_etat_processus).langue == 'F')
5081: {
5082: printf("+++Erreur : Mémoire "
5083: "insuffisante\n");
5084: }
5085: else
5086: {
5087: printf("+++Error : Not enough "
5088: "memory\n");
5089: }
5090:
5091: return(EXIT_FAILURE);
5092: }
5093:
5094: printf("%s [%d]\n", message,
5095: (int) getpid());
5096: free(message);
5097:
5098: # ifndef SEMAPHORES_NOMMES
5099: sem_post(&((*s_etat_processus)
5100: .semaphore_fork));
5101: sem_post(&semaphore_gestionnaires_signaux);
5102: sem_destroy(
5103: &semaphore_gestionnaires_signaux);
5104: sem_destroy(&((*s_etat_processus)
5105: .semaphore_fork));
5106: # else
5107: sem_post((*s_etat_processus)
5108: .semaphore_fork);
5109: sem_post(semaphore_gestionnaires_signaux);
5110: sem_destroy2(
5111: semaphore_gestionnaires_signaux,
5112: getpid(), SEM_SIGNAUX);
5113: sem_destroy3((*s_etat_processus)
5114: .semphore_fork,
5115: getpid(), pthread_self(), SEM_FORK);
5116: # endif
5117:
5118: liberation_contexte_cas(s_etat_processus);
5119: liberation_queue_signaux(s_etat_processus);
5120:
5121: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
5122: stackoverflow_deinstall_handler();
5123: # endif
5124:
5125: # ifdef HAVE_SIGSEGV_RECOVERY
5126: if (debug == d_faux)
5127: {
5128: sigsegv_deinstall_handler();
5129: }
5130: # endif
5131:
5132: return(EXIT_FAILURE);
5133: }
5134: }
5135:
5136: (*s_etat_processus).instruction_courante = NULL;
5137: liberation(s_etat_processus, s_objet);
5138:
5139: free(arguments);
5140: }
5141:
5142: if (option_a == d_vrai)
5143: {
5144: fprintf(stdout, "%s\n", (*s_etat_processus)
5145: .definitions_chainees);
5146: }
5147: else
5148: {
5149: if (option_D == d_vrai)
5150: {
5151: lancement_daemon(s_etat_processus);
5152: }
5153:
5154: if (option_p == d_faux)
5155: {
5156: if (setjmp(contexte_initial) == 0)
5157: {
5158: erreur = sequenceur(s_etat_processus);
5159:
5160: if (erreur == d_absence_erreur)
5161: {
5162: if (((*s_etat_processus)
5163: .arret_depuis_abort == 0) &&
5164: ((*s_etat_processus).at_exit
5165: != NULL))
5166: {
5167: // Permet de traiter ATEXIT
5168: // même après réception d'un SIGINT.
5169: (*s_etat_processus)
5170: .var_volatile_alarme = 0;
5171: (*s_etat_processus)
5172: .var_volatile_requete_arret = 0;
5173:
5174: if ((*s_etat_processus).profilage ==
5175: d_vrai)
5176: {
5177: profilage(s_etat_processus,
5178: "ATEXIT");
5179: }
5180:
5181: erreur = evaluation(s_etat_processus,
5182: (*s_etat_processus).at_exit,
5183: 'E');
5184:
5185: if ((*s_etat_processus).profilage ==
5186: d_vrai)
5187: {
5188: profilage(s_etat_processus, NULL);
5189: }
5190:
5191: if (((*s_etat_processus)
5192: .erreur_execution != d_ex) ||
5193: ((*s_etat_processus).exception
5194: != d_ep) || ((*s_etat_processus)
5195: .erreur_systeme != d_es))
5196: {
5197: printf("%s [%d]\n", message =
5198: messages(s_etat_processus),
5199: (int) getpid());
5200: free(message);
5201:
5202: if (test_cfsf(s_etat_processus, 51)
5203: == d_faux)
5204: {
5205: printf("%s", ds_beep);
5206: }
5207:
5208: if ((*s_etat_processus).core ==
5209: d_vrai)
5210: {
5211: printf("\n");
5212:
5213: if ((*s_etat_processus).langue
5214: == 'F')
5215: {
5216: printf("+++Information : Gé"
5217: "nération du fichie"
5218: "r rpl-core "
5219: "[%d]\n", (int)
5220: getpid());
5221: }
5222: else
5223: {
5224: printf("+++Information : Wr"
5225: "iting rpl-core fil"
5226: "e [%d]\n",
5227: (int) getpid());
5228: }
5229:
5230: rplcore(s_etat_processus);
5231:
5232: if ((*s_etat_processus).langue
5233: == 'F')
5234: {
5235: printf("+++Information : Pr"
5236: "ocessus tracé [%d]"
5237: "\n",
5238: (int) getpid());
5239: }
5240: else
5241: {
5242: printf("+++Information : Do"
5243: "ne [%d]\n", (int)
5244: getpid());
5245: }
5246:
5247: printf("\n");
5248: fflush(stdout);
5249: }
5250: }
5251: }
5252: }
5253: }
5254: }
5255: else
5256: {
5257: if (setjmp(contexte_initial) == 0)
5258: {
5259: erreur = sequenceur_optimise(s_etat_processus);
5260:
5261: if (erreur == d_absence_erreur)
5262: {
5263: if (((*s_etat_processus)
5264: .arret_depuis_abort == 0) &&
5265: ((*s_etat_processus).at_exit
5266: != NULL))
5267: {
5268: // Permet de traiter ATEXIT
5269: // même après réception d'un SIGINT.
5270: (*s_etat_processus)
5271: .var_volatile_alarme = 0;
5272: (*s_etat_processus)
5273: .var_volatile_requete_arret = 0;
5274:
5275: if ((*s_etat_processus).profilage ==
5276: d_vrai)
5277: {
5278: profilage(s_etat_processus,
5279: "ATEXIT");
5280: }
5281:
5282: erreur = evaluation(s_etat_processus,
5283: (*s_etat_processus).at_exit,
5284: 'E');
5285:
5286: if ((*s_etat_processus).profilage ==
5287: d_vrai)
5288: {
5289: profilage(s_etat_processus, NULL);
5290: }
5291:
5292: if (((*s_etat_processus)
5293: .erreur_execution != d_ex) ||
5294: ((*s_etat_processus).exception
5295: != d_ep) || ((*s_etat_processus)
5296: .erreur_systeme != d_es))
5297: {
5298: printf("%s [%d]\n", message =
5299: messages(s_etat_processus),
5300: (int) getpid());
5301: free(message);
5302:
5303: if (test_cfsf(s_etat_processus, 51)
5304: == d_faux)
5305: {
5306: printf("%s", ds_beep);
5307: }
5308:
5309: if ((*s_etat_processus).core ==
5310: d_vrai)
5311: {
5312: printf("\n");
5313:
5314: if ((*s_etat_processus).langue
5315: == 'F')
5316: {
5317: printf("+++Information : Gé"
5318: "nération du fichie"
5319: "r rpl-core "
5320: "[%d]\n", (int)
5321: getpid());
5322: }
5323: else
5324: {
5325: printf("+++Information : Wr"
5326: "iting rpl-core fil"
5327: "e [%d]\n",
5328: (int) getpid());
5329: }
5330:
5331: rplcore(s_etat_processus);
5332:
5333: if ((*s_etat_processus).langue
5334: == 'F')
5335: {
5336: printf("+++Information : Pr"
5337: "ocessus tracé [%d]"
5338: "\n",
5339: (int) getpid());
5340: }
5341: else
5342: {
5343: printf("+++Information : Do"
5344: "ne [%d]\n", (int)
5345: getpid());
5346: }
5347:
5348: printf("\n");
5349: fflush(stdout);
5350: }
5351: }
5352: }
5353: }
5354: }
5355: }
5356: }
5357:
5358: for(i = 0; i < (*s_etat_processus).sections_critiques; i++)
5359: {
5360: pthread_mutex_unlock(&mutex_sections_critiques);
5361: }
5362:
5363: liberation(s_etat_processus, (*s_etat_processus).at_exit);
5364: liberation(s_etat_processus, (*s_etat_processus).at_poke);
5365:
5366: if ((*s_etat_processus).generateur_aleatoire != NULL)
5367: {
5368: liberation_generateur_aleatoire(s_etat_processus);
5369: }
5370:
5371: l_element_courant = (*s_etat_processus).liste_mutexes;
5372: while(l_element_courant != NULL)
5373: {
5374: liberation(s_etat_processus,
5375: (*((struct_liste_chainee *)
5376: l_element_courant)).donnee);
5377: l_element_suivant = (*((struct_liste_chainee *)
5378: l_element_courant)).suivant;
5379: free((struct_liste_chainee *) l_element_courant);
5380: l_element_courant = l_element_suivant;
5381: }
5382:
5383: /*
5384: * Arrêt des processus fils
5385: */
5386:
5387: if ((*s_etat_processus).presence_fusible == d_vrai)
5388: {
5389: pthread_cancel((*s_etat_processus).thread_fusible);
5390: }
5391:
5392: pthread_mutex_lock(&((*s_etat_processus)
5393: .mutex_pile_processus));
5394:
5395: l_element_courant = (void *) (*s_etat_processus)
5396: .l_base_pile_processus;
5397:
5398: while(l_element_courant != NULL)
5399: {
5400: if ((*s_etat_processus).debug == d_vrai)
5401: {
5402: if (((*s_etat_processus).type_debug &
5403: d_debug_processus) != 0)
5404: {
5405: if ((*(*((struct_processus_fils *)
5406: (*(*((struct_liste_chainee *)
5407: l_element_courant)).donnee)
5408: .objet)).thread)
5409: .processus_detache == d_vrai)
5410: {
5411: if ((*s_etat_processus).langue == 'F')
5412: {
5413: printf("[%d] Signalement pour arrêt du "
5414: "processus %d\n",
5415: (int) getpid(), (int)
5416: (*(*((struct_processus_fils *)
5417: (*(*((struct_liste_chainee *)
5418: l_element_courant)).donnee)
5419: .objet)).thread).pid);
5420: }
5421: else
5422: {
5423: printf("[%d] Send stop signal to "
5424: "process %d\n",
5425: (int) getpid(), (int)
5426: (*(*((struct_processus_fils *)
5427: (*(*((struct_liste_chainee *)
5428: l_element_courant)).donnee)
5429: .objet)).thread).pid);
5430: }
5431: }
5432: else
5433: {
5434: if ((*s_etat_processus).langue == 'F')
5435: {
5436: printf("[%d] Signalement pour arrêt du "
5437: "thread %llu\n", (int) getpid(),
5438: (unsigned long long)
5439: (*(*((struct_processus_fils *)
5440: (*(*((struct_liste_chainee *)
5441: l_element_courant)).donnee)
5442: .objet)).thread).tid);
5443: }
5444: else
5445: {
5446: printf("[%d] Send stop signal to "
5447: "thread %llu\n",
5448: (int) getpid(),
5449: (unsigned long long)
5450: (*(*((struct_processus_fils *)
5451: (*(*((struct_liste_chainee *)
5452: l_element_courant)).donnee)
5453: .objet)).thread).tid);
5454: }
5455: }
5456: }
5457: }
5458:
5459: if ((*(*((struct_processus_fils *)
5460: (*(*((struct_liste_chainee *)
5461: l_element_courant)).donnee).objet))
5462: .thread).processus_detache == d_vrai)
5463: {
5464: if ((*s_etat_processus).var_volatile_alarme != 0)
5465: {
5466: envoi_signal_processus(
5467: (*(*((struct_processus_fils *)
5468: (*(*((struct_liste_chainee *)
5469: l_element_courant)).donnee).objet))
5470: .thread).pid, rpl_sigurg);
5471: }
5472: else
5473: {
5474: if ((*s_etat_processus).arret_depuis_abort
5475: == -1)
5476: {
5477: envoi_signal_processus(
5478: (*(*((struct_processus_fils *)
5479: (*(*((struct_liste_chainee *)
5480: l_element_courant)).donnee).objet))
5481: .thread).pid, rpl_sigabort);
5482: }
5483: else
5484: {
5485: envoi_signal_processus(
5486: (*(*((struct_processus_fils *)
5487: (*(*((struct_liste_chainee *)
5488: l_element_courant)).donnee).objet))
5489: .thread).pid, rpl_sigstop);
5490: }
5491: }
5492: }
5493: else
5494: {
5495: pthread_mutex_lock(&((*(*((struct_processus_fils *)
5496: (*(*((struct_liste_chainee *)
5497: l_element_courant)).donnee).objet)).thread)
5498: .mutex));
5499:
5500: if ((*(*((struct_processus_fils *)
5501: (*(*((struct_liste_chainee *)
5502: l_element_courant)).donnee).objet)).thread)
5503: .thread_actif == d_vrai)
5504: {
5505: if ((*s_etat_processus).var_volatile_alarme
5506: != 0)
5507: {
5508: envoi_signal_thread(
5509: (*(*((struct_processus_fils *)
5510: (*(*((struct_liste_chainee *)
5511: l_element_courant)).donnee).objet))
5512: .thread).tid, rpl_sigurg);
5513: }
5514: else
5515: {
5516: if ((*s_etat_processus).arret_depuis_abort
5517: == -1)
5518: {
5519: envoi_signal_thread(
5520: (*(*((struct_processus_fils *)
5521: (*(*((struct_liste_chainee *)
5522: l_element_courant)).donnee)
5523: .objet)).thread).tid,
5524: rpl_sigabort);
5525: }
5526: else
5527: {
5528: envoi_signal_thread(
5529: (*(*((struct_processus_fils *)
5530: (*(*((struct_liste_chainee *)
5531: l_element_courant)).donnee)
5532: .objet)).thread).tid,
5533: rpl_sigstop);
5534: }
5535: }
5536: }
5537:
5538: pthread_mutex_unlock(
5539: &((*(*((struct_processus_fils *)
5540: (*(*((struct_liste_chainee *)
5541: l_element_courant)).donnee).objet)).thread)
5542: .mutex));
5543: }
5544:
5545: l_element_courant = (*((struct_liste_chainee *)
5546: l_element_courant)).suivant;
5547: }
5548:
5549: /*
5550: * Attente de la fin de tous les processus fils
5551: */
5552:
5553: for(i = 0; i < d_NOMBRE_INTERRUPTIONS;
5554: (*s_etat_processus).masque_interruptions[i++]
5555: = 'I');
5556:
5557: attente.tv_sec = 0;
5558: attente.tv_nsec = GRANULARITE_us * 1000;
5559:
5560: while((*s_etat_processus).l_base_pile_processus != NULL)
5561: {
5562: l_element_courant = (void *)
5563: (*s_etat_processus).l_base_pile_processus;
5564:
5565: for(i = 0; i < (*(*((struct_processus_fils *)
5566: (*(*((struct_liste_chainee *)
5567: l_element_courant)).donnee).objet)).thread)
5568: .nombre_objets_dans_pipe; i++)
5569: {
5570: if ((s_objet = lecture_pipe(
5571: s_etat_processus,
5572: (*(*((struct_processus_fils *)
5573: (*(*((struct_liste_chainee *)
5574: l_element_courant)).donnee).objet)).thread)
5575: .pipe_objets[0])) != NULL)
5576: {
5577: liberation(s_etat_processus, s_objet);
5578:
5579: (*(*((struct_processus_fils *)
5580: (*(*((struct_liste_chainee *)
5581: l_element_courant)).donnee).objet))
5582: .thread).nombre_objets_dans_pipe--;
5583:
5584: action.sa_handler = SIG_IGN;
5585: action.sa_flags = 0;
5586:
5587: if (sigaction(SIGPIPE, &action, ®istre)
5588: != 0)
5589: {
5590: # ifndef SEMAPHORES_NOMMES
5591: sem_post(&((*s_etat_processus)
5592: .semaphore_fork));
5593: sem_post(
5594: &semaphore_gestionnaires_signaux
5595: );
5596: sem_destroy(
5597: &semaphore_gestionnaires_signaux
5598: );
5599: sem_destroy(&((*s_etat_processus)
5600: .semaphore_fork));
5601: # else
5602: sem_post((*s_etat_processus)
5603: .semaphore_fork);
5604: sem_post(
5605: semaphore_gestionnaires_signaux
5606: );
5607: sem_destroy2(
5608: semaphore_gestionnaires_signaux,
5609: getpid(), SEM_SIGNAUX);
5610: sem_destroy3((*s_etat_processus)
5611: .semphore_fork, getpid(),
5612: pthread_self(), SEM_FORK);
5613: # endif
5614:
5615: liberation_contexte_cas(s_etat_processus);
5616: liberation_queue_signaux(s_etat_processus);
5617:
5618: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
5619: stackoverflow_deinstall_handler();
5620: # endif
5621:
5622: # ifdef HAVE_SIGSEGV_RECOVERY
5623: if (debug == d_faux)
5624: {
5625: sigsegv_deinstall_handler();
5626: }
5627: # endif
5628:
5629: pthread_mutex_unlock(&((*s_etat_processus)
5630: .mutex_pile_processus));
5631: return(EXIT_FAILURE);
5632: }
5633:
5634: while((longueur_ecriture =
5635: write_atomic(s_etat_processus,
5636: (*(*((struct_processus_fils *)
5637: (*(*((struct_liste_chainee *)
5638: l_element_courant)).donnee).objet))
5639: .thread).pipe_nombre_injections[1], "+",
5640: sizeof(unsigned char))) !=
5641: sizeof(unsigned char))
5642: {
5643: if (longueur_ecriture == -1)
5644: {
5645: // Le processus n'existe plus.
5646: break;
5647: }
5648: }
5649:
5650: if (sigaction(SIGPIPE, ®istre, NULL)
5651: != 0)
5652: {
5653: # ifndef SEMAPHORES_NOMMES
5654: sem_post(&((*s_etat_processus)
5655: .semaphore_fork));
5656: sem_post(
5657: &semaphore_gestionnaires_signaux
5658: );
5659: sem_destroy(
5660: &semaphore_gestionnaires_signaux
5661: );
5662: sem_destroy(&((*s_etat_processus)
5663: .semaphore_fork));
5664: # else
5665: sem_post((*s_etat_processus)
5666: .semaphore_fork);
5667: sem_post(
5668: semaphore_gestionnaires_signaux
5669: );
5670: sem_destroy2(
5671: semaphore_gestionnaires_signaux,
5672: getpid(), SEM_SIGNAUX);
5673: sem_destroy3((*s_etat_processus)
5674: .semphore_fork, getpid(),
5675: pthread_self(), SEM_FORK);
5676: # endif
5677:
5678: liberation_contexte_cas(s_etat_processus);
5679: liberation_queue_signaux(s_etat_processus);
5680:
5681: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
5682: stackoverflow_deinstall_handler();
5683: # endif
5684:
5685: # ifdef HAVE_SIGSEGV_RECOVERY
5686: if (debug == d_faux)
5687: {
5688: sigsegv_deinstall_handler();
5689: }
5690: # endif
5691:
5692: pthread_mutex_unlock(&((*s_etat_processus)
5693: .mutex_pile_processus));
5694: return(EXIT_FAILURE);
5695: }
5696: }
5697: }
5698:
5699: pthread_mutex_lock(&((*s_etat_processus)
5700: .mutex_interruptions));
5701:
5702: if ((*s_etat_processus)
5703: .nombre_interruptions_non_affectees != 0)
5704: {
5705: affectation_interruptions_logicielles(
5706: s_etat_processus);
5707: }
5708:
5709: pthread_mutex_unlock(&((*s_etat_processus)
5710: .mutex_interruptions));
5711: pthread_mutex_unlock(&((*s_etat_processus)
5712: .mutex_pile_processus));
5713: nanosleep(&attente, NULL);
5714: scrutation_interruptions(s_etat_processus);
5715: pthread_mutex_lock(&((*s_etat_processus)
5716: .mutex_pile_processus));
5717: }
5718:
5719: pthread_mutex_unlock(&((*s_etat_processus)
5720: .mutex_pile_processus));
5721:
5722: erreur_historique = write_history(
5723: (*s_etat_processus).nom_fichier_historique);
5724: clear_history();
5725:
5726: if (erreur_historique != 0)
5727: {
5728: if ((*s_etat_processus).langue == 'F')
5729: {
5730: printf("+++Erreur : L'historique ne peut être "
5731: "écrit\n");
5732: }
5733: else
5734: {
5735: printf("+++Error : History cannot be "
5736: "written\n");
5737: }
5738:
5739: if (test_cfsf(s_etat_processus, 51) == d_faux)
5740: {
5741: printf("%s", ds_beep);
5742: }
5743: }
5744:
5745: free((*s_etat_processus).nom_fichier_historique);
5746:
5747: if (((*s_etat_processus).core == d_vrai) &&
5748: (erreur == d_erreur) &&
5749: ((*s_etat_processus).var_volatile_traitement_sigint
5750: == 0))
5751: {
5752: printf("\n");
5753:
5754: if ((*s_etat_processus).langue == 'F')
5755: {
5756: printf("+++Information : Génération du fichier "
5757: "rpl-core [%d]\n", (int) getpid());
5758: }
5759: else
5760: {
5761: printf("+++Information : Writing rpl-core "
5762: "file [%d]\n", (int) getpid());
5763: }
5764:
5765: rplcore(s_etat_processus);
5766:
5767: if ((*s_etat_processus).langue == 'F')
5768: {
5769: printf("+++Information : Processus tracé [%d]\n",
5770: (int) getpid());
5771: }
5772: else
5773: {
5774: printf("+++Information : Done [%d]\n",
5775: (int) getpid());
5776: }
5777:
5778: printf("\n");
5779: }
5780:
5781: free((*s_etat_processus).definitions_chainees);
5782:
5783: /*
5784: * Libération de l'arbre des instructions
5785: */
5786:
5787: liberation_arbre_instructions(s_etat_processus,
5788: (*s_etat_processus).arbre_instructions);
5789: free((*s_etat_processus).pointeurs_caracteres);
5790:
5791: if ((*s_etat_processus).entree_standard != NULL)
5792: {
5793: pclose((*s_etat_processus).entree_standard);
5794: (*s_etat_processus).entree_standard = NULL;
5795: }
5796:
5797: if ((*s_etat_processus).nom_fichier_impression != NULL)
5798: {
5799: if (test_cfsf(s_etat_processus, 51) == d_faux)
5800: {
5801: printf("%s", ds_beep);
5802: }
5803:
5804: if ((*s_etat_processus).langue == 'F')
5805: {
5806: printf("+++Attention : Queue d'impression "
5807: "non vide !\n");
5808: }
5809: else
5810: {
5811: printf("+++Warning : Non empty printing "
5812: "spool queue !\n");
5813: }
5814:
5815: instruction_erase(s_etat_processus);
5816: }
5817:
5818: if ((*s_etat_processus).fichiers_graphiques != NULL)
5819: {
5820: instruction_cllcd(s_etat_processus);
5821: }
5822:
5823: liberation(s_etat_processus, (*s_etat_processus).indep);
5824: liberation(s_etat_processus, (*s_etat_processus).depend);
5825:
5826: free((*s_etat_processus).label_x);
5827: free((*s_etat_processus).label_y);
5828: free((*s_etat_processus).label_z);
5829: free((*s_etat_processus).titre);
5830: free((*s_etat_processus).legende);
5831:
5832: liberation(s_etat_processus, (*s_etat_processus)
5833: .parametres_courbes_de_niveau);
5834:
5835: for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
5836: {
5837: liberation(s_etat_processus,
5838: (*s_etat_processus).corps_interruptions[i]);
5839:
5840: l_element_courant = (*s_etat_processus)
5841: .pile_origine_interruptions[i];
5842:
5843: while(l_element_courant != NULL)
5844: {
5845: l_element_suivant = (*((struct_liste_chainee *)
5846: l_element_courant)).suivant;
5847:
5848: liberation(s_etat_processus,
5849: (*((struct_liste_chainee *)
5850: l_element_courant)).donnee);
5851: free(l_element_courant);
5852:
5853: l_element_courant = l_element_suivant;
5854: }
5855: }
5856:
5857: if ((*s_etat_processus).instruction_derniere_erreur
5858: != NULL)
5859: {
5860: free((*s_etat_processus).instruction_derniere_erreur);
5861: (*s_etat_processus).instruction_derniere_erreur = NULL;
5862: }
5863:
5864: /*
5865: * Le pointeur s_etat_processus.nom_fichier_source est
5866: * alloué par le système. Il ne faut donc pas
5867: * le libérer...
5868: */
5869:
5870: liberation_arbre_variables_partagees(s_etat_processus,
5871: (*(*s_etat_processus).s_arbre_variables_partagees));
5872: liberation_arbre_variables(s_etat_processus,
5873: (*s_etat_processus).s_arbre_variables, d_vrai);
5874: free((*s_etat_processus).pointeurs_caracteres_variables);
5875:
5876: l_element_statique_courant = (*s_etat_processus)
5877: .l_liste_variables_statiques;
5878:
5879: while(l_element_statique_courant != NULL)
5880: {
5881: l_element_statique_suivant =
5882: (*l_element_statique_courant).suivant;
5883: free(l_element_statique_courant);
5884: l_element_statique_courant = l_element_statique_suivant;
5885: }
5886:
5887: l_element_partage_courant = (*(*s_etat_processus)
5888: .l_liste_variables_partagees);
5889:
5890: while(l_element_partage_courant != NULL)
5891: {
5892: l_element_partage_suivant =
5893: (*l_element_partage_courant).suivant;
5894: free(l_element_partage_courant);
5895: l_element_partage_courant = l_element_partage_suivant;
5896: }
5897:
5898: /*
5899: * Si resultats est non nul, rplinit a été appelé
5900: * depuis rpl() [librpl] et non main().
5901: * On copie alors le contenu de la * pile dans un
5902: * tableau **resultats dont le pointeur de base a
5903: * été alloué dans rpl().
5904: */
5905:
5906: if (resultats != NULL)
5907: {
5908: if ((*resultats) != NULL)
5909: {
5910: free((*resultats));
5911:
5912: if (((*resultats) = malloc(((size_t)
5913: ((*s_etat_processus)
5914: .hauteur_pile_operationnelle + 1))
5915: * sizeof(unsigned char **))) != NULL)
5916: {
5917: (*resultats)[(*s_etat_processus)
5918: .hauteur_pile_operationnelle] = NULL;
5919: l_element_courant = (void *) (*s_etat_processus)
5920: .l_base_pile;
5921:
5922: for(i = 0; i < (*s_etat_processus)
5923: .hauteur_pile_operationnelle; i++)
5924: {
5925: if (l_element_courant != NULL)
5926: {
5927: (*resultats)[i] =
5928: formateur(s_etat_processus,
5929: 0, (*((struct_liste_chainee *)
5930: l_element_courant)).donnee);
5931:
5932: if ((*resultats)[i] == NULL)
5933: {
5934: i = (*s_etat_processus).
5935: hauteur_pile_operationnelle;
5936: }
5937: else
5938: {
5939: l_element_suivant =
5940: (*((struct_liste_chainee *)
5941: l_element_courant)).suivant;
5942: }
5943: }
5944: }
5945: }
5946: else
5947: {
5948: (*resultats) = NULL;
5949: erreur = d_es_allocation_memoire;
5950: }
5951: }
5952: }
5953:
5954: l_element_courant = (void *) (*s_etat_processus)
5955: .l_base_pile;
5956: while(l_element_courant != NULL)
5957: {
5958: l_element_suivant = (*((struct_liste_chainee *)
5959: l_element_courant)).suivant;
5960:
5961: liberation(s_etat_processus,
5962: (*((struct_liste_chainee *)
5963: l_element_courant)).donnee);
5964: free((struct_liste_chainee *) l_element_courant);
5965:
5966: l_element_courant = l_element_suivant;
5967: }
5968:
5969: l_element_courant = (void *) (*s_etat_processus)
5970: .l_base_pile_contextes;
5971: while(l_element_courant != NULL)
5972: {
5973: l_element_suivant = (*((struct_liste_chainee *)
5974: l_element_courant)).suivant;
5975:
5976: liberation(s_etat_processus,
5977: (*((struct_liste_chainee *)
5978: l_element_courant)).donnee);
5979: free((struct_liste_chainee *) l_element_courant);
5980:
5981: l_element_courant = l_element_suivant;
5982: }
5983:
5984: l_element_courant = (void *) (*s_etat_processus)
5985: .l_base_pile_taille_contextes;
5986: while(l_element_courant != NULL)
5987: {
5988: l_element_suivant = (*((struct_liste_chainee *)
5989: l_element_courant)).suivant;
5990:
5991: liberation(s_etat_processus,
5992: (*((struct_liste_chainee *)
5993: l_element_courant)).donnee);
5994: free((struct_liste_chainee *) l_element_courant);
5995:
5996: l_element_courant = l_element_suivant;
5997: }
5998:
5999: for(i = 0; i < (*s_etat_processus)
6000: .nombre_instructions_externes; i++)
6001: {
6002: free((*s_etat_processus).s_instructions_externes[i]
6003: .nom);
6004: free((*s_etat_processus).s_instructions_externes[i]
6005: .nom_bibliotheque);
6006: }
6007:
6008: if ((*s_etat_processus).nombre_instructions_externes != 0)
6009: {
6010: free((*s_etat_processus).s_instructions_externes);
6011: }
6012:
6013: l_element_courant = (void *) (*s_etat_processus)
6014: .s_bibliotheques;
6015:
6016: while(l_element_courant != NULL)
6017: {
6018: l_element_suivant = (*((struct_liste_chainee *)
6019: l_element_courant)).suivant;
6020:
6021: free((*((struct_bibliotheque *)
6022: (*((struct_liste_chainee *)
6023: l_element_courant)).donnee)).nom);
6024: dlclose((*((struct_bibliotheque *)
6025: (*((struct_liste_chainee *)
6026: l_element_courant)).donnee)).descripteur);
6027: free((*((struct_liste_chainee *) l_element_courant))
6028: .donnee);
6029: free(l_element_courant);
6030:
6031: l_element_courant = l_element_suivant;
6032: }
6033:
6034: l_element_courant = (void *) (*s_etat_processus)
6035: .l_base_pile_last;
6036: while(l_element_courant != NULL)
6037: {
6038: l_element_suivant = (*((struct_liste_chainee *)
6039: l_element_courant)).suivant;
6040:
6041: liberation(s_etat_processus,
6042: (*((struct_liste_chainee *)
6043: l_element_courant)).donnee);
6044: free((struct_liste_chainee *) l_element_courant);
6045:
6046: l_element_courant = l_element_suivant;
6047: }
6048:
6049: l_element_courant = (void *) (*s_etat_processus)
6050: .l_base_pile_systeme;
6051: while(l_element_courant != NULL)
6052: {
6053: l_element_suivant = (*((struct_liste_pile_systeme *)
6054: l_element_courant)).suivant;
6055:
6056: liberation(s_etat_processus,
6057: (*((struct_liste_pile_systeme *)
6058: l_element_courant)).indice_boucle);
6059: liberation(s_etat_processus,
6060: (*((struct_liste_pile_systeme *)
6061: l_element_courant)).limite_indice_boucle);
6062: liberation(s_etat_processus,
6063: (*((struct_liste_pile_systeme *)
6064: l_element_courant)).objet_de_test);
6065:
6066: if ((*((struct_liste_pile_systeme *)
6067: l_element_courant)).nom_variable != NULL)
6068: {
6069: free((*((struct_liste_pile_systeme *)
6070: l_element_courant)).nom_variable);
6071: }
6072:
6073: free((struct_liste_pile_systeme *)
6074: l_element_courant);
6075:
6076: l_element_courant = l_element_suivant;
6077: }
6078:
6079: l_element_courant = (void *)
6080: (*s_etat_processus).s_fichiers;
6081: while(l_element_courant != NULL)
6082: {
6083: l_element_suivant = (*((struct_liste_chainee *)
6084: l_element_courant)).suivant;
6085:
6086: fclose((*((struct_descripteur_fichier *)
6087: (*((struct_liste_chainee *)
6088: l_element_courant)).donnee))
6089: .descripteur_c);
6090:
6091: if ((*((struct_descripteur_fichier *)
6092: (*((struct_liste_chainee *)
6093: l_element_courant)).donnee)).type != 'C')
6094: {
6095: sqlite3_close((*((struct_descripteur_fichier *)
6096: (*((struct_liste_chainee *)
6097: l_element_courant)).donnee))
6098: .descripteur_sqlite);
6099: }
6100:
6101: if ((*((struct_descripteur_fichier *)
6102: (*((struct_liste_chainee *)
6103: l_element_courant)).donnee))
6104: .effacement == 'Y')
6105: {
6106: unlink((*((struct_descripteur_fichier *)
6107: (*((struct_liste_chainee *)
6108: l_element_courant)).donnee))
6109: .nom);
6110: }
6111:
6112: free((*((struct_descripteur_fichier *)
6113: (*((struct_liste_chainee *)
6114: l_element_courant)).donnee)).nom);
6115: free((struct_descripteur_fichier *)
6116: (*((struct_liste_chainee *)
6117: l_element_courant)).donnee);
6118: free(l_element_courant);
6119:
6120: l_element_courant = l_element_suivant;
6121: }
6122:
6123: l_element_courant = (void *)
6124: (*s_etat_processus).s_sockets;
6125: while(l_element_courant != NULL)
6126: {
6127: l_element_suivant = (*((struct_liste_chainee *)
6128: l_element_courant)).suivant;
6129:
6130: if ((*((struct_socket *)
6131: (*(*((struct_liste_chainee *)
6132: l_element_courant)).donnee).objet))
6133: .socket_connectee == d_vrai)
6134: {
6135: shutdown((*((struct_socket *)
6136: (*(*((struct_liste_chainee *)
6137: l_element_courant)).donnee).objet))
6138: .socket, SHUT_RDWR);
6139: }
6140:
6141: close((*((struct_socket *)
6142: (*(*((struct_liste_chainee *)
6143: l_element_courant)).donnee).objet)).socket);
6144:
6145: if ((*((struct_socket *) (*(*((struct_liste_chainee *)
6146: l_element_courant)).donnee).objet)).effacement
6147: == 'Y')
6148: {
6149: unlink((*((struct_socket *)
6150: (*(*((struct_liste_chainee *)
6151: l_element_courant)).donnee).objet))
6152: .adresse);
6153: }
6154:
6155: liberation(s_etat_processus,
6156: (*((struct_liste_chainee *)
6157: l_element_courant)).donnee);
6158: free(l_element_courant);
6159:
6160: l_element_courant = l_element_suivant;
6161: }
6162:
6163: l_element_courant = (void *)
6164: (*s_etat_processus).s_connecteurs_sql;
6165: while(l_element_courant != NULL)
6166: {
6167: l_element_suivant = (*((struct_liste_chainee *)
6168: l_element_courant)).suivant;
6169:
6170: sqlclose((*((struct_liste_chainee *)
6171: l_element_courant)).donnee);
6172: liberation(s_etat_processus,
6173: (*((struct_liste_chainee *)
6174: l_element_courant)).donnee);
6175: free(l_element_courant);
6176:
6177: l_element_courant = l_element_suivant;
6178: }
6179:
6180: l_element_courant = (*s_etat_processus).s_marques;
6181: while(l_element_courant != NULL)
6182: {
6183: free((*((struct_marque *) l_element_courant)).label);
6184: free((*((struct_marque *) l_element_courant)).position);
6185: l_element_suivant = (*((struct_marque *)
6186: l_element_courant)).suivant;
6187: free(l_element_courant);
6188: l_element_courant = l_element_suivant;
6189: }
6190: }
6191: else
6192: {
6193: erreur = d_es_allocation_memoire;
6194:
6195: if (test_cfsf(s_etat_processus, 51) == d_faux)
6196: {
6197: printf("%s", ds_beep);
6198: }
6199:
6200: if ((*s_etat_processus).langue == 'F')
6201: {
6202: printf("+++Système : Mémoire insuffisante\n");
6203: }
6204: else
6205: {
6206: printf("+++System : Not enough memory\n");
6207: }
6208: }
6209: }
6210:
6211: liberation_allocateur(s_etat_processus);
6212: }
6213:
6214: if (traitement_fichier_temporaire == 'Y')
6215: {
6216: destruction_fichier(nom_fichier_temporaire);
6217: free(nom_fichier_temporaire);
6218: }
6219:
6220: if ((*s_etat_processus).profilage == d_vrai)
6221: {
6222: ecriture_profil(s_etat_processus);
6223: liberation_profil(s_etat_processus);
6224: }
6225: }
6226:
6227: closelog();
6228:
6229: pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes));
6230:
6231: retrait_thread(s_etat_processus);
6232:
6233: pthread_mutex_destroy(&((*s_etat_processus).mutex_pile_processus));
6234: pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation));
6235: pthread_mutex_destroy(&((*s_etat_processus).mutex_interruptions));
6236: pthread_mutex_destroy(&((*s_etat_processus).mutex_signaux));
6237: pthread_mutex_destroy(&mutex_sections_critiques);
6238: pthread_mutex_destroy(&mutex_liste_variables_partagees);
6239:
6240: # ifndef SEMAPHORES_NOMMES
6241: sem_post(&((*s_etat_processus).semaphore_fork));
6242: sem_destroy(&((*s_etat_processus).semaphore_fork));
6243: # else
6244: sem_post((*s_etat_processus).semaphore_fork);
6245: sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(),
6246: SEM_FORK);
6247: # endif
6248:
6249: free((*s_etat_processus).localisation);
6250:
6251: # ifndef SEMAPHORES_NOMMES
6252: sem_post(&semaphore_gestionnaires_signaux);
6253: sem_destroy(&semaphore_gestionnaires_signaux);
6254: # else
6255: sem_post(semaphore_gestionnaires_signaux);
6256: sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX);
6257: # endif
6258:
6259: destruction_queue_signaux(s_etat_processus);
6260: liberation_contexte_cas(s_etat_processus);
6261:
6262: free((*s_etat_processus).chemin_fichiers_temporaires);
6263:
6264: if ((*s_etat_processus).requete_redemarrage == d_vrai)
6265: {
6266: chdir(repertoire_initial);
6267: execvp(arg_exec[0], &(arg_exec[0]));
6268: erreur = d_erreur;
6269: }
6270:
6271: free(arg_exec);
6272: arret_thread_signaux(s_etat_processus);
6273: free(s_etat_processus);
6274:
6275: # ifdef DEBUG_MEMOIRE
6276: debug_memoire_verification();
6277: analyse_post_mortem();
6278: # endif
6279:
6280: # ifdef HAVE_STACK_OVERFLOW_RECOVERY
6281: stackoverflow_deinstall_handler();
6282: # endif
6283:
6284: # ifdef HAVE_SIGSEGV_RECOVERY
6285: if (debug == d_faux)
6286: {
6287: sigsegv_deinstall_handler();
6288: }
6289: # endif
6290:
6291: return((erreur == d_absence_erreur) ? EXIT_SUCCESS : EXIT_FAILURE);
6292: }
6293:
6294:
6295: void
6296: informations(struct_processus *s_etat_processus)
6297: {
6298: printf("\n");
6299:
6300: if ((*s_etat_processus).langue == 'F')
6301: {
6302: printf(" rpl [-options] [programme]\n");
6303: printf(" -a : analyse du code\n");
6304: printf(" -A : paramètres passés au programme principal\n");
6305: printf(" -c : génération de fichier de débogage (rpl-core)\n");
6306: printf(" -d : option de déverminage interne\n");
6307: printf(" -D : lancement d'un daemon\n");
6308: printf(" -h : aide sur la ligne de commande\n");
6309: printf(" -i : fonctionnement interactif\n");
6310: printf(" -l : licence d'utilisation\n");
6311: printf(" -n : ignorance du signal HUP\n");
6312: printf(" -p : précompilation du script avant exécution\n");
6313: printf(" -P : profilage (-P ou -PP)\n");
6314: printf(" -s : empêchement de l'ouverture de l'écran initial\n");
6315: printf(" -S : exécution du script passé en ligne de commande\n");
6316: printf(" -t : trace\n");
6317: printf(" -v : version\n");
6318: }
6319: else
6320: {
6321: printf(" rpl [-options] [program]\n");
6322: printf(" -a : analyzes program\n");
6323: printf(" -A : sends parameters to main program\n");
6324: printf(" -c : allows creation of a rpl-core file, providing a way"
6325: "\n"
6326: " to debug a program\n");
6327: printf(" -d : internal debug process\n");
6328: printf(" -D : starts in daemon mode\n");
6329: printf(" -h : shows a summary of available options\n");
6330: printf(" -i : runs the RPL/2 sequencer in interactive mode\n");
6331: printf(" -l : prints the user licence of the software\n");
6332: printf(" -n : ignores HUP signal\n");
6333: printf(" -p : precompiles script\n");
6334: printf(" -P : computes profile data (-P or -PP)\n");
6335: printf(" -s : disables splash screen\n");
6336: printf(" -S : executes script written in command line\n");
6337: printf(" -t : enables tracing mode\n");
6338: printf(" -v : prints the version number\n");
6339: }
6340:
6341: printf("\n");
6342:
6343: return;
6344: }
6345:
6346:
6347: logical1
6348: controle_integrite(struct_processus *s_etat_processus,
6349: unsigned char *executable_candidat, unsigned char *executable)
6350: {
6351: unsigned char *md5;
6352: unsigned char *sha1;
6353:
6354: if (strcmp(executable, "rplpp") == 0)
6355: {
6356: md5 = rplpp_md5;
6357: sha1 = rplpp_sha1;
6358: }
6359: else if (strcmp(executable, "rplfile") == 0)
6360: {
6361: md5 = rplfile_md5;
6362: sha1 = rplfile_sha1;
6363: }
6364: else if (strcmp(executable, "rpliconv") == 0)
6365: {
6366: md5 = rpliconv_md5;
6367: sha1 = rpliconv_sha1;
6368: }
6369: else if (strcmp(executable, "rplawk") == 0)
6370: {
6371: md5 = rplawk_md5;
6372: sha1 = rplawk_sha1;
6373: }
6374: else if (strcmp(executable, "rplconvert") == 0)
6375: {
6376: md5 = rplconvert_md5;
6377: sha1 = rplconvert_sha1;
6378: }
6379: else
6380: {
6381: return(d_faux);
6382: }
6383:
6384: if (controle(s_etat_processus, executable_candidat, "md5", md5) != d_vrai)
6385: {
6386: return(d_faux);
6387: }
6388:
6389: if (controle(s_etat_processus, executable_candidat, "sha1", sha1) != d_vrai)
6390: {
6391: return(d_faux);
6392: }
6393:
6394: return(d_vrai);
6395: }
6396:
6397:
6398: unsigned char *
6399: date_compilation()
6400: {
6401: unsigned char *date;
6402:
6403: if ((date = malloc((strlen(d_date_en_rpl) + 1) * sizeof(unsigned char)))
6404: == NULL)
6405: {
6406: return(NULL);
6407: }
6408:
6409: strcpy(date, d_date_en_rpl);
6410:
6411: return(date);
6412: }
6413:
6414: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>