📄 sys_status_main.c
字号:
/* Virtual terminal interface shell. * Copyright (C) 2000 Kunihiro Ishiguro * * This file is part of GNU Zebra. * * GNU Zebra 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, or (at your option) any * later version. * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */#include <zebra.h>#include <sys/un.h>#include <setjmp.h>#include <sys/wait.h>#include <pwd.h>//huxuekun#include <unistd.h>#include <termios.h>#include <readline/readline.h>#include <readline/history.h>#include "thread.h"#include "version.h"#include "getopt.h"#include "command.h"#include "memory.h"//#include "log.h"#include "prefix.h"#include "sys_status.h"#include "vtysh/vtysh_user.h" //#include "sys_ssl.h"extern int Debug;int verify_client=0;struct thread_master *master;/* SIGTSTP handler. This function care user's ^Z input. */voidrestart_status_connect_all (int sig){ syslog (LOG_INFO, "trap sigusr1"); status_connect_close (); status_connect_all ();}/** * @brief: SIGUSR1 handler. * @description: show error messages , then exit */intmain (int argc, char **argv, char **env){ int opt ; static char optstr[]="dv"; struct thread thread; while ((opt = getopt (argc, argv, optstr))!=-1) { switch (opt) { case 0: break; case 'd': Debug = 1; break; case 'v': verify_client = 1; break; default: break; } } master = thread_master_create (); if(!Debug) if (fork ()) exit(0); ssl_init(); status_serv_inet(); status_connect_all (); //jhb add 2004-04-08, we must after vtysh_connect_all //because we transfer hostname to syslogd #ifdef WATCH_DOG//huxuekun: 2003.2.10 init_watch_dog(); thread_add_timer(master, watch_dog, NULL, WATCHDOG_TIMER);#endif while (thread_fetch (master, &thread)) thread_call (&thread); /* Not reached... */#ifdef WATCH_DOG stop_watch_dog();#endif exit (0); }#ifdef WATCH_DOG/* huxuekun: 2003.2.10 * */static void init_watch_dog(void){ printf("in init_wathc_dog\n"); iopl(3); outb(WATCHDOG_TIMER_INTVAL, WATCHDOG_TIMER_PORT); inb(WATCHDOG_TIMER_START); //start watch_dog counter}int watch_dog(struct thread *t){ inb(WATCHDOG_TIMER_STOP); //stop watch_dog counter inb(WATCHDOG_TIMER_START); //restart watch_dog counter// syslog(LOG_INFO, "watch_dog works!"); //for test thread_add_timer(master, watch_dog, NULL, WATCHDOG_TIMER);}static void stop_watch_dog(void){ inb(WATCHDOG_TIMER_STOP); //stop watch_dog counter} #endif // end WATCH_DO
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -