home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
comm
/
amitcp-3.0ß2.lha
/
AmiTCP
/
src
/
amitcp
/
kern
/
uipc_socket.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-12-18
|
32KB
|
1,305 lines
RCS_ID_C="$Id: uipc_socket.c,v 1.28 1993/12/18 15:28:09 jraja Exp $";
/*
* Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
* Helsinki University of Technology, Finland.
* All rights reserved.
*
* HISTORY
* $Log: uipc_socket.c,v $
* Revision 1.28 1993/12/18 15:28:09 jraja
* Disabled code using M_EOR, unless USE_M_EOR is defined.
*
* Revision 1.27 1993/11/17 12:12:48 jraja
* Added check for the SB_SEL flag to sohasoutofband() to prevent superfluous
* calls to selwakeup().
*
* Revision 1.26 1993/11/17 09:20:33 jraja
* Fixed selwakeup bug in sohasoutofband(), there was mixture of net2 & bsdss
* -style selwakeup usage.
*
* Revision 1.25 1993/06/04 11:16:15 jraja
* Fixes for first public release.
*
* Revision 1.24 1993/05/17 01:07:47 ppessi
* Changed RCS version.
*
* Revision 1.23 1993/04/28 13:42:48 too
* Fixed setting of linger value in getsockopt()
*
* Revision 1.22 93/04/26 11:54:49 11:54:49 too (Tomi Ollila)
* Changed include paths of amiga_api.h, amiga_libcallentry.h and amiga_raf.h
* from kern to api
*
* Revision 1.21 93/04/24 22:45:52 22:45:52 jraja (Jarno Tapio Rajahalme)
* Removed Define for USECLUSTERS
*
* Revision 1.20 93/04/24 17:52:15 17:52:15 jraja (Jarno Tapio Rajahalme)
* Changed MCLBYTES to mbconf.mclbytes.
*
* Revision 1.19 93/04/12 00:37:56 00:37:56 jraja (Jarno Tapio Rajahalme)
* Added #include <kern/amiga_includes.h> for Signal().
*
* Revision 1.18 93/04/12 00:29:11 00:29:11 jraja (Jarno Tapio Rajahalme)
* Added signalling of task (SIGURG).
*
* Revision 1.17 93/04/11 22:28:37 22:28:37 jraja (Jarno Tapio Rajahalme)
* Removed one extra argument from call to pr_usrreq.
* Added parenthesis around &&'s inside ||'s.
*
* Revision 1.16 93/04/06 15:16:08 15:16:08 jraja (Jarno Tapio Rajahalme)
* Changed spl function return value storage to spl_t,
* changed bcopys and bzeros to aligned and/or const when possible,
* added inclusion of conf.h to every .c file.
*
* Revision 1.15 93/03/21 16:59:37 16:59:37 jraja (Jarno Tapio Rajahalme)
* Changed linger time to seconds. Removed obsolete test on timeout value for
* send/receive timeout (was checked to fit in a short, but since the timeouts are
* now timeval's the check is not needed.
*
* Revision 1.14 93/03/19 14:14:56 14:14:56 too (Tomi Ollila)
* Code changes at night 17-18 March 1993
*
* Revision 1.13 93/03/17 12:06:35 12:06:35 jraja (Jarno Tapio Rajahalme)
* Fixed tsleep() call to find socket base if necessary and to give NULL
* timeout if timeval is all zeroes.
*
* Revision 1.12 93/03/16 19:47:16 19:47:16 too (Tomi Ollila)
* uses multible mbufs (broken)
*
* Revision 1.11 93/03/13 17:13:06 17:13:06 ppessi (Pekka Pessi)
* Fixed bugs with variable initializations. Works with UDP.
*
* Revision 1.10 93/03/05 03:26:23 03:26:23 ppessi (Pekka Pessi)
* Compiles with SASC. Initial test version.
*
* Revision 1.9 93/03/04 10:57:17 10:57:17 jraja (Jarno Tapio Rajahalme)
* Added prototype inclusion for kern/uipc_domain_protos_.h.h
*
* Revision 1.8 93/03/04 09:53:45 09:53:45 jraja (Jarno Tapio Rajahalme)
* Removed some redundant includes.
*
* Revision 1.7 93/02/27 11:03:55 11:03:55 too (Tomi Ollila)
* Added Prototypes
*
* Revision 1.6 93/02/25 13:01:48 13:01:48 too (Tomi Ollila)
* Added static inlines, sys/cdefs etc.
*
* Revision 1.5 93/02/24 18:14:47 18:14:47 too (Tomi Ollila)
* Compiles. support for so_linger and sb_timeo as struct timeval type added.
*
* Revision 1.4 93/02/23 11:37:56 11:37:56 too (Tomi Ollila)
* Made AMITCP combatible, not compiled yet
*
* Revision 1.3 93/01/09 12:56:26 12:56:26 jraja (Jarno Tapio Rajahalme)
* Added #ifdef USECLUSTERS to disable cluster dependant code.
*
* Revision 1.2 92/11/20 15:14:49 15:14:49 jraja (Jarno Tapio Rajahalme)
* Added #ifndef AMITCP's to make this compile.
*
* Revision 1.1 92/11/19 12:07:27 12:07:27 jraja (Jarno Tapio Rajahalme)
* Initial revision
*
*
*/
/*
* Mach Operating System
* Copyright (c) 1992 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* HISTORY
* Log: uipc_socket.c,v
* Revision 2.1 92/04/21 17:12:32 rwd
* BSDSS
*
*
*/
/*
* Copyright (c) 1982, 1986, 1988, 1990 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_socket.c 7.28 (Berkeley) 5/4/91
*/
#include <conf.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/domain.h>
#include <sys/kernel.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/synch.h>
#include <api/amiga_api.h>
#include <kern/amiga_includes.h>
#include <kern/uipc_socket_protos.h>
#include <kern/uipc_socket2_protos.h>
#include <kern/uipc_domain_protos.h>
#include <kern/amiga_select_protos.h>
/*
* Socket operation routines.
* These routines are called by the routines in
* sys_socket.c or from a system process, and
* implement the semantics of socket operations by
* switching out to the protocol specific routines.
*/
int
socreate(dom, aso, type, proto)
int dom;
struct socket **aso;
register int type;
int proto;
{
#ifndef AMITCP
struct proc *p = (struct proc*)cthread_data(cthread_self());
#endif /* AMITCP */
register struct protosw *prp;
register struct socket *so;
register int error;
if (proto)
prp = pffindproto(dom, proto, type);
else
prp = pffindtype(dom,