Changeset 1433ecda in mainline for uspace/lib/c/generic
- Timestamp:
- 2018-04-04T15:42:37Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c4e1cc
- Parents:
- 47b2d7e3
- Location:
- uspace/lib/c/generic
- Files:
-
- 23 edited
-
assert.c (modified) (1 diff)
-
cap.c (modified) (2 diffs)
-
elf/elf_load.c (modified) (1 diff)
-
fibril_synch.c (modified) (2 diffs)
-
inet/addr.c (modified) (2 diffs)
-
io/printf_core.c (modified) (12 diffs)
-
io/visualizer.c (modified) (1 diff)
-
io/vsnprintf.c (modified) (1 diff)
-
l18n/langs.c (modified) (1 diff)
-
libc.c (modified) (2 diffs)
-
mem.c (modified) (6 diffs)
-
pio_trace.c (modified) (2 diffs)
-
rcu.c (modified) (2 diffs)
-
rtld/dynamic.c (modified) (3 diffs)
-
rtld/module.c (modified) (2 diffs)
-
rtld/rtld.c (modified) (2 diffs)
-
rtld/symbol.c (modified) (1 diff)
-
str.c (modified) (5 diffs)
-
str_error.c (modified) (2 diffs)
-
task.c (modified) (1 diff)
-
thread.c (modified) (2 diffs)
-
vfs/canonify.c (modified) (1 diff)
-
vfs/vfs.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/assert.c
r47b2d7e3 r1433ecda 39 39 #include <stdint.h> 40 40 41 static atomic_t failed_asserts = { 0};41 static atomic_t failed_asserts = { 0 }; 42 42 43 43 void __helenos_assert_quick_abort(const char *cond, const char *file, unsigned int line) -
uspace/lib/c/generic/cap.c
r47b2d7e3 r1433ecda 211 211 { 212 212 switch (c) { 213 case '0': *val = 0; break; 214 case '1': *val = 1; break; 215 case '2': *val = 2; break; 216 case '3': *val = 3; break; 217 case '4': *val = 4; break; 218 case '5': *val = 5; break; 219 case '6': *val = 6; break; 220 case '7': *val = 7; break; 221 case '8': *val = 8; break; 222 case '9': *val = 9; break; 213 case '0': 214 *val = 0; 215 break; 216 case '1': 217 *val = 1; 218 break; 219 case '2': 220 *val = 2; 221 break; 222 case '3': 223 *val = 3; 224 break; 225 case '4': 226 *val = 4; 227 break; 228 case '5': 229 *val = 5; 230 break; 231 case '6': 232 *val = 6; 233 break; 234 case '7': 235 *val = 7; 236 break; 237 case '8': 238 *val = 8; 239 break; 240 case '9': 241 *val = 9; 242 break; 223 243 default: 224 244 return EINVAL; … … 275 295 276 296 return EINVAL; 277 found:297 found: 278 298 cap->cunit = i; 279 299 } -
uspace/lib/c/generic/elf/elf_load.c
r47b2d7e3 r1433ecda 77 77 DPRINTF("Binary is dynamically linked.\n"); 78 78 #ifdef CONFIG_RTLD 79 DPRINTF( "- prog dynamic: %p\n", info->finfo.dynamic);79 DPRINTF("- prog dynamic: %p\n", info->finfo.dynamic); 80 80 81 81 errno_t rc2 = rtld_prog_process(&info->finfo, &env); -
uspace/lib/c/generic/fibril_synch.c
r47b2d7e3 r1433ecda 77 77 context_get_pc(&oi->owned_by->ctx)); 78 78 printf("Fibril %p waits for primitive %p.\n", 79 oi->owned_by, oi->owned_by->waits_for);79 oi->owned_by, oi->owned_by->waits_for); 80 80 oi = oi->owned_by->waits_for; 81 81 } … … 354 354 355 355 errno_t 356 fibril_condvar_wait_timeout(fibril_condvar_t *fcv, fibril_mutex_t *fm,356 fibril_condvar_wait_timeout(fibril_condvar_t *fcv, fibril_mutex_t *fm, 357 357 suseconds_t timeout) 358 358 { -
uspace/lib/c/generic/inet/addr.c
r47b2d7e3 r1433ecda 49 49 50 50 #if !(defined(__BE__) ^ defined(__LE__)) 51 #error The architecture must be either big-endian or little-endian.51 #error The architecture must be either big-endian or little-endian. 52 52 #endif 53 53 … … 69 69 static const inet_addr_t inet_addr_any_addr6 = { 70 70 .version = ip_v6, 71 .addr6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}71 .addr6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 72 72 }; 73 73 -
uspace/lib/c/generic/io/printf_core.c
r47b2d7e3 r1433ecda 593 593 /** Prints a special double (ie NaN, infinity) padded to width characters. */ 594 594 static int print_special(ieee_double_t val, int width, uint32_t flags, 595 printf_spec_t *ps)595 printf_spec_t *ps) 596 596 { 597 597 assert(val.is_special); … … 702 702 */ 703 703 static int print_double_str_fixed(double_str_t *val_str, int precision, int width, 704 uint32_t flags, printf_spec_t *ps)704 uint32_t flags, printf_spec_t *ps) 705 705 { 706 706 int len = val_str->len; … … 840 840 */ 841 841 static int print_double_fixed(double g, int precision, int width, uint32_t flags, 842 printf_spec_t *ps)842 printf_spec_t *ps) 843 843 { 844 844 if (flags & __PRINTF_FLAG_LEFTALIGNED) { … … 869 869 */ 870 870 val_str.len = double_to_fixed_str(val, -1, precision + 1, buf, buf_size, 871 &val_str.dec_exp);871 &val_str.dec_exp); 872 872 873 873 /* … … 919 919 920 920 exp_str[0] = '0' + exp_val / 100; 921 exp_str[1] = '0' + (exp_val % 100) / 10 ;921 exp_str[1] = '0' + (exp_val % 100) / 10; 922 922 exp_str[2] = '0' + (exp_val % 10); 923 923 … … 938 938 */ 939 939 static int print_double_str_scient(double_str_t *val_str, int precision, 940 int width, uint32_t flags, printf_spec_t *ps)940 int width, uint32_t flags, printf_spec_t *ps) 941 941 { 942 942 int len = val_str->len; … … 1062 1062 */ 1063 1063 static int print_double_scientific(double g, int precision, int width, 1064 uint32_t flags, printf_spec_t *ps)1064 uint32_t flags, printf_spec_t *ps) 1065 1065 { 1066 1066 if (flags & __PRINTF_FLAG_LEFTALIGNED) { … … 1088 1088 */ 1089 1089 val_str.len = double_to_fixed_str(val, precision + 2, -1, buf, buf_size, 1090 &val_str.dec_exp);1090 &val_str.dec_exp); 1091 1091 1092 1092 /* … … 1129 1129 */ 1130 1130 static int print_double_generic(double g, int precision, int width, 1131 uint32_t flags, printf_spec_t *ps)1131 uint32_t flags, printf_spec_t *ps) 1132 1132 { 1133 1133 ieee_double_t val = extract_ieee_double(g); … … 1156 1156 precision = precision - (dec_exp + 1); 1157 1157 return print_double_fixed(g, precision, width, 1158 flags | __PRINTF_FLAG_NOFRACZEROS, ps);1158 flags | __PRINTF_FLAG_NOFRACZEROS, ps); 1159 1159 } else { 1160 1160 --precision; 1161 1161 return print_double_scientific(g, precision, width, 1162 flags | __PRINTF_FLAG_NOFRACZEROS, ps);1162 flags | __PRINTF_FLAG_NOFRACZEROS, ps); 1163 1163 } 1164 1164 } else { … … 1214 1214 */ 1215 1215 static int print_double(double g, char spec, int precision, int width, 1216 uint32_t flags, printf_spec_t *ps)1216 uint32_t flags, printf_spec_t *ps) 1217 1217 { 1218 1218 switch (spec) { … … 1543 1543 case 'e': 1544 1544 retval = print_double(va_arg(ap, double), uc, precision, 1545 width, flags, ps);1545 width, flags, ps); 1546 1546 1547 1547 if (retval < 0) { -
uspace/lib/c/generic/io/visualizer.c
r47b2d7e3 r1433ecda 174 174 errno_t visualizer_update_damaged_region(async_sess_t *sess, 175 175 sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height, 176 sysarg_t x_offset, sysarg_t y_offset)176 sysarg_t x_offset, sysarg_t y_offset) 177 177 { 178 178 assert(x_offset <= UINT16_MAX); -
uspace/lib/c/generic/io/vsnprintf.c
r47b2d7e3 r1433ecda 170 170 }; 171 171 printf_spec_t ps = { 172 (int (*) (const char *, size_t, void *)) vsnprintf_str_write,173 (int (*) (const wchar_t *, size_t, void *)) vsnprintf_wstr_write,172 (int (*) (const char *, size_t, void *)) vsnprintf_str_write, 173 (int (*) (const wchar_t *, size_t, void *)) vsnprintf_wstr_write, 174 174 &data 175 175 }; -
uspace/lib/c/generic/l18n/langs.c
r47b2d7e3 r1433ecda 54 54 */ 55 55 switch (locale) { 56 case L18N_WIN_LOCALE_AFRIKAANS:57 return "Afrikaans";58 case L18N_WIN_LOCALE_CZECH:59 return "Czech";60 case L18N_WIN_LOCALE_ENGLISH_UNITED_STATES:61 return "English (US)";62 case L18N_WIN_LOCALE_SLOVAK:63 return "Slovak";64 case L18N_WIN_LOCALE_SPANISH_TRADITIONAL:65 return "Spanish (traditional)";66 case L18N_WIN_LOCALE_ZULU:67 return "Zulu";68 default:69 break;56 case L18N_WIN_LOCALE_AFRIKAANS: 57 return "Afrikaans"; 58 case L18N_WIN_LOCALE_CZECH: 59 return "Czech"; 60 case L18N_WIN_LOCALE_ENGLISH_UNITED_STATES: 61 return "English (US)"; 62 case L18N_WIN_LOCALE_SLOVAK: 63 return "Slovak"; 64 case L18N_WIN_LOCALE_SPANISH_TRADITIONAL: 65 return "Spanish (traditional)"; 66 case L18N_WIN_LOCALE_ZULU: 67 return "Zulu"; 68 default: 69 break; 70 70 } 71 71 -
uspace/lib/c/generic/libc.c
r47b2d7e3 r1433ecda 138 138 139 139 /* Unreachable */ 140 while (1); 140 while (1) 141 ; 141 142 } 142 143 … … 146 147 147 148 /* Unreachable */ 148 while (1); 149 while (1) 150 ; 149 151 } 150 152 -
uspace/lib/c/generic/mem.c
r47b2d7e3 r1433ecda 54 54 word_size = sizeof(unsigned long); 55 55 fill = word_size - ((uintptr_t) dest & (word_size - 1)); 56 if (fill > n) fill = n; 56 if (fill > n) 57 fill = n; 57 58 58 59 pb = dest; … … 64 65 /* Compute remaining size. */ 65 66 n -= fill; 66 if (n == 0) return dest; 67 if (n == 0) 68 return dest; 67 69 68 70 n_words = n / word_size; … … 93 95 struct along { 94 96 unsigned long n; 95 } __attribute__ ((packed));97 } __attribute__((packed)); 96 98 97 99 static void *unaligned_memcpy(void *dst, const void *src, size_t n) … … 133 135 if (((uintptr_t) dst & (word_size - 1)) != 134 136 ((uintptr_t) src & (word_size - 1))) 135 return unaligned_memcpy(dst, src, n);137 return unaligned_memcpy(dst, src, n); 136 138 137 139 /* … … 143 145 mod = (uintptr_t) dst & (word_size - 1); 144 146 fill = word_size - mod; 145 if (fill > n) fill = n; 147 if (fill > n) 148 fill = n; 146 149 147 150 /* Copy the initial segment. */ … … 157 160 158 161 n -= fill; 159 if (n == 0) return dst; 162 if (n == 0) 163 return dst; 160 164 161 165 /* Pointers to aligned segment. */ -
uspace/lib/c/generic/pio_trace.c
r47b2d7e3 r1433ecda 50 50 } region_t; 51 51 52 static inline region_t * region_instance(link_t *l)52 static inline region_t *region_instance(link_t *l) 53 53 { 54 54 return list_get_instance(l, region_t, link); 55 55 } 56 56 57 static inline region_t * region_create(volatile void*base, size_t size,58 trace_fnc log, void *data)57 static inline region_t *region_create(volatile void *base, size_t size, 58 trace_fnc log, void *data) 59 59 { 60 60 region_t *new_reg = malloc(sizeof(region_t)); … … 79 79 } pio_regions_t; 80 80 81 static pio_regions_t * get_regions(void)81 static pio_regions_t *get_regions(void) 82 82 { 83 83 static pio_regions_t regions = { -
uspace/lib/c/generic/rcu.c
r47b2d7e3 r1433ecda 340 340 list_foreach_safe(rcu.fibrils_list, fibril_it, next_fibril) { 341 341 fibril_rcu_data_t *fib = member_to_inst(fibril_it, 342 fibril_rcu_data_t, link);342 fibril_rcu_data_t, link); 343 343 344 344 if (is_preexisting_reader(fib, reader_group)) { … … 405 405 if (!list_empty(&rcu.sync_lock.blocked_fibrils)) { 406 406 blocked_fibril_t *blocked_fib = member_to_inst( 407 list_first(&rcu.sync_lock.blocked_fibrils), blocked_fibril_t, link);407 list_first(&rcu.sync_lock.blocked_fibrils), blocked_fibril_t, link); 408 408 409 409 if (!blocked_fib->is_ready) { -
uspace/lib/c/generic/rtld/dynamic.c
r47b2d7e3 r1433ecda 65 65 d_val = dp->d_un.d_val; 66 66 DPRINTF("tag=%u ptr=0x%x val=%u\n", (unsigned)dp->d_tag, 67 (unsigned)d_ptr, (unsigned)d_val);67 (unsigned)d_ptr, (unsigned)d_val); 68 68 69 69 switch (dp->d_tag) { 70 70 71 case DT_PLTRELSZ: info->plt_rel_sz = d_val; break; 72 case DT_PLTGOT: info->plt_got = d_ptr; break; 73 case DT_HASH: info->hash = d_ptr; break; 74 case DT_STRTAB: info->str_tab = d_ptr; break; 75 case DT_SYMTAB: info->sym_tab = d_ptr; break; 76 case DT_RELA: info->rela = d_ptr; break; 77 case DT_RELASZ: info->rela_sz = d_val; break; 78 case DT_RELAENT: info->rela_ent = d_val; break; 79 case DT_STRSZ: info->str_sz = d_val; break; 80 case DT_SYMENT: info->sym_ent = d_val; break; 81 case DT_INIT: info->init = d_ptr; break; 82 case DT_FINI: info->fini = d_ptr; break; 83 case DT_SONAME: soname_idx = d_val; break; 84 case DT_RPATH: rpath_idx = d_val; break; 85 case DT_SYMBOLIC: info->symbolic = true; break; 86 case DT_REL: info->rel = d_ptr; break; 87 case DT_RELSZ: info->rel_sz = d_val; break; 88 case DT_RELENT: info->rel_ent = d_val; break; 89 case DT_PLTREL: info->plt_rel = d_val; break; 90 case DT_TEXTREL: info->text_rel = true; break; 91 case DT_JMPREL: info->jmp_rel = d_ptr; break; 92 case DT_BIND_NOW: info->bind_now = true; break; 71 case DT_PLTRELSZ: 72 info->plt_rel_sz = d_val; 73 break; 74 case DT_PLTGOT: 75 info->plt_got = d_ptr; 76 break; 77 case DT_HASH: 78 info->hash = d_ptr; 79 break; 80 case DT_STRTAB: 81 info->str_tab = d_ptr; 82 break; 83 case DT_SYMTAB: 84 info->sym_tab = d_ptr; 85 break; 86 case DT_RELA: 87 info->rela = d_ptr; 88 break; 89 case DT_RELASZ: 90 info->rela_sz = d_val; 91 break; 92 case DT_RELAENT: 93 info->rela_ent = d_val; 94 break; 95 case DT_STRSZ: 96 info->str_sz = d_val; 97 break; 98 case DT_SYMENT: 99 info->sym_ent = d_val; 100 break; 101 case DT_INIT: 102 info->init = d_ptr; 103 break; 104 case DT_FINI: 105 info->fini = d_ptr; 106 break; 107 case DT_SONAME: 108 soname_idx = d_val; 109 break; 110 case DT_RPATH: 111 rpath_idx = d_val; 112 break; 113 case DT_SYMBOLIC: 114 info->symbolic = true; 115 break; 116 case DT_REL: 117 info->rel = d_ptr; 118 break; 119 case DT_RELSZ: 120 info->rel_sz = d_val; 121 break; 122 case DT_RELENT: 123 info->rel_ent = d_val; 124 break; 125 case DT_PLTREL: 126 info->plt_rel = d_val; 127 break; 128 case DT_TEXTREL: 129 info->text_rel = true; 130 break; 131 case DT_JMPREL: 132 info->jmp_rel = d_ptr; 133 break; 134 case DT_BIND_NOW: 135 info->bind_now = true; 136 break; 93 137 94 138 default: … … 108 152 109 153 DPRINTF("str_tab=0x%" PRIxPTR ", soname_idx=0x%x, soname=0x%" PRIxPTR "\n", 110 (uintptr_t)info->soname, soname_idx, (uintptr_t)info->soname);154 (uintptr_t)info->soname, soname_idx, (uintptr_t)info->soname); 111 155 DPRINTF("soname='%s'\n", info->soname); 112 156 DPRINTF("rpath='%s'\n", info->rpath); … … 134 178 break; 135 179 136 default: break; 180 default: 181 break; 137 182 } 138 183 -
uspace/lib/c/generic/rtld/module.c
r47b2d7e3 r1433ecda 91 91 92 92 /* Do not relocate twice. */ 93 if (m->relocated) return; 93 if (m->relocated) 94 return; 94 95 95 96 module_process_pre_arch(m); … … 246 247 247 248 while (dp->d_tag != DT_NULL) { 248 if (dp->d_tag == DT_NEEDED) ++n; 249 if (dp->d_tag == DT_NEEDED) 250 ++n; 249 251 ++dp; 250 252 } -
uspace/lib/c/generic/rtld/rtld.c
r47b2d7e3 r1433ecda 186 186 * Ascending addresses 187 187 */ 188 offset = 0; i = 1; 188 offset = 0; 189 i = 1; 189 190 list_foreach(rtld->imodules, imodules_link, module_t, m) { 190 191 assert(i == m->id); … … 200 201 * Descending addresses 201 202 */ 202 offset = 0; i = 1; 203 offset = 0; 204 i = 1; 203 205 list_foreach(rtld->imodules, imodules_link, module_t, m) { 204 206 assert(i == m->id); -
uspace/lib/c/generic/rtld/symbol.c
r47b2d7e3 r1433ecda 55 55 h = (h << 4) + *name++; 56 56 g = h & 0xf0000000; 57 if (g != 0) h ^= g >> 24; 57 if (g != 0) 58 h ^= g >> 24; 58 59 h &= ~g; 59 60 } -
uspace/lib/c/generic/str.c
r47b2d7e3 r1433ecda 49 49 /** Check the condition if wchar_t is signed */ 50 50 #ifdef __WCHAR_UNSIGNED__ 51 #define WCHAR_SIGNED_CHECK(cond) (true)51 #define WCHAR_SIGNED_CHECK(cond) (true) 52 52 #else 53 #define WCHAR_SIGNED_CHECK(cond) (cond)53 #define WCHAR_SIGNED_CHECK(cond) (cond) 54 54 #endif 55 55 … … 164 164 /* 0xxxxxxx (Plain ASCII) */ 165 165 return b & 0x7f; 166 } 167 else if ((b & 0xe0) == 0xc0 || (b & 0xf0) == 0xe0 || 166 } else if ((b & 0xe0) == 0xc0 || (b & 0xf0) == 0xe0 || 168 167 (b & 0xf8) == 0xf0) { 169 168 /* Start byte */ 170 169 size_t start_offset = *offset; 171 170 return str_decode(str, &start_offset, size); 172 } 173 else if ((b & 0xc0) != 0x80) { 171 } else if ((b & 0xc0) != 0x80) { 174 172 /* Not a continuation byte */ 175 173 return U_SPECIAL; … … 936 934 ch += (src[idx + 1] & 0x03FF); 937 935 idx += 2; 938 } 939 else 936 } else 940 937 break; 941 938 } else { … … 983 980 idx++; 984 981 } else { 985 dest[idx] = c;982 dest[idx] = c; 986 983 } 987 984 … … 1110 1107 size_t len = str_length(str); 1111 1108 1112 wchar_t *wstr = calloc(len +1, sizeof(wchar_t));1109 wchar_t *wstr = calloc(len + 1, sizeof(wchar_t)); 1113 1110 if (wstr == NULL) 1114 1111 return NULL; -
uspace/lib/c/generic/str_error.c
r47b2d7e3 r1433ecda 57 57 #define __errno_entry(name, num, desc) #name, 58 58 59 static const char *err_name[] = {59 static const char *err_name[] = { 60 60 #include <abi/errno.in> 61 61 }; … … 64 64 #define __errno_entry(name, num, desc) "[" #name "]" desc, 65 65 66 static const char *err_desc[] = {66 static const char *err_desc[] = { 67 67 #include <abi/errno.in> 68 68 }; -
uspace/lib/c/generic/task.c
r47b2d7e3 r1433ecda 346 346 * @param wait task_wait_t previously initialized by task_setup_wait. 347 347 */ 348 void task_cancel_wait(task_wait_t *wait) { 348 void task_cancel_wait(task_wait_t *wait) 349 { 349 350 async_forget(wait->aid); 350 351 } -
uspace/lib/c/generic/thread.c
r47b2d7e3 r1433ecda 105 105 * @return Zero on success or a code from @ref errno.h on failure. 106 106 */ 107 errno_t thread_create(void (* function)(void *), void *arg, const char *name,107 errno_t thread_create(void (*function)(void *), void *arg, const char *name, 108 108 thread_id_t *tid) 109 109 { … … 157 157 158 158 /* Unreachable */ 159 while (1); 159 while (1) 160 ; 160 161 } 161 162 -
uspace/lib/c/generic/vfs/canonify.c
r47b2d7e3 r1433ecda 119 119 typedef struct { 120 120 state_t s; 121 void (* f)(token_t *, token_t *, token_t *);121 void (*f)(token_t *, token_t *, token_t *); 122 122 } change_state_t; 123 123 -
uspace/lib/c/generic/vfs/vfs.c
r47b2d7e3 r1433ecda 1317 1317 *pos += cnt; 1318 1318 rc = vfs_write_short(file, *pos, bp, nbyte - nwr, &cnt); 1319 } while (rc == EOK && ((ssize_t )nbyte - nwr - cnt) > 0);1319 } while (rc == EOK && ((ssize_t)nbyte - nwr - cnt) > 0); 1320 1320 1321 1321 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.
