Added documentation

This commit is contained in:
Edward Emelianov
2021-10-29 20:40:38 +03:00
parent 39b9cee77c
commit b2a3d68513
10 changed files with 471 additions and 41 deletions

View File

@@ -33,11 +33,13 @@
#include "socket.h"
static InputType tp;
static pid_t childpid;
/**
* We REDEFINE the default WEAK function of signal processing
*/
void signals(int sig){
if(childpid) exit(sig); // father -> do nothin @ end
if(sig){
signal(sig, SIG_IGN);
DBG("Get signal %d.", sig);
@@ -192,7 +194,7 @@ int main(int argc, char *argv[]){
signal(SIGQUIT, signals); // ctrl+\ - quit
signal(SIGTSTP, SIG_IGN); // ignore ctrl+Z
while(1){ // guard for dead processes
pid_t childpid = fork();
childpid = fork();
if(childpid){ // father
LOGMSG("create child with PID %d\n", childpid);
DBG("Created child with PID %d\n", childpid);