FreeBSD/sys/compat/linux/linux_misc.c
/*
 *  Set affinity of a process.
 */
Set affinity of a process.
Set affinity of a process .
int
linux_sched_setaffinity(struct thread *td,
    struct linux_sched_setaffinity_args *args)
{
	struct cpuset_setaffinity_args csa;
	struct thread *tdt;
#ifdef DEBUG
	if (ldebug(sched_setaffinity))
		printf(ARGS(sched_setaffinity, "%d, %d, *"), args->pid,
		    args->len);
#endif
	if (args->len < sizeof(cpuset_t))
		return (EINVAL);
	tdt = linux_tdfind(td, args->pid, -1);
	if (tdt == NULL)
		return (ESRCH);
	PROC_UNLOCK(tdt->td_proc);
	csa.level = CPU_LEVEL_WHICH;
	csa.which = CPU_WHICH_TID;
	csa.id = tdt->td_tid;
	csa.cpusetsize = sizeof(cpuset_t);
	csa.mask = (cpuset_t *) args->user_mask_ptr;
	return (sys_cpuset_setaffinity(td, &csa));
}
int linux_sched_setaffinity ( struct thread * td , struct linux_sched_setaffinity_args * args ) { struct cpuset_setaffinity_args csa ; struct thread * tdt ; #ifdef DEBUG if ( ldebug ( sched_setaffinity ) ) printf ( ARGS ( sched_setaffinity , " " ) , args -> pid , args -> len ) ; #endif if ( args -> len < sizeof ( cpuset_t ) ) return ( EINVAL ) ; tdt = linux_tdfind ( td , args -> pid , -1 ) ; if ( tdt == NULL ) return ( ESRCH ) ; PROC_UNLOCK ( tdt -> td_proc ) ; csa . level = CPU_LEVEL_WHICH ; csa . which = CPU_WHICH_TID ; csa . id = tdt -> td_tid ; csa . cpusetsize = sizeof ( cpuset_t ) ; csa . mask = ( cpuset_t * ) args -> user_mask_ptr ; return ( sys_cpuset_setaffinity ( td , & csa ) ) ; }
Set affinity of a process.
Set affinity of a process .