kernel/proc/interrupt.c
/*
 * Called by CloseHandle() to free an interrupt handler.  If there are no
 * handlers for a given IRQ the interrupt is masked.
 *
 * TODO: Need to prevent forking of interrupt descriptors (dup in same process is ok)
 */
Called by CloseHandle() to free an interrupt handler.  If there are no
handlers for a given IRQ the interrupt is masked.

Need to prevent forking of interrupt descriptors (dup in same process is ok)
Called by CloseHandle () to free an interrupt handler . If there are no handlers for a given IRQ the interrupt is masked . Need to prevent forking of interrupt descriptors ( dup in same process is ok )
int DoCloseInterrupt(int fd) {
  struct Process *current;
  struct VNode *vnode;
  struct SuperBlock *sb;
  struct Filp *filp;
  int irq;
  current = GetCurrentProcess();
  filp = GetFilp(fd);
  if (filp == NULL) {
    return -EINVAL;
  }
  vnode = filp->vnode;
  if (S_ISIRQ(vnode->mode) == false) {
    return -EINVAL;
  }
  irq = vnode->isr_irq;
  DisableInterrupts();
  LIST_REM_ENTRY(&isr_handler_list[irq], vnode, isr_handler_entry);
  irq_handler_cnt[irq]--;
  if (irq_handler_cnt[irq] == 0)
  {
    MaskInterrupt(irq);
  }
  EnableInterrupts();
  FreeHandle(fd);
  VNodeFree(vnode);
  FreeSuperBlock(sb);
  return 0;
}
int DoCloseInterrupt ( int fd ) { struct Process * current ; struct VNode * vnode ; struct SuperBlock * sb ; struct Filp * filp ; int irq ; current = GetCurrentProcess ( ) ; filp = GetFilp ( fd ) ; if ( filp == NULL ) { return - EINVAL ; } vnode = filp -> vnode ; if ( S_ISIRQ ( vnode -> mode ) == false ) { return - EINVAL ; } irq = vnode -> isr_irq ; DisableInterrupts ( ) ; LIST_REM_ENTRY ( & isr_handler_list [ irq ] , vnode , isr_handler_entry ) ; irq_handler_cnt [ irq ] -- ; if ( irq_handler_cnt [ irq ] == 0 ) { MaskInterrupt ( irq ) ; } EnableInterrupts ( ) ; FreeHandle ( fd ) ; VNodeFree ( vnode ) ; FreeSuperBlock ( sb ) ; return 0 ; }
Called by CloseHandle() to free an interrupt handler.
Called by CloseHandle () to free an interrupt handler .
/*
  if (!(current->flags & PROCF_ALLOW_IO)) {
    return -EPERM;
  }
*/