Changeset f787c8e in mainline


Ignore:
Timestamp:
2018-08-01T18:37:54Z (6 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
82d9087
Parents:
1de92fb0
Message:

Move some internal interfaces to private headers.

Location:
uspace
Files:
2 deleted
17 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/Makefile

    r1de92fb0 rf787c8e  
    6666        app/redir \
    6767        app/rcutest \
    68         app/rcubench \
    6968        app/sbi \
    7069        app/sportdmp \
  • uspace/app/rcutest/rcutest.c

    r1de92fb0 rf787c8e  
    4646#include <fibril_synch.h>
    4747#include <compiler/barrier.h>
    48 #include <futex.h>
    4948#include <str.h>
    5049
  • uspace/lib/c/generic/async/ports.c

    r1de92fb0 rf787c8e  
    5151#include <abi/mm/as.h>
    5252#include "../private/libc.h"
     53#include "../private/fibril.h"
    5354
    5455/** Interface data */
  • uspace/lib/c/generic/io/kio.c

    r1de92fb0 rf787c8e  
    4444#include <macros.h>
    4545#include <libarch/config.h>
    46 #include <futex.h>
     46
     47#include "../private/futex.h"
    4748
    4849#define KIO_BUFFER_SIZE PAGE_SIZE
  • uspace/lib/c/generic/ipc.c

    r1de92fb0 rf787c8e  
    4646#include <errno.h>
    4747#include <adt/list.h>
    48 #include <futex.h>
    4948#include <fibril.h>
    5049#include <macros.h>
  • uspace/lib/c/generic/malloc.c

    r1de92fb0 rf787c8e  
    4444#include <bitops.h>
    4545#include <mem.h>
    46 #include <fibril_synch.h>
    4746#include <stdlib.h>
    4847#include <adt/gcdlcm.h>
     48
    4949#include "private/malloc.h"
     50#include "private/fibril.h"
    5051
    5152/** Magic used in heap headers. */
  • uspace/lib/c/generic/private/fibril.h

    r1de92fb0 rf787c8e  
    3535#include <abi/proc/uarg.h>
    3636#include <atomic.h>
    37 #include <futex.h>
     37#include <fibril.h>
     38
     39#include "./futex.h"
     40
     41typedef struct {
     42        fibril_t *fibril;
     43} fibril_event_t;
     44
     45#define FIBRIL_EVENT_INIT ((fibril_event_t) {0})
    3846
    3947struct fibril {
     
    7381extern void __fibrils_init(void);
    7482
     83extern void fibril_wait_for(fibril_event_t *);
     84extern errno_t fibril_wait_timeout(fibril_event_t *, const struct timeval *);
     85extern void fibril_notify(fibril_event_t *);
     86
     87extern errno_t fibril_ipc_wait(ipc_call_t *, const struct timeval *);
     88extern void fibril_ipc_poke(void);
     89
     90/**
     91 * "Restricted" fibril mutex.
     92 *
     93 * Similar to `fibril_mutex_t`, but has a set of restrictions placed on its
     94 * use. Within a rmutex critical section, you
     95 *         - may not use any other synchronization primitive,
     96 *           save for another `fibril_rmutex_t`. This includes nonblocking
     97 *           operations like cvar signal and mutex unlock, unless otherwise
     98 *           specified.
     99 *         - may not read IPC messages
     100 *         - may not start a new thread/fibril
     101 *           (creating fibril without starting is fine)
     102 *
     103 * Additionally, locking with a timeout is not possible on this mutex,
     104 * and there is no associated condition variable type.
     105 * This is a design constraint, not a lack of implementation effort.
     106 */
     107typedef struct {
     108        // TODO: At this point, this is just silly handwaving to hide current
     109        //       futex use behind a fibril based abstraction. Later, the imple-
     110        //       mentation will change, but the restrictions placed on this type
     111        //       will allow it to be simpler and faster than a regular mutex.
     112        //       There might also be optional debug checking of the assumptions.
     113        //
     114        //       Note that a consequence of the restrictions is that if we are
     115        //       running on a single thread, no other fibril can ever get to run
     116        //       while a fibril has a rmutex locked. That means that for
     117        //       single-threaded programs, we can reduce all rmutex locks and
     118        //       unlocks to simple branches on a global bool variable.
     119
     120        futex_t futex;
     121} fibril_rmutex_t;
     122
     123#define FIBRIL_RMUTEX_INITIALIZER(name) \
     124        { .futex = FUTEX_INITIALIZE(1) }
     125
     126#define FIBRIL_RMUTEX_INITIALIZE(name) \
     127        fibril_rmutex_t name = FIBRIL_RMUTEX_INITIALIZER(name)
     128
     129extern void fibril_rmutex_initialize(fibril_rmutex_t *);
     130extern void fibril_rmutex_lock(fibril_rmutex_t *);
     131extern bool fibril_rmutex_trylock(fibril_rmutex_t *);
     132extern void fibril_rmutex_unlock(fibril_rmutex_t *);
     133
     134
    75135#endif
  • uspace/lib/c/generic/thread/fibril.c

    r1de92fb0 rf787c8e  
    4242#include <as.h>
    4343#include <context.h>
    44 #include <futex.h>
    4544#include <assert.h>
    4645
     
    5150
    5251#include "../private/thread.h"
     52#include "../private/futex.h"
    5353#include "../private/fibril.h"
    5454#include "../private/libc.h"
  • uspace/lib/c/generic/thread/fibril_synch.c

    r1de92fb0 rf787c8e  
    3737#include <async.h>
    3838#include <adt/list.h>
    39 #include <futex.h>
    4039#include <sys/time.h>
    4140#include <errno.h>
     
    5049#include "../private/async.h"
    5150#include "../private/fibril.h"
     51#include "../private/futex.h"
    5252
    5353void fibril_rmutex_initialize(fibril_rmutex_t *m)
  • uspace/lib/c/generic/thread/futex.c

    r1de92fb0 rf787c8e  
    3333 */
    3434
    35 #include <futex.h>
    36 
    3735#include <assert.h>
    3836#include <atomic.h>
     
    4139
    4240#include "../private/fibril.h"
     41#include "../private/futex.h"
    4342
    4443//#define DPRINTF(...) kio_printf(__VA_ARGS__)
  • uspace/lib/c/generic/thread/mpsc.c

    r1de92fb0 rf787c8e  
    3636#include <mem.h>
    3737#include <stdlib.h>
     38
     39#include "../private/fibril.h"
    3840
    3941/*
  • uspace/lib/c/generic/thread/rcu.c

    r1de92fb0 rf787c8e  
    7373#include <compiler/barrier.h>
    7474#include <libarch/barrier.h>
    75 #include <futex.h>
    7675#include <macros.h>
    7776#include <async.h>
  • uspace/lib/c/include/fibril.h

    r1de92fb0 rf787c8e  
    4949typedef fibril_t *fid_t;
    5050
    51 typedef struct {
    52         fibril_t *fibril;
    53 } fibril_event_t;
    54 
    55 #define FIBRIL_EVENT_INIT ((fibril_event_t) {0})
    56 
    5751/** Fibril-local variable specifier */
    5852#define fibril_local __thread
     
    8276extern __noreturn void fibril_exit(long);
    8377
    84 extern void fibril_wait_for(fibril_event_t *);
    85 extern errno_t fibril_wait_timeout(fibril_event_t *, const struct timeval *);
    86 extern void fibril_notify(fibril_event_t *);
    87 
    88 extern errno_t fibril_ipc_wait(ipc_call_t *, const struct timeval *);
    89 extern void fibril_ipc_poke(void);
    90 
    9178#endif
    9279
  • uspace/lib/c/include/fibril_synch.h

    r1de92fb0 rf787c8e  
    4141#include <sys/time.h>
    4242#include <stdbool.h>
    43 #include <futex.h>
    44 
    45 /**
    46  * "Restricted" fibril mutex.
    47  *
    48  * Similar to `fibril_mutex_t`, but has a set of restrictions placed on its
    49  * use. Within a rmutex critical section, you
    50  *         - may not use any other synchronization primitive,
    51  *           save for another `fibril_rmutex_t`. This includes nonblocking
    52  *           operations like cvar signal and mutex unlock, unless otherwise
    53  *           specified.
    54  *         - may not read IPC messages
    55  *         - may not start a new thread/fibril
    56  *           (creating fibril without starting is fine)
    57  *
    58  * Additionally, locking with a timeout is not possible on this mutex,
    59  * and there is no associated condition variable type.
    60  * This is a design constraint, not a lack of implementation effort.
    61  */
    62 typedef struct {
    63         // TODO: At this point, this is just silly handwaving to hide current
    64         //       futex use behind a fibril based abstraction. Later, the imple-
    65         //       mentation will change, but the restrictions placed on this type
    66         //       will allow it to be simpler and faster than a regular mutex.
    67         //       There might also be optional debug checking of the assumptions.
    68         //
    69         //       Note that a consequence of the restrictions is that if we are
    70         //       running on a single thread, no other fibril can ever get to run
    71         //       while a fibril has a rmutex locked. That means that for
    72         //       single-threaded programs, we can reduce all rmutex locks and
    73         //       unlocks to simple branches on a global bool variable.
    74 
    75         futex_t futex;
    76 } fibril_rmutex_t;
    77 
    78 #define FIBRIL_RMUTEX_INITIALIZER(name) \
    79         { .futex = FUTEX_INITIALIZE(1) }
    80 
    81 #define FIBRIL_RMUTEX_INITIALIZE(name) \
    82         fibril_rmutex_t name = FIBRIL_RMUTEX_INITIALIZER(name)
    8343
    8444typedef struct {
     
    204164        fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt)
    205165
    206 extern void fibril_rmutex_initialize(fibril_rmutex_t *);
    207 extern void fibril_rmutex_lock(fibril_rmutex_t *);
    208 extern bool fibril_rmutex_trylock(fibril_rmutex_t *);
    209 extern void fibril_rmutex_unlock(fibril_rmutex_t *);
    210 
    211166extern void fibril_mutex_initialize(fibril_mutex_t *);
    212167extern void fibril_mutex_lock(fibril_mutex_t *);
  • uspace/lib/c/include/ipc/common.h

    r1de92fb0 rf787c8e  
    3737
    3838#include <abi/ipc/ipc.h>
    39 #include <atomic.h>
    4039#include <abi/proc/task.h>
    41 #include <futex.h>
    4240#include <abi/cap.h>
     41#include <types/common.h>
    4342
    4443#define IPC_FLAG_BLOCKING  0x01
  • uspace/lib/drv/include/dev_iface.h

    r1de92fb0 rf787c8e  
    3838#include <ipc/common.h>
    3939#include <ipc/dev_iface.h>
     40#include <stdbool.h>
    4041
    4142/*
  • uspace/srv/hid/input/ctl/stty.c

    r1de92fb0 rf787c8e  
    3838 */
    3939
     40#include <errno.h>
    4041#include <io/keycode.h>
    4142#include "../stroke.h"
Note: See TracChangeset for help on using the changeset viewer.