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

Function intr_getaffinity

freebsd/kern/kern_intr.c:459–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457}
458
459int
460intr_getaffinity(int irq, int mode, void *m)
461{
462 struct intr_event *ie;
463 struct thread *td;
464 struct proc *p;
465 cpuset_t *mask;
466 lwpid_t id;
467 int error;
468
469 mask = m;
470 ie = intr_lookup(irq);
471 if (ie == NULL)
472 return (ESRCH);
473
474 error = 0;
475 CPU_ZERO(mask);
476 switch (mode) {
477 case CPU_WHICH_IRQ:
478 case CPU_WHICH_INTRHANDLER:
479 mtx_lock(&ie->ie_lock);
480 if (ie->ie_cpu == NOCPU)
481 CPU_COPY(cpuset_root, mask);
482 else
483 CPU_SET(ie->ie_cpu, mask);
484 mtx_unlock(&ie->ie_lock);
485 break;
486 case CPU_WHICH_ITHREAD:
487 mtx_lock(&ie->ie_lock);
488 if (ie->ie_thread == NULL) {
489 mtx_unlock(&ie->ie_lock);
490 CPU_COPY(cpuset_root, mask);
491 } else {
492 id = ie->ie_thread->it_thread->td_tid;
493 mtx_unlock(&ie->ie_lock);
494 error = cpuset_which(CPU_WHICH_TID, id, &p, &td, NULL);
495 if (error != 0)
496 return (error);
497 CPU_COPY(&td->td_cpuset->cs_mask, mask);
498 PROC_UNLOCK(p);
499 }
500 default:
501 return (EINVAL);
502 }
503 return (0);
504}
505
506int
507intr_event_destroy(struct intr_event *ie)

Callers 1

kern_cpuset_getaffinityFunction · 0.85

Calls 4

intr_lookupFunction · 0.85
cpuset_whichFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected