Listing 1. Registering an Interrupt Source

/* fd_set variable required to use select() */
static fd_set set_of_pipes;
/* A structure to maintain a linked list of
   processes... */
struct list_proc{
  int p_num;
  void (*rout_hndl)();
  struct list_proc *next;
static struct list_proc *ini_list=NULL;
/* A list of processes will be created and
   maintained by the reg_process function,
   containing processes information who are
   using interrupts */
void reg_process(int num_pipe, void (*routine)())
  struct list_proc *element;
  element = (struct list_proc *)
               malloc(sizeof(struct list_proc));
  element->p_num = num_pipe;
  element->rout_hndl = routine;
  element->next = ini_list;
  ini_list = element;
  /* Bring up to date file descriptors' group of
  the pipes connected to a process that is using
  signals */
  FD_SET(num_pipe, &set_of_pipes);