aboutsummaryrefslogtreecommitdiffstats
path: root/cputemp2maxfreq.c
diff options
context:
space:
mode:
authorPA4WDH2024-09-12 13:58:56 +0200
committerPA4WDH2024-09-12 13:58:56 +0200
commitbcdcc64c373b5db66b8e07ab6529ede2d983e036 (patch)
treed5fd68c7059b46b643abc23dfa3270086ad1afd4 /cputemp2maxfreq.c
parentAdd cpufreq_get_long_int as generic function to get cpufreq data (diff)
downloadcputemp2maxfreq-bcdcc64c373b5db66b8e07ab6529ede2d983e036.tar.gz
cputemp2maxfreq-bcdcc64c373b5db66b8e07ab6529ede2d983e036.tar.bz2
cputemp2maxfreq-bcdcc64c373b5db66b8e07ab6529ede2d983e036.zip
Improve signal handling
Diffstat (limited to 'cputemp2maxfreq.c')
-rw-r--r--cputemp2maxfreq.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/cputemp2maxfreq.c b/cputemp2maxfreq.c
index d146158..212fb39 100644
--- a/cputemp2maxfreq.c
+++ b/cputemp2maxfreq.c
@@ -92,6 +92,7 @@ int main(int argc,char **argv)
struct s_sensor sensor;
char *transition_latency_remark;
char sensor_string[20];
+ struct sigaction sigact={0};
argparse(argc,argv);
config.logger("%s version %s, buildtime %s %s",config.name,version(),__DATE__,__TIME__);
@@ -263,9 +264,14 @@ int main(int argc,char **argv)
if (config.csvlog[0]!=0) csvlog_init();
// Set signal handlers
- signal(SIGTERM,signal_handler);
- signal(SIGINT,signal_handler);
- signal(SIGQUIT,signal_handler);
+ sigact.sa_handler=&signal_handler;
+ sigemptyset(&sigact.sa_mask);
+ sigaddset(&sigact.sa_mask,SIGTERM);
+ sigaddset(&sigact.sa_mask,SIGINT);
+ sigaddset(&sigact.sa_mask,SIGQUIT);
+ sigaction(SIGTERM,&sigact,NULL);
+ sigaction(SIGINT,&sigact,NULL);
+ sigaction(SIGQUIT,&sigact,NULL);
while(1)
{