home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / net / netisr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  2.6 KB  |  109 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    netisr.c,v $
  29.  * Revision 2.1  92/04/21  17:14:10  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. #include <iso.h>
  36. #include <ns.h>
  37. #include <inet.h>
  38. #include <imp.h>
  39.  
  40. #include <sys/param.h>
  41. #include <sys/proc.h>
  42. #include <net/netisr.h>
  43.  
  44. int        netisr = 0;
  45. struct mutex    netisr_mutex = MUTEX_INITIALIZER;
  46.  
  47. /*
  48.  * Must be called at splnet.
  49.  */
  50. void dosoftnet()
  51. {
  52.     struct proc *p = (struct proc *)cthread_data(cthread_self());
  53.     int original_master = p->p_master_lock;
  54.  
  55.     mutex_lock(&netisr_mutex);
  56.  
  57. #if    NIMP > 0
  58.     if (netisr & (1<<NETISR_IMP)) {
  59.         netisr &= ~(1<<NETISR_IMP);
  60.         mutex_unlock(&netisr_mutex);
  61.         impintr();
  62.         mutex_lock(&netisr_mutex);
  63.     }
  64. #endif    NIMP > 0
  65. #if    INET
  66.     if (netisr & (1<<NETISR_IP)) {
  67.         netisr &= ~(1<<NETISR_IP);
  68.         mutex_unlock(&netisr_mutex);
  69.         ipintr();
  70.         mutex_lock(&netisr_mutex);
  71.     }
  72. #endif    INET
  73. #if    ISO
  74.     if (netisr & (1<<NETISR_ISO)) {
  75.         netisr &= ~(1<<NETISR_ISO);
  76.         mutex_unlock(&netisr_mutex);
  77.         isointr();
  78.         mutex_lock(&netisr_mutex);
  79.     }
  80. #endif    ISO
  81. #if    CCITT
  82.     if (netisr & (1<<NETISR_CCITT)) {
  83.         netisr &= ~(1<<NETISR_CCITT);
  84.         mutex_unlock(&netisr_mutex);
  85.         ccittintr();
  86.         mutex_lock(&netisr_mutex);
  87.     }
  88. #endif    CCITT
  89. #if    NS
  90.     if (netisr & (1<<NETISR_NS)) {
  91.         netisr &= ~(1<<NETISR_NS);
  92.         mutex_unlock(&netisr_mutex);
  93.         nsintr();
  94.         mutex_lock(&netisr_mutex);
  95.     }
  96. #endif    NS
  97.     if (netisr & (1<<NETISR_RAW)) {
  98.         netisr &= ~(1<<NETISR_RAW);
  99.         mutex_unlock(&netisr_mutex);
  100.         rawintr();
  101.     }
  102.     else {
  103.         mutex_unlock(&netisr_mutex);
  104.     }
  105.  
  106.     if (original_master != p->p_master_lock)
  107.         panic("dosoftnet");
  108. }
  109.