Changeset 06b0211b in mainline for uspace/lib
- Timestamp:
- 2013-04-29T11:29:45Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- aa2b32c
- Parents:
- ba4799a (diff), df956b9b (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
- Files:
-
- 64 added
- 64 deleted
- 31 edited
- 109 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
rba4799a r06b0211b 31 31 ROOT_PATH = $(USPACE_PREFIX)/.. 32 32 33 INCLUDE_ABI = include/abi34 INCLUDE_LIBARCH = include/libarch35 36 33 COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common 37 34 COMMON_HEADER = $(ROOT_PATH)/common.h 38 COMMON_HEADER_ARCH = arch/$(UARCH)/include/ common.h35 COMMON_HEADER_ARCH = arch/$(UARCH)/include/libarch/common.h 39 36 40 37 CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config … … 46 43 $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld 47 44 48 PRE_DEPEND = $( INCLUDE_ABI) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH)45 PRE_DEPEND = $(COMMON_HEADER_ARCH) 49 46 EXTRA_OUTPUT = $(LINKER_SCRIPTS) 50 EXTRA_CLEAN = $( INCLUDE_ABI) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS)47 EXTRA_CLEAN = $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS) 51 48 LIBRARY = libc 52 49 SLIBRARY = libc.so.0.0 … … 162 159 include $(USPACE_PREFIX)/Makefile.common 163 160 164 $(INCLUDE_LIBARCH): arch/$(UARCH)/include165 ln -sfn ../$< $@166 167 $(INCLUDE_ABI): ../../../abi/include/168 ln -sfn ../$< $@169 161 170 162 $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in … … 181 173 182 174 $(COMMON_HEADER_ARCH): $(COMMON_HEADER) 183 ln -sfn ../../../ $< $@175 ln -sfn ../../../../$< $@ -
uspace/lib/c/arch/abs32le/src/tls.c
rba4799a r06b0211b 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/tls.c
rba4799a r06b0211b 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/src/tls.c
rba4799a r06b0211b 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/src/setjmp.S
rba4799a r06b0211b 35 35 .type setjmp,@function 36 36 setjmp: 37 movl 0(%esp),%eax # save pc value into eax38 movl 4(%esp),%edx # address of the jmp_buf structure to save context to39 40 37 movl 0(%esp),%eax # save pc value into eax 38 movl 4(%esp),%edx # address of the jmp_buf structure to save context to 39 40 # save registers to the jmp_buf structure 41 41 CONTEXT_SAVE_ARCH_CORE %edx %eax 42 43 xorl %eax,%eax 42 43 xorl %eax,%eax # set_jmp returns 0 44 44 ret 45 45 46 46 .type longjmp,@function 47 47 longjmp: 48 49 movl 4(%esp), %ecx # put address of jmp_buf into ecx 50 movl 8(%esp), %eax # put return value into eax 51 52 # restore registers from the jmp_buf structure 48 movl 4(%esp), %ecx # put address of jmp_buf into ecx 49 movl 8(%esp), %eax # put return value into eax 50 51 # restore registers from the jmp_buf structure 53 52 CONTEXT_RESTORE_ARCH_CORE %ecx %edx 54 55 movl %edx,0(%esp) 53 54 movl %edx,0(%esp) # put saved pc on stack 56 55 ret 57 -
uspace/lib/c/arch/ia32/src/tls.c
rba4799a r06b0211b 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/src/tls.c
rba4799a r06b0211b 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/Makefile.common
rba4799a r06b0211b 27 27 # 28 28 29 GCC_CFLAGS += -msoft-float -m ips3 -mabi=3229 GCC_CFLAGS += -msoft-float -mabi=32 30 30 BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a 31 31 … … 34 34 BFD_ARCH = mips 35 35 BFD_NAME = elf32-tradlittlemips 36 37 ifeq ($(MACHINE),msim) 38 GCC_CFLAGS += -march=r4000 39 endif 40 41 ifeq ($(MACHINE),lmalta) 42 GCC_CFLAGS += -march=4kc 43 endif 44 -
uspace/lib/c/arch/mips32/src/tls.c
rba4799a r06b0211b 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/mips32eb/Makefile.common
rba4799a r06b0211b 27 27 # 28 28 29 GCC_CFLAGS += -msoft-float -m ips3 -mabi=3229 GCC_CFLAGS += -msoft-float -mabi=32 30 30 BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a 31 31 … … 34 34 BFD_ARCH = mips 35 35 BFD_NAME = elf32-tradbigmips 36 37 ifeq ($(MACHINE),bmalta) 38 GCC_CFLAGS += -march=4kc 39 endif 40 -
uspace/lib/c/arch/mips64/src/tls.c
rba4799a r06b0211b 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/src/tls.c
rba4799a r06b0211b 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/src/tls.c
rba4799a r06b0211b 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/hash_table.c
rba4799a r06b0211b 81 81 * @param init_size Initial desired number of hash table buckets. Pass zero 82 82 * if you want the default initial size. 83 * @param max_keys Maximal number of keys needed to identify an item. 83 * @param max_load The table is resized when the average load per bucket 84 * exceeds this number. Pass zero if you want the default. 84 85 * @param op Hash table operations structure. remove_callback() 85 86 * is optional and can be NULL if no action is to be taken -
uspace/lib/c/generic/async.c
rba4799a r06b0211b 350 350 static async_client_conn_t client_connection = default_client_connection; 351 351 static async_interrupt_handler_t interrupt_received = default_interrupt_received; 352 static size_t interrupt_handler_stksz = FIBRIL_DFLT_STK_SIZE; 352 353 353 354 /** Setter for client_connection function pointer. … … 370 371 { 371 372 interrupt_received = intr; 373 } 374 375 /** Set the stack size for the interrupt handler notification fibrils. 376 * 377 * @param size Stack size in bytes. 378 */ 379 void async_set_interrupt_handler_stack_size(size_t size) 380 { 381 interrupt_handler_stksz = size; 372 382 } 373 383 … … 587 597 msg->call = *call; 588 598 589 fid_t fid = fibril_create(notification_fibril, msg); 599 fid_t fid = fibril_create_generic(notification_fibril, msg, 600 interrupt_handler_stksz); 590 601 if (fid == 0) { 591 602 free(msg); … … 2057 2068 2058 2069 async_sess_t *sess = exch->sess; 2070 assert(sess != NULL); 2059 2071 2060 2072 atomic_dec(&sess->refcnt); … … 2078 2090 * @param arg User defined argument. 2079 2091 * @param flags Storage for the received flags. Can be NULL. 2080 * @param dst Destination address space area base. Cannot be NULL. 2092 * @param dst Address of the storage for the destination address space area 2093 * base address. Cannot be NULL. 2081 2094 * 2082 2095 * @return Zero on success or a negative error code from errno.h. … … 2206 2219 * 2207 2220 * @param callid Hash of the IPC_M_DATA_WRITE call to answer. 2208 * @param dst Destination address space area base address. 2221 * @param dst Address of the storage for the destination address space area 2222 * base address. 2209 2223 * 2210 2224 * @return Zero on success or a value from @ref errno.h on failure. -
uspace/lib/c/generic/fibril.c
rba4799a r06b0211b 95 95 fibril_t *fibril_setup(void) 96 96 { 97 tcb_t *tcb = __make_tls();97 tcb_t *tcb = tls_make(); 98 98 if (!tcb) 99 99 return NULL; … … 101 101 fibril_t *fibril = malloc(sizeof(fibril_t)); 102 102 if (!fibril) { 103 __free_tls(tcb);103 tls_free(tcb); 104 104 return NULL; 105 105 } … … 122 122 void fibril_teardown(fibril_t *fibril) 123 123 { 124 __free_tls(fibril->tcb);124 tls_free(fibril->tcb); 125 125 free(fibril); 126 126 } … … 256 256 * @param func Implementing function of the new fibril. 257 257 * @param arg Argument to pass to func. 258 * @param stksz Stack size in bytes. 258 259 * 259 260 * @return 0 on failure or TLS of the new fibril. 260 261 * 261 262 */ 262 fid_t fibril_create (int (*func)(void *), void *arg)263 fid_t fibril_create_generic(int (*func)(void *), void *arg, size_t stksz) 263 264 { 264 265 fibril_t *fibril; … … 268 269 return 0; 269 270 270 size_t stack_size = stack_size_get(); 271 size_t stack_size = (stksz == FIBRIL_DFLT_STK_SIZE) ? 272 stack_size_get() : stksz; 271 273 fibril->stack = as_area_create((void *) -1, stack_size, 272 274 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD | -
uspace/lib/c/generic/net/socket_client.c
rba4799a r06b0211b 192 192 /** Default thread for new connections. 193 193 * 194 * @param[in] iid The initial message identifier. 195 * @param[in] icall The initial message call structure. 196 * @param[in] arg Local argument. 194 * @param[in] iid The initial message identifier. 195 * @param[in] icall The initial message call structure. 196 * @param[in] arg Local argument. 197 * 197 198 */ 198 199 static void socket_connection(ipc_callid_t iid, ipc_call_t * icall, void *arg) 199 200 { 200 ipc_callid_t callid; 201 ipc_call_t call; 202 socket_t *socket; 203 int rc; 204 205 loop: 206 callid = async_get_call(&call); 207 208 switch (IPC_GET_IMETHOD(call)) { 209 case NET_SOCKET_RECEIVED: 210 case NET_SOCKET_ACCEPTED: 211 case NET_SOCKET_DATA_FRAGMENT_SIZE: 212 fibril_rwlock_read_lock(&socket_globals.lock); 213 214 /* Find the socket */ 215 socket = sockets_find(socket_get_sockets(), 216 SOCKET_GET_SOCKET_ID(call)); 217 if (!socket) { 218 rc = ENOTSOCK; 219 fibril_rwlock_read_unlock(&socket_globals.lock); 220 break; 201 while (true) { 202 ipc_call_t call; 203 ipc_callid_t callid = async_get_call(&call); 204 205 if (!IPC_GET_IMETHOD(call)) { 206 async_answer_0(callid, 0); 207 return; 221 208 } 209 210 int rc; 222 211 223 212 switch (IPC_GET_IMETHOD(call)) { 224 213 case NET_SOCKET_RECEIVED: 225 fibril_mutex_lock(&socket->receive_lock); 226 /* Push the number of received packet fragments */ 227 rc = dyn_fifo_push(&socket->received, 228 SOCKET_GET_DATA_FRAGMENTS(call), 229 SOCKET_MAX_RECEIVED_SIZE); 230 if (rc == EOK) { 231 /* Signal the received packet */ 232 fibril_condvar_signal(&socket->receive_signal); 214 case NET_SOCKET_ACCEPTED: 215 case NET_SOCKET_DATA_FRAGMENT_SIZE: 216 fibril_rwlock_read_lock(&socket_globals.lock); 217 218 /* Find the socket */ 219 socket_t *socket = sockets_find(socket_get_sockets(), 220 SOCKET_GET_SOCKET_ID(call)); 221 if (!socket) { 222 rc = ENOTSOCK; 223 fibril_rwlock_read_unlock(&socket_globals.lock); 224 break; 233 225 } 234 fibril_mutex_unlock(&socket->receive_lock); 226 227 switch (IPC_GET_IMETHOD(call)) { 228 case NET_SOCKET_RECEIVED: 229 fibril_mutex_lock(&socket->receive_lock); 230 /* Push the number of received packet fragments */ 231 rc = dyn_fifo_push(&socket->received, 232 SOCKET_GET_DATA_FRAGMENTS(call), 233 SOCKET_MAX_RECEIVED_SIZE); 234 if (rc == EOK) { 235 /* Signal the received packet */ 236 fibril_condvar_signal(&socket->receive_signal); 237 } 238 fibril_mutex_unlock(&socket->receive_lock); 239 break; 240 241 case NET_SOCKET_ACCEPTED: 242 /* Push the new socket identifier */ 243 fibril_mutex_lock(&socket->accept_lock); 244 rc = dyn_fifo_push(&socket->accepted, 1, 245 SOCKET_MAX_ACCEPTED_SIZE); 246 if (rc == EOK) { 247 /* Signal the accepted socket */ 248 fibril_condvar_signal(&socket->accept_signal); 249 } 250 fibril_mutex_unlock(&socket->accept_lock); 251 break; 252 253 default: 254 rc = ENOTSUP; 255 } 256 257 if ((SOCKET_GET_DATA_FRAGMENT_SIZE(call) > 0) && 258 (SOCKET_GET_DATA_FRAGMENT_SIZE(call) != 259 socket->data_fragment_size)) { 260 fibril_rwlock_write_lock(&socket->sending_lock); 261 262 /* Set the data fragment size */ 263 socket->data_fragment_size = 264 SOCKET_GET_DATA_FRAGMENT_SIZE(call); 265 266 fibril_rwlock_write_unlock(&socket->sending_lock); 267 } 268 269 fibril_rwlock_read_unlock(&socket_globals.lock); 235 270 break; 236 237 case NET_SOCKET_ACCEPTED: 238 /* Push the new socket identifier */ 239 fibril_mutex_lock(&socket->accept_lock); 240 rc = dyn_fifo_push(&socket->accepted, 1, 241 SOCKET_MAX_ACCEPTED_SIZE); 242 if (rc == EOK) { 243 /* Signal the accepted socket */ 244 fibril_condvar_signal(&socket->accept_signal); 245 } 246 fibril_mutex_unlock(&socket->accept_lock); 247 break; 248 271 249 272 default: 250 273 rc = ENOTSUP; 251 274 } 252 253 if ((SOCKET_GET_DATA_FRAGMENT_SIZE(call) > 0) && 254 (SOCKET_GET_DATA_FRAGMENT_SIZE(call) != 255 socket->data_fragment_size)) { 256 fibril_rwlock_write_lock(&socket->sending_lock); 257 258 /* Set the data fragment size */ 259 socket->data_fragment_size = 260 SOCKET_GET_DATA_FRAGMENT_SIZE(call); 261 262 fibril_rwlock_write_unlock(&socket->sending_lock); 263 } 264 265 fibril_rwlock_read_unlock(&socket_globals.lock); 266 break; 267 268 default: 269 rc = ENOTSUP; 270 } 271 272 async_answer_0(callid, (sysarg_t) rc); 273 goto loop; 275 276 async_answer_0(callid, (sysarg_t) rc); 277 } 274 278 } 275 279 -
uspace/lib/c/generic/tls.c
rba4799a r06b0211b 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/async.h
rba4799a r06b0211b 156 156 extern void async_set_client_connection(async_client_conn_t); 157 157 extern void async_set_interrupt_received(async_interrupt_handler_t); 158 extern void async_set_interrupt_handler_stack_size(size_t); 158 159 159 160 /* -
uspace/lib/c/include/fibril.h
rba4799a r06b0211b 86 86 extern void context_restore(context_t *ctx) __attribute__((noreturn)); 87 87 88 extern fid_t fibril_create(int (*func)(void *), void *arg); 88 #define FIBRIL_DFLT_STK_SIZE 0 89 90 #define fibril_create(func, arg) \ 91 fibril_create_generic((func), (arg), FIBRIL_DFLT_STK_SIZE) 92 extern fid_t fibril_create_generic(int (*func)(void *), void *arg, size_t); 89 93 extern void fibril_destroy(fid_t fid); 90 94 extern fibril_t *fibril_setup(void); -
uspace/lib/c/include/macros.h
rba4799a r06b0211b 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))40 #define abs(a) ((a) >= 0 ? (a) : -(a)) 41 41 42 42 -
uspace/lib/c/include/mem.h
rba4799a r06b0211b 40 40 #define bzero(ptr, len) memset((ptr), 0, (len)) 41 41 42 extern void *memset(void *, int, size_t); 43 extern void *memcpy(void *, const void *, size_t); 42 extern void *memset(void *, int, size_t) 43 __attribute__ ((optimize("-fno-tree-loop-distribute-patterns"))); 44 extern void *memcpy(void *, const void *, size_t) 45 __attribute__ ((optimize("-fno-tree-loop-distribute-patterns"))); 44 46 extern void *memmove(void *, const void *, size_t); 45 47 -
uspace/lib/c/include/setjmp.h
rba4799a r06b0211b 38 38 #include <libarch/fibril.h> 39 39 40 typedef context_t jmp_buf ;40 typedef context_t jmp_buf[1]; 41 41 42 42 extern int setjmp(jmp_buf env); … … 47 47 /** @} 48 48 */ 49 -
uspace/lib/c/include/sys/types.h
rba4799a r06b0211b 50 50 typedef volatile uint32_t ioport32_t; 51 51 52 typedef int16_t unaligned_int16_t __attribute__ ((aligned(1))); 53 typedef int32_t unaligned_int32_t __attribute__ ((aligned(1))); 54 typedef int64_t unaligned_int64_t __attribute__ ((aligned(1))); 55 56 typedef uint16_t unaligned_uint16_t __attribute__ ((aligned(1))); 57 typedef uint32_t unaligned_uint32_t __attribute__ ((aligned(1))); 58 typedef uint64_t unaligned_uint64_t __attribute__ ((aligned(1))); 59 52 60 #endif 53 61 -
uspace/lib/c/include/tls.h
rba4799a r06b0211b 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 -
uspace/lib/posix/include/posix/fcntl.h
rba4799a r06b0211b 48 48 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) 49 49 50 /* Dummy compatibility flag */ 51 #undef O_NOCTTY 52 #define O_NOCTTY 0 53 50 54 /* fcntl commands */ 51 55 #undef F_DUPFD -
uspace/lib/posix/include/posix/float.h
rba4799a r06b0211b 36 36 #define POSIX_FLOAT_H_ 37 37 38 /* 39 * The macros defined below are needed for compilation of MPFR 40 * (http://www.mpfr.org/). Probably, they should be provided by GCC 41 * itself but that does not work for cross-compilation. 42 * 38 /* Rouding direction -1 - unknown */ 39 #define FLT_ROUNDS (-1) 40 41 /* define some standard C constants in terms of GCC built-ins */ 42 #ifdef __GNUC__ 43 #undef DBL_MANT_DIG 44 #define DBL_MANT_DIG __DBL_MANT_DIG__ 45 #undef DBL_MIN_EXP 46 #define DBL_MIN_EXP __DBL_MIN_EXP__ 47 #undef DBL_MAX_EXP 48 #define DBL_MAX_EXP __DBL_MAX_EXP__ 49 #undef DBL_MAX 50 #define DBL_MAX __DBL_MAX__ 51 #undef DBL_MAX_10_EXP 52 #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ 53 #undef DBL_MIN_10_EXP 54 #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ 55 #undef DBL_MIN 56 #define DBL_MIN __DBL_MIN__ 57 #undef DBL_DIG 58 #define DBL_DIG __DBL_DIG__ 59 #undef DBL_EPSILON 60 #define DBL_EPSILON __DBL_EPSILON__ 61 #undef FLT_RADIX 62 #define FLT_RADIX __FLT_RADIX__ 63 #else 64 /* For something else than GCC, following definitions are provided. 43 65 * They are intentionally guarded by the given macro to ensure that anyone 44 66 * who wants them states this explicitly. … … 50 72 */ 51 73 #ifdef FLOAT_H_YES_I_REALLY_WANT_LIMITS 52 53 74 /* float limits */ 54 75 #define FLT_MIN 1.1754943508222875079687365372222456778186655567720875215087517062784172594547271728515625e-38 … … 82 103 #endif 83 104 105 #endif /* __GNUC__ */ 106 84 107 #endif /* POSIX_FLOAT_H_ */ 85 108 -
uspace/lib/posix/include/posix/limits.h
rba4799a r06b0211b 49 49 #define PATH_MAX 256 50 50 51 /* it's probably a safe assumption */ 52 #undef CHAR_BIT 53 #define CHAR_BIT 8 54 51 55 #endif /* POSIX_LIMITS_H_ */ 52 56 -
uspace/lib/posix/include/posix/math.h
rba4799a r06b0211b 40 40 #endif 41 41 42 #ifdef __GNUC__ 43 #define HUGE_VAL (__builtin_huge_val()) 44 #endif 45 42 46 /* Normalization Functions */ 43 47 extern double __POSIX_DEF__(ldexp)(double x, int exp); 44 48 extern double __POSIX_DEF__(frexp)(double num, int *exp); 45 49 50 double __POSIX_DEF__(fabs)(double x); 51 double __POSIX_DEF__(floor)(double x); 52 double __POSIX_DEF__(modf)(double x, double *iptr); 53 double __POSIX_DEF__(fmod)(double x, double y); 54 double __POSIX_DEF__(pow)(double x, double y); 55 double __POSIX_DEF__(exp)(double x); 56 double __POSIX_DEF__(sqrt)(double x); 57 double __POSIX_DEF__(log)(double x); 58 double __POSIX_DEF__(sin)(double x); 59 double __POSIX_DEF__(cos)(double x); 60 double __POSIX_DEF__(atan2)(double y, double x); 46 61 47 62 #endif /* POSIX_MATH_H_ */ -
uspace/lib/posix/include/posix/stdio.h
rba4799a r06b0211b 70 70 71 71 typedef struct _IO_FILE FILE; 72 73 #ifndef LIBPOSIX_INTERNAL 74 enum _buffer_type { 75 /** No buffering */ 76 _IONBF, 77 /** Line buffering */ 78 _IOLBF, 79 /** Full buffering */ 80 _IOFBF 81 }; 82 #endif 72 83 73 84 extern FILE *stdin; -
uspace/lib/posix/source/math.c
rba4799a r06b0211b 63 63 } 64 64 65 /** 66 * 67 * @param x 68 * @return 69 */ 70 double posix_cos(double x) 71 { 72 // TODO: Python dependency 73 not_implemented(); 74 } 75 76 /** 77 * 78 * @param x 79 * @param y 80 * @return 81 */ 82 double posix_pow(double x, double y) 83 { 84 // TODO: Python dependency 85 not_implemented(); 86 } 87 88 /** 89 * 90 * @param x 91 * @return 92 */ 93 double posix_floor(double x) 94 { 95 // TODO: Python dependency 96 not_implemented(); 97 } 98 99 /** 100 * 101 * @param x 102 * @return 103 */ 104 double posix_fabs(double x) 105 { 106 // TODO: Python dependency 107 not_implemented(); 108 } 109 110 /** 111 * 112 * @param x 113 * @param iptr 114 * @return 115 */ 116 double posix_modf(double x, double *iptr) 117 { 118 // TODO: Python dependency 119 not_implemented(); 120 } 121 122 /** 123 * 124 * @param x 125 * @param y 126 * @return 127 */ 128 double posix_fmod(double x, double y) 129 { 130 // TODO: Python dependency 131 not_implemented(); 132 } 133 134 /** 135 * 136 * @param x 137 * @return 138 */ 139 double posix_log(double x) 140 { 141 // TODO: Python dependency 142 not_implemented(); 143 } 144 145 /** 146 * 147 * @param x 148 * @param y 149 * @return 150 */ 151 double posix_atan2(double y, double x) 152 { 153 // TODO: Python dependency 154 not_implemented(); 155 } 156 157 /** 158 * 159 * @param x 160 * @return 161 */ 162 double posix_sin(double x) 163 { 164 // TODO: Python dependency 165 not_implemented(); 166 } 167 168 /** 169 * 170 * @param x 171 * @return 172 */ 173 double posix_exp(double x) 174 { 175 // TODO: Python dependency 176 not_implemented(); 177 } 178 179 /** 180 * 181 * @param x 182 * @return 183 */ 184 double posix_sqrt(double x) 185 { 186 // TODO: Python dependency 187 not_implemented(); 188 } 189 65 190 /** @} 66 191 */
Note:
See TracChangeset
for help on using the changeset viewer.