Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 269bc459 in mainline


Ignore:
Timestamp:
2018-11-11T15:47:39Z (3 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
45c8eea
Parents:
8a18d5b
git-author:
Jakub Jermar <jakub@…> (2018-11-10 17:01:38)
git-committer:
Jakub Jermar <jakub@…> (2018-11-11 15:47:39)
Message:

Add SYS_WAITQ_DESTROY

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • abi/include/abi/syscall.h

    r8a18d5b r269bc459  
    5454        SYS_WAITQ_SLEEP,
    5555        SYS_WAITQ_WAKEUP,
     56        SYS_WAITQ_DESTROY,
    5657        SYS_SMC_COHERENCE,
    5758
  • kernel/generic/include/synch/syswaitq.h

    r8a18d5b r269bc459  
    4646extern sys_errno_t sys_waitq_sleep(cap_waitq_handle_t, uintptr_t);
    4747extern sys_errno_t sys_waitq_wakeup(cap_waitq_handle_t);
     48extern sys_errno_t sys_waitq_destroy(cap_waitq_handle_t);
    4849
    4950#endif
  • kernel/generic/src/synch/syswaitq.c

    r8a18d5b r269bc459  
    123123}
    124124
     125/** Destroy a waitq
     126 *
     127 * @param whandle  Waitq capability handle of the waitq to be destroyed.
     128 *
     129 * @return         Error code.
     130 */
     131sys_errno_t sys_waitq_destroy(cap_waitq_handle_t whandle)
     132{
     133        kobject_t *kobj = cap_unpublish(TASK, whandle, KOBJECT_TYPE_WAITQ);
     134        if (!kobj)
     135                return (sys_errno_t) ENOENT;
     136        kobject_put(kobj);
     137        cap_free(TASK, whandle);
     138        return EOK;
     139}
     140
    125141/** Sleep in the waitq
    126142 *
  • kernel/generic/src/syscall/syscall.c

    r8a18d5b r269bc459  
    139139        [SYS_WAITQ_SLEEP] = (syshandler_t) sys_waitq_sleep,
    140140        [SYS_WAITQ_WAKEUP] = (syshandler_t) sys_waitq_wakeup,
     141        [SYS_WAITQ_DESTROY] = (syshandler_t) sys_waitq_destroy,
    141142        [SYS_SMC_COHERENCE] = (syshandler_t) sys_smc_coherence,
    142143
  • uspace/lib/c/generic/private/fibril.h

    r8a18d5b r269bc459  
    127127
    128128extern void fibril_rmutex_initialize(fibril_rmutex_t *);
     129extern void fibril_rmutex_destroy(fibril_rmutex_t *);
    129130extern void fibril_rmutex_lock(fibril_rmutex_t *);
    130131extern bool fibril_rmutex_trylock(fibril_rmutex_t *);
  • uspace/lib/c/generic/private/futex.h

    r8a18d5b r269bc459  
    5555
    5656extern void futex_initialize(futex_t *futex, int value);
     57
     58static inline errno_t futex_destroy(futex_t *futex)
     59{
     60        if (futex->whandle)
     61                return __SYSCALL1(SYS_WAITQ_DESTROY, (sysarg_t) futex->whandle);
     62        return EOK;
     63}
    5764
    5865#ifdef CONFIG_DEBUG_FUTEX
  • uspace/lib/c/generic/thread/fibril_synch.c

    r8a18d5b r269bc459  
    5454{
    5555        futex_initialize(&m->futex, 1);
     56}
     57
     58void fibril_rmutex_destroy(fibril_rmutex_t *m)
     59{
     60        futex_destroy(&m->futex);
    5661}
    5762
  • uspace/lib/c/generic/thread/mpsc.c

    r8a18d5b r269bc459  
    9797        }
    9898
    99         // TODO: fibril_rmutex_destroy()
     99        fibril_rmutex_destroy(&q->t_lock);
    100100
    101101        free(q);
Note: See TracChangeset for help on using the changeset viewer.