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

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

?? ocf_ipc.c

?? linux集群服務器軟件代碼包
?? C
字號:
/* $Id: ocf_ipc.c,v 1.23 2005/02/09 01:45:05 gshi Exp $ *//* * * ocf_ipc.c: IPC abstraction implementation. * * * Copyright (c) 2002 Xiaoxiang Liu <xiliu@ncsa.uiuc.edu> * * 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 * */#include <portability.h>#include <clplumbing/ipc.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/poll.h>#include <clplumbing/cl_log.h>#include <sys/types.h>#include <unistd.h>struct IPC_WAIT_CONNECTION * socket_wait_conn_new(GHashTable* ch_attrs);struct IPC_CHANNEL * socket_client_channel_new(GHashTable* ch_attrs);int (*ipc_pollfunc_ptr)(struct pollfd*, unsigned int, int)=	(int (*)(struct pollfd*, unsigned int, int)) poll;/* Set the IPC poll function to the given function */voidipc_set_pollfunc(int (*pf)(struct pollfd*, unsigned int, int)){	ipc_pollfunc_ptr = pf;}struct IPC_WAIT_CONNECTION * ipc_wait_conn_constructor(const char * ch_type, GHashTable* ch_attrs){  if (strcmp(ch_type, "domain_socket") == 0  ||	strcmp(ch_type, IPC_ANYTYPE) == 0  ||	strcmp(ch_type, IPC_DOMAIN_SOCKET) == 0) {    return socket_wait_conn_new(ch_attrs);  }  return NULL;}struct IPC_CHANNEL * ipc_channel_constructor(const char * ch_type, GHashTable* ch_attrs){  if	(strcmp(ch_type, "domain_socket") == 0  ||	strcmp(ch_type, IPC_ANYTYPE) == 0  ||	strcmp(ch_type, IPC_DOMAIN_SOCKET) == 0) {	return socket_client_channel_new(ch_attrs);  }  return NULL;}struct IPC_AUTH * ipc_set_auth(uid_t * a_uid, gid_t * a_gid, int num_uid, int num_gid){  struct IPC_AUTH *temp_auth;  int i;  static int v = 1;  temp_auth = g_new(struct IPC_AUTH, 1);  temp_auth->uid = g_hash_table_new(g_direct_hash, g_direct_equal);  temp_auth->gid = g_hash_table_new(g_direct_hash, g_direct_equal);  if (num_uid > 0) {    for (i=0; i<num_uid; i++) {      g_hash_table_insert(temp_auth->uid, GINT_TO_POINTER((gint)a_uid[i])      ,		&v);    }  }  if (num_gid > 0) {    for (i=0; i<num_gid; i++) {      g_hash_table_insert(temp_auth->gid, GINT_TO_POINTER((gint)a_gid[i])      ,		&v);    }  }  return temp_auth;}voidipc_destroy_auth(struct IPC_AUTH *auth){	if (auth != NULL) {		if (auth->uid) {			g_hash_table_destroy(auth->uid);		}		if (auth->gid) {			g_hash_table_destroy(auth->gid);		}		g_free((void *)auth);	}}	struct ipc_bufpool*ipc_bufpool_new(int size){	struct ipc_bufpool* pool;	int	totalsize;			/* there are memories for two struct SOCKET_MSG_HEAD	 * one for the big message, the other one for the next	 * message. This code prevents allocating 	 *	<big memory> <4k> <big memory><4k> ... 	 * from happening when a client sends big messages	 * constantly*/	totalsize = size + sizeof(struct ipc_bufpool) 		+ sizeof(struct SOCKET_MSG_HEAD) * 2 ;				if (totalsize < POOL_SIZE){		totalsize = POOL_SIZE;	}		if (totalsize > MAXDATASIZE){		cl_log(LOG_INFO, "ipc_bufpool_new: "		       "asking for buffer with size %d"		       "corrupted data len???", totalsize);		return NULL;	}		pool = (struct ipc_bufpool*)g_malloc(totalsize+1);	memset(pool, 0, totalsize);	pool->refcount = 1;	pool->startpos = pool->currpos = pool->consumepos =		((char*)pool) + sizeof(struct ipc_bufpool); 		pool->endpos = ((char*)pool)  + totalsize;	pool->size = totalsize;		return pool;}voidipc_bufpool_del(struct ipc_bufpool* pool){		if (pool == NULL){		return;	}		if (pool->refcount > 0){		cl_log(LOG_ERR," ipc_bufpool_del:"		       " IPC buffer pool reference count"		       " > 0");		return;	}		memset(pool, 0, pool->size);	g_free(pool);		return;}intipc_bufpool_spaceleft(struct ipc_bufpool* pool){	if( pool == NULL){		cl_log(LOG_ERR, "ipc_bufpool_spacelft:"		       "invalid input argument");		return 0;			}		return pool->endpos - pool->currpos;}/* brief free the memory space allocated to msg and destroy msg. */static voidipc_bufpool_msg_done(struct IPC_MESSAGE * msg) {		struct ipc_bufpool* pool;		if (msg == NULL){		cl_log(LOG_ERR, "ipc_bufpool_msg_done:"		       "invalid input");		return;	}		pool = (struct ipc_bufpool*)msg->msg_private;		ipc_bufpool_unref(pool);	g_free(msg);	}static struct IPC_MESSAGE*ipc_bufpool_msg_new(void){	struct IPC_MESSAGE * temp_msg;		temp_msg = g_malloc(sizeof(struct IPC_MESSAGE));	if (temp_msg == NULL){		cl_log(LOG_ERR, "ipc_bufpool_msg_new:"		       "allocating new msg failed");		return NULL;	}		memset(temp_msg, 0, sizeof(struct IPC_MESSAGE));	return temp_msg;}/* after a recv call, we have new data * in the pool buf, we need to update our * pool struct to consume it * */intipc_bufpool_update(struct ipc_bufpool* pool,		   struct IPC_CHANNEL * ch,		   int msg_len,		   IPC_Queue* rqueue){	IPC_Message*			ipcmsg;	struct SOCKET_MSG_HEAD		localhead;	struct SOCKET_MSG_HEAD*		head = &localhead;	int				nmsgs = 0 ;		if (rqueue == NULL){		cl_log(LOG_ERR, "ipc_update_bufpool:"		       "invalid input");		return 0;	}		pool->currpos += msg_len;		while(TRUE){		/*not enough data for head*/		if (pool->currpos - pool->consumepos < ch->msgpad){			break;		}				memcpy(head, pool->consumepos, sizeof(struct SOCKET_MSG_HEAD));				if (head->magic != HEADMAGIC){			cl_log(LOG_ERR, "ipc_bufpool_update: "			       "magic number in head does not match."			       "Something very bad happened, abort now, farside pid =%d",			       ch->farside_pid);			abort();		}		if ( head->msg_len > MAXDATASIZE){			cl_log(LOG_ERR, "ipc_update_bufpool:"			       "msg length is corruptted(%d)",			       head->msg_len);			break;		}				if (pool->consumepos + ch->msgpad + head->msg_len		    > pool->currpos){			break;					}				ipcmsg = ipc_bufpool_msg_new();		if (ipcmsg == NULL){			cl_log(LOG_ERR, "ipc_update_bufpool:"			       "allocating memory for new ipcmsg failed");			break;					}		ipcmsg->msg_buf = pool->consumepos;		ipcmsg->msg_body = pool->consumepos + ch->msgpad;		ipcmsg->msg_len = head->msg_len;		ipcmsg->msg_private = pool;		ipcmsg->msg_done = ipc_bufpool_msg_done;				rqueue->queue = g_list_append(rqueue->queue, ipcmsg);		rqueue->current_qlen ++;		nmsgs++;				pool->consumepos += ch->msgpad + head->msg_len;		ipc_bufpool_ref(pool);	}		return nmsgs;}gbooleanipc_bufpool_full(struct ipc_bufpool* pool, 		 struct IPC_CHANNEL* ch, 		 int* dataspaceneeded){		struct SOCKET_MSG_HEAD  localhead;	struct SOCKET_MSG_HEAD* head = &localhead;	*dataspaceneeded = 0;	/* not enough space for head */	if (pool->endpos - pool->consumepos < ch->msgpad){		return TRUE;	}		/*enough space for head*/	if (pool->currpos - pool->consumepos >= ch->msgpad){		memcpy(head, pool->consumepos, sizeof(struct SOCKET_MSG_HEAD));				/* not enough space for data*/		if ( pool->consumepos + ch->msgpad + head->msg_len >= pool->endpos){			*dataspaceneeded = head->msg_len;			return TRUE;		}	}			/* Either we are sure we have enough space 	 * or we cannot tell because we have not received	 * head yet. But we are sure we have enough space	 * for head	 */	return FALSE;	}int ipc_bufpool_partial_copy(struct ipc_bufpool* dstpool,			      struct ipc_bufpool* srcpool){	struct SOCKET_MSG_HEAD	localhead;	struct SOCKET_MSG_HEAD *head = &localhead;	int space_needed;	int nbytes;		if (dstpool == NULL	    || srcpool == NULL){		cl_log(LOG_ERR, "ipc_bufpool_partial_ipcmsg_cp:"		       "invalid input");				return IPC_FAIL;	}		if (srcpool->currpos - srcpool->consumepos >=	    sizeof(struct SOCKET_MSG_HEAD)){				memcpy(head, srcpool->consumepos, sizeof(struct SOCKET_MSG_HEAD));		space_needed = head->msg_len + sizeof(*head);				if (space_needed >  ipc_bufpool_spaceleft(dstpool)){			cl_log(LOG_ERR, "ipc_bufpool_partial_ipcmsg_cp:"			       " not enough space left in dst pool,spaced needed=%d",			       space_needed);			return IPC_FAIL;			}		}		nbytes = srcpool->currpos - srcpool->consumepos;	memcpy(dstpool->consumepos, srcpool->consumepos,nbytes);			srcpool->currpos = srcpool->consumepos;	dstpool->currpos = dstpool->consumepos + nbytes;		return IPC_OK;}voidipc_bufpool_ref(struct ipc_bufpool* pool){	if (pool == NULL){		cl_log(LOG_ERR, "ref_pool:"		       " invalid input");		return;			}		pool->refcount ++;	}voidipc_bufpool_unref(struct ipc_bufpool* pool){		if (pool == NULL){		cl_log(LOG_ERR, "unref_pool:"		       " invalid input");		return;			}		pool->refcount --;	if (pool->refcount <= 0){		ipc_bufpool_del(pool);	}		return;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲三级在线播放| 成人免费视频视频| 成人久久18免费网站麻豆| 欧美色老头old∨ideo| 精品国产第一区二区三区观看体验| 国产精品色噜噜| 久久精品国产一区二区| 色综合天天综合在线视频| 日韩精品中文字幕在线不卡尤物 | 丁香啪啪综合成人亚洲小说| 欧美色图第一页| 国产精品人成在线观看免费| 久久66热re国产| 欧美电影在线免费观看| 亚洲色图第一区| a在线播放不卡| 国产日韩欧美高清在线| 激情偷乱视频一区二区三区| 欧美日韩一区视频| 自拍偷拍欧美精品| 国产成人欧美日韩在线电影| 久久综合一区二区| 老司机精品视频线观看86| 欧美综合在线视频| 亚洲女性喷水在线观看一区| 成人国产亚洲欧美成人综合网 | 91丨porny丨蝌蚪视频| 日韩欧美中文一区| 亚洲第一电影网| 在线视频欧美区| 亚洲最新在线观看| 色狠狠av一区二区三区| 亚洲精品ww久久久久久p站| 成人av集中营| 亚洲欧洲精品天堂一级| av一二三不卡影片| 136国产福利精品导航| av在线不卡网| 亚洲精品日日夜夜| 欧美性猛交xxxxxxxx| 性感美女极品91精品| 91精品国产91久久久久久最新毛片| 一区二区久久久| 欧美日韩高清一区二区不卡| 午夜欧美在线一二页| 欧美一区二区视频在线观看2020 | 国产剧情一区二区三区| 国产欧美精品一区二区三区四区 | 激情成人综合网| 久久精品一区二区三区四区| 成人免费黄色大片| 亚洲欧洲日产国产综合网| 在线观看精品一区| 日本在线播放一区二区三区| 久久综合九色综合久久久精品综合| 国内精品免费**视频| 国产精品无人区| 在线精品视频一区二区三四| 青青草成人在线观看| 欧美一级爆毛片| 国产不卡视频在线播放| 一区二区三区欧美亚洲| 日韩精品中午字幕| 99re在线精品| 调教+趴+乳夹+国产+精品| 精品第一国产综合精品aⅴ| 成人av动漫在线| 日韩高清在线观看| 日本sm残虐另类| 亚洲国产岛国毛片在线| 欧美色手机在线观看| 极品美女销魂一区二区三区| 亚洲色图一区二区三区| 91精品国产综合久久精品麻豆| 国产精选一区二区三区| 亚洲一区二区av在线| 国产亚洲午夜高清国产拍精品| 色av成人天堂桃色av| 精品一区二区三区日韩| 一区二区三区在线看| 精品国产免费久久| 欧洲一区在线观看| 粉嫩av一区二区三区| 丝袜美腿亚洲综合| 国产精品国产三级国产专播品爱网| 欧美精品一二三| 99久久免费精品高清特色大片| 麻豆国产欧美日韩综合精品二区| 亚洲精品国产精华液| 久久精品夜夜夜夜久久| 欧美喷潮久久久xxxxx| 91免费看`日韩一区二区| 亚洲色欲色欲www在线观看| www激情久久| 69p69国产精品| 欧美日韩色一区| 91在线视频网址| 高清视频一区二区| 国产精品一二三四| 国产尤物一区二区在线| 日韩国产精品大片| 亚洲福利视频三区| 一区二区三区中文字幕| 亚洲日穴在线视频| 中文字幕一区二区三区四区 | 5566中文字幕一区二区电影| 色天使久久综合网天天| 91视频.com| 色综合久久九月婷婷色综合| 成人性生交大片免费看在线播放 | 免费观看成人av| 日韩成人av影视| 美女一区二区在线观看| 丝袜亚洲另类欧美| 全部av―极品视觉盛宴亚洲| 日韩高清一级片| 久久se精品一区精品二区| 理论电影国产精品| 国产一区视频网站| 国产精品一区二区久激情瑜伽| 国产一区二区三区精品欧美日韩一区二区三区 | 日韩一区二区三区视频在线 | 欧美日韩国产另类一区| 欧美视频中文字幕| 欧美精选午夜久久久乱码6080| 欧美精品日韩综合在线| 欧美一区二区在线不卡| 久久影院视频免费| 中文字幕免费不卡| 亚洲老妇xxxxxx| 日一区二区三区| 激情久久五月天| 99re视频这里只有精品| 欧美日韩一卡二卡| 日韩免费高清电影| 亚洲国产成人午夜在线一区| 亚洲激情五月婷婷| 视频在线观看一区二区三区| 极品美女销魂一区二区三区| 不卡一区二区在线| 在线观看一区二区视频| 欧美一区二区精品| 欧美国产成人在线| 亚洲一区二区3| 国产自产视频一区二区三区| av动漫一区二区| 欧美高清dvd| 日本一区二区三区四区 | 欧美日韩在线不卡| 精品国产乱码久久久久久夜甘婷婷| 中文字幕av一区 二区| 亚洲最新视频在线观看| 狠狠久久亚洲欧美| 91激情五月电影| 26uuu另类欧美亚洲曰本| 1区2区3区精品视频| 美女mm1313爽爽久久久蜜臀| 91女厕偷拍女厕偷拍高清| 日韩精品在线看片z| 一区二区三区在线视频免费| 极品少妇一区二区三区精品视频| 日本福利一区二区| 国产日韩欧美精品综合| 亚洲第一搞黄网站| 99久久国产综合精品麻豆| 日韩一区二区三区三四区视频在线观看| 国产精品区一区二区三| 麻豆国产91在线播放| 欧美三级日韩三级国产三级| 国产精品色婷婷久久58| 精品午夜久久福利影院| 欧美日韩成人在线一区| 亚洲欧美视频在线观看视频| 国产酒店精品激情| 欧美一二三区在线| 亚洲bt欧美bt精品| 一本大道久久a久久精二百| 欧美极品美女视频| 国产乱码字幕精品高清av| 欧美一区二区在线看| 亚洲国产一区视频| 91在线免费视频观看| 国产精品嫩草影院com| 国产乱码精品一区二区三区忘忧草| 538在线一区二区精品国产| 性做久久久久久| 欧美性欧美巨大黑白大战| 中文字幕在线免费不卡| 高清av一区二区| 久久久精品日韩欧美| 激情都市一区二区| 26uuu精品一区二区三区四区在线| 日日骚欧美日韩| 日韩一区二区三区在线观看| 天天av天天翘天天综合网| 欧美人伦禁忌dvd放荡欲情| 亚洲一卡二卡三卡四卡五卡| 色综合久久久久综合99| 一区二区三区四区不卡在线 | 97成人超碰视|