MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kern_cpuset_getid

Function kern_cpuset_getid

freebsd/kern/kern_cpuset.c:1813–1861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1811}
1812
1813int
1814kern_cpuset_getid(struct thread *td, cpulevel_t level, cpuwhich_t which,
1815 id_t id, cpusetid_t *setid)
1816{
1817 struct cpuset *nset;
1818 struct cpuset *set;
1819 struct thread *ttd;
1820 struct proc *p;
1821 cpusetid_t tmpid;
1822 int error;
1823
1824 if (level == CPU_LEVEL_WHICH && which != CPU_WHICH_CPUSET)
1825 return (EINVAL);
1826 error = cpuset_which(which, id, &p, &ttd, &set);
1827 if (error)
1828 return (error);
1829 switch (which) {
1830 case CPU_WHICH_TID:
1831 case CPU_WHICH_PID:
1832 thread_lock(ttd);
1833 set = cpuset_refbase(ttd->td_cpuset);
1834 thread_unlock(ttd);
1835 PROC_UNLOCK(p);
1836 break;
1837 case CPU_WHICH_CPUSET:
1838 case CPU_WHICH_JAIL:
1839 break;
1840 case CPU_WHICH_IRQ:
1841 case CPU_WHICH_DOMAIN:
1842 return (EINVAL);
1843 }
1844 switch (level) {
1845 case CPU_LEVEL_ROOT:
1846 nset = cpuset_refroot(set);
1847 cpuset_rel(set);
1848 set = nset;
1849 break;
1850 case CPU_LEVEL_CPUSET:
1851 break;
1852 case CPU_LEVEL_WHICH:
1853 break;
1854 }
1855 tmpid = set->cs_id;
1856 cpuset_rel(set);
1857 if (error == 0)
1858 error = copyout(&tmpid, setid, sizeof(tmpid));
1859
1860 return (error);
1861}
1862
1863#ifndef _SYS_SYSPROTO_H_
1864struct cpuset_getaffinity_args {

Callers 1

sys_cpuset_getidFunction · 0.85

Calls 5

cpuset_whichFunction · 0.85
cpuset_refbaseFunction · 0.85
cpuset_refrootFunction · 0.85
cpuset_relFunction · 0.85
copyoutFunction · 0.50

Tested by

no test coverage detected