Changeset bd5f3b7 in mainline for uspace/lib/c


Ignore:
Timestamp:
2011-08-21T13:07:35Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
00aece0, f1a9e87
Parents:
86a34d3e (diff), a6480d5 (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.
Message:

Merge mainline changes.

Location:
uspace/lib/c
Files:
49 added
2 deleted
74 edited
7 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    r86a34d3e rbd5f3b7  
    3131ROOT_PATH = $(USPACE_PREFIX)/..
    3232
    33 INCLUDE_KERNEL = include/kernel
    34 INCLUDE_ARCH = include/arch
     33INCLUDE_ABI = include/abi
    3534INCLUDE_LIBARCH = include/libarch
    3635
     
    4746        $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
    4847
    49 PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH)
     48PRE_DEPEND = $(INCLUDE_ABI) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH)
    5049EXTRA_OUTPUT = $(LINKER_SCRIPTS)
    51 EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS)
     50EXTRA_CLEAN = $(INCLUDE_ABI) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS)
    5251LIBRARY = libc
    5352SLIBRARY = libc.so.0.0
     
    5958-include arch/$(UARCH)/Makefile.inc
    6059
    61 EXTRA_CFLAGS += -I../../srv/loader/include
    62 
    6360GENERIC_SOURCES = \
    6461        generic/libc.c \
     
    6764        generic/cap.c \
    6865        generic/clipboard.c \
    69         generic/devmap.c \
    7066        generic/devman.c \
    7167        generic/device/hw_res.c \
    7268        generic/device/char_dev.c \
     69        generic/elf/elf_load.c \
    7370        generic/event.c \
    7471        generic/errno.c \
     72        generic/loc.c \
    7573        generic/mem.c \
    7674        generic/str.c \
     
    134132                generic/dlfcn.c \
    135133                generic/rtld/rtld.c \
    136                 generic/rtld/elf_load.c \
    137134                generic/rtld/dynamic.c \
    138135                generic/rtld/module.c \
     
    146143include $(USPACE_PREFIX)/Makefile.common
    147144
    148 $(INCLUDE_ARCH): $(INCLUDE_KERNEL) $(INCLUDE_KERNEL)/arch
    149         ln -sfn kernel/arch $@
    150 
    151145$(INCLUDE_LIBARCH): arch/$(UARCH)/include
    152146        ln -sfn ../$< $@
    153147
    154 $(INCLUDE_KERNEL)/arch: ../../../kernel/generic/include/arch $(INCLUDE_KERNEL)
    155 
    156 $(INCLUDE_KERNEL): ../../../kernel/generic/include/
     148$(INCLUDE_ABI): ../../../abi/include/
    157149        ln -sfn ../$< $@
    158150
  • uspace/lib/c/arch/abs32le/include/elf_linux.h

    r86a34d3e rbd5f3b7  
    11/*
    2  * Copyright (c) 2011 Vojtech Horky
     2 * Copyright (c) 2011 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup drvusbmast
     29/** @addtogroup libcabs32le
    3030 * @{
    3131 */
    3232/** @file
    33  * Generic functions for USB mass storage.
    3433 */
    3534
    36 #ifndef USB_USBMAST_MAST_H_
    37 #define USB_USBMAST_MAST_H_
     35#ifndef LIBC_abs32le_ELF_LINUX_H_
     36#define LBIC_abs32le_ELF_LINUX_H_
    3837
    39 #include <scsi/spc.h>
     38#include <libarch/istate.h>
    4039#include <sys/types.h>
    41 #include <usb/usb.h>
    42 #include <usb/dev/pipes.h>
    43 #include <usb/dev/driver.h>
    4440
    45 #define BULK_IN_EP 0
    46 #define BULK_OUT_EP 1
     41typedef struct {
     42} elf_regs_t;
    4743
    48 int usb_massstor_data_in(usb_device_t *dev, uint32_t, uint8_t, void *,
    49     size_t, void *, size_t, size_t *);
    50 int usb_massstor_reset(usb_device_t *);
    51 void usb_massstor_reset_recovery(usb_device_t *);
    52 int usb_massstor_get_max_lun(usb_device_t *);
    53 size_t usb_masstor_get_lun_count(usb_device_t *);
     44static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
     45{
     46        (void) istate; (void) elf_regs;
     47}
    5448
    5549#endif
    5650
    57 /**
    58  * @}
     51/** @}
    5952 */
  • uspace/lib/c/arch/abs32le/include/istate.h

    • Property mode changed from 100644 to 120000
    r86a34d3e rbd5f3b7  
    1 /*
    2  * Copyright (c) 2010 Martin Decky
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup debug
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_abs32le__ISTATE_H_
    36 #define LIBC_abs32le__ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/abs32le/include/istate.h
  • uspace/lib/c/arch/abs32le/include/syscall.h

    r86a34d3e rbd5f3b7  
    3838
    3939#include <sys/types.h>
    40 #include <kernel/syscall/syscall.h>
     40#include <abi/syscall.h>
    4141
    4242#define __syscall0  __syscall
  • uspace/lib/c/arch/amd64/include/istate.h

    • Property mode changed from 100644 to 120000
    r86a34d3e rbd5f3b7  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcamd64
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_amd64_ISTATE_H_
    36 #define LIBC_amd64_ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/amd64/include/istate.h
  • uspace/lib/c/arch/amd64/src/fibril.S

    r86a34d3e rbd5f3b7  
    3232.global context_restore
    3333
    34 #include <kernel/arch/context_offset.h>
     34#include <libarch/context_offset.h>
    3535
    3636## Save current CPU context
  • uspace/lib/c/arch/arm32/include/istate.h

    • Property mode changed from 100644 to 120000
    r86a34d3e rbd5f3b7  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcarm32
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_arm32__ISTATE_H_
    36 #define LIBC_arm32__ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/arm32/include/istate.h
  • uspace/lib/c/arch/ia32/Makefile.common

    r86a34d3e rbd5f3b7  
    2828
    2929CLANG_ARCH = i386
    30 GCC_CFLAGS += -march=pentium -fno-omit-frame-pointer
     30
     31ifeq ($(PROCESSOR),i486)
     32        GCC_CFLAGS += -march=i486 -fno-omit-frame-pointer
     33else
     34        GCC_CFLAGS += -march=pentium -fno-omit-frame-pointer
     35endif
    3136
    3237ENDIANESS = LE
  • uspace/lib/c/arch/ia32/Makefile.inc

    r86a34d3e rbd5f3b7  
    2828
    2929ARCH_SOURCES = \
    30         arch/$(UARCH)/src/entry.s \
     30        arch/$(UARCH)/src/entry.S \
    3131        arch/$(UARCH)/src/entryjmp.s \
    3232        arch/$(UARCH)/src/thread_entry.s \
  • uspace/lib/c/arch/ia32/include/ddi.h

    r86a34d3e rbd5f3b7  
    4141static inline uint8_t pio_read_8(ioport8_t *port)
    4242{
    43         uint8_t val;
    44        
    45         asm volatile (
    46                 "inb %w[port], %b[val]\n"
    47                 : [val] "=a" (val)
    48                 : [port] "d" (port)
    49         );
    50        
    51         return val;
     43        if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
     44                uint8_t val;
     45               
     46                asm volatile (
     47                        "inb %w[port], %b[val]\n"
     48                        : [val] "=a" (val)
     49                        : [port] "d" (port)
     50                );
     51               
     52                return val;
     53        } else
     54                return (uint8_t) *port;
    5255}
    5356
    5457static inline uint16_t pio_read_16(ioport16_t *port)
    5558{
    56         uint16_t val;
    57        
    58         asm volatile (
    59                 "inw %w[port], %w[val]\n"
    60                 : [val] "=a" (val)
    61                 : [port] "d" (port)
    62         );
    63        
    64         return val;
     59        if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
     60                uint16_t val;
     61               
     62                asm volatile (
     63                        "inw %w[port], %w[val]\n"
     64                        : [val] "=a" (val)
     65                        : [port] "d" (port)
     66                );
     67               
     68                return val;
     69        } else
     70                return (uint16_t) *port;
    6571}
    6672
    6773static inline uint32_t pio_read_32(ioport32_t *port)
    6874{
    69         uint32_t val;
    70        
    71         asm volatile (
    72                 "inl %w[port], %[val]\n"
    73                 : [val] "=a" (val)
    74                 : [port] "d" (port)
    75         );
    76        
    77         return val;
     75        if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
     76                uint32_t val;
     77               
     78                asm volatile (
     79                        "inl %w[port], %[val]\n"
     80                        : [val] "=a" (val)
     81                        : [port] "d" (port)
     82                );
     83               
     84                return val;
     85        } else
     86                return (uint32_t) *port;
    7887}
    7988
    8089static inline void pio_write_8(ioport8_t *port, uint8_t val)
    8190{
    82         asm volatile (
    83                 "outb %b[val], %w[port]\n"
    84                 :: [val] "a" (val), [port] "d" (port)
    85         );
     91        if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
     92                asm volatile (
     93                        "outb %b[val], %w[port]\n"
     94                        :: [val] "a" (val), [port] "d" (port)
     95                );     
     96        } else
     97                *port = val;
    8698}
    8799
    88100static inline void pio_write_16(ioport16_t *port, uint16_t val)
    89101{
    90         asm volatile (
    91                 "outw %w[val], %w[port]\n"
    92                 :: [val] "a" (val), [port] "d" (port)
    93         );
     102        if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
     103                asm volatile (
     104                        "outw %w[val], %w[port]\n"
     105                        :: [val] "a" (val), [port] "d" (port)
     106                );
     107        } else
     108                *port = val;
    94109}
    95110
    96111static inline void pio_write_32(ioport32_t *port, uint32_t val)
    97112{
    98         asm volatile (
    99                 "outl %[val], %w[port]\n"
    100                 :: [val] "a" (val), [port] "d" (port)
    101         );
     113        if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
     114                asm volatile (
     115                        "outl %[val], %w[port]\n"
     116                        :: [val] "a" (val), [port] "d" (port)
     117                );
     118        } else
     119                *port = val;
    102120}
    103121
  • uspace/lib/c/arch/ia32/include/elf_linux.h

    r86a34d3e rbd5f3b7  
    11/*
    2  * Copyright (c) 2011 Vojtech Horky
     2 * Copyright (c) 2011 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup tester
    30  * @brief Test devman service.
     29/** @addtogroup libcia32
    3130 * @{
    3231 */
    33 /**
    34  * @file
     32/** @file Definitions needed to write core files in Linux-ELF format.
    3533 */
    3634
    37 #include <inttypes.h>
    38 #include <errno.h>
    39 #include <str_error.h>
     35#ifndef LIBC_ia32_ELF_LINUX_H_
     36#define LBIC_ia32_ELF_LINUX_H_
     37
     38#include <libarch/istate.h>
    4039#include <sys/types.h>
    41 #include <async.h>
    42 #include <devman.h>
    43 #include <str.h>
    44 #include <async.h>
    45 #include <vfs/vfs.h>
    46 #include <vfs/vfs_sess.h>
    47 #include <sys/stat.h>
    48 #include <fcntl.h>
    49 #include "../tester.h"
    5040
    51 #define DEVICE_CLASS "test3"
     41/** Linux kernel struct pt_regs structure.
     42 *
     43 * We need this to save register state to a core file in Linux format
     44 * (readable by GDB configured for Linux target).
     45 */
     46typedef struct {
     47        uint32_t ebx;
     48        uint32_t ecx;
     49        uint32_t edx;
     50        uint32_t esi;
     51        uint32_t edi;
     52        uint32_t ebp;
     53        uint32_t eax;
     54        uint32_t ds;
     55        uint32_t es;
     56        uint32_t fs;
     57        uint32_t gs;
     58        uint32_t old_eax;
     59        uint32_t eip;
     60        uint32_t cs;
     61        uint32_t eflags;
     62        uint32_t esp;
     63        uint32_t ss;
     64} elf_regs_t;
    5265
    53 const char *test_devman2(void)
     66/** Convert istate_t to elf_regs_t. */
     67static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
    5468{
    55         size_t idx = 1;
    56         int rc = EOK;
    57         const char *err_msg = NULL;
    58         char *path = NULL;
    59         while (rc == EOK) {
    60                 rc = asprintf(&path, "/dev/class/%s\\%zu", DEVICE_CLASS, idx);
    61                 if (rc < 0) {
    62                         continue;
    63                 }
    64                 int fd = open(path, O_RDONLY);
    65                 if (fd < 0) {
    66                         TPRINTF("Failed opening `%s': %s.\n",
    67                             path, str_error(fd));
    68                         rc = fd;
    69                         err_msg = "Failed opening file";
    70                         continue;
    71                 }
    72                 async_sess_t *sess = fd_session(EXCHANGE_SERIALIZE, fd);
    73                 close(fd);
    74                 if (sess == NULL) {
    75                         TPRINTF("Failed opening phone: %s.\n", str_error(errno));
    76                         rc = errno;
    77                         err_msg = "Failed opening file descriptor phone";
    78                         continue;
    79                 }
    80                 async_hangup(sess);
    81                 TPRINTF("Path `%s' okay.\n", path);
    82                 free(path);
    83                 idx++;
    84                 rc = EOK;
    85         }
    86        
    87         if (path != NULL)
    88                 free(path);
    89        
    90         return err_msg;
     69        elf_regs->ebx = istate->ebx;
     70        elf_regs->ecx = istate->ecx;
     71        elf_regs->edx = istate->edx;
     72        elf_regs->esi = istate->esi;
     73        elf_regs->edi = istate->edi;
     74        elf_regs->ebp = istate->ebp;
     75        elf_regs->eax = istate->eax;
     76
     77        elf_regs->ds = istate->ds;
     78        elf_regs->es = istate->es;
     79        elf_regs->fs = istate->fs;
     80        elf_regs->gs = istate->gs;
     81
     82        elf_regs->old_eax = 0;
     83        elf_regs->eip = istate->eip;
     84        elf_regs->cs = istate->cs;
     85        elf_regs->eflags = istate->eflags;
     86        elf_regs->esp = istate->esp;
     87        elf_regs->ss = istate->ss;
    9188}
     89
     90#endif
    9291
    9392/** @}
  • uspace/lib/c/arch/ia32/include/istate.h

    • Property mode changed from 100644 to 120000
    r86a34d3e rbd5f3b7  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup debug
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_ia32__ISTATE_H_
    36 #define LIBC_ia32__ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/ia32/include/istate.h
  • uspace/lib/c/arch/ia32/include/syscall.h

    r86a34d3e rbd5f3b7  
    3838
    3939#include <sys/types.h>
    40 #include <kernel/syscall/syscall.h>
     40#include <abi/syscall.h>
    4141
    4242#define __syscall0  __syscall_fast_func
  • uspace/lib/c/arch/ia32/src/entry.S

    r86a34d3e rbd5f3b7  
    4747        # Do not set %gs, it contains descriptor that can see TLS
    4848       
     49#ifndef PROCESSOR_i486 
    4950        # Detect the mechanism used for making syscalls
    5051        movl $(INTEL_CPUID_STANDARD), %eax
     
    5253        bt $(INTEL_SEP), %edx
    5354        jnc 0f
    54         leal __syscall_fast_func, %eax
    55         movl $__syscall_fast, (%eax)
    56 0:
     55                leal __syscall_fast_func, %eax
     56                movl $__syscall_fast, (%eax)
     57        0:
     58#endif
     59       
    5760        #
    5861        # Create the first stack frame.
  • uspace/lib/c/arch/ia32/src/fibril.S

    r86a34d3e rbd5f3b7  
    2727#
    2828
    29 #include <kernel/arch/context_offset.h>
     29#include <libarch/context_offset.h>
    3030
    3131.text
  • uspace/lib/c/arch/ia32/src/setjmp.S

    r86a34d3e rbd5f3b7  
    2727#
    2828
    29 #include <kernel/arch/context_offset.h>
     29#include <libarch/context_offset.h>
    3030
    3131.text
  • uspace/lib/c/arch/ia64/include/istate.h

    • Property mode changed from 100644 to 120000
    r86a34d3e rbd5f3b7  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcsparc64
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_ia64_ISTATE_H_
    36 #define LIBC_ia64_ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/ia64/include/istate.h
  • uspace/lib/c/arch/mips32/include/istate.h

    • Property mode changed from 100644 to 120000
    r86a34d3e rbd5f3b7  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcmips32
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_mips32__ISTATE_H_
    36 #define LIBC_mips32__ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/mips32/include/istate.h
  • uspace/lib/c/arch/mips32/src/fibril.S

    r86a34d3e rbd5f3b7  
    3232.set noreorder
    3333
    34 #include <arch/context_offset.h>
     34#include <libarch/context_offset.h>
    3535       
    3636.global context_save
  • uspace/lib/c/arch/mips64/include/istate.h

    • Property mode changed from 100644 to 120000
    r86a34d3e rbd5f3b7  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcmips64
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_mips64__ISTATE_H_
    36 #define LIBC_mips64__ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/mips64/include/istate.h
  • uspace/lib/c/arch/mips64/src/fibril.S

    r86a34d3e rbd5f3b7  
    3232.set noreorder
    3333
    34 #include <arch/context_offset.h>
     34#include <libarch/context_offset.h>
    3535
    3636.global context_save
  • uspace/lib/c/arch/ppc32/include/istate.h

    • Property mode changed from 100644 to 120000
    r86a34d3e rbd5f3b7  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcppc32
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_ppc32_ISTATE_H_
    36 #define LIBC_ppc32_ISTATE_H_
    37 
    38 #include <sys/types.h>
    39 
    40 /** Interrupt context.
    41  *
    42  * This is a copy of the kernel definition with which it must be kept in sync.
    43  */
    44 typedef struct istate {
    45         uint32_t r0;
    46         uint32_t r2;
    47         uint32_t r3;
    48         uint32_t r4;
    49         uint32_t r5;
    50         uint32_t r6;
    51         uint32_t r7;
    52         uint32_t r8;
    53         uint32_t r9;
    54         uint32_t r10;
    55         uint32_t r11;
    56         uint32_t r13;
    57         uint32_t r14;
    58         uint32_t r15;
    59         uint32_t r16;
    60         uint32_t r17;
    61         uint32_t r18;
    62         uint32_t r19;
    63         uint32_t r20;
    64         uint32_t r21;
    65         uint32_t r22;
    66         uint32_t r23;
    67         uint32_t r24;
    68         uint32_t r25;
    69         uint32_t r26;
    70         uint32_t r27;
    71         uint32_t r28;
    72         uint32_t r29;
    73         uint32_t r30;
    74         uint32_t r31;
    75         uint32_t cr;
    76         uint32_t pc;
    77         uint32_t srr1;
    78         uint32_t lr;
    79         uint32_t ctr;
    80         uint32_t xer;
    81         uint32_t dar;
    82         uint32_t r12;
    83         uint32_t sp;
    84 } istate_t;
    85 
    86 static inline uintptr_t istate_get_pc(istate_t *istate)
    87 {
    88         return istate->pc;
    89 }
    90 
    91 static inline uintptr_t istate_get_fp(istate_t *istate)
    92 {
    93         return istate->sp;
    94 }
    95 
    96 #endif
    97 
    98 /** @}
    99  */
     1../../../../../../kernel/arch/ppc32/include/istate.h
  • uspace/lib/c/arch/ppc32/src/fibril.S

    r86a34d3e rbd5f3b7  
    3333
    3434#include <libarch/regname.h>
    35 #include <arch/context_offset.h>
     35#include <libarch/context_offset.h>
    3636
    3737context_save:
  • uspace/lib/c/arch/sparc64/include/istate.h

    • Property mode changed from 100644 to 120000
    r86a34d3e rbd5f3b7  
    1 /*
    2  * Copyright (c) 2010 Jiri Svoboda
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * - Redistributions of source code must retain the above copyright
    10  *   notice, this list of conditions and the following disclaimer.
    11  * - Redistributions in binary form must reproduce the above copyright
    12  *   notice, this list of conditions and the following disclaimer in the
    13  *   documentation and/or other materials provided with the distribution.
    14  * - The name of the author may not be used to endorse or promote products
    15  *   derived from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    27  */
    28 
    29 /** @addtogroup libcsparc64
    30  * @{
    31  */
    32 /** @file
    33  */
    34 
    35 #ifndef LIBC_sparc64_ISTATE_H_
    36 #define LIBC_sparc64_ISTATE_H_
    37 
    38 #include <arch/istate.h>
    39 
    40 #endif
    41 
    42 /** @}
    43  */
     1../../../../../../kernel/arch/sparc64/include/istate.h
  • uspace/lib/c/arch/sparc64/include/syscall.h

    r86a34d3e rbd5f3b7  
    3737
    3838#include <sys/types.h>
    39 #include <kernel/syscall/syscall.h>
     39#include <abi/syscall.h>
    4040
    4141#define __syscall0      __syscall
  • uspace/lib/c/arch/sparc64/src/fibril.S

    r86a34d3e rbd5f3b7  
    2727#
    2828
    29 #include <kernel/arch/context_offset.h>
     29#include <libarch/context_offset.h>
    3030
    31 .text   
     31.text
    3232
    3333.global context_save
  • uspace/lib/c/generic/async.c

    r86a34d3e rbd5f3b7  
    9898#include <ipc/ipc.h>
    9999#include <async.h>
     100#include "private/async.h"
    100101#undef LIBC_ASYNC_C_
    101102
     
    107108#include <errno.h>
    108109#include <sys/time.h>
    109 #include <arch/barrier.h>
     110#include <libarch/barrier.h>
    110111#include <bool.h>
    111112#include <malloc.h>
    112113#include <mem.h>
    113114#include <stdlib.h>
    114 #include "private/async.h"
     115#include <macros.h>
    115116
    116117#define CLIENT_HASH_TABLE_BUCKETS  32
     
    138139        link_t link;
    139140       
    140         sysarg_t in_task_hash;
     141        task_id_t in_task_id;
    141142        atomic_t refcnt;
    142143        void *data;
     
    150151        link_t link;
    151152       
    152         /** Incoming client task hash. */
    153         sysarg_t in_task_hash;
     153        /** Incoming client task ID. */
     154        task_id_t in_task_id;
    154155       
    155156        /** Incoming phone hash. */
     
    203204}
    204205
    205 void *async_get_client_data(void)
    206 {
    207         assert(fibril_connection);
    208         return fibril_connection->client->data;
    209 }
    210 
    211206/** Default fibril function that gets called to handle new connection.
    212207 *
     
    289284{
    290285        assert(key);
     286        assert(keys == 2);
    291287        assert(item);
    292288       
    293289        client_t *client = hash_table_get_instance(item, client_t, link);
    294         return (key[0] == client->in_task_hash);
     290        return (key[0] == LOWER32(client->in_task_id) &&
     291            (key[1] == UPPER32(client->in_task_id)));
    295292}
    296293
     
    580577}
    581578
     579static client_t *async_client_get(task_id_t client_id, bool create)
     580{
     581        unsigned long key[2] = {
     582                LOWER32(client_id),
     583                UPPER32(client_id),
     584        };
     585        client_t *client = NULL;
     586
     587        futex_down(&async_futex);
     588        link_t *lnk = hash_table_find(&client_hash_table, key);
     589        if (lnk) {
     590                client = hash_table_get_instance(lnk, client_t, link);
     591                atomic_inc(&client->refcnt);
     592        } else if (create) {
     593                client = malloc(sizeof(client_t));
     594                if (client) {
     595                        client->in_task_id = client_id;
     596                        client->data = async_client_data_create();
     597               
     598                        atomic_set(&client->refcnt, 1);
     599                        hash_table_insert(&client_hash_table, key, &client->link);
     600                }
     601        }
     602
     603        futex_up(&async_futex);
     604        return client;
     605}
     606
     607static void async_client_put(client_t *client)
     608{
     609        bool destroy;
     610        unsigned long key[2] = {
     611                LOWER32(client->in_task_id),
     612                UPPER32(client->in_task_id)
     613        };
     614       
     615        futex_down(&async_futex);
     616       
     617        if (atomic_predec(&client->refcnt) == 0) {
     618                hash_table_remove(&client_hash_table, key, 2);
     619                destroy = true;
     620        } else
     621                destroy = false;
     622       
     623        futex_up(&async_futex);
     624       
     625        if (destroy) {
     626                if (client->data)
     627                        async_client_data_destroy(client->data);
     628               
     629                free(client);
     630        }
     631}
     632
     633void *async_get_client_data(void)
     634{
     635        assert(fibril_connection);
     636        return fibril_connection->client->data;
     637}
     638
     639void *async_get_client_data_by_id(task_id_t client_id)
     640{
     641        client_t *client = async_client_get(client_id, false);
     642        if (!client)
     643                return NULL;
     644        if (!client->data) {
     645                async_client_put(client);
     646                return NULL;
     647        }
     648
     649        return client->data;
     650}
     651
     652void async_put_client_data_by_id(task_id_t client_id)
     653{
     654        client_t *client = async_client_get(client_id, false);
     655
     656        assert(client);
     657        assert(client->data);
     658
     659        /* Drop the reference we got in async_get_client_data_by_hash(). */
     660        async_client_put(client);
     661
     662        /* Drop our own reference we got at the beginning of this function. */
     663        async_client_put(client);
     664}
     665
    582666/** Wrapper for client connection fibril.
    583667 *
     
    598682         */
    599683        fibril_connection = (connection_t *) arg;
    600        
    601         futex_down(&async_futex);
    602684       
    603685        /*
     
    606688         * hash in a new tracking structure.
    607689         */
    608        
    609         unsigned long key = fibril_connection->in_task_hash;
    610         link_t *lnk = hash_table_find(&client_hash_table, &key);
    611        
    612         client_t *client;
    613        
    614         if (lnk) {
    615                 client = hash_table_get_instance(lnk, client_t, link);
    616                 atomic_inc(&client->refcnt);
    617         } else {
    618                 client = malloc(sizeof(client_t));
    619                 if (!client) {
    620                         ipc_answer_0(fibril_connection->callid, ENOMEM);
    621                         futex_up(&async_futex);
    622                         return 0;
    623                 }
    624                
    625                 client->in_task_hash = fibril_connection->in_task_hash;
    626                 client->data = async_client_data_create();
    627                
    628                 atomic_set(&client->refcnt, 1);
    629                 hash_table_insert(&client_hash_table, &key, &client->link);
    630         }
    631        
    632         futex_up(&async_futex);
    633        
     690
     691        client_t *client = async_client_get(fibril_connection->in_task_id, true);
     692        if (!client) {
     693                ipc_answer_0(fibril_connection->callid, ENOMEM);
     694                return 0;
     695        }
     696
    634697        fibril_connection->client = client;
    635698       
     
    643706         * Remove the reference for this client task connection.
    644707         */
    645         bool destroy;
    646        
    647         futex_down(&async_futex);
    648        
    649         if (atomic_predec(&client->refcnt) == 0) {
    650                 hash_table_remove(&client_hash_table, &key, 1);
    651                 destroy = true;
    652         } else
    653                 destroy = false;
    654        
    655         futex_up(&async_futex);
    656        
    657         if (destroy) {
    658                 if (client->data)
    659                         async_client_data_destroy(client->data);
    660                
    661                 free(client);
    662         }
     708        async_client_put(client);
    663709       
    664710        /*
     
    666712         */
    667713        futex_down(&async_futex);
    668         key = fibril_connection->in_phone_hash;
     714        unsigned long key = fibril_connection->in_phone_hash;
    669715        hash_table_remove(&conn_hash_table, &key, 1);
    670716        futex_up(&async_futex);
     
    700746 * particular fibrils.
    701747 *
    702  * @param in_task_hash  Identification of the incoming connection.
     748 * @param in_task_id    Identification of the incoming connection.
    703749 * @param in_phone_hash Identification of the incoming connection.
    704750 * @param callid        Hash of the opening IPC_M_CONNECT_ME_TO call.
     
    714760 *
    715761 */
    716 fid_t async_new_connection(sysarg_t in_task_hash, sysarg_t in_phone_hash,
     762fid_t async_new_connection(task_id_t in_task_id, sysarg_t in_phone_hash,
    717763    ipc_callid_t callid, ipc_call_t *call,
    718764    async_client_conn_t cfibril, void *carg)
     
    726772        }
    727773       
    728         conn->in_task_hash = in_task_hash;
     774        conn->in_task_id = in_task_id;
    729775        conn->in_phone_hash = in_phone_hash;
    730776        list_initialize(&conn->msg_queue);
     
    785831        case IPC_M_CONNECT_ME_TO:
    786832                /* Open new connection with fibril, etc. */
    787                 async_new_connection(call->in_task_hash, IPC_GET_ARG5(*call),
     833                async_new_connection(call->in_task_id, IPC_GET_ARG5(*call),
    788834                    callid, call, client_connection, NULL);
    789835                return;
     
    933979{
    934980        if (!hash_table_create(&client_hash_table, CLIENT_HASH_TABLE_BUCKETS,
    935             1, &client_hash_table_ops))
     981            2, &client_hash_table_ops))
    936982                abort();
    937983       
     
    949995        session_ns->arg2 = 0;
    950996        session_ns->arg3 = 0;
     997       
     998        fibril_mutex_initialize(&session_ns->remote_state_mtx);
     999        session_ns->remote_state_data = NULL;
    9511000       
    9521001        list_initialize(&session_ns->exch_list);
     
    14261475                return ENOENT;
    14271476       
    1428         sysarg_t task_hash;
    14291477        sysarg_t phone_hash;
    1430         int rc = async_req_3_5(exch, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3,
    1431             NULL, NULL, NULL, &task_hash, &phone_hash);
     1478        sysarg_t rc;
     1479
     1480        aid_t req;
     1481        ipc_call_t answer;
     1482        req = async_send_3(exch, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3,
     1483            &answer);
     1484        async_wait_for(req, &rc);
    14321485        if (rc != EOK)
    1433                 return rc;
    1434        
     1486                return (int) rc;
     1487
     1488        phone_hash = IPC_GET_ARG5(answer);
     1489
    14351490        if (client_receiver != NULL)
    1436                 async_new_connection(task_hash, phone_hash, 0, NULL,
     1491                async_new_connection(answer.in_task_id, phone_hash, 0, NULL,
    14371492                    client_receiver, carg);
    14381493       
     
    15091564        sess->arg3 = 0;
    15101565       
     1566        fibril_mutex_initialize(&sess->remote_state_mtx);
     1567        sess->remote_state_data = NULL;
     1568       
    15111569        list_initialize(&sess->exch_list);
    15121570        fibril_mutex_initialize(&sess->mutex);
     
    15901648        sess->arg3 = arg3;
    15911649       
     1650        fibril_mutex_initialize(&sess->remote_state_mtx);
     1651        sess->remote_state_data = NULL;
     1652       
    15921653        list_initialize(&sess->exch_list);
    15931654        fibril_mutex_initialize(&sess->mutex);
     
    15951656       
    15961657        return sess;
     1658}
     1659
     1660/** Set arguments for new connections.
     1661 *
     1662 * FIXME This is an ugly hack to work around the problem that parallel
     1663 * exchanges are implemented using parallel connections. When we create
     1664 * a callback session, the framework does not know arguments for the new
     1665 * connections.
     1666 *
     1667 * The proper solution seems to be to implement parallel exchanges using
     1668 * tagging.
     1669 */
     1670void async_sess_args_set(async_sess_t *sess, sysarg_t arg1, sysarg_t arg2,
     1671    sysarg_t arg3)
     1672{
     1673        sess->arg1 = arg1;
     1674        sess->arg2 = arg2;
     1675        sess->arg3 = arg3;
    15971676}
    15981677
     
    16401719        sess->arg3 = arg3;
    16411720       
     1721        fibril_mutex_initialize(&sess->remote_state_mtx);
     1722        sess->remote_state_data = NULL;
     1723       
    16421724        list_initialize(&sess->exch_list);
    16431725        fibril_mutex_initialize(&sess->mutex);
     
    16701752        sess->arg2 = 0;
    16711753        sess->arg3 = 0;
     1754       
     1755        fibril_mutex_initialize(&sess->remote_state_mtx);
     1756        sess->remote_state_data = NULL;
    16721757       
    16731758        list_initialize(&sess->exch_list);
     
    23342419        sess->arg3 = 0;
    23352420       
     2421        fibril_mutex_initialize(&sess->remote_state_mtx);
     2422        sess->remote_state_data = NULL;
     2423       
    23362424        list_initialize(&sess->exch_list);
    23372425        fibril_mutex_initialize(&sess->mutex);
     
    23802468        sess->arg3 = 0;
    23812469       
     2470        fibril_mutex_initialize(&sess->remote_state_mtx);
     2471        sess->remote_state_data = NULL;
     2472       
    23822473        list_initialize(&sess->exch_list);
    23832474        fibril_mutex_initialize(&sess->mutex);
     
    24222513        sess->arg3 = 0;
    24232514       
     2515        fibril_mutex_initialize(&sess->remote_state_mtx);
     2516        sess->remote_state_data = NULL;
     2517       
    24242518        list_initialize(&sess->exch_list);
    24252519        fibril_mutex_initialize(&sess->mutex);
     
    24292523}
    24302524
     2525int async_state_change_start(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
     2526    sysarg_t arg3, async_exch_t *other_exch)
     2527{
     2528        return async_req_5_0(exch, IPC_M_STATE_CHANGE_AUTHORIZE,
     2529            arg1, arg2, arg3, 0, other_exch->phone);
     2530}
     2531
     2532bool async_state_change_receive(ipc_callid_t *callid, sysarg_t *arg1,
     2533    sysarg_t *arg2, sysarg_t *arg3)
     2534{
     2535        assert(callid);
     2536
     2537        ipc_call_t call;
     2538        *callid = async_get_call(&call);
     2539
     2540        if (IPC_GET_IMETHOD(call) != IPC_M_STATE_CHANGE_AUTHORIZE)
     2541                return false;
     2542       
     2543        if (arg1)
     2544                *arg1 = IPC_GET_ARG1(call);
     2545        if (arg2)
     2546                *arg2 = IPC_GET_ARG2(call);
     2547        if (arg3)
     2548                *arg3 = IPC_GET_ARG3(call);
     2549
     2550        return true;
     2551}
     2552
     2553int async_state_change_finalize(ipc_callid_t callid, async_exch_t *other_exch)
     2554{
     2555        return ipc_answer_1(callid, EOK, other_exch->phone);
     2556}
     2557
     2558/** Lock and get session remote state
     2559 *
     2560 * Lock and get the local replica of the remote state
     2561 * in stateful sessions. The call should be paired
     2562 * with async_remote_state_release*().
     2563 *
     2564 * @param[in] sess Stateful session.
     2565 *
     2566 * @return Local replica of the remote state.
     2567 *
     2568 */
     2569void *async_remote_state_acquire(async_sess_t *sess)
     2570{
     2571        fibril_mutex_lock(&sess->remote_state_mtx);
     2572        return sess->remote_state_data;
     2573}
     2574
     2575/** Update the session remote state
     2576 *
     2577 * Update the local replica of the remote state
     2578 * in stateful sessions. The remote state must
     2579 * be already locked.
     2580 *
     2581 * @param[in] sess  Stateful session.
     2582 * @param[in] state New local replica of the remote state.
     2583 *
     2584 */
     2585void async_remote_state_update(async_sess_t *sess, void *state)
     2586{
     2587        assert(fibril_mutex_is_locked(&sess->remote_state_mtx));
     2588        sess->remote_state_data = state;
     2589}
     2590
     2591/** Release the session remote state
     2592 *
     2593 * Unlock the local replica of the remote state
     2594 * in stateful sessions.
     2595 *
     2596 * @param[in] sess Stateful session.
     2597 *
     2598 */
     2599void async_remote_state_release(async_sess_t *sess)
     2600{
     2601        assert(fibril_mutex_is_locked(&sess->remote_state_mtx));
     2602       
     2603        fibril_mutex_unlock(&sess->remote_state_mtx);
     2604}
     2605
     2606/** Release the session remote state and end an exchange
     2607 *
     2608 * Unlock the local replica of the remote state
     2609 * in stateful sessions. This is convenience function
     2610 * which gets the session pointer from the exchange
     2611 * and also ends the exchange.
     2612 *
     2613 * @param[in] exch Stateful session's exchange.
     2614 *
     2615 */
     2616void async_remote_state_release_exchange(async_exch_t *exch)
     2617{
     2618        if (exch == NULL)
     2619                return;
     2620       
     2621        async_sess_t *sess = exch->sess;
     2622        assert(fibril_mutex_is_locked(&sess->remote_state_mtx));
     2623       
     2624        async_exchange_end(exch);
     2625        fibril_mutex_unlock(&sess->remote_state_mtx);
     2626}
     2627
    24312628/** @}
    24322629 */
  • uspace/lib/c/generic/async_obsolete.c

    r86a34d3e rbd5f3b7  
    3838#include <async.h>
    3939#include <async_obsolete.h>
     40#include "private/async.h"
    4041#undef LIBC_ASYNC_C_
    4142#undef LIBC_ASYNC_OBSOLETE_C_
     
    4445#include <malloc.h>
    4546#include <errno.h>
    46 #include "private/async.h"
    4747
    4848/** Send message and return id of the sent message.
  • uspace/lib/c/generic/ddi.c

    r86a34d3e rbd5f3b7  
    3131 */
    3232/** @file
    33  */ 
     33 */
    3434
     35#include <sys/types.h>
     36#include <abi/ddi/arg.h>
    3537#include <ddi.h>
    3638#include <libarch/ddi.h>
     
    4042#include <align.h>
    4143#include <libarch/config.h>
    42 #include <kernel/ddi/ddi_arg.h>
    4344
    4445/** Return unique device number.
  • uspace/lib/c/generic/devman.c

    r86a34d3e rbd5f3b7  
    11/*
    22 * Copyright (c) 2007 Josef Cejka
    3  * Copyright (c) 2009 Jiri Svoboda
     3 * Copyright (c) 2011 Jiri Svoboda
    44 * Copyright (c) 2010 Lenka Trochtova
    55 * All rights reserved.
     
    8989                        if (devman_driver_block_sess == NULL)
    9090                                devman_driver_block_sess =
    91                                     service_connect_blocking(EXCHANGE_SERIALIZE,
     91                                    service_connect_blocking(EXCHANGE_PARALLEL,
    9292                                    SERVICE_DEVMAN, DEVMAN_DRIVER, 0);
    9393                }
     
    138138                if (devman_driver_sess == NULL)
    139139                        devman_driver_sess =
    140                             service_connect(EXCHANGE_SERIALIZE, SERVICE_DEVMAN,
     140                            service_connect(EXCHANGE_PARALLEL, SERVICE_DEVMAN,
    141141                            DEVMAN_DRIVER, 0);
    142142               
     
    195195       
    196196        exch = devman_exchange_begin(DEVMAN_DRIVER);
    197         async_connect_to_me(exch, 0, 0, 0, NULL, NULL);
     197        async_connect_to_me(exch, 0, 0, 0, conn, NULL);
    198198        devman_exchange_end(exch);
    199199       
     
    271271}
    272272
    273 int devman_add_device_to_class(devman_handle_t devman_handle,
    274     const char *class_name)
     273int devman_add_device_to_category(devman_handle_t devman_handle,
     274    const char *cat_name)
    275275{
    276276        async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_DRIVER);
    277277       
    278278        ipc_call_t answer;
    279         aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_CLASS,
     279        aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_CATEGORY,
    280280            devman_handle, &answer);
    281         sysarg_t retval = async_data_write_start(exch, class_name,
    282             str_size(class_name));
     281        sysarg_t retval = async_data_write_start(exch, cat_name,
     282            str_size(cat_name));
    283283       
    284284        devman_exchange_end(exch);
     
    308308}
    309309
     310/** Remove function from device.
     311 *
     312 * Request devman to remove function owned by this driver task.
     313 * @param funh      Devman handle of the function
     314 *
     315 * @return EOK on success or negative error code.
     316 */
     317int devman_remove_function(devman_handle_t funh)
     318{
     319        async_exch_t *exch;
     320        sysarg_t retval;
     321       
     322        exch = devman_exchange_begin_blocking(DEVMAN_DRIVER);
     323        retval = async_req_1_0(exch, DEVMAN_REMOVE_FUNCTION, (sysarg_t) funh);
     324        devman_exchange_end(exch);
     325       
     326        return (int) retval;
     327}
     328
    310329async_sess_t *devman_parent_device_connect(exch_mgmt_t mgmt,
    311330    devman_handle_t handle, unsigned int flags)
     
    323342}
    324343
    325 int devman_device_get_handle(const char *pathname, devman_handle_t *handle,
     344int devman_fun_get_handle(const char *pathname, devman_handle_t *handle,
    326345    unsigned int flags)
    327346{
     
    333352                exch = devman_exchange_begin(DEVMAN_CLIENT);
    334353                if (exch == NULL)
    335                         return errno;
     354                        return ENOMEM;
    336355        }
    337356       
     
    364383}
    365384
    366 int devman_device_get_handle_by_class(const char *classname,
    367     const char *devname, devman_handle_t *handle, unsigned int flags)
     385static int devman_get_str_internal(sysarg_t method, sysarg_t arg1, char *buf,
     386    size_t buf_size)
    368387{
    369388        async_exch_t *exch;
    370        
    371         if (flags & IPC_FLAG_BLOCKING)
    372                 exch = devman_exchange_begin_blocking(DEVMAN_CLIENT);
    373         else {
    374                 exch = devman_exchange_begin(DEVMAN_CLIENT);
    375                 if (exch == NULL)
    376                         return errno;
    377         }
     389        ipc_call_t dreply;
     390        size_t act_size;
     391        sysarg_t dretval;
     392       
     393        exch = devman_exchange_begin_blocking(LOC_PORT_CONSUMER);
    378394       
    379395        ipc_call_t answer;
    380         aid_t req = async_send_1(exch, DEVMAN_DEVICE_GET_HANDLE_BY_CLASS,
    381             flags, &answer);
    382         sysarg_t retval = async_data_write_start(exch, classname,
    383             str_size(classname));
     396        aid_t req = async_send_1(exch, method, arg1, &answer);
     397        aid_t dreq = async_data_read(exch, buf, buf_size - 1, &dreply);
     398        async_wait_for(dreq, &dretval);
     399       
     400        devman_exchange_end(exch);
     401       
     402        if (dretval != EOK) {
     403                async_wait_for(req, NULL);
     404                return dretval;
     405        }
     406       
     407        sysarg_t retval;
     408        async_wait_for(req, &retval);
     409       
     410        if (retval != EOK)
     411                return retval;
     412       
     413        act_size = IPC_GET_ARG2(dreply);
     414        assert(act_size <= buf_size - 1);
     415        buf[act_size] = '\0';
     416       
     417        return EOK;
     418}
     419
     420int devman_fun_get_path(devman_handle_t handle, char *buf, size_t buf_size)
     421{
     422        return devman_get_str_internal(DEVMAN_FUN_GET_PATH, handle, buf,
     423            buf_size);
     424}
     425
     426int devman_fun_get_name(devman_handle_t handle, char *buf, size_t buf_size)
     427{
     428        return devman_get_str_internal(DEVMAN_FUN_GET_NAME, handle, buf,
     429            buf_size);
     430}
     431
     432static int devman_get_handles_once(sysarg_t method, sysarg_t arg1,
     433    devman_handle_t *handle_buf, size_t buf_size, size_t *act_size)
     434{
     435        async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_CLIENT);
     436
     437        ipc_call_t answer;
     438        aid_t req = async_send_1(exch, method, arg1, &answer);
     439        int rc = async_data_read_start(exch, handle_buf, buf_size);
     440       
     441        devman_exchange_end(exch);
     442       
     443        if (rc != EOK) {
     444                async_wait_for(req, NULL);
     445                return rc;
     446        }
     447       
     448        sysarg_t retval;
     449        async_wait_for(req, &retval);
    384450       
    385451        if (retval != EOK) {
    386                 devman_exchange_end(exch);
    387                 async_wait_for(req, NULL);
    388                 return retval;
    389         }
    390        
    391         retval = async_data_write_start(exch, devname,
    392             str_size(devname));
    393        
    394         devman_exchange_end(exch);
    395        
    396         if (retval != EOK) {
    397                 async_wait_for(req, NULL);
    398                 return retval;
    399         }
    400        
    401         async_wait_for(req, &retval);
    402        
    403         if (retval != EOK) {
    404                 if (handle != NULL)
    405                         *handle = (devman_handle_t) -1;
    406                
    407                 return retval;
    408         }
    409        
    410         if (handle != NULL)
    411                 *handle = (devman_handle_t) IPC_GET_ARG1(answer);
    412        
    413         return retval;
    414 }
    415 
    416 int devman_get_device_path(devman_handle_t handle, char *path, size_t path_size)
     452                return retval;
     453        }
     454       
     455        *act_size = IPC_GET_ARG1(answer);
     456        return EOK;
     457}
     458
     459/** Get list of handles.
     460 *
     461 * Returns an allocated array of handles.
     462 *
     463 * @param method        IPC method
     464 * @param arg1          IPC argument 1
     465 * @param data          Place to store pointer to array of handles
     466 * @param count         Place to store number of handles
     467 * @return              EOK on success or negative error code
     468 */
     469static int devman_get_handles_internal(sysarg_t method, sysarg_t arg1,
     470    devman_handle_t **data, size_t *count)
     471{
     472        devman_handle_t *handles;
     473        size_t act_size;
     474        size_t alloc_size;
     475        int rc;
     476
     477        *data = NULL;
     478        act_size = 0;   /* silence warning */
     479
     480        rc = devman_get_handles_once(method, arg1, NULL, 0,
     481            &act_size);
     482        if (rc != EOK)
     483                return rc;
     484
     485        alloc_size = act_size;
     486        handles = malloc(alloc_size);
     487        if (handles == NULL)
     488                return ENOMEM;
     489
     490        while (true) {
     491                rc = devman_get_handles_once(method, arg1, handles, alloc_size,
     492                    &act_size);
     493                if (rc != EOK)
     494                        return rc;
     495
     496                if (act_size <= alloc_size)
     497                        break;
     498
     499                alloc_size *= 2;
     500                free(handles);
     501
     502                handles = malloc(alloc_size);
     503                if (handles == NULL)
     504                        return ENOMEM;
     505        }
     506
     507        *count = act_size / sizeof(devman_handle_t);
     508        *data = handles;
     509        return EOK;
     510}
     511
     512int devman_fun_get_child(devman_handle_t funh, devman_handle_t *devh)
    417513{
    418514        async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
    419515        if (exch == NULL)
    420                 return errno;
    421        
    422         ipc_call_t answer;
    423         aid_t req = async_send_1(exch, DEVMAN_DEVICE_GET_DEVICE_PATH,
    424             handle, &answer);
    425        
    426         ipc_call_t data_request_call;
    427         aid_t data_request = async_data_read(exch, path, path_size,
    428             &data_request_call);
    429        
    430         devman_exchange_end(exch);
    431        
    432         if (data_request == 0) {
    433                 async_wait_for(req, NULL);
    434516                return ENOMEM;
    435         }
    436        
    437         sysarg_t data_request_rc;
    438         async_wait_for(data_request, &data_request_rc);
    439        
    440         sysarg_t opening_request_rc;
    441         async_wait_for(req, &opening_request_rc);
    442        
    443         if (data_request_rc != EOK) {
    444                 /* Prefer the return code of the opening request. */
    445                 if (opening_request_rc != EOK)
    446                         return (int) opening_request_rc;
    447                 else
    448                         return (int) data_request_rc;
    449         }
    450        
    451         if (opening_request_rc != EOK)
    452                 return (int) opening_request_rc;
    453        
    454         /* To be on the safe-side. */
    455         path[path_size - 1] = 0;
    456         size_t transferred_size = IPC_GET_ARG2(data_request_call);
    457         if (transferred_size >= path_size)
    458                 return ELIMIT;
    459        
    460         /* Terminate the string (trailing 0 not send over IPC). */
    461         path[transferred_size] = 0;
    462         return EOK;
     517       
     518        sysarg_t retval = async_req_1_1(exch, DEVMAN_FUN_GET_CHILD,
     519            funh, devh);
     520       
     521        devman_exchange_end(exch);
     522        return (int) retval;
     523}
     524
     525int devman_dev_get_functions(devman_handle_t devh, devman_handle_t **funcs,
     526    size_t *count)
     527{
     528        return devman_get_handles_internal(DEVMAN_DEV_GET_FUNCTIONS,
     529            devh, funcs, count);
     530}
     531
     532int devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle)
     533{
     534        async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT);
     535        if (exch == NULL)
     536                return ENOMEM;
     537       
     538        sysarg_t retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE,
     539            sid, handle);
     540       
     541        devman_exchange_end(exch);
     542        return (int) retval;
    463543}
    464544
  • uspace/lib/c/generic/elf/elf_load.c

    r86a34d3e rbd5f3b7  
    2929 */
    3030
    31 /** @addtogroup generic 
     31/** @addtogroup generic
    3232 * @{
    3333 */
     
    4949#include <assert.h>
    5050#include <as.h>
     51#include <elf/elf.h>
    5152#include <unistd.h>
    5253#include <fcntl.h>
     
    5556#include <entry_point.h>
    5657
    57 #include "elf.h"
    58 #include "elf_load.h"
     58#include <elf/elf_load.h>
    5959
    6060#define DPRINTF(...)
     
    7474static int load_segment(elf_ld_t *elf, elf_segment_header_t *entry);
    7575
    76 /** Read until the buffer is read in its entirety. */
    77 static int my_read(int fd, void *buf, size_t len)
    78 {
    79         int cnt = 0;
    80         do {
    81                 buf += cnt;
    82                 len -= cnt;
    83                 cnt = read(fd, buf, len);
    84         } while ((cnt > 0) && ((len - cnt) > 0));
    85 
    86         return cnt;
    87 }
    88 
    8976/** Load ELF binary from a file.
    9077 *
     
    160147        int i, rc;
    161148
    162         rc = my_read(elf->fd, header, sizeof(elf_header_t));
    163         if (rc < 0) {
     149        rc = read_all(elf->fd, header, sizeof(elf_header_t));
     150        if (rc != sizeof(elf_header_t)) {
    164151                DPRINTF("Read error.\n");
    165152                return EE_INVALID;
     
    222209                        + i * sizeof(elf_segment_header_t), SEEK_SET);
    223210
    224                 rc = my_read(elf->fd, &segment_hdr,
     211                rc = read_all(elf->fd, &segment_hdr,
    225212                    sizeof(elf_segment_header_t));
    226                 if (rc < 0) {
     213                if (rc != sizeof(elf_segment_header_t)) {
    227214                        DPRINTF("Read error.\n");
    228215                        return EE_INVALID;
     
    244231                    + i * sizeof(elf_section_header_t), SEEK_SET);
    245232
    246                 rc = my_read(elf->fd, &section_hdr,
     233                rc = read_all(elf->fd, &section_hdr,
    247234                    sizeof(elf_section_header_t));
    248                 if (rc < 0) {
     235                if (rc != sizeof(elf_section_header_t)) {
    249236                        DPRINTF("Read error.\n");
    250237                        return EE_INVALID;
     
    334321        uintptr_t seg_addr;
    335322        size_t mem_sz;
    336         int rc;
     323        ssize_t rc;
    337324
    338325        bias = elf->bias;
     
    412399                if (now > left) now = left;
    413400
    414                 rc = my_read(elf->fd, dp, now);
    415 
    416                 if (rc < 0) {
     401                rc = read_all(elf->fd, dp, now);
     402
     403                if (rc != (ssize_t) now) {
    417404                        DPRINTF("Read error.\n");
    418405                        return EE_INVALID;
  • uspace/lib/c/generic/event.c

    r86a34d3e rbd5f3b7  
    3939#include <libc.h>
    4040#include <event.h>
    41 #include <kernel/ipc/event_types.h>
    4241
    4342/** Subscribe event notifications.
     
    5049 */
    5150int event_subscribe(event_type_t evno, sysarg_t imethod)
     51{
     52        return __SYSCALL2(SYS_EVENT_SUBSCRIBE, (sysarg_t) evno,
     53            (sysarg_t) imethod);
     54}
     55
     56int event_task_subscribe(event_task_type_t evno, sysarg_t imethod)
    5257{
    5358        return __SYSCALL2(SYS_EVENT_SUBSCRIBE, (sysarg_t) evno,
     
    6772}
    6873
     74int event_task_unmask(event_task_type_t evno)
     75{
     76        return __SYSCALL1(SYS_EVENT_UNMASK, (sysarg_t) evno);
     77}
     78
    6979/** @}
    7080 */
  • uspace/lib/c/generic/fibril.c

    r86a34d3e rbd5f3b7  
    4141#include <unistd.h>
    4242#include <stdio.h>
    43 #include <arch/barrier.h>
     43#include <libarch/barrier.h>
    4444#include <libarch/faddr.h>
    4545#include <futex.h>
  • uspace/lib/c/generic/io/io.c

    r86a34d3e rbd5f3b7  
    4545#include <vfs/vfs.h>
    4646#include <vfs/vfs_sess.h>
    47 #include <ipc/devmap.h>
     47#include <ipc/loc.h>
    4848#include <adt/list.h>
    4949#include "../private/io.h"
     
    101101static LIST_INITIALIZE(files);
    102102
    103 void __stdio_init(int filc, fdi_node_t *filv[])
     103void __stdio_init(int filc)
    104104{
    105105        if (filc > 0) {
    106                 stdin = fopen_node(filv[0], "r");
     106                stdin = fdopen(0, "r");
    107107        } else {
    108108                stdin = &stdin_null;
     
    111111       
    112112        if (filc > 1) {
    113                 stdout = fopen_node(filv[1], "w");
     113                stdout = fdopen(1, "w");
    114114        } else {
    115115                stdout = &stdout_klog;
     
    118118       
    119119        if (filc > 2) {
    120                 stderr = fopen_node(filv[2], "w");
     120                stderr = fdopen(2, "w");
    121121        } else {
    122122                stderr = &stderr_klog;
     
    285285}
    286286
    287 FILE *fopen_node(fdi_node_t *node, const char *mode)
    288 {
    289         int flags;
    290         if (!parse_mode(mode, &flags))
    291                 return NULL;
    292        
    293         /* Open file. */
    294         FILE *stream = malloc(sizeof(FILE));
    295         if (stream == NULL) {
    296                 errno = ENOMEM;
    297                 return NULL;
    298         }
    299        
    300         stream->fd = open_node(node, flags);
    301         if (stream->fd < 0) {
    302                 /* errno was set by open_node() */
    303                 free(stream);
    304                 return NULL;
    305         }
    306        
    307         stream->error = false;
    308         stream->eof = false;
    309         stream->klog = false;
    310         stream->sess = NULL;
    311         stream->need_sync = false;
    312         _setvbuf(stream);
    313        
    314         list_append(&stream->link, &files);
    315        
    316         return stream;
    317 }
    318 
    319287int fclose(FILE *stream)
    320288{
     
    594562                }
    595563               
    596                 buf += now;
     564                data += now;
    597565                stream->buf_head += now;
    598566                buf_free -= now;
    599567                bytes_left -= now;
    600568                total_written += now;
     569                stream->buf_state = _bs_write;
    601570               
    602571                if (buf_free == 0) {
     
    606575                }
    607576        }
    608        
    609         if (total_written > 0)
    610                 stream->buf_state = _bs_write;
    611577
    612578        if (need_flush)
     
    714680off64_t ftell(FILE *stream)
    715681{
     682        _fflushbuf(stream);
    716683        return lseek(stream->fd, 0, SEEK_CUR);
    717684}
     
    781748}
    782749
    783 int fnode(FILE *stream, fdi_node_t *node)
    784 {
    785         if (stream->fd >= 0)
    786                 return fd_node(stream->fd, node);
     750int fhandle(FILE *stream, int *handle)
     751{
     752        if (stream->fd >= 0) {
     753                *handle = stream->fd;
     754                return EOK;
     755        }
    787756       
    788757        return ENOENT;
  • uspace/lib/c/generic/io/printf_core.c

    r86a34d3e rbd5f3b7  
    206206        }
    207207       
    208         return (int) (counter + 1);
     208        return (int) (counter);
    209209}
    210210
     
    244244        }
    245245       
    246         return (int) (counter + 1);
     246        return (int) (counter);
    247247}
    248248
  • uspace/lib/c/generic/ipc.c

    r86a34d3e rbd5f3b7  
    4747#include <futex.h>
    4848#include <fibril.h>
     49#include <macros.h>
    4950
    5051/**
     
    611612/** Request callback connection.
    612613 *
    613  * The @a taskhash and @a phonehash identifiers returned
     614 * The @a task_id and @a phonehash identifiers returned
    614615 * by the kernel can be used for connection tracking.
    615616 *
     
    618619 * @param arg2      User defined argument.
    619620 * @param arg3      User defined argument.
    620  * @param taskhash  Opaque identifier of the client task.
     621 * @param task_id   Identifier of the client task.
    621622 * @param phonehash Opaque identifier of the phone that will
    622623 *                  be used for incoming calls.
     
    626627 */
    627628int ipc_connect_to_me(int phoneid, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
    628     sysarg_t *taskhash, sysarg_t *phonehash)
    629 {
    630         return ipc_call_sync_3_5(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2,
    631             arg3, NULL, NULL, NULL, taskhash, phonehash);
     629    task_id_t *task_id, sysarg_t *phonehash)
     630{
     631        ipc_call_t data;
     632        int rc = __SYSCALL6(SYS_IPC_CALL_SYNC_FAST, phoneid,
     633            IPC_M_CONNECT_TO_ME, arg1, arg2, arg3, (sysarg_t) &data);
     634        if (rc == EOK) {
     635                *task_id = data.in_task_id;
     636                *phonehash = IPC_GET_ARG5(data);
     637        }       
     638        return rc;
    632639}
    633640
  • uspace/lib/c/generic/libc.c

    r86a34d3e rbd5f3b7  
    9191                argc = 0;
    9292                argv = NULL;
    93                 __stdio_init(0, NULL);
     93                __stdio_init(0);
    9494        } else {
    9595                argc = __pcb->argc;
    9696                argv = __pcb->argv;
    97                 __stdio_init(__pcb->filc, __pcb->filv);
     97                __stdio_init(__pcb->filc);
    9898                (void) chdir(__pcb->cwd);
    9999        }
  • uspace/lib/c/generic/loader.c

    r86a34d3e rbd5f3b7  
    256256 *
    257257 */
    258 int loader_set_files(loader_t *ldr, fdi_node_t *const files[])
    259 {
    260         /*
    261          * Serialize the arguments into a single array. First
    262          * compute size of the buffer needed.
    263          */
    264         fdi_node_t *const *ap = files;
    265         size_t count = 0;
    266         while (*ap != NULL) {
    267                 count++;
    268                 ap++;
    269         }
    270        
    271         fdi_node_t *files_buf;
    272         files_buf = (fdi_node_t *) malloc(count * sizeof(fdi_node_t));
    273         if (files_buf == NULL)
    274                 return ENOMEM;
    275        
    276         /* Fill the buffer */
    277         size_t i;
    278         for (i = 0; i < count; i++)
    279                 files_buf[i] = *files[i];
    280        
     258int loader_set_files(loader_t *ldr, int * const files[])
     259{
    281260        /* Send serialized files to the loader */
    282261        async_exch_t *exch = async_exchange_begin(ldr->sess);
    283        
    284         ipc_call_t answer;
    285         aid_t req = async_send_0(exch, LOADER_SET_FILES, &answer);
    286         sysarg_t rc = async_data_write_start(exch, (void *) files_buf,
    287             count * sizeof(fdi_node_t));
    288        
    289         async_exchange_end(exch);
    290         free(files_buf);
    291        
     262        async_exch_t *vfs_exch = vfs_exchange_begin();
     263       
     264        int i;
     265        for (i = 0; files[i]; i++);
     266
     267        ipc_call_t answer;
     268        aid_t req = async_send_1(exch, LOADER_SET_FILES, i, &answer);
     269
     270        sysarg_t rc = EOK;
     271       
     272        for (i = 0; files[i]; i++) {
     273                rc = async_state_change_start(exch, VFS_PASS_HANDLE, *files[i],
     274                    0, vfs_exch);
     275                if (rc != EOK)
     276                        break;
     277        }
     278       
     279        vfs_exchange_end(vfs_exch);
     280        async_exchange_end(exch);
     281
    292282        if (rc != EOK) {
    293283                async_wait_for(req, NULL);
  • uspace/lib/c/generic/ns.c

    r86a34d3e rbd5f3b7  
    5656        async_exchange_end(exch);
    5757       
     58        /*
     59         * FIXME Ugly hack to work around limitation of implementing
     60         * parallel exchanges using multiple connections. Shift out
     61         * first argument for non-initial connections.
     62         */
     63        async_sess_args_set(sess, arg2, arg3, 0);
     64       
    5865        return sess;
    5966}
     
    6673            async_connect_me_to_blocking(mgmt, exch, service, arg2, arg3);
    6774        async_exchange_end(exch);
     75       
     76        /*
     77         * FIXME Ugly hack to work around limitation of implementing
     78         * parallel exchanges using multiple connections. Shift out
     79         * first argument for non-initial connections.
     80         */
     81        async_sess_args_set(sess, arg2, arg3, 0);
    6882       
    6983        return sess;
  • uspace/lib/c/generic/ns_obsolete.c

    r86a34d3e rbd5f3b7  
    3636#include <async_obsolete.h>
    3737#include <ns_obsolete.h>
    38 #include <kernel/ipc/ipc_methods.h>
     38#include <abi/ipc/methods.h>
    3939
    4040int service_obsolete_connect(sysarg_t service, sysarg_t arg2, sysarg_t arg3)
  • uspace/lib/c/generic/private/async.h

    r86a34d3e rbd5f3b7  
    3636#define LIBC_PRIVATE_ASYNC_H_
    3737
     38#include <async.h>
    3839#include <adt/list.h>
    3940#include <fibril.h>
     41#include <fibril_synch.h>
    4042#include <sys/time.h>
    4143#include <bool.h>
     44
     45/** Session data */
     46struct _async_sess {
     47        /** List of inactive exchanges */
     48        list_t exch_list;
     49       
     50        /** Exchange management style */
     51        exch_mgmt_t mgmt;
     52       
     53        /** Session identification */
     54        int phone;
     55       
     56        /** First clone connection argument */
     57        sysarg_t arg1;
     58       
     59        /** Second clone connection argument */
     60        sysarg_t arg2;
     61       
     62        /** Third clone connection argument */
     63        sysarg_t arg3;
     64       
     65        /** Exchange mutex */
     66        fibril_mutex_t mutex;
     67       
     68        /** Number of opened exchanges */
     69        atomic_t refcnt;
     70       
     71        /** Mutex for stateful connections */
     72        fibril_mutex_t remote_state_mtx;
     73       
     74        /** Data for stateful connections */
     75        void *remote_state_data;
     76};
     77
     78/** Exchange data */
     79struct _async_exch {
     80        /** Link into list of inactive exchanges */
     81        link_t sess_link;
     82       
     83        /** Link into global list of inactive exchanges */
     84        link_t global_link;
     85       
     86        /** Session pointer */
     87        async_sess_t *sess;
     88       
     89        /** Exchange identification */
     90        int phone;
     91};
    4292
    4393/** Structures of this type are used to track the timeout events. */
  • uspace/lib/c/generic/private/io.h

    r86a34d3e rbd5f3b7  
    3636#define LIBC_PRIVATE_IO_H_
    3737
    38 #include <vfs/vfs.h>
    39 
    40 extern void __stdio_init(int filc, fdi_node_t *filv[]);
     38extern void __stdio_init(int);
    4139extern void __stdio_done(void);
    4240
  • uspace/lib/c/generic/private/thread.h

    r86a34d3e rbd5f3b7  
    3636#define LIBC_PRIVATE_THREAD_H_
    3737
    38 #include <kernel/proc/uarg.h>
     38#include <abi/proc/uarg.h>
    3939
    4040extern void __thread_entry(void);
  • uspace/lib/c/generic/rtld/module.c

    r86a34d3e rbd5f3b7  
    3535 */
    3636
     37#include <adt/list.h>
     38#include <elf/elf_load.h>
     39#include <fcntl.h>
     40#include <loader/pcb.h>
    3741#include <stdio.h>
    3842#include <stdlib.h>
    3943#include <unistd.h>
    40 #include <fcntl.h>
    41 #include <adt/list.h>
    42 #include <loader/pcb.h>
    4344
    4445#include <rtld/rtld.h>
     
    4748#include <rtld/rtld_arch.h>
    4849#include <rtld/module.h>
    49 #include <elf_load.h>
    5050
    5151/** (Eagerly) process all relocation tables in a module.
     
    9393module_t *module_find(const char *name)
    9494{
    95         link_t *head = &runtime_env->modules_head;
    96 
    97         link_t *cur;
    9895        module_t *m;
    9996        const char *p, *soname;
     
    110107
    111108        /* Traverse list of all modules. Not extremely fast, but simple */
    112         DPRINTF("head = %p\n", head);
    113         for (cur = head->next; cur != head; cur = cur->next) {
     109        list_foreach(runtime_env->modules, cur) {
    114110                DPRINTF("cur = %p\n", cur);
    115111                m = list_get_instance(cur, module_t, modules_link);
     
    177173
    178174        /* Insert into the list of loaded modules */
    179         list_append(&m->modules_link, &runtime_env->modules_head);
     175        list_append(&m->modules_link, &runtime_env->modules);
    180176
    181177        return m;
     
    249245void modules_process_relocs(module_t *start)
    250246{
    251         link_t *head = &runtime_env->modules_head;
    252 
    253         link_t *cur;
    254         module_t *m;
    255 
    256         for (cur = head->next; cur != head; cur = cur->next) {
     247        module_t *m;
     248
     249        list_foreach(runtime_env->modules, cur) {
    257250                m = list_get_instance(cur, module_t, modules_link);
    258251
     
    268261void modules_untag(void)
    269262{
    270         link_t *head = &runtime_env->modules_head;
    271 
    272         link_t *cur;
    273         module_t *m;
    274 
    275         for (cur = head->next; cur != head; cur = cur->next) {
     263        module_t *m;
     264
     265        list_foreach(runtime_env->modules, cur) {
    276266                m = list_get_instance(cur, module_t, modules_link);
    277267                m->bfs_tag = false;
  • uspace/lib/c/generic/rtld/rtld.c

    r86a34d3e rbd5f3b7  
    4444{
    4545        runtime_env = &rt_env_static;
    46         list_initialize(&runtime_env->modules_head);
     46        list_initialize(&runtime_env->modules);
    4747        runtime_env->next_bias = 0x2000000;
    4848        runtime_env->program = NULL;
  • uspace/lib/c/generic/rtld/symbol.c

    r86a34d3e rbd5f3b7  
    3838#include <stdlib.h>
    3939
     40#include <elf/elf.h>
    4041#include <rtld/rtld.h>
    4142#include <rtld/rtld_debug.h>
    4243#include <rtld/symbol.h>
    43 #include <elf.h>
    4444
    4545/*
     
    118118        module_t *m, *dm;
    119119        elf_symbol_t *sym, *s;
    120         link_t queue_head;
     120        list_t queue;
    121121        size_t i;
    122122
     
    132132
    133133        /* Insert root (the program) into the queue and tag it */
    134         list_initialize(&queue_head);
     134        list_initialize(&queue);
    135135        start->bfs_tag = true;
    136         list_append(&start->queue_link, &queue_head);
     136        list_append(&start->queue_link, &queue);
    137137
    138138        /* If the symbol is found, it will be stored in 'sym' */
     
    140140
    141141        /* While queue is not empty */
    142         while (!list_empty(&queue_head)) {
     142        while (!list_empty(&queue)) {
    143143                /* Pop first element from the queue */
    144                 m = list_get_instance(queue_head.next, module_t, queue_link);
     144                m = list_get_instance(list_first(&queue), module_t, queue_link);
    145145                list_remove(&m->queue_link);
    146146
     
    162162                        if (dm->bfs_tag == false) {
    163163                                dm->bfs_tag = true;
    164                                 list_append(&dm->queue_link, &queue_head);
     164                                list_append(&dm->queue_link, &queue);
    165165                        }
    166166                }
     
    168168
    169169        /* Empty the queue so that we leave it in a clean state */
    170         while (!list_empty(&queue_head))
    171                 list_remove(queue_head.next);
     170        while (!list_empty(&queue))
     171                list_remove(list_first(&queue));
    172172
    173173        if (!sym) {
  • uspace/lib/c/generic/str.c

    r86a34d3e rbd5f3b7  
    22 * Copyright (c) 2005 Martin Decky
    33 * Copyright (c) 2008 Jiri Svoboda
     4 * Copyright (c) 2011 Martin Sucha
    45 * All rights reserved.
    56 *
     
    718719
    719720        dest[dlen - 1] = '\0';
     721}
     722
     723/** Convert string to wide string.
     724 *
     725 * Convert string @a src to wide string. A new wide NULL-terminated
     726 * string will be allocated on the heap.
     727 *
     728 * @param src   Source string.
     729 */
     730wchar_t *str_to_awstr(const char *str)
     731{
     732        size_t len = str_length(str);
     733        wchar_t *wstr = calloc(len+1, sizeof(wchar_t));
     734        if (wstr == NULL) {
     735                return NULL;
     736        }
     737        str_to_wstr(wstr, len+1, str);
     738        return wstr;
    720739}
    721740
  • uspace/lib/c/generic/task.c

    r86a34d3e rbd5f3b7  
    4646#include <libc.h>
    4747#include "private/ns.h"
     48#include <vfs/vfs.h>
    4849
    4950task_id_t task_get_id(void)
     
    102103{
    103104        /* Send default files */
    104         fdi_node_t *files[4];
    105         fdi_node_t stdin_node;
    106         fdi_node_t stdout_node;
    107         fdi_node_t stderr_node;
    108        
    109         if ((stdin != NULL) && (fnode(stdin, &stdin_node) == EOK))
    110                 files[0] = &stdin_node;
     105        int *files[4];
     106        int fd_stdin;
     107        int fd_stdout;
     108        int fd_stderr;
     109       
     110        if ((stdin != NULL) && (fhandle(stdin, &fd_stdin) == EOK))
     111                files[0] = &fd_stdin;
    111112        else
    112113                files[0] = NULL;
    113114       
    114         if ((stdout != NULL) && (fnode(stdout, &stdout_node) == EOK))
    115                 files[1] = &stdout_node;
     115        if ((stdout != NULL) && (fhandle(stdout, &fd_stdout) == EOK))
     116                files[1] = &fd_stdout;
    116117        else
    117118                files[1] = NULL;
    118119       
    119         if ((stderr != NULL) && (fnode(stderr, &stderr_node) == EOK))
    120                 files[2] = &stderr_node;
     120        if ((stderr != NULL) && (fhandle(stderr, &fd_stderr) == EOK))
     121                files[2] = &fd_stderr;
    121122        else
    122123                files[2] = NULL;
     
    142143 */
    143144int task_spawnvf(task_id_t *id, const char *path, const char *const args[],
    144     fdi_node_t *const files[])
     145    int *const files[])
    145146{
    146147        /* Connect to a program loader. */
  • uspace/lib/c/generic/thread.c

    r86a34d3e rbd5f3b7  
    3737#include <stdlib.h>
    3838#include <libarch/faddr.h>
    39 #include <kernel/proc/uarg.h>
     39#include <abi/proc/uarg.h>
    4040#include <fibril.h>
    4141#include <str.h>
  • uspace/lib/c/generic/time.c

    r86a34d3e rbd5f3b7  
    3636#include <time.h>
    3737#include <bool.h>
    38 #include <arch/barrier.h>
     38#include <libarch/barrier.h>
    3939#include <macros.h>
    4040#include <errno.h>
  • uspace/lib/c/generic/udebug.c

    r86a34d3e rbd5f3b7  
    3535#include <udebug.h>
    3636#include <sys/types.h>
    37 #include <kernel/ipc/ipc_methods.h>
     37#include <abi/ipc/methods.h>
    3838#include <async.h>
    3939
  • uspace/lib/c/generic/vfs/vfs.c

    r86a34d3e rbd5f3b7  
    5151#include <assert.h>
    5252#include <str.h>
    53 #include <devmap.h>
     53#include <loc.h>
    5454#include <ipc/vfs.h>
    55 #include <ipc/devmap.h>
     55#include <ipc/loc.h>
    5656
    5757static FIBRIL_MUTEX_INITIALIZE(vfs_mutex);
     
    6969 *
    7070 */
    71 static async_exch_t *vfs_exchange_begin(void)
     71async_exch_t *vfs_exchange_begin(void)
    7272{
    7373        fibril_mutex_lock(&vfs_mutex);
     
    8787 *
    8888 */
    89 static void vfs_exchange_end(async_exch_t *exch)
     89void vfs_exchange_end(async_exch_t *exch)
    9090{
    9191        async_exchange_end(exch);
     
    142142}
    143143
    144 int mount(const char *fs_name, const char *mp, const char *fqdn,
     144int mount(const char *fs_name, const char *mp, const char *fqsn,
    145145    const char *opts, unsigned int flags)
    146146{
    147147        int null_id = -1;
    148         char null[DEVMAP_NAME_MAXLEN];
    149        
    150         if (str_cmp(fqdn, "") == 0) {
     148        char null[LOC_NAME_MAXLEN];
     149       
     150        if (str_cmp(fqsn, "") == 0) {
    151151                /* No device specified, create a fresh
    152152                   null/%d device instead */
    153                 null_id = devmap_null_create();
     153                null_id = loc_null_create();
    154154               
    155155                if (null_id == -1)
    156156                        return ENOMEM;
    157157               
    158                 snprintf(null, DEVMAP_NAME_MAXLEN, "null/%d", null_id);
    159                 fqdn = null;
    160         }
    161        
    162         devmap_handle_t devmap_handle;
    163         int res = devmap_device_get_handle(fqdn, &devmap_handle, flags);
     158                snprintf(null, LOC_NAME_MAXLEN, "null/%d", null_id);
     159                fqsn = null;
     160        }
     161       
     162        service_id_t service_id;
     163        int res = loc_service_get_id(fqsn, &service_id, flags);
    164164        if (res != EOK) {
    165165                if (null_id != -1)
    166                         devmap_null_destroy(null_id);
     166                        loc_null_destroy(null_id);
    167167               
    168168                return res;
     
    173173        if (!mpa) {
    174174                if (null_id != -1)
    175                         devmap_null_destroy(null_id);
     175                        loc_null_destroy(null_id);
    176176               
    177177                return ENOMEM;
     
    181181
    182182        sysarg_t rc_orig;
    183         aid_t req = async_send_2(exch, VFS_IN_MOUNT, devmap_handle, flags, NULL);
     183        aid_t req = async_send_2(exch, VFS_IN_MOUNT, service_id, flags, NULL);
    184184        sysarg_t rc = async_data_write_start(exch, (void *) mpa, mpa_size);
    185185        if (rc != EOK) {
     
    189189               
    190190                if (null_id != -1)
    191                         devmap_null_destroy(null_id);
     191                        loc_null_destroy(null_id);
    192192               
    193193                if (rc_orig == EOK)
     
    204204               
    205205                if (null_id != -1)
    206                         devmap_null_destroy(null_id);
     206                        loc_null_destroy(null_id);
    207207               
    208208                if (rc_orig == EOK)
     
    219219               
    220220                if (null_id != -1)
    221                         devmap_null_destroy(null_id);
     221                        loc_null_destroy(null_id);
    222222               
    223223                if (rc_orig == EOK)
     
    235235               
    236236                if (null_id != -1)
    237                         devmap_null_destroy(null_id);
     237                        loc_null_destroy(null_id);
    238238               
    239239                if (rc_orig == EOK)
     
    248248       
    249249        if ((rc != EOK) && (null_id != -1))
    250                 devmap_null_destroy(null_id);
     250                loc_null_destroy(null_id);
    251251       
    252252        return (int) rc;
     
    329329}
    330330
    331 int open_node(fdi_node_t *node, int oflag)
    332 {
    333         async_exch_t *exch = vfs_exchange_begin();
    334        
    335         ipc_call_t answer;
    336         aid_t req = async_send_4(exch, VFS_IN_OPEN_NODE, node->fs_handle,
    337             node->devmap_handle, node->index, oflag, &answer);
    338        
    339         vfs_exchange_end(exch);
    340 
    341         sysarg_t rc;
    342         async_wait_for(req, &rc);
    343        
    344         if (rc != EOK)
    345                 return (int) rc;
    346        
    347         return (int) IPC_GET_ARG1(answer);
    348 }
    349 
    350331int close(int fildes)
    351332{
     
    415396        else
    416397                return -1;
     398}
     399
     400/** Read entire buffer.
     401 *
     402 * In face of short reads this function continues reading until either
     403 * the entire buffer is read or no more data is available (at end of file).
     404 *
     405 * @param fildes        File descriptor
     406 * @param buf           Buffer, @a nbytes bytes long
     407 * @param nbytes        Number of bytes to read
     408 *
     409 * @return              On success, positive number of bytes read.
     410 *                      On failure, negative error code from read().
     411 */
     412ssize_t read_all(int fildes, void *buf, size_t nbyte)
     413{
     414        ssize_t cnt = 0;
     415        size_t nread = 0;
     416        uint8_t *bp = (uint8_t *) buf;
     417
     418        do {
     419                bp += cnt;
     420                nread += cnt;
     421                cnt = read(fildes, bp, nbyte - nread);
     422        } while (cnt > 0 && (nbyte - nread - cnt) > 0);
     423
     424        if (cnt < 0)
     425                return cnt;
     426
     427        return nread + cnt;
     428}
     429
     430/** Write entire buffer.
     431 *
     432 * This function fails if it cannot write exactly @a len bytes to the file.
     433 *
     434 * @param fildes        File descriptor
     435 * @param buf           Data, @a nbytes bytes long
     436 * @param nbytes        Number of bytes to write
     437 *
     438 * @return              EOK on error, return value from write() if writing
     439 *                      failed.
     440 */
     441ssize_t write_all(int fildes, const void *buf, size_t nbyte)
     442{
     443        ssize_t cnt = 0;
     444        ssize_t nwritten = 0;
     445        const uint8_t *bp = (uint8_t *) buf;
     446
     447        do {
     448                bp += cnt;
     449                nwritten += cnt;
     450                cnt = write(fildes, bp, nbyte - nwritten);
     451        } while (cnt > 0 && ((ssize_t )nbyte - nwritten - cnt) > 0);
     452
     453        if (cnt < 0)
     454                return cnt;
     455
     456        if ((ssize_t)nbyte - nwritten - cnt > 0)
     457                return EIO;
     458
     459        return nbyte;
    417460}
    418461
     
    749792        }
    750793       
    751         if (!stat.device) {
     794        if (!stat.service) {
    752795                errno = ENOENT;
    753796                return NULL;
    754797        }
    755798       
    756         return devmap_device_connect(mgmt, stat.device, 0);
    757 }
    758 
    759 int fd_node(int fildes, fdi_node_t *node)
    760 {
    761         struct stat stat;
    762         int rc = fstat(fildes, &stat);
    763        
    764         if (rc == EOK) {
    765                 node->fs_handle = stat.fs_handle;
    766                 node->devmap_handle = stat.devmap_handle;
    767                 node->index = stat.index;
    768         }
    769        
    770         return rc;
     799        return loc_service_connect(mgmt, stat.service, 0);
    771800}
    772801
     
    786815}
    787816
     817int fd_wait(void)
     818{
     819        async_exch_t *exch = vfs_exchange_begin();
     820       
     821        sysarg_t ret;
     822        sysarg_t rc = async_req_0_1(exch, VFS_IN_WAIT_HANDLE, &ret);
     823       
     824        vfs_exchange_end(exch);
     825       
     826        if (rc == EOK)
     827                return (int) ret;
     828       
     829        return (int) rc;
     830}
     831
    788832/** @}
    789833 */
  • uspace/lib/c/include/as.h

    r86a34d3e rbd5f3b7  
    3737
    3838#include <sys/types.h>
     39#include <abi/mm/as.h>
    3940#include <task.h>
    40 #include <kernel/mm/as.h>
    4141#include <libarch/config.h>
    4242
  • uspace/lib/c/include/async.h

    r86a34d3e rbd5f3b7  
    4242#include <ipc/common.h>
    4343#include <fibril.h>
    44 #include <fibril_synch.h>
    4544#include <sys/time.h>
    4645#include <atomic.h>
     
    9695} exch_mgmt_t;
    9796
    98 /** Session data */
    99 typedef struct {
    100         /** List of inactive exchanges */
    101         list_t exch_list;
    102        
    103         /** Exchange management style */
    104         exch_mgmt_t mgmt;
    105        
    106         /** Session identification */
    107         int phone;
    108        
    109         /** First clone connection argument */
    110         sysarg_t arg1;
    111        
    112         /** Second clone connection argument */
    113         sysarg_t arg2;
    114        
    115         /** Third clone connection argument */
    116         sysarg_t arg3;
    117        
    118         /** Exchange mutex */
    119         fibril_mutex_t mutex;
    120        
    121         /** Number of opened exchanges */
    122         atomic_t refcnt;
    123 } async_sess_t;
    124 
    125 /** Exchange data */
    126 typedef struct {
    127         /** Link into list of inactive exchanges */
    128         link_t sess_link;
    129        
    130         /** Link into global list of inactive exchanges */
    131         link_t global_link;
    132        
    133         /** Session pointer */
    134         async_sess_t *sess;
    135        
    136         /** Exchange identification */
    137         int phone;
    138 } async_exch_t;
     97/** Forward declarations */
     98struct _async_exch;
     99struct _async_sess;
     100
     101typedef struct _async_sess async_sess_t;
     102typedef struct _async_exch async_exch_t;
    139103
    140104extern atomic_t threads_in_ipc_wait;
     
    176140extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
    177141
    178 extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
     142extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
    179143    ipc_call_t *, async_client_conn_t, void *);
    180144
     
    186150extern void async_set_client_data_destructor(async_client_data_dtor_t);
    187151extern void *async_get_client_data(void);
     152extern void *async_get_client_data_by_id(task_id_t);
     153extern void async_put_client_data_by_id(task_id_t);
    188154
    189155extern void async_set_client_connection(async_client_conn_t);
     
    371337
    372338/*
     339 * FIXME These functions just work around problems with parallel exchange
     340 * management. Proper solution needs to be implemented.
     341 */
     342void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);
     343
     344/*
    373345 * User-friendly wrappers for async_share_in_start().
    374346 */
     
    477449extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
    478450
     451extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
     452    sysarg_t, async_exch_t *);
     453extern bool async_state_change_receive(ipc_callid_t *, sysarg_t *, sysarg_t *,
     454    sysarg_t *);
     455extern int async_state_change_finalize(ipc_callid_t, async_exch_t *);
     456
     457extern void *async_remote_state_acquire(async_sess_t *);
     458extern void async_remote_state_update(async_sess_t *, void *);
     459extern void async_remote_state_release(async_sess_t *);
     460extern void async_remote_state_release_exchange(async_exch_t *);
     461
    479462#endif
    480463
  • uspace/lib/c/include/ddi.h

    r86a34d3e rbd5f3b7  
    3737
    3838#include <sys/types.h>
    39 #include <kernel/ddi/irq.h>
     39#include <abi/ddi/irq.h>
    4040#include <task.h>
    4141
  • uspace/lib/c/include/devman.h

    r86a34d3e rbd5f3b7  
    3838
    3939#include <ipc/devman.h>
     40#include <ipc/loc.h>
    4041#include <async.h>
    4142#include <bool.h>
     
    4849extern int devman_add_function(const char *, fun_type_t, match_id_list_t *,
    4950    devman_handle_t, devman_handle_t *);
     51extern int devman_remove_function(devman_handle_t);
    5052
    5153extern async_sess_t *devman_device_connect(exch_mgmt_t, devman_handle_t,
     
    5456    unsigned int);
    5557
    56 extern int devman_device_get_handle(const char *, devman_handle_t *,
     58extern int devman_fun_get_handle(const char *, devman_handle_t *,
    5759    unsigned int);
    58 extern int devman_device_get_handle_by_class(const char *, const char *,
    59     devman_handle_t *, unsigned int);
    60 extern int devman_get_device_path(devman_handle_t, char *, size_t);
     60extern int devman_fun_get_child(devman_handle_t, devman_handle_t *);
     61extern int devman_dev_get_functions(devman_handle_t, devman_handle_t **,
     62    size_t *);
     63extern int devman_fun_get_name(devman_handle_t, char *, size_t);
     64extern int devman_fun_get_path(devman_handle_t, char *, size_t);
    6165
    62 extern int devman_add_device_to_class(devman_handle_t, const char *);
     66extern int devman_add_device_to_category(devman_handle_t, const char *);
     67extern int devman_fun_sid_to_handle(service_id_t, devman_handle_t *);
    6368
    6469#endif
  • uspace/lib/c/include/elf/elf.h

    r86a34d3e rbd5f3b7  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
     2 * Copyright (c) 2011 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 #ifndef FB_PPM_H_
    30 #define FB_PPM_H_
     29/** @addtogroup generic
     30 * @{
     31 */
     32/** @file
     33 */
    3134
    32 #include "fb.h"
     35#ifndef LIBC_ELF_H_
     36#define LIBC_ELF_H_
     37
    3338#include <sys/types.h>
    34 
    35 extern int ppm_draw(unsigned char *, size_t, unsigned int, unsigned int,
    36     unsigned int, unsigned int, putpixel_cb_t, void *);
    37 extern int ppm_get_data(unsigned char *, size_t, unsigned int *, unsigned int *);
     39#include <abi/elf.h>
     40#include <libarch/elf.h>
    3841
    3942#endif
     43
     44/** @}
     45 */
  • uspace/lib/c/include/elf/elf_load.h

    r86a34d3e rbd5f3b7  
    11/*
     2 * Copyright (c) 2006 Sergey Bondari
    23 * Copyright (c) 2008 Jiri Svoboda
    34 * All rights reserved.
     
    3738#define ELF_LOAD_H_
    3839
    39 #include <arch/elf.h>
     40#include <elf/elf.h>
    4041#include <sys/types.h>
    4142#include <loader/pcb.h>
    4243
    43 #include "elf.h"
     44/**
     45 * ELF error return codes
     46 */
     47#define EE_OK                   0       /* No error */
     48#define EE_INVALID              1       /* Invalid ELF image */
     49#define EE_MEMORY               2       /* Cannot allocate address space */
     50#define EE_INCOMPATIBLE         3       /* ELF image is not compatible with current architecture */
     51#define EE_UNSUPPORTED          4       /* Non-supported ELF (e.g. dynamic ELFs) */
     52#define EE_LOADER               5       /* The image is actually a program loader. */
     53#define EE_IRRECOVERABLE        6
    4454
    4555typedef enum {
     
    8292} elf_ld_t;
    8393
    84 int elf_load_file(const char *file_name, size_t so_bias, eld_flags_t flags,
    85     elf_info_t *info);
    86 void elf_create_pcb(elf_info_t *info, pcb_t *pcb);
     94extern const char *elf_error(unsigned int);
     95extern int elf_load_file(const char *, size_t, eld_flags_t, elf_info_t *);
     96extern void elf_create_pcb(elf_info_t *, pcb_t *);
    8797
    8898#endif
  • uspace/lib/c/include/errno.h

    r86a34d3e rbd5f3b7  
    3636#define LIBC_ERRNO_H_
    3737
    38 #include <kernel/errno.h>
     38#include <abi/errno.h>
    3939#include <fibril.h>
    4040
  • uspace/lib/c/include/event.h

    r86a34d3e rbd5f3b7  
    3636#define LIBC_EVENT_H_
    3737
    38 #include <kernel/ipc/event_types.h>
     38#include <abi/ipc/event.h>
     39#include <libarch/types.h>
    3940
    4041extern int event_subscribe(event_type_t, sysarg_t);
     42extern int event_task_subscribe(event_task_type_t, sysarg_t);
    4143extern int event_unmask(event_type_t);
     44extern int event_task_unmask(event_task_type_t);
    4245
    4346#endif
  • uspace/lib/c/include/ipc/common.h

    r86a34d3e rbd5f3b7  
    3737
    3838#include <sys/types.h>
     39#include <abi/ipc/ipc.h>
    3940#include <atomic.h>
    40 #include <kernel/ipc/ipc.h>
     41#include <task.h>
    4142
    4243#define IPC_FLAG_BLOCKING  0x01
     
    4445typedef struct {
    4546        sysarg_t args[IPC_CALL_LEN];
    46         sysarg_t in_task_hash;
     47        task_id_t in_task_id;
    4748        sysarg_t in_phone_hash;
    4849} ipc_call_t;
  • uspace/lib/c/include/ipc/devman.h

    r86a34d3e rbd5f3b7  
    130130        DEVMAN_CLIENT,
    131131        DEVMAN_CONNECT_TO_DEVICE,
    132         DEVMAN_CONNECT_FROM_DEVMAP,
     132        DEVMAN_CONNECT_FROM_LOC,
    133133        DEVMAN_CONNECT_TO_PARENTS_DEVICE
    134134} devman_interface_t;
     
    138138        DEVMAN_ADD_FUNCTION,
    139139        DEVMAN_ADD_MATCH_ID,
    140         DEVMAN_ADD_DEVICE_TO_CLASS
    141 
     140        DEVMAN_ADD_DEVICE_TO_CATEGORY,
     141        DEVMAN_REMOVE_FUNCTION
    142142} driver_to_devman_t;
    143143
     
    149149typedef enum {
    150150        DEVMAN_DEVICE_GET_HANDLE = IPC_FIRST_USER_METHOD,
    151         DEVMAN_DEVICE_GET_HANDLE_BY_CLASS,
    152         DEVMAN_DEVICE_GET_DEVICE_PATH
     151        DEVMAN_DEV_GET_FUNCTIONS,
     152        DEVMAN_FUN_GET_CHILD,
     153        DEVMAN_FUN_GET_NAME,
     154        DEVMAN_FUN_GET_PATH,
     155        DEVMAN_FUN_SID_TO_HANDLE
    153156} client_to_devman_t;
    154157
  • uspace/lib/c/include/ipc/fb.h

    r86a34d3e rbd5f3b7  
    5555        FB_DRAW_TEXT_DATA,
    5656        FB_FLUSH,
    57         FB_DRAW_PPM,
     57        FB_DRAW_IMGMAP,
    5858        FB_PREPARE_SHM,
    5959        FB_DROP_SHM,
    60         FB_SHM2PIXMAP,
    61         FB_VP_DRAW_PIXMAP,
    62         FB_VP2PIXMAP,
    63         FB_DROP_PIXMAP,
     60        FB_SHM2IMGMAP,
     61        FB_VP_DRAW_IMGMAP,
     62        FB_VP2IMGMAP,
     63        FB_DROP_IMGMAP,
    6464        FB_ANIM_CREATE,
    6565        FB_ANIM_DROP,
    66         FB_ANIM_ADDPIXMAP,
     66        FB_ANIM_ADDIMGMAP,
    6767        FB_ANIM_CHGVP,
    6868        FB_ANIM_START,
  • uspace/lib/c/include/ipc/ipc.h

    r86a34d3e rbd5f3b7  
    4242#include <sys/types.h>
    4343#include <ipc/common.h>
    44 #include <kernel/ipc/ipc_methods.h>
    45 #include <kernel/synch/synch.h>
     44#include <abi/ipc/methods.h>
     45#include <abi/synch.h>
    4646#include <task.h>
    4747
     
    254254    sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool);
    255255
    256 extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t *,
     256extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, task_id_t *,
    257257    sysarg_t *);
    258258extern int ipc_connect_me(int);
  • uspace/lib/c/include/ipc/loc.h

    r86a34d3e rbd5f3b7  
    11/*
    22 * Copyright (c) 2007 Josef Cejka
     3 * Copyright (c) 2011 Jiri Svoboda
    34 * All rights reserved.
    45 *
     
    2728 */
    2829
    29 /** @addtogroup devmap
     30/** @addtogroup loc
    3031 * @{
    3132 */
    3233
    33 #ifndef LIBC_IPC_DEVMAP_H_
    34 #define LIBC_IPC_DEVMAP_H_
     34#ifndef LIBC_IPC_LOC_H_
     35#define LIBC_IPC_LOC_H_
    3536
    3637#include <ipc/common.h>
    3738
    38 #define DEVMAP_NAME_MAXLEN  255
     39#define LOC_NAME_MAXLEN  255
    3940
    40 typedef sysarg_t devmap_handle_t;
     41typedef sysarg_t service_id_t;
     42typedef sysarg_t category_id_t;
    4143
    4244typedef enum {
    43         DEV_HANDLE_NONE,
    44         DEV_HANDLE_NAMESPACE,
    45         DEV_HANDLE_DEVICE
    46 } devmap_handle_type_t;
     45        LOC_OBJECT_NONE,
     46        LOC_OBJECT_NAMESPACE,
     47        LOC_OBJECT_SERVICE
     48} loc_object_type_t;
    4749
    4850typedef enum {
    49         DEVMAP_DRIVER_REGISTER = IPC_FIRST_USER_METHOD,
    50         DEVMAP_DRIVER_UNREGISTER,
    51         DEVMAP_DEVICE_REGISTER,
    52         DEVMAP_DEVICE_UNREGISTER,
    53         DEVMAP_DEVICE_GET_HANDLE,
    54         DEVMAP_NAMESPACE_GET_HANDLE,
    55         DEVMAP_HANDLE_PROBE,
    56         DEVMAP_NULL_CREATE,
    57         DEVMAP_NULL_DESTROY,
    58         DEVMAP_GET_NAMESPACE_COUNT,
    59         DEVMAP_GET_DEVICE_COUNT,
    60         DEVMAP_GET_NAMESPACES,
    61         DEVMAP_GET_DEVICES
    62 } devmap_request_t;
     51        LOC_SERVER_REGISTER = IPC_FIRST_USER_METHOD,
     52        LOC_SERVER_UNREGISTER,
     53        LOC_SERVICE_ADD_TO_CAT,
     54        LOC_SERVICE_REGISTER,
     55        LOC_SERVICE_UNREGISTER,
     56        LOC_SERVICE_GET_ID,
     57        LOC_SERVICE_GET_NAME,
     58        LOC_NAMESPACE_GET_ID,
     59        LOC_CALLBACK_CREATE,
     60        LOC_CATEGORY_GET_ID,
     61        LOC_CATEGORY_GET_NAME,
     62        LOC_CATEGORY_GET_SVCS,
     63        LOC_ID_PROBE,
     64        LOC_NULL_CREATE,
     65        LOC_NULL_DESTROY,
     66        LOC_GET_NAMESPACE_COUNT,
     67        LOC_GET_SERVICE_COUNT,
     68        LOC_GET_CATEGORIES,
     69        LOC_GET_NAMESPACES,
     70        LOC_GET_SERVICES
     71} loc_request_t;
    6372
    64 /** Interface provided by devmap.
     73typedef enum {
     74        LOC_EVENT_CAT_CHANGE = IPC_FIRST_USER_METHOD
     75} loc_event_t;
     76
     77/** Ports provided by location service.
    6578 *
    66  * Every process that connects to devmap must ask one of following
    67  * interfaces otherwise connection will be refused.
     79 * Every process that connects to loc must ask one of following
     80 * ports, otherwise connection will be refused.
    6881 *
    6982 */
    7083typedef enum {
    71         /** Connect as device driver */
    72         DEVMAP_DRIVER = 1,
    73         /** Connect as client */
    74         DEVMAP_CLIENT,
     84        /** Service supplier (server) port */
     85        LOC_PORT_SUPPLIER = 1,
     86        /** Service consumer (client) port */
     87        LOC_PORT_CONSUMER,
    7588        /** Create new connection to instance of device that
    7689            is specified by second argument of call. */
    77         DEVMAP_CONNECT_TO_DEVICE
    78 } devmap_interface_t;
     90        LOC_CONNECT_TO_SERVICE
     91} loc_interface_t;
    7992
    8093typedef struct {
    81         devmap_handle_t handle;
    82         char name[DEVMAP_NAME_MAXLEN + 1];
    83 } dev_desc_t;
     94        service_id_t id;
     95        char name[LOC_NAME_MAXLEN + 1];
     96} loc_sdesc_t;
    8497
    8598#endif
  • uspace/lib/c/include/ipc/services.h

    r86a34d3e rbd5f3b7  
    4545        SERVICE_VIDEO      = FOURCC('v', 'i', 'd', ' '),
    4646        SERVICE_VFS        = FOURCC('v', 'f', 's', ' '),
    47         SERVICE_DEVMAP     = FOURCC('d', 'e', 'v', 'p'),
     47        SERVICE_LOC        = FOURCC('l', 'o', 'c', ' '),
    4848        SERVICE_DEVMAN     = FOURCC('d', 'e', 'v', 'n'),
    4949        SERVICE_IRC        = FOURCC('i', 'r', 'c', ' '),
  • uspace/lib/c/include/ipc/vfs.h

    r86a34d3e rbd5f3b7  
    6262typedef enum {
    6363        VFS_IN_OPEN = IPC_FIRST_USER_METHOD,
    64         VFS_IN_OPEN_NODE,
    6564        VFS_IN_READ,
    6665        VFS_IN_WRITE,
     
    7877        VFS_IN_RENAME,
    7978        VFS_IN_STAT,
    80         VFS_IN_DUP
     79        VFS_IN_DUP,
     80        VFS_IN_WAIT_HANDLE,
    8181} vfs_in_request_t;
    8282
  • uspace/lib/c/include/libc.h

    r86a34d3e rbd5f3b7  
    3737
    3838#include <sys/types.h>
    39 #include <kernel/syscall/syscall.h>
     39#include <abi/syscall.h>
    4040#include <libarch/syscall.h>
    4141
  • uspace/lib/c/include/loader/loader.h

    r86a34d3e rbd5f3b7  
    3838
    3939#include <task.h>
    40 #include <vfs/vfs.h>
    4140
    4241/** Forward declararion */
     
    5049extern int loader_set_pathname(loader_t *, const char *);
    5150extern int loader_set_args(loader_t *, const char *const[]);
    52 extern int loader_set_files(loader_t *, fdi_node_t *const[]);
     51extern int loader_set_files(loader_t *, int *const[]);
    5352extern int loader_load_program(loader_t *);
    5453extern int loader_run(loader_t *);
  • uspace/lib/c/include/loader/pcb.h

    r86a34d3e rbd5f3b7  
    3838
    3939#include <sys/types.h>
    40 #include <vfs/vfs.h>
    4140
    4241typedef void (*entry_point_t)(void);
     
    6261       
    6362        /** Number of preset files. */
    64         int filc;
    65         /** Preset files. */
    66         fdi_node_t **filv;
     63        unsigned int filc;
    6764       
    6865        /*
  • uspace/lib/c/include/rtld/elf_dyn.h

    r86a34d3e rbd5f3b7  
    3636#define LIBC_RTLD_ELF_DYN_H_
    3737
    38 #include <arch/elf.h>
    3938#include <sys/types.h>
    40 
    41 #include <elf.h>
     39#include <elf/elf.h>
    4240#include <libarch/rtld/elf_dyn.h>
    4341
  • uspace/lib/c/include/rtld/rtld.h

    r86a34d3e rbd5f3b7  
    4949
    5050        /** List of all loaded modules including rtld and the program */
    51         link_t modules_head;
     51        list_t modules;
    5252
    5353        /** Temporary hack to place each module at different address. */
  • uspace/lib/c/include/rtld/symbol.h

    r86a34d3e rbd5f3b7  
    3636#define LIBC_RTLD_SYMBOL_H_
    3737
     38#include <elf/elf.h>
    3839#include <rtld/rtld.h>
    39 #include <elf.h>
    4040
    4141elf_symbol_t *symbol_bfs_find(const char *name, module_t *start, module_t **mod);
  • uspace/lib/c/include/stats.h

    r86a34d3e rbd5f3b7  
    4040#include <stdint.h>
    4141#include <bool.h>
    42 #include <kernel/sysinfo/abi.h>
     42#include <sys/types.h>
     43#include <abi/sysinfo.h>
    4344
    4445extern stats_cpu_t *stats_get_cpus(size_t *);
  • uspace/lib/c/include/str.h

    r86a34d3e rbd5f3b7  
    8383extern char *wstr_to_astr(const wchar_t *src);
    8484extern void str_to_wstr(wchar_t *dest, size_t dlen, const char *src);
     85extern wchar_t *str_to_awstr(const char *src);
    8586
    8687extern char *str_chr(const char *str, wchar_t ch);
  • uspace/lib/c/include/sys/stat.h

    r86a34d3e rbd5f3b7  
    3939#include <bool.h>
    4040#include <ipc/vfs.h>
    41 #include <ipc/devmap.h>
     41#include <ipc/loc.h>
    4242
    4343struct stat {
    4444        fs_handle_t fs_handle;
    45         devmap_handle_t devmap_handle;
     45        service_id_t service_id;
    4646        fs_index_t index;
    4747        unsigned int lnkcnt;
     
    4949        bool is_directory;
    5050        aoff64_t size;
    51         devmap_handle_t device;
     51        service_id_t service;
    5252};
    5353
  • uspace/lib/c/include/syscall.h

    r86a34d3e rbd5f3b7  
    4545
    4646#include <sys/types.h>
    47 #include <kernel/syscall/syscall.h>
     47#include <abi/syscall.h>
    4848
    4949#define __syscall0  __syscall
  • uspace/lib/c/include/task.h

    r86a34d3e rbd5f3b7  
    3737
    3838#include <sys/types.h>
    39 #include <vfs/vfs.h>
    4039
    4140typedef uint64_t task_id_t;
     
    5352extern int task_spawnv(task_id_t *, const char *path, const char *const []);
    5453extern int task_spawnvf(task_id_t *, const char *path, const char *const [],
    55     fdi_node_t *const []);
     54    int *const []);
    5655extern int task_spawnl(task_id_t *, const char *path, ...);
    5756
  • uspace/lib/c/include/udebug.h

    r86a34d3e rbd5f3b7  
    3636#define LIBC_UDEBUG_H_
    3737
    38 #include <kernel/udebug/udebug.h>
     38#include <abi/udebug.h>
    3939#include <sys/types.h>
    4040#include <async.h>
  • uspace/lib/c/include/unistd.h

    r86a34d3e rbd5f3b7  
    6363extern ssize_t read(int, void *, size_t);
    6464
     65extern ssize_t read_all(int, void *, size_t);
     66extern ssize_t write_all(int, const void *, size_t);
     67
    6568extern off64_t lseek(int, off64_t, int);
    6669extern int ftruncate(int, aoff64_t);
  • uspace/lib/c/include/vfs/vfs.h

    r86a34d3e rbd5f3b7  
    3838#include <sys/types.h>
    3939#include <ipc/vfs.h>
    40 #include <ipc/devmap.h>
     40#include <ipc/loc.h>
    4141#include <stdio.h>
     42#include <async.h>
    4243
    43 /** Libc version of the VFS triplet.
    44  *
    45  * Unique identification of a file system node
    46  * within a file system instance.
    47  *
    48  */
    49 typedef struct {
    50         fs_handle_t fs_handle;
    51         devmap_handle_t devmap_handle;
    52         fs_index_t index;
    53 } fdi_node_t;
     44enum vfs_change_state_type {
     45        VFS_PASS_HANDLE
     46};
    5447
    5548extern char *absolutize(const char *, size_t *);
     
    5952extern int unmount(const char *);
    6053
    61 extern int open_node(fdi_node_t *, int);
    62 extern int fd_node(int, fdi_node_t *);
     54extern int fhandle(FILE *, int *);
    6355
    64 extern FILE *fopen_node(fdi_node_t *, const char *);
    65 extern int fnode(FILE *, fdi_node_t *);
     56extern int fd_wait(void);
     57
     58extern async_exch_t *vfs_exchange_begin(void);
     59extern void vfs_exchange_end(async_exch_t *);
    6660
    6761#endif
Note: See TracChangeset for help on using the changeset viewer.