⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linux_mond.c

📁 Linux内核监控工具。 Linux内核监控工具。 Linux内核监控工具。
💻 C
字号:
/***************************************************************************                          linux_mond.c  -  description                             -------------------    begin                : Thu Sep 27 08:08:03 EET 2001    copyright            : (C) 2001-2002 by Petri Turunen    email                : petri.turunen@pete.fi.eu.org ***************************************************************************//*************************************************************************** *                                                                         * *   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.                                   * *                                                                         * ***************************************************************************/#ifdef HAVE_CONFIG_H#include <config.h>#endif#include "linux_mond.h"#include <stdlib.h> //for malloc and free#include <ctype.h> //for isalpha//Global variablesunsigned char CRYPTIV[9];char CRYPTKEY[17];struct conf_t server_config; //defined in linux_mond.cchar PIDDIR[21]; int PORT=8881;char *TIEDOSTO="/etc/linux_mond.conf";struct msg_t ipmsg;unsigned char read_buf[1025];int silent=0;int to_postgresql=0;int tosyslog=1;void sig_child(int signo);int get_strings(char *buff);int client(int inbound_connection, char *ip);void sig_child(int signo){ pid_t pid; int   stat; while( (pid = waitpid(-1, &stat, WNOHANG)) > 0) {  if(silent!=1)  {   openlog("linux_mond",LOG_PID,LOG_LOCAL7);   syslog(LOG_INFO, "child %d terminated.", pid);   closelog();  } }	   return;}void sighup(){ slog(2,"Received SIGHUP.\n");}void sigterm(){ slog(2,"Received SIGTERM. Shutting down.\n"); exit(0);}void sig_alarm(){ return;}int server(){	 // Variables for the server component of the application.	 int file_descriptor;	// File descriptor that represents the server socket.	 struct	sockaddr_in	server_address;	// Really only contains the port we want to listen on.	 int	inbound_connection;	// File descriptor that represents the socket of the inbound connection.	 struct	sockaddr_in	inbound_address;	// Address of the inbound connection.	 int	inbound_address_size;	// Size of the structure for the inbound connection.	 pid_t childpit;	 int len;	 const int on = 1;	 struct timeval tv;         tv.tv_sec = 5;         tv.tv_usec = 0; 	 // Code for the server component begins here.	// Allocate a TCP socket for the internet	file_descriptor=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);	 	if (file_descriptor<0)	// Check to see if there was a failure in allocation.	{	 slog(2,"linux_mond.c: socket: %s",strerror(errno));	 return -1;	}	 //sallitaan osoitteen uudelleen k鋣tt

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -