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

Changeset 0b8fad2 in mainline


Ignore:
Timestamp:
2018-11-11T15:47:39Z (3 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
6874bd2
Parents:
25f6bddb
git-author:
Jakub Jermar <jakub@…> (2018-11-11 11:08:58)
git-committer:
Jakub Jermar <jakub@…> (2018-11-11 15:47:39)
Message:

Make user waitq more generic

By allowing SYS_WAITQ_SLEEP to specify flags, the implementation needn't
hardcode the use of SYNCH_FLAGS_FUTEX, resulting in a more generic
synchronization primitive usable from userspace.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/synch/syswaitq.h

    r25f6bddb r0b8fad2  
    4444
    4545extern sys_errno_t sys_waitq_create(cap_waitq_handle_t *);
    46 extern sys_errno_t sys_waitq_sleep(cap_waitq_handle_t, uintptr_t);
     46extern sys_errno_t sys_waitq_sleep(cap_waitq_handle_t, uint32_t, unsigned int);
    4747extern sys_errno_t sys_waitq_wakeup(cap_waitq_handle_t);
    4848extern sys_errno_t sys_waitq_destroy(cap_waitq_handle_t);
  • kernel/generic/src/synch/syswaitq.c

    r25f6bddb r0b8fad2  
    143143 * @param whandle  Waitq capability handle of the waitq in which to sleep.
    144144 * @param timeout  Timeout in microseconds.
     145 * @param flags    Flags from SYNCH_FLAGS_* family. SYNCH_FLAGS_INTERRUPTIBLE is
     146 *                 always implied.
    145147 *
    146148 * @return         Error code.
    147149 */
    148 sys_errno_t sys_waitq_sleep(cap_waitq_handle_t whandle, uintptr_t timeout)
     150sys_errno_t sys_waitq_sleep(cap_waitq_handle_t whandle, uint32_t timeout,
     151    unsigned int flags)
    149152{
    150153        kobject_t *kobj = kobject_get(TASK, whandle, KOBJECT_TYPE_WAITQ);
     
    157160
    158161        errno_t rc = waitq_sleep_timeout(kobj->waitq, timeout,
    159             SYNCH_FLAGS_INTERRUPTIBLE | SYNCH_FLAGS_FUTEX, NULL);
     162            SYNCH_FLAGS_INTERRUPTIBLE | flags, NULL);
    160163
    161164#ifdef CONFIG_UDEBUG
  • uspace/lib/c/generic/private/futex.h

    r25f6bddb r0b8fad2  
    4343#include <fibril.h>
    4444#include <abi/cap.h>
     45#include <abi/synch.h>
    4546
    4647typedef struct futex {
     
    147148        }
    148149
    149         return __SYSCALL2(SYS_WAITQ_SLEEP, (sysarg_t) futex->whandle,
    150             (sysarg_t) timeout);
     150        return __SYSCALL3(SYS_WAITQ_SLEEP, (sysarg_t) futex->whandle,
     151            (sysarg_t) timeout, (sysarg_t) SYNCH_FLAGS_FUTEX);
    151152}
    152153
Note: See TracChangeset for help on using the changeset viewer.