From owner-freebsd-java Sun Mar 5 12:24:40 2000 Delivered-To: freebsd-java@freebsd.org Received: from nohow.demon.co.uk (nohow.demon.co.uk [212.228.18.189]) by hub.freebsd.org (Postfix) with ESMTP id 1B8AE37BAF5; Sun, 5 Mar 2000 12:24:24 -0800 (PST) (envelope-from noway@nohow.demon.co.uk) Received: from localhost (noway@localhost) by nohow.demon.co.uk (8.9.3/8.9.3) with ESMTP id UAA02651; Sun, 5 Mar 2000 20:22:26 GMT (envelope-from noway@nohow.demon.co.uk) Date: Sun, 5 Mar 2000 20:22:25 +0000 (GMT) From: Jose Marques To: Joe Shevland Cc: SADA Kenji , sada@FreeBSD.ORG, freebsd-java@FreeBSD.ORG Subject: RE: linux-jdk-1.2.2 ports In-Reply-To: Message-ID: X-No-Archive: yes MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Mon, 6 Mar 2000, Joe Shevland wrote: > This was sent roughly about a month ago and > worked out for me then... And the following patch for FreeBSD 4.0-CURRENT was posted to FreeBSD-current a few days ago: Perhaps somebody can test them and send-pr them? NB: I've not tried this patch myself yet. -8<- cut here ---- From=20salaman@teknos.com Sun Mar 5 20:20:33 2000 Date: Wed, 23 Feb 2000 16:40:43 -0400 From: Victor A. Salaman To: "'freebsd-current@freebsd.org'" , "'freebsd-emulation@freebsd.org'" Subject: Linux Emulation patches [ Part 1, Text/PLAIN 123 lines. ] [ Unable to print this part. ] Hi: =A0 I was wondering who mantains the Linux Emulation? I have some patches that were sent to me for FreeBSD-3.4, I have converted them to FreeBSD 4.0-Current for Linux emulation problems. Specifically anyone trying to use any program that opens a server socket will get bitten by the emulation unless these patches are applied ( JServ, Resin, Tomcat are some Java programs affected by this... and=A0since Sun hasn't release a JDK 1.2 for FreeBSD,=A0well, the only way to run some server programs=A0is with Blackdown, but=A0without these patches they are useless ). =A0 Anyways, after sending email to marcel and peter with the patches, I haven't even received a reply. So therefore, I'm posting them here, in case anyone wants to commit them at all. I feel 4.0 shouldn't go out with a known broken linux emulation. =A0 --- /usr/src/sys/i386/linux/linux_file.c=A0Wed Feb 23 16:11:50 2000 +++ /usr/src/sys/i386/linux/linux_file.orig=A0Wed Feb 23 16:11:37 2000 @@ -199,6 +199,12 @@ =A0=A0=A0=A0 } */ fcntl_args; =A0=A0=A0=A0 struct linux_flock linux_flock; =A0=A0=A0=A0 struct flock *bsd_flock; +=A0=A0=A0 struct filedesc *fdp; +=A0=A0=A0 struct file *fp; +=A0=A0=A0 struct vnode *vp; +=A0=A0=A0 long pgid; +=A0=A0=A0 struct pgrp *pgrp; +=A0=A0=A0 struct tty *tp; =A0=A0=A0=A0 caddr_t sg; =A0=A0=A0=A0 dev_t dev; =A0 @@ -283,9 +289,47 @@ =A0 =A0=A0=A0=A0 case LINUX_F_SETOWN: =A0=A0=A0=A0 case LINUX_F_GETOWN: -=A0fcntl_args.cmd =3D args->cmd =3D=3D LINUX_F_SETOWN ? F_SETOWN : F_GETOW= N; -=A0fcntl_args.arg =3D args->arg; -=A0return fcntl(p, &fcntl_args); +=A0/* +=A0 * We need to route around the normal fcntl() for these calls, +=A0 * since it uses TIOC{G,S}PGRP, which is too restrictive for +=A0 * Linux F_{G,S}ETOWN semantics. For sockets, this problem +=A0 * does not exist. +=A0 */ +=A0fdp =3D p->p_fd; +=A0if ((u_int)args->fd >=3D fdp->fd_nfiles || +=A0=A0(fp =3D fdp->fd_ofiles[args->fd]) =3D=3D NULL) +=A0=A0=A0=A0 return EBADF; +=A0if (fp->f_type =3D=3D DTYPE_SOCKET) { +=A0=A0=A0=A0 fcntl_args.cmd =3D args->cmd =3D=3D LINUX_F_SETOWN ? F_SETOWN= : F_GETOWN; +=A0=A0=A0 =A0=A0=A0=A0 fcntl_args.arg =3D args->arg; +=A0=A0=A0=A0 return fcntl(p, &fcntl_args); +=A0} +=A0vp =3D (struct vnode *)fp->f_data; +=A0dev =3D vn_todev(vp); +=A0if (dev =3D=3D NODEV) +=A0=A0=A0=A0 return EINVAL; +=A0if (!(devsw(dev)->d_flags & D_TTY)) +=A0=A0=A0=A0 return EINVAL; +=A0tp =3D dev->si_tty; +=A0if (!tp) +=A0=A0=A0=A0 return EINVAL; +=A0if (args->cmd =3D=3D LINUX_F_GETOWN) { +=A0=A0=A0=A0 p->p_retval[0] =3D tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID; +=A0=A0=A0=A0 return 0; +=A0} +=A0if ((long)args->arg <=3D 0) { +=A0=A0=A0=A0 pgid =3D -(long)args->arg; +=A0} else { +=A0=A0=A0=A0 struct proc *p1 =3D pfind((long)args->arg); +=A0=A0=A0=A0 if (p1 =3D=3D 0) +=A0=A0return (ESRCH); +=A0=A0=A0=A0 pgid =3D (long)p1->p_pgrp->pg_id; +=A0} +=A0pgrp =3D pgfind(pgid); +=A0if (pgrp =3D=3D NULL || pgrp->pg_session !=3D p->p_session) +=A0=A0=A0=A0 return EPERM; +=A0tp->t_pgrp =3D pgrp; +=A0return 0; =A0=A0=A0=A0 } =A0=A0=A0=A0 return EINVAL; =A0} --- /usr/src/sys/i386/linux/linux_socket.c=A0Wed Feb 23 16:11:50 2000 +++ /usr/src/sys/i386/linux/linux_socket.orig=A0Wed Feb 23 16:11:48 2000 @@ -441,11 +441,6 @@ =A0=A0caddr_t name; =A0=A0int *anamelen; =A0=A0=A0=A0 } */ bsd_args; -=A0=A0=A0 struct fcntl_args /* { -=A0=A0=A0 int fd; -=A0=A0=A0 int cmd; -=A0=A0=A0 long arg; -=A0=A0=A0 } */ f_args; =A0=A0=A0=A0 int error; =A0 =A0=A0=A0=A0 if ((error=3Dcopyin((caddr_t)args, (caddr_t)&linux_args, sizeof(linux_args)))) @@ -453,24 +448,7 @@ =A0=A0=A0=A0 bsd_args.s =3D linux_args.s; =A0=A0=A0=A0 bsd_args.name =3D (caddr_t)linux_args.addr; =A0=A0=A0=A0 bsd_args.anamelen =3D linux_args.namelen; - -=A0=A0=A0 if (error =3D oaccept(p, &bsd_args)) -=A0return error; -=A0=A0=A0 /* -=A0=A0=A0=A0 * linux appears not to copy flags from the parent socket to t= he -=A0=A0=A0=A0 * accepted one, so we must clear the flags in the new descrip= tor. -=A0=A0=A0=A0 */ -=A0=A0=A0 f_args.fd =3D p->p_retval[0]; -=A0=A0=A0 f_args.cmd =3D F_SETFL; -=A0=A0=A0 f_args.arg =3D 0; -=A0=A0 /* -=A0=A0=A0=A0 * we ignore errors here since otherwise we would have an open= file -=A0=A0=A0=A0 * descriptor that wasn't returned to the user. -=A0=A0=A0=A0 */ -=A0=A0=A0 (void) fcntl(p, &f_args); -=A0=A0=A0 /* put the file descriptor back as the return value */ -=A0=A0=A0 p->p_retval[0] =3D f_args.fd; -=A0=A0=A0 return 0; +=A0=A0=A0 return oaccept(p, &bsd_args); =A0} =A0 =A0struct linux_getsockname_args { -8<- cut here ---- --=20 Jose Marques To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message