Changeset 102f641 in mainline for uspace/lib
- Timestamp:
- 2019-09-02T19:01:50Z (6 years ago)
- Children:
- 25697163
- Parents:
- 241f1985
- Location:
- uspace/lib
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/adt/dyn_array.c
r241f1985 r102f641 44 44 #include <stdlib.h> 45 45 46 47 48 49 46 static int dyn_array_realloc(dyn_array_t *da, size_t capacity) 50 47 { … … 74 71 _dyn_array_unshift(da, index, 1); 75 72 int rc = dyn_array_reserve(da, da->size); 76 73 assert(rc == EOK); 77 74 } 78 75 … … 96 93 _dyn_array_unshift(da, begin, end - begin); 97 94 int rc = dyn_array_reserve(da, da->size); 98 95 assert(rc == EOK); 99 96 } 100 97 … … 192 189 } 193 190 194 195 191 /** @} 196 192 */ -
uspace/lib/c/generic/async/client.c
r241f1985 r102f641 164 164 static FIBRIL_CONDVAR_INITIALIZE(avail_phone_cv); 165 165 166 167 166 /** Create session for existing phone 168 167 * 169 168 * @return session on success, NULL on error 170 169 */ 171 170 172 171 async_sess_t *create_session(cap_phone_handle_t phone, exch_mgmt_t mgmt, 173 172 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3) … … 181 180 session->arg2 = arg2; 182 181 session->arg3 = arg3; 183 182 184 183 fibril_mutex_initialize(&session->remote_state_mtx); 185 184 session->remote_state_data = NULL; 186 185 187 186 list_initialize(&session->exch_list); 188 187 fibril_mutex_initialize(&session->mutex); -
uspace/lib/c/generic/async/server.c
r241f1985 r102f641 226 226 void async_set_implicit_connection(async_port_handler_t conn) 227 227 { 228 assert(implicit_connection == NULL); 229 implicit_connection = conn; 230 } 231 228 assert(implicit_connection == NULL); 229 implicit_connection = conn; 230 } 232 231 233 232 static fibril_rmutex_t client_mutex; -
uspace/lib/c/generic/libc.c
r241f1985 r102f641 54 54 #include "private/taskman.h" 55 55 56 57 56 #ifdef CONFIG_RTLD 58 57 #include <rtld/rtld.h> … … 119 118 } 120 119 #endif 121 120 122 121 /* Setup async framework and taskman connection */ 123 122 __async_server_init(); -
uspace/lib/c/generic/loader.c
r241f1985 r102f641 68 68 if (ldr == NULL) 69 69 return NULL; 70 70 71 71 async_sess_t *sess = taskman_session_loader(); 72 72 if (sess == NULL) { -
uspace/lib/c/generic/private/async.h
r241f1985 r102f641 108 108 extern void async_reply_received(ipc_call_t *); 109 109 extern async_sess_t *create_session(cap_phone_handle_t, exch_mgmt_t, 110 110 sysarg_t, sysarg_t, sysarg_t); 111 111 extern cap_phone_handle_t async_session_phone(async_sess_t *); 112 112 -
uspace/lib/c/generic/task.c
r241f1985 r102f641 115 115 async_exch_t *exch = taskman_exchange_begin(); 116 116 if (exch == NULL) 117 117 return EIO; 118 118 119 119 wait->aid = async_send_3(exch, TASKMAN_WAIT, LOWER32(id), UPPER32(id), … … 388 388 if (wait->flags & TASK_WAIT_RETVAL && retval) 389 389 *retval = ipc_get_arg2(&wait->result); 390 391 390 } 392 391 … … 440 439 errno_t rc = async_req_2_0(exch, TASKMAN_RETVAL, val, wait_for_exit); 441 440 taskman_exchange_end(exch); 442 441 443 442 return rc; 444 443 } -
uspace/lib/c/generic/task_event.c
r241f1985 r102f641 63 63 while (true) { 64 64 ipc_call_t call; 65 65 66 66 if (!async_get_call(&call) || !ipc_get_imethod(&call)) { 67 67 /* Hangup, end of game */ … … 99 99 port_id_t port; 100 100 errno_t rc = async_create_callback_port(exch, INTERFACE_TASKMAN_CB, 0, 0, 101 101 taskman_event_conn, NULL, &port); 102 102 taskman_exchange_end(exch); 103 103 -
uspace/lib/c/generic/taskman.c
r241f1985 r102f641 32 32 /** @file 33 33 */ 34 35 34 36 35 #include <async.h> … … 86 85 aid_t req = async_send_0(exch, TASKMAN_NEW_TASK, NULL); 87 86 async_exchange_end(exch); 88 87 89 88 if (req) { 90 89 async_forget(req); … … 104 103 105 104 async_sess_t *sess = async_connect_me_to(exch, INTERFACE_NS, 106 105 TASKMAN_CONNECT_TO_NS, 0); 107 106 async_exchange_end(exch); 108 107 … … 170 169 } 171 170 172 173 174 171 /** @} 175 172 */ -
uspace/lib/c/generic/taskman_noasync.c
r241f1985 r102f641 44 44 #include <taskman_noasync.h> 45 45 46 47 48 49 46 /** Tell taskman we are his NS 50 47 * … … 67 64 } 68 65 69 70 66 void task_retval_noasync(errno_t retval) 71 67 { -
uspace/lib/c/include/adt/dyn_array.h
r241f1985 r102f641 60 60 _dyn_array_initialize((dyn_array), sizeof(type)) 61 61 62 63 62 /** Dynamic array accessor 64 63 * … … 68 67 (*((type *) (dyn_array)->_data + index)) 69 68 70 71 69 /** Access last element 72 70 * … … 75 73 #define dyn_array_last(dyn_array, type) \ 76 74 (*((type *) (dyn_array)->_data + ((dyn_array)->size - 1))) 77 78 75 79 76 /** Insert item at given position, shift rest of array … … 101 98 #define dyn_array_append(dyn_array, type, value) \ 102 99 dyn_array_insert(dyn_array, type, (dyn_array)->size, (value)) 103 104 100 105 101 /** Dynamic array iteration -
uspace/lib/c/include/ipc/common.h
r241f1985 r102f641 46 46 /** 47 47 * IPC_FLAG_AUTOSTART_ is for use in brokers only. In clinet code use 48 * IPC_AUTOSTART that includes implies blocking behavior. */ 48 * IPC_AUTOSTART that includes implies blocking behavior. 49 */ 49 50 #define IPC_FLAG_AUTOSTART_ 0x02 50 51 -
uspace/lib/c/include/ipc/services.h
r241f1985 r102f641 67 67 #define SERVICE_NAME_VOLSRV "volsrv" 68 68 69 70 69 #define LOC_DEVICE_NAMESPACE "devices" 71 70 #define LOC_UNIT_NAMESPACE_SEPARATOR "__" -
uspace/lib/c/include/ipc/taskman.h
r241f1985 r102f641 38 38 #include <ipc/common.h> 39 39 40 41 40 typedef enum { 42 41 TASKMAN_WAIT = IPC_FIRST_USER_METHOD, -
uspace/lib/c/include/loader/pcb.h
r241f1985 r102f641 63 63 /** Session to taskman (typically spawn parent) */ 64 64 async_sess_t *session_taskman; 65 65 66 66 /** Current working directory. */ 67 67 char *cwd; -
uspace/lib/c/include/taskman_noasync.h
r241f1985 r102f641 36 36 #define LIBC_TASKMAN_NOASYNC_H_ 37 37 38 39 38 /* Internal functions to be used by NS only */ 40 39 extern int taskman_intro_ns_noasync(void); -
uspace/lib/c/include/types/task.h
r241f1985 r102f641 51 51 } task_wait_t; 52 52 53 typedef void (* 53 typedef void (*task_event_handler_t)(task_id_t, int, task_exit_t, int); 54 54 55 55 #endif -
uspace/lib/c/test/dyn_array.c
r241f1985 r102f641 38 38 static dyn_array_t da; 39 39 40 PCUT_TEST_BEFORE { 40 PCUT_TEST_BEFORE 41 { 41 42 dyn_array_initialize(&da, data_t); 42 43 int rc = dyn_array_reserve(&da, 3); … … 44 45 } 45 46 46 PCUT_TEST_AFTER { 47 PCUT_TEST_AFTER 48 { 47 49 dyn_array_destroy(&da); 48 50 } 49 51 50 PCUT_TEST(initialization) { 52 PCUT_TEST(initialization) 53 { 51 54 PCUT_ASSERT_INT_EQUALS(da.capacity, 3); 52 55 PCUT_ASSERT_INT_EQUALS(da.size, 0); 53 56 } 54 57 55 PCUT_TEST(append) { 58 PCUT_TEST(append) 59 { 56 60 dyn_array_append(&da, data_t, 42); 57 61 dyn_array_append(&da, data_t, 666); … … 62 66 } 63 67 64 PCUT_TEST(assign) { 68 PCUT_TEST(assign) 69 { 65 70 dyn_array_append(&da, data_t, 42); 66 71 dyn_array_at(&da, data_t, 0) = 112; … … 69 74 } 70 75 71 PCUT_TEST(remove) { 76 PCUT_TEST(remove) 77 { 72 78 dyn_array_append(&da, data_t, 10); 73 79 dyn_array_append(&da, data_t, 11); … … 79 85 } 80 86 81 PCUT_TEST(insert) { 87 PCUT_TEST(insert) 88 { 82 89 dyn_array_append(&da, data_t, 10); 83 90 dyn_array_append(&da, data_t, 11); … … 92 99 } 93 100 94 PCUT_TEST(capacity_grow) { 101 PCUT_TEST(capacity_grow) 102 { 95 103 dyn_array_append(&da, data_t, 42); 96 104 dyn_array_append(&da, data_t, 666); … … 101 109 } 102 110 103 PCUT_TEST(capacity_shrink) { 111 PCUT_TEST(capacity_shrink) 112 { 104 113 dyn_array_append(&da, data_t, 42); 105 114 dyn_array_append(&da, data_t, 666); … … 113 122 } 114 123 115 PCUT_TEST(iterator) { 124 PCUT_TEST(iterator) 125 { 116 126 for (int i = 0; i < 10; ++i) { 117 dyn_array_append(&da, data_t, i *i);127 dyn_array_append(&da, data_t, i * i); 118 128 } 119 129 120 130 int i = 0; 121 131 dyn_array_foreach(da, data_t, it) { 122 PCUT_ASSERT_INT_EQUALS(i *i, *it);132 PCUT_ASSERT_INT_EQUALS(i * i, *it); 123 133 ++i; 124 134 } 125 135 } 126 136 127 PCUT_TEST(find) { 137 PCUT_TEST(find) 138 { 128 139 dyn_array_append(&da, data_t, 10); 129 140 dyn_array_append(&da, data_t, 11); … … 136 147 } 137 148 138 PCUT_TEST(clear_range_middle) { 149 PCUT_TEST(clear_range_middle) 150 { 139 151 dyn_array_append(&da, data_t, 10); 140 152 dyn_array_append(&da, data_t, 11); … … 148 160 } 149 161 150 PCUT_TEST(clear_range_begin) { 162 PCUT_TEST(clear_range_begin) 163 { 151 164 dyn_array_append(&da, data_t, 10); 152 165 dyn_array_append(&da, data_t, 11); … … 160 173 } 161 174 162 PCUT_TEST(clear_range_end) { 175 PCUT_TEST(clear_range_end) 176 { 163 177 dyn_array_append(&da, data_t, 10); 164 178 dyn_array_append(&da, data_t, 11); … … 172 186 } 173 187 174 PCUT_TEST(clear_range_empty) { 188 PCUT_TEST(clear_range_empty) 189 { 175 190 dyn_array_append(&da, data_t, 10); 176 191 dyn_array_append(&da, data_t, 99); … … 182 197 } 183 198 184 PCUT_TEST(concat_simple) { 199 PCUT_TEST(concat_simple) 200 { 185 201 dyn_array_append(&da, data_t, 10); 186 202 dyn_array_append(&da, data_t, 99); … … 202 218 dyn_array_destroy(&da2); 203 219 } 204 PCUT_TEST(concat_self) { 220 221 PCUT_TEST(concat_self) 222 { 205 223 dyn_array_append(&da, data_t, 10); 206 224 dyn_array_append(&da, data_t, 99); -
uspace/lib/conf/include/conf/configuration.h
r241f1985 r102f641 38 38 /** Value name */ 39 39 const char *name; 40 40 41 41 /** Parse and store given string 42 42 * -
uspace/lib/conf/include/conf/ini.h
r241f1985 r102f641 103 103 } ini_item_iterator_t; 104 104 105 106 105 extern void ini_configuration_init(ini_configuration_t *); 107 106 extern void ini_configuration_deinit(ini_configuration_t *); … … 123 122 extern size_t ini_item_iterator_lineno(ini_item_iterator_t *); 124 123 125 126 127 124 #endif -
uspace/lib/conf/include/conf/text_parse.h
r241f1985 r102f641 53 53 } text_parse_error_t; 54 54 55 56 55 extern void text_parse_init(text_parse_t *); 57 56 extern void text_parse_deinit(text_parse_t *); -
uspace/lib/conf/src/ini.c
r241f1985 r102f641 110 110 } 111 111 112 113 112 static size_t ini_item_ht_hash(const ht_link_t *item) 114 113 { … … 142 141 ini_item_destroy(&ini_item); 143 142 } 144 145 143 146 144 static hash_table_ops_t configuration_ht_ops = { … … 235 233 continue; 236 234 } 237 235 238 236 /* Start new section */ 239 237 if (line[0] == '[') { … … 256 254 *close_bracket = '\0'; 257 255 cur_section->name = str_dup(line + 1); 258 256 259 257 if (!hash_table_insert_unique(&conf->sections, 260 258 &cur_section->ht_link)) { … … 329 327 } 330 328 331 332 333 329 /* 334 330 * Actual INI functions … … 355 351 } 356 352 357 static ini_section_t *ini_section_create(void)353 static ini_section_t *ini_section_create(void) 358 354 { 359 355 ini_section_t *section = malloc(sizeof(ini_section_t)); … … 403 399 } 404 400 405 406 401 /** Parse file contents to INI structure 407 402 * … … 447 442 } 448 443 449 450 444 /** Get a section from configuration 451 445 * … … 476 470 */ 477 471 ini_item_iterator_t ini_section_get_iterator(ini_section_t *section, 478 const char *key)472 const char *key) 479 473 { 480 474 ini_item_iterator_t result; -
uspace/lib/conf/src/text_parse.c
r241f1985 r102f641 63 63 */ 64 64 void text_parse_raise_error(text_parse_t *parse, size_t lineno, 65 int parse_errno) { 65 int parse_errno) 66 { 66 67 assert(parse); 67 68 -
uspace/lib/conf/test/ini.c
r241f1985 r102f641 39 39 static text_parse_t parse; 40 40 41 PCUT_TEST_BEFORE { 41 PCUT_TEST_BEFORE 42 { 42 43 ini_configuration_init(&ini_conf); 43 44 text_parse_init(&parse); 44 45 } 45 46 46 PCUT_TEST_AFTER { 47 PCUT_TEST_AFTER 48 { 47 49 text_parse_deinit(&parse); 48 50 ini_configuration_deinit(&ini_conf); 49 51 } 50 52 51 PCUT_TEST(simple_parsing) { 53 PCUT_TEST(simple_parsing) 54 { 52 55 const char *data = 53 56 "[Section]\n" … … 68 71 } 69 72 70 PCUT_TEST(default_section) { 73 PCUT_TEST(default_section) 74 { 71 75 const char *data = 72 76 "key = value\n" … … 86 90 } 87 91 88 PCUT_TEST(multikey) { 92 PCUT_TEST(multikey) 93 { 89 94 const char *data = 90 95 "key = value\n" … … 114 119 } 115 120 116 PCUT_TEST(dup_section) { 121 PCUT_TEST(dup_section) 122 { 117 123 const char *data = 118 124 "[Section]\n" … … 133 139 } 134 140 135 PCUT_TEST(empty_section) { 141 PCUT_TEST(empty_section) 142 { 136 143 const char *data = 137 144 "[Section1]\n" -
uspace/lib/conf/test/main.c
r241f1985 r102f641 33 33 PCUT_IMPORT(ini); 34 34 35 PCUT_MAIN() 35 PCUT_MAIN(); -
uspace/lib/gui/window.c
r241f1985 r102f641 615 615 win->focus = NULL; 616 616 win->surface = NULL; 617 617 618 618 unsigned int ipc_flags = IPC_AUTOSTART; 619 619 service_id_t reg_dsid; … … 640 640 return NULL; 641 641 } 642 643 642 644 643 win->osess = loc_service_connect(out_dsid, INTERFACE_COMPOSITOR, ipc_flags); -
uspace/lib/sysman/src/broker.c
r241f1985 r102f641 86 86 async_forget(req); 87 87 } 88 89 -
uspace/lib/sysman/src/ctl.c
r241f1985 r102f641 87 87 errno_t rc = async_req_2_0(exch, SYSMAN_CTL_UNIT_START, handle, flags); 88 88 sysman_exchange_end(exch); 89 89 90 90 return rc; 91 91 } … … 97 97 errno_t rc = async_req_2_0(exch, SYSMAN_CTL_UNIT_STOP, handle, flags); 98 98 sysman_exchange_end(exch); 99 99 100 100 return rc; 101 101 } -
uspace/lib/sysman/src/sysman.c
r241f1985 r102f641 31 31 #include <sysman/sysman.h> 32 32 33 static async_sess_t *sysman_sess[SYSMAN_PORT_MAX_] = { NULL};33 static async_sess_t *sysman_sess[SYSMAN_PORT_MAX_] = { NULL }; 34 34 35 35 async_exch_t *sysman_exchange_begin(sysman_interface_t iface) … … 51 51 async_exchange_end(exch); 52 52 } 53
Note:
See TracChangeset
for help on using the changeset viewer.