<commit_before>/**
   @file dsme_wd.c

   This file implements hardware watchdog kicker thread.
   The kicking is done in another, low-priority thread.
   <p>
   Copyright (C) 2004-2009 Nokia Corporation.

   @author <NAME> <<EMAIL>>
   @author <NAME> <<EMAIL>>

   This file is part of Dsme.

   Dsme is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License
   version 2.1 as published by the Free Software Foundation.

   Dsme is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with Dsme.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "dsme_wd.h"
#include "dsme/logging.h"

#include <cal.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>

#include <pthread.h>
#include <sched.h>
#include <semaphore.h>
#include <linux/types.h>
#include <linux/watchdog.h>

#define DSME_WD_PRIORITY  (-20)
#define DSME_WD_SCHEDULER SCHED_RR

typedef struct wd_t {
    const char* file;   /* pathname of the watchdog device */
    int         period; /* watchdog timeout; 0 for keeping the default */
} wd_t;

static const wd_t wd[] = {
    { "/dev/twl4030_wdt", 30 }, /* set the twl wd timeout to 30 seconds */
    { "/dev/watchdog",    14 }  /* set the omap wd timeout to 14 seconds */
};
#define WD_COUNT (sizeof(wd) / sizeof(wd[0]))
static int wd_fd[WD_COUNT];

static bool  wd_enabled = true;
static sem_t dsme_wd_sem;
<commit_msg>disable hwwd's until glib supports monotonic timeouts<commit_after>/**
   @file dsme_wd.c

   This file implements hardware watchdog kicker thread.
   The kicking is done in another, low-priority thread.
   <p>
   Copyright (C) 2004-2009 Nokia Corporation.

   @author <NAME> <<EMAIL>>
   @author <NAME> <<EMAIL>>

   This file is part of Dsme.

   Dsme is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License
   version 2.1 as published by the Free Software Foundation.

   Dsme is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with Dsme.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "dsme_wd.h"
#include "dsme/logging.h"

#include <cal.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>

#include <pthread.h>
#include <sched.h>
#include <semaphore.h>
#include <linux/types.h>
#include <linux/watchdog.h>

#define DSME_WD_PRIORITY  (-20)
#define DSME_WD_SCHEDULER SCHED_RR

typedef struct wd_t {
    const char* file;   /* pathname of the watchdog device */
    int         period; /* watchdog timeout; 0 for keeping the default */
} wd_t;

static const wd_t wd[] = {
    { "/dev/twl4030_wdt", 30 }, /* set the twl wd timeout to 30 seconds */
    { "/dev/watchdog",    14 }  /* set the omap wd timeout to 14 seconds */
};
#if 0 /* disable hardware watchdogs until glib supports monotonic timeouts */
#define WD_COUNT (sizeof(wd) / sizeof(wd[0]))
#else
#define WD_COUNT 0
#endif
static int wd_fd[WD_COUNT];

static bool  wd_enabled = true;
static sem_t dsme_wd_sem;

{'fraction_non_alphanumeric': 0.10914227015921932, 'fraction_numerical': 0.01386748844375963, 'mean_word_length': 3.5823529411764707, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6297744', 'n_tokens_mistral': 1379, 'n_tokens_neox': 1304, 'n_words': 479}