From owner-freebsd-java Thu Jun 1 6: 0:14 2000 Delivered-To: freebsd-java@freebsd.org Received: from kleopatra.acc.umu.se (kleopatra.acc.umu.se [130.239.18.150]) by hub.freebsd.org (Postfix) with ESMTP id D1A2A37B9B9 for ; Thu, 1 Jun 2000 06:00:03 -0700 (PDT) (envelope-from markush@acc.umu.se) Received: from mao.acc.umu.se (root@mao.acc.umu.se [130.239.18.154]) by kleopatra.acc.umu.se (8.10.1/8.10.1) with ESMTP id e51CxEW37940; Thu, 1 Jun 2000 14:59:14 +0200 Received: (from markush@localhost) by mao.acc.umu.se (8.9.3/8.9.3/Debian/GNU) id OAA26251; Thu, 1 Jun 2000 14:59:14 +0200 Date: Thu, 1 Jun 2000 14:59:14 +0200 From: Markus Holmberg To: freebsd-java@freebsd.org Cc: Marcel Moolenaar , John Rochester Subject: [markush@acc.umu.se: i386/18940: Reading from stdin using linux-jdk1.2.2 under Linux emulation fails] Message-ID: <20000601145914.A24627@acc.umu.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3-current-20000511i Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Just to notify people who experienced the problems with reading from stdin using linux-jdk-1.2.2: I have now sent a PR regarding this, just to get it on record. http://www.freebsd.org/cgi/query-pr.cgi?pr=18940 Regards, Markus. ----- Forwarded message from markush@acc.umu.se ----- From: markush@acc.umu.se To: FreeBSD-gnats-submit@FreeBSD.ORG Date: Thu, 1 Jun 2000 14:46:03 +0200 (CEST) Subject: i386/18940: Reading from stdin using linux-jdk1.2.2 under Linux emulation fails >Number: 18940 >Category: i386 >Synopsis: Reading from stdin using linux-jdk-1.2.2 under Linux emulation fails >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jun 01 05:50:00 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Markus Holmberg >Release: FreeBSD 4.0-STABLE i386 >Organization: n/a >Environment: FreeBSD 4.0-STABLE (also tested on 3.4-STABLE) linux-jdk-1.2.2 (port is submitted as pr, but not processed) >Description: Several people on the freebsd-java mailing list have reported problems with reading from standard input in linux-jdk-1.2.2. The problem is that input does not seem to be "sent" to the java process running under Linux emulation, which means that the Java program blocks in the i/o read operation (even though there is input to be read). >How-To-Repeat: Using the Java-snippet below, a dot character should be printed on a line for itself for each character that has been read in from stdin. This will not happen on a broken system (a few dots might be output, but after that it's blocked). (Read.java) -8<------------------------------------------ import java.io.*; public class Read { public static void main(String[] args) { try { while (System.in.read() != -1) { System.out.println("."); } } catch (IOException e) { System.err.println(e); } } } -8<------------------------------------------ >Fix: There was a patch (for 3.x) posted to the freebsd-java mailing list some months ago, but it is unclear why the patch works and if it causes any undesired side effects (since it removes a lot of code). Marcel Moolenaar (Linux emulation maintainer) has seen the patch but is not sure if it's safe to remove the code that the patch wants to remove. John Rochesters original patch for 3.x (only the patch for linux_file.c is relevant in the posting): http://docs.freebsd.org/cgi/getmsg.cgi?fetch=22905+0+archive/2000/freebsd-java/20000220.freebsd-java Here's the same patch adapted for 4.0-STABLE (May 29th): --- linux_file.c.orig Mon May 29 13:21:09 2000 +++ linux_file.c Mon May 29 13:26:05 2000 @@ -199,12 +199,6 @@ } */ fcntl_args; struct linux_flock linux_flock; struct flock *bsd_flock; - struct filedesc *fdp; - struct file *fp; - struct vnode *vp; - long pgid; - struct pgrp *pgrp; - struct tty *tp; caddr_t sg; dev_t dev; @@ -289,47 +283,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; - dev = vn_todev(vp); - if (dev == NODEV) - return EINVAL; - if (!(devsw(dev)->d_flags & D_TTY)) - return EINVAL; - tp = dev->si_tty; - if (!tp) - 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; } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message ----- End forwarded message ----- -- Markus Holmberg | Give me Unix or give me a typewriter. markush@acc.umu.se | http://www.freebsd.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message