亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? klogd.c

?? linux下記錄系統日志代碼以及記錄內核日志代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*    klogd.c - main program for Linux kernel log daemon.    Copyright (c) 1995  Dr. G.W. Wettstein <greg@wind.rmcc.com>    This file is part of the sysklogd package, a kernel and system log daemon.    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., 675 Mass Ave, Cambridge, MA 02139, USA.*//* * Steve Lord (lord@cray.com) 7th Nov 92 * * Modified to check for kernel info by Dr. G.W. Wettstein 02/17/93. * * Fri Mar 12 16:53:56 CST 1993:  Dr. Wettstein * 	Modified LogLine to use a newline as the line separator in *	the kernel message buffer. * *	Added debugging code to dump the contents of the kernel message *	buffer at the start of the LogLine function. * * Thu Jul 29 11:40:32 CDT 1993:  Dr. Wettstein *	Added syscalls to turn off logging of kernel messages to the *	console when klogd becomes responsible for kernel messages. * *	klogd now catches SIGTERM and SIGKILL signals.  Receipt of these *	signals cases the clean_up function to be called which shuts down *	kernel logging and re-enables logging of messages to the console. * * Sat Dec 11 11:54:22 CST 1993:  Dr. Wettstein *	Added fixes to allow compilation with no complaints with -Wall. * *      When the daemon catches a fatal signal (SIGTERM, SIGKILL) a  *	message is output to the logfile advising that the daemon is *	going to terminate. * * Thu Jan  6 11:54:10 CST 1994:  Dr. Wettstein *	Major re-write/re-organization of the code. * *	Klogd now assigns kernel messages to priority levels when output *	to the syslog facility is requested.  The priority level is *	determined by decoding the prioritization sequence which is *	tagged onto the start of the kernel messages. * *	Added the following program options: -f arg -c arg -s -o -d * *		The -f switch can be used to specify that output should *		be written to the named file. * *		The -c switch is used to specify the level of kernel *		messages which are to be directed to the console. * *		The -s switch causes the program to use the syscall *		interface to the kernel message facility.  This can be *		used to override the presence of the /proc filesystem. * *		The -o switch causes the program to operate in 'one-shot' *		mode.  A single call will be made to read the complete *		kernel buffer.  The contents of the buffer will be *		output and the program will terminate. * *		The -d switch causes 'debug' mode to be activated.  This *		will cause the daemon to generate LOTS of output to stderr. * *	The buffer decomposition function (LogLine) was re-written to *	squash a bug which was causing only partial kernel messages to *	be written to the syslog facility. * *	The signal handling code was modified to properly differentiate *	between the STOP and TSTP signals. * *	Added pid saving when the daemon detaches into the background.  Thank *	you to Juha Virtanen (jiivee@hut.fi) for providing this patch. * * Mon Feb  6 07:31:29 CST 1995:  Dr. Wettstein *	Significant re-organization of the signal handling code.  The *	signal handlers now only set variables.  Not earth shaking by any *	means but aesthetically pleasing to the code purists in the group. * *	Patch to make things more compliant with the file system standards. *	Thanks to Chris Metcalf for prompting this helpful change. * *	The routines responsible for reading the kernel log sources now *	initialize the buffers before reading.  I think that this will *	solve problems with non-terminated kernel messages producing *	output of the form:  new old old old * *	This may also help influence the occassional reports of klogd *	failing under significant load.  I think that the jury may still *	be out on this one though.  My thanks to Joerg Ahrens for initially *	tipping me off to the source of this problem.  Also thanks to *	Michael O'Reilly for tipping me off to the best fix for this problem. *	And last but not least Mark Lord for prompting me to try this as *	a means of attacking the stability problem. * *	Specifying a - as the arguement to the -f switch will cause output *	to be directed to stdout rather than a filename of -.  Thanks to *	Randy Appleton for a patch which prompted me to do this. * * Wed Feb 22 15:37:37 CST 1995:  Dr. Wettstein *	Added version information to logging startup messages. * * Wed Jul 26 18:57:23 MET DST 1995: Martin Schulze *	Added an commandline argument "-n" to avoid forking. This obsoletes *	the compiler define NO_FORK. It's more useful to have this as an *	argument as there are many binary versions and one doesn't need to *	recompile the daemon. * * Thu Aug 10 19:01:08 MET DST 1995: Martin Schulze *	Added my pidfile.[ch] to it to perform a better handling with pidfiles. *	Now both, syslogd and klogd, can only be started once. They check the *	pidfile. * * Fri Nov 17 15:05:43 CST 1995:  Dr. Wettstein *	Added support for kernel address translation.  This required moving *	some definitions and includes to the new klogd.h file.  Some small *	code cleanups and modifications. * * Mon Nov 20 10:03:39 MET 1995 *	Added -v option to print the version and exit. * * Thu Jan 18 11:19:46 CST 1996:  Dr. Wettstein *	Added suggested patches from beta-testers.  These address two *	two problems.  The first is segmentation faults which occur with *	the ELF libraries.  This was caused by passing a null pointer to *	the strcmp function. * *	Added a second patch to remove the pidfile as part of the *	termination cleanup sequence.  This minimizes the potential for *	conflicting pidfiles causing immediate termination at boot time. *	 * Wed Aug 21 09:13:03 CDT 1996:  Dr. Wettstein *	Added ability to reload static symbols and kernel module symbols *      under control of SIGUSR1 and SIGUSR2 signals. * *	Added -p switch to select 'paranoid' behavior with respect to the *	loading of kernel module symbols. * *	Informative line now printed whenever a state change occurs due *	to signal reception by the daemon. * *	Added the -i and -I command line switches to signal the currently *	executing daemon. * * Tue Nov 19 10:15:36 PST 1996: Leland Olds <olds@eskimo.com> *	Corrected vulnerability to buffer overruns by rewriting LogLine *	routine.  Obscenely long kernel messages will now be broken up *	into lines no longer than LOG_LINE_LENGTH. * *	The last version of LogLine was vulnerable to buffer overruns: *	- Kernel messages longer than LOG_LINE_LENGTH caused a buffer *	  overrun. *	- If a line was determined to be shorter than LOG_LINE_LENGTH, *	  the routine "ExpandKadds" could cause the line grow by *	  an unknown amount and overrun a buffer. *	I turned these routines into a little parsing state machine that *	should not have these problems. * * Sun Jun 15 16:23:29 MET DST 1997: Michael Alan Dorman *	Some more glibc patches made by <mdorman@debian.org>. * * Thu Aug 21 12:11:27 MET DST 1997: Martin Schulze <joey@infodrom.north.de> *	Fixed little mistake which prevented klogd from accepting a *	console log  * * Fri Jan  9 00:39:52 CET 1998: Martin Schulze <joey@infodrom.north.de> *	Changed the behaviour of klogd when receiving a terminate *	signal.  Now the program terminates immediately instead of *	completing the receipt of a kernel message, i.e the read() *	call.  The old behaveiour could result in klogd being *	recognized as being undead, because it'll only die after a *	message has been received. * * Fri Jan  9 11:03:48 CET 1998: Martin Schulze <joey@infodrom.north.de> *	Corrected some code that caused klogd to dump core when *	receiving messages containing '%', some of them exist in *	2.1.78.  Thanks to Chu-yeon Park <kokids@doit.ajou.ac.kr> for *	informing me. * * Fri Jan  9 23:38:19 CET 1998: Florian La Roche <florian@knorke.saar.de> *	Added -x switch to omit EIP translation and System.map evaluation. * * Sun Jan 25 20:47:46 CET 1998: Martin Schulze <joey@infodrom.north.de> *	As the bug covering the %'s introduced a problem with *	unevaluated priorities I've worked out a real fix that strips *	%'s to an even number which is harmless for printf. * * Sat Oct 10 20:01:48 CEST 1998: Martin Schulze <joey@infodrom.north.de> *	Added support for TESTING define which will turn klogd into *	stdio-mode used for debugging. * * Mon Apr 13 18:18:45 CEST 1998: Martin Schulze <joey@infodrom.north.de> *	Modified System.map read function to try all possible map *	files until a file with matching version is found.  Added support for *	Debian release. * * Mon Oct 12 13:01:27 MET DST 1998: Martin Schulze <joey@infodrom.north.de> *	Used unsigned long and strtoul() to resolve kernel oops symbols. * * Sun Jan  3 18:38:03 CET 1999: Martin Schulze <joey@infodrom.north.de> *	Shortened LOG_LINE_LENGTH in order to get long lines splitted *	up earlier and syslogd has a better chance concatenating them *	together again. * * Sat Aug 21 12:27:02 CEST 1999: Martin Schulze <joey@infodrom.north.de> *	Skip newline when reading in messages. * * Tue Sep 12 22:14:33 CEST 2000: Martin Schulze <joey@infodrom.ffis.de> *	Don't feed a buffer directly to a printf-type routine, use *	"%s" as format string instead.  Thanks to Jouko Pynn鰊en *	<jouko@solutions.fi> for pointing this out. * * Tue Sep 12 22:44:57 CEST 2000: Martin Schulze <joey@infodrom.ffis.de> *      Commandline option `-2': When symbols are expanded, print the *	line twice.  Once with addresses converted to symbols, once with the *	raw text.  Allows external programs such as ksymoops do their own *	processing on the original data.  Thanks to Keith Owens *	<kaos@ocs.com.au> for the patch. * * Mon Sep 18 09:32:27 CEST 2000: Martin Schulze <joey@infodrom.ffis.de> *	Added patch to fix priority decoding after moving kernel *	messgages into "%s".  Thanks to Solar Designer *	<solar@false.com> for the patch. * * Sun Mar 11 20:23:44 CET 2001: Martin Schulze <joey@infodrom.ffis.de> *	Stop LogLine() from being called with wrong argument when a *	former calculation failed already.  Thanks to Thomas Roessler *	<roessler@does-not-exist.org> for providing a patch. * *	Ignore zero bytes, no busy loop is entered anymore.  Several *	people have submitted patches: Troels Walsted Hansen *	<troels@thule.no>, Wolfgang Oertl <Wolfgang.Oertl@uibk.ac.at> *	and Thomas Roessler. *//* Includes. */#include <unistd.h>#include <signal.h>#include <errno.h>#include <sys/fcntl.h>#include <sys/stat.h>#if !defined(__GLIBC__)#include <linux/time.h>#endif /* __GLIBC__ */#include <stdarg.h>#include <paths.h>#include <stdlib.h>#include "klogd.h"#include "ksyms.h"#ifndef TESTING#include "pidfile.h"#endif#include "version.h"#define __LIBRARY__#include <linux/unistd.h>#if !defined(__GLIBC__)# define __NR_ksyslog __NR_syslog_syscall3(int,ksyslog,int, type, char *, buf, int, len);#else#include <sys/klog.h>#define ksyslog klogctl#endif#define LOG_BUFFER_SIZE 4096#define LOG_LINE_LENGTH 1000#ifndef TESTING#if defined(FSSTND)static char	*PidFile = _PATH_VARRUN "klogd.pid";#elsestatic char	*PidFile = "/etc/klogd.pid";#endif#endifstatic int	kmsg,		change_state = 0,		terminate = 0,		caught_TSTP = 0,		reload_symbols = 0,		console_log_level = -1;static int	use_syscall = 0,		one_shot = 0,		symbol_lookup = 1,		no_fork = 0;	/* don't fork - don't run in daemon mode */static char	*symfile = (char *) 0,		log_buffer[LOG_BUFFER_SIZE];static FILE *output_file = (FILE *) 0;static enum LOGSRC {none, proc, kernel} logsrc;int debugging = 0;int symbols_twice = 0;/* Function prototypes. */extern int ksyslog(int type, char *buf, int len);static void CloseLogSrc(void);extern void restart(int sig);extern void stop_logging(int sig);extern void stop_daemon(int sig);extern void reload_daemon(int sig);static void Terminate(void);static void SignalDaemon(int);static void ReloadSymbols(void);static void ChangeLogging(void);static enum LOGSRC GetKernelLogSrc(void);static void LogLine(char *ptr, int len);static void LogKernelLine(void);static void LogProcLine(void);extern int main(int argc, char *argv[]);static void CloseLogSrc(){	/* Turn on logging of messages to console. */  	ksyslog(7, NULL, 0);          /* Shutdown the log sources. */	switch ( logsrc )	{	    case kernel:		ksyslog(0, 0, 0);		Syslog(LOG_INFO, "Kernel logging (ksyslog) stopped.");		break;            case proc:		close(kmsg);		Syslog(LOG_INFO, "Kernel logging (proc) stopped.");		break;	    case none:		break;	}	if ( output_file != (FILE *) 0 )		fflush(output_file);	return;}void restart(sig)		int sig;{	signal(SIGCONT, restart);	change_state = 1;	caught_TSTP = 0;	return;}void stop_logging(sig)	int sig;	{	signal(SIGTSTP, stop_logging);	change_state = 1;	caught_TSTP = 1;	return;}void stop_daemon(sig)	int sig;{	Terminate();	return;}void reload_daemon(sig)     int sig;{	change_state = 1;	reload_symbols = 1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩成人一区二区| 亚洲一级二级三级在线免费观看| 91免费在线视频观看| av电影在线观看完整版一区二区| 国产伦精品一区二区三区免费迷 | 日韩精品一区二区在线观看| 在线不卡免费欧美| 日韩午夜激情av| 久久综合九色综合97_久久久| 久久看人人爽人人| 国产精品日产欧美久久久久| 成人免费一区二区三区视频| 亚洲国产精品久久久久秋霞影院 | 日韩1区2区3区| 国产美女视频91| 99久久国产综合精品女不卡| 在线视频欧美精品| 欧美一区二区精品| 26uuu欧美日本| 亚洲视频在线一区观看| 午夜天堂影视香蕉久久| 久国产精品韩国三级视频| 豆国产96在线|亚洲| 97超碰欧美中文字幕| 欧美老女人在线| 久久综合狠狠综合久久综合88| 欧美激情一区在线| 亚洲mv在线观看| 国产精品一区二区在线播放| 91免费看`日韩一区二区| 欧美伦理影视网| 国产精品天美传媒| 亚洲成av人片一区二区三区| 国产电影精品久久禁18| 欧美日韩国产大片| 综合在线观看色| 毛片av中文字幕一区二区| 成人av网址在线| 欧美一区二区视频网站| 国产精品久久久久一区| 免费精品99久久国产综合精品| www.99精品| 欧美电影免费观看高清完整版| 综合久久一区二区三区| 黑人精品欧美一区二区蜜桃| 在线视频亚洲一区| 国产精品久久看| 狠狠色狠狠色综合| 欧美高清视频一二三区| 亚洲六月丁香色婷婷综合久久| 九九国产精品视频| 最新不卡av在线| 另类专区欧美蜜桃臀第一页| 欧美中文字幕一区二区三区| 欧美国产精品中文字幕| 美腿丝袜亚洲三区| 欧美日韩亚洲另类| 亚洲精品久久久久久国产精华液| 国产美女精品人人做人人爽| 日韩免费电影一区| 天堂蜜桃一区二区三区| 欧美午夜免费电影| 亚洲色图制服诱惑| av一本久道久久综合久久鬼色| 久久久久久99精品| 狠狠色狠狠色合久久伊人| 日韩精品在线网站| 久久99久久99精品免视看婷婷| 欧美精品自拍偷拍动漫精品| 午夜精品一区在线观看| 欧美日韩一区二区电影| 一区二区三区中文字幕电影| 91黄色免费版| 亚洲丶国产丶欧美一区二区三区| 91亚洲国产成人精品一区二三| 亚洲欧洲性图库| va亚洲va日韩不卡在线观看| 国产精品不卡在线| 日韩免费高清视频| 激情欧美一区二区三区在线观看| 精品国产成人系列| 成人深夜在线观看| 亚洲三级小视频| 欧美日韩国产区一| 捆绑调教一区二区三区| 久久免费国产精品| av电影在线观看不卡| 亚洲精品国产精华液| 7777精品伊人久久久大香线蕉的 | 日韩欧美高清dvd碟片| 美女性感视频久久| 国产午夜精品福利| 91视视频在线观看入口直接观看www| 亚洲欧美另类在线| 欧美美女一区二区在线观看| 久久99国产精品成人| 国产精品美女久久久久久久久| 97久久精品人人澡人人爽| 天堂蜜桃91精品| 国产欧美综合色| 在线观看91精品国产入口| 欧美bbbbb| 亚洲视频在线一区观看| 日韩欧美视频一区| 成人在线视频首页| 日韩国产精品久久久久久亚洲| 久久欧美一区二区| 91欧美一区二区| 亚洲h动漫在线| 亚洲欧洲精品天堂一级 | 久久精品一区二区| 在线免费观看不卡av| 久久99精品久久久久久| 亚洲精品成a人| 国产三区在线成人av| 在线这里只有精品| 国产激情偷乱视频一区二区三区| 一区二区欧美精品| 中文字幕高清不卡| 日韩午夜激情视频| 欧美色欧美亚洲另类二区| 国产成人午夜视频| 日本亚洲视频在线| 亚洲自拍与偷拍| 国产精品麻豆欧美日韩ww| 欧美r级在线观看| 欧美日韩中文一区| 欧美在线免费观看视频| 风流少妇一区二区| 国内精品久久久久影院一蜜桃| 图片区小说区国产精品视频| 国产精品你懂的| 日本一区二区三区四区 | 日韩女优制服丝袜电影| 91国产免费观看| 成人va在线观看| 国产精品一区2区| 看片的网站亚洲| 五月婷婷另类国产| 性欧美疯狂xxxxbbbb| 亚洲成人在线免费| 亚洲成人免费观看| 亚洲电影你懂得| 亚洲第一av色| 日韩电影在线免费| 日韩激情在线观看| 日韩精品一级二级| 免费观看在线综合| 男人的天堂久久精品| 美女视频第一区二区三区免费观看网站| 亚洲激情图片qvod| 一区二区国产盗摄色噜噜| 亚洲男人的天堂在线aⅴ视频| 国产精品国模大尺度视频| 中文字幕高清不卡| 亚洲精品成人精品456| 亚洲国产日韩a在线播放性色| 亚洲国产精品一区二区www| 婷婷六月综合网| 麻豆一区二区99久久久久| 精品中文av资源站在线观看| 九一九一国产精品| 国产a精品视频| 99久久婷婷国产综合精品电影| www.欧美.com| 欧美亚洲一区三区| 精品精品欲导航| 国产日产精品1区| 亚洲天堂成人在线观看| 午夜精品在线看| 国产精品综合久久| 成人精品小蝌蚪| 欧洲亚洲国产日韩| 精品国产乱码久久久久久久| 国产日韩欧美综合在线| 亚洲色图19p| 另类小说图片综合网| 成人一区二区视频| 欧美日韩亚洲高清一区二区| 精品福利在线导航| 亚洲手机成人高清视频| 欧美aaaaaa午夜精品| 成人高清视频在线| 欧美日韩三级一区二区| 欧美成人一级视频| 一区二区三区**美女毛片| 麻豆国产精品777777在线| 成人性生交大片免费看视频在线 | 亚洲精品在线观看视频| 日韩伦理电影网| 国产精品一二三在| 欧美日韩www| 中文字幕一区二区三区在线播放 | 亚洲欧洲精品一区二区精品久久久| 亚洲一二三区不卡| 成人性生交大合| 日韩精品中文字幕一区二区三区| 亚洲图片你懂的| 成人精品视频一区二区三区| 91精品国产综合久久久久久久|