From owner-freebsd-java Thu Feb 3 9:56:27 2000 Delivered-To: freebsd-java@freebsd.org Received: from lugh.relay.co.uk (lugh.relay.co.uk [194.72.177.254]) by builder.freebsd.org (Postfix) with ESMTP id 006C64059 for ; Thu, 3 Feb 2000 09:56:14 -0800 (PST) Received: from raku.enetgroup.co.uk ([194.72.178.7]) by lugh.relay.co.uk (Netscape Messaging Server 4.15) with ESMTP id FPD8G500.800 for ; Thu, 3 Feb 2000 17:55:17 +0000 Content-Length: 4391 Message-ID: X-Mailer: XFMail 1.3 [p0] on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="_=XFMail.1.3.p0.FreeBSD:000203175550:345=_" Date: Thu, 03 Feb 2000 17:55:51 -0000 (GMT) From: John Rochester To: freebsd-java@FreeBSD.org Subject: patches to linux module Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org This message is in MIME format --_=XFMail.1.3.p0.FreeBSD:000203175550:345=_ Content-Type: text/plain; charset=us-ascii These patches only work on FreeBSD 3.4-STABLE - anything else, and you're on your own. Save the patches in a file, say /tmp/patches become root cd /usr/src/sys/i386/linux patch -p0 < /tmp/patches if the patches succeed, (they should fail only if you are not 3.4-STABLE) cd ../../modules/linux make I get some warnings about linux_sysent.c - they're ok. if the make succeeds, make install make clean Now you have two choices: The easy choice: reboot The fast choice: kill all processes using linux emulation kldunload linux kldload linux ---- John Rochester, Java Developer e-Net Software, Bath, UK jr@cs.mun.ca john.rochester@enetgroup.co.uk --_=XFMail.1.3.p0.FreeBSD:000203175550:345=_ Content-Disposition: attachment; filename="patches" Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii; name=patches; SizeOnDisk=3231 --- linux_socket.c.orig Wed Feb 2 12:49:23 2000 +++ linux_socket.c Wed Feb 2 13:00:25 2000 @@ -441,6 +441,11 @@ caddr_t name; int *anamelen; } */ bsd_args; + struct fcntl_args /* { + int fd; + int cmd; + long arg; + } */ f_args; int error; if ((error=copyin((caddr_t)args, (caddr_t)&linux_args, sizeof(linux_args))) ) @@ -448,7 +453,23 @@ bsd_args.s = linux_args.s; bsd_args.name = (caddr_t)linux_args.addr; bsd_args.anamelen = linux_args.namelen; - return oaccept(p, &bsd_args); + if (error = oaccept(p, &bsd_args)) + return error; + /* + * linux appears not to copy flags from the parent socket to the + * accepted one, so we must clear the flags in the new descriptor. + */ + f_args.fd = p->p_retval[0]; + f_args.cmd = F_SETFL; + f_args.arg = 0; + /* + * we ignore errors here since otherwise we would have an open file + * descriptor that wasn't returned to the user. + */ + (void) fcntl(p, &f_args); + /* put the file descriptor back as the return value */ + p->p_retval[0] = f_args.fd; + return 0; } struct linux_getsockname_args { --- linux_file.c.orig Wed Feb 2 12:49:18 2000 +++ linux_file.c Wed Feb 2 13:06:27 2000 @@ -196,18 +196,10 @@ } */ fcntl_args; struct linux_flock linux_flock; struct flock *bsd_flock; - struct filedesc *fdp; - struct file *fp; - struct vnode *vp; - struct vattr va; - long pgid; - struct pgrp *pgrp; - struct tty *tp, *(*d_tty) __P((dev_t)); caddr_t sg; sg = stackgap_init(); bsd_flock = (struct flock *)stackgap_alloc(&sg, sizeof(struct flock)); - d_tty = NULL; #ifdef DEBUG printf("Linux-emul(%d): fcntl(%d, %08x, *)\n", @@ -286,47 +278,9 @@ case LINUX_F_SETOWN: case LINUX_F_GETOWN: - /* - * We need to route around the normal fcntl() for these calls, - * since it uses TIOC{G,S}PGRP, which is too restrictive for - * Linux F_{G,S}ETOWN semantics. For sockets, this problem - * does not exist. - */ - fdp = p->p_fd; - if ((u_int)args->fd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[args->fd]) == NULL) - return EBADF; - if (fp->f_type == DTYPE_SOCKET) { - fcntl_args.cmd = args->cmd == LINUX_F_SETOWN ? F_SETOWN : F_GETOWN; - fcntl_args.arg = args->arg; - return fcntl(p, &fcntl_args); - } - vp = (struct vnode *)fp->f_data; - if (vp->v_type != VCHR) - return EINVAL; - if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p))) - return error; - - d_tty = cdevsw[major(va.va_rdev)]->d_devtotty; - if (!d_tty || (!(tp = (*d_tty)(va.va_rdev)))) - return EINVAL; - if (args->cmd == LINUX_F_GETOWN) { - p->p_retval[0] = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID; - return 0; - } - if ((long)args->arg <= 0) { - pgid = -(long)args->arg; - } else { - struct proc *p1 = pfind((long)args->arg); - if (p1 == 0) - return (ESRCH); - pgid = (long)p1->p_pgrp->pg_id; - } - pgrp = pgfind(pgid); - if (pgrp == NULL || pgrp->pg_session != p->p_session) - return EPERM; - tp->t_pgrp = pgrp; - return 0; + fcntl_args.cmd = args->cmd == LINUX_F_SETOWN ? F_SETOWN : F_GETOWN; + fcntl_args.arg = args->arg; + return fcntl(p, &fcntl_args); } return EINVAL; } --_=XFMail.1.3.p0.FreeBSD:000203175550:345=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message