Changeset b79d450 in mainline for uspace/lib/libc
- Timestamp:
- 2010-01-27T20:35:49Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fb6f1a5
- Parents:
- fccc236 (diff), 95e6c4f (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/libc
- Files:
-
- 16 added
- 6 deleted
- 31 edited
- 6 moved
-
Makefile (modified) (2 diffs)
-
Makefile.build (deleted)
-
Makefile.common (deleted)
-
Makefile.toolchain (modified) (1 diff)
-
arch/amd64/Makefile.inc (modified) (1 diff)
-
arch/amd64/include/istate.h (added)
-
arch/amd64/include/types.h (modified) (1 diff)
-
arch/amd64/src/stacktrace.c (added)
-
arch/amd64/src/stacktrace_asm.S (moved) (moved from uspace/srv/clip/Makefile.common ) (2 diffs)
-
arch/arm32/Makefile.inc (modified) (1 diff)
-
arch/arm32/include/istate.h (added)
-
arch/arm32/include/types.h (modified) (1 diff)
-
arch/arm32/src/stacktrace.S (deleted)
-
arch/arm32/src/stacktrace.c (added)
-
arch/arm32/src/stacktrace_asm.S (moved) (moved from uspace/app/getterm/Makefile.common ) (2 diffs)
-
arch/ia32/Makefile.inc (modified) (1 diff)
-
arch/ia32/include/istate.h (added)
-
arch/ia32/include/types.h (modified) (1 diff)
-
arch/ia32/src/stacktrace.S (deleted)
-
arch/ia32/src/stacktrace.c (added)
-
arch/ia32/src/stacktrace_asm.S (moved) (moved from uspace/app/klog/Makefile.common ) (2 diffs)
-
arch/ia64/Makefile.inc (modified) (1 diff)
-
arch/ia64/include/istate.h (added)
-
arch/ia64/include/types.h (modified) (1 diff)
-
arch/ia64/src/stacktrace.c (added)
-
arch/ia64/src/stacktrace_asm.S (moved) (moved from uspace/app/init/Makefile.common ) (2 diffs)
-
arch/mips32/Makefile.inc (modified) (1 diff)
-
arch/mips32/include/istate.h (added)
-
arch/mips32/include/types.h (modified) (1 diff)
-
arch/mips32/src/stacktrace.c (added)
-
arch/mips32/src/stacktrace_asm.S (added)
-
arch/mips32eb/Makefile.inc (modified) (1 diff)
-
arch/mips32eb/include/istate.h (added)
-
arch/ppc32/Makefile.inc (modified) (1 diff)
-
arch/ppc32/include/istate.h (added)
-
arch/ppc32/include/types.h (modified) (1 diff)
-
arch/ppc32/src/stacktrace.S (deleted)
-
arch/ppc32/src/stacktrace.c (added)
-
arch/ppc32/src/stacktrace_asm.S (moved) (moved from uspace/app/edit/Makefile.common ) (2 diffs)
-
arch/sparc64/Makefile.inc (modified) (1 diff)
-
arch/sparc64/include/istate.h (added)
-
arch/sparc64/include/types.h (modified) (1 diff)
-
arch/sparc64/src/stacktrace.S (deleted)
-
arch/sparc64/src/stacktrace.c (added)
-
arch/sparc64/src/stacktrace_asm.S (moved) (moved from uspace/lib/libc/arch/amd64/src/stacktrace.S ) (1 diff)
-
generic/adt/hash_table.c (modified) (1 diff)
-
generic/io/io.c (modified) (2 diffs)
-
generic/stacktrace.c (modified) (2 diffs)
-
generic/udebug.c (modified) (2 diffs)
-
generic/vfs/vfs.c (modified) (1 diff)
-
include/adt/hash_table.h (modified) (1 diff)
-
include/assert.h (modified) (1 diff)
-
include/ipc/bd.h (modified) (1 diff)
-
include/ipc/vfs.h (modified) (5 diffs)
-
include/stacktrace.h (modified) (2 diffs)
-
include/stdlib.h (modified) (1 diff)
-
include/sys/types.h (modified) (1 diff)
-
include/udebug.h (modified) (1 diff)
-
include/vfs/vfs.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/Makefile
rfccc236 rb79d450 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 include Makefile.common 30 -include ../../../Makefile.config 30 31 31 .PHONY: all clean 32 USPACE_PREFIX = $(shell pwd)/../.. 33 #LIBS = $(LIBC_PREFIX)/libc.a 34 LIBS = 32 35 33 all: ../../../Makefile.config ../../../config.h ../../../config.defs 34 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 35 $(MAKE) -f Makefile.build PRECHECK=$(PRECHECK) 36 LINK = arch/$(UARCH)/_link.ld 36 37 37 clean: 38 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(LIBC) arch/*/_link.ld 39 find generic/ arch/*/ -name '*.o' -follow -exec rm \{\} \; 38 PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) 39 EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) 40 EXTRA_OUTPUT = $(LINK) 41 42 INCLUDE_KERNEL = include/kernel 43 INCLUDE_ARCH = include/arch 44 INCLUDE_LIBARCH = include/libarch 45 46 OUTPUT = libc.a 47 48 GENERIC_SOURCES = \ 49 generic/libc.c \ 50 generic/ddi.c \ 51 generic/as.c \ 52 generic/cap.c \ 53 generic/clipboard.c \ 54 generic/devmap.c \ 55 generic/event.c \ 56 generic/errno.c \ 57 generic/mem.c \ 58 generic/string.c \ 59 generic/fibril.c \ 60 generic/fibril_synch.c \ 61 generic/pcb.c \ 62 generic/smc.c \ 63 generic/thread.c \ 64 generic/tls.c \ 65 generic/task.c \ 66 generic/futex.c \ 67 generic/io/asprintf.c \ 68 generic/io/io.c \ 69 generic/io/printf.c \ 70 generic/io/klog.c \ 71 generic/io/snprintf.c \ 72 generic/io/vprintf.c \ 73 generic/io/vsnprintf.c \ 74 generic/io/printf_core.c \ 75 generic/io/console.c \ 76 generic/malloc.c \ 77 generic/sysinfo.c \ 78 generic/ipc.c \ 79 generic/async.c \ 80 generic/loader.c \ 81 generic/getopt.c \ 82 generic/adt/list.o \ 83 generic/adt/hash_table.o \ 84 generic/time.c \ 85 generic/err.c \ 86 generic/stdlib.c \ 87 generic/mman.c \ 88 generic/udebug.c \ 89 generic/vfs/vfs.c \ 90 generic/vfs/canonify.c \ 91 generic/stacktrace.c 92 93 ARCH_SOURCES = \ 94 arch/$(UARCH)/src/entry.s \ 95 arch/$(UARCH)/src/thread_entry.s 96 97 SOURCES = \ 98 $(GENERIC_SOURCES) \ 99 $(ARCH_SOURCES) 100 101 include ../Makefile.common 102 103 $(INCLUDE_ARCH): $(INCLUDE_KERNEL) $(INCLUDE_KERNEL)/arch 104 ln -sfn kernel/arch $@ 105 106 $(INCLUDE_LIBARCH): arch/$(UARCH)/include 107 ln -sfn ../$< $@ 108 109 $(INCLUDE_KERNEL)/arch: ../../../kernel/generic/include/arch $(INCLUDE_KERNEL) 110 111 $(INCLUDE_KERNEL): ../../../kernel/generic/include/ 112 ln -sfn ../$< $@ 113 114 $(LINK): $(LINK).in 115 $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@ -
uspace/lib/libc/Makefile.toolchain
rfccc236 rb79d450 59 59 # 60 60 61 include $(LIBC_PREFIX)/../../../Makefile.config62 include $(LIBC_PREFIX)/../../../config.defs63 include $(LIBC_PREFIX)/arch/$(UARCH)/Makefile.inc61 -include $(LIBC_PREFIX)/../../../Makefile.config 62 -include $(LIBC_PREFIX)/../../../config.defs 63 -include $(LIBC_PREFIX)/arch/$(UARCH)/Makefile.inc 64 64 65 65 ## Simple detection of the host system -
uspace/lib/libc/arch/amd64/Makefile.inc
rfccc236 rb79d450 37 37 arch/$(UARCH)/src/fibril.S \ 38 38 arch/$(UARCH)/src/tls.c \ 39 arch/$(UARCH)/src/stacktrace.S 39 arch/$(UARCH)/src/stacktrace.c \ 40 arch/$(UARCH)/src/stacktrace_asm.S 40 41 41 42 GCC_CFLAGS += -fno-omit-frame-pointer -
uspace/lib/libc/arch/amd64/include/types.h
rfccc236 rb79d450 36 36 #define LIBC_amd64_TYPES_H_ 37 37 38 #define __64_BITS__ 39 38 40 typedef unsigned long long sysarg_t; 39 41 -
uspace/lib/libc/arch/amd64/src/stacktrace_asm.S
rfccc236 rb79d450 1 1 # 2 # Copyright (c) 2009 Martin Decky2 # Copyright (c) 2009 Jakub Jermar 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 .text 29 30 30 ## Common names 31 # 31 .global stacktrace_prepare 32 .global stacktrace_fp_get 33 .global stacktrace_pc_get 32 34 33 LIBC_PREFIX = ../../lib/libc 34 SOFTINT_PREFIX = ../../lib/softint 35 LIBS = $(LIBC_PREFIX)/libc.a 35 stacktrace_prepare: 36 ret 36 37 37 DEPEND = Makefile.depend 38 DEPEND_PREV = $(DEPEND).prev 39 JOB = clip.job 40 OUTPUT = clip 38 stacktrace_fp_get: 39 movq %rbp, %rax 40 ret 41 42 stacktrace_pc_get: 43 movq (%rsp), %rax 44 ret -
uspace/lib/libc/arch/arm32/Makefile.inc
rfccc236 rb79d450 38 38 arch/$(UARCH)/src/tls.c \ 39 39 arch/$(UARCH)/src/eabi.S \ 40 arch/$(UARCH)/src/stacktrace.S 40 arch/$(UARCH)/src/stacktrace.c \ 41 arch/$(UARCH)/src/stacktrace_asm.S 41 42 42 43 GCC_CFLAGS += -ffixed-r9 -mtp=soft -mapcs-frame -fno-omit-frame-pointer -
uspace/lib/libc/arch/arm32/include/types.h
rfccc236 rb79d450 37 37 #define LIBC_arm32_TYPES_H_ 38 38 39 #define __32_BITS__ 40 39 41 typedef unsigned int sysarg_t; 40 42 -
uspace/lib/libc/arch/arm32/src/stacktrace_asm.S
rfccc236 rb79d450 1 1 # 2 # Copyright (c) 200 5 Martin Decky2 # Copyright (c) 2009 Jakub Jermar 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 .text 29 30 30 ## Common names 31 # 31 .global stacktrace_prepare 32 .global stacktrace_fp_get 33 .global stacktrace_pc_get 32 34 33 LIBC_PREFIX = ../../lib/libc 34 SOFTINT_PREFIX = ../../lib/softint 35 LIBS = $(LIBC_PREFIX)/libc.a 35 stacktrace_prepare: 36 mov pc, lr 36 37 37 DEPEND = Makefile.depend 38 DEPEND_PREV = $(DEPEND).prev 39 JOB = getterm.job 40 OUTPUT = getterm 38 stacktrace_fp_get: 39 mov r0, fp 40 mov pc, lr 41 42 stacktrace_pc_get: 43 mov r0, lr 44 mov pc, lr -
uspace/lib/libc/arch/ia32/Makefile.inc
rfccc236 rb79d450 38 38 arch/$(UARCH)/src/tls.c \ 39 39 arch/$(UARCH)/src/setjmp.S \ 40 arch/$(UARCH)/src/stacktrace.S 40 arch/$(UARCH)/src/stacktrace.c \ 41 arch/$(UARCH)/src/stacktrace_asm.S 41 42 42 43 GCC_CFLAGS += -march=pentium -
uspace/lib/libc/arch/ia32/include/types.h
rfccc236 rb79d450 36 36 #define LIBC_ia32_TYPES_H_ 37 37 38 #define __32_BITS__ 39 38 40 typedef unsigned int sysarg_t; 39 41 -
uspace/lib/libc/arch/ia32/src/stacktrace_asm.S
rfccc236 rb79d450 1 1 # 2 # Copyright (c) 200 5 Martin Decky2 # Copyright (c) 2009 Jakub Jermar 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 .text 29 30 30 ## Common names 31 # 31 .global stacktrace_prepare 32 .global stacktrace_fp_get 33 .global stacktrace_pc_get 32 34 33 LIBC_PREFIX = ../../lib/libc 34 SOFTINT_PREFIX = ../../lib/softint 35 LIBS = $(LIBC_PREFIX)/libc.a 35 stacktrace_prepare: 36 ret 36 37 37 DEPEND = Makefile.depend 38 DEPEND_PREV = $(DEPEND).prev 39 JOB = klog.job 40 OUTPUT = klog 38 stacktrace_fp_get: 39 movl %ebp, %eax 40 ret 41 42 stacktrace_pc_get: 43 movl (%esp), %eax 44 ret -
uspace/lib/libc/arch/ia64/Makefile.inc
rfccc236 rb79d450 37 37 arch/$(UARCH)/src/tls.c \ 38 38 arch/$(UARCH)/src/ddi.c \ 39 arch/$(UARCH)/src/stacktrace.S 39 arch/$(UARCH)/src/stacktrace.c \ 40 arch/$(UARCH)/src/stacktrace_asm.S 40 41 41 42 GCC_CFLAGS += -fno-unwind-tables -
uspace/lib/libc/arch/ia64/include/types.h
rfccc236 rb79d450 36 36 #define LIBC_ia64_TYPES_H_ 37 37 38 #define __64_BITS__ 39 38 40 typedef unsigned long long sysarg_t; 39 41 -
uspace/lib/libc/arch/ia64/src/stacktrace_asm.S
rfccc236 rb79d450 1 1 # 2 # Copyright (c) 200 5 Martin Decky2 # Copyright (c) 2009 Jakub Jermar 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 .text 29 30 30 ## Common names 31 # 31 .global stacktrace_prepare 32 .global stacktrace_fp_get 33 .global stacktrace_pc_get 32 34 33 LIBC_PREFIX = ../../lib/libc 34 SOFTINT_PREFIX = ../../lib/softint 35 LIBS = $(LIBC_PREFIX)/libc.a 35 stacktrace_prepare: 36 br.ret.sptk.many b0 36 37 37 DEPEND = Makefile.depend 38 DEPEND_PREV = $(DEPEND).prev 39 JOB = init.job 40 OUTPUT = init 38 stacktrace_fp_get: 39 stacktrace_pc_get: 40 mov r8 = r0 41 br.ret.sptk.many b0 -
uspace/lib/libc/arch/mips32/Makefile.inc
rfccc236 rb79d450 36 36 arch/$(UARCH)/src/fibril.S \ 37 37 arch/$(UARCH)/src/tls.c \ 38 arch/$(UARCH)/src/stacktrace.S 38 arch/$(UARCH)/src/stacktrace.c \ 39 arch/$(UARCH)/src/stacktrace_asm.S 39 40 40 41 GCC_CFLAGS += -mips3 -
uspace/lib/libc/arch/mips32/include/types.h
rfccc236 rb79d450 37 37 #define LIBC_mips32_TYPES_H_ 38 38 39 #define __32_BITS__ 40 39 41 typedef unsigned int sysarg_t; 40 42 -
uspace/lib/libc/arch/mips32eb/Makefile.inc
rfccc236 rb79d450 35 35 ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \ 36 36 arch/$(UARCH)/src/fibril.S \ 37 arch/$(UARCH)/src/tls.c 37 arch/$(UARCH)/src/tls.c \ 38 arch/$(UARCH)/src/stacktrace.c \ 39 arch/$(UARCH)/src/stacktrace_asm.S 38 40 39 41 GCC_CFLAGS += -mips3 -
uspace/lib/libc/arch/ppc32/Makefile.inc
rfccc236 rb79d450 36 36 arch/$(UARCH)/src/fibril.S \ 37 37 arch/$(UARCH)/src/tls.c \ 38 arch/$(UARCH)/src/stacktrace.S 38 arch/$(UARCH)/src/stacktrace.c \ 39 arch/$(UARCH)/src/stacktrace_asm.S 39 40 40 41 GCC_CFLAGS += -mcpu=powerpc -msoft-float -m32 -
uspace/lib/libc/arch/ppc32/include/types.h
rfccc236 rb79d450 36 36 #define LIBC_ppc32_TYPES_H_ 37 37 38 #define __32_BITS__ 39 38 40 typedef unsigned int sysarg_t; 39 41 -
uspace/lib/libc/arch/ppc32/src/stacktrace_asm.S
rfccc236 rb79d450 1 1 # 2 # Copyright (c) 200 5 Martin Decky2 # Copyright (c) 2009 Jakub Jermar 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 .text 29 30 30 ## Common names 31 # 31 #include <libarch/regname.h> 32 32 33 LIBC_PREFIX = ../../lib/libc 34 SOFTINT_PREFIX = ../../lib/softint35 LIBS = $(LIBC_PREFIX)/libc.a 33 .global stacktrace_prepare 34 .global stacktrace_fp_get 35 .global stacktrace_pc_get 36 36 37 DEPEND = Makefile.depend 38 DEPEND_PREV = $(DEPEND).prev 39 JOB = edit.job 40 OUTPUT = edit 37 stacktrace_prepare: 38 blr 39 40 stacktrace_fp_get: 41 mr r3, sp 42 blr 43 44 stacktrace_pc_get: 45 mflr r3 46 blr -
uspace/lib/libc/arch/sparc64/Makefile.inc
rfccc236 rb79d450 35 35 ARCH_SOURCES += arch/$(UARCH)/src/fibril.S \ 36 36 arch/$(UARCH)/src/tls.c \ 37 arch/$(UARCH)/src/stacktrace.S 37 arch/$(UARCH)/src/stacktrace.c \ 38 arch/$(UARCH)/src/stacktrace_asm.S 38 39 39 40 GCC_CFLAGS += -mcpu=ultrasparc -m64 -
uspace/lib/libc/arch/sparc64/include/types.h
rfccc236 rb79d450 36 36 #define LIBC_sparc64_TYPES_H_ 37 37 38 #define __64_BITS__ 39 38 40 typedef unsigned long sysarg_t; 39 41 -
uspace/lib/libc/arch/sparc64/src/stacktrace_asm.S
rfccc236 rb79d450 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 31 .global frame_pointer_get 32 .global frame_pointer_prev 33 .global frame_pointer_validate 34 .global return_address_get 35 .global program_counter_get 33 .global stacktrace_prepare 34 .global stacktrace_fp_get 35 .global stacktrace_pc_get 36 36 37 frame_pointer_get: 38 movq %rbp, %rax 37 stacktrace_prepare: 38 save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE+STACK_ARG_SAVE_AREA_SIZE), %sp 39 # Flush all other windows to memory so that we can read their contents. 40 flushw 39 41 ret 42 restore 40 43 41 frame_pointer_prev: 42 movq (%rdi), %rax 43 ret 44 stacktrace_fp_get: 45 # Add the stack bias to %sp to get the actual address. 46 retl 47 add %sp, STACK_BIAS, %o0 44 48 45 frame_pointer_validate: 46 movq %rdi, %rax 47 ret 48 49 return_address_get: 50 movq 8(%rdi), %rax 51 ret 52 53 program_counter_get: 54 movq (%rsp), %rax 55 ret 49 stacktrace_pc_get: 50 retl 51 mov %o7, %o0 -
uspace/lib/libc/generic/adt/hash_table.c
rfccc236 rb79d450 193 193 } 194 194 195 /** Apply fucntion to all items in hash table. 196 * 197 * @param h Hash table. 198 * @param f Function to be applied. 199 * @param arg Argument to be passed to the function. 200 */ 201 void 202 hash_table_apply(hash_table_t *h, void (*f)(link_t *, void *), void *arg) 203 { 204 hash_index_t bucket; 205 link_t *cur; 206 207 for (bucket = 0; bucket < h->entries; bucket++) { 208 for (cur = h->entry[bucket].next; cur != &h->entry[bucket]; 209 cur = cur->next) { 210 f(cur, arg); 211 } 212 } 213 } 214 195 215 /** @} 196 216 */ -
uspace/lib/libc/generic/io/io.c
rfccc236 rb79d450 554 554 } 555 555 556 int ftell(FILE *stream) 557 { 558 off_t rc = lseek(stream->fd, 0, SEEK_CUR); 559 if (rc == (off_t) (-1)) { 560 /* errno has been set by lseek. */ 561 return -1; 562 } 563 564 return rc; 565 } 566 556 567 void rewind(FILE *stream) 557 568 { … … 584 595 } 585 596 597 void clearerr(FILE *stream) 598 { 599 stream->eof = false; 600 stream->error = false; 601 } 602 586 603 int fphone(FILE *stream) 587 604 { -
uspace/lib/libc/generic/stacktrace.c
rfccc236 rb79d450 1 1 /* 2 2 * Copyright (c) 2009 Jakub Jermar 3 * Copyright (c) 2010 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 36 37 #include <stdio.h> 37 38 #include <sys/types.h> 39 #include <errno.h> 38 40 39 void stack_trace_fp_pc(uintptr_t fp, uintptr_t pc) 41 static int stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data); 42 43 void stacktrace_print_fp_pc(uintptr_t fp, uintptr_t pc) 40 44 { 41 printf("Printing stack trace:\n"); 42 printf("=====================\n"); 43 while (frame_pointer_validate(fp)) { 45 stacktrace_t st; 46 uintptr_t nfp; 47 48 st.op_arg = NULL; 49 st.read_uintptr = stacktrace_read_uintptr; 50 51 while (stacktrace_fp_valid(&st, fp)) { 44 52 printf("%p: %p()\n", fp, pc); 45 pc = return_address_get(fp); 46 fp = frame_pointer_prev(fp); 53 (void) stacktrace_ra_get(&st, fp, &pc); 54 (void) stacktrace_fp_prev(&st, fp, &nfp); 55 fp = nfp; 47 56 } 48 printf("=====================\n");49 57 } 50 58 51 void stack _trace(void)59 void stacktrace_print(void) 52 60 { 53 stack_trace_fp_pc(frame_pointer_get(), program_counter_get()); 61 stacktrace_prepare(); 62 stacktrace_print_fp_pc(stacktrace_fp_get(), stacktrace_pc_get()); 54 63 /* 55 64 * Prevent the tail call optimization of the previous call by 56 65 * making it a non-tail call. 57 66 */ 58 (void) frame_pointer_get(); 67 (void) stacktrace_fp_get(); 68 } 69 70 static int stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data) 71 { 72 (void) arg; 73 *data = *((uintptr_t *) addr); 74 return EOK; 59 75 } 60 76 -
uspace/lib/libc/generic/udebug.c
rfccc236 rb79d450 69 69 } 70 70 71 int udebug_name_read(int phoneid, void *buffer, size_t n, 72 size_t *copied, size_t *needed) 73 { 74 ipcarg_t a_copied, a_needed; 75 int rc; 76 77 rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_NAME_READ, 78 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed); 79 80 *copied = (size_t)a_copied; 81 *needed = (size_t)a_needed; 82 83 return rc; 84 } 85 86 int udebug_areas_read(int phoneid, void *buffer, size_t n, 87 size_t *copied, size_t *needed) 88 { 89 ipcarg_t a_copied, a_needed; 90 int rc; 91 92 rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_AREAS_READ, 93 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed); 94 95 *copied = (size_t)a_copied; 96 *needed = (size_t)a_needed; 97 98 return rc; 99 } 100 71 101 int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n) 72 102 { … … 78 108 { 79 109 return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_ARGS_READ, 110 tid, (sysarg_t)buffer); 111 } 112 113 int udebug_regs_read(int phoneid, thash_t tid, void *buffer) 114 { 115 return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_REGS_READ, 80 116 tid, (sysarg_t)buffer); 81 117 } -
uspace/lib/libc/generic/vfs/vfs.c
rfccc236 rb79d450 197 197 } 198 198 199 int unmount(const char *mp) 200 { 201 ipcarg_t rc; 202 ipcarg_t rc_orig; 203 aid_t req; 204 size_t mpa_size; 205 char *mpa; 206 207 mpa = absolutize(mp, &mpa_size); 208 if (!mpa) 209 return ENOMEM; 210 211 futex_down(&vfs_phone_futex); 212 async_serialize_start(); 213 vfs_connect(); 214 215 req = async_send_0(vfs_phone, VFS_IN_UNMOUNT, NULL); 216 rc = async_data_write_start(vfs_phone, (void *) mpa, mpa_size); 217 if (rc != EOK) { 218 async_wait_for(req, &rc_orig); 219 async_serialize_end(); 220 futex_up(&vfs_phone_futex); 221 free(mpa); 222 if (rc_orig == EOK) 223 return (int) rc; 224 else 225 return (int) rc_orig; 226 } 227 228 229 async_wait_for(req, &rc); 230 async_serialize_end(); 231 futex_up(&vfs_phone_futex); 232 free(mpa); 233 234 return (int) rc; 235 } 236 199 237 static int open_internal(const char *abs, size_t abs_size, int lflag, int oflag) 200 238 { -
uspace/lib/libc/include/adt/hash_table.h
rfccc236 rb79d450 88 88 extern void hash_table_remove(hash_table_t *, unsigned long [], hash_count_t); 89 89 extern void hash_table_destroy(hash_table_t *); 90 extern void hash_table_apply(hash_table_t *, void (*)(link_t *, void *), 91 void *); 90 92 91 93 #endif -
uspace/lib/libc/include/assert.h
rfccc236 rb79d450 51 51 52 52 #ifndef NDEBUG 53 # define assert(expr) if (!(expr)) { printf("Assertion failed (%s) at file '%s', line %d.\n", #expr, __FILE__, __LINE__); abort();} 53 # define assert(expr) \ 54 do { \ 55 if (!(expr)) { \ 56 printf("Assertion failed (%s) at file '%s', " \ 57 "line %d.\n", #expr, __FILE__, __LINE__); \ 58 abort(); \ 59 } \ 60 } while (0) 54 61 #else 55 62 # define assert(expr) -
uspace/lib/libc/include/ipc/bd.h
rfccc236 rb79d450 40 40 typedef enum { 41 41 BD_GET_BLOCK_SIZE = IPC_FIRST_USER_METHOD, 42 BD_GET_NUM_BLOCKS, 42 43 BD_READ_BLOCKS, 43 44 BD_WRITE_BLOCKS -
uspace/lib/libc/include/ipc/vfs.h
rfccc236 rb79d450 86 86 VFS_OUT_MOUNTED, 87 87 VFS_OUT_UNMOUNT, 88 VFS_OUT_UNMOUNTED, 88 89 VFS_OUT_SYNC, 89 90 VFS_OUT_STAT, … … 100 101 * No lookup flags used. 101 102 */ 102 #define L_NONE 0103 #define L_NONE 0 103 104 104 105 /** … … 107 108 * with L_DIRECTORY. 108 109 */ 109 #define L_FILE 1110 #define L_FILE 1 110 111 111 112 /** 112 * Lookup wil succeed only if the object is a directory. If L_CREATE is113 * Lookup will succeed only if the object is a directory. If L_CREATE is 113 114 * specified, an empty directory will be created. This flag is mutually 114 115 * exclusive with L_FILE. 115 116 */ 116 #define L_DIRECTORY 2 117 #define L_DIRECTORY 2 118 119 /** 120 * Lookup will succeed only if the object is a root directory. The flag is 121 * mutually exclusive with L_FILE and L_MP. 122 */ 123 #define L_ROOT 4 124 125 /** 126 * Lookup will succeed only if the object is a mount point. The flag is mutually 127 * exclusive with L_FILE and L_ROOT. 128 */ 129 #define L_MP 8 130 117 131 118 132 /** … … 120 134 * object already exists. L_EXCLUSIVE is implied when L_DIRECTORY is used. 121 135 */ 122 #define L_EXCLUSIVE 4136 #define L_EXCLUSIVE 16 123 137 124 138 /** 125 139 * L_CREATE is used for creating both regular files and directories. 126 140 */ 127 #define L_CREATE 8141 #define L_CREATE 32 128 142 129 143 /** 130 144 * L_LINK is used for linking to an already existing nodes. 131 145 */ 132 #define L_LINK 16146 #define L_LINK 64 133 147 134 148 /** … … 137 151 * VFS_UNLINK. 138 152 */ 139 #define L_UNLINK 32153 #define L_UNLINK 128 140 154 141 155 /** 142 * L_OPEN is used to indicate that the lookup operation is a part of VFS_ OPEN156 * L_OPEN is used to indicate that the lookup operation is a part of VFS_IN_OPEN 143 157 * call from the client. This means that the server might allocate some 144 158 * resources for the opened file. This flag cannot be passed directly by the 145 159 * client. 146 160 */ 147 #define L_OPEN 64161 #define L_OPEN 256 148 162 149 163 #endif -
uspace/lib/libc/include/stacktrace.h
rfccc236 rb79d450 1 1 /* 2 2 * Copyright (c) 2009 Jakub Jermar 3 * Copyright (c) 2010 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 39 40 #include <bool.h> 40 41 41 extern void stack_trace(void); 42 extern void stack_trace_fp_pc(uintptr_t, uintptr_t); 42 typedef struct { 43 void *op_arg; 44 int (*read_uintptr)(void *, uintptr_t, uintptr_t *); 45 } stacktrace_t; 46 47 extern void stacktrace_print(void); 48 extern void stacktrace_print_fp_pc(uintptr_t, uintptr_t); 43 49 44 50 /* 45 51 * The following interface is to be implemented by each architecture. 46 52 */ 47 extern bool frame_pointer_validate(uintptr_t); 48 extern uintptr_t frame_pointer_get(void); 49 extern uintptr_t frame_pointer_prev(uintptr_t); 50 extern uintptr_t return_address_get(uintptr_t); 51 extern uintptr_t program_counter_get(); 53 extern bool stacktrace_fp_valid(stacktrace_t *, uintptr_t); 54 extern int stacktrace_fp_prev(stacktrace_t *, uintptr_t, uintptr_t *); 55 extern int stacktrace_ra_get(stacktrace_t *, uintptr_t, uintptr_t *); 56 57 extern void stacktrace_prepare(void); 58 extern uintptr_t stacktrace_fp_get(void); 59 extern uintptr_t stacktrace_pc_get(); 52 60 53 61 #endif -
uspace/lib/libc/include/stdlib.h
rfccc236 rb79d450 42 42 #define abort() \ 43 43 do { \ 44 stack _trace(); \44 stacktrace_print(); \ 45 45 _exit(1); \ 46 46 } while (0) -
uspace/lib/libc/include/sys/types.h
rfccc236 rb79d450 40 40 typedef long off_t; 41 41 typedef int mode_t; 42 typedef uint64_t bn_t; /**< Block number type. */ 42 43 43 44 typedef int32_t wchar_t; -
uspace/lib/libc/include/udebug.h
rfccc236 rb79d450 47 47 int udebug_thread_read(int phoneid, void *buffer, size_t n, 48 48 size_t *copied, size_t *needed); 49 int udebug_name_read(int phoneid, void *buffer, size_t n, 50 size_t *copied, size_t *needed); 51 int udebug_areas_read(int phoneid, void *buffer, size_t n, 52 size_t *copied, size_t *needed); 49 53 int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n); 50 54 int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer); 55 int udebug_regs_read(int phoneid, thash_t tid, void *buffer); 51 56 int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type, 52 57 sysarg_t *val0, sysarg_t *val1); -
uspace/lib/libc/include/vfs/vfs.h
rfccc236 rb79d450 55 55 extern int mount(const char *, const char *, const char *, const char *, 56 56 unsigned int); 57 extern int unmount(const char *); 57 58 58 59 extern void __stdio_init(int filc, fdi_node_t *filv[]);
Note:
See TracChangeset
for help on using the changeset viewer.
