📄 util.h
字号:
/* voifax general purpose functions library * Copyright (C) 2004 Simone Freddio & Andrea Emanuelli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#ifndef UTIL_H#define UTIL_H#define WATCHDOG_NUMBER 10#define WATCHDOG_MAXVALUE 32768/* Rimuove i caratteri 'a capo' e 'linea nuova' da una stringa */int remove_special_chars(char *string);int memory_search(char *array, int array_size, char *target, int target_size);typedef struct { int counter; char name[50]; int valid;} t_watchdog_item;typedef struct { t_watchdog_item list[WATCHDOG_NUMBER];} t_watchdog_list;int wd_init(void);/* Inizializza la memoria shared per la lista di watchdog e il processo child adibito al controllo dei watchdog. Valori di ritorno: true = inizializzazione ok false = errore nell' allocazione di memoria*/int wd_create(int initial_value, char *name);/* Crea un nuovo watchdog con un valore iniziale di initial_value secondi ed identificato da name. (i) initial_value valore iniziale in secondi del watchdog (i) name identificativo watchdog Valori di ritorno: -1 = errore grave n = identificativo watchdog*/int wd_refresh(int wd_handler);/* Aumenta il valore interno del watchdog di un secondo. (i) wd_handler identificativo watchdog Valori di ritorno: true = watchdog aggiornato false = errore*/int wd_destroy(int wd_handler);/* Distrugge un watchdog. (i) wd_handler identificativo watchdog Valori di ritorno: true = watchdog aggiornato false = errore*/void wd_close(void);/* Disattiva tutti i watchdog e rimuove la shared memory della libreria.*/#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -