<commit_before>#include "ecore_private.h"
#include "Ecore.h"

#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <unistd.h>
#include <assert.h>

typedef void (*Signal_Handler)(int sig, siginfo_t *si, void *foo);

static void _ecore_signal_callback_set(int sig, Signal_Handler func); 
static void _ecore_signal_callback_ignore(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigchld(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigusr1(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigusr2(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sighup(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigquit(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigint(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigterm(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigpwr(int sig, siginfo_t *si, void *foo);

#ifdef SIGRTMIN
static void _ecore_signal_callback_sigrt(int sig, siginfo_t *si, void *foo);
#endif

static volatile sig_atomic_t sig_count = 0;
static volatile sig_atomic_t sigchld_count = 0;
static volatile sig_atomic_t sigusr1_count = 0;
static volatile sig_atomic_t sigusr2_count = 0;
static volatile sig_atomic_t sighup_count = 0;
static volatile sig_atomic_t sigquit_count = 0;
static volatile sig_atomic_t sigint_count = 0;
static volatile sig_atomic_t sigterm_count = 0;

static volatile siginfo_t sigchld_info = {0};
static volatile siginfo_t sigusr1_info = {0};
static volatile siginfo_t sigusr2_info = {0};
static volatile siginfo_t sighup_info = {0};
static volatile siginfo_t sigquit_info = {0};
static volatile siginfo_t sigint_info = {0};
static volatile siginfo_t sigterm_info = {0};

#ifdef SIGPWR
static volatile sig_atomic_t sigpwr_count = 0;
static volatile siginfo_t sigpwr_info = {0};
#endif

#ifdef SIGRTMIN
static volatile sig_atomic_t *sigrt_count = NULL;
static volatile siginfo_t *sigrt_info = NULL;
#endif

void
_ecore_signal_shutdown(void)
{
#ifdef SIGRTMIN
   int i, num = SIGRTMAX - SIGRTMIN;
#endif

   _ecore_signal_callback_set(SIGPIPE, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGALRM, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGCHLD, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGUSR1, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGUSR2, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGHUP,  (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGQUIT, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGINT,  (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGTERM, (Signal_Handler) SIG_DFL);
#ifdef SIGPWR
   _ecore_signal_callback_set(SIGPWR, (Signal_Handler) SIG_DFL);
#endif
   sigchld_count = 0;
   sigusr1_count = 0;
   sigusr2_count = 0;
   sighup_count = 0;
   sigquit_count = 0;
   sigint_count = 0;
   sigterm_count = 0;
   sigpwr_count = 0;
   sig_count = 0;

#ifdef SIGRTMIN
   for (i = 0; i < num; i++) {
      _ecore_signal_callback_set(SIGRTMIN + i, (Signal_Handler) SIG_DFL);
      sigrt_count[i] = 0;
   }

   if (sigrt_count) {
      free((sig_atomic_t *) sigrt_count);
      sigrt_count = NULL;
   }

   if (sigrt_info) {
      free((siginfo_t *) sigrt_info);
      sigrt_info = NULL;
   }
#endif
}

void
_ecore_signal_init(void)
{
#ifdef SIGRTMIN
   int i, num = SIGRTMAX - SIGRTMIN;<commit_msg>Fix some ifdef's for the SIGPWR signal.<commit_after>#include "ecore_private.h"
#include "Ecore.h"

#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <unistd.h>
#include <assert.h>

typedef void (*Signal_Handler)(int sig, siginfo_t *si, void *foo);

static void _ecore_signal_callback_set(int sig, Signal_Handler func); 
static void _ecore_signal_callback_ignore(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigchld(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigusr1(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigusr2(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sighup(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigquit(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigint(int sig, siginfo_t *si, void *foo);
static void _ecore_signal_callback_sigterm(int sig, siginfo_t *si, void *foo);
#ifdef SIGPWR
static void _ecore_signal_callback_sigpwr(int sig, siginfo_t *si, void *foo);
#endif

#ifdef SIGRTMIN
static void _ecore_signal_callback_sigrt(int sig, siginfo_t *si, void *foo);
#endif

static volatile sig_atomic_t sig_count = 0;
static volatile sig_atomic_t sigchld_count = 0;
static volatile sig_atomic_t sigusr1_count = 0;
static volatile sig_atomic_t sigusr2_count = 0;
static volatile sig_atomic_t sighup_count = 0;
static volatile sig_atomic_t sigquit_count = 0;
static volatile sig_atomic_t sigint_count = 0;
static volatile sig_atomic_t sigterm_count = 0;

static volatile siginfo_t sigchld_info = {0};
static volatile siginfo_t sigusr1_info = {0};
static volatile siginfo_t sigusr2_info = {0};
static volatile siginfo_t sighup_info = {0};
static volatile siginfo_t sigquit_info = {0};
static volatile siginfo_t sigint_info = {0};
static volatile siginfo_t sigterm_info = {0};

#ifdef SIGPWR
static volatile sig_atomic_t sigpwr_count = 0;
static volatile siginfo_t sigpwr_info = {0};
#endif

#ifdef SIGRTMIN
static volatile sig_atomic_t *sigrt_count = NULL;
static volatile siginfo_t *sigrt_info = NULL;
#endif

void
_ecore_signal_shutdown(void)
{
#ifdef SIGRTMIN
   int i, num = SIGRTMAX - SIGRTMIN;
#endif

   _ecore_signal_callback_set(SIGPIPE, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGALRM, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGCHLD, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGUSR1, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGUSR2, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGHUP,  (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGQUIT, (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGINT,  (Signal_Handler) SIG_DFL);
   _ecore_signal_callback_set(SIGTERM, (Signal_Handler) SIG_DFL);
#ifdef SIGPWR
   _ecore_signal_callback_set(SIGPWR, (Signal_Handler) SIG_DFL);
   sigpwr_count = 0;
#endif
   sigchld_count = 0;
   sigusr1_count = 0;
   sigusr2_count = 0;
   sighup_count = 0;
   sigquit_count = 0;
   sigint_count = 0;
   sigterm_count = 0;
   sig_count = 0;

#ifdef SIGRTMIN
   for (i = 0; i < num; i++) {
      _ecore_signal_callback_set(SIGRTMIN + i, (Signal_Handler) SIG_DFL);
      sigrt_count[i] = 0;
   }

   if (sigrt_count) {
      free((sig_atomic_t *) sigrt_count);
      sigrt_count = NULL;
   }

   if (sigrt_info) {
      free((siginfo_t *) sigrt_info);
      sigrt_info = NULL;
   }
#endif
}

void
_ecore_signal_init(void)
{
#ifdef SIGRTMIN
   int i, num = SIGRTMAX - SIGRTMIN;
{'fraction_non_alphanumeric': 0.09350351355227306, 'fraction_numerical': 0.010899182561307902, 'mean_word_length': 5.870935960591133, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6411084', 'n_tokens_mistral': 2693, 'n_tokens_neox': 2632, 'n_words': 626}