Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Mar 2008 12:11:08 -1000 (HST)
From:      Jeff Roberson <jroberson@chesapeake.net>
To:        Roman Divacky <rdivacky@freebsd.org>
Cc:        emulation@freebsd.org, jeff@freebsd.org
Subject:   Re: [PATCH] linux get affinity syscall
Message-ID:  <20080303121025.K920@desktop>
In-Reply-To: <20080303144152.GA47887@freebsd.org>
References:  <20080302110130.GA30563@freebsd.org> <20080303022202.S920@desktop> <20080303144152.GA47887@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Mon, 3 Mar 2008, Roman Divacky wrote:

> On Mon, Mar 03, 2008 at 02:23:49AM -1000, Jeff Roberson wrote:
>>
>> 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.
>
> no.. its specified in  bytes

You are right.  So it is with fdsets.  Please hold on and I'll change 
cpuset to be bytes as well.

>
>>>
>>>       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.
>
> ok.. will do it like that
>
> thnx for the comments, can anyone test the stuff? (I have access
> to UP only ATM)
>
> roman
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080303121025.K920>