From 37451f22b741ef0ef93eda38791cb5c934d6fe5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Wed, 21 Apr 2021 13:50:58 +0200 Subject: [PATCH] save --- jobs | Bin 32344 -> 33016 bytes jobs.c | 88 ++++++++++++++++++++++++++++++++++------------------ jobs.h | 10 ++---- minishell | Bin 32696 -> 32992 bytes minishell.c | 57 ++++++++++++++++++++++++---------- test.sh | 2 +- 6 files changed, 102 insertions(+), 55 deletions(-) diff --git a/jobs b/jobs index c42736bc3ffd781dc38a1f26bf18438c02944025..470a24c19290de02d9c51f8149d25774f77d4887 100755 GIT binary patch delta 10589 zcmb7K3wTu3wLbgI?3sNglVm2zWbz^z-VlTkKwd^j6l8)t5+s-)NFoU&7#@=Fh7K5F zosLxEmMdCXv0Ai#NY%6|h=7kPNUNf?ing{v#15rmyjB}6b?(3RITIkY-|gMsm%a8{ z>tAcH{aRvvkzble-47PfVNrFbhNZS@7z1904hu9%C;gUM*8AmWH#&errQxqik>%_FJ%^sbO(bUGtKq zE3~CGjg89}Y7jIoU$&SeP0cG8)-=l}ov+L9iP3Vm@LWrCp=(}Dh=(QtC9R<$QPXT% zwk2DY)nL#R^`}WgiB31EFp1V7nc>gco?@}(mut0hIl{Eg}HGcXtc~^oFI9Z$U85Q_iitDUu%2XbAt7X z^-r0oY4uq^o-O`17K`rHvhR-x7 z1|wI`fIj9cmOE0e3Ka*#n@)yTy%VlD5e!d1b~ppL=orKp3{UPjOgl6>*yN(Y$mCkIOh)bSw`r~GzN zh`lbvV&^L11S2W-M2hX>Cco319p@1hjZo<*g!j&|?cF@^*04=IyuJAkj7s4vIw`2_ zuf1G>2@baWHGnAvOlGI`O0UBjn?d=}JMb8Ju}98GD`FF6B(3s#^4k?`+0>=2`al8a zD>u>e-^5}^HA+s0)tHiCewem?bQD^b_e6_uG`d#~^Nq#9UhFF>O1}!Ljo`vBqV5d8 zLHf7hkp`AdA`&nNRF`Mz6vw64%Rl*+AnQy`AILJ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z8+pUuQvCOZf8UwEqD$ Cn^4FA diff --git a/jobs.c b/jobs.c index e0db70d..482678e 100644 --- a/jobs.c +++ b/jobs.c @@ -3,78 +3,106 @@ #include #include "jobs.h" -void ajouter(list* l_ptr, int pid, int id) { +void ajouter(list *l_ptr, int pid, int id, char*** cmd) +{ + + cell *new_cell = malloc(sizeof(*new_cell)); + + char *name_with_extension; + name_with_extension = malloc(sizeof(char)*256); - cell* new_cell = malloc(sizeof(*new_cell)); + char** cursor = *cmd; + + strcpy(name_with_extension, *cursor); + cursor++; + strcat(name_with_extension, *cursor); + cursor++; + char* test = *cursor; new_cell->pid = pid; new_cell->id = id; - if (*l_ptr == NULL) { + if (*l_ptr == NULL) + { new_cell->next = NULL; - } else { + } + else + { new_cell->next = *l_ptr; } *l_ptr = new_cell; printf("[%d] %d\n", id, pid); - } -void supprimer(list* l_ptr, int pid) { - - cell* cursor = *l_ptr; +void supprimer(list *l_ptr, int pid) +{ - if (cursor->pid == pid) { - cell* cursor2free = cursor; - *l_ptr = cursor->next; + cell *cursor = *l_ptr; + + if (cursor->pid == pid) + { + cell *cursor2free = cursor; + *l_ptr = cursor->next; free(cursor2free); - } else { - while (cursor->next != NULL) { - if (cursor->next->pid == pid) { + } + else + { + while (cursor->next != NULL) + { + if (cursor->next->pid == pid) + { break; - } else { + } + else + { cursor = cursor->next; } } - cell* cursor_next = cursor->next->next; + cell *cursor_next = cursor->next->next; free(cursor->next); cursor->next = cursor_next; } - } -void afficher(list* l_ptr) { +void afficher(list *l_ptr) +{ - cell* cursor = *l_ptr; - - while (cursor != NULL) { + cell *cursor = *l_ptr; + + while (cursor != NULL) + { printf("[%d] %d\n", cursor->id, cursor->pid); cursor = cursor->next; } - } -void initialiser(list* l_ptr) { +void initialiser(list *l_ptr) +{ *l_ptr = NULL; } -void liberer(list* l_ptr) { +void liberer(list *l_ptr) +{ free(*l_ptr); *l_ptr = NULL; } -int est_vide(list l_ptr) { +int est_vide(list l_ptr) +{ return l_ptr == NULL; } -int contiens(list* l_ptr, int pid) { - - cell* cursor = *l_ptr; +int contiens(list *l_ptr, int pid) +{ - while (cursor != NULL) { - if (cursor->pid == pid) { + cell *cursor = *l_ptr; + + while (cursor != NULL) + { + if (cursor->pid == pid) + { return 1; } cursor = cursor->next; diff --git a/jobs.h b/jobs.h index 17d07c9..2d1d858 100644 --- a/jobs.h +++ b/jobs.h @@ -5,22 +5,18 @@ typedef struct cell cell; struct cell { int id; int pid; - int state; char* cmd; cell* next; }; typedef cell* list; -void ajouter(cell** list, int pid, int id); +void ajouter(cell** list, int pid, int id, char*** cmd); void supprimer(cell** list, int pid); void afficher(cell** list); void initialiser(list* list); void liberer(list* list); int contiens(list* l_ptr, int pid); +cell* trouver(list* l_ptr, int pid); -#endif - -// state: -// 0: running -// 1: suspended \ No newline at end of file +#endif \ No newline at end of file diff --git a/minishell b/minishell index e5fb37197d79c59bc491a38e7f8aff650de49f0c..780d6c30a67b3699ee9f4581fd3648f2a01e405b 100755 GIT binary patch delta 9965 zcmbVS33yaRw!U?{tNY$gcha4$(@7u+VG|@9$f7J^i8O175={^Y5dw(>h>);EvB3nj zr^QF8ry~q1<0$gpQ&6KLGO`I8)Te^O8)0S~gNk;<(KtFzW?XvyQ}=cY`Nr?P?-gI_ z)H(H^rM7eHUiv_Ub#7L-r6qQI6j_Q5qI9ln8?r|~=``4rZRheGC8-8ek}48ep1z11 z>>@FZ<+J|n8<>~rCrtGdVu$)ga_)Uw9y@zWjpy6LZ5`*^zuErU(C2OzyDWo!{QzV5 zvk{zSE1MKWMN8=?-m~N~r(jku8!HM?H^{oLtP4f8)hiloY3!Kf7sz_EtcS|_jI4Lc z`k<`;A?q7u{i&>fOSLGlrmPm%Q-sPkF7Y(Fk*P1f_J)|aw88jN;HdC(j4!lgv(}%Elu|?1K^)X!# z=_xfBTFGqjrtTHr=}uR4+_Xh<+rQVd7<0Avi5taOrYLvj`?3rrS$EGd7&}N#dz*8z zDKC#xl&`me?HW%~{sECO zJ&h^;5Pukb{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2|U*FnwG`cTs=)=ta5c_ zb>*U!m1~!-(biTks$Qxssado3R{6-H5p928G|t*~^|IA$^eXc*`Yl!vm4BF!c1|i^ znDBxLFPc!J?E3yOXMU3s>(>>=1*2!pB6b0vDvFK!?b+mSFv(sbA`#h@>?jG(w8+7`K`%EO)@8Fq+jegcxlA5VOvsMa?3Z9{cAXYCaE^x8K20`t!#%Bt^@ z=c-?nM`|8uyLnxP1z(-Ftj~4l;Vh>Tfh*);P+QF|MBsIjZOC;-zRz|DdG&@74lhnB zDqgvM!^r3--N>ii?eg%3AVMtKm>d1un8>uHB+0EC2RkE~g3rYJH{Qt($f8ZTiG@Q9 zs}b0(w{6`tma#5*cyq2JvM{^kKQ@nJRyq2Paok!24gB3ml5D=CKR%1UaK|{uqeMeN z$^}O{{Id+~SF#A$fpP;YmRo@FMF#f0+*0Rh*=v;_2Q&2WGWmUQth4SGgSSt}@pU5{ UqpA$l1JRL=88rrWGe*q+KOYs-K>z>% diff --git a/minishell.c b/minishell.c index 6739710..e56b04f 100644 --- a/minishell.c +++ b/minishell.c @@ -14,6 +14,7 @@ int prompting = 0; int job_id = 1; list jobs; +pid_t pidFils; jmp_buf start; @@ -25,9 +26,16 @@ void handler_print(int signal_num, siginfo_t *info) { // si il n'y a pas d'execution de procces actuellement printf("\n"); } + + // TODO: trouver id, cmd... à partir pid printf("[%d] --> (%d) %s\n", info->si_pid, signal_num, strsignal(signal_num)); supprimer(&jobs, info->si_pid); job_id--; + + if (prompting) + { // on réaffiche un prompt si besoin + siglongjmp(start, signal_num); + } } } @@ -37,6 +45,20 @@ void handler_restart(int signal_num, siginfo_t *info) siglongjmp(start, signal_num); } +void handler_stop(int signal_num, siginfo_t *info) +{ + if (!prompting) + { + kill(pidFils, SIGTSTP); + //ajouter(&jobs, pidFils, job_id++, cmd); + siglongjmp(start, signal_num); + } + else + { + handler_restart(signal_num, info); + } +} + int main(int argc, char *argv[]) { @@ -47,11 +69,13 @@ int main(int argc, char *argv[]) // gestion de SIGCHLD struct sigaction action; sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO; //| SA_RESTART; + action.sa_flags = SA_SIGINFO | SA_RESTART; action.sa_handler = handler_print; sigaction(SIGCHLD, &action, NULL); action.sa_handler = handler_restart; sigaction(SIGINT, &action, NULL); + action.sa_handler = handler_stop; + sigaction(SIGTSTP, &action, NULL); // variables de "pwd" char initcd[256], currentcd[256]; @@ -60,7 +84,6 @@ int main(int argc, char *argv[]) // loop principal while (1) { - if (sigsetjmp(start, 1) == 2) { // si on provient du jump continue; @@ -82,6 +105,11 @@ int main(int argc, char *argv[]) { // ligne vide, on skip continue; } + else if (!strcmp(cmd->seq[0][0], "bg")) + { + kill(pidFils, SIGCONT); + continue; + } else if (!strcmp(cmd->seq[0][0], "exit")) { break; @@ -90,7 +118,7 @@ int main(int argc, char *argv[]) { // cd int ret = 0; if (cmd->seq[0][1] == NULL) - { // vide + { // vide, sans path ret = chdir(initcd); } else @@ -109,7 +137,7 @@ int main(int argc, char *argv[]) continue; } - pid_t pidFils = fork(); + pidFils = fork(); if (pidFils == -1) { // si le fork échoue @@ -119,6 +147,11 @@ int main(int argc, char *argv[]) if (pidFils == 0) { // instructions du fils + if (cmd->backgrounded) + { + action.sa_handler = SIG_IGN; + sigaction(SIGINT, &action, NULL); // on ignore SIGINT + } execvp(cmd->seq[0][0], cmd->seq[0]); exit(errno); // si execlp échoue on exit avec une erreur } @@ -126,27 +159,17 @@ int main(int argc, char *argv[]) { // instructions du père if (cmd->backgrounded) { // on sauvegarde le pid, si background - ajouter(&jobs, pidFils, job_id++); + ajouter(&jobs, pidFils, job_id++, cmd->seq); } else { // on attend le fils, si foreground - jmp_buf env; - setjmp(env); // sauvegarde pour un jump - int codeTerm; pid_t idFils = waitpid(pidFils, &codeTerm, 0); // on attend la fin de l'exec du fils if (idFils == -1) { // si le wait fail - if (errno == 4) - { - longjmp(env, 1); // si interruption du wait, on jump - } - else - { - fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", codeTerm, errno, strerror(errno)); - exit(errno); - } + fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", codeTerm, errno, strerror(errno)); + exit(errno); } if (codeTerm) diff --git a/test.sh b/test.sh index f8fc522..1c0a797 100644 --- a/test.sh +++ b/test.sh @@ -1,2 +1,2 @@ sleep 5 -echo bonjourr +printf "\n\nbonjourr\n\n" \ No newline at end of file