version 1.328, 2019/02/07 21:44:15
|
version 1.341, 2020/03/17 15:30:50
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.31 |
RPL/2 (R) version 4.1.32 |
Copyright (C) 1989-2019 Dr. BERTRAND Joël |
Copyright (C) 1989-2020 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 18
|
Line 18
|
along with RPL/2. If not, write to info@cecill.info. |
along with RPL/2. If not, write to info@cecill.info. |
================================================================================ |
================================================================================ |
*/ |
*/ |
#define DEBUG_ERREURS |
|
#define DEBUG_SEMAPHORES |
|
|
|
#ifndef INCLUSION_RPL |
#ifndef INCLUSION_RPL |
#define INCLUSION_RPL |
#define INCLUSION_RPL |
Line 326 enum signaux_rpl
|
Line 325 enum signaux_rpl
|
rpl_sighup, |
rpl_sighup, |
rpl_sigtstp, |
rpl_sigtstp, |
rpl_sigexcept, |
rpl_sigexcept, |
rpl_sigmax |
rpl_sigmax, |
|
rpl_siguser // Base des signaux à la discrétion de l'utilisateur |
}; |
}; |
|
|
#define LONGUEUR_QUEUE_SIGNAUX 1024 |
#define LONGUEUR_QUEUE_SIGNAUX 1024 |
Line 395 union semun
|
Line 395 union semun
|
|
|
#ifdef IPCS_SYSV |
#ifdef IPCS_SYSV |
# ifdef DEBUG_SEMAPHORES |
# ifdef DEBUG_SEMAPHORES |
|
# define sem_init(a, b, c) ({ \ |
|
uprintf("[%d-%llu] Semaphore %s (%p) "\ |
|
"initialization at %s() " \ |
|
"line #%d <%d>\n", (int) getpid(), (unsigned long long) \ |
|
pthread_self(), \ |
|
#a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ |
|
sem_init_SysV(a, b, c); }) |
# define sem_wait(a) ({ int value; sem_getvalue(a, &value); \ |
# define sem_wait(a) ({ int value; sem_getvalue(a, &value); \ |
uprintf("[%d-%llu] Semaphore %s (%p) "\ |
uprintf("[%d-%llu] Semaphore %s (%p) "\ |
"waiting at %s() " \ |
"waiting at %s() " \ |
Line 439 union semun
|
Line 446 union semun
|
# define sem_unlink(a) sem_unlink_SysV(a) |
# define sem_unlink(a) sem_unlink_SysV(a) |
#else |
#else |
# ifdef DEBUG_SEMAPHORES |
# ifdef DEBUG_SEMAPHORES |
|
# define sem_init(a, b, c) ({ \ |
|
uprintf("[%d-%llu] Semaphore %s (%p) "\ |
|
"initialization at %s() " \ |
|
"line #%d <%d>\n", (int) getpid(), (unsigned long long) \ |
|
pthread_self(), \ |
|
#a, a, __FUNCTION__, __LINE__, c), fflush(stdout); \ |
|
sem_init(a, b, c); }) |
# define sem_wait(a) ({ int value; sem_getvalue(a, &value); \ |
# define sem_wait(a) ({ int value; sem_getvalue(a, &value); \ |
uprintf("[%d-%llu] Semaphore %s (%p) "\ |
uprintf("[%d-%llu] Semaphore %s (%p) "\ |
"waiting at %s() " \ |
"waiting at %s() " \ |
Line 554 union semun
|
Line 568 union semun
|
|
|
__EXTERN__ pid_t pid_processus_pere; |
__EXTERN__ pid_t pid_processus_pere; |
|
|
|
__EXTERN__ pthread_mutex_t mutex_sigaction; |
__EXTERN__ pthread_mutex_t mutex_liste_threads; |
__EXTERN__ pthread_mutex_t mutex_liste_threads; |
|
__EXTERN__ pthread_mutex_t mutex_liste_threads_surveillance; |
__EXTERN__ pthread_mutex_t mutex_creation_variable_partagee |
__EXTERN__ pthread_mutex_t mutex_creation_variable_partagee |
__STATIC_MUTEX_INITIALIZATION__; |
__STATIC_MUTEX_INITIALIZATION__; |
__EXTERN__ pthread_mutex_t mutex_sections_critiques; |
__EXTERN__ pthread_mutex_t mutex_sections_critiques; |
Line 562 union semun
|
Line 578 union semun
|
__EXTERN__ pthread_mutex_t mutex_sem __STATIC_MUTEX_INITIALIZATION__; |
__EXTERN__ pthread_mutex_t mutex_sem __STATIC_MUTEX_INITIALIZATION__; |
|
|
__EXTERN__ volatile int routine_recursive; |
__EXTERN__ volatile int routine_recursive; |
__EXTERN__ volatile int nombre_thread_surveillance_processus; |
__EXTERN__ volatile int nombre_threads_surveillance_processus; |
|
|
# define SEM_FORK 0 |
# define SEM_FORK 0 |
# define SEM_QUEUE 1 |
# define SEM_QUEUE 1 |
Line 715 void *debug_memoire_modification(void *p
|
Line 731 void *debug_memoire_modification(void *p
|
void debug_memoire_retrait(void *ptr); |
void debug_memoire_retrait(void *ptr); |
void debug_memoire_verification(); |
void debug_memoire_verification(); |
|
|
pid_t debug_fork(); |
|
|
|
#define malloc(s) debug_memoire_ajout(s, __FUNCTION__, __LINE__, #s) |
|
#define free(s) debug_memoire_retrait(s) |
#define free(s) debug_memoire_retrait(s) |
#define realloc(s, t) debug_memoire_modification(s, t, \ |
#ifdef RPLCXX |
__FUNCTION__, __LINE__, #t) |
# define malloc(s) debug_memoire_ajout(s, \ |
#define fork() debug_fork() |
const_cast<const unsigned char *> \ |
|
(reinterpret_cast<unsigned char *> \ |
|
(const_cast<char *>(__FUNCTION__))), __LINE__, \ |
|
const_cast<const unsigned char *> \ |
|
(reinterpret_cast<unsigned char *> \ |
|
(const_cast<char *>(#s)))) |
|
# define realloc(s, t) debug_memoire_modification(s, t, \ |
|
const_cast<const unsigned char *> \ |
|
(reinterpret_cast<unsigned char *> \ |
|
(const_cast<char *>(__FUNCTION__))), __LINE__, \ |
|
const_cast<const unsigned char *> \ |
|
(reinterpret_cast<unsigned char *> \ |
|
(const_cast<char *>(#t)))) |
|
#else |
|
# define malloc(s) debug_memoire_ajout(s, __FUNCTION__, __LINE__, \ |
|
(const unsigned char *) #s) |
|
# define realloc(s, t) debug_memoire_modification(s, t, \ |
|
__FUNCTION__, __LINE__, (const unsigned char *) #t) |
|
#endif |
|
#define fork() debug_fork(s_etat_processus) |
#endif |
#endif |
|
|
#ifdef DEBUG_RETURN |
#ifdef DEBUG_RETURN |
Line 1046 pid_t debug_fork();
|
Line 1078 pid_t debug_fork();
|
# define d_ex_taille_message __erreur(92) |
# define d_ex_taille_message __erreur(92) |
# define d_ex_type_externe_dup __erreur(93) |
# define d_ex_type_externe_dup __erreur(93) |
# define d_ex_type_externe_drop __erreur(94) |
# define d_ex_type_externe_drop __erreur(94) |
|
# define d_ex_simplification __erreur(95) |
#endif |
#endif |
|
|
|
|
Line 2540 typedef struct processus
|
Line 2573 typedef struct processus
|
} struct_processus; |
} struct_processus; |
#endif |
#endif |
|
|
|
#ifdef DEBUG_MEMOIRE |
|
pid_t debug_fork(struct_processus *s_etat_processus); |
|
#endif |
|
|
|
|
/* |
/* |
================================================================================ |
================================================================================ |
Line 3307 int envoi_signal_contexte(struct_process
|
Line 3344 int envoi_signal_contexte(struct_process
|
enum signaux_rpl signal); |
enum signaux_rpl signal); |
int envoi_signal_processus(pid_t pid, enum signaux_rpl signal, |
int envoi_signal_processus(pid_t pid, enum signaux_rpl signal, |
logical1 test_ouverture); |
logical1 test_ouverture); |
int envoi_signal_thread(pthread_t tid, enum signaux_rpl signal); |
int envoi_signal_thread(struct_processus *s_etat_processus, |
|
pthread_t tid, enum signaux_rpl signal); |
#endif |
#endif |
|
|
/* |
/* |
Line 3543 logical1 validation_chaine(unsigned char
|
Line 3581 logical1 validation_chaine(unsigned char
|
#ifndef RPLARGS |
#ifndef RPLARGS |
ssize_t read_atomic(struct_processus *s_etat_processus, |
ssize_t read_atomic(struct_processus *s_etat_processus, |
int fd, void *buf, size_t count); |
int fd, void *buf, size_t count); |
|
ssize_t read_atomic_signal(struct_processus *s_etat_processus, |
|
int fd, void *buf, size_t count); |
ssize_t write_atomic(struct_processus *s_etat_processus, |
ssize_t write_atomic(struct_processus *s_etat_processus, |
int fd, void *buf, size_t count); |
int fd, void *buf, size_t count); |
#endif |
#endif |