Changeset 850235d in mainline for uspace/lib/c
- Timestamp:
- 2013-03-10T14:56:21Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 05bab88
- Parents:
- ea906c29 (diff), 2277e03 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/lib/c
- Files:
-
- 9 added
- 81 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
rea906c29 r850235d 113 113 generic/iplink.c \ 114 114 generic/iplink_srv.c \ 115 generic/ieee_double.c \ 116 generic/power_of_ten.c \ 117 generic/double_to_str.c \ 115 118 generic/malloc.c \ 116 119 generic/sysinfo.c \ … … 134 137 generic/net/socket_client.c \ 135 138 generic/net/socket_parse.c \ 139 generic/stack.c \ 136 140 generic/stacktrace.c \ 137 141 generic/arg_parse.c \ 138 142 generic/sort.c \ 139 143 generic/stats.c \ 140 generic/assert.c 144 generic/assert.c \ 145 generic/pio_trace.c 141 146 142 147 ifeq ($(CONFIG_RTLD),y) -
uspace/lib/c/arch/abs32le/include/libarch/atomic.h
rea906c29 r850235d 36 36 #define LIBC_abs32le_ATOMIC_H_ 37 37 38 #include < bool.h>38 #include <stdbool.h> 39 39 40 40 #define LIBC_ARCH_ATOMIC_H_ -
uspace/lib/c/arch/abs32le/include/libarch/ddi.h
rea906c29 r850235d 36 36 #include <libarch/types.h> 37 37 38 static inline void pio_write_8(ioport8_t *port, uint8_t v)38 static inline void arch_pio_write_8(ioport8_t *port, uint8_t v) 39 39 { 40 40 *port = v; 41 41 } 42 42 43 static inline void pio_write_16(ioport16_t *port, uint16_t v)43 static inline void arch_pio_write_16(ioport16_t *port, uint16_t v) 44 44 { 45 45 *port = v; 46 46 } 47 47 48 static inline void pio_write_32(ioport32_t *port, uint32_t v)48 static inline void arch_pio_write_32(ioport32_t *port, uint32_t v) 49 49 { 50 50 *port = v; 51 51 } 52 52 53 static inline uint8_t pio_read_8(ioport8_t *port)53 static inline uint8_t arch_pio_read_8(const ioport8_t *port) 54 54 { 55 55 return *port; 56 56 } 57 57 58 static inline uint16_t pio_read_16(ioport16_t *port)58 static inline uint16_t arch_pio_read_16(const ioport16_t *port) 59 59 { 60 60 return *port; 61 61 } 62 62 63 static inline uint32_t pio_read_32(ioport32_t *port)63 static inline uint32_t arch_pio_read_32(const ioport32_t *port) 64 64 { 65 65 return *port; -
uspace/lib/c/arch/abs32le/src/entryjmp.c
rea906c29 r850235d 30 30 */ 31 31 32 #include < bool.h>32 #include <stdbool.h> 33 33 #include <entry_point.h> 34 34 -
uspace/lib/c/arch/abs32le/src/fibril.c
rea906c29 r850235d 31 31 32 32 #include <fibril.h> 33 #include < bool.h>33 #include <stdbool.h> 34 34 35 35 int context_save(context_t *ctx) -
uspace/lib/c/arch/abs32le/src/stacktrace.c
rea906c29 r850235d 32 32 #include <sys/types.h> 33 33 #include <unistd.h> 34 #include < bool.h>34 #include <stdbool.h> 35 35 #include <stacktrace.h> 36 36 -
uspace/lib/c/arch/abs32le/src/tls.c
rea906c29 r850235d 34 34 #include <unistd.h> 35 35 36 tcb_t * __alloc_tls(void **data, size_t size)36 tcb_t * tls_alloc_arch(void **data, size_t size) 37 37 { 38 38 return tls_alloc_variant_2(data, size); 39 39 } 40 40 41 void __free_tls_arch(tcb_t *tcb, size_t size)41 void tls_free_arch(tcb_t *tcb, size_t size) 42 42 { 43 43 tls_free_variant_2(tcb, size); -
uspace/lib/c/arch/amd64/src/stacktrace.c
rea906c29 r850235d 36 36 37 37 #include <sys/types.h> 38 #include < bool.h>38 #include <stdbool.h> 39 39 40 40 #include <stacktrace.h> -
uspace/lib/c/arch/amd64/src/tls.c
rea906c29 r850235d 38 38 #include <sys/types.h> 39 39 40 tcb_t * __alloc_tls(void **data, size_t size)40 tcb_t *tls_alloc_arch(void **data, size_t size) 41 41 { 42 42 return tls_alloc_variant_2(data, size); 43 43 } 44 44 45 void __free_tls_arch(tcb_t *tcb, size_t size)45 void tls_free_arch(tcb_t *tcb, size_t size) 46 46 { 47 47 tls_free_variant_2(tcb, size); -
uspace/lib/c/arch/arm32/Makefile.common
rea906c29 r850235d 28 28 # 29 29 30 GCC_CFLAGS += -ffixed-r9 -mtp=soft -fno-omit-frame-pointer -mapcs-frame -march=$(subst _,-,$(PROCESSOR_ARCH)) 31 32 ifeq ($(CONFIG_FPU),y) 33 GCC_CFLAGS += -mfloat-abi=hard 34 else 30 35 BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a 31 GCC_CFLAGS += -ffixed-r9 -mtp=soft -fno-omit-frame-pointer -march=armv4 -mapcs-frame 36 endif 32 37 33 38 ENDIANESS = LE -
uspace/lib/c/arch/arm32/include/libarch/atomic.h
rea906c29 r850235d 41 41 42 42 #include <atomicdflt.h> 43 #include < bool.h>43 #include <stdbool.h> 44 44 #include <sys/types.h> 45 45 -
uspace/lib/c/arch/arm32/include/libarch/ddi.h
rea906c29 r850235d 37 37 #include <libarch/types.h> 38 38 39 static inline void pio_write_8(ioport8_t *port, uint8_t v)39 static inline void arch_pio_write_8(ioport8_t *port, uint8_t v) 40 40 { 41 41 *port = v; 42 42 } 43 43 44 static inline void pio_write_16(ioport16_t *port, uint16_t v)44 static inline void arch_pio_write_16(ioport16_t *port, uint16_t v) 45 45 { 46 46 *port = v; 47 47 } 48 48 49 static inline void pio_write_32(ioport32_t *port, uint32_t v)49 static inline void arch_pio_write_32(ioport32_t *port, uint32_t v) 50 50 { 51 51 *port = v; 52 52 } 53 53 54 static inline uint8_t pio_read_8(ioport8_t *port)54 static inline uint8_t arch_pio_read_8(const ioport8_t *port) 55 55 { 56 56 return *port; 57 57 } 58 58 59 static inline uint16_t pio_read_16(ioport16_t *port)59 static inline uint16_t arch_pio_read_16(const ioport16_t *port) 60 60 { 61 61 return *port; 62 62 } 63 63 64 static inline uint32_t pio_read_32(ioport32_t *port)64 static inline uint32_t arch_pio_read_32(const ioport32_t *port) 65 65 { 66 66 return *port; -
uspace/lib/c/arch/arm32/src/stacktrace.c
rea906c29 r850235d 36 36 37 37 #include <sys/types.h> 38 #include < bool.h>38 #include <stdbool.h> 39 39 40 40 #include <stacktrace.h> -
uspace/lib/c/arch/arm32/src/tls.c
rea906c29 r850235d 38 38 #include <sys/types.h> 39 39 40 tcb_t * __alloc_tls(void **data, size_t size)40 tcb_t *tls_alloc_arch(void **data, size_t size) 41 41 { 42 42 return tls_alloc_variant_1(data, size); 43 43 } 44 44 45 void __free_tls_arch(tcb_t *tcb, size_t size)45 void tls_free_arch(tcb_t *tcb, size_t size) 46 46 { 47 47 tls_free_variant_1(tcb, size); -
uspace/lib/c/arch/ia32/include/libarch/ddi.h
rea906c29 r850235d 39 39 #define IO_SPACE_BOUNDARY ((void *) (64 * 1024)) 40 40 41 static inline uint8_t pio_read_8(ioport8_t *port)41 static inline uint8_t arch_pio_read_8(const ioport8_t *port) 42 42 { 43 43 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { … … 55 55 } 56 56 57 static inline uint16_t pio_read_16(ioport16_t *port)57 static inline uint16_t arch_pio_read_16(const ioport16_t *port) 58 58 { 59 59 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { … … 71 71 } 72 72 73 static inline uint32_t pio_read_32(ioport32_t *port)73 static inline uint32_t arch_pio_read_32(const ioport32_t *port) 74 74 { 75 75 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { … … 87 87 } 88 88 89 static inline void pio_write_8(ioport8_t *port, uint8_t val)89 static inline void arch_pio_write_8(ioport8_t *port, uint8_t val) 90 90 { 91 91 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { … … 98 98 } 99 99 100 static inline void pio_write_16(ioport16_t *port, uint16_t val)100 static inline void arch_pio_write_16(ioport16_t *port, uint16_t val) 101 101 { 102 102 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { … … 109 109 } 110 110 111 static inline void pio_write_32(ioport32_t *port, uint32_t val)111 static inline void arch_pio_write_32(ioport32_t *port, uint32_t val) 112 112 { 113 113 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { -
uspace/lib/c/arch/ia32/src/stacktrace.c
rea906c29 r850235d 37 37 #include <libarch/config.h> 38 38 #include <sys/types.h> 39 #include < bool.h>39 #include <stdbool.h> 40 40 #include <stacktrace.h> 41 41 -
uspace/lib/c/arch/ia32/src/tls.c
rea906c29 r850235d 39 39 #include <align.h> 40 40 41 tcb_t * __alloc_tls(void **data, size_t size)41 tcb_t *tls_alloc_arch(void **data, size_t size) 42 42 { 43 43 return tls_alloc_variant_2(data, size); 44 44 } 45 45 46 void __free_tls_arch(tcb_t *tcb, size_t size)46 void tls_free_arch(tcb_t *tcb, size_t size) 47 47 { 48 48 tls_free_variant_2(tcb, size); -
uspace/lib/c/arch/ia64/include/libarch/ddi.h
rea906c29 r850235d 50 50 (ia64_iospace_address = get_ia64_iospace_address())) 51 51 52 static inline void pio_write_8(ioport8_t *port, uint8_t v)52 static inline void arch_pio_write_8(ioport8_t *port, uint8_t v) 53 53 { 54 54 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { … … 65 65 } 66 66 67 static inline void pio_write_16(ioport16_t *port, uint16_t v)67 static inline void arch_pio_write_16(ioport16_t *port, uint16_t v) 68 68 { 69 69 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { … … 80 80 } 81 81 82 static inline void pio_write_32(ioport32_t *port, uint32_t v)82 static inline void arch_pio_write_32(ioport32_t *port, uint32_t v) 83 83 { 84 84 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { … … 95 95 } 96 96 97 static inline uint8_t pio_read_8(ioport8_t *port)97 static inline uint8_t arch_pio_read_8(const ioport8_t *port) 98 98 { 99 99 uint8_t v; … … 115 115 } 116 116 117 static inline uint16_t pio_read_16(ioport16_t *port)117 static inline uint16_t arch_pio_read_16(const ioport16_t *port) 118 118 { 119 119 uint16_t v; … … 135 135 } 136 136 137 static inline uint32_t pio_read_32(ioport32_t *port)137 static inline uint32_t arch_pio_read_32(const ioport32_t *port) 138 138 { 139 139 uint32_t v; -
uspace/lib/c/arch/ia64/src/ddi.c
rea906c29 r850235d 1 /* 2 * Copyright (c) 2006 Martin Decky 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 1 28 #include <libarch/ddi.h> 2 29 #include <sysinfo.h> … … 12 39 return addr; 13 40 } 14 -
uspace/lib/c/arch/ia64/src/stacktrace.c
rea906c29 r850235d 36 36 37 37 #include <sys/types.h> 38 #include < bool.h>38 #include <stdbool.h> 39 39 #include <errno.h> 40 40 -
uspace/lib/c/arch/ia64/src/tls.c
rea906c29 r850235d 38 38 #include <malloc.h> 39 39 40 tcb_t * __alloc_tls(void **data, size_t size)40 tcb_t *tls_alloc_arch(void **data, size_t size) 41 41 { 42 42 return tls_alloc_variant_1(data, size); 43 43 } 44 44 45 void __free_tls_arch(tcb_t *tcb, size_t size)45 void tls_free_arch(tcb_t *tcb, size_t size) 46 46 { 47 47 tls_free_variant_1(tcb, size); -
uspace/lib/c/arch/mips32/include/libarch/ddi.h
rea906c29 r850235d 37 37 #include <libarch/types.h> 38 38 39 static inline void pio_write_8(ioport8_t *port, uint8_t v)39 static inline void arch_pio_write_8(ioport8_t *port, uint8_t v) 40 40 { 41 41 *port = v; 42 42 } 43 43 44 static inline void pio_write_16(ioport16_t *port, uint16_t v)44 static inline void arch_pio_write_16(ioport16_t *port, uint16_t v) 45 45 { 46 46 *port = v; 47 47 } 48 48 49 static inline void pio_write_32(ioport32_t *port, uint32_t v)49 static inline void arch_pio_write_32(ioport32_t *port, uint32_t v) 50 50 { 51 51 *port = v; 52 52 } 53 53 54 static inline uint8_t pio_read_8(ioport8_t *port)54 static inline uint8_t arch_pio_read_8(const ioport8_t *port) 55 55 { 56 56 return *port; 57 57 } 58 58 59 static inline uint16_t pio_read_16(ioport16_t *port)59 static inline uint16_t arch_pio_read_16(const ioport16_t *port) 60 60 { 61 61 return *port; 62 62 } 63 63 64 static inline uint32_t pio_read_32(ioport32_t *port)64 static inline uint32_t arch_pio_read_32(const ioport32_t *port) 65 65 { 66 66 return *port; -
uspace/lib/c/arch/mips32/src/stacktrace.c
rea906c29 r850235d 36 36 37 37 #include <sys/types.h> 38 #include < bool.h>38 #include <stdbool.h> 39 39 #include <errno.h> 40 40 -
uspace/lib/c/arch/mips32/src/tls.c
rea906c29 r850235d 37 37 #include <sys/types.h> 38 38 39 tcb_t * __alloc_tls(void **data, size_t size)39 tcb_t * tls_alloc_arch(void **data, size_t size) 40 40 { 41 41 return tls_alloc_variant_1(data, size); 42 42 } 43 43 44 void __free_tls_arch(tcb_t *tcb, size_t size)44 void tls_free_arch(tcb_t *tcb, size_t size) 45 45 { 46 46 tls_free_variant_1(tcb, size); -
uspace/lib/c/arch/mips64/include/libarch/ddi.h
rea906c29 r850235d 37 37 #include <libarch/types.h> 38 38 39 static inline void pio_write_8(ioport8_t *port, uint8_t v)39 static inline void arch_pio_write_8(ioport8_t *port, uint8_t v) 40 40 { 41 41 *port = v; 42 42 } 43 43 44 static inline void pio_write_16(ioport16_t *port, uint16_t v)44 static inline void arch_pio_write_16(ioport16_t *port, uint16_t v) 45 45 { 46 46 *port = v; 47 47 } 48 48 49 static inline void pio_write_32(ioport32_t *port, uint32_t v)49 static inline void arch_pio_write_32(ioport32_t *port, uint32_t v) 50 50 { 51 51 *port = v; 52 52 } 53 53 54 static inline uint8_t pio_read_8(ioport8_t *port)54 static inline uint8_t arch_pio_read_8(const ioport8_t *port) 55 55 { 56 56 return *port; 57 57 } 58 58 59 static inline uint16_t pio_read_16(ioport16_t *port)59 static inline uint16_t arch_pio_read_16(const ioport16_t *port) 60 60 { 61 61 return *port; 62 62 } 63 63 64 static inline uint32_t pio_read_32(ioport32_t *port)64 static inline uint32_t arch_pio_read_32(const ioport32_t *port) 65 65 { 66 66 return *port; -
uspace/lib/c/arch/mips64/src/stacktrace.c
rea906c29 r850235d 36 36 37 37 #include <sys/types.h> 38 #include < bool.h>38 #include <stdbool.h> 39 39 #include <errno.h> 40 40 -
uspace/lib/c/arch/mips64/src/tls.c
rea906c29 r850235d 37 37 #include <sys/types.h> 38 38 39 tcb_t * __alloc_tls(void **data, size_t size)39 tcb_t *tls_alloc_arch(void **data, size_t size) 40 40 { 41 41 return tls_alloc_variant_1(data, size); 42 42 } 43 43 44 void __free_tls_arch(tcb_t *tcb, size_t size)44 void tls_free_arch(tcb_t *tcb, size_t size) 45 45 { 46 46 tls_free_variant_1(tcb, size); -
uspace/lib/c/arch/ppc32/include/libarch/ddi.h
rea906c29 r850235d 37 37 #include <libarch/types.h> 38 38 39 static inline void pio_write_8(ioport8_t *port, uint8_t v)39 static inline void arch_pio_write_8(ioport8_t *port, uint8_t v) 40 40 { 41 41 *port = v; 42 42 } 43 43 44 static inline void pio_write_16(ioport16_t *port, uint16_t v)44 static inline void arch_pio_write_16(ioport16_t *port, uint16_t v) 45 45 { 46 46 *port = v; 47 47 } 48 48 49 static inline void pio_write_32(ioport32_t *port, uint32_t v)49 static inline void arch_pio_write_32(ioport32_t *port, uint32_t v) 50 50 { 51 51 *port = v; 52 52 } 53 53 54 static inline uint8_t pio_read_8(ioport8_t *port)54 static inline uint8_t arch_pio_read_8(const ioport8_t *port) 55 55 { 56 56 return *port; 57 57 } 58 58 59 static inline uint16_t pio_read_16(ioport16_t *port)59 static inline uint16_t arch_pio_read_16(const ioport16_t *port) 60 60 { 61 61 return *port; 62 62 } 63 63 64 static inline uint32_t pio_read_32(ioport32_t *port)64 static inline uint32_t arch_pio_read_32(const ioport32_t *port) 65 65 { 66 66 return *port; -
uspace/lib/c/arch/ppc32/src/stacktrace.c
rea906c29 r850235d 36 36 37 37 #include <sys/types.h> 38 #include < bool.h>38 #include <stdbool.h> 39 39 40 40 #include <stacktrace.h> -
uspace/lib/c/arch/ppc32/src/tls.c
rea906c29 r850235d 36 36 #include <sys/types.h> 37 37 38 tcb_t * __alloc_tls(void **data, size_t size)38 tcb_t *tls_alloc_arch(void **data, size_t size) 39 39 { 40 40 return tls_alloc_variant_1(data, size); 41 41 } 42 42 43 void __free_tls_arch(tcb_t *tcb, size_t size)43 void tls_free_arch(tcb_t *tcb, size_t size) 44 44 { 45 45 tls_free_variant_1(tcb, size); -
uspace/lib/c/arch/sparc64/include/libarch/ddi.h
rea906c29 r850235d 45 45 } 46 46 47 static inline void pio_write_8(ioport8_t *port, uint8_t v)47 static inline void arch_pio_write_8(ioport8_t *port, uint8_t v) 48 48 { 49 49 *port = v; … … 51 51 } 52 52 53 static inline void pio_write_16(ioport16_t *port, uint16_t v)53 static inline void arch_pio_write_16(ioport16_t *port, uint16_t v) 54 54 { 55 55 *port = v; … … 57 57 } 58 58 59 static inline void pio_write_32(ioport32_t *port, uint32_t v)59 static inline void arch_pio_write_32(ioport32_t *port, uint32_t v) 60 60 { 61 61 *port = v; … … 63 63 } 64 64 65 static inline uint8_t pio_read_8(ioport8_t *port)65 static inline uint8_t arch_pio_read_8(const ioport8_t *port) 66 66 { 67 67 uint8_t rv; … … 73 73 } 74 74 75 static inline uint16_t pio_read_16(ioport16_t *port)75 static inline uint16_t arch_pio_read_16(const ioport16_t *port) 76 76 { 77 77 uint16_t rv; … … 83 83 } 84 84 85 static inline uint32_t pio_read_32(ioport32_t *port)85 static inline uint32_t arch_pio_read_32(const ioport32_t *port) 86 86 { 87 87 uint32_t rv; -
uspace/lib/c/arch/sparc64/src/stacktrace.c
rea906c29 r850235d 35 35 36 36 #include <sys/types.h> 37 #include < bool.h>37 #include <stdbool.h> 38 38 #include <libarch/stack.h> 39 39 #include <errno.h> -
uspace/lib/c/arch/sparc64/src/tls.c
rea906c29 r850235d 38 38 #include <sys/types.h> 39 39 40 tcb_t * __alloc_tls(void **data, size_t size)40 tcb_t *tls_alloc_arch(void **data, size_t size) 41 41 { 42 42 return tls_alloc_variant_2(data, size); 43 43 } 44 44 45 void __free_tls_arch(tcb_t *tcb, size_t size)45 void tls_free_arch(tcb_t *tcb, size_t size) 46 46 { 47 47 tls_free_variant_2(tcb, size); -
uspace/lib/c/generic/adt/list.c
rea906c29 r850235d 40 40 41 41 #include <adt/list.h> 42 #include < bool.h>42 #include <stdbool.h> 43 43 44 44 /** Check for membership -
uspace/lib/c/generic/async.c
rea906c29 r850235d 109 109 #include <sys/time.h> 110 110 #include <libarch/barrier.h> 111 #include < bool.h>111 #include <stdbool.h> 112 112 #include <malloc.h> 113 113 #include <mem.h> -
uspace/lib/c/generic/ddi.c
rea906c29 r850235d 34 34 35 35 #include <assert.h> 36 #include <atomic.h> 36 37 #include <unistd.h> 38 #include <stdio.h> 37 39 #include <errno.h> 38 40 #include <sys/types.h> … … 47 49 #include "private/libc.h" 48 50 51 49 52 /** Return unique device number. 50 53 * … … 120 123 * 121 124 */ 122 int iospace_enable(task_id_t id, void *ioaddr, unsigned longsize)123 { 124 ddi_ioarg_t arg;125 126 arg.task_id = id;127 arg.ioaddr = ioaddr;128 arg.size = size;125 static int iospace_enable(task_id_t id, void *ioaddr, size_t size) 126 { 127 const ddi_ioarg_t arg = { 128 .task_id = id, 129 .ioaddr = ioaddr, 130 .size = size 131 }; 129 132 130 133 return __SYSCALL1(SYS_IOSPACE_ENABLE, (sysarg_t) &arg); … … 136 139 * @param size Size of the I/O region. 137 140 * @param virt Virtual address for application's 138 * PIO operations. 141 * PIO operations. Can be NULL for PMIO. 139 142 * 140 143 * @return EOK on success. … … 146 149 #ifdef IO_SPACE_BOUNDARY 147 150 if (pio_addr < IO_SPACE_BOUNDARY) { 148 *virt = pio_addr; 151 if (virt) 152 *virt = pio_addr; 149 153 return iospace_enable(task_get_id(), pio_addr, size); 150 154 } 155 #else 156 (void) iospace_enable; 151 157 #endif 152 158 if (!virt) 159 return EINVAL; 160 153 161 void *phys_frame = 154 162 (void *) ALIGN_DOWN((uintptr_t) pio_addr, PAGE_SIZE); … … 166 174 } 167 175 176 void pio_write_8(ioport8_t *reg, uint8_t val) 177 { 178 pio_trace_log(reg, val, true); 179 arch_pio_write_8(reg, val); 180 } 181 182 void pio_write_16(ioport16_t *reg, uint16_t val) 183 { 184 pio_trace_log(reg, val, true); 185 arch_pio_write_16(reg, val); 186 } 187 188 void pio_write_32(ioport32_t *reg, uint32_t val) 189 { 190 pio_trace_log(reg, val, true); 191 arch_pio_write_32(reg, val); 192 } 193 194 uint8_t pio_read_8(const ioport8_t *reg) 195 { 196 const uint8_t val = arch_pio_read_8(reg); 197 pio_trace_log(reg, val, false); 198 return val; 199 } 200 201 uint16_t pio_read_16(const ioport16_t *reg) 202 { 203 const uint16_t val = arch_pio_read_16(reg); 204 pio_trace_log(reg, val, false); 205 return val; 206 } 207 208 uint32_t pio_read_32(const ioport32_t *reg) 209 { 210 const uint32_t val = arch_pio_read_32(reg); 211 pio_trace_log(reg, val, false); 212 return val; 213 } 214 168 215 /** Register IRQ notification. 169 216 * -
uspace/lib/c/generic/devman.c
rea906c29 r850235d 45 45 #include <errno.h> 46 46 #include <malloc.h> 47 #include < bool.h>47 #include <stdbool.h> 48 48 49 49 static FIBRIL_MUTEX_INITIALIZE(devman_driver_block_mutex); -
uspace/lib/c/generic/fibril.c
rea906c29 r850235d 37 37 #include <fibril.h> 38 38 #include <thread.h> 39 #include <stack.h> 39 40 #include <tls.h> 40 41 #include <malloc.h> 42 #include <abi/mm/as.h> 43 #include <as.h> 41 44 #include <unistd.h> 42 45 #include <stdio.h> … … 47 50 #include <async.h> 48 51 49 #ifndef FIBRIL_INITIAL_STACK_PAGES_NO50 #define FIBRIL_INITIAL_STACK_PAGES_NO 151 #endif52 53 52 /** 54 53 * This futex serializes access to ready_list, … … 96 95 fibril_t *fibril_setup(void) 97 96 { 98 tcb_t *tcb = __make_tls();97 tcb_t *tcb = tls_make(); 99 98 if (!tcb) 100 99 return NULL; … … 102 101 fibril_t *fibril = malloc(sizeof(fibril_t)); 103 102 if (!fibril) { 104 __free_tls(tcb);103 tls_free(tcb); 105 104 return NULL; 106 105 } … … 123 122 void fibril_teardown(fibril_t *fibril) 124 123 { 125 __free_tls(fibril->tcb);124 tls_free(fibril->tcb); 126 125 free(fibril); 127 126 } … … 195 194 * stack member filled. 196 195 */ 197 free(stack);196 as_area_destroy(stack); 198 197 } 199 198 fibril_teardown(srcf->clean_after_me); … … 269 268 return 0; 270 269 271 fibril->stack = 272 (char *) malloc(FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize()); 273 if (!fibril->stack) { 270 size_t stack_size = stack_size_get(); 271 fibril->stack = as_area_create((void *) -1, stack_size, 272 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD | 273 AS_AREA_LATE_RESERVE); 274 if (fibril->stack == (void *) -1) { 274 275 fibril_teardown(fibril); 275 276 return 0; … … 281 282 context_save(&fibril->ctx); 282 283 context_set(&fibril->ctx, FADDR(fibril_main), fibril->stack, 283 FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize(), fibril->tcb);284 stack_size, fibril->tcb); 284 285 285 286 return (fid_t) fibril; … … 298 299 fibril_t *fibril = (fibril_t *) fid; 299 300 300 free(fibril->stack);301 as_area_destroy(fibril->stack); 301 302 fibril_teardown(fibril); 302 303 } -
uspace/lib/c/generic/io/chargrid.c
rea906c29 r850235d 37 37 #include <unistd.h> 38 38 #include <assert.h> 39 #include < bool.h>39 #include <stdbool.h> 40 40 #include <as.h> 41 41 #include <io/chargrid.h> -
uspace/lib/c/generic/io/io.c
rea906c29 r850235d 39 39 #include <str.h> 40 40 #include <errno.h> 41 #include < bool.h>41 #include <stdbool.h> 42 42 #include <malloc.h> 43 43 #include <async.h> -
uspace/lib/c/generic/io/klog.c
rea906c29 r850235d 39 39 #include <unistd.h> 40 40 #include <errno.h> 41 #include <abi/klog.h> 41 42 #include <io/klog.h> 42 43 #include <io/printf_core.h> … … 44 45 size_t klog_write(const void *buf, size_t size) 45 46 { 46 ssize_t ret = (ssize_t) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, size);47 ssize_t ret = (ssize_t) __SYSCALL3(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf, size); 47 48 48 49 if (ret >= 0) … … 54 55 void klog_update(void) 55 56 { 56 (void) __SYSCALL3(SYS_KLOG, 1, (uintptr_t) NULL, 0); 57 (void) __SYSCALL3(SYS_KLOG, KLOG_UPDATE, (uintptr_t) NULL, 0); 58 } 59 60 void klog_command(const void *buf, size_t size) 61 { 62 (void) __SYSCALL3(SYS_KLOG, KLOG_COMMAND, (sysarg_t) buf, (sysarg_t) size); 57 63 } 58 64 -
uspace/lib/c/generic/io/printf_core.c
rea906c29 r850235d 42 42 #include <ctype.h> 43 43 #include <str.h> 44 #include <double_to_str.h> 45 #include <ieee_double.h> 46 #include <assert.h> 47 #include <macros.h> 48 44 49 45 50 /** show prefixes 0x or 0 */ 46 51 #define __PRINTF_FLAG_PREFIX 0x00000001 47 52 53 /** show the decimal point even if no fractional digits present */ 54 #define __PRINTF_FLAG_DECIMALPT 0x00000001 55 48 56 /** signed / unsigned number */ 49 57 #define __PRINTF_FLAG_SIGNED 0x00000002 … … 66 74 /** number has - sign */ 67 75 #define __PRINTF_FLAG_NEGATIVE 0x00000100 76 77 /** don't print trailing zeros in the fractional part */ 78 #define __PRINTF_FLAG_NOFRACZEROS 0x00000200 79 68 80 69 81 /** … … 110 122 static const char invalch = U_SPECIAL; 111 123 124 125 126 /** Unformatted double number string representation. */ 127 typedef struct { 128 /** Buffer with len digits, no sign or leading zeros. */ 129 char *str; 130 /** Number of digits in str. */ 131 int len; 132 /** Decimal exponent, ie number = str * 10^dec_exp */ 133 int dec_exp; 134 /** True if negative. */ 135 bool neg; 136 } double_str_t; 137 138 139 140 /** Returns the sign character or 0 if no sign should be printed. */ 141 static int get_sign_char(bool negative, uint32_t flags) 142 { 143 if (negative) { 144 return '-'; 145 } else if (flags & __PRINTF_FLAG_SHOWPLUS) { 146 return '+'; 147 } else if (flags & __PRINTF_FLAG_SPACESIGN) { 148 return ' '; 149 } else { 150 return 0; 151 } 152 } 153 154 /** Prints count times character ch. */ 155 static int print_padding(char ch, int count, printf_spec_t *ps) 156 { 157 for (int i = 0; i < count; ++i) { 158 if (ps->str_write(&ch, 1, ps->data) < 0) { 159 return -1; 160 } 161 } 162 163 return count; 164 } 165 166 112 167 /** Print one or more characters without adding newline. 113 168 * … … 281 336 return printf_putstr(nullstr, ps); 282 337 283 /* Print leading spaces. */284 338 size_t strw = str_length(str); 339 340 /* Precision unspecified - print everything. */ 285 341 if ((precision == 0) || (precision > strw)) 286 342 precision = strw; … … 329 385 return printf_putstr(nullstr, ps); 330 386 331 /* Print leading spaces. */332 387 size_t strw = wstr_length(str); 388 389 /* Precision not specified - print everything. */ 333 390 if ((precision == 0) || (precision > strw)) 334 391 precision = strw; … … 377 434 uint32_t flags, printf_spec_t *ps) 378 435 { 436 /* Precision not specified. */ 437 if (precision < 0) { 438 precision = 0; 439 } 440 379 441 const char *digits; 380 442 if (flags & __PRINTF_FLAG_BIGCHARS) … … 525 587 526 588 return ((int) counter); 589 } 590 591 /** Prints a special double (ie NaN, infinity) padded to width characters. */ 592 static int print_special(ieee_double_t val, int width, uint32_t flags, 593 printf_spec_t *ps) 594 { 595 assert(val.is_special); 596 597 char sign = get_sign_char(val.is_negative, flags); 598 599 const int str_len = 3; 600 const char *str; 601 602 if (flags & __PRINTF_FLAG_BIGCHARS) { 603 str = val.is_infinity ? "INF" : "NAN"; 604 } else { 605 str = val.is_infinity ? "inf" : "nan"; 606 } 607 608 int padding_len = max(0, width - ((sign ? 1 : 0) + str_len)); 609 610 int counter = 0; 611 int ret; 612 613 /* Leading padding. */ 614 if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { 615 if ((ret = print_padding(' ', padding_len, ps)) < 0) 616 return -1; 617 618 counter += ret; 619 } 620 621 if (sign) { 622 if ((ret = ps->str_write(&sign, 1, ps->data)) < 0) 623 return -1; 624 625 counter += ret; 626 } 627 628 if ((ret = ps->str_write(str, str_len, ps->data)) < 0) 629 return -1; 630 631 counter += ret; 632 633 634 /* Trailing padding. */ 635 if (flags & __PRINTF_FLAG_LEFTALIGNED) { 636 if ((ret = print_padding(' ', padding_len, ps)) < 0) 637 return -1; 638 639 counter += ret; 640 } 641 642 return counter; 643 } 644 645 /** Trims trailing zeros but leaves a single "0" intact. */ 646 static void fp_trim_trailing_zeros(char *buf, int *len, int *dec_exp) 647 { 648 /* Cut the zero off by adjusting the exponent. */ 649 while (2 <= *len && '0' == buf[*len - 1]) { 650 --*len; 651 ++*dec_exp; 652 } 653 } 654 655 /** Textually round up the last digit thereby eliminating it. */ 656 static void fp_round_up(char *buf, int *len, int *dec_exp) 657 { 658 assert(1 <= *len); 659 660 char *last_digit = &buf[*len - 1]; 661 662 int carry = ('5' <= *last_digit); 663 664 /* Cut the digit off by adjusting the exponent. */ 665 --*len; 666 ++*dec_exp; 667 --last_digit; 668 669 if (carry) { 670 /* Skip all the digits to cut off/round to zero. */ 671 while (buf <= last_digit && '9' == *last_digit) { 672 --last_digit; 673 } 674 675 /* last_digit points to the last digit to round but not '9' */ 676 if (buf <= last_digit) { 677 *last_digit += 1; 678 int new_len = last_digit - buf + 1; 679 *dec_exp += *len - new_len; 680 *len = new_len; 681 } else { 682 /* All len digits rounded to 0. */ 683 buf[0] = '1'; 684 *dec_exp += *len; 685 *len = 1; 686 } 687 } else { 688 /* The only digit was rounded to 0. */ 689 if (last_digit < buf) { 690 buf[0] = '0'; 691 *dec_exp = 0; 692 *len = 1; 693 } 694 } 695 } 696 697 698 /** Format and print the double string repressentation according 699 * to the %f specifier. 700 */ 701 static int print_double_str_fixed(double_str_t *val_str, int precision, int width, 702 uint32_t flags, printf_spec_t *ps) 703 { 704 int len = val_str->len; 705 char *buf = val_str->str; 706 int dec_exp = val_str->dec_exp; 707 708 assert(0 < len); 709 assert(0 <= precision); 710 assert(0 <= dec_exp || -dec_exp <= precision); 711 712 /* Number of integral digits to print (at least leading zero). */ 713 int int_len = max(1, len + dec_exp); 714 715 char sign = get_sign_char(val_str->neg, flags); 716 717 /* Fractional portion lengths. */ 718 int last_frac_signif_pos = max(0, -dec_exp); 719 int leading_frac_zeros = max(0, last_frac_signif_pos - len); 720 int signif_frac_figs = min(last_frac_signif_pos, len); 721 int trailing_frac_zeros = precision - last_frac_signif_pos; 722 char *buf_frac = buf + len - signif_frac_figs; 723 724 if (flags & __PRINTF_FLAG_NOFRACZEROS) { 725 trailing_frac_zeros = 0; 726 } 727 728 int frac_len = leading_frac_zeros + signif_frac_figs + trailing_frac_zeros; 729 730 bool has_decimal_pt = (0 < frac_len) || (flags & __PRINTF_FLAG_DECIMALPT); 731 732 /* Number of non-padding chars to print. */ 733 int num_len = (sign ? 1 : 0) + int_len + (has_decimal_pt ? 1 : 0) + frac_len; 734 735 int padding_len = max(0, width - num_len); 736 int ret = 0; 737 int counter = 0; 738 739 /* Leading padding and sign. */ 740 741 if (!(flags & (__PRINTF_FLAG_LEFTALIGNED | __PRINTF_FLAG_ZEROPADDED))) { 742 if ((ret = print_padding(' ', padding_len, ps)) < 0) 743 return -1; 744 745 counter += ret; 746 } 747 748 if (sign) { 749 if ((ret = ps->str_write(&sign, 1, ps->data)) < 0) 750 return -1; 751 752 counter += ret; 753 } 754 755 if (flags & __PRINTF_FLAG_ZEROPADDED) { 756 if ((ret = print_padding('0', padding_len, ps)) < 0) 757 return -1; 758 759 counter += ret; 760 } 761 762 /* Print the intergral part of the buffer. */ 763 764 int buf_int_len = min(len, len + dec_exp); 765 766 if (0 < buf_int_len) { 767 if ((ret = ps->str_write(buf, buf_int_len, ps->data)) < 0) 768 return -1; 769 770 counter += ret; 771 772 /* Print trailing zeros of the integral part of the number. */ 773 if ((ret = print_padding('0', int_len - buf_int_len, ps)) < 0) 774 return -1; 775 } else { 776 /* Single leading integer 0. */ 777 char ch = '0'; 778 if ((ret = ps->str_write(&ch, 1, ps->data)) < 0) 779 return -1; 780 } 781 782 counter += ret; 783 784 /* Print the decimal point and the fractional part. */ 785 if (has_decimal_pt) { 786 char ch = '.'; 787 788 if ((ret = ps->str_write(&ch, 1, ps->data)) < 0) 789 return -1; 790 791 counter += ret; 792 793 /* Print leading zeros of the fractional part of the number. */ 794 if ((ret = print_padding('0', leading_frac_zeros, ps)) < 0) 795 return -1; 796 797 counter += ret; 798 799 /* Print significant digits of the fractional part of the number. */ 800 if (0 < signif_frac_figs) { 801 if ((ret = ps->str_write(buf_frac, signif_frac_figs, ps->data)) < 0) 802 return -1; 803 804 counter += ret; 805 } 806 807 /* Print trailing zeros of the fractional part of the number. */ 808 if ((ret = print_padding('0', trailing_frac_zeros, ps)) < 0) 809 return -1; 810 811 counter += ret; 812 } 813 814 /* Trailing padding. */ 815 if (flags & __PRINTF_FLAG_LEFTALIGNED) { 816 if ((ret = print_padding(' ', padding_len, ps)) < 0) 817 return -1; 818 819 counter += ret; 820 } 821 822 return counter; 823 } 824 825 826 /** Convert, format and print a double according to the %f specifier. 827 * 828 * @param g Double to print. 829 * @param precision Number of fractional digits to print. If 0 no 830 * decimal point will be printed unless the flag 831 * __PRINTF_FLAG_DECIMALPT is specified. 832 * @param width Minimum number of characters to display. Pads 833 * with '0' or ' ' depending on the set flags; 834 * @param flags Printf flags. 835 * @param ps Printing functions. 836 * 837 * @return The number of characters printed; negative on failure. 838 */ 839 static int print_double_fixed(double g, int precision, int width, uint32_t flags, 840 printf_spec_t *ps) 841 { 842 if (flags & __PRINTF_FLAG_LEFTALIGNED) { 843 flags &= ~__PRINTF_FLAG_ZEROPADDED; 844 } 845 846 if (flags & __PRINTF_FLAG_DECIMALPT) { 847 flags &= ~__PRINTF_FLAG_NOFRACZEROS; 848 } 849 850 ieee_double_t val = extract_ieee_double(g); 851 852 if (val.is_special) { 853 return print_special(val, width, flags, ps); 854 } 855 856 char buf[MAX_DOUBLE_STR_BUF_SIZE]; 857 const size_t buf_size = MAX_DOUBLE_STR_BUF_SIZE; 858 double_str_t val_str; 859 860 val_str.str = buf; 861 val_str.neg = val.is_negative; 862 863 if (0 <= precision) { 864 /* 865 * Request one more digit so we can round the result. The last 866 * digit it returns may have an error of at most +/- 1. 867 */ 868 val_str.len = double_to_fixed_str(val, -1, precision + 1, buf, buf_size, 869 &val_str.dec_exp); 870 871 /* 872 * Round using the last digit to produce precision fractional digits. 873 * If less than precision+1 fractional digits were output the last 874 * digit is definitely inaccurate so also round to get rid of it. 875 */ 876 fp_round_up(buf, &val_str.len, &val_str.dec_exp); 877 878 /* Rounding could have introduced trailing zeros. */ 879 if (flags & __PRINTF_FLAG_NOFRACZEROS) { 880 fp_trim_trailing_zeros(buf, &val_str.len, &val_str.dec_exp); 881 } 882 } else { 883 /* Let the implementation figure out the proper precision. */ 884 val_str.len = double_to_short_str(val, buf, buf_size, &val_str.dec_exp); 885 886 /* Precision needed for the last significant digit. */ 887 precision = max(0, -val_str.dec_exp); 888 } 889 890 return print_double_str_fixed(&val_str, precision, width, flags, ps); 891 } 892 893 /** Prints the decimal exponent part of a %e specifier formatted number. */ 894 static int print_exponent(int exp_val, uint32_t flags, printf_spec_t *ps) 895 { 896 int counter = 0; 897 int ret; 898 899 char exp_ch = (flags & __PRINTF_FLAG_BIGCHARS) ? 'E' : 'e'; 900 901 if ((ret = ps->str_write(&exp_ch, 1, ps->data)) < 0) 902 return -1; 903 904 counter += ret; 905 906 char exp_sign = (exp_val < 0) ? '-' : '+'; 907 908 if ((ret = ps->str_write(&exp_sign, 1, ps->data)) < 0) 909 return -1; 910 911 counter += ret; 912 913 /* Print the exponent. */ 914 exp_val = abs(exp_val); 915 916 char exp_str[4] = { 0 }; 917 918 exp_str[0] = '0' + exp_val / 100; 919 exp_str[1] = '0' + (exp_val % 100) / 10 ; 920 exp_str[2] = '0' + (exp_val % 10); 921 922 int exp_len = (exp_str[0] == '0') ? 2 : 3; 923 const char *exp_str_start = &exp_str[3] - exp_len; 924 925 if ((ret = ps->str_write(exp_str_start, exp_len, ps->data)) < 0) 926 return -1; 927 928 counter += ret; 929 930 return counter; 931 } 932 933 934 /** Format and print the double string repressentation according 935 * to the %e specifier. 936 */ 937 static int print_double_str_scient(double_str_t *val_str, int precision, 938 int width, uint32_t flags, printf_spec_t *ps) 939 { 940 int len = val_str->len; 941 int dec_exp = val_str->dec_exp; 942 char *buf = val_str->str; 943 944 assert(0 < len); 945 946 char sign = get_sign_char(val_str->neg, flags); 947 bool has_decimal_pt = (0 < precision) || (flags & __PRINTF_FLAG_DECIMALPT); 948 int dec_pt_len = has_decimal_pt ? 1 : 0; 949 950 /* Fractional part lengths. */ 951 int signif_frac_figs = len - 1; 952 int trailing_frac_zeros = precision - signif_frac_figs; 953 954 if (flags & __PRINTF_FLAG_NOFRACZEROS) { 955 trailing_frac_zeros = 0; 956 } 957 958 int frac_len = signif_frac_figs + trailing_frac_zeros; 959 960 int exp_val = dec_exp + len - 1; 961 /* Account for exponent sign and 'e'; minimum 2 digits. */ 962 int exp_len = 2 + (abs(exp_val) >= 100 ? 3 : 2); 963 964 /* Number of non-padding chars to print. */ 965 int num_len = (sign ? 1 : 0) + 1 + dec_pt_len + frac_len + exp_len; 966 967 int padding_len = max(0, width - num_len); 968 int ret = 0; 969 int counter = 0; 970 971 if (!(flags & (__PRINTF_FLAG_LEFTALIGNED | __PRINTF_FLAG_ZEROPADDED))) { 972 if ((ret = print_padding(' ', padding_len, ps)) < 0) 973 return -1; 974 975 counter += ret; 976 } 977 978 if (sign) { 979 if ((ret = ps->str_write(&sign, 1, ps->data)) < 0) 980 return -1; 981 982 counter += ret; 983 } 984 985 if (flags & __PRINTF_FLAG_ZEROPADDED) { 986 if ((ret = print_padding('0', padding_len, ps)) < 0) 987 return -1; 988 989 counter += ret; 990 } 991 992 /* Single leading integer. */ 993 if ((ret = ps->str_write(buf, 1, ps->data)) < 0) 994 return -1; 995 996 counter += ret; 997 998 /* Print the decimal point and the fractional part. */ 999 if (has_decimal_pt) { 1000 char ch = '.'; 1001 1002 if ((ret = ps->str_write(&ch, 1, ps->data)) < 0) 1003 return -1; 1004 1005 counter += ret; 1006 1007 /* Print significant digits of the fractional part of the number. */ 1008 if (0 < signif_frac_figs) { 1009 if ((ret = ps->str_write(buf + 1, signif_frac_figs, ps->data)) < 0) 1010 return -1; 1011 1012 counter += ret; 1013 } 1014 1015 /* Print trailing zeros of the fractional part of the number. */ 1016 if ((ret = print_padding('0', trailing_frac_zeros, ps)) < 0) 1017 return -1; 1018 1019 counter += ret; 1020 } 1021 1022 /* Print the exponent. */ 1023 if ((ret = print_exponent(exp_val, flags, ps)) < 0) 1024 return -1; 1025 1026 counter += ret; 1027 1028 if (flags & __PRINTF_FLAG_LEFTALIGNED) { 1029 if ((ret = print_padding(' ', padding_len, ps)) < 0) 1030 return -1; 1031 1032 counter += ret; 1033 } 1034 1035 return counter; 1036 } 1037 1038 1039 /** Convert, format and print a double according to the %e specifier. 1040 * 1041 * Note that if g is large, the output may be huge (3e100 prints 1042 * with at least 100 digits). 1043 * 1044 * %e style: [-]d.dddde+dd 1045 * left-justified: [-]d.dddde+dd[space_pad] 1046 * right-justified: [space_pad][-][zero_pad]d.dddde+dd 1047 * 1048 * @param g Double to print. 1049 * @param precision Number of fractional digits to print, ie 1050 * precision + 1 significant digits to display. If 0 no 1051 * decimal point will be printed unless the flag 1052 * __PRINTF_FLAG_DECIMALPT is specified. If negative 1053 * the shortest accurate number will be printed. 1054 * @param width Minimum number of characters to display. Pads 1055 * with '0' or ' ' depending on the set flags; 1056 * @param flags Printf flags. 1057 * @param ps Printing functions. 1058 * 1059 * @return The number of characters printed; negative on failure. 1060 */ 1061 static int print_double_scientific(double g, int precision, int width, 1062 uint32_t flags, printf_spec_t *ps) 1063 { 1064 if (flags & __PRINTF_FLAG_LEFTALIGNED) { 1065 flags &= ~__PRINTF_FLAG_ZEROPADDED; 1066 } 1067 1068 ieee_double_t val = extract_ieee_double(g); 1069 1070 if (val.is_special) { 1071 return print_special(val, width, flags, ps); 1072 } 1073 1074 char buf[MAX_DOUBLE_STR_BUF_SIZE]; 1075 const size_t buf_size = MAX_DOUBLE_STR_BUF_SIZE; 1076 double_str_t val_str; 1077 1078 val_str.str = buf; 1079 val_str.neg = val.is_negative; 1080 1081 if (0 <= precision) { 1082 /* 1083 * Request one more digit (in addition to the leading integer) 1084 * so we can round the result. The last digit it returns may 1085 * have an error of at most +/- 1. 1086 */ 1087 val_str.len = double_to_fixed_str(val, precision + 2, -1, buf, buf_size, 1088 &val_str.dec_exp); 1089 1090 /* 1091 * Round the extra digit to produce precision+1 significant digits. 1092 * If less than precision+2 significant digits were returned the last 1093 * digit is definitely inaccurate so also round to get rid of it. 1094 */ 1095 fp_round_up(buf, &val_str.len, &val_str.dec_exp); 1096 1097 /* Rounding could have introduced trailing zeros. */ 1098 if (flags & __PRINTF_FLAG_NOFRACZEROS) { 1099 fp_trim_trailing_zeros(buf, &val_str.len, &val_str.dec_exp); 1100 } 1101 } else { 1102 /* Let the implementation figure out the proper precision. */ 1103 val_str.len = double_to_short_str(val, buf, buf_size, &val_str.dec_exp); 1104 1105 /* Use all produced digits. */ 1106 precision = val_str.len - 1; 1107 } 1108 1109 return print_double_str_scient(&val_str, precision, width, flags, ps); 1110 } 1111 1112 1113 /** Convert, format and print a double according to the %g specifier. 1114 * 1115 * %g style chooses between %f and %e. 1116 * 1117 * @param g Double to print. 1118 * @param precision Number of significant digits to display; excluding 1119 * any leading zeros from this count. If negative 1120 * the shortest accurate number will be printed. 1121 * @param width Minimum number of characters to display. Pads 1122 * with '0' or ' ' depending on the set flags; 1123 * @param flags Printf flags. 1124 * @param ps Printing functions. 1125 * 1126 * @return The number of characters printed; negative on failure. 1127 */ 1128 static int print_double_generic(double g, int precision, int width, 1129 uint32_t flags, printf_spec_t *ps) 1130 { 1131 ieee_double_t val = extract_ieee_double(g); 1132 1133 if (val.is_special) { 1134 return print_special(val, width, flags, ps); 1135 } 1136 1137 char buf[MAX_DOUBLE_STR_BUF_SIZE]; 1138 const size_t buf_size = MAX_DOUBLE_STR_BUF_SIZE; 1139 int dec_exp; 1140 int len; 1141 1142 /* Honor the user requested number of significant digits. */ 1143 if (0 <= precision) { 1144 /* 1145 * Do a quick and dirty conversion of a single digit to determine 1146 * the decimal exponent. 1147 */ 1148 len = double_to_fixed_str(val, 1, -1, buf, buf_size, &dec_exp); 1149 assert(0 < len); 1150 1151 precision = max(1, precision); 1152 1153 if (-4 <= dec_exp && dec_exp < precision) { 1154 precision = precision - (dec_exp + 1); 1155 return print_double_fixed(g, precision, width, 1156 flags | __PRINTF_FLAG_NOFRACZEROS, ps); 1157 } else { 1158 --precision; 1159 return print_double_scientific(g, precision, width, 1160 flags | __PRINTF_FLAG_NOFRACZEROS, ps); 1161 } 1162 } else { 1163 /* Convert to get the decimal exponent and digit count.*/ 1164 len = double_to_short_str(val, buf, buf_size, &dec_exp); 1165 assert(0 < len); 1166 1167 if (flags & __PRINTF_FLAG_LEFTALIGNED) { 1168 flags &= ~__PRINTF_FLAG_ZEROPADDED; 1169 } 1170 1171 double_str_t val_str; 1172 val_str.str = buf; 1173 val_str.len = len; 1174 val_str.neg = val.is_negative; 1175 val_str.dec_exp = dec_exp; 1176 1177 int first_digit_pos = len + dec_exp; 1178 int last_digit_pos = dec_exp; 1179 1180 /* The whole number (15 digits max) fits between dec places 15 .. -6 */ 1181 if (len <= 15 && -6 <= last_digit_pos && first_digit_pos <= 15) { 1182 /* Precision needed for the last significant digit. */ 1183 precision = max(0, -val_str.dec_exp); 1184 return print_double_str_fixed(&val_str, precision, width, flags, ps); 1185 } else { 1186 /* Use all produced digits. */ 1187 precision = val_str.len - 1; 1188 return print_double_str_scient(&val_str, precision, width, flags, ps); 1189 } 1190 } 1191 } 1192 1193 1194 /** Convert, format and print a double according to the specifier. 1195 * 1196 * Depending on the specifier it prints the double using the styles 1197 * %g, %f or %e by means of print_double_generic(), print_double_fixed(), 1198 * print_double_scientific(). 1199 * 1200 * @param g Double to print. 1201 * @param spec Specifier of the style to print in; one of: 'g','G','f','F', 1202 * 'e','E'. 1203 * @param precision Number of fractional digits to display. If negative 1204 * the shortest accurate number will be printed for style %g; 1205 * negative precision defaults to 6 for styles %f, %e. 1206 * @param width Minimum number of characters to display. Pads 1207 * with '0' or ' ' depending on the set flags; 1208 * @param flags Printf flags. 1209 * @param ps Printing functions. 1210 * 1211 * @return The number of characters printed; negative on failure. 1212 */ 1213 static int print_double(double g, char spec, int precision, int width, 1214 uint32_t flags, printf_spec_t *ps) 1215 { 1216 switch (spec) { 1217 case 'F': 1218 flags |= __PRINTF_FLAG_BIGCHARS; 1219 /* Fall through.*/ 1220 case 'f': 1221 precision = (precision < 0) ? 6 : precision; 1222 return print_double_fixed(g, precision, width, flags, ps); 1223 1224 case 'E': 1225 flags |= __PRINTF_FLAG_BIGCHARS; 1226 /* Fall through.*/ 1227 case 'e': 1228 precision = (precision < 0) ? 6 : precision; 1229 return print_double_scientific(g, precision, width, flags, ps); 1230 1231 case 'G': 1232 flags |= __PRINTF_FLAG_BIGCHARS; 1233 /* Fall through.*/ 1234 case 'g': 1235 return print_double_generic(g, precision, width, flags, ps); 1236 1237 default: 1238 assert(false); 1239 return -1; 1240 } 527 1241 } 528 1242 … … 656 1370 case '#': 657 1371 flags |= __PRINTF_FLAG_PREFIX; 1372 flags |= __PRINTF_FLAG_DECIMALPT; 658 1373 break; 659 1374 case '-': … … 701 1416 702 1417 /* Precision and '*' operator */ 703 int precision = 0;1418 int precision = -1; 704 1419 if (uc == '.') { 705 1420 i = nxt; 706 1421 uc = str_decode(fmt, &nxt, STR_NO_LIMIT); 707 1422 if (isdigit(uc)) { 1423 precision = 0; 708 1424 while (true) { 709 1425 precision *= 10; … … 723 1439 precision = (int) va_arg(ap, int); 724 1440 if (precision < 0) { 725 /* Ignore negative precision */726 precision = 0;1441 /* Ignore negative precision - use default instead */ 1442 precision = -1; 727 1443 } 728 1444 } … … 774 1490 */ 775 1491 case 's': 1492 precision = max(0, precision); 1493 776 1494 if (qualifier == PrintfQualifierLong) 777 1495 retval = print_wstr(va_arg(ap, wchar_t *), width, precision, flags, ps); … … 797 1515 goto out; 798 1516 }; 1517 1518 counter += retval; 1519 j = nxt; 1520 goto next_char; 1521 1522 /* 1523 * Floating point values 1524 */ 1525 case 'G': 1526 case 'g': 1527 case 'F': 1528 case 'f': 1529 case 'E': 1530 case 'e': 1531 retval = print_double(va_arg(ap, double), uc, precision, 1532 width, flags, ps); 1533 1534 if (retval < 0) { 1535 counter = -counter; 1536 goto out; 1537 } 799 1538 800 1539 counter += retval; -
uspace/lib/c/generic/io/window.c
rea906c29 r850235d 40 40 #include <stdio.h> 41 41 42 int win_register(async_sess_t *sess, service_id_t *in, service_id_t *out) 42 int win_register(async_sess_t *sess, service_id_t *in, service_id_t *out, 43 sysarg_t x_offset, sysarg_t y_offset) 43 44 { 44 45 async_exch_t *exch = async_exchange_begin(sess); 45 int ret = async_req_ 0_2(exch, WINDOW_REGISTER, in, out);46 int ret = async_req_2_2(exch, WINDOW_REGISTER, x_offset, y_offset, in, out); 46 47 async_exchange_end(exch); 47 48 -
uspace/lib/c/generic/loc.c
rea906c29 r850235d 37 37 #include <errno.h> 38 38 #include <malloc.h> 39 #include < bool.h>39 #include <stdbool.h> 40 40 41 41 static FIBRIL_MUTEX_INITIALIZE(loc_supp_block_mutex); -
uspace/lib/c/generic/malloc.c
rea906c29 r850235d 35 35 36 36 #include <malloc.h> 37 #include < bool.h>37 #include <stdbool.h> 38 38 #include <as.h> 39 39 #include <align.h> … … 289 289 size_t asize = ALIGN_UP(size, PAGE_SIZE); 290 290 void *astart = as_area_create(AS_AREA_ANY, asize, 291 AS_AREA_WRITE | AS_AREA_READ );291 AS_AREA_WRITE | AS_AREA_READ | AS_AREA_CACHEABLE); 292 292 if (astart == AS_MAP_FAILED) 293 293 return false; -
uspace/lib/c/generic/private/async.h
rea906c29 r850235d 41 41 #include <fibril_synch.h> 42 42 #include <sys/time.h> 43 #include < bool.h>43 #include <stdbool.h> 44 44 45 45 /** Structures of this type are used to track the timeout events. */ -
uspace/lib/c/generic/stdlib.c
rea906c29 r850235d 39 39 long int random(void) 40 40 { 41 return glbl_seed = ((1366 *glbl_seed + 150889) % RAND_MAX);41 return glbl_seed = ((1366 * glbl_seed + 150889) % RAND_MAX); 42 42 } 43 43 44 44 void srandom(unsigned int seed) 45 45 { 46 glbl_seed = seed ;46 glbl_seed = seed % RAND_MAX; 47 47 } 48 48 -
uspace/lib/c/generic/sysinfo.c
rea906c29 r850235d 38 38 #include <errno.h> 39 39 #include <malloc.h> 40 #include < bool.h>40 #include <stdbool.h> 41 41 #include <unistd.h> 42 42 -
uspace/lib/c/generic/thread.c
rea906c29 r850235d 39 39 #include <abi/proc/uarg.h> 40 40 #include <fibril.h> 41 #include <stack.h> 41 42 #include <str.h> 42 43 #include <async.h> … … 44 45 #include <as.h> 45 46 #include "private/thread.h" 46 47 #ifndef THREAD_INITIAL_STACK_PAGES48 #define THREAD_INITIAL_STACK_PAGES 249 #endif50 47 51 48 /** Main thread function. … … 101 98 return ENOMEM; 102 99 103 size_t stack_size = getpagesize() * THREAD_INITIAL_STACK_PAGES;100 size_t stack_size = stack_size_get(); 104 101 void *stack = as_area_create(AS_AREA_ANY, stack_size, 105 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 102 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD | 103 AS_AREA_LATE_RESERVE); 106 104 if (stack == AS_MAP_FAILED) { 107 105 free(uarg); -
uspace/lib/c/generic/time.c
rea906c29 r850235d 37 37 #include <sys/time.h> 38 38 #include <time.h> 39 #include < bool.h>39 #include <stdbool.h> 40 40 #include <libarch/barrier.h> 41 41 #include <macros.h> -
uspace/lib/c/generic/tls.c
rea906c29 r850235d 51 51 * @return Pointer to TCB. 52 52 */ 53 tcb_t * __make_tls(void)53 tcb_t *tls_make(void) 54 54 { 55 55 void *data; … … 57 57 size_t tls_size = &_tbss_end - &_tdata_start; 58 58 59 tcb = __alloc_tls(&data, tls_size);59 tcb = tls_alloc_arch(&data, tls_size); 60 60 if (!tcb) 61 61 return NULL; … … 74 74 } 75 75 76 void __free_tls(tcb_t *tcb)76 void tls_free(tcb_t *tcb) 77 77 { 78 78 size_t tls_size = &_tbss_end - &_tdata_start; 79 __free_tls_arch(tcb, tls_size);79 tls_free_arch(tcb, tls_size); 80 80 } 81 81 -
uspace/lib/c/include/adt/hash_table.h
rea906c29 r850235d 40 40 #include <adt/list.h> 41 41 #include <unistd.h> 42 #include < bool.h>42 #include <stdbool.h> 43 43 #include <macros.h> 44 44 -
uspace/lib/c/include/async.h
rea906c29 r850235d 44 44 #include <sys/time.h> 45 45 #include <atomic.h> 46 #include < bool.h>46 #include <stdbool.h> 47 47 #include <task.h> 48 48 -
uspace/lib/c/include/atomicdflt.h
rea906c29 r850235d 41 41 42 42 #include <stdint.h> 43 #include < bool.h>43 #include <stdbool.h> 44 44 45 45 typedef struct atomic { -
uspace/lib/c/include/bd_srv.h
rea906c29 r850235d 39 39 #include <async.h> 40 40 #include <fibril_synch.h> 41 #include < bool.h>41 #include <stdbool.h> 42 42 #include <sys/types.h> 43 43 -
uspace/lib/c/include/cfg.h
rea906c29 r850235d 41 41 #include <adt/list.h> 42 42 #include <sys/types.h> 43 #include < bool.h>43 #include <stdbool.h> 44 44 45 45 /** -
uspace/lib/c/include/ddi.h
rea906c29 r850235d 36 36 #define LIBC_DDI_H_ 37 37 38 #include <stdbool.h> 38 39 #include <sys/types.h> 40 #include <sys/time.h> 39 41 #include <abi/ddi/irq.h> 40 42 #include <task.h> … … 50 52 extern int dmamem_unmap_anonymous(void *); 51 53 52 extern int iospace_enable(task_id_t, void *, unsigned long);53 54 extern int pio_enable(void *, size_t, void **); 55 56 typedef void (*trace_fnc)(const volatile void *place, uint32_t val, 57 volatile void* base, size_t size, void *data, bool write); 58 59 extern int pio_trace_enable(void *, size_t, trace_fnc, void *); 60 extern void pio_trace_log(const volatile void *, uint32_t val, bool write); 61 extern void pio_trace_disable(void *); 62 63 extern void pio_write_8(ioport8_t *, uint8_t); 64 extern void pio_write_16(ioport16_t *, uint16_t); 65 extern void pio_write_32(ioport32_t *, uint32_t); 66 67 extern uint8_t pio_read_8(const ioport8_t *); 68 extern uint16_t pio_read_16(const ioport16_t *); 69 extern uint32_t pio_read_32(const ioport32_t *); 70 71 static inline uint8_t pio_change_8( 72 ioport8_t *reg, uint8_t val, uint8_t mask, useconds_t delay) 73 { 74 uint8_t v = pio_read_8(reg); 75 udelay(delay); 76 pio_write_8(reg, (v & ~mask) | val); 77 return v; 78 } 79 80 static inline uint16_t pio_change_16( 81 ioport16_t *reg, uint16_t val, uint16_t mask, useconds_t delay) 82 { 83 uint16_t v = pio_read_16(reg); 84 udelay(delay); 85 pio_write_16(reg, (v & ~mask) | val); 86 return v; 87 } 88 89 static inline uint32_t pio_change_32( 90 ioport32_t *reg, uint32_t val, uint32_t mask, useconds_t delay) 91 { 92 uint32_t v = pio_read_32(reg); 93 udelay(delay); 94 pio_write_32(reg, (v & ~mask) | val); 95 return v; 96 } 97 98 static inline uint8_t pio_set_8(ioport8_t *r, uint8_t v, useconds_t d) 99 { 100 return pio_change_8(r, v, 0, d); 101 } 102 static inline uint16_t pio_set_16(ioport16_t *r, uint16_t v, useconds_t d) 103 { 104 return pio_change_16(r, v, 0, d); 105 } 106 static inline uint32_t pio_set_32(ioport32_t *r, uint32_t v, useconds_t d) 107 { 108 return pio_change_32(r, v, 0, d); 109 } 110 111 static inline uint8_t pio_clear_8(ioport8_t *r, uint8_t v, useconds_t d) 112 { 113 return pio_change_8(r, 0, v, d); 114 } 115 static inline uint16_t pio_clear_16(ioport16_t *r, uint16_t v, useconds_t d) 116 { 117 return pio_change_16(r, 0, v, d); 118 } 119 static inline uint32_t pio_clear_32(ioport32_t *r, uint32_t v, useconds_t d) 120 { 121 return pio_change_32(r, 0, v, d); 122 } 54 123 55 124 extern int irq_register(int, int, int, irq_code_t *); -
uspace/lib/c/include/device/hw_res.h
rea906c29 r850235d 38 38 #include <ipc/dev_iface.h> 39 39 #include <async.h> 40 #include < bool.h>40 #include <stdbool.h> 41 41 42 42 #define DMA_MODE_ON_DEMAND 0 -
uspace/lib/c/include/devman.h
rea906c29 r850235d 40 40 #include <ipc/loc.h> 41 41 #include <async.h> 42 #include < bool.h>42 #include <stdbool.h> 43 43 44 44 extern async_exch_t *devman_exchange_begin_blocking(devman_interface_t); -
uspace/lib/c/include/fibril_synch.h
rea906c29 r850235d 40 40 #include <libarch/tls.h> 41 41 #include <sys/time.h> 42 #include < bool.h>42 #include <stdbool.h> 43 43 44 44 typedef struct { -
uspace/lib/c/include/inet/iplink_srv.h
rea906c29 r850235d 38 38 #include <async.h> 39 39 #include <fibril_synch.h> 40 #include < bool.h>40 #include <stdbool.h> 41 41 #include <sys/types.h> 42 42 -
uspace/lib/c/include/io/charfield.h
rea906c29 r850235d 38 38 39 39 #include <sys/types.h> 40 #include < bool.h>40 #include <stdbool.h> 41 41 #include <io/color.h> 42 42 #include <io/style.h> -
uspace/lib/c/include/io/con_srv.h
rea906c29 r850235d 44 44 #include <io/pixel.h> 45 45 #include <io/style.h> 46 #include < bool.h>46 #include <stdbool.h> 47 47 #include <sys/time.h> 48 48 #include <sys/types.h> -
uspace/lib/c/include/io/console.h
rea906c29 r850235d 41 41 #include <io/keycode.h> 42 42 #include <async.h> 43 #include < bool.h>43 #include <stdbool.h> 44 44 #include <stdio.h> 45 45 -
uspace/lib/c/include/io/klog.h
rea906c29 r850235d 42 42 extern size_t klog_write(const void *, size_t); 43 43 extern void klog_update(void); 44 extern void klog_command(const void *, size_t); 44 45 extern int klog_printf(const char *, ...) 45 46 PRINTF_ATTRIBUTE(1, 2); -
uspace/lib/c/include/io/pixel.h
rea906c29 r850235d 42 42 ((channel) >> (8 - (bits))) 43 43 44 #define INVERT(pixel) ((pixel) ^ 0x00ffffff) 45 44 46 #define ALPHA(pixel) ((pixel) >> 24) 45 47 #define RED(pixel) (((pixel) & 0x00ff0000) >> 16) -
uspace/lib/c/include/io/pixelmap.h
rea906c29 r850235d 52 52 sysarg_t y) 53 53 { 54 size_t offset = y * pixelmap->width + x; 55 pixel_t *pixel = pixelmap->data + offset; 56 return pixel; 54 if (x < pixelmap->width && y < pixelmap->height) { 55 size_t offset = y * pixelmap->width + x; 56 pixel_t *pixel = pixelmap->data + offset; 57 return pixel; 58 } else { 59 return NULL; 60 } 57 61 } 58 62 -
uspace/lib/c/include/io/window.h
rea906c29 r850235d 36 36 #define LIBC_IO_WINDOW_H_ 37 37 38 #include < bool.h>38 #include <stdbool.h> 39 39 #include <sys/types.h> 40 40 #include <async.h> … … 71 71 ET_POSITION_EVENT, 72 72 ET_SIGNAL_EVENT, 73 ET_WINDOW_FOCUS, 74 ET_WINDOW_UNFOCUS, 73 75 ET_WINDOW_RESIZE, 74 76 ET_WINDOW_REFRESH, … … 100 102 } window_grab_flags_t; 101 103 102 extern int win_register(async_sess_t *, service_id_t *, service_id_t * );104 extern int win_register(async_sess_t *, service_id_t *, service_id_t *, sysarg_t, sysarg_t); 103 105 104 106 extern int win_get_event(async_sess_t *, window_event_t *); -
uspace/lib/c/include/ipc/vfs.h
rea906c29 r850235d 38 38 #include <ipc/common.h> 39 39 #include <sys/types.h> 40 #include < bool.h>40 #include <stdbool.h> 41 41 42 42 #define FS_NAME_MAXLEN 20 -
uspace/lib/c/include/loc.h
rea906c29 r850235d 38 38 #include <ipc/loc.h> 39 39 #include <async.h> 40 #include < bool.h>40 #include <stdbool.h> 41 41 42 42 typedef void (*loc_cat_change_cb_t)(void); -
uspace/lib/c/include/macros.h
rea906c29 r850235d 38 38 #define min(a, b) ((a) < (b) ? (a) : (b)) 39 39 #define max(a, b) ((a) > (b) ? (a) : (b)) 40 #define abs(a) ((a) >= 0 ? (a) : (-a)) 41 40 42 41 43 #define KiB2SIZE(kb) ((kb) << 10) … … 60 62 #endif 61 63 64 #define _paddname(line) PADD_ ## line ## __ 65 #define _padd(width, line) uint ## width ## _t _paddname(line) 66 #define PADD32 _padd(32, __LINE__) 67 #define PADD16 _padd(16, __LINE__) 68 #define PADD8 _padd(8, __LINE__) 69 62 70 /** @} 63 71 */ -
uspace/lib/c/include/nic/nic.h
rea906c29 r850235d 40 40 41 41 #include <nic/eth_phys.h> 42 #include < bool.h>42 #include <stdbool.h> 43 43 44 44 /** Ethernet address length. */ -
uspace/lib/c/include/rtld/dynamic.h
rea906c29 r850235d 36 36 #define LIBC_RTLD_DYNAMIC_H_ 37 37 38 #include < bool.h>38 #include <stdbool.h> 39 39 #include <rtld/elf_dyn.h> 40 40 #include <libarch/rtld/dynamic.h> -
uspace/lib/c/include/sort.h
rea906c29 r850235d 37 37 38 38 #include <sys/types.h> 39 #include < bool.h>39 #include <stdbool.h> 40 40 41 41 typedef int (* sort_cmp_t)(void *, void *, void *); -
uspace/lib/c/include/stack.h
rea906c29 r850235d 1 1 /* 2 * Copyright (c) 20 06 Martin Decky2 * Copyright (c) 2012 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 33 33 */ 34 34 35 #ifndef LIBC_ BOOL_H_36 #define LIBC_ BOOL_H_35 #ifndef LIBC_STACK_H_ 36 #define LIBC_STACK_H_ 37 37 38 38 #include <libarch/types.h> 39 #include <abi/bool.h>40 39 41 #define false 0 42 #define true 1 40 extern size_t stack_size_get(void); 43 41 44 42 #endif -
uspace/lib/c/include/stacktrace.h
rea906c29 r850235d 38 38 39 39 #include <sys/types.h> 40 #include < bool.h>40 #include <stdbool.h> 41 41 42 42 typedef struct { -
uspace/lib/c/include/stats.h
rea906c29 r850235d 39 39 #include <thread.h> 40 40 #include <stdint.h> 41 #include < bool.h>41 #include <stdbool.h> 42 42 #include <sys/types.h> 43 43 #include <abi/sysinfo.h> -
uspace/lib/c/include/stdbool.h
rea906c29 r850235d 1 1 /* 2 * Copyright (c) 20 11 Jiri Zarevucky2 * Copyright (c) 2006 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup lib posix29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 /** @file Boolean type and values.32 /** @file 33 33 */ 34 34 35 #ifndef POSIX_STDBOOL_H_36 #define POSIX_STDBOOL_H_35 #ifndef LIBC_BOOL_H_ 36 #define LIBC_BOOL_H_ 37 37 38 #ifdef LIBC_BOOL_H_ 38 #include <libarch/types.h> 39 #include <abi/bool.h> 39 40 40 #if (!defined(POSIX_STDIO_H_)) && \ 41 (!defined(POSIX_STDLIB_H_)) && \ 42 (!defined(POSIX_STRING_H_)) 43 #error "You can't include bool.h and stdbool.h at the same time." 41 #define false 0 42 #define true 1 43 44 #define __bool_true_false_are_defined 1 45 44 46 #endif 45 47 46 #endif /* LIBC_BOOL_H */ 47 48 #define LIBC_BOOL_H_ 49 50 #define bool _Bool 51 #define true 1 52 #define false 0 53 #define __bool_true_false_are_defined 1 54 55 #endif /* POSIX_STDBOOL_H_ */ 48 /** @} 49 */ -
uspace/lib/c/include/stdio.h
rea906c29 r850235d 40 40 #include <str.h> 41 41 #include <io/verify.h> 42 #include <abi/klog.h> 42 43 43 44 #define EOF (-1) … … 51 52 int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \ 52 53 if (_n > 0) \ 53 (void) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) _buf, str_size(_buf)); \54 (void) __SYSCALL3(SYS_KLOG, KLOG_WRITE, (sysarg_t) _buf, str_size(_buf)); \ 54 55 } 55 56 -
uspace/lib/c/include/str.h
rea906c29 r850235d 39 39 #include <mem.h> 40 40 #include <sys/types.h> 41 #include < bool.h>41 #include <stdbool.h> 42 42 43 43 #define U_SPECIAL '?' -
uspace/lib/c/include/sys/stat.h
rea906c29 r850235d 37 37 38 38 #include <sys/types.h> 39 #include < bool.h>39 #include <stdbool.h> 40 40 #include <ipc/vfs.h> 41 41 #include <ipc/loc.h> -
uspace/lib/c/include/sysinfo.h
rea906c29 r850235d 37 37 38 38 #include <sys/types.h> 39 #include < bool.h>39 #include <stdbool.h> 40 40 #include <abi/sysinfo.h> 41 41 -
uspace/lib/c/include/tls.h
rea906c29 r850235d 48 48 extern char _tbss_end; 49 49 50 extern tcb_t * __make_tls(void);51 extern tcb_t * __alloc_tls(void **, size_t);52 extern void __free_tls(tcb_t *);53 extern void __free_tls_arch(tcb_t *, size_t);50 extern tcb_t *tls_make(void); 51 extern tcb_t *tls_alloc_arch(void **, size_t); 52 extern void tls_free(tcb_t *); 53 extern void tls_free_arch(tcb_t *, size_t); 54 54 55 55 #ifdef CONFIG_TLS_VARIANT_1
Note:
See TracChangeset
for help on using the changeset viewer.