亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产精品99久久久久久久女警| 欧洲人成人精品| 色综合久久久久综合| 在线播放国产精品二区一二区四区| 欧美极品少妇xxxxⅹ高跟鞋| 午夜成人在线视频| 91免费观看在线| 国产欧美一区二区在线观看| 久久精品国产999大香线蕉| 99久久久久久| 中文字幕欧美国产| 久久av老司机精品网站导航| 欧美日韩中字一区| 亚洲乱码中文字幕| 成人黄色网址在线观看| 国产欧美日韩卡一| 精品一区二区影视| 日韩欧美国产精品一区| 亚洲不卡av一区二区三区| a级高清视频欧美日韩| 日本一区二区在线不卡| 懂色av中文字幕一区二区三区| 欧美成人三级电影在线| 日韩av在线免费观看不卡| 欧美日韩免费电影| 亚洲午夜在线视频| 欧美亚洲日本一区| 亚洲一区二区五区| 欧美在线小视频| 亚洲国产你懂的| 欧美羞羞免费网站| 日韩黄色免费电影| 欧美一区二区不卡视频| 人人精品人人爱| 久久综合九色综合97_久久久| 激情国产一区二区| 国产亚洲精品免费| 95精品视频在线| 亚洲激情六月丁香| 欧美日韩亚洲高清一区二区| 午夜精品国产更新| 精品欧美乱码久久久久久| 国产精品一级二级三级| 欧美高清在线视频| 91精品91久久久中77777| 一区二区三区丝袜| 9191精品国产综合久久久久久| 奇米在线7777在线精品| 久久人人爽爽爽人久久久| 风间由美一区二区三区在线观看| 国产精品久久福利| 欧美日韩一级二级三级| 美国十次了思思久久精品导航| 免费av成人在线| 精品精品欲导航| 国产成人免费xxxxxxxx| 亚洲人123区| 日韩午夜精品电影| 成人av电影免费观看| 亚洲一二三四在线| 日韩欧美成人激情| 99精品偷自拍| 久久69国产一区二区蜜臀| 亚洲欧洲日韩综合一区二区| 欧美群妇大交群的观看方式| 欧美怡红院视频| 精品亚洲国产成人av制服丝袜| 国产精品久久久久久久第一福利| 精品婷婷伊人一区三区三| 国产一区二区三区免费| 亚洲女同一区二区| 精品国产99国产精品| 色菇凉天天综合网| 国产精品一区二区无线| 视频在线在亚洲| 亚洲三级在线播放| 久久综合一区二区| 在线观看91精品国产麻豆| 不卡的av电影在线观看| 免费成人性网站| 亚洲成av人片在线观看| 亚洲欧洲国产日韩| 国产香蕉久久精品综合网| 欧美日韩国产一二三| 99re这里都是精品| 国产高清精品网站| 免费在线观看精品| 五月综合激情网| 亚洲视频一区二区在线观看| www久久久久| 精品噜噜噜噜久久久久久久久试看 | 国产成人免费视频网站高清观看视频 | 久久久久久久久久美女| 欧美日韩在线直播| 欧洲精品视频在线观看| 成人少妇影院yyyy| 国产精品一区二区三区乱码 | 懂色中文一区二区在线播放| 麻豆91免费观看| 日韩精品免费专区| 亚洲第一主播视频| 亚洲一区视频在线| 亚洲激情图片一区| 一区二区三区四区五区视频在线观看 | 九九精品视频在线看| 午夜精品久久久久影视| 一区二区国产视频| 亚洲免费观看高清完整版在线观看熊| 国产午夜亚洲精品午夜鲁丝片 | 中文字幕字幕中文在线中不卡视频| 精品国产乱码久久久久久蜜臀 | 日本aⅴ免费视频一区二区三区| 亚洲电影中文字幕在线观看| 亚洲视频免费观看| 中文字幕日本不卡| 亚洲欧美日韩国产综合| 中文字幕中文字幕一区二区| 国产精品欧美经典| 国产精品伦一区| 亚洲天堂成人网| 一区二区三区在线观看国产| 精品一区二区三区在线观看| 久久成人av少妇免费| 国产在线看一区| 国产高清亚洲一区| 99久久免费国产| 欧美系列一区二区| 91精品在线麻豆| 精品国产网站在线观看| 久久嫩草精品久久久精品| 国产亚洲精品bt天堂精选| 国产精品高清亚洲| 一区二区三区免费网站| 亚洲成av人影院在线观看网| 蜜臀av性久久久久蜜臀av麻豆| 久久成人免费电影| 成人av电影免费在线播放| 欧美在线观看一二区| 欧美日韩精品三区| www国产精品av| 亚洲欧美日韩精品久久久久| 日韩av一区二区三区| 国产激情视频一区二区三区欧美| 97久久精品人人做人人爽| 欧美日韩一区二区不卡| 精品成人一区二区| 1024亚洲合集| 奇米777欧美一区二区| 成人一区二区三区| 欧美日韩激情在线| 久久久久综合网| 一区二区三区久久久| 久久成人18免费观看| 色综合色综合色综合 | 色婷婷久久久亚洲一区二区三区| 欧美三级中文字幕| 久久综合九色综合97婷婷女人| 一区二区三区波多野结衣在线观看| 天堂午夜影视日韩欧美一区二区| 国产在线国偷精品产拍免费yy| 91丨九色丨黑人外教| 一区二区在线观看视频在线观看| 另类人妖一区二区av| 91麻豆免费看| 久久久久亚洲蜜桃| 天天做天天摸天天爽国产一区| 国产福利精品一区二区| 欧美精品久久天天躁| 亚洲人成7777| 成人性色生活片| 91精品国产aⅴ一区二区| 国产精品久久久久久久浪潮网站| 麻豆精品在线播放| 欧美日韩成人一区| 有坂深雪av一区二区精品| 国产成人啪免费观看软件| 91.com视频| 亚洲一区二区三区四区不卡| 丁香六月久久综合狠狠色| 精品久久久久一区| 免费不卡在线观看| 欧美日韩一区二区欧美激情| 中文字幕一区二区三区在线观看 | 色婷婷av一区二区三区软件| www国产精品av| 久久不见久久见免费视频7| 欧美日韩成人一区二区| 亚洲国产一区二区a毛片| 色综合久久中文字幕综合网| 国产女人18毛片水真多成人如厕 | 亚洲v中文字幕| 欧美亚洲动漫精品| 亚洲精品成人少妇| 91视频精品在这里| 亚洲特黄一级片| 成人18视频日本| 国产精品国产三级国产三级人妇 | 奇米色一区二区| 日韩亚洲国产中文字幕欧美| 无码av免费一区二区三区试看|