From b40ce4165d5eb3a5de1515245055350ae3dbab8e Mon Sep 17 00:00:00 2001 From: Julian Elischer Date: Wed, 12 Sep 2001 08:38:13 +0000 Subject: KSE Milestone 2 Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha --- sys/dev/streams/streams.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'sys/dev/streams') diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index b1ccc35337d3..8d025760cea3 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -61,8 +61,8 @@ #include #include -static int svr4_soo_close __P((struct file *, struct proc *)); -static int svr4_ptm_alloc __P((struct proc *)); +static int svr4_soo_close __P((struct file *, struct thread *)); +static int svr4_ptm_alloc __P((struct thread *)); static d_open_t streamsopen; struct svr4_sockcache_entry { @@ -198,7 +198,7 @@ MODULE_VERSION(streams, 1); * routine. */ static int -streamsopen(dev_t dev, int oflags, int devtype, struct proc *p) +streamsopen(dev_t dev, int oflags, int devtype, struct thread *td) { int type, protocol; int fd; @@ -206,9 +206,10 @@ streamsopen(dev_t dev, int oflags, int devtype, struct proc *p) struct socket *so; int error; int family; + struct proc *p = td->td_proc; PROC_LOCK(p); - if (p->p_dupfd >= 0) { + if (td->td_dupfd >= 0) { PROC_UNLOCK(p); return ENODEV; } @@ -254,16 +255,16 @@ streamsopen(dev_t dev, int oflags, int devtype, struct proc *p) break; case dev_ptm: - return svr4_ptm_alloc(p); + return svr4_ptm_alloc(td); default: return EOPNOTSUPP; } - if ((error = falloc(p, &fp, &fd)) != 0) + if ((error = falloc(td, &fp, &fd)) != 0) return error; - if ((error = socreate(family, &so, type, protocol, p)) != 0) { + if ((error = socreate(family, &so, type, protocol, td)) != 0) { p->p_fd->fd_ofiles[fd] = 0; ffree(fp); return error; @@ -276,15 +277,16 @@ streamsopen(dev_t dev, int oflags, int devtype, struct proc *p) (void)svr4_stream_get(fp); PROC_LOCK(p); - p->p_dupfd = fd; + td->td_dupfd = fd; PROC_UNLOCK(p); return ENXIO; } static int -svr4_ptm_alloc(p) - struct proc *p; +svr4_ptm_alloc(td) + struct thread *td; { + struct proc *p = td->td_proc; /* * XXX this is very, very ugly. But I can't find a better * way that won't duplicate a big amount of code from @@ -319,13 +321,13 @@ svr4_ptm_alloc(p) if ((error = copyout(ptyname, path, sizeof(ptyname))) != 0) return error; - switch (error = open(p, &oa)) { + switch (error = open(td, &oa)) { case ENOENT: case ENXIO: return error; case 0: PROC_LOCK(p); - p->p_dupfd = p->p_retval[0]; + td->td_dupfd = td->td_retval[0]; PROC_UNLOCK(p); return ENXIO; default: @@ -394,14 +396,14 @@ svr4_delete_socket(p, fp) } static int -svr4_soo_close(struct file *fp, struct proc *p) +svr4_soo_close(struct file *fp, struct thread *td) { struct socket *so = (struct socket *)fp->f_data; /* CHECKUNIT_DIAG(ENXIO);*/ - svr4_delete_socket(p, fp); + svr4_delete_socket(td->td_proc, fp); free(so->so_emuldata, M_TEMP); - return soo_close(fp, p); + return soo_close(fp, td); return (0); } -- cgit v1.3