      .  
   ,         -
   .

   

         
<asm/semaphore .h>.  struct semaphore    -
.      .

static DECLARE_SEMAPHORE_GENERIC(name, count);

 name    , a count   .  
     (mutex),  -
  ,   .

static DECLARE_MUTEX(name) ;

 name       .    -
 ,     .     -
 ,         
  ,   

sema init(sem, count);

 sem  , a count    .  
     
 

init_MUTEX(sem) ;

,   "mutex"    init_MUTEX () 
     "init"   ,      -
 sema_init ()    .    ,   -
  ,        . , 
   7         ,  
  .

 

 down interruptible ()     .
   ,        
TASK_INTERRUPTIBLE.    3  ,   
 ,         
       .     
,      ,   -
  ,   down_interruptible ()   -EINTR.
     down (),  -
       TASK_UNINTERRUPTIBLE.  -
   ,   ,    
,     .   down_interruptible ()
   ,   down (). ,   -
, ,   .

                                                     193