From owner-freebsd-java Tue Jul 16 7:45: 7 2002 Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BB7AA37B400 for ; Tue, 16 Jul 2002 07:44:59 -0700 (PDT) Received: from mta05-svc.ntlworld.com (mta05-svc.ntlworld.com [62.253.162.45]) by mx1.FreeBSD.org (Postfix) with ESMTP id CFEFA43E6A for ; Tue, 16 Jul 2002 07:44:58 -0700 (PDT) (envelope-from antony.t.curtis@ntlworld.com) Received: from ntlworld.com ([213.104.146.54]) by mta05-svc.ntlworld.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020716144457.NCDR28874.mta05-svc.ntlworld.com@ntlworld.com>; Tue, 16 Jul 2002 15:44:57 +0100 Message-ID: <3D3430CB.5000308@ntlworld.com> Date: Tue, 16 Jul 2002 15:42:19 +0100 From: Antony T Curtis User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.0.0) Gecko/20020715 X-Accept-Language: en-gb, en-us, en MIME-Version: 1.0 To: Marc van Kempen Cc: freebsd-java@FreeBSD.ORG Subject: Re: linux JRE 1.4 under linux compatibility only runs as root References: <20020711214742.C259A37B406@hub.freebsd.org> <20020711150748.B14694@alicia.nttmcl.com> <20020711174958.E32743@seaman.org> <3D2F4743.4010403@ntlworld.com> <3D33E0C3.4090405@bowtie.nl> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Marc van Kempen wrote: > Antony T Curtis wrote: > >> >> I gave this a go patching both sched_getscheduler and sched_getparam >> on -STABLE... >> >> The result: jdk1.4 works well on non-root account (tested running >> Java2D demo and SwingSet2) >> >> Thanks! >> >> Richard Seaman, Jr. wrote: >> >>> On Thu, Jul 11, 2002 at 03:07:48PM -0700, Shannon -jj Behrens wrote: >> >> >> >> >> >>> >>> Not hard at all. The perms in sched_getscheduler in -stable are silly. >>> (also sched_getparam). Just try changing it to something like the patch >>> below (note that I don't have a stable system at the moment, so I don't >>> guarantee it works, nor that it even compiles -- take it as a guide >>> only). >> >> >> >> >> > > Hi Antony, > > Could you post your patch? I tried Richard's patch on a 4.5 system, but > unfortunately without succes. > > Marc. The following is from my 4.6-STABLE system --- p1003_1b.c.orig Thu Aug 3 02:09:59 2000 +++ p1003_1b.c Fri Jul 12 21:44:24 2002 @@ -178,15 +178,22 @@ int sched_getparam(struct proc *p, struct sched_getparam_args *uap) { - int e; + int e = 0; + struct proc *targetp; struct sched_param sched_param; - (void) (0 - || (e = p31b_proc(p, uap->pid, &p)) - || (e = ksched_getparam(&p->p_retval[0], ksched, p, &sched_param)) - ); + if (uap->pid == 0) { + targetp = p; + } else { + targetp = pfind(uap->pid); + if (targetp == NULL) + e = ESRCH; + } + + if (e == 0) + e = ksched_getparam(&p->p_retval[0], ksched, targetp, &sched_param); - if (!e) + if (e == 0) copyout(&sched_param, uap->param, sizeof(sched_param)); return e; @@ -211,13 +218,21 @@ int sched_getscheduler(struct proc *p, struct sched_getscheduler_args *uap) { - int e; - (void) (0 - || (e = p31b_proc(p, uap->pid, &p)) - || (e = ksched_getscheduler(&p->p_retval[0], ksched, p)) - ); + int e = 0; + struct proc *targetp; - return e; + if (uap->pid == 0) { + targetp = p; + } else { + targetp = pfind(uap->pid); + if (targetp == NULL) + e = ESRCH; + } + + if (e == 0) + e = ksched_getscheduler(&p->p_retval[0], ksched, targetp); + + return (e); } int sched_yield(struct proc *p, struct sched_yield_args *uap) -- Antony T Curtis BSc Unix Analyst Programmer http://homepage.ntlworld.com/antony.t.curtis/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message