Changeset 7c3fb9b in mainline for uspace/lib/c
- Timestamp:
- 2018-05-17T08:29:01Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6ff23ff
- Parents:
- fac0ac7
- git-author:
- Jiri Svoboda <jiri@…> (2018-05-16 17:28:17)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-05-17 08:29:01)
- Location:
- uspace/lib/c
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/abs32le/include/libarch/atomic.h
rfac0ac7 r7c3fb9b 55 55 static inline void atomic_inc(atomic_t *val) 56 56 { 57 /* On real hardware the increment has to be done 58 as an atomic action. */ 57 /* 58 * On real hardware the increment has to be done 59 * as an atomic action. 60 */ 59 61 60 62 val->count++; … … 63 65 static inline void atomic_dec(atomic_t *val) 64 66 { 65 /* On real hardware the decrement has to be done 66 as an atomic action. */ 67 /* 68 * On real hardware the decrement has to be done 69 * as an atomic action. 70 */ 67 71 68 72 val->count++; … … 71 75 static inline atomic_count_t atomic_postinc(atomic_t *val) 72 76 { 73 /* On real hardware both the storing of the previous 74 value and the increment have to be done as a single 75 atomic action. */ 77 /* 78 * On real hardware both the storing of the previous 79 * value and the increment have to be done as a single 80 * atomic action. 81 */ 76 82 77 83 atomic_count_t prev = val->count; … … 83 89 static inline atomic_count_t atomic_postdec(atomic_t *val) 84 90 { 85 /* On real hardware both the storing of the previous 86 value and the decrement have to be done as a single 87 atomic action. */ 91 /* 92 * On real hardware both the storing of the previous 93 * value and the decrement have to be done as a single 94 * atomic action. 95 */ 88 96 89 97 atomic_count_t prev = val->count; -
uspace/lib/c/arch/amd64/include/libarch/fibril_context.h
rfac0ac7 r7c3fb9b 1 /* Copyright (c) 2014 Jakub Jermar 1 /* 2 * Copyright (c) 2014 Jakub Jermar 2 3 * All rights reserved. 3 4 * … … 45 46 46 47 typedef struct context { 47 /* We include only registers that must be preserved 48 /* 49 * We include only registers that must be preserved 48 50 * during function call. 49 51 */ -
uspace/lib/c/arch/arm32/include/libarch/fibril_context.h
rfac0ac7 r7c3fb9b 1 /* Copyright (c) 2014 Jakub Jermar 1 /* 2 * Copyright (c) 2014 Jakub Jermar 2 3 * All rights reserved. 3 4 * -
uspace/lib/c/arch/ia32/include/libarch/fibril_context.h
rfac0ac7 r7c3fb9b 1 /* Copyright (c) 2014 Jakub Jermar 1 /* 2 * Copyright (c) 2014 Jakub Jermar 2 3 * All rights preserved. 3 4 * -
uspace/lib/c/arch/ia64/include/libarch/fibril_context.h
rfac0ac7 r7c3fb9b 1 /* Copyright (c) 2014 Jakub Jermar 1 /* 2 * Copyright (c) 2014 Jakub Jermar 2 3 * All rights preserved. 3 4 * -
uspace/lib/c/arch/mips32/include/libarch/atomic.h
rfac0ac7 r7c3fb9b 50 50 #define atomic_predec(x) atomic_add(x, -1) 51 51 52 /* Atomic addition of immediate value.52 /** Atomic addition of immediate value. 53 53 * 54 54 * @param val Memory location to which will be the immediate value added. -
uspace/lib/c/arch/mips32/include/libarch/fibril_context.h
rfac0ac7 r7c3fb9b 1 /* Copyright (c) 2014 Jakub Jermar 1 /* 2 * Copyright (c) 2014 Jakub Jermar 2 3 * All rights reserved. 3 4 * -
uspace/lib/c/arch/mips32/include/libarch/tls.h
rfac0ac7 r7c3fb9b 46 46 #define CONFIG_TLS_VARIANT_1 47 47 48 /* I did not find any specification (neither MIPS nor PowerPC), but 48 /* 49 * I did not find any specification (neither MIPS nor PowerPC), but 49 50 * as I found it 50 51 * - it uses Variant II -
uspace/lib/c/arch/ppc32/include/libarch/fibril_context.h
rfac0ac7 r7c3fb9b 1 /* Copyright (c) 2014 Jakub Jermar 1 /* 2 * Copyright (c) 2014 Jakub Jermar 2 3 * All rights reserved. 3 4 * -
uspace/lib/c/arch/riscv64/include/libarch/atomic.h
rfac0ac7 r7c3fb9b 57 57 static inline void atomic_inc(atomic_t *val) 58 58 { 59 /* On real hardware the increment has to be done 60 as an atomic action. */ 59 /* 60 * On real hardware the increment has to be done 61 * as an atomic action. 62 */ 61 63 62 64 val->count++; … … 65 67 static inline void atomic_dec(atomic_t *val) 66 68 { 67 /* On real hardware the decrement has to be done 68 as an atomic action. */ 69 /* 70 * On real hardware the decrement has to be done 71 * as an atomic action. 72 */ 69 73 70 74 val->count++; … … 73 77 static inline atomic_count_t atomic_postinc(atomic_t *val) 74 78 { 75 /* On real hardware both the storing of the previous 76 value and the increment have to be done as a single 77 atomic action. */ 79 /* 80 * On real hardware both the storing of the previous 81 * value and the increment have to be done as a single 82 * atomic action. 83 */ 78 84 79 85 atomic_count_t prev = val->count; … … 85 91 static inline atomic_count_t atomic_postdec(atomic_t *val) 86 92 { 87 /* On real hardware both the storing of the previous 88 value and the decrement have to be done as a single 89 atomic action. */ 93 /* 94 * On real hardware both the storing of the previous 95 * value and the decrement have to be done as a single 96 * atomic action. 97 */ 90 98 91 99 atomic_count_t prev = val->count; -
uspace/lib/c/arch/riscv64/include/libarch/fibril_context.h
rfac0ac7 r7c3fb9b 1 /* Copyright (c) 2016 Martin Decky 1 /* 2 * Copyright (c) 2016 Martin Decky 2 3 * All rights reserved. 3 4 * -
uspace/lib/c/arch/sparc64/include/libarch/fibril_context.h
rfac0ac7 r7c3fb9b 1 /* Copyright (c) 2014 Jakub Jermar 1 /* 2 * Copyright (c) 2014 Jakub Jermar 2 3 * All rights reserved. 3 4 * -
uspace/lib/c/generic/async.c
rfac0ac7 r7c3fb9b 1205 1205 assert(fibril_connection); 1206 1206 1207 /* Why doing this? 1207 /* 1208 * Why doing this? 1208 1209 * GCC 4.1.0 coughs on fibril_connection-> dereference. 1209 1210 * GCC 4.1.1 happilly puts the rdhwr instruction in delay slot. -
uspace/lib/c/generic/double_to_str.c
rfac0ac7 r7c3fb9b 102 102 ac = a * c; 103 103 104 /* Denote 32 bit parts of x a y as: x == a b, y == c d. Then: 104 /* 105 * Denote 32 bit parts of x a y as: x == a b, y == c d. Then: 105 106 * a b 106 107 * * c d … … 280 281 (rest + digit_val_diff < w_dist || rest - w_dist < w_dist - rest); 281 282 282 /* Of the shortest strings pick the one that is closest to the actual 283 floating point number. */ 283 /* 284 * Of the shortest strings pick the one that is closest to the actual 285 * floating point number. 286 */ 284 287 while (next_closer) { 285 288 assert('0' < buf[len - 1]); … … 571 574 * |0 0 .. 0 1|0 0 .. 0 0| == one == 1.0 572 575 * | 0 |0 0 .. 0 1| == w_err == 1 * 2^w_scaled.e 573 */576 */ 574 577 assert(alpha <= w_scaled.exponent && w_scaled.exponent <= gamma); 575 578 assert(0 != w_scaled.significand); … … 589 592 one.exponent = w_scaled.exponent; 590 593 591 /* Extract the integral part of w_scaled. 592 w_scaled / one == w_scaled >> -one.e */ 594 /* 595 * Extract the integral part of w_scaled. 596 * w_scaled / one == w_scaled >> -one.e 597 */ 593 598 uint32_t int_part = (uint32_t)(w_scaled.significand >> (-one.exponent)); 594 599 595 /* Fractional part of w_scaled. 596 w_scaled % one == w_scaled & (one.f - 1) */ 600 /* 601 * Fractional part of w_scaled. 602 * w_scaled % one == w_scaled & (one.f - 1) 603 */ 597 604 uint64_t frac_part = w_scaled.significand & (one.significand - 1); 598 605 -
uspace/lib/c/generic/elf/elf.c
rfac0ac7 r7c3fb9b 96 96 assert(elf_is_valid(hdr)); 97 97 98 /* There are two legal options for a HelenOS ELF file. 98 /* 99 * There are two legal options for a HelenOS ELF file. 99 100 * Either the file is ET_DYN (shared library or PIE), and the base is 100 101 * (required to be) at vaddr 0. Or the file is ET_EXEC (non-relocatable) -
uspace/lib/c/generic/elf/elf_mod.c
rfac0ac7 r7c3fb9b 189 189 } 190 190 191 /* Read program header table. 191 /* 192 * Read program header table. 192 193 * Normally, there are very few program headers, so don't bother 193 194 * with allocating memory dynamically. … … 239 240 } 240 241 241 /* Attempt to allocate a span of memory large enough for the 242 /* 243 * Attempt to allocate a span of memory large enough for the 242 244 * shared object. 243 245 */ -
uspace/lib/c/generic/getopt.c
rfac0ac7 r7c3fb9b 1 1 /* $NetBSD: getopt_long.c,v 1.21.4.1 2008/01/09 01:34:14 matt Exp $ */ 2 2 3 /* -3 /* 4 4 * Copyright (c) 2000 The NetBSD Foundation, Inc. 5 5 * All rights reserved. … … 41 41 #include <str.h> 42 42 43 /* HelenOS Port : We're incorporating only the modern getopt_long with wrappers 43 /* 44 * HelenOS Port : We're incorporating only the modern getopt_long with wrappers 44 45 * to keep legacy getopt() usage from breaking. All references to REPLACE_GETOPT 45 * are dropped, we just include the code */ 46 * are dropped, we just include the code 47 */ 46 48 47 49 int opterr = 1; /* if error message should be printed */ … … 81 83 /* Error messages */ 82 84 83 /* HelenOS Port: Calls to warnx() were eliminated (as we have no stderr that 85 /* 86 * HelenOS Port: Calls to warnx() were eliminated (as we have no stderr that 84 87 * may be redirected) and replaced with printf. As such, error messages now 85 * end in a newline */ 88 * end in a newline 89 */ 86 90 87 91 static const char recargchar[] = "option requires an argument -- %c\n"; -
uspace/lib/c/generic/ieee_double.c
rfac0ac7 r7c3fb9b 98 98 ret.pos_val.exponent = raw_exponent - exponent_bias; 99 99 100 /* The predecessor is closer to val than the successor 100 /* 101 * The predecessor is closer to val than the successor 101 102 * if val is a normal value of the form 2^k (hence 102 103 * raw_significand == 0) with the only exception being -
uspace/lib/c/generic/io/io.c
rfac0ac7 r7c3fb9b 105 105 void __stdio_init(void) 106 106 { 107 /* The first three standard file descriptors are assigned for compatibility. 107 /* 108 * The first three standard file descriptors are assigned for compatibility. 108 109 * This will probably be removed later. 109 110 */ -
uspace/lib/c/generic/io/vsnprintf.c
rfac0ac7 r7c3fb9b 70 70 71 71 if (left == 1) { 72 /* We have only one free byte left in buffer 72 /* 73 * We have only one free byte left in buffer 73 74 * -> store trailing zero 74 75 */ … … 79 80 80 81 if (left <= size) { 81 /* We do not have enough space for the whole string 82 /* 83 * We do not have enough space for the whole string 82 84 * with the trailing zero => print only a part 83 85 * of string … … 92 94 } 93 95 94 /* Put trailing zero at end, but not count it 96 /* 97 * Put trailing zero at end, but not count it 95 98 * into data->len so it could be rewritten next time 96 99 */ … … 104 107 data->len += size; 105 108 106 /* Put trailing zero at end, but not count it 109 /* 110 * Put trailing zero at end, but not count it 107 111 * into data->len so it could be rewritten next time 108 112 */ … … 140 144 141 145 if (left == 1) { 142 /* We have only one free byte left in buffer 146 /* 147 * We have only one free byte left in buffer 143 148 * -> store trailing zero 144 149 */ … … 154 159 } 155 160 156 /* Put trailing zero at end, but not count it 161 /* 162 * Put trailing zero at end, but not count it 157 163 * into data->len so it could be rewritten next time 158 164 */ -
uspace/lib/c/generic/rtld/module.c
rfac0ac7 r7c3fb9b 353 353 rtld->tls_align = max(rtld->tls_align, m->tls_align); 354 354 355 /* We are allocating spans "backwards", here, 355 /* 356 * We are allocating spans "backwards", here, 356 357 * as described in U. Drepper's paper. 357 358 */ … … 361 362 } 362 363 363 /* We are in negative offsets. In order for the alignments to 364 /* 365 * We are in negative offsets. In order for the alignments to 364 366 * be correct, "zero" offset (i.e. the total size) must be aligned 365 367 * to the strictest alignment present. -
uspace/lib/c/generic/str.c
rfac0ac7 r7c3fb9b 202 202 return EINVAL; 203 203 204 /* Unsigned version of ch (bit operations should only be done 205 on unsigned types). */ 204 /* 205 * Unsigned version of ch (bit operations should only be done 206 * on unsigned types). 207 */ 206 208 uint32_t cc = (uint32_t) ch; 207 209 … … 1222 1224 * @param ch Character to insert to. 1223 1225 * @param pos Character index where to insert. 1224 @@param max_pos Characters in the buffer.1226 * @param max_pos Characters in the buffer. 1225 1227 * 1226 1228 * @return True if the insertion was sucessful, false if the position … … 1531 1533 return EINVAL; 1532 1534 1533 /* Check whether we are at the end of 1534 the string in strict mode */ 1535 /* 1536 * Check whether we are at the end of 1537 * the string in strict mode 1538 */ 1535 1539 if ((strict) && (*lendptr != 0)) 1536 1540 return EINVAL; … … 1578 1582 return EINVAL; 1579 1583 1580 /* Check whether we are at the end of 1581 the string in strict mode */ 1584 /* 1585 * Check whether we are at the end of 1586 * the string in strict mode 1587 */ 1582 1588 if ((strict) && (*lendptr != 0)) 1583 1589 return EINVAL; … … 1625 1631 return EINVAL; 1626 1632 1627 /* Check whether we are at the end of 1628 the string in strict mode */ 1633 /* 1634 * Check whether we are at the end of 1635 * the string in strict mode 1636 */ 1629 1637 if ((strict) && (*lendptr != 0)) 1630 1638 return EINVAL; … … 1671 1679 return EINVAL; 1672 1680 1673 /* Check whether we are at the end of 1674 the string in strict mode */ 1681 /* 1682 * Check whether we are at the end of 1683 * the string in strict mode 1684 */ 1675 1685 if ((strict) && (*lendptr != 0)) 1676 1686 return EINVAL; … … 1711 1721 return EINVAL; 1712 1722 1713 /* Check whether we are at the end of 1714 the string in strict mode */ 1723 /* 1724 * Check whether we are at the end of 1725 * the string in strict mode 1726 */ 1715 1727 if ((strict) && (*lendptr != 0)) 1716 1728 return EINVAL; -
uspace/lib/c/generic/str_error.c
rfac0ac7 r7c3fb9b 41 41 #define NOERR_LEN 64 42 42 43 /* The arrays below are automatically generated from the same file that 43 /* 44 * The arrays below are automatically generated from the same file that 44 45 * errno.h constants are generated from. Triple-include of the same list 45 46 * with redefinitions of __errno() macro are used to ensure that the … … 73 74 static int find_errno(errno_t e) 74 75 { 75 /* Just a dumb linear search. 76 /* 77 * Just a dumb linear search. 76 78 * There are too few entries to warrant anything smarter. 77 79 */ -
uspace/lib/c/generic/strtol.c
rfac0ac7 r7c3fb9b 57 57 } 58 58 59 /* FIXME: workaround for GCC "optimizing" the overflow check 59 /* 60 * FIXME: workaround for GCC "optimizing" the overflow check 60 61 * into soft-emulated 128b multiplication using `__multi3`, 61 62 * which we don't currently implement. … … 139 140 140 141 if (endptr != NULL) { 141 /* Move the pointer to the end of the number, 142 /* 143 * Move the pointer to the end of the number, 142 144 * in case it isn't there already. 143 145 */ -
uspace/lib/c/generic/vfs/inbox.c
rfac0ac7 r7c3fb9b 65 65 static LIST_INITIALIZE(inb_list); 66 66 67 /* Inserts a named file into the inbox.67 /** Inserts a named file into the inbox. 68 68 * 69 69 * If a file with the same name is already present, it overwrites it and returns … … 118 118 } 119 119 120 /* Retrieve a file with this name.120 /** Retrieve a file with this name. 121 121 * 122 122 * @param name Name of the entry. … … 138 138 } 139 139 140 /* Writes names of entries that are currently set into an array provided by the140 /** Writes names of entries that are currently set into an array provided by the 141 141 * user. 142 142 * -
uspace/lib/c/generic/vol.c
rfac0ac7 r7c3fb9b 236 236 237 237 /** Erase partition (to the extent where we will consider it not containing 238 * a file system. */ 238 * a file system. 239 */ 239 240 errno_t vol_part_empty(vol_t *vol, service_id_t sid) 240 241 { -
uspace/lib/c/include/getopt.h
rfac0ac7 r7c3fb9b 1 1 /* $NetBSD: getopt.h,v 1.10.6.1 2008/05/18 12:30:09 yamt Exp $ */ 2 2 3 /* -3 /* 4 4 * Copyright (c) 2000 The NetBSD Foundation, Inc. 5 5 * All rights reserved. -
uspace/lib/c/include/io/pixelmap.h
rfac0ac7 r7c3fb9b 54 54 PIXELMAP_EXTEND_SIDES, 55 55 56 /* If outside of a pixmap, return closest pixel from the edge, 56 /* 57 * If outside of a pixmap, return closest pixel from the edge, 57 58 * with alpha = 0 58 59 */ -
uspace/lib/c/include/wchar.h
rfac0ac7 r7c3fb9b 27 27 */ 28 28 29 /* Authors: 29 /* 30 * Authors: 30 31 * Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com> 31 32 */
Note:
See TracChangeset
for help on using the changeset viewer.