From owner-freebsd-emulation@FreeBSD.ORG Mon Mar 3 12:21:37 2008 Return-Path: Delivered-To: emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1D6C106566C; Mon, 3 Mar 2008 12:21:37 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from webaccess-cl.virtdom.com (webaccess-cl.virtdom.com [216.240.101.25]) by mx1.freebsd.org (Postfix) with ESMTP id 84DEE8FC20; Mon, 3 Mar 2008 12:21:37 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from [192.168.1.107] (cpe-24-94-75-93.hawaii.res.rr.com [24.94.75.93]) (authenticated bits=0) by webaccess-cl.virtdom.com (8.13.6/8.13.6) with ESMTP id m23CLYDJ024768; Mon, 3 Mar 2008 07:21:36 -0500 (EST) (envelope-from jroberson@chesapeake.net) Date: Mon, 3 Mar 2008 02:23:49 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Roman Divacky In-Reply-To: <20080302110130.GA30563@freebsd.org> Message-ID: <20080303022202.S920@desktop> References: <20080302110130.GA30563@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: emulation@freebsd.org, jeff@freebsd.org Subject: Re: [PATCH] linux get affinity syscall X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Mar 2008 12:21:37 -0000 On Sun, 2 Mar 2008, Roman Divacky wrote: > hi.. > > jeff commited his cpu set and I tried to map that to linuxulator > version of linux_sched_getaffinity(), the current (untested) code > looks like this: > > /* > * Get affinity of a process > */ > int > linux_sched_getaffinity(struct thread *td, > struct linux_sched_getaffinity_args *args) > { > int error; > struct cpuset_getaffinity_args cga; > > if (args->len < sizeof(cpumask_t)) > return (EINVAL); Len here is in number of bits I believe as it is for our cpusetsize. > > cga.level = CPU_LEVEL_WHICH; > cga.which = CPU_WHICH_PID; > cga.id = args->pid; > cga.cpusetsize = sizeof(cpumask_t) * NBBY; > cga.mask = (long *) args->user_mask_ptr; Our call will accept larger values and zero fill any bits we don't use. It should be safe to pass the original len. > > if ((error = cpuset_getaffinity(td, &cga)) == 0) > td->td_retval[0] = sizeof(cpumask_t); > > return (error); > } Thanks, Jeff > > > can someone comment on this? thnx > > roman >