Changeset c6588ce in mainline for uspace/lib/c
- Timestamp:
- 2012-05-05T08:12:17Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ee04c28
- Parents:
- 2cc7f16 (diff), d21e935c (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
- 16 deleted
- 42 edited
- 12 moved
-
Makefile (modified) (4 diffs)
-
arch/amd64/include/fibril.h (modified) (1 diff)
-
arch/arm32/Makefile.common (modified) (1 diff)
-
arch/arm32/include/fibril.h (modified) (4 diffs)
-
arch/arm32/src/eabi.S (modified) (2 diffs)
-
arch/ia32/include/fibril.h (modified) (1 diff)
-
arch/ia64/include/ddi.h (modified) (7 diffs)
-
arch/ia64/include/fibril.h (modified) (2 diffs)
-
arch/mips32/Makefile.inc (modified) (1 diff)
-
arch/mips32/include/atomic.h (modified) (1 diff)
-
arch/mips32/include/config.h (modified) (1 diff)
-
arch/mips32/include/faddr.h (modified) (1 diff)
-
arch/mips32/include/fibril.h (modified) (1 diff)
-
arch/mips32/include/stack.h (added)
-
arch/mips32/src/entry.S (moved) (moved from uspace/lib/c/arch/mips64/src/entry.s ) (3 diffs)
-
arch/mips32/src/entryjmp.S (moved) (moved from uspace/lib/c/arch/mips64/src/entryjmp.s ) (2 diffs)
-
arch/mips32/src/fibril.S (modified) (1 diff)
-
arch/mips32/src/syscall.c (modified) (1 diff)
-
arch/mips32/src/thread_entry.S (moved) (moved from uspace/lib/c/arch/mips64/src/thread_entry.s ) (3 diffs)
-
arch/mips32eb/Makefile.inc (modified) (1 diff)
-
arch/mips32eb/include/stack.h (added)
-
arch/mips64/Makefile.inc (modified) (1 diff)
-
arch/mips64/include/fibril.h (modified) (1 diff)
-
arch/mips64/include/stack.h (added)
-
arch/mips64/src/entry.S (moved) (moved from uspace/lib/c/arch/mips32/src/entry.s ) (2 diffs)
-
arch/mips64/src/entryjmp.S (moved) (moved from uspace/lib/c/arch/mips32/src/entryjmp.s ) (3 diffs)
-
arch/mips64/src/thread_entry.S (moved) (moved from uspace/lib/c/arch/mips32/src/thread_entry.s ) (2 diffs)
-
arch/ppc32/include/fibril.h (modified) (2 diffs)
-
arch/sparc64/include/fibril.h (modified) (2 diffs)
-
generic/adt/measured_strings.c (deleted)
-
generic/async.c (modified) (22 diffs)
-
generic/device/nic.c (modified) (2 diffs)
-
generic/devman.c (modified) (8 diffs)
-
generic/fibril_synch.c (modified) (4 diffs)
-
generic/inet.c (added)
-
generic/inetcfg.c (added)
-
generic/inetping.c (added)
-
generic/io/printf_core.c (modified) (2 diffs)
-
generic/ipc.c (modified) (1 diff)
-
generic/iplink.c (added)
-
generic/iplink_srv.c (added)
-
generic/loader.c (modified) (5 diffs)
-
generic/loc.c (modified) (9 diffs)
-
generic/net/icmp_api.c (deleted)
-
generic/net/modules.c (deleted)
-
generic/net/packet.c (deleted)
-
generic/net/socket_client.c (modified) (4 diffs)
-
generic/ns.c (modified) (5 diffs)
-
generic/private/async.h (modified) (1 diff)
-
generic/str.c (modified) (7 diffs)
-
generic/sysinfo.c (modified) (4 diffs)
-
include/async.h (modified) (2 diffs)
-
include/fibril.h (modified) (1 diff)
-
include/inet/inet.h (moved) (moved from uspace/lib/net/include/net_hardware.h ) (3 diffs)
-
include/inet/inetcfg.h (added)
-
include/inet/inetping.h (moved) (moved from uspace/lib/net/include/packet_remote.h ) (2 diffs)
-
include/inet/iplink.h (moved) (moved from uspace/lib/net/include/il_remote.h ) (2 diffs)
-
include/inet/iplink_srv.h (moved) (moved from uspace/lib/c/include/adt/measured_strings.h ) (2 diffs)
-
include/ipc/icmp.h (deleted)
-
include/ipc/il.h (deleted)
-
include/ipc/inet.h (moved) (moved from uspace/srv/net/net/packet_server.h ) (2 diffs)
-
include/ipc/ip.h (deleted)
-
include/ipc/ipc.h (modified) (1 diff)
-
include/ipc/iplink.h (moved) (moved from uspace/lib/c/include/ipc/tl.h ) (2 diffs)
-
include/ipc/net.h (deleted)
-
include/ipc/net_net.h (deleted)
-
include/ipc/netif.h (deleted)
-
include/ipc/nil.h (deleted)
-
include/ipc/packet.h (deleted)
-
include/ipc/services.h (modified) (1 diff)
-
include/ipc/socket.h (modified) (1 diff)
-
include/net/icmp_codes.h (deleted)
-
include/net/in.h (modified) (1 diff)
-
include/net/modules.h (deleted)
-
include/net/packet.h (deleted)
-
include/net/packet_header.h (deleted)
-
include/ns.h (modified) (1 diff)
-
include/str.h (modified) (2 diffs)
-
include/sysinfo.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
r2cc7f16 rc6588ce 87 87 generic/task.c \ 88 88 generic/futex.c \ 89 generic/inet.c \ 90 generic/inetcfg.c \ 91 generic/inetping.c \ 89 92 generic/io/asprintf.c \ 90 93 generic/io/io.c \ … … 97 100 generic/io/printf_core.c \ 98 101 generic/io/console.c \ 102 generic/iplink.c \ 103 generic/iplink_srv.c \ 99 104 generic/malloc.c \ 100 105 generic/sysinfo.c \ … … 108 113 generic/adt/hash_set.c \ 109 114 generic/adt/dynamic_fifo.c \ 110 generic/adt/measured_strings.c \111 115 generic/adt/char_map.c \ 112 116 generic/adt/prodcons.c \ … … 118 122 generic/vfs/canonify.c \ 119 123 generic/net/inet.c \ 120 generic/net/icmp_common.c \121 generic/net/icmp_api.c \122 generic/net/modules.c \123 generic/net/packet.c \124 124 generic/net/socket_client.c \ 125 125 generic/net/socket_parse.c \ -
uspace/lib/c/arch/amd64/include/fibril.h
r2cc7f16 rc6588ce 38 38 #include <sys/types.h> 39 39 40 /* According to ABI the stack MUST be aligned on 40 /* 41 * According to ABI the stack MUST be aligned on 41 42 * 16-byte boundary. If it is not, the va_arg calling will 42 43 * panic sooner or later 43 44 */ 44 #define SP_DELTA 1645 #define SP_DELTA 16 45 46 46 47 #define context_set(c, _pc, stack, size, ptls) \ -
uspace/lib/c/arch/arm32/Makefile.common
r2cc7f16 rc6588ce 28 28 # 29 29 30 GCC_CFLAGS += -ffixed-r9 -mtp=soft - mapcs-frame -fno-omit-frame-pointer30 GCC_CFLAGS += -ffixed-r9 -mtp=soft -fno-omit-frame-pointer -march=armv4 31 31 32 32 ENDIANESS = LE -
uspace/lib/c/arch/arm32/include/fibril.h
r2cc7f16 rc6588ce 27 27 */ 28 28 29 /** @addtogroup libcarm32 29 /** @addtogroup libcarm32 30 30 * @{ 31 31 */ … … 42 42 43 43 /** Size of a stack item */ 44 #define STACK_ITEM_SIZE 444 #define STACK_ITEM_SIZE 4 45 45 46 46 /** Stack alignment - see <a href="http://www.arm.com/support/faqdev/14269.html">ABI</a> for details */ 47 #define STACK_ALIGNMENT 847 #define STACK_ALIGNMENT 8 48 48 49 #define SP_DELTA (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))49 #define SP_DELTA (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 50 50 51 51 52 /** Sets data to the context. 53 * 52 /** Sets data to the context. 53 * 54 54 * @param c Context (#context_t). 55 55 * @param _pc Program counter. … … 62 62 (c)->pc = (sysarg_t) (_pc); \ 63 63 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 64 (c)->tls = ((sysarg_t)(ptls)) + sizeof(tcb_t) + ARM_TP_OFFSET; \64 (c)->tls = ((sysarg_t)(ptls)) + sizeof(tcb_t) + ARM_TP_OFFSET; \ 65 65 (c)->fp = 0; \ 66 66 } while (0) 67 67 68 /** Fibril context. 68 /** Fibril context. 69 69 * 70 70 * Only registers preserved accross function calls are included. r9 is used … … 91 91 } 92 92 93 94 93 #endif 95 94 -
uspace/lib/c/arch/arm32/src/eabi.S
r2cc7f16 rc6588ce 1 1 # 2 # Copyright (c) 20 07 Pavel Jancik2 # Copyright (c) 2012 Martin Decky 3 3 # All rights reserved. 4 4 # … … 31 31 .global __aeabi_read_tp 32 32 33 .global __aeabi_idiv 34 .global __aeabi_uidiv 35 36 .global __aeabi_idivmod 37 .global __aeabi_uidivmod 38 39 .global __aeabi_ldivmod 40 .global __aeabi_uldivmod 41 33 42 __aeabi_read_tp: 34 43 mov r0, r9 35 44 mov pc, lr 45 46 __aeabi_idiv: 47 push {lr} 48 bl __divsi3 49 pop {lr} 50 mov pc, lr 51 52 __aeabi_uidiv: 53 push {lr} 54 bl __udivsi3 55 pop {lr} 56 mov pc, lr 57 58 __aeabi_idivmod: 59 push {lr} 60 sub sp, sp, #12 61 add r2, sp, #4 62 bl __udivmodsi3 63 ldr r1, [sp, #4] 64 add sp, sp, #12 65 pop {lr} 66 mov pc, lr 67 68 __aeabi_uidivmod: 69 push {lr} 70 sub sp, sp, #12 71 add r2, sp, #4 72 bl __udivmodsi3 73 ldr r1, [sp, #4] 74 add sp, sp, #12 75 pop {lr} 76 mov pc, lr 77 78 __aeabi_ldivmod: 79 push {lr} 80 sub sp, sp, #24 81 push {sp} 82 bl __divmoddi3 83 add sp, sp, #4 84 pop {r2, r3} 85 add sp, sp, #16 86 pop {lr} 87 mov pc, lr 88 89 __aeabi_uldivmod: 90 push {lr} 91 sub sp, sp, #24 92 push {sp} 93 bl __udivmoddi3 94 add sp, sp, #4 95 pop {r2, r3} 96 add sp, sp, #16 97 pop {lr} 98 mov pc, lr -
uspace/lib/c/arch/ia32/include/fibril.h
r2cc7f16 rc6588ce 38 38 #include <sys/types.h> 39 39 40 /* According to ABI the stack MUST be aligned on 40 /* 41 * According to ABI the stack MUST be aligned on 41 42 * 16-byte boundary. If it is not, the va_arg calling will 42 43 * panic sooner or later -
uspace/lib/c/arch/ia64/include/ddi.h
r2cc7f16 rc6588ce 62 62 63 63 asm volatile ("mf\n" ::: "memory"); 64 asm volatile ("mf.a\n" ::: "memory"); 64 65 } 65 66 … … 76 77 77 78 asm volatile ("mf\n" ::: "memory"); 79 asm volatile ("mf.a\n" ::: "memory"); 78 80 } 79 81 … … 90 92 91 93 asm volatile ("mf\n" ::: "memory"); 94 asm volatile ("mf.a\n" ::: "memory"); 92 95 } 93 96 … … 106 109 v = *port; 107 110 } 111 112 asm volatile ("mf.a\n" ::: "memory"); 108 113 109 114 return v; … … 125 130 } 126 131 132 asm volatile ("mf.a\n" ::: "memory"); 133 127 134 return v; 128 135 } … … 134 141 asm volatile ("mf\n" ::: "memory"); 135 142 136 if (port < (ioport32_t *) port) {143 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 137 144 uintptr_t prt = (uintptr_t) port; 138 145 … … 143 150 } 144 151 152 asm volatile ("mf.a\n" ::: "memory"); 153 145 154 return v; 146 155 } -
uspace/lib/c/arch/ia64/include/fibril.h
r2cc7f16 rc6588ce 27 27 */ 28 28 29 /** @addtogroup libcia64 29 /** @addtogroup libcia64 30 30 * @{ 31 31 */ … … 45 45 * No need to allocate scratch area. 46 46 */ 47 #define SP_DELTA (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))47 #define SP_DELTA (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 48 48 49 #define PFM_MASK (~0x3fffffffff)49 #define PFM_MASK (~0x3fffffffff) 50 50 51 #define PSTHREAD_INITIAL_STACK_PAGES_NO 2 51 #define PSTHREAD_INITIAL_STACK_PAGES_NO 2 52 52 53 /* Stack is divided into two equal parts (for memory stack and register stack). */ 53 #define PSTHREAD_INITIAL_STACK_DIVISION 254 #define PSTHREAD_INITIAL_STACK_DIVISION 2 54 55 55 #define context_set(c, _pc, stack, size, tls) \ 56 do { \ 57 (c)->pc = (uint64_t) _pc; \ 58 (c)->bsp = ((uint64_t) stack) + size / PSTHREAD_INITIAL_STACK_DIVISION; \ 59 (c)->ar_pfs &= PFM_MASK; \ 60 (c)->sp = ((uint64_t) stack) + ALIGN_UP((size / PSTHREAD_INITIAL_STACK_DIVISION), STACK_ALIGNMENT) - SP_DELTA; \ 61 (c)->tp = (uint64_t) tls; \ 62 } while (0); 63 56 #define context_set(c, _pc, stack, size, tls) \ 57 do { \ 58 (c)->pc = (uint64_t) _pc; \ 59 (c)->bsp = ((uint64_t) stack) + \ 60 size / PSTHREAD_INITIAL_STACK_DIVISION; \ 61 (c)->ar_pfs &= PFM_MASK; \ 62 (c)->sp = ((uint64_t) stack) + \ 63 ALIGN_UP((size / PSTHREAD_INITIAL_STACK_DIVISION), STACK_ALIGNMENT) - \ 64 SP_DELTA; \ 65 (c)->tp = (uint64_t) tls; \ 66 } while (0) 64 67 65 68 /* -
uspace/lib/c/arch/mips32/Makefile.inc
r2cc7f16 rc6588ce 28 28 29 29 ARCH_SOURCES = \ 30 arch/$(UARCH)/src/entry. s\31 arch/$(UARCH)/src/entryjmp. s\32 arch/$(UARCH)/src/thread_entry. s\30 arch/$(UARCH)/src/entry.S \ 31 arch/$(UARCH)/src/entryjmp.S \ 32 arch/$(UARCH)/src/thread_entry.S \ 33 33 arch/$(UARCH)/src/syscall.c \ 34 34 arch/$(UARCH)/src/fibril.S \ -
uspace/lib/c/arch/mips32/include/atomic.h
r2cc7f16 rc6588ce 67 67 " ll %0, %1\n" 68 68 " addu %0, %0, %3\n" /* same as add, but never traps on overflow */ 69 " move %2, %0\n"69 " move %2, %0\n" 70 70 " sc %0, %1\n" 71 71 " beq %0, %4, 1b\n" /* if the atomic operation failed, try again */ -
uspace/lib/c/arch/mips32/include/config.h
r2cc7f16 rc6588ce 36 36 #define LIBC_mips32_CONFIG_H_ 37 37 38 #define PAGE_WIDTH 1439 #define PAGE_SIZE (1 << PAGE_WIDTH)38 #define PAGE_WIDTH 14 39 #define PAGE_SIZE (1 << PAGE_WIDTH) 40 40 41 41 #endif -
uspace/lib/c/arch/mips32/include/faddr.h
r2cc7f16 rc6588ce 38 38 #include <libarch/types.h> 39 39 40 #define FADDR(fptr) ((uintptr_t) (fptr))40 #define FADDR(fptr) ((uintptr_t) (fptr)) 41 41 42 42 #endif -
uspace/lib/c/arch/mips32/include/fibril.h
r2cc7f16 rc6588ce 38 38 39 39 #include <sys/types.h> 40 #include <libarch/stack.h> 41 #include <align.h> 40 42 41 /* We define our own context_set, because we need to set 42 * the TLS pointer to the tcb+0x7000 43 #define SP_DELTA (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 44 45 /* 46 * We define our own context_set, because we need to set 47 * the TLS pointer to the tcb + 0x7000 43 48 * 44 49 * See tls_set in thread.h 45 50 */ 46 #define context_set(c, _pc, stack, size, ptls) \ 47 (c)->pc = (sysarg_t) (_pc); \ 48 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 49 (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); 50 51 52 /* +16 is just for sure that the called function 53 * have space to store it's arguments 54 */ 55 #define SP_DELTA (8+16) 51 #define context_set(c, _pc, stack, size, ptls) \ 52 do { \ 53 (c)->pc = (sysarg_t) (_pc); \ 54 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 55 (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); \ 56 } while (0) 56 57 57 58 typedef struct { -
uspace/lib/c/arch/mips32/src/entry.S
r2cc7f16 rc6588ce 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 .section .init, "ax" … … 41 43 .ent __entry 42 44 __entry: 43 .frame $sp, 32, $3144 .cpload $ 2545 .frame $sp, ABI_STACK_FRAME, $ra 46 .cpload $t9 45 47 46 # FIXME: Reflect exactly ABI specs here 48 # Allocate the stack frame. 49 addiu $sp, -ABI_STACK_FRAME 47 50 48 addiu $sp, -3249 .cprestore 16 # Allow PIC code51 # Allow PIC code 52 .cprestore 16 50 53 51 # Pass pcb_ptr to __main() as the first argument. pcb_ptris already54 # Pass pcb_ptr to __main() as the first argument. It is already 52 55 # in $a0. As the first argument is passed in $a0, no operation 53 56 # is needed. … … 55 58 jal __main 56 59 nop 57 .end 60 61 # 62 # Not reached. 63 # 64 addiu $sp, ABI_STACK_FRAME 65 .end __entry -
uspace/lib/c/arch/mips32/src/entryjmp.S
r2cc7f16 rc6588ce 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 .section .text … … 41 43 entry_point_jmp: 42 44 # tmp := entry_point 43 move $ 25, $a045 move $t9, $a0 44 46 45 47 # Pass pcb to the entry point in $a0 46 48 move $a0, $a1 47 jr $25 48 nop 49 .end 49 50 jr $t9 51 addiu $sp, -ABI_STACK_FRAME 52 addiu $sp, ABI_STACK_FRAME 53 .end entry_point_jmp -
uspace/lib/c/arch/mips32/src/fibril.S
r2cc7f16 rc6588ce 33 33 34 34 #include <libarch/context_offset.h> 35 35 36 36 .global context_save 37 37 .global context_restore 38 38 39 39 context_save: 40 40 CONTEXT_SAVE_ARCH_CORE $a0 41 41 42 42 # context_save returns 1 43 43 j $ra 44 li $v0, 1 45 44 li $v0, 1 45 46 46 context_restore: 47 47 CONTEXT_RESTORE_ARCH_CORE $a0 48 49 # Just for the jump into first function, but one instruction 50 # should not bother us 51 move $t9, $ra 48 49 # Just for the jump into first function, 50 # but one instruction should not bother us 51 move $t9, $ra 52 52 53 # context_restore returns 0 53 54 j $ra 54 xor $v0, $v0 55 55 xor $v0, $v0 -
uspace/lib/c/arch/mips32/src/syscall.c
r2cc7f16 rc6588ce 57 57 "r" (__mips_reg_t1), 58 58 "r" (__mips_reg_v0) 59 : "%ra" /* We are a function call, although C does not 60 * know it */ 59 /* 60 * We are a function call, although C 61 * does not know it. 62 */ 63 : "%ra" 61 64 ); 62 65 -
uspace/lib/c/arch/mips32/src/thread_entry.S
r2cc7f16 rc6588ce 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 … … 40 42 .ent __thread_entry 41 43 __thread_entry: 42 .frame $sp, 32, $3143 .cpload $ 2544 .frame $sp, ABI_STACK_FRAME, $ra 45 .cpload $t9 44 46 45 47 # 46 48 # v0 contains address of uarg. 47 49 # 48 add $ 4, $2, 050 add $a0, $v0, 0 49 51 50 addiu $sp, -32 52 # Allocate the stack frame. 53 addiu $sp, -ABI_STACK_FRAME 54 55 # Allow PIC code 51 56 .cprestore 16 52 57 … … 57 62 # Not reached. 58 63 # 64 addiu $sp, ABI_STACK_FRAME 59 65 .end __thread_entry -
uspace/lib/c/arch/mips32eb/Makefile.inc
r2cc7f16 rc6588ce 28 28 29 29 ARCH_SOURCES = \ 30 arch/$(UARCH)/src/entry. s\31 arch/$(UARCH)/src/entryjmp. s\32 arch/$(UARCH)/src/thread_entry. s\30 arch/$(UARCH)/src/entry.S \ 31 arch/$(UARCH)/src/entryjmp.S \ 32 arch/$(UARCH)/src/thread_entry.S \ 33 33 arch/$(UARCH)/src/syscall.c \ 34 34 arch/$(UARCH)/src/fibril.S \ -
uspace/lib/c/arch/mips64/Makefile.inc
r2cc7f16 rc6588ce 28 28 29 29 ARCH_SOURCES = \ 30 arch/$(UARCH)/src/entry. s\31 arch/$(UARCH)/src/entryjmp. s\32 arch/$(UARCH)/src/thread_entry. s\30 arch/$(UARCH)/src/entry.S \ 31 arch/$(UARCH)/src/entryjmp.S \ 32 arch/$(UARCH)/src/thread_entry.S \ 33 33 arch/$(UARCH)/src/syscall.c \ 34 34 arch/$(UARCH)/src/fibril.S \ -
uspace/lib/c/arch/mips64/include/fibril.h
r2cc7f16 rc6588ce 38 38 39 39 #include <sys/types.h> 40 #include <libarch/stack.h> 41 #include <align.h> 40 42 41 /* We define our own context_set, because we need to set 42 * the TLS pointer to the tcb+0x7000 43 #define SP_DELTA (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 44 45 /* 46 * We define our own context_set, because we need to set 47 * the TLS pointer to the tcb + 0x7000 43 48 * 44 49 * See tls_set in thread.h 45 50 */ 46 51 #define context_set(c, _pc, stack, size, ptls) \ 47 (c)->pc = (sysarg_t) (_pc); \ 48 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 49 (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); 50 51 /* +16 is just for sure that the called function 52 * have space to store it's arguments 53 */ 54 #define SP_DELTA (8 + 16) 52 do { \ 53 (c)->pc = (sysarg_t) (_pc); \ 54 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 55 (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); \ 56 } while (0) 55 57 56 58 typedef struct { -
uspace/lib/c/arch/mips64/src/entry.S
r2cc7f16 rc6588ce 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 .section .init, "ax" … … 41 43 .ent __entry 42 44 __entry: 43 .frame $sp, 32, $31 44 .cpload $25 45 46 # Mips o32 may store its arguments on stack, make space (16 bytes), 47 # so that it could work with -O0 48 # Make space additional 16 bytes for the stack frame 49 50 addiu $sp, -32 51 .cprestore 16 # Allow PIC code 52 53 # Pass pcb_ptr to __main() as the first argument. pcb_ptr is already 45 .frame $sp, ABI_STACK_FRAME, $ra 46 .cpload $t9 47 48 # Allocate the stack frame. 49 addiu $sp, -ABI_STACK_FRAME 50 51 # Allow PIC code 52 .cprestore 16 53 54 # Pass pcb_ptr to __main() as the first argument. It is already 54 55 # in $a0. As the first argument is passed in $a0, no operation 55 56 # is needed. 56 57 57 58 jal __main 58 59 nop 59 .end 60 61 # 62 # Not reached. 63 # 64 addiu $sp, ABI_STACK_FRAME 65 .end __entry -
uspace/lib/c/arch/mips64/src/entryjmp.S
r2cc7f16 rc6588ce 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 .section .text … … 34 36 ## void entry_point_jmp(void *entry_point, void *pcb); 35 37 # 36 # $a0 (=$4) contains entry_point37 # $a1 (=$5) contains pcb38 # $a0 (=$4) contains entry_point 39 # $a1 (=$5) contains pcb 38 40 # 39 41 # Jump to program entry point … … 41 43 entry_point_jmp: 42 44 # tmp := entry_point 43 move $ 25, $a044 45 move $t9, $a0 46 45 47 # Pass pcb to the entry point in $a0 46 48 move $a0, $a1 47 jr $25 48 nop 49 .end 49 50 jr $t9 51 addiu $sp, -ABI_STACK_FRAME 52 addiu $sp, ABI_STACK_FRAME 53 .end entry_point_jmp -
uspace/lib/c/arch/mips64/src/thread_entry.S
r2cc7f16 rc6588ce 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 31 33 .set noat 32 34 .set noreorder 33 35 .option pic2 34 36 35 37 .globl __thread_entry 36 38 … … 40 42 .ent __thread_entry 41 43 __thread_entry: 42 .frame $sp, 32, $3143 .cpload $ 2544 44 .frame $sp, ABI_STACK_FRAME, $ra 45 .cpload $t9 46 45 47 # 46 48 # v0 contains address of uarg. 47 49 # 48 add $4, $2, 0 49 # Mips o32 may store its arguments on stack, make space 50 addiu $sp, -32 50 add $a0, $v0, 0 51 52 # Allocate the stack frame. 53 addiu $sp, -ABI_STACK_FRAME 54 55 # Allow PIC code 51 56 .cprestore 16 52 57 53 58 jal __thread_main 54 59 nop 55 60 56 61 # 57 62 # Not reached. 58 63 # 64 addiu $sp, ABI_STACK_FRAME 59 65 .end __thread_entry -
uspace/lib/c/arch/ppc32/include/fibril.h
r2cc7f16 rc6588ce 27 27 */ 28 28 29 /** @addtogroup libcppc32 29 /** @addtogroup libcppc32 30 30 * @{ 31 31 */ … … 38 38 #include <sys/types.h> 39 39 40 /* We define our own context_set, because we need to set 41 * the TLS pointer to the tcb+0x7000 40 #define SP_DELTA 16 41 42 /* 43 * We define our own context_set, because we need to set 44 * the TLS pointer to the tcb + 0x7000 42 45 * 43 46 * See tls_set in thread.h 44 47 */ 45 #define context_set(c, _pc, stack, size, ptls) \46 (c)->pc = (sysarg_t) (_pc);\47 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA;\48 (c)->tls = ((sysarg_t) (ptls)) + 0x7000 + sizeof(tcb_t);49 50 #define SP_DELTA 16 48 #define context_set(c, _pc, stack, size, ptls) \ 49 do { \ 50 (c)->pc = (sysarg_t) (_pc); \ 51 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 52 (c)->tls = ((sysarg_t) (ptls)) + 0x7000 + sizeof(tcb_t); \ 53 } while (0) 51 54 52 55 typedef struct { -
uspace/lib/c/arch/sparc64/include/fibril.h
r2cc7f16 rc6588ce 40 40 #include <align.h> 41 41 42 #define SP_DELTA (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE)42 #define SP_DELTA (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE) 43 43 44 44 #define context_set(c, _pc, stack, size, ptls) \ … … 50 50 (c)->tp = (uint64_t) ptls; \ 51 51 } while (0) 52 52 53 53 /* 54 54 * Save only registers that must be preserved across -
uspace/lib/c/generic/async.c
r2cc7f16 rc6588ce 189 189 /** If reply was received. */ 190 190 bool done; 191 192 /** If the message / reply should be discarded on arrival. */ 193 bool forget; 194 195 /** If already destroyed. */ 196 bool destroyed; 191 197 192 198 /** Pointer to where the answer data is stored. */ … … 240 246 /** Identifier of the incoming connection handled by the current fibril. */ 241 247 static fibril_local connection_t *fibril_connection; 248 249 static void to_event_initialize(to_event_t *to) 250 { 251 struct timeval tv = { 0, 0 }; 252 253 to->inlist = false; 254 to->occurred = false; 255 link_initialize(&to->link); 256 to->expires = tv; 257 } 258 259 static void wu_event_initialize(wu_event_t *wu) 260 { 261 wu->inlist = false; 262 link_initialize(&wu->link); 263 } 264 265 void awaiter_initialize(awaiter_t *aw) 266 { 267 aw->fid = 0; 268 aw->active = false; 269 to_event_initialize(&aw->to_event); 270 wu_event_initialize(&aw->wu_event); 271 } 272 273 static amsg_t *amsg_create(void) 274 { 275 amsg_t *msg; 276 277 msg = malloc(sizeof(amsg_t)); 278 if (msg) { 279 msg->done = false; 280 msg->forget = false; 281 msg->destroyed = false; 282 msg->dataptr = NULL; 283 msg->retval = (sysarg_t) EINVAL; 284 awaiter_initialize(&msg->wdata); 285 } 286 287 return msg; 288 } 289 290 static void amsg_destroy(amsg_t *msg) 291 { 292 assert(!msg->destroyed); 293 msg->destroyed = true; 294 free(msg); 295 } 242 296 243 297 static void *default_client_data_constructor(void) … … 892 946 893 947 switch (IPC_GET_IMETHOD(*call)) { 894 case IPC_M_C ONNECT_ME:948 case IPC_M_CLONE_ESTABLISH: 895 949 case IPC_M_CONNECT_ME_TO: 896 950 /* Open new connection with fibril, etc. */ … … 963 1017 964 1018 suseconds_t timeout; 1019 unsigned int flags = SYNCH_FLAGS_NONE; 965 1020 if (!list_empty(&timeout_list)) { 966 1021 awaiter_t *waiter = list_get_instance( … … 973 1028 futex_up(&async_futex); 974 1029 handle_expired_timeouts(); 975 continue; 976 } else 1030 /* 1031 * Notice that even if the event(s) already 1032 * expired (and thus the other fibril was 1033 * supposed to be running already), 1034 * we check for incoming IPC. 1035 * 1036 * Otherwise, a fibril that continuously 1037 * creates (almost) expired events could 1038 * prevent IPC retrieval from the kernel. 1039 */ 1040 timeout = 0; 1041 flags = SYNCH_FLAGS_NON_BLOCKING; 1042 1043 } else { 977 1044 timeout = tv_sub(&waiter->to_event.expires, &tv); 978 } else 1045 futex_up(&async_futex); 1046 } 1047 } else { 1048 futex_up(&async_futex); 979 1049 timeout = SYNCH_NO_TIMEOUT; 980 981 futex_up(&async_futex); 1050 } 982 1051 983 1052 atomic_inc(&threads_in_ipc_wait); 984 1053 985 1054 ipc_call_t call; 986 ipc_callid_t callid = ipc_wait_cycle(&call, timeout, 987 SYNCH_FLAGS_NONE); 1055 ipc_callid_t callid = ipc_wait_cycle(&call, timeout, flags); 988 1056 989 1057 atomic_dec(&threads_in_ipc_wait); … … 1100 1168 1101 1169 msg->done = true; 1102 if (!msg->wdata.active) { 1170 1171 if (msg->forget) { 1172 assert(msg->wdata.active); 1173 amsg_destroy(msg); 1174 } else if (!msg->wdata.active) { 1103 1175 msg->wdata.active = true; 1104 1176 fibril_add_ready(msg->wdata.fid); 1105 1177 } 1106 1178 1107 1179 futex_up(&async_futex); 1108 1180 } … … 1131 1203 return 0; 1132 1204 1133 amsg_t *msg = malloc(sizeof(amsg_t));1205 amsg_t *msg = amsg_create(); 1134 1206 if (msg == NULL) 1135 1207 return 0; 1136 1208 1137 msg->done = false;1138 1209 msg->dataptr = dataptr; 1139 1140 msg->wdata.to_event.inlist = false;1141 1142 /*1143 * We may sleep in the next method,1144 * but it will use its own means1145 */1146 1210 msg->wdata.active = true; 1147 1211 … … 1177 1241 return 0; 1178 1242 1179 amsg_t *msg = malloc(sizeof(amsg_t)); 1180 1243 amsg_t *msg = amsg_create(); 1181 1244 if (msg == NULL) 1182 1245 return 0; 1183 1246 1184 msg->done = false;1185 1247 msg->dataptr = dataptr; 1186 1187 msg->wdata.to_event.inlist = false;1188 1189 /*1190 * We may sleep in the next method,1191 * but it will use its own means1192 */1193 1248 msg->wdata.active = true; 1194 1249 … … 1213 1268 1214 1269 futex_down(&async_futex); 1270 1271 assert(!msg->forget); 1272 assert(!msg->destroyed); 1273 1215 1274 if (msg->done) { 1216 1275 futex_up(&async_futex); … … 1231 1290 *retval = msg->retval; 1232 1291 1233 free(msg);1292 amsg_destroy(msg); 1234 1293 } 1235 1294 1236 1295 /** Wait for a message sent by the async framework, timeout variant. 1296 * 1297 * If the wait times out, the caller may choose to either wait again by calling 1298 * async_wait_for() or async_wait_timeout(), or forget the message via 1299 * async_forget(). 1237 1300 * 1238 1301 * @param amsgid Hash of the message to wait for. … … 1249 1312 1250 1313 amsg_t *msg = (amsg_t *) amsgid; 1251 1252 /* TODO: Let it go through the event read at least once */ 1253 if (timeout < 0) 1254 return ETIMEOUT; 1255 1314 1256 1315 futex_down(&async_futex); 1316 1317 assert(!msg->forget); 1318 assert(!msg->destroyed); 1319 1257 1320 if (msg->done) { 1258 1321 futex_up(&async_futex); … … 1260 1323 } 1261 1324 1325 /* 1326 * Negative timeout is converted to zero timeout to avoid 1327 * using tv_add with negative augmenter. 1328 */ 1329 if (timeout < 0) 1330 timeout = 0; 1331 1262 1332 gettimeofday(&msg->wdata.to_event.expires, NULL); 1263 1333 tv_add(&msg->wdata.to_event.expires, timeout); 1264 1334 1335 /* 1336 * Current fibril is inserted as waiting regardless of the 1337 * "size" of the timeout. 1338 * 1339 * Checking for msg->done and immediately bailing out when 1340 * timeout == 0 would mean that the manager fibril would never 1341 * run (consider single threaded program). 1342 * Thus the IPC answer would be never retrieved from the kernel. 1343 * 1344 * Notice that the actual delay would be very small because we 1345 * - switch to manager fibril 1346 * - the manager sees expired timeout 1347 * - and thus adds us back to ready queue 1348 * - manager switches back to some ready fibril 1349 * (prior it, it checks for incoming IPC). 1350 * 1351 */ 1265 1352 msg->wdata.fid = fibril_get_id(); 1266 1353 msg->wdata.active = false; … … 1279 1366 *retval = msg->retval; 1280 1367 1281 free(msg);1368 amsg_destroy(msg); 1282 1369 1283 1370 return 0; 1284 1371 } 1372 1373 /** Discard the message / reply on arrival. 1374 * 1375 * The message will be marked to be discarded once the reply arrives in 1376 * reply_received(). It is not allowed to call async_wait_for() or 1377 * async_wait_timeout() on this message after a call to this function. 1378 * 1379 * @param amsgid Hash of the message to forget. 1380 */ 1381 void async_forget(aid_t amsgid) 1382 { 1383 amsg_t *msg = (amsg_t *) amsgid; 1384 1385 assert(msg); 1386 assert(!msg->forget); 1387 assert(!msg->destroyed); 1388 1389 futex_down(&async_futex); 1390 if (msg->done) 1391 amsg_destroy(msg); 1392 else 1393 msg->forget = true; 1394 futex_up(&async_futex); 1395 } 1285 1396 1286 1397 /** Wait for specified time. … … 1293 1404 void async_usleep(suseconds_t timeout) 1294 1405 { 1295 amsg_t *msg = malloc(sizeof(amsg_t)); 1296 1406 amsg_t *msg = amsg_create(); 1297 1407 if (!msg) 1298 1408 return; 1299 1409 1300 1410 msg->wdata.fid = fibril_get_id(); 1301 msg->wdata.active = false;1302 1411 1303 1412 gettimeofday(&msg->wdata.to_event.expires, NULL); … … 1313 1422 /* Futex is up automatically after fibril_switch() */ 1314 1423 1315 free(msg);1424 amsg_destroy(msg); 1316 1425 } 1317 1426 … … 1559 1668 } 1560 1669 1561 /** Wrapper for making IPC_M_C ONNECT_MEcalls using the async framework.1562 * 1563 * Ask throughfor a cloned connection to some service.1670 /** Wrapper for making IPC_M_CLONE_ESTABLISH calls using the async framework. 1671 * 1672 * Ask for a cloned connection to some service. 1564 1673 * 1565 1674 * @param mgmt Exchange management style. … … 1569 1678 * 1570 1679 */ 1571 async_sess_t *async_c onnect_me(exch_mgmt_t mgmt, async_exch_t *exch)1680 async_sess_t *async_clone_establish(exch_mgmt_t mgmt, async_exch_t *exch) 1572 1681 { 1573 1682 if (exch == NULL) { … … 1584 1693 ipc_call_t result; 1585 1694 1586 amsg_t *msg = malloc(sizeof(amsg_t));1587 if ( msg == NULL) {1695 amsg_t *msg = amsg_create(); 1696 if (!msg) { 1588 1697 free(sess); 1589 1698 errno = ENOMEM; … … 1591 1700 } 1592 1701 1593 msg->done = false;1594 1702 msg->dataptr = &result; 1595 1596 msg->wdata.to_event.inlist = false;1597 1598 /*1599 * We may sleep in the next method,1600 * but it will use its own means1601 */1602 1703 msg->wdata.active = true; 1603 1704 1604 ipc_call_async_0(exch->phone, IPC_M_C ONNECT_ME, msg,1705 ipc_call_async_0(exch->phone, IPC_M_CLONE_ESTABLISH, msg, 1605 1706 reply_received, true); 1606 1707 … … 1643 1744 ipc_call_t result; 1644 1745 1645 amsg_t *msg = malloc(sizeof(amsg_t));1646 if ( msg == NULL)1746 amsg_t *msg = amsg_create(); 1747 if (!msg) 1647 1748 return ENOENT; 1648 1749 1649 msg->done = false;1650 1750 msg->dataptr = &result; 1651 1652 msg->wdata.to_event.inlist = false;1653 1654 /*1655 * We may sleep in the next method,1656 * but it will use its own means1657 */1658 1751 msg->wdata.active = true; 1659 1752 … … 2251 2344 IPC_FF_ROUTE_FROM_ME); 2252 2345 if (retval != EOK) { 2253 async_ wait_for(msg, NULL);2346 async_forget(msg); 2254 2347 ipc_answer_0(callid, retval); 2255 2348 return retval; … … 2445 2538 IPC_FF_ROUTE_FROM_ME); 2446 2539 if (retval != EOK) { 2447 async_ wait_for(msg, NULL);2540 async_forget(msg); 2448 2541 ipc_answer_0(callid, retval); 2449 2542 return retval; -
uspace/lib/c/generic/device/nic.c
r2cc7f16 rc6588ce 65 65 66 66 if (retval != EOK) { 67 async_ wait_for(req, NULL);67 async_forget(req); 68 68 return retval; 69 69 } … … 94 94 rc = async_connect_to_me(exch, 0, 0, 0, cfun, carg); 95 95 if (rc != EOK) { 96 async_ wait_for(req, NULL);96 async_forget(req); 97 97 return rc; 98 98 } -
uspace/lib/c/generic/devman.c
r2cc7f16 rc6588ce 188 188 189 189 if (retval != EOK) { 190 async_ wait_for(req, NULL);190 async_forget(req); 191 191 return retval; 192 192 } … … 226 226 if (retval != EOK) { 227 227 devman_exchange_end(exch); 228 async_ wait_for(req, NULL);228 async_forget(req); 229 229 return retval; 230 230 } … … 242 242 if (retval != EOK) { 243 243 devman_exchange_end(exch); 244 async_ wait_for(req2, NULL);245 async_ wait_for(req, NULL);244 async_forget(req2); 245 async_forget(req); 246 246 return retval; 247 247 } … … 250 250 if (retval != EOK) { 251 251 devman_exchange_end(exch); 252 async_ wait_for(req, NULL);252 async_forget(req); 253 253 return retval; 254 254 } … … 283 283 284 284 if (retval != EOK) { 285 async_ wait_for(req, NULL);285 async_forget(req); 286 286 return retval; 287 287 } … … 386 386 387 387 if (retval != EOK) { 388 async_ wait_for(req, NULL);388 async_forget(req); 389 389 return retval; 390 390 } … … 423 423 424 424 if (dretval != EOK) { 425 async_ wait_for(req, NULL);425 async_forget(req); 426 426 return dretval; 427 427 } … … 488 488 489 489 if (rc != EOK) { 490 async_ wait_for(req, NULL);490 async_forget(req); 491 491 return rc; 492 492 } -
uspace/lib/c/generic/fibril_synch.c
r2cc7f16 rc6588ce 112 112 awaiter_t wdata; 113 113 114 awaiter_initialize(&wdata); 114 115 wdata.fid = fibril_get_id(); 115 wdata.active = false;116 116 wdata.wu_event.inlist = true; 117 link_initialize(&wdata.wu_event.link);118 117 list_append(&wdata.wu_event.link, &fm->waiters); 119 118 check_for_deadlock(&fm->oi); … … 205 204 awaiter_t wdata; 206 205 206 awaiter_initialize(&wdata); 207 207 wdata.fid = (fid_t) f; 208 wdata.active = false;209 208 wdata.wu_event.inlist = true; 210 link_initialize(&wdata.wu_event.link);211 209 f->flags &= ~FIBRIL_WRITER; 212 210 list_append(&wdata.wu_event.link, &frw->waiters); … … 233 231 awaiter_t wdata; 234 232 233 awaiter_initialize(&wdata); 235 234 wdata.fid = (fid_t) f; 236 wdata.active = false;237 235 wdata.wu_event.inlist = true; 238 link_initialize(&wdata.wu_event.link);239 236 f->flags |= FIBRIL_WRITER; 240 237 list_append(&wdata.wu_event.link, &frw->waiters); … … 375 372 return ETIMEOUT; 376 373 374 awaiter_initialize(&wdata); 377 375 wdata.fid = fibril_get_id(); 378 wdata.active = false;379 380 376 wdata.to_event.inlist = timeout > 0; 381 wdata.to_event.occurred = false;382 link_initialize(&wdata.to_event.link);383 384 377 wdata.wu_event.inlist = true; 385 link_initialize(&wdata.wu_event.link);386 378 387 379 futex_down(&async_futex); -
uspace/lib/c/generic/io/printf_core.c
r2cc7f16 rc6588ce 283 283 /* Print leading spaces. */ 284 284 size_t strw = str_length(str); 285 if ( precision == 0)285 if ((precision == 0) || (precision > strw)) 286 286 precision = strw; 287 287 … … 331 331 /* Print leading spaces. */ 332 332 size_t strw = wstr_length(str); 333 if ( precision == 0)333 if ((precision == 0) || (precision > strw)) 334 334 precision = strw; 335 335 -
uspace/lib/c/generic/ipc.c
r2cc7f16 rc6588ce 647 647 * 648 648 */ 649 int ipc_c onnect_me(int phoneid)649 int ipc_clone_establish(int phoneid) 650 650 { 651 651 sysarg_t newphid; 652 int res = ipc_call_sync_0_5(phoneid, IPC_M_C ONNECT_ME, NULL, NULL,653 NULL, NULL, &newphid);652 int res = ipc_call_sync_0_5(phoneid, IPC_M_CLONE_ESTABLISH, NULL, 653 NULL, NULL, NULL, &newphid); 654 654 if (res) 655 655 return res; -
uspace/lib/c/generic/loader.c
r2cc7f16 rc6588ce 101 101 102 102 if (rc != EOK) { 103 async_ wait_for(req, NULL);103 async_forget(req); 104 104 return (int) rc; 105 105 } … … 139 139 140 140 if (rc != EOK) { 141 async_ wait_for(req, NULL);141 async_forget(req); 142 142 return (int) rc; 143 143 } … … 177 177 178 178 if (rc != EOK) { 179 async_ wait_for(req, NULL);179 async_forget(req); 180 180 return (int) rc; 181 181 } … … 236 236 237 237 if (rc != EOK) { 238 async_ wait_for(req, NULL);238 async_forget(req); 239 239 return (int) rc; 240 240 } … … 281 281 282 282 if (rc != EOK) { 283 async_ wait_for(req, NULL);283 async_forget(req); 284 284 return (int) rc; 285 285 } -
uspace/lib/c/generic/loc.c
r2cc7f16 rc6588ce 246 246 247 247 if (retval != EOK) { 248 async_ wait_for(req, NULL);248 async_forget(req); 249 249 return retval; 250 250 } … … 285 285 286 286 if (retval != EOK) { 287 async_ wait_for(req, NULL);287 async_forget(req); 288 288 return retval; 289 289 } … … 352 352 353 353 if (retval != EOK) { 354 async_ wait_for(req, NULL);354 async_forget(req); 355 355 return retval; 356 356 } … … 401 401 402 402 if (dretval != EOK) { 403 async_ wait_for(req, NULL);403 async_forget(req); 404 404 return dretval; 405 405 } … … 471 471 472 472 if (retval != EOK) { 473 async_ wait_for(req, NULL);473 async_forget(req); 474 474 return retval; 475 475 } … … 520 520 521 521 if (retval != EOK) { 522 async_ wait_for(req, NULL);522 async_forget(req); 523 523 return retval; 524 524 } … … 683 683 684 684 if (rc != EOK) { 685 async_ wait_for(req, NULL);685 async_forget(req); 686 686 free(devs); 687 687 return 0; … … 732 732 733 733 if (rc != EOK) { 734 async_ wait_for(req, NULL);734 async_forget(req); 735 735 free(devs); 736 736 return 0; … … 760 760 761 761 if (rc != EOK) { 762 async_ wait_for(req, NULL);762 async_forget(req); 763 763 return rc; 764 764 } -
uspace/lib/c/generic/net/socket_client.c
r2cc7f16 rc6588ce 44 44 #include <errno.h> 45 45 #include <task.h> 46 #include <ns.h> 46 47 #include <ipc/services.h> 47 48 #include <ipc/socket.h> 48 #include <net/modules.h>49 49 #include <net/in.h> 50 50 #include <net/socket.h> … … 284 284 { 285 285 if (socket_globals.tcp_sess == NULL) { 286 socket_globals.tcp_sess = bind_service(SERVICE_TCP,286 socket_globals.tcp_sess = service_bind(SERVICE_TCP, 287 287 0, 0, SERVICE_TCP, socket_connection); 288 288 } … … 301 301 { 302 302 if (socket_globals.udp_sess == NULL) { 303 socket_globals.udp_sess = bind_service(SERVICE_UDP,303 socket_globals.udp_sess = service_bind(SERVICE_UDP, 304 304 0, 0, SERVICE_UDP, socket_connection); 305 305 } … … 378 378 * @return Other error codes as defined for the NET_SOCKET message. 379 379 * @return Other error codes as defined for the 380 * bind_service() function.380 * service_bind() function. 381 381 */ 382 382 int socket(int domain, int type, int protocol) -
uspace/lib/c/generic/ns.c
r2cc7f16 rc6588ce 37 37 #include <async.h> 38 38 #include <macros.h> 39 #include <errno.h> 39 40 #include "private/ns.h" 40 41 … … 48 49 } 49 50 50 async_sess_t *service_connect(exch_mgmt_t mgmt, s ysarg_t service, sysarg_t arg2,51 async_sess_t *service_connect(exch_mgmt_t mgmt, services_t service, sysarg_t arg2, 51 52 sysarg_t arg3) 52 53 { … … 72 73 } 73 74 74 async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, s ysarg_t service,75 async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, services_t service, 75 76 sysarg_t arg2, sysarg_t arg3) 76 77 { … … 81 82 async_connect_me_to_blocking(mgmt, exch, service, arg2, arg3); 82 83 async_exchange_end(exch); 83 84 84 85 if (!sess) 85 86 return NULL; … … 91 92 */ 92 93 async_sess_args_set(sess, arg2, arg3, 0); 94 95 return sess; 96 } 97 98 /** Create bidirectional connection with a service 99 * 100 * @param[in] service Service. 101 * @param[in] arg1 First parameter. 102 * @param[in] arg2 Second parameter. 103 * @param[in] arg3 Third parameter. 104 * @param[in] client_receiver Message receiver. 105 * 106 * @return Session to the service. 107 * @return Other error codes as defined by async_connect_to_me(). 108 * 109 */ 110 async_sess_t *service_bind(services_t service, sysarg_t arg1, sysarg_t arg2, 111 sysarg_t arg3, async_client_conn_t client_receiver) 112 { 113 /* Connect to the needed service */ 114 async_sess_t *sess = 115 service_connect_blocking(EXCHANGE_SERIALIZE, service, 0, 0); 116 if (sess != NULL) { 117 /* Request callback connection */ 118 async_exch_t *exch = async_exchange_begin(sess); 119 int rc = async_connect_to_me(exch, arg1, arg2, arg3, 120 client_receiver, NULL); 121 async_exchange_end(exch); 122 123 if (rc != EOK) { 124 async_hangup(sess); 125 errno = rc; 126 return NULL; 127 } 128 } 93 129 94 130 return sess; -
uspace/lib/c/generic/private/async.h
r2cc7f16 rc6588ce 81 81 } awaiter_t; 82 82 83 extern void awaiter_initialize(awaiter_t *); 84 83 85 extern void __async_init(void); 84 86 extern void async_insert_timeout(awaiter_t *); -
uspace/lib/c/generic/str.c
r2cc7f16 rc6588ce 46 46 #include <mem.h> 47 47 #include <str.h> 48 49 /** Check the condition if wchar_t is signed */ 50 #ifdef WCHAR_IS_UNSIGNED 51 #define WCHAR_SIGNED_CHECK(cond) (true) 52 #else 53 #define WCHAR_SIGNED_CHECK(cond) (cond) 54 #endif 48 55 49 56 /** Byte mask consisting of lowest @n bits (out of 8) */ … … 261 268 } 262 269 270 /** Get size of string with size limit. 271 * 272 * Get the number of bytes which are used by the string @a str 273 * (excluding the NULL-terminator), but no more than @max_size bytes. 274 * 275 * @param str String to consider. 276 * @param max_size Maximum number of bytes to measure. 277 * 278 * @return Number of bytes used by the string 279 * 280 */ 281 size_t str_nsize(const char *str, size_t max_size) 282 { 283 size_t size = 0; 284 285 while ((*str++ != 0) && (size < max_size)) 286 size++; 287 288 return size; 289 } 290 291 /** Get size of wide string with size limit. 292 * 293 * Get the number of bytes which are used by the wide string @a str 294 * (excluding the NULL-terminator), but no more than @max_size bytes. 295 * 296 * @param str Wide string to consider. 297 * @param max_size Maximum number of bytes to measure. 298 * 299 * @return Number of bytes used by the wide string 300 * 301 */ 302 size_t wstr_nsize(const wchar_t *str, size_t max_size) 303 { 304 return (wstr_nlength(str, max_size) * sizeof(wchar_t)); 305 } 306 263 307 /** Get size of wide string with length limit. 264 308 * … … 362 406 bool ascii_check(wchar_t ch) 363 407 { 364 if ( (ch >= 0) && (ch <= 127))408 if (WCHAR_SIGNED_CHECK(ch >= 0) && (ch <= 127)) 365 409 return true; 366 410 … … 375 419 bool chr_check(wchar_t ch) 376 420 { 377 if ( (ch >= 0) && (ch <= 1114111))421 if (WCHAR_SIGNED_CHECK(ch >= 0) && (ch <= 1114111)) 378 422 return true; 379 423 … … 476 520 * @param count Size of the destination buffer (must be > 0). 477 521 * @param src Source string. 522 * 478 523 */ 479 524 void str_cpy(char *dest, size_t size, const char *src) … … 508 553 * @param src Source string. 509 554 * @param n Maximum number of bytes to read from @a src. 555 * 510 556 */ 511 557 void str_ncpy(char *dest, size_t size, const char *src, size_t n) … … 1498 1544 * 1499 1545 */ 1500 int str_uint64 (const char *nptr, char **endptr, unsigned int base,1546 int str_uint64_t(const char *nptr, char **endptr, unsigned int base, 1501 1547 bool strict, uint64_t *result) 1502 1548 { -
uspace/lib/c/generic/sysinfo.c
r2cc7f16 rc6588ce 40 40 #include <bool.h> 41 41 42 /** Get sysinfo keys size 43 * 44 * @param path Sysinfo path. 45 * @param value Pointer to store the keys size. 46 * 47 * @return EOK if the keys were successfully read. 48 * 49 */ 50 static int sysinfo_get_keys_size(const char *path, size_t *size) 51 { 52 return (int) __SYSCALL3(SYS_SYSINFO_GET_KEYS_SIZE, (sysarg_t) path, 53 (sysarg_t) str_size(path), (sysarg_t) size); 54 } 55 56 /** Get sysinfo keys 57 * 58 * @param path Sysinfo path. 59 * @param value Pointer to store the keys size. 60 * 61 * @return Keys read from sysinfo or NULL if the 62 * sysinfo item has no subkeys. 63 * The returned non-NULL pointer should be 64 * freed by free(). 65 * 66 */ 67 char *sysinfo_get_keys(const char *path, size_t *size) 68 { 69 /* 70 * The size of the keys might change during time. 71 * Unfortunatelly we cannot allocate the buffer 72 * and transfer the keys as a single atomic operation. 73 */ 74 75 /* Get the keys size */ 76 int ret = sysinfo_get_keys_size(path, size); 77 if ((ret != EOK) || (size == 0)) { 78 /* 79 * Item with no subkeys. 80 */ 81 *size = 0; 82 return NULL; 83 } 84 85 char *data = malloc(*size); 86 if (data == NULL) { 87 *size = 0; 88 return NULL; 89 } 90 91 /* Get the data */ 92 size_t sz; 93 ret = __SYSCALL5(SYS_SYSINFO_GET_KEYS, (sysarg_t) path, 94 (sysarg_t) str_size(path), (sysarg_t) data, (sysarg_t) *size, 95 (sysarg_t) &sz); 96 if (ret == EOK) { 97 *size = sz; 98 return data; 99 } 100 101 free(data); 102 *size = 0; 103 return NULL; 104 } 105 42 106 /** Get sysinfo item type 43 107 * … … 70 134 /** Get sysinfo binary data size 71 135 * 72 * @param path Sysinfo path.73 * @param value Pointer to store the binary data size.136 * @param path Sysinfo path. 137 * @param size Pointer to store the binary data size. 74 138 * 75 139 * @return EOK if the value was successfully read and … … 85 149 /** Get sysinfo binary data 86 150 * 87 * @param path Sysinfo path.88 * @param value Pointer to store the binary data size.151 * @param path Sysinfo path. 152 * @param size Pointer to store the binary data size. 89 153 * 90 154 * @return Binary data read from sysinfo or NULL if the … … 134 198 } 135 199 200 /** Get sysinfo property 201 * 202 * @param path Sysinfo path. 203 * @param name Property name. 204 * @param size Pointer to store the binary data size. 205 * 206 * @return Property value read from sysinfo or NULL if the 207 * sysinfo item value type is not binary data. 208 * The returned non-NULL pointer should be 209 * freed by free(). 210 * 211 */ 212 void *sysinfo_get_property(const char *path, const char *name, size_t *size) 213 { 214 size_t total_size; 215 void *data = sysinfo_get_data(path, &total_size); 216 if ((data == NULL) || (total_size == 0)) { 217 *size = 0; 218 return NULL; 219 } 220 221 size_t pos = 0; 222 while (pos < total_size) { 223 /* Process each property with sanity checks */ 224 size_t cur_size = str_nsize(data + pos, total_size - pos); 225 if (((char *) data)[pos + cur_size] != 0) 226 break; 227 228 bool found = (str_cmp(data + pos, name) == 0); 229 230 pos += cur_size + 1; 231 if (pos >= total_size) 232 break; 233 234 /* Process value size */ 235 size_t value_size; 236 memcpy(&value_size, data + pos, sizeof(value_size)); 237 238 pos += sizeof(value_size); 239 if ((pos >= total_size) || (pos + value_size > total_size)) 240 break; 241 242 if (found) { 243 void *value = malloc(value_size); 244 if (value == NULL) 245 break; 246 247 memcpy(value, data + pos, value_size); 248 free(data); 249 250 *size = value_size; 251 return value; 252 } 253 254 pos += value_size; 255 } 256 257 free(data); 258 259 *size = 0; 260 return NULL; 261 } 262 136 263 /** @} 137 264 */ -
uspace/lib/c/include/async.h
r2cc7f16 rc6588ce 139 139 extern void async_wait_for(aid_t, sysarg_t *); 140 140 extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t); 141 extern void async_forget(aid_t); 141 142 142 143 extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t, … … 320 321 sysarg_t *, sysarg_t *); 321 322 322 extern async_sess_t *async_c onnect_me(exch_mgmt_t, async_exch_t *);323 extern async_sess_t *async_clone_establish(exch_mgmt_t, async_exch_t *); 323 324 extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t, 324 325 sysarg_t, sysarg_t); -
uspace/lib/c/include/fibril.h
r2cc7f16 rc6588ce 41 41 42 42 #define context_set_generic(c, _pc, stack, size, ptls) \ 43 (c)->pc = (sysarg_t) (_pc); \ 44 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 45 (c)->tls = (sysarg_t) (ptls); 43 do { \ 44 (c)->pc = (sysarg_t) (_pc); \ 45 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 46 (c)->tls = (sysarg_t) (ptls); \ 47 } while (0) 46 48 47 49 #define FIBRIL_SERIALIZED 1 -
uspace/lib/c/include/inet/inet.h
r2cc7f16 rc6588ce 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup lib net29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 33 32 /** @file 34 * Hardware types according to the on-line IANA - Address Resolution Protocol35 * (ARP) Parameters36 * http://www.iana.org/assignments/arp-parameters/arp-parameters.xml,37 * cited January 14 2009.38 33 */ 39 34 40 #ifndef LIB NET_NET_HARDWARE_H_41 #define LIB NET_NET_HARDWARE_H_35 #ifndef LIBC_INET_INET_H_ 36 #define LIBC_INET_INET_H_ 42 37 43 38 #include <sys/types.h> 44 39 45 /** Network interface layer type type definition. */ 46 typedef uint8_t hw_type_t; 40 #define INET_TTL_MAX 255 47 41 48 /** @name Network interface layer types definitions */ 49 /*@{*/ 42 typedef struct { 43 uint32_t ipv4; 44 } inet_addr_t; 50 45 51 /** Ethernet (10Mb) hardware type. */ 52 #define HW_ETHER 1 46 typedef struct { 47 inet_addr_t src; 48 inet_addr_t dest; 49 uint8_t tos; 50 void *data; 51 size_t size; 52 } inet_dgram_t; 53 53 54 /*@}*/ 54 typedef struct { 55 int (*recv)(inet_dgram_t *); 56 } inet_ev_ops_t; 57 58 typedef enum { 59 INET_DF = 1 60 } inet_df_t; 61 62 extern int inet_init(uint8_t, inet_ev_ops_t *); 63 extern int inet_send(inet_dgram_t *, uint8_t, inet_df_t); 64 extern int inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *); 55 65 56 66 #endif … … 58 68 /** @} 59 69 */ 60 -
uspace/lib/c/include/inet/inetping.h
r2cc7f16 rc6588ce 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup lib net29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 /** @file 33 */ 32 34 33 #ifndef LIB NET_PACKET_REMOTE_H_34 #define LIB NET_PACKET_REMOTE_H_35 #ifndef LIBC_INET_INETPING_H_ 36 #define LIBC_INET_INETPING_H_ 35 37 36 #include < net/packet.h>38 #include <inet/inet.h> 37 39 #include <sys/types.h> 38 #include <async.h>39 40 40 extern int packet_translate_remote(async_sess_t *, packet_t **, packet_id_t); 41 extern packet_t *packet_get_4_remote(async_sess_t *, size_t, size_t, size_t, 42 size_t); 43 extern packet_t *packet_get_1_remote(async_sess_t *, size_t); 44 extern void pq_release_remote(async_sess_t *, packet_id_t); 41 typedef struct { 42 inet_addr_t src; 43 inet_addr_t dest; 44 uint16_t seq_no; 45 void *data; 46 size_t size; 47 } inetping_sdu_t; 48 49 typedef struct inetping_ev_ops { 50 int (*recv)(inetping_sdu_t *); 51 } inetping_ev_ops_t; 52 53 extern int inetping_init(inetping_ev_ops_t *); 54 extern int inetping_send(inetping_sdu_t *); 55 extern int inetping_get_srcaddr(inet_addr_t *, inet_addr_t *); 56 45 57 46 58 #endif -
uspace/lib/c/include/inet/iplink.h
r2cc7f16 rc6588ce 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup lib net29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 33 32 /** @file 34 * Internetwork layer module interface for the underlying network interface35 * layer. This interface is always called by the remote modules.36 33 */ 37 34 38 #ifndef LIB NET_IL_REMOTE_H_39 #define LIB NET_IL_REMOTE_H_35 #ifndef LIBC_INET_IPLINK_H_ 36 #define LIBC_INET_IPLINK_H_ 40 37 41 #include < ipc/services.h>38 #include <async.h> 42 39 #include <sys/types.h> 43 #include <net/device.h>44 #include <net/packet.h>45 #include <async.h>46 40 47 /** @name Internetwork layer module interface 48 * This interface is used by other modules. 49 */ 50 /*@{*/ 41 struct iplink_ev_ops; 51 42 52 extern int il_device_state_msg(async_sess_t *, nic_device_id_t, 53 nic_device_state_t, services_t); 54 extern int il_received_msg(async_sess_t *, nic_device_id_t, packet_t *, 55 services_t); 56 extern int il_mtu_changed_msg(async_sess_t *, nic_device_id_t, size_t, 57 services_t); 58 extern int il_addr_changed_msg(async_sess_t *, nic_device_id_t, size_t, 59 const uint8_t *); 43 typedef struct { 44 async_sess_t *sess; 45 struct iplink_ev_ops *ev_ops; 46 } iplink_t; 60 47 61 /*@}*/ 48 typedef struct { 49 uint32_t ipv4; 50 } iplink_addr_t; 51 52 /** IP link Service Data Unit */ 53 typedef struct { 54 /** Local source address */ 55 iplink_addr_t lsrc; 56 /** Local destination address */ 57 iplink_addr_t ldest; 58 /** Serialized IP packet */ 59 void *data; 60 /** Size of @c data in bytes */ 61 size_t size; 62 } iplink_sdu_t; 63 64 typedef struct iplink_ev_ops { 65 int (*recv)(iplink_t *, iplink_sdu_t *); 66 } iplink_ev_ops_t; 67 68 extern int iplink_open(async_sess_t *, iplink_ev_ops_t *, iplink_t **); 69 extern void iplink_close(iplink_t *); 70 extern int iplink_send(iplink_t *, iplink_sdu_t *); 71 extern int iplink_addr_add(iplink_t *, iplink_addr_t *); 72 extern int iplink_addr_remove(iplink_t *, iplink_addr_t *); 73 extern int iplink_get_mtu(iplink_t *, size_t *); 62 74 63 75 #endif -
uspace/lib/c/include/inet/iplink_srv.h
r2cc7f16 rc6588ce 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 28 28 29 29 /** @addtogroup libc 30 * @{ 30 * @{ 31 */ 32 /** @file 31 33 */ 32 34 33 /** @file 34 * Character string with measured length. 35 * The structure has been designed for serialization of character strings 36 * between modules. 37 */ 35 #ifndef LIBC_INET_IPLINK_SRV_H_ 36 #define LIBC_INET_IPLINK_SRV_H_ 38 37 39 #ifndef LIBC_MEASURED_STRINGS_H_ 40 #define LIBC_MEASURED_STRINGS_H_ 38 #include <async.h> 39 #include <fibril_synch.h> 40 #include <bool.h> 41 #include <sys/types.h> 41 42 42 #include <sys/types.h> 43 #include <async.h> 43 struct iplink_ops; 44 44 45 /** Type definition of the character string with measured length. 46 * @see measured_string 47 */ 48 typedef struct measured_string measured_string_t; 45 typedef struct { 46 fibril_mutex_t lock; 47 bool connected; 48 struct iplink_ops *ops; 49 void *arg; 50 async_sess_t *client_sess; 51 } iplink_srv_t; 49 52 50 /** Character string with measured length. 51 * 52 * This structure has been designed for serialization of character strings 53 * between modules. 54 */ 55 struct measured_string { 56 /** Character string data. */ 57 uint8_t *value; 58 /** Character string length. */ 59 size_t length; 60 }; 53 typedef struct { 54 uint32_t ipv4; 55 } iplink_srv_addr_t; 61 56 62 extern measured_string_t *measured_string_create_bulk(const uint8_t *, size_t); 63 extern measured_string_t *measured_string_copy(measured_string_t *); 57 /** IP link Service Data Unit */ 58 typedef struct { 59 /** Local source address */ 60 iplink_srv_addr_t lsrc; 61 /** Local destination address */ 62 iplink_srv_addr_t ldest; 63 /** Serialized IP packet */ 64 void *data; 65 /** Size of @c data in bytes */ 66 size_t size; 67 } iplink_srv_sdu_t; 64 68 65 extern int measured_strings_receive(measured_string_t **, uint8_t **, size_t); 66 extern int measured_strings_reply(const measured_string_t *, size_t); 69 typedef struct iplink_ops { 70 int (*open)(iplink_srv_t *); 71 int (*close)(iplink_srv_t *); 72 int (*send)(iplink_srv_t *, iplink_srv_sdu_t *); 73 int (*get_mtu)(iplink_srv_t *, size_t *); 74 int (*addr_add)(iplink_srv_t *, iplink_srv_addr_t *); 75 int (*addr_remove)(iplink_srv_t *, iplink_srv_addr_t *); 76 } iplink_ops_t; 67 77 68 extern int measured_strings_return(async_exch_t *, measured_string_t **,69 uint8_t **, size_t); 70 extern int measured_strings_send(async_exch_t *, const measured_string_t *,71 size_t);78 extern void iplink_srv_init(iplink_srv_t *); 79 80 extern int iplink_conn(ipc_callid_t, ipc_call_t *, void *); 81 extern int iplink_ev_recv(iplink_srv_t *, iplink_srv_sdu_t *); 72 82 73 83 #endif -
uspace/lib/c/include/ipc/inet.h
r2cc7f16 rc6588ce 1 1 /* 2 * Copyright (c) 2009 Lukas Mejdrech 3 * Copyright (c) 2011 Radim Vansa 2 * Copyright (c) 2012 Jiri Svoboda 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup lib packet29 /** @addtogroup libcipc 31 30 * @{ 32 31 */ 33 34 32 /** @file 35 * Packet server.36 * The hosting module has to be compiled with both the packet.c and the37 * packet_server.c source files. To function correctly, initialization of the38 * packet map by the pm_init() function has to happen at the first place. Then39 * the packet messages have to be processed by the packet_server_message()40 * function. The packet map should be released by the pm_destroy() function41 * during the module termination.42 * @see IS_NET_PACKET_MESSAGE()43 33 */ 44 34 45 #ifndef NET_PACKET_SERVER_H_46 #define NET_PACKET_SERVER_H_35 #ifndef LIBC_IPC_INET_H_ 36 #define LIBC_IPC_INET_H_ 47 37 48 38 #include <ipc/common.h> 49 39 50 extern int packet_server_init(void); 51 extern int packet_server_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, 52 size_t *); 40 /** Inet ports */ 41 typedef enum { 42 /** Default port */ 43 INET_PORT_DEFAULT = 1, 44 /** Configuration port */ 45 INET_PORT_CFG, 46 /** Ping service port */ 47 INET_PORT_PING 48 } inet_port_t; 49 50 /** Requests on Inet default port */ 51 typedef enum { 52 INET_CALLBACK_CREATE = IPC_FIRST_USER_METHOD, 53 INET_GET_SRCADDR, 54 INET_SEND, 55 INET_SET_PROTO 56 } inet_request_t; 57 58 /** Events on Inet default port */ 59 typedef enum { 60 INET_EV_RECV = IPC_FIRST_USER_METHOD 61 } inet_event_t; 62 63 /** Requests on Inet configuration port */ 64 typedef enum { 65 INETCFG_ADDR_CREATE_STATIC = IPC_FIRST_USER_METHOD, 66 INETCFG_ADDR_DELETE, 67 INETCFG_ADDR_GET, 68 INETCFG_ADDR_GET_ID, 69 INETCFG_GET_ADDR_LIST, 70 INETCFG_GET_LINK_LIST, 71 INETCFG_GET_SROUTE_LIST, 72 INETCFG_LINK_GET, 73 INETCFG_SROUTE_CREATE, 74 INETCFG_SROUTE_DELETE, 75 INETCFG_SROUTE_GET, 76 INETCFG_SROUTE_GET_ID 77 } inetcfg_request_t; 78 79 /** Events on Inet ping port */ 80 typedef enum { 81 INETPING_EV_RECV = IPC_FIRST_USER_METHOD 82 } inetping_event_t; 83 84 /** Requests on Inet ping port */ 85 typedef enum { 86 INETPING_SEND = IPC_FIRST_USER_METHOD, 87 INETPING_GET_SRCADDR 88 } inetping_request_t; 53 89 54 90 #endif 55 91 56 /** @} 92 /** 93 * @} 57 94 */ -
uspace/lib/c/include/ipc/ipc.h
r2cc7f16 rc6588ce 254 254 sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool); 255 255 256 extern int ipc_clone_establish(int); 256 257 extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, task_id_t *, 257 258 sysarg_t *); 258 extern int ipc_connect_me(int);259 259 extern int ipc_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t); 260 260 extern int ipc_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t); -
uspace/lib/c/include/ipc/iplink.h
r2cc7f16 rc6588ce 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libc 29 /** @addtogroup libcipc 30 30 * @{ 31 31 */ 32 33 32 /** @file 34 * Transport layer modules messages.35 * @see tl_interface.h36 33 */ 37 34 38 #ifndef LIBC_ TL_MESSAGES_H_39 #define LIBC_ TL_MESSAGES_H_35 #ifndef LIBC_IPC_IPLINK_H_ 36 #define LIBC_IPC_IPLINK_H_ 40 37 41 #include <ipc/ net.h>38 #include <ipc/common.h> 42 39 43 /** Transport layer modules messages. */44 40 typedef enum { 45 /** Packet received message. 46 * @see tl_received_msg() 47 */ 48 NET_TL_RECEIVED = NET_TL_FIRST 49 } tl_messages; 41 IPLINK_GET_MTU = IPC_FIRST_USER_METHOD, 42 IPLINK_SEND, 43 IPLINK_ADDR_ADD, 44 IPLINK_ADDR_REMOVE 45 } iplink_request_t; 46 47 typedef enum { 48 IPLINK_EV_RECV = IPC_FIRST_USER_METHOD 49 } iplink_event_t; 50 50 51 51 #endif 52 52 53 /** @} 53 /** 54 * @} 54 55 */ -
uspace/lib/c/include/ipc/services.h
r2cc7f16 rc6588ce 48 48 SERVICE_IRC = FOURCC('i', 'r', 'c', ' '), 49 49 SERVICE_CLIPBOARD = FOURCC('c', 'l', 'i', 'p'), 50 SERVICE_NETWORKING = FOURCC('n', 'e', 't', ' '),51 SERVICE_ETHERNET = FOURCC('e', 't', 'h', ' '),52 SERVICE_NILDUMMY = FOURCC('n', 'i', 'l', 'd'),53 SERVICE_IP = FOURCC('i', 'p', 'v', '4'),54 SERVICE_ARP = FOURCC('a', 'r', 'p', ' '),55 SERVICE_ICMP = FOURCC('i', 'c', 'm', 'p'),56 50 SERVICE_UDP = FOURCC('u', 'd', 'p', ' '), 57 51 SERVICE_TCP = FOURCC('t', 'c', 'p', ' ') 58 52 } services_t; 53 54 #define SERVICE_NAME_INET "net/inet" 55 #define SERVICE_NAME_INETCFG "net/inetcfg" 56 #define SERVICE_NAME_INETPING "net/inetping" 59 57 60 58 #endif -
uspace/lib/c/include/ipc/socket.h
r2cc7f16 rc6588ce 38 38 #define LIBC_SOCKET_MESSAGES_H_ 39 39 40 #include <ipc/net.h>41 42 40 /** Socket client messages. */ 43 41 typedef enum { 44 42 /** Creates a new socket. @see socket() */ 45 NET_SOCKET = NET_SOCKET_FIRST,43 NET_SOCKET = IPC_FIRST_USER_METHOD, 46 44 /** Binds the socket. @see bind() */ 47 45 NET_SOCKET_BIND, -
uspace/lib/c/include/net/in.h
r2cc7f16 rc6588ce 45 45 #define INET_ADDRSTRLEN (4 * 3 + 3 + 1) 46 46 47 #define INADDR_ANY 0 48 47 49 /** Type definition of the INET address. 48 50 * @see in_addr -
uspace/lib/c/include/ns.h
r2cc7f16 rc6588ce 37 37 38 38 #include <sys/types.h> 39 #include <ipc/services.h> 39 40 #include <task.h> 40 41 #include <async.h> 41 42 42 43 extern int service_register(sysarg_t); 43 extern async_sess_t *service_connect(exch_mgmt_t, s ysarg_t, sysarg_t, sysarg_t);44 extern async_sess_t *service_connect_blocking(exch_mgmt_t, s ysarg_t, sysarg_t,44 extern async_sess_t *service_connect(exch_mgmt_t, services_t, sysarg_t, sysarg_t); 45 extern async_sess_t *service_connect_blocking(exch_mgmt_t, services_t, sysarg_t, 45 46 sysarg_t); 47 extern async_sess_t *service_bind(services_t, sysarg_t, sysarg_t, sysarg_t, 48 async_client_conn_t); 46 49 47 50 extern int ns_ping(void); -
uspace/lib/c/include/str.h
r2cc7f16 rc6588ce 61 61 extern size_t wstr_size(const wchar_t *str); 62 62 63 extern size_t str_nsize(const char *str, size_t max_size); 64 extern size_t wstr_nsize(const wchar_t *str, size_t max_size); 65 63 66 extern size_t str_lsize(const char *str, size_t max_len); 64 67 extern size_t wstr_lsize(const wchar_t *str, size_t max_len); … … 103 106 extern int str_uint16_t(const char *, char **, unsigned int, bool, uint16_t *); 104 107 extern int str_uint32_t(const char *, char **, unsigned int, bool, uint32_t *); 105 extern int str_uint64 (const char *, char **, unsigned int, bool, uint64_t *);108 extern int str_uint64_t(const char *, char **, unsigned int, bool, uint64_t *); 106 109 extern int str_size_t(const char *, char **, unsigned int, bool, size_t *); 107 110 -
uspace/lib/c/include/sysinfo.h
r2cc7f16 rc6588ce 40 40 #include <abi/sysinfo.h> 41 41 42 extern char *sysinfo_get_keys(const char *, size_t *); 42 43 extern sysinfo_item_val_type_t sysinfo_get_val_type(const char *); 43 44 extern int sysinfo_get_value(const char *, sysarg_t *); 44 45 extern void *sysinfo_get_data(const char *, size_t *); 46 extern void *sysinfo_get_property(const char *, const char *, size_t *); 45 47 46 48 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
