[PATCH] linux get affinity syscall

Roman Divacky rdivacky at freebsd.org
Sun Mar 2 11:01:34 UTC 2008


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);

        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;

        if ((error = cpuset_getaffinity(td, &cga)) == 0)
                td->td_retval[0] = sizeof(cpumask_t);

        return (error);
}


can someone comment on this? thnx

roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20080302/7025f421/attachment.pgp


More information about the freebsd-emulation mailing list