Deleted Added
full compact
streams.c (49344) streams.c (49413)
1/*
2 * Copyright (c) 1998 Mark Newton
3 * Copyright (c) 1994 Christos Zoulas
4 * Copyright (c) 1997 Todd Vierling
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * Stolen from NetBSD /sys/compat/svr4/svr4_net.c. Pseudo-device driver
30 * skeleton produced from /usr/share/examples/drivers/make_pseudo_driver.sh
31 * in 3.0-980524-SNAP then hacked a bit (but probably not enough :-).
32 *
1/*
2 * Copyright (c) 1998 Mark Newton
3 * Copyright (c) 1994 Christos Zoulas
4 * Copyright (c) 1997 Todd Vierling
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * Stolen from NetBSD /sys/compat/svr4/svr4_net.c. Pseudo-device driver
30 * skeleton produced from /usr/share/examples/drivers/make_pseudo_driver.sh
31 * in 3.0-980524-SNAP then hacked a bit (but probably not enough :-).
32 *
33 * $Id$
33 * $Id: streams.c,v 1.8 1999/08/01 12:51:06 newton Exp $
34 */
35
36#include "streams.h" /* generated file.. defines NSTREAMS */
37#include "opt_devfs.h"
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/kernel.h> /* SYSINIT stuff */
41#include <sys/conf.h> /* cdevsw stuff */

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

246 return error;
247
248 if ((error = socreate(family, &so, type, protocol, p)) != 0) {
249 p->p_fd->fd_ofiles[fd] = 0;
250 ffree(fp);
251 return error;
252 }
253
34 */
35
36#include "streams.h" /* generated file.. defines NSTREAMS */
37#include "opt_devfs.h"
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/kernel.h> /* SYSINIT stuff */
41#include <sys/conf.h> /* cdevsw stuff */

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

246 return error;
247
248 if ((error = socreate(family, &so, type, protocol, p)) != 0) {
249 p->p_fd->fd_ofiles[fd] = 0;
250 ffree(fp);
251 return error;
252 }
253
254 fp->f_data = (caddr_t)so;
254 fp->f_flag = FREAD|FWRITE;
255 fp->f_flag = FREAD|FWRITE;
255 fp->f_type = DTYPE_SOCKET;
256 fp->f_ops = &svr4_netops;
256 fp->f_ops = &svr4_netops;
257 fp->f_type = DTYPE_SOCKET;
257
258
258 fp->f_data = (caddr_t)so;
259 (void)svr4_stream_get(fp);
260 p->p_dupfd = fd;
261 return ENXIO;
262}
263
264static int
265svr4_ptm_alloc(p)
266 struct proc *p;

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

329 return NULL;
330
331 so = (struct socket *) fp->f_data;
332
333 if (so->so_emuldata)
334 return so->so_emuldata;
335
336 /* Allocate a new one. */
259 (void)svr4_stream_get(fp);
260 p->p_dupfd = fd;
261 return ENXIO;
262}
263
264static int
265svr4_ptm_alloc(p)
266 struct proc *p;

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

329 return NULL;
330
331 so = (struct socket *) fp->f_data;
332
333 if (so->so_emuldata)
334 return so->so_emuldata;
335
336 /* Allocate a new one. */
337 fp->f_ops = &svr4_netops;
338 st = malloc(sizeof(struct svr4_strm), M_TEMP, M_WAITOK);
339 st->s_family = so->so_proto->pr_domain->dom_family;
340 st->s_cmd = ~0;
341 st->s_afd = -1;
342 st->s_eventmask = 0;
343 so->so_emuldata = st;
337 st = malloc(sizeof(struct svr4_strm), M_TEMP, M_WAITOK);
338 st->s_family = so->so_proto->pr_domain->dom_family;
339 st->s_cmd = ~0;
340 st->s_afd = -1;
341 st->s_eventmask = 0;
342 so->so_emuldata = st;
343 fp->f_ops = &svr4_netops;
344
345 return st;
346}
347
348void
349svr4_delete_socket(p, fp)
350 struct proc *p;
351 struct file *fp;

--- 32 unchanged lines hidden ---
344
345 return st;
346}
347
348void
349svr4_delete_socket(p, fp)
350 struct proc *p;
351 struct file *fp;

--- 32 unchanged lines hidden ---