Changeset d314571 in mainline


Ignore:
Timestamp:
2018-11-11T15:46:26Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9e889f6
Parents:
5c03bd30
git-author:
Jakub Jermar <jakub@…> (2018-11-10 14:36:06)
git-committer:
Jakub Jermar <jakub@…> (2018-11-11 15:46:26)
Message:

Turn wait queue into a kobject usable by uspace

In order to provide an elegant synchronization mechanism for userspace,
this commit adds syscalls to create, sleep on and wakeup from a wait
queue.

Files:
2 added
8 edited

Legend:

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

    r5c03bd30 rd314571  
    5252} *cap_irq_handle_t;
    5353
     54typedef struct {
     55} *cap_waitq_handle_t;
     56
    5457#endif
    5558
  • abi/include/abi/syscall.h

    r5c03bd30 rd314571  
    5151        SYS_PROGRAM_SPAWN_LOADER,
    5252
     53        SYS_WAITQ_CREATE,
     54        SYS_WAITQ_SLEEP,
     55        SYS_WAITQ_WAKEUP,
    5356        SYS_FUTEX_SLEEP,
    5457        SYS_FUTEX_WAKEUP,
  • kernel/Makefile

    r5c03bd30 rd314571  
    228228        generic/src/synch/waitq.c \
    229229        generic/src/synch/futex.c \
     230        generic/src/synch/syswaitq.c \
    230231        generic/src/smp/ipi.c \
    231232        generic/src/smp/smp.c \
  • kernel/generic/include/cap/cap.h

    r5c03bd30 rd314571  
    5555        KOBJECT_TYPE_IRQ,
    5656        KOBJECT_TYPE_PHONE,
     57        KOBJECT_TYPE_WAITQ,
    5758        KOBJECT_TYPE_MAX
    5859} kobject_type_t;
     
    6364struct irq;
    6465struct phone;
     66struct waitq;
    6567
    6668typedef struct kobject_ops {
     
    8890                struct irq *irq;
    8991                struct phone *phone;
     92                struct waitq *waitq;
    9093        };
    9194} kobject_t;
  • kernel/generic/include/synch/waitq.h

    r5c03bd30 rd314571  
    4949 *
    5050 */
    51 typedef struct {
     51typedef struct waitq {
    5252        /** Lock protecting wait queue structure.
    5353         *
  • kernel/generic/src/main/main.c

    r5c03bd30 rd314571  
    7878#include <synch/waitq.h>
    7979#include <synch/futex.h>
     80#include <synch/syswaitq.h>
    8081#include <arch/arch.h>
    8182#include <arch.h>
     
    279280        thread_init();
    280281        futex_init();
     282        sys_waitq_init();
    281283
    282284        sysinfo_set_item_data("boot_args", NULL, bargs, str_size(bargs) + 1);
  • kernel/generic/src/proc/thread.c

    r5c03bd30 rd314571  
    4848#include <synch/spinlock.h>
    4949#include <synch/waitq.h>
     50#include <synch/syswaitq.h>
    5051#include <cpu.h>
    5152#include <str.h>
     
    520521                        ipc_cleanup();
    521522                        futex_task_cleanup();
     523                        sys_waitq_task_cleanup();
    522524                        LOG("Cleanup of task %" PRIu64 " completed.", TASK->taskid);
    523525                }
  • kernel/generic/src/syscall/syscall.c

    r5c03bd30 rd314571  
    4848#include <synch/futex.h>
    4949#include <synch/smc.h>
     50#include <synch/syswaitq.h>
    5051#include <ddi/ddi.h>
    5152#include <ipc/event.h>
     
    136137
    137138        /* Synchronization related syscalls. */
     139        [SYS_WAITQ_CREATE] = (syshandler_t) sys_waitq_create,
     140        [SYS_WAITQ_SLEEP] = (syshandler_t) sys_waitq_sleep,
     141        [SYS_WAITQ_WAKEUP] = (syshandler_t) sys_waitq_wakeup,
    138142        [SYS_FUTEX_SLEEP] = (syshandler_t) sys_futex_sleep,
    139143        [SYS_FUTEX_WAKEUP] = (syshandler_t) sys_futex_wakeup,
Note: See TracChangeset for help on using the changeset viewer.