update from Rick Macklem to generate proper error messages
[unix-history] / usr / src / sys / kern / uipc_pipe.c
CommitLineData
da7c5cc6
KM
1/*
2 * Copyright (c) 1982 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 *
6 * @(#)uipc_pipe.c 6.3 (Berkeley) %G%
7 */
f498603d 8
94368568
JB
9#include "param.h"
10#include "mbuf.h"
11#include "protosw.h"
12#include "socket.h"
13#include "socketvar.h"
14#include "unpcb.h"
f498603d 15
f498603d
BJ
16#define PIPSIZ 4096
17
18/*
c87c2ad7
BJ
19 * Sneakily connect a pipe from wso to rso.
20 * This will get cleaned up when socketpair is added.
f498603d 21 */
2b4b57cd 22piconnect(wso, rso)
f498603d
BJ
23 struct socket *wso, *rso;
24{
25
de48daf3 26 /* when we reserve memory this routine may fail */
c87c2ad7
BJ
27 sotounpcb(wso)->unp_conn = sotounpcb(rso);
28 sotounpcb(rso)->unp_conn = sotounpcb(wso);
b1cf15af
BJ
29 wso->so_snd.sb_hiwat = PIPSIZ;
30 wso->so_snd.sb_mbmax = 2*PIPSIZ;
f498603d 31 wso->so_state |= SS_ISCONNECTED|SS_CANTRCVMORE;
b1cf15af
BJ
32 rso->so_rcv.sb_hiwat = 0;
33 rso->so_rcv.sb_mbmax = 0;
f498603d
BJ
34 rso->so_state |= SS_ISCONNECTED|SS_CANTSENDMORE;
35 return (1);
36}