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

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

?? rcd_serial.c

?? linux集群服務器軟件代碼包
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* $Id: rcd_serial.c,v 1.24 2005/02/18 07:32:09 zhaokai Exp $ *//* * Stonith module for RCD_SERIAL Stonith device * * Original code from null.c by * Copyright (c) 2000 Alan Robertson <alanr@unix.sh> * * Copious borrowings from nw_rpc100s.c by * Copyright (c) 2000 Computer Generation Incorporated *          Eric Z. Ayers <eric.ayers@compgen.com> * *                and from apcsmart.c by * Copyright (c) 2000 Andreas Piesk <a.piesk@gmx.net> * * Modifications for RC Delayed Serial Ciruit by  * Copyright (c) 2002 John Sutton <john@scl.co.uk> * * Mangled by Zhaokai <zhaokai@cn.ibm.com>, IBM, 2005 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. *  * This library 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 * Lesser General Public License for more details. *  * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * */#define	DEVICE	"RCD_SERIAL STONITH device"#include "stonith_plugin_common.h"#include "stonith_signal.h"#define PIL_PLUGIN              rcd_serial#define PIL_PLUGIN_S            "rcd_serial"#define PIL_PLUGINLICENSE 	LICENSE_LGPL#define PIL_PLUGINLICENSEURL 	URL_LGPL#define	ST_DTRRTS		"dtr|rts"#define	ST_MSDURATION		"msduration"#define MAX_RCD_SERIALLINE	512#include <pils/plugin.h>#include <sys/ioctl.h>#include <sys/time.h>static StonithPlugin*	rcd_serial_new(void);static void		rcd_serial_destroy(StonithPlugin *);static int		rcd_serial_set_config(StonithPlugin *, StonithNVpair *);static const char **	rcd_serial_get_confignames(StonithPlugin *);static const char *	rcd_serial_getinfo(StonithPlugin * s, int InfoType);static int		rcd_serial_status(StonithPlugin * );static int		rcd_serial_reset_req(StonithPlugin * s, int request, const char * host);static char **		rcd_serial_hostlist(StonithPlugin  *);static struct stonith_ops rcd_serialOps ={	rcd_serial_new,			/* Create new STONITH object		*/	rcd_serial_destroy,		/* Destroy STONITH object		*/	rcd_serial_getinfo,		/* Return STONITH info string		*/	rcd_serial_get_confignames,	/* Return STONITH info string		*/	rcd_serial_set_config,		/* Get configuration from NVpairs	*/	rcd_serial_status,		/* Return STONITH device status		*/	rcd_serial_reset_req,		/* Request a reset 			*/	rcd_serial_hostlist,		/* Return list of supported hosts 	*/};PIL_PLUGIN_BOILERPLATE2("1.0", Debug)static const PILPluginImports*  PluginImports;static PILPlugin*               OurPlugin;static PILInterface*		OurInterface;static StonithImports*		OurImports;static void*			interfprivate;PIL_rcPIL_PLUGIN_INIT(PILPlugin*us, const PILPluginImports* imports);PIL_rcPIL_PLUGIN_INIT(PILPlugin*us, const PILPluginImports* imports){	/* Force the compiler to do a little type checking */	(void)(PILPluginInitFun)PIL_PLUGIN_INIT;	PluginImports = imports;	OurPlugin = us;	/* Register ourself as a plugin */	imports->register_plugin(us, &OurPIExports);  	/*  Register our interface implementation */ 	return imports->register_interface(us, PIL_PLUGINTYPE_S	,	PIL_PLUGIN_S	,	&rcd_serialOps	,	NULL		/*close */	,	&OurInterface	,	(void*)&OurImports	,	&interfprivate); }/* ------------------- RCD specific stuff -------------- *//*  A diagram of a circuit suitable for use with this plugin is in  README.rcd_serial which should be somewhere in the distribution (if Alan  includes it ;-) and/or at http://www.scl.co.uk/rcd_serial/ (if I remember  to put it there ;-).  Once you've got this built, you can test things using the stonith command  as follows:	stonith -L		will show a list of plugin types, including rcd_serial	stonith -t rcd_serial testhost		will show required parameters  In these 3 you can either pass the params after the -p option or you can  put them in a config file and use -F configname instead of -p "param ...".	stonith -t rcd_serial -p "testhost /dev/ttyS0 rts 1500" -S		will show the status of the device	stonith -t rcd_serial -p "testhost /dev/ttyS0 rts 1500" -l		will list the single host testhost	stonith -t rcd_serial -p "testhost /dev/ttyS0 rts 1500" testhost		will reset testhost (provided testhost has its reset pins		suitably wired to the RTS signal coming out of port /dev/ttyS0		and that 1.5s is enough time to cause a reset ;-)*//*  Define RCD_NOPAUSE if you are using the serial port for some purpose  _in_addition_ to using it as a stonith device.  For example, I use one  of the input pins on the same serial port for monitoring the state of a  power supply.  Periodically, a cron job has to open the port to read the  state of this input and thus has to clear down the output pins DTR and RTS  in order to avoid causing a spurious stonith reset.  Now, if it should  happen that just at the same time as we are _really_ trying to do a stonith  reset, this cron job starts up, then the stonith reset won't occur ;-(.  To avoid this (albeit unlikely) outcome, you should #define RCD_NOPAUSE.  The effect of this is that instead of setting the line high just once and  then falling into a pause until an alarm goes off, rather, the program falls  into a loop which is continuously setting the line high.  That costs us a bit  of CPU as compared with sitting in a pause, but hey, how often is this code  going to get exercised!  Never, we hope...*/#undef RCD_NOPAUSE#ifdef RCD_NOPAUSEstatic int RCD_alarmcaught;#endif/* * own prototypes */static void RCD_alarm_handler(int sig);static int RCD_open_serial_port(char *device);static int RCD_close_serial_port(int fd);static voidRCD_alarm_handler(int sig) {#if !defined(HAVE_POSIX_SIGNALS)        if (sig)		signal(sig, SIG_DFL);	else    { signal(sig, RCD_alarm_handler); }#else	struct sigaction sa;	sigset_t sigmask;	/* Maybe a bit naughty but it works and it saves duplicating all */	/* this setup code - if handler called with 0 for sig, we install */	/* ourself as handler. */	if (sig) sa.sa_handler = (void (*)(int))SIG_DFL;	else     sa.sa_handler = RCD_alarm_handler;	sigemptyset(&sigmask);	sa.sa_mask = sigmask;	sa.sa_flags = 0;	sigaction(SIGALRM, &sa, NULL);#endif#ifdef RCD_NOPAUSE	RCD_alarmcaught = 1;#endif	return;}static intRCD_open_serial_port(char *device) {	int fd;	int status;	int bothbits;	bothbits = TIOCM_RTS | TIOCM_DTR;	fd = 0;	if ((fd = open(device, O_RDONLY | O_NDELAY)) != -1) {		/*			Opening the device always sets DTR & CTS high.			Clear them down immediately.		*/		status = ioctl(fd, TIOCMBIC, &bothbits);		/* If there was an error clearing bits, set the fd to -1 ( indicates error ) */		if (status != 0 ) { 			fd = -1;		}	}	return fd;}static intRCD_close_serial_port(int fd) {        return close(fd);}/* *	RCD_Serial STONITH device. */struct pluginDevice {	StonithPlugin	sp;	const char *	pluginid;	char **		hostlist;	/* name of single host we can reset */	int		hostcount;	/* i.e. 1 after initialisation */	char *		device;		/* serial device name */	char *		signal;		/* either rts or dtr */	int		msduration;	/* how long (ms) to assert the signal */};static const char * pluginid = "pluginDevice-Stonith";static const char * NOTrcd_serialID = "Hey, dummy this has been destroyed (RCD_SerialDev)";static intrcd_serial_status(StonithPlugin  *s){	struct pluginDevice*	rcd;	int fd;	const char * err;	ERRIFWRONGDEV(s,S_OOPS);	rcd = (struct pluginDevice*) s;	/*	All we can do is make sure the serial device exists and	can be opened and closed without error.	*/	if ((fd = RCD_open_serial_port(rcd->device)) == -1) {                err = strerror(errno);		LOG(PIL_CRIT, "%s: open of %s failed - %s",			__FUNCTION__, rcd->device, err);		return(S_OOPS);	}	if (RCD_close_serial_port(fd) != 0) {                err = strerror(errno);		LOG(PIL_CRIT, "%s: close of %s failed - %s",			__FUNCTION__, rcd->device, err);		return(S_OOPS);	}	return S_OK;}/* *	Return the list of hosts configured for this RCD_SERIAL device */static char **rcd_serial_hostlist(StonithPlugin  *s){	char **		ret = NULL;	struct pluginDevice*	rcd;	int		j;	ERRIFWRONGDEV(s,NULL);	rcd = (struct pluginDevice*) s;	if (rcd->hostcount < 0) {		LOG(PIL_CRIT		,	"unconfigured stonith object in RCD_SERIAL_list_hosts");		return(NULL);	}	ret = (char **)MALLOC((rcd->hostcount+1)*sizeof(char*));	if (ret == NULL) {		LOG(PIL_CRIT, "out of memory");		return ret;	}	memset(ret, 0, (rcd->hostcount+1)*sizeof(char*));	for (j=0; j < rcd->hostcount; ++j) {		ret[j] = STRDUP(rcd->hostlist[j]);		if (ret[j] == NULL) {			stonith_free_hostlist(ret);			ret = NULL;			return ret;		}	}	return(ret);}/* *	Parse the config information, and stash it away... */static intRCD_SERIAL_parse_config_info(struct pluginDevice* rcd, const char * info){	char *copy;	char *token;	char *endptr;	int ret;	if (rcd->hostcount >= 0) {		return(S_OOPS);	}	/* strtok() is nice to use to parse a string with	   (other than it isn't threadsafe), but it is destructive, so	   we're going to alloc our own private little copy for the	   duration of this function.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧洲三级电影| 国产二区国产一区在线观看| 7777精品伊人久久久大香线蕉的 | 国产91对白在线观看九色| 国产欧美日产一区| 99久久精品国产毛片| 亚洲欧美成aⅴ人在线观看| 日本高清不卡在线观看| 亚洲一区二区av电影| 欧美精品在欧美一区二区少妇| 日韩黄色免费网站| 26uuu国产电影一区二区| 国产成人高清在线| 亚洲精品一卡二卡| 777奇米成人网| 精品亚洲成a人| 国产精品电影院| 欧美亚洲愉拍一区二区| 秋霞影院一区二区| 国产婷婷一区二区| 色就色 综合激情| 日韩精品福利网| 国产欧美一区二区精品性色超碰 | 欧美激情一区二区在线| 91亚洲精品乱码久久久久久蜜桃| 夜夜精品浪潮av一区二区三区| 91.xcao| 国产成人免费高清| 一区二区三区不卡视频 | 91精品欧美久久久久久动漫| 国产一区二区三区在线观看免费视频 | 国产日韩欧美精品电影三级在线| 色综合色狠狠天天综合色| 日韩激情在线观看| 中文字幕精品三区| 欧美日韩国产小视频| 久久丁香综合五月国产三级网站| 国产精品―色哟哟| 51精品久久久久久久蜜臀| 国产成人激情av| 婷婷综合久久一区二区三区| 久久精品人人做人人爽97| 色综合天天天天做夜夜夜夜做| 亚洲aaa精品| 久久精品欧美一区二区三区麻豆| 一本一道综合狠狠老| 日韩电影免费在线| 国产精品福利一区| 91精品国产高清一区二区三区| 国产传媒一区在线| 亚洲国产日韩一区二区| 欧美精品一区二区三区在线| 91欧美一区二区| 久久成人免费网站| 亚洲欧美日韩一区二区 | 亚洲va欧美va人人爽| 国产日韩欧美亚洲| 欧美一级日韩不卡播放免费| 99精品一区二区| 国模娜娜一区二区三区| 夜夜嗨av一区二区三区四季av| 久久久三级国产网站| 欧美日韩国产乱码电影| www.色精品| 激情综合色丁香一区二区| 亚洲综合色噜噜狠狠| 国产精品无人区| 精品三级av在线| 欧美日本在线看| 一本大道久久精品懂色aⅴ| 国产精品一区二区果冻传媒| 日韩在线一区二区三区| 一区二区三区美女视频| 国产精品天天摸av网| 欧美mv日韩mv| 欧美巨大另类极品videosbest| 色又黄又爽网站www久久| 国产不卡视频在线播放| 精品伊人久久久久7777人| 香蕉影视欧美成人| 亚洲精品高清在线| 国产精品狼人久久影院观看方式| 2021国产精品久久精品 | 欧美日韩视频在线第一区| 99vv1com这只有精品| 国产精品 欧美精品| 美女视频黄久久| 日韩精品一级二级| 亚洲国产综合色| 亚洲激情图片小说视频| 中文字幕人成不卡一区| 中文无字幕一区二区三区| 精品成人佐山爱一区二区| 日韩女同互慰一区二区| 91麻豆精品国产91久久久 | 欧美美女一区二区在线观看| 91官网在线免费观看| 99国产精品久久久久久久久久久| 成人永久免费视频| 国产福利一区二区三区视频| 国内成人精品2018免费看| 九色|91porny| 久久99热这里只有精品| 蜜桃视频在线观看一区| 麻豆精品一区二区三区| 免费高清在线一区| 奇米精品一区二区三区在线观看| 午夜精品久久久久| 亚洲风情在线资源站| 亚洲成人激情综合网| 午夜电影网亚洲视频| 午夜婷婷国产麻豆精品| 日日夜夜免费精品视频| 日韩电影免费在线观看网站| 免费人成网站在线观看欧美高清| 日日噜噜夜夜狠狠视频欧美人| 丝瓜av网站精品一区二区 | 国产一区二区三区高清播放| 黄网站免费久久| 国产成人啪午夜精品网站男同| 国产成人在线观看免费网站| 豆国产96在线|亚洲| 成人白浆超碰人人人人| 9i在线看片成人免费| 色欧美日韩亚洲| 欧美三区在线观看| 制服丝袜在线91| 欧美大胆人体bbbb| 久久精品一区二区三区不卡| 国产女主播一区| 亚洲天天做日日做天天谢日日欢 | 久久精品人人做人人综合 | 北岛玲一区二区三区四区| av在线综合网| 在线观看区一区二| 欧美日韩成人综合在线一区二区| 91精品国产入口| 久久精品这里都是精品| 国产精品成人免费| 一区二区日韩电影| 人人超碰91尤物精品国产| 激情国产一区二区| 成人18精品视频| 欧美三级视频在线观看| 日韩欧美在线影院| 国产欧美日韩在线看| 亚洲欧美激情小说另类| 日韩电影一二三区| 国产成人自拍在线| 色视频一区二区| 日韩免费观看2025年上映的电影 | 亚洲精品大片www| 日韩电影在线观看网站| 国产福利不卡视频| 在线精品亚洲一区二区不卡| 日韩一二三四区| 亚洲国产精品国自产拍av| 亚洲综合清纯丝袜自拍| 久久不见久久见免费视频7| 成人av中文字幕| 欧美一区二区三区视频在线| 欧美极品少妇xxxxⅹ高跟鞋| 亚洲黄网站在线观看| 久久成人羞羞网站| 91亚洲永久精品| 精品久久久久久久人人人人传媒| 一色屋精品亚洲香蕉网站| 日韩成人一区二区| 成人高清视频在线| 欧美福利电影网| 国产精品视频观看| 日本欧美久久久久免费播放网| 国产91精品一区二区| 欧美人动与zoxxxx乱| 国产女主播一区| 日韩中文字幕麻豆| a4yy欧美一区二区三区| 日韩一区二区电影在线| 亚洲欧洲精品天堂一级| 蜜臀精品一区二区三区在线观看 | 免费看欧美美女黄的网站| a亚洲天堂av| 欧美一区二区三区啪啪| 1区2区3区国产精品| 精品写真视频在线观看| 日本精品视频一区二区三区| 久久色中文字幕| 天堂午夜影视日韩欧美一区二区| 国产a区久久久| 日韩一区二区精品葵司在线 | 国产精品青草综合久久久久99| 日韩激情视频网站| 91在线精品秘密一区二区| 久久综合九色综合欧美亚洲| 亚洲成人精品影院| www.成人网.com| xfplay精品久久| 日韩电影在线免费看| 在线免费视频一区二区| 国产精品拍天天在线|