Changeset d73d992 in mainline
- Timestamp:
- 2018-06-25T20:10:06Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3679f51a
- Parents:
- 0a0dff8
- git-author:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-25 18:56:55)
- git-committer:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-25 20:10:06)
- Location:
- uspace
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nic/nic.c
r0a0dff8 rd73d992 34 34 */ 35 35 36 #include <assert.h> 36 37 #include <errno.h> 37 38 #include <loc.h> -
uspace/app/taskdump/fibrildump.c
r0a0dff8 rd73d992 33 33 */ 34 34 35 #include <adt/list.h> 36 #include <context.h> 35 37 #include <errno.h> 36 38 #include <fibril.h> … … 42 44 #include <taskdump.h> 43 45 #include <udebug.h> 46 47 struct fibril { 48 link_t all_link; 49 context_t ctx; 50 uint8_t __opaque[]; 51 }; 44 52 45 53 static errno_t fibrildump_read_uintptr(void *, uintptr_t, uintptr_t *); -
uspace/lib/c/generic/async/client.c
r0a0dff8 rd73d992 121 121 #include <abi/mm/as.h> 122 122 #include "../private/libc.h" 123 #include "../private/fibril.h" 123 124 124 125 /** Naming service session */ -
uspace/lib/c/generic/async/server.c
r0a0dff8 rd73d992 120 120 #include <abi/mm/as.h> 121 121 #include "../private/libc.h" 122 #include "../private/fibril.h" 122 123 123 124 /** Async framework global futex */ … … 1884 1885 } 1885 1886 1887 _Noreturn void async_manager(void) 1888 { 1889 futex_down(&async_futex); 1890 fibril_switch(FIBRIL_FROM_DEAD); 1891 __builtin_unreachable(); 1892 } 1893 1886 1894 /** @} 1887 1895 */ -
uspace/lib/c/generic/fibril.c
r0a0dff8 rd73d992 49 49 #include <async.h> 50 50 51 #include "private/fibril.h" 52 51 53 #ifdef FUTEX_UPGRADABLE 52 54 #include <rcu.h> … … 75 77 futex_unlock(&fibril_futex); 76 78 77 fibril_t *fibril = __tcb_get()->fibril_data;79 fibril_t *fibril = fibril_self(); 78 80 79 81 #ifdef FUTEX_UPGRADABLE … … 98 100 return NULL; 99 101 100 fibril_t *fibril = malloc(sizeof(fibril_t));102 fibril_t *fibril = calloc(1, sizeof(fibril_t)); 101 103 if (!fibril) { 102 104 tls_free(tcb); … … 106 108 tcb->fibril_data = fibril; 107 109 fibril->tcb = tcb; 108 109 fibril->func = NULL;110 fibril->arg = NULL;111 fibril->stack = NULL;112 fibril->clean_after_me = NULL;113 fibril->retval = 0;114 fibril->flags = 0;115 116 fibril->waits_for = NULL;117 110 118 111 /* … … 156 149 futex_lock(&fibril_futex); 157 150 158 fibril_t *srcf = __tcb_get()->fibril_data;151 fibril_t *srcf = fibril_self(); 159 152 fibril_t *dstf = NULL; 160 153 … … 345 338 } 346 339 340 fibril_t *fibril_self(void) 341 { 342 return __tcb_get()->fibril_data; 343 } 344 347 345 /** Return fibril id of the currently running fibril. 348 346 * … … 352 350 fid_t fibril_get_id(void) 353 351 { 354 return (fid_t) __tcb_get()->fibril_data; 352 return (fid_t) fibril_self(); 353 } 354 355 void fibril_yield(void) 356 { 357 fibril_switch(FIBRIL_PREEMPT); 355 358 } 356 359 -
uspace/lib/c/generic/fibril_synch.c
r0a0dff8 rd73d992 45 45 #include <stdio.h> 46 46 #include "private/async.h" 47 #include "private/fibril.h" 47 48 48 49 static void optimize_execution_power(void) … … 201 202 wdata.fid = (fid_t) f; 202 203 wdata.wu_event.inlist = true; 203 f-> flags &= ~FIBRIL_WRITER;204 f->is_writer = false; 204 205 list_append(&wdata.wu_event.link, &frw->waiters); 205 206 check_for_deadlock(&frw->oi); … … 225 226 wdata.fid = (fid_t) f; 226 227 wdata.wu_event.inlist = true; 227 f-> flags |= FIBRIL_WRITER;228 f->is_writer = true; 228 229 list_append(&wdata.wu_event.link, &frw->waiters); 229 230 check_for_deadlock(&frw->oi); … … 276 277 f->waits_for = NULL; 277 278 278 if (f-> flags & FIBRIL_WRITER) {279 if (f->is_writer) { 279 280 if (frw->readers) 280 281 break; -
uspace/lib/c/generic/inet/host.c
r0a0dff8 rd73d992 35 35 */ 36 36 37 #include <assert.h> 37 38 #include <errno.h> 38 39 #include <inet/addr.h> -
uspace/lib/c/generic/inet/hostport.c
r0a0dff8 rd73d992 36 36 */ 37 37 38 #include <assert.h> 38 39 #include <errno.h> 39 40 #include <inet/addr.h> -
uspace/lib/c/generic/libc.c
r0a0dff8 rd73d992 55 55 #include "private/malloc.h" 56 56 #include "private/io.h" 57 #include "private/fibril.h" 57 58 58 59 #ifdef FUTEX_UPGRADABLE -
uspace/lib/c/generic/rcu.c
r0a0dff8 rd73d992 82 82 #include <thread.h> 83 83 84 #include "private/fibril.h" 85 84 86 85 87 /** RCU sleeps for RCU_SLEEP_MS before polling an active RCU reader again. */ -
uspace/lib/c/generic/thread.c
r0a0dff8 rd73d992 46 46 #include <as.h> 47 47 #include "private/thread.h" 48 #include "private/fibril.h" 48 49 49 50 #ifdef FUTEX_UPGRADABLE -
uspace/lib/c/include/async.h
r0a0dff8 rd73d992 108 108 typedef struct async_exch async_exch_t; 109 109 110 #define async_manager() \ 111 do { \ 112 futex_down(&async_futex); \ 113 fibril_switch(FIBRIL_FROM_DEAD); \ 114 } while (0) 110 extern _Noreturn void async_manager(void); 115 111 116 112 #define async_get_call(data) \ -
uspace/lib/c/include/fibril.h
r0a0dff8 rd73d992 36 36 #define LIBC_FIBRIL_H_ 37 37 38 #include <context.h>39 38 #include <types/common.h> 40 #include <adt/list.h>41 #include <libarch/tls.h>42 39 43 #define FIBRIL_WRITER 1 44 45 struct fibril; 40 typedef struct fibril fibril_t; 46 41 47 42 typedef struct { 48 struct fibril*owned_by;43 fibril_t *owned_by; 49 44 } fibril_owner_info_t; 50 45 51 typedef enum {52 FIBRIL_PREEMPT,53 FIBRIL_TO_MANAGER,54 FIBRIL_FROM_MANAGER,55 FIBRIL_FROM_DEAD56 } fibril_switch_type_t;57 58 46 typedef sysarg_t fid_t; 59 60 typedef struct fibril {61 link_t link;62 link_t all_link;63 context_t ctx;64 void *stack;65 void *arg;66 errno_t (*func)(void *);67 tcb_t *tcb;68 69 struct fibril *clean_after_me;70 errno_t retval;71 int flags;72 73 fibril_owner_info_t *waits_for;74 } fibril_t;75 47 76 48 /** Fibril-local variable specifier */ … … 81 53 extern fid_t fibril_create_generic(errno_t (*func)(void *), void *arg, size_t); 82 54 extern void fibril_destroy(fid_t fid); 83 extern fibril_t *fibril_setup(void);84 extern void fibril_teardown(fibril_t *f, bool locked);85 extern int fibril_switch(fibril_switch_type_t stype);86 55 extern void fibril_add_ready(fid_t fid); 87 extern void fibril_add_manager(fid_t fid);88 extern void fibril_remove_manager(void);89 56 extern fid_t fibril_get_id(void); 57 extern void fibril_yield(void); 90 58 91 59 static inline fid_t fibril_create(errno_t (*func)(void *), void *arg) … … 94 62 } 95 63 96 static inline int fibril_yield(void)97 {98 return fibril_switch(FIBRIL_PREEMPT);99 }100 101 64 #endif 102 65 -
uspace/srv/volsrv/types/part.h
r0a0dff8 rd73d992 38 38 #define TYPES_PART_H_ 39 39 40 #include <adt/list.h> 40 41 #include <types/label.h> 41 42
Note:
See TracChangeset
for help on using the changeset viewer.