Deleted Added
full compact
sys_socket.c (41086) sys_socket.c (43408)
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.18 1998/06/07 17:11:40 dfr Exp $
34 * $Id: sys_socket.c,v 1.19 1998/11/11 10:03:56 truckman Exp $
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/file.h>
40#include <sys/protosw.h>
41#include <sys/socket.h>
42#include <sys/socketvar.h>
43#include <sys/filio.h> /* XXX */
44#include <sys/sockio.h>
45#include <sys/stat.h>
46#include <sys/uio.h>
47#include <sys/filedesc.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/file.h>
40#include <sys/protosw.h>
41#include <sys/socket.h>
42#include <sys/socketvar.h>
43#include <sys/filio.h> /* XXX */
44#include <sys/sockio.h>
45#include <sys/stat.h>
46#include <sys/uio.h>
47#include <sys/filedesc.h>
48
49#include <net/if.h>
50#include <net/route.h>
51
52static int soo_read __P((struct file *fp, struct uio *uio,
52int soo_read __P((struct file *fp, struct uio *uio,
53 struct ucred *cred));
53 struct ucred *cred));
54static int soo_write __P((struct file *fp, struct uio *uio,
54int soo_write __P((struct file *fp, struct uio *uio,
55 struct ucred *cred));
55 struct ucred *cred));
56static int soo_close __P((struct file *fp, struct proc *p));
56int soo_close __P((struct file *fp, struct proc *p));
57
58struct fileops socketops =
59 { soo_read, soo_write, soo_ioctl, soo_poll, soo_close };
60
61/* ARGSUSED */
57
58struct fileops socketops =
59 { soo_read, soo_write, soo_ioctl, soo_poll, soo_close };
60
61/* ARGSUSED */
62static int
62int
63soo_read(fp, uio, cred)
64 struct file *fp;
65 struct uio *uio;
66 struct ucred *cred;
67{
68 struct socket *so = (struct socket *)fp->f_data;
69 return so->so_proto->pr_usrreqs->pru_soreceive(so, 0, uio, 0, 0, 0);
70}
71
72/* ARGSUSED */
63soo_read(fp, uio, cred)
64 struct file *fp;
65 struct uio *uio;
66 struct ucred *cred;
67{
68 struct socket *so = (struct socket *)fp->f_data;
69 return so->so_proto->pr_usrreqs->pru_soreceive(so, 0, uio, 0, 0, 0);
70}
71
72/* ARGSUSED */
73static int
73int
74soo_write(fp, uio, cred)
75 struct file *fp;
76 struct uio *uio;
77 struct ucred *cred;
78{
79 struct socket *so = (struct socket *)fp->f_data;
80 return so->so_proto->pr_usrreqs->pru_sosend(so, 0, uio, 0, 0, 0,
81 uio->uio_procp);

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

163{
164
165 bzero((caddr_t)ub, sizeof (*ub));
166 ub->st_mode = S_IFSOCK;
167 return ((*so->so_proto->pr_usrreqs->pru_sense)(so, ub));
168}
169
170/* ARGSUSED */
74soo_write(fp, uio, cred)
75 struct file *fp;
76 struct uio *uio;
77 struct ucred *cred;
78{
79 struct socket *so = (struct socket *)fp->f_data;
80 return so->so_proto->pr_usrreqs->pru_sosend(so, 0, uio, 0, 0, 0,
81 uio->uio_procp);

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

163{
164
165 bzero((caddr_t)ub, sizeof (*ub));
166 ub->st_mode = S_IFSOCK;
167 return ((*so->so_proto->pr_usrreqs->pru_sense)(so, ub));
168}
169
170/* ARGSUSED */
171static int
171int
172soo_close(fp, p)
173 struct file *fp;
174 struct proc *p;
175{
176 int error = 0;
177
178 if (fp->f_data)
179 error = soclose((struct socket *)fp->f_data);
180 fp->f_data = 0;
181 return (error);
182}
172soo_close(fp, p)
173 struct file *fp;
174 struct proc *p;
175{
176 int error = 0;
177
178 if (fp->f_data)
179 error = soclose((struct socket *)fp->f_data);
180 fp->f_data = 0;
181 return (error);
182}