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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? serial.c

?? 在LINUX下實(shí)現(xiàn)HA的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
	}		if(strncmp(buf, MSG_END, endlen) == 0){				len += strnlen(buf, MAXLINE) + 2;		if(len >= MAXMSG){			PILCallLog(LOG, PIL_CRIT, "serial_read:msgstring exceeds MAXMSG after adding MSG_END");			ha_free(msgstring);			return(NULL);		}		tmplen = strnlen(buf, MAXLINE);				memcpy(p, buf, tmplen);		p += tmplen;		strcat(p, "\n");		p++;		p[0] = 0;	}		if (buf[0] == EOS ) {		ha_free(msgstring);		return NULL;	}else{		thissp->consecutive_errors=0;	}			*lenp = len;		/*	PILCallLog(LOG, PIL_INFO, "final msgstring=%s", msgstring);	*/		return(msgstring);	}/* This function does all the writing to our tty ports */static intserial_write(struct hb_media* mp, void *p, int len){	int			string_startlen = sizeof(MSG_START)-1;	int			netstring_startlen = sizeof(MSG_START_NETSTRING) - 1;	char			*str;	int			str_new = 0;	int			wrc;	int			size;	int			ourtty;	static gboolean		warnyet=FALSE;	static longclock_t	warninterval;	static longclock_t	lastwarn;		if (strncmp(p, MSG_START, string_startlen) == 0) {		str = p;		size = strlen(str);		if(size > len){			return(HA_FAIL);		}	} else if(strncmp(p, MSG_START_NETSTRING, netstring_startlen) == 0) {				struct ha_msg * msg;				msg = wirefmt2msg(p, len);		if(!msg){			ha_log(PIL_WARN, "serial_write(): wirefmt2msg() failed");			return(HA_FAIL);		}				add_msg_auth(msg);		str = msg2string(msg);				str_new = 1;		size = strlen(str);		ha_msg_del(msg);			} else{		return(HA_FAIL);	}	TTYASSERT(mp);		if (!warnyet) {		warninterval = msto_longclock(RTS_WARNTIME*1000L);	}	ourmedia = mp;	/* Only used for the "localdie" function */	OurImports->RegisterCleanup(serial_localdie);	ourtty = ((struct serial_private*)(mp->pd))->ttyfd;	if (DEBUGPKT) {		PILCallLog(LOG, PIL_DEBUG, "Sending pkt to %s [%d bytes]"		,	mp->name, size);	}	if (DEBUGPKTCONT) {		PILCallLog(LOG, PIL_DEBUG, "%s", str);	}	setmsalarm(500);	wrc = write(ourtty, str, size);	cancelmstimer();	if (DEBUGPKTCONT) {		PILCallLog(LOG, PIL_DEBUG, "serial write returned %d", wrc);	}		if (wrc < 0 || wrc != size) {		if (DEBUGPKTCONT && wrc < 0) {			PILCallLog(LOG, PIL_DEBUG, "serial write errno was %d", errno);		}		if (wrc > 0 || (wrc < 0 && errno == EINTR)) {			longclock_t	now = time_longclock();			tcflush(ourtty, TCIOFLUSH);			if (!warnyet			||	cmp_longclock(sub_longclock(now, lastwarn)			,		warninterval) >= 0) {				lastwarn = now;				warnyet = TRUE;				PILCallLog(LOG, PIL_WARN				,	"TTY write timeout on [%s]"				" (no connection or bad cable"				"? [see documentation])"				,	mp->name);			}		}else{			PILCallLog(LOG, PIL_CRIT, "TTY write failure on [%s]: %s"			    ,	mp->name, strerror(errno));		}	}		if(str_new){		ha_free(str);		str = NULL;	}	return(HA_OK);}/* Gets function for our tty */static char *ttygets(char * inbuf, int length, struct serial_private *tty){	char *	cp;	char *	end = inbuf + length;	int	rc;	int	fd = tty->ttyfd;	for(cp=inbuf; cp < end; ++cp) {		int saverr;		errno = 0;		/* One read per char -- yecch  (but it's easy) */		rc = read(fd, cp, 1);		saverr = errno;		OurImports->CheckForEvents();		errno = saverr;		if (rc != 1) {			if (rc == 0 || errno == EINTR) {				PILCallLog(LOG, PIL_WARN, "EOF in ttygets [%s]: %s [%d]"				,	tty->ttyname, strerror(errno), rc);				++tty->consecutive_errors;				tcsetpgrp(fd, getsid(getpid()));				if ((tty->consecutive_errors % 10) == 0) {					PILCallLog(LOG, PIL_WARN					,	"10 consecutive EOF"					" errors from serial port %s"					,	tty->ttyname);					PILCallLog(LOG, PIL_INFO					,	"%s pgrp: %d", tty->ttyname					,	tcgetpgrp(fd));					sleep(10);				}				return(NULL);			}			errno = 0;			continue;		}else{			tty->consecutive_errors = 0;		}					if (*cp == '\r' || *cp == '\n') {			break;		}	}	*cp = '\0';	return(inbuf);}/* * $Log: serial.c,v $ * Revision 1.29.2.4  2004/05/12 02:04:38  alan * Changed a message back from an error into a warning. * * Revision 1.29.2.3  2004/05/12 01:46:26  alan * Changed tty write timeout back to warning. * * Revision 1.29.2.2  2004/05/12 00:10:14  alan * Changed all the HBcomm plugins to use PILCallLog() for logging * instead of calling the function pointer directly. * Also, in the process fixed several mismatches between arguments * and format strings, and a couple of format string vulnerabilities. * * Revision 1.34  2004/05/11 22:04:35  alan * Changed all the HBcomm plugins to use PILCallLog() for logging instead of calling * the function pointer directly. * Also, in the process fixed several mismatches between arguments and format strings, and * a couple of format string vulnerabilities. * * Revision 1.33  2004/04/29 16:24:34  msoffen * fixed comment in Log * * Revision 1.32  2004/04/29 16:23:16  msoffen * Changed // comments to / * * / comments. * * Revision 1.31  2004/03/03 05:31:51  alan * Put in Gochun Shi's new netstrings on-the-wire data format code. * this allows sending binary data, among many other things! * * Revision 1.30  2004/02/17 22:11:59  lars * Pet peeve removal: _Id et al now gone, replaced with consistent Id header. * * Revision 1.29  2004/01/21 11:34:15  horms * - Replaced numerous malloc + strcpy/strncpy invocations with strdup *   * This usually makes the code a bit cleaner *   * Also is easier not to make code with potential buffer over-runs * - Added STRDUP to pils modules * - Removed some spurious MALLOC and FREE redefinitions *   _that could never be used_ * - Make sure the return value of strdup is honoured in error conditions * * Revision 1.28  2004/01/20 16:23:11  alan * Fixed an oversight which turns out to have been luckily-benign in practice. * * Revision 1.27  2003/05/21 21:56:50  alan * Minor tweak to the last tty fix from Carson Gaspar. * * Revision 1.26  2003/05/21 21:55:07  alan * Put in a bug fix from Carson Gaspar <carson@taltos.org> to open our * serial ttys with O_NOCTTY to avoid having them become our controlling * ttys. * * Revision 1.25  2003/04/15 23:09:52  alan * Continuing saga of the semi-major heartbeat process restructure. * * Revision 1.24  2003/02/07 08:37:18  horms * Removed inclusion of portability.h from .h files * so that it does not need to be installed. * * Revision 1.23  2003/02/05 09:06:34  horms * Lars put a lot of work into making sure that portability.h * is included first, everywhere. However this broke a few * things when building against heartbeat headers that * have been installed (usually somewhere under /usr/include or * /usr/local/include). * * This patch should resolve this problem without undoing all of * Lars's hard work. * * As an asside: I think that portability.h is a virus that has * infected all of heartbeat's code and now must also infect all * code that builds against heartbeat. I wish that it didn't need * to be included all over the place. Especially in headers to * be installed on the system. However, I respect Lars's opinion * that this is the best way to resolve some weird build problems * in the current tree. * * Revision 1.22  2003/01/31 10:02:09  lars * Various small code cleanups: * - Lots of "signed vs unsigned" comparison fixes * - time_t globally replaced with TIME_T * - All seqnos moved to "seqno_t", which defaults to unsigned long * - DIMOF() definition centralized to portability.h and typecast to int * - EOS define moved to portability.h * - dropped inclusion of signal.h from stonith.h, so that sigignore is *   properly defined * * Revision 1.21  2002/10/22 17:41:58  alan * Added some documentation about deadtime, etc. * Switched one of the sets of FIFOs to IPC channels. * Added msg_from_IPC to ha_msg.c make that easier. * Fixed a few compile errors that were introduced earlier. * Moved hb_api_core.h out of the global include directory, * and back into a local directory.  I also make sure it doesn't get * installed.  This *shouldn't* cause problems. * Added a ipc_waitin() function to the IPC code to allow you to wait for * input synchronously if you really want to. * Changes the STONITH test to default to enabled. * * Revision 1.20  2002/10/18 07:16:10  alan * Put in Horms big patch plus a patch for the apcmastersnmp code where * a macro named MIN returned the MAX instead.  The code actually wanted * the MAX, so when the #define for MIN was surrounded by a #ifndef, then * it no longer worked...  This fix courtesy of Martin Bene. * There was also a missing #include needed on older Linux systems. * * Revision 1.19  2002/06/16 06:11:26  alan * Put in a couple of changes to the PILS interfaces *  - exported license information (name, URL) *  - imported malloc/free * * Revision 1.18  2002/04/24 12:11:40  alan * updated the copyright date. * * Revision 1.17  2002/04/13 22:35:08  alan * Changed ha_msg_add_nv to take an end pointer to make it safer. * Added a length parameter to string2msg so it would be safer. * Changed the various networking plugins to use the new string2msg(). * * Revision 1.16  2002/04/09 21:53:27  alan * A large number of minor cleanups related to exit, cleanup, and process * management.  It all looks reasonably good. * One or two slightly larger changes (but still not major changes) in * these same areas. * Basically, now we wait for everything to be done before we exit, etc. * * Revision 1.15  2002/04/09 12:45:36  alan * Put in changes to the bcast, mcast and serial code such that * interrupted system calls in reads are ignored. * * Revision 1.14  2002/04/04 09:21:59  lars * Make the serial code also report a bad cable as the likely cause of the error. * (Most common mistake on the lists so far) * * Revision 1.13  2002/02/10 22:50:39  alan * Added a bit to the serial code to limit the number of messages which * come out (and the workload on the machine) when the serial port goes * nuts. * * Revision 1.12  2001/10/25 14:34:17  alan * Changed the serial code to send a BREAK when one side first starts up their * conversation. * Configured the receiving code to flush I/O buffers when they receive a break * Configured the code to ignore SIGINTs (except for their buffer flush effect) * Configured the code to use SIGQUIT instead of SIGINT when communicating that * the shutdown resource giveup is complete. * * This is all to fix a bug which occurs because of leftover out-of-date messages * in the serial buffering system. * * Revision 1.11  2001/10/04 21:14:30  alan * Patch from Reza Arbab <arbab@austin.ibm.com> to make it compile correctly * on AIX. * * Revision 1.10  2001/10/03 05:22:19  alan * Added code to save configuration parameters so we can pass them to the various communication plugins... * * Revision 1.9  2001/10/02 22:31:33  alan * Fixed really dumb error in the serial code.  I called an init function *after* * returning from the function ;-) * * Revision 1.8  2001/10/02 21:57:19  alan * Added debugging to the tty code. * * Revision 1.7  2001/10/02 20:15:41  alan * Debug code, etc. from Matt Soffen... * * Revision 1.6  2001/10/02 05:12:19  alan * Various portability fixes (make warnings go away) for Solaris. * * Revision 1.5  2001/09/27 17:02:34  alan * Shortened alarm time in write in serial.c * Put in a handful of Solaris warning-elimination patches. * * Revision 1.4  2001/09/07 16:18:17  alan * Updated ping.c to conform to the new plugin loading system. * Changed log messages in bcast, mcast, ping and serial to use the * new logging function. * * Revision 1.3  2001/08/15 16:56:47  alan * Put in the code to allow serial port comm plugins to work... * * Revision 1.2  2001/08/15 16:17:12  alan * Fixed the code so that serial comm plugins build/load/work. * * Revision 1.1  2001/08/10 17:16:44  alan * New code for the new plugin loading system. * * Revision 1.27  2001/06/08 04:57:48  alan * Changed "config.h" to <portability.h> * * Revision 1.26  2001/05/31 15:51:08  alan * Put in more fixes to get module loading (closer to) working... * * Revision 1.25  2001/05/26 17:38:01  mmoerz * *.cvsignore: added automake generated files that were formerly located in * 	     config/ * * Makefile.am: removed ac_aux_dir stuff (for libtool) and added libltdl * * configure.in: removed ac_aux_dir stuff (for libtool) and added libltdl as * 		a convenience library * * bootstrap: added libtools libltdl support * * heartbeat/Makefile.am: added some headerfile to noinst_HEADERS * * heartbeat/heartbeat.c: changed dlopen, dlclose to lt_dlopen, lt_dlclose * * heartbeat/crc.c: changed to libltdl, exports functions via EXPORT() * * heartbeat/mcast.c: changed to libltdl, exports functions via EXPORT() * * heartbeat/md5.c: changed to libltdl, exports functions via EXPORT() * * heartbeat/ping.c: changed to libltdl, exports functions via EXPORT() * * heartbeat/serial.c: changed to libltdl, exports functions via EXPORT() * * heartbeat/sha1.c: changed to libltdl, exports functions via EXPORT() * * heartbeat/udp.c: changed to libltdl, exports functions via EXPORT() * * heartbeat/hb_module.h: added EXPORT() Macro, changed to libtools function * 			pointer * * heartbeat/module.c: converted to libtool (dlopen/dlclose -> lt_dlopen/...) * 		      exchanged scandir with opendir, readdir. enhanced * 		      autoloading code so that only .la modules get loaded. * * Revision 1.24  2001/05/12 06:05:23  alan * Put in the latest portability fixes (aka autoconf fixes) * * Revision 1.23  2001/05/11 06:20:26  alan * Fixed CFLAGS so we load modules from the right diurectory. * Fixed minor static symbol problems. * Fixed a bug which kept early error messages from coming out. * * Revision 1.22  2001/05/10 22:36:37  alan * Deleted Makefiles from CVS and made all the warnings go away. * * Revision 1.21  2000/12/12 23:23:47  alan * Changed the type of times from time_t to TIME_T (unsigned long). * Added BuildPreReq: lynx * Made things a little more OpenBSD compatible. * * Revision 1.20  2000/12/04 22:16:33  alan * Simplfied a BSD compatibility fix. * * Revision 1.19  2000/12/04 20:33:17  alan * OpenBSD fixes from Frank DENIS aka Jedi/Sector One <j@c9x.org> * * Revision 1.18  2000/09/01 21:10:46  marcelo * Added dynamic module support * * Revision 1.17  2000/08/13 04:36:16  alan * Added code to make ping heartbeats work... * It looks like they do, too ;-) * * Revision 1.16  2000/08/04 03:45:56  alan * Moved locking code into lock.c, so it could be used by both heartbeat and * the client code.  Also restructured it slightly... * * Revision 1.15  2000/07/26 05:17:19  alan * Added GPL license statements to all the code. * * Revision 1.14  2000/05/17 13:39:55  alan * Added the close-on-exec flag to sockets and tty fds that we open. * Thanks to Christoph J鋑er for noticing the problem. * * Revision 1.13  2000/04/27 13:24:34  alan * Added comments about lock file fix. Minor corresponding code changes. * * Revision 1.12  2000/04/11 22:12:22  horms * Now cleans locks on serial devices from dead processes succesfully * * Revision 1.11  2000/02/23 18:44:53  alan * Put in a bug fix from Cliff Liang <lqm@readworld.com> to fix the tty * locking code.  The parameters to sscanf were mixed up. * * Revision 1.10  1999/11/15 05:31:43  alan * More tweaks for CTS/RTS flow control. * * Revision 1.9  1999/11/14 08:23:44  alan * Fixed bug in serial code where turning on flow control caused * heartbeat to hang.  Also now detect hangs and shutdown automatically. * * Revision 1.8  1999/11/11 04:58:04  alan * Fixed a problem in the Makefile which caused resources to not be * taken over when we start up. * Added RTSCTS to the serial port. * Added lots of error checking to the resource takeover code. * * Revision 1.7  1999/11/07 20:57:21  alan * Put in Matt Soffen's latest FreeBSD patch... * * Revision 1.6  1999/10/25 15:35:03  alan * Added code to move a little ways along the path to having error recovery * in the heartbeat protocol. * Changed the code for serial.c and ppp-udp.c so that they reauthenticate * packets they change the ttl on (before forwarding them). * * Revision 1.5  1999/10/10 20:12:54  alanr * New malloc/free (untested) * * Revision 1.4  1999/10/05 06:17:30  alanr * Fixed various uninitialized variables * * Revision 1.3  1999/09/30 15:55:12  alanr * * Added Matt Soffen's fix to change devname to serial_device for some kind * of FreeBSD compatibility. * * Revision 1.2  1999/09/26 14:01:18  alanr * Added Mijta's code for authentication and Guenther Thomsen's code for serial locking and syslog reform * * Revision 1.1.1.1  1999/09/23 15:31:24  alanr * High-Availability Linux * * Revision 1.11  1999/09/18 02:56:36  alanr * Put in Matt Soffen's portability changes... * * Revision 1.10  1999/09/16 05:50:20  alanr * Getting ready for 0.4.3... * * Revision 1.9  1999/08/17 03:49:26  alanr * added log entry to bottom of file. * */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
最新热久久免费视频| 国产一区二区91| 色婷婷久久一区二区三区麻豆| 中文字幕成人在线观看| 国产白丝网站精品污在线入口| 久久精品欧美日韩| 99久久综合国产精品| 亚洲人成网站色在线观看 | 日韩精品高清不卡| 欧美丰满嫩嫩电影| 另类调教123区| 久久久久久久久一| 91一区二区在线观看| 一区二区在线观看视频| 欧美日韩综合一区| 天天操天天干天天综合网| 日韩欧美中文字幕公布| 国产成人精品亚洲日本在线桃色 | 亚洲电影你懂得| 欧美一级日韩一级| 精品午夜一区二区三区在线观看| 国产亚洲精品久| 色综合天天综合网国产成人综合天| 亚洲一区在线观看网站| 欧美一区二区三级| 成人av网站在线观看| 亚洲成人av免费| 欧美不卡一区二区三区四区| 岛国精品一区二区| 亚洲成人免费看| 久久婷婷久久一区二区三区| 一本色道综合亚洲| 蜜桃av一区二区| 成人欧美一区二区三区1314| 欧美日本在线视频| 成人av电影观看| 美国一区二区三区在线播放| 国产精品成人一区二区艾草 | 亚洲国产精品尤物yw在线观看| 欧美一区二区三区视频在线 | 亚洲人123区| 欧美www视频| 欧美伊人精品成人久久综合97| 久久99精品国产麻豆婷婷 | 久久久久久久久久美女| 欧美天天综合网| 国产91清纯白嫩初高中在线观看 | 日韩伦理免费电影| 精品乱人伦小说| 91国产精品成人| 国产91在线|亚洲| 九九九久久久精品| 午夜在线电影亚洲一区| 亚洲日本青草视频在线怡红院 | 国产一区二区视频在线播放| 亚洲高清不卡在线观看| 国产精品理论在线观看| www国产成人| 欧美成人video| 91精品国产欧美日韩| 日本乱人伦一区| 99久久精品国产一区二区三区| 精品亚洲成av人在线观看| 亚洲mv大片欧洲mv大片精品| 日韩一区在线播放| 国产精品成人网| 欧美激情艳妇裸体舞| 欧美大片国产精品| 日韩视频在线观看一区二区| 91.成人天堂一区| 欧美性做爰猛烈叫床潮| 91浏览器打开| 99国产精品99久久久久久| 国产电影一区二区三区| 精品午夜久久福利影院| 蜜臀av在线播放一区二区三区| 亚洲.国产.中文慕字在线| 一区二区三区欧美日| 亚洲欧美一区二区三区久本道91| 国产精品欧美综合在线| 中文字幕第一区二区| 国产精品天天看| 国产精品久久久久久久久免费丝袜| 久久精品视频免费| 中文字幕的久久| 中文字幕色av一区二区三区| ...中文天堂在线一区| 亚洲欧洲韩国日本视频| 亚洲美女在线一区| 亚洲综合在线视频| 亚洲电影中文字幕在线观看| 午夜日韩在线电影| 日本v片在线高清不卡在线观看| 亚洲成人av一区二区| 日韩专区欧美专区| 久久99国产精品尤物| 国产精品亚洲第一| 94-欧美-setu| 欧美日韩一区精品| 欧美zozo另类异族| 久久精品视频网| 亚洲天堂a在线| 亚洲高清免费视频| 韩国三级中文字幕hd久久精品| 国产一本一道久久香蕉| 成人美女在线观看| 欧美最猛性xxxxx直播| 欧美高清www午色夜在线视频| 日韩女优电影在线观看| 国产精品丝袜91| 一区二区三区在线免费视频| 欧美bbbbb| 成人免费高清视频| 欧美电影一区二区三区| 国产夜色精品一区二区av| 亚洲美女屁股眼交3| 美女mm1313爽爽久久久蜜臀| 成人av高清在线| 正在播放一区二区| 国产精品网站在线观看| 丝袜美腿亚洲色图| 高清日韩电视剧大全免费| 欧美日韩一区二区不卡| 国产午夜亚洲精品午夜鲁丝片| 亚洲精品videosex极品| 蜜桃视频免费观看一区| 91免费观看视频| 精品欧美久久久| 亚洲一区二区精品视频| 国产精品888| 欧美一区二区三区四区视频| 国产精品国产成人国产三级| 日韩精品亚洲专区| 99国产欧美另类久久久精品| 精品国精品国产| 亚洲第一在线综合网站| 床上的激情91.| 日韩你懂的在线播放| 亚洲日穴在线视频| 国产精品1024| 日韩欧美在线观看一区二区三区| 自拍偷拍亚洲综合| 国产在线精品免费av| 欧美一区二区在线免费播放| 亚洲欧美电影院| 高清不卡在线观看av| 宅男在线国产精品| 亚洲一区在线看| 91香蕉视频污在线| 日本一区二区不卡视频| 精品无人码麻豆乱码1区2区| 91精品蜜臀在线一区尤物| 亚洲线精品一区二区三区| 99久久精品国产导航| 久久久久国产精品麻豆| 久久国产福利国产秒拍| 6080午夜不卡| 亚洲国产日产av| 一本久道中文字幕精品亚洲嫩| 欧美国产精品一区二区三区| 久久精品国产秦先生| 欧美一区二区三区四区在线观看| 亚洲午夜私人影院| 日本电影欧美片| 亚洲精品精品亚洲| 一本大道久久a久久精二百| 亚洲欧洲另类国产综合| 91社区在线播放| 亚洲日本护士毛茸茸| 91丨九色丨蝌蚪富婆spa| 国产精品久99| 91在线观看美女| 亚洲精品国产无套在线观| 91香蕉国产在线观看软件| 1000部国产精品成人观看| 成人激情文学综合网| 国产精品久久久久7777按摩| 91免费小视频| 亚洲一区二区高清| 欧美日韩aaa| 麻豆中文一区二区| 精品国产91洋老外米糕| 国产精品亚洲第一| 国产精品视频看| 色综合久久综合网97色综合 | 亚洲男人电影天堂| 欧美日韩亚洲丝袜制服| 奇米亚洲午夜久久精品| 精品久久人人做人人爱| 国产不卡高清在线观看视频| 中文字幕一区二区三区不卡| 一本久久综合亚洲鲁鲁五月天| 亚洲韩国精品一区| 日韩亚洲欧美一区| 国产精一区二区三区| 亚洲天堂成人网| 777奇米成人网| 国产东北露脸精品视频| 亚洲精品视频在线| 日韩欧美一二三区|