Deleted Added
full compact
sys_socket.c (8876) sys_socket.c (12819)
1/*
2 * Copyright (c) 1982, 1986, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)sys_socket.c 8.1 (Berkeley) 6/10/93
1/*
2 * Copyright (c) 1982, 1986, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)sys_socket.c 8.1 (Berkeley) 6/10/93
34 * $Id: sys_socket.c,v 1.4 1994/10/02 17:35:25 phk Exp $
34 * $Id: sys_socket.c,v 1.5 1995/05/30 08:05:59 rgrimes Exp $
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/proc.h>
40#include <sys/file.h>
41#include <sys/mbuf.h>
42#include <sys/protosw.h>
43#include <sys/socket.h>
44#include <sys/stat.h>
45#include <sys/socketvar.h>
46#include <sys/ioctl.h>
47#include <sys/stat.h>
48
49#include <net/if.h>
50#include <net/route.h>
51
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/proc.h>
40#include <sys/file.h>
41#include <sys/mbuf.h>
42#include <sys/protosw.h>
43#include <sys/socket.h>
44#include <sys/stat.h>
45#include <sys/socketvar.h>
46#include <sys/ioctl.h>
47#include <sys/stat.h>
48
49#include <net/if.h>
50#include <net/route.h>
51
52static int soo_read __P((struct file *fp, struct uio *uio,
53 struct ucred *cred));
54static int soo_write __P((struct file *fp, struct uio *uio,
55 struct ucred *cred));
56static int soo_close __P((struct file *fp, struct proc *p));
57
52struct fileops socketops =
53 { soo_read, soo_write, soo_ioctl, soo_select, soo_close };
54
55/* ARGSUSED */
58struct fileops socketops =
59 { soo_read, soo_write, soo_ioctl, soo_select, soo_close };
60
61/* ARGSUSED */
56int
62static int
57soo_read(fp, uio, cred)
58 struct file *fp;
59 struct uio *uio;
60 struct ucred *cred;
61{
62
63 return (soreceive((struct socket *)fp->f_data, (struct mbuf **)0,
64 uio, (struct mbuf **)0, (struct mbuf **)0, (int *)0));
65}
66
67/* ARGSUSED */
63soo_read(fp, uio, cred)
64 struct file *fp;
65 struct uio *uio;
66 struct ucred *cred;
67{
68
69 return (soreceive((struct socket *)fp->f_data, (struct mbuf **)0,
70 uio, (struct mbuf **)0, (struct mbuf **)0, (int *)0));
71}
72
73/* ARGSUSED */
68int
74static int
69soo_write(fp, uio, cred)
70 struct file *fp;
71 struct uio *uio;
72 struct ucred *cred;
73{
74
75 return (sosend((struct socket *)fp->f_data, (struct mbuf *)0,
76 uio, (struct mbuf *)0, (struct mbuf *)0, 0));

--- 109 unchanged lines hidden (view full) ---

186 bzero((caddr_t)ub, sizeof (*ub));
187 ub->st_mode = S_IFSOCK;
188 return ((*so->so_proto->pr_usrreq)(so, PRU_SENSE,
189 (struct mbuf *)ub, (struct mbuf *)0,
190 (struct mbuf *)0));
191}
192
193/* ARGSUSED */
75soo_write(fp, uio, cred)
76 struct file *fp;
77 struct uio *uio;
78 struct ucred *cred;
79{
80
81 return (sosend((struct socket *)fp->f_data, (struct mbuf *)0,
82 uio, (struct mbuf *)0, (struct mbuf *)0, 0));

--- 109 unchanged lines hidden (view full) ---

192 bzero((caddr_t)ub, sizeof (*ub));
193 ub->st_mode = S_IFSOCK;
194 return ((*so->so_proto->pr_usrreq)(so, PRU_SENSE,
195 (struct mbuf *)ub, (struct mbuf *)0,
196 (struct mbuf *)0));
197}
198
199/* ARGSUSED */
194int
200static int
195soo_close(fp, p)
196 struct file *fp;
197 struct proc *p;
198{
199 int error = 0;
200
201 if (fp->f_data)
202 error = soclose((struct socket *)fp->f_data);
203 fp->f_data = 0;
204 return (error);
205}
201soo_close(fp, p)
202 struct file *fp;
203 struct proc *p;
204{
205 int error = 0;
206
207 if (fp->f_data)
208 error = soclose((struct socket *)fp->f_data);
209 fp->f_data = 0;
210 return (error);
211}