Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/event.c

    r8a637a4 rcfaa35a  
    5858}
    5959
    60 static event_t *evno2event(int evno, task_t *task)
     60static event_t *evno2event(int evno, task_t *t)
    6161{
    6262        ASSERT(evno < EVENT_TASK_END);
    63        
     63
    6464        event_t *event;
    65        
     65
    6666        if (evno < EVENT_END)
    6767                event = &events[(event_type_t) evno];
    6868        else
    69                 event = &task->events[(event_task_type_t) evno - EVENT_END];
    70        
     69                event = &t->events[(event_task_type_t) evno - EVENT_END];
     70
    7171        return event;
    7272}
     
    8686                event_initialize(evno2event(i, task));
    8787}
     88
    8889
    8990/** Unsubscribe kernel events associated with an answerbox
     
    251252 *
    252253 * @return EOK if the subscription was successful.
    253  * @return EEXIST if the notifications of the given type are
     254 * @return EEXISTS if the notifications of the given type are
    254255 *         already subscribed.
    255256 *
     
    259260{
    260261        int res;
    261        
     262
    262263        spinlock_lock(&event->lock);
    263264       
     
    269270                res = EOK;
    270271        } else
    271                 res = EEXIST;
    272        
    273         spinlock_unlock(&event->lock);
    274        
    275         return res;
    276 }
    277 
    278 /** Unsubscribe event notifications
    279  *
    280  * @param evno      Event type.
    281  * @param answerbox Answerbox used to send the notifications to.
    282  *
    283  * @return EOK if the subscription was successful.
    284  * @return EEXIST if the notifications of the given type are
    285  *         already subscribed.
    286  *
    287  */
    288 static int event_unsubscribe(event_t *event, answerbox_t *answerbox)
    289 {
    290         int res;
    291        
    292         spinlock_lock(&event->lock);
    293        
    294         if (event->answerbox == answerbox) {
    295                 event->answerbox = NULL;
    296                 event->counter = 0;
    297                 event->imethod = 0;
    298                 event->masked = false;
    299                 res = EOK;
    300         } else
    301                 res = ENOENT;
     272                res = EEXISTS;
    302273       
    303274        spinlock_unlock(&event->lock);
     
    326297}
    327298
    328 /** Event notification subscription syscall wrapper
     299/** Event notification syscall wrapper
    329300 *
    330301 * @param evno    Event type to subscribe.
     
    334305 * @return EOK on success.
    335306 * @return ELIMIT on unknown event type.
    336  * @return EEXIST if the notifications of the given type are
     307 * @return EEXISTS if the notifications of the given type are
    337308 *         already subscribed.
    338309 *
    339310 */
    340 sysarg_t sys_ipc_event_subscribe(sysarg_t evno, sysarg_t imethod)
     311sysarg_t sys_event_subscribe(sysarg_t evno, sysarg_t imethod)
    341312{
    342313        if (evno >= EVENT_TASK_END)
     
    345316        return (sysarg_t) event_subscribe(evno2event(evno, TASK),
    346317            (sysarg_t) imethod, &TASK->answerbox);
    347 }
    348 
    349 /** Event notification unsubscription syscall wrapper
    350  *
    351  * @param evno    Event type to unsubscribe.
    352  *
    353  * @return EOK on success.
    354  * @return ELIMIT on unknown event type.
    355  * @return ENOENT if the notification of the given type is not
    356            subscribed.
    357  *
    358  */
    359 sysarg_t sys_ipc_event_unsubscribe(sysarg_t evno)
    360 {
    361         if (evno >= EVENT_TASK_END)
    362                 return ELIMIT;
    363        
    364         return (sysarg_t) event_unsubscribe(evno2event(evno, TASK),
    365             &TASK->answerbox);
    366318}
    367319
     
    379331 *
    380332 */
    381 sysarg_t sys_ipc_event_unmask(sysarg_t evno)
     333sysarg_t sys_event_unmask(sysarg_t evno)
    382334{
    383335        if (evno >= EVENT_TASK_END)
Note: See TracChangeset for help on using the changeset viewer.