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

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

?? uipc_sock2.c

?? vxworks下的實(shí)現(xiàn)網(wǎng)絡(luò)TCPIP協(xié)議的原代碼
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/* uipc_sock2.c - uipc primitive socket routines *//* Copyright 1984-1996 Wind River Systems, Inc. */#include "copyright_wrs.h"/* * Copyright (c) 1982, 1986, 1988, 1990, 1993 *	The Regents of the University of California.  All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *	This product includes software developed by the University of *	California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * *	@(#)uipc_socket2.c	8.2 (Berkeley) 2/14/95 *//*modification history--------------------01f,12nov98,n_s  fixed sbcompress to work with netBufLib buffers. spr # 2296601e,19sep97,vin  changed m_ext.ext_size to m_extSize01d,11aug97,vin  adjusted sb_max to 5 *cc and low water mark to CL_SIZE_6401c,03dec96,vin	 changed calloc(..) to MALLOC(..) and free(..) to FREE(..)		 to use network buffers.01b,22nov96,vin	 added cluster support, replace m_get(..) with mBufClGet(..). 01a,03mar96,vin  created from BSD4.4lite2. Integrated with 02t of uipc_sock2.c*//*DESCRIPTION*/#ifdef BSDUNIX44 #include <sys/param.h>#include <sys/systm.h>#include <sys/proc.h>#include <sys/file.h>#include <sys/buf.h>#include <sys/malloc.h>#include <sys/mbuf.h>#include <sys/protosw.h>#include <sys/socket.h>#include <sys/socketvar.h>#else#include "vxWorks.h"#include "semLib.h"#include "memLib.h"#include "errno.h"#include "net/mbuf.h"#include "net/protosw.h"#include "sys/socket.h"#include "net/socketvar.h"#include "net/systm.h"#include "net/unixLib.h"#endif /* BSDUNIX44 *//* globals */VOIDFUNCPTR sowakeupHook = NULL;	/* user callback in sowakeup() */u_long	sb_max = SB_MAX;		/* patchable max socket buffer size*//* * Primitive routines for operating on sockets and socket buffers *//* * Procedures to manipulate state flags of socket * and do appropriate wakeups.  Normal sequence from the * active (originating) side is that soisconnecting() is * called during processing of connect() call, * resulting in an eventual call to soisconnected() if/when the * connection is established.  When the connection is torn down * soisdisconnecting() is called during processing of disconnect() call, * and soisdisconnected() is called when the connection to the peer * is totally severed.  The semantics of these routines are such that * connectionless protocols can call soisconnected() and soisdisconnected() * only, bypassing the in-progress calls when setting up a ``connection'' * takes no time. * * From the passive side, a socket is created with * two queues of sockets: so_q0 for connections in progress * and so_q for connections already made and awaiting user acceptance. * As a protocol is preparing incoming connections, it creates a socket * structure queued on so_q0 by calling sonewconn().  When the connection * is established, soisconnected() is called, and transfers the * socket structure to so_q, making it available to accept(). *  * If a socket is closed with sockets on either * so_q0 or so_q, these sockets are dropped. * * If higher level protocols are implemented in * the kernel, the wakeups done here will sometimes * cause software-interrupt process scheduling. */voidsoisconnecting(so)	register struct socket *so;{	so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING);	so->so_state |= SS_ISCONNECTING;}voidsoisconnected(so)	register struct socket *so;{	register struct socket *head = so->so_head;	so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);	so->so_state |= SS_ISCONNECTED;	if (head && soqremque(so, 0)) {		soqinsque(head, so, 1);		sorwakeup(head);		wakeup(&head->so_timeoSem);	} else {	        wakeup(&so->so_timeoSem);		sorwakeup(so);		sowwakeup(so);	}}voidsoisdisconnecting(so)	register struct socket *so;{	so->so_state &= ~SS_ISCONNECTING;	so->so_state |= (SS_ISDISCONNECTING|SS_CANTRCVMORE|SS_CANTSENDMORE);	wakeup(&so->so_timeoSem);	sowwakeup(so);	sorwakeup(so);}voidsoisdisconnected(so)	register struct socket *so;{	so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);	so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE);	wakeup(&so->so_timeoSem);	sowwakeup(so);	sorwakeup(so);}/* * When an attempt at a new connection is noted on a socket * which accepts connections, sonewconn is called.  If the * connection is possible (subject to space constraints, etc.) * then we allocate a new structure, propoerly linked into the * data structure of the original socket, and return this. * Connstatus may be 0, or SO_ISCONFIRMING, or SO_ISCONNECTED. * * Currently, sonewconn() is defined as sonewconn1() in socketvar.h * to catch calls that are missing the (new) second parameter. */struct socket *sonewconn1(head, connstatus)	register struct socket *head;	int connstatus;{	register struct socket *so;	int soqueue = connstatus ? 1 : 0;	if (head->so_qlen + head->so_q0len > 3 * head->so_qlimit / 2)		return ((struct socket *)0);        MALLOC(so, struct socket *, sizeof(*so), MT_SOCKET, M_DONTWAIT);        if (so == NULL)                return ((struct socket *)0);        bzero((caddr_t)so, sizeof(*so));	so->so_type = head->so_type;	so->so_options = head->so_options &~ SO_ACCEPTCONN;	so->so_linger = head->so_linger;	so->so_state = head->so_state | SS_NOFDREF;	so->so_proto = head->so_proto;	so->so_timeo = head->so_timeo;	so->so_pgrp = head->so_pgrp;	/* initialize the socket's semaphores */	semBInit (&so->so_timeoSem, SEM_Q_PRIORITY, SEM_EMPTY);	semBInit (&so->so_rcv.sb_Sem, SEM_Q_PRIORITY, SEM_EMPTY);	semBInit (&so->so_snd.sb_Sem, SEM_Q_PRIORITY, SEM_EMPTY);        /* initialize the select stuff */	selWakeupListInit (&so->so_selWakeupList);	(void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat);	soqinsque(head, so, soqueue);	if ((*so->so_proto->pr_usrreq)(so, PRU_ATTACH,	    (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0)) {		(void) soqremque(so, soqueue);		FREE(so, MT_SOCKET);		return ((struct socket *)0);	}	if (connstatus) {		sorwakeup(head);		wakeup(&head->so_timeoSem);		so->so_state |= connstatus;	}	return (so);}voidsoqinsque(head, so, q)	register struct socket *head, *so;	int q;{	register struct socket **prev;	so->so_head = head;	if (q == 0) {		head->so_q0len++;		so->so_q0 = 0;		for (prev = &(head->so_q0); *prev; )			prev = &((*prev)->so_q0);	} else {		head->so_qlen++;		so->so_q = 0;		for (prev = &(head->so_q); *prev; )			prev = &((*prev)->so_q);	}	*prev = so;}intsoqremque(so, q)	register struct socket *so;	int q;{	register struct socket *head, *prev, *next;	head = so->so_head;	prev = head;	for (;;) {		next = q ? prev->so_q : prev->so_q0;		if (next == so)			break;		if (next == 0)			return (0);		prev = next;	}	if (q == 0) {		prev->so_q0 = next->so_q0;		head->so_q0len--;	} else {		prev->so_q = next->so_q;		head->so_qlen--;	}	next->so_q0 = next->so_q = 0;	next->so_head = 0;	return (1);}/* * Socantsendmore indicates that no more data will be sent on the * socket; it would normally be applied to a socket when the user * informs the system that no more data is to be sent, by the protocol * code (in case PRU_SHUTDOWN).  Socantrcvmore indicates that no more data * will be received, and will normally be applied to the socket by a * protocol when it detects that the peer will send no more data. * Data queued for reading in the socket may yet be read. */voidsocantsendmore(so)	struct socket *so;{	so->so_state |= SS_CANTSENDMORE;	sowwakeup(so);}voidsocantrcvmore(so)	struct socket *so;{	so->so_state |= SS_CANTRCVMORE;	sorwakeup(so);}/* * Queue a process for a select on a socket buffer. */sbselqueue(so, sb, wakeupNode)	struct socket *so;        struct sockbuf *sb;	SEL_WAKEUP_NODE *wakeupNode;{	if (selNodeAdd (&so->so_selWakeupList, wakeupNode) == ERROR)	    return;	/* this is race free ONLY if we assume we're at splnet - rdc */	sb->sb_sel = (struct proc *) 1;}sbseldequeue(so, sb, wakeupNode)    struct socket *so;    struct sockbuf *sb;    SEL_WAKEUP_NODE *wakeupNode;    {    selNodeDelete (&so->so_selWakeupList, wakeupNode);    /* this is race free ONLY if we assume we're at splnet - rdc */    if (selWakeupListLen (&so->so_selWakeupList) == 0)	sb->sb_sel = (struct proc *) 0;    }/* * Wait for data to arrive at/drain from a socket buffer. */voidsbwait(sb)	struct sockbuf *sb;{	sb->sb_want++;	sb->sb_flags |= SB_WAIT;	ksleep (&sb->sb_Sem);}/*  * Lock a sockbuf already known to be locked; * return any error returned from sleep (EINTR). */intsb_lock(sb)	register struct sockbuf *sb;{	while (sb->sb_flags & SB_LOCK) {		sb->sb_flags |= SB_WANT;		ksleep(&sb->sb_Sem);	}	sb->sb_flags |= SB_LOCK;	return (0);}/* * Wakeup processes waiting on a socket buffer. */void sbwakeup(so, sb, wakeupType)	struct socket *so;	register struct sockbuf *sb;	SELECT_TYPE wakeupType;{	if (sb->sb_want > 0)	    {	    sb->sb_want--;	    wakeup(&sb->sb_Sem);	    }        else	    sb->sb_want = 0;	if (sb->sb_sel) {	    /* wake up everybody on selectTask List */	    /* assume this is running in netTask context */	    selWakeupAll (&so->so_selWakeupList, wakeupType);	    }}/* * Wakeup socket readers and writers. *//* ARGSUSED */void sowakeup(so, sb, wakeupType)	struct socket *so;	struct sockbuf *sb;	SELECT_TYPE wakeupType;{        sbwakeup(so, sb, wakeupType);	/* user callback, instead of full signals implementation */	if (sowakeupHook != NULL)	     (*sowakeupHook) (so, wakeupType);#ifdef	BERKELEY	/* XXX one day asynchronous IO will work... -gae */        register struct proc *p;        if (so->so_state & SS_ASYNC) {                if (so->so_pgrp < 0)                        gsignal(-so->so_pgrp, SIGIO);                else if (so->so_pgrp > 0 && (p = pfind(so->so_pgrp)) != 0)                        psignal(p, SIGIO);        }#endif	/* BERKELEY */}/* * Socket buffer (struct sockbuf) utility routines. * * Each socket contains two socket buffers: one for sending data and * one for receiving data.  Each buffer contains a queue of mbufs, * information about the number of mbufs and amount of data in the * queue, and other fields allowing select() statements and notification * on data availability to be implemented. * * Data stored in a socket buffer is maintained as a list of records. * Each record is a list of mbufs chained together with the m_next * field.  Records are chained together with the m_nextpkt field. The upper * level routine soreceive() expects the following conventions to be * observed when placing information in the receive buffer: * * 1. If the protocol requires each message be preceded by the sender's *    name, then a record containing that name must be present before *    any associated data (mbuf's must be of type MT_SONAME). * 2. If the protocol supports the exchange of ``access rights'' (really *    just additional data associated with the message), and there are *    ``rights'' to be received, then a record containing this data *    should be present (mbuf's must be of type MT_RIGHTS). * 3. If a name or rights record exists, then it must be followed by

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
五月天一区二区| 国产调教视频一区| 久久免费电影网| 国产精品乱码一区二区三区软件| 亚洲视频在线一区观看| 亚洲成人手机在线| 国产一区二区三区日韩| 色呦呦国产精品| 欧美va亚洲va香蕉在线| 一区精品在线播放| 首页国产欧美日韩丝袜| 成人小视频在线观看| 欧美网站大全在线观看| 久久这里都是精品| 亚洲最新在线观看| 国产精品一区在线观看乱码| 在线观看日产精品| 久久综合久久综合九色| 亚洲男人都懂的| 久久精品国产成人一区二区三区| 成人avav影音| 欧美一区二区免费视频| 国产精品毛片大码女人| 免费成人av在线播放| 成人91在线观看| 日韩免费高清av| 亚洲欧美日韩人成在线播放| 久久国产视频网| 在线亚洲人成电影网站色www| 欧美精品一区二区三区高清aⅴ| 一区二区三区在线视频观看58| 七七婷婷婷婷精品国产| 日本乱码高清不卡字幕| 国产亚洲精品资源在线26u| 亚洲成人免费视| 91亚洲永久精品| 国产视频一区不卡| 欧美aaa在线| 欧洲精品在线观看| 国产精品丝袜黑色高跟| 国内精品国产三级国产a久久| 精品视频免费看| 亚洲人成网站色在线观看| 国产剧情在线观看一区二区| 日韩视频免费观看高清在线视频| 尤物在线观看一区| jlzzjlzz欧美大全| 26uuu精品一区二区| 五月激情综合婷婷| 欧美性欧美巨大黑白大战| 国产精品久久久久久户外露出| 狠狠色狠狠色综合日日91app| 5858s免费视频成人| 亚洲一区二区三区视频在线| 91在线播放网址| 国产精品久久久久影院亚瑟| 国产精品一区二区无线| 精品久久久久久久久久久久久久久 | 精品日韩在线一区| 天天综合天天综合色| 色婷婷av一区二区三区软件| 中文字幕一区二区三区在线不卡| 麻豆专区一区二区三区四区五区| 欧美日韩精品综合在线| 亚洲一区二区三区四区的| 日本道免费精品一区二区三区| 国产精品久久久久毛片软件| 国产精品1区2区3区在线观看| 精品国产sm最大网站免费看 | 欧美精品一区二区三区四区| 美日韩黄色大片| 日韩三级视频在线观看| 蜜桃一区二区三区在线观看| 欧美日韩国产综合久久| 性久久久久久久| 欧美久久久久久久久| 天天亚洲美女在线视频| 欧美日韩视频一区二区| 丝袜诱惑亚洲看片| 91精品国产欧美一区二区| 日本在线不卡视频| 精品999在线播放| 国产一区福利在线| 欧美激情一区二区在线| 成人免费观看视频| 亚洲精品高清视频在线观看| 欧美亚洲高清一区| 婷婷夜色潮精品综合在线| 欧美高清视频一二三区| 精品一区二区久久久| 久久影院视频免费| yourporn久久国产精品| 亚洲激情在线播放| 欧美久久久久久蜜桃| 久久99精品国产| 色综合天天性综合| 丝袜美腿高跟呻吟高潮一区| 日韩精品在线一区| 国产成人av电影在线| 综合激情成人伊人| 欧美日韩成人一区| 激情六月婷婷久久| 中文字幕第一区第二区| 色哟哟国产精品| 日本伊人色综合网| 久久久91精品国产一区二区精品| 成人免费高清在线观看| 亚洲国产精品尤物yw在线观看| 欧美一级淫片007| 国产成人在线视频网站| 亚洲综合在线电影| 精品国产91洋老外米糕| 成年人网站91| 日韩成人一区二区| 国产精品天干天干在观线| 欧美色精品在线视频| 九色|91porny| 1024成人网| 欧美大片在线观看一区二区| 99久久婷婷国产| 日韩精品亚洲专区| 国产日产欧产精品推荐色| 91久久奴性调教| 久久99国产精品麻豆| 国产精品灌醉下药二区| 欧美二区在线观看| 粉嫩13p一区二区三区| 亚洲电影中文字幕在线观看| 国产网站一区二区| 欧美人与禽zozo性伦| 国产福利一区在线| 亚洲.国产.中文慕字在线| 亚洲国产精品激情在线观看| 欧美色图免费看| 国产99久久精品| 亚洲一区免费在线观看| 欧美韩国日本一区| 4438x成人网最大色成网站| 成人国产精品免费观看视频| 日韩一区精品视频| 一区二区三区四区高清精品免费观看| 日韩精品一区二区三区在线| 91国产免费看| 丁香天五香天堂综合| 日本不卡不码高清免费观看| 亚洲天堂精品在线观看| 精品国产乱码久久久久久影片| 91国偷自产一区二区三区观看| 国产剧情一区二区| 久久国内精品视频| 午夜成人免费电影| 一区二区三区视频在线观看| 久久久欧美精品sm网站| 91麻豆精品国产自产在线观看一区 | 欧美精品丝袜中出| 91免费精品国自产拍在线不卡| 日韩三级免费观看| 欧洲人成人精品| av一本久道久久综合久久鬼色| 精品无人区卡一卡二卡三乱码免费卡 | 国产乱人伦偷精品视频免下载| 亚洲成人自拍网| 一级做a爱片久久| 亚洲欧洲日韩综合一区二区| 久久久电影一区二区三区| 日韩精品中午字幕| 精品视频色一区| 欧美性大战xxxxx久久久| 色呦呦网站一区| 91蝌蚪国产九色| 成人黄页毛片网站| 成人一区二区视频| 国产乱妇无码大片在线观看| 激情小说亚洲一区| 奇米亚洲午夜久久精品| 午夜视频久久久久久| 亚洲成人三级小说| 亚洲成人免费电影| 五月婷婷综合激情| 亚洲成a人片综合在线| 夜夜嗨av一区二区三区四季av| 亚洲免费电影在线| 亚洲欧美色图小说| 一区二区三区在线免费| 一区二区在线观看视频| 亚洲人精品午夜| 亚洲精品国产无天堂网2021| 亚洲免费三区一区二区| 亚洲人成在线观看一区二区| 亚洲久草在线视频| 亚洲激情综合网| 亚洲成va人在线观看| 日本视频一区二区| 精久久久久久久久久久| 国内外精品视频| 国产成人精品在线看| 成人av网站在线| 日本高清免费不卡视频| 欧美日韩dvd在线观看| 在线播放中文一区|