From c7248375faa830e1f694c7859c91d84e8551fb19 Mon Sep 17 00:00:00 2001 From: Bjoern Esswein <bjoern.esswein@gmail.com> Date: Tue, 18 Feb 2020 14:08:15 +0100 Subject: [PATCH] signal.c renamed mask variables --- Readme.md | 16 ++++++++-------- Zettel.html | 16 ++++++++-------- signal.c | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Readme.md b/Readme.md index 627a408..15cda65 100644 --- a/Readme.md +++ b/Readme.md @@ -207,16 +207,16 @@ int main() { if( sigaction(SIGCHLD, &handleSIGCHLD, NULL) != 0 ) die("Could not set sigaction"); //mask sigchld - sigset_t newMask_Itr; - sigset_t oldMask_Itr; - sigemptyset(&newMask_Itr); - sigaddset(&newMask_Itr, SIGCHLD); - if (sigprocmask(SIG_BLOCK, &newMask_Itr, &oldMask_Itr) == -1) die("sigprocmask"); + sigset_t newMask; + sigset_t oldMask; + sigemptyset(&newMask); + sigaddset(&newMask, SIGCHLD); + if (sigprocmask(SIG_BLOCK, &newMask, &oldMask) == -1) die("sigprocmask"); //do critical stuff //alte signal mask wiederherstellen - if (sigprocmask(SIG_SETMASK, &oldMask_Itr, NULL) == -1) die("sigprocmask"); + if (sigprocmask(SIG_SETMASK, &oldMask, NULL) == -1) die("sigprocmask"); pid_t pid = fork(); if(pid < 0) die("fork"); @@ -227,9 +227,9 @@ int main() { //passives warten pcount = 1; - if (sigprocmask(SIG_BLOCK, &newMask_Itr, &oldMask_Itr) == -1) die("sigprocmask"); + if (sigprocmask(SIG_BLOCK, &newMask, &oldMask) == -1) die("sigprocmask"); while (pcount > 0) { - sigsuspend(&oldMask_Itr); + sigsuspend(&oldMask); } } diff --git a/Zettel.html b/Zettel.html index 8714e1a..bd9949b 100644 --- a/Zettel.html +++ b/Zettel.html @@ -195,16 +195,16 @@ accept</p> <span class="hljs-keyword">if</span>( sigaction(SIGCHLD, &handleSIGCHLD, <span class="hljs-literal">NULL</span>) != <span class="hljs-number">0</span> ) die(<span class="hljs-string">"Could not set sigaction"</span>); <span class="hljs-comment">//mask sigchld</span> - <span class="hljs-keyword">sigset_t</span> newMask_Itr; - <span class="hljs-keyword">sigset_t</span> oldMask_Itr; - sigemptyset(&newMask_Itr); - sigaddset(&newMask_Itr, SIGCHLD); - <span class="hljs-keyword">if</span> (sigprocmask(SIG_BLOCK, &newMask_Itr, &oldMask_Itr) == <span class="hljs-number">-1</span>) die(<span class="hljs-string">"sigprocmask"</span>); + <span class="hljs-keyword">sigset_t</span> newMask; + <span class="hljs-keyword">sigset_t</span> oldMask; + sigemptyset(&newMask); + sigaddset(&newMask, SIGCHLD); + <span class="hljs-keyword">if</span> (sigprocmask(SIG_BLOCK, &newMask, &oldMask) == <span class="hljs-number">-1</span>) die(<span class="hljs-string">"sigprocmask"</span>); <span class="hljs-comment">//do critical stuff</span> <span class="hljs-comment">//alte signal mask wiederherstellen</span> - <span class="hljs-keyword">if</span> (sigprocmask(SIG_SETMASK, &oldMask_Itr, <span class="hljs-literal">NULL</span>) == <span class="hljs-number">-1</span>) die(<span class="hljs-string">"sigprocmask"</span>); + <span class="hljs-keyword">if</span> (sigprocmask(SIG_SETMASK, &oldMask, <span class="hljs-literal">NULL</span>) == <span class="hljs-number">-1</span>) die(<span class="hljs-string">"sigprocmask"</span>); <span class="hljs-keyword">pid_t</span> pid = fork(); <span class="hljs-keyword">if</span>(pid < <span class="hljs-number">0</span>) die(<span class="hljs-string">"fork"</span>); @@ -215,9 +215,9 @@ accept</p> <span class="hljs-comment">//passives warten</span> pcount = <span class="hljs-number">1</span>; - <span class="hljs-keyword">if</span> (sigprocmask(SIG_BLOCK, &newMask_Itr, &oldMask_Itr) == <span class="hljs-number">-1</span>) die(<span class="hljs-string">"sigprocmask"</span>); + <span class="hljs-keyword">if</span> (sigprocmask(SIG_BLOCK, &newMask, &oldMask) == <span class="hljs-number">-1</span>) die(<span class="hljs-string">"sigprocmask"</span>); <span class="hljs-keyword">while</span> (pcount > <span class="hljs-number">0</span>) { - sigsuspend(&oldMask_Itr); + sigsuspend(&oldMask); } } diff --git a/signal.c b/signal.c index 1b57060..7ef89f9 100644 --- a/signal.c +++ b/signal.c @@ -16,16 +16,16 @@ int main() { if( sigaction(SIGCHLD, &handleSIGCHLD, NULL) != 0 ) die("Could not set sigaction"); //mask sigchld - sigset_t newMask_Itr; - sigset_t oldMask_Itr; - sigemptyset(&newMask_Itr); - sigaddset(&newMask_Itr, SIGCHLD); - if (sigprocmask(SIG_BLOCK, &newMask_Itr, &oldMask_Itr) == -1) die("sigprocmask"); + sigset_t newMask; + sigset_t oldMask; + sigemptyset(&newMask); + sigaddset(&newMask, SIGCHLD); + if (sigprocmask(SIG_BLOCK, &newMask, &oldMask) == -1) die("sigprocmask"); //do critical stuff //alte signal mask wiederherstellen - if (sigprocmask(SIG_SETMASK, &oldMask_Itr, NULL) == -1) die("sigprocmask"); + if (sigprocmask(SIG_SETMASK, &oldMask, NULL) == -1) die("sigprocmask"); pid_t pid = fork(); if(pid < 0) die("fork"); @@ -36,9 +36,9 @@ int main() { //passives warten pcount = 1; - if (sigprocmask(SIG_BLOCK, &newMask_Itr, &oldMask_Itr) == -1) die("sigprocmask"); + if (sigprocmask(SIG_BLOCK, &newMask, &oldMask) == -1) die("sigprocmask"); while (pcount > 0) { - sigsuspend(&oldMask_Itr); + sigsuspend(&oldMask); } } -- GitLab