Index: .gitignore
===================================================================
--- .gitignore	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ .gitignore	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -442,3 +442,2 @@
 tools/gcc-*.tar.bz2
 tools/gdb-*.tar.gz
-tools/sycek/
Index: ravis.yml
===================================================================
--- .travis.yml	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,62 +1,0 @@
-#
-# Travis CI configuration notes
-# -----------------------------
-#
-# * HelenOS is always built for all architectures
-#   * that is done using matrix environmental variables
-#   * the list of architectures has to be kept manually in sync with
-#     HelenOS.config
-#   * the actual architecture is specified via H_ARCH variable
-#
-# * ported software is built when H_HARBOURS is set to true for given
-#   configuration
-#   * building ported software takes a lot of time, it is thus impossible
-#     to build for all architectures
-#   * some ports are known to fail for certain architectures: because that
-#     would make the whole build failing, we currently build only for ia32
-#     that seems to be in the best condition with respect to ported software
-#   * list of harbours is also maintained manually, look for a variable
-#     H_DEFAULT_HARBOURS_LIST to allow overriding from within this file
-#
-# * since the setup is rather complicated we use a dedicated shell script to
-#   run the actual build process and installation of the cross-compiler
-#   toolchain
-#
-# * if you have enabled Travis in your feature branch you may want to change
-#   some of the settings to better suite your needs
-#   * reduce number of built architectures (probably not needed)
-#   * built ported software for a different architecture
-#     * specify H_HARBOURS=true
-#     * optionally specify H_HARBOUR_LIST="..." to a list of harbours to be
-#       built
-#     * optionally specify H_HARBOURS_REPOSITORY="..." to point to your repo
-#       with HARBOUR files
-#
-
-language: c
-sudo: required
-env:
-  global:
-    - CROSS_PREFIX=/usr/local/cross-static/
-  matrix:
-    - H_ARCH=amd64
-    - H_ARCH=arm32/beagleboardxm
-    - H_ARCH=arm32/beaglebone
-    - H_ARCH=arm32/gta02
-    - H_ARCH=arm32/integratorcp
-    - H_ARCH=arm32/raspberrypi
-    - H_ARCH=ia32 H_HARBOURS=true
-    - H_ARCH=ia64/i460GX
-    - H_ARCH=ia64/ski
-    - H_ARCH=mips32/malta-be
-    - H_ARCH=mips32/malta-le
-    - H_ARCH=mips32/msim
-    - H_ARCH=ppc32
-    - H_ARCH=sparc64/niagara
-    - H_ARCH=sparc64/ultra
-before_install:
- - ./tools/travis.sh install
-script:
- - ./tools/travis.sh run
-os:
- - linux
Index: Makefile
===================================================================
--- Makefile	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ Makefile	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -30,5 +30,4 @@
 .NOTPARALLEL:
 
-CCHECK = tools/sycek/ccheck
 CSCOPE = cscope
 FORMAT = clang-format
@@ -45,13 +44,11 @@
 CONFIG_MAKEFILE = Makefile.config
 CONFIG_HEADER = config.h
-ERRNO_HEADER = abi/include/abi/errno.h
-ERRNO_INPUT = abi/include/abi/errno.in
 
-.PHONY: all precheck cscope cscope_parts autotool config_auto config_default config distclean clean check releasefile release common boot kernel uspace export-posix
+.PHONY: all precheck cscope cscope_parts autotool config_auto config_default config distclean clean check releasefile release common boot kernel uspace
 
 all: kernel uspace
 	$(MAKE) -r -C boot PRECHECK=$(PRECHECK)
 
-common: $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(ERRNO_HEADER)
+common: $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER)
 
 kernel: common
@@ -60,11 +57,4 @@
 uspace: common
 	$(MAKE) -r -C uspace PRECHECK=$(PRECHECK)
-
-export-posix: common
-ifndef EXPORT_DIR
-	@echo ERROR: Variable EXPORT_DIR is not defined. && false
-else
-	$(MAKE) -r -C uspace export EXPORT_DIR=$(abspath $(EXPORT_DIR))
-endif
 
 precheck: clean
@@ -83,13 +73,4 @@
 	find abi kernel boot uspace -type f -regex '^.*\.[ch]$$' | xargs $(FORMAT) -i -sort-includes -style=file
 
-ccheck: $(CCHECK)
-	tools/ccheck.sh
-
-ccheck-fix: $(CCHECK)
-	tools/ccheck.sh --fix
-
-$(CCHECK):
-	cd tools && ./build-ccheck.sh
-
 doxy:
 	$(MAKE) -r -C doxygen
@@ -102,11 +83,4 @@
 	$(CHECK)
 endif
-
-# `sed` pulls a list of "compatibility-only" error codes from `errno.in`,
-# the following grep finds instances of those error codes in HelenOS code.
-check_errno:
-	@ ! cat abi/include/abi/errno.in | \
-	sed -n -e '1,/COMPAT_START/d' -e 's/__errno_entry(\([A-Z0-9]\+\).*/\\b\1\\b/p' | \
-	git grep -n -f - -- ':(exclude)abi' ':(exclude)uspace/lib/posix'
 
 # Autotool (detects compiler features)
@@ -151,8 +125,3 @@
 	$(MAKE) -r -C doxygen clean
 
-$(ERRNO_HEADER): $(ERRNO_INPUT)
-	echo '/* Generated file. Edit errno.in instead. */' > $@.new
-	sed 's/__errno_entry(\([^,]*\),\([^,]*\),.*/#define \1 __errno_t(\2)/' < $< >> $@.new
-	mv $@.new $@
-
 -include Makefile.local
Index: ADME.md
===================================================================
--- README.md	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,98 +1,0 @@
-# HelenOS
-
-HelenOS is a portable microkernel-based multiserver operating
-system designed and implemented from scratch. It decomposes key
-operating system functionality such as file systems, networking,
-device drivers and graphical user interface into a collection of
-fine-grained user space components that interact with each other
-via message passing. A failure or crash of one component does not
-directly harm others. HelenOS is therefore flexible, modular,
-extensible, fault tolerant and easy to understand.
-
-HelenOS does not aim to be a clone of any existing operating system
-and trades compatibility with legacy APIs for cleaner design.
-Most of HelenOS components have been made to order specifically for
-HelenOS so that its essential parts can stay free of adaptation layers,
-glue code, franken-components and the maintenance burden incurred by them.
-
-* [Website](http://helenos.org)
-* [Wiki](http://helenos.org/wiki)
-* [Tickets](http://www.helenos.org/report/1)
-* [How to contribute](http://www.helenos.org/wiki/HowToContribute)
-
-## Portability
-
-HelenOS runs on seven different processor architectures and machines ranging
-from embedded ARM devices and single-board computers through multicore 32-bit
-and 64-bit desktop PCs to 64-bit Itanium and SPARC rack-mount servers.
-
-## Building
-
-### Building the toolchain
-
-In order to build HelenOS, one must first build the cross-compiler toolchain
-(either as a root or by specifying the `CROSS_PREFIX` environment variable)
-by running (example for the amd64 architecture, further list of targets can be
-found in the `default` directory):
-
-```
-$ cd HelenOS/tools
-$ ./toolchain.sh amd64
-```
-
-The toolchain script will print a list of software packages that are required
-for the toolchain to correctly build. Make sure you install all the dependencies.
-Unfortunately, the script cannot install the required dependencies for you automatically
-since the host environments are very diverse. In case the compilation of the toolchain
-fails half way through, try to analyze the error message(s), add appropriate missing
-dependencies and try again.
-
-As an example, here are some of the packages you will need for Ubuntu 12.10 (may be out of date):
-
-```
-$ sudo apt-get install build-essential libgmp-dev libmpfr-dev ppl-dev libmpc-dev zlib1g-dev texinfo libtinfo-dev xutils-dev
-```
-
-Whereas for CentOS/Fedora, you will need:
-
-```
-# sudo dnf group install 'Development Tools'
-# sudo dnf install wget texinfo libmpc-devel mpfr-devel gmp-devel PyYAML genisoimage
-```
-In case the toolchain script won't work no matter how hard you try, let us know.
-Please supply as many relevant information (your OS and distribution, list of
-installed packages with version information, the output of the toolchain script, etc.) as
-possible.
-
-### Configuring the build
-
-Go back to the source root of HelenOS and start the build process:
-
-```
-$ cd ..
-$ make PROFILE=amd64
-```
-
-Now HelenOS should automatically start building.
-
-Note: If you installed the toolchain to a custom directory, make sure `CROSS_PREFIX`
-environment variable is correctly set.
-
-### Running the OS
-
-When you get the command line back, there should be an `image.iso` file in the source
-root directory. If you have QEMU, you should be able to start HelenOS by running:
-
-```
-$ ./tools/ew.py
-```
-
-For additional information about running HelenOS, see
-[UsersGuide/RunningInQEMU](http://www.helenos.org/wiki/UsersGuide/RunningInQEMU) or
-[UsersGuide/RunningInVirtualBox](http://www.helenos.org/wiki/UsersGuide/RunningInVirtualBox) or
-see the files in contrib/conf.
-
-## License
-  
-HelenOS is open source, free software. Its source code is available under
-the BSD license. Some third-party components are licensed under GPL.
Index: i/include/_bits/errno.h
===================================================================
--- abi/include/_bits/errno.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_ERRNO_H_
-#define _BITS_ERRNO_H_
-
-#ifdef __OPAQUE_ERRNO__
-#include <_bits/opaque_handle.h>
-
-opaque_handle(errno_t);
-typedef errno_t sys_errno_t;
-#define __errno_t(val) ((errno_t) val)
-
-#else
-
-#include <_bits/native.h>
-
-/**
- * The type of <errno.h> constants. Normally, this is an alias for `int`,
- * but we support an alternative definition that allows us to verify
- * integrity of error handling without using external tools.
- */
-typedef int errno_t;
-
-/**
- * Same as `errno_t`, except represented as `sysarg_t`. Used in kernel in
- * places where error number is always passed, but the type must be `sysarg_t`.
- */
-typedef sysarg_t sys_errno_t;
-
-/**
- * A C++-style "cast" to `errno_t`.
- * Used in <abi/errno.h> to define error constants. Normally, it doesn't do
- * anything at all.
- */
-#define __errno_t(val) val
-
-#endif
-
-#endif
Index: i/include/_bits/opaque_handle.h
===================================================================
--- abi/include/_bits/opaque_handle.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-
-#ifndef _BITS_OPAQUE_HANDLE_H_
-#define _BITS_OPAQUE_HANDLE_H_
-
-#define opaque_handle(__name) typedef struct __opaque_##__name *__name
-
-#endif
-
-/** @}
- */
Index: abi/include/abi/errno.h
===================================================================
--- abi/include/abi/errno.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ abi/include/abi/errno.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1,117 +1,110 @@
-/* Generated file. Edit errno.in instead. */
-#define EOK             __errno_t(      0)
-#define ENOENT          __errno_t(      1)
-#define ENOMEM          __errno_t(      2)
-#define ELIMIT          __errno_t(      3)
-#define EREFUSED        __errno_t(      4)
-#define EFORWARD        __errno_t(      5)
-#define EPERM           __errno_t(      6)
-#define EHANGUP         __errno_t(      7)
-#define EPARTY          __errno_t(      8)
-#define EEXIST          __errno_t(      9)
-#define EBADMEM         __errno_t(     10)
-#define ENOTSUP         __errno_t(     11)
-#define EADDRNOTAVAIL   __errno_t(     12)
-#define ETIMEOUT        __errno_t(     13)
-#define EINVAL          __errno_t(     14)
-#define EBUSY           __errno_t(     15)
-#define EOVERFLOW       __errno_t(     16)
-#define EINTR           __errno_t(     17)
-#define EMFILE          __errno_t(     18)
-#define ENAMETOOLONG    __errno_t(     19)
-#define EISDIR          __errno_t(     20)
-#define ENOTDIR         __errno_t(     21)
-#define ENOSPC          __errno_t(     22)
-#define ENOTEMPTY       __errno_t(     23)
-#define EBADF           __errno_t(     24)
-#define EDOM            __errno_t(     25)
-#define ERANGE          __errno_t(     26)
-#define EXDEV           __errno_t(     27)
-#define EIO             __errno_t(     28)
-#define EMLINK          __errno_t(     29)
-#define ENXIO           __errno_t(     30)
-#define ENOFS           __errno_t(     31)
-#define EBADCHECKSUM    __errno_t(     32)
-#define ESTALL          __errno_t(     33)
-#define EEMPTY          __errno_t(     34)
-#define ENAK            __errno_t(     35)
-#define EAGAIN          __errno_t(     36)
+/*
+ * Copyright (c) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
 
-/* libhttp error codes. Defining them here is a temporary hack. */
+/** @addtogroup generic
+ * @{
+ */
+/** @file
+ */
 
-#define HTTP_EMULTIPLE_HEADERS  __errno_t(  50)
-#define HTTP_EMISSING_HEADER    __errno_t(  51)
-#define HTTP_EPARSE             __errno_t(  52)
+#ifndef ABI_ERRNO_H_
+#define ABI_ERRNO_H_
 
-/* libext4 error codes. Same as above. */
+/**
+ * Values in the range [-1, -255] are kernel error codes,
+ * values in the range [-256, -512] are user error codes.
+ */
 
-#define EXT4_ERR_BAD_DX_DIR     __errno_t(  60)
+typedef enum {
+	EOK           =  0,   /* No error */
+	ENOENT        = -1,   /* No such entry */
+	ENOMEM        = -2,   /* Not enough memory */
+	ELIMIT        = -3,   /* Limit exceeded */
+	EREFUSED      = -4,   /* Connection refused */
+	EFORWARD      = -5,   /* Forward error */
+	EPERM         = -6,   /* Permission denied */
+
+/*
+ * Answerbox closed connection, call
+ * sys_ipc_hangup() to close the connection.
+ * Used by answerbox to close the connection.
+ */
+	EHANGUP       = -7,
+
+/*
+ * The other party encountered an error when
+ * receiving the call.
+ */
+	EPARTY        = -8,
+
+	EEXIST        = -9,   /* Entry already exists */
+	EBADMEM       = -10,  /* Bad memory pointer */
+	ENOTSUP       = -11,  /* Not supported */
+	EADDRNOTAVAIL = -12,  /* Address not available. */
+	ETIMEOUT      = -13,  /* Timeout expired */
+	EINVAL        = -14,  /* Invalid value */
+	EBUSY         = -15,  /* Resource is busy */
+	EOVERFLOW     = -16,  /* The result does not fit its size. */
+	EINTR         = -17,  /* Operation was interrupted. */
+
+	EMFILE        = -18,
+	ENAMETOOLONG  = -256,
+	EISDIR        = -257,
+	ENOTDIR       = -258,
+	ENOSPC        = -259,
+	ENOTEMPTY     = -261,
+	EBADF         = -262,
+	EDOM          = -263,
+	ERANGE        = -264,
+	EXDEV         = -265,
+	EIO           = -266,
+	EMLINK        = -267,
+	ENXIO         = -268,
+	ENOFS         = -269,
+
+/** Bad checksum. */
+	EBADCHECKSUM  = -300,
+
+/** USB: stalled operation. */
+	ESTALL        = -301,
+
+/** Empty resource (no data). */
+	EEMPTY        = -302,
+
+/** Negative acknowledgment. */
+	ENAK          = -303,
+
+/** The requested operation was not performed. Try again later. */
+	EAGAIN        = -11002,
+} errno_t;
 
 
-/* POSIX error codes + whatever nonstandard names crop up in third-party
- * software. These are not used in HelenOS code, but are defined here in
- * order to avoid nasty hacks in libposix.
- *
- * If you decide to use one of these in native HelenOS code,
- * move it up to the first group.
+#endif
+
+/** @}
  */
-
-/* COMPAT_START -- do not remove or edit this comment */
-
-#define E2BIG             __errno_t(  101)
-#define EACCES            __errno_t(  102)
-#define EADDRINUSE        __errno_t(  103)
-#define EAFNOSUPPORT      __errno_t(  105)
-#define EALREADY          __errno_t(  107)
-#define EBADMSG           __errno_t(  109)
-#define ECANCELED         __errno_t(  111)
-#define ECHILD            __errno_t(  112)
-#define ECONNABORTED      __errno_t(  113)
-#define ECONNREFUSED      __errno_t(  114)
-#define ECONNRESET        __errno_t(  115)
-#define EDEADLK           __errno_t(  116)
-#define EDESTADDRREQ      __errno_t(  117)
-#define EDQUOT            __errno_t(  119)
-#define EFAULT            __errno_t(  121)
-#define EFBIG             __errno_t(  122)
-#define EHOSTUNREACH      __errno_t(  123)
-#define EIDRM             __errno_t(  124)
-#define EILSEQ            __errno_t(  125)
-#define EINPROGRESS       __errno_t(  126)
-#define EISCONN           __errno_t(  130)
-#define ELOOP             __errno_t(  132)
-#define EMSGSIZE          __errno_t(  135)
-#define EMULTIHOP         __errno_t(  136)
-#define ENETDOWN          __errno_t(  138)
-#define ENETRESET         __errno_t(  139)
-#define ENETUNREACH       __errno_t(  140)
-#define ENFILE            __errno_t(  141)
-#define ENOBUFS           __errno_t(  142)
-#define ENODATA           __errno_t(  143)
-#define ENODEV            __errno_t(  144)
-#define ENOEXEC           __errno_t(  146)
-#define ENOLCK            __errno_t(  147)
-#define ENOLINK           __errno_t(  148)
-#define ENOMSG            __errno_t(  150)
-#define ENOPROTOOPT       __errno_t(  151)
-#define ENOSR             __errno_t(  153)
-#define ENOSTR            __errno_t(  154)
-#define ENOSYS            __errno_t(  155)
-#define ENOTCONN          __errno_t(  156)
-#define ENOTRECOVERABLE   __errno_t(  159)
-#define ENOTSOCK          __errno_t(  160)
-#define ENOTTY            __errno_t(  162)
-#define EOPNOTSUPP        __errno_t(  164)
-#define EOWNERDEAD        __errno_t(  166)
-#define EPIPE             __errno_t(  168)
-#define EPROTO            __errno_t(  169)
-#define EPROTONOSUPPORT   __errno_t(  170)
-#define EPROTOTYPE        __errno_t(  171)
-#define EROFS             __errno_t(  173)
-#define ESPIPE            __errno_t(  174)
-#define ESRCH             __errno_t(  175)
-#define ESTALE            __errno_t(  176)
-#define ETIME             __errno_t(  177)
-#define ETIMEDOUT         __errno_t(  178)
-#define ETXTBSY           __errno_t(  179)
-#define EWOULDBLOCK       __errno_t(  180)
Index: i/include/abi/errno.in
===================================================================
--- abi/include/abi/errno.in	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,116 +1,0 @@
-__errno_entry(EOK            ,      0, "No error")
-__errno_entry(ENOENT         ,      1, "No such entry")
-__errno_entry(ENOMEM         ,      2, "Not enough memory")
-__errno_entry(ELIMIT         ,      3, "Limit exceeded")
-__errno_entry(EREFUSED       ,      4, "Connection refused")
-__errno_entry(EFORWARD       ,      5, "Forwarding error")
-__errno_entry(EPERM          ,      6, "Permission denied")
-__errno_entry(EHANGUP        ,      7, "Answerbox closed connection")
-__errno_entry(EPARTY         ,      8, "Other party encountered an error")
-__errno_entry(EEXIST         ,      9, "Entry already exists")
-__errno_entry(EBADMEM        ,     10, "Bad memory pointer")
-__errno_entry(ENOTSUP        ,     11, "Operation not supported")
-__errno_entry(EADDRNOTAVAIL  ,     12, "Address not available")
-__errno_entry(ETIMEOUT       ,     13, "Timeout expired")
-__errno_entry(EINVAL         ,     14, "Invalid value")
-__errno_entry(EBUSY          ,     15, "Resource is busy")
-__errno_entry(EOVERFLOW      ,     16, "Result does not fit its size")
-__errno_entry(EINTR          ,     17, "Operation interrupted")
-__errno_entry(EMFILE         ,     18, "Too many open files")
-__errno_entry(ENAMETOOLONG   ,     19, "Name is too long")
-__errno_entry(EISDIR         ,     20, "Entry is a directory")
-__errno_entry(ENOTDIR        ,     21, "Entry is not a directory")
-__errno_entry(ENOSPC         ,     22, "No space left")
-__errno_entry(ENOTEMPTY      ,     23, "Directory is not empty")
-__errno_entry(EBADF          ,     24, "Bad object handle")
-__errno_entry(EDOM           ,     25, "Mathematics argument out of domain of function")
-__errno_entry(ERANGE         ,     26, "Value out of range")
-__errno_entry(EXDEV          ,     27, "Prohibited cross-device link")
-__errno_entry(EIO            ,     28, "Input/output error")
-__errno_entry(EMLINK         ,     29, "Too many links")
-__errno_entry(ENXIO          ,     30, "Device or address does not exist")
-__errno_entry(ENOFS          ,     31, "No such file system type")
-__errno_entry(EBADCHECKSUM   ,     32, "Bad checksum")
-__errno_entry(ESTALL         ,     33, "USB: Operation stalled")
-__errno_entry(EEMPTY         ,     34, "Resource is empty")
-__errno_entry(ENAK           ,     35, "Negative acknowledgement")
-__errno_entry(EAGAIN         ,     36, "Operation could not proceed, try again")
-
-/* libhttp error codes. Defining them here is a temporary hack. */
-
-__errno_entry(HTTP_EMULTIPLE_HEADERS ,  50, "HTTP: Multiple headers")
-__errno_entry(HTTP_EMISSING_HEADER   ,  51, "HTTP: Missing header")
-__errno_entry(HTTP_EPARSE            ,  52, "HTTP: Parse error")
-
-/* libext4 error codes. Same as above. */
-
-__errno_entry(EXT4_ERR_BAD_DX_DIR    ,  60, "EXT4: Filesystem corrupted")
-
-
-/* POSIX error codes + whatever nonstandard names crop up in third-party
- * software. These are not used in HelenOS code, but are defined here in
- * order to avoid nasty hacks in libposix.
- *
- * If you decide to use one of these in native HelenOS code,
- * move it up to the first group.
- */
-
-/* COMPAT_START -- do not remove or edit this comment */
-
-__errno_entry(E2BIG            ,  101, "Argument list too long")
-__errno_entry(EACCES           ,  102, "Permission denied")
-__errno_entry(EADDRINUSE       ,  103, "Address in use")
-__errno_entry(EAFNOSUPPORT     ,  105, "Address family not supported")
-__errno_entry(EALREADY         ,  107, "Connection already in progress")
-__errno_entry(EBADMSG          ,  109, "Bad message")
-__errno_entry(ECANCELED        ,  111, "Operation canceled")
-__errno_entry(ECHILD           ,  112, "No child processes")
-__errno_entry(ECONNABORTED     ,  113, "Connection aborted")
-__errno_entry(ECONNREFUSED     ,  114, "Connection refused")
-__errno_entry(ECONNRESET       ,  115, "Connection reset")
-__errno_entry(EDEADLK          ,  116, "Resource deadlock would occur")
-__errno_entry(EDESTADDRREQ     ,  117, "Destination address required")
-__errno_entry(EDQUOT           ,  119, "Reserved")
-__errno_entry(EFAULT           ,  121, "Bad address")
-__errno_entry(EFBIG            ,  122, "File too large")
-__errno_entry(EHOSTUNREACH     ,  123, "Host is unreachable")
-__errno_entry(EIDRM            ,  124, "Identifier removed")
-__errno_entry(EILSEQ           ,  125, "Illegal byte sequence")
-__errno_entry(EINPROGRESS      ,  126, "Operation in progress")
-__errno_entry(EISCONN          ,  130, "Socket is connected")
-__errno_entry(ELOOP            ,  132, "Too many levels of symbolic links")
-__errno_entry(EMSGSIZE         ,  135, "Message too large")
-__errno_entry(EMULTIHOP        ,  136, "Reserved")
-__errno_entry(ENETDOWN         ,  138, "Network is down")
-__errno_entry(ENETRESET        ,  139, "Connection aborted by network")
-__errno_entry(ENETUNREACH      ,  140, "Network unreachable")
-__errno_entry(ENFILE           ,  141, "Too many files open in system")
-__errno_entry(ENOBUFS          ,  142, "No buffer space available")
-__errno_entry(ENODATA          ,  143, "No message is available on the STREAM head read queue")
-__errno_entry(ENODEV           ,  144, "No such device")
-__errno_entry(ENOEXEC          ,  146, "Executable file format error")
-__errno_entry(ENOLCK           ,  147, "No locks available")
-__errno_entry(ENOLINK          ,  148, "Reserved")
-__errno_entry(ENOMSG           ,  150, "No message of the desired type")
-__errno_entry(ENOPROTOOPT      ,  151, "Protocol not available")
-__errno_entry(ENOSR            ,  153, "No STREAM resources.")
-__errno_entry(ENOSTR           ,  154, "Not a STREAM")
-__errno_entry(ENOSYS           ,  155, "Function not supported")
-__errno_entry(ENOTCONN         ,  156, "The socket is not connected")
-__errno_entry(ENOTRECOVERABLE  ,  159, "State not recoverable")
-__errno_entry(ENOTSOCK         ,  160, "Not a socket")
-__errno_entry(ENOTTY           ,  162, "Inappropriate I/O control operation")
-__errno_entry(EOPNOTSUPP       ,  164, "Operation not supported")
-__errno_entry(EOWNERDEAD       ,  166, "Previous owned died")
-__errno_entry(EPIPE            ,  168, "Broken pipe")
-__errno_entry(EPROTO           ,  169, "Protocol error")
-__errno_entry(EPROTONOSUPPORT  ,  170, "Protocol not supported")
-__errno_entry(EPROTOTYPE       ,  171, "Protocol wrong type for socket")
-__errno_entry(EROFS            ,  173, "Read-only file system")
-__errno_entry(ESPIPE           ,  174, "Invalid seek")
-__errno_entry(ESRCH            ,  175, "No such process")
-__errno_entry(ESTALE           ,  176, "Reserved")
-__errno_entry(ETIME            ,  177, "Stream ioctl() timeout")
-__errno_entry(ETIMEDOUT        ,  178, "Connection timed out")
-__errno_entry(ETXTBSY          ,  179, "Text file busy")
-__errno_entry(EWOULDBLOCK      ,  180, "Operation would block")
Index: abi/include/abi/ipc/ipc.h
===================================================================
--- abi/include/abi/ipc/ipc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ abi/include/abi/ipc/ipc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,7 +60,4 @@
 #define IPC_CALL_NOTIF           (1 << 3)
 
-/** The call was automatically answered by the kernel due to error */
-#define IPC_CALL_AUTO_REPLY      (1 << 4)
-
 /**
  * Maximum buffer size allowed for IPC_M_DATA_WRITE and
@@ -70,5 +67,5 @@
 
 /* Macros for manipulating calling data */
-#define IPC_SET_RETVAL(data, retval)  ((data).args[0] = (sysarg_t) (retval))
+#define IPC_SET_RETVAL(data, retval)  ((data).args[0] = (retval))
 #define IPC_SET_IMETHOD(data, val)    ((data).args[0] = (val))
 #define IPC_SET_ARG1(data, val)       ((data).args[1] = (val))
@@ -79,5 +76,5 @@
 
 #define IPC_GET_IMETHOD(data)  ((data).args[0])
-#define IPC_GET_RETVAL(data)   ((errno_t) (data).args[0])
+#define IPC_GET_RETVAL(data)   ((data).args[0])
 
 #define IPC_GET_ARG1(data)  ((data).args[1])
Index: abi/include/abi/ipc/methods.h
===================================================================
--- abi/include/abi/ipc/methods.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ abi/include/abi/ipc/methods.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -108,5 +108,5 @@
 	 *
 	 * - ARG1 - source user page address
-	 */
+	 */ 
 	IPC_M_PAGE_IN,
 
Index: abi/include/abi/proc/uarg.h
===================================================================
--- abi/include/abi/proc/uarg.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ abi/include/abi/proc/uarg.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,5 @@
 	size_t uspace_stack_size;
 	
-	void (*uspace_thread_function)(void *);
+	void (* uspace_thread_function)(void *);
 	void *uspace_thread_arg;
 	
Index: abi/include/abi/synch.h
===================================================================
--- abi/include/abi/synch.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ abi/include/abi/synch.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,4 +46,21 @@
 #define SYNCH_FLAGS_INTERRUPTIBLE  (1 << 1)
 
+/** Could not satisfy the request without going to sleep. */
+#define ESYNCH_WOULD_BLOCK  1
+/** Timeout occurred. */
+#define ESYNCH_TIMEOUT      2
+/** Sleep was interrupted. */
+#define ESYNCH_INTERRUPTED  4
+/** Operation succeeded without sleeping. */
+#define ESYNCH_OK_ATOMIC    8
+/** Operation succeeded and did sleep. */
+#define ESYNCH_OK_BLOCKED   16
+
+#define SYNCH_FAILED(rc) \
+	((rc) & (ESYNCH_WOULD_BLOCK | ESYNCH_TIMEOUT | ESYNCH_INTERRUPTED))
+
+#define SYNCH_OK(rc) \
+	((rc) & (ESYNCH_OK_ATOMIC | ESYNCH_OK_BLOCKED))
+
 #endif
 
Index: boot/arch/arm32/include/arch/arch.h
===================================================================
--- boot/arch/arm32/include/arch/arch.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ boot/arch/arm32/include/arch/arch.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,15 +55,15 @@
 
 #ifdef MACHINE_beagleboardxm
-#define PA_OFFSET 0
+	#define PA_OFFSET 0
 #elif defined MACHINE_beaglebone
-#define PA_OFFSET 0
+	#define PA_OFFSET 0
 #else
-#define PA_OFFSET 0x80000000
+	#define PA_OFFSET 0x80000000
 #endif
 
 #ifndef __ASM__
-#define PA2KA(addr)  (((uintptr_t) (addr)) + PA_OFFSET)
+	#define PA2KA(addr)  (((uintptr_t) (addr)) + PA_OFFSET)
 #else
-#define PA2KA(addr)  ((addr) + PA_OFFSET)
+	#define PA2KA(addr)  ((addr) + PA_OFFSET)
 #endif
 
Index: boot/arch/mips32/include/arch/arch.h
===================================================================
--- boot/arch/mips32/include/arch/arch.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ boot/arch/mips32/include/arch/arch.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,11 +56,11 @@
 
 #ifndef __ASM__
-#define PA2KA(addr)    (((uintptr_t) (addr)) + 0x80000000)
-#define PA2KSEG(addr)  (((uintptr_t) (addr)) + 0xa0000000)
-#define KA2PA(addr)    (((uintptr_t) (addr)) - 0x80000000)
-#define KSEG2PA(addr)  (((uintptr_t) (addr)) - 0xa0000000)
+	#define PA2KA(addr)    (((uintptr_t) (addr)) + 0x80000000)
+	#define PA2KSEG(addr)  (((uintptr_t) (addr)) + 0xa0000000)
+	#define KA2PA(addr)    (((uintptr_t) (addr)) - 0x80000000)
+	#define KSEG2PA(addr)  (((uintptr_t) (addr)) - 0xa0000000)
 #else
-#define PA2KA(addr)    ((addr) + 0x80000000)
-#define KSEG2PA(addr)  ((addr) - 0xa0000000)
+	#define PA2KA(addr)    ((addr) + 0x80000000)
+	#define KSEG2PA(addr)  ((addr) - 0xa0000000)
 #endif
 
Index: boot/arch/ppc32/include/arch/arch.h
===================================================================
--- boot/arch/ppc32/include/arch/arch.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ boot/arch/ppc32/include/arch/arch.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,7 +38,7 @@
 
 #ifndef __ASM__
-#define PA2KA(addr)  (((uintptr_t) (addr)) + 0x80000000)
+	#define PA2KA(addr)  (((uintptr_t) (addr)) + 0x80000000)
 #else
-#define PA2KA(addr)  ((addr) + 0x80000000)
+	#define PA2KA(addr)  ((addr) + 0x80000000)
 #endif
 
Index: boot/arch/riscv64/include/arch/mm.h
===================================================================
--- boot/arch/riscv64/include/arch/mm.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ boot/arch/riscv64/include/arch/mm.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,9 +34,9 @@
 
 #ifndef __ASM__
-#define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffff800000000000))
-#define PA2KA(x)  (((uintptr_t) (x)) + UINT64_C(0xffff800000000000))
+	#define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffff800000000000))
+	#define PA2KA(x)  (((uintptr_t) (x)) + UINT64_C(0xffff800000000000))
 #else
-#define KA2PA(x)  ((x) - 0xffff800000000000)
-#define PA2KA(x)  ((x) + 0xffff800000000000)
+	#define KA2PA(x)  ((x) - 0xffff800000000000)
+	#define PA2KA(x)  ((x) + 0xffff800000000000)
 #endif
 
Index: boot/generic/include/printf.h
===================================================================
--- boot/generic/include/printf.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ boot/generic/include/printf.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 extern int puts(const char *);
 extern int printf(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
+    PRINTF_ATTRIBUTE(1, 2);
 extern int vprintf(const char *, va_list);
 
Index: boot/generic/include/printf_verify.h
===================================================================
--- boot/generic/include/printf_verify.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ boot/generic/include/printf_verify.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -33,14 +33,14 @@
 #define BOOT_PRINTF_VERIFY_H_
 
-#ifndef _HELENOS_NVERIFY_PRINTF
+#ifndef NVERIFY_PRINTF
 
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
+#define PRINTF_ATTRIBUTE(start, end) \
 	__attribute__((format(gnu_printf, start, end)))
 
-#else /* _HELENOS_NVERIFY_PRINTF */
+#else /* NVERIFY_PRINTF */
 
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end)
+#define PRINTF_ATTRIBUTE(start, end)
 
-#endif /* _HELENOS_NVERIFY_PRINTF */
+#endif /* NVERIFY_PRINTF */
 
 #endif
Index: contrib/arch/uspace/srv/vfs/vfs.bp
===================================================================
--- contrib/arch/uspace/srv/vfs/vfs.bp	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ contrib/arch/uspace/srv/vfs/vfs.bp	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -129,9 +129,9 @@
 	?fstat {
 		tentative {
-			?ipc_m_data_read /* vfs_stat_t */ {
+			?ipc_m_data_read /* struct stat */ {
 				alternative (fs; tmpfs; fat; devfs) {
 					[fnc.vfs_grab_phone] ;
 					!fs.stat {
-						!fs.ipc_m_data_read /* forward vfs_stat_t */
+						!fs.ipc_m_data_read /* forward struct stat */
 					} ;
 					[fnc.vfs_release_phone]
@@ -144,10 +144,10 @@
 		?ipc_m_data_write /* path */ ;
 		tentative {
-			?ipc_m_data_read /* vfs_stat_t */ {
+			?ipc_m_data_read /* struct stat */ {
 				alternative (fs; tmpfs; fat; devfs) {
 					[fnc.vfs_lookup_internal] ;
 					tentative {
 						!fs.stat {
-							!fs.ipc_m_data_read /* forward vfs_stat_t */
+							!fs.ipc_m_data_read /* forward struct stat */
 						}
 					}
Index: contrib/qemu/build-from-scratch.sh
===================================================================
--- contrib/qemu/build-from-scratch.sh	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ contrib/qemu/build-from-scratch.sh	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -29,5 +29,5 @@
 #
 
-VERSION=2.11.0
+VERSION=2.10.0
 BASENAME=qemu-${VERSION}
 BASENAME_MASTER=qemu-master
@@ -36,5 +36,5 @@
 URL=http://wiki.qemu-project.org/download/${TARBALL}
 REPO=git://git.qemu.org/qemu.git
-MD5="335994a755bc655e88a87aeb36bfc0b9"
+MD5="ca73441de73a9b52c6c49c97190d2185"
 
 OPENSPARC_TARBALL="OpenSPARCT1_Arch.1.5.tar.bz2"
Index: kernel/Makefile
===================================================================
--- kernel/Makefile	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/Makefile	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -90,5 +90,5 @@
 
 COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
-	-ffreestanding -nostdlib -nostdinc \
+	-ffreestanding -fno-builtin -nostdlib -nostdinc \
 	-fexec-charset=UTF-8 -finput-charset=UTF-8 -fno-common \
 	-fdebug-prefix-map=$(realpath $(ROOT_PATH))=.
@@ -208,10 +208,9 @@
 	generic/src/mm/backend_user.c \
 	generic/src/mm/slab.c \
-	generic/src/lib/halt.c \
+	generic/src/lib/func.c \
 	generic/src/lib/mem.c \
 	generic/src/lib/memfnc.c \
 	generic/src/lib/gsort.c \
 	generic/src/lib/str.c \
-	generic/src/lib/str_error.c \
 	generic/src/lib/elf.c \
 	generic/src/lib/ra.c \
Index: kernel/arch/abs32le/include/arch/mm/as.h
===================================================================
--- kernel/arch/abs32le/include/arch/mm/as.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/abs32le/include/arch/mm/as.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,7 +48,7 @@
 #include <genarch/mm/as_pt.h>
 
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
+#define as_constructor_arch(as, flags)  (as != as)
+#define as_destructor_arch(as)          (as != as)
+#define as_create_arch(as, flags)       (as != as)
 #define as_install_arch(as)
 #define as_deinstall_arch(as)
Index: kernel/arch/abs32le/src/abs32le.c
===================================================================
--- kernel/arch/abs32le/src/abs32le.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/abs32le/src/abs32le.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include <arch/asm.h>
 
-#include <halt.h>
+#include <func.h>
 #include <config.h>
 #include <console/console.h>
@@ -105,5 +105,5 @@
 int context_save_arch(context_t *ctx)
 {
-	return EOK;
+	return 1;
 }
 
@@ -125,10 +125,10 @@
 }
 
-errno_t memcpy_from_uspace(void *dst, const void *uspace_src, size_t size)
+int memcpy_from_uspace(void *dst, const void *uspace_src, size_t size)
 {
 	return EOK;
 }
 
-errno_t memcpy_to_uspace(void *uspace_dst, const void *src, size_t size)
+int memcpy_to_uspace(void *uspace_dst, const void *src, size_t size)
 {
 	return EOK;
Index: kernel/arch/abs32le/src/mm/page.c
===================================================================
--- kernel/arch/abs32le/src/mm/page.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/abs32le/src/mm/page.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 #include <align.h>
 #include <config.h>
-#include <halt.h>
+#include <func.h>
 #include <arch/interrupt.h>
 #include <arch/asm.h>
Index: kernel/arch/amd64/Makefile.inc
===================================================================
--- kernel/arch/amd64/Makefile.inc	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/amd64/Makefile.inc	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -32,5 +32,5 @@
 
 FPU_NO_CFLAGS = -mno-sse -mno-sse2
-COMMON_CFLAGS += -mcmodel=$(MEMORY_MODEL) -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer
+COMMON_CFLAGS += -m64 -mcmodel=$(MEMORY_MODEL) -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer
 
 BITS = 64
Index: kernel/arch/amd64/include/arch/interrupt.h
===================================================================
--- kernel/arch/amd64/include/arch/interrupt.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/amd64/include/arch/interrupt.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -83,7 +83,7 @@
 #define VECTOR_SMP_CALL_IPI       (IVT_FREEBASE + 3)
 
-extern void (*disable_irqs_function)(uint16_t);
-extern void (*enable_irqs_function)(uint16_t);
-extern void (*eoi_function)(void);
+extern void (* disable_irqs_function)(uint16_t);
+extern void (* enable_irqs_function)(uint16_t);
+extern void (* eoi_function)(void);
 extern const char *irqs_info;
 
Index: kernel/arch/amd64/include/arch/mm/as.h
===================================================================
--- kernel/arch/amd64/include/arch/mm/as.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/amd64/include/arch/mm/as.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,7 +46,7 @@
 #define USER_ADDRESS_SPACE_END_ARCH      UINT64_C(0x00007fffffffffff)
 
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
+#define as_constructor_arch(as, flags)  (as != as)
+#define as_destructor_arch(as)          (as != as)
+#define as_create_arch(as, flags)       (as != as)
 
 #define as_install_arch(as)
Index: kernel/arch/amd64/src/interrupt.c
===================================================================
--- kernel/arch/amd64/src/interrupt.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/amd64/src/interrupt.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include <panic.h>
 #include <arch/drivers/i8259.h>
-#include <halt.h>
+#include <func.h>
 #include <cpu.h>
 #include <arch/asm.h>
Index: kernel/arch/arm32/include/arch/cache.h
===================================================================
--- kernel/arch/arm32/include/arch/cache.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/arm32/include/arch/cache.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,10 +39,10 @@
 #include <typedefs.h>
 
-extern unsigned dcache_levels(void);
+unsigned dcache_levels(void);
 
-extern void dcache_flush(void);
-extern void dcache_flush_invalidate(void);
-extern void cpu_dcache_flush(void);
-extern void cpu_dcache_flush_invalidate(void);
+void dcache_flush(void);
+void dcache_flush_invalidate(void);
+void cpu_dcache_flush(void);
+void cpu_dcache_flush_invalidate(void);
 extern void icache_invalidate(void);
 extern void dcache_invalidate(void);
@@ -50,5 +50,5 @@
 
 #endif
-
 /** @}
  */
+
Index: kernel/arch/arm32/include/arch/elf.h
===================================================================
--- kernel/arch/arm32/include/arch/elf.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/arm32/include/arch/elf.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,7 +40,7 @@
 
 #ifdef __BE__
-#define ELF_DATA_ENCODING  ELFDATA2MSB
+	#define ELF_DATA_ENCODING  ELFDATA2MSB
 #else
-#define ELF_DATA_ENCODING  ELFDATA2LSB
+	#define ELF_DATA_ENCODING  ELFDATA2LSB
 #endif
 
Index: kernel/arch/arm32/include/arch/exception.h
===================================================================
--- kernel/arch/arm32/include/arch/exception.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/arm32/include/arch/exception.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,7 +45,7 @@
 
 #ifdef HIGH_EXCEPTION_VECTORS
-#define EXC_BASE_ADDRESS  0xffff0000
+	#define EXC_BASE_ADDRESS  0xffff0000
 #else
-#define EXC_BASE_ADDRESS  0x0
+	#define EXC_BASE_ADDRESS  0x0
 #endif
 
Index: kernel/arch/arm32/include/arch/mach/integratorcp/integratorcp.h
===================================================================
--- kernel/arch/arm32/include/arch/mach/integratorcp/integratorcp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/arm32/include/arch/mach/integratorcp/integratorcp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -77,22 +77,22 @@
 
 typedef struct {
-	uintptr_t uart;
-	uintptr_t kbd_ctrl;
-	uintptr_t kbd_stat;
-	uintptr_t kbd_data;
-	uintptr_t kbd_intstat;
-	uintptr_t rtc;
-	uintptr_t rtc1_load;
-	uintptr_t rtc1_read;
-	uintptr_t rtc1_ctl;
-	uintptr_t rtc1_intrclr;
-	uintptr_t rtc1_intrstat;
-	uintptr_t rtc1_bgload;
-	uintptr_t irqc;
-	uintptr_t irqc_mask;
-	uintptr_t irqc_unmask;
-	uintptr_t vga;
-	uintptr_t cmcr;
-	uintptr_t sdramcr;
+        uintptr_t uart;
+        uintptr_t kbd_ctrl;
+        uintptr_t kbd_stat;
+        uintptr_t kbd_data;
+        uintptr_t kbd_intstat;
+        uintptr_t rtc;
+        uintptr_t rtc1_load;
+        uintptr_t rtc1_read;
+        uintptr_t rtc1_ctl;
+        uintptr_t rtc1_intrclr;
+        uintptr_t rtc1_intrstat;
+        uintptr_t rtc1_bgload;
+        uintptr_t irqc;
+        uintptr_t irqc_mask;
+        uintptr_t irqc_unmask;
+        uintptr_t vga;
+        uintptr_t cmcr;
+        uintptr_t sdramcr;
 } icp_hw_map_t;
 
Index: kernel/arch/arm32/include/arch/machine_func.h
===================================================================
--- kernel/arch/arm32/include/arch/machine_func.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/arm32/include/arch/machine_func.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -108,5 +108,5 @@
 extern size_t machine_get_irq_count(void);
 
-extern const char *machine_get_platform_name(void);
+extern const char * machine_get_platform_name(void);
 
 #endif
Index: kernel/arch/arm32/include/arch/mm/as.h
===================================================================
--- kernel/arch/arm32/include/arch/mm/as.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/arm32/include/arch/mm/as.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,7 +49,7 @@
 #include <genarch/mm/as_pt.h>
 
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
+#define as_constructor_arch(as, flags)		(as != as)
+#define as_destructor_arch(as)			(as != as)
+#define as_create_arch(as, flags)		(as != as)
 #define as_deinstall_arch(as)
 #define as_invalidate_translation_cache(as, page, cnt)
Index: kernel/arch/arm32/include/arch/types.h
===================================================================
--- kernel/arch/arm32/include/arch/types.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/arm32/include/arch/types.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,7 +38,7 @@
 
 #ifndef DOXYGEN
-#define ATTRIBUTE_PACKED __attribute__((packed))
+	#define ATTRIBUTE_PACKED __attribute__((packed))
 #else
-#define ATTRIBUTE_PACKED
+	#define ATTRIBUTE_PACKED
 #endif
 
Index: kernel/arch/arm32/src/mach/beaglebone/beaglebone.c
===================================================================
--- kernel/arch/arm32/src/mach/beaglebone/beaglebone.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/arm32/src/mach/beaglebone/beaglebone.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -123,5 +123,5 @@
 {
 	unsigned sysclk_freq;
-	errno_t rc;
+	int rc;
 
 	/* Initialize the IRQ */
Index: kernel/arch/ia32/Makefile.inc
===================================================================
--- kernel/arch/ia32/Makefile.inc	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/ia32/Makefile.inc	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,5 +34,5 @@
 ENDIANESS = LE
 
-COMMON_CFLAGS += -fno-omit-frame-pointer
+COMMON_CFLAGS += -m32 -fno-omit-frame-pointer
 
 ## Accepted CPUs
Index: kernel/arch/ia32/include/arch/interrupt.h
===================================================================
--- kernel/arch/ia32/include/arch/interrupt.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/ia32/include/arch/interrupt.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -85,7 +85,7 @@
 #define VECTOR_SMP_CALL_IPI       (IVT_FREEBASE + 3)
 
-extern void (*disable_irqs_function)(uint16_t);
-extern void (*enable_irqs_function)(uint16_t);
-extern void (*eoi_function)(void);
+extern void (* disable_irqs_function)(uint16_t);
+extern void (* enable_irqs_function)(uint16_t);
+extern void (* eoi_function)(void);
 extern const char *irqs_info;
 
Index: kernel/arch/ia32/include/arch/mm/as.h
===================================================================
--- kernel/arch/ia32/include/arch/mm/as.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/ia32/include/arch/mm/as.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,7 +48,7 @@
 #include <genarch/mm/as_pt.h>
 
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
+#define as_constructor_arch(as, flags)  (as != as)
+#define as_destructor_arch(as)          (as != as)
+#define as_create_arch(as, flags)       (as != as)
 #define as_install_arch(as)
 #define as_deinstall_arch(as)
Index: kernel/arch/ia32/include/arch/smp/smp.h
===================================================================
--- kernel/arch/ia32/include/arch/smp/smp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/ia32/include/arch/smp/smp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 struct smp_config_operations {
 	/** Check whether a processor is enabled. */
-	bool (*cpu_enabled)(size_t);
+	bool (* cpu_enabled)(size_t);
 	
 	/** Check whether a processor is BSP. */
Index: kernel/arch/ia32/src/interrupt.c
===================================================================
--- kernel/arch/ia32/src/interrupt.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/ia32/src/interrupt.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include <panic.h>
 #include <arch/drivers/i8259.h>
-#include <halt.h>
+#include <func.h>
 #include <cpu.h>
 #include <arch/asm.h>
Index: kernel/arch/ia32/src/mm/page.c
===================================================================
--- kernel/arch/ia32/src/mm/page.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/ia32/src/mm/page.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 #include <align.h>
 #include <config.h>
-#include <halt.h>
+#include <func.h>
 #include <arch/interrupt.h>
 #include <arch/asm.h>
Index: kernel/arch/ia32/src/smp/mps.c
===================================================================
--- kernel/arch/ia32/src/smp/mps.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/ia32/src/smp/mps.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 #include <arch/smp/smp.h>
 #include <assert.h>
-#include <halt.h>
+#include <func.h>
 #include <typedefs.h>
 #include <cpu.h>
@@ -91,5 +91,5 @@
 		return false;
 	
-	return ((processor_entries[i].cpu_flags & 0x01) == 0x01);
+	return (bool) ((processor_entries[i].cpu_flags & 0x01) == 0x01);
 }
 
@@ -98,5 +98,5 @@
 	assert(i < processor_entry_cnt);
 	
-	return ((processor_entries[i].cpu_flags & 0x02) == 0x02);
+	return (bool) ((processor_entries[i].cpu_flags & 0x02) == 0x02);
 }
 
Index: kernel/arch/ia32/src/smp/smp.c
===================================================================
--- kernel/arch/ia32/src/smp/smp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/ia32/src/smp/smp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,4 @@
 #include <arch/boot/boot.h>
 #include <assert.h>
-#include <errno.h>
 #include <genarch/acpi/acpi.h>
 #include <genarch/acpi/madt.h>
@@ -45,5 +44,5 @@
 #include <synch/waitq.h>
 #include <arch/pm.h>
-#include <halt.h>
+#include <func.h>
 #include <panic.h>
 #include <arch/asm.h>
@@ -179,5 +178,5 @@
 			 */
 			if (waitq_sleep_timeout(&ap_completion_wq, 1000000,
-			    SYNCH_FLAGS_NONE, NULL) == ETIMEOUT) {
+			    SYNCH_FLAGS_NONE) == ESYNCH_TIMEOUT) {
 				log(LF_ARCH, LVL_NOTE, "%s: waiting for cpu%u "
 				    "(APIC ID = %d) timed out", __FUNCTION__,
Index: kernel/arch/ia64/include/arch/mm/as.h
===================================================================
--- kernel/arch/ia64/include/arch/mm/as.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/ia64/include/arch/mm/as.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,7 +48,7 @@
 #include <genarch/mm/as_ht.h>
 
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
+#define as_constructor_arch(as, flags)  (as != as)
+#define as_destructor_arch(as)          (as != as)
+#define as_create_arch(as, flags)       (as != as)
 #define as_deinstall_arch(as)
 #define as_invalidate_translation_cache(as, page, cnt)
Index: kernel/arch/ia64/src/ddi/ddi.c
===================================================================
--- kernel/arch/ia64/src/ddi/ddi.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/ia64/src/ddi/ddi.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,5 +53,5 @@
  * @return EOK on success or an error code from errno.h.
  */
-errno_t ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
+int ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
 {
 	if (!task->arch.iomap) {
@@ -85,5 +85,5 @@
  * @return EOK on success or an error code from errno.h.
  */
-errno_t ddi_iospace_disable_arch(task_t *task, uintptr_t ioaddr, size_t size)
+int ddi_iospace_disable_arch(task_t *task, uintptr_t ioaddr, size_t size)
 {
 	if (!task->arch.iomap)
Index: kernel/arch/mips32/include/arch/elf.h
===================================================================
--- kernel/arch/mips32/include/arch/elf.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/mips32/include/arch/elf.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,7 +39,7 @@
 
 #ifdef __BE__
-#define ELF_DATA_ENCODING  ELFDATA2MSB
+	#define ELF_DATA_ENCODING  ELFDATA2MSB
 #else
-#define ELF_DATA_ENCODING  ELFDATA2LSB
+	#define ELF_DATA_ENCODING  ELFDATA2LSB
 #endif
 
Index: kernel/arch/mips32/include/arch/mm/as.h
===================================================================
--- kernel/arch/mips32/include/arch/mm/as.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/mips32/include/arch/mm/as.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,7 +48,7 @@
 #include <genarch/mm/as_pt.h>
 
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
+#define as_constructor_arch(as, flags)		(as != as)
+#define as_destructor_arch(as)			(as != as)
+#define as_create_arch(as, flags)		(as != as)
 #define as_deinstall_arch(as)
 #define as_invalidate_translation_cache(as, page, cnt)
Index: kernel/arch/mips32/src/debugger.c
===================================================================
--- kernel/arch/mips32/src/debugger.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/mips32/src/debugger.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 #include <arch.h>
 #include <arch/cp0.h>
-#include <halt.h>
+#include <func.h>
 #include <symtab.h>
 
Index: kernel/arch/mips32/src/exception.c
===================================================================
--- kernel/arch/mips32/src/exception.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/mips32/src/exception.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 #include <print.h>
 #include <interrupt.h>
-#include <halt.h>
+#include <func.h>
 #include <ddi/irq.h>
 #include <arch/debugger.h>
Index: kernel/arch/ppc32/include/arch/mm/as.h
===================================================================
--- kernel/arch/ppc32/include/arch/mm/as.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/ppc32/include/arch/mm/as.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,7 +50,7 @@
 #include <genarch/mm/as_pt.h>
 
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
+#define as_constructor_arch(as, flags)  (as != as)
+#define as_destructor_arch(as)          (as != as)
+#define as_create_arch(as, flags)       (as != as)
 #define as_deinstall_arch(as)
 
Index: kernel/arch/riscv64/include/arch/mm/as.h
===================================================================
--- kernel/arch/riscv64/include/arch/mm/as.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/riscv64/include/arch/mm/as.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,7 +51,7 @@
 #include <genarch/mm/as_pt.h>
 
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
+#define as_constructor_arch(as, flags)  (as != as)
+#define as_destructor_arch(as)          (as != as)
+#define as_create_arch(as, flags)       (as != as)
 #define as_deinstall_arch(as)
 #define as_invalidate_translation_cache(as, page, cnt)
Index: kernel/arch/riscv64/src/mm/page.c
===================================================================
--- kernel/arch/riscv64/src/mm/page.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/riscv64/src/mm/page.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 #include <align.h>
 #include <config.h>
-#include <halt.h>
+#include <func.h>
 #include <arch/interrupt.h>
 #include <arch/asm.h>
Index: kernel/arch/riscv64/src/riscv64.c
===================================================================
--- kernel/arch/riscv64/src/riscv64.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/riscv64/src/riscv64.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include <arch/drivers/ucb.h>
 
-#include <halt.h>
+#include <func.h>
 #include <config.h>
 #include <errno.h>
@@ -143,10 +143,10 @@
 }
 
-errno_t memcpy_from_uspace(void *dst, const void *uspace_src, size_t size)
+int memcpy_from_uspace(void *dst, const void *uspace_src, size_t size)
 {
 	return EOK;
 }
 
-errno_t memcpy_to_uspace(void *uspace_dst, const void *src, size_t size)
+int memcpy_to_uspace(void *uspace_dst, const void *src, size_t size)
 {
 	return EOK;
Index: kernel/arch/sparc64/include/arch/drivers/pci.h
===================================================================
--- kernel/arch/sparc64/include/arch/drivers/pci.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/sparc64/include/arch/drivers/pci.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,6 +52,6 @@
 
 struct pci_operations {
-	void (*enable_interrupt)(pci_t *, int);
-	void (*clear_interrupt)(pci_t *, int);
+	void (* enable_interrupt)(pci_t *, int);
+	void (* clear_interrupt)(pci_t *, int);
 };
 
Index: kernel/arch/sparc64/include/arch/mm/cache_spec.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/cache_spec.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/sparc64/include/arch/mm/cache_spec.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,7 +47,7 @@
 
 #if defined (US)
-#define DCACHE_SIZE  (16 * 1024)
+	#define DCACHE_SIZE  (16 * 1024)
 #elif defined (US3)
-#define DCACHE_SIZE  (64 * 1024)
+	#define DCACHE_SIZE  (64 * 1024)
 #endif
 
Index: kernel/arch/sparc64/include/arch/sun4v/md.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4v/md.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/sparc64/include/arch/sun4v/md.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,7 +54,7 @@
 const char *md_get_node_name(md_node_t node);
 bool md_get_integer_property(md_node_t node, const char *key,
-    uint64_t *result);
+	uint64_t *result);
 bool md_get_string_property(md_node_t node, const char *key,
-    const char **result);
+	const char **result);
 bool md_next_node(md_node_t *node, const char *name);
 void md_init(void);
Index: kernel/arch/sparc64/src/mm/sun4u/as.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4u/as.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/sparc64/src/mm/sun4u/as.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,10 +60,10 @@
 }
 
-errno_t as_constructor_arch(as_t *as, unsigned int flags)
+int as_constructor_arch(as_t *as, unsigned int flags)
 {
 #ifdef CONFIG_TSB
 	uintptr_t tsb_base = frame_alloc(TSB_FRAMES, flags, TSB_SIZE - 1);
 	if (!tsb_base)
-		return ENOMEM;
+		return -1;
 
 	tsb_entry_t *tsb = (tsb_entry_t *) PA2KA(tsb_base);
@@ -74,5 +74,5 @@
 #endif
 	
-	return EOK;
+	return 0;
 }
 
@@ -88,5 +88,5 @@
 }
 
-errno_t as_create_arch(as_t *as, unsigned int flags)
+int as_create_arch(as_t *as, unsigned int flags)
 {
 #ifdef CONFIG_TSB
Index: kernel/arch/sparc64/src/mm/sun4v/as.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4v/as.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/sparc64/src/mm/sun4v/as.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -63,10 +63,10 @@
 }
 
-errno_t as_constructor_arch(as_t *as, unsigned int flags)
+int as_constructor_arch(as_t *as, unsigned int flags)
 {
 #ifdef CONFIG_TSB
 	uintptr_t tsb_base = frame_alloc(TSB_FRAMES, flags, TSB_SIZE - 1);
 	if (!tsb_base)
-		return ENOMEM;
+		return -1;
 
 	tsb_entry_t *tsb = (tsb_entry_t *) PA2KA(tsb_base);
@@ -83,5 +83,5 @@
 #endif
 	
-	return EOK;
+	return 0;
 }
 
@@ -97,5 +97,5 @@
 }
 
-errno_t as_create_arch(as_t *as, unsigned int flags)
+int as_create_arch(as_t *as, unsigned int flags)
 {
 #ifdef CONFIG_TSB
@@ -103,5 +103,5 @@
 #endif
 	
-	return EOK;
+	return 0;
 }
 
Index: kernel/arch/sparc64/src/smp/sun4u/smp.c
===================================================================
--- kernel/arch/sparc64/src/smp/sun4u/smp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/sparc64/src/smp/sun4u/smp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -106,6 +106,6 @@
 	waking_up_mid = mid;
 		
-	if (waitq_sleep_timeout(&ap_completion_wq, 1000000,
-	    SYNCH_FLAGS_NONE, NULL) == ETIMEOUT)
+	if (waitq_sleep_timeout(&ap_completion_wq, 1000000, SYNCH_FLAGS_NONE) ==
+	    ESYNCH_TIMEOUT)
 		log(LF_ARCH, LVL_NOTE, "%s: waiting for processor (mid = %" PRIu32
 		    ") timed out", __func__, mid);
Index: kernel/arch/sparc64/src/smp/sun4v/smp.c
===================================================================
--- kernel/arch/sparc64/src/smp/sun4v/smp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/sparc64/src/smp/sun4v/smp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 #include <config.h>
 #include <macros.h>
-#include <halt.h>
+#include <func.h>
 #include <stdbool.h>
 #include <stddef.h>
@@ -373,6 +373,6 @@
 #endif
 	
-	if (waitq_sleep_timeout(&ap_completion_wq, 10000000,
-	    SYNCH_FLAGS_NONE, NULL) == ETIMEOUT)
+	if (waitq_sleep_timeout(&ap_completion_wq, 10000000, SYNCH_FLAGS_NONE) ==
+	    ESYNCH_TIMEOUT)
 		printf("%s: waiting for processor (cpuid = %" PRIu64 ") timed out\n",
 		    __func__, cpuid);
Index: kernel/arch/sparc64/src/sun4v/md.c
===================================================================
--- kernel/arch/sparc64/src/sun4v/md.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/arch/sparc64/src/sun4v/md.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,5 +35,5 @@
 #include <debug.h>
 #include <panic.h>
-#include <halt.h>
+#include <func.h>
 #include <log.h>
 #include <str.h>
Index: kernel/doc/doxygroups.h
===================================================================
--- kernel/doc/doxygroups.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/doc/doxygroups.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -117,5 +117,5 @@
 	 * @ingroup mm
 	 * @endcond
-	 */
+	 */	 
 	
 	/**
@@ -193,5 +193,5 @@
 	 * @ingroup ddi
 	 * @endcond
-	 */
+	 */	 
 
  	/**
@@ -257,5 +257,5 @@
 	 * @ingroup debug
 	 * @endcond
-	 */
+	 */	 
 
 	/**
@@ -321,5 +321,5 @@
 	 * @ingroup interrupt
 	 * @endcond
-	 */
+	 */	 
 
 	/**
@@ -389,5 +389,5 @@
 	 * @ingroup others
 	 * @endcond
-	 */
+	 */	 
 
 	/**
Index: kernel/genarch/include/genarch/drivers/am335x/ctrl_module.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/ctrl_module.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/genarch/include/genarch/drivers/am335x/ctrl_module.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
 typedef ioport32_t am335x_ctrl_module_t;
 
-static errno_t
+static int
 am335x_ctrl_module_clock_freq_get(am335x_ctrl_module_t *base, unsigned *freq)
 {
Index: kernel/genarch/include/genarch/drivers/am335x/timer.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/timer.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/genarch/include/genarch/drivers/am335x/timer.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -85,5 +85,5 @@
 } am335x_timer_t;
 
-extern errno_t am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id,
+extern int am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id,
     unsigned hz, unsigned srcclk_hz);
 extern void am335x_timer_intr_ack(am335x_timer_t *timer);
Index: kernel/genarch/include/genarch/ofw/ofw_tree.h
===================================================================
--- kernel/genarch/include/genarch/ofw/ofw_tree.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/genarch/include/genarch/ofw/ofw_tree.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -65,5 +65,5 @@
 
 /* Walker for visiting OpenFirmware device tree nodes. */
-typedef bool (*ofw_tree_walker_t)(ofw_tree_node_t *, void *);
+typedef bool (* ofw_tree_walker_t)(ofw_tree_node_t *, void *);
 
 extern void ofw_tree_init(ofw_tree_node_t *);
Index: kernel/genarch/src/ddi/ddi-bitmap.c
===================================================================
--- kernel/genarch/src/ddi/ddi-bitmap.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/genarch/src/ddi/ddi-bitmap.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,5 +57,5 @@
  *
  */
-errno_t ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
+int ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
 {
 	size_t elements = ioaddr + size;
@@ -120,5 +120,5 @@
  *
  */
-errno_t ddi_iospace_disable_arch(task_t *task, uintptr_t ioaddr, size_t size)
+int ddi_iospace_disable_arch(task_t *task, uintptr_t ioaddr, size_t size)
 {
 	size_t elements = ioaddr + size;
Index: kernel/genarch/src/ddi/ddi-dummy.c
===================================================================
--- kernel/genarch/src/ddi/ddi-dummy.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/genarch/src/ddi/ddi-dummy.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,5 +48,5 @@
  * @return EOK on success or an error code from errno.h.
  */
-errno_t ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
+int ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
 {
 	return 0;
@@ -63,5 +63,5 @@
  * @return EOK on success or an error code from errno.h.
  */
-errno_t ddi_iospace_disable_arch(task_t *task, uintptr_t ioaddr, size_t size)
+int ddi_iospace_disable_arch(task_t *task, uintptr_t ioaddr, size_t size)
 {
 	return 0;
Index: kernel/genarch/src/drivers/am335x/timer.c
===================================================================
--- kernel/genarch/src/drivers/am335x/timer.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/genarch/src/drivers/am335x/timer.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -84,5 +84,5 @@
 }
 
-errno_t
+int
 am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id, unsigned hz,
     unsigned srcclk_hz)
Index: kernel/genarch/src/ofw/upa.c
===================================================================
--- kernel/genarch/src/ofw/upa.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/genarch/src/ofw/upa.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include <genarch/ofw/ofw_tree.h>
 #include <genarch/ofw/upa.h>
-#include <halt.h>
+#include <func.h>
 #include <panic.h>
 #include <macros.h>
Index: kernel/generic/include/adt/bitmap.h
===================================================================
--- kernel/generic/include/adt/bitmap.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/adt/bitmap.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,6 +37,4 @@
 
 #include <stddef.h>
-#include <stdbool.h>
-#include <stdint.h>
 
 #define BITMAP_ELEMENT   8
@@ -83,5 +81,5 @@
 extern void bitmap_clear_range(bitmap_t *, size_t, size_t);
 
-extern bool bitmap_allocate_range(bitmap_t *, size_t, size_t, size_t, size_t,
+extern int bitmap_allocate_range(bitmap_t *, size_t, size_t, size_t, size_t,
     size_t *);
 extern void bitmap_copy(bitmap_t *, bitmap_t *, size_t);
Index: kernel/generic/include/adt/hash_table.h
===================================================================
--- kernel/generic/include/adt/hash_table.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/adt/hash_table.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -84,6 +84,6 @@
 	member_to_inst((item), type, member)
 
-extern bool hash_table_create(hash_table_t *, size_t, size_t,
-    hash_table_ops_t *);
+extern bool hash_table_create(hash_table_t *, size_t, size_t, 
+	hash_table_ops_t *);
 extern void hash_table_destroy(hash_table_t *);
 
@@ -98,6 +98,6 @@
 extern size_t hash_table_remove(hash_table_t *, void *);
 extern void hash_table_remove_item(hash_table_t *, ht_link_t *);
-extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *),
-    void *);
+extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *), 
+	void *);
 
 
Index: kernel/generic/include/align.h
===================================================================
--- kernel/generic/include/align.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/align.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,5 +58,5 @@
  * @param s Address or size to be checked for alignment.
  * @param a Size of alignment, must be a power of 2.
- */
+ */ 
 #define IS_ALIGNED(s, a)	(ALIGN_UP((s), (a)) == (s))
 
Index: kernel/generic/include/arch.h
===================================================================
--- kernel/generic/include/arch.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/arch.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -80,9 +80,9 @@
 
 typedef struct {
-	void (*pre_mm_init)(void);
-	void (*post_mm_init)(void);
-	void (*post_cpu_init)(void);
-	void (*pre_smp_init)(void);
-	void (*post_smp_init)(void);
+	void (* pre_mm_init)(void);
+	void (* post_mm_init)(void);
+	void (* post_cpu_init)(void);
+	void (* pre_smp_init)(void);
+	void (* post_smp_init)(void);
 } arch_ops_t;
 
Index: kernel/generic/include/cap/cap.h
===================================================================
--- kernel/generic/include/cap/cap.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/cap/cap.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -115,5 +115,5 @@
 
 extern void caps_init(void);
-extern errno_t caps_task_alloc(struct task *);
+extern int caps_task_alloc(struct task *);
 extern void caps_task_free(struct task *);
 extern void caps_task_init(struct task *);
@@ -121,5 +121,5 @@
     bool (*)(cap_t *, void *), void *);
 
-extern errno_t cap_alloc(struct task *, cap_handle_t *);
+extern cap_handle_t cap_alloc(struct task *);
 extern void cap_publish(struct task *, cap_handle_t, kobject_t *);
 extern kobject_t *cap_unpublish(struct task *, cap_handle_t, kobject_type_t);
Index: kernel/generic/include/console/console.h
===================================================================
--- kernel/generic/include/console/console.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/console/console.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -71,5 +71,5 @@
 extern wchar_t getc(indev_t *indev);
 extern size_t gets(indev_t *indev, char *buf, size_t buflen);
-extern sys_errno_t sys_kio(int cmd, const void *buf, size_t size);
+extern sysarg_t sys_kio(int cmd, const void *buf, size_t size);
 
 extern void grab_console(void);
Index: kernel/generic/include/ddi/ddi.h
===================================================================
--- kernel/generic/include/ddi/ddi.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/ddi/ddi.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,20 +55,20 @@
 extern void ddi_parea_register(parea_t *);
 
-extern sys_errno_t sys_physmem_map(uintptr_t, size_t, unsigned int, void *,
+extern sysarg_t sys_physmem_map(uintptr_t, size_t, unsigned int, void *,
     uintptr_t);
-extern sys_errno_t sys_physmem_unmap(uintptr_t);
+extern sysarg_t sys_physmem_unmap(uintptr_t);
 
-extern sys_errno_t sys_dmamem_map(size_t, unsigned int, unsigned int, void *,
+extern sysarg_t sys_dmamem_map(size_t, unsigned int, unsigned int, void *,
     void *, uintptr_t);
-extern sys_errno_t sys_dmamem_unmap(uintptr_t, size_t, unsigned int);
+extern sysarg_t sys_dmamem_unmap(uintptr_t, size_t, unsigned int);
 
-extern sys_errno_t sys_iospace_enable(ddi_ioarg_t *);
-extern sys_errno_t sys_iospace_disable(ddi_ioarg_t *);
+extern sysarg_t sys_iospace_enable(ddi_ioarg_t *);
+extern sysarg_t sys_iospace_disable(ddi_ioarg_t *);
 
 /*
  * Interface to be implemented by all architectures.
  */
-extern errno_t ddi_iospace_enable_arch(task_t *, uintptr_t, size_t);
-extern errno_t ddi_iospace_disable_arch(task_t *, uintptr_t, size_t);
+extern int ddi_iospace_enable_arch(task_t *, uintptr_t, size_t);
+extern int ddi_iospace_disable_arch(task_t *, uintptr_t, size_t);
 
 #endif
Index: kernel/generic/include/errno.h
===================================================================
--- kernel/generic/include/errno.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/errno.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #define KERN_ERRNO_H_
 
-#include <_bits/errno.h>
 #include <abi/errno.h>
 
Index: kernel/generic/include/func.h
===================================================================
--- kernel/generic/include/func.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ kernel/generic/include/func.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup generic
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_FUNC_H_
+#define KERN_FUNC_H_
+
+#include <atomic.h>
+
+extern atomic_t haltstate;
+
+extern void halt(void) __attribute__((noreturn));
+
+#endif
+
+/** @}
+ */
Index: kernel/generic/include/gsort.h
===================================================================
--- kernel/generic/include/gsort.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/gsort.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include <stddef.h>
 
-typedef int (*sort_cmp_t)(void *, void *, void *);
+typedef int (* sort_cmp_t)(void *, void *, void *);
 
 extern bool gsort(void *, size_t, size_t, sort_cmp_t, void *);
Index: rnel/generic/include/halt.h
===================================================================
--- kernel/generic/include/halt.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_HALT_H_
-#define KERN_HALT_H_
-
-#include <atomic.h>
-
-extern atomic_t haltstate;
-
-extern void halt(void) __attribute__((noreturn));
-
-#endif
-
-/** @}
- */
Index: kernel/generic/include/interrupt.h
===================================================================
--- kernel/generic/include/interrupt.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/interrupt.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,7 +61,7 @@
 
 extern void fault_from_uspace(istate_t *, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
+    PRINTF_ATTRIBUTE(2, 3);
 extern void fault_if_from_uspace(istate_t *, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
+    PRINTF_ATTRIBUTE(2, 3);
 extern istate_t *istate_get(thread_t *);
 extern iroutine_t exc_register(unsigned int, const char *, bool, iroutine_t);
Index: kernel/generic/include/ipc/event.h
===================================================================
--- kernel/generic/include/ipc/event.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/ipc/event.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -95,12 +95,12 @@
 	event_task_notify((t), (e), (m), (a1), (a2), (a3), (a4), (a5))
 
-extern errno_t event_notify(event_type_t, bool, sysarg_t, sysarg_t, sysarg_t,
+extern int event_notify(event_type_t, bool, sysarg_t, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t);
-extern errno_t event_task_notify(struct task *, event_task_type_t, bool, sysarg_t, sysarg_t,
+extern int event_task_notify(struct task *, event_task_type_t, bool, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t, sysarg_t);
 
-extern sys_errno_t sys_ipc_event_subscribe(sysarg_t, sysarg_t);
-extern sys_errno_t sys_ipc_event_unsubscribe(sysarg_t);
-extern sys_errno_t sys_ipc_event_unmask(sysarg_t);
+extern sysarg_t sys_ipc_event_subscribe(sysarg_t, sysarg_t);
+extern sysarg_t sys_ipc_event_unsubscribe(sysarg_t);
+extern sysarg_t sys_ipc_event_unmask(sysarg_t);
 
 #endif
Index: kernel/generic/include/ipc/ipc.h
===================================================================
--- kernel/generic/include/ipc/ipc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/ipc/ipc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -110,6 +110,4 @@
 	/** User-defined label */
 	sysarg_t label;
-	/** Capability handle */
-	cap_handle_t cap_handle;
 } ipc_data_t;
 
@@ -186,8 +184,8 @@
 extern void ipc_call_release(call_t *);
 
-extern errno_t ipc_call_sync(phone_t *, call_t *);
-extern errno_t ipc_call(phone_t *, call_t *);
+extern int ipc_call_sync(phone_t *, call_t *);
+extern int ipc_call(phone_t *, call_t *);
 extern call_t *ipc_wait_for_call(answerbox_t *, uint32_t, unsigned int);
-extern errno_t ipc_forward(call_t *, phone_t *, answerbox_t *, unsigned int);
+extern int ipc_forward(call_t *, phone_t *, answerbox_t *, unsigned int);
 extern void ipc_answer(answerbox_t *, call_t *);
 extern void _ipc_answer_free_call(call_t *, bool);
@@ -195,10 +193,10 @@
 extern void ipc_phone_init(phone_t *, struct task *);
 extern bool ipc_phone_connect(phone_t *, answerbox_t *);
-extern errno_t ipc_phone_hangup(phone_t *);
+extern int ipc_phone_hangup(phone_t *);
 
 extern void ipc_answerbox_init(answerbox_t *, struct task *);
 
 extern void ipc_cleanup(void);
-extern void ipc_backsend_err(phone_t *, call_t *, errno_t);
+extern void ipc_backsend_err(phone_t *, call_t *, sysarg_t);
 extern void ipc_answerbox_slam_phones(answerbox_t *, bool);
 extern void ipc_cleanup_call_list(answerbox_t *, list_t *);
Index: kernel/generic/include/ipc/ipcrsc.h
===================================================================
--- kernel/generic/include/ipc/ipcrsc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/ipc/ipcrsc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include <cap/cap.h>
 
-extern errno_t phone_alloc(task_t *, cap_handle_t *);
+extern cap_handle_t phone_alloc(task_t *);
 extern bool phone_connect(cap_handle_t, answerbox_t *);
 extern void phone_dealloc(cap_handle_t);
Index: kernel/generic/include/ipc/irq.h
===================================================================
--- kernel/generic/include/ipc/irq.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/ipc/irq.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,7 +51,6 @@
 extern void ipc_irq_top_half_handler(irq_t *);
 
-extern errno_t ipc_irq_subscribe(answerbox_t *, inr_t, sysarg_t, irq_code_t *,
-    cap_handle_t *);
-extern errno_t ipc_irq_unsubscribe(answerbox_t *, int);
+extern int ipc_irq_subscribe(answerbox_t *, inr_t, sysarg_t, irq_code_t *);
+extern int ipc_irq_unsubscribe(answerbox_t *, int);
 
 /*
Index: kernel/generic/include/ipc/kbox.h
===================================================================
--- kernel/generic/include/ipc/kbox.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/ipc/kbox.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
 } kbox_t;
 
-extern errno_t ipc_connect_kbox(task_id_t, cap_handle_t *);
+extern int ipc_connect_kbox(task_id_t);
 extern void ipc_kbox_cleanup(void);
 
Index: kernel/generic/include/ipc/sysipc.h
===================================================================
--- kernel/generic/include/ipc/sysipc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/ipc/sysipc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,24 +40,34 @@
 #include <typedefs.h>
 
-extern errno_t ipc_req_internal(int, ipc_data_t *, sysarg_t);
+extern int ipc_req_internal(int, ipc_data_t *, sysarg_t);
 
-extern sys_errno_t sys_ipc_call_async_fast(sysarg_t, sysarg_t, sysarg_t,
+extern sysarg_t sys_ipc_call_async_fast(sysarg_t, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t, sysarg_t);
-extern sys_errno_t sys_ipc_call_async_slow(sysarg_t, ipc_data_t *, sysarg_t);
-extern sys_errno_t sys_ipc_answer_fast(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+extern sysarg_t sys_ipc_call_async_slow(sysarg_t, ipc_data_t *, sysarg_t);
+extern sysarg_t sys_ipc_answer_fast(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t);
-extern sys_errno_t sys_ipc_answer_slow(sysarg_t, ipc_data_t *);
-extern sys_errno_t sys_ipc_wait_for_call(ipc_data_t *, uint32_t, unsigned int);
-extern sys_errno_t sys_ipc_poke(void);
-extern sys_errno_t sys_ipc_forward_fast(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+extern sysarg_t sys_ipc_answer_slow(sysarg_t, ipc_data_t *);
+extern sysarg_t sys_ipc_wait_for_call(ipc_data_t *, uint32_t, unsigned int);
+extern sysarg_t sys_ipc_poke(void);
+extern sysarg_t sys_ipc_forward_fast(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     sysarg_t, unsigned int);
-extern sys_errno_t sys_ipc_forward_slow(sysarg_t, sysarg_t, ipc_data_t *,
+extern sysarg_t sys_ipc_forward_slow(sysarg_t, sysarg_t, ipc_data_t *,
     unsigned int);
-extern sys_errno_t sys_ipc_hangup(sysarg_t);
+extern sysarg_t sys_ipc_hangup(sysarg_t);
 
-extern sys_errno_t sys_ipc_irq_subscribe(inr_t, sysarg_t, irq_code_t *, cap_handle_t *);
-extern sys_errno_t sys_ipc_irq_unsubscribe(sysarg_t);
+extern sysarg_t sys_ipc_irq_subscribe(inr_t, sysarg_t, irq_code_t *);
+extern sysarg_t sys_ipc_irq_unsubscribe(sysarg_t);
 
-extern sys_errno_t sys_ipc_connect_kbox(task_id_t *, cap_handle_t *);
+#ifdef __32_BITS__
+
+extern sysarg_t sys_ipc_connect_kbox(sysarg64_t *);
+
+#endif  /* __32_BITS__ */
+
+#ifdef __64_BITS__
+
+extern sysarg_t sys_ipc_connect_kbox(sysarg_t);
+
+#endif  /* __64_BITS__ */
 
 #endif
Index: kernel/generic/include/ipc/sysipc_ops.h
===================================================================
--- kernel/generic/include/ipc/sysipc_ops.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/ipc/sysipc_ops.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,7 +40,11 @@
 #define SYSIPC_OP(op, call, ...) \
 	({ \
-		sysipc_ops_t *ops = sysipc_ops_get((call)->request_method); \
-		assert(ops->op); \
-		ops->op((call), ##__VA_ARGS__); \
+		int rc = EOK; \
+		\
+		sysipc_ops_t *ops; \
+		ops = sysipc_ops_get((call)->request_method); \
+		if (ops->op) \
+			rc = ops->op((call), ##__VA_ARGS__); \
+		rc; \
 	})
 
@@ -90,5 +94,5 @@
 	 * Invoked on:		all calls
 	 */
-	errno_t (*request_preprocess)(call_t *, phone_t *);
+	int (* request_preprocess)(call_t *, phone_t *);
 
 	/**
@@ -101,6 +105,6 @@
 	 *			_ipc_answer_free_call()
 	 * Invoked on:		all forgotten calls
-	 */
-	errno_t (*request_forget)(call_t *);
+	 */	
+	int (* request_forget)(call_t *);
 
 	/**
@@ -111,6 +115,6 @@
 	 * Races with:		request_forget()
 	 * Invoked on:		all calls delivered to the callee
-	 */
-	int (*request_process)(call_t *, answerbox_t *);
+	 */	
+	int (* request_process)(call_t *, answerbox_t *);
 
 	/**
@@ -123,5 +127,5 @@
 	 * Invoked on:		all forgotten calls
 	 */
-	errno_t (*answer_cleanup)(call_t *, ipc_data_t *);
+	int (* answer_cleanup)(call_t *, ipc_data_t *);
 
 	/**
@@ -134,5 +138,5 @@
 	 * Invoked on:		all answered calls
 	 */
-	errno_t (*answer_preprocess)(call_t *, ipc_data_t *);
+	int (* answer_preprocess)(call_t *, ipc_data_t *);
 
 	/**
@@ -144,15 +148,15 @@
 	 * Invoked on:		all answered calls
 	 */
-	errno_t (*answer_process)(call_t *);
+	int (* answer_process)(call_t *);
 } sysipc_ops_t;
 
 extern sysipc_ops_t *sysipc_ops_get(sysarg_t);
 
-extern errno_t null_request_preprocess(call_t *, phone_t *);
-extern errno_t null_request_forget(call_t *);
+extern int null_request_preprocess(call_t *, phone_t *);
+extern int null_request_forget(call_t *);
 extern int null_request_process(call_t *, answerbox_t *);
-extern errno_t null_answer_cleanup(call_t *, ipc_data_t *);
-extern errno_t null_answer_preprocess(call_t *, ipc_data_t *);
-extern errno_t null_answer_process(call_t *);
+extern int null_answer_cleanup(call_t *, ipc_data_t *);
+extern int null_answer_preprocess(call_t *, ipc_data_t *);
+extern int null_answer_process(call_t *);
 
 #endif
Index: kernel/generic/include/ipc/sysipc_priv.h
===================================================================
--- kernel/generic/include/ipc/sysipc_priv.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/ipc/sysipc_priv.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include <ipc/ipc.h>
 
-extern errno_t answer_preprocess(call_t *, ipc_data_t *);
+extern int answer_preprocess(call_t *, ipc_data_t *);
 
 #endif
Index: kernel/generic/include/log.h
===================================================================
--- kernel/generic/include/log.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/log.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #define KERN_LOG_H_
 
-#include <errno.h>
 #include <stdarg.h>
 #include <stddef.h>
@@ -48,10 +47,10 @@
 extern int log_vprintf(const char *, va_list);
 extern int log_printf(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
+    PRINTF_ATTRIBUTE(1, 2);
 extern int log(log_facility_t, log_level_t, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(3, 4);
+    PRINTF_ATTRIBUTE(3, 4);
 
-extern sys_errno_t sys_klog(sysarg_t, void *buf, size_t size,
-    sysarg_t level, size_t *uspace_nread);
+extern sysarg_t sys_klog(sysarg_t, void *buf, size_t size,
+    sysarg_t level);
 
 #endif /* KERN_LOG_H_ */
Index: kernel/generic/include/mm/as.h
===================================================================
--- kernel/generic/include/mm/as.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/mm/as.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -268,9 +268,9 @@
 extern as_area_t *as_area_create(as_t *, unsigned int, size_t, unsigned int,
     mem_backend_t *, mem_backend_data_t *, uintptr_t *, uintptr_t);
-extern errno_t as_area_destroy(as_t *, uintptr_t);
-extern errno_t as_area_resize(as_t *, uintptr_t, size_t, unsigned int);
-extern errno_t as_area_share(as_t *, uintptr_t, size_t, as_t *, unsigned int,
+extern int as_area_destroy(as_t *, uintptr_t);
+extern int as_area_resize(as_t *, uintptr_t, size_t, unsigned int);
+extern int as_area_share(as_t *, uintptr_t, size_t, as_t *, unsigned int,
     uintptr_t *, uintptr_t);
-extern errno_t as_area_change_flags(as_t *, unsigned int, uintptr_t);
+extern int as_area_change_flags(as_t *, unsigned int, uintptr_t);
 
 extern unsigned int as_area_get_flags(as_area_t *);
@@ -283,5 +283,5 @@
 
 #ifndef as_constructor_arch
-extern errno_t as_constructor_arch(as_t *, unsigned int);
+extern int as_constructor_arch(as_t *, unsigned int);
 #endif /* !def as_constructor_arch */
 
@@ -291,5 +291,5 @@
 
 #ifndef as_create_arch
-extern errno_t as_create_arch(as_t *, unsigned int);
+extern int as_create_arch(as_t *, unsigned int);
 #endif /* !def as_create_arch */
 
@@ -311,7 +311,7 @@
 extern sysarg_t sys_as_area_create(uintptr_t, size_t, unsigned int, uintptr_t,
     as_area_pager_info_t *);
-extern sys_errno_t sys_as_area_resize(uintptr_t, size_t, unsigned int);
-extern sys_errno_t sys_as_area_change_flags(uintptr_t, unsigned int);
-extern sys_errno_t sys_as_area_destroy(uintptr_t);
+extern sysarg_t sys_as_area_resize(uintptr_t, size_t, unsigned int);
+extern sysarg_t sys_as_area_change_flags(uintptr_t, unsigned int);
+extern sysarg_t sys_as_area_destroy(uintptr_t);
 
 /* Introspection functions. */
Index: kernel/generic/include/mm/page.h
===================================================================
--- kernel/generic/include/mm/page.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/mm/page.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,9 +46,9 @@
 /** Operations to manipulate page mappings. */
 typedef struct {
-	void (*mapping_insert)(as_t *, uintptr_t, uintptr_t, unsigned int);
-	void (*mapping_remove)(as_t *, uintptr_t);
-	bool (*mapping_find)(as_t *, uintptr_t, bool, pte_t *);
-	void (*mapping_update)(as_t *, uintptr_t, bool, pte_t *);
-	void (*mapping_make_global)(uintptr_t, size_t);
+	void (* mapping_insert)(as_t *, uintptr_t, uintptr_t, unsigned int);
+	void (* mapping_remove)(as_t *, uintptr_t);
+	bool (* mapping_find)(as_t *, uintptr_t, bool, pte_t *);
+	void (* mapping_update)(as_t *, uintptr_t, bool, pte_t *);
+	void (* mapping_make_global)(uintptr_t, size_t);
 } page_mapping_operations_t;
 
@@ -67,6 +67,6 @@
 extern void page_table_destroy(pte_t *);
 
-extern errno_t page_find_mapping(uintptr_t, uintptr_t *);
-extern sys_errno_t sys_page_find_mapping(uintptr_t, uintptr_t *);
+extern int page_find_mapping(uintptr_t, uintptr_t *);
+extern sysarg_t sys_page_find_mapping(uintptr_t, uintptr_t *);
 
 #endif
Index: kernel/generic/include/mm/slab.h
===================================================================
--- kernel/generic/include/mm/slab.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/mm/slab.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -94,5 +94,5 @@
 	size_t size;
 	
-	errno_t (*constructor)(void *obj, unsigned int kmflag);
+	int (*constructor)(void *obj, unsigned int kmflag);
 	size_t (*destructor)(void *obj);
 	
@@ -124,5 +124,5 @@
 
 extern slab_cache_t *slab_cache_create(const char *, size_t, size_t,
-    errno_t (*)(void *, unsigned int), size_t (*)(void *), unsigned int);
+    int (*)(void *, unsigned int), size_t (*)(void *), unsigned int);
 extern void slab_cache_destroy(slab_cache_t *);
 
Index: kernel/generic/include/panic.h
===================================================================
--- kernel/generic/include/panic.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/panic.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -66,5 +66,5 @@
 extern void panic_common(panic_category_t, struct istate *, int,
     uintptr_t, const char *, ...) __attribute__ ((noreturn))
-    _HELENOS_PRINTF_ATTRIBUTE(5, 6);
+    PRINTF_ATTRIBUTE(5, 6);
 
 #endif
Index: kernel/generic/include/print.h
===================================================================
--- kernel/generic/include/print.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/print.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,7 +44,7 @@
 extern int puts(const char *s);
 extern int printf(const char *fmt, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
+    PRINTF_ATTRIBUTE(1, 2);
 extern int snprintf(char *str, size_t size, const char *fmt, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(3, 4);
+    PRINTF_ATTRIBUTE(3, 4);
 
 extern int vprintf(const char *fmt, va_list ap);
Index: kernel/generic/include/printf/verify.h
===================================================================
--- kernel/generic/include/printf/verify.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/printf/verify.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,20 +36,20 @@
 #define KERN_PRINTF_VERIFY_H_
 
-#ifndef _HELENOS_NVERIFY_PRINTF
+#ifndef NVERIFY_PRINTF
 
 #ifdef __clang__
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
+#define PRINTF_ATTRIBUTE(start, end) \
 	__attribute__((format(__printf__, start, end)))
 #else
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
+#define PRINTF_ATTRIBUTE(start, end) \
 	__attribute__((format(gnu_printf, start, end)))
 #endif
 
 
-#else /* _HELENOS_NVERIFY_PRINTF */
+#else /* NVERIFY_PRINTF */
 
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end)
+#define PRINTF_ATTRIBUTE(start, end)
 
-#endif /* _HELENOS_NVERIFY_PRINTF */
+#endif /* NVERIFY_PRINTF */
 
 #endif
Index: kernel/generic/include/proc/program.h
===================================================================
--- kernel/generic/include/proc/program.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/proc/program.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,10 +55,10 @@
 extern void *program_loader;
 
-extern errno_t program_create(as_t *, uintptr_t, char *, program_t *);
-extern errno_t program_create_from_image(void *, char *, program_t *);
-extern errno_t program_create_loader(program_t *, char *);
+extern int program_create(as_t *, uintptr_t, char *, program_t *);
+extern int program_create_from_image(void *, char *, program_t *);
+extern int program_create_loader(program_t *, char *);
 extern void program_ready(program_t *);
 
-extern sys_errno_t sys_program_spawn_loader(char *, size_t);
+extern sysarg_t sys_program_spawn_loader(char *, size_t);
 
 #endif
Index: kernel/generic/include/proc/task.h
===================================================================
--- kernel/generic/include/proc/task.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/proc/task.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,5 +58,4 @@
 #include <udebug/udebug.h>
 #include <mm/as.h>
-#include <abi/proc/task.h>
 #include <abi/sysinfo.h>
 #include <arch.h>
@@ -157,5 +156,5 @@
 extern void task_release(task_t *);
 extern task_t *task_find_by_id(task_id_t);
-extern errno_t task_kill(task_id_t);
+extern int task_kill(task_id_t);
 extern void task_kill_self(bool) __attribute__((noreturn));
 extern void task_get_accounting(task_t *, uint64_t *, uint64_t *);
@@ -174,5 +173,5 @@
 
 #ifdef __32_BITS__
-extern sys_errno_t sys_task_get_id(sysarg64_t *);
+extern sysarg_t sys_task_get_id(sysarg64_t *);
 #endif
 
@@ -181,7 +180,7 @@
 #endif
 
-extern sys_errno_t sys_task_set_name(const char *, size_t);
-extern sys_errno_t sys_task_kill(task_id_t *);
-extern sys_errno_t sys_task_exit(sysarg_t);
+extern sysarg_t sys_task_set_name(const char *, size_t);
+extern sysarg_t sys_task_kill(task_id_t *);
+extern sysarg_t sys_task_exit(sysarg_t);
 
 #endif
Index: kernel/generic/include/proc/thread.h
===================================================================
--- kernel/generic/include/proc/thread.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/proc/thread.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,5 +48,4 @@
 #include <abi/proc/uarg.h>
 #include <udebug/udebug.h>
-#include <abi/proc/thread.h>
 #include <abi/sysinfo.h>
 #include <arch.h>
@@ -256,5 +255,5 @@
 	thread_join_timeout((t), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE)
 
-extern errno_t thread_join_timeout(thread_t *, uint32_t, unsigned int);
+extern int thread_join_timeout(thread_t *, uint32_t, unsigned int);
 extern void thread_detach(thread_t *);
 
@@ -276,10 +275,10 @@
 
 /* Thread syscall prototypes. */
-extern sys_errno_t sys_thread_create(uspace_arg_t *, char *, size_t,
+extern sysarg_t sys_thread_create(uspace_arg_t *, char *, size_t,
     thread_id_t *);
-extern sys_errno_t sys_thread_exit(int);
-extern sys_errno_t sys_thread_get_id(thread_id_t *);
-extern sys_errno_t sys_thread_usleep(uint32_t);
-extern sys_errno_t sys_thread_udelay(uint32_t);
+extern sysarg_t sys_thread_exit(int);
+extern sysarg_t sys_thread_get_id(thread_id_t *);
+extern sysarg_t sys_thread_usleep(uint32_t);
+extern sysarg_t sys_thread_udelay(uint32_t);
 
 #endif
Index: kernel/generic/include/security/perm.h
===================================================================
--- kernel/generic/include/security/perm.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/security/perm.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -75,6 +75,6 @@
 #ifdef __32_BITS__
 
-extern sys_errno_t sys_perm_grant(sysarg64_t *, perm_t);
-extern sys_errno_t sys_perm_revoke(sysarg64_t *, perm_t);
+extern sysarg_t sys_perm_grant(sysarg64_t *, perm_t);
+extern sysarg_t sys_perm_revoke(sysarg64_t *, perm_t);
 
 #endif  /* __32_BITS__ */
@@ -82,6 +82,6 @@
 #ifdef __64_BITS__
 
-extern sys_errno_t sys_perm_grant(sysarg_t, perm_t);
-extern sys_errno_t sys_perm_revoke(sysarg_t, perm_t);
+extern sysarg_t sys_perm_grant(sysarg_t, perm_t);
+extern sysarg_t sys_perm_revoke(sysarg_t, perm_t);
 
 #endif  /* __64_BITS__ */
Index: kernel/generic/include/stacktrace.h
===================================================================
--- kernel/generic/include/stacktrace.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/stacktrace.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,8 +49,8 @@
 
 typedef struct {
-	bool (*stack_trace_context_validate)(stack_trace_context_t *);
-	bool (*frame_pointer_prev)(stack_trace_context_t *, uintptr_t *);
-	bool (*return_address_get)(stack_trace_context_t *, uintptr_t *);
-	bool (*symbol_resolve)(uintptr_t, const char **, uintptr_t *);
+	bool (* stack_trace_context_validate)(stack_trace_context_t *);
+	bool (* frame_pointer_prev)(stack_trace_context_t *, uintptr_t *);
+	bool (* return_address_get)(stack_trace_context_t *, uintptr_t *);
+	bool (* symbol_resolve)(uintptr_t, const char **, uintptr_t *);
 } stack_trace_ops_t;
 
Index: kernel/generic/include/str.h
===================================================================
--- kernel/generic/include/str.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/str.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,4 @@
 #include <stddef.h>
 #include <stdint.h>
-#include <errno.h>
 
 /**< Common Unicode characters */
@@ -68,5 +67,5 @@
 
 extern wchar_t str_decode(const char *str, size_t *offset, size_t sz);
-extern errno_t chr_encode(wchar_t ch, char *str, size_t *offset, size_t sz);
+extern int chr_encode(wchar_t ch, char *str, size_t *offset, size_t sz);
 
 extern size_t str_size(const char *str);
@@ -100,11 +99,8 @@
 extern bool wstr_remove(wchar_t *str, size_t pos);
 
-extern errno_t str_uint64_t(const char *, char **, unsigned int, bool, uint64_t *);
+extern int str_uint64_t(const char *, char **, unsigned int, bool, uint64_t *);
 
 extern void order_suffix(const uint64_t, uint64_t *, char *);
 extern void bin_order_suffix(const uint64_t, uint64_t *, const char **, bool);
-
-extern const char *str_error(errno_t err);
-extern const char *str_error_name(errno_t err);
 
 #endif
Index: kernel/generic/include/symtab.h
===================================================================
--- kernel/generic/include/symtab.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/symtab.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 
 extern void symtab_print_search(const char *);
-extern const char *symtab_hints_enum(const char *, const char **, void **);
+extern const char* symtab_hints_enum(const char *, const char **, void **);
 
 #endif
Index: kernel/generic/include/symtab_lookup.h
===================================================================
--- kernel/generic/include/symtab_lookup.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/symtab_lookup.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,7 +45,7 @@
 };
 
-extern errno_t symtab_name_lookup(uintptr_t, const char **, uintptr_t *);
+extern int symtab_name_lookup(uintptr_t, const char **, uintptr_t *);
 extern const char *symtab_fmt_name_lookup(uintptr_t);
-extern errno_t symtab_addr_lookup(const char *, uintptr_t *);
+extern int symtab_addr_lookup(const char *, uintptr_t *);
 
 #ifdef CONFIG_SYMTAB
Index: kernel/generic/include/synch/condvar.h
===================================================================
--- kernel/generic/include/synch/condvar.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/synch/condvar.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -62,10 +62,10 @@
 extern void condvar_signal(condvar_t *cv);
 extern void condvar_broadcast(condvar_t *cv);
-extern errno_t _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, uint32_t usec,
+extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, uint32_t usec,
     int flags);
-extern errno_t _condvar_wait_timeout_spinlock_impl(condvar_t *cv, spinlock_t *lock,
-    uint32_t usec, int flags);
-extern errno_t _condvar_wait_timeout_irq_spinlock(condvar_t *cv,
-    irq_spinlock_t *irq_lock, uint32_t usec, int flags);
+extern int _condvar_wait_timeout_spinlock_impl(condvar_t *cv, spinlock_t *lock, 
+	uint32_t usec, int flags);
+extern int _condvar_wait_timeout_irq_spinlock(condvar_t *cv, 
+	irq_spinlock_t *irq_lock, uint32_t usec, int flags);
 
 
Index: kernel/generic/include/synch/futex.h
===================================================================
--- kernel/generic/include/synch/futex.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/synch/futex.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,6 +53,6 @@
 
 extern void futex_init(void);
-extern sys_errno_t sys_futex_sleep(uintptr_t);
-extern sys_errno_t sys_futex_wakeup(uintptr_t);
+extern sysarg_t sys_futex_sleep(uintptr_t);
+extern sysarg_t sys_futex_wakeup(uintptr_t);
 
 extern void futex_task_cleanup(void);
Index: kernel/generic/include/synch/mutex.h
===================================================================
--- kernel/generic/include/synch/mutex.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/synch/mutex.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -67,5 +67,5 @@
 extern void mutex_initialize(mutex_t *, mutex_type_t);
 extern bool mutex_locked(mutex_t *);
-extern errno_t _mutex_lock_timeout(mutex_t *, uint32_t, unsigned int);
+extern int _mutex_lock_timeout(mutex_t *, uint32_t, unsigned int);
 extern void mutex_unlock(mutex_t *);
 
Index: kernel/generic/include/synch/semaphore.h
===================================================================
--- kernel/generic/include/synch/semaphore.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/synch/semaphore.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #define KERN_SEMAPHORE_H_
 
-#include <errno.h>
 #include <stdint.h>
 #include <synch/waitq.h>
@@ -55,9 +54,9 @@
 
 #define semaphore_down_interruptable(s) \
-	(_semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, \
-		SYNCH_FLAGS_INTERRUPTIBLE) != EINTR)
+	(ESYNCH_INTERRUPTED != _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, \
+		SYNCH_FLAGS_INTERRUPTIBLE))
 
 extern void semaphore_initialize(semaphore_t *, int);
-extern errno_t _semaphore_down_timeout(semaphore_t *, uint32_t, unsigned int);
+extern int _semaphore_down_timeout(semaphore_t *, uint32_t, unsigned int);
 extern void semaphore_up(semaphore_t *);
 extern int semaphore_count_get(semaphore_t *);
Index: kernel/generic/include/synch/smc.h
===================================================================
--- kernel/generic/include/synch/smc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/synch/smc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,5 @@
 #define KERN_SMC_H_
 
-extern sys_errno_t sys_smc_coherence(uintptr_t, size_t);
+extern sysarg_t sys_smc_coherence(uintptr_t, size_t);
 
 #endif
Index: kernel/generic/include/synch/smp_memory_barrier.h
===================================================================
--- kernel/generic/include/synch/smp_memory_barrier.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/synch/smp_memory_barrier.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include <typedefs.h>
 
-extern sys_errno_t sys_smp_memory_barrier(void);
+extern sysarg_t sys_smp_memory_barrier(void);
 
 #endif
Index: kernel/generic/include/synch/spinlock.h
===================================================================
--- kernel/generic/include/synch/spinlock.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/synch/spinlock.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -112,5 +112,5 @@
 
 extern void spinlock_initialize(spinlock_t *, const char *);
-extern bool spinlock_trylock(spinlock_t *);
+extern int spinlock_trylock(spinlock_t *);
 extern void spinlock_lock_debug(spinlock_t *);
 extern void spinlock_unlock_debug(spinlock_t *);
@@ -287,5 +287,5 @@
 extern void irq_spinlock_lock(irq_spinlock_t *, bool);
 extern void irq_spinlock_unlock(irq_spinlock_t *, bool);
-extern bool irq_spinlock_trylock(irq_spinlock_t *);
+extern int irq_spinlock_trylock(irq_spinlock_t *);
 extern void irq_spinlock_pass(irq_spinlock_t *, irq_spinlock_t *);
 extern void irq_spinlock_exchange(irq_spinlock_t *, irq_spinlock_t *);
Index: kernel/generic/include/synch/waitq.h
===================================================================
--- kernel/generic/include/synch/waitq.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/synch/waitq.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -67,13 +67,13 @@
 
 #define waitq_sleep(wq) \
-	waitq_sleep_timeout((wq), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE, NULL)
+	waitq_sleep_timeout((wq), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE)
 
 struct thread;
 
 extern void waitq_initialize(waitq_t *);
-extern errno_t waitq_sleep_timeout(waitq_t *, uint32_t, unsigned int, bool *);
+extern int waitq_sleep_timeout(waitq_t *, uint32_t, unsigned int);
 extern ipl_t waitq_sleep_prepare(waitq_t *);
-extern errno_t waitq_sleep_timeout_unsafe(waitq_t *, uint32_t, unsigned int, bool *);
-extern void waitq_sleep_finish(waitq_t *, bool, ipl_t);
+extern int waitq_sleep_timeout_unsafe(waitq_t *, uint32_t, unsigned int);
+extern void waitq_sleep_finish(waitq_t *, int, ipl_t);
 extern void waitq_wakeup(waitq_t *, wakeup_mode_t);
 extern void _waitq_wakeup_unsafe(waitq_t *, wakeup_mode_t);
Index: kernel/generic/include/synch/workqueue.h
===================================================================
--- kernel/generic/include/synch/workqueue.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/synch/workqueue.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,13 +61,13 @@
 extern void workq_global_worker_init(void);
 extern void workq_global_stop(void);
-extern bool workq_global_enqueue_noblock(work_t *, work_func_t);
-extern bool workq_global_enqueue(work_t *, work_func_t);
+extern int workq_global_enqueue_noblock(work_t *, work_func_t);
+extern int workq_global_enqueue(work_t *, work_func_t);
 
-extern struct work_queue *workq_create(const char *);
+extern struct work_queue * workq_create(const char *);
 extern void workq_destroy(struct work_queue *);
-extern bool workq_init(struct work_queue *, const char *);
+extern int workq_init(struct work_queue *, const char *);
 extern void workq_stop(struct work_queue *);
-extern bool workq_enqueue_noblock(struct work_queue *, work_t *, work_func_t);
-extern bool workq_enqueue(struct work_queue *, work_t *, work_func_t);
+extern int workq_enqueue_noblock(struct work_queue *, work_t *, work_func_t);
+extern int workq_enqueue(struct work_queue *, work_t *, work_func_t);
 
 extern void workq_print_info(struct work_queue *);
Index: kernel/generic/include/syscall/copy.h
===================================================================
--- kernel/generic/include/syscall/copy.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/syscall/copy.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,12 +44,12 @@
 extern char memcpy_to_uspace_failover_address;
 
-extern errno_t copy_from_uspace(void *dst, const void *uspace_src, size_t size);
-extern errno_t copy_to_uspace(void *dst_uspace, const void *src, size_t size);
+extern int copy_from_uspace(void *dst, const void *uspace_src, size_t size);
+extern int copy_to_uspace(void *dst_uspace, const void *src, size_t size);
 
 /*
  * This interface must be implemented by each architecture.
  */
-extern errno_t memcpy_from_uspace(void *dst, const void *uspace_src, size_t size);
-extern errno_t memcpy_to_uspace(void *uspace_dst, const void *src, size_t size);
+extern int memcpy_from_uspace(void *dst, const void *uspace_src, size_t size);
+extern int memcpy_to_uspace(void *uspace_dst, const void *src, size_t size);
 
 #endif
Index: kernel/generic/include/sysinfo/sysinfo.h
===================================================================
--- kernel/generic/include/sysinfo/sysinfo.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/sysinfo/sysinfo.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -162,10 +162,10 @@
 extern void sysinfo_dump(sysinfo_item_t *);
 
-extern sys_errno_t sys_sysinfo_get_keys_size(void *, size_t, void *);
-extern sys_errno_t sys_sysinfo_get_keys(void *, size_t, void *, size_t, size_t *);
+extern sysarg_t sys_sysinfo_get_keys_size(void *, size_t, void *);
+extern sysarg_t sys_sysinfo_get_keys(void *, size_t, void *, size_t, size_t *);
 extern sysarg_t sys_sysinfo_get_val_type(void *, size_t);
-extern sys_errno_t sys_sysinfo_get_value(void *, size_t, void *);
-extern sys_errno_t sys_sysinfo_get_data_size(void *, size_t, void *);
-extern sys_errno_t sys_sysinfo_get_data(void *, size_t, void *, size_t, size_t *);
+extern sysarg_t sys_sysinfo_get_value(void *, size_t, void *);
+extern sysarg_t sys_sysinfo_get_data_size(void *, size_t, void *);
+extern sysarg_t sys_sysinfo_get_data(void *, size_t, void *, size_t, size_t *);
 
 #endif
Index: kernel/generic/include/typedefs.h
===================================================================
--- kernel/generic/include/typedefs.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/typedefs.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 
 #include <arch/types.h>
-#include <_bits/errno.h>
 
 typedef struct {
@@ -43,5 +42,5 @@
 } atomic_t;
 
-typedef void (*function)(void);
+typedef void (* function)(void);
 
 typedef uint32_t container_id_t;
Index: kernel/generic/include/udebug/udebug.h
===================================================================
--- kernel/generic/include/udebug/udebug.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/udebug/udebug.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -102,5 +102,5 @@
 void udebug_before_thread_runs(void);
 
-errno_t udebug_task_cleanup(struct task *);
+int udebug_task_cleanup(struct task *);
 void udebug_thread_fault(void);
 
Index: kernel/generic/include/udebug/udebug_ipc.h
===================================================================
--- kernel/generic/include/udebug/udebug_ipc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/udebug/udebug_ipc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include <ipc/ipc.h>
 
-errno_t udebug_request_preprocess(call_t *call, phone_t *phone);
+int udebug_request_preprocess(call_t *call, phone_t *phone);
 void udebug_call_receive(call_t *call);
 
Index: kernel/generic/include/udebug/udebug_ops.h
===================================================================
--- kernel/generic/include/udebug/udebug_ops.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/include/udebug/udebug_ops.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,23 +37,20 @@
 
 #include <ipc/ipc.h>
-#include <proc/thread.h>
-#include <stdbool.h>
-#include <stddef.h>
 
-errno_t udebug_begin(call_t *call, bool *active);
-errno_t udebug_end(void);
-errno_t udebug_set_evmask(udebug_evmask_t mask);
+int udebug_begin(call_t *call);
+int udebug_end(void);
+int udebug_set_evmask(udebug_evmask_t mask);
 
-errno_t udebug_go(thread_t *t, call_t *call);
-errno_t udebug_stop(thread_t *t, call_t *call);
+int udebug_go(thread_t *t, call_t *call);
+int udebug_stop(thread_t *t, call_t *call);
 
-errno_t udebug_thread_read(void **buffer, size_t buf_size, size_t *stored,
+int udebug_thread_read(void **buffer, size_t buf_size, size_t *stored,
     size_t *needed);
-errno_t udebug_name_read(char **data, size_t *data_size);
-errno_t udebug_args_read(thread_t *t, void **buffer);
+int udebug_name_read(char **data, size_t *data_size);
+int udebug_args_read(thread_t *t, void **buffer);
 
-errno_t udebug_regs_read(thread_t *t, void **buffer);
+int udebug_regs_read(thread_t *t, void **buffer);
 
-errno_t udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer);
+int udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer);
 
 #endif
Index: kernel/generic/src/adt/bitmap.c
===================================================================
--- kernel/generic/src/adt/bitmap.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/adt/bitmap.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -269,5 +269,5 @@
  *
  */
-bool bitmap_allocate_range(bitmap_t *bitmap, size_t count, size_t base,
+int bitmap_allocate_range(bitmap_t *bitmap, size_t count, size_t base,
     size_t prefered, size_t constraint, size_t *index)
 {
Index: kernel/generic/src/cap/cap.c
===================================================================
--- kernel/generic/src/cap/cap.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/cap/cap.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -124,5 +124,5 @@
  * @param task  Task for which to allocate the info structure.
  */
-errno_t caps_task_alloc(task_t *task)
+int caps_task_alloc(task_t *task)
 {
 	task->cap_info = (cap_info_t *) malloc(sizeof(cap_info_t),
@@ -257,11 +257,11 @@
  * @param task  Task for which to allocate the new capability.
  *
- * @param[out] handle  New capability handle on success.
- *
- * @return An error code in case of error.
- */
-errno_t cap_alloc(task_t *task, cap_handle_t *handle)
+ * @return New capability handle on success.
+ * @return Negative error code in case of error.
+ */
+cap_handle_t cap_alloc(task_t *task)
 {
 	cap_t *cap = NULL;
+	cap_handle_t handle;
 
 	/*
@@ -293,8 +293,8 @@
 
 	cap->state = CAP_STATE_ALLOCATED;
-	*handle = cap->handle;
-	mutex_unlock(&task->cap_info->lock);
-
-	return EOK;
+	handle = cap->handle;
+	mutex_unlock(&task->cap_info->lock);
+
+	return handle;
 }
 
Index: kernel/generic/src/console/chardev.c
===================================================================
--- kernel/generic/src/console/chardev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/console/chardev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include <synch/spinlock.h>
 #include <print.h>
-#include <halt.h>
+#include <func.h>
 #include <cpu.h>
 
Index: kernel/generic/src/console/cmd.c
===================================================================
--- kernel/generic/src/console/cmd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/console/cmd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,5 @@
 #include <arch.h>
 #include <config.h>
-#include <halt.h>
+#include <func.h>
 #include <str.h>
 #include <macros.h>
@@ -972,5 +972,5 @@
 	sysarg_t (*fnc)(void);
 	fncptr_t fptr;
-	errno_t rc;
+	int rc;
 
 	symbol = (char *) argv->buffer;
@@ -1033,5 +1033,5 @@
 	sysarg_t arg1 = argv[1].intval;
 	fncptr_t fptr;
-	errno_t rc;
+	int rc;
 
 	symbol = (char *) argv->buffer;
@@ -1070,5 +1070,5 @@
 	sysarg_t arg2 = argv[2].intval;
 	fncptr_t fptr;
-	errno_t rc;
+	int rc;
 
 	symbol = (char *) argv->buffer;
@@ -1107,5 +1107,5 @@
 	sysarg_t arg3 = argv[3].intval;
 	fncptr_t fptr;
-	errno_t rc;
+	int rc;
 	
 	symbol = (char *) argv->buffer;
@@ -1182,5 +1182,5 @@
 	uint32_t arg1 = argv[1].intval;
 	bool pointer = false;
-	errno_t rc;
+	int rc;
 	
 	if (((char *) argv->buffer)[0] == '*') {
Index: kernel/generic/src/console/console.c
===================================================================
--- kernel/generic/src/console/console.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/console/console.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -391,8 +391,8 @@
  *
  */
-sys_errno_t sys_kio(int cmd, const void *buf, size_t size)
+sysarg_t sys_kio(int cmd, const void *buf, size_t size)
 {
 	char *data;
-	errno_t rc;
+	int rc;
 
 	switch (cmd) {
@@ -408,15 +408,15 @@
 
 	if (size > PAGE_SIZE)
-		return (sys_errno_t) ELIMIT;
+		return (sysarg_t) ELIMIT;
 	
 	if (size > 0) {
 		data = (char *) malloc(size + 1, 0);
 		if (!data)
-			return (sys_errno_t) ENOMEM;
+			return (sysarg_t) ENOMEM;
 		
 		rc = copy_from_uspace(data, buf, size);
 		if (rc) {
 			free(data);
-			return (sys_errno_t) rc;
+			return (sysarg_t) rc;
 		}
 		data[size] = 0;
Index: kernel/generic/src/console/kconsole.c
===================================================================
--- kernel/generic/src/console/kconsole.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/console/kconsole.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,5 @@
 #include <macros.h>
 #include <debug.h>
-#include <halt.h>
+#include <func.h>
 #include <str.h>
 #include <sysinfo/sysinfo.h>
@@ -563,5 +563,5 @@
 		
 		uintptr_t symaddr;
-		errno_t rc = symtab_addr_lookup(symname, &symaddr);
+		int rc = symtab_addr_lookup(symname, &symaddr);
 		switch (rc) {
 		case ENOENT:
@@ -591,5 +591,5 @@
 		uint64_t value;
 		char *end;
-		errno_t rc = str_uint64_t(text, &end, 0, false, &value);
+		int rc = str_uint64_t(text, &end, 0, false, &value);
 		if (end != text + len)
 			rc = EINVAL;
Index: kernel/generic/src/ddi/ddi.c
===================================================================
--- kernel/generic/src/ddi/ddi.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ddi/ddi.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -104,5 +104,5 @@
  *
  */
-NO_TRACE static errno_t physmem_map(uintptr_t phys, size_t pages,
+NO_TRACE static int physmem_map(uintptr_t phys, size_t pages,
     unsigned int flags, uintptr_t *virt, uintptr_t bound)
 {
@@ -210,5 +210,5 @@
 }
 
-NO_TRACE static errno_t physmem_unmap(uintptr_t virt)
+NO_TRACE static int physmem_unmap(uintptr_t virt)
 {
 	assert(TASK);
@@ -228,9 +228,9 @@
  *
  */
-sys_errno_t sys_physmem_map(uintptr_t phys, size_t pages, unsigned int flags,
+sysarg_t sys_physmem_map(uintptr_t phys, size_t pages, unsigned int flags,
     void *virt_ptr, uintptr_t bound)
 {
 	uintptr_t virt;
-	errno_t rc = copy_from_uspace(&virt, virt_ptr, sizeof(virt));
+	int rc = copy_from_uspace(&virt, virt_ptr, sizeof(virt));
 	if (rc != EOK)
 		return rc;
@@ -250,5 +250,5 @@
 }
 
-sys_errno_t sys_physmem_unmap(uintptr_t virt)
+sysarg_t sys_physmem_unmap(uintptr_t virt)
 {
 	return physmem_unmap(virt);
@@ -265,5 +265,5 @@
  *
  */
-NO_TRACE static errno_t iospace_enable(task_id_t id, uintptr_t ioaddr, size_t size)
+NO_TRACE static int iospace_enable(task_id_t id, uintptr_t ioaddr, size_t size)
 {
 	/*
@@ -290,5 +290,5 @@
 	/* Lock the task and release the lock protecting tasks_btree. */
 	irq_spinlock_exchange(&tasks_lock, &task->lock);
-	errno_t rc = ddi_iospace_enable_arch(task, ioaddr, size);
+	int rc = ddi_iospace_enable_arch(task, ioaddr, size);
 	irq_spinlock_unlock(&task->lock, true);
 
@@ -306,5 +306,5 @@
  *
  */
-NO_TRACE static errno_t iospace_disable(task_id_t id, uintptr_t ioaddr, size_t size)
+NO_TRACE static int iospace_disable(task_id_t id, uintptr_t ioaddr, size_t size)
 {
 	/*
@@ -331,5 +331,5 @@
 	/* Lock the task and release the lock protecting tasks_btree. */
 	irq_spinlock_exchange(&tasks_lock, &task->lock);
-	errno_t rc = ddi_iospace_disable_arch(task, ioaddr, size);
+	int rc = ddi_iospace_disable_arch(task, ioaddr, size);
 	irq_spinlock_unlock(&task->lock, true);
 	
@@ -344,27 +344,27 @@
  *
  */
-sys_errno_t sys_iospace_enable(ddi_ioarg_t *uspace_io_arg)
+sysarg_t sys_iospace_enable(ddi_ioarg_t *uspace_io_arg)
 {
 	ddi_ioarg_t arg;
-	errno_t rc = copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-	
-	return (sys_errno_t) iospace_enable((task_id_t) arg.task_id,
+	int rc = copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
+	if (rc != 0)
+		return (sysarg_t) rc;
+	
+	return (sysarg_t) iospace_enable((task_id_t) arg.task_id,
 	    (uintptr_t) arg.ioaddr, (size_t) arg.size);
 }
 
-sys_errno_t sys_iospace_disable(ddi_ioarg_t *uspace_io_arg)
+sysarg_t sys_iospace_disable(ddi_ioarg_t *uspace_io_arg)
 {
 	ddi_ioarg_t arg;
-	errno_t rc = copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-
-	return (sys_errno_t) iospace_disable((task_id_t) arg.task_id,
+	int rc = copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
+	if (rc != 0)
+		return (sysarg_t) rc;
+
+	return (sysarg_t) iospace_disable((task_id_t) arg.task_id,
 	    (uintptr_t) arg.ioaddr, (size_t) arg.size);
 }
 
-NO_TRACE static errno_t dmamem_map(uintptr_t virt, size_t size, unsigned int map_flags,
+NO_TRACE static int dmamem_map(uintptr_t virt, size_t size, unsigned int map_flags,
     unsigned int flags, uintptr_t *phys)
 {
@@ -375,5 +375,5 @@
 }
 
-NO_TRACE static errno_t dmamem_map_anonymous(size_t size, uintptr_t constraint,
+NO_TRACE static int dmamem_map_anonymous(size_t size, uintptr_t constraint,
     unsigned int map_flags, unsigned int flags, uintptr_t *phys,
     uintptr_t *virt, uintptr_t bound)
@@ -403,5 +403,5 @@
 }
 
-NO_TRACE static errno_t dmamem_unmap(uintptr_t virt, size_t size)
+NO_TRACE static int dmamem_unmap(uintptr_t virt, size_t size)
 {
 	// TODO: implement unlocking & unmap
@@ -409,10 +409,10 @@
 }
 
-NO_TRACE static errno_t dmamem_unmap_anonymous(uintptr_t virt)
+NO_TRACE static int dmamem_unmap_anonymous(uintptr_t virt)
 {
 	return as_area_destroy(TASK->as, virt);
 }
 
-sys_errno_t sys_dmamem_map(size_t size, unsigned int map_flags, unsigned int flags,
+sysarg_t sys_dmamem_map(size_t size, unsigned int map_flags, unsigned int flags,
     void *phys_ptr, void *virt_ptr, uintptr_t bound)
 {
@@ -423,5 +423,5 @@
 		
 		uintptr_t phys;
-		errno_t rc = dmamem_map((uintptr_t) virt_ptr, size, map_flags,
+		int rc = dmamem_map((uintptr_t) virt_ptr, size, map_flags,
 		    flags, &phys);
 		
@@ -440,5 +440,5 @@
 		
 		uintptr_t constraint;
-		errno_t rc = copy_from_uspace(&constraint, phys_ptr,
+		int rc = copy_from_uspace(&constraint, phys_ptr,
 		    sizeof(constraint));
 		if (rc != EOK)
@@ -472,5 +472,5 @@
 }
 
-sys_errno_t sys_dmamem_unmap(uintptr_t virt, size_t size, unsigned int flags)
+sysarg_t sys_dmamem_unmap(uintptr_t virt, size_t size, unsigned int flags)
 {
 	if ((flags & DMAMEM_FLAGS_ANONYMOUS) == 0)
Index: kernel/generic/src/debug/panic.c
===================================================================
--- kernel/generic/src/debug/panic.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/debug/panic.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,5 @@
 #include <print.h>
 #include <stacktrace.h>
-#include <halt.h>
+#include <func.h>
 #include <typedefs.h>
 #include <mm/as.h>
Index: kernel/generic/src/debug/symtab.c
===================================================================
--- kernel/generic/src/debug/symtab.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/debug/symtab.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,9 +50,9 @@
  * @param offset Place to store offset from the symbol address.
  *
- * @return Zero on success or an error code, ENOENT if not found,
+ * @return Zero on success or negative error code, ENOENT if not found,
  *         ENOTSUP if symbol table not available.
  *
  */
-errno_t symtab_name_lookup(uintptr_t addr, const char **name, uintptr_t *offset)
+int symtab_name_lookup(uintptr_t addr, const char **name, uintptr_t *offset)
 {
 #ifdef CONFIG_SYMTAB
@@ -96,5 +96,5 @@
 {
 	const char *name;
-	errno_t rc = symtab_name_lookup(addr, &name, NULL);
+	int rc = symtab_name_lookup(addr, &name, NULL);
 	
 	switch (rc) {
@@ -156,5 +156,5 @@
  *
  */
-errno_t symtab_addr_lookup(const char *name, uintptr_t *addr)
+int symtab_addr_lookup(const char *name, uintptr_t *addr)
 {
 #ifdef CONFIG_SYMTAB
Index: kernel/generic/src/ipc/event.c
===================================================================
--- kernel/generic/src/ipc/event.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/event.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -138,8 +138,8 @@
 }
 
-static errno_t event_enqueue(event_t *event, bool mask, sysarg_t a1, sysarg_t a2,
+static int event_enqueue(event_t *event, bool mask, sysarg_t a1, sysarg_t a2,
     sysarg_t a3, sysarg_t a4, sysarg_t a5)
 {
-	errno_t res;
+	int res;
 
 	spinlock_lock(&event->lock);
@@ -206,5 +206,5 @@
  *
  */
-errno_t event_notify(event_type_t evno, bool mask, sysarg_t a1, sysarg_t a2,
+int event_notify(event_type_t evno, bool mask, sysarg_t a1, sysarg_t a2,
     sysarg_t a3, sysarg_t a4, sysarg_t a5)
 {
@@ -234,5 +234,5 @@
  *
  */
-errno_t event_task_notify(task_t *task, event_task_type_t evno, bool mask,
+int event_task_notify(task_t *task, event_task_type_t evno, bool mask,
     sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4, sysarg_t a5)
 {
@@ -255,8 +255,8 @@
  *
  */
-static errno_t event_subscribe(event_t *event, sysarg_t imethod,
+static int event_subscribe(event_t *event, sysarg_t imethod,
     answerbox_t *answerbox)
 {
-	errno_t res;
+	int res;
 	
 	spinlock_lock(&event->lock);
@@ -286,7 +286,7 @@
  *
  */
-static errno_t event_unsubscribe(event_t *event, answerbox_t *answerbox)
-{
-	errno_t res;
+static int event_unsubscribe(event_t *event, answerbox_t *answerbox)
+{
+	int res;
 	
 	spinlock_lock(&event->lock);
@@ -338,10 +338,10 @@
  *
  */
-sys_errno_t sys_ipc_event_subscribe(sysarg_t evno, sysarg_t imethod)
+sysarg_t sys_ipc_event_subscribe(sysarg_t evno, sysarg_t imethod)
 {
 	if (evno >= EVENT_TASK_END)
 		return ELIMIT;
 	
-	return (sys_errno_t) event_subscribe(evno2event(evno, TASK),
+	return (sysarg_t) event_subscribe(evno2event(evno, TASK),
 	    (sysarg_t) imethod, &TASK->answerbox);
 }
@@ -357,10 +357,10 @@
  *
  */
-sys_errno_t sys_ipc_event_unsubscribe(sysarg_t evno)
+sysarg_t sys_ipc_event_unsubscribe(sysarg_t evno)
 {
 	if (evno >= EVENT_TASK_END)
 		return ELIMIT;
 	
-	return (sys_errno_t) event_unsubscribe(evno2event(evno, TASK),
+	return (sysarg_t) event_unsubscribe(evno2event(evno, TASK),
 	    &TASK->answerbox);
 }
@@ -379,5 +379,5 @@
  *
  */
-sys_errno_t sys_ipc_event_unmask(sysarg_t evno)
+sysarg_t sys_ipc_event_unmask(sysarg_t evno)
 {
 	if (evno >= EVENT_TASK_END)
Index: kernel/generic/src/ipc/ipc.c
===================================================================
--- kernel/generic/src/ipc/ipc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/ipc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -205,8 +205,8 @@
  * @param request Call structure with request.
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t ipc_call_sync(phone_t *phone, call_t *request)
+ * @return EOK on success or a negative error code.
+ *
+ */
+int ipc_call_sync(phone_t *phone, call_t *request)
 {
 	answerbox_t *mybox = slab_alloc(answerbox_cache, 0);
@@ -216,5 +216,5 @@
 	request->callerbox = mybox;
 	
-	errno_t rc = ipc_call(phone, request);
+	int rc = ipc_call(phone, request);
 	if (rc != EOK) {
 		slab_free(answerbox_cache, mybox);
@@ -371,5 +371,5 @@
  *
  */
-void ipc_backsend_err(phone_t *phone, call_t *call, errno_t err)
+void ipc_backsend_err(phone_t *phone, call_t *call, sysarg_t err)
 {
 	_ipc_call_actions_internal(phone, call, false);
@@ -415,5 +415,5 @@
  *
  */
-errno_t ipc_call(phone_t *phone, call_t *call)
+int ipc_call(phone_t *phone, call_t *call)
 {
 	mutex_lock(&phone->lock);
@@ -444,9 +444,9 @@
  * @param phone Phone structure to be hung up.
  *
- * @return EOK if the phone is disconnected.
- * @return EINVAL if the phone was already disconnected.
- *
- */
-errno_t ipc_phone_hangup(phone_t *phone)
+ * @return 0 if the phone is disconnected.
+ * @return -1 if the phone was already disconnected.
+ *
+ */
+int ipc_phone_hangup(phone_t *phone)
 {
 	mutex_lock(&phone->lock);
@@ -455,5 +455,5 @@
 	    phone->state == IPC_PHONE_CONNECTING) {
 		mutex_unlock(&phone->lock);
-		return EINVAL;
+		return -1;
 	}
 	
@@ -478,5 +478,5 @@
 	mutex_unlock(&phone->lock);
 	
-	return EOK;
+	return 0;
 }
 
@@ -495,5 +495,5 @@
  *
  */
-errno_t ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox,
+int ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox,
     unsigned int mode)
 {
@@ -535,9 +535,9 @@
 	uint64_t answer_cnt = 0;
 	uint64_t call_cnt = 0;
-	errno_t rc;
+	int rc;
 	
 restart:
-	rc = waitq_sleep_timeout(&box->wq, usec, flags, NULL);
-	if (rc != EOK)
+	rc = waitq_sleep_timeout(&box->wq, usec, flags);
+	if (SYNCH_FAILED(rc))
 		return NULL;
 	
@@ -638,5 +638,5 @@
 		phone = list_get_instance(list_first(&box->connected_phones),
 		    phone_t, link);
-		if (mutex_trylock(&phone->lock) != EOK) {
+		if (SYNCH_FAILED(mutex_trylock(&phone->lock))) {
 			irq_spinlock_unlock(&box->lock, true);
 			DEADLOCK_PROBE(p_phonelck, DEADLOCK_THRESHOLD);
Index: kernel/generic/src/ipc/ipcrsc.c
===================================================================
--- kernel/generic/src/ipc/ipcrsc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/ipcrsc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -166,13 +166,11 @@
  * @param task  Task for which to allocate a new phone.
  *
- * @param[out] out_handle  New phone capability handle.
- *
- * @return  An error code if a new capability cannot be allocated.
- */
-errno_t phone_alloc(task_t *task, cap_handle_t *out_handle)
-{
-	cap_handle_t handle;
-	errno_t rc = cap_alloc(task, &handle);
-	if (rc == EOK) {
+ * @return  New phone capability handle.
+ * @return  Negative error code if a new capability cannot be allocated.
+ */
+cap_handle_t phone_alloc(task_t *task)
+{
+	cap_handle_t handle = cap_alloc(task);
+	if (handle >= 0) {
 		phone_t *phone = slab_alloc(phone_cache, FRAME_ATOMIC);
 		if (!phone) {
@@ -195,8 +193,7 @@
 		
 		cap_publish(task, handle, kobject);
-
-		*out_handle = handle;
 	}
-	return rc;
+	
+	return handle;
 }
 
Index: kernel/generic/src/ipc/irq.c
===================================================================
--- kernel/generic/src/ipc/irq.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/irq.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -78,5 +78,5 @@
 }
 
-static errno_t ranges_map_and_apply(irq_pio_range_t *ranges, size_t rangecount,
+static int ranges_map_and_apply(irq_pio_range_t *ranges, size_t rangecount,
     irq_cmd_t *cmds, size_t cmdcount)
 {
@@ -164,5 +164,5 @@
  *
  */
-static errno_t code_check(irq_cmd_t *cmds, size_t cmdcount)
+static int code_check(irq_cmd_t *cmds, size_t cmdcount)
 {
 	for (size_t i = 0; i < cmdcount; i++) {
@@ -226,5 +226,5 @@
 	
 	irq_code_t *code = malloc(sizeof(*code), 0);
-	errno_t rc = copy_from_uspace(code, ucode, sizeof(*code));
+	int rc = copy_from_uspace(code, ucode, sizeof(*code));
 	if (rc != EOK)
 		goto error;
@@ -308,11 +308,10 @@
  * @param ucode   Uspace pointer to top-half IRQ code.
  *
- * @param[out] uspace_handle  Uspace pointer to IRQ capability handle
- *
- * @return  Error code.
- *
- */
-errno_t ipc_irq_subscribe(answerbox_t *box, inr_t inr, sysarg_t imethod,
-    irq_code_t *ucode, cap_handle_t *uspace_handle)
+ * @return  IRQ capability handle.
+ * @return  Negative error code.
+ *
+ */
+int ipc_irq_subscribe(answerbox_t *box, inr_t inr, sysarg_t imethod,
+    irq_code_t *ucode)
 {
 	if ((inr < 0) || (inr > last_inr))
@@ -330,15 +329,8 @@
 	 * Allocate and populate the IRQ kernel object.
 	 */
-	cap_handle_t handle;
-	errno_t rc = cap_alloc(TASK, &handle);
-	if (rc != EOK)
-		return rc;
-	
-	rc = copy_to_uspace(uspace_handle, &handle, sizeof(cap_handle_t));
-	if (rc != EOK) {
-		cap_free(TASK, handle);
-		return rc;
-	}
-
+	cap_handle_t handle = cap_alloc(TASK);
+	if (handle < 0)
+		return handle;
+	
 	irq_t *irq = (irq_t *) slab_alloc(irq_cache, FRAME_ATOMIC);
 	if (!irq) {
@@ -379,5 +371,5 @@
 	cap_publish(TASK, handle, kobject);
 	
-	return EOK;
+	return handle;
 }
 
@@ -387,8 +379,8 @@
  * @param handle  IRQ capability handle.
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t ipc_irq_unsubscribe(answerbox_t *box, int handle)
+ * @return EOK on success or a negative error code.
+ *
+ */
+int ipc_irq_unsubscribe(answerbox_t *box, int handle)
 {
 	kobject_t *kobj = cap_unpublish(TASK, handle, KOBJECT_TYPE_IRQ);
Index: kernel/generic/src/ipc/kbox.c
===================================================================
--- kernel/generic/src/ipc/kbox.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/kbox.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -206,9 +206,8 @@
  * cleanup code.
  *
- * @param[out] out_phone  Phone capability handle on success.
- * @return Error code.
- *
- */
-errno_t ipc_connect_kbox(task_id_t taskid, cap_handle_t *out_phone)
+ * @return Phone capability handle on success, or negative error code.
+ *
+ */
+int ipc_connect_kbox(task_id_t taskid)
 {
 	irq_spinlock_lock(&tasks_lock, true);
@@ -232,29 +231,13 @@
 	}
 	
-	if (task->kb.finished) {
+	if (task->kb.finished != false) {
 		mutex_unlock(&task->kb.cleanup_lock);
 		return EINVAL;
 	}
 	
-	/* Create a kbox thread if necessary. */
-	if (task->kb.thread == NULL) {
-		thread_t *kb_thread = thread_create(kbox_thread_proc, NULL, task,
-		    THREAD_FLAG_NONE, "kbox");
-		
-		if (!kb_thread) {
-			mutex_unlock(&task->kb.cleanup_lock);
-			return ENOMEM;
-		}
-		
-		task->kb.thread = kb_thread;
-		thread_ready(kb_thread);
-	}
-	
-	/* Allocate a new phone. */
-	cap_handle_t phone_handle;
-	errno_t rc = phone_alloc(TASK, &phone_handle);
-	if (rc != EOK) {
-		mutex_unlock(&task->kb.cleanup_lock);
-		return rc;
+	cap_handle_t phone_handle = phone_alloc(TASK);
+	if (phone_handle < 0) {
+		mutex_unlock(&task->kb.cleanup_lock);
+		return phone_handle;
 	}
 	
@@ -265,7 +248,23 @@
 	(void) ipc_phone_connect(phone_obj->phone, &task->kb.box);
 	
+	if (task->kb.thread != NULL) {
+		mutex_unlock(&task->kb.cleanup_lock);
+		return phone_handle;
+	}
+	
+	/* Create a kbox thread */
+	thread_t *kb_thread = thread_create(kbox_thread_proc, NULL, task,
+	    THREAD_FLAG_NONE, "kbox");
+	if (!kb_thread) {
+		mutex_unlock(&task->kb.cleanup_lock);
+		return ENOMEM;
+	}
+	
+	task->kb.thread = kb_thread;
+	thread_ready(kb_thread);
+	
 	mutex_unlock(&task->kb.cleanup_lock);
-	*out_phone = phone_handle;
-	return EOK;
+	
+	return phone_handle;
 }
 
Index: kernel/generic/src/ipc/ops/conctmeto.c
===================================================================
--- kernel/generic/src/ipc/ops/conctmeto.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/ops/conctmeto.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,15 +40,12 @@
 #include <arch.h>
 
-static errno_t request_preprocess(call_t *call, phone_t *phone)
+static int request_preprocess(call_t *call, phone_t *phone)
 {
-	cap_handle_t phone_handle;
-	errno_t rc = phone_alloc(TASK, &phone_handle);
+	cap_handle_t phone_handle = phone_alloc(TASK);
 
-	/* Remember the phone capability or that an error occured. */
-	call->priv = (rc == EOK) ? phone_handle : -1;
-
-	if (rc != EOK) {
-		return rc;
-	}
+	/* Remember the phone capability or the error. */
+	call->priv = phone_handle;
+	if (phone_handle < 0)
+		return phone_handle;
 
 	/* Set arg5 for server */
@@ -61,12 +58,7 @@
 }
 
-static errno_t request_forget(call_t *call)
+static int request_forget(call_t *call)
 {
 	cap_handle_t phone_handle = (cap_handle_t) call->priv;
-
-	if (phone_handle < 0) {
-		return EOK;
-	}
-
 	phone_dealloc(phone_handle);
 	/* Hand over reference from ARG5 to phone->kobject */
@@ -77,5 +69,5 @@
 }
 
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
+static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
 {
 	/* Hand over reference from ARG5 to phone */
@@ -93,5 +85,5 @@
 }
 
-static errno_t answer_process(call_t *answer)
+static int answer_process(call_t *answer)
 {
 	cap_handle_t phone_handle = (cap_handle_t) answer->priv;
Index: kernel/generic/src/ipc/ops/concttome.c
===================================================================
--- kernel/generic/src/ipc/ops/concttome.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/ops/concttome.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,11 +42,12 @@
 static int request_process(call_t *call, answerbox_t *box)
 {
-	cap_handle_t phone_handle;
-	errno_t rc = phone_alloc(TASK, &phone_handle);
-	IPC_SET_ARG5(call->data, (rc == EOK) ? phone_handle : -1);
-	return 0;
+	cap_handle_t phone_handle = phone_alloc(TASK);
+
+	IPC_SET_ARG5(call->data, phone_handle);
+	
+	return EOK;
 }
 
-static errno_t answer_cleanup(call_t *answer, ipc_data_t *olddata)
+static int answer_cleanup(call_t *answer, ipc_data_t *olddata)
 {
 	cap_handle_t phone_handle = (cap_handle_t) IPC_GET_ARG5(*olddata);
@@ -58,5 +59,5 @@
 }
 
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
+static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
 {
 	cap_handle_t phone_handle = (cap_handle_t) IPC_GET_ARG5(*olddata);
Index: kernel/generic/src/ipc/ops/dataread.c
===================================================================
--- kernel/generic/src/ipc/ops/dataread.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/ops/dataread.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 #include <config.h>
 
-static errno_t request_preprocess(call_t *call, phone_t *phone)
+static int request_preprocess(call_t *call, phone_t *phone)
 {
 	size_t size = IPC_GET_ARG2(call->data);
@@ -57,5 +57,5 @@
 }
 
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
+static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
 {
 	assert(!answer->buffer);
@@ -76,5 +76,5 @@
 				
 			answer->buffer = malloc(size, 0);
-			errno_t rc = copy_from_uspace(answer->buffer,
+			int rc = copy_from_uspace(answer->buffer,
 			    (void *) src, size);
 			if (rc) {
@@ -95,10 +95,10 @@
 }
 
-static errno_t answer_process(call_t *answer)
+static int answer_process(call_t *answer)
 {
 	if (answer->buffer) {
 		uintptr_t dst = IPC_GET_ARG1(answer->data);
 		size_t size = IPC_GET_ARG2(answer->data);
-		errno_t rc;
+		int rc;
 
 		rc = copy_to_uspace((void *) dst, answer->buffer, size);
Index: kernel/generic/src/ipc/ops/datawrite.c
===================================================================
--- kernel/generic/src/ipc/ops/datawrite.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/ops/datawrite.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 #include <config.h>
 
-static errno_t request_preprocess(call_t *call, phone_t *phone)
+static int request_preprocess(call_t *call, phone_t *phone)
 {
 	uintptr_t src = IPC_GET_ARG1(call->data);
@@ -57,6 +57,6 @@
 
 	call->buffer = (uint8_t *) malloc(size, 0);
-	errno_t rc = copy_from_uspace(call->buffer, (void *) src, size);
-	if (rc != EOK) {
+	int rc = copy_from_uspace(call->buffer, (void *) src, size);
+	if (rc != 0) {
 		/*
 		 * call->buffer will be cleaned up in ipc_call_free() at the
@@ -69,5 +69,5 @@
 }
 
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
+static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
 {
 	assert(answer->buffer);
@@ -80,5 +80,5 @@
 			
 		if (size <= max_size) {
-			errno_t rc = copy_to_uspace((void *) dst,
+			int rc = copy_to_uspace((void *) dst,
 			    answer->buffer, size);
 			if (rc)
Index: kernel/generic/src/ipc/ops/debug.c
===================================================================
--- kernel/generic/src/ipc/ops/debug.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/ops/debug.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,10 +44,10 @@
 }
 
-static errno_t answer_process(call_t *answer)
+static int answer_process(call_t *answer)
 {
 	if (answer->buffer) {
 		uintptr_t dst = IPC_GET_ARG1(answer->data);
 		size_t size = IPC_GET_ARG2(answer->data);
-		errno_t rc;
+		int rc;
 
 		rc = copy_to_uspace((void *) dst, answer->buffer, size);
Index: kernel/generic/src/ipc/ops/pagein.c
===================================================================
--- kernel/generic/src/ipc/ops/pagein.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/ops/pagein.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,5 @@
 #include <arch.h>
 
-static errno_t pagein_request_preprocess(call_t *call, phone_t *phone)
+static int pagein_request_process(call_t *call, answerbox_t *box)
 {
 	/*
@@ -52,5 +52,5 @@
 	 * wanted to be each other's pager.
 	 */
-	if (TASK->taskid <= phone->callee->task->taskid)
+	if (call->sender->taskid <= TASK->taskid)
 		return ENOTSUP;
 	else
@@ -58,5 +58,5 @@
 }
 
-static errno_t pagein_answer_preprocess(call_t *answer, ipc_data_t *olddata)
+static int pagein_answer_preprocess(call_t *answer, ipc_data_t *olddata)
 {
 	/*
@@ -97,7 +97,7 @@
 
 sysipc_ops_t ipc_m_page_in_ops = {
-	.request_preprocess = pagein_request_preprocess,
+	.request_preprocess = null_request_preprocess,
 	.request_forget = null_request_forget,
-	.request_process = null_request_process,
+	.request_process = pagein_request_process,
 	.answer_cleanup = null_answer_cleanup,
 	.answer_preprocess = pagein_answer_preprocess,
Index: kernel/generic/src/ipc/ops/sharein.c
===================================================================
--- kernel/generic/src/ipc/ops/sharein.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/ops/sharein.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 #include <arch.h>
 
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
+static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
 {
 	if (!IPC_GET_RETVAL(answer->data)) {
@@ -49,5 +49,5 @@
 			
 		uintptr_t dst_base = (uintptr_t) -1;
-		errno_t rc = as_area_share(AS, IPC_GET_ARG1(answer->data),
+		int rc = as_area_share(AS, IPC_GET_ARG1(answer->data),
 		    IPC_GET_ARG1(*olddata), as, IPC_GET_ARG2(answer->data),
 		    &dst_base, IPC_GET_ARG3(answer->data));
Index: kernel/generic/src/ipc/ops/shareout.c
===================================================================
--- kernel/generic/src/ipc/ops/shareout.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/ops/shareout.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 #include <arch.h>
 
-static errno_t request_preprocess(call_t *call, phone_t *phone)
+static int request_preprocess(call_t *call, phone_t *phone)
 {
 	size_t size = as_area_get_size(IPC_GET_ARG1(call->data));
@@ -53,7 +53,7 @@
 }
 
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
+static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	if (!IPC_GET_RETVAL(answer->data)) {
Index: kernel/generic/src/ipc/ops/stchngath.c
===================================================================
--- kernel/generic/src/ipc/ops/stchngath.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/ops/stchngath.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 #include <macros.h>
 
-static errno_t request_preprocess(call_t *call, phone_t *phone)
+static int request_preprocess(call_t *call, phone_t *phone)
 {
 	task_t *other_task_s;
@@ -68,7 +68,7 @@
 }
 
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
+static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	if (!IPC_GET_RETVAL(answer->data)) {
Index: kernel/generic/src/ipc/sysipc.c
===================================================================
--- kernel/generic/src/ipc/sysipc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/sysipc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -155,10 +155,10 @@
  * @param olddata Saved data of the request.
  *
- * @return Return EOK on success or an error code.
- *
- */
-errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
-{
-	errno_t rc = EOK;
+ * @return Return EOK on success or a negative error code.
+ *
+ */
+int answer_preprocess(call_t *answer, ipc_data_t *olddata)
+{
+	int rc = EOK;
 
 	spinlock_lock(&answer->forget_lock);
@@ -194,5 +194,5 @@
 	spinlock_unlock(&answer->forget_lock);
 
-	if ((errno_t) IPC_GET_RETVAL(answer->data) == EHANGUP) {
+	if ((native_t) IPC_GET_RETVAL(answer->data) == EHANGUP) {
 		phone_t *phone = answer->caller_phone;
 		mutex_lock(&phone->lock);
@@ -222,5 +222,5 @@
  *
  */
-static errno_t request_preprocess(call_t *call, phone_t *phone)
+static int request_preprocess(call_t *call, phone_t *phone)
 {
 	call->request_method = IPC_GET_IMETHOD(call->data);
@@ -239,5 +239,5 @@
 static void process_answer(call_t *call)
 {
-	if (((errno_t) IPC_GET_RETVAL(call->data) == EHANGUP) &&
+	if (((native_t) IPC_GET_RETVAL(call->data) == EHANGUP) &&
 	    (call->flags & IPC_CALL_FORWARDED))
 		IPC_SET_RETVAL(call->data, EFORWARD);
@@ -271,5 +271,5 @@
  *
  */
-errno_t ipc_req_internal(cap_handle_t handle, ipc_data_t *data, sysarg_t priv)
+int ipc_req_internal(cap_handle_t handle, ipc_data_t *data, sysarg_t priv)
 {
 	kobject_t *kobj = kobject_get(TASK, handle, KOBJECT_TYPE_PHONE);
@@ -281,5 +281,5 @@
 	memcpy(call->data.args, data->args, sizeof(data->args));
 	
-	errno_t rc = request_preprocess(call, kobj->phone);
+	int rc = request_preprocess(call, kobj->phone);
 	if (!rc) {
 #ifdef CONFIG_UDEBUG
@@ -359,8 +359,8 @@
  *
  * @return EOK on success.
- * @return An error code on error.
- *
- */
-sys_errno_t sys_ipc_call_async_fast(sysarg_t handle, sysarg_t imethod,
+ * @return Negative error code on error.
+ *
+ */
+sysarg_t sys_ipc_call_async_fast(sysarg_t handle, sysarg_t imethod,
     sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t label)
 {
@@ -389,5 +389,5 @@
 	call->data.label = label;
 	
-	errno_t res = request_preprocess(call, kobj->phone);
+	int res = request_preprocess(call, kobj->phone);
 	
 	if (!res)
@@ -409,5 +409,5 @@
  *
  */
-sys_errno_t sys_ipc_call_async_slow(sysarg_t handle, ipc_data_t *data,
+sysarg_t sys_ipc_call_async_slow(sysarg_t handle, ipc_data_t *data,
     sysarg_t label)
 {
@@ -422,10 +422,10 @@
 
 	call_t *call = ipc_call_alloc(0);
-	errno_t rc = copy_from_uspace(&call->data.args, &data->args,
+	int rc = copy_from_uspace(&call->data.args, &data->args,
 	    sizeof(call->data.args));
-	if (rc != EOK) {
+	if (rc != 0) {
 		kobject_put(call->kobject);
 		kobject_put(kobj);
-		return (sys_errno_t) rc;
+		return (sysarg_t) rc;
 	}
 
@@ -433,5 +433,5 @@
 	call->data.label = label;
 	
-	errno_t res = request_preprocess(call, kobj->phone);
+	int res = request_preprocess(call, kobj->phone);
 	
 	if (!res)
@@ -466,5 +466,5 @@
  *
  */
-static sys_errno_t sys_ipc_forward_common(sysarg_t chandle, sysarg_t phandle,
+static sysarg_t sys_ipc_forward_common(sysarg_t chandle, sysarg_t phandle,
     sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
     sysarg_t arg4, sysarg_t arg5, unsigned int mode, bool slow)
@@ -482,5 +482,5 @@
 	
 	bool after_forward = false;
-	errno_t rc;
+	int rc;
 
 	kobject_t *pkobj = kobject_get(TASK, phandle, KOBJECT_TYPE_PHONE);
@@ -577,5 +577,5 @@
  *
  */
-sys_errno_t sys_ipc_forward_fast(sysarg_t chandle, sysarg_t phandle,
+sysarg_t sys_ipc_forward_fast(sysarg_t chandle, sysarg_t phandle,
     sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
 {
@@ -601,12 +601,12 @@
  *
  */
-sys_errno_t sys_ipc_forward_slow(sysarg_t chandle, sysarg_t phandle,
+sysarg_t sys_ipc_forward_slow(sysarg_t chandle, sysarg_t phandle,
     ipc_data_t *data, unsigned int mode)
 {
 	ipc_data_t newdata;
-	errno_t rc = copy_from_uspace(&newdata.args, &data->args,
+	int rc = copy_from_uspace(&newdata.args, &data->args,
 	    sizeof(newdata.args));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
+	if (rc != 0)
+		return (sysarg_t) rc;
 	
 	return sys_ipc_forward_common(chandle, phandle,
@@ -631,5 +631,5 @@
  *
  */
-sys_errno_t sys_ipc_answer_fast(sysarg_t chandle, sysarg_t retval, sysarg_t arg1,
+sysarg_t sys_ipc_answer_fast(sysarg_t chandle, sysarg_t retval, sysarg_t arg1,
     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
 {
@@ -660,5 +660,5 @@
 	 */
 	IPC_SET_ARG5(call->data, 0);
-	errno_t rc = answer_preprocess(call, saved ? &saved_data : NULL);
+	int rc = answer_preprocess(call, saved ? &saved_data : NULL);
 	
 	ipc_answer(&TASK->answerbox, call);
@@ -678,5 +678,5 @@
  *
  */
-sys_errno_t sys_ipc_answer_slow(sysarg_t chandle, ipc_data_t *data)
+sysarg_t sys_ipc_answer_slow(sysarg_t chandle, ipc_data_t *data)
 {
 	kobject_t *kobj = cap_unpublish(TASK, chandle, KOBJECT_TYPE_CALL);
@@ -695,7 +695,7 @@
 		saved = false;
 	
-	errno_t rc = copy_from_uspace(&call->data.args, &data->args, 
+	int rc = copy_from_uspace(&call->data.args, &data->args, 
 	    sizeof(call->data.args));
-	if (rc != EOK) {
+	if (rc != 0) {
 		/*
 		 * Republish the capability so that the call does not get lost.
@@ -722,5 +722,5 @@
  *
  */
-sys_errno_t sys_ipc_hangup(sysarg_t handle)
+sysarg_t sys_ipc_hangup(sysarg_t handle)
 {
 	kobject_t *kobj = kobject_get(TASK, handle, KOBJECT_TYPE_PHONE);
@@ -728,7 +728,11 @@
 		return ENOENT;
 	
-	errno_t rc = ipc_phone_hangup(kobj->phone);
+	if (ipc_phone_hangup(kobj->phone)) {
+		kobject_put(kobj);
+		return -1;
+	}
+	
 	kobject_put(kobj);
-	return rc;
+	return 0;
 }
 
@@ -740,7 +744,9 @@
  *                 for explanation.
  *
- * @return An error code on error.
- */
-sys_errno_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
+ * @return Capability handle of the received request.
+ * @return CAP_NIL for answers, notifications and when there is no call.
+ * @return Negative error code on error.
+ */
+sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
     unsigned int flags)
 {
@@ -761,21 +767,18 @@
 
 	if (!call) {
-		ipc_data_t data = {};
-		data.cap_handle = CAP_NIL;
-		STRUCT_TO_USPACE(calldata, &data);
-		return EOK;
-	}
-	
-	call->data.flags = call->flags;
+		STRUCT_TO_USPACE(calldata, &(ipc_data_t){});
+		return CAP_NIL;
+	}
+	
 	if (call->flags & IPC_CALL_NOTIF) {
 		/* Set in_phone_hash to the interrupt counter */
 		call->data.phone = (void *) call->priv;
 		
-		call->data.cap_handle = CAP_NIL;
+		call->data.flags = IPC_CALL_NOTIF;
 
 		STRUCT_TO_USPACE(calldata, &call->data);
 		kobject_put(call->kobject);
 		
-		return EOK;
+		return CAP_NIL;
 	}
 	
@@ -788,10 +791,10 @@
 		}
 
-		call->data.cap_handle = CAP_NIL;
+		call->data.flags = IPC_CALL_ANSWERED;
 		
 		STRUCT_TO_USPACE(calldata, &call->data);
 		kobject_put(call->kobject);
 		
-		return EOK;
+		return CAP_NIL;
 	}
 	
@@ -799,12 +802,11 @@
 		goto restart;
 	
-	cap_handle_t handle;
-	errno_t rc = cap_alloc(TASK, &handle);
-	if (rc != EOK) {
+	int rc;
+	cap_handle_t handle = cap_alloc(TASK);
+	if (handle < 0) {
+		rc = handle;
 		goto error;
 	}
 	
-	call->data.cap_handle = handle;
-
 	/*
 	 * Include phone hash of the caller in the request, copy the whole
@@ -817,5 +819,5 @@
 	kobject_add_ref(call->kobject);
 	cap_publish(TASK, handle, call->kobject);
-	return EOK;
+	return handle;
 
 error:
@@ -825,6 +827,5 @@
 	/*
 	 * The callee will not receive this call and no one else has a chance to
-	 * answer it. Set the IPC_CALL_AUTO_REPLY flag and return the EPARTY
-	 * error code.
+	 * answer it. Reply with the EPARTY error code.
 	 */
 	ipc_data_t saved_data;
@@ -839,5 +840,4 @@
 	IPC_SET_RETVAL(call->data, EPARTY);
 	(void) answer_preprocess(call, saved ? &saved_data : NULL);
-	call->flags |= IPC_CALL_AUTO_REPLY;
 	ipc_answer(&TASK->answerbox, call);
 
@@ -848,5 +848,5 @@
  *
  */
-sys_errno_t sys_ipc_poke(void)
+sysarg_t sys_ipc_poke(void)
 {
 	waitq_unsleep(&TASK->answerbox.wq);
@@ -860,17 +860,15 @@
  * @param ucode   Uspace pointer to the top-half pseudocode.
  *
- * @param[out] uspace_handle  Uspace pointer to IRQ kernel object capability
- *
+ * @return IRQ kernel object capability
  * @return EPERM
  * @return Error code returned by ipc_irq_subscribe().
  *
  */
-sys_errno_t sys_ipc_irq_subscribe(inr_t inr, sysarg_t imethod, irq_code_t *ucode,
-	cap_handle_t *uspace_handle)
+sysarg_t sys_ipc_irq_subscribe(inr_t inr, sysarg_t imethod, irq_code_t *ucode)
 {
 	if (!(perm_get(TASK) & PERM_IRQ_REG))
 		return EPERM;
 	
-	return ipc_irq_subscribe(&TASK->answerbox, inr, imethod, ucode, uspace_handle);
+	return ipc_irq_subscribe(&TASK->answerbox, inr, imethod, ucode);
 }
 
@@ -883,5 +881,5 @@
  *
  */
-sys_errno_t sys_ipc_irq_unsubscribe(sysarg_t cap)
+sysarg_t sys_ipc_irq_unsubscribe(sysarg_t cap)
 {
 	if (!(perm_get(TASK) & PERM_IRQ_REG))
@@ -893,34 +891,45 @@
 }
 
-/** Syscall connect to a task by ID
- *
- * @return Error code.
- *
- */
-sys_errno_t sys_ipc_connect_kbox(task_id_t *uspace_taskid, cap_handle_t *uspace_phone)
+#ifdef __32_BITS__
+
+/** Syscall connect to a task by ID (32 bits)
+ *
+ * @return Phone id on success, or negative error code.
+ *
+ */
+sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid)
 {
 #ifdef CONFIG_UDEBUG
-	task_id_t taskid;
-	cap_handle_t phone;
-	
-	errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(task_id_t));
-	if (rc == EOK) {
-		rc = ipc_connect_kbox((task_id_t) taskid, &phone);
-	}
-	
-	if (rc == EOK) {
-		rc = copy_to_uspace(uspace_phone, &phone, sizeof(cap_handle_t));
-		if (rc != EOK) {
-			// Clean up the phone on failure.
-			sys_ipc_hangup(phone);
-		}
-	}
-	
-	return (sys_errno_t) rc;
+	sysarg64_t taskid;
+	int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
+	if (rc != 0)
+		return (sysarg_t) rc;
+	
+	return ipc_connect_kbox((task_id_t) taskid);
 #else
-	return (sys_errno_t) ENOTSUP;
+	return (sysarg_t) ENOTSUP;
 #endif
 }
 
+#endif  /* __32_BITS__ */
+
+#ifdef __64_BITS__
+
+/** Syscall connect to a task by ID (64 bits)
+ *
+ * @return Phone id on success, or negative error code.
+ *
+ */
+sysarg_t sys_ipc_connect_kbox(sysarg_t taskid)
+{
+#ifdef CONFIG_UDEBUG
+	return ipc_connect_kbox((task_id_t) taskid);
+#else
+	return (sysarg_t) ENOTSUP;
+#endif
+}
+
+#endif  /* __64_BITS__ */
+
 /** @}
  */
Index: kernel/generic/src/ipc/sysipc_ops.c
===================================================================
--- kernel/generic/src/ipc/sysipc_ops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/ipc/sysipc_ops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -69,10 +69,10 @@
 };
 
-errno_t null_request_preprocess(call_t *call, phone_t *phone)
+int null_request_preprocess(call_t *call, phone_t *phone)
 {
 	return EOK;
 }
 
-errno_t null_request_forget(call_t *call)
+int null_request_forget(call_t *call)
 {
 	return EOK;
@@ -81,18 +81,18 @@
 int null_request_process(call_t *call, answerbox_t *box)
 {
-	return 0;
+	return EOK;
 }
 
-errno_t null_answer_cleanup(call_t *call, ipc_data_t *data)
+int null_answer_cleanup(call_t *call, ipc_data_t *data)
 {
 	return EOK;
 }
 
-errno_t null_answer_preprocess(call_t *call, ipc_data_t *data)
+int null_answer_preprocess(call_t *call, ipc_data_t *data)
 {
 	return EOK;
 }
 
-errno_t null_answer_process(call_t *call)
+int null_answer_process(call_t *call)
 {
 	return EOK;
Index: kernel/generic/src/lib/func.c
===================================================================
--- kernel/generic/src/lib/func.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ kernel/generic/src/lib/func.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup generic
+ * @{
+ */
+
+/**
+ * @file
+ * @brief Miscellaneous functions.
+ */
+
+#include <func.h>
+#include <log.h>
+#include <cpu.h>
+#include <arch/asm.h>
+#include <arch.h>
+#include <console/kconsole.h>
+
+atomic_t haltstate = {0}; /**< Halt flag */
+
+
+/** Halt wrapper
+ *
+ * Set halt flag and halt the CPU.
+ *
+ */
+void halt(void)
+{
+#if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE))
+	bool rundebugger = false;
+	
+	if (!atomic_get(&haltstate)) {
+		atomic_set(&haltstate, 1);
+		rundebugger = true;
+	}
+#else
+	atomic_set(&haltstate, 1);
+#endif
+	
+	interrupts_disable();
+	
+#if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE))
+	if ((rundebugger) && (kconsole_check_poll()))
+		kconsole("panic", "\nLast resort kernel console ready.\n", false);
+#endif
+	
+	if (CPU)
+		log(LF_OTHER, LVL_NOTE, "cpu%u: halted", CPU->id);
+	else
+		log(LF_OTHER, LVL_NOTE, "cpu: halted");
+	
+	cpu_halt();
+}
+
+/** @}
+ */
Index: rnel/generic/src/lib/halt.c
===================================================================
--- kernel/generic/src/lib/halt.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-
-/**
- * @file
- * @brief Halt function.
- */
-
-#include <halt.h>
-#include <log.h>
-#include <cpu.h>
-#include <arch/asm.h>
-#include <arch.h>
-#include <console/kconsole.h>
-
-/** Halt flag */
-atomic_t haltstate = {0};
-
-/** Halt wrapper
- *
- * Set halt flag and halt the CPU.
- *
- */
-void halt(void)
-{
-#if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE))
-	bool rundebugger = false;
-	
-	if (!atomic_get(&haltstate)) {
-		atomic_set(&haltstate, 1);
-		rundebugger = true;
-	}
-#else
-	atomic_set(&haltstate, 1);
-#endif
-	
-	interrupts_disable();
-	
-#if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE))
-	if ((rundebugger) && (kconsole_check_poll()))
-		kconsole("panic", "\nLast resort kernel console ready.\n", false);
-#endif
-	
-	if (CPU)
-		log(LF_OTHER, LVL_NOTE, "cpu%u: halted", CPU->id);
-	else
-		log(LF_OTHER, LVL_NOTE, "cpu: halted");
-	
-	cpu_halt();
-}
-
-/** @}
- */
Index: kernel/generic/src/lib/str.c
===================================================================
--- kernel/generic/src/lib/str.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/lib/str.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -217,5 +217,5 @@
  *         code was invalid.
  */
-errno_t chr_encode(const wchar_t ch, char *str, size_t *offset, size_t size)
+int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t size)
 {
 	if (*offset >= size)
@@ -794,5 +794,5 @@
  *
  */
-static errno_t str_uint(const char *nptr, char **endptr, unsigned int base,
+static int str_uint(const char *nptr, char **endptr, unsigned int base,
     bool *neg, uint64_t *result)
 {
@@ -915,5 +915,5 @@
  *
  */
-errno_t str_uint64_t(const char *nptr, char **endptr, unsigned int base,
+int str_uint64_t(const char *nptr, char **endptr, unsigned int base,
     bool strict, uint64_t *result)
 {
@@ -922,5 +922,5 @@
 	bool neg;
 	char *lendptr;
-	errno_t ret = str_uint(nptr, &lendptr, base, &neg, result);
+	int ret = str_uint(nptr, &lendptr, base, &neg, result);
 	
 	if (endptr != NULL)
Index: rnel/generic/src/lib/str_error.c
===================================================================
--- kernel/generic/src/lib/str_error.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <str.h>
-
-/* The arrays below are automatically generated from the same file that
- * errno.h constants are generated from. Triple-include of the same list
- * with redefinitions of __errno() macro are used to ensure that the
- * information cannot get out of synch. This is inpired by musl libc.
- */
-
-#undef __errno_entry
-#define __errno_entry(name, num, desc) name,
-
-static const errno_t err_num[] = {
-#include <abi/errno.in>
-};
-
-#undef __errno_entry
-#define __errno_entry(name, num, desc) #name,
-
-static const char* err_name[] = {
-#include <abi/errno.in>
-};
-
-#undef __errno_entry
-#define __errno_entry(name, num, desc) "[" #name "]" desc,
-
-static const char* err_desc[] = {
-#include <abi/errno.in>
-};
-
-/* Returns index corresponding to the given errno, or -1 if not found. */
-static int find_errno(errno_t e)
-{
-	/* Just a dumb linear search.
-	 * There too few entries to warrant anything smarter.
-	 */
-
-	int len = sizeof(err_num) / sizeof(errno_t);
-
-	for (int i = 0; i < len; i++) {
-		if (err_num[i] == e) {
-			return i;
-		}
-	}
-
-	return -1;
-}
-
-const char *str_error_name(errno_t e)
-{
-	int i = find_errno(e);
-
-	if (i >= 0) {
-		return err_name[i];
-	}
-
-	return "(unknown)";
-}
-
-const char *str_error(errno_t e)
-{
-	int i = find_errno(e);
-
-	if (i >= 0) {
-		return err_desc[i];
-	}
-
-	return "Unknown error code";
-}
-
Index: kernel/generic/src/log/log.c
===================================================================
--- kernel/generic/src/log/log.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/log/log.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -221,7 +221,7 @@
 		
 		size_t buffer_offset = 0;
-		errno_t rc = chr_encode(wstr[chars], buffer, &buffer_offset, 16);
+		int rc = chr_encode(wstr[chars], buffer, &buffer_offset, 16);
 		if (rc != EOK) {
-			return EOF;
+			return rc;
 		}
 		
@@ -293,12 +293,12 @@
  *
  */
-sys_errno_t sys_klog(sysarg_t operation, void *buf, size_t size,
-    sysarg_t level, size_t *uspace_nread)
+sysarg_t sys_klog(sysarg_t operation, void *buf, size_t size,
+    sysarg_t level)
 {
 	char *data;
-	errno_t rc;
+	int rc;
 	
 	if (size > PAGE_SIZE)
-		return (sys_errno_t) ELIMIT;
+		return (sysarg_t) ELIMIT;
 	
 	switch (operation) {
@@ -306,10 +306,10 @@
 			data = (char *) malloc(size + 1, 0);
 			if (!data)
-				return (sys_errno_t) ENOMEM;
+				return (sysarg_t) ENOMEM;
 			
 			rc = copy_from_uspace(data, buf, size);
 			if (rc) {
 				free(data);
-				return (sys_errno_t) rc;
+				return (sysarg_t) rc;
 			}
 			data[size] = 0;
@@ -325,5 +325,5 @@
 			data = (char *) malloc(size, 0);
 			if (!data)
-				return (sys_errno_t) ENOMEM;
+				return (sysarg_t) ENOMEM;
 			
 			size_t entry_len = 0;
@@ -366,5 +366,5 @@
 			if (rc != EOK) {
 				free(data);
-				return (sys_errno_t) rc;
+				return (sysarg_t) rc;
 			}
 			
@@ -374,10 +374,9 @@
 			
 			if (rc != EOK)
-				return (sys_errno_t) rc;
-			
-			return copy_to_uspace(uspace_nread, &copied, sizeof(copied));
-			return EOK;
+				return (sysarg_t) rc;
+			
+			return copied;
 		default:
-			return (sys_errno_t) ENOTSUP;
+			return (sysarg_t) ENOTSUP;
 	}
 }
Index: kernel/generic/src/main/kinit.c
===================================================================
--- kernel/generic/src/main/kinit.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/main/kinit.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
 #include <proc/program.h>
 #include <panic.h>
-#include <halt.h>
+#include <func.h>
 #include <cpu.h>
 #include <arch/asm.h>
@@ -253,5 +253,5 @@
 		assert(page);
 		
-		errno_t rc = program_create_from_image((void *) page, namebuf,
+		int rc = program_create_from_image((void *) page, namebuf,
 		    &programs[i]);
 		
@@ -290,6 +290,6 @@
 			log(LF_OTHER, LVL_ERROR,
 			    "init[%zu]: Init binary load failed "
-			    "(error %s, loader status %u)", i,
-			    str_error_name(rc), programs[i].loader_status);
+			    "(error %d, loader status %u)", i, rc,
+			    programs[i].loader_status);
 	}
 	
Index: kernel/generic/src/main/main.c
===================================================================
--- kernel/generic/src/main/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/main/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -67,5 +67,4 @@
 #include <align.h>
 #include <interrupt.h>
-#include <str.h>
 #include <mm/frame.h>
 #include <mm/page.h>
Index: kernel/generic/src/main/shutdown.c
===================================================================
--- kernel/generic/src/main/shutdown.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/main/shutdown.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include <arch.h>
 #include <proc/task.h>
-#include <halt.h>
+#include <func.h>
 #include <print.h>
 #include <log.h>
Index: kernel/generic/src/mm/as.c
===================================================================
--- kernel/generic/src/mm/as.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/mm/as.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -111,5 +111,5 @@
 as_t *AS_KERNEL = NULL;
 
-NO_TRACE static errno_t as_constructor(void *obj, unsigned int flags)
+NO_TRACE static int as_constructor(void *obj, unsigned int flags)
 {
 	as_t *as = (as_t *) obj;
@@ -760,5 +760,5 @@
  *
  */
-errno_t as_area_resize(as_t *as, uintptr_t address, size_t size, unsigned int flags)
+int as_area_resize(as_t *as, uintptr_t address, size_t size, unsigned int flags)
 {
 	if (!IS_ALIGNED(address, PAGE_SIZE))
@@ -833,5 +833,5 @@
 			    btree_node_t, leaf_link);
 			
-			if ((cond = (node->keys != 0))) {
+			if ((cond = (bool) node->keys)) {
 				uintptr_t ptr = node->key[node->keys - 1];
 				size_t node_size =
@@ -969,5 +969,5 @@
  *
  */
-errno_t as_area_destroy(as_t *as, uintptr_t address)
+int as_area_destroy(as_t *as, uintptr_t address)
 {
 	mutex_lock(&as->lock);
@@ -1085,5 +1085,5 @@
  *
  */
-errno_t as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
+int as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
     as_t *dst_as, unsigned int dst_flags_mask, uintptr_t *dst_base,
     uintptr_t bound)
@@ -1248,5 +1248,5 @@
  *
  */
-errno_t as_area_change_flags(as_t *as, unsigned int flags, uintptr_t address)
+int as_area_change_flags(as_t *as, unsigned int flags, uintptr_t address)
 {
 	/* Flags for the new memory mapping */
@@ -2208,17 +2208,17 @@
 }
 
-sys_errno_t sys_as_area_resize(uintptr_t address, size_t size, unsigned int flags)
-{
-	return (sys_errno_t) as_area_resize(AS, address, size, 0);
-}
-
-sys_errno_t sys_as_area_change_flags(uintptr_t address, unsigned int flags)
-{
-	return (sys_errno_t) as_area_change_flags(AS, flags, address);
-}
-
-sys_errno_t sys_as_area_destroy(uintptr_t address)
-{
-	return (sys_errno_t) as_area_destroy(AS, address);
+sysarg_t sys_as_area_resize(uintptr_t address, size_t size, unsigned int flags)
+{
+	return (sysarg_t) as_area_resize(AS, address, size, 0);
+}
+
+sysarg_t sys_as_area_change_flags(uintptr_t address, unsigned int flags)
+{
+	return (sysarg_t) as_area_change_flags(AS, flags, address);
+}
+
+sysarg_t sys_as_area_destroy(uintptr_t address)
+{
+	return (sysarg_t) as_area_destroy(AS, address);
 }
 
Index: kernel/generic/src/mm/backend_user.c
===================================================================
--- kernel/generic/src/mm/backend_user.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/mm/backend_user.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,4 @@
 #include <errno.h>
 #include <log.h>
-#include <str.h>
 
 static bool user_create(as_area_t *);
@@ -126,11 +125,11 @@
 	IPC_SET_ARG5(data, pager_info->id3);
 
-	errno_t rc = ipc_req_internal(pager_info->pager, &data, (sysarg_t) true);
+	int rc = ipc_req_internal(pager_info->pager, &data, (sysarg_t) true);
 
 	if (rc != EOK) {
 		log(LF_USPACE, LVL_FATAL,
 		    "Page-in request for page %#" PRIxPTR
-		    " at pager %d failed with error %s.",
-		    upage, pager_info->pager, str_error_name(rc));
+		    " at pager %d failed with error %d.",
+		    upage, pager_info->pager, rc);
 		return AS_PF_FAULT;
 	}
Index: kernel/generic/src/mm/page.c
===================================================================
--- kernel/generic/src/mm/page.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/mm/page.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -190,5 +190,5 @@
 }
 
-errno_t page_find_mapping(uintptr_t virt, uintptr_t *phys)
+int page_find_mapping(uintptr_t virt, uintptr_t *phys)
 {
 	page_table_lock(AS, true);
@@ -215,13 +215,13 @@
  *
  */
-sys_errno_t sys_page_find_mapping(uintptr_t virt, uintptr_t *phys_ptr)
+sysarg_t sys_page_find_mapping(uintptr_t virt, uintptr_t *phys_ptr)
 {
 	uintptr_t phys;
-	errno_t rc = page_find_mapping(virt, &phys);
+	int rc = page_find_mapping(virt, &phys);
 	if (rc != EOK)
 		return rc;
 	
 	rc = copy_to_uspace(phys_ptr, &phys, sizeof(phys));
-	return (sys_errno_t) rc;
+	return (sysarg_t) rc;
 }
 
Index: kernel/generic/src/mm/slab.c
===================================================================
--- kernel/generic/src/mm/slab.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/mm/slab.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -102,5 +102,4 @@
 
 #include <assert.h>
-#include <errno.h>
 #include <synch/spinlock.h>
 #include <mm/slab.h>
@@ -335,5 +334,5 @@
 	irq_spinlock_unlock(&cache->slablock, true);
 	
-	if ((cache->constructor) && (cache->constructor(obj, flags) != EOK)) {
+	if ((cache->constructor) && (cache->constructor(obj, flags))) {
 		/* Bad, bad, construction failed */
 		slab_obj_destroy(cache, obj, slab);
@@ -608,5 +607,5 @@
  */
 NO_TRACE static void _slab_cache_create(slab_cache_t *cache, const char *name,
-    size_t size, size_t align, errno_t (*constructor)(void *obj,
+    size_t size, size_t align, int (*constructor)(void *obj,
     unsigned int kmflag), size_t (*destructor)(void *obj), unsigned int flags)
 {
@@ -662,5 +661,5 @@
  */
 slab_cache_t *slab_cache_create(const char *name, size_t size, size_t align,
-    errno_t (*constructor)(void *obj, unsigned int kmflag),
+    int (*constructor)(void *obj, unsigned int kmflag),
     size_t (*destructor)(void *obj), unsigned int flags)
 {
Index: kernel/generic/src/proc/program.c
===================================================================
--- kernel/generic/src/proc/program.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/proc/program.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -66,8 +66,8 @@
  * @param prg        Buffer for storing program information.
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t program_create(as_t *as, uintptr_t entry_addr, char *name, program_t *prg)
+ * @return EOK on success or negative error code.
+ *
+ */
+int program_create(as_t *as, uintptr_t entry_addr, char *name, program_t *prg)
 {
 	prg->loader_status = EE_OK;
@@ -134,8 +134,8 @@
  *                        will be returned.
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t program_create_from_image(void *image_addr, char *name, program_t *prg)
+ * @return EOK on success or negative error code.
+ *
+ */
+int program_create_from_image(void *image_addr, char *name, program_t *prg)
 {
 	as_t *as = as_create(0);
@@ -171,8 +171,8 @@
  * @param name Name to set for the program's task.
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t program_create_loader(program_t *prg, char *name)
+ * @return EOK on success or negative error code.
+ *
+ */
+int program_create_loader(program_t *prg, char *name)
 {
 	as_t *as = as_create(0);
@@ -225,5 +225,5 @@
  *
  */
-sys_errno_t sys_program_spawn_loader(char *uspace_name, size_t name_len)
+sysarg_t sys_program_spawn_loader(char *uspace_name, size_t name_len)
 {
 	/* Cap length of name and copy it from userspace. */
@@ -232,7 +232,7 @@
 	
 	char namebuf[TASK_NAME_BUFLEN];
-	errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len);
-	if (rc != EOK)
-		return (sys_errno_t) rc;
+	int rc = copy_from_uspace(namebuf, uspace_name, name_len);
+	if (rc != 0)
+		return (sysarg_t) rc;
 	
 	namebuf[name_len] = 0;
@@ -241,5 +241,5 @@
 	program_t prg;
 	rc = program_create_loader(&prg, namebuf);
-	if (rc != EOK)
+	if (rc != 0)
 		return rc;
 	
Index: kernel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/proc/scheduler.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,5 +58,5 @@
 #include <context.h>
 #include <fpu_context.h>
-#include <halt.h>
+#include <func.h>
 #include <arch.h>
 #include <adt/list.h>
Index: kernel/generic/src/proc/task.c
===================================================================
--- kernel/generic/src/proc/task.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/proc/task.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
 #include <print.h>
 #include <errno.h>
-#include <halt.h>
+#include <func.h>
 #include <str.h>
 #include <syscall/copy.h>
@@ -83,5 +83,5 @@
 /* Forward declarations. */
 static void task_kill_internal(task_t *);
-static errno_t tsk_constructor(void *, unsigned int);
+static int tsk_constructor(void *, unsigned int);
 static size_t tsk_destructor(void *obj);
 
@@ -158,9 +158,9 @@
 }
 
-errno_t tsk_constructor(void *obj, unsigned int kmflags)
+int tsk_constructor(void *obj, unsigned int kmflags)
 {
 	task_t *task = (task_t *) obj;
 
-	errno_t rc = caps_task_alloc(task);
+	int rc = caps_task_alloc(task);
 	if (rc != EOK)
 		return rc;
@@ -185,5 +185,5 @@
 #endif
 	
-	return EOK;
+	return 0;
 }
 
@@ -207,8 +207,4 @@
 {
 	task_t *task = (task_t *) slab_alloc(task_cache, 0);
-	if (task == NULL) {
-		return NULL;
-	}
-	
 	task_create_arch(task);
 	
@@ -245,13 +241,5 @@
 	if ((ipc_phone_0) &&
 	    (container_check(ipc_phone_0->task->container, task->container))) {
-		cap_handle_t phone_handle;
-		errno_t rc = phone_alloc(task, &phone_handle);
-		if (rc != EOK) {
-			task->as = NULL;
-			task_destroy_arch(task);
-			slab_free(task_cache, task);
-			return NULL;
-		}
-		
+		cap_handle_t phone_handle = phone_alloc(task);
 		kobject_t *phone_obj = kobject_get(task, phone_handle,
 		    KOBJECT_TYPE_PHONE);
@@ -345,5 +333,5 @@
  *
  */
-sys_errno_t sys_task_get_id(sysarg64_t *uspace_taskid)
+sysarg_t sys_task_get_id(sysarg64_t *uspace_taskid)
 {
 	/*
@@ -351,5 +339,5 @@
 	 * the lifespan of the task.
 	 */
-	return (sys_errno_t) copy_to_uspace(uspace_taskid, &TASK->taskid,
+	return (sysarg_t) copy_to_uspace(uspace_taskid, &TASK->taskid,
 	    sizeof(TASK->taskid));
 }
@@ -385,5 +373,5 @@
  *
  */
-sys_errno_t sys_task_set_name(const char *uspace_name, size_t name_len)
+sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len)
 {
 	char namebuf[TASK_NAME_BUFLEN];
@@ -393,7 +381,7 @@
 		name_len = TASK_NAME_BUFLEN - 1;
 	
-	errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len);
-	if (rc != EOK)
-		return (sys_errno_t) rc;
+	int rc = copy_from_uspace(namebuf, uspace_name, name_len);
+	if (rc != 0)
+		return (sysarg_t) rc;
 	
 	namebuf[name_len] = '\0';
@@ -426,12 +414,12 @@
  *
  */
-sys_errno_t sys_task_kill(task_id_t *uspace_taskid)
+sysarg_t sys_task_kill(task_id_t *uspace_taskid)
 {
 	task_id_t taskid;
-	errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-	
-	return (sys_errno_t) task_kill(taskid);
+	int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid));
+	if (rc != 0)
+		return (sysarg_t) rc;
+	
+	return (sysarg_t) task_kill(taskid);
 }
 
@@ -539,5 +527,5 @@
  *
  */
-errno_t task_kill(task_id_t id)
+int task_kill(task_id_t id)
 {
 	if (id == 1)
@@ -596,5 +584,5 @@
  *
  */
-sys_errno_t sys_task_exit(sysarg_t notify)
+sysarg_t sys_task_exit(sysarg_t notify)
 {
 	task_kill_self(notify);
Index: kernel/generic/src/proc/thread.c
===================================================================
--- kernel/generic/src/proc/thread.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/proc/thread.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -153,5 +153,5 @@
  *
  */
-static errno_t thr_constructor(void *obj, unsigned int kmflags)
+static int thr_constructor(void *obj, unsigned int kmflags)
 {
 	thread_t *thread = (thread_t *) obj;
@@ -171,5 +171,5 @@
 	thread->saved_fpu_context = slab_alloc(fpu_context_cache, kmflags);
 	if (!thread->saved_fpu_context)
-		return ENOMEM;
+		return -1;
 #endif /* CONFIG_FPU_LAZY */
 #endif /* CONFIG_FPU */
@@ -201,5 +201,5 @@
 			slab_free(fpu_context_cache, thread->saved_fpu_context);
 #endif
-		return ENOMEM;
+		return -1;
 	}
 	
@@ -210,5 +210,5 @@
 #endif
 	
-	return EOK;
+	return 0;
 }
 
@@ -548,5 +548,5 @@
  * 
  * Threads that are blocked waiting for a synchronization primitive 
- * are woken up with a return code of EINTR if the
+ * are woken up with a return code of ESYNCH_INTERRUPTED if the
  * blocking call was interruptable. See waitq_sleep_timeout().
  * 
@@ -639,5 +639,5 @@
  *
  */
-errno_t thread_join_timeout(thread_t *thread, uint32_t usec, unsigned int flags)
+int thread_join_timeout(thread_t *thread, uint32_t usec, unsigned int flags)
 {
 	if (thread == THREAD)
@@ -653,5 +653,5 @@
 	irq_spinlock_unlock(&thread->lock, true);
 	
-	return waitq_sleep_timeout(&thread->join_wq, usec, flags, NULL);
+	return waitq_sleep_timeout(&thread->join_wq, usec, flags);
 }
 
@@ -700,5 +700,5 @@
 	waitq_initialize(&wq);
 	
-	(void) waitq_sleep_timeout(&wq, usec, SYNCH_FLAGS_NON_BLOCKING, NULL);
+	(void) waitq_sleep_timeout(&wq, usec, SYNCH_FLAGS_NON_BLOCKING);
 }
 
@@ -930,5 +930,5 @@
  *
  */
-sys_errno_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name,
+sysarg_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name,
     size_t name_len, thread_id_t *uspace_thread_id)
 {
@@ -937,7 +937,7 @@
 	
 	char namebuf[THREAD_NAME_BUFLEN];
-	errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len);
-	if (rc != EOK)
-		return (sys_errno_t) rc;
+	int rc = copy_from_uspace(namebuf, uspace_name, name_len);
+	if (rc != 0)
+		return (sysarg_t) rc;
 	
 	namebuf[name_len] = 0;
@@ -951,7 +951,7 @@
 	
 	rc = copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t));
-	if (rc != EOK) {
+	if (rc != 0) {
 		free(kernel_uarg);
-		return (sys_errno_t) rc;
+		return (sysarg_t) rc;
 	}
 	
@@ -962,5 +962,5 @@
 			rc = copy_to_uspace(uspace_thread_id, &thread->tid,
 			    sizeof(thread->tid));
-			if (rc != EOK) {
+			if (rc != 0) {
 				/*
 				 * We have encountered a failure, but the thread
@@ -977,5 +977,5 @@
 				free(kernel_uarg);
 				
-				return (sys_errno_t) rc;
+				return (sysarg_t) rc;
 			 }
 		}
@@ -999,5 +999,5 @@
 		free(kernel_uarg);
 	
-	return (sys_errno_t) ENOMEM;
+	return (sysarg_t) ENOMEM;
 }
 
@@ -1005,7 +1005,10 @@
  *
  */
-sys_errno_t sys_thread_exit(int uspace_status)
+sysarg_t sys_thread_exit(int uspace_status)
 {
 	thread_exit();
+	
+	/* Unreachable */
+	return 0;
 }
 
@@ -1018,5 +1021,5 @@
  *
  */
-sys_errno_t sys_thread_get_id(thread_id_t *uspace_thread_id)
+sysarg_t sys_thread_get_id(thread_id_t *uspace_thread_id)
 {
 	/*
@@ -1025,10 +1028,10 @@
 	 *
 	 */
-	return (sys_errno_t) copy_to_uspace(uspace_thread_id, &THREAD->tid,
+	return (sysarg_t) copy_to_uspace(uspace_thread_id, &THREAD->tid,
 	    sizeof(THREAD->tid));
 }
 
 /** Syscall wrapper for sleeping. */
-sys_errno_t sys_thread_usleep(uint32_t usec)
+sysarg_t sys_thread_usleep(uint32_t usec)
 {
 	thread_usleep(usec);
@@ -1036,5 +1039,5 @@
 }
 
-sys_errno_t sys_thread_udelay(uint32_t usec)
+sysarg_t sys_thread_udelay(uint32_t usec)
 {
 	delay(usec);
Index: kernel/generic/src/security/perm.c
===================================================================
--- kernel/generic/src/security/perm.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/security/perm.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -84,8 +84,8 @@
  *
  */
-static errno_t perm_grant(task_id_t taskid, perm_t perms)
+static sysarg_t perm_grant(task_id_t taskid, perm_t perms)
 {
 	if (!(perm_get(TASK) & PERM_PERM))
-		return EPERM;
+		return (sysarg_t) EPERM;
 	
 	irq_spinlock_lock(&tasks_lock, true);
@@ -94,5 +94,5 @@
 	if ((!task) || (!container_check(CONTAINER, task->container))) {
 		irq_spinlock_unlock(&tasks_lock, true);
-		return ENOENT;
+		return (sysarg_t) ENOENT;
 	}
 	
@@ -102,5 +102,5 @@
 	
 	irq_spinlock_unlock(&tasks_lock, true);
-	return EOK;
+	return 0;
 }
 
@@ -116,5 +116,5 @@
  *
  */
-static errno_t perm_revoke(task_id_t taskid, perm_t perms)
+static sysarg_t perm_revoke(task_id_t taskid, perm_t perms)
 {
 	irq_spinlock_lock(&tasks_lock, true);
@@ -123,5 +123,5 @@
 	if ((!task) || (!container_check(CONTAINER, task->container))) {
 		irq_spinlock_unlock(&tasks_lock, true);
-		return ENOENT;
+		return (sysarg_t) ENOENT;
 	}
 	
@@ -136,5 +136,5 @@
 		irq_spinlock_unlock(&TASK->lock, false);
 		irq_spinlock_unlock(&tasks_lock, true);
-		return EPERM;
+		return (sysarg_t) EPERM;
 	}
 	
@@ -143,5 +143,5 @@
 	
 	irq_spinlock_unlock(&tasks_lock, true);
-	return EOK;
+	return 0;
 }
 
@@ -158,10 +158,10 @@
  *
  */
-sys_errno_t sys_perm_grant(sysarg64_t *uspace_taskid, perm_t perms)
+sysarg_t sys_perm_grant(sysarg64_t *uspace_taskid, perm_t perms)
 {
 	sysarg64_t taskid;
-	errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
+	int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
+	if (rc != 0)
+		return (sysarg_t) rc;
 	
 	return perm_grant((task_id_t) taskid, perms);
@@ -179,10 +179,10 @@
  *
  */
-sys_errno_t sys_perm_revoke(sysarg64_t *uspace_taskid, perm_t perms)
+sysarg_t sys_perm_revoke(sysarg64_t *uspace_taskid, perm_t perms)
 {
 	sysarg64_t taskid;
-	errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
+	int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
+	if (rc != 0)
+		return (sysarg_t) rc;
 	
 	return perm_revoke((task_id_t) taskid, perms);
@@ -203,5 +203,5 @@
  *
  */
-sys_errno_t sys_perm_grant(sysarg_t taskid, perm_t perms)
+sysarg_t sys_perm_grant(sysarg_t taskid, perm_t perms)
 {
 	return perm_grant((task_id_t) taskid, perms);
@@ -219,5 +219,5 @@
  *
  */
-sys_errno_t sys_perm_revoke(sysarg_t taskid, perm_t perms)
+sysarg_t sys_perm_revoke(sysarg_t taskid, perm_t perms)
 {
 	return perm_revoke((task_id_t) taskid, perms);
Index: kernel/generic/src/synch/condvar.c
===================================================================
--- kernel/generic/src/synch/condvar.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/synch/condvar.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -80,14 +80,13 @@
  * For exact description of meaning of possible combinations of usec and flags,
  * see comment for waitq_sleep_timeout().  Note that when
- * SYNCH_FLAGS_NON_BLOCKING is specified here, EAGAIN is always
+ * SYNCH_FLAGS_NON_BLOCKING is specified here, ESYNCH_WOULD_BLOCK is always
  * returned.
  *
  * @return		See comment for waitq_sleep_timeout().
  */
-errno_t _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, uint32_t usec, int flags)
+int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, uint32_t usec, int flags)
 {
-	errno_t rc;
+	int rc;
 	ipl_t ipl;
-	bool blocked;
 
 	ipl = waitq_sleep_prepare(&cv->wq);
@@ -96,8 +95,7 @@
 
 	cv->wq.missed_wakeups = 0;	/* Enforce blocking. */
-	rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, flags, &blocked);
-	assert(blocked || rc != EOK);
+	rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, flags);
 
-	waitq_sleep_finish(&cv->wq, blocked, ipl);
+	waitq_sleep_finish(&cv->wq, rc, ipl);
 	/* Lock only after releasing the waitq to avoid a possible deadlock. */
 	mutex_lock(mtx);
@@ -119,16 +117,15 @@
  * For exact description of meaning of possible combinations of usec and flags,
  * see comment for waitq_sleep_timeout().  Note that when
- * SYNCH_FLAGS_NON_BLOCKING is specified here, EAGAIN is always
+ * SYNCH_FLAGS_NON_BLOCKING is specified here, ESYNCH_WOULD_BLOCK is always
  * returned.
  *
  * @return See comment for waitq_sleep_timeout().
  */
-errno_t _condvar_wait_timeout_spinlock_impl(condvar_t *cv, spinlock_t *lock, 
+int _condvar_wait_timeout_spinlock_impl(condvar_t *cv, spinlock_t *lock, 
 	uint32_t usec, int flags)
 {
-	errno_t rc;
+	int rc;
 	ipl_t ipl;
-	bool blocked;
-
+	
 	ipl = waitq_sleep_prepare(&cv->wq);
 
@@ -137,8 +134,7 @@
 
 	cv->wq.missed_wakeups = 0;	/* Enforce blocking. */
-	rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, flags, &blocked);
-	assert(blocked || rc != EOK);
+	rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, flags);
 
-	waitq_sleep_finish(&cv->wq, blocked, ipl);
+	waitq_sleep_finish(&cv->wq, rc, ipl);
 	/* Lock only after releasing the waitq to avoid a possible deadlock. */
 	spinlock_lock(lock);
@@ -156,13 +152,13 @@
  * For exact description of meaning of possible combinations of usec and flags,
  * see comment for waitq_sleep_timeout().  Note that when
- * SYNCH_FLAGS_NON_BLOCKING is specified here, EAGAIN is always
+ * SYNCH_FLAGS_NON_BLOCKING is specified here, ESYNCH_WOULD_BLOCK is always
  * returned.
  *
  * @return See comment for waitq_sleep_timeout().
  */
-errno_t _condvar_wait_timeout_irq_spinlock(condvar_t *cv, irq_spinlock_t *irq_lock, 
+int _condvar_wait_timeout_irq_spinlock(condvar_t *cv, irq_spinlock_t *irq_lock, 
 	uint32_t usec, int flags)
 {
-	errno_t rc;
+	int rc;
 	/* Save spinlock's state so we can restore it correctly later on. */
 	ipl_t ipl = irq_lock->ipl;
Index: kernel/generic/src/synch/futex.c
===================================================================
--- kernel/generic/src/synch/futex.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/synch/futex.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -395,13 +395,13 @@
  *
  * @return		If there is no physical mapping for uaddr ENOENT is
- *			returned. Otherwise returns the return value of
- *                      waitq_sleep_timeout().
- */
-sys_errno_t sys_futex_sleep(uintptr_t uaddr)
+ *			returned. Otherwise returns a wait result as defined in
+ *			synch.h.
+ */
+sysarg_t sys_futex_sleep(uintptr_t uaddr)
 {
 	futex_t *futex = get_futex(uaddr);
 	
 	if (!futex) 
-		return (sys_errno_t) ENOENT;
+		return (sysarg_t) ENOENT;
 
 #ifdef CONFIG_UDEBUG
@@ -409,6 +409,5 @@
 #endif
 
-	errno_t rc = waitq_sleep_timeout(
-	    &futex->wq, 0, SYNCH_FLAGS_INTERRUPTIBLE, NULL);
+	int rc = waitq_sleep_timeout(&futex->wq, 0, SYNCH_FLAGS_INTERRUPTIBLE); 
 
 #ifdef CONFIG_UDEBUG
@@ -416,5 +415,5 @@
 #endif
 
-	return (sys_errno_t) rc;
+	return (sysarg_t) rc;
 }
 
@@ -425,5 +424,5 @@
  * @return		ENOENT if there is no physical mapping for uaddr.
  */
-sys_errno_t sys_futex_wakeup(uintptr_t uaddr)
+sysarg_t sys_futex_wakeup(uintptr_t uaddr)
 {
 	futex_t *futex = get_futex(uaddr);
@@ -431,7 +430,7 @@
 	if (futex) {
 		waitq_wakeup(&futex->wq, WAKEUP_FIRST);
-		return EOK;
+		return 0;
 	} else {
-		return (sys_errno_t) ENOENT;
+		return (sysarg_t) ENOENT;
 	}
 }
Index: kernel/generic/src/synch/mutex.c
===================================================================
--- kernel/generic/src/synch/mutex.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/synch/mutex.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 
 #include <assert.h>
-#include <errno.h>
 #include <synch/mutex.h>
 #include <synch/semaphore.h>
@@ -85,7 +84,7 @@
  *
  */
-errno_t _mutex_lock_timeout(mutex_t *mtx, uint32_t usec, unsigned int flags)
+int _mutex_lock_timeout(mutex_t *mtx, uint32_t usec, unsigned int flags)
 {
-	errno_t rc;
+	int rc;
 
 	if (mtx->type == MUTEX_PASSIVE && THREAD) {
@@ -96,8 +95,8 @@
 		if (mtx->owner == THREAD) {
 			mtx->nesting++;
-			return EOK;
+			return ESYNCH_OK_ATOMIC;
 		} else {
 			rc = _semaphore_down_timeout(&mtx->sem, usec, flags);
-			if (rc == EOK) {
+			if (SYNCH_OK(rc)) {
 				mtx->owner = THREAD;
 				mtx->nesting = 1;
@@ -120,5 +119,6 @@
 			}
 			rc = semaphore_trydown(&mtx->sem);
-		} while (rc != EOK && !(flags & SYNCH_FLAGS_NON_BLOCKING));
+		} while (SYNCH_FAILED(rc) &&
+		    !(flags & SYNCH_FLAGS_NON_BLOCKING));
 		if (deadlock_reported)
 			printf("cpu%u: not deadlocked\n", CPU->id);
Index: kernel/generic/src/synch/rcu.c
===================================================================
--- kernel/generic/src/synch/rcu.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/synch/rcu.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -957,8 +957,8 @@
 			
 			/* Wait for the GP to complete. */
-			errno_t ret = _condvar_wait_timeout_spinlock(&rcu.gp_ended, &rcu.gp_lock, 
+			int ret = _condvar_wait_timeout_spinlock(&rcu.gp_ended, &rcu.gp_lock, 
 				SYNCH_NO_TIMEOUT, SYNCH_FLAGS_INTERRUPTIBLE);
 			
-			if (ret == EINTR) {
+			if (ret == ESYNCH_INTERRUPTED) {
 				spinlock_unlock(&rcu.gp_lock);
 				return false;			
@@ -1013,10 +1013,10 @@
 		spinlock_lock(&rcu.gp_lock);
 
-		errno_t ret = 0;
+		int ret = 0;
 		ret = _condvar_wait_timeout_spinlock(&rcu.expedite_now, &rcu.gp_lock,
 			DETECT_SLEEP_MS * 1000, SYNCH_FLAGS_INTERRUPTIBLE);
 
 		/* rcu.expedite_now was signaled. */
-		if (ret == EOK) {
+		if (ret == ESYNCH_OK_BLOCKED) {
 			*expedite = true;
 		}
@@ -1024,5 +1024,5 @@
 		spinlock_unlock(&rcu.gp_lock);
 
-		return (ret != EINTR);
+		return (ret != ESYNCH_INTERRUPTED);
 	}
 }
@@ -1271,5 +1271,5 @@
 		int ret = _condvar_wait_timeout_spinlock(&rcu.gp_ended, &rcu.gp_lock, 
 			SYNCH_NO_TIMEOUT, SYNCH_FLAGS_INTERRUPTIBLE);
-		interrupted = (ret == EINTR);
+		interrupted = (ret == ESYNCH_INTERRUPTED);
 	}
 	
@@ -1332,5 +1332,5 @@
 			&rcu.gp_lock, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_INTERRUPTIBLE);
 		
-		interrupted = (ret == EINTR);
+		interrupted = (ret == ESYNCH_INTERRUPTED);
 	}
 	
@@ -1406,5 +1406,5 @@
 	spinlock_unlock(&rcu.gp_lock);
 	
-	return (ret != EINTR);
+	return (ret != ESYNCH_INTERRUPTED);
 }
 
Index: kernel/generic/src/synch/semaphore.c
===================================================================
--- kernel/generic/src/synch/semaphore.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/synch/semaphore.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -71,7 +71,7 @@
  *
  */
-errno_t _semaphore_down_timeout(semaphore_t *sem, uint32_t usec, unsigned int flags)
+int _semaphore_down_timeout(semaphore_t *sem, uint32_t usec, unsigned int flags)
 {
-	return waitq_sleep_timeout(&sem->wq, usec, flags, NULL);
+	return waitq_sleep_timeout(&sem->wq, usec, flags);
 }
 
Index: kernel/generic/src/synch/smc.c
===================================================================
--- kernel/generic/src/synch/smc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/synch/smc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 #include <mm/as.h>
 
-sys_errno_t sys_smc_coherence(uintptr_t va, size_t size)
+sysarg_t sys_smc_coherence(uintptr_t va, size_t size)
 {
 	if (overlaps(va, size, (uintptr_t) NULL, PAGE_SIZE))
Index: kernel/generic/src/synch/smp_memory_barrier.c
===================================================================
--- kernel/generic/src/synch/smp_memory_barrier.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/synch/smp_memory_barrier.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
  * @return Irrelevant.
  */
-sys_errno_t sys_smp_memory_barrier(void)
+sysarg_t sys_smp_memory_barrier(void)
 {
 	for (unsigned int cpu_id = 0; cpu_id < config.cpu_active; ++cpu_id) {
Index: kernel/generic/src/synch/spinlock.c
===================================================================
--- kernel/generic/src/synch/spinlock.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/synch/spinlock.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -153,8 +153,8 @@
  *
  */
-bool spinlock_trylock(spinlock_t *lock)
+int spinlock_trylock(spinlock_t *lock)
 {
 	preemption_disable();
-	bool ret = !test_and_set(&lock->val);
+	int rc = !test_and_set(&lock->val);
 	
 	/*
@@ -163,8 +163,8 @@
 	CS_ENTER_BARRIER();
 	
-	if (!ret)
+	if (!rc)
 		preemption_enable();
 	
-	return ret;
+	return rc;
 }
 
@@ -257,11 +257,11 @@
  *
  */
-bool irq_spinlock_trylock(irq_spinlock_t *lock)
+int irq_spinlock_trylock(irq_spinlock_t *lock)
 {
 	ASSERT_IRQ_SPINLOCK(interrupts_disabled(), lock);
-	bool ret = spinlock_trylock(&(lock->lock));
-	
-	ASSERT_IRQ_SPINLOCK((!ret) || (!lock->guard), lock);
-	return ret;
+	int rc = spinlock_trylock(&(lock->lock));
+	
+	ASSERT_IRQ_SPINLOCK((!rc) || (!lock->guard), lock);
+	return rc;
 }
 
Index: kernel/generic/src/synch/waitq.c
===================================================================
--- kernel/generic/src/synch/waitq.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/synch/waitq.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,4 @@
 
 #include <assert.h>
-#include <errno.h>
 #include <synch/waitq.h>
 #include <synch/spinlock.h>
@@ -239,8 +238,4 @@
  * @param flags Specify mode of the sleep.
  *
- * @param[out] blocked  On return, regardless of the return code,
- *                      `*blocked` is set to `true` iff the thread went to
- *                      sleep.
- *
  * The sleep can be interrupted only if the
  * SYNCH_FLAGS_INTERRUPTIBLE bit is specified in flags.
@@ -256,28 +251,23 @@
  * call will immediately return, reporting either success or failure.
  *
- * @return EAGAIN, meaning that the sleep failed because it was requested
- *                 as SYNCH_FLAGS_NON_BLOCKING, but there was no pending wakeup.
- * @return ETIMEOUT, meaning that the sleep timed out.
- * @return EINTR, meaning that somebody interrupted the sleeping
- *         thread. Check the value of `*blocked` to see if the thread slept,
- *         or if a pending interrupt forced it to return immediately.
- * @return EOK, meaning that none of the above conditions occured, and the
- *              thread was woken up successfuly by `waitq_wakeup()`. Check
- *              the value of `*blocked` to see if the thread slept or if
- *              the wakeup was already pending.
- *
- */
-errno_t waitq_sleep_timeout(waitq_t *wq, uint32_t usec, unsigned int flags, bool *blocked)
+ * @return ESYNCH_WOULD_BLOCK, meaning that the sleep failed because at the
+ *         time of the call there was no pending wakeup
+ * @return ESYNCH_TIMEOUT, meaning that the sleep timed out.
+ * @return ESYNCH_INTERRUPTED, meaning that somebody interrupted the sleeping
+ *         thread.
+ * @return ESYNCH_OK_ATOMIC, meaning that the sleep succeeded and that there
+ *         was a pending wakeup at the time of the call. The caller was not put
+ *         asleep at all.
+ * @return ESYNCH_OK_BLOCKED, meaning that the sleep succeeded; the full sleep
+ *         was attempted.
+ *
+ */
+int waitq_sleep_timeout(waitq_t *wq, uint32_t usec, unsigned int flags)
 {
 	assert((!PREEMPTION_DISABLED) || (PARAM_NON_BLOCKING(flags, usec)));
 	
 	ipl_t ipl = waitq_sleep_prepare(wq);
-	bool nblocked;
-	errno_t rc = waitq_sleep_timeout_unsafe(wq, usec, flags, &nblocked);
-	waitq_sleep_finish(wq, nblocked, ipl);
-
-	if (blocked != NULL) {
-		*blocked = nblocked;
-	}
+	int rc = waitq_sleep_timeout_unsafe(wq, usec, flags);
+	waitq_sleep_finish(wq, rc, ipl);
 	return rc;
 }
@@ -330,27 +320,32 @@
  * lock is released.
  *
- * @param wq       Wait queue.
- * @param blocked  Out parameter of waitq_sleep_timeout_unsafe().
- * @param ipl      Interrupt level returned by waitq_sleep_prepare().
- *
- */
-void waitq_sleep_finish(waitq_t *wq, bool blocked, ipl_t ipl)
-{
-	if (blocked) {
-		/*
+ * @param wq  Wait queue.
+ * @param rc  Return code of waitq_sleep_timeout_unsafe().
+ * @param ipl Interrupt level returned by waitq_sleep_prepare().
+ *
+ */
+void waitq_sleep_finish(waitq_t *wq, int rc, ipl_t ipl)
+{
+	switch (rc) {
+	case ESYNCH_WOULD_BLOCK:
+	case ESYNCH_OK_ATOMIC:
+		irq_spinlock_unlock(&wq->lock, false);
+		break;
+	default:
+		/* 
 		 * Wait for a waitq_wakeup() or waitq_unsleep() to complete
 		 * before returning from waitq_sleep() to the caller. Otherwise
 		 * the caller might expect that the wait queue is no longer used 
 		 * and deallocate it (although the wakeup on a another cpu has 
-		 * not yet completed and is using the wait queue).
-		 *
-		 * Note that we have to do this for EOK and EINTR, but not
-		 * necessarily for ETIMEOUT where the timeout handler stops
-		 * using the waitq before waking us up. To be on the safe side,
-		 * ensure the waitq is not in use anymore in this case as well.
+		 * not yet completed and is using the wait queue). 
+		 * 
+		 * Note that we have to do this for ESYNCH_OK_BLOCKED and
+		 * ESYNCH_INTERRUPTED, but not necessarily for ESYNCH_TIMEOUT
+		 * where the timeout handler stops using the waitq before waking 
+		 * us up. To be on the safe side, ensure the waitq is not in use 
+		 * anymore in this case as well.
 		 */
 		waitq_complete_wakeup(wq);
-	} else {
-		irq_spinlock_unlock(&wq->lock, false);
+		break;
 	}
 	
@@ -368,21 +363,17 @@
  * @param flags See waitq_sleep_timeout().
  *
- * @param[out] blocked  See waitq_sleep_timeout().
- *
  * @return See waitq_sleep_timeout().
  *
  */
-errno_t waitq_sleep_timeout_unsafe(waitq_t *wq, uint32_t usec, unsigned int flags, bool *blocked)
-{
-	*blocked = false;
-
+int waitq_sleep_timeout_unsafe(waitq_t *wq, uint32_t usec, unsigned int flags)
+{
 	/* Checks whether to go to sleep at all */
 	if (wq->missed_wakeups) {
 		wq->missed_wakeups--;
-		return EOK;
+		return ESYNCH_OK_ATOMIC;
 	} else {
 		if (PARAM_NON_BLOCKING(flags, usec)) {
 			/* Return immediately instead of going to sleep */
-			return EAGAIN;
+			return ESYNCH_WOULD_BLOCK;
 		}
 	}
@@ -401,5 +392,6 @@
 		if (THREAD->interrupted) {
 			irq_spinlock_unlock(&THREAD->lock, false);
-			return EINTR;
+			irq_spinlock_unlock(&wq->lock, false);
+			return ESYNCH_INTERRUPTED;
 		}
 		
@@ -413,5 +405,5 @@
 			THREAD->last_cycle = get_cycle();
 			irq_spinlock_unlock(&THREAD->lock, false);
-			return EINTR;
+			return ESYNCH_INTERRUPTED;
 		}
 	} else
@@ -424,5 +416,5 @@
 			THREAD->last_cycle = get_cycle();
 			irq_spinlock_unlock(&THREAD->lock, false);
-			return ETIMEOUT;
+			return ESYNCH_TIMEOUT;
 		}
 		
@@ -441,9 +433,4 @@
 	THREAD->sleep_queue = wq;
 	
-	/* Must be before entry to scheduler, because there are multiple
-	 * return vectors.
-	 */
-	*blocked = true;
-	
 	irq_spinlock_unlock(&THREAD->lock, false);
 	
@@ -451,5 +438,5 @@
 	scheduler();
 	
-	return EOK;
+	return ESYNCH_OK_BLOCKED;
 }
 
Index: kernel/generic/src/synch/workqueue.c
===================================================================
--- kernel/generic/src/synch/workqueue.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/synch/workqueue.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,4 @@
 
 #include <assert.h>
-#include <errno.h>
 #include <synch/workqueue.h>
 #include <synch/spinlock.h>
@@ -257,5 +256,5 @@
  * workq_stop().
  */
-bool workq_init(struct work_queue *workq, const char *name)
+int workq_init(struct work_queue *workq, const char *name)
 {
 	workq_preinit(workq, name);
@@ -395,5 +394,5 @@
  * See workq_enqueue_noblock() for more details.
  */
-bool workq_global_enqueue_noblock(work_t *work_item, work_func_t func)
+int workq_global_enqueue_noblock(work_t *work_item, work_func_t func)
 {
 	return workq_enqueue_noblock(&g_work_queue, work_item, func);
@@ -404,5 +403,5 @@
  * See workq_enqueue() for more details.
  */
-bool workq_global_enqueue(work_t *work_item, work_func_t func)
+int workq_global_enqueue(work_t *work_item, work_func_t func)
 {
 	return workq_enqueue(&g_work_queue, work_item, func);
@@ -427,5 +426,5 @@
  * @return true  Otherwise. func() will be invoked in a separate thread.
  */
-bool workq_enqueue_noblock(struct work_queue *workq, work_t *work_item, 
+int workq_enqueue_noblock(struct work_queue *workq, work_t *work_item, 
 	work_func_t func)
 {
@@ -447,5 +446,5 @@
  * @return true  Otherwise. func() will be invoked in a separate thread.
  */
-bool workq_enqueue(struct work_queue *workq, work_t *work_item, work_func_t func)
+int workq_enqueue(struct work_queue *workq, work_t *work_item, work_func_t func)
 {
 	return _workq_enqueue(workq, work_item, func, true);
@@ -895,8 +894,8 @@
 	
 	while (list_empty(&info->work_queues) && !stop) {
-		errno_t ret = _condvar_wait_timeout_irq_spinlock(&info->req_cv, 
+		int ret = _condvar_wait_timeout_irq_spinlock(&info->req_cv, 
 			&info->lock, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_INTERRUPTIBLE);
 		
-		stop = (ret == EINTR);
+		stop = (ret == ESYNCH_INTERRUPTED);
 	}
 	
Index: kernel/generic/src/syscall/copy.c
===================================================================
--- kernel/generic/src/syscall/copy.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/syscall/copy.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,10 +57,10 @@
  * @param size Size of the data to be copied.
  *
- * @return EOK on success or an error code from @ref errno.h.
+ * @return EOK on success or error code from @ref errno.h.
  */
-errno_t copy_from_uspace(void *dst, const void *uspace_src, size_t size)
+int copy_from_uspace(void *dst, const void *uspace_src, size_t size)
 {
 	ipl_t ipl;
-	errno_t rc;
+	int rc;
 	
 	assert(THREAD);
@@ -108,10 +108,10 @@
  * @param size Size of the data to be copied.
  *
- * @return 0 on success or an error code from @ref errno.h.
+ * @return 0 on success or error code from @ref errno.h.
  */
-errno_t copy_to_uspace(void *uspace_dst, const void *src, size_t size)
+int copy_to_uspace(void *uspace_dst, const void *src, size_t size)
 {
 	ipl_t ipl;
-	errno_t rc;
+	int rc;
 	
 	assert(THREAD);
Index: kernel/generic/src/sysinfo/stats.c
===================================================================
--- kernel/generic/src/sysinfo/stats.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/sysinfo/stats.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -157,5 +157,5 @@
 	 */
 	
-	if (mutex_trylock(&as->lock) != EOK)
+	if (SYNCH_FAILED(mutex_trylock(&as->lock)))
 		return 0;
 	
@@ -169,5 +169,5 @@
 			as_area_t *area = node->value[i];
 			
-			if (mutex_trylock(&area->lock) != EOK)
+			if (SYNCH_FAILED(mutex_trylock(&area->lock)))
 				continue;
 			
@@ -198,5 +198,5 @@
 	 */
 	
-	if (mutex_trylock(&as->lock) != EOK)
+	if (SYNCH_FAILED(mutex_trylock(&as->lock)))
 		return 0;
 	
@@ -209,5 +209,5 @@
 			as_area_t *area = node->value[i];
 			
-			if (mutex_trylock(&area->lock) != EOK)
+			if (SYNCH_FAILED(mutex_trylock(&area->lock)))
 				continue;
 			
Index: kernel/generic/src/sysinfo/sysinfo.c
===================================================================
--- kernel/generic/src/sysinfo/sysinfo.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/sysinfo/sysinfo.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,5 +61,5 @@
  *
  */
-NO_TRACE static errno_t sysinfo_item_constructor(void *obj, unsigned int kmflag)
+NO_TRACE static int sysinfo_item_constructor(void *obj, unsigned int kmflag)
 {
 	sysinfo_item_t *item = (sysinfo_item_t *) obj;
@@ -71,5 +71,5 @@
 	item->next = NULL;
 	
-	return EOK;
+	return 0;
 }
 
@@ -790,8 +790,8 @@
  *
  */
-sys_errno_t sys_sysinfo_get_keys_size(void *path_ptr, size_t path_size,
+sysarg_t sys_sysinfo_get_keys_size(void *path_ptr, size_t path_size,
     void *size_ptr)
 {
-	errno_t rc;
+	int rc;
 	
 	/*
@@ -811,5 +811,5 @@
 		rc = EINVAL;
 	
-	return (sys_errno_t) rc;
+	return (sysarg_t) rc;
 }
 
@@ -838,8 +838,8 @@
  *
  */
-sys_errno_t sys_sysinfo_get_keys(void *path_ptr, size_t path_size,
+sysarg_t sys_sysinfo_get_keys(void *path_ptr, size_t path_size,
     void *buffer_ptr, size_t buffer_size, size_t *size_ptr)
 {
-	errno_t rc;
+	int rc;
 	
 	/* Get the keys */
@@ -858,5 +858,5 @@
 		rc = EINVAL;
 	
-	return (sys_errno_t) rc;
+	return (sysarg_t) rc;
 }
 
@@ -909,8 +909,8 @@
  *
  */
-sys_errno_t sys_sysinfo_get_value(void *path_ptr, size_t path_size,
+sysarg_t sys_sysinfo_get_value(void *path_ptr, size_t path_size,
     void *value_ptr)
 {
-	errno_t rc;
+	int rc;
 	
 	/*
@@ -928,5 +928,5 @@
 		rc = EINVAL;
 	
-	return (sys_errno_t) rc;
+	return (sysarg_t) rc;
 }
 
@@ -945,8 +945,8 @@
  *
  */
-sys_errno_t sys_sysinfo_get_data_size(void *path_ptr, size_t path_size,
+sysarg_t sys_sysinfo_get_data_size(void *path_ptr, size_t path_size,
     void *size_ptr)
 {
-	errno_t rc;
+	int rc;
 	
 	/*
@@ -965,5 +965,5 @@
 		rc = EINVAL;
 	
-	return (sys_errno_t) rc;
+	return (sysarg_t) rc;
 }
 
@@ -995,8 +995,8 @@
  *
  */
-sys_errno_t sys_sysinfo_get_data(void *path_ptr, size_t path_size,
+sysarg_t sys_sysinfo_get_data(void *path_ptr, size_t path_size,
     void *buffer_ptr, size_t buffer_size, size_t *size_ptr)
 {
-	errno_t rc;
+	int rc;
 	
 	/* Get the item */
@@ -1018,5 +1018,5 @@
 		free(ret.data.data);
 	
-	return (sys_errno_t) rc;
+	return (sysarg_t) rc;
 }
 
Index: kernel/generic/src/time/clock.c
===================================================================
--- kernel/generic/src/time/clock.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/time/clock.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
 #include <synch/spinlock.h>
 #include <synch/waitq.h>
-#include <halt.h>
+#include <func.h>
 #include <proc/scheduler.h>
 #include <cpu.h>
Index: kernel/generic/src/time/timeout.c
===================================================================
--- kernel/generic/src/time/timeout.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/time/timeout.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 #include <panic.h>
 #include <synch/spinlock.h>
-#include <halt.h>
+#include <func.h>
 #include <cpu.h>
 #include <arch/asm.h>
Index: kernel/generic/src/udebug/udebug.c
===================================================================
--- kernel/generic/src/udebug/udebug.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/udebug/udebug.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -98,7 +98,7 @@
 	
 	wq->missed_wakeups = 0;  /* Enforce blocking. */
-	bool blocked;
-	(void) waitq_sleep_timeout_unsafe(wq, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE, &blocked);
-	waitq_sleep_finish(wq, blocked, ipl);
+	int rc = waitq_sleep_timeout_unsafe(wq, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
+	
+	waitq_sleep_finish(wq, rc, ipl);
 }
 
@@ -394,8 +394,8 @@
  * @param task Task structure. task->udebug.lock must be already locked.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t udebug_task_cleanup(struct task *task)
+ * @return Zero on success or negative error code.
+ *
+ */
+int udebug_task_cleanup(struct task *task)
 {
 	assert(mutex_locked(&task->udebug.lock));
Index: kernel/generic/src/udebug/udebug_ipc.c
===================================================================
--- kernel/generic/src/udebug/udebug_ipc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/udebug/udebug_ipc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
 #include <udebug/udebug_ipc.h>
 
-errno_t udebug_request_preprocess(call_t *call, phone_t *phone)
+int udebug_request_preprocess(call_t *call, phone_t *phone)
 {
 	switch (IPC_GET_ARG1(call->data)) {
@@ -71,9 +71,8 @@
 static void udebug_receive_begin(call_t *call)
 {
-	errno_t rc;
-	bool active;
-
-	rc = udebug_begin(call, &active);
-	if (rc != EOK) {
+	int rc;
+
+	rc = udebug_begin(call);
+	if (rc < 0) {
 		IPC_SET_RETVAL(call->data, rc);
 		ipc_answer(&TASK->kb.box, call);
@@ -85,6 +84,6 @@
 	 * send a reply.
 	 */
-	if (active) {
-		IPC_SET_RETVAL(call->data, EOK);
+	if (rc != 0) {
+		IPC_SET_RETVAL(call->data, 0);
 		ipc_answer(&TASK->kb.box, call);
 	}
@@ -98,5 +97,5 @@
 static void udebug_receive_end(call_t *call)
 {
-	errno_t rc;
+	int rc;
 
 	rc = udebug_end();
@@ -113,5 +112,5 @@
 static void udebug_receive_set_evmask(call_t *call)
 {
-	errno_t rc;
+	int rc;
 	udebug_evmask_t mask;
 
@@ -132,10 +131,10 @@
 {
 	thread_t *t;
-	errno_t rc;
+	int rc;
 
 	t = (thread_t *)IPC_GET_ARG2(call->data);
 
 	rc = udebug_go(t, call);
-	if (rc != EOK) {
+	if (rc < 0) {
 		IPC_SET_RETVAL(call->data, rc);
 		ipc_answer(&TASK->kb.box, call);
@@ -152,5 +151,5 @@
 {
 	thread_t *t;
-	errno_t rc;
+	int rc;
 
 	t = (thread_t *)IPC_GET_ARG2(call->data);
@@ -172,5 +171,5 @@
 	void *buffer;
 	size_t copied, needed;
-	errno_t rc;
+	int rc;
 
 	uspace_addr = IPC_GET_ARG2(call->data);	/* Destination address */
@@ -182,5 +181,5 @@
 	 */
 	rc = udebug_thread_read(&buffer, buf_size, &copied, &needed);
-	if (rc != EOK) {
+	if (rc < 0) {
 		IPC_SET_RETVAL(call->data, rc);
 		ipc_answer(&TASK->kb.box, call);
@@ -307,5 +306,5 @@
 	thread_t *t;
 	sysarg_t uspace_addr;
-	errno_t rc;
+	int rc;
 	void *buffer;
 
@@ -346,10 +345,10 @@
 	sysarg_t to_copy;
 	void *buffer = NULL;
-	errno_t rc;
+	int rc;
 
 	t = (thread_t *) IPC_GET_ARG2(call->data);
 
 	rc = udebug_regs_read(t, &buffer);
-	if (rc != EOK) {
+	if (rc < 0) {
 		IPC_SET_RETVAL(call->data, rc);
 		ipc_answer(&TASK->kb.box, call);
@@ -390,5 +389,5 @@
 	unsigned size;
 	void *buffer = NULL;
-	errno_t rc;
+	int rc;
 
 	uspace_dst = IPC_GET_ARG2(call->data);
@@ -397,5 +396,5 @@
 
 	rc = udebug_mem_read(uspace_src, size, &buffer);
-	if (rc != EOK) {
+	if (rc < 0) {
 		IPC_SET_RETVAL(call->data, rc);
 		ipc_answer(&TASK->kb.box, call);
Index: kernel/generic/src/udebug/udebug_ops.c
===================================================================
--- kernel/generic/src/udebug/udebug_ops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/generic/src/udebug/udebug_ops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,4 @@
 #include <errno.h>
 #include <print.h>
-#include <stdbool.h>
 #include <str.h>
 #include <syscall/copy.h>
@@ -79,5 +78,5 @@
  *
  */
-static errno_t _thread_op_begin(thread_t *thread, bool being_go)
+static int _thread_op_begin(thread_t *thread, bool being_go)
 {
 	mutex_lock(&TASK->udebug.lock);
@@ -158,21 +157,18 @@
  *
  * Initiates a debugging session for the current task (and its threads).
- * When the debugging session has started a reply should be sent to the
+ * When the debugging session has started a reply will be sent to the
  * UDEBUG_BEGIN call. This may happen immediately in this function if
  * all the threads in this task are stoppable at the moment and in this
- * case the function sets @a *active to @c true.
- *
- * Otherwise the function sets @a *active to false and the resonse should
- * be sent as soon as all the threads become stoppable (i.e. they can be
- * considered stopped).
+ * case the function returns 1.
+ *
+ * Otherwise the function returns 0 and the reply will be sent as soon as
+ * all the threads become stoppable (i.e. they can be considered stopped).
  *
  * @param call The BEGIN call we are servicing.
- * @param active Place to store @c true iff we went directly to active state,
- *               @c false if we only went to beginning state
- *
- * @return EOK on success, EBUSY if the task is already has an active
- *         debugging session.
- */
-errno_t udebug_begin(call_t *call, bool *active)
+ *
+ * @return 0 (OK, but not done yet), 1 (done) or negative error code.
+ *
+ */
+int udebug_begin(call_t *call)
 {
 	LOG("Debugging task %" PRIu64, TASK->taskid);
@@ -189,10 +185,12 @@
 	TASK->udebug.debugger = call->sender;
 	
+	int reply;
+	
 	if (TASK->udebug.not_stoppable_count == 0) {
 		TASK->udebug.dt_state = UDEBUG_TS_ACTIVE;
 		TASK->udebug.begin_call = NULL;
-		*active = true;  /* directly to active state */
+		reply = 1;  /* immediate reply */
 	} else
-		*active = false;  /* only in beginning state */
+		reply = 0;  /* no reply */
 	
 	/* Set udebug.active on all of the task's userspace threads. */
@@ -209,5 +207,5 @@
 	
 	mutex_unlock(&TASK->udebug.lock);
-	return EOK;
+	return reply;
 }
 
@@ -216,13 +214,13 @@
  * Closes the debugging session for the current task.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t udebug_end(void)
+ * @return Zero on success or negative error code.
+ *
+ */
+int udebug_end(void)
 {
 	LOG("Task %" PRIu64, TASK->taskid);
 	
 	mutex_lock(&TASK->udebug.lock);
-	errno_t rc = udebug_task_cleanup(TASK);
+	int rc = udebug_task_cleanup(TASK);
 	mutex_unlock(&TASK->udebug.lock);
 	
@@ -236,8 +234,8 @@
  * @param mask Or combination of events that should be enabled.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t udebug_set_evmask(udebug_evmask_t mask)
+ * @return Zero on success or negative error code.
+ *
+ */
+int udebug_set_evmask(udebug_evmask_t mask)
 {
 	LOG("mask = 0x%x", mask);
@@ -253,5 +251,5 @@
 	mutex_unlock(&TASK->udebug.lock);
 	
-	return EOK;
+	return 0;
 }
 
@@ -266,8 +264,8 @@
  *
  */
-errno_t udebug_go(thread_t *thread, call_t *call)
+int udebug_go(thread_t *thread, call_t *call)
 {
 	/* On success, this will lock thread->udebug.lock. */
-	errno_t rc = _thread_op_begin(thread, false);
+	int rc = _thread_op_begin(thread, false);
 	if (rc != EOK)
 		return rc;
@@ -285,5 +283,5 @@
 	_thread_op_end(thread);
 	
-	return EOK;
+	return 0;
 }
 
@@ -297,5 +295,5 @@
  *
  */
-errno_t udebug_stop(thread_t *thread, call_t *call)
+int udebug_stop(thread_t *thread, call_t *call)
 {
 	LOG("udebug_stop()");
@@ -306,5 +304,5 @@
 	 *
 	 */
-	errno_t rc = _thread_op_begin(thread, true);
+	int rc = _thread_op_begin(thread, true);
 	if (rc != EOK)
 		return rc;
@@ -316,5 +314,5 @@
 		/* Answer will be sent when the thread becomes stoppable. */
 		_thread_op_end(thread);
-		return EOK;
+		return 0;
 	}
 	
@@ -339,5 +337,5 @@
 	mutex_unlock(&TASK->udebug.lock);
 	
-	return EOK;
+	return 0;
 }
 
@@ -364,5 +362,5 @@
  *
  */
-errno_t udebug_thread_read(void **buffer, size_t buf_size, size_t *stored,
+int udebug_thread_read(void **buffer, size_t buf_size, size_t *stored,
     size_t *needed)
 {
@@ -414,5 +412,5 @@
 	*needed = (copied_ids + extra_ids) * sizeof(sysarg_t);
 	
-	return EOK;
+	return 0;
 }
 
@@ -428,5 +426,5 @@
  *
  */
-errno_t udebug_name_read(char **data, size_t *data_size)
+int udebug_name_read(char **data, size_t *data_size)
 {
 	size_t name_size = str_size(TASK->name) + 1;
@@ -437,5 +435,5 @@
 	memcpy(*data, TASK->name, name_size);
 	
-	return EOK;
+	return 0;
 }
 
@@ -457,8 +455,8 @@
  *
  */
-errno_t udebug_args_read(thread_t *thread, void **buffer)
+int udebug_args_read(thread_t *thread, void **buffer)
 {
 	/* On success, this will lock t->udebug.lock. */
-	errno_t rc = _thread_op_begin(thread, false);
+	int rc = _thread_op_begin(thread, false);
 	if (rc != EOK)
 		return rc;
@@ -480,5 +478,5 @@
 	
 	*buffer = arg_buffer;
-	return EOK;
+	return 0;
 }
 
@@ -500,8 +498,8 @@
  *
  */
-errno_t udebug_regs_read(thread_t *thread, void **buffer)
+int udebug_regs_read(thread_t *thread, void **buffer)
 {
 	/* On success, this will lock t->udebug.lock */
-	errno_t rc = _thread_op_begin(thread, false);
+	int rc = _thread_op_begin(thread, false);
 	if (rc != EOK)
 		return rc;
@@ -522,5 +520,5 @@
 	
 	*buffer = (void *) state_buf;
-	return EOK;
+	return 0;
 }
 
@@ -536,5 +534,5 @@
  *
  */
-errno_t udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer)
+int udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer)
 {
 	/* Verify task state */
@@ -553,12 +551,12 @@
 	 *
 	 */
-	errno_t rc = copy_from_uspace(data_buffer, (void *) uspace_addr, n);
-	mutex_unlock(&TASK->udebug.lock);
-	
-	if (rc != EOK)
+	int rc = copy_from_uspace(data_buffer, (void *) uspace_addr, n);
+	mutex_unlock(&TASK->udebug.lock);
+	
+	if (rc != 0)
 		return rc;
 	
 	*buffer = data_buffer;
-	return EOK;
+	return 0;
 }
 
Index: kernel/test/print/print5.c
===================================================================
--- kernel/test/print/print5.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/test/print/print5.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,5 @@
  *
  */
-#define _HELENOS_NVERIFY_PRINTF
+#define NVERIFY_PRINTF
 
 #include <print.h>
Index: kernel/test/synch/rcu1.c
===================================================================
--- kernel/test/synch/rcu1.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/test/synch/rcu1.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,9 +51,11 @@
 } exited_t;
 
-/* Co-opt EPARTY error code for race detection. */
-#define ERACE   EPARTY
-
-/*-------------------------------------------------------------------*/
-static void wait_for_cb_exit(size_t secs, exited_t *p, errno_t *presult)
+/* Callback raced with preexisting readers. */
+#define ERACE   123
+/* Waited for too long for the callback to exit; consider it lost. */
+#define ECBLOST 432
+
+/*-------------------------------------------------------------------*/
+static void wait_for_cb_exit(size_t secs, exited_t *p, int *presult)
 {
 	size_t loops = 0;
@@ -69,5 +71,5 @@
 	
 	if (!p->exited) {
-		*presult = ETIMEOUT;
+		*presult = ECBLOST;
 	}
 }
@@ -113,8 +115,8 @@
 			bool joined = false;
 			do {
-				errno_t ret = thread_join_timeout(thread[i], 5 * 1000 * 1000, 0);
-				joined = (ret != ETIMEOUT);
+				int ret = thread_join_timeout(thread[i], 5 * 1000 * 1000, 0);
+				joined = (ret != ESYNCH_TIMEOUT);
 				
-				if (ret == EOK) {
+				if (ret == ESYNCH_OK_BLOCKED) {
 					TPRINTF("%zu threads remain\n", thread_cnt - i - 1);
 				}
@@ -365,5 +367,5 @@
 
 
-static errno_t seq_test_result = EOK;
+static int seq_test_result = EOK;
 
 static atomic_t cur_time = {1};
@@ -534,5 +536,5 @@
 	join_one();
 	
-	errno_t result = EOK;
+	int result = EOK;
 	wait_for_cb_exit(2 /* secs */, p, &result);
 	
@@ -553,5 +555,5 @@
 typedef struct preempt_struct {
 	exited_t e;
-	errno_t result;
+	int result;
 } preempt_t;
 
Index: kernel/test/synch/semaphore2.c
===================================================================
--- kernel/test/synch/semaphore2.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ kernel/test/synch/semaphore2.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,6 +60,5 @@
 static void consumer(void *arg)
 {
-	errno_t rc;
-	int to;
+	int rc, to;
 	
 	thread_detach(THREAD);
@@ -70,5 +69,5 @@
 	TPRINTF("cpu%u, tid %" PRIu64 " down+ (%d)\n", CPU->id, THREAD->tid, to);
 	rc = semaphore_down_timeout(&sem, to);
-	if (rc != EOK) {
+	if (SYNCH_FAILED(rc)) {
 		TPRINTF("cpu%u, tid %" PRIu64 " down!\n", CPU->id, THREAD->tid);
 		return;
Index: release/Makefile
===================================================================
--- release/Makefile	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ release/Makefile	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -83,6 +83,4 @@
 
 release: src_rel
-	mkdir -p $(EXPORT_DIR)/uspace/overlay
-	(cd ..; tools/cc.sh) >$(EXPORT_DIR)/uspace/overlay/COPYRIGHT
 	for profile in $(PROFILES); do \
 		$(MAKE) -r -C $(EXPORT_DIR) distclean ; \
Index: tools/autotool.py
===================================================================
--- tools/autotool.py	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ tools/autotool.py	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -615,5 +615,4 @@
 				path = "%s/%s/bin" % (cross_prefix, platform)
 		
-		common['TARGET'] = target
 		prefix = "%s-" % target
 		
Index: ols/build-ccheck.sh
===================================================================
--- tools/build-ccheck.sh	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2018 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-git clone https://github.com/jxsvoboda/sycek sycek
-cd sycek
-make
Index: ols/cc.sh
===================================================================
--- tools/cc.sh	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,74 +1,0 @@
-#! /bin/bash
-
-#
-# Copyright (c) 2017 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-cat << EOF
-In order to comply with the license terms of the distributed software, we would
-like to reproduce the following copyright notices, that were automatically
-collected by our $0 script, followed by a list of conditions and
-disclaimer:
-EOF
-
-echo ""
-
-git grep 'Copyright ([cC])' | \
-	sed -E -n 's/^.*(Copyright \([cC]\) (20[0-9][0-9]-)?20[0-9][0-9],? [-a-zA-Z., ]*[-a-zA-Z.]$)/\1/p' | \
-	sed -E 's/ ( )+/ /' | \
-	grep -v 'HelenOS project' | \
-	sort -u
-
-echo ""
-
-cat << EOF
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-- Redistributions of source code must retain the above copyright
-  notice, this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright
-  notice, this list of conditions and the following disclaimer in the
-  documentation and/or other materials provided with the distribution.
-- The name of the author may not be used to endorse or promote products
-  derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-EOF
-
Index: ols/ccheck.sh
===================================================================
--- tools/ccheck.sh	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2018 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-ccheck=tools/sycek/ccheck
-
-if [ ."$1" == .--fix ] ; then
-	opt=--fix
-else
-	opt=
-fi
-
-srepcnt=0
-snorepcnt=0
-fcnt=0
-
-find abi kernel boot uspace -type f -regex '^.*\.[ch]$' | (
-while read fname; do
-	outfile="$(mktemp)"
-	$ccheck $opt $fname >"$outfile" 2>&1
-	rc=$?
-	if [ .$rc == .0 ]; then
-		if [ -s "$outfile" ] ; then
-			srepcnt=$((srepcnt + 1))
-			cat "$outfile"
-		else
-			snorepcnt=$((snorepcnt + 1))
-		fi
-	else
-		fcnt=$((fcnt + 1))
-	fi
-
-	rm -f "$outfile"
-done
-
-echo "Checked files with issues: $srepcnt"
-echo "Checked files without issues: $snorepcnt"
-echo "Not checked files: $fcnt"
-)
Index: tools/ew.py
===================================================================
--- tools/ew.py	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ tools/ew.py	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -107,5 +107,5 @@
 			raise Exception
 		if processor == 'us':
-			return 'system-sparc64', '-M sun4u --prom-env boot-args="console=devices/\\hw\\pci0\\01:01.0\\com1\\a"'
+			return 'system-sparc64', '-M sun4u --prom-env boot-args="console=devices/\\hw\\pci0\\00:03.0\\com1\\a"'
 		elif processor == 'sun4v':
 			default_path = '/usr/local/opensparc/image/'
@@ -276,6 +276,4 @@
 				'audio' : False,
 				'console' : False,
-                                'net' : False,
-                                'usb' : False
 			},
 			'sun4v' : {
Index: ols/srepl
===================================================================
--- tools/srepl	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#!/bin/sh
-
-function usage {
-	echo "Usage:"
-	echo
-	echo "	$0 search_pattern [-- <pathspec> ]"
-	echo "	$0 search_pattern replacement [-- <pathspec> ]"
-	echo
-	echo "Pattern should be a basic regexp as accepted by grep and sed."
-	echo "For information on pathspec syntax, see git documentation."
-	echo
-	exit 1
-}
-
-
-if [ "$1" == "--" ]; then
-	usage
-elif [ "$#" -eq 1 ]  || [ "$2" == "--" ]; then
-	pattern="$1"
-	shift
-	git grep -I -n "$pattern" "$@"
-elif [ "$#" -eq 2 ] || [ "$3" == "--" ]; then
-
-	if ( git status --porcelain | grep '^.[^ ]' ); then
-		echo "You have unstaged changes in your tree."
-		echo "Either stage them with 'git add', commit them,"
-		echo "or discard them with 'git checkout -- .'"
-		exit 1
-	fi
-
-	pattern="$1"
-	replacement="$2"
-	shift
-	shift
-	git grep -I -l "$pattern" "$@" | xargs sed -i "s/$pattern/$replacement/g"
-else
-	usage
-fi
Index: ols/travis.sh
===================================================================
--- tools/travis.sh	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,213 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2018 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# This is wrapper script for testing build of HelenOS under Travis CI [1].
-#
-# You probably do not want to run this script directly. If you wish to test
-# that HelenOS builds for all architectures, consider using either check.sh
-# script or running our CI solution [2] (if you want to test ported software
-# too).
-#
-# [1] https://travis-ci.org/
-# [2] http://www.helenos.org/wiki/CI
-#
-
-H_ARCH_CONFIG_CROSS_TARGET=2
-H_ARCH_CONFIG_OUTPUT_FILENAME=3
-
-h_get_arch_config_space() {
-    cat <<'EOF_CONFIG_SPACE'
-amd64:amd64-unknown-elf:image.iso
-arm32/beagleboardxm:arm-linux-gnueabi:uImage.bin
-arm32/beaglebone:arm-linux-gnueabi:uImage.bin
-arm32/gta02:arm-linux-gnueabi:uImage.bin
-arm32/integratorcp:arm-linux-gnueabi:image.boot
-arm32/raspberrypi:arm-linux-gnueabi:uImage.bin
-ia32:i686-pc-linux-gnu:image.iso
-ia64/i460GX:ia64-pc-linux-gnu:image.boot
-ia64/ski:ia64-pc-linux-gnu:image.boot
-mips32/malta-be:mips-linux-gnu:image.boot
-mips32/malta-le:mipsel-linux-gnu:image.boot
-mips32/msim:mipsel-linux-gnu:image.boot
-ppc32:ppc-linux-gnu:image.iso
-sparc64/niagara:sparc64-linux-gnu:image.iso
-sparc64/ultra:sparc64-linux-gnu:image.iso
-EOF_CONFIG_SPACE
-}
-
-h_get_arch_config() {
-    h_get_arch_config_space | grep "^$H_ARCH:" | cut '-d:' -f "$1"
-}
-
-H_DEFAULT_HARBOURS_LIST="binutils fdlibm jainja libgmp libiconv msim pcc zlib libisl libmpfr libpng python2 libmpc gcc"
-
-
-
-#
-# main script starts here
-#
-
-# Check we are actually running inside Travis
-if [ -z "$TRAVIS" ]; then
-    echo "\$TRAVIS env not set. Are you running me inside Travis?" >&2
-    exit 5
-fi
-
-# Check HelenOS configuration was set-up
-if [ -z "$H_ARCH" ]; then
-    echo "\$H_ARCH env not set. Are you running me inside Travis?" >&2
-    exit 5
-fi
-
-# Check cross-compiler target
-H_CROSS_TARGET=`h_get_arch_config $H_ARCH_CONFIG_CROSS_TARGET`
-if [ -z "$H_CROSS_TARGET" ]; then
-    echo "No suitable cross-target found for '$H_ARCH.'" >&2
-    exit 1
-fi
-
-
-# Custom CROSS_PREFIX
-export CROSS_PREFIX=/usr/local/cross-static/
-
-# Default Harbours repository
-if [ -z "$H_HARBOURS_REPOSITORY" ]; then
-    H_HARBOURS_REPOSITORY="https://github.com/HelenOS/harbours.git"
-fi
-
-if [ "$1" = "help" ]; then
-    echo
-    echo "Following variables needs to be set prior running this script."
-    echo "Example settings follows:"
-    echo
-    echo "export H_ARCH=$H_ARCH"
-    echo "export TRAVIS_BUILD_ID=`date +%s`"
-    echo
-    echo "export H_HARBOURS=true"
-    echo "export H_HARBOUR_LIST=\"$H_DEFAULT_HARBOURS_LIST\""
-    echo
-    exit 0
-
-elif [ "$1" = "install" ]; then
-    set -x
-    
-    # Install dependencies
-    sudo apt-get -qq update || exit 1
-    sudo apt-get install -y genisoimage || exit 1
-
-    # Fetch and install cross-compiler
-    wget "http://ci.helenos.org/download/helenos-cross-$H_CROSS_TARGET.static.tar.xz" -O "/tmp/cross-$H_CROSS_TARGET.static.tar.xz" || exit 1
-    sudo mkdir -p "$CROSS_PREFIX" || exit 1
-    sudo tar -xJ -C "$CROSS_PREFIX" -f "/tmp/cross-$H_CROSS_TARGET.static.tar.xz" || exit 1
-    exit 0
-
-
-elif [ "$1" = "run" ]; then
-    set -x
-    
-    # Expected output filename (bootable image)
-    H_OUTPUT_FILENAME=`h_get_arch_config $H_ARCH_CONFIG_OUTPUT_FILENAME`
-    if [ -z "$H_OUTPUT_FILENAME" ]; then
-        echo "No suitable output image found for '$H_ARCH.'" >&2
-        exit 1
-    fi
-
-    # Build HARBOURs too?
-    H_HARBOURS=`echo "$H_HARBOURS" | grep -e '^true$' -e '^false$'`
-    if [ -z "$H_HARBOURS" ]; then
-        H_HARBOURS=false
-    fi
-    if [ -z "$H_HARBOUR_LIST" ]; then
-        H_HARBOUR_LIST="$H_DEFAULT_HARBOURS_LIST"
-    fi
-
-	
-    # Build it
-    make "PROFILE=$H_ARCH" HANDS_OFF=y || exit 1
-    test -s "$H_OUTPUT_FILENAME" || exit 1
-    
-    echo
-    echo "HelenOS for $H_ARCH built okay."
-    echo
-
-    # Build harbours
-    if $H_HARBOURS; then
-        echo
-        echo "Will try to build ported software for $H_ARCH."
-        echo "Repository used is $H_HARBOURS_REPOSITORY."
-        echo
-        
-        H_HELENOS_HOME=`pwd`
-        cd "$HOME" || exit 1
-        git clone --depth 10 "$H_HARBOURS_REPOSITORY" helenos-harbours || exit 1
-        mkdir "build-harbours-$TRAVIS_BUILD_ID" || exit 1
-        (
-            cd "build-harbours-$TRAVIS_BUILD_ID" || exit 1
-            mkdir build || exit 1
-            cd build
-
-            (
-                #[ "$H_ARCH" = "mips32/malta-be" ] && H_ARCH="mips32eb/malta-be"
-                echo "root = $H_HELENOS_HOME"
-                echo "arch =" `echo "$H_ARCH" | cut -d/ -f 1`
-                echo "machine =" `echo "$H_ARCH" | cut -d/ -f 2`
-            ) >hsct.conf || exit 1
-            
-            # "$HOME/helenos-harbours/hsct.sh" init "$H_HELENOS_HOME" "$H_ARCH" build >/dev/null 2>/dev/null || exit 1
-            
-            "$HOME/helenos-harbours/hsct.sh" update || exit 1
-
-            FAILED_HARBOURS=""    
-            for HARBOUR in $H_HARBOUR_LIST; do
-                "$HOME/helenos-harbours/hsct.sh" archive --no-deps "$HARBOUR" >"run-$HARBOUR.log" 2>&1
-                if [ $? -eq 0 ]; then
-                    tail -n 10 "run-$HARBOUR.log"
-                else
-                    FAILED_HARBOURS="$FAILED_HARBOURS $HARBOUR"
-                    cat build/$HARBOUR/*/config.log
-                    tail -n 100 "run-$HARBOUR.log"
-                fi
-                
-            done
-            
-            if [ -n "$FAILED_HARBOURS" ]; then
-                echo
-                echo "ERROR: following packages were not built:$FAILED_HARBOURS."
-                echo
-                exit 1
-            fi
-        ) || exit 1
-    fi
-else
-    echo "Invalid action specified." >&2
-    exit 5
-fi
-
Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/Makefile	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -255,5 +255,5 @@
 CLEANS := $(addsuffix .clean,$(DIRS) $(LIBS) $(BASE_LIBS))
 
-.PHONY: all $(BASE_BUILDS) $(BUILDS) $(BUILDS_TESTS) $(CLEANS) clean export
+.PHONY: all $(BASE_BUILDS) $(BUILDS) $(BUILDS_TESTS) $(CLEANS) clean
 
 all: $(BUILDS) $(BUILDS_TESTS)
@@ -261,7 +261,4 @@
 $(BUILDS_TESTS): $(BASE_BUILDS) $(BUILDS)
 	$(MAKE) -r -C $(basename $@) all-test PRECHECK=$(PRECHECK)
-
-export: lib/posix.build lib/math.build lib/clui.build
-	$(MAKE) -r -C lib/posix export EXPORT_DIR=$(EXPORT_DIR)
 
 clean: $(CLEANS)
Index: uspace/Makefile.common
===================================================================
--- uspace/Makefile.common	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/Makefile.common	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -174,55 +174,29 @@
 endif
 
-# Flags that are not necessary, and can be overriden, but are used by default.
-DEFAULT_CFLAGS = \
-	-O$(OPTIMIZATION) \
-	-ffunction-sections \
-	-pipe \
-	-Wall \
-	-Wextra \
-	-Wno-unused-parameter \
-	-Wmissing-prototypes \
-	-Wwrite-strings \
-	-Werror-implicit-function-declaration
+COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
+	-ffreestanding -fno-builtin -nostdlib -nostdinc -fexec-charset=UTF-8 \
+	-finput-charset=UTF-8 -D__$(ENDIANESS)__ -fno-common \
+	-fdebug-prefix-map=$(realpath $(ROOT_PATH))=.
+
+GCC_CFLAGS = -ffunction-sections -Wall -Wextra -Wno-clobbered \
+	-Wno-unused-parameter -Wmissing-prototypes -std=gnu99 \
+	-Werror-implicit-function-declaration \
+	-Wwrite-strings -pipe
+
+# -Wno-missing-prototypes is there because it warns about main().
+# This should be fixed elsewhere.
+CLANG_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-typedef-redefinition \
+	-Wno-missing-prototypes -Wno-unused-command-line-argument \
+	-std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
+	-pipe -fno-stack-protector -fno-PIC
 
 ifeq ($(CONFIG_DEBUG),y)
-	DEFAULT_CFLAGS += -Werror
-endif
-
-ifeq ($(COMPILER),clang)
-	DEFAULT_CFLAGS += \
-		-Wno-missing-field-initializers \
-		-Wno-typedef-redefinition \
-		-Wno-unused-command-line-argument
-else
-	DEFAULT_CFLAGS += \
-		-Wno-clobbered
+	COMMON_CFLAGS += -Werror
 endif
 
 ifeq ($(CONFIG_LINE_DEBUG),y)
-	DEFAULT_CFLAGS += -ggdb
-endif
-
-# Flags that should always be used, even for third-party software.
-COMMON_CFLAGS = \
-	-ffreestanding \
-	-nostdlib \
-	-nostdinc \
-	-D__$(ENDIANESS)__
-
-# Flags that are always used for HelenOS code, but not for third-party.
-HELENOS_CFLAGS = \
-	-std=gnu99 \
-	$(INCLUDES_FLAGS) \
-	-imacros $(CONFIG_HEADER) \
-	-D_HELENOS_SOURCE \
-	-fexec-charset=UTF-8 \
-	-finput-charset=UTF-8 \
-	-fno-common \
-	-fdebug-prefix-map=$(realpath $(ROOT_PATH))=.
-
-# TODO: Use a different name.
-# CFLAGS variable is traditionally used for overridable flags.
-CFLAGS = $(COMMON_CFLAGS) $(HELENOS_CFLAGS) $(DEFAULT_CFLAGS)
+	GCC_CFLAGS += -ggdb
+	CLANG_CFLAGS += -g
+endif
 
 ## Setup platform configuration
@@ -242,4 +216,10 @@
 endif
 
+ifeq ($(COMPILER),clang)
+	CFLAGS += $(COMMON_CFLAGS) $(CLANG_CFLAGS)
+else
+	CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
+endif
+
 ifeq ($(CONFIG_STRIP_BINARIES),y)
 	LFLAGS += --strip-all
@@ -266,5 +246,6 @@
 all-test: $(TEST_OUTPUTS)
 
-clean: fasterclean
+clean:
+	rm -f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk
 	find . -name '*.o' -follow -exec rm \{\} \;
 	find . -name '*.lo' -follow -exec rm \{\} \;
@@ -272,5 +253,5 @@
 
 fasterclean:
-	rm -rf $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk
+	rm -f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk
 
 depend: $(PRE_DEPEND)
Index: uspace/app/barber/barber.c
===================================================================
--- uspace/app/barber/barber.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/barber/barber.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -208,5 +208,5 @@
 {
 	category_id_t led_cat;
-	errno_t rc = loc_category_get_id("led", &led_cat, IPC_FLAG_BLOCKING);
+	int rc = loc_category_get_id("led", &led_cat, IPC_FLAG_BLOCKING);
 	if (rc != EOK)
 		return;
@@ -255,5 +255,5 @@
 	
 	list_initialize(&led_devs);
-	errno_t rc = loc_register_cat_change_cb(loc_callback);
+	int rc = loc_register_cat_change_cb(loc_callback);
 	if (rc != EOK) {
 		printf("Unable to register callback for device discovery.\n");
Index: uspace/app/bdsh/cmds/builtins/batch/batch.c
===================================================================
--- uspace/app/bdsh/cmds/builtins/batch/batch.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/builtins/batch/batch.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -32,5 +32,4 @@
 #include <stddef.h>
 #include <errno.h>
-#include <str.h>
 #include "config.h"
 #include "util.h"
@@ -86,5 +85,5 @@
 	}
 
-	errno_t rc = EOK;
+	int rc = 0;
 	FILE *batch = fopen(argv[1], "r");
 	if (batch == NULL) {
@@ -105,5 +104,5 @@
 				if (cur == fusr.line) {
 					/* skip empty line */
-					rc = EOK;
+					rc = 0;
 					free(cur);
 				} else {
Index: uspace/app/bdsh/cmds/builtins/cd/cd.c
===================================================================
--- uspace/app/bdsh/cmds/builtins/cd/cd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/builtins/cd/cd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,8 +51,8 @@
 static bool previous_directory_set = false;
 
-static errno_t chdir_and_remember(const char *new_dir)
+static int chdir_and_remember(const char *new_dir)
 {
 
-	errno_t rc = vfs_cwd_get(previous_directory_tmp, PATH_MAX);
+	int rc = vfs_cwd_get(previous_directory_tmp, PATH_MAX);
 	previous_directory_valid = (rc == EOK);
 	previous_directory_set = true;
@@ -85,6 +85,5 @@
 int cmd_cd(char **argv, cliuser_t *usr)
 {
-	int argc;
-	errno_t rc = EOK;
+	int argc, rc = 0;
 
 	argc = cli_count_args(argv);
Index: uspace/app/bdsh/cmds/mknewcmd
===================================================================
--- uspace/app/bdsh/cmds/mknewcmd	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/mknewcmd	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1,6 +1,4 @@
 #!/bin/sh
-# Copyright (C) 2008 Tim Post
-# All Rights Reserved
-#
+# Copyright (C) 2008 Tim Post - All Rights Reserved
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are met:
Index: uspace/app/bdsh/cmds/modules/cat/cat.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -187,5 +187,5 @@
 	off64_t file_size = 0, length = 0;
 	aoff64_t pos = 0;
-	errno_t rc;
+	int rc;
 
 	bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0);
@@ -195,10 +195,6 @@
 		/* Allow storing the whole UTF-8 character. */
 		blen = STR_BOUNDS(1);
-	} else {
-		errno_t rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd);
-		if (rc != EOK) {
-			fd = -1;
-		}
-	}
+	} else
+		fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ);
 	
 	if (fd < 0) {
@@ -215,5 +211,5 @@
 
 	if (tail != CAT_FULL_FILE) {
-		vfs_stat_t st;
+		struct stat st;
 
 		if (vfs_stat(fd, &st) != EOK) {
@@ -316,5 +312,5 @@
 	bool tailFirst = false;
 	sysarg_t rows, cols;
-	errno_t rc;
+	int rc;
 	
 	/*
@@ -328,5 +324,4 @@
 	console_rows = 0;
 	should_quit = false;
-	dash_represents_stdin = false;
 	console = console_init(stdin, stdout);
 	number = false;
@@ -339,5 +334,5 @@
 
 	for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
-		c = getopt_long(argc, argv, "xhvmH:t:b:sn", long_options, &opt_ind);
+		c = getopt_long(argc, argv, "xhvmH:t:b:s:n", long_options, &opt_ind);
 		switch (c) {
 		case 'h':
Index: uspace/app/bdsh/cmds/modules/cmp/cmp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cmp/cmp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/cmp/cmp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -70,7 +70,7 @@
 }
 
-static errno_t cmp_files(const char *fn0, const char *fn1)
+static int cmp_files(const char *fn0, const char *fn1)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	const char *fn[2] = {fn0, fn1};
 	int fd[2] = {-1, -1};
@@ -80,6 +80,7 @@
 
 	for (int i = 0; i < 2; i++) {
-		rc = vfs_lookup_open(fn[i], WALK_REGULAR, MODE_READ, &(fd[i]));
-		if (rc != EOK) {
+		fd[i] = vfs_lookup_open(fn[i], WALK_REGULAR, MODE_READ);
+		if (fd[i] < 0) {
+			rc = fd[i];
 			printf("Unable to open %s\n", fn[i]);
 			goto end;
@@ -101,5 +102,5 @@
 		    memcmp(buffer[0], buffer[1], offset[0]) != 0) {
 			printf("Return 1\n");
-			rc = EBUSY;
+			rc = 1;
 			goto end;
 		}
@@ -117,5 +118,5 @@
 int cmd_cmp(char **argv)
 {
-	errno_t rc;
+	int rc;
 	unsigned int argc;
 	int c, opt_ind;
Index: uspace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -28,5 +28,4 @@
 
 #include <errno.h>
-#include <str_error.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -80,7 +79,7 @@
 static dentry_type_t get_type(const char *path)
 {
-	vfs_stat_t s;
-
-	errno_t r = vfs_stat_path(path, &s);
+	struct stat s;
+
+	int r = vfs_stat_path(path, &s);
 
 	if (r != EOK)
@@ -176,8 +175,8 @@
 }
 
-static errno_t do_copy(const char *src, const char *dest,
+static int do_copy(const char *src, const char *dest,
     size_t blen, int vb, int recursive, int force, int interactive)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	char dest_path[PATH_MAX];
 	char src_path[PATH_MAX];
@@ -266,7 +265,5 @@
 
 		/* call copy_file and exit */
-		if (copy_file(src, dest_path, blen, vb) < 0) {
-			rc = EIO;
-		}
+		rc = (copy_file(src, dest_path, blen, vb) < 0);
 
 	} else if (src_type == TYPE_DIR) {
@@ -340,6 +337,6 @@
 		 */
 		while ((dp = readdir(dir))) {
-			vfs_stat_t src_s;
-			vfs_stat_t dest_s;
+			struct stat src_s;
+			struct stat dest_s;
 
 			char src_dent[PATH_MAX];
@@ -388,21 +385,21 @@
 	int fd1, fd2;
 	size_t rbytes, wbytes;
-	errno_t rc;
+	int rc;
 	off64_t total;
 	char *buff = NULL;
 	aoff64_t posr = 0, posw = 0;
-	vfs_stat_t st;
+	struct stat st;
 
 	if (vb)
 		printf("Copying %s to %s\n", src, dest);
 
-	rc = vfs_lookup_open(src, WALK_REGULAR, MODE_READ, &fd1);
-	if (rc != EOK) {
+	fd1 = vfs_lookup_open(src, WALK_REGULAR, MODE_READ);
+	if (fd1 < 0) {
 		printf("Unable to open source file %s\n", src);
 		return -1;
 	}
 
-	rc = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE, &fd2);
-	if (rc != EOK) {
+	fd2 = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE);
+	if (fd2 < 0) {
 		printf("Unable to open destination file %s\n", dest);
 		vfs_put(fd1);
@@ -435,6 +432,6 @@
 
 	if (rc != EOK) {
-		printf("\nError copying %s: %s\n", src, str_error(rc));
-		return -1;
+		printf("\nError copying %s, (%d)\n", src, rc);
+		return rc;
 	}
 
@@ -444,9 +441,5 @@
 	if (buff)
 		free(buff);
-	if (rc != EOK) {
-		return -1;
-	} else {
-		return 0;
-	}
+	return rc;
 }
 
@@ -479,5 +472,5 @@
 	int force = 0, interactive = 0;
 	int c, opt_ind;
-	errno_t ret;
+	int64_t ret;
 
 	con = console_init(stdin, stdout);
Index: uspace/app/bdsh/cmds/modules/ls/ls.c
===================================================================
--- uspace/app/bdsh/cmds/modules/ls/ls.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/ls/ls.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -32,5 +32,4 @@
 
 #include <errno.h>
-#include <str_error.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -135,5 +134,5 @@
 	int i;
 	int nbdirs = 0;
-	errno_t rc;
+	int rc;
 	int len;
 	char *buff;
@@ -185,5 +184,5 @@
 		if (rc != EOK) {
 			printf("ls: skipping bogus node %s\n", buff);
-			printf("error=%s\n", str_error_name(rc));
+			printf("error=%d\n", rc);
 			goto out;
 		}
Index: uspace/app/bdsh/cmds/modules/ls/ls.h
===================================================================
--- uspace/app/bdsh/cmds/modules/ls/ls.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/ls/ls.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -23,5 +23,5 @@
 struct dir_elem_t {
 	char *name;
-	vfs_stat_t s;
+	struct stat s;
 };
 
Index: uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mkdir/mkdir.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/mkdir/mkdir.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -94,11 +94,10 @@
 
 	int ret = 0;
-	errno_t rc;
 
 	if (!create_parents) {
-		rc = vfs_link_path(path, KIND_DIRECTORY, NULL);
-		if (rc != EOK) {
+		ret = vfs_link_path(path, KIND_DIRECTORY, NULL);
+		if (ret != EOK) {
 			cli_error(CL_EFAIL, "%s: could not create %s (%s)",
-			    cmdname, path, str_error(rc));
+			    cmdname, path, str_error(ret));
 			ret = 1;
 		}
@@ -136,8 +135,8 @@
 			path[prev_off] = 0;
 
-			rc = vfs_link_path(path, KIND_DIRECTORY, NULL);
-			if (rc != EOK && rc != EEXIST) {
+			ret = vfs_link_path(path, KIND_DIRECTORY, NULL);
+			if (ret != EOK && ret != EEXIST) {
 				cli_error(CL_EFAIL, "%s: could not create %s (%s)",
-				    cmdname, path, str_error(rc));
+				    cmdname, path, str_error(ret));
 				ret = 1;
 				goto leave;
@@ -147,8 +146,8 @@
 		}
 		/* Create the final directory. */
-		rc = vfs_link_path(path, KIND_DIRECTORY, NULL);
-		if (rc != EOK) {
+		ret = vfs_link_path(path, KIND_DIRECTORY, NULL);
+		if (ret != EOK) {
 			cli_error(CL_EFAIL, "%s: could not create %s (%s)",
-			    cmdname, path, str_error(rc));
+			    cmdname, path, str_error(ret));
 			ret = 1;
 		}
Index: uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mkfile/mkfile.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/mkfile/mkfile.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -87,7 +87,7 @@
  * @param str	String containing the size specification.
  * @param rsize	Place to store size in bytes
- * @return	EOK on success or an error code
+ * @return	EOK on success or error code
  */
-static errno_t read_size(const char *str, size_t *rsize)
+static int read_size(const char *str, size_t *rsize)
 {
 	size_t number, unit;
@@ -123,5 +123,5 @@
 	size_t to_write;
 	size_t nwritten;
-	errno_t rc;
+	int rc;
 	char *file_name;
 	void *buffer;
@@ -163,6 +163,6 @@
 	file_name = argv[optind];
 
-	rc = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MUST_CREATE, MODE_WRITE, &fd);
-	if (rc != EOK) {
+	fd = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MUST_CREATE, MODE_WRITE);
+	if (fd < 0) {
 		printf("%s: failed to create file %s.\n", cmdname, file_name);
 		return CMD_FAILURE;
@@ -192,5 +192,5 @@
 		rc = vfs_write(fd, &pos, buffer, to_write, &nwritten);
 		if (rc != EOK) {
-			printf("%s: Error writing file (%s).\n", cmdname, str_error(rc));
+			printf("%s: Error writing file (%s).\n", cmdname, str_error(errno));
 			vfs_put(fd);
 			free(buffer);
@@ -202,11 +202,10 @@
 	free(buffer);
 
-	rc = vfs_put(fd);
-	if (rc != EOK)
+	if (vfs_put(fd) < 0)
 		goto error;
 
 	return CMD_SUCCESS;
 error:
-	printf("%s: Error writing file (%s).\n", cmdname, str_error(rc));
+	printf("%s: Error writing file (%s).\n", cmdname, str_error(errno));
 	return CMD_FAILURE;
 }
Index: uspace/app/bdsh/cmds/modules/mount/mount.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mount/mount.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/mount/mount.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <getopt.h>
 #include <inttypes.h>
-#include <str.h>
 #include "config.h"
 #include "util.h"
@@ -79,5 +78,5 @@
 	mtab_ent_t *old_ent = NULL;
 	char *svc_name;
-	errno_t rc;
+	int rc;
 
 	vfs_get_mtab_list(&mtab_list);
@@ -110,5 +109,5 @@
 static void print_fstypes(void)
 {
-	errno_t rc;
+	int rc;
 	vfs_fstypes_t fstypes;
 	char **p;
@@ -133,6 +132,5 @@
 	const char *mopts = "";
 	const char *dev = "";
-	errno_t rc;
-	int c, opt_ind;
+	int rc, c, opt_ind;
 	unsigned int instance = 0;
 	bool instance_set = false;
Index: uspace/app/bdsh/cmds/modules/mv/mv.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mv/mv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/mv/mv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -30,5 +30,4 @@
 #include <stdlib.h>
 #include <errno.h>
-#include <str_error.h>
 #include <vfs/vfs.h>
 #include "config.h"
@@ -52,5 +51,5 @@
 {
 	unsigned int argc;
-	errno_t rc;
+	int rc;
 
 	argc = cli_count_args(argv);
@@ -63,6 +62,6 @@
 	rc = vfs_rename_path(argv[1], argv[2]);
 	if (rc != EOK) {
-		printf("Unable to rename %s to %s: %s)\n",
-		    argv[1], argv[2], str_error(rc));
+		printf("Unable to rename %s to %s (error=%d)\n",
+		    argv[1], argv[2], rc);
 		return CMD_FAILURE;
 	}
Index: uspace/app/bdsh/cmds/modules/rm/rm.c
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -149,5 +149,6 @@
 	}
 
-	if (vfs_lookup(path, WALK_REGULAR, &fd) == EOK) {
+	fd = vfs_lookup(path, WALK_REGULAR);
+	if (fd >= 0) {
 		vfs_put(fd);
 		return RM_FILE;
@@ -195,5 +196,5 @@
 static unsigned int rm_recursive(const char *path)
 {
-	errno_t rc;
+	int rc;
 	unsigned int ret = 0;
 
@@ -209,5 +210,5 @@
 	rc = vfs_unlink_path(path);
 	if (rc == EOK)
-		return 0;
+		return EOK;
 
 	cli_error(CL_ENOTSUP, "Can not remove %s", path);
Index: uspace/app/bdsh/cmds/modules/sleep/sleep.c
===================================================================
--- uspace/app/bdsh/cmds/modules/sleep/sleep.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/sleep/sleep.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -31,5 +31,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 #include "config.h"
 #include "util.h"
@@ -63,7 +62,7 @@
  * @return EOK if conversion was successful.
  */
-static errno_t decimal_to_useconds(const char *nptr, useconds_t *result)
+static int decimal_to_useconds(const char *nptr, useconds_t *result)
 {
-	errno_t ret;
+	int ret;
 	uint64_t whole_seconds;
 	uint64_t frac_seconds;
@@ -113,5 +112,5 @@
 int cmd_sleep(char **argv)
 {
-	errno_t ret;
+	int ret;
 	unsigned int argc;
 	useconds_t duration = 0;
Index: uspace/app/bdsh/cmds/modules/touch/touch.c
===================================================================
--- uspace/app/bdsh/cmds/modules/touch/touch.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/touch/touch.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -82,5 +82,5 @@
 	int longind;
 	bool no_create = false;
-	vfs_stat_t file_stat;
+	struct stat file_stat;
 	int fd = -1;
 	char *buff = NULL;
@@ -123,8 +123,5 @@
 		if ((!no_create) ||
 		    ((no_create) && (vfs_stat_path(buff, &file_stat) == EOK))) {
-			errno_t rc = vfs_lookup(buff, WALK_REGULAR | WALK_MAY_CREATE, &fd);
-			if (rc != EOK) {
-				fd = -1;
-			}
+			fd = vfs_lookup(buff, WALK_REGULAR | WALK_MAY_CREATE);
 		}
 		
Index: uspace/app/bdsh/cmds/modules/unmount/unmount.c
===================================================================
--- uspace/app/bdsh/cmds/modules/unmount/unmount.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/cmds/modules/unmount/unmount.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -31,5 +31,4 @@
 #include <vfs/vfs.h>
 #include <errno.h>
-#include <str_error.h>
 #include "config.h"
 #include "util.h"
@@ -57,5 +56,5 @@
 {
 	unsigned int argc;
-	errno_t rc;
+	int rc;
 
 	argc = cli_count_args(argv);
@@ -69,5 +68,5 @@
 	rc = vfs_unmount_path(argv[1]);
 	if (rc != EOK) {
-		printf("Unable to unmount %s: %s\n", argv[1], str_error(rc));
+		printf("Unable to unmount %s (rc=%d)\n", argv[1], rc);
 		return CMD_FAILURE;
 	}
Index: uspace/app/bdsh/compl.c
===================================================================
--- uspace/app/bdsh/compl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/compl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,5 +34,4 @@
 #include <stdlib.h>
 #include <vfs/vfs.h>
-#include <str.h>
 
 #include "cmds/cmds.h"
@@ -41,6 +40,6 @@
 #include "tok.h"
 
-static errno_t compl_init(wchar_t *text, size_t pos, size_t *cstart, void **state);
-static errno_t compl_get_next(void *state, char **compl);
+static int compl_init(wchar_t *text, size_t pos, size_t *cstart, void **state);
+static int compl_get_next(void *state, char **compl);
 static void compl_fini(void *state);
 
@@ -69,7 +68,7 @@
 
 	/** Pointer inside list of directories */
-	const char *const *path;
+	const char **path;
 	/** If not @c NULL, should be freed in the end. */
-	char **path_list;
+	const char **path_list;
 	/** Current open directory */
 	DIR *dir;
@@ -88,5 +87,5 @@
  * Set up iterators in completion object, based on current token.
  */
-static errno_t compl_init(wchar_t *text, size_t pos, size_t *cstart, void **state)
+static int compl_init(wchar_t *text, size_t pos, size_t *cstart, void **state)
 {
 	compl_t *cs = NULL;
@@ -94,5 +93,5 @@
 	char *prefix = NULL;
 	char *dirname = NULL;
-	errno_t retval;
+	int retval;
 	
 	token_t *tokens = calloc(WORD_MAX, sizeof(token_t));
@@ -219,7 +218,5 @@
 		cs->path_list[0] = dirname;
 		cs->path_list[1] = NULL;
-		/* The second const ensures that we can't assign a const
-		 * string to the non-const array. */
-		cs->path = (const char *const *) cs->path_list;
+		cs->path = cs->path_list;
 
 	} else if (cs->is_command) {
@@ -291,5 +288,5 @@
 
 /** Get next match. */
-static errno_t compl_get_next(void *state, char **compl)
+static int compl_get_next(void *state, char **compl)
 {
 	compl_t *cs = (compl_t *) state;
@@ -362,5 +359,5 @@
 				char *ent_path;
 				asprintf(&ent_path, "%s/%s", *cs->path, dent->d_name);
-				vfs_stat_t ent_stat;
+				struct stat ent_stat;
 				if (vfs_stat_path(ent_path, &ent_stat) != EOK) {
 					/* Error */
Index: uspace/app/bdsh/errors.h
===================================================================
--- uspace/app/bdsh/errors.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/errors.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
 
 extern void cli_error(int, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
+    PRINTF_ATTRIBUTE(2, 3);
 
 #endif
Index: uspace/app/bdsh/exec.c
===================================================================
--- uspace/app/bdsh/exec.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/exec.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,6 +58,6 @@
 	int fd;
 
-	errno_t rc = vfs_lookup_open(f, WALK_REGULAR, MODE_READ, &fd);
-	if (rc == EOK) {
+	fd = vfs_lookup_open(f, WALK_REGULAR, MODE_READ);
+	if (fd >= 0) {
 		vfs_put(fd);
 		return 0;
@@ -98,6 +98,5 @@
 	task_exit_t texit;
 	char *tmp;
-	errno_t rc;
-	int retval, i;
+	int rc, retval, i;
 	int file_handles[3] = { -1, -1, -1 };
 	FILE *files[3];
@@ -118,5 +117,5 @@
 	free(tmp);
 
-	if (rc != EOK) {
+	if (rc != 0) {
 		cli_error(CL_EEXEC, "%s: Cannot spawn `%s' (%s)", progname, cmd,
 		    str_error(rc));
Index: uspace/app/bdsh/input.c
===================================================================
--- uspace/app/bdsh/input.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/input.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -65,5 +65,5 @@
  * invokes the built-in entry point (a[0]) passing all arguments in a[] to
  * the handler */
-errno_t process_input(cliuser_t *usr)
+int process_input(cliuser_t *usr)
 {
 	token_t *tokens_buf = calloc(WORD_MAX, sizeof(token_t));
@@ -73,5 +73,5 @@
 	
 	char *cmd[WORD_MAX];
-	errno_t rc = EOK;
+	int rc = 0;
 	tokenizer_t tok;
 	unsigned int i, pipe_count, processed_pipes;
@@ -82,5 +82,5 @@
 	if (usr->line == NULL) {
 		free(tokens_buf);
-		return EINVAL;
+		return CL_EFAIL;
 	}
 
@@ -198,9 +198,5 @@
 	}
 
-	if (run_command(cmd, usr, &new_iostate) == 0) {
-		rc = EOK;
-	} else {
-		rc = EINVAL;
-	}
+	rc = run_command(cmd, usr, &new_iostate);
 	
 finit_with_files:
@@ -259,5 +255,5 @@
 {
 	char *str;
-	errno_t rc;
+	int rc;
 	
 	tinput_set_prompt(tinput, usr->prompt);
Index: uspace/app/bdsh/input.h
===================================================================
--- uspace/app/bdsh/input.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/input.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,5 +35,5 @@
 
 extern void get_input(cliuser_t *);
-extern errno_t process_input(cliuser_t *);
+extern int process_input(cliuser_t *);
 extern int input_init(void);
 
Index: uspace/app/bdsh/scli.c
===================================================================
--- uspace/app/bdsh/scli.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/scli.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -98,5 +98,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t ret = 0;
+	int ret = 0;
 	
 	stdiostate.stdin = stdin;
Index: uspace/app/bdsh/scli.h
===================================================================
--- uspace/app/bdsh/scli.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/scli.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 	char *cwd;
 	char *prompt;
-	errno_t lasterr;
+	int lasterr;
 } cliuser_t;
 
Index: uspace/app/bdsh/test/toktest.c
===================================================================
--- uspace/app/bdsh/test/toktest.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/test/toktest.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,10 +46,10 @@
 	str_cpy(input_buffer, MAX_INPUT, input);
 
-	errno_t rc = tok_init(&tokenizer, input_buffer, tokens, MAX_TOKENS);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	int rc = tok_init(&tokenizer, input_buffer, tokens, MAX_TOKENS);
+	PCUT_ASSERT_INT_EQUALS(EOK, rc);
 
 	size_t token_count;
 	rc = tok_tokenize(&tokenizer, &token_count);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_INT_EQUALS(EOK, rc);
 
 
Index: uspace/app/bdsh/tok.c
===================================================================
--- uspace/app/bdsh/tok.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/tok.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,8 +38,8 @@
 static wchar_t tok_get_char(tokenizer_t *);
 static wchar_t tok_look_char(tokenizer_t *);
-static errno_t tok_push_char(tokenizer_t *, wchar_t);
-static errno_t tok_push_token(tokenizer_t *);
+static int tok_push_char(tokenizer_t *, wchar_t);
+static int tok_push_token(tokenizer_t *);
 static bool tok_pending_chars(tokenizer_t *);
-static errno_t tok_finish_string(tokenizer_t *);
+static int tok_finish_string(tokenizer_t *);
 static void tok_start_token(tokenizer_t *, token_type_t);
 
@@ -51,5 +51,5 @@
  * @param max_tokens number of elements of the out_tokens array
  */
-errno_t tok_init(tokenizer_t *tok, char *input, token_t *out_tokens,
+int tok_init(tokenizer_t *tok, char *input, token_t *out_tokens,
     size_t max_tokens)
 {	
@@ -89,7 +89,7 @@
 
 /** Tokenize the input string into the tokens */
-errno_t tok_tokenize(tokenizer_t *tok, size_t *tokens_length)
-{
-	errno_t rc;
+int tok_tokenize(tokenizer_t *tok, size_t *tokens_length)
+{
+	int rc;
 	wchar_t next_char;
 	
@@ -178,7 +178,7 @@
 
 /** Finish tokenizing an opened string */
-errno_t tok_finish_string(tokenizer_t *tok)
-{
-	errno_t rc;
+int tok_finish_string(tokenizer_t *tok)
+{
+	int rc;
 	wchar_t next_char;
 	
@@ -233,5 +233,5 @@
 
 /** Append a char to the end of the current token */
-errno_t tok_push_char(tokenizer_t *tok, wchar_t ch)
+int tok_push_char(tokenizer_t *tok, wchar_t ch)
 {
 	return chr_encode(ch, tok->outbuf, &tok->outbuf_offset, tok->outbuf_size);
@@ -244,5 +244,5 @@
 
 /** Push the current token to the output array */
-errno_t tok_push_token(tokenizer_t *tok)
+int tok_push_token(tokenizer_t *tok)
 {
 	if (tok->outtok_offset >= tok->outtok_size) {
Index: uspace/app/bdsh/tok.h
===================================================================
--- uspace/app/bdsh/tok.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bdsh/tok.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 	size_t byte_length;
 	size_t char_length;
-	token_type_t type;
+ 	token_type_t type;
 } token_t;
 
@@ -63,7 +63,7 @@
 } tokenizer_t;
 
-extern errno_t tok_init(tokenizer_t *, char *, token_t *, size_t);
+extern int tok_init(tokenizer_t *, char *, token_t *, size_t);
 extern void tok_fini(tokenizer_t *);
-extern errno_t tok_tokenize(tokenizer_t *, size_t *);
+extern int tok_tokenize(tokenizer_t *, size_t *);
 
 #endif
Index: uspace/app/bithenge/test.c
===================================================================
--- uspace/app/bithenge/test.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bithenge/test.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,5 +57,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 	if (argc < 3) {
 		fprintf(stderr, "Usage: %s <script> <source>\n", argv[0]);
Index: uspace/app/blkdump/blkdump.c
===================================================================
--- uspace/app/blkdump/blkdump.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/blkdump/blkdump.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,4 @@
 #include <inttypes.h>
 #include <errno.h>
-#include <str.h>
 
 #define NAME	"blkdump"
@@ -64,5 +63,5 @@
 {
 
-	errno_t rc;
+	int rc;
 	char *dev_path;
 	size_t block_size;
@@ -162,13 +161,12 @@
 	printf("Device %s has %" PRIuOFF64 " blocks, %" PRIuOFF64 " bytes each\n", dev_path, dev_nblocks, (aoff64_t) block_size);
 
-	int ret;
 	if (toc)
-		ret = print_toc();
+		rc = print_toc();
 	else
-		ret = print_blocks(block_offset, block_count, block_size);
+		rc = print_blocks(block_offset, block_count, block_size);
 
 	block_fini(service_id);
 
-	return ret;
+	return rc;
 }
 
@@ -179,5 +177,5 @@
 	aoff64_t limit;
 	size_t data_offset;
-	errno_t rc;
+	int rc;
 
 	data = malloc(block_size);
@@ -218,5 +216,5 @@
 {
 	scsi_toc_multisess_data_t toc;
-	errno_t rc;
+	int rc;
 
 	rc = block_read_toc(service_id, 0, &toc, sizeof(toc));
Index: uspace/app/bnchmark/bnchmark.c
===================================================================
--- uspace/app/bnchmark/bnchmark.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/bnchmark/bnchmark.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,4 @@
 #include <stdlib.h>
 #include <stdint.h>
-#include <str_error.h>
 #include <mem.h>
 #include <loc.h>
@@ -49,5 +48,4 @@
 #include <time.h>
 #include <dirent.h>
-#include <str.h>
 
 #define NAME	"bnchmark"
@@ -55,15 +53,15 @@
 #define MBYTE (1024*1024)
 
-typedef errno_t(*measure_func_t)(void *);
+typedef int(*measure_func_t)(void *);
 typedef unsigned long umseconds_t; /* milliseconds */
 
 static void syntax_print(void);
 
-static errno_t measure(measure_func_t fn, void* data, umseconds_t *result)
+static int measure(measure_func_t fn, void* data, umseconds_t *result)
 {
 	struct timeval start_time;
 	gettimeofday(&start_time, NULL);
 	
-	errno_t rc = fn(data);
+	int rc = fn(data);
 	if (rc != EOK) {
 		fprintf(stderr, "measured function failed\n");
@@ -80,5 +78,5 @@
 }
 
-static errno_t sequential_read_file(void *data)
+static int sequential_read_file(void *data)
 {
 	char *path = (char *) data;
@@ -110,5 +108,5 @@
 }
 
-static errno_t sequential_read_dir(void *data)
+static int sequential_read_dir(void *data)
 {
 	char *path = (char *) data;
@@ -132,5 +130,5 @@
 int main(int argc, char **argv)
 {
-	errno_t rc;
+	int rc;
 	umseconds_t milliseconds_taken = 0;
 	char *path = NULL;
@@ -188,5 +186,5 @@
 		rc = measure(fn, path, &milliseconds_taken);
 		if (rc != EOK) {
-			fprintf(stderr, "Error: %s\n", str_error(rc));
+			fprintf(stderr, "Error %d\n", rc);
 			return 1;
 		}
Index: uspace/app/corecfg/corecfg.c
===================================================================
--- uspace/app/corecfg/corecfg.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/corecfg/corecfg.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <errno.h>
 #include <stdio.h>
-#include <str.h>
 
 #define NAME "corecfg"
@@ -51,5 +50,5 @@
 {
 	bool enable;
-	errno_t rc;
+	int rc;
 
 	rc = corecfg_get_enable(&enable);
@@ -66,5 +65,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	rc = corecfg_init();
Index: uspace/app/date/date.c
===================================================================
--- uspace/app/date/date.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/date/date.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,11 +36,10 @@
 #include <getopt.h>
 #include <ctype.h>
-#include <str.h>
 
 #define NAME   "date"
 
-static errno_t read_date_from_arg(char *wdate, struct tm *t);
-static errno_t read_time_from_arg(char *wdate, struct tm *t);
-static errno_t tm_sanity_check(struct tm *t);
+static int read_date_from_arg(char *wdate, struct tm *t);
+static int read_time_from_arg(char *wdate, struct tm *t);
+static int tm_sanity_check(struct tm *t);
 static bool is_leap_year(int year);
 
@@ -52,6 +51,5 @@
 main(int argc, char **argv)
 {
-	errno_t rc;
-	int c;
+	int rc, c;
 	category_id_t cat_id;
 	size_t        svc_cnt;
@@ -198,8 +196,8 @@
  *  with the following format: DD/MM/YYYY
  */
-static errno_t
+static int
 read_date_from_arg(char *wdate, struct tm *t)
 {
-	errno_t rc;
+	int rc;
 	uint32_t tmp;
 
@@ -233,8 +231,8 @@
  *  with the following format: HH:MM:SS or HH:MM
  */
-static errno_t
+static int
 read_time_from_arg(char *wtime, struct tm *t)
 {
-	errno_t rc;
+	int rc;
 	size_t len = str_size(wtime);
 	bool sec_present = len == 8;
@@ -279,5 +277,5 @@
  * @return      EOK on success or EINVAL
  */
-static errno_t
+static int
 tm_sanity_check(struct tm *t)
 {
Index: uspace/app/devctl/devctl.c
===================================================================
--- uspace/app/devctl/devctl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/devctl/devctl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 #include <str_error.h>
 
@@ -71,5 +70,5 @@
 }
 
-static errno_t fun_subtree_print(devman_handle_t funh, int lvl)
+static int fun_subtree_print(devman_handle_t funh, int lvl)
 {
 	devman_handle_t devh;
@@ -77,5 +76,5 @@
 	size_t count, i;
 	unsigned int score;
-	errno_t rc;
+	int rc;
 	int j;
 
@@ -137,8 +136,8 @@
 }
 
-static errno_t fun_tree_print(void)
+static int fun_tree_print(void)
 {
 	devman_handle_t root_fun;
-	errno_t rc;
+	int rc;
 
 	rc = devman_fun_get_handle("/", &root_fun, 0);
@@ -155,8 +154,8 @@
 }
 
-static errno_t fun_online(const char *path)
+static int fun_online(const char *path)
 {
 	devman_handle_t funh;
-	errno_t rc;
+	int rc;
 
 	rc = devman_fun_get_handle(path, &funh, 0);
@@ -176,8 +175,8 @@
 }
 
-static errno_t fun_offline(const char *path)
+static int fun_offline(const char *path)
 {
 	devman_handle_t funh;
-	errno_t rc;
+	int rc;
 
 	rc = devman_fun_get_handle(path, &funh, 0);
@@ -198,5 +197,5 @@
 }
 
-static errno_t drv_list(void)
+static int drv_list(void)
 {
 	devman_handle_t *devs;
@@ -208,5 +207,5 @@
 	size_t i;
 	table_t *table = NULL;
-	errno_t rc;
+	int rc;
 
 	rc = devman_get_drivers(&drvs, &ndrvs);
@@ -253,5 +252,5 @@
 }
 
-static errno_t drv_show(char *drvname)
+static int drv_show(char *drvname)
 {
 	devman_handle_t *devs;
@@ -263,5 +262,5 @@
 	size_t ndevs;
 	size_t i;
-	errno_t rc;
+	int rc;
 
 	rc = devman_driver_get_handle(drvname, &drvh);
@@ -318,12 +317,12 @@
 }
 
-static errno_t drv_load(const char *drvname)
-{
-	errno_t rc;
+static int drv_load(const char *drvname)
+{
+	int rc;
 	devman_handle_t drvh;
 
 	rc = devman_driver_get_handle(drvname, &drvh);
 	if (rc != EOK) {
-		printf("Failed resolving driver '%s': %s.\n", drvname, str_error(rc));
+		printf("Failed resolving driver '%s' (%d).\n", drvname, rc);
 		return rc;
 	}
@@ -331,19 +330,19 @@
 	rc = devman_driver_load(drvh);
 	if (rc != EOK) {
-		printf("Failed loading driver '%s': %s.\n", drvname, str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t drv_unload(const char *drvname)
-{
-	errno_t rc;
+		printf("Failed loading driver '%s' (%d).\n", drvname, rc);
+		return rc;
+	}
+
+	return EOK;
+}
+
+static int drv_unload(const char *drvname)
+{
+	int rc;
 	devman_handle_t drvh;
 
 	rc = devman_driver_get_handle(drvname, &drvh);
 	if (rc != EOK) {
-		printf("Failed resolving driver '%s': %s.\n", drvname, str_error(rc));
+		printf("Failed resolving driver '%s' (%d).\n", drvname, rc);
 		return rc;
 	}
@@ -351,5 +350,5 @@
 	rc = devman_driver_unload(drvh);
 	if (rc != EOK) {
-		printf("Failed unloading driver '%s': %s.\n", drvname, str_error(rc));
+		printf("Failed unloading driver '%s' (%d).\n", drvname, rc);
 		return rc;
 	}
@@ -372,5 +371,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	if (argc == 1 || argv[1][0] == '-') {
Index: uspace/app/df/df.c
===================================================================
--- uspace/app/df/df.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/df/df.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,7 +56,7 @@
 static bool display_blocks;
 
-static errno_t size_to_human_readable(uint64_t, size_t, char **);
+static int size_to_human_readable(uint64_t, size_t, char **);
 static void print_header(void);
-static errno_t print_statfs(vfs_statfs_t *, char *, char *);
+static int print_statfs(struct statfs *, char *, char *);
 static void print_usage(void);
 
@@ -64,6 +64,6 @@
 {
 	int optres, errflg = 0;
-	vfs_statfs_t st;
-	errno_t rc;
+	struct statfs st;
+	int rc;
 
 	display_blocks = false;
@@ -128,5 +128,5 @@
 }
 
-static errno_t size_to_human_readable(uint64_t nblocks, size_t block_size, char **rptr)
+static int size_to_human_readable(uint64_t nblocks, size_t block_size, char **rptr)
 {
 	cap_spec_t cap;
@@ -147,10 +147,10 @@
 }
 
-static errno_t print_statfs(vfs_statfs_t *st, char *name, char *mountpoint)
+static int print_statfs(struct statfs *st, char *name, char *mountpoint)
 {
 	uint64_t const used_blocks = st->f_blocks - st->f_bfree;
 	unsigned const perc_used = PERCENTAGE(used_blocks, st->f_blocks);
 	char *str;
-	errno_t rc;
+	int rc;
 
 	printf("%10s", name);
Index: uspace/app/dltest/dltest.c
===================================================================
--- uspace/app/dltest/dltest.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/dltest/dltest.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 
 /** libdltest library handle */
Index: uspace/app/dnscfg/dnscfg.c
===================================================================
--- uspace/app/dnscfg/dnscfg.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/dnscfg/dnscfg.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,4 @@
 #include <stdlib.h>
 #include <stdint.h>
-#include <str.h>
 #include <str_error.h>
 
@@ -56,5 +55,5 @@
 }
 
-static errno_t dnscfg_set_ns(int argc, char *argv[])
+static int dnscfg_set_ns(int argc, char *argv[])
 {
 	if (argc < 1) {
@@ -73,5 +72,5 @@
 	
 	inet_addr_t addr;
-	errno_t rc = inet_addr_parse(srv_addr, &addr, NULL);
+	int rc = inet_addr_parse(srv_addr, &addr, NULL);
 	
 	if (rc != EOK) {
@@ -90,10 +89,10 @@
 }
 
-static errno_t dnscfg_unset_ns(void)
+static int dnscfg_unset_ns(void)
 {
 	inet_addr_t addr;
 	inet_addr_any(&addr);
 	
-	errno_t rc = dnsr_set_srvaddr(&addr);
+	int rc = dnsr_set_srvaddr(&addr);
 	if (rc != EOK) {
 		printf("%s: Failed unsetting server address (%s)\n",
@@ -105,8 +104,8 @@
 }
 
-static errno_t dnscfg_print(void)
+static int dnscfg_print(void)
 {
 	inet_addr_t addr;
-	errno_t rc = dnsr_get_srvaddr(&addr);
+	int rc = dnsr_get_srvaddr(&addr);
 	if (rc != EOK) {
 		printf("%s: Failed getting DNS server address.\n", NAME);
Index: uspace/app/dnsres/dnsres.c
===================================================================
--- uspace/app/dnsres/dnsres.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/dnsres/dnsres.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 
 #define NAME  "dnsres"
@@ -79,5 +78,5 @@
 	
 	dnsr_hostinfo_t *hinfo;
-	errno_t rc = dnsr_name2host(hname, &hinfo, ver);
+	int rc = dnsr_name2host(hname, &hinfo, ver);
 	if (rc != EOK) {
 		printf("%s: Error resolving '%s'.\n", NAME, hname);
Index: uspace/app/download/main.c
===================================================================
--- uspace/app/download/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/download/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -73,6 +73,5 @@
 	uri_t *uri = NULL;
 	http_t *http = NULL;
-	errno_t rc;
-	int ret;
+	int rc;
 
 	if (argc < 2) {
@@ -156,6 +155,6 @@
 		}
 	} else {
-		ret = asprintf(&server_path, "%s?%s", path, uri->query);
-		if (ret < 0) {
+		rc = asprintf(&server_path, "%s?%s", path, uri->query);
+		if (rc < 0) {
 			fprintf(stderr, "Failed allocating path\n");
 			rc = ENOMEM;
@@ -230,6 +229,6 @@
 		}
 		
-		if (rc != EOK) {
-			fprintf(stderr, "Failed receiving body: %s", str_error(rc));
+		if (body_size != 0) {
+			fprintf(stderr, "Failed receiving body: %s", str_error(body_size));
 		}
 	}
Index: uspace/app/edit/edit.c
===================================================================
--- uspace/app/edit/edit.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/edit/edit.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -132,8 +132,8 @@
 static void pos_handle(pos_event_t *ev);
 
-static errno_t file_save(char const *fname);
+static int file_save(char const *fname);
 static void file_save_as(void);
-static errno_t file_insert(char *fname);
-static errno_t file_save_range(char const *fname, spt_t const *spos,
+static int file_insert(char *fname);
+static int file_save_range(char const *fname, spt_t const *spos,
     spt_t const *epos);
 static char *range_get_str(spt_t const *spos, spt_t const *epos);
@@ -191,5 +191,5 @@
 	cons_event_t ev;
 	bool new_file;
-	errno_t rc;
+	int rc;
 
 	con = console_init(stdin, stdout);
@@ -578,8 +578,8 @@
 
 /** Save the document. */
-static errno_t file_save(char const *fname)
+static int file_save(char const *fname)
 {
 	spt_t sp, ep;
-	errno_t rc;
+	int rc;
 
 	status_display("Saving...");
@@ -616,5 +616,5 @@
 	}
 
-	errno_t rc = file_save(fname);
+	int rc = file_save(fname);
 	if (rc != EOK)
 		return;
@@ -697,5 +697,5 @@
  * of the caret.
  */
-static errno_t file_insert(char *fname)
+static int file_insert(char *fname)
 {
 	FILE *f;
@@ -735,5 +735,5 @@
 
 /** Save a range of text into a file. */
-static errno_t file_save_range(char const *fname, spt_t const *spos,
+static int file_save_range(char const *fname, spt_t const *spos,
     spt_t const *epos)
 {
@@ -761,5 +761,5 @@
 	} while (!spt_equal(&bep, epos));
 
-	if (fclose(f) < 0)
+	if (fclose(f) != EOK)
 		return EIO;
 
@@ -1283,5 +1283,5 @@
 
 /* Search operations */
-static errno_t search_spt_producer(void *data, wchar_t *ret)
+static int search_spt_producer(void *data, wchar_t *ret)
 {
 	assert(data != NULL);
@@ -1292,5 +1292,5 @@
 }
 
-static errno_t search_spt_reverse_producer(void *data, wchar_t *ret)
+static int search_spt_reverse_producer(void *data, wchar_t *ret)
 {
 	assert(data != NULL);
@@ -1301,5 +1301,5 @@
 }
 
-static errno_t search_spt_mark(void *data, void **mark)
+static int search_spt_mark(void *data, void **mark)
 {
 	assert(data != NULL);
@@ -1397,5 +1397,5 @@
 	
 	match_t match;
-	errno_t rc = search_next_match(search, &match);
+	int rc = search_next_match(search, &match);
 	if (rc != EOK) {
 		status_display("Failed searching.");
@@ -1515,5 +1515,5 @@
 	size_t off;
 	wchar_t c;
-	errno_t rc;
+	int rc;
 
 	rc = clipboard_get_str(&str);
Index: uspace/app/edit/search.c
===================================================================
--- uspace/app/edit/search.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/edit/search.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -105,10 +105,10 @@
 }
 
-errno_t search_next_match(search_t *s, match_t *match)
+int search_next_match(search_t *s, match_t *match)
 {
 	search_equals_fn eq = s->ops.equals;
 	
 	wchar_t cur_char;
-	errno_t rc = EOK;
+	int rc = EOK;
 	while ((rc = s->ops.producer(s->client_data, &cur_char)) == EOK && cur_char > 0) {
 		/* Deal with mismatches */
Index: uspace/app/edit/search.h
===================================================================
--- uspace/app/edit/search.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/edit/search.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,6 +43,6 @@
 typedef struct search search_t;
 typedef bool (*search_equals_fn)(const wchar_t, const wchar_t);
-typedef errno_t (*search_producer_fn)(void *, wchar_t *);
-typedef errno_t (*search_mark_fn)(void *, void **);
+typedef int (*search_producer_fn)(void *, wchar_t *);
+typedef int (*search_mark_fn)(void *, void **);
 typedef void (*search_mark_free_fn)(void *);
 
@@ -61,5 +61,5 @@
 extern bool char_exact_equals(const wchar_t, const wchar_t);
 extern search_t *search_init(const char *, void *, search_ops_t, bool);
-extern errno_t search_next_match(search_t *, match_t *);
+extern int search_next_match(search_t *, match_t *);
 extern void search_fini(search_t *);
 
Index: uspace/app/edit/search_impl.h
===================================================================
--- uspace/app/edit/search_impl.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/edit/search_impl.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 	/* Note: This structure is opaque for the user. */
 
-	wchar_t *pattern;
+	const wchar_t *pattern;
 	size_t pattern_length;
 	ssize_t *back_table;
Index: uspace/app/edit/sheet.c
===================================================================
--- uspace/app/edit/sheet.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/edit/sheet.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -67,5 +67,5 @@
 
 /** Initialize an empty sheet. */
-errno_t sheet_create(sheet_t **rsh)
+int sheet_create(sheet_t **rsh)
 {
 	sheet_t *sh;
@@ -95,5 +95,5 @@
  * @param str	The text to insert (printable characters, tabs, newlines).
  *
- * @return	EOK on success or an error code.
+ * @return	EOK on success or negative error code.
  *
  * @note	@a dir affects which way tags that were placed on @a pos will
@@ -101,5 +101,5 @@
  *		and vice versa.
  */
-errno_t sheet_insert(sheet_t *sh, spt_t *pos, enum dir_spec dir, char *str)
+int sheet_insert(sheet_t *sh, spt_t *pos, enum dir_spec dir, char *str)
 {
 	char *ipp;
@@ -145,7 +145,7 @@
  * @param epos	Ending point.
  *
- * @return	EOK on success or an error code.
+ * @return	EOK on success or negative error code.
  **/
-errno_t sheet_delete(sheet_t *sh, spt_t *spos, spt_t *epos)
+int sheet_delete(sheet_t *sh, spt_t *spos, spt_t *epos)
 {
 	char *spp;
Index: uspace/app/edit/sheet.h
===================================================================
--- uspace/app/edit/sheet.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/edit/sheet.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -90,7 +90,7 @@
 } tag_t;
 
-extern errno_t sheet_create(sheet_t **);
-extern errno_t sheet_insert(sheet_t *, spt_t *, enum dir_spec, char *);
-extern errno_t sheet_delete(sheet_t *, spt_t *, spt_t *);
+extern int sheet_create(sheet_t **);
+extern int sheet_insert(sheet_t *, spt_t *, enum dir_spec, char *);
+extern int sheet_delete(sheet_t *, spt_t *, spt_t *);
 extern void sheet_copy_out(sheet_t *, spt_t const *, spt_t const *, char *,
     size_t, spt_t *);
Index: uspace/app/fdisk/fdisk.c
===================================================================
--- uspace/app/fdisk/fdisk.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/fdisk/fdisk.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,4 @@
 #include <stdlib.h>
 #include <fdisk.h>
-#include <str.h>
 
 #define NO_LABEL_CAPTION "(No name)"
@@ -69,8 +68,8 @@
 } devac_t;
 
-static errno_t fdsk_pcnt_fs_format(vol_part_cnt_t pcnt, vol_fstype_t fstype,
+static int fdsk_pcnt_fs_format(vol_part_cnt_t pcnt, vol_fstype_t fstype,
     char **rstr)
 {
-	errno_t rc;
+	int rc;
 	char *s;
 
@@ -98,9 +97,9 @@
 
 /** Confirm user selection. */
-static errno_t fdsk_confirm(const char *msg, bool *rconfirm)
+static int fdsk_confirm(const char *msg, bool *rconfirm)
 {
 	tinput_t *tinput = NULL;
 	char *answer;
-	errno_t rc;
+	int rc;
 
 	tinput = tinput_new();
@@ -147,5 +146,5 @@
 
 /** Device selection */
-static errno_t fdsk_dev_sel_choice(service_id_t *rsvcid)
+static int fdsk_dev_sel_choice(service_id_t *rsvcid)
 {
 	fdisk_dev_list_t *devlist = NULL;
@@ -160,5 +159,5 @@
 	void *sel;
 	int ndevs;
-	errno_t rc;
+	int rc;
 
 	rc = nchoice_create(&choice);
@@ -211,6 +210,6 @@
 		}
 
-		int ret = asprintf(&dtext, "%s (%s)", svcname, scap);
-		if (ret < 0) {
+		rc = asprintf(&dtext, "%s (%s)", svcname, scap);
+		if (rc < 0) {
 			rc = ENOMEM;
 			printf("Out of memory.\n");
@@ -270,6 +269,4 @@
 	return EOK;
 error:
-	assert(rc != EOK);
-	*rsvcid = 0;
 	if (devlist != NULL)
 		fdisk_dev_list_free(devlist);
@@ -282,5 +279,5 @@
 }
 
-static errno_t fdsk_create_label(fdisk_dev_t *dev)
+static int fdsk_create_label(fdisk_dev_t *dev)
 {
 	nchoice_t *choice = NULL;
@@ -288,5 +285,5 @@
 	char *sltype = NULL;
 	int i;
-	errno_t rc;
+	int rc;
 
 	rc = nchoice_create(&choice);
@@ -342,8 +339,8 @@
 }
 
-static errno_t fdsk_delete_label(fdisk_dev_t *dev)
+static int fdsk_delete_label(fdisk_dev_t *dev)
 {
 	bool confirm;
-	errno_t rc;
+	int rc;
 
 	rc = fdsk_confirm("Warning. Any data on disk will be lost. "
@@ -366,8 +363,8 @@
 }
 
-static errno_t fdsk_erase_disk(fdisk_dev_t *dev)
+static int fdsk_erase_disk(fdisk_dev_t *dev)
 {
 	bool confirm;
-	errno_t rc;
+	int rc;
 
 	rc = fdsk_confirm("Warning. Any data on disk will be lost. "
@@ -390,5 +387,5 @@
 }
 
-static errno_t fdsk_select_fstype(vol_fstype_t *fstype)
+static int fdsk_select_fstype(vol_fstype_t *fstype)
 {
 	nchoice_t *choice = NULL;
@@ -396,5 +393,5 @@
 	char *sfstype;
 	int i;
-	errno_t rc;
+	int rc;
 
 	rc = nchoice_create(&choice);
@@ -445,7 +442,7 @@
 }
 
-static errno_t fdsk_create_part(fdisk_dev_t *dev, label_pkind_t pkind)
+static int fdsk_create_part(fdisk_dev_t *dev, label_pkind_t pkind)
 {
-	errno_t rc;
+	int rc;
 	fdisk_part_spec_t pspec;
 	cap_spec_t cap;
@@ -554,5 +551,5 @@
 }
 
-static errno_t fdsk_delete_part(fdisk_dev_t *dev)
+static int fdsk_delete_part(fdisk_dev_t *dev)
 {
 	nchoice_t *choice = NULL;
@@ -566,5 +563,5 @@
 	bool confirm;
 	void *sel;
-	errno_t rc;
+	int rc;
 
 	rc = nchoice_create(&choice);
@@ -616,7 +613,7 @@
 				label = "(No name)";
 
-			int ret = asprintf(&sdesc, "%s %s, %s, %s", label,
+			rc = asprintf(&sdesc, "%s %s, %s, %s", label,
 			    scap, spkind, sfstype);
-			if (ret < 0) {
+			if (rc < 0) {
 				rc = ENOMEM;
 				goto error;
@@ -624,6 +621,6 @@
 
 		} else {
-			int ret = asprintf(&sdesc, "%s, %s", scap, spkind);
-			if (ret < 0) {
+			rc = asprintf(&sdesc, "%s, %s", scap, spkind);
+			if (rc < 0) {
 				rc = ENOMEM;
 				goto error;
@@ -701,5 +698,5 @@
 
 /** Device menu */
-static errno_t fdsk_dev_menu(fdisk_dev_t *dev)
+static int fdsk_dev_menu(fdisk_dev_t *dev)
 {
 	nchoice_t *choice = NULL;
@@ -718,5 +715,5 @@
 	char *spkind;
 	const char *label;
-	errno_t rc;
+	int rc;
 	int npart;
 	void *sel;
@@ -1080,5 +1077,5 @@
 	service_id_t svcid;
 	fdisk_dev_t *dev;
-	errno_t rc;
+	int rc;
 
 	rc = fdisk_create(&fdisk);
Index: uspace/app/fontviewer/fontviewer.c
===================================================================
--- uspace/app/fontviewer/fontviewer.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/fontviewer/fontviewer.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,4 @@
 #include <stdlib.h>
 #include <stdbool.h>
-#include <str_error.h>
 #include <window.h>
 #include <canvas.h>
@@ -63,5 +62,5 @@
 char *font_path = NULL;
 
-static errno_t draw(void);
+static int draw(void);
 
 static void on_keyboard_event(widget_t *widget, void *data)
@@ -96,7 +95,7 @@
 	}
 	
-	errno_t rc = draw();
+	int rc = draw();
 	if (rc != EOK) {
-		printf("Failed drawing: %s.\n", str_error(rc));
+		printf("Failed drawing: %d.\n", rc);
 		exit(1);
 	}
@@ -104,5 +103,5 @@
 }
 
-static errno_t create_font(font_t **font, uint16_t points)
+static int create_font(font_t **font, uint16_t points)
 {
 	if (font_path == NULL) {
@@ -139,5 +138,5 @@
 
 static int text(drawctx_t *, font_t *, source_t *, surface_coord_t x,
-    surface_coord_t , const char *, ...) _HELENOS_PRINTF_ATTRIBUTE(6, 7);
+    surface_coord_t , const char *, ...) PRINTF_ATTRIBUTE(6, 7);
 static int text(drawctx_t *drawctx, font_t *font, source_t *source,
     surface_coord_t x, surface_coord_t y, const char *fmt, ...)
@@ -149,11 +148,12 @@
 	va_end(args);
 	
-	if (ret >= 0) {
-		drawctx_set_source(drawctx, source);
-		drawctx_set_font(drawctx, font);
-		drawctx_print(drawctx, str, x, y);
-
-		free(str);
-	}
+	if (ret <= 0)
+		return ret;
+	
+	drawctx_set_source(drawctx, source);
+	drawctx_set_font(drawctx, font);
+	drawctx_print(drawctx, str, x, y);
+	
+	free(str);
 	
 	return ret;
@@ -161,5 +161,5 @@
 
 
-static errno_t draw(void)
+static int draw(void)
 {
 	source_t background = rgb(255, 255, 255);
@@ -174,5 +174,5 @@
 	
 	font_t *font;
-	errno_t rc = create_font(&font, points);
+	int rc = create_font(&font, points);
 	if (rc != EOK) {
 		printf("Failed creating font\n");
@@ -274,7 +274,7 @@
 	height = WINDOW_HEIGHT;
 	
-	errno_t rc = draw();
+	int rc = draw();
 	if (rc != EOK) {
-		printf("Failed drawing: %s.\n", str_error(rc));
+		printf("Failed drawing: %d.\n", rc);
 		return 2;
 	}
Index: uspace/app/getterm/getterm.c
===================================================================
--- uspace/app/getterm/getterm.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/getterm/getterm.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,4 @@
 #include <loc.h>
 #include <vfs/vfs.h>
-#include <str.h>
 #include "version.h"
 #include "welcome.h"
@@ -66,16 +65,12 @@
 	*stream = NULL;
 	
-	int oldfd;
-	errno_t rc = vfs_lookup_open(path, WALK_REGULAR, mode, &oldfd);
-	if (rc != EOK)
+	int oldfd = vfs_lookup_open(path, WALK_REGULAR, mode);
+	if (oldfd < 0)
 		return;
 	
 	if (oldfd != fd) {
-		int newfd;
-		if (vfs_clone(oldfd, fd, false, &newfd) != EOK)
+		if (vfs_clone(oldfd, fd, false) != fd)
 			return;
 		
-		assert(newfd == fd);
-
 		if (vfs_put(oldfd))
 			return;
@@ -134,5 +129,5 @@
 		/* Wait for the terminal service to be ready */
 		service_id_t service_id;
-		errno_t rc = loc_service_get_id(term, &service_id, IPC_FLAG_BLOCKING);
+		int rc = loc_service_get_id(term, &service_id, IPC_FLAG_BLOCKING);
 		if (rc != EOK) {
 			printf("%s: Error waiting on %s (%s)\n", APP_NAME, term,
@@ -171,5 +166,5 @@
 	task_wait_t twait;
 	
-	errno_t rc = task_spawnv(&id, &twait, cmd, (const char * const *) args);
+	int rc = task_spawnv(&id, &twait, cmd, (const char * const *) args);
 	if (rc != EOK) {
 		printf("%s: Error spawning %s (%s)\n", APP_NAME, cmd,
Index: uspace/app/gunzip/gunzip.c
===================================================================
--- uspace/app/gunzip/gunzip.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/gunzip/gunzip.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 	void *data, *ddata;
 	size_t size, dsize;
@@ -58,5 +58,6 @@
 	}
 
-	if (fseek(f, 0, SEEK_END) < 0) {
+	rc = fseek(f, 0, SEEK_END);
+	if (rc != 0) {
 		printf("Error determining size of '%s'\n", argv[1]);
 		fclose(f);
@@ -71,5 +72,6 @@
 	}
 
-	if (fseek(f, 0, SEEK_SET) < 0) {
+	rc = fseek(f, 0, SEEK_SET);
+	if (rc != 0) {
 		printf ("Error rewinding '%s'\n", argv[1]);
 		fclose(f);
Index: uspace/app/inet/inet.c
===================================================================
--- uspace/app/inet/inet.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/inet/inet.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,4 @@
 #include <stdlib.h>
 #include <stdint.h>
-#include <str.h>
 #include <str_error.h>
 
@@ -61,5 +60,5 @@
 }
 
-static errno_t addr_create_static(int argc, char *argv[])
+static int addr_create_static(int argc, char *argv[])
 {
 	char *aobj_name;
@@ -70,5 +69,5 @@
 	sysarg_t link_id;
 	sysarg_t addr_id;
-	errno_t rc;
+	int rc;
 
 	if (argc < 3) {
@@ -90,5 +89,5 @@
 	rc = loc_service_get_id(link_name, &link_id, 0);
 	if (rc != EOK) {
-		printf(NAME ": Service '%s' not found: %s.\n", link_name, str_error(rc));
+		printf(NAME ": Service '%s' not found (%d).\n", link_name, rc);
 		return ENOENT;
 	}
@@ -111,5 +110,5 @@
 }
 
-static errno_t addr_delete(int argc, char *argv[])
+static int addr_delete(int argc, char *argv[])
 {
 	char *aobj_name;
@@ -117,5 +116,5 @@
 	sysarg_t link_id;
 	sysarg_t addr_id;
-	errno_t rc;
+	int rc;
 
 	if (argc < 2) {
@@ -136,6 +135,5 @@
 	rc = loc_service_get_id(link_name, &link_id, 0);
 	if (rc != EOK) {
-		printf(NAME ": Service '%s' not found: %s.\n", link_name,
-		    str_error(rc));
+		printf(NAME ": Service '%s' not found (%d).\n", link_name, rc);
 		return ENOENT;
 	}
@@ -143,6 +141,5 @@
 	rc = inetcfg_addr_get_id(aobj_name, link_id, &addr_id);
 	if (rc != EOK) {
-		printf(NAME ": Address '%s' not found: %s.\n", aobj_name,
-		    str_error(rc));
+		printf(NAME ": Address '%s' not found (%d).\n", aobj_name, rc);
 		return ENOENT;
 	}
@@ -150,6 +147,6 @@
 	rc = inetcfg_addr_delete(addr_id);
 	if (rc != EOK) {
-		printf(NAME ": Failed deleting address '%s': %s\n", aobj_name,
-		    str_error(rc));
+		printf(NAME ": Failed deleting address '%s' (%d)\n", aobj_name,
+		    rc);
 		return EIO;
 	}
@@ -158,5 +155,5 @@
 }
 
-static errno_t sroute_create(int argc, char *argv[])
+static int sroute_create(int argc, char *argv[])
 {
 	char *dest_str;
@@ -167,5 +164,5 @@
 	inet_addr_t router;
 	sysarg_t sroute_id;
-	errno_t rc;
+	int rc;
 
 	if (argc < 3) {
@@ -200,6 +197,6 @@
 	rc = inetcfg_sroute_create(route_name, &dest, &router, &sroute_id);
 	if (rc != EOK) {
-		printf(NAME ": Failed creating static route '%s': %s\n",
-		    route_name, str_error(rc));
+		printf(NAME ": Failed creating static route '%s' (%d)\n",
+		    route_name, rc);
 		return EIO;
 	}
@@ -208,9 +205,9 @@
 }
 
-static errno_t sroute_delete(int argc, char *argv[])
+static int sroute_delete(int argc, char *argv[])
 {
 	char *route_name;
 	sysarg_t sroute_id;
-	errno_t rc;
+	int rc;
 
 	if (argc < 1) {
@@ -230,6 +227,6 @@
 	rc = inetcfg_sroute_get_id(route_name, &sroute_id);
 	if (rc != EOK) {
-		printf(NAME ": Static route '%s' not found: %s.\n",
-		    route_name, str_error(rc));
+		printf(NAME ": Static route '%s' not found (%d).\n",
+		    route_name, rc);
 		return ENOENT;
 	}
@@ -237,6 +234,6 @@
 	rc = inetcfg_sroute_delete(sroute_id);
 	if (rc != EOK) {
-		printf(NAME ": Failed deleting static route '%s': %s\n",
-		    route_name, str_error(rc));
+		printf(NAME ": Failed deleting static route '%s' (%d)\n",
+		    route_name, rc);
 		return EIO;
 	}
@@ -245,5 +242,5 @@
 }
 
-static errno_t addr_list(void)
+static int addr_list(void)
 {
 	sysarg_t *addr_list;
@@ -254,5 +251,5 @@
 	size_t count;
 	size_t i;
-	errno_t rc;
+	int rc;
 	char *astr = NULL;
 
@@ -335,5 +332,5 @@
 }
 
-static errno_t link_list(void)
+static int link_list(void)
 {
 	sysarg_t *link_list = NULL;
@@ -343,5 +340,5 @@
 	size_t count;
 	size_t i;
-	errno_t rc;
+	int rc;
 
 	rc = inetcfg_get_link_list(&link_list, &count);
@@ -396,5 +393,5 @@
 }
 
-static errno_t sroute_list(void)
+static int sroute_list(void)
 {
 	sysarg_t *sroute_list = NULL;
@@ -404,5 +401,5 @@
 	size_t count;
 	size_t i;
-	errno_t rc;
+	int rc;
 	char *dest_str = NULL;
 	char *router_str = NULL;
@@ -485,10 +482,10 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	rc = inetcfg_init();
 	if (rc != EOK) {
-		printf(NAME ": Failed connecting to internet service: %s.\n",
-		    str_error(rc));
+		printf(NAME ": Failed connecting to internet service (%d).\n",
+		    rc);
 		return 1;
 	}
Index: uspace/app/init/init.c
===================================================================
--- uspace/app/init/init.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/init/init.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -79,5 +79,5 @@
 /** Report mount operation success */
 static bool mount_report(const char *desc, const char *mntpt,
-    const char *fstype, const char *dev, errno_t rc)
+    const char *fstype, const char *dev, int rc)
 {
 	switch (rc) {
@@ -125,5 +125,5 @@
 		opts = "restore";
 	
-	errno_t rc = vfs_mount_path(ROOT_MOUNT_POINT, fstype, ROOT_DEVICE, opts,
+	int rc = vfs_mount_path(ROOT_MOUNT_POINT, fstype, ROOT_DEVICE, opts,
 	    IPC_FLAG_BLOCKING, 0);
 	if (rc == EOK)
@@ -144,5 +144,5 @@
 static bool mount_locfs(void)
 {
-	errno_t rc = vfs_mount_path(LOCFS_MOUNT_POINT, LOCFS_FS_TYPE, "", "",
+	int rc = vfs_mount_path(LOCFS_MOUNT_POINT, LOCFS_FS_TYPE, "", "",
 	    IPC_FLAG_BLOCKING, 0);
 	return mount_report("Location service filesystem", LOCFS_MOUNT_POINT,
@@ -150,7 +150,7 @@
 }
 
-static errno_t srv_startl(const char *path, ...)
-{
-	vfs_stat_t s;
+static int srv_startl(const char *path, ...)
+{
+	struct stat s;
 	if (vfs_stat_path(path, &s) != EOK) {
 		printf("%s: Unable to stat %s\n", NAME, path);
@@ -174,5 +174,5 @@
 	task_id_t id;
 	task_wait_t wait;
-	errno_t rc = task_spawn(&id, &wait, path, cnt, ap);
+	int rc = task_spawn(&id, &wait, path, cnt, ap);
 	va_end(ap);
 	
@@ -208,12 +208,12 @@
 		    path, retval);
 	
-	return retval == 0 ? EOK : EPARTY;
-}
-
-static errno_t console(const char *isvc, const char *osvc)
+	return retval;
+}
+
+static int console(const char *isvc, const char *osvc)
 {
 	/* Wait for the input service to be ready */
 	service_id_t service_id;
-	errno_t rc = loc_service_get_id(isvc, &service_id, IPC_FLAG_BLOCKING);
+	int rc = loc_service_get_id(isvc, &service_id, IPC_FLAG_BLOCKING);
 	if (rc != EOK) {
 		printf("%s: Error waiting on %s (%s)\n", NAME, isvc,
@@ -233,9 +233,9 @@
 }
 
-static errno_t compositor(const char *isvc, const char *name)
+static int compositor(const char *isvc, const char *name)
 {
 	/* Wait for the input service to be ready */
 	service_id_t service_id;
-	errno_t rc = loc_service_get_id(isvc, &service_id, IPC_FLAG_BLOCKING);
+	int rc = loc_service_get_id(isvc, &service_id, IPC_FLAG_BLOCKING);
 	if (rc != EOK) {
 		printf("%s: Error waiting on %s (%s)\n", NAME, isvc,
@@ -256,5 +256,5 @@
 	task_id_t id;
 	task_wait_t wait;
-	errno_t rc = task_spawnl(&id, &wait, app, app, winreg, NULL);
+	int rc = task_spawnl(&id, &wait, app, app, winreg, NULL);
 	if (rc != EOK) {
 		printf("%s: Error spawning %s %s (%s)\n", NAME, app,
@@ -281,5 +281,5 @@
 		    APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
 		
-		errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc,
+		int rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc,
 		    LOCFS_MOUNT_POINT, "--msg", "--wait", "--", app, NULL);
 		if (rc != EOK)
@@ -290,5 +290,5 @@
 		    APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
 		
-		errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc,
+		int rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc,
 		    LOCFS_MOUNT_POINT, "--wait", "--", app, NULL);
 		if (rc != EOK)
@@ -300,5 +300,5 @@
 static bool mount_tmpfs(void)
 {
-	errno_t rc = vfs_mount_path(TMPFS_MOUNT_POINT, TMPFS_FS_TYPE, "", "", 0, 0);
+	int rc = vfs_mount_path(TMPFS_MOUNT_POINT, TMPFS_FS_TYPE, "", "", 0, 0);
 	return mount_report("Temporary filesystem", TMPFS_MOUNT_POINT,
 	    TMPFS_FS_TYPE, NULL, rc);
@@ -307,5 +307,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	info_print();
Index: uspace/app/kill/kill.c
===================================================================
--- uspace/app/kill/kill.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/kill/kill.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <stdio.h>
 #include <task.h>
-#include <str.h>
 #include <str_error.h>
 
@@ -51,5 +50,5 @@
 	char *eptr;
 	task_id_t taskid;
-	errno_t rc;
+	int rc;
 
 	if (argc != 2) {
Index: uspace/app/killall/killall.c
===================================================================
--- uspace/app/killall/killall.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/killall/killall.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,4 @@
 #include <str_error.h>
 #include <stdlib.h>
-#include <str.h>
 
 #define NAME  "killall"
@@ -68,5 +67,5 @@
 		if (str_cmp(stats_tasks[i].name, argv[1]) == 0) {
 			task_id_t taskid = stats_tasks[i].task_id;
-			errno_t rc = task_kill(taskid);
+			int rc = task_kill(taskid);
 			if (rc != EOK)
 				printf("Failed to kill task ID %" PRIu64 ": %s\n",
Index: uspace/app/kio/kio.c
===================================================================
--- uspace/app/kio/kio.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/kio/kio.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -110,5 +110,5 @@
  *
  */
-static errno_t consumer(void *data)
+static int consumer(void *data)
 {
 	FILE *log = fopen(LOG_FNAME, "a");
@@ -187,5 +187,5 @@
 {
 	size_t pages;
-	errno_t rc = sysinfo_get_value("kio.pages", &pages);
+	int rc = sysinfo_get_value("kio.pages", &pages);
 	if (rc != EOK) {
 		fprintf(stderr, "%s: Unable to get number of kio pages\n",
Index: uspace/app/loc/loc.c
===================================================================
--- uspace/app/loc/loc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/loc/loc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 #define NAME "loc"
 
-static errno_t show_cat(const char *cat_name, category_id_t cat_id)
+static int show_cat(const char *cat_name, category_id_t cat_id)
 {
 	service_id_t *svc_ids;
@@ -49,5 +49,5 @@
 	char *svc_name;
 	char *server_name;
-	errno_t rc;
+	int rc;
 	size_t j;
 
@@ -90,5 +90,5 @@
 }
 
-static errno_t list_svcs_by_cat(void)
+static int list_svcs_by_cat(void)
 {
 	category_id_t *cat_ids;
@@ -97,5 +97,5 @@
 	size_t i;
 	char *cat_name;
-	errno_t rc;
+	int rc;
 
 	rc = loc_get_categories(&cat_ids, &cat_cnt);
@@ -136,5 +136,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 	char *cmd;
 	char *cat_name;
Index: uspace/app/logset/main.c
===================================================================
--- uspace/app/logset/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/logset/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 {
 	log_level_t result;
-	errno_t rc = log_level_from_str(log_level, &result);
+	int rc = log_level_from_str(log_level, &result);
 	if (rc != EOK) {
 		fprintf(stderr, "Unrecognised log level '%s': %s.\n",
@@ -62,5 +62,5 @@
 	if (argc == 2) {
 		log_level_t new_default_level = parse_log_level_or_die(argv[1]);
-		errno_t rc = logctl_set_default_level(new_default_level);
+		int rc = logctl_set_default_level(new_default_level);
 
 		if (rc != EOK) {
@@ -72,5 +72,5 @@
 		log_level_t new_level = parse_log_level_or_die(argv[2]);
 		const char *logname = argv[1];
-		errno_t rc = logctl_set_log_level(logname, new_level);
+		int rc = logctl_set_log_level(logname, new_level);
 
 		if (rc != EOK) {
Index: uspace/app/mixerctl/mixerctl.c
===================================================================
--- uspace/app/mixerctl/mixerctl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/mixerctl/mixerctl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,7 +49,7 @@
 static void print_levels(async_exch_t *exch)
 {
-	char* name = NULL;
+	const char* name = NULL;
 	unsigned count = 0;
-	errno_t ret = audio_mixer_get_info(exch, &name, &count);
+	int ret = audio_mixer_get_info(exch, &name, &count);
 	if (ret != EOK) {
 		printf("Failed to get mixer info: %s.\n", str_error(ret));
@@ -59,7 +59,7 @@
 
 	for (unsigned i = 0; i < count; ++i) {
-		char *name = NULL;
+		const char *name = NULL;
 		unsigned levels = 0, current = 0;
-		errno_t ret =
+		int ret =
 		    audio_mixer_get_item_info(exch, i, &name, &levels);
 		if (ret != EOK) {
@@ -99,5 +99,5 @@
 	const unsigned item = get_number(argv[params++]);
 	const unsigned value = get_number(argv[params]);
-	errno_t ret = audio_mixer_set_item_level(exch, item, value);
+	int ret = audio_mixer_set_item_level(exch, item, value);
 	if (ret != EOK) {
 		printf("Failed to set item level: %s.\n", str_error(ret));
@@ -118,5 +118,5 @@
 	unsigned value = 0;
 
-	errno_t ret = audio_mixer_get_item_level(exch, item, &value);
+	int ret = audio_mixer_get_item_level(exch, item, &value);
 	if (ret != EOK) {
 		printf("Failed to get item level: %s.\n", str_error(ret));
@@ -148,5 +148,5 @@
 
 	service_id_t mixer_sid;
-	errno_t rc = loc_service_get_id(service, &mixer_sid, 0);
+	int rc = loc_service_get_id(service, &mixer_sid, 0);
 	if (rc != EOK) {
 		printf("Failed to resolve service '%s': %s.\n",
Index: uspace/app/mkbd/main.c
===================================================================
--- uspace/app/mkbd/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/mkbd/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,5 +60,5 @@
 static async_sess_t *dev_sess = NULL;
 
-static errno_t initialize_report_parser(async_sess_t *dev_sess,
+static int initialize_report_parser(async_sess_t *dev_sess,
     usb_hid_report_t **report)
 {
@@ -67,5 +67,5 @@
 		return ENOMEM;
 	
-	errno_t rc = usb_hid_report_init(*report);
+	int rc = usb_hid_report_init(*report);
 	if (rc != EOK) {
 		usb_hid_report_deinit(*report);
@@ -131,5 +131,5 @@
 	
 	uint8_t report_id;
-	errno_t rc = usb_hid_parse_report(report, buffer, size, &report_id);
+	int rc = usb_hid_parse_report(report, buffer, size, &report_id);
 	if (rc != EOK)
 		return;
@@ -165,5 +165,5 @@
 }
 
-static errno_t wait_for_quit_fibril(void *arg)
+static int wait_for_quit_fibril(void *arg)
 {
 	console_ctrl_t *con = console_init(stdin, stdout);
@@ -218,5 +218,5 @@
 	devman_handle_t dev_handle = 0;
 	
-	errno_t rc = usb_resolve_device_handle(devpath, &dev_handle);
+	int rc = usb_resolve_device_handle(devpath, &dev_handle);
 	if (rc != EOK) {
 		printf("Device not found or not of USB kind: %s.\n",
@@ -237,6 +237,4 @@
 	rc = devman_fun_get_path(dev_handle, path, MAX_PATH_LENGTH);
 	if (rc != EOK) {
-		printf(NAME ": failed to get path (handle %"
-		       PRIun "): %s.\n", dev_handle, str_error(errno));
 		return ENOMEM;
 	}
@@ -264,5 +262,4 @@
 	uint8_t *event = (uint8_t *)malloc(size);
 	if (event == NULL) {
-		printf("Out of memory.\n");
 		// TODO: hangup phone?
 		return ENOMEM;
Index: uspace/app/mkexfat/mkexfat.c
===================================================================
--- uspace/app/mkexfat/mkexfat.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/mkexfat/mkexfat.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -112,9 +112,9 @@
 vbr_checksum_update(void const *octets, size_t nbytes, uint32_t *checksum);
 
-static errno_t
+static int
 ebs_write(service_id_t service_id, exfat_cfg_t *cfg,
     int base, uint32_t *chksum);
 
-static errno_t
+static int
 bitmap_write(service_id_t service_id, exfat_cfg_t *cfg);
 
@@ -284,5 +284,5 @@
 }
 
-static errno_t
+static int
 bootsec_write(service_id_t service_id, exfat_cfg_t *cfg)
 {
@@ -290,5 +290,5 @@
 	uint32_t vbr_checksum;
 	uint32_t *chksum_sector;
-	errno_t rc;
+	int rc;
 	unsigned idx;
 
@@ -344,13 +344,12 @@
  * @param cfg  Pointer to the exFAT configuration structure.
  * @param base Base sector of the EBS.
- * @return  EOK on success or an error code.
- */
-static errno_t
+ * @return  EOK on success or a negative error code.
+ */
+static int
 ebs_write(service_id_t service_id, exfat_cfg_t *cfg, int base,
     uint32_t *chksum)
 {
 	uint32_t *ebs = calloc(cfg->sector_size, sizeof(uint8_t));
-	int i;
-	errno_t rc;
+	int i, rc;
 
 	if (!ebs)
@@ -397,12 +396,12 @@
  * @param service_id  The service id.
  * @param cfg Pointer to the exfat_cfg structure.
- * @return EOK on success or an error code.
- */
-static errno_t
+ * @return EOK on success or a negative error code.
+ */
+static int
 fat_initialize(service_id_t service_id, exfat_cfg_t *cfg)
 {
 	unsigned long i;
 	uint32_t *pfat;
-	errno_t rc;
+	int rc;
 
 	pfat = calloc(cfg->sector_size, 1);
@@ -437,11 +436,11 @@
  * @param cur_cls  Cluster index from where to start the allocation.
  * @param ncls  Number of clusters to allocate.
- * @return EOK on success or an error code.
- */
-static errno_t
+ * @return EOK on success or a negative error code.
+ */
+static int
 fat_allocate_clusters(service_id_t service_id, exfat_cfg_t *cfg,
     uint32_t cur_cls, unsigned long ncls)
 {
-	errno_t rc;
+	int rc;
 	unsigned const fat_entries = cfg->sector_size / sizeof(uint32_t);
 	aoff64_t fat_sec = cur_cls / fat_entries + FAT_SECTOR_START;
@@ -494,12 +493,12 @@
  * @param service_id   The service id.
  * @param cfg  Pointer to the exfat configuration structure.
- * @return  EOK on success or an error code.
- */
-static errno_t
+ * @return  EOK on success or a negative error code.
+ */
+static int
 bitmap_write(service_id_t service_id, exfat_cfg_t *cfg)
 {
 	unsigned long i, sec;
 	unsigned long allocated_cls;
-	errno_t rc = EOK;
+	int rc = EOK;
 	bool need_reset = true;
 
@@ -544,8 +543,8 @@
 
 /** Write the upcase table to disk. */
-static errno_t
+static int
 upcase_table_write(service_id_t service_id, exfat_cfg_t *cfg)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	aoff64_t start_sec, nsecs, i;
 	uint8_t *table_ptr;
@@ -593,7 +592,7 @@
  * @param service_id   The service id.
  * @param cfg   Pointer to the exFAT configuration structure.
- * @return   EOK on success or an error code.
- */
-static errno_t
+ * @return   EOK on success or a negative error code.
+ */
+static int
 root_dentries_write(service_id_t service_id, exfat_cfg_t *cfg)
 {
@@ -601,5 +600,5 @@
 	aoff64_t rootdir_sec;
 	uint16_t wlabel[EXFAT_VOLLABEL_LEN + 1];
-	errno_t rc;
+	int rc;
 	uint8_t *data;
 	unsigned long i;
@@ -758,6 +757,5 @@
 	char *dev_path;
 	service_id_t service_id;
-	errno_t rc;
-	int c, opt_ind;
+	int rc, c, opt_ind;
 	aoff64_t user_fs_size = 0;
 
Index: uspace/app/mkfat/mkfat.c
===================================================================
--- uspace/app/mkfat/mkfat.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/mkfat/mkfat.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,5 +48,4 @@
 #include <inttypes.h>
 #include <errno.h>
-#include <str.h>
 #include "fat.h"
 #include "fat_dentry.h"
@@ -87,6 +86,6 @@
 static void syntax_print(void);
 
-static errno_t fat_params_compute(struct fat_cfg *cfg);
-static errno_t fat_blocks_write(struct fat_cfg const *cfg, service_id_t service_id);
+static int fat_params_compute(struct fat_cfg *cfg);
+static int fat_blocks_write(struct fat_cfg const *cfg, service_id_t service_id);
 static void fat_bootsec_create(struct fat_cfg const *cfg, struct fat_bs *bs);
 
@@ -95,5 +94,5 @@
 	struct fat_cfg cfg;
 
-	errno_t rc;
+	int rc;
 	char *dev_path;
 	service_id_t service_id;
@@ -253,5 +252,5 @@
 }
 
-static errno_t fat_label_encode(void *dest, const char *src)
+static int fat_label_encode(void *dest, const char *src)
 {
 	int i;
@@ -285,5 +284,5 @@
  * file system params.
  */
-static errno_t fat_params_compute(struct fat_cfg *cfg)
+static int fat_params_compute(struct fat_cfg *cfg)
 {
 	uint32_t fat_bytes;
@@ -357,5 +356,5 @@
 
 /** Create file system with the given parameters. */
-static errno_t fat_blocks_write(struct fat_cfg const *cfg, service_id_t service_id)
+static int fat_blocks_write(struct fat_cfg const *cfg, service_id_t service_id)
 {
 	aoff64_t addr;
@@ -363,5 +362,5 @@
 	int i;
 	uint32_t j;
-	errno_t rc;
+	int rc;
 	struct fat_bs bs;
 	fat_dentry_t *de;
Index: uspace/app/mkmfs/mkmfs.c
===================================================================
--- uspace/app/mkmfs/mkmfs.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/mkmfs/mkmfs.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -82,15 +82,15 @@
 static void	help_cmd_mkmfs(help_level_t level);
 static bool	is_power_of_two(uint32_t n);
-static errno_t	init_superblock(struct mfs_sb_info *sb);
-static errno_t	write_superblock(const struct mfs_sb_info *sbi);
-static errno_t	write_superblock3(const struct mfs_sb_info *sbi);
-static errno_t	init_bitmaps(const struct mfs_sb_info *sb);
-static errno_t	init_inode_table(const struct mfs_sb_info *sb);
-static errno_t	make_root_ino(const struct mfs_sb_info *sb);
-static errno_t	make_root_ino2(const struct mfs_sb_info *sb);
+static int	init_superblock(struct mfs_sb_info *sb);
+static int	write_superblock(const struct mfs_sb_info *sbi);
+static int	write_superblock3(const struct mfs_sb_info *sbi);
+static int	init_bitmaps(const struct mfs_sb_info *sb);
+static int	init_inode_table(const struct mfs_sb_info *sb);
+static int	make_root_ino(const struct mfs_sb_info *sb);
+static int	make_root_ino2(const struct mfs_sb_info *sb);
 static void	mark_bmap(uint32_t *bmap, int idx, int v);
-static errno_t	insert_dentries(const struct mfs_sb_info *sb);
-
-static inline errno_t write_block(aoff64_t off, size_t size, const void *data);
+static int	insert_dentries(const struct mfs_sb_info *sb);
+
+static inline int write_block(aoff64_t off, size_t size, const void *data);
 
 static service_id_t service_id;
@@ -109,6 +109,5 @@
 int main (int argc, char **argv)
 {
-	errno_t rc;
-	int c, opt_ind;
+	int rc, c, opt_ind;
 	char *device_name;
 	size_t devblock_size;
@@ -290,11 +289,11 @@
  * @param sb		Pointer to the superblock structure.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t insert_dentries(const struct mfs_sb_info *sb)
+ * @return		EOK on success or a negative error code.
+ */
+static int insert_dentries(const struct mfs_sb_info *sb)
 {
 	void *root_block;
 	uint8_t *dentry_ptr;
-	errno_t rc;
+	int rc;
 	const long root_dblock = sb->first_data_zone;
 
@@ -343,11 +342,11 @@
  * @param sb		Pointer to the superblock structure.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t init_inode_table(const struct mfs_sb_info *sb)
+ * @return		EOK on success or a negative error code.
+ */
+static int init_inode_table(const struct mfs_sb_info *sb)
 {
 	unsigned int i;
 	uint8_t *itable_buf;
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	long itable_off = sb->zbmap_blocks + sb->ibmap_blocks + 2;
@@ -376,10 +375,10 @@
  * @param sb		Ponter to the superblock structure.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t make_root_ino(const struct mfs_sb_info *sb)
+ * @return		EOK on success or a negative error code.
+ */
+static int make_root_ino(const struct mfs_sb_info *sb)
 {
 	struct mfs_inode *ino_buf;
-	errno_t rc;
+	int rc;
 
 	const long itable_off = sb->zbmap_blocks + sb->ibmap_blocks + 2;
@@ -413,10 +412,10 @@
  * @param sb		Pointer to the superblock structure.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t make_root_ino2(const struct mfs_sb_info *sb)
+ * @return		EOK on success or a negative error code.
+ */
+static int make_root_ino2(const struct mfs_sb_info *sb)
 {
 	struct mfs2_inode *ino_buf;
-	errno_t rc;
+	int rc;
 
 	/* Compute offset of the first inode table block */
@@ -452,7 +451,7 @@
  * @param sb		Pointer to the superblock structure.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t init_superblock(struct mfs_sb_info *sb)
+ * @return		EOK on success or a negative error code.
+ */
+static int init_superblock(struct mfs_sb_info *sb)
 {
 	aoff64_t inodes;
@@ -460,5 +459,5 @@
 	unsigned long ind2;
 	unsigned long zones;
-	errno_t rc;
+	int rc;
 
 	if (sb->longnames)
@@ -559,10 +558,10 @@
  * @param sbi		Pointer to the superblock structure to write on disk.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t write_superblock(const struct mfs_sb_info *sbi)
+ * @return		EOK on success or a negative error code.
+ */
+static int write_superblock(const struct mfs_sb_info *sbi)
 {
 	struct mfs_superblock *sb;
-	errno_t rc;
+	int rc;
 
 	sb = malloc(MFS_SUPERBLOCK_SIZE);;
@@ -592,10 +591,10 @@
  * @param sbi		Pointer to the superblock structure to write on disk.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t write_superblock3(const struct mfs_sb_info *sbi)
+ * @return		EOK on success or a negative error code.
+ */
+static int write_superblock3(const struct mfs_sb_info *sbi)
 {
 	struct mfs3_superblock *sb;
-	errno_t rc;
+	int rc;
 
 	sb = malloc(MFS_SUPERBLOCK_SIZE);
@@ -625,7 +624,7 @@
  * @param sb		Pointer to the superblock structure.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t init_bitmaps(const struct mfs_sb_info *sb)
+ * @return		EOK on success or a negative error code.
+ */
+static int init_bitmaps(const struct mfs_sb_info *sb)
 {
 	uint32_t *ibmap_buf, *zbmap_buf;
@@ -634,5 +633,5 @@
 	const unsigned int zbmap_nblocks = sb->zbmap_blocks;
 	unsigned int i;
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	ibmap_buf = malloc(ibmap_nblocks * sb->block_size);
@@ -699,10 +698,10 @@
  * @param data		Pointer to the block content.
  *
- * @return		EOK on success or a error number.
- */
-static inline errno_t write_block(aoff64_t off, size_t size, const void *data)
+ * @return		EOK on success or a negative error number.
+ */
+static inline int write_block(aoff64_t off, size_t size, const void *data)
 {
 	if (shift == 3) {
-		errno_t rc;
+		int rc;
 		aoff64_t tmp_off = off << 1;
 		uint8_t *data_ptr = (uint8_t *) data;
Index: uspace/app/modplay/modplay.c
===================================================================
--- uspace/app/modplay/modplay.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/modplay/modplay.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str_error.h>
 #include <trackmod.h>
 
@@ -79,5 +78,5 @@
 	void *buffer;
 	size_t buffer_size;
-	errno_t rc;
+	int rc;
 
 	if (argc != 2) {
@@ -118,5 +117,5 @@
 	rc = hound_context_connect_target(hound, HOUND_DEFAULT_TARGET);
 	if (rc != EOK) {
-		printf("Error connecting default audio target: %s.\n", str_error(rc));
+		printf("Error connecting default audio target (%d).\n", rc);
 		return 1;
 	}
Index: uspace/app/netecho/comm.c
===================================================================
--- uspace/app/netecho/comm.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/netecho/comm.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,4 @@
 #include <stdlib.h>
 #include <stdint.h>
-#include <str.h>
 #include <str_error.h>
 
@@ -72,5 +71,5 @@
 	size_t pos;
 	size_t now;
-	errno_t rc;
+	int rc;
 
 	size = udp_rmsg_size(rmsg);
@@ -110,8 +109,8 @@
 }
 
-errno_t comm_open_listen(const char *port_s)
+int comm_open_listen(const char *port_s)
 {
 	inet_ep2_t epp;
-	errno_t rc;
+	int rc;
 
 	char *endptr;
@@ -143,9 +142,9 @@
 }
 
-errno_t comm_open_talkto(const char *hostport)
+int comm_open_talkto(const char *hostport)
 {
 	inet_ep2_t epp;
 	const char *errmsg;
-	errno_t rc;
+	int rc;
 
 	inet_ep2_init(&epp);
@@ -183,7 +182,7 @@
 }
 
-errno_t comm_send(void *data, size_t size)
+int comm_send(void *data, size_t size)
 {
-	errno_t rc = udp_assoc_send_msg(assoc, &remote, data, size);
+	int rc = udp_assoc_send_msg(assoc, &remote, data, size);
 	if (rc != EOK)
 		return EIO;
Index: uspace/app/netecho/comm.h
===================================================================
--- uspace/app/netecho/comm.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/netecho/comm.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,8 +39,8 @@
 #include <stddef.h>
 
-extern errno_t comm_open_listen(const char *);
-extern errno_t comm_open_talkto(const char *);
+extern int comm_open_listen(const char *);
+extern int comm_open_talkto(const char *);
 extern void comm_close(void);
-extern errno_t comm_send(void *, size_t);
+extern int comm_send(void *, size_t);
 
 #endif
Index: uspace/app/netecho/netecho.c
===================================================================
--- uspace/app/netecho/netecho.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/netecho/netecho.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -75,5 +75,5 @@
 	char cbuf[STR_BOUNDS(1)];
 	size_t offs;
-	errno_t rc;
+	int rc;
 
 	offs = 0;
@@ -137,5 +137,5 @@
 static void netecho_send_messages(char **msgs)
 {
-	errno_t rc;
+	int rc;
 
 	while (*msgs != NULL) {
@@ -154,5 +154,5 @@
 	char *port;
 	char **msgs;
-	errno_t rc;
+	int rc;
 
 	if (argc < 2) {
Index: uspace/app/netstart/self_test.c
===================================================================
--- uspace/app/netstart/self_test.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/app/netstart/self_test.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,334 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup net
+ * @{
+ */
+
+/** @file
+ * Networking self-tests implementation.
+ *
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <net_checksum.h>
+#include <adt/int_map.h>
+#include <adt/char_map.h>
+#include <adt/generic_char_map.h>
+#include <adt/measured_strings.h>
+#include <adt/dynamic_fifo.h>
+
+#include "self_test.h"
+
+/** Test the statement, compare the result and evaluate.
+ *
+ * @param[in] statement The statement to test.
+ * @param[in] result    The expected result.
+ *
+ */
+#define TEST(statement, result) \
+	do { \
+		printf("\n\t%s == %s", #statement, #result); \
+		if ((statement) != (result)) { \
+			printf("\tfailed\n"); \
+			fprintf(stderr, "\nNetwork self-test failed\n"); \
+			return EINVAL; \
+		} else \
+			printf("\tOK"); \
+	} while (0)
+
+#define XMALLOC(var, type) \
+	do { \
+		(var) = (type *) malloc(sizeof(type)); \
+		if ((var) == NULL) { \
+			fprintf(stderr, "\nMemory allocation error\n"); \
+			return ENOMEM; \
+		} \
+	} while (0)
+
+GENERIC_CHAR_MAP_DECLARE(int_char_map, int);
+GENERIC_CHAR_MAP_IMPLEMENT(int_char_map, int);
+
+GENERIC_FIELD_DECLARE(int_field, int);
+GENERIC_FIELD_IMPLEMENT(int_field, int);
+
+INT_MAP_DECLARE(int_map, int);
+INT_MAP_IMPLEMENT(int_map, int);
+
+/** Self-test start function.
+ *
+ * Run all self-tests.
+ *
+ * @returns EOK on success.
+ * @returns The first error occurred.
+ *
+ */
+int self_test(void)
+{
+	printf("Running networking self-tests\n");
+	
+	printf("\nChar map test");
+	char_map_t cm;
+	
+	TEST(char_map_update(&cm, "ucho", 0, 3), EINVAL);
+	TEST(char_map_initialize(&cm), EOK);
+	TEST(char_map_exclude(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST(char_map_find(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST(char_map_add(&cm, "bla", 0, 1), EOK);
+	TEST(char_map_find(&cm, "bla", 0), 1);
+	TEST(char_map_add(&cm, "bla", 0, 10), EEXISTS);
+	TEST(char_map_update(&cm, "bla", 0, 2), EOK);
+	TEST(char_map_find(&cm, "bla", 0), 2);
+	TEST(char_map_update(&cm, "ucho", 0, 2), EOK);
+	TEST(char_map_exclude(&cm, "bla", 0), 2);
+	TEST(char_map_exclude(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST(char_map_find(&cm, "ucho", 0), 2);
+	TEST(char_map_update(&cm, "ucho", 0, 3), EOK);
+	TEST(char_map_find(&cm, "ucho", 0), 3);
+	TEST(char_map_add(&cm, "blabla", 0, 5), EOK);
+	TEST(char_map_find(&cm, "blabla", 0), 5);
+	TEST(char_map_add(&cm, "bla", 0, 6), EOK);
+	TEST(char_map_find(&cm, "bla", 0), 6);
+	TEST(char_map_exclude(&cm, "bla", 0), 6);
+	TEST(char_map_find(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST(char_map_find(&cm, "blabla", 0), 5);
+	TEST(char_map_add(&cm, "auto", 0, 7), EOK);
+	TEST(char_map_find(&cm, "auto", 0), 7);
+	TEST(char_map_add(&cm, "kara", 0, 8), EOK);
+	TEST(char_map_find(&cm, "kara", 0), 8);
+	TEST(char_map_add(&cm, "nic", 0, 9), EOK);
+	TEST(char_map_find(&cm, "nic", 0), 9);
+	TEST(char_map_find(&cm, "blabla", 0), 5);
+	TEST(char_map_add(&cm, "micnicnic", 5, 9), EOK);
+	TEST(char_map_find(&cm, "micni", 0), 9);
+	TEST(char_map_find(&cm, "micnicn", 5), 9);
+	TEST(char_map_add(&cm, "\x10\x0\x2\x2", 4, 15), EOK);
+	TEST(char_map_find(&cm, "\x10\x0\x2\x2", 4), 15);
+	
+	TEST((char_map_destroy(&cm), EOK), EOK);
+	TEST(char_map_update(&cm, "ucho", 0, 3), EINVAL);
+	
+	printf("\nCRC computation test");
+	uint32_t value;
+	
+	TEST(value = ~compute_crc32(~0, "123456789", 8 * 9), 0xcbf43926);
+	TEST(value = ~compute_crc32(~0, "1", 8), 0x83dcefb7);
+	TEST(value = ~compute_crc32(~0, "12", 8 * 2), 0x4f5344cd);
+	TEST(value = ~compute_crc32(~0, "123", 8 * 3), 0x884863d2);
+	TEST(value = ~compute_crc32(~0, "1234", 8 * 4), 0x9be3e0a3);
+	TEST(value = ~compute_crc32(~0, "12345678", 8 * 8), 0x9ae0daaf);
+	TEST(value = ~compute_crc32(~0, "ahoj pane", 8 * 9), 0x5fc3d706);
+	
+	printf("\nDynamic fifo test");
+	dyn_fifo_t fifo;
+	
+	TEST(dyn_fifo_push(&fifo, 1, 0), EINVAL);
+	TEST(dyn_fifo_initialize(&fifo, 1), EOK);
+	TEST(dyn_fifo_push(&fifo, 1, 0), EOK);
+	TEST(dyn_fifo_pop(&fifo), 1);
+	TEST(dyn_fifo_pop(&fifo), ENOENT);
+	TEST(dyn_fifo_push(&fifo, 2, 1), EOK);
+	TEST(dyn_fifo_push(&fifo, 3, 1), ENOMEM);
+	TEST(dyn_fifo_push(&fifo, 3, 0), EOK);
+	TEST(dyn_fifo_pop(&fifo), 2);
+	TEST(dyn_fifo_pop(&fifo), 3);
+	TEST(dyn_fifo_push(&fifo, 4, 2), EOK);
+	TEST(dyn_fifo_push(&fifo, 5, 2), EOK);
+	TEST(dyn_fifo_push(&fifo, 6, 2), ENOMEM);
+	TEST(dyn_fifo_push(&fifo, 6, 5), EOK);
+	TEST(dyn_fifo_push(&fifo, 7, 5), EOK);
+	TEST(dyn_fifo_pop(&fifo), 4);
+	TEST(dyn_fifo_pop(&fifo), 5);
+	TEST(dyn_fifo_push(&fifo, 8, 5), EOK);
+	TEST(dyn_fifo_push(&fifo, 9, 5), EOK);
+	TEST(dyn_fifo_push(&fifo, 10, 6), EOK);
+	TEST(dyn_fifo_push(&fifo, 11, 6), EOK);
+	TEST(dyn_fifo_pop(&fifo), 6);
+	TEST(dyn_fifo_pop(&fifo), 7);
+	TEST(dyn_fifo_push(&fifo, 12, 6), EOK);
+	TEST(dyn_fifo_push(&fifo, 13, 6), EOK);
+	TEST(dyn_fifo_push(&fifo, 14, 6), ENOMEM);
+	TEST(dyn_fifo_push(&fifo, 14, 8), EOK);
+	TEST(dyn_fifo_pop(&fifo), 8);
+	TEST(dyn_fifo_pop(&fifo), 9);
+	TEST(dyn_fifo_pop(&fifo), 10);
+	TEST(dyn_fifo_pop(&fifo), 11);
+	TEST(dyn_fifo_pop(&fifo), 12);
+	TEST(dyn_fifo_pop(&fifo), 13);
+	TEST(dyn_fifo_pop(&fifo), 14);
+	TEST(dyn_fifo_destroy(&fifo), EOK);
+	TEST(dyn_fifo_push(&fifo, 1, 0), EINVAL);
+	
+	printf("\nGeneric char map test");
+	
+	int *x;
+	int *y;
+	int *z;
+	int *u;
+	int *v;
+	int *w;
+	
+	XMALLOC(x, int);
+	XMALLOC(y, int);
+	XMALLOC(z, int);
+	XMALLOC(u, int);
+	XMALLOC(v, int);
+	XMALLOC(w, int);
+	
+	int_char_map_t icm;
+	icm.magic = 0;
+	
+	TEST(int_char_map_add(&icm, "ucho", 0, z), EINVAL);
+	TEST(int_char_map_initialize(&icm), EOK);
+	TEST((int_char_map_exclude(&icm, "bla", 0), EOK), EOK);
+	TEST(int_char_map_find(&icm, "bla", 0), NULL);
+	TEST(int_char_map_add(&icm, "bla", 0, x), EOK);
+	TEST(int_char_map_find(&icm, "bla", 0), x);
+	TEST(int_char_map_add(&icm, "bla", 0, y), EEXISTS);
+	TEST((int_char_map_exclude(&icm, "bla", 0), EOK), EOK);
+	TEST((int_char_map_exclude(&icm, "bla", 0), EOK), EOK);
+	TEST(int_char_map_add(&icm, "blabla", 0, v), EOK);
+	TEST(int_char_map_find(&icm, "blabla", 0), v);
+	TEST(int_char_map_add(&icm, "bla", 0, w), EOK);
+	TEST(int_char_map_find(&icm, "bla", 0), w);
+	TEST((int_char_map_exclude(&icm, "bla", 0), EOK), EOK);
+	TEST(int_char_map_find(&icm, "bla", 0), NULL);
+	TEST(int_char_map_find(&icm, "blabla", 0), v);
+	TEST(int_char_map_add(&icm, "auto", 0, u), EOK);
+	TEST(int_char_map_find(&icm, "auto", 0), u);
+	TEST((int_char_map_destroy(&icm), EOK), EOK);
+	TEST(int_char_map_add(&icm, "ucho", 0, z), EINVAL);
+	
+	printf("\nGeneric field test");
+	
+	XMALLOC(x, int);
+	XMALLOC(y, int);
+	XMALLOC(z, int);
+	XMALLOC(u, int);
+	XMALLOC(v, int);
+	XMALLOC(w, int);
+	
+	int_field_t gf;
+	gf.magic = 0;
+	
+	TEST(int_field_add(&gf, x), EINVAL);
+	TEST(int_field_count(&gf), -1);
+	TEST(int_field_initialize(&gf), EOK);
+	TEST(int_field_count(&gf), 0);
+	TEST(int_field_get_index(&gf, 1), NULL);
+	TEST(int_field_add(&gf, x), 0);
+	TEST(int_field_get_index(&gf, 0), x);
+	TEST((int_field_exclude_index(&gf, 0), EOK), EOK);
+	TEST(int_field_get_index(&gf, 0), NULL);
+	TEST(int_field_add(&gf, y), 1);
+	TEST(int_field_get_index(&gf, 1), y);
+	TEST(int_field_add(&gf, z), 2);
+	TEST(int_field_get_index(&gf, 2), z);
+	TEST(int_field_get_index(&gf, 1), y);
+	TEST(int_field_count(&gf), 3);
+	TEST(int_field_add(&gf, u), 3);
+	TEST(int_field_get_index(&gf, 3), u);
+	TEST(int_field_add(&gf, v), 4);
+	TEST(int_field_get_index(&gf, 4), v);
+	TEST(int_field_add(&gf, w), 5);
+	TEST(int_field_get_index(&gf, 5), w);
+	TEST(int_field_count(&gf), 6);
+	TEST((int_field_exclude_index(&gf, 1), EOK), EOK);
+	TEST(int_field_get_index(&gf, 1), NULL);
+	TEST(int_field_get_index(&gf, 3), u);
+	TEST((int_field_exclude_index(&gf, 7), EOK), EOK);
+	TEST(int_field_get_index(&gf, 3), u);
+	TEST(int_field_get_index(&gf, 5), w);
+	TEST((int_field_exclude_index(&gf, 4), EOK), EOK);
+	TEST(int_field_get_index(&gf, 4), NULL);
+	TEST((int_field_destroy(&gf), EOK), EOK);
+	TEST(int_field_count(&gf), -1);
+	
+	printf("\nInt map test");
+	
+	XMALLOC(x, int);
+	XMALLOC(y, int);
+	XMALLOC(z, int);
+	XMALLOC(u, int);
+	XMALLOC(v, int);
+	XMALLOC(w, int);
+	
+	int_map_t im;
+	im.magic = 0;
+	
+	TEST(int_map_add(&im, 1, x), EINVAL);
+	TEST(int_map_count(&im), -1);
+	TEST(int_map_initialize(&im), EOK);
+	TEST(int_map_count(&im), 0);
+	TEST(int_map_find(&im, 1), NULL);
+	TEST(int_map_add(&im, 1, x), 0);
+	TEST(int_map_find(&im, 1), x);
+	TEST((int_map_exclude(&im, 1), EOK), EOK);
+	TEST(int_map_find(&im, 1), NULL);
+	TEST(int_map_add(&im, 1, y), 1);
+	TEST(int_map_find(&im, 1), y);
+	TEST(int_map_add(&im, 4, z), 2);
+	TEST(int_map_get_index(&im, 2), z);
+	TEST(int_map_find(&im, 4), z);
+	TEST(int_map_find(&im, 1), y);
+	TEST(int_map_count(&im), 3);
+	TEST(int_map_add(&im, 2, u), 3);
+	TEST(int_map_find(&im, 2), u);
+	TEST(int_map_add(&im, 3, v), 4);
+	TEST(int_map_find(&im, 3), v);
+	TEST(int_map_get_index(&im, 4), v);
+	TEST(int_map_add(&im, 6, w), 5);
+	TEST(int_map_find(&im, 6), w);
+	TEST(int_map_count(&im), 6);
+	TEST((int_map_exclude(&im, 1), EOK), EOK);
+	TEST(int_map_find(&im, 1), NULL);
+	TEST(int_map_find(&im, 2), u);
+	TEST((int_map_exclude(&im, 7), EOK), EOK);
+	TEST(int_map_find(&im, 2), u);
+	TEST(int_map_find(&im, 6), w);
+	TEST((int_map_exclude_index(&im, 4), EOK), EOK);
+	TEST(int_map_get_index(&im, 4), NULL);
+	TEST(int_map_find(&im, 3), NULL);
+	TEST((int_map_destroy(&im), EOK), EOK);
+	TEST(int_map_count(&im), -1);
+	
+	printf("\nMeasured strings test");
+	
+	measured_string_ref string =
+	    measured_string_create_bulk("I am a measured string!", 0);
+	printf("\n%x, %s at %x of %d\n", string, string->value, string->value,
+	    string->length);
+	
+	return EOK;
+}
+
+/** @}
+ */
Index: uspace/app/netstart/self_test.h
===================================================================
--- uspace/app/netstart/self_test.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/app/netstart/self_test.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup net
+ * @{
+ */
+
+#ifndef __SELF_TEST_H__
+#define __SELF_TEST_H__
+
+extern int self_test(void);
+
+#endif
+
+/** @}
+ */
Index: uspace/app/nic/nic.c
===================================================================
--- uspace/app/nic/nic.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/nic/nic.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,4 @@
 #include <stdlib.h>
 #include <stddef.h>
-#include <str.h>
 #include <str_error.h>
 
@@ -73,5 +72,5 @@
 static async_sess_t *get_nic_by_index(size_t i)
 {
-	errno_t rc;
+	int rc;
 	size_t count;
 	char *svc_name;
@@ -111,10 +110,10 @@
 }
 
-static errno_t nic_get_info(service_id_t svc_id, char *svc_name,
+static int nic_get_info(service_id_t svc_id, char *svc_name,
     nic_info_t *info)
 {
 	async_sess_t *sess;
 	nic_role_t role;
-	errno_t rc;
+	int rc;
 
 	sess = loc_service_connect(svc_id, INTERFACE_DDF, 0);
@@ -246,5 +245,5 @@
 }
 
-static errno_t nic_list(void)
+static int nic_list(void)
 {
 	category_id_t nic_cat;
@@ -254,5 +253,5 @@
 	char *svc_name;
 	char *addr_str;
-	errno_t rc;
+	int rc;
 
 	rc = loc_category_get_id("nic", &nic_cat, 0);
@@ -317,5 +316,5 @@
 }
 
-static errno_t nic_set_speed(int i, char *str)
+static int nic_set_speed(int i, char *str)
 {
 	async_sess_t *sess;
@@ -324,5 +323,5 @@
 	nic_channel_mode_t oldduplex;
 	nic_role_t oldrole;
-	errno_t rc;
+	int rc;
 
 	rc = str_uint32_t(str, NULL, 10, false, &speed);
@@ -352,5 +351,5 @@
 }
 
-static errno_t nic_set_duplex(int i, char *str)
+static int nic_set_duplex(int i, char *str)
 {
 	async_sess_t *sess;
@@ -359,5 +358,5 @@
 	nic_channel_mode_t oldduplex;
 	nic_role_t oldrole;
-	errno_t rc;
+	int rc;
 
 	if (!str_cmp(str, "half"))
@@ -390,8 +389,8 @@
 }
 
-static errno_t nic_set_autoneg(int i)
-{
-	async_sess_t *sess;
-	errno_t rc;
+static int nic_set_autoneg(int i)
+{
+	async_sess_t *sess;
+	int rc;
 
 	sess = get_nic_by_index(i);
@@ -410,10 +409,9 @@
 }
 
-static errno_t nic_set_addr(int i, char *str)
+static int nic_set_addr(int i, char *str)
 {
 	async_sess_t *sess;
 	nic_address_t addr;
-	errno_t rc;
-	int idx;
+	int rc, idx;
 
 	sess = get_nic_by_index(i);
@@ -439,5 +437,5 @@
 }
 
-static errno_t nic_set_rx_unicast(int i, char *str)
+static int nic_set_rx_unicast(int i, char *str)
 {
 	async_sess_t *sess;
@@ -474,5 +472,5 @@
 }
 
-static errno_t nic_set_rx_multicast(int i, char *str)
+static int nic_set_rx_multicast(int i, char *str)
 {
 	async_sess_t *sess;
@@ -503,5 +501,5 @@
 }
 
-static errno_t nic_set_rx_broadcast(int i, char *str)
+static int nic_set_rx_broadcast(int i, char *str)
 {
 	async_sess_t *sess;
@@ -529,5 +527,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 	uint32_t index;
 
Index: uspace/app/nterm/conn.c
===================================================================
--- uspace/app/nterm/conn.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/nterm/conn.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -69,5 +69,5 @@
 static void conn_data_avail(tcp_conn_t *conn)
 {
-	errno_t rc;
+	int rc;
 	size_t nrecv;
 
@@ -75,5 +75,5 @@
 		rc = tcp_conn_recv(conn, recv_buf, RECV_BUF_SIZE, &nrecv);
 		if (rc != EOK) {
-			printf("\n[Receive error: %s]\n", str_error_name(rc));
+			printf("\n[Receive error %d]\n", rc);
 			break;
 		}
@@ -86,9 +86,9 @@
 }
 
-errno_t conn_open(const char *hostport)
+int conn_open(const char *hostport)
 {
 	inet_ep2_t epp;
 	const char *errmsg;
-	errno_t rc;
+	int rc;
 
 	inet_ep2_init(&epp);
@@ -126,7 +126,7 @@
 }
 
-errno_t conn_send(void *data, size_t size)
+int conn_send(void *data, size_t size)
 {
-	errno_t rc = tcp_conn_send(conn, data, size);
+	int rc = tcp_conn_send(conn, data, size);
 	if (rc != EOK)
 		return EIO;
Index: uspace/app/nterm/conn.h
===================================================================
--- uspace/app/nterm/conn.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/nterm/conn.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,6 +39,6 @@
 #include <stddef.h>
 
-extern errno_t conn_open(const char *);
-extern errno_t conn_send(void *, size_t);
+extern int conn_open(const char *);
+extern int conn_send(void *, size_t);
 
 #endif
Index: uspace/app/nterm/nterm.c
===================================================================
--- uspace/app/nterm/nterm.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/nterm/nterm.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <io/console.h>
 #include <stdio.h>
-#include <str.h>
 
 #include "conn.h"
@@ -62,5 +61,5 @@
 	char cbuf[STR_BOUNDS(1)];
 	size_t offs;
-	errno_t rc;
+	int rc;
 
 	offs = 0;
@@ -111,5 +110,5 @@
 {
 	cons_event_t ev;
-	errno_t rc;
+	int rc;
 
 	if (argc != 2) {
Index: uspace/app/ping/ping.c
===================================================================
--- uspace/app/ping/ping.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/ping/ping.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -71,5 +71,5 @@
 static FIBRIL_MUTEX_INITIALIZE(quit_lock);
 
-static errno_t ping_ev_recv(inetping_sdu_t *);
+static int ping_ev_recv(inetping_sdu_t *);
 
 static inetping_ev_ops_t ev_ops = {
@@ -109,8 +109,8 @@
 }
 
-static errno_t ping_ev_recv(inetping_sdu_t *sdu)
+static int ping_ev_recv(inetping_sdu_t *sdu)
 {
 	char *asrc;
-	errno_t rc = inet_addr_format(&src_addr, &asrc);
+	int rc = inet_addr_format(&src_addr, &asrc);
 	if (rc != EOK)
 		return ENOMEM;
@@ -133,5 +133,5 @@
 }
 
-static errno_t ping_send(uint16_t seq_no)
+static int ping_send(uint16_t seq_no)
 {
 	inetping_sdu_t sdu;
@@ -143,13 +143,13 @@
 	sdu.size = 3;
 	
-	errno_t rc = inetping_send(&sdu);
+	int rc = inetping_send(&sdu);
 	if (rc != EOK)
-		printf("Failed sending echo request: %s: %s.\n",
-		    str_error_name(rc), str_error(rc));
+		printf("Failed sending echo request: %s (%d).\n",
+		    str_error(rc), rc);
 	
 	return rc;
 }
 
-static errno_t transmit_fibril(void *arg)
+static int transmit_fibril(void *arg)
 {
 	uint16_t seq_no = 0;
@@ -163,5 +163,5 @@
 		
 		fibril_mutex_lock(&received_lock);
-		errno_t rc = fibril_condvar_wait_timeout(&received_cv, &received_lock,
+		int rc = fibril_condvar_wait_timeout(&received_cv, &received_lock,
 		    PING_TIMEOUT);
 		received_t recv = received;
@@ -190,5 +190,5 @@
 }
 
-static errno_t input_fibril(void *arg)
+static int input_fibril(void *arg)
 {
 	console_ctrl_t *con = console_init(stdin, stdout);
@@ -222,8 +222,8 @@
 	ip_ver_t ip_ver = ip_any;
 	
-	errno_t rc = inetping_init(&ev_ops);
+	int rc = inetping_init(&ev_ops);
 	if (rc != EOK) {
 		printf("Failed connecting to internet ping service: "
-		    "%s: %s.\n", str_error_name(rc), str_error(rc));
+		    "%s (%d).\n", str_error(rc), rc);
 		goto error;
 	}
@@ -290,5 +290,6 @@
 	}
 	
-	if (asprintf(&sdest, "%s (%s)", host, adest) < 0) {
+	rc = asprintf(&sdest, "%s (%s)", host, adest);
+	if (rc < 0) {
 		printf("Out of memory.\n");
 		goto error;
Index: uspace/app/pkg/pkg.c
===================================================================
--- uspace/app/pkg/pkg.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/pkg/pkg.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 #include <str_error.h>
 #include <task.h>
@@ -50,5 +49,5 @@
 }
 
-static errno_t cmd_runl(const char *path, ...)
+static int cmd_runl(const char *path, ...)
 {
 	va_list ap;
@@ -66,5 +65,5 @@
 	task_id_t id;
 	task_wait_t wait;
-	errno_t rc = task_spawn(&id, &wait, path, cnt, ap);
+	int rc = task_spawn(&id, &wait, path, cnt, ap);
 	va_end(ap);
 
@@ -97,9 +96,9 @@
 	}
 
-	return retval == 0 ? EOK : EPARTY;
-}
-
-
-static errno_t pkg_install(int argc, char *argv[])
+	return retval;
+}
+
+
+static int pkg_install(int argc, char *argv[])
 {
 	char *pkg_name;
@@ -107,6 +106,5 @@
 	char *fname;
 	char *fnunpack;
-	errno_t rc;
-	int ret;
+	int rc;
 
 	if (argc != 3) {
@@ -117,22 +115,22 @@
 	pkg_name = argv[2];
 
-	ret = asprintf(&src_uri, "http://ci.helenos.org/latest/" STRING(UARCH)
+	rc = asprintf(&src_uri, "http://ci.helenos.org/latest/" STRING(UARCH)
 	    "/%s-for-helenos-" STRING(UARCH) ".tar.gz",
 	    pkg_name);
-	if (ret < 0) {
+	if (rc < 0) {
 		printf("Out of memory.\n");
 		return ENOMEM;
 	}
 
-	ret = asprintf(&fname, "/tmp/%s-for-helenos-" STRING(UARCH)
+	rc = asprintf(&fname, "/tmp/%s-for-helenos-" STRING(UARCH)
 	    ".tar.gz", pkg_name);
-	if (ret < 0) {
+	if (rc < 0) {
 		printf("Out of memory.\n");
 		return ENOMEM;
 	}
 
-	ret = asprintf(&fnunpack, "/tmp/%s-for-helenos-" STRING(UARCH) ".tar",
+	rc = asprintf(&fnunpack, "/tmp/%s-for-helenos-" STRING(UARCH) ".tar",
 	    pkg_name);
-	if (ret < 0) {
+	if (rc < 0) {
 		printf("Out of memory.\n");
 		return ENOMEM;
@@ -182,5 +180,5 @@
 {
 	char *cmd;
-	errno_t rc;
+	int rc;
 
 	if (argc < 2) {
Index: uspace/app/rcubench/rcubench.c
===================================================================
--- uspace/app/rcubench/rcubench.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/rcubench/rcubench.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,4 @@
 #include <compiler/barrier.h>
 #include <futex.h>
-#include <str.h>
 
 #include <rcu.h>
@@ -127,5 +126,5 @@
 		thread_id_t tid;
 		/* Also sets up a fibril for the thread. */
-		errno_t ret = thread_create(thread_func, bench, "rcubench-t", &tid);
+		int ret = thread_create(thread_func, bench, "rcubench-t", &tid);
 		if (ret != EOK) {
 			printf("Error: Failed to create benchmark thread.\n");
@@ -218,5 +217,5 @@
 	/* Determine iteration count. */
 	uint32_t iter_cnt = 0;
-	errno_t ret = str_uint32_t(argv[2], NULL, 0, true, &iter_cnt);
+	int ret = str_uint32_t(argv[2], NULL, 0, true, &iter_cnt);
 
 	if (ret == EOK && 1 <= iter_cnt) {
Index: uspace/app/rcutest/rcutest.c
===================================================================
--- uspace/app/rcutest/rcutest.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/rcutest/rcutest.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,4 @@
 #include <stdlib.h>
 #include <stdint.h>
-#include <str_error.h>
 #include <mem.h>
 #include <errno.h>
@@ -48,5 +47,4 @@
 #include <compiler/barrier.h>
 #include <futex.h>
-#include <str.h>
 
 #include <rcu.h>
@@ -169,7 +167,7 @@
 
 
-typedef errno_t (*fibril_func_t)(void *);
-
-static bool create_fibril(errno_t (*func)(void*), void *arg)
+typedef int (*fibril_func_t)(void *);
+
+static bool create_fibril(int (*func)(void*), void *arg)
 {
 	fid_t fid = fibril_create(func, arg);
@@ -309,5 +307,5 @@
 
 
-static errno_t sleeping_reader(one_reader_info_t *arg)
+static int sleeping_reader(one_reader_info_t *arg)
 {
 	rcu_register_fibril();
@@ -391,5 +389,5 @@
 
 
-static errno_t preexisting_reader(two_reader_info_t *arg)
+static int preexisting_reader(two_reader_info_t *arg)
 {
 	rcu_register_fibril();
@@ -431,5 +429,5 @@
 }
 
-static errno_t new_reader(two_reader_info_t *arg)
+static int new_reader(two_reader_info_t *arg)
 {
 	rcu_register_fibril();
@@ -552,5 +550,5 @@
 
 
-static errno_t exiting_locked_reader(exit_reader_info_t *arg)
+static int exiting_locked_reader(exit_reader_info_t *arg)
 {
 	rcu_register_fibril();
@@ -648,5 +646,5 @@
 }
 
-static errno_t seq_reader(seq_test_info_t *arg)
+static int seq_reader(seq_test_info_t *arg)
 {
 	rcu_register_fibril();
@@ -691,5 +689,5 @@
 }
 
-static errno_t seq_updater(seq_test_info_t *arg)
+static int seq_updater(seq_test_info_t *arg)
 {
 	rcu_register_fibril();
@@ -780,7 +778,7 @@
 		thread_id_t tid;
 		
-		errno_t ret = thread_create(dummy_fibril, NULL, "urcu-test-worker", &tid);
+		int ret = thread_create(dummy_fibril, NULL, "urcu-test-worker", &tid);
 		if (EOK != ret) {
-			printf("Failed to create thread '%zu' (error: %s)\n", k + 1, str_error_name(ret));
+			printf("Failed to create thread '%zu' (error: %d)\n", k + 1, ret);
 			return false;
 		}
@@ -863,5 +861,5 @@
 	if (argc == 3) {
 		uint32_t thread_cnt = 0;
-		errno_t ret = str_uint32_t(argv[2], NULL, 0, true, &thread_cnt);
+		int ret = str_uint32_t(argv[2], NULL, 0, true, &thread_cnt);
 		
 		if (ret == EOK && 1 <= thread_cnt && thread_cnt <= 64) {
Index: uspace/app/redir/redir.c
===================================================================
--- uspace/app/redir/redir.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/redir/redir.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,16 +59,12 @@
 	*stream = NULL;
 	
-	int oldfd;
-	errno_t rc = vfs_lookup_open(path, WALK_REGULAR | flags, mode, &oldfd);
-	if (rc != EOK)
+	int oldfd = vfs_lookup_open(path, WALK_REGULAR | flags, mode);
+	if (oldfd < 0)
 		return;
 	
 	if (oldfd != fd) {
-		int newfd;
-		if (vfs_clone(oldfd, fd, false, &newfd) != EOK)
+		if (vfs_clone(oldfd, fd, false) != fd)
 			return;
 		
-		assert(newfd == fd);
-
 		if (vfs_put(oldfd))
 			return;
@@ -82,5 +78,5 @@
 	const char **args;
 	task_id_t id = 0;
-	errno_t rc;
+	int rc;
 
 	args = (const char **) calloc(argc + 1, sizeof(char *));
Index: uspace/app/sbi/src/bigint.c
===================================================================
--- uspace/app/sbi/src/bigint.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/bigint.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -186,5 +186,5 @@
  *			to @a dval.
  */
-errno_t bigint_get_value_int(bigint_t *bigint, int *dval)
+int bigint_get_value_int(bigint_t *bigint, int *dval)
 {
 	bigint_t vval, diff;
Index: uspace/app/sbi/src/bigint.h
===================================================================
--- uspace/app/sbi/src/bigint.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/bigint.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 void bigint_destroy(bigint_t *bigint);
 
-errno_t bigint_get_value_int(bigint_t *bigint, int *dval);
+int bigint_get_value_int(bigint_t *bigint, int *dval);
 bool_t bigint_is_zero(bigint_t *bigint);
 bool_t bigint_is_negative(bigint_t *bigint);
Index: uspace/app/sbi/src/builtin/bi_char.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_char.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/builtin/bi_char.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -73,5 +73,5 @@
         char *str;
         int char_val;
-        errno_t rc;
+        int rc;
 
 #ifdef DEBUG_RUN_TRACE
Index: uspace/app/sbi/src/builtin/bi_console.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_console.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/builtin/bi_console.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -107,5 +107,5 @@
 	rdata_var_t *var;
 	int char_val;
-	errno_t rc;
+	int rc;
 
 #ifdef DEBUG_RUN_TRACE
Index: uspace/app/sbi/src/builtin/bi_string.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_string.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/builtin/bi_string.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -125,5 +125,5 @@
 	int length;
 
-	errno_t rc;
+	int rc;
 
 	/* Extract self.Value */
Index: uspace/app/sbi/src/input.c
===================================================================
--- uspace/app/sbi/src/input.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/input.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,5 @@
 #define INPUT_BUFFER_SIZE 256
 
-static errno_t input_init_file(input_t *input, const char *fname);
+static int input_init_file(input_t *input, const char *fname);
 static void input_init_interactive(input_t *input);
 static void input_init_string(input_t *input, const char *str);
@@ -57,5 +57,5 @@
  *			ENOENT when opening file fails.
  */
-errno_t input_new_file(input_t **input, const char *fname)
+int input_new_file(input_t **input, const char *fname)
 {
 	*input = malloc(sizeof(input_t));
@@ -71,5 +71,5 @@
  * @return		EOK on success, ENOMEM when allocation fails.
  */
-errno_t input_new_interactive(input_t **input)
+int input_new_interactive(input_t **input)
 {
 	*input = malloc(sizeof(input_t));
@@ -87,5 +87,5 @@
  * @return		EOK on success, ENOMEM when allocation fails.
  */
-errno_t input_new_string(input_t **input, const char *str)
+int input_new_string(input_t **input, const char *str)
 {
 	*input = malloc(sizeof(input_t));
@@ -104,5 +104,5 @@
  * @return		EOK on success, ENOENT when opening file fails.
 */
-static errno_t input_init_file(input_t *input, const char *fname)
+static int input_init_file(input_t *input, const char *fname)
 {
 	FILE *f;
@@ -174,5 +174,5 @@
  * @return		EOK on success, EIO on failure.
  */
-errno_t input_get_line(input_t *input, char **line)
+int input_get_line(input_t *input, char **line)
 {
 	const char *prompt;
Index: uspace/app/sbi/src/input.h
===================================================================
--- uspace/app/sbi/src/input.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/input.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -32,9 +32,9 @@
 #include "mytypes.h"
 
-errno_t input_new_file(input_t **input, const char *fname);
-errno_t input_new_interactive(input_t **input);
-errno_t input_new_string(input_t **input, const char *str);
+int input_new_file(input_t **input, const char *fname);
+int input_new_interactive(input_t **input);
+int input_new_string(input_t **input, const char *str);
 
-errno_t input_get_line(input_t *input, char **line);
+int input_get_line(input_t *input, char **line);
 int input_get_line_no(input_t *input);
 
Index: uspace/app/sbi/src/lex.c
===================================================================
--- uspace/app/sbi/src/lex.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/lex.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -257,5 +257,5 @@
 void lex_init(lex_t *lex, struct input *input)
 {
-	errno_t rc;
+	int rc;
 
 	lex->input = input;
@@ -717,5 +717,5 @@
 {
 	char *bp;
-	errno_t rc;
+	int rc;
 
 	bp = lex->ibp;
Index: uspace/app/sbi/src/main.c
===================================================================
--- uspace/app/sbi/src/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,5 +61,5 @@
 	stype_t stype;
 	run_t run;
-	errno_t rc;
+	int rc;
 
 	/* Store executable file path under which we have been invoked. */
Index: uspace/app/sbi/src/mytypes.h
===================================================================
--- uspace/app/sbi/src/mytypes.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/mytypes.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,8 +53,5 @@
 /** We need NULL defined. */
 #include <stddef.h>
-
-#ifndef EOK
 #define EOK 0
-#endif
 
 #include "bigint_t.h"
Index: uspace/app/sbi/src/os/helenos.c
===================================================================
--- uspace/app/sbi/src/os/helenos.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/os/helenos.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -151,5 +151,5 @@
  *			EIO on decoding error.
  */
-errno_t os_str_get_char(const char *str, int index, int *out_char)
+int os_str_get_char(const char *str, int index, int *out_char)
 {
 	size_t offset;
@@ -210,8 +210,8 @@
  * @param ptr	Place to store pointer to new string.
  */
-errno_t os_input_line(const char *prompt, char **ptr)
+int os_input_line(const char *prompt, char **ptr)
 {
 	char *line;
-	errno_t rc;
+	int rc;
 
 	if (tinput == NULL) {
@@ -247,11 +247,10 @@
  *		Command is present just one, not duplicated.
  */
-errno_t os_exec(char *const cmd[])
+int os_exec(char *const cmd[])
 {
 	task_id_t tid;
 	task_wait_t twait;
 	task_exit_t texit;
-	errno_t rc;
-	int retval;
+	int rc, retval;
 
 	rc = task_spawnv(&tid, &twait, cmd[0], (char const * const *) cmd);
Index: uspace/app/sbi/src/os/os.h
===================================================================
--- uspace/app/sbi/src/os/os.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/os/os.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,9 +35,9 @@
 char *os_str_dup(const char *str);
 size_t os_str_length(const char *str);
-errno_t os_str_get_char(const char *str, int index, int *out_char);
+int os_str_get_char(const char *str, int index, int *out_char);
 char *os_chr_to_astr(wchar_t chr);
 void os_input_disp_help(void);
-errno_t os_input_line(const char *prompt, char **ptr);
-errno_t os_exec(char * const cmd[]);
+int os_input_line(const char *prompt, char **ptr);
+int os_exec(char * const cmd[]);
 
 void os_store_ef_path(char *path);
Index: uspace/app/sbi/src/os/posix.c
===================================================================
--- uspace/app/sbi/src/os/posix.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/os/posix.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -114,5 +114,5 @@
  * @return	Zero if equal, nonzero if not equal
  */
-errno_t os_str_cmp(const char *a, const char *b)
+int os_str_cmp(const char *a, const char *b)
 {
 	return strcmp(a, b);
@@ -147,5 +147,5 @@
  *			EIO on decoding error.
  */
-errno_t os_str_get_char(const char *str, int index, int *out_char)
+int os_str_get_char(const char *str, int index, int *out_char)
 {
 	size_t len;
@@ -193,5 +193,5 @@
  * @param ptr	Place to store pointer to new string.
  */
-errno_t os_input_line(const char *prompt, char **ptr)
+int os_input_line(const char *prompt, char **ptr)
 {
 	printf("%s", prompt);
@@ -214,5 +214,5 @@
  *		Command is present just one, not duplicated.
  */
-errno_t os_exec(char *const cmd[])
+int os_exec(char *const cmd[])
 {
 	pid_t pid;
Index: uspace/app/sbi/src/program.c
===================================================================
--- uspace/app/sbi/src/program.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/program.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,10 +55,10 @@
  *			EINVAL if file has syntax errors.
  */
-errno_t program_file_process(stree_program_t *program, const char *fname)
+int program_file_process(stree_program_t *program, const char *fname)
 {
 	input_t *input;
 	lex_t lex;
 	parse_t parse;
-	errno_t rc;
+	int rc;
 
 	rc = input_new_file(&input, fname);
@@ -91,7 +91,7 @@
  *			has syntax errors.
  */
-errno_t program_lib_process(stree_program_t *program)
+int program_lib_process(stree_program_t *program)
 {
-	errno_t rc;
+	int rc;
 	char *path, *fname;
 	char *tmp;
Index: uspace/app/sbi/src/program.h
===================================================================
--- uspace/app/sbi/src/program.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/program.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -32,6 +32,6 @@
 #include "mytypes.h"
 
-errno_t program_file_process(stree_program_t *program, const char *fname);
-errno_t program_lib_process(stree_program_t *program);
+int program_file_process(stree_program_t *program, const char *fname);
+int program_lib_process(stree_program_t *program);
 
 #endif
Index: uspace/app/sbi/src/run_expr.c
===================================================================
--- uspace/app/sbi/src/run_expr.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/run_expr.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1414,5 +1414,5 @@
 	int length;
 	int i;
-	errno_t rc;
+	int rc;
 	int iextent;
 
@@ -2287,5 +2287,5 @@
 	int elem_index;
 	int arg_val;
-	errno_t rc;
+	int rc;
 
 	rdata_item_t *ritem;
@@ -2476,5 +2476,5 @@
 	int elem_index;
 	int arg_val;
-	errno_t rc1, rc2;
+	int rc1, rc2;
 
 	rdata_value_t *value;
Index: uspace/app/sbi/src/stype.c
===================================================================
--- uspace/app/sbi/src/stype.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/stype.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1890,5 +1890,5 @@
  * @return		EOK if equal, EINVAL if not.
  */
-errno_t stype_targs_check_equal(stype_t *stype, tdata_item_t *a_ti,
+int stype_targs_check_equal(stype_t *stype, tdata_item_t *a_ti,
     tdata_item_t *b_ti)
 {
Index: uspace/app/sbi/src/stype.h
===================================================================
--- uspace/app/sbi/src/stype.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sbi/src/stype.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
 tdata_item_t *stype_tobject_find_pred(stype_t *stype, tdata_item_t *src,
     tdata_item_t *dest);
-errno_t stype_targs_check_equal(stype_t *stype, tdata_item_t *a_ti,
+int stype_targs_check_equal(stype_t *stype, tdata_item_t *a_ti,
     tdata_item_t *b_ti);
 
Index: uspace/app/sportdmp/sportdmp.c
===================================================================
--- uspace/app/sportdmp/sportdmp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sportdmp/sportdmp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -33,5 +33,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 
 #define BUF_SIZE 1
@@ -51,5 +50,5 @@
 
 	int arg = 1;
-	errno_t rc;
+	int rc;
 
 	if (argc > arg && str_test_prefix(argv[arg], "--baud=")) {
Index: uspace/app/stats/stats.c
===================================================================
--- uspace/app/stats/stats.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/stats/stats.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -274,5 +274,5 @@
 			// TODO: Support for 64b range
 			int tmp;
-			errno_t ret = arg_parse_int(argc, argv, &i, &tmp, off);
+			int ret = arg_parse_int(argc, argv, &i, &tmp, off);
 			if (ret != EOK) {
 				printf("%s: Malformed task_id '%s'\n", NAME, argv[i]);
Index: uspace/app/sysinfo/sysinfo.c
===================================================================
--- uspace/app/sysinfo/sysinfo.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sysinfo/sysinfo.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,4 @@
 #include <sysinfo.h>
 #include <stdlib.h>
-#include <str.h>
 
 static void dump_bytes_hex(char *data, size_t size)
@@ -61,8 +60,8 @@
 }
 
-static errno_t print_item_val(char *ipath)
+static int print_item_val(char *ipath)
 {
 	sysarg_t value;
-	errno_t rc = sysinfo_get_value(ipath, &value);
+	int rc = sysinfo_get_value(ipath, &value);
 	if (rc != EOK) {
 		printf("Error reading item '%s'.\n", ipath);
Index: uspace/app/sysinst/futil.c
===================================================================
--- uspace/app/sysinst/futil.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sysinst/futil.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,19 +54,19 @@
  * @return EOK on success, EIO on I/O error
  */
-errno_t futil_copy_file(const char *srcp, const char *destp)
+int futil_copy_file(const char *srcp, const char *destp)
 {
 	int sf, df;
 	size_t nr, nw;
-	errno_t rc;
+	int rc;
 	aoff64_t posr = 0, posw = 0;
 
 	printf("Copy '%s' to '%s'.\n", srcp, destp);
 
-	rc = vfs_lookup_open(srcp, WALK_REGULAR, MODE_READ, &sf);
-	if (rc != EOK)
-		return EIO;
-
-	rc = vfs_lookup_open(destp, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE, &df);
-	if (rc != EOK)
+	sf = vfs_lookup_open(srcp, WALK_REGULAR, MODE_READ);
+	if (sf < 0)
+		return EIO;
+
+	df = vfs_lookup_open(destp, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE);
+	if (df < 0)
 		return EIO;
 
@@ -87,5 +87,5 @@
 
 	rc = vfs_put(df);
-	if (rc != EOK)
+	if (rc < 0)
 		return EIO;
 
@@ -104,11 +104,11 @@
  * @return EOK on success, ENOMEM if out of memory, EIO on I/O error
  */
-errno_t futil_rcopy_contents(const char *srcdir, const char *destdir)
+int futil_rcopy_contents(const char *srcdir, const char *destdir)
 {
 	DIR *dir;
 	struct dirent *de;
-	vfs_stat_t s;
+	struct stat s;
 	char *srcp, *destp;
-	errno_t rc;
+	int rc;
 
 	dir = opendir(srcdir);
@@ -158,15 +158,15 @@
  *         I/O error, ENOMEM if out of memory
  */
-errno_t futil_get_file(const char *srcp, void **rdata, size_t *rsize)
+int futil_get_file(const char *srcp, void **rdata, size_t *rsize)
 {
 	int sf;
 	size_t nr;
-	errno_t rc;
+	int rc;
 	size_t fsize;
 	char *data;
-	vfs_stat_t st;
-
-	rc = vfs_lookup_open(srcp, WALK_REGULAR, MODE_READ, &sf);
-	if (rc != EOK)
+	struct stat st;
+
+	sf = vfs_lookup_open(srcp, WALK_REGULAR, MODE_READ);
+	if (sf < 0)
 		return ENOENT;
 
Index: uspace/app/sysinst/futil.h
===================================================================
--- uspace/app/sysinst/futil.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sysinst/futil.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,7 +41,7 @@
 #include <stddef.h>
 
-extern errno_t futil_copy_file(const char *, const char *);
-extern errno_t futil_rcopy_contents(const char *, const char *);
-extern errno_t futil_get_file(const char *, void **, size_t *);
+extern int futil_copy_file(const char *, const char *);
+extern int futil_rcopy_contents(const char *, const char *);
+extern int futil_get_file(const char *, void **, size_t *);
 
 #endif
Index: uspace/app/sysinst/sysinst.c
===================================================================
--- uspace/app/sysinst/sysinst.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/sysinst/sysinst.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,8 +44,6 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str_error.h>
 #include <task.h>
 #include <vfs/vfs.h>
-#include <str.h>
 
 #include "futil.h"
@@ -84,7 +82,7 @@
  * @param pdev Place to store partition device name
  *
- * @return EOK on success or an error code
- */
-static errno_t sysinst_label_dev(const char *dev, char **pdev)
+ * @return EOK on success or error code
+ */
+static int sysinst_label_dev(const char *dev, char **pdev)
 {
 	fdisk_t *fdisk;
@@ -94,5 +92,5 @@
 	cap_spec_t cap;
 	service_id_t sid;
-	errno_t rc;
+	int rc;
 
 	printf("sysinst_label_dev(): get service ID '%s'\n", dev);
@@ -119,5 +117,5 @@
 	rc = fdisk_label_create(fdev, lt_mbr);
 	if (rc != EOK) {
-		printf("Error creating label: %s.\n", str_error(rc));
+		printf("Error creating label (%d).\n", rc);
 		return rc;
 	}
@@ -127,5 +125,5 @@
 	rc = fdisk_part_get_max_avail(fdev, spc_pri, &cap);
 	if (rc != EOK) {
-		printf("Error getting available capacity: %s.\n", str_error(rc));
+		printf("Error getting available capacity (%d).\n", rc);
 		return rc;
 	}
@@ -143,5 +141,6 @@
 
 	/* XXX libfdisk should give us the service name */
-	if (asprintf(pdev, "%sp1", dev) < 0)
+	rc = asprintf(pdev, "%sp1", dev);
+	if (rc < 0)
 		return ENOMEM;
 
@@ -153,11 +152,11 @@
  *
  * @param dev Partition device
- * @return EOK on success or an error code
- */
-static errno_t sysinst_fs_mount(const char *dev)
+ * @return EOK on success or error code
+ */
+static int sysinst_fs_mount(const char *dev)
 {
 	task_wait_t twait;
 	task_exit_t texit;
-	errno_t rc;
+	int rc;
 	int trc;
 
@@ -192,11 +191,11 @@
 /** Copy boot files.
  *
- * @return EOK on success or an error code
- */
-static errno_t sysinst_copy_boot_files(void)
+ * @return EOK on success or error code
+ */
+static int sysinst_copy_boot_files(void)
 {
 	task_wait_t twait;
 	task_exit_t texit;
-	errno_t rc;
+	int rc;
 	int trc;
 
@@ -259,7 +258,7 @@
  *
  * @param devp Disk device
- * @return EOK on success or an error code
- */
-static errno_t sysinst_copy_boot_blocks(const char *devp)
+ * @return EOK on success or error code
+ */
+static int sysinst_copy_boot_blocks(const char *devp)
 {
 	void *boot_img;
@@ -273,5 +272,5 @@
 	aoff64_t core_blocks;
 	grub_boot_blocklist_t *first_bl, *bl;
-	errno_t rc;
+	int rc;
 
 	printf("sysinst_copy_boot_blocks: Read boot block image.\n");
@@ -354,9 +353,9 @@
  *
  * @param dev Device to install to.
- * @return EOK on success or an error code
- */
-static errno_t sysinst_install(const char *dev)
-{
-	errno_t rc;
+ * @return EOK on success or error code
+ */
+static int sysinst_install(const char *dev)
+{
+	int rc;
 	char *pdev;
 
Index: uspace/app/taskdump/elf_core.c
===================================================================
--- uspace/app/taskdump/elf_core.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/taskdump/elf_core.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,5 +55,4 @@
 #include <stddef.h>
 #include <errno.h>
-#include <str_error.h>
 #include <mem.h>
 #include <as.h>
@@ -62,10 +61,9 @@
 #include <libarch/istate.h>
 #include <vfs/vfs.h>
-#include <str.h>
 
 #include "elf_core.h"
 
 static off64_t align_foff_up(off64_t, uintptr_t, size_t);
-static errno_t write_mem_area(int, aoff64_t *, as_area_info_t *, async_sess_t *);
+static int write_mem_area(int, aoff64_t *, as_area_info_t *, async_sess_t *);
 
 #define BUFFER_SIZE 0x1000
@@ -85,5 +83,5 @@
  *
  */
-errno_t elf_core_save(const char *file_name, as_area_info_t *ainfo, unsigned int n,
+int elf_core_save(const char *file_name, as_area_info_t *ainfo, unsigned int n,
     async_sess_t *sess, istate_t *istate)
 {
@@ -99,5 +97,5 @@
 
 	int fd;
-	errno_t rc;
+	int rc;
 	size_t nwr;
 	unsigned int i;
@@ -125,8 +123,8 @@
 	}
 
-	rc = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MAY_CREATE,
-	    MODE_WRITE, &fd);
-	if (rc != EOK) {
-		printf("Failed opening file '%s': %s.\n", file_name, str_error(rc));
+	fd = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MAY_CREATE,
+	    MODE_WRITE);
+	if (fd < 0) {
+		printf("Failed opening file.\n");
 		free(p_hdr);
 		return ENOENT;
@@ -293,5 +291,5 @@
  *
  */
-static errno_t write_mem_area(int fd, aoff64_t *pos, as_area_info_t *area,
+static int write_mem_area(int fd, aoff64_t *pos, as_area_info_t *area,
     async_sess_t *sess)
 {
@@ -299,5 +297,5 @@
 	size_t total;
 	uintptr_t addr;
-	errno_t rc;
+	int rc;
 	size_t nwr;
 
@@ -308,5 +306,5 @@
 		to_copy = min(area->size - total, BUFFER_SIZE);
 		rc = udebug_mem_read(sess, buffer, addr, to_copy);
-		if (rc != EOK) {
+		if (rc < 0) {
 			printf("Failed reading task memory.\n");
 			return EIO;
Index: uspace/app/taskdump/fibrildump.c
===================================================================
--- uspace/app/taskdump/fibrildump.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/taskdump/fibrildump.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 #include <udebug.h>
 
-static errno_t fibrildump_read_uintptr(void *, uintptr_t, uintptr_t *);
+static int fibrildump_read_uintptr(void *, uintptr_t, uintptr_t *);
 
 static stacktrace_ops_t fibrildump_st_ops = {
@@ -49,5 +49,5 @@
 }; 
 
-static errno_t fibrildump_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data)
+static int fibrildump_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data)
 {
 	async_sess_t *sess = (async_sess_t *)arg;
@@ -56,7 +56,7 @@
 }
 
-static errno_t read_link(async_sess_t *sess, uintptr_t addr, link_t *link)
+static int read_link(async_sess_t *sess, uintptr_t addr, link_t *link)
 {
-	errno_t rc;
+	int rc;
 
 	rc = udebug_mem_read(sess, (void *)link, addr, sizeof(link_t));
@@ -64,7 +64,7 @@
 }
 
-static errno_t read_fibril(async_sess_t *sess, uintptr_t addr, fibril_t *fibril)
+static int read_fibril(async_sess_t *sess, uintptr_t addr, fibril_t *fibril)
 {
-	errno_t rc;
+	int rc;
 
 	rc = udebug_mem_read(sess, (void *)fibril, addr, sizeof(fibril_t));
@@ -72,5 +72,5 @@
 }
 
-errno_t fibrils_dump(symtab_t *symtab, async_sess_t *sess)
+int fibrils_dump(symtab_t *symtab, async_sess_t *sess)
 {
 	uintptr_t fibril_list_addr;
@@ -79,5 +79,5 @@
 	uintptr_t addr, fibril_addr;
 	uintptr_t pc, fp;
-	errno_t rc;
+	int rc;
 
 	/* 
Index: uspace/app/taskdump/include/elf_core.h
===================================================================
--- uspace/app/taskdump/include/elf_core.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/taskdump/include/elf_core.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include <libarch/istate.h>
 
-extern errno_t elf_core_save(const char *, as_area_info_t *, unsigned int,
+extern int elf_core_save(const char *, as_area_info_t *, unsigned int,
     async_sess_t *, istate_t *);
 
Index: uspace/app/taskdump/include/fibrildump.h
===================================================================
--- uspace/app/taskdump/include/fibrildump.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/taskdump/include/fibrildump.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include <symtab.h>
 
-extern errno_t fibrils_dump(symtab_t *, async_sess_t *sess);
+extern int fibrils_dump(symtab_t *, async_sess_t *sess);
 
 #endif
Index: uspace/app/taskdump/include/symtab.h
===================================================================
--- uspace/app/taskdump/include/symtab.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/taskdump/include/symtab.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,8 +48,8 @@
 } symtab_t;
 
-extern errno_t symtab_load(const char *file_name, symtab_t **symtab);
+extern int symtab_load(const char *file_name, symtab_t **symtab);
 extern void symtab_delete(symtab_t *st);
-extern errno_t symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr);
-extern errno_t symtab_addr_to_name(symtab_t *symtab, uintptr_t addr, char **name,
+extern int symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr);
+extern int symtab_addr_to_name(symtab_t *symtab, uintptr_t addr, char **name,
     size_t *offs);
 
Index: uspace/app/taskdump/include/taskdump.h
===================================================================
--- uspace/app/taskdump/include/taskdump.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/taskdump/include/taskdump.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include <stdint.h>
 
-extern errno_t td_stacktrace(uintptr_t, uintptr_t);
+extern int td_stacktrace(uintptr_t, uintptr_t);
 
 #endif
Index: uspace/app/taskdump/symtab.c
===================================================================
--- uspace/app/taskdump/symtab.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/taskdump/symtab.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,14 +41,12 @@
 #include <stddef.h>
 #include <errno.h>
-#include <str.h>
-#include <str_error.h>
 #include <vfs/vfs.h>
 
 #include "include/symtab.h"
 
-static errno_t elf_hdr_check(elf_header_t *hdr);
-static errno_t section_hdr_load(int fd, const elf_header_t *ehdr, int idx,
+static int elf_hdr_check(elf_header_t *hdr);
+static int section_hdr_load(int fd, const elf_header_t *ehdr, int idx,
     elf_section_header_t *shdr);
-static errno_t chunk_load(int fd, off64_t start, size_t size, void **ptr);
+static int chunk_load(int fd, off64_t start, size_t size, void **ptr);
 
 /** Load symbol table from an ELF file.
@@ -60,5 +58,5 @@
  *			ENOTSUP if file parsing failed.
  */
-errno_t symtab_load(const char *file_name, symtab_t **symtab)
+int symtab_load(const char *file_name, symtab_t **symtab)
 {
 	symtab_t *stab;
@@ -72,5 +70,5 @@
 
 	int fd;
-	errno_t rc;
+	int rc;
 	size_t nread;
 	int i;
@@ -84,7 +82,7 @@
 		return ENOMEM;
 
-	rc = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK) {
-		printf("failed opening file '%s': %s\n", file_name, str_error(rc));
+	fd = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ);
+	if (fd < 0) {
+		printf("failed opening file\n");
 		free(stab);
 		return ENOENT;
@@ -205,5 +203,5 @@
  * @return	EOK on success, ENOENT if no such symbol was found.
  */
-errno_t symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr)
+int symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr)
 {
 	size_t i;
@@ -242,5 +240,5 @@
  * @return	EOK on success or ENOENT if no matching symbol was found.
  */
-errno_t symtab_addr_to_name(symtab_t *st, uintptr_t addr, char **name,
+int symtab_addr_to_name(symtab_t *st, uintptr_t addr, char **name,
     size_t *offs)
 {
@@ -286,7 +284,7 @@
 /** Check if ELF header is valid.
  *
- * @return	EOK on success or an error code.
- */
-static errno_t elf_hdr_check(elf_header_t *ehdr)
+ * @return	EOK on success or negative error code.
+ */
+static int elf_hdr_check(elf_header_t *ehdr)
 {
 	/* TODO */
@@ -303,8 +301,8 @@
  * @return		EOK on success or EIO if I/O failed.
  */
-static errno_t section_hdr_load(int fd, const elf_header_t *elf_hdr, int idx,
+static int section_hdr_load(int fd, const elf_header_t *elf_hdr, int idx,
     elf_section_header_t *sec_hdr)
 {
-	errno_t rc;
+	int rc;
 	size_t nread;
 	aoff64_t pos = elf_hdr->e_shoff + idx * sizeof(elf_section_header_t);
@@ -328,7 +326,7 @@
  * @return		EOK on success or EIO on failure.
  */
-static errno_t chunk_load(int fd, off64_t start, size_t size, void **ptr)
-{
-	errno_t rc;
+static int chunk_load(int fd, off64_t start, size_t size, void **ptr)
+{
+	int rc;
 	size_t nread;
 	aoff64_t pos = start;
Index: uspace/app/taskdump/taskdump.c
===================================================================
--- uspace/app/taskdump/taskdump.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/taskdump/taskdump.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,5 +48,4 @@
 #include <macros.h>
 #include <assert.h>
-#include <str.h>
 
 #include <symtab.h>
@@ -64,11 +63,11 @@
 static symtab_t *app_symtab;
 
-static errno_t connect_task(task_id_t task_id);
+static int connect_task(task_id_t task_id);
 static int parse_args(int argc, char *argv[]);
 static void print_syntax(void);
-static errno_t threads_dump(void);
-static errno_t thread_dump(uintptr_t thash);
-static errno_t areas_dump(void);
-static errno_t td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value);
+static int threads_dump(void);
+static int thread_dump(uintptr_t thash);
+static int areas_dump(void);
+static int td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value);
 
 static void autoload_syms(void);
@@ -84,5 +83,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf("Task Dump Utility\n");
@@ -93,5 +92,5 @@
 
 	rc = connect_task(task_id);
-	if (rc != EOK) {
+	if (rc < 0) {
 		printf("Failed connecting to task %" PRIu64 ".\n", task_id);
 		return 1;
@@ -106,13 +105,13 @@
 
 	rc = threads_dump();
-	if (rc != EOK)
+	if (rc < 0)
 		printf("Failed dumping threads.\n");
 
 	rc = areas_dump();
-	if (rc != EOK)
+	if (rc < 0)
 		printf("Failed dumping address space areas.\n");
 
 	rc = fibrils_dump(app_symtab, sess);
-	if (rc != EOK)
+	if (rc < 0)
 		printf("Failed dumping fibrils.\n");
 
@@ -123,5 +122,5 @@
 }
 
-static errno_t connect_task(task_id_t task_id)
+static int connect_task(task_id_t task_id)
 {
 	async_sess_t *ksess = async_connect_kbox(task_id);
@@ -141,7 +140,7 @@
 	}
 	
-	errno_t rc = udebug_begin(ksess);
-	if (rc != EOK) {
-		printf("udebug_begin() -> %s\n", str_error_name(rc));
+	int rc = udebug_begin(ksess);
+	if (rc < 0) {
+		printf("udebug_begin() -> %d\n", rc);
 		return rc;
 	}
@@ -211,5 +210,5 @@
 }
 
-static errno_t threads_dump(void)
+static int threads_dump(void)
 {
 	uintptr_t *thash_buf;
@@ -220,10 +219,10 @@
 	size_t needed;
 	size_t i;
-	errno_t rc;
+	int rc;
 
 	/* TODO: See why NULL does not work. */
 	rc = udebug_thread_read(sess, &dummy_buf, 0, &copied, &needed);
-	if (rc != EOK) {
-		printf("udebug_thread_read() -> %s\n", str_error_name(rc));
+	if (rc < 0) {
+		printf("udebug_thread_read() -> %d\n", rc);
 		return rc;
 	}
@@ -238,6 +237,6 @@
 
 	rc = udebug_thread_read(sess, thash_buf, buf_size, &copied, &needed);
-	if (rc != EOK) {
-		printf("udebug_thread_read() -> %s\n", str_error_name(rc));
+	if (rc < 0) {
+		printf("udebug_thread_read() -> %d\n", rc);
 		return rc;
 	}
@@ -261,5 +260,5 @@
 }
 
-static errno_t areas_dump(void)
+static int areas_dump(void)
 {
 	as_area_info_t *ainfo_buf;
@@ -270,9 +269,9 @@
 	size_t needed;
 	size_t i;
-	errno_t rc;
+	int rc;
 
 	rc = udebug_areas_read(sess, &dummy_buf, 0, &copied, &needed);
-	if (rc != EOK) {
-		printf("udebug_areas_read() -> %s\n", str_error_name(rc));
+	if (rc < 0) {
+		printf("udebug_areas_read() -> %d\n", rc);
 		return rc;
 	}
@@ -282,6 +281,6 @@
 
 	rc = udebug_areas_read(sess, ainfo_buf, buf_size, &copied, &needed);
-	if (rc != EOK) {
-		printf("udebug_areas_read() -> %s\n", str_error_name(rc));
+	if (rc < 0) {
+		printf("udebug_areas_read() -> %d\n", rc);
 		return rc;
 	}
@@ -321,10 +320,10 @@
 }
 
-errno_t td_stacktrace(uintptr_t fp, uintptr_t pc)
+int td_stacktrace(uintptr_t fp, uintptr_t pc)
 {
 	uintptr_t nfp;
 	stacktrace_t st;
 	char *sym_pc;
-	errno_t rc;
+	int rc;
 
 	st.op_arg = NULL;
@@ -350,14 +349,14 @@
 }
 
-static errno_t thread_dump(uintptr_t thash)
+static int thread_dump(uintptr_t thash)
 {
 	istate_t istate;
 	uintptr_t pc, fp;
 	char *sym_pc;
-	errno_t rc;
+	int rc;
 
 	rc = udebug_regs_read(sess, thash, &istate);
-	if (rc != EOK) {
-		printf("Failed reading registers: %s.\n", str_error_name(rc));
+	if (rc < 0) {
+		printf("Failed reading registers (%d).\n", rc);
 		return EIO;
 	}
@@ -379,13 +378,13 @@
 }
 
-static errno_t td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value)
+static int td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value)
 {
 	uintptr_t data;
-	errno_t rc;
+	int rc;
 
 	(void) arg;
 
 	rc = udebug_mem_read(sess, &data, addr, sizeof(data));
-	if (rc != EOK) {
+	if (rc < 0) {
 		printf("Warning: udebug_mem_read() failed.\n");
 		return rc;
@@ -400,12 +399,11 @@
 {
 	char *file_name;
-	errno_t rc;
-	int ret;
+	int rc;
 
 	assert(app_name != NULL);
 	assert(app_symtab == NULL);
 
-	ret = asprintf(&file_name, "/app/%s", app_name);
-	if (ret < 0) {
+	rc = asprintf(&file_name, "/app/%s", app_name);
+	if (rc < 0) {
 		printf("Memory allocation failure.\n");
 		exit(1);
@@ -421,6 +419,6 @@
 	free(file_name);
 
-	ret = asprintf(&file_name, "/srv/%s", app_name);
-	if (ret < 0) {
+	rc = asprintf(&file_name, "/srv/%s", app_name);
+	if (rc < 0) {
 		printf("Memory allocation failure.\n");
 		exit(1);
@@ -434,6 +432,6 @@
 	}
 
-	ret = asprintf(&file_name, "/drv/%s/%s", app_name, app_name);
-	if (ret < 0) {
+	rc = asprintf(&file_name, "/drv/%s/%s", app_name, app_name);
+	if (rc < 0) {
 		printf("Memory allocation failure.\n");
 		exit(1);
@@ -456,8 +454,8 @@
 	size_t copied, needed, name_size;
 	char *name;
-	errno_t rc;
+	int rc;
 
 	rc = udebug_name_read(sess, &dummy_buf, 0, &copied, &needed);
-	if (rc != EOK)
+	if (rc < 0)
 		return NULL;
 
@@ -465,5 +463,5 @@
 	name = malloc(name_size + 1);
 	rc = udebug_name_read(sess, name, name_size, &copied, &needed);
-	if (rc != EOK) {
+	if (rc < 0) {
 		free(name);
 		return NULL;
@@ -489,6 +487,5 @@
 	char *name;
 	size_t offs;
-	errno_t rc;
-	int ret;
+	int rc;
 	char *str;
 
@@ -500,10 +497,10 @@
 
 	if (rc == EOK) {
-		ret = asprintf(&str, "%p (%s+%zu)", (void *) addr, name, offs);
+		rc = asprintf(&str, "%p (%s+%zu)", (void *) addr, name, offs);
 	} else {
-		ret = asprintf(&str, "%p", (void *) addr);
-	}
-
-	if (ret < 0) {
+		rc = asprintf(&str, "%p", (void *) addr);
+	}
+
+	if (rc < 0) {
 		printf("Memory allocation error.\n");
 		exit(1);
Index: uspace/app/tester/chardev/chardev1.c
===================================================================
--- uspace/app/tester/chardev/chardev1.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tester/chardev/chardev1.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -28,5 +28,4 @@
 
 #include <errno.h>
-#include <str_error.h>
 #include <ipc/services.h>
 #include <io/chardev.h>
@@ -47,5 +46,5 @@
 	async_sess_t *sess;
 	size_t nbytes;
-	errno_t rc;
+	int rc;
 
 	TPRINTF("Test small transfer character device operations\n");
@@ -99,5 +98,5 @@
 	async_sess_t *sess;
 	size_t nbytes;
-	errno_t rc;
+	int rc;
 
 	TPRINTF("Test large transfer character device operations\n");
@@ -151,5 +150,5 @@
 	async_sess_t *sess;
 	size_t nbytes;
-	errno_t rc;
+	int rc;
 
 	TPRINTF("Test partially-successful character device operations\n");
@@ -178,6 +177,5 @@
 	}
 
-	TPRINTF("Sent %zu bytes and got rc = %s (expected)\n", nbytes,
-	    str_error_name(rc));
+	TPRINTF("Sent %zu bytes and got rc = %d (expected)\n", nbytes, rc);
 
 	rc = chardev_read(chardev, small_buffer, SMALL_BUFFER_SIZE, &nbytes);
@@ -188,6 +186,5 @@
 	}
 
-	TPRINTF("Received %zu bytes and got rc = %s (expected)\n", nbytes,
-	    str_error_name(rc));
+	TPRINTF("Received %zu bytes and got rc = %d (expected)\n", nbytes, rc);
 
 	chardev_close(chardev);
Index: uspace/app/tester/float/float1.c
===================================================================
--- uspace/app/tester/float/float1.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tester/float/float1.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -28,5 +28,4 @@
  */
 
-#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -76,5 +75,5 @@
 	TPRINTF("Creating threads");
 	for (unsigned int i = 0; i < THREADS; i++) {
-		if (thread_create(e, NULL, "e", NULL) != EOK) {
+		if (thread_create(e, NULL, "e", NULL) < 0) {
 			TPRINTF("\nCould not create thread %u\n", i);
 			break;
Index: uspace/app/tester/hw/serial/serial1.c
===================================================================
--- uspace/app/tester/hw/serial/serial1.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tester/hw/serial/serial1.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
 	serial_t *serial;
 	chardev_t *chardev;
-	errno_t rc;
+	int rc;
 	size_t nread;
 	size_t nwritten;
@@ -75,5 +75,5 @@
 	
 	service_id_t svc_id;
-	errno_t res = loc_service_get_id("devices/\\hw\\pci0\\00:01.0\\com1\\a",
+	int res = loc_service_get_id("devices/\\hw\\pci0\\00:01.0\\com1\\a",
 	    &svc_id, IPC_FLAG_BLOCKING);
 	if (res != EOK)
Index: uspace/app/tester/ipc/ping_pong.c
===================================================================
--- uspace/app/tester/ipc/ping_pong.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tester/ipc/ping_pong.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,5 +55,5 @@
 		size_t i;
 		for (i = 0; i < COUNT_GRANULARITY; i++) {
-			errno_t retval = ns_ping();
+			int retval = ns_ping();
 			
 			if (retval != EOK) {
Index: uspace/app/tester/mm/common.c
===================================================================
--- uspace/app/tester/mm/common.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tester/mm/common.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -371,5 +371,5 @@
 	
 	/* Free the memory */
-	errno_t ret = as_area_destroy(area->addr);
+	int ret = as_area_destroy(area->addr);
 	if (ret != EOK)
 		error_flag = true;
Index: uspace/app/tester/mm/mapping1.c
===================================================================
--- uspace/app/tester/mm/mapping1.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tester/mm/mapping1.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -30,5 +30,4 @@
 #include <stdlib.h>
 #include <stddef.h>
-#include <str_error.h>
 #include <as.h>
 #include <errno.h>
@@ -66,5 +65,5 @@
     verify_mapping((area), (page_count), (expected_rc), #expected_rc)
 
-static bool verify_mapping(void *area, int page_count, errno_t expected_rc,
+static bool verify_mapping(void *area, int page_count, int expected_rc,
     const char *expected_rc_str)
 {
@@ -73,8 +72,8 @@
 	for (i = 0; i < page_count; i++) {
 		void *page_start = ((char *) area) + PAGE_SIZE * i;
-		errno_t rc = as_get_physical_mapping(page_start, NULL);
+		int rc = as_get_physical_mapping(page_start, NULL);
 		if (rc != expected_rc) {
-			TPRINTF("as_get_physical_mapping() = %s != %s\n",
-			    str_error_name(rc), str_error_name(expected_rc));
+			TPRINTF("as_get_physical_mapping() = %d != %d\n",
+			    rc, expected_rc);
 			return false;
 		}
@@ -85,5 +84,5 @@
 const char *test_mapping1(void)
 {
-	errno_t rc;
+	int rc;
 	
 	size_t buffer1_len = BUFFER1_PAGES * PAGE_SIZE;
Index: uspace/app/tester/mm/pager1.c
===================================================================
--- uspace/app/tester/mm/pager1.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tester/mm/pager1.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,11 +45,11 @@
 {
 	size_t nwr;
-	errno_t rc;
+	int rc;
 
 	TPRINTF("Creating temporary file...\n");
 
-	rc = vfs_lookup_open(TEST_FILE, WALK_REGULAR | WALK_MAY_CREATE,
-	    MODE_READ | MODE_WRITE, &fd);
-	if (rc != EOK)
+	fd = vfs_lookup_open(TEST_FILE, WALK_REGULAR | WALK_MAY_CREATE,
+	    MODE_READ | MODE_WRITE);
+	if (fd < 0)
 		return NULL;
 	(void) vfs_unlink_path(TEST_FILE);
Index: uspace/app/tester/print/print5.c
===================================================================
--- uspace/app/tester/print/print5.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tester/print/print5.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,5 @@
  *
  */
-#define _HELENOS_NVERIFY_PRINTF
+#define NVERIFY_PRINTF
 
 #include <stdio.h>
Index: uspace/app/tester/thread/thread1.c
===================================================================
--- uspace/app/tester/thread/thread1.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tester/thread/thread1.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -32,5 +32,4 @@
 
 #include <atomic.h>
-#include <errno.h>
 #include <thread.h>
 #include <stdio.h>
@@ -62,5 +61,5 @@
 	TPRINTF("Creating threads");
 	for (i = 0; i < THREADS; i++) {
-		if (thread_create(threadtest, NULL, "threadtest", NULL) != EOK) {
+		if (thread_create(threadtest, NULL, "threadtest", NULL) < 0) {
 			TPRINTF("\nCould not create thread %u\n", i);
 			break;
Index: uspace/app/tester/vfs/vfs1.c
===================================================================
--- uspace/app/tester/vfs/vfs1.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tester/vfs/vfs1.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -31,5 +31,4 @@
 #include <stdlib.h>
 #include <stddef.h>
-#include <str_error.h>
 #include <str.h>
 #include <vfs/vfs.h>
@@ -69,17 +68,16 @@
 {
 	aoff64_t pos = 0;
-	errno_t rc;
+	int rc;
 
 	rc = vfs_link_path(TEST_DIRECTORY, KIND_DIRECTORY, NULL);
 	if (rc != EOK) {
-		TPRINTF("rc=%s\n", str_error_name(rc));
+		TPRINTF("rc=%d\n", rc);
 		return "vfs_link_path() failed";
 	}
 	TPRINTF("Created directory %s\n", TEST_DIRECTORY);
 	
-	int fd0;
-	rc = vfs_lookup_open(TEST_FILE, WALK_REGULAR | WALK_MAY_CREATE,
-	    MODE_READ | MODE_WRITE, &fd0);
-	if (rc != EOK)
+	int fd0 = vfs_lookup_open(TEST_FILE, WALK_REGULAR | WALK_MAY_CREATE,
+	    MODE_READ | MODE_WRITE);
+	if (fd0 < 0)
 		return "vfs_lookup_open() failed";
 	TPRINTF("Created file %s (fd=%d)\n", TEST_FILE, fd0);
@@ -97,5 +95,5 @@
 	TPRINTF("read..\n");
 	while ((rc = vfs_read(fd0, &pos, buf, BUF_SIZE, &cnt))) {
-		TPRINTF("read returns rc = %s, cnt = %zu\n", str_error_name(rc), cnt);
+		TPRINTF("read returns rc = %d, cnt = %zu\n", rc, cnt);
 		if (rc != EOK)
 			return "read() failed";
Index: uspace/app/testread/testread.c
===================================================================
--- uspace/app/testread/testread.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/testread/testread.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,5 +58,4 @@
 #include <time.h>
 #include <offset.h>
-#include <str.h>
 
 #define NAME	"testread"
Index: uspace/app/testwrit/testwrit.c
===================================================================
--- uspace/app/testwrit/testwrit.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/testwrit/testwrit.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -33,5 +33,4 @@
 #include <stdio.h>
 #include <stddef.h>
-#include <str.h>
 
 #define BUF_SIZE  1024
Index: uspace/app/tetris/scores.c
===================================================================
--- uspace/app/tetris/scores.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tetris/scores.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -205,5 +205,5 @@
 }
 
-errno_t loadscores(void)
+int loadscores(void)
 {
 	FILE *f;
Index: uspace/app/tetris/scores.h
===================================================================
--- uspace/app/tetris/scores.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tetris/scores.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -72,5 +72,5 @@
 extern void initscores(void);
 extern void insertscore(int score, int level);
-extern errno_t loadscores(void);
+extern int loadscores(void);
 extern void savescores(void);
 
Index: uspace/app/tetris/screen.c
===================================================================
--- uspace/app/tetris/screen.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tetris/screen.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -138,5 +138,5 @@
 winsize_t winsize;
 
-static errno_t get_display_size(winsize_t *ws)
+static int get_display_size(winsize_t *ws)
 {
 	return console_get_size(console, &ws->ws_col, &ws->ws_row);
@@ -146,7 +146,7 @@
 {
 	sysarg_t ccap;
-	errno_t rc = console_get_color_cap(console, &ccap);
-	
-	if (rc != EOK)
+	int rc = console_get_color_cap(console, &ccap);
+	
+	if (rc != 0)
 		return false;
 	
Index: uspace/app/tetris/tetris.c
===================================================================
--- uspace/app/tetris/tetris.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/tetris/tetris.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -156,7 +156,7 @@
 const struct shape *randshape(void)
 {
-	const struct shape *tmp = &shapes[rand() % 7];
+	const struct shape *tmp = &shapes[random() % 7];
 	int i;
-	int j = rand() % 4;
+	int j = random() % 4;
 	
 	for (i = 0; i < j; i++)
@@ -171,5 +171,5 @@
 	
 	gettimeofday(&tv, NULL);
-	srand(tv.tv_sec + tv.tv_usec / 100000);
+	srandom(tv.tv_sec + tv.tv_usec / 100000);
 }
 
Index: uspace/app/top/screen.c
===================================================================
--- uspace/app/top/screen.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/top/screen.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,4 @@
 #include <inttypes.h>
 #include <macros.h>
-#include <str.h>
 #include "screen.h"
 #include "top.h"
Index: uspace/app/top/screen.h
===================================================================
--- uspace/app/top/screen.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/top/screen.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,5 @@
 extern void print_data(data_t *);
 extern void show_warning(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
+    PRINTF_ATTRIBUTE(1, 2);
 
 extern int tgetchar(unsigned int);
Index: uspace/app/top/top.c
===================================================================
--- uspace/app/top/top.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/top/top.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,4 @@
 #include <errno.h>
 #include <gsort.h>
-#include <str.h>
 #include "screen.h"
 #include "top.h"
Index: uspace/app/trace/Makefile
===================================================================
--- uspace/app/trace/Makefile	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/trace/Makefile	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,6 @@
 	ipcp.c \
 	ipc_desc.c \
-	proto.c
+	proto.c \
+	errors.c
 
 include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/trace/errors.c
===================================================================
--- uspace/app/trace/errors.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/app/trace/errors.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2008 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup trace
+ * @{
+ */
+/** @file
+ */
+
+#include <errno.h>
+#include "errors.h"
+
+const err_desc_t err_desc[] = {
+	[-EOK]		= { "EOK",		"No error" },
+	[-ENOENT]	= { "ENOENT",		"No such entry" },
+	[-ENOMEM]	= { "ENOMEM",		"Not enough memory" },
+	[-ELIMIT]	= { "ELIMIT",		"Limit exceeded" },
+	[-EREFUSED]	= { "EREFUSED",		"Connection refused" },
+
+	[-EFORWARD]	= { "EFORWARD",		"Forward error" },
+	[-EPERM]	= { "EPERM",		"Permission denied" },
+	[-EHANGUP]	= { "EHANGUP",		"Answerbox closed connection" },
+	[-EEXIST]	= { "EEXIST",		"Entry already exists" },
+	[-EBADMEM]	= { "EBADMEM",		"Bad memory pointer" },
+
+	[-ENOTSUP]	= { "ENOTSUP",		"Not supported" },
+	[-EADDRNOTAVAIL] = { "EADDRNOTAVAIL", 	"Address not available." },
+	[-ETIMEOUT]	= { "ETIMEOUT",		"Timeout expired" },
+	[-EINVAL]	= { "EINVAL",		"Invalid value" },
+	[-EBUSY]	= { "EBUSY",		"Resource is busy" },
+
+	[-EOVERFLOW]	= { "EOVERFLOW",	"The result does not fit its size." }
+};
+
+/** @}
+ */
Index: uspace/app/trace/errors.h
===================================================================
--- uspace/app/trace/errors.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/app/trace/errors.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2008 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup trace
+ * @{
+ */
+/** @file
+ */
+
+#ifndef ERRORS_H_
+#define ERRORS_H_
+
+typedef struct {
+	const char *name;  /**< Error value name (Exx) */
+	const char *desc;  /**< Error description */
+} err_desc_t;
+
+extern const err_desc_t err_desc[];
+
+#endif
+
+/** @}
+ */
Index: uspace/app/trace/ipcp.c
===================================================================
--- uspace/app/trace/ipcp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/trace/ipcp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,5 +35,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str_error.h>
 #include <inttypes.h>
 #include <adt/hash_table.h>
@@ -250,5 +249,5 @@
 	sysarg_t method;
 	sysarg_t service;
-	errno_t retval;
+	sysarg_t retval;
 	proto_t *proto;
 	int cphone;
@@ -265,7 +264,7 @@
 	
 	if ((display_mask & DM_IPC) != 0) {
-		printf("Response to %d: retval=%s, args = (%" PRIun ", "
+		printf("Response to %d: retval=%" PRIdn ", args = (%" PRIun ", "
 		    "%" PRIun ", %" PRIun ", %" PRIun ", %" PRIun ")\n",
-		    hash, str_error_name(retval), IPC_GET_ARG1(*answer),
+		    hash, retval, IPC_GET_ARG1(*answer),
 		    IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer),
 		    IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
@@ -281,5 +280,5 @@
 			if (oper->rv_type != V_VOID) {
 				putchar(' ');
-				val_print((sysarg_t) retval, oper->rv_type);
+				val_print(retval, oper->rv_type);
 			}
 			
@@ -345,8 +344,8 @@
 }
 
-void ipcp_hangup(int phone, errno_t rc)
+void ipcp_hangup(int phone, int rc)
 {
 	if ((display_mask & DM_SYSTEM) != 0) {
-		printf("Hang phone %d up -> %s\n", phone, str_error_name(rc));
+		printf("Hang phone %d up -> %d\n", phone, rc);
 		ipcp_connection_clear(phone);
 	}
Index: uspace/app/trace/ipcp.h
===================================================================
--- uspace/app/trace/ipcp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/trace/ipcp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,5 @@
 void ipcp_call_sync(int phone, ipc_call_t *call, ipc_call_t *answer);
 void ipcp_call_in(ipc_call_t *call, ipc_callid_t hash);
-void ipcp_hangup(int phone, errno_t rc);
+void ipcp_hangup(int phone, int rc);
 
 void ipcp_connection_set(int phone, int server, proto_t *proto);
Index: uspace/app/trace/trace.c
===================================================================
--- uspace/app/trace/trace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/trace/trace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -63,4 +63,5 @@
 #include "syscalls.h"
 #include "ipcp.h"
+#include "errors.h"
 #include "trace.h"
 
@@ -93,6 +94,6 @@
 display_mask_t display_mask;
 
-static errno_t program_run_fibril(void *arg);
-static errno_t cev_fibril(void *arg);
+static int program_run_fibril(void *arg);
+static int cev_fibril(void *arg);
 
 static void program_run(void)
@@ -122,7 +123,7 @@
 }
 
-static errno_t program_run_fibril(void *arg)
-{
-	errno_t rc;
+static int program_run_fibril(void *arg)
+{
+	int rc;
 
 	/*
@@ -131,5 +132,5 @@
 	 */
 	rc = loader_run(task_ldr);
-	if (rc != EOK) {
+	if (rc != 0) {
 		printf("Error running program\n");
 		exit(1);
@@ -143,5 +144,5 @@
 
 
-static errno_t connect_task(task_id_t task_id)
+static int connect_task(task_id_t task_id)
 {
 	async_sess_t *ksess = async_connect_kbox(task_id);
@@ -161,13 +162,13 @@
 	}
 	
-	errno_t rc = udebug_begin(ksess);
-	if (rc != EOK) {
-		printf("udebug_begin() -> %s\n", str_error_name(rc));
+	int rc = udebug_begin(ksess);
+	if (rc < 0) {
+		printf("udebug_begin() -> %d\n", rc);
 		return rc;
 	}
 	
 	rc = udebug_set_evmask(ksess, UDEBUG_EM_ALL);
-	if (rc != EOK) {
-		printf("udebug_set_evmask(0x%x) -> %s\n ", UDEBUG_EM_ALL, str_error_name(rc));
+	if (rc < 0) {
+		printf("udebug_set_evmask(0x%x) -> %d\n ", UDEBUG_EM_ALL, rc);
 		return rc;
 	}
@@ -177,7 +178,7 @@
 }
 
-static errno_t get_thread_list(void)
-{
-	errno_t rc;
+static int get_thread_list(void)
+{
+	int rc;
 	size_t tb_copied;
 	size_t tb_needed;
@@ -186,6 +187,6 @@
 	rc = udebug_thread_read(sess, thread_hash_buf,
 		THBUF_SIZE*sizeof(unsigned), &tb_copied, &tb_needed);
-	if (rc != EOK) {
-		printf("udebug_thread_read() -> %s\n", str_error_name(rc));
+	if (rc < 0) {
+		printf("udebug_thread_read() -> %d\n", rc);
 		return rc;
 	}
@@ -225,6 +226,6 @@
 		if (sval >= -15 && sval <= 0) {
 			printf("%ld %s (%s)", sval,
-			    str_error_name((errno_t) sval),
-			    str_error((errno_t) sval));
+			    err_desc[-sval].name,
+			    err_desc[-sval].desc);
 		} else {
 			printf("%ld", sval);
@@ -234,6 +235,6 @@
 		if (sval >= -15 && sval < 0) {
 			printf("%ld %s (%s)", sval,
-			    str_error_name((errno_t) sval),
-			    str_error((errno_t) sval));
+			    err_desc[-sval].name,
+			    err_desc[-sval].desc);
 		} else {
 			printf("%ld", sval);
@@ -279,10 +280,10 @@
 }
 
-static void sc_ipc_call_async_fast(sysarg_t *sc_args, errno_t sc_rc)
+static void sc_ipc_call_async_fast(sysarg_t *sc_args, sysarg_t sc_rc)
 {
 	ipc_call_t call;
 	sysarg_t phoneid;
 	
-	if (sc_rc != EOK)
+	if (sc_rc != (sysarg_t) EOK)
 		return;
 
@@ -296,13 +297,13 @@
 	IPC_SET_ARG5(call, 0);
 
-	ipcp_call_out(phoneid, &call, 0);
-}
-
-static void sc_ipc_call_async_slow(sysarg_t *sc_args, errno_t sc_rc)
+	ipcp_call_out(phoneid, &call, sc_rc);
+}
+
+static void sc_ipc_call_async_slow(sysarg_t *sc_args, sysarg_t sc_rc)
 {
 	ipc_call_t call;
-	errno_t rc;
-
-	if (sc_rc != EOK)
+	int rc;
+
+	if (sc_rc != (sysarg_t) EOK)
 		return;
 
@@ -310,6 +311,6 @@
 	rc = udebug_mem_read(sess, &call.args, sc_args[1], sizeof(call.args));
 
-	if (rc == EOK) {
-		ipcp_call_out(sc_args[0], &call, 0);
+	if (rc >= 0) {
+		ipcp_call_out(sc_args[0], &call, sc_rc);
 	}
 }
@@ -318,5 +319,5 @@
 {
 	ipc_call_t call;
-	errno_t rc;
+	int rc;
 
 	if (sc_rc == 0) return;
@@ -325,5 +326,5 @@
 	rc = udebug_mem_read(sess, &call, sc_args[0], sizeof(call));
 	
-	if (rc == EOK)
+	if (rc >= 0)
 		ipcp_call_in(&call, sc_rc);
 }
@@ -333,10 +334,10 @@
 {
 	sysarg_t sc_args[6];
-	errno_t rc;
+	int rc;
 
 	/* Read syscall arguments */
 	rc = udebug_args_read(sess, thread_hash, sc_args);
 
-	if (rc != EOK) {
+	if (rc < 0) {
 		printf("error\n");
 		return;
@@ -361,5 +362,5 @@
 	sysarg_t sc_args[6];
 	int rv_type;
-	errno_t rc;
+	int rc;
 
 	/* Read syscall arguments */
@@ -368,5 +369,5 @@
 //	printf("[%d] ", thread_id);
 
-	if (rc != EOK) {
+	if (rc < 0) {
 		printf("error\n");
 		return;
@@ -384,8 +385,8 @@
 	switch (sc_id) {
 	case SYS_IPC_CALL_ASYNC_FAST:
-		sc_ipc_call_async_fast(sc_args, (errno_t) sc_rc);
+		sc_ipc_call_async_fast(sc_args, sc_rc);
 		break;
 	case SYS_IPC_CALL_ASYNC_SLOW:
-		sc_ipc_call_async_slow(sc_args, (errno_t) sc_rc);
+		sc_ipc_call_async_slow(sc_args, sc_rc);
 		break;
 	case SYS_IPC_WAIT:
@@ -403,7 +404,7 @@
 }
 
-static errno_t trace_loop(void *thread_hash_arg)
-{
-	errno_t rc;
+static int trace_loop(void *thread_hash_arg)
+{
+	int rc;
 	unsigned ev_type;
 	uintptr_t thread_hash;
@@ -445,5 +446,5 @@
 		}
 
-		if (rc == EOK) {
+		if (rc >= 0) {
 			switch (ev_type) {
 			case UDEBUG_EVENT_SYSCALL_B:
@@ -498,5 +499,5 @@
 {
 	loader_t *ldr;
-	errno_t rc;
+	int rc;
 
 	/* Spawn a program loader */
@@ -566,5 +567,5 @@
 }
 
-static errno_t cev_fibril(void *arg)
+static int cev_fibril(void *arg)
 {
 	cons_event_t event;
@@ -581,5 +582,5 @@
 		
 		if (!console_get_event(console, &event))
-			return EINVAL;
+			return -1;
 		
 		if (event.type == CEV_KEY) {
@@ -598,11 +599,11 @@
 	bool done;
 	int i;
-	errno_t rc;
+	int rc;
 
 	ipcp_init();
 
 	rc = get_thread_list();
-	if (rc != EOK) {
-		printf("Failed to get thread list (%s)\n", str_error(rc));
+	if (rc < 0) {
+		printf("Failed to get thread list (error %d)\n", rc);
 		return;
 	}
@@ -643,5 +644,5 @@
 			rc = udebug_stop(sess, thash);
 			if (rc != EOK)
-				printf("Error: stop -> %s\n", str_error_name(rc));
+				printf("Error: stop -> %d\n", rc);
 			break;
 		case KC_R:
@@ -844,5 +845,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 	task_exit_t texit;
 	int retval;
@@ -859,5 +860,5 @@
 
 	rc = connect_task(task_id);
-	if (rc != EOK) {
+	if (rc < 0) {
 		printf("Failed connecting to task %" PRIu64 ".\n", task_id);
 		return 1;
Index: uspace/app/untar/main.c
===================================================================
--- uspace/app/untar/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/untar/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,5 @@
 }
 
-static errno_t skip_blocks(FILE *tarfile, size_t valid_data_size)
+static int skip_blocks(FILE *tarfile, size_t valid_data_size)
 {
 	size_t blocks_to_read = get_block_count(valid_data_size);
@@ -58,5 +58,5 @@
 }
 
-static errno_t handle_normal_file(const tar_header_t *header, FILE *tarfile)
+static int handle_normal_file(const tar_header_t *header, FILE *tarfile)
 {
 	// FIXME: create the directory first
@@ -69,5 +69,5 @@
 	}
 
-	errno_t rc = EOK;
+	int rc = EOK;
 	size_t bytes_remaining = header->size;
 	size_t blocks = get_block_count(bytes_remaining);
@@ -101,7 +101,7 @@
 }
 
-static errno_t handle_directory(const tar_header_t *header, FILE *tarfile)
+static int handle_directory(const tar_header_t *header, FILE *tarfile)
 {
-	errno_t rc;
+	int rc;
 
 	rc = vfs_link_path(header->filename, KIND_DIRECTORY, NULL);
@@ -140,5 +140,5 @@
 			break;
 		}
-		errno_t rc = tar_header_parse(&header, &header_raw);
+		int rc = tar_header_parse(&header, &header_raw);
 		if (rc == EEMPTY) {
 			continue;
Index: uspace/app/untar/tar.c
===================================================================
--- uspace/app/untar/tar.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/untar/tar.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -67,7 +67,7 @@
 }
 
-errno_t tar_header_parse(tar_header_t *parsed, const tar_header_raw_t *raw)
+int tar_header_parse(tar_header_t *parsed, const tar_header_raw_t *raw)
 {
-	errno_t rc;
+	int rc;
 
 	if (str_length(raw->filename) == 0) {
Index: uspace/app/untar/tar.h
===================================================================
--- uspace/app/untar/tar.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/untar/tar.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -70,5 +70,5 @@
 
 
-extern errno_t tar_header_parse(tar_header_t *, const tar_header_raw_t *);
+extern int tar_header_parse(tar_header_t *, const tar_header_raw_t *);
 extern tar_type_t tar_type_parse(const char);
 extern const char *tar_type_str(tar_type_t);
Index: uspace/app/usbinfo/hid.c
===================================================================
--- uspace/app/usbinfo/hid.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/usbinfo/hid.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -136,5 +136,5 @@
 
 	size_t actual_report_size;
-	errno_t rc = usb_request_get_descriptor(ctrl_pipe,
+	int rc = usb_request_get_descriptor(ctrl_pipe,
 	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE,
 	    USB_DESCTYPE_HID_REPORT, 0, iface_no,
Index: uspace/app/usbinfo/info.c
===================================================================
--- uspace/app/usbinfo/info.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/usbinfo/info.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -313,5 +313,5 @@
 	l18_win_locales_t *langs;
 	size_t langs_count;
-	errno_t rc = usb_request_get_supported_languages(
+	int rc = usb_request_get_supported_languages(
 	    usb_device_get_default_pipe(usb_dev), &langs, &langs_count);
 	if (rc != EOK) {
@@ -362,5 +362,5 @@
 void dump_status(usb_device_t *usb_dev)
 {
-	errno_t rc;
+	int rc;
 	uint16_t status = 0;
 
Index: uspace/app/usbinfo/list.c
===================================================================
--- uspace/app/usbinfo/list.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/usbinfo/list.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,4 @@
 #include <loc.h>
 #include <usb_iface.h>
-#include <str.h>
 
 #include "usbinfo.h"
@@ -54,5 +53,5 @@
 {
 	char path[MAX_PATH_LENGTH];
-	errno_t rc = devman_fun_get_path(handle, path, MAX_PATH_LENGTH);
+	int rc = devman_fun_get_path(handle, path, MAX_PATH_LENGTH);
 	if (rc != EOK) {
 		printf(NAME "Failed to get path for device %"PRIun"\n", handle);
@@ -65,5 +64,5 @@
 {
 	devman_handle_t hc_handle = 0;
-	errno_t rc = devman_fun_sid_to_handle(svc, &hc_handle);
+	int rc = devman_fun_sid_to_handle(svc, &hc_handle);
 	if (rc != EOK) {
 		printf(NAME ": Error resolving handle of HC with SID %"
@@ -134,5 +133,5 @@
 	service_id_t *svcs;
 	size_t count;
-	errno_t rc;
+	int rc;
 
 	rc = loc_category_get_id(USB_HC_CATEGORY, &usbhc_cat, 0);
Index: uspace/app/usbinfo/main.c
===================================================================
--- uspace/app/usbinfo/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/usbinfo/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -198,5 +198,5 @@
 		/* The initialization is here only to make compiler happy. */
 		devman_handle_t handle = 0;
-		errno_t rc = usb_resolve_device_handle(devpath, &handle);
+		int rc = usb_resolve_device_handle(devpath, &handle);
 		if (rc != EOK) {
 			fprintf(stderr, NAME ": device `%s' not found "
Index: uspace/app/usbinfo/usbinfo.h
===================================================================
--- uspace/app/usbinfo/usbinfo.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/usbinfo/usbinfo.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
 extern void dump_descriptor_tree(uint8_t *, size_t);
 
-static inline void internal_error(errno_t err)
+static inline void internal_error(int err)
 {
 	fprintf(stderr, NAME ": internal error (%s).\n", str_error(err));
Index: uspace/app/viewer/viewer.c
===================================================================
--- uspace/app/viewer/viewer.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/viewer/viewer.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,4 @@
 #include <codec/tga.h>
 #include <task.h>
-#include <str.h>
 
 #define NAME  "viewer"
@@ -110,11 +109,10 @@
 static bool img_load(const char *fname, surface_t **p_local_surface)
 {
-	int fd;
-	errno_t rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK)
-		return false;
-	
-	vfs_stat_t stat;
-	rc = vfs_stat(fd, &stat);
+	int fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ);
+	if (fd < 0)
+		return false;
+	
+	struct stat stat;
+	int rc = vfs_stat(fd, &stat);
 	if (rc != EOK) {
 		vfs_put(fd);
Index: uspace/app/vlaunch/vlaunch.c
===================================================================
--- uspace/app/vlaunch/vlaunch.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/vlaunch/vlaunch.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -66,5 +66,5 @@
 	task_id_t id;
 	task_wait_t wait;
-	errno_t rc = task_spawnl(&id, &wait, app, app, winreg, NULL);
+	int rc = task_spawnl(&id, &wait, app, app, winreg, NULL);
 	if (rc != EOK) {
 		printf("%s: Error spawning %s %s (%s)\n", NAME, app,
Index: uspace/app/vuhid/device.c
===================================================================
--- uspace/app/vuhid/device.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/vuhid/device.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 #include <usb/classes/classes.h>
 
-static errno_t on_data_from_device(usbvirt_device_t *dev,
+static int on_data_from_device(usbvirt_device_t *dev,
     usb_endpoint_t ep, usb_transfer_type_t tr_type,
     void *data, size_t data_size, size_t *actual_size)
@@ -58,5 +58,5 @@
 }
 
-static errno_t on_data_to_device(usbvirt_device_t *dev,
+static int on_data_to_device(usbvirt_device_t *dev,
     usb_endpoint_t ep, usb_transfer_type_t tr_type,
     const void *data, size_t data_size)
@@ -75,5 +75,5 @@
 }
 
-static errno_t interface_life_fibril(void *arg)
+static int interface_life_fibril(void *arg)
 {
 	vuhid_interface_t *iface = arg;
@@ -109,5 +109,5 @@
 }
 
-errno_t add_interface_by_id(vuhid_interface_t **interfaces, const char *id,
+int add_interface_by_id(vuhid_interface_t **interfaces, const char *id,
     usbvirt_device_t *dev)
 {
@@ -161,5 +161,5 @@
 
 	/* From now on, in case of errors, we goto to error_leave */
-	errno_t rc;
+	int rc;
 
 	/*
Index: uspace/app/vuhid/hids/bootkbd.c
===================================================================
--- uspace/app/vuhid/hids/bootkbd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/vuhid/hids/bootkbd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -101,5 +101,5 @@
 };
 
-static errno_t on_data_out(vuhid_interface_t *iface,
+static int on_data_out(vuhid_interface_t *iface,
     const void *buffer, size_t buffer_size)
 {
Index: uspace/app/vuhid/life.c
===================================================================
--- uspace/app/vuhid/life.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/vuhid/life.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
 
 
-errno_t interface_live_on_data_in(vuhid_interface_t *iface,
+int interface_live_on_data_in(vuhid_interface_t *iface,
     void *buffer, size_t buffer_size, size_t *act_buffer_size)
 {
Index: uspace/app/vuhid/main.c
===================================================================
--- uspace/app/vuhid/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/vuhid/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -216,5 +216,5 @@
 	/* Determine which interfaces to initialize. */
 	for (int i = optind; i < argc; i++) {
-		errno_t rc = add_interface_by_id(available_hid_interfaces, argv[i],
+		int rc = add_interface_by_id(available_hid_interfaces, argv[i],
 		    &hid_dev);
 		if (rc != EOK) {
@@ -234,5 +234,5 @@
 	}
 
-	const errno_t rc = usbvirt_device_plug(&hid_dev, controller);
+	const int rc = usbvirt_device_plug(&hid_dev, controller);
 	if (rc != EOK) {
 		printf("Unable to start communication with VHCD `%s': %s.\n",
Index: uspace/app/vuhid/stdreq.c
===================================================================
--- uspace/app/vuhid/stdreq.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/vuhid/stdreq.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 	vuhid_data_t *vuhid = device->device_data
 
-errno_t req_get_descriptor(usbvirt_device_t *device,
+int req_get_descriptor(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -70,5 +70,5 @@
 }
 
-errno_t req_set_protocol(usbvirt_device_t *device,
+int req_set_protocol(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -89,5 +89,5 @@
 }
 
-errno_t req_set_report(usbvirt_device_t *device,
+int req_set_report(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -109,5 +109,5 @@
 
 	/* SET_REPORT is translated to data out */
-	errno_t rc = iface->on_data_out(iface, data, data_length);
+	int rc = iface->on_data_out(iface, data, data_length);
 
 	return rc;
Index: uspace/app/vuhid/stdreq.h
===================================================================
--- uspace/app/vuhid/stdreq.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/vuhid/stdreq.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,13 +38,13 @@
 #include <usbvirt/device.h>
 
-errno_t req_get_descriptor(usbvirt_device_t *device,
+int req_get_descriptor(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size);
 
-errno_t req_set_protocol(usbvirt_device_t *device,
+int req_set_protocol(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size);
 
-errno_t req_set_report(usbvirt_device_t *device,
+int req_set_report(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size);
Index: uspace/app/vuhid/virthid.h
===================================================================
--- uspace/app/vuhid/virthid.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/vuhid/virthid.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -70,6 +70,6 @@
 	size_t out_data_size;
 
-	errno_t (*on_data_in)(vuhid_interface_t *, void *, size_t, size_t *);
-	errno_t (*on_data_out)(vuhid_interface_t *, const void *, size_t);
+	int (*on_data_in)(vuhid_interface_t *, void *, size_t, size_t *);
+	int (*on_data_out)(vuhid_interface_t *, const void *, size_t);
 	void (*live)(vuhid_interface_t *);
 
@@ -114,9 +114,9 @@
 } __attribute__ ((packed)) hid_descriptor_t;
 
-errno_t add_interface_by_id(vuhid_interface_t **, const char *, usbvirt_device_t *);
+int add_interface_by_id(vuhid_interface_t **, const char *, usbvirt_device_t *);
 void wait_for_interfaces_death(usbvirt_device_t *);
 
 void interface_life_live(vuhid_interface_t *);
-errno_t interface_live_on_data_in(vuhid_interface_t *, void *, size_t, size_t *);
+int interface_live_on_data_in(vuhid_interface_t *, void *, size_t, size_t *);
 
 
Index: uspace/app/wavplay/dplay.c
===================================================================
--- uspace/app/wavplay/dplay.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/wavplay/dplay.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -148,5 +148,5 @@
 	const size_t fragment_size = pb->buffer.size / DEFAULT_FRAGMENTS;
 	printf("Registering event callback\n");
-	errno_t ret = audio_pcm_register_event_callback(pb->device,
+	int ret = audio_pcm_register_event_callback(pb->device,
 	    device_event_callback, pb);
 	if (ret != EOK) {
@@ -282,5 +282,5 @@
 
 		if (!started) {
-			errno_t ret = audio_pcm_start_playback(pb->device,
+			int ret = audio_pcm_start_playback(pb->device,
 			    pb->f.channels, pb->f.sampling_rate,
 			    pb->f.sample_format);
@@ -309,5 +309,5 @@
 			async_usleep(real_delay);
 		/* update buffer position */
-		const errno_t ret = audio_pcm_get_buffer_pos(pb->device, &pos);
+		const int ret = audio_pcm_get_buffer_pos(pb->device, &pos);
 		if (ret != EOK) {
 			printf("Failed to update position indicator %s\n",
@@ -329,9 +329,9 @@
  * @param device The device.
  * @param file The file.
- * @return 0 on success, non-zero on failure.
+ * @return Error code.
  */
 int dplay(const char *device, const char *file)
 {
-	errno_t ret = EOK;
+	int ret = EOK;
 	audio_pcm_sess_t *session = NULL;
 	if (str_cmp(device, "default") == 0) {
@@ -345,7 +345,5 @@
 	}
 	printf("Playing on device: %s.\n", device);
-	sysarg_t val;
-	ret = audio_pcm_query_cap(session, AUDIO_CAP_PLAYBACK, &val);
-	if (ret != EOK || !val) {
+	if (audio_pcm_query_cap(session, AUDIO_CAP_PLAYBACK) <= 0) {
 		printf("Device %s does not support playback\n", device);
 		ret = ENOTSUP;
@@ -353,5 +351,5 @@
 	}
 
-	char* info = NULL;
+	const char* info = NULL;
 	ret = audio_pcm_get_info_str(session, &info);
 	if (ret != EOK) {
@@ -388,10 +386,8 @@
 		goto cleanup;
 	}
-	ret = audio_pcm_query_cap(pb.device, AUDIO_CAP_BUFFER_POS, &val);
-	if (ret == EOK && val) {
+	if (audio_pcm_query_cap(pb.device, AUDIO_CAP_BUFFER_POS) > 0) {
 		play(&pb);
 	} else {
-		ret = audio_pcm_query_cap(pb.device, AUDIO_CAP_INTERRUPT, &val);
-		if (ret == EOK && val)
+		if (audio_pcm_query_cap(pb.device, AUDIO_CAP_INTERRUPT) > 0)
 			play_fragment(&pb);
 		else
Index: uspace/app/wavplay/drec.c
===================================================================
--- uspace/app/wavplay/drec.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/wavplay/drec.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,4 @@
 #include <as.h>
 #include <inttypes.h>
-#include <str.h>
 
 #include "wave.h"
@@ -140,5 +139,5 @@
 	assert(rec);
 	assert(rec->device);
-	errno_t ret = audio_pcm_register_event_callback(rec->device,
+	int ret = audio_pcm_register_event_callback(rec->device,
 	    device_event_callback, rec);
 	if (ret != EOK) {
@@ -171,11 +170,10 @@
  * @param device The device.
  * @param file The file.
- * @return 0 on succes, non-zero on failure.
+ * @return Error code.
  */
 int drecord(const char *device, const char *file)
 {
-	errno_t ret = EOK;
+	int ret = EOK;
 	audio_pcm_sess_t *session = NULL;
-	sysarg_t val;
 	if (str_cmp(device, "default") == 0) {
 		session = audio_pcm_open_default();
@@ -188,6 +186,5 @@
 	}
 	printf("Recording on device: %s.\n", device);
-	ret = audio_pcm_query_cap(session, AUDIO_CAP_CAPTURE, &val);
-	if (ret != EOK || !val) {
+	if (audio_pcm_query_cap(session, AUDIO_CAP_CAPTURE) <= 0) {
 		printf("Device %s does not support recording\n", device);
 		ret = ENOTSUP;
@@ -195,5 +192,5 @@
 	}
 
-	char* info = NULL;
+	const char* info = NULL;
 	ret = audio_pcm_get_info_str(session, &info);
 	if (ret != EOK) {
@@ -228,6 +225,5 @@
 		goto cleanup;
 	}
-	ret = audio_pcm_query_cap(rec.device, AUDIO_CAP_INTERRUPT, &val);
-	if (ret == EOK && val)
+	if (audio_pcm_query_cap(rec.device, AUDIO_CAP_INTERRUPT) > 0)
 		record_fragment(&rec, format);
 	else
Index: uspace/app/wavplay/main.c
===================================================================
--- uspace/app/wavplay/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/wavplay/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,5 +57,5 @@
  * @return Error code.
  */
-static errno_t hplay_ctx(hound_context_t *ctx, const char *filename)
+static int hplay_ctx(hound_context_t *ctx, const char *filename)
 {
 	printf("Hound context playback: %s\n", filename);
@@ -76,5 +76,5 @@
 	pcm_format_t format;
 	const char *error;
-	errno_t ret = wav_parse_header(&header, NULL, NULL, &format.channels,
+	int ret = wav_parse_header(&header, NULL, NULL, &format.channels,
 	    &format.sampling_rate, &format.sample_format, &error);
 	if (ret != EOK) {
@@ -118,5 +118,5 @@
  * @return Error code
  */
-static errno_t hplay(const char *filename)
+static int hplay(const char *filename)
 {
 	printf("Hound playback: %s\n", filename);
@@ -137,5 +137,5 @@
 	pcm_format_t format;
 	const char *error;
-	errno_t ret = wav_parse_header(&header, NULL, NULL, &format.channels,
+	int ret = wav_parse_header(&header, NULL, NULL, &format.channels,
 	    &format.sampling_rate, &format.sample_format, &error);
 	if (ret != EOK) {
@@ -197,9 +197,9 @@
  * @return Error code.
  */
-static errno_t play_wrapper(void *arg)
+static int play_wrapper(void *arg)
 {
 	assert(arg);
 	fib_play_t *p = arg;
-	const errno_t ret = hplay_ctx(p->ctx, p->file);
+	const int ret = hplay_ctx(p->ctx, p->file);
 	atomic_dec(p->count);
 	free(arg);
@@ -289,5 +289,5 @@
 			return 1;
 		}
-		const errno_t ret = hound_context_connect_target(hound_ctx,
+		const int ret = hound_context_connect_target(hound_ctx,
 		    HOUND_DEFAULT_TARGET);
 		if (ret != EOK) {
Index: uspace/app/wavplay/wave.c
===================================================================
--- uspace/app/wavplay/wave.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/wavplay/wave.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,5 @@
  * Does sanity checks and endian conversion.
  */
-errno_t wav_parse_header(const void *hdata, const void **data, size_t *data_size,
+int wav_parse_header(const void *hdata, const void **data, size_t *data_size,
     unsigned *channels, unsigned *sampling_rate, pcm_sample_format_t *format,
     const char **error)
Index: uspace/app/wavplay/wave.h
===================================================================
--- uspace/app/wavplay/wave.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/wavplay/wave.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -90,5 +90,5 @@
 } wave_header_t;
 
-errno_t wav_parse_header(const void *, const void**, size_t *, unsigned *,
+int wav_parse_header(const void *, const void**, size_t *, unsigned *,
     unsigned *, pcm_sample_format_t *, const char **);
 
Index: uspace/app/websrv/websrv.c
===================================================================
--- uspace/app/websrv/websrv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/websrv/websrv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -134,5 +134,5 @@
 
 
-static errno_t recv_create(tcp_conn_t *conn, recv_t **rrecv)
+static int recv_create(tcp_conn_t *conn, recv_t **rrecv)
 {
 	recv_t *recv;
@@ -157,8 +157,8 @@
 
 /** Receive one character (with buffering) */
-static errno_t recv_char(recv_t *recv, char *c)
+static int recv_char(recv_t *recv, char *c)
 {
 	size_t nrecv;
-	errno_t rc;
+	int rc;
 	
 	if (recv->rbuf_out == recv->rbuf_in) {
@@ -168,5 +168,5 @@
 		rc = tcp_conn_recv_wait(recv->conn, recv->rbuf, BUFFER_SIZE, &nrecv);
 		if (rc != EOK) {
-			fprintf(stderr, "tcp_conn_recv() failed: %s\n", str_error(rc));
+			fprintf(stderr, "tcp_conn_recv() failed (%d)\n", rc);
 			return rc;
 		}
@@ -180,5 +180,5 @@
 
 /** Receive one line with length limit */
-static errno_t recv_line(recv_t *recv, char **rbuf)
+static int recv_line(recv_t *recv, char **rbuf)
 {
 	char *bp = recv->lbuf;
@@ -187,5 +187,5 @@
 	while (bp < recv->lbuf + BUFFER_SIZE) {
 		char prev = c;
-		errno_t rc = recv_char(recv, &c);
+		int rc = recv_char(recv, &c);
 		
 		if (rc != EOK)
@@ -226,5 +226,5 @@
 }
 
-static errno_t send_response(tcp_conn_t *conn, const char *msg)
+static int send_response(tcp_conn_t *conn, const char *msg)
 {
 	size_t response_size = str_size(msg);
@@ -233,5 +233,5 @@
 	    fprintf(stderr, "Sending response\n");
 	
-	errno_t rc = tcp_conn_send(conn, (void *) msg, response_size);
+	int rc = tcp_conn_send(conn, (void *) msg, response_size);
 	if (rc != EOK) {
 		fprintf(stderr, "tcp_conn_send() failed\n");
@@ -242,9 +242,9 @@
 }
 
-static errno_t uri_get(const char *uri, tcp_conn_t *conn)
+static int uri_get(const char *uri, tcp_conn_t *conn)
 {
 	char *fbuf = NULL;
 	char *fname = NULL;
-	errno_t rc;
+	int rc;
 	size_t nr;
 	int fd = -1;
@@ -259,11 +259,12 @@
 		uri = "/index.html";
 	
-	if (asprintf(&fname, "%s%s", WEB_ROOT, uri) < 0) {
+	rc = asprintf(&fname, "%s%s", WEB_ROOT, uri);
+	if (rc < 0) {
 		rc = ENOMEM;
 		goto out;
 	}
 	
-	rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK) {
+	fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ);
+	if (fd < 0) {
 		rc = send_response(conn, msg_not_found);
 		goto out;
@@ -302,9 +303,9 @@
 }
 
-static errno_t req_process(tcp_conn_t *conn, recv_t *recv)
+static int req_process(tcp_conn_t *conn, recv_t *recv)
 {
 	char *reqline = NULL;
 
-	errno_t rc = recv_line(recv, &reqline);
+	int rc = recv_line(recv, &reqline);
 	if (rc != EOK) {
 		fprintf(stderr, "recv_line() failed\n");
@@ -355,8 +356,8 @@
 }
 
-static errno_t parse_option(int argc, char *argv[], int *index)
+static int parse_option(int argc, char *argv[], int *index)
 {
 	int value;
-	errno_t rc;
+	int rc;
 	
 	switch (argv[*index][1]) {
@@ -403,5 +404,5 @@
 static void websrv_new_conn(tcp_listener_t *lst, tcp_conn_t *conn)
 {
-	errno_t rc;
+	int rc;
 	recv_t *recv = NULL;
 	
@@ -443,5 +444,5 @@
 	tcp_listener_t *lst;
 	tcp_t *tcp;
-	errno_t rc;
+	int rc;
 	
 	/* Parse command line arguments */
Index: uspace/app/wifi_supplicant/wifi_supplicant.c
===================================================================
--- uspace/app/wifi_supplicant/wifi_supplicant.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/app/wifi_supplicant/wifi_supplicant.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,6 +41,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
 #include <loc.h>
 
@@ -88,8 +86,8 @@
 }
 
-static errno_t get_wifi_list(service_id_t **wifis, size_t *count)
+static int get_wifi_list(service_id_t **wifis, size_t *count)
 {
 	category_id_t wifi_cat;
-	errno_t rc = loc_category_get_id("ieee80211", &wifi_cat, 0);
+	int rc = loc_category_get_id("ieee80211", &wifi_cat, 0);
 	if (rc != EOK) {
 		printf("Error resolving category 'ieee80211'.\n");
@@ -111,5 +109,5 @@
 	size_t count;
 	
-	errno_t rc = get_wifi_list(&wifis, &count);
+	int rc = get_wifi_list(&wifis, &count);
 	if (rc != EOK) {
 		printf("Error fetching wifi list.\n");
@@ -134,12 +132,12 @@
 }
 
-static errno_t wifi_list(void)
+static int wifi_list(void)
 {
 	service_id_t *wifis = NULL;
 	size_t count;
 	
-	errno_t rc = get_wifi_list(&wifis, &count);
-	if (rc != EOK) {
-		printf("Error fetching wifi list: %s\n", str_error(rc));
+	int rc = get_wifi_list(&wifis, &count);
+	if (rc != EOK) {
+		printf("Error fetching wifi list.\n");
 		return EINVAL;
 	}
@@ -150,5 +148,5 @@
 		rc = loc_service_get_name(wifis[i], &svc_name);
 		if (rc != EOK) {
-			printf("Error getting service name: %s\n", str_error(rc));
+			printf("Error getting service name.\n");
 			free(wifis);
 			return rc;
@@ -163,5 +161,5 @@
 }
 
-static errno_t wifi_connect(uint32_t index, char *ssid_start, char *password)
+static int wifi_connect(uint32_t index, char *ssid_start, char *password)
 {
 	assert(ssid_start);
@@ -174,11 +172,11 @@
 	}
 	
-	errno_t rc = ieee80211_disconnect(sess);
+	int rc = ieee80211_disconnect(sess);
 	if(rc != EOK) {
 		if (rc == EREFUSED)
 			printf("Device is not ready yet.\n");
 		else
-			printf("Error when disconnecting device: %s\n",
-			    str_error(rc));
+			printf("Error when disconnecting device. "
+			    "Error: %d\n", rc);
 		
 		return rc;
@@ -194,6 +192,6 @@
 			printf("Given SSID not in scan results.\n");
 		else
-			printf("Error when connecting to network: %s\n",
-			    str_error(rc));
+			printf("Error when connecting to network. "
+			    "Error: %d\n", rc);
 		
 		return rc;
@@ -207,5 +205,5 @@
 }
 
-static errno_t wifi_disconnect(uint32_t index)
+static int wifi_disconnect(uint32_t index)
 {
 	async_sess_t *sess = get_wifi_by_index(index);
@@ -216,5 +214,5 @@
 	}
 	
-	errno_t rc = ieee80211_disconnect(sess);
+	int rc = ieee80211_disconnect(sess);
 	if (rc != EOK) {
 		if (rc == EREFUSED)
@@ -223,6 +221,6 @@
 			printf("Not connected to any WiFi network.\n");
 		else
-			printf("Error when disconnecting from network: %s\n",
-			    str_error(rc));
+			printf("Error when disconnecting from network. "
+			    "Error: %d\n", rc);
 		
 		return rc;
@@ -234,5 +232,5 @@
 }
 
-static errno_t wifi_scan(uint32_t index, bool now)
+static int wifi_scan(uint32_t index, bool now)
 {
 	async_sess_t *sess = get_wifi_by_index(index);
@@ -244,11 +242,10 @@
 	
 	ieee80211_scan_results_t scan_results;
-	errno_t rc = ieee80211_get_scan_results(sess, &scan_results, now);
+	int rc = ieee80211_get_scan_results(sess, &scan_results, now);
 	if (rc != EOK) {
 		if (rc == EREFUSED)
 			printf("Device is not ready yet.\n");
 		else
-			printf("Failed to fetch scan results: %s\n",
-			    str_error(rc));
+			printf("Failed to fetch scan results. Error: %d\n", rc);
 		
 		return rc;
@@ -278,8 +275,8 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc = inetcfg_init();
-	if (rc != EOK) {
-		printf("%s: Failed connecting to inetcfg service: %s.\n",
-		    NAME, str_error(rc));
+	int rc = inetcfg_init();
+	if (rc != EOK) {
+		printf("%s: Failed connecting to inetcfg service (%d).\n",
+		    NAME, rc);
 		return 1;
 	}
@@ -287,6 +284,6 @@
 	rc = dhcp_init();
 	if (rc != EOK) {
-		printf("%s: Failed connecting to dhcp service: %s.\n",
-		    NAME, str_error(rc));
+		printf("%s: Failed connecting to dhcp service (%d).\n",
+		    NAME, rc);
 		return 1;
 	}
Index: uspace/dist/src/c/demos/edit/edit.c
===================================================================
--- uspace/dist/src/c/demos/edit/edit.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/edit/edit.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -190,5 +190,5 @@
 	cons_event_t ev;
 	bool new_file;
-	errno_t rc;
+	int rc;
 
 	con = console_init(stdin, stdout);
@@ -580,5 +580,5 @@
 {
 	spt_t sp, ep;
-	errno_t rc;
+	int rc;
 
 	status_display("Saving...");
@@ -615,5 +615,5 @@
 	}
 
-	errno_t rc = file_save(fname);
+	int rc = file_save(fname);
 	if (rc != EOK)
 		return;
@@ -1330,5 +1330,5 @@
 	
 	match_t match;
-	errno_t rc = search_next_match(search, &match);
+	int rc = search_next_match(search, &match);
 	if (rc != EOK) {
 		status_display("Failed searching.");
@@ -1448,5 +1448,5 @@
 	size_t off;
 	wchar_t c;
-	errno_t rc;
+	int rc;
 
 	rc = clipboard_get_str(&str);
Index: uspace/dist/src/c/demos/edit/search.c
===================================================================
--- uspace/dist/src/c/demos/edit/search.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/edit/search.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -104,10 +104,10 @@
 }
 
-errno_t search_next_match(search_t *s, match_t *match)
+int search_next_match(search_t *s, match_t *match)
 {
 	search_equals_fn eq = s->ops.equals;
 	
 	wchar_t cur_char;
-	errno_t rc = EOK;
+	int rc = EOK;
 	while ((rc = s->ops.producer(s->client_data, &cur_char)) == EOK && cur_char > 0) {
 		/* Deal with mismatches */
Index: uspace/dist/src/c/demos/edit/search.h
===================================================================
--- uspace/dist/src/c/demos/edit/search.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/edit/search.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,6 +42,6 @@
 typedef struct search search_t;
 typedef bool (*search_equals_fn)(const wchar_t, const wchar_t);
-typedef errno_t (*search_producer_fn)(void *, wchar_t *);
-typedef errno_t (*search_mark_fn)(void *, void **);
+typedef int (*search_producer_fn)(void *, wchar_t *);
+typedef int (*search_mark_fn)(void *, void **);
 typedef void (*search_mark_free_fn)(void *);
 
@@ -60,5 +60,5 @@
 extern bool char_exact_equals(const wchar_t, const wchar_t);
 extern search_t *search_init(const char *, void *, search_ops_t, bool);
-extern errno_t search_next_match(search_t *, match_t *);
+extern int search_next_match(search_t *, match_t *);
 extern void search_fini(search_t *);
 
Index: uspace/dist/src/c/demos/edit/sheet.c
===================================================================
--- uspace/dist/src/c/demos/edit/sheet.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/edit/sheet.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -67,5 +67,5 @@
 
 /** Initialize an empty sheet. */
-errno_t sheet_create(sheet_t **rsh)
+int sheet_create(sheet_t **rsh)
 {
 	sheet_t *sh;
@@ -95,5 +95,5 @@
  * @param str	The text to insert (printable characters, tabs, newlines).
  *
- * @return	EOK on success or an error code.
+ * @return	EOK on success or negative error code.
  *
  * @note	@a dir affects which way tags that were placed on @a pos will
@@ -101,5 +101,5 @@
  *		and vice versa.
  */
-errno_t sheet_insert(sheet_t *sh, spt_t *pos, enum dir_spec dir, char *str)
+int sheet_insert(sheet_t *sh, spt_t *pos, enum dir_spec dir, char *str)
 {
 	char *ipp;
@@ -145,7 +145,7 @@
  * @param epos	Ending point.
  *
- * @return	EOK on success or an error code.
+ * @return	EOK on success or negative error code.
  **/
-errno_t sheet_delete(sheet_t *sh, spt_t *spos, spt_t *epos)
+int sheet_delete(sheet_t *sh, spt_t *spos, spt_t *epos)
 {
 	char *spp;
Index: uspace/dist/src/c/demos/edit/sheet.h
===================================================================
--- uspace/dist/src/c/demos/edit/sheet.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/edit/sheet.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -90,7 +90,7 @@
 } tag_t;
 
-extern errno_t sheet_create(sheet_t **);
-extern errno_t sheet_insert(sheet_t *, spt_t *, enum dir_spec, char *);
-extern errno_t sheet_delete(sheet_t *, spt_t *, spt_t *);
+extern int sheet_create(sheet_t **);
+extern int sheet_insert(sheet_t *, spt_t *, enum dir_spec, char *);
+extern int sheet_delete(sheet_t *, spt_t *, spt_t *);
 extern void sheet_copy_out(sheet_t *, spt_t const *, spt_t const *, char *,
     size_t, spt_t *);
Index: uspace/dist/src/c/demos/hello/hello.c
===================================================================
--- uspace/dist/src/c/demos/hello/hello.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/hello/hello.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1,3 +1,3 @@
-extern errno_t putchar(char);
+extern int putchar(char);
 
 #define TERMINATOR '!'
Index: uspace/dist/src/c/demos/tetris/scores.c
===================================================================
--- uspace/dist/src/c/demos/tetris/scores.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/tetris/scores.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -206,9 +206,9 @@
 }
 
-errno_t loadscores(void)
+int loadscores(void)
 {
 	FILE *f;
 	size_t cnt;
-	errno_t rc;
+	int rc;
 
 	f = fopen("/data/tetris.sco", "rb");
@@ -229,5 +229,5 @@
 	FILE *f;
 	size_t cnt;
-	errno_t rc;
+	int rc;
 
 	f = fopen("/data/tetris.sco", "wb");
Index: uspace/dist/src/c/demos/tetris/scores.h
===================================================================
--- uspace/dist/src/c/demos/tetris/scores.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/tetris/scores.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -72,5 +72,5 @@
 extern void initscores(void);
 extern void insertscore(int score, int level);
-extern errno_t loadscores(void);
+extern int loadscores(void);
 extern void savescores(void);
 
Index: uspace/dist/src/c/demos/tetris/screen.c
===================================================================
--- uspace/dist/src/c/demos/tetris/screen.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/tetris/screen.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -147,7 +147,7 @@
 {
 	sysarg_t ccap;
-	errno_t rc = console_get_color_cap(console, &ccap);
-	
-	if (rc != EOK)
+	int rc = console_get_color_cap(console, &ccap);
+	
+	if (rc != 0)
 		return false;
 	
@@ -353,5 +353,5 @@
  *
  */
-errno_t tgetchar(void)
+int tgetchar(void)
 {
 	/*
@@ -392,5 +392,5 @@
  *
  */
-errno_t twait(void)
+int twait(void)
 {
 	wchar_t c = 0;
Index: uspace/dist/src/c/demos/tetris/screen.h
===================================================================
--- uspace/dist/src/c/demos/tetris/screen.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/tetris/screen.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -71,5 +71,5 @@
 extern void clear_screen(void);
 
-extern errno_t put(int);
+extern int put(int);
 extern void scr_clear(void);
 extern void scr_end(void);
@@ -80,6 +80,6 @@
 
 extern void tsleep(void);
-extern errno_t tgetchar(void);
-extern errno_t twait(void);
+extern int tgetchar(void);
+extern int twait(void);
 
 /** @}
Index: uspace/dist/src/c/demos/tetris/shapes.c
===================================================================
--- uspace/dist/src/c/demos/tetris/shapes.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/tetris/shapes.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -93,5 +93,5 @@
  * taking the current board into account.
  */
-errno_t fits_in(const struct shape *shape, int pos)
+int fits_in(const struct shape *shape, int pos)
 {
 	const int *o = shape->off;
Index: uspace/dist/src/c/demos/tetris/tetris.c
===================================================================
--- uspace/dist/src/c/demos/tetris/tetris.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/tetris/tetris.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -157,7 +157,7 @@
 const struct shape *randshape(void)
 {
-	const struct shape *tmp = &shapes[rand() % 7];
+	const struct shape *tmp = &shapes[random() % 7];
 	int i;
-	int j = rand() % 4;
+	int j = random() % 4;
 	
 	for (i = 0; i < j; i++)
@@ -172,5 +172,5 @@
 	
 	gettimeofday(&tv, NULL);
-	srand(tv.tv_sec + tv.tv_usec / 100000);
+	srandom(tv.tv_sec + tv.tv_usec / 100000);
 }
 
Index: uspace/dist/src/c/demos/tetris/tetris.h
===================================================================
--- uspace/dist/src/c/demos/tetris/tetris.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/tetris/tetris.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -194,5 +194,5 @@
 extern int classic;
 
-extern errno_t fits_in(const struct shape *, int);
+extern int fits_in(const struct shape *, int);
 extern void place(const struct shape *, int, int);
 extern void stop(const char *);
Index: uspace/dist/src/c/demos/top/screen.c
===================================================================
--- uspace/dist/src/c/demos/top/screen.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/top/screen.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -537,5 +537,5 @@
  *
  */
-errno_t tgetchar(unsigned int sec)
+int tgetchar(unsigned int sec)
 {
 	/*
Index: uspace/dist/src/c/demos/top/screen.h
===================================================================
--- uspace/dist/src/c/demos/top/screen.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/dist/src/c/demos/top/screen.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,7 +45,7 @@
 extern void print_data(data_t *);
 extern void show_warning(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
+    PRINTF_ATTRIBUTE(1, 2);
 
-extern errno_t tgetchar(unsigned int);
+extern int tgetchar(unsigned int);
 
 #endif
Index: uspace/drv/audio/hdaudio/codec.c
===================================================================
--- uspace/drv/audio/hdaudio/codec.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/hdaudio/codec.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <ddf/log.h>
 #include <errno.h>
-#include <str_error.h>
 #include <stdlib.h>
 
@@ -46,5 +45,5 @@
 #include "stream.h"
 
-static errno_t hda_ccmd(hda_codec_t *codec, int node, uint32_t vid, uint32_t payload,
+static int hda_ccmd(hda_codec_t *codec, int node, uint32_t vid, uint32_t payload,
     uint32_t *resp)
 {
@@ -66,5 +65,5 @@
 		    (payload & 0xffff);
 	}
-	errno_t rc = hda_cmd(codec->hda, verb, resp);
+	int rc = hda_cmd(codec->hda, verb, resp);
 /*
 	if (resp != NULL) {
@@ -78,5 +77,5 @@
 }
 
-static errno_t hda_get_parameter(hda_codec_t *codec, int node, hda_param_id_t param,
+static int hda_get_parameter(hda_codec_t *codec, int node, hda_param_id_t param,
     uint32_t *resp)
 {
@@ -84,8 +83,8 @@
 }
 
-static errno_t hda_get_subnc(hda_codec_t *codec, int node, int *startnode,
+static int hda_get_subnc(hda_codec_t *codec, int node, int *startnode,
     int *nodecount)
 {
-	errno_t rc;
+	int rc;
 	uint32_t resp;
 
@@ -103,8 +102,8 @@
 
 /** Get Function Group Type */
-static errno_t hda_get_fgrp_type(hda_codec_t *codec, int node, bool *unsol,
+static int hda_get_fgrp_type(hda_codec_t *codec, int node, bool *unsol,
     hda_fgrp_type_t *type)
 {
-	errno_t rc;
+	int rc;
 	uint32_t resp;
 
@@ -119,8 +118,8 @@
 }
 
-static errno_t hda_get_clist_len(hda_codec_t *codec, int node, bool *longform,
+static int hda_get_clist_len(hda_codec_t *codec, int node, bool *longform,
     int *items)
 {
-	errno_t rc;
+	int rc;
 	uint32_t resp;
 
@@ -135,15 +134,15 @@
 }
 
-static errno_t hda_get_clist_entry(hda_codec_t *codec, int node, int n, uint32_t *resp)
+static int hda_get_clist_entry(hda_codec_t *codec, int node, int n, uint32_t *resp)
 {
 	return hda_ccmd(codec, node, hda_clist_entry_get, n, resp);
 }
 
-static errno_t hda_get_eapd_btl_enable(hda_codec_t *codec, int node, uint32_t *resp)
+static int hda_get_eapd_btl_enable(hda_codec_t *codec, int node, uint32_t *resp)
 {
 	return hda_ccmd(codec, node, hda_eapd_btl_enable_get, 0, resp);
 }
 
-static errno_t hda_set_eapd_btl_enable(hda_codec_t *codec, int node, uint8_t payload)
+static int hda_set_eapd_btl_enable(hda_codec_t *codec, int node, uint8_t payload)
 {
 	return hda_ccmd(codec, node, hda_eapd_btl_enable_set, payload, NULL);
@@ -151,5 +150,5 @@
 
 /** Get Suppported PCM Size, Rates */
-static errno_t hda_get_supp_rates(hda_codec_t *codec, int node, uint32_t *rates)
+static int hda_get_supp_rates(hda_codec_t *codec, int node, uint32_t *rates)
 {
 	return hda_get_parameter(codec, node, hda_supp_rates, rates);
@@ -157,15 +156,15 @@
 
 /** Get Suppported Stream Formats */
-static errno_t hda_get_supp_formats(hda_codec_t *codec, int node, uint32_t *fmts)
+static int hda_get_supp_formats(hda_codec_t *codec, int node, uint32_t *fmts)
 {
 	return hda_get_parameter(codec, node, hda_supp_formats, fmts);
 }
 
-static errno_t hda_set_converter_fmt(hda_codec_t *codec, int node, uint16_t fmt)
+static int hda_set_converter_fmt(hda_codec_t *codec, int node, uint16_t fmt)
 {
 	return hda_ccmd(codec, node, hda_converter_fmt_set, fmt, NULL);
 }
 
-static errno_t hda_set_converter_ctl(hda_codec_t *codec, int node, uint8_t stream,
+static int hda_set_converter_ctl(hda_codec_t *codec, int node, uint8_t stream,
     uint8_t channel)
 {
@@ -176,12 +175,12 @@
 }
 
-static errno_t hda_set_pin_ctl(hda_codec_t *codec, int node, uint8_t pctl)
+static int hda_set_pin_ctl(hda_codec_t *codec, int node, uint8_t pctl)
 {
 	return hda_ccmd(codec, node, hda_pin_ctl_set, pctl, NULL);
 }
 
-static errno_t hda_get_pin_ctl(hda_codec_t *codec, int node, uint8_t *pctl)
-{
-	errno_t rc;
+static int hda_get_pin_ctl(hda_codec_t *codec, int node, uint8_t *pctl)
+{
+	int rc;
 	uint32_t resp;
 
@@ -195,8 +194,8 @@
 
 /** Get Audio Widget Capabilities */
-static errno_t hda_get_aw_caps(hda_codec_t *codec, int node,
+static int hda_get_aw_caps(hda_codec_t *codec, int node,
     hda_awidget_type_t *type, uint32_t *caps)
 {
-	errno_t rc;
+	int rc;
 	uint32_t resp;
 
@@ -212,5 +211,5 @@
 
 /** Get Pin Capabilities */
-static errno_t hda_get_pin_caps(hda_codec_t *codec, int node, uint32_t *caps)
+static int hda_get_pin_caps(hda_codec_t *codec, int node, uint32_t *caps)
 {
 	return hda_get_parameter(codec, node, hda_pin_caps, caps);
@@ -218,5 +217,5 @@
 
 /** Get Power State */
-static errno_t hda_get_power_state(hda_codec_t *codec, int node, uint32_t *pstate)
+static int hda_get_power_state(hda_codec_t *codec, int node, uint32_t *pstate)
 {
 	return hda_ccmd(codec, node, hda_power_state_get, 0, pstate);
@@ -224,10 +223,10 @@
 
 /** Get Configuration Default */
-static errno_t hda_get_cfg_def(hda_codec_t *codec, int node, uint32_t *cfgdef)
+static int hda_get_cfg_def(hda_codec_t *codec, int node, uint32_t *cfgdef)
 {
 	return hda_ccmd(codec, node, hda_cfg_def_get, 0, cfgdef);
 }
 
-static errno_t hda_get_conn_sel(hda_codec_t *codec, int node, uint32_t *conn)
+static int hda_get_conn_sel(hda_codec_t *codec, int node, uint32_t *conn)
 {
 	return hda_ccmd(codec, node, hda_conn_sel_get, 0, conn);
@@ -235,10 +234,10 @@
 
 /** Get Amplifier Gain / Mute  */
-static errno_t hda_get_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload,
+static int hda_get_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload,
     uint32_t *resp)
 {
 //	ddf_msg(LVL_NOTE, "hda_get_amp_gain_mute(codec, %d, %x)",
 //	    node, payload);
-	errno_t rc = hda_ccmd(codec, node, hda_amp_gain_mute_get, payload, resp);
+	int rc = hda_ccmd(codec, node, hda_amp_gain_mute_get, payload, resp);
 //	ddf_msg(LVL_NOTE, "hda_get_amp_gain_mute(codec, %d, %x, resp=%x)",
 //	    node, payload, *resp);
@@ -247,10 +246,10 @@
 
 /** Get GP I/O Count */
-static errno_t hda_get_gpio_cnt(hda_codec_t *codec, int node, uint32_t *resp)
+static int hda_get_gpio_cnt(hda_codec_t *codec, int node, uint32_t *resp)
 {
 	return hda_get_parameter(codec, node, hda_gpio_cnt, resp);
 }
 
-static errno_t hda_set_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload)
+static int hda_set_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload)
 {
 //	ddf_msg(LVL_NOTE, "hda_set_amp_gain_mute(codec, %d, %x)",
@@ -259,10 +258,10 @@
 }
 
-static errno_t hda_set_out_amp_max(hda_codec_t *codec, uint8_t aw)
+static int hda_set_out_amp_max(hda_codec_t *codec, uint8_t aw)
 {
 	uint32_t ampcaps;
 	uint32_t gmleft, gmright;
 	uint32_t offset;
-	errno_t rc;
+	int rc;
 
 	rc = hda_get_parameter(codec, aw,
@@ -294,5 +293,5 @@
 }
 
-static errno_t hda_set_in_amp_max(hda_codec_t *codec, uint8_t aw)
+static int hda_set_in_amp_max(hda_codec_t *codec, uint8_t aw)
 {
 	uint32_t ampcaps;
@@ -300,5 +299,5 @@
 	uint32_t offset;
 	int i;
-	errno_t rc;
+	int rc;
 
 	rc = hda_get_parameter(codec, aw,
@@ -332,7 +331,7 @@
 }
 
-static errno_t hda_clist_dump(hda_codec_t *codec, uint8_t aw)
-{
-	errno_t rc;
+static int hda_clist_dump(hda_codec_t *codec, uint8_t aw)
+{
+	int rc;
 	bool longform;
 	int len;
@@ -394,7 +393,7 @@
 }
 
-static errno_t hda_pin_init(hda_codec_t *codec, uint8_t aw)
-{
-	errno_t rc;
+static int hda_pin_init(hda_codec_t *codec, uint8_t aw)
+{
+	int rc;
 	uint32_t cfgdef;
 	uint32_t pcaps;
@@ -471,7 +470,7 @@
 
 /** Init power-control in wiget capable of doing so. */
-static errno_t hda_power_ctl_init(hda_codec_t *codec, uint8_t aw)
-{
-	errno_t rc;
+static int hda_power_ctl_init(hda_codec_t *codec, uint8_t aw)
+{
+	int rc;
 	uint32_t pwrstate;
 
@@ -491,5 +490,5 @@
 {
 	hda_codec_t *codec;
-	errno_t rc;
+	int rc;
 	int sfg, nfg;
 	int saw, naw;
@@ -515,5 +514,5 @@
 		goto error;
 
-	ddf_msg(LVL_NOTE, "hda_get_subnc -> %s", str_error_name(rc));
+	ddf_msg(LVL_NOTE, "hda_get_subnc -> %d", rc);
 	ddf_msg(LVL_NOTE, "sfg=%d nfg=%d", sfg, nfg);
 
@@ -525,5 +524,5 @@
 			goto error;
 
-		ddf_msg(LVL_NOTE, "hda_get_fgrp_type -> %s", str_error_name(rc));
+		ddf_msg(LVL_NOTE, "hda_get_fgrp_type -> %d", rc);
 		ddf_msg(LVL_NOTE, "unsol: %d, grptype: %d", unsol, grptype);
 
@@ -547,5 +546,5 @@
 			goto error;
 
-		ddf_msg(LVL_NOTE, "hda_get_subnc -> %s", str_error_name(rc));
+		ddf_msg(LVL_NOTE, "hda_get_subnc -> %d", rc);
 		ddf_msg(LVL_NOTE, "saw=%d baw=%d", saw, naw);
 
@@ -639,7 +638,7 @@
 }
 
-errno_t hda_out_converter_setup(hda_codec_t *codec, hda_stream_t *stream)
-{
-	errno_t rc;
+int hda_out_converter_setup(hda_codec_t *codec, hda_stream_t *stream)
+{
+	int rc;
 	int out_aw;
 	int i;
@@ -666,7 +665,7 @@
 }
 
-errno_t hda_in_converter_setup(hda_codec_t *codec, hda_stream_t *stream)
-{
-	errno_t rc;
+int hda_in_converter_setup(hda_codec_t *codec, hda_stream_t *stream)
+{
+	int rc;
 
 	/* Configure converter */
Index: uspace/drv/audio/hdaudio/codec.h
===================================================================
--- uspace/drv/audio/hdaudio/codec.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/hdaudio/codec.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,6 +52,6 @@
 extern hda_codec_t *hda_codec_init(hda_t *, uint8_t);
 extern void hda_codec_fini(hda_codec_t *);
-extern errno_t hda_out_converter_setup(hda_codec_t *, hda_stream_t *);
-extern errno_t hda_in_converter_setup(hda_codec_t *, hda_stream_t *);
+extern int hda_out_converter_setup(hda_codec_t *, hda_stream_t *);
+extern int hda_in_converter_setup(hda_codec_t *, hda_stream_t *);
 
 #endif
Index: uspace/drv/audio/hdaudio/hdactl.c
===================================================================
--- uspace/drv/audio/hdaudio/hdactl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/hdaudio/hdactl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -64,5 +64,5 @@
  * to read as 0.
  */
-static errno_t hda_ctl_reg16_set_reset(uint16_t *reg, uint16_t mask)
+static int hda_ctl_reg16_set_reset(uint16_t *reg, uint16_t mask)
 {
 	uint16_t val;
@@ -116,5 +116,5 @@
  *
  */
-static errno_t hda_rb_size_select(uint8_t sizecap, uint8_t *selsz)
+static int hda_rb_size_select(uint8_t sizecap, uint8_t *selsz)
 {
 	int i;
@@ -146,5 +146,5 @@
 
 /** Initialize the CORB */
-static errno_t hda_corb_init(hda_t *hda)
+static int hda_corb_init(hda_t *hda)
 {
 	uint8_t ctl;
@@ -152,5 +152,5 @@
 	uint8_t sizecap;
 	uint8_t selsz;
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_NOTE, "hda_corb_init()");
@@ -237,5 +237,5 @@
 
 /** Initialize the RIRB */
-static errno_t hda_rirb_init(hda_t *hda)
+static int hda_rirb_init(hda_t *hda)
 {
 	uint8_t ctl;
@@ -243,5 +243,5 @@
 	uint8_t sizecap;
 	uint8_t selsz;
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_NOTE, "hda_rirb_init()");
@@ -372,5 +372,5 @@
 
 /** Write to CORB */
-static errno_t hda_corb_write(hda_t *hda, uint32_t *data, size_t count)
+static int hda_corb_write(hda_t *hda, uint32_t *data, size_t count)
 {
 	size_t avail;
@@ -414,5 +414,5 @@
 }
 
-static errno_t hda_rirb_read(hda_t *hda, hda_rirb_entry_t *data)
+static int hda_rirb_read(hda_t *hda, hda_rirb_entry_t *data)
 {
 	size_t wp;
@@ -436,5 +436,5 @@
 }
 
-static errno_t hda_solrb_read(hda_t *hda, hda_rirb_entry_t *data, size_t count)
+static int hda_solrb_read(hda_t *hda, hda_rirb_entry_t *data, size_t count)
 {
 	hda_rirb_entry_t resp;
@@ -490,5 +490,5 @@
 	uint32_t intctl;
 	int cnt;
-	errno_t rc;
+	int rc;
 
 	ctl = calloc(1, sizeof(hda_ctl_t));
@@ -615,7 +615,7 @@
 }
 
-errno_t hda_cmd(hda_t *hda, uint32_t verb, uint32_t *resp)
-{
-	errno_t rc;
+int hda_cmd(hda_t *hda, uint32_t verb, uint32_t *resp)
+{
+	int rc;
 	hda_rirb_entry_t rentry;
 
@@ -639,5 +639,5 @@
 {
 	hda_rirb_entry_t resp;
-	errno_t rc;
+	int rc;
 
 	while (true) {
Index: uspace/drv/audio/hdaudio/hdactl.h
===================================================================
--- uspace/drv/audio/hdaudio/hdactl.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/hdaudio/hdactl.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -78,5 +78,5 @@
 extern void hda_ctl_fini(hda_ctl_t *);
 extern void hda_ctl_interrupt(hda_ctl_t *);
-extern errno_t hda_cmd(hda_t *, uint32_t, uint32_t *);
+extern int hda_cmd(hda_t *, uint32_t, uint32_t *);
 extern void hda_ctl_dump_info(hda_ctl_t *);
 
Index: uspace/drv/audio/hdaudio/hdaudio.c
===================================================================
--- uspace/drv/audio/hdaudio/hdaudio.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/hdaudio/hdaudio.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,9 +52,9 @@
 #define NAME "hdaudio"
 
-static errno_t hda_dev_add(ddf_dev_t *dev);
-static errno_t hda_dev_remove(ddf_dev_t *dev);
-static errno_t hda_dev_gone(ddf_dev_t *dev);
-static errno_t hda_fun_online(ddf_fun_t *fun);
-static errno_t hda_fun_offline(ddf_fun_t *fun);
+static int hda_dev_add(ddf_dev_t *dev);
+static int hda_dev_remove(ddf_dev_t *dev);
+static int hda_dev_gone(ddf_dev_t *dev);
+static int hda_fun_online(ddf_fun_t *fun);
+static int hda_fun_offline(ddf_fun_t *fun);
 
 static void hdaudio_interrupt(ipc_call_t *, ddf_dev_t *);
@@ -148,5 +148,5 @@
 };
 
-static errno_t hda_dev_add(ddf_dev_t *dev)
+static int hda_dev_add(ddf_dev_t *dev)
 {
 	ddf_fun_t *fun_pcm = NULL;
@@ -160,5 +160,5 @@
 	int i;
 	void *regs = NULL;
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_NOTE, "hda_dev_add()");
@@ -259,14 +259,14 @@
 	rc = hw_res_enable_interrupt(hda->parent_sess, res.irqs.irqs[0]);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed enabling interrupt.: %s", str_error(rc));
-		goto error;
-	}
-
-	int irq_cap;
-	rc = register_interrupt_handler(dev, res.irqs.irqs[0],
-	    hdaudio_interrupt, &irq_code, &irq_cap);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed registering interrupt handler: %s",
-		    str_error_name(rc));
+		ddf_msg(LVL_ERROR, "Failed enabling interrupt. (%d)", rc);
+		goto error;
+	}
+
+	int irq_cap = register_interrupt_handler(dev, res.irqs.irqs[0],
+	    hdaudio_interrupt, &irq_code);
+	if (irq_cap < 0) {
+		rc = irq_cap;
+		ddf_msg(LVL_ERROR, "Failed registering interrupt handler. (%d)",
+		    rc);
 		goto error;
 	}
@@ -314,12 +314,12 @@
 	hw_res_list_parsed_clean(&res);
 
-	ddf_msg(LVL_NOTE, "Failing hda_dev_add() -> %s", str_error_name(rc));
+	ddf_msg(LVL_NOTE, "Failing hda_dev_add() -> %d", rc);
 	return rc;
 }
 
-static errno_t hda_dev_remove(ddf_dev_t *dev)
+static int hda_dev_remove(ddf_dev_t *dev)
 {
 	hda_t *hda = (hda_t *)ddf_dev_data_get(dev);
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "hda_dev_remove(%p)", dev);
@@ -340,8 +340,8 @@
 }
 
-static errno_t hda_dev_gone(ddf_dev_t *dev)
+static int hda_dev_gone(ddf_dev_t *dev)
 {
 	hda_t *hda = (hda_t *)ddf_dev_data_get(dev);
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "hda_dev_remove(%p)", dev);
@@ -356,5 +356,5 @@
 }
 
-static errno_t hda_fun_online(ddf_fun_t *fun)
+static int hda_fun_online(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "hda_fun_online()");
@@ -362,5 +362,5 @@
 }
 
-static errno_t hda_fun_offline(ddf_fun_t *fun)
+static int hda_fun_offline(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "hda_fun_offline()");
Index: uspace/drv/audio/hdaudio/pcm_iface.c
===================================================================
--- uspace/drv/audio/hdaudio/pcm_iface.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/hdaudio/pcm_iface.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,19 +47,19 @@
 #include "stream.h"
 
-static errno_t hda_get_info_str(ddf_fun_t *, const char **);
+static int hda_get_info_str(ddf_fun_t *, const char **);
 static unsigned hda_query_cap(ddf_fun_t *, audio_cap_t);
-static errno_t hda_test_format(ddf_fun_t *, unsigned *, unsigned *,
+static int hda_test_format(ddf_fun_t *, unsigned *, unsigned *,
     pcm_sample_format_t *);
-static errno_t hda_get_buffer(ddf_fun_t *, void **, size_t *);
-static errno_t hda_get_buffer_position(ddf_fun_t *, size_t *);
-static errno_t hda_set_event_session(ddf_fun_t *, async_sess_t *);
+static int hda_get_buffer(ddf_fun_t *, void **, size_t *);
+static int hda_get_buffer_position(ddf_fun_t *, size_t *);
+static int hda_set_event_session(ddf_fun_t *, async_sess_t *);
 static async_sess_t *hda_get_event_session(ddf_fun_t *);
-static errno_t hda_release_buffer(ddf_fun_t *);
-static errno_t hda_start_playback(ddf_fun_t *, unsigned, unsigned, unsigned,
+static int hda_release_buffer(ddf_fun_t *);
+static int hda_start_playback(ddf_fun_t *, unsigned, unsigned, unsigned,
     pcm_sample_format_t);
-static errno_t hda_stop_playback(ddf_fun_t *, bool);
-static errno_t hda_start_capture(ddf_fun_t *, unsigned, unsigned, unsigned,
+static int hda_stop_playback(ddf_fun_t *, bool);
+static int hda_start_capture(ddf_fun_t *, unsigned, unsigned, unsigned,
     pcm_sample_format_t);
-static errno_t hda_stop_capture(ddf_fun_t *, bool);
+static int hda_stop_capture(ddf_fun_t *, bool);
 
 audio_pcm_iface_t hda_pcm_iface = {
@@ -90,5 +90,5 @@
 }
 
-static errno_t hda_get_info_str(ddf_fun_t *fun, const char **name)
+static int hda_get_info_str(ddf_fun_t *fun, const char **name)
 {
 	ddf_msg(LVL_NOTE, "hda_get_info_str()");
@@ -120,12 +120,12 @@
 		return 16384;
 	default:
-		return -1;
-	}
-}
-
-static errno_t hda_test_format(ddf_fun_t *fun, unsigned *channels,
+		return ENOTSUP;
+	}
+}
+
+static int hda_test_format(ddf_fun_t *fun, unsigned *channels,
     unsigned *rate, pcm_sample_format_t *format)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	ddf_msg(LVL_NOTE, "hda_test_format(%u, %u, %d)\n",
@@ -150,8 +150,8 @@
 }
 
-static errno_t hda_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
-{
-	hda_t *hda = fun_to_hda(fun);
-	errno_t rc;
+static int hda_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
+{
+	hda_t *hda = fun_to_hda(fun);
+	int rc;
 
 	hda_lock(hda);
@@ -183,5 +183,5 @@
 }
 
-static errno_t hda_get_buffer_position(ddf_fun_t *fun, size_t *pos)
+static int hda_get_buffer_position(ddf_fun_t *fun, size_t *pos)
 {
 	ddf_msg(LVL_NOTE, "hda_get_buffer_position()");
@@ -189,5 +189,5 @@
 }
 
-static errno_t hda_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
+static int hda_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
 {
 	hda_t *hda = fun_to_hda(fun);
@@ -215,5 +215,5 @@
 }
 
-static errno_t hda_release_buffer(ddf_fun_t *fun)
+static int hda_release_buffer(ddf_fun_t *fun)
 {
 	hda_t *hda = fun_to_hda(fun);
@@ -234,9 +234,9 @@
 }
 
-static errno_t hda_start_playback(ddf_fun_t *fun, unsigned frames,
+static int hda_start_playback(ddf_fun_t *fun, unsigned frames,
     unsigned channels, unsigned rate, pcm_sample_format_t format)
 {
 	hda_t *hda = fun_to_hda(fun);
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_NOTE, "hda_start_playback()");
@@ -275,5 +275,5 @@
 }
 
-static errno_t hda_stop_playback(ddf_fun_t *fun, bool immediate)
+static int hda_stop_playback(ddf_fun_t *fun, bool immediate)
 {
 	hda_t *hda = fun_to_hda(fun);
@@ -293,9 +293,9 @@
 }
 
-static errno_t hda_start_capture(ddf_fun_t *fun, unsigned frames, unsigned channels,
+static int hda_start_capture(ddf_fun_t *fun, unsigned frames, unsigned channels,
     unsigned rate, pcm_sample_format_t format)
 {
 	hda_t *hda = fun_to_hda(fun);
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_NOTE, "hda_start_capture()");
@@ -334,5 +334,5 @@
 }
 
-static errno_t hda_stop_capture(ddf_fun_t *fun, bool immediate)
+static int hda_stop_capture(ddf_fun_t *fun, bool immediate)
 {
 	hda_t *hda = fun_to_hda(fun);
Index: uspace/drv/audio/hdaudio/spec/regs.h
===================================================================
--- uspace/drv/audio/hdaudio/spec/regs.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/hdaudio/spec/regs.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -64,5 +64,5 @@
 	/** Buffer Descriptor List Pointer - Lower */
 	uint32_t bdpl;
-	/** Buffer Descriptor List Pointer - Upper */
+	/** Buffer Descriptor List Pointer - Upper */ 
 	uint32_t bdpu;
 } hda_sdesc_regs_t;
Index: uspace/drv/audio/hdaudio/stream.c
===================================================================
--- uspace/drv/audio/hdaudio/stream.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/hdaudio/stream.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,4 @@
 #include <ddi.h>
 #include <errno.h>
-#include <str_error.h>
 #include <macros.h>
 #include <stdlib.h>
@@ -49,5 +48,5 @@
 #include "stream.h"
 
-errno_t hda_stream_buffers_alloc(hda_t *hda, hda_stream_buffers_t **rbufs)
+int hda_stream_buffers_alloc(hda_t *hda, hda_stream_buffers_t **rbufs)
 {
 	void *bdl;
@@ -57,5 +56,5 @@
 	size_t i;
 //	size_t j, k;
-	errno_t rc;
+	int rc;
 
 	bufs = calloc(1, sizeof(hda_stream_buffers_t));
@@ -123,5 +122,5 @@
 	    0, &buffer_phys, &buffer);
 	if (rc != EOK) {
-		ddf_msg(LVL_NOTE, "dmamem_map_anon -> %s", str_error_name(rc));
+		ddf_msg(LVL_NOTE, "dmamem_map_anon -> %d", rc);
 		goto error;
 	}
Index: uspace/drv/audio/hdaudio/stream.h
===================================================================
--- uspace/drv/audio/hdaudio/stream.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/hdaudio/stream.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -77,5 +77,5 @@
 } hda_stream_t;
 
-extern errno_t hda_stream_buffers_alloc(hda_t *, hda_stream_buffers_t **);
+extern int hda_stream_buffers_alloc(hda_t *, hda_stream_buffers_t **);
 extern void hda_stream_buffers_free(hda_stream_buffers_t *);
 extern hda_stream_t *hda_stream_create(hda_t *, hda_stream_dir_t,
Index: uspace/drv/audio/sb16/dsp.c
===================================================================
--- uspace/drv/audio/sb16/dsp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/sb16/dsp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -89,5 +89,5 @@
 }
 
-static inline errno_t dsp_read(sb_dsp_t *dsp, uint8_t *data)
+static inline int dsp_read(sb_dsp_t *dsp, uint8_t *data)
 {
 	assert(data);
@@ -106,5 +106,5 @@
 }
 
-static inline errno_t dsp_write(sb_dsp_t *dsp, uint8_t data)
+static inline int dsp_write(sb_dsp_t *dsp, uint8_t data)
 {
 	assert(dsp);
@@ -159,5 +159,5 @@
 }
 
-static inline errno_t setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size)
+static inline int setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size)
 {
 	async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev);
@@ -168,5 +168,5 @@
 }
 
-static inline errno_t setup_buffer(sb_dsp_t *dsp, size_t size)
+static inline int setup_buffer(sb_dsp_t *dsp, size_t size)
 {
 	assert(dsp);
@@ -178,5 +178,5 @@
 	void *buffer = AS_AREA_ANY;
 	
-	errno_t ret = dmamem_map_anonymous(size, DMAMEM_16MiB | 0x0000ffff,
+	int ret = dmamem_map_anonymous(size, DMAMEM_16MiB | 0x0000ffff,
 	    AS_AREA_WRITE | AS_AREA_READ, 0, &pa, &buffer);
 	if (ret != EOK) {
@@ -202,5 +202,5 @@
 }
 
-errno_t sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
+int sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
     int dma8, int dma16)
 {
@@ -215,5 +215,5 @@
 	dsp_reset(dsp);
 	uint8_t response;
-	const errno_t ret = dsp_read(dsp, &response);
+	const int ret = dsp_read(dsp, &response);
 	if (ret != EOK) {
 		ddf_log_error("Failed to read DSP reset response value.");
@@ -290,9 +290,9 @@
 		return 16535;
 	default:
-		return -1;
-	}
-}
-
-errno_t sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *pos)
+		return ENOTSUP;
+	}
+}
+
+int sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *pos)
 {
 	if (dsp->state == DSP_NO_BUFFER)
@@ -303,16 +303,16 @@
 
 	// TODO: Assumes DMA 16
-	size_t remain;
-	errno_t rc = hw_res_dma_channel_remain(sess, dsp->dma16_channel, &remain);
-	if (rc == EOK) {
+	const int remain = hw_res_dma_channel_remain(sess, dsp->dma16_channel);
+	if (remain >= 0) {
 		*pos = dsp->buffer.size - remain;
-	}
-	return rc;
-}
-
-errno_t sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
+		return EOK;
+	}
+	return remain;
+}
+
+int sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
   pcm_sample_format_t *format)
 {
-	errno_t ret = EOK;
+	int ret = EOK;
 	if (*channels == 0 || *channels > 2) {
 		*channels = 2;
@@ -336,5 +336,5 @@
 }
 
-errno_t sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session)
+int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session)
 {
 	assert(dsp);
@@ -353,5 +353,5 @@
 }
 
-errno_t sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size)
+int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size)
 {
 	assert(dsp);
@@ -364,5 +364,5 @@
 	assert(dsp->buffer.data == NULL);
 
-	const errno_t ret = setup_buffer(dsp, *size);
+	const int ret = setup_buffer(dsp, *size);
 	if (ret == EOK) {
 		ddf_log_debug("Providing buffer: %p, %zu B.",
@@ -378,5 +378,5 @@
 }
 
-errno_t sb_dsp_release_buffer(sb_dsp_t *dsp)
+int sb_dsp_release_buffer(sb_dsp_t *dsp)
 {
 	assert(dsp);
@@ -392,5 +392,5 @@
 }
 
-errno_t sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
+int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
     unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
 {
@@ -441,5 +441,5 @@
 }
 
-errno_t sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate)
+int sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate)
 {
 	assert(dsp);
@@ -471,5 +471,5 @@
 }
 
-errno_t sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
+int sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
     unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
 {
@@ -517,5 +517,5 @@
 }
 
-errno_t sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate)
+int sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate)
 {
 	assert(dsp);
Index: uspace/drv/audio/sb16/dsp.h
===================================================================
--- uspace/drv/audio/sb16/dsp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/sb16/dsp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -76,21 +76,21 @@
 } sb_dsp_t;
 
-errno_t sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
+int sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
     int dma8, int dma16);
 void sb_dsp_interrupt(sb_dsp_t *dsp);
 unsigned sb_dsp_query_cap(sb_dsp_t *dsp, audio_cap_t cap);
-errno_t sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *size);
-errno_t sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
-    pcm_sample_format_t *format);
-errno_t sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size);
-errno_t sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session);
-async_sess_t *sb_dsp_get_event_session(sb_dsp_t *dsp);
-errno_t sb_dsp_release_buffer(sb_dsp_t *dsp);
-errno_t sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
+int sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *size);
+int sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
+  pcm_sample_format_t *format);
+int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size);
+int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session);
+async_sess_t * sb_dsp_get_event_session(sb_dsp_t *dsp);
+int sb_dsp_release_buffer(sb_dsp_t *dsp);
+int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
     unsigned channels, unsigned sample_rate, pcm_sample_format_t format);
-errno_t sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate);
-errno_t sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
+int sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate);
+int sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
     unsigned channels, unsigned sample_rate, pcm_sample_format_t format);
-errno_t sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate);
+int sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate);
 
 #endif
Index: uspace/drv/audio/sb16/main.c
===================================================================
--- uspace/drv/audio/sb16/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/sb16/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,8 +47,8 @@
 #define NAME "sb16"
 
-static errno_t sb_add_device(ddf_dev_t *device);
-static errno_t sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
+static int sb_add_device(ddf_dev_t *device);
+static int sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
     addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16);
-static errno_t sb_enable_interrupt(ddf_dev_t *device, int irq);
+static int sb_enable_interrupt(ddf_dev_t *device, int irq);
 
 static driver_ops_t sb_driver_ops = {
@@ -87,5 +87,5 @@
  * @return Error code.
  */
-static errno_t sb_add_device(ddf_dev_t *device)
+static int sb_add_device(ddf_dev_t *device)
 {
 	bool handler_regd = false;
@@ -96,5 +96,5 @@
 
 	sb16_t *soft_state = ddf_dev_data_alloc(device, sizeof(sb16_t));
-	errno_t rc = soft_state ? EOK : ENOMEM;
+	int rc = soft_state ? EOK : ENOMEM;
 	if (rc != EOK) {
 		ddf_log_error("Failed to allocate sb16 structure.");
@@ -123,7 +123,8 @@
 	};
 
-	rc = register_interrupt_handler(device, irq, irq_handler,
-	    &irq_code, &irq_cap);
-	if (rc != EOK) {
+	irq_cap = register_interrupt_handler(device, irq, irq_handler,
+	    &irq_code);
+	if (irq_cap < 0) {
+		rc = irq_cap;
 		ddf_log_error("Failed to register irq handler: %s.",
 		    str_error(rc));
@@ -173,5 +174,5 @@
 }
 
-static errno_t sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
+static int sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
     addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16)
 {
@@ -184,5 +185,5 @@
 	hw_res_list_parsed_t hw_res;
 	hw_res_list_parsed_init(&hw_res);
-	const errno_t ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
+	const int ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
 	if (ret != EOK) {
 		return ret;
@@ -241,5 +242,5 @@
 }
 
-static errno_t sb_enable_interrupt(ddf_dev_t *device, int irq)
+static int sb_enable_interrupt(ddf_dev_t *device, int irq)
 {
 	async_sess_t *parent_sess = ddf_dev_parent_sess_get(device);
Index: uspace/drv/audio/sb16/mixer.c
===================================================================
--- uspace/drv/audio/sb16/mixer.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/sb16/mixer.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -123,5 +123,5 @@
 }
 
-errno_t sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type)
+int sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type)
 {
 	assert(mixer);
@@ -149,5 +149,5 @@
 }
 
-errno_t sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned item,
+int sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned item,
     const char** name, unsigned *levels)
 {
@@ -171,5 +171,5 @@
  * @return Error code.
  */
-errno_t sb_mixer_get_control_item_value(const sb_mixer_t *mixer, unsigned item,
+int sb_mixer_get_control_item_value(const sb_mixer_t *mixer, unsigned item,
     unsigned *value)
 {
@@ -194,5 +194,5 @@
  * @return Error code.
  */
-errno_t sb_mixer_set_control_item_value(const sb_mixer_t *mixer, unsigned item,
+int sb_mixer_set_control_item_value(const sb_mixer_t *mixer, unsigned item,
     unsigned value)
 {
Index: uspace/drv/audio/sb16/mixer.h
===================================================================
--- uspace/drv/audio/sb16/mixer.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/sb16/mixer.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,12 +50,12 @@
 } sb_mixer_t;
 
-const char *sb_mixer_type_str(sb_mixer_type_t type);
-errno_t sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type);
+const char * sb_mixer_type_str(sb_mixer_type_t type);
+int sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type);
 int sb_mixer_get_control_item_count(const sb_mixer_t *mixer);
-errno_t sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned index,
+int sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned index,
     const char **name, unsigned *levels);
-errno_t sb_mixer_get_control_item_value(const sb_mixer_t *mixer, unsigned index,
+int sb_mixer_get_control_item_value(const sb_mixer_t *mixer, unsigned index,
     unsigned *value);
-errno_t sb_mixer_set_control_item_value(const sb_mixer_t *mixer, unsigned index,
+int sb_mixer_set_control_item_value(const sb_mixer_t *mixer, unsigned index,
     unsigned value);
 #endif
Index: uspace/drv/audio/sb16/mixer_iface.c
===================================================================
--- uspace/drv/audio/sb16/mixer_iface.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/sb16/mixer_iface.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
 }
 
-static errno_t sb_get_info(ddf_fun_t *fun, const char** name, unsigned *items)
+static int sb_get_info(ddf_fun_t *fun, const char** name, unsigned *items)
 {
 	sb_mixer_t *mixer = fun_to_mixer(fun);
@@ -58,5 +58,5 @@
 }
 
-static errno_t sb_get_item_info(ddf_fun_t *fun, unsigned item, const char** name,
+static int sb_get_item_info(ddf_fun_t *fun, unsigned item, const char** name,
     unsigned *max_level)
 {
@@ -65,5 +65,5 @@
 }
 
-static errno_t sb_set_item_level(ddf_fun_t *fun, unsigned item, unsigned value)
+static int sb_set_item_level(ddf_fun_t *fun, unsigned item, unsigned value)
 {
 	sb_mixer_t *mixer = fun_to_mixer(fun);
@@ -71,5 +71,5 @@
 }
 
-static errno_t sb_get_item_level(ddf_fun_t *fun, unsigned item, unsigned *value)
+static int sb_get_item_level(ddf_fun_t *fun, unsigned item, unsigned *value)
 {
 	sb_mixer_t *mixer = fun_to_mixer(fun);
Index: uspace/drv/audio/sb16/pcm_iface.c
===================================================================
--- uspace/drv/audio/sb16/pcm_iface.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/sb16/pcm_iface.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 }
 
-static errno_t sb_get_info_str(ddf_fun_t *fun, const char** name)
+static int sb_get_info_str(ddf_fun_t *fun, const char** name)
 {
 	if (name)
@@ -59,20 +59,20 @@
 }
 
-static errno_t sb_test_format(ddf_fun_t *fun, unsigned *channels, unsigned *rate,
+static int sb_test_format(ddf_fun_t *fun, unsigned *channels, unsigned *rate,
     pcm_sample_format_t *format)
 {
 	return sb_dsp_test_format(fun_to_dsp(fun), channels, rate, format);
 }
-static errno_t sb_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
+static int sb_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
 {
 	return sb_dsp_get_buffer(fun_to_dsp(fun), buffer, size);
 }
 
-static errno_t sb_get_buffer_position(ddf_fun_t *fun, size_t *size)
+static int sb_get_buffer_position(ddf_fun_t *fun, size_t *size)
 {
 	return sb_dsp_get_buffer_position(fun_to_dsp(fun), size);
 }
 
-static errno_t sb_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
+static int sb_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
 {
 	return sb_dsp_set_event_session(fun_to_dsp(fun), sess);
@@ -84,10 +84,10 @@
 }
 
-static errno_t sb_release_buffer(ddf_fun_t *fun)
+static int sb_release_buffer(ddf_fun_t *fun)
 {
 	return sb_dsp_release_buffer(fun_to_dsp(fun));
 }
 
-static errno_t sb_start_playback(ddf_fun_t *fun, unsigned frames,
+static int sb_start_playback(ddf_fun_t *fun, unsigned frames,
     unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
 {
@@ -96,10 +96,10 @@
 }
 
-static errno_t sb_stop_playback(ddf_fun_t *fun, bool immediate)
+static int sb_stop_playback(ddf_fun_t *fun, bool immediate)
 {
 	return sb_dsp_stop_playback(fun_to_dsp(fun), immediate);
 }
 
-static errno_t sb_start_capture(ddf_fun_t *fun, unsigned frames,
+static int sb_start_capture(ddf_fun_t *fun, unsigned frames,
     unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
 {
@@ -108,5 +108,5 @@
 }
 
-static errno_t sb_stop_capture(ddf_fun_t *fun, bool immediate)
+static int sb_stop_capture(ddf_fun_t *fun, bool immediate)
 {
 	return sb_dsp_stop_capture(fun_to_dsp(fun), immediate);
Index: uspace/drv/audio/sb16/sb16.c
===================================================================
--- uspace/drv/audio/sb16/sb16.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/sb16/sb16.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -94,5 +94,5 @@
 }
 
-errno_t sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8,
+int sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8,
     int dma16)
 {
@@ -100,5 +100,5 @@
 
 	/* Setup registers */
-	errno_t ret = pio_enable_range(regs, (void **) &sb->regs);
+	int ret = pio_enable_range(regs, (void **) &sb->regs);
 	if (ret != EOK)
 		return ret;
@@ -179,5 +179,5 @@
 }
 
-errno_t sb16_init_mpu(sb16_t *sb, addr_range_t *regs)
+int sb16_init_mpu(sb16_t *sb, addr_range_t *regs)
 {
 	sb->mpu_regs = NULL;
Index: uspace/drv/audio/sb16/sb16.h
===================================================================
--- uspace/drv/audio/sb16/sb16.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/audio/sb16/sb16.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,6 +53,6 @@
 size_t sb16_irq_code_size(void);
 void sb16_irq_code(addr_range_t *regs, int dma8, int dma16, irq_cmd_t cmds[], irq_pio_range_t ranges[]);
-errno_t sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8, int dma16);
-errno_t sb16_init_mpu(sb16_t *sb, addr_range_t *regs);
+int sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8, int dma16);
+int sb16_init_mpu(sb16_t *sb, addr_range_t *regs);
 void sb16_interrupt(sb16_t *sb);
 
Index: uspace/drv/block/ahci/ahci.c
===================================================================
--- uspace/drv/block/ahci/ahci.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/block/ahci/ahci.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -109,14 +109,14 @@
 	}
 
-static errno_t get_sata_device_name(ddf_fun_t *, size_t, char *);
-static errno_t get_num_blocks(ddf_fun_t *, uint64_t *);
-static errno_t get_block_size(ddf_fun_t *, size_t *);
-static errno_t read_blocks(ddf_fun_t *, uint64_t, size_t, void *);
-static errno_t write_blocks(ddf_fun_t *, uint64_t, size_t, void *);
-
-static errno_t ahci_identify_device(sata_dev_t *);
-static errno_t ahci_set_highest_ultra_dma_mode(sata_dev_t *);
-static errno_t ahci_rb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
-static errno_t ahci_wb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
+static int get_sata_device_name(ddf_fun_t *, size_t, char *);
+static int get_num_blocks(ddf_fun_t *, uint64_t *);
+static int get_block_size(ddf_fun_t *, size_t *);
+static int read_blocks(ddf_fun_t *, uint64_t, size_t, void *);
+static int write_blocks(ddf_fun_t *, uint64_t, size_t, void *);
+
+static int ahci_identify_device(sata_dev_t *);
+static int ahci_set_highest_ultra_dma_mode(sata_dev_t *);
+static int ahci_rb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
+static int ahci_wb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
 
 static void ahci_sata_devices_create(ahci_dev_t *, ddf_dev_t *);
@@ -124,5 +124,5 @@
 static void ahci_ahci_hw_start(ahci_dev_t *);
 
-static errno_t ahci_dev_add(ddf_dev_t *);
+static int ahci_dev_add(ddf_dev_t *);
 
 static void ahci_get_model_name(uint16_t *, char *);
@@ -177,5 +177,5 @@
  *
  */
-static errno_t get_sata_device_name(ddf_fun_t *fun,
+static int get_sata_device_name(ddf_fun_t *fun,
     size_t sata_dev_name_length, char *sata_dev_name)
 {
@@ -193,5 +193,5 @@
  *
  */
-static errno_t get_num_blocks(ddf_fun_t *fun, uint64_t *num_blocks)
+static int get_num_blocks(ddf_fun_t *fun, uint64_t *num_blocks)
 {
 	sata_dev_t *sata = fun_sata_dev(fun);
@@ -208,5 +208,5 @@
  *
  */
-static errno_t get_block_size(ddf_fun_t *fun, size_t *block_size)
+static int get_block_size(ddf_fun_t *fun, size_t *block_size)
 {
 	sata_dev_t *sata = fun_sata_dev(fun);
@@ -225,5 +225,5 @@
  *
  */
-static errno_t read_blocks(ddf_fun_t *fun, uint64_t blocknum,
+static int read_blocks(ddf_fun_t *fun, uint64_t blocknum,
     size_t count, void *buf)
 {
@@ -232,5 +232,5 @@
 	uintptr_t phys;
 	void *ibuf = AS_AREA_ANY;
-	errno_t rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
+	int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
 	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf);
 	if (rc != EOK) {
@@ -268,5 +268,5 @@
  *
  */
-static errno_t write_blocks(ddf_fun_t *fun, uint64_t blocknum,
+static int write_blocks(ddf_fun_t *fun, uint64_t blocknum,
     size_t count, void *buf)
 {
@@ -275,5 +275,5 @@
 	uintptr_t phys;
 	void *ibuf = AS_AREA_ANY;
-	errno_t rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
+	int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
 	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf);
 	if (rc != EOK) {
@@ -424,5 +424,5 @@
  *
  */
-static errno_t ahci_identify_device(sata_dev_t *sata)
+static int ahci_identify_device(sata_dev_t *sata)
 {
 	if (sata->is_invalid_device) {
@@ -434,5 +434,5 @@
 	uintptr_t phys;
 	sata_identify_data_t *idata = AS_AREA_ANY;
-	errno_t rc = dmamem_map_anonymous(SATA_IDENTIFY_DEVICE_BUFFER_LENGTH,
+	int rc = dmamem_map_anonymous(SATA_IDENTIFY_DEVICE_BUFFER_LENGTH,
 	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
 	    (void *) &idata);
@@ -605,5 +605,5 @@
  *
  */
-static errno_t ahci_set_highest_ultra_dma_mode(sata_dev_t *sata)
+static int ahci_set_highest_ultra_dma_mode(sata_dev_t *sata)
 {
 	if (sata->is_invalid_device) {
@@ -628,5 +628,5 @@
 	uintptr_t phys;
 	sata_identify_data_t *idata = AS_AREA_ANY;
-	errno_t rc = dmamem_map_anonymous(SATA_SET_FEATURE_BUFFER_LENGTH,
+	int rc = dmamem_map_anonymous(SATA_SET_FEATURE_BUFFER_LENGTH,
 	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
 	    (void *) &idata);
@@ -734,5 +734,5 @@
  *
  */
-static errno_t ahci_rb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
+static int ahci_rb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
 {
 	if (sata->is_invalid_device) {
@@ -822,5 +822,5 @@
  *
  */
-static errno_t ahci_wb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
+static int ahci_wb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
 {
 	if (sata->is_invalid_device) {
@@ -949,5 +949,5 @@
 	
 	/* Allocate and init retfis structure. */
-	errno_t rc = dmamem_map_anonymous(size, DMAMEM_4GiB,
+	int rc = dmamem_map_anonymous(size, DMAMEM_4GiB,
 	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_fb);
 	if (rc != EOK)
@@ -1038,9 +1038,9 @@
  *
  */
-static errno_t ahci_sata_create(ahci_dev_t *ahci, ddf_dev_t *dev,
+static int ahci_sata_create(ahci_dev_t *ahci, ddf_dev_t *dev,
     volatile ahci_port_t *port, unsigned int port_num)
 {
 	ddf_fun_t *fun = NULL;
-	errno_t rc;
+	int rc;
 	
 	sata_dev_t *sata = ahci_sata_allocate(ahci, port);
@@ -1184,13 +1184,12 @@
 	ct.ranges = ahci_ranges;
 	
-	int irq_cap;
-	errno_t rc = register_interrupt_handler(dev,
-	    hw_res_parsed.irqs.irqs[0], ahci_interrupt, &ct, &irq_cap);
-	if (rc != EOK) {
+	int irq_cap = register_interrupt_handler(dev,
+	    hw_res_parsed.irqs.irqs[0], ahci_interrupt, &ct);
+	if (irq_cap < 0) {
 		ddf_msg(LVL_ERROR, "Failed registering interrupt handler.");
 		goto error_register_interrupt_handler;
 	}
 	
-	rc = hw_res_enable_interrupt(ahci->parent_sess,
+	int rc = hw_res_enable_interrupt(ahci->parent_sess,
 	    hw_res_parsed.irqs.irqs[0]);
 	if (rc != EOK) {
@@ -1255,5 +1254,5 @@
  *
  */
-static errno_t ahci_dev_add(ddf_dev_t *dev)	
+static int ahci_dev_add(ddf_dev_t *dev)	
 {
 	ahci_dev_t *ahci = ahci_ahci_create(dev);
Index: uspace/drv/block/ata_bd/ata_bd.c
===================================================================
--- uspace/drv/block/ata_bd/ata_bd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/block/ata_bd/ata_bd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -82,41 +82,41 @@
 static const size_t identify_data_size = 512;
 
-static errno_t ata_bd_init_io(ata_ctrl_t *ctrl);
+static int ata_bd_init_io(ata_ctrl_t *ctrl);
 static void ata_bd_fini_io(ata_ctrl_t *ctrl);
 
-static errno_t ata_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t ata_bd_close(bd_srv_t *);
-static errno_t ata_bd_read_blocks(bd_srv_t *, uint64_t ba, size_t cnt, void *buf,
+static int ata_bd_open(bd_srvs_t *, bd_srv_t *);
+static int ata_bd_close(bd_srv_t *);
+static int ata_bd_read_blocks(bd_srv_t *, uint64_t ba, size_t cnt, void *buf,
     size_t);
-static errno_t ata_bd_read_toc(bd_srv_t *, uint8_t session, void *buf, size_t);
-static errno_t ata_bd_write_blocks(bd_srv_t *, uint64_t ba, size_t cnt,
+static int ata_bd_read_toc(bd_srv_t *, uint8_t session, void *buf, size_t);
+static int ata_bd_write_blocks(bd_srv_t *, uint64_t ba, size_t cnt,
     const void *buf, size_t);
-static errno_t ata_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t ata_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
-static errno_t ata_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
-
-static errno_t ata_rcmd_read(disk_t *disk, uint64_t ba, size_t cnt,
+static int ata_bd_get_block_size(bd_srv_t *, size_t *);
+static int ata_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
+static int ata_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
+
+static int ata_rcmd_read(disk_t *disk, uint64_t ba, size_t cnt,
     void *buf);
-static errno_t ata_rcmd_write(disk_t *disk, uint64_t ba, size_t cnt,
+static int ata_rcmd_write(disk_t *disk, uint64_t ba, size_t cnt,
     const void *buf);
-static errno_t ata_rcmd_flush_cache(disk_t *disk);
-static errno_t disk_init(ata_ctrl_t *ctrl, disk_t *d, int disk_id);
-static errno_t ata_identify_dev(disk_t *disk, void *buf);
-static errno_t ata_identify_pkt_dev(disk_t *disk, void *buf);
-static errno_t ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size,
+static int ata_rcmd_flush_cache(disk_t *disk);
+static int disk_init(ata_ctrl_t *ctrl, disk_t *d, int disk_id);
+static int ata_identify_dev(disk_t *disk, void *buf);
+static int ata_identify_pkt_dev(disk_t *disk, void *buf);
+static int ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size,
     void *obuf, size_t obuf_size, size_t *rcvd_size);
-static errno_t ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size,
+static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size,
     size_t *rcvd_size);
-static errno_t ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt,
+static int ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt,
     void *obuf, size_t obuf_size);
-static errno_t ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,
+static int ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,
     size_t *block_size);
-static errno_t ata_pcmd_read_toc(disk_t *disk, uint8_t ses,
+static int ata_pcmd_read_toc(disk_t *disk, uint8_t ses,
     void *obuf, size_t obuf_size);
 static void disk_print_summary(disk_t *d);
-static errno_t coord_calc(disk_t *d, uint64_t ba, block_coord_t *bc);
+static int coord_calc(disk_t *d, uint64_t ba, block_coord_t *bc);
 static void coord_sc_program(ata_ctrl_t *ctrl, const block_coord_t *bc,
     uint16_t scnt);
-static errno_t wait_status(ata_ctrl_t *ctrl, unsigned set, unsigned n_reset,
+static int wait_status(ata_ctrl_t *ctrl, unsigned set, unsigned n_reset,
     uint8_t *pstatus, unsigned timeout);
 
@@ -143,8 +143,7 @@
 
 /** Initialize ATA controller. */
-errno_t ata_ctrl_init(ata_ctrl_t *ctrl, ata_base_t *res)
-{
-	int i;
-	errno_t rc;
+int ata_ctrl_init(ata_ctrl_t *ctrl, ata_base_t *res)
+{
+	int i, rc;
 	int n_disks;
 
@@ -209,8 +208,7 @@
 
 /** Remove ATA controller. */
-errno_t ata_ctrl_remove(ata_ctrl_t *ctrl)
-{
-	int i;
-	errno_t rc;
+int ata_ctrl_remove(ata_ctrl_t *ctrl)
+{
+	int i, rc;
 
 	ddf_msg(LVL_DEBUG, ": ata_ctrl_remove()");
@@ -234,8 +232,7 @@
 
 /** Surprise removal of ATA controller. */
-errno_t ata_ctrl_gone(ata_ctrl_t *ctrl)
-{
-	int i;
-	errno_t rc;
+int ata_ctrl_gone(ata_ctrl_t *ctrl)
+{
+	int i, rc;
 
 	ddf_msg(LVL_DEBUG, "ata_ctrl_gone()");
@@ -308,7 +305,7 @@
 
 /** Enable device I/O. */
-static errno_t ata_bd_init_io(ata_ctrl_t *ctrl)
-{
-	errno_t rc;
+static int ata_bd_init_io(ata_ctrl_t *ctrl)
+{
+	int rc;
 	void *vaddr;
 
@@ -344,5 +341,5 @@
  * the disk structure.
  */
-static errno_t disk_init(ata_ctrl_t *ctrl, disk_t *d, int disk_id)
+static int disk_init(ata_ctrl_t *ctrl, disk_t *d, int disk_id)
 {
 	identify_data_t idata;
@@ -356,5 +353,5 @@
 	size_t block_size;
 	size_t pos, len;
-	errno_t rc;
+	int rc;
 	unsigned i;
 
@@ -498,10 +495,10 @@
 }
 
-static errno_t ata_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	return EOK;
-}
-
-static errno_t ata_bd_close(bd_srv_t *bd)
+static int ata_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
+{
+	return EOK;
+}
+
+static int ata_bd_close(bd_srv_t *bd)
 {
 	return EOK;
@@ -509,9 +506,9 @@
 
 /** Read multiple blocks from the device. */
-static errno_t ata_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
+static int ata_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
     void *buf, size_t size)
 {
 	disk_t *disk = bd_srv_disk(bd);
-	errno_t rc;
+	int rc;
 
 	if (size < cnt * disk->block_size)
@@ -538,5 +535,5 @@
 
 /** Read TOC from device. */
-static errno_t ata_bd_read_toc(bd_srv_t *bd, uint8_t session, void *buf, size_t size)
+static int ata_bd_read_toc(bd_srv_t *bd, uint8_t session, void *buf, size_t size)
 {
 	disk_t *disk = bd_srv_disk(bd);
@@ -546,9 +543,9 @@
 
 /** Write multiple blocks to the device. */
-static errno_t ata_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
+static int ata_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
     const void *buf, size_t size)
 {
 	disk_t *disk = bd_srv_disk(bd);
-	errno_t rc;
+	int rc;
 
 	if (disk->dev_type != ata_reg_dev)
@@ -572,5 +569,5 @@
 
 /** Get device block size. */
-static errno_t ata_bd_get_block_size(bd_srv_t *bd, size_t *rbsize)
+static int ata_bd_get_block_size(bd_srv_t *bd, size_t *rbsize)
 {
 	disk_t *disk = bd_srv_disk(bd);
@@ -581,5 +578,5 @@
 
 /** Get device number of blocks. */
-static errno_t ata_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
+static int ata_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
 {
 	disk_t *disk = bd_srv_disk(bd);
@@ -590,5 +587,5 @@
 
 /** Flush cache. */
-static errno_t ata_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
+static int ata_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
 {
 	disk_t *disk = bd_srv_disk(bd);
@@ -602,5 +599,5 @@
 
 /** PIO data-in command protocol. */
-static errno_t ata_pio_data_in(disk_t *disk, void *obuf, size_t obuf_size,
+static int ata_pio_data_in(disk_t *disk, void *obuf, size_t obuf_size,
     size_t blk_size, size_t nblocks)
 {
@@ -633,5 +630,5 @@
 
 /** PIO data-out command protocol. */
-static errno_t ata_pio_data_out(disk_t *disk, const void *buf, size_t buf_size,
+static int ata_pio_data_out(disk_t *disk, const void *buf, size_t buf_size,
     size_t blk_size, size_t nblocks)
 {
@@ -662,5 +659,5 @@
 
 /** PIO non-data command protocol. */
-static errno_t ata_pio_nondata(disk_t *disk)
+static int ata_pio_nondata(disk_t *disk)
 {
 	ata_ctrl_t *ctrl = disk->ctrl;
@@ -687,5 +684,5 @@
  *			not present). EIO if device responds with error.
  */
-static errno_t ata_identify_dev(disk_t *disk, void *buf)
+static int ata_identify_dev(disk_t *disk, void *buf)
 {
 	ata_ctrl_t *ctrl = disk->ctrl;
@@ -739,5 +736,5 @@
  * @param buf		Pointer to a 512-byte buffer.
  */
-static errno_t ata_identify_pkt_dev(disk_t *disk, void *buf)
+static int ata_identify_pkt_dev(disk_t *disk, void *buf)
 {
 	ata_ctrl_t *ctrl = disk->ctrl;
@@ -772,5 +769,5 @@
  * @return EOK on success, EIO on error.
  */
-static errno_t ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size,
+static int ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size,
     void *obuf, size_t obuf_size, size_t *rcvd_size)
 {
@@ -860,10 +857,10 @@
  * @return EOK on success, EIO on error.
  */
-static errno_t ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size,
+static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size,
     size_t *rcvd_size)
 {
 	uint8_t cpb[12];
 	scsi_cdb_inquiry_t *cp = (scsi_cdb_inquiry_t *)cpb;
-	errno_t rc;
+	int rc;
 
 	memset(cpb, 0, sizeof(cpb));
@@ -893,5 +890,5 @@
  * @return EOK on success, EIO on error.
  */
-static errno_t ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,
+static int ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,
     size_t *block_size)
 {
@@ -899,5 +896,5 @@
 	scsi_read_capacity_10_data_t data;
 	size_t rsize;
-	errno_t rc;
+	int rc;
 
 	memset(&cdb, 0, sizeof(cdb));
@@ -930,9 +927,9 @@
  * @return EOK on success, EIO on error.
  */
-static errno_t ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt,
+static int ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt,
     void *obuf, size_t obuf_size)
 {
 	scsi_cdb_read_12_t cp;
-	errno_t rc;
+	int rc;
 
 	if (ba > UINT32_MAX)
@@ -969,10 +966,10 @@
  * @return EOK on success, EIO on error.
  */
-static errno_t ata_pcmd_read_toc(disk_t *disk, uint8_t session, void *obuf,
+static int ata_pcmd_read_toc(disk_t *disk, uint8_t session, void *obuf,
     size_t obuf_size)
 {
 	uint8_t cpb[12];
 	scsi_cdb_read_toc_t *cp = (scsi_cdb_read_toc_t *)cpb;
-	errno_t rc;
+	int rc;
 
 	memset(cpb, 0, sizeof(cpb));
@@ -1001,5 +998,5 @@
  * @return EOK on success, EIO on error.
  */
-static errno_t ata_rcmd_read(disk_t *disk, uint64_t ba, size_t blk_cnt,
+static int ata_rcmd_read(disk_t *disk, uint64_t ba, size_t blk_cnt,
     void *buf)
 {
@@ -1007,5 +1004,5 @@
 	uint8_t drv_head;
 	block_coord_t bc;
-	errno_t rc;
+	int rc;
 
 	/* Silence warning. */
@@ -1061,5 +1058,5 @@
  * @return EOK on success, EIO on error.
  */
-static errno_t ata_rcmd_write(disk_t *disk, uint64_t ba, size_t cnt,
+static int ata_rcmd_write(disk_t *disk, uint64_t ba, size_t cnt,
     const void *buf)
 {
@@ -1067,5 +1064,5 @@
 	uint8_t drv_head;
 	block_coord_t bc;
-	errno_t rc;
+	int rc;
 
 	/* Silence warning. */
@@ -1117,9 +1114,9 @@
  * @return EOK on success, EIO on error.
  */
-static errno_t ata_rcmd_flush_cache(disk_t *disk)
+static int ata_rcmd_flush_cache(disk_t *disk)
 {
 	ata_ctrl_t *ctrl = disk->ctrl;
 	uint8_t drv_head;
-	errno_t rc;
+	int rc;
 
 	/* New value for Drive/Head register */
@@ -1159,5 +1156,5 @@
  * @return EOK on success or EINVAL if block index is past end of device.
  */
-static errno_t coord_calc(disk_t *d, uint64_t ba, block_coord_t *bc)
+static int coord_calc(disk_t *d, uint64_t ba, block_coord_t *bc)
 {
 	uint64_t c;
@@ -1246,5 +1243,5 @@
  * @return		EOK on success, EIO on timeout.
  */
-static errno_t wait_status(ata_ctrl_t *ctrl, unsigned set, unsigned n_reset,
+static int wait_status(ata_ctrl_t *ctrl, unsigned set, unsigned n_reset,
     uint8_t *pstatus, unsigned timeout)
 {
Index: uspace/drv/block/ata_bd/ata_bd.h
===================================================================
--- uspace/drv/block/ata_bd/ata_bd.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/block/ata_bd/ata_bd.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -153,7 +153,7 @@
 } ata_fun_t;
 
-extern errno_t ata_ctrl_init(ata_ctrl_t *, ata_base_t *);
-extern errno_t ata_ctrl_remove(ata_ctrl_t *);
-extern errno_t ata_ctrl_gone(ata_ctrl_t *);
+extern int ata_ctrl_init(ata_ctrl_t *, ata_base_t *);
+extern int ata_ctrl_remove(ata_ctrl_t *);
+extern int ata_ctrl_gone(ata_ctrl_t *);
 
 extern bd_ops_t ata_bd_ops;
Index: uspace/drv/block/ata_bd/main.c
===================================================================
--- uspace/drv/block/ata_bd/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/block/ata_bd/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,9 +41,9 @@
 #include "main.h"
 
-static errno_t ata_dev_add(ddf_dev_t *dev);
-static errno_t ata_dev_remove(ddf_dev_t *dev);
-static errno_t ata_dev_gone(ddf_dev_t *dev);
-static errno_t ata_fun_online(ddf_fun_t *fun);
-static errno_t ata_fun_offline(ddf_fun_t *fun);
+static int ata_dev_add(ddf_dev_t *dev);
+static int ata_dev_remove(ddf_dev_t *dev);
+static int ata_dev_gone(ddf_dev_t *dev);
+static int ata_fun_online(ddf_fun_t *fun);
+static int ata_fun_offline(ddf_fun_t *fun);
 
 static void ata_bd_connection(ipc_callid_t, ipc_call_t *, void *);
@@ -62,9 +62,9 @@
 };
 
-static errno_t ata_get_res(ddf_dev_t *dev, ata_base_t *ata_res)
+static int ata_get_res(ddf_dev_t *dev, ata_base_t *ata_res)
 {
 	async_sess_t *parent_sess;
 	hw_res_list_parsed_t hw_res;
-	errno_t rc;
+	int rc;
 
 	parent_sess = ddf_dev_parent_sess_get(dev);
@@ -106,11 +106,11 @@
  *
  * @param  dev New device
- * @return     EOK on success or an error code.
+ * @return     EOK on success or negative error code.
  */
-static errno_t ata_dev_add(ddf_dev_t *dev)
+static int ata_dev_add(ddf_dev_t *dev)
 {
 	ata_ctrl_t *ctrl;
 	ata_base_t res;
-	errno_t rc;
+	int rc;
 
 	rc = ata_get_res(dev, &res);
@@ -151,8 +151,8 @@
 }
 
-errno_t ata_fun_create(disk_t *disk)
+int ata_fun_create(disk_t *disk)
 {
 	ata_ctrl_t *ctrl = disk->ctrl;
-	errno_t rc;
+	int rc;
 	char *fun_name = NULL;
 	ddf_fun_t *fun = NULL;
@@ -212,7 +212,7 @@
 }
 
-errno_t ata_fun_remove(disk_t *disk)
-{
-	errno_t rc;
+int ata_fun_remove(disk_t *disk)
+{
+	int rc;
 	char *fun_name;
 
@@ -250,7 +250,7 @@
 }
 
-errno_t ata_fun_unbind(disk_t *disk)
-{
-	errno_t rc;
+int ata_fun_unbind(disk_t *disk)
+{
+	int rc;
 	char *fun_name;
 
@@ -282,5 +282,5 @@
 }
 
-static errno_t ata_dev_remove(ddf_dev_t *dev)
+static int ata_dev_remove(ddf_dev_t *dev)
 {
 	ata_ctrl_t *ctrl = (ata_ctrl_t *)ddf_dev_data_get(dev);
@@ -291,5 +291,5 @@
 }
 
-static errno_t ata_dev_gone(ddf_dev_t *dev)
+static int ata_dev_gone(ddf_dev_t *dev)
 {
 	ata_ctrl_t *ctrl = (ata_ctrl_t *)ddf_dev_data_get(dev);
@@ -300,5 +300,5 @@
 }
 
-static errno_t ata_fun_online(ddf_fun_t *fun)
+static int ata_fun_online(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "ata_fun_online()");
@@ -306,5 +306,5 @@
 }
 
-static errno_t ata_fun_offline(ddf_fun_t *fun)
+static int ata_fun_offline(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "ata_fun_offline()");
Index: uspace/drv/block/ata_bd/main.h
===================================================================
--- uspace/drv/block/ata_bd/main.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/block/ata_bd/main.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,7 +38,7 @@
 #include "ata_bd.h"
 
-extern errno_t ata_fun_create(disk_t *);
-extern errno_t ata_fun_remove(disk_t *);
-extern errno_t ata_fun_unbind(disk_t *);
+extern int ata_fun_create(disk_t *);
+extern int ata_fun_remove(disk_t *);
+extern int ata_fun_unbind(disk_t *);
 
 #endif
Index: uspace/drv/block/ddisk/ddisk.c
===================================================================
--- uspace/drv/block/ddisk/ddisk.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/block/ddisk/ddisk.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,9 +56,9 @@
 #define DDISK_CMD_IRQ_DEASSERT	0x4
 
-static errno_t ddisk_dev_add(ddf_dev_t *);
-static errno_t ddisk_dev_remove(ddf_dev_t *);
-static errno_t ddisk_dev_gone(ddf_dev_t *);
-static errno_t ddisk_fun_online(ddf_fun_t *);
-static errno_t ddisk_fun_offline(ddf_fun_t *);
+static int ddisk_dev_add(ddf_dev_t *);
+static int ddisk_dev_remove(ddf_dev_t *);
+static int ddisk_dev_gone(ddf_dev_t *);
+static int ddisk_fun_online(ddf_fun_t *);
+static int ddisk_fun_offline(ddf_fun_t *);
 
 static void ddisk_bd_connection(ipc_callid_t, ipc_call_t *, void *);
@@ -117,11 +117,11 @@
 } ddisk_t;
 
-static errno_t ddisk_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t ddisk_bd_close(bd_srv_t *);
-static errno_t ddisk_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t ddisk_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *,
+static int ddisk_bd_open(bd_srvs_t *, bd_srv_t *);
+static int ddisk_bd_close(bd_srv_t *);
+static int ddisk_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
+static int ddisk_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *,
     size_t);
-static errno_t ddisk_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t ddisk_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
+static int ddisk_bd_get_block_size(bd_srv_t *, size_t *);
+static int ddisk_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
 
 bd_ops_t ddisk_bd_ops = {
@@ -188,10 +188,10 @@
 }
 
-errno_t ddisk_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	return EOK;
-}
-
-errno_t ddisk_bd_close(bd_srv_t *bd)
+int ddisk_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
+{
+	return EOK;
+}
+
+int ddisk_bd_close(bd_srv_t *bd)
 {
 	return EOK;
@@ -199,5 +199,5 @@
 
 static
-errno_t ddisk_rw_block(ddisk_t *ddisk, bool read, aoff64_t ba, void *buf)
+int ddisk_rw_block(ddisk_t *ddisk, bool read, aoff64_t ba, void *buf)
 {
 	fibril_mutex_lock(&ddisk->lock);
@@ -236,10 +236,10 @@
 
 static
-errno_t ddisk_bd_rw_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
+int ddisk_bd_rw_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
     size_t size, bool is_read)
 {
 	ddisk_t *ddisk = (ddisk_t *) bd->srvs->sarg;
 	aoff64_t i;
-	errno_t rc;
+	int rc;
 
 	if (size < cnt * DDISK_BLOCK_SIZE)
@@ -256,5 +256,5 @@
 }
 
-errno_t ddisk_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
+int ddisk_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
     size_t size)
 {
@@ -262,5 +262,5 @@
 }
 
-errno_t ddisk_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
+int ddisk_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
     const void *buf, size_t size)
 {
@@ -268,5 +268,5 @@
 }
 
-errno_t ddisk_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
+int ddisk_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
 {
 	*rsize = DDISK_BLOCK_SIZE; 
@@ -274,5 +274,5 @@
 }
 
-errno_t ddisk_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
+int ddisk_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
 {
 	ddisk_t *ddisk = (ddisk_t *) bd->srvs->sarg;
@@ -282,9 +282,9 @@
 }
 
-static errno_t ddisk_get_res(ddf_dev_t *dev, ddisk_res_t *ddisk_res)
+static int ddisk_get_res(ddf_dev_t *dev, ddisk_res_t *ddisk_res)
 {
 	async_sess_t *parent_sess;
 	hw_res_list_parsed_t hw_res;
-	errno_t rc;
+	int rc;
 
 	parent_sess = ddf_dev_parent_sess_get(dev);
@@ -317,7 +317,7 @@
 }
 
-static errno_t ddisk_fun_create(ddisk_t *ddisk)
-{
-	errno_t rc;
+static int ddisk_fun_create(ddisk_t *ddisk)
+{
+	int rc;
 	ddf_fun_t *fun = NULL;
 
@@ -350,7 +350,7 @@
 }
 
-static errno_t ddisk_fun_remove(ddisk_t *ddisk)
-{
-	errno_t rc;
+static int ddisk_fun_remove(ddisk_t *ddisk)
+{
+	int rc;
 
 	if (ddisk->fun == NULL)
@@ -381,7 +381,7 @@
 }
 
-static errno_t ddisk_fun_unbind(ddisk_t *ddisk)
-{
-	errno_t rc;
+static int ddisk_fun_unbind(ddisk_t *ddisk)
+{
+	int rc;
 
 	if (ddisk->fun == NULL)
@@ -408,11 +408,11 @@
  *
  * @param  dev New device
- * @return     EOK on success or an error code.
+ * @return     EOK on success or negative error code.
  */
-static errno_t ddisk_dev_add(ddf_dev_t *dev)
+static int ddisk_dev_add(ddf_dev_t *dev)
 {
 	ddisk_t *ddisk;
 	ddisk_res_t res;
-	errno_t rc;
+	int rc;
 
 	/*
@@ -503,7 +503,8 @@
 	ddisk_irq_commands[0].addr = (void *) &res_phys->status;
 	ddisk_irq_commands[3].addr = (void *) &res_phys->command;
-	rc = register_interrupt_handler(dev, ddisk->ddisk_res.irq,
-	    ddisk_irq_handler, &ddisk_irq_code, &ddisk->irq_cap);
-	if (rc != EOK) {
+	ddisk->irq_cap = register_interrupt_handler(dev, ddisk->ddisk_res.irq,
+	    ddisk_irq_handler, &ddisk_irq_code);
+	if (ddisk->irq_cap < 0) {
+		rc = ddisk->irq_cap;
 		ddf_msg(LVL_ERROR, "Failed to register interrupt handler.");
 		goto error;
@@ -530,7 +531,7 @@
 
 
-static errno_t ddisk_dev_remove_common(ddisk_t *ddisk, bool surprise)
-{
-	errno_t rc;
+static int ddisk_dev_remove_common(ddisk_t *ddisk, bool surprise)
+{
+	int rc;
 
 	if (!surprise)
@@ -558,5 +559,5 @@
 }
 
-static errno_t ddisk_dev_remove(ddf_dev_t *dev)
+static int ddisk_dev_remove(ddf_dev_t *dev)
 {
 	ddisk_t *ddisk = (ddisk_t *) ddf_dev_data_get(dev);
@@ -566,5 +567,5 @@
 }
 
-static errno_t ddisk_dev_gone(ddf_dev_t *dev)
+static int ddisk_dev_gone(ddf_dev_t *dev)
 {
 	ddisk_t *ddisk = (ddisk_t *) ddf_dev_data_get(dev);
@@ -574,5 +575,5 @@
 }
 
-static errno_t ddisk_fun_online(ddf_fun_t *fun)
+static int ddisk_fun_online(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "ddisk_fun_online()");
@@ -580,5 +581,5 @@
 }
 
-static errno_t ddisk_fun_offline(ddf_fun_t *fun)
+static int ddisk_fun_offline(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "ddisk_fun_offline()");
Index: uspace/drv/block/usbmast/bo_trans.c
===================================================================
--- uspace/drv/block/usbmast/bo_trans.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/block/usbmast/bo_trans.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,7 +58,7 @@
  * @return		Error code
  */
-errno_t usb_massstor_cmd(usbmast_fun_t *mfun, uint32_t tag, scsi_cmd_t *cmd)
-{
-	errno_t rc;
+int usb_massstor_cmd(usbmast_fun_t *mfun, uint32_t tag, scsi_cmd_t *cmd)
+{
+	int rc;
 
 	if (cmd->data_in && cmd->data_out)
@@ -192,5 +192,5 @@
  * @return		Error code
  */
-errno_t usb_massstor_reset(usbmast_dev_t *mdev)
+int usb_massstor_reset(usbmast_dev_t *mdev)
 {
 	return usb_control_request_set(
@@ -228,5 +228,5 @@
  *
  * @param mfun		Mass storage function
- * @return		Maximum LUN (index, not count), or -1
+ * @return		Error code of maximum LUN (index, not count)
  */
 int usb_massstor_get_max_lun(usbmast_dev_t *mdev)
@@ -234,5 +234,5 @@
 	uint8_t max_lun;
 	size_t data_recv_len;
-	errno_t rc = usb_control_request_get(
+	int rc = usb_control_request_get(
 	    usb_device_get_default_pipe(mdev->usb_dev),
 	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,
@@ -240,10 +240,10 @@
 	    &data_recv_len);
 	if (rc != EOK) {
-		return -1;
+		return rc;
 	}
 	if (data_recv_len != 1) {
-		return -1;
-	}
-	return max_lun;
+		return EEMPTY;
+	}
+	return (int) max_lun;
 }
 
Index: uspace/drv/block/usbmast/bo_trans.h
===================================================================
--- uspace/drv/block/usbmast/bo_trans.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/block/usbmast/bo_trans.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -86,6 +86,6 @@
 } scsi_cmd_t;
 
-extern errno_t usb_massstor_cmd(usbmast_fun_t *, uint32_t, scsi_cmd_t *);
-extern errno_t usb_massstor_reset(usbmast_dev_t *);
+extern int usb_massstor_cmd(usbmast_fun_t *, uint32_t, scsi_cmd_t *);
+extern int usb_massstor_reset(usbmast_dev_t *);
 extern void usb_massstor_reset_recovery(usbmast_dev_t *);
 extern int usb_massstor_get_max_lun(usbmast_dev_t *);
Index: uspace/drv/block/usbmast/main.c
===================================================================
--- uspace/drv/block/usbmast/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/block/usbmast/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -77,15 +77,15 @@
 };
 
-static errno_t usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun);
+static int usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun);
 static void usbmast_bd_connection(ipc_callid_t iid, ipc_call_t *icall,
     void *arg);
 
-static errno_t usbmast_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t usbmast_bd_close(bd_srv_t *);
-static errno_t usbmast_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t usbmast_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
-static errno_t usbmast_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
-static errno_t usbmast_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t usbmast_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
+static int usbmast_bd_open(bd_srvs_t *, bd_srv_t *);
+static int usbmast_bd_close(bd_srv_t *);
+static int usbmast_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
+static int usbmast_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
+static int usbmast_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
+static int usbmast_bd_get_block_size(bd_srv_t *, size_t *);
+static int usbmast_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
 
 static bd_ops_t usbmast_bd_ops = {
@@ -109,5 +109,5 @@
  * @return Error code.
  */
-static errno_t usbmast_device_gone(usb_device_t *dev)
+static int usbmast_device_gone(usb_device_t *dev)
 {
 	usbmast_dev_t *mdev = usb_device_data_get(dev);
@@ -115,5 +115,5 @@
 
 	for (size_t i = 0; i < mdev->lun_count; ++i) {
-		const errno_t rc = ddf_fun_unbind(mdev->luns[i]);
+		const int rc = ddf_fun_unbind(mdev->luns[i]);
 		if (rc != EOK) {
 			usb_log_error("Failed to unbind LUN function %zu: "
@@ -133,5 +133,5 @@
  * @return Error code.
  */
-static errno_t usbmast_device_remove(usb_device_t *dev)
+static int usbmast_device_remove(usb_device_t *dev)
 {
 	//TODO: flush buffers, or whatever.
@@ -145,7 +145,7 @@
  * @return Error code.
  */
-static errno_t usbmast_device_add(usb_device_t *dev)
-{
-	errno_t rc;
+static int usbmast_device_add(usb_device_t *dev)
+{
+	int rc;
 	usbmast_dev_t *mdev = NULL;
 	unsigned i;
@@ -199,5 +199,5 @@
 		if (mdev->luns[i] == NULL)
 			continue;
-		const errno_t rc = ddf_fun_unbind(mdev->luns[i]);
+		const int rc = ddf_fun_unbind(mdev->luns[i]);
 		if (rc != EOK) {
 			usb_log_warning("Failed to unbind LUN function %zu: "
@@ -216,9 +216,9 @@
  * @param mdev		Mass storage device
  * @param lun		LUN
- * @return		EOK on success or an error code.
- */
-static errno_t usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun)
-{
-	errno_t rc;
+ * @return		EOK on success or negative error code.
+ */
+static int usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun)
+{
+	int rc;
 	char *fun_name = NULL;
 	ddf_fun_t *fun = NULL;
@@ -327,5 +327,5 @@
 
 /** Open device. */
-static errno_t usbmast_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
+static int usbmast_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
 {
 	return EOK;
@@ -333,5 +333,5 @@
 
 /** Close device. */
-static errno_t usbmast_bd_close(bd_srv_t *bd)
+static int usbmast_bd_close(bd_srv_t *bd)
 {
 	return EOK;
@@ -339,5 +339,5 @@
 
 /** Read blocks from the device. */
-static errno_t usbmast_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, void *buf,
+static int usbmast_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, void *buf,
     size_t size)
 {
@@ -351,5 +351,5 @@
 
 /** Synchronize blocks to nonvolatile storage. */
-static errno_t usbmast_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
+static int usbmast_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
 {
 	usbmast_fun_t *mfun = bd_srv_usbmast(bd);
@@ -359,5 +359,5 @@
 
 /** Write blocks to the device. */
-static errno_t usbmast_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
+static int usbmast_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
     const void *buf, size_t size)
 {
@@ -371,5 +371,5 @@
 
 /** Get device block size. */
-static errno_t usbmast_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
+static int usbmast_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
 {
 	usbmast_fun_t *mfun = bd_srv_usbmast(bd);
@@ -379,5 +379,5 @@
 
 /** Get number of blocks on device. */
-static errno_t usbmast_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
+static int usbmast_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
 {
 	usbmast_fun_t *mfun = bd_srv_usbmast(bd);
Index: uspace/drv/block/usbmast/scsi_ms.c
===================================================================
--- uspace/drv/block/usbmast/scsi_ms.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/block/usbmast/scsi_ms.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -72,9 +72,9 @@
 }
 
-static errno_t usb_massstor_unit_ready(usbmast_fun_t *mfun)
+static int usb_massstor_unit_ready(usbmast_fun_t *mfun)
 {
 	scsi_cmd_t cmd;
 	scsi_cdb_test_unit_ready_t cdb;
-	errno_t rc;
+	int rc;
 
 	memset(&cdb, 0, sizeof(cdb));
@@ -107,9 +107,9 @@
  * XXX This is too simplified.
  */
-static errno_t usbmast_run_cmd(usbmast_fun_t *mfun, scsi_cmd_t *cmd)
+static int usbmast_run_cmd(usbmast_fun_t *mfun, scsi_cmd_t *cmd)
 {
 	uint8_t sense_key;
 	scsi_sense_data_t sense_buf;
-	errno_t rc;
+	int rc;
 
 	do {
@@ -162,10 +162,10 @@
  * @return		Error code
  */
-errno_t usbmast_inquiry(usbmast_fun_t *mfun, usbmast_inquiry_data_t *inq_res)
+int usbmast_inquiry(usbmast_fun_t *mfun, usbmast_inquiry_data_t *inq_res)
 {
 	scsi_std_inquiry_data_t inq_data;
 	scsi_cmd_t cmd;
 	scsi_cdb_inquiry_t cdb;
-	errno_t rc;
+	int rc;
 
 	memset(&cdb, 0, sizeof(cdb));
@@ -231,9 +231,9 @@
  * @return		Error code.
  */
-errno_t usbmast_request_sense(usbmast_fun_t *mfun, void *buf, size_t size)
+int usbmast_request_sense(usbmast_fun_t *mfun, void *buf, size_t size)
 {
 	scsi_cmd_t cmd;
 	scsi_cdb_request_sense_t cdb;
-	errno_t rc;
+	int rc;
 
 	memset(&cdb, 0, sizeof(cdb));
@@ -272,5 +272,5 @@
  * @return		Error code.
  */
-errno_t usbmast_read_capacity(usbmast_fun_t *mfun, uint32_t *nblocks,
+int usbmast_read_capacity(usbmast_fun_t *mfun, uint32_t *nblocks,
     uint32_t *block_size)
 {
@@ -278,5 +278,5 @@
 	scsi_cdb_read_capacity_10_t cdb;
 	scsi_read_capacity_10_data_t data;
-	errno_t rc;
+	int rc;
 
 	memset(&cdb, 0, sizeof(cdb));
@@ -323,9 +323,9 @@
  * @return		Error code
  */
-errno_t usbmast_read(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks, void *buf)
+int usbmast_read(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks, void *buf)
 {
 	scsi_cmd_t cmd;
 	scsi_cdb_read_10_t cdb;
-	errno_t rc;
+	int rc;
 
 	if (ba > UINT32_MAX)
@@ -378,10 +378,10 @@
  * @return		Error code
  */
-errno_t usbmast_write(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks,
+int usbmast_write(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks,
     const void *data)
 {
 	scsi_cmd_t cmd;
 	scsi_cdb_write_10_t cdb;
-	errno_t rc;
+	int rc;
 
 	if (ba > UINT32_MAX)
@@ -428,5 +428,5 @@
  * @return		Error code
  */
-errno_t usbmast_sync_cache(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks)
+int usbmast_sync_cache(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks)
 {
 	if (ba > UINT32_MAX)
@@ -447,5 +447,5 @@
 	};
 
-	const errno_t rc = usbmast_run_cmd(mfun, &cmd);
+	const int rc = usbmast_run_cmd(mfun, &cmd);
 
         if (rc != EOK) {
Index: uspace/drv/block/usbmast/scsi_ms.h
===================================================================
--- uspace/drv/block/usbmast/scsi_ms.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/block/usbmast/scsi_ms.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,10 +60,10 @@
 } usbmast_inquiry_data_t;
 
-extern errno_t usbmast_inquiry(usbmast_fun_t *, usbmast_inquiry_data_t *);
-extern errno_t usbmast_request_sense(usbmast_fun_t *, void *, size_t);
-extern errno_t usbmast_read_capacity(usbmast_fun_t *, uint32_t *, uint32_t *);
-extern errno_t usbmast_read(usbmast_fun_t *, uint64_t, size_t, void *);
-extern errno_t usbmast_write(usbmast_fun_t *, uint64_t, size_t, const void *);
-extern errno_t usbmast_sync_cache(usbmast_fun_t *, uint64_t, size_t);
+extern int usbmast_inquiry(usbmast_fun_t *, usbmast_inquiry_data_t *);
+extern int usbmast_request_sense(usbmast_fun_t *, void *, size_t);
+extern int usbmast_read_capacity(usbmast_fun_t *, uint32_t *, uint32_t *);
+extern int usbmast_read(usbmast_fun_t *, uint64_t, size_t, void *);
+extern int usbmast_write(usbmast_fun_t *, uint64_t, size_t, const void *);
+extern int usbmast_sync_cache(usbmast_fun_t *, uint64_t, size_t);
 extern const char *usbmast_scsi_dev_type_str(unsigned);
 
Index: uspace/drv/bus/adb/cuda_adb/cuda_adb.c
===================================================================
--- uspace/drv/bus/adb/cuda_adb/cuda_adb.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/adb/cuda_adb/cuda_adb.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
 
 static void cuda_dev_connection(ipc_callid_t, ipc_call_t *, void *);
-static errno_t cuda_init(cuda_t *);
+static int cuda_init(cuda_t *);
 static void cuda_irq_handler(ipc_call_t *, void *);
 
@@ -108,10 +108,10 @@
 };
 
-static errno_t cuda_dev_create(cuda_t *cuda, const char *name, const char *id,
+static int cuda_dev_create(cuda_t *cuda, const char *name, const char *id,
     adb_dev_t **rdev)
 {
 	adb_dev_t *dev = NULL;
 	ddf_fun_t *fun;
-	errno_t rc;
+	int rc;
 
 	fun = ddf_fun_create(cuda->dev, fun_inner, name);
@@ -155,9 +155,9 @@
 }
 
-errno_t cuda_add(cuda_t *cuda, cuda_res_t *res)
+int cuda_add(cuda_t *cuda, cuda_res_t *res)
 {
 	adb_dev_t *kbd = NULL;
 	adb_dev_t *mouse = NULL;
-	errno_t rc;
+	int rc;
 
 	cuda->phys_base = res->base;
@@ -187,10 +187,10 @@
 }
 
-errno_t cuda_remove(cuda_t *cuda)
+int cuda_remove(cuda_t *cuda)
 {
 	return ENOTSUP;
 }
 
-errno_t cuda_gone(cuda_t *cuda)
+int cuda_gone(cuda_t *cuda)
 {
 	return ENOTSUP;
@@ -229,7 +229,7 @@
 }
 
-static errno_t cuda_init(cuda_t *cuda)
-{
-	errno_t rc;
+static int cuda_init(cuda_t *cuda)
+{
+	int rc;
 
 	void *vaddr;
@@ -252,5 +252,5 @@
 	cuda_irq_code.cmds[0].addr = (void *) &((cuda_regs_t *)
 	    cuda->phys_base)->ifr;
-	async_irq_subscribe(10, cuda_irq_handler, cuda, &cuda_irq_code, NULL);
+	async_irq_subscribe(10, cuda_irq_handler, cuda, &cuda_irq_code);
 
 	/* Enable SR interrupt. */
Index: uspace/drv/bus/adb/cuda_adb/cuda_adb.h
===================================================================
--- uspace/drv/bus/adb/cuda_adb/cuda_adb.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/adb/cuda_adb/cuda_adb.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -87,7 +87,7 @@
 } cuda_t;
 
-extern errno_t cuda_add(cuda_t *, cuda_res_t *);
-extern errno_t cuda_remove(cuda_t *);
-extern errno_t cuda_gone(cuda_t *);
+extern int cuda_add(cuda_t *, cuda_res_t *);
+extern int cuda_remove(cuda_t *);
+extern int cuda_gone(cuda_t *);
 
 #endif
Index: uspace/drv/bus/adb/cuda_adb/main.c
===================================================================
--- uspace/drv/bus/adb/cuda_adb/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/adb/cuda_adb/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,9 +43,9 @@
 #define NAME  "cuda_adb"
 
-static errno_t cuda_dev_add(ddf_dev_t *dev);
-static errno_t cuda_dev_remove(ddf_dev_t *dev);
-static errno_t cuda_dev_gone(ddf_dev_t *dev);
-static errno_t cuda_fun_online(ddf_fun_t *fun);
-static errno_t cuda_fun_offline(ddf_fun_t *fun);
+static int cuda_dev_add(ddf_dev_t *dev);
+static int cuda_dev_remove(ddf_dev_t *dev);
+static int cuda_dev_gone(ddf_dev_t *dev);
+static int cuda_fun_online(ddf_fun_t *fun);
+static int cuda_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -62,9 +62,9 @@
 };
 
-static errno_t cuda_get_res(ddf_dev_t *dev, cuda_res_t *res)
+static int cuda_get_res(ddf_dev_t *dev, cuda_res_t *res)
 {
 	async_sess_t *parent_sess;
 	hw_res_list_parsed_t hw_res;
-	errno_t rc;
+	int rc;
 
 	parent_sess = ddf_dev_parent_sess_get(dev);
@@ -97,9 +97,9 @@
 }
 
-static errno_t cuda_dev_add(ddf_dev_t *dev)
+static int cuda_dev_add(ddf_dev_t *dev)
 {
 	cuda_t *cuda;
 	cuda_res_t cuda_res;
-	errno_t rc;
+	int rc;
 
         ddf_msg(LVL_DEBUG, "cuda_dev_add(%p)", dev);
@@ -122,5 +122,5 @@
 }
 
-static errno_t cuda_dev_remove(ddf_dev_t *dev)
+static int cuda_dev_remove(ddf_dev_t *dev)
 {
         cuda_t *cuda = (cuda_t *)ddf_dev_data_get(dev);
@@ -131,5 +131,5 @@
 }
 
-static errno_t cuda_dev_gone(ddf_dev_t *dev)
+static int cuda_dev_gone(ddf_dev_t *dev)
 {
         cuda_t *cuda = (cuda_t *)ddf_dev_data_get(dev);
@@ -140,5 +140,5 @@
 }
 
-static errno_t cuda_fun_online(ddf_fun_t *fun)
+static int cuda_fun_online(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "cuda_fun_online()");
@@ -146,5 +146,5 @@
 }
 
-static errno_t cuda_fun_offline(ddf_fun_t *fun)
+static int cuda_fun_offline(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "cuda_fun_offline()");
Index: uspace/drv/bus/isa/i8237.c
===================================================================
--- uspace/drv/bus/isa/i8237.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/isa/i8237.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -279,8 +279,8 @@
  *
  */
-static inline errno_t dma_controller_init(dma_controller_t *controller)
+static inline int dma_controller_init(dma_controller_t *controller)
 {
 	assert(controller);
-	errno_t ret = pio_enable(DMA_CONTROLLER_PAGE_BASE, sizeof(dma_page_regs_t),
+	int ret = pio_enable(DMA_CONTROLLER_PAGE_BASE, sizeof(dma_page_regs_t),
 	    (void **) &controller->page_table);
 	if (ret != EOK)
@@ -339,5 +339,5 @@
  * @return Error code.
  */
-errno_t dma_channel_setup(unsigned int channel, uint32_t pa, uint32_t size,
+int dma_channel_setup(unsigned int channel, uint32_t pa, uint32_t size,
     uint8_t mode)
 {
@@ -454,5 +454,5 @@
  * @return Error code.
  */
-errno_t dma_channel_remain(unsigned channel, size_t *size)
+int dma_channel_remain(unsigned channel, size_t *size)
 {
 	assert(size);
Index: uspace/drv/bus/isa/i8237.h
===================================================================
--- uspace/drv/bus/isa/i8237.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/isa/i8237.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,6 +38,6 @@
 #define DRV_BUS_ISA_I8237_H
 
-extern errno_t dma_channel_setup(unsigned, uint32_t, uint32_t, uint8_t);
-extern errno_t dma_channel_remain(unsigned, size_t *);
+extern int dma_channel_setup(unsigned, uint32_t, uint32_t, uint8_t);
+extern int dma_channel_remain(unsigned, size_t *);
 
 #endif
Index: uspace/drv/bus/isa/isa.c
===================================================================
--- uspace/drv/bus/isa/isa.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/isa/isa.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -130,5 +130,5 @@
 }
 
-static errno_t isa_fun_enable_interrupt(ddf_fun_t *fnode, int irq)
+static int isa_fun_enable_interrupt(ddf_fun_t *fnode, int irq)
 {
 	isa_fun_t *fun = isa_fun(fnode);
@@ -140,5 +140,5 @@
 }
 
-static errno_t isa_fun_disable_interrupt(ddf_fun_t *fnode, int irq)
+static int isa_fun_disable_interrupt(ddf_fun_t *fnode, int irq)
 {
 	isa_fun_t *fun = isa_fun(fnode);
@@ -150,5 +150,5 @@
 }
 
-static errno_t isa_fun_clear_interrupt(ddf_fun_t *fnode, int irq)
+static int isa_fun_clear_interrupt(ddf_fun_t *fnode, int irq)
 {
 	isa_fun_t *fun = isa_fun(fnode);
@@ -160,5 +160,5 @@
 }
 
-static errno_t isa_fun_setup_dma(ddf_fun_t *fnode,
+static int isa_fun_setup_dma(ddf_fun_t *fnode,
     unsigned int channel, uint32_t pa, uint32_t size, uint8_t mode)
 {
@@ -182,5 +182,5 @@
 }
 
-static errno_t isa_fun_remain_dma(ddf_fun_t *fnode,
+static int isa_fun_remain_dma(ddf_fun_t *fnode,
     unsigned channel, size_t *size)
 {
@@ -232,8 +232,8 @@
 };
 
-static errno_t isa_dev_add(ddf_dev_t *dev);
-static errno_t isa_dev_remove(ddf_dev_t *dev);
-static errno_t isa_fun_online(ddf_fun_t *fun);
-static errno_t isa_fun_offline(ddf_fun_t *fun);
+static int isa_dev_add(ddf_dev_t *dev);
+static int isa_dev_remove(ddf_dev_t *dev);
+static int isa_fun_online(ddf_fun_t *fun);
+static int isa_fun_offline(ddf_fun_t *fun);
 
 /** The isa device driver's standard operations */
@@ -277,10 +277,10 @@
 	int fd;
 	size_t len;
-	errno_t rc;
+	int rc;
 	size_t nread;
-	vfs_stat_t st;
-
-	rc = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK) {
+	struct stat st;
+
+	fd = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ);
+	if (fd < 0) {
 		ddf_msg(LVL_ERROR, "Unable to open %s", conf_path);
 		goto cleanup;
@@ -578,5 +578,5 @@
 	    "function %s", id, score, ddf_fun_get_name(fun->fnode));
 
-	errno_t rc = ddf_fun_add_match_id(fun->fnode, id, score);
+	int rc = ddf_fun_add_match_id(fun->fnode, id, score);
 	if (rc != EOK) {
 		ddf_msg(LVL_ERROR, "Failed adding match ID: %s",
@@ -698,8 +698,8 @@
 }
 
-static errno_t isa_dev_add(ddf_dev_t *dev)
+static int isa_dev_add(ddf_dev_t *dev)
 {
 	async_sess_t *sess;
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "isa_dev_add, device handle = %d",
@@ -767,5 +767,5 @@
 }
 
-static errno_t isa_dev_remove(ddf_dev_t *dev)
+static int isa_dev_remove(ddf_dev_t *dev)
 {
 	isa_bus_t *isa = isa_bus(dev);
@@ -777,5 +777,5 @@
 		    isa_fun_t, bus_link);
 
-		errno_t rc = ddf_fun_offline(fun->fnode);
+		int rc = ddf_fun_offline(fun->fnode);
 		if (rc != EOK) {
 			fibril_mutex_unlock(&isa->mutex);
@@ -807,5 +807,5 @@
 }
 
-static errno_t isa_fun_online(ddf_fun_t *fun)
+static int isa_fun_online(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "isa_fun_online()");
@@ -813,5 +813,5 @@
 }
 
-static errno_t isa_fun_offline(ddf_fun_t *fun)
+static int isa_fun_offline(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "isa_fun_offline()");
Index: uspace/drv/bus/pci/pciintel/pci.c
===================================================================
--- uspace/drv/bus/pci/pciintel/pci.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/pci/pciintel/pci.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -99,5 +99,5 @@
 }
 
-static bool pciintel_fun_owns_interrupt(pci_fun_t *fun, int irq)
+static int pciintel_fun_owns_interrupt(pci_fun_t *fun, int irq)
 {
 	size_t i;
@@ -114,5 +114,5 @@
 }
 
-static errno_t pciintel_enable_interrupt(ddf_fun_t *fnode, int irq)
+static int pciintel_enable_interrupt(ddf_fun_t *fnode, int irq)
 {
 	pci_fun_t *fun = pci_fun(fnode);
@@ -124,5 +124,5 @@
 }
 
-static errno_t pciintel_disable_interrupt(ddf_fun_t *fnode, int irq)
+static int pciintel_disable_interrupt(ddf_fun_t *fnode, int irq)
 {
 	pci_fun_t *fun = pci_fun(fnode);
@@ -134,5 +134,5 @@
 }
 
-static errno_t pciintel_clear_interrupt(ddf_fun_t *fnode, int irq)
+static int pciintel_clear_interrupt(ddf_fun_t *fnode, int irq)
 {
 	pci_fun_t *fun = pci_fun(fnode);
@@ -154,5 +154,5 @@
 
 
-static errno_t config_space_write_32(ddf_fun_t *fun, uint32_t address,
+static int config_space_write_32(ddf_fun_t *fun, uint32_t address,
     uint32_t data)
 {
@@ -163,5 +163,5 @@
 }
 
-static errno_t config_space_write_16(
+static int config_space_write_16(
     ddf_fun_t *fun, uint32_t address, uint16_t data)
 {
@@ -172,5 +172,5 @@
 }
 
-static errno_t config_space_write_8(
+static int config_space_write_8(
     ddf_fun_t *fun, uint32_t address, uint8_t data)
 {
@@ -181,5 +181,5 @@
 }
 
-static errno_t config_space_read_32(
+static int config_space_read_32(
     ddf_fun_t *fun, uint32_t address, uint32_t *data)
 {
@@ -190,5 +190,5 @@
 }
 
-static errno_t config_space_read_16(
+static int config_space_read_16(
     ddf_fun_t *fun, uint32_t address, uint16_t *data)
 {
@@ -199,5 +199,5 @@
 }
 
-static errno_t config_space_read_8(
+static int config_space_read_8(
     ddf_fun_t *fun, uint32_t address, uint8_t *data)
 {
@@ -234,7 +234,7 @@
 };
 
-static errno_t pci_dev_add(ddf_dev_t *);
-static errno_t pci_fun_online(ddf_fun_t *);
-static errno_t pci_fun_offline(ddf_fun_t *);
+static int pci_dev_add(ddf_dev_t *);
+static int pci_fun_online(ddf_fun_t *);
+static int pci_fun_offline(ddf_fun_t *);
 
 /** PCI bus driver standard operations */
@@ -382,13 +382,13 @@
 void pci_fun_create_match_ids(pci_fun_t *fun)
 {
-	errno_t rc;
-	int ret;
+	int rc;
 	char match_id_str[ID_MAX_STR_LEN];
 
 	/* Vendor ID & Device ID, length(incl \0) 22 */
-	ret = snprintf(match_id_str, ID_MAX_STR_LEN, "pci/ven=%04"
+	rc = snprintf(match_id_str, ID_MAX_STR_LEN, "pci/ven=%04"
 	    PRIx16 "&dev=%04" PRIx16, fun->vendor_id, fun->device_id);
-	if (ret < 0) {
-		ddf_msg(LVL_ERROR, "Failed creating match ID str");
+	if (rc < 0) {
+		ddf_msg(LVL_ERROR, "Failed creating match ID str: %s",
+		    str_error(rc));
 	}
 
@@ -399,9 +399,10 @@
 
 	/* Class, subclass, prog IF, revision, length(incl \0) 47 */
-	ret = snprintf(match_id_str, ID_MAX_STR_LEN,
+	rc = snprintf(match_id_str, ID_MAX_STR_LEN,
 	    "pci/class=%02x&subclass=%02x&progif=%02x&revision=%02x",
 	    fun->class_code, fun->subclass_code, fun->prog_if, fun->revision);
-	if (ret < 0) {
-		ddf_msg(LVL_ERROR, "Failed creating match ID str");
+	if (rc < 0) {
+		ddf_msg(LVL_ERROR, "Failed creating match ID str: %s",
+		    str_error(rc));
 	}
 
@@ -412,9 +413,10 @@
 
 	/* Class, subclass, prog IF, length(incl \0) 35 */
-	ret = snprintf(match_id_str, ID_MAX_STR_LEN,
+	rc = snprintf(match_id_str, ID_MAX_STR_LEN,
 	    "pci/class=%02x&subclass=%02x&progif=%02x",
 	    fun->class_code, fun->subclass_code, fun->prog_if);
-	if (ret < 0) {
-		ddf_msg(LVL_ERROR, "Failed creating match ID str");
+	if (rc < 0) {
+		ddf_msg(LVL_ERROR, "Failed creating match ID str: %s",
+		    str_error(rc));
 	}
 
@@ -425,9 +427,10 @@
 
 	/* Class, subclass, length(incl \0) 25 */
-	ret = snprintf(match_id_str, ID_MAX_STR_LEN,
+	rc = snprintf(match_id_str, ID_MAX_STR_LEN,
 	    "pci/class=%02x&subclass=%02x",
 	    fun->class_code, fun->subclass_code);
-	if (ret < 0) {
-		ddf_msg(LVL_ERROR, "Failed creating match ID str");
+	if (rc < 0) {
+		ddf_msg(LVL_ERROR, "Failed creating match ID str: %s",
+		    str_error(rc));
 	}
 
@@ -438,8 +441,9 @@
 
 	/* Class, length(incl \0) 13 */
-	ret = snprintf(match_id_str, ID_MAX_STR_LEN, "pci/class=%02x",
+	rc = snprintf(match_id_str, ID_MAX_STR_LEN, "pci/class=%02x",
 	    fun->class_code);
-	if (ret < 0) {
-		ddf_msg(LVL_ERROR, "Failed creating match ID str");
+	if (rc < 0) {
+		ddf_msg(LVL_ERROR, "Failed creating match ID str: %s",
+		    str_error(rc));
 	}
 
@@ -510,5 +514,5 @@
 #define MEM_MASK (~0xf)
 	
-	io = (val & 1) != 0;
+	io = (bool) (val & 1);
 	if (io) {
 		addrw64 = false;
@@ -602,5 +606,5 @@
 {
 	pci_fun_t *fun;
-	errno_t rc;
+	int rc;
 	
 	int child_bus = 0;
@@ -684,5 +688,5 @@
 }
 
-static errno_t pci_dev_add(ddf_dev_t *dnode)
+static int pci_dev_add(ddf_dev_t *dnode)
 {
 	hw_resource_list_t hw_resources;
@@ -691,5 +695,5 @@
 	bool got_res = false;
 	async_sess_t *sess;
-	errno_t rc;
+	int rc;
 	
 	ddf_msg(LVL_DEBUG, "pci_dev_add");
@@ -810,5 +814,5 @@
 }
 
-static errno_t pci_fun_online(ddf_fun_t *fun)
+static int pci_fun_online(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "pci_fun_online()");
@@ -816,5 +820,5 @@
 }
 
-static errno_t pci_fun_offline(ddf_fun_t *fun)
+static int pci_fun_offline(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "pci_fun_offline()");
Index: uspace/drv/bus/usb/ehci/ehci_batch.c
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_batch.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/ehci_batch.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -234,8 +234,8 @@
 			    -= td_remain_size(ehci_batch->tds[i]);
 		} else {
-			usb_log_debug("Batch %p found error TD(%zu):%08x: %s.",
+			usb_log_debug("Batch %p found error TD(%zu):%08x (%d).",
 			    ehci_batch->usb_batch, i,
 			    ehci_batch->tds[i]->status,
-			    str_error_name(ehci_batch->usb_batch->error));
+			    ehci_batch->usb_batch->error);
 			/* Clear possible ED HALT */
 			qh_clear_halt(ehci_batch->qh);
Index: uspace/drv/bus/usb/ehci/ehci_endpoint.c
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_endpoint.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/ehci_endpoint.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -77,5 +77,5 @@
  * @return Error code.
  */
-errno_t ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep)
+int ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep)
 {
 	assert(ep);
Index: uspace/drv/bus/usb/ehci/ehci_endpoint.h
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_endpoint.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/ehci_endpoint.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
 } ehci_endpoint_t;
 
-errno_t ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep);
+int ehci_endpoint_init(hcd_t *hcd, endpoint_t *ep);
 void ehci_endpoint_fini(hcd_t *hcd, endpoint_t *ep);
 
Index: uspace/drv/bus/usb/ehci/ehci_rh.c
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_rh.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/ehci_rh.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -99,5 +99,5 @@
  * initializes internal virtual hub.
  */
-errno_t ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,
+int ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,
     const char *name)
 {
@@ -140,5 +140,5 @@
  * status change requests might be postponed until there is something to report.
  */
-errno_t ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch)
+int ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch)
 {
 	assert(instance);
@@ -175,5 +175,5 @@
  * processing of a postponed request.
  */
-errno_t ehci_rh_interrupt(ehci_rh_t *instance)
+int ehci_rh_interrupt(ehci_rh_t *instance)
 {
 	//TODO atomic swap needed
@@ -217,5 +217,5 @@
  * @return Error code.
  */
-static errno_t req_get_status(usbvirt_device_t *device,
+static int req_get_status(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -240,5 +240,5 @@
  * @return Error code.
  */
-static errno_t req_clear_hub_feature(usbvirt_device_t *device,
+static int req_clear_hub_feature(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -268,5 +268,5 @@
  * @return Error code.
  */
-static errno_t req_get_port_status(usbvirt_device_t *device,
+static int req_get_port_status(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -311,5 +311,5 @@
 } ehci_rh_job_t;
 
-static errno_t stop_reset(void *arg)
+static int stop_reset(void *arg)
 {
 	ehci_rh_job_t *job = arg;
@@ -340,5 +340,5 @@
 }
 
-static errno_t stop_resume(void *arg)
+static int stop_resume(void *arg)
 {
 	ehci_rh_job_t *job = arg;
@@ -353,5 +353,5 @@
 }
 
-static errno_t delayed_job(errno_t (*func)(void*), ehci_rh_t *rh, unsigned port)
+static int delayed_job(int (*func)(void*), ehci_rh_t *rh, unsigned port)
 {
 	ehci_rh_job_t *job = malloc(sizeof(*job));
@@ -379,5 +379,5 @@
  * @return Error code.
  */
-static errno_t req_clear_port_feature(usbvirt_device_t *device,
+static int req_clear_port_feature(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -458,5 +458,5 @@
  * @return Error code.
  */
-static errno_t req_set_port_feature(usbvirt_device_t *device,
+static int req_set_port_feature(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -507,5 +507,5 @@
  * only need 1 byte.
  */
-static errno_t req_status_change_handler(usbvirt_device_t *device,
+static int req_status_change_handler(usbvirt_device_t *device,
     usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
     void *buffer, size_t buffer_size, size_t *actual_size)
Index: uspace/drv/bus/usb/ehci/ehci_rh.h
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_rh.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/ehci_rh.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -67,8 +67,8 @@
 } ehci_rh_t;
 
-errno_t ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,
+int ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,
     const char *name);
-errno_t ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch);
-errno_t ehci_rh_interrupt(ehci_rh_t *instance);
+int ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch);
+int ehci_rh_interrupt(ehci_rh_t *instance);
 
 /** Get EHCI rh address.
Index: uspace/drv/bus/usb/ehci/endpoint_list.c
===================================================================
--- uspace/drv/bus/usb/ehci/endpoint_list.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/endpoint_list.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
  * Allocates memory for internal ed_t structure.
  */
-errno_t endpoint_list_init(endpoint_list_t *instance, const char *name)
+int endpoint_list_init(endpoint_list_t *instance, const char *name)
 {
 	assert(instance);
Index: uspace/drv/bus/usb/ehci/endpoint_list.h
===================================================================
--- uspace/drv/bus/usb/ehci/endpoint_list.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/endpoint_list.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -68,5 +68,5 @@
 }
 
-errno_t endpoint_list_init(endpoint_list_t *instance, const char *name);
+int endpoint_list_init(endpoint_list_t *instance, const char *name);
 void endpoint_list_chain(endpoint_list_t *instance, const endpoint_list_t *next);
 void endpoint_list_append_ep(endpoint_list_t *instance, ehci_endpoint_t *ep);
Index: uspace/drv/bus/usb/ehci/hc.c
===================================================================
--- uspace/drv/bus/usb/ehci/hc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/hc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -90,5 +90,5 @@
 
 static void hc_start(hc_t *instance);
-static errno_t hc_init_memory(hc_t *instance);
+static int hc_init_memory(hc_t *instance);
 
 /** Generate IRQ code.
@@ -96,9 +96,7 @@
  * @param[in] hw_res Device's resources.
  *
- * @param[out] irq
- *
  * @return Error code.
  */
-errno_t ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)
+int ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res)
 {
 	assert(code);
@@ -132,5 +130,5 @@
 	ehci_caps_regs_t *caps = NULL;
 
-	errno_t ret = pio_enable_range(&regs, (void**)&caps);
+	int ret = pio_enable_range(&regs, (void**)&caps);
 	if (ret != EOK) {
 		free(code->ranges);
@@ -148,6 +146,5 @@
 	    RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]);
 
-	*irq = hw_res->irqs.irqs[0];
-	return EOK;
+	return hw_res->irqs.irqs[0];
 }
 
@@ -159,5 +156,5 @@
  * @return Error code
  */
-errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
+int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
 {
 	assert(instance);
@@ -168,5 +165,5 @@
 	    return EINVAL;
 
-	errno_t ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
+	int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
 	    (void **)&instance->caps);
 	if (ret != EOK) {
@@ -273,5 +270,5 @@
 }
 
-errno_t ehci_hc_status(hcd_t *hcd, uint32_t *status)
+int ehci_hc_status(hcd_t *hcd, uint32_t *status)
 {
 	assert(hcd);
@@ -294,5 +291,5 @@
  * @return Error code.
  */
-errno_t ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
+int ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
 {
 	assert(hcd);
@@ -445,10 +442,10 @@
  * @return Error code.
  */
-errno_t hc_init_memory(hc_t *instance)
+int hc_init_memory(hc_t *instance)
 {
 	assert(instance);
 	usb_log_debug2("HC(%p): Initializing Async list(%p).", instance,
 	    &instance->async_list);
-	errno_t ret = endpoint_list_init(&instance->async_list, "ASYNC");
+	int ret = endpoint_list_init(&instance->async_list, "ASYNC");
 	if (ret != EOK) {
 		usb_log_error("HC(%p): Failed to setup ASYNC list: %s",
Index: uspace/drv/bus/usb/ehci/hc.h
===================================================================
--- uspace/drv/bus/usb/ehci/hc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/hc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -82,5 +82,5 @@
 } hc_t;
 
-errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts);
+int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts);
 void hc_fini(hc_t *instance);
 
@@ -88,9 +88,9 @@
 void hc_dequeue_endpoint(hc_t *instance, const endpoint_t *ep);
 
-errno_t ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq);
+int ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res);
 
 void ehci_hc_interrupt(hcd_t *hcd, uint32_t status);
-errno_t ehci_hc_status(hcd_t *hcd, uint32_t *status);
-errno_t ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);
+int ehci_hc_status(hcd_t *hcd, uint32_t *status);
+int ehci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);
 #endif
 /**
Index: uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c
===================================================================
--- uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,5 @@
 
 
-errno_t td_error(const td_t *td)
+int td_error(const td_t *td)
 {
 	assert(td);
Index: uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.h
===================================================================
--- uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -90,5 +90,5 @@
 }
 
-errno_t td_error(const td_t *td);
+int td_error(const td_t *td);
 
 void td_init(td_t *td, const td_t *next, usb_direction_t dir, const void * buf,
Index: uspace/drv/bus/usb/ehci/main.c
===================================================================
--- uspace/drv/bus/usb/ehci/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,5 @@
 #define NAME "ehci"
 
-static errno_t ehci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
+static int ehci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
 static void ehci_driver_fini(hcd_t *);
 
@@ -72,5 +72,5 @@
 
 
-static errno_t ehci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res,
+static int ehci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res,
     bool irq)
 {
@@ -82,5 +82,5 @@
 		return ENOMEM;
 
-	const errno_t ret = hc_init(instance, res, irq);
+	const int ret = hc_init(instance, res, irq);
 	if (ret == EOK) {
 		hcd_set_implementation(hcd, instance, &ehci_hc_driver.ops);
@@ -107,5 +107,5 @@
  * @return Error code.
  */
-static errno_t ehci_dev_add(ddf_dev_t *device)
+static int ehci_dev_add(ddf_dev_t *device)
 {
 	usb_log_debug("ehci_dev_add() called\n");
Index: uspace/drv/bus/usb/ehci/res.c
===================================================================
--- uspace/drv/bus/usb/ehci/res.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/res.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -62,5 +62,5 @@
  * @return Error code.
  */
-static errno_t disable_extended_caps(async_sess_t *parent_sess, unsigned eecp)
+static int disable_extended_caps(async_sess_t *parent_sess, unsigned eecp)
 {
 	/* nothing to do */
@@ -70,5 +70,5 @@
 	/* Read the first EEC. i.e. Legacy Support register */
 	uint32_t usblegsup;
-	errno_t ret = pci_config_space_read_32(parent_sess,
+	int ret = pci_config_space_read_32(parent_sess,
 	    eecp + USBLEGSUP_OFFSET, &usblegsup);
 	if (ret != EOK) {
@@ -172,5 +172,5 @@
 }
 
-errno_t disable_legacy(ddf_dev_t *device)
+int disable_legacy(ddf_dev_t *device)
 {
 	assert(device);
@@ -184,5 +184,5 @@
 	hw_res_list_parsed_t res;
 	hw_res_list_parsed_init(&res);
-	errno_t ret = hw_res_get_list_parsed(parent_sess, &res, 0);
+	int ret = hw_res_get_list_parsed(parent_sess, &res, 0);
 	if (ret != EOK) {
 		usb_log_error("Failed to get resource list: %s\n",
Index: uspace/drv/bus/usb/ehci/res.h
===================================================================
--- uspace/drv/bus/usb/ehci/res.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ehci/res.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include <device/hw_res_parsed.h>
 
-extern errno_t disable_legacy(ddf_dev_t *);
+extern int disable_legacy(ddf_dev_t *);
 
 #endif
Index: uspace/drv/bus/usb/ohci/endpoint_list.c
===================================================================
--- uspace/drv/bus/usb/ohci/endpoint_list.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ohci/endpoint_list.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
  * Allocates memory for internal ed_t structure.
  */
-errno_t endpoint_list_init(endpoint_list_t *instance, const char *name)
+int endpoint_list_init(endpoint_list_t *instance, const char *name)
 {
 	assert(instance);
Index: uspace/drv/bus/usb/ohci/endpoint_list.h
===================================================================
--- uspace/drv/bus/usb/ohci/endpoint_list.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ohci/endpoint_list.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -71,5 +71,5 @@
 }
 
-errno_t endpoint_list_init(endpoint_list_t *instance, const char *name);
+int endpoint_list_init(endpoint_list_t *instance, const char *name);
 void endpoint_list_set_next(
     const endpoint_list_t *instance, const endpoint_list_t *next);
Index: uspace/drv/bus/usb/ohci/hc.c
===================================================================
--- uspace/drv/bus/usb/ohci/hc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ohci/hc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -91,6 +91,6 @@
 static void hc_gain_control(hc_t *instance);
 static void hc_start(hc_t *instance);
-static errno_t hc_init_transfer_lists(hc_t *instance);
-static errno_t hc_init_memory(hc_t *instance);
+static int hc_init_transfer_lists(hc_t *instance);
+static int hc_init_memory(hc_t *instance);
 
 /** Generate IRQ code.
@@ -103,5 +103,5 @@
  * @return Error code.
  */
-errno_t ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)
+int ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res)
 {
 	assert(code);
@@ -141,6 +141,5 @@
 	    RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]);
 
-	*irq = hw_res->irqs.irqs[0];
-	return EOK;
+	return hw_res->irqs.irqs[0];
 }
 
@@ -152,5 +151,5 @@
  * @return Error code
  */
-errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
+int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
 {
 	assert(instance);
@@ -160,5 +159,5 @@
 	    return EINVAL;
 
-	errno_t ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
+	int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
 	    (void **) &instance->registers);
 	if (ret != EOK) {
@@ -269,5 +268,5 @@
 }
 
-errno_t ohci_hc_status(hcd_t *hcd, uint32_t *status)
+int ohci_hc_status(hcd_t *hcd, uint32_t *status)
 {
 	assert(hcd);
@@ -289,5 +288,5 @@
  * @return Error code.
  */
-errno_t ohci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
+int ohci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
 {
 	assert(hcd);
@@ -518,5 +517,5 @@
  * @return Error code
  */
-errno_t hc_init_transfer_lists(hc_t *instance)
+int hc_init_transfer_lists(hc_t *instance)
 {
 	assert(instance);
@@ -524,5 +523,5 @@
 do { \
 	const char *name = usb_str_transfer_type(type); \
-	const errno_t ret = endpoint_list_init(&instance->lists[type], name); \
+	const int ret = endpoint_list_init(&instance->lists[type], name); \
 	if (ret != EOK) { \
 		usb_log_error("Failed to setup %s endpoint list: %s.\n", \
@@ -552,5 +551,5 @@
  * @return Error code.
  */
-errno_t hc_init_memory(hc_t *instance)
+int hc_init_memory(hc_t *instance)
 {
 	assert(instance);
@@ -558,5 +557,5 @@
 	memset(&instance->rh, 0, sizeof(instance->rh));
 	/* Init queues */
-	const errno_t ret = hc_init_transfer_lists(instance);
+	const int ret = hc_init_transfer_lists(instance);
 	if (ret != EOK) {
 		return ret;
Index: uspace/drv/bus/usb/ohci/hc.h
===================================================================
--- uspace/drv/bus/usb/ohci/hc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ohci/hc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -80,5 +80,5 @@
 } hc_t;
 
-extern errno_t hc_init(hc_t *, const hw_res_list_parsed_t *, bool);
+extern int hc_init(hc_t *, const hw_res_list_parsed_t *, bool);
 extern void hc_fini(hc_t *);
 
@@ -86,9 +86,9 @@
 extern void hc_dequeue_endpoint(hc_t *, const endpoint_t *);
 
-errno_t ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq);
+int ohci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res);
 
 extern void ohci_hc_interrupt(hcd_t *, uint32_t);
-extern errno_t ohci_hc_status(hcd_t *, uint32_t *);
-extern errno_t ohci_hc_schedule(hcd_t *, usb_transfer_batch_t *);
+extern int ohci_hc_status(hcd_t *, uint32_t *);
+extern int ohci_hc_schedule(hcd_t *, usb_transfer_batch_t *);
 
 #endif
Index: uspace/drv/bus/usb/ohci/hw_struct/completion_codes.h
===================================================================
--- uspace/drv/bus/usb/ohci/hw_struct/completion_codes.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ohci/hw_struct/completion_codes.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,5 +54,5 @@
 };
 
-inline static errno_t cc_to_rc(unsigned int cc)
+inline static unsigned int cc_to_rc(unsigned int cc)
 {
 	switch (cc) {
Index: uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.h
===================================================================
--- uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -119,5 +119,5 @@
  * @return Error code.
  */
-static inline errno_t td_error(const td_t *instance)
+static inline int td_error(const td_t *instance)
 {
 	assert(instance);
Index: uspace/drv/bus/usb/ohci/main.c
===================================================================
--- uspace/drv/bus/usb/ohci/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ohci/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 
 #define NAME "ohci"
-static errno_t ohci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
+static int ohci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
 static void ohci_driver_fini(hcd_t *);
 
@@ -66,5 +66,5 @@
 
 
-static errno_t ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)
+static int ohci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)
 {
 	assert(hcd);
@@ -75,5 +75,5 @@
 		return ENOMEM;
 
-	const errno_t ret = hc_init(instance, res, irq);
+	const int ret = hc_init(instance, res, irq);
 	if (ret == EOK) {
 		hcd_set_implementation(hcd, instance, &ohci_hc_driver.ops);
@@ -100,5 +100,5 @@
  * @return Error code.
  */
-static errno_t ohci_dev_add(ddf_dev_t *device)
+static int ohci_dev_add(ddf_dev_t *device)
 {
 	usb_log_debug("ohci_dev_add() called\n");
Index: uspace/drv/bus/usb/ohci/ohci_endpoint.c
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_endpoint.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ohci/ohci_endpoint.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -72,5 +72,5 @@
  * @return Error code.
  */
-errno_t ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep)
+int ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep)
 {
 	assert(ep);
Index: uspace/drv/bus/usb/ohci/ohci_endpoint.h
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_endpoint.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ohci/ohci_endpoint.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,5 +53,5 @@
 } ohci_endpoint_t;
 
-errno_t ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep);
+int ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep);
 void ohci_endpoint_fini(hcd_t *hcd, endpoint_t *ep);
 
Index: uspace/drv/bus/usb/ohci/ohci_rh.c
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_rh.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ohci/ohci_rh.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -109,5 +109,5 @@
  * initializes internal virtual hub.
  */
-errno_t ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name)
+int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name)
 {
 	assert(instance);
@@ -174,5 +174,5 @@
  * status change requests might be postponed until there is something to report.
  */
-errno_t ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch)
+int ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch)
 {
 	assert(instance);
@@ -205,5 +205,5 @@
  * processing of a postponed request.
  */
-errno_t ohci_rh_interrupt(ohci_rh_t *instance)
+int ohci_rh_interrupt(ohci_rh_t *instance)
 {
 	//TODO atomic swap needed
@@ -245,5 +245,5 @@
  * @return Error code.
  */
-static errno_t req_get_status(usbvirt_device_t *device,
+static int req_get_status(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -268,5 +268,5 @@
  * @return Error code.
  */
-static errno_t req_clear_hub_feature(usbvirt_device_t *device,
+static int req_clear_hub_feature(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -298,5 +298,5 @@
  * @return Error code.
  */
-static errno_t req_get_port_status(usbvirt_device_t *device,
+static int req_get_port_status(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -322,5 +322,5 @@
  * @return Error code.
  */
-static errno_t req_clear_port_feature(usbvirt_device_t *device,
+static int req_clear_port_feature(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -386,5 +386,5 @@
  * @return Error code.
  */
-static errno_t req_set_port_feature(usbvirt_device_t *device,
+static int req_set_port_feature(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -437,5 +437,5 @@
  * only need 1 byte.
  */
-static errno_t req_status_change_handler(usbvirt_device_t *device,
+static int req_status_change_handler(usbvirt_device_t *device,
     usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
     void *buffer, size_t buffer_size, size_t *actual_size)
Index: uspace/drv/bus/usb/ohci/ohci_rh.h
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_rh.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/ohci/ohci_rh.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -65,7 +65,7 @@
 } ohci_rh_t;
 
-errno_t ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name);
-errno_t ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch);
-errno_t ohci_rh_interrupt(ohci_rh_t *instance);
+int ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs, const char *name);
+int ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch);
+int ohci_rh_interrupt(ohci_rh_t *instance);
 
 /** Get OHCI rh address.
Index: uspace/drv/bus/usb/uhci/hc.c
===================================================================
--- uspace/drv/bus/usb/uhci/hc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/uhci/hc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -94,8 +94,8 @@
 
 static void hc_init_hw(const hc_t *instance);
-static errno_t hc_init_mem_structures(hc_t *instance);
-static errno_t hc_init_transfer_lists(hc_t *instance);
-
-static errno_t hc_debug_checker(void *arg);
+static int hc_init_mem_structures(hc_t *instance);
+static int hc_init_transfer_lists(hc_t *instance);
+
+static int hc_debug_checker(void *arg);
 
 
@@ -103,9 +103,8 @@
  * @param[out] code IRQ code structure.
  * @param[in] hw_res Device's resources.
- * @param[out] irq
  *
  * @return Error code.
  */
-errno_t uhci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res, int *irq)
+int uhci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res)
 {
 	assert(code);
@@ -143,6 +142,5 @@
 	    RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]);
 
-	*irq = hw_res->irqs.irqs[0];
-	return EOK;
+	return hw_res->irqs.irqs[0];
 }
 
@@ -216,5 +214,5 @@
  * interrupt fibrils.
  */
-errno_t hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
+int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
 {
 	assert(instance);
@@ -228,5 +226,5 @@
 
 	/* allow access to hc control registers */
-	errno_t ret = pio_enable_range(&hw_res->io_ranges.ranges[0],
+	int ret = pio_enable_range(&hw_res->io_ranges.ranges[0],
 	    (void **) &instance->registers);
 	if (ret != EOK) {
@@ -318,5 +316,5 @@
  *  - frame list page (needs to be one UHCI hw accessible 4K page)
  */
-errno_t hc_init_mem_structures(hc_t *instance)
+int hc_init_mem_structures(hc_t *instance)
 {
 	assert(instance);
@@ -330,5 +328,5 @@
 
 	/* Init transfer lists */
-	errno_t ret = hc_init_transfer_lists(instance);
+	int ret = hc_init_transfer_lists(instance);
 	if (ret != EOK) {
 		usb_log_error("Failed to initialize transfer lists.\n");
@@ -359,10 +357,10 @@
  * USB scheduling. Sets pointer table for quick access.
  */
-errno_t hc_init_transfer_lists(hc_t *instance)
+int hc_init_transfer_lists(hc_t *instance)
 {
 	assert(instance);
 #define SETUP_TRANSFER_LIST(type, name) \
 do { \
-	errno_t ret = transfer_list_init(&instance->transfers_##type, name); \
+	int ret = transfer_list_init(&instance->transfers_##type, name); \
 	if (ret != EOK) { \
 		usb_log_error("Failed to setup %s transfer list: %s.\n", \
@@ -411,5 +409,5 @@
 }
 
-errno_t uhci_hc_status(hcd_t *hcd, uint32_t *status)
+int uhci_hc_status(hcd_t *hcd, uint32_t *status)
 {
 	assert(hcd);
@@ -435,5 +433,5 @@
  * Checks for bandwidth availability and appends the batch to the proper queue.
  */
-errno_t uhci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
+int uhci_hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
 {
 	assert(hcd);
@@ -464,5 +462,5 @@
  * @return EOK (should never return)
  */
-errno_t hc_debug_checker(void *arg)
+int hc_debug_checker(void *arg)
 {
 	hc_t *instance = arg;
Index: uspace/drv/bus/usb/uhci/hc.h
===================================================================
--- uspace/drv/bus/usb/uhci/hc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/uhci/hc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -124,12 +124,12 @@
 } hc_t;
 
-extern errno_t hc_init(hc_t *, const hw_res_list_parsed_t *, bool);
+extern int hc_init(hc_t *, const hw_res_list_parsed_t *, bool);
 extern void hc_fini(hc_t *);
 
-extern errno_t uhci_hc_gen_irq_code(irq_code_t *, const hw_res_list_parsed_t *, int *);
+extern int uhci_hc_gen_irq_code(irq_code_t *, const hw_res_list_parsed_t *);
 
 extern void uhci_hc_interrupt(hcd_t *, uint32_t);
-extern errno_t uhci_hc_status(hcd_t *, uint32_t *);
-extern errno_t uhci_hc_schedule(hcd_t *, usb_transfer_batch_t *);
+extern int uhci_hc_status(hcd_t *, uint32_t *);
+extern int uhci_hc_schedule(hcd_t *, usb_transfer_batch_t *);
 
 #endif
Index: uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.c
===================================================================
--- uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -119,5 +119,5 @@
  * @return Error code.
  */
-errno_t td_status(const td_t *instance)
+int td_status(const td_t *instance)
 {
 	assert(instance);
Index: uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.h
===================================================================
--- uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -102,5 +102,5 @@
     const void *buffer, const td_t *next);
 
-errno_t td_status(const td_t *instance);
+int td_status(const td_t *instance);
 
 void td_print_status(const td_t *instance);
Index: uspace/drv/bus/usb/uhci/main.c
===================================================================
--- uspace/drv/bus/usb/uhci/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/uhci/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,7 +49,7 @@
 #define NAME "uhci"
 
-static errno_t uhci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
+static int uhci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool);
 static void uhci_driver_fini(hcd_t *);
-static errno_t disable_legacy(ddf_dev_t *);
+static int disable_legacy(ddf_dev_t *);
 
 static const ddf_hc_driver_t uhci_hc_driver = {
@@ -67,5 +67,5 @@
 };
 
-static errno_t uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)
+static int uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq)
 {
 	assert(hcd);
@@ -76,5 +76,5 @@
 		return ENOMEM;
 
-	const errno_t ret = hc_init(instance, res, irq);
+	const int ret = hc_init(instance, res, irq);
 	if (ret == EOK) {
 		hcd_set_implementation(hcd, instance, &uhci_hc_driver.ops);
@@ -101,5 +101,5 @@
  * @return Error code.
  */
-static errno_t disable_legacy(ddf_dev_t *device)
+static int disable_legacy(ddf_dev_t *device)
 {
 	assert(device);
@@ -119,5 +119,5 @@
  * @return Error code.
  */
-static errno_t uhci_dev_add(ddf_dev_t *device)
+static int uhci_dev_add(ddf_dev_t *device)
 {
 	usb_log_debug2("uhci_dev_add() called\n");
Index: uspace/drv/bus/usb/uhci/transfer_list.c
===================================================================
--- uspace/drv/bus/usb/uhci/transfer_list.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/uhci/transfer_list.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
  * Allocates memory for internal qh_t structure.
  */
-errno_t transfer_list_init(transfer_list_t *instance, const char *name)
+int transfer_list_init(transfer_list_t *instance, const char *name)
 {
 	assert(instance);
Index: uspace/drv/bus/usb/uhci/transfer_list.h
===================================================================
--- uspace/drv/bus/usb/uhci/transfer_list.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/uhci/transfer_list.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,5 +57,5 @@
 
 void transfer_list_fini(transfer_list_t *instance);
-errno_t transfer_list_init(transfer_list_t *instance, const char *name);
+int transfer_list_init(transfer_list_t *instance, const char *name);
 void transfer_list_set_next(transfer_list_t *instance, transfer_list_t *next);
 void transfer_list_add_batch(
Index: uspace/drv/bus/usb/uhci/uhci_rh.c
===================================================================
--- uspace/drv/bus/usb/uhci/uhci_rh.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/uhci/uhci_rh.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -78,5 +78,5 @@
  * @return Error code, EOK on success.
  */
-errno_t uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name)
+int uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name)
 {
 	assert(instance);
@@ -98,5 +98,5 @@
  * not have to be.
  */
-errno_t uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch)
+int uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch)
 {
 	assert(instance);
@@ -193,5 +193,5 @@
  * it is usefull for debuging purposes only.
  */
-static errno_t req_get_port_state(usbvirt_device_t *device,
+static int req_get_port_state(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -228,5 +228,5 @@
  * @note: reset change status needs to be handled in sw.
  */
-static errno_t req_get_port_status(usbvirt_device_t *device,
+static int req_get_port_status(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -267,5 +267,5 @@
  * @return Error code.
  */
-static errno_t req_clear_port_feature(usbvirt_device_t *device,
+static int req_clear_port_feature(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -340,5 +340,5 @@
  * @return Error code.
  */
-static errno_t req_set_port_feature(usbvirt_device_t *device,
+static int req_set_port_feature(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -402,5 +402,5 @@
  * only need 1 byte.
  */
-static errno_t req_status_change_handler(usbvirt_device_t *device,
+static int req_status_change_handler(usbvirt_device_t *device,
     usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
     void *buffer, size_t buffer_size, size_t *actual_size)
Index: uspace/drv/bus/usb/uhci/uhci_rh.h
===================================================================
--- uspace/drv/bus/usb/uhci/uhci_rh.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/uhci/uhci_rh.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,6 +56,6 @@
 } uhci_rh_t;
 
-errno_t uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name);
-errno_t uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch);
+int uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name);
+int uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch);
 
 /** Get UHCI rh address.
Index: uspace/drv/bus/usb/usbflbk/main.c
===================================================================
--- uspace/drv/bus/usb/usbflbk/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/usbflbk/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
  * @return Error code.
  */
-static errno_t usbfallback_device_add(usb_device_t *dev)
+static int usbfallback_device_add(usb_device_t *dev)
 {
 	usb_log_info("Pretending to control %s `%s'.\n",
@@ -59,5 +59,5 @@
  * @return Error code.
  */
-static errno_t usbfallback_device_gone(usb_device_t *dev)
+static int usbfallback_device_gone(usb_device_t *dev)
 {
 	assert(dev);
Index: uspace/drv/bus/usb/usbhub/port.c
===================================================================
--- uspace/drv/bus/usb/usbhub/port.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/usbhub/port.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,13 +54,13 @@
 };
 
-static errno_t usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub);
+static int usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub);
 static void usb_hub_port_reset_completed(usb_hub_port_t *port,
     usb_hub_dev_t *hub, usb_port_status_t status);
-static errno_t get_port_status(usb_hub_port_t *port, usb_port_status_t *status);
-static errno_t add_device_phase1_worker_fibril(void *arg);
-static errno_t create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,
+static int get_port_status(usb_hub_port_t *port, usb_port_status_t *status);
+static int add_device_phase1_worker_fibril(void *arg);
+static int create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,
     usb_speed_t speed);
 
-errno_t usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub)
+int usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub)
 {
 	assert(port);
@@ -77,5 +77,5 @@
  * @return Operation result
  */
-errno_t usb_hub_port_clear_feature(
+int usb_hub_port_clear_feature(
     usb_hub_port_t *port, usb_hub_class_feature_t feature)
 {
@@ -99,5 +99,5 @@
  * @return Operation result
  */
-errno_t usb_hub_port_set_feature(
+int usb_hub_port_set_feature(
     usb_hub_port_t *port, usb_hub_class_feature_t feature)
 {
@@ -143,5 +143,5 @@
 
 	usb_port_status_t status = 0;
-	const errno_t opResult = get_port_status(port, &status);
+	const int opResult = get_port_status(port, &status);
 	if (opResult != EOK) {
 		usb_log_error("(%p-%u): Failed to get port status: %s.\n", hub,
@@ -158,5 +158,5 @@
 
 		/* ACK the change */
-		const errno_t opResult = usb_hub_port_clear_feature(port,
+		const int opResult = usb_hub_port_clear_feature(port,
 		    USB_HUB_FEATURE_C_PORT_CONNECTION);
 		if (opResult != EOK) {
@@ -167,5 +167,5 @@
 
 		if (connected) {
-			const errno_t opResult = create_add_device_fibril(port, hub,
+			const int opResult = create_add_device_fibril(port, hub,
 			    usb_port_speed(status));
 			if (opResult != EOK) {
@@ -191,5 +191,5 @@
 		   port->port_number);
 		usb_hub_port_device_gone(port, hub);
-		const errno_t rc = usb_hub_port_clear_feature(port,
+		const int rc = usb_hub_port_clear_feature(port,
 		        USB_HUB_FEATURE_C_PORT_ENABLE);
 		if (rc != EOK) {
@@ -206,5 +206,5 @@
 		    " NOT happen as we do not support suspend state!", hub,
 		    port->port_number);
-		const errno_t rc = usb_hub_port_clear_feature(port,
+		const int rc = usb_hub_port_clear_feature(port,
 		        USB_HUB_FEATURE_C_PORT_SUSPEND);
 		if (rc != EOK) {
@@ -224,5 +224,5 @@
 		 * mode. USB system software is responsible for powering port
 		 * back on when the over-current condition is gone */
-		const errno_t rc = usb_hub_port_clear_feature(port,
+		const int rc = usb_hub_port_clear_feature(port,
 		    USB_HUB_FEATURE_C_PORT_OVER_CURRENT);
 		if (rc != EOK) {
@@ -232,5 +232,5 @@
 		}
 		if (!(status & ~USB_HUB_PORT_STATUS_OC)) {
-			const errno_t rc = usb_hub_port_set_feature(
+			const int rc = usb_hub_port_set_feature(
 			    port, USB_HUB_FEATURE_PORT_POWER);
 			if (rc != EOK) {
@@ -260,5 +260,5 @@
  * @param hub hub representation
  */
-errno_t usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub)
+int usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub)
 {
 	assert(port);
@@ -267,5 +267,5 @@
 	if (!exch)
 		return ENOMEM;
-	const errno_t rc = usb_device_remove(exch, port->port_number);
+	const int rc = usb_device_remove(exch, port->port_number);
 	usb_device_bus_exchange_end(exch);
 	if (rc == EOK)
@@ -304,5 +304,5 @@
 
 	/* Clear the port reset change. */
-	errno_t rc = usb_hub_port_clear_feature(port, USB_HUB_FEATURE_C_PORT_RESET);
+	int rc = usb_hub_port_clear_feature(port, USB_HUB_FEATURE_C_PORT_RESET);
 	if (rc != EOK) {
 		usb_log_error("(%p-%u): Failed to clear port reset change: %s.",
@@ -317,5 +317,5 @@
  * @return Error code.
  */
-static errno_t get_port_status(usb_hub_port_t *port, usb_port_status_t *status)
+static int get_port_status(usb_hub_port_t *port, usb_port_status_t *status)
 {
 	assert(port);
@@ -333,5 +333,5 @@
 	usb_port_status_t status_tmp;
 
-	const errno_t rc = usb_pipe_control_read(port->control_pipe,
+	const int rc = usb_pipe_control_read(port->control_pipe,
 	    &request, sizeof(usb_device_request_setup_packet_t),
 	    &status_tmp, sizeof(status_tmp), &recv_size);
@@ -351,8 +351,8 @@
 }
 
-static errno_t port_enable(usb_hub_port_t *port, usb_hub_dev_t *hub, bool enable)
+static int port_enable(usb_hub_port_t *port, usb_hub_dev_t *hub, bool enable)
 {
 	if (enable) {
-		errno_t rc =
+		int rc =
 		    usb_hub_port_set_feature(port, USB_HUB_FEATURE_PORT_RESET);
 		if (rc != EOK) {
@@ -383,10 +383,10 @@
  * @return 0 Always.
  */
-errno_t add_device_phase1_worker_fibril(void *arg)
+int add_device_phase1_worker_fibril(void *arg)
 {
 	struct add_device_phase1 *params = arg;
 	assert(params);
 
-	errno_t ret = EOK;
+	int ret = EOK;
 	usb_hub_dev_t *hub = params->hub;
 	usb_hub_port_t *port = params->port;
@@ -434,5 +434,5 @@
 		usb_log_error("(%p-%u): Failed to enumerate device: %s", hub,
 		    port->port_number, str_error(ret));
-		const errno_t ret = port_enable(port, hub, false);
+		const int ret = port_enable(port, hub, false);
 		if (ret != EOK) {
 			usb_log_warning("(%p-%u)Failed to disable port (%s), "
@@ -440,5 +440,5 @@
 			    port->port_number, str_error(ret));
 		} else {
-			const errno_t ret = usb_release_default_address(exch);
+			const int ret = usb_release_default_address(exch);
 			if (ret != EOK)
 				usb_log_warning("(%p-%u): Failed to release "
@@ -475,5 +475,5 @@
  * @return Error code.
  */
-static errno_t create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,
+static int create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,
     usb_speed_t speed)
 {
Index: uspace/drv/bus/usb/usbhub/port.h
===================================================================
--- uspace/drv/bus/usb/usbhub/port.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/usbhub/port.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -83,8 +83,8 @@
 }
 
-errno_t usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub);
-errno_t usb_hub_port_clear_feature(
+int usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub);
+int usb_hub_port_clear_feature(
     usb_hub_port_t *port, usb_hub_class_feature_t feature);
-errno_t usb_hub_port_set_feature(
+int usb_hub_port_set_feature(
     usb_hub_port_t *port, usb_hub_class_feature_t feature);
 void usb_hub_port_reset_fail(usb_hub_port_t *port);
Index: uspace/drv/bus/usb/usbhub/usbhub.c
===================================================================
--- uspace/drv/bus/usb/usbhub/usbhub.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/usbhub/usbhub.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -81,6 +81,6 @@
 };
 
-static errno_t usb_set_first_configuration(usb_device_t *usb_device);
-static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev);
+static int usb_set_first_configuration(usb_device_t *usb_device);
+static int usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev);
 static void usb_hub_over_current(const usb_hub_dev_t *hub_dev,
     usb_hub_status_t status);
@@ -97,5 +97,5 @@
  * @return error code
  */
-errno_t usb_hub_device_add(usb_device_t *usb_dev)
+int usb_hub_device_add(usb_device_t *usb_dev)
 {
 	assert(usb_dev);
@@ -114,5 +114,5 @@
 
 	/* Set hub's first configuration. (There should be only one) */
-	errno_t opResult = usb_set_first_configuration(usb_dev);
+	int opResult = usb_set_first_configuration(usb_dev);
 	if (opResult != EOK) {
 		usb_log_error("Could not set hub configuration: %s\n",
@@ -174,5 +174,5 @@
  * @return error code
  */
-errno_t usb_hub_device_remove(usb_device_t *usb_dev)
+int usb_hub_device_remove(usb_device_t *usb_dev)
 {
 	return ENOTSUP;
@@ -184,5 +184,5 @@
  * @return error code
  */
-errno_t usb_hub_device_gone(usb_device_t *usb_dev)
+int usb_hub_device_gone(usb_device_t *usb_dev)
 {
 	assert(usb_dev);
@@ -202,5 +202,5 @@
 
 	for (size_t port = 0; port < hub->port_count; ++port) {
-		const errno_t ret = usb_hub_port_fini(&hub->ports[port], hub);
+		const int ret = usb_hub_port_fini(&hub->ports[port], hub);
 		if (ret != EOK)
 			return ret;
@@ -208,5 +208,5 @@
 	free(hub->ports);
 
-	const errno_t ret = ddf_fun_unbind(hub->hub_fun);
+	const int ret = ddf_fun_unbind(hub->hub_fun);
 	if (ret != EOK) {
 		usb_log_error("(%p) Failed to unbind '%s' function: %s.",
@@ -266,5 +266,5 @@
  * @return error code
  */
-static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev)
+static int usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev)
 {
 	assert(hub_dev);
@@ -277,5 +277,5 @@
 	usb_hub_descriptor_header_t descriptor;
 	size_t received_size;
-	errno_t opResult = usb_request_get_descriptor(control_pipe,
+	int opResult = usb_request_get_descriptor(control_pipe,
 	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_DEVICE,
 	    USB_DESCTYPE_HUB, 0, 0, &descriptor,
@@ -317,5 +317,5 @@
 	for (unsigned int port = 0; port < hub_dev->port_count; ++port) {
 		usb_log_debug("(%p): Powering port %u.", hub_dev, port);
-		const errno_t ret = usb_hub_port_set_feature(
+		const int ret = usb_hub_port_set_feature(
 		    &hub_dev->ports[port], USB_HUB_FEATURE_PORT_POWER);
 
@@ -343,5 +343,5 @@
  * @return error code
  */
-static errno_t usb_set_first_configuration(usb_device_t *usb_device)
+static int usb_set_first_configuration(usb_device_t *usb_device)
 {
 	assert(usb_device);
@@ -369,5 +369,5 @@
 	/* Set configuration. Use the configuration that was in
 	 * usb_device->descriptors.configuration i.e. The first one. */
-	const errno_t opResult = usb_request_set_configuration(
+	const int opResult = usb_request_set_configuration(
 	    usb_device_get_default_pipe(usb_device),
 	    config_descriptor->configuration_number);
@@ -406,5 +406,5 @@
 	/* Over-current condition is gone, it is safe to turn the ports on. */
 	for (size_t port = 0; port < hub_dev->port_count; ++port) {
-		const errno_t ret = usb_hub_port_set_feature(
+		const int ret = usb_hub_port_set_feature(
 		    &hub_dev->ports[port], USB_HUB_FEATURE_PORT_POWER);
 		if (ret != EOK) {
@@ -438,5 +438,5 @@
 	/* NOTE: We can't use standard USB GET_STATUS request, because
 	 * hubs reply is 4byte instead of 2 */
-	const errno_t opResult = usb_pipe_control_read(control_pipe,
+	const int opResult = usb_pipe_control_read(control_pipe,
 	    &get_hub_status_request, sizeof(get_hub_status_request),
 	    &status, sizeof(usb_hub_status_t), &rcvd_size);
@@ -456,5 +456,5 @@
 		usb_hub_over_current(hub_dev, status);
 		/* Ack change in hub OC flag */
-		const errno_t ret = usb_request_clear_feature(
+		const int ret = usb_request_clear_feature(
 		    control_pipe, USB_REQUEST_TYPE_CLASS,
 		    USB_REQUEST_RECIPIENT_DEVICE,
@@ -480,5 +480,5 @@
 		 * Just ACK the change.
 		 */
-		const errno_t ret = usb_request_clear_feature(
+		const int ret = usb_request_clear_feature(
 		    control_pipe, USB_REQUEST_TYPE_CLASS,
 		    USB_REQUEST_RECIPIENT_DEVICE,
Index: uspace/drv/bus/usb/usbhub/usbhub.h
===================================================================
--- uspace/drv/bus/usb/usbhub/usbhub.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/usbhub/usbhub.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -83,7 +83,7 @@
 extern const usb_endpoint_description_t hub_status_change_endpoint_description;
 
-extern errno_t usb_hub_device_add(usb_device_t *);
-extern errno_t usb_hub_device_remove(usb_device_t *);
-extern errno_t usb_hub_device_gone(usb_device_t *);
+extern int usb_hub_device_add(usb_device_t *);
+extern int usb_hub_device_remove(usb_device_t *);
+extern int usb_hub_device_gone(usb_device_t *);
 
 extern bool hub_port_changes_callback(usb_device_t *, uint8_t *, size_t,
Index: uspace/drv/bus/usb/usbmid/explore.c
===================================================================
--- uspace/drv/bus/usb/usbmid/explore.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/usbmid/explore.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -66,5 +66,5 @@
  * @param list List where to add the interfaces.
  */
-static errno_t create_interfaces(const uint8_t *config_descriptor,
+static int create_interfaces(const uint8_t *config_descriptor,
     size_t config_descriptor_size, list_t *list, usb_device_t *usb_dev)
 {
@@ -111,5 +111,5 @@
 
 		usbmid_interface_t *iface = NULL;
-		const errno_t rc = usbmid_spawn_interface_child(usb_dev, &iface,
+		const int rc = usbmid_spawn_interface_child(usb_dev, &iface,
 			&usb_device_descriptors(usb_dev)->device, interface);
 		if (rc != EOK) {
@@ -134,5 +134,5 @@
  * @return Whether to accept this device.
  */
-errno_t usbmid_explore_device(usb_device_t *dev)
+int usbmid_explore_device(usb_device_t *dev)
 {
 	assert(dev);
@@ -157,5 +157,5 @@
 
 	/* Select the first configuration */
-	errno_t rc = usb_request_set_configuration(usb_device_get_default_pipe(dev),
+	int rc = usb_request_set_configuration(usb_device_get_default_pipe(dev),
 	    config_descriptor->configuration_number);
 	if (rc != EOK) {
Index: uspace/drv/bus/usb/usbmid/main.c
===================================================================
--- uspace/drv/bus/usb/usbmid/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/usbmid/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
  * @return Error code.
  */
-static errno_t usbmid_device_add(usb_device_t *dev)
+static int usbmid_device_add(usb_device_t *dev)
 {
 	usb_log_info("Taking care of new MID `%s'.\n", usb_device_get_name(dev));
@@ -61,5 +61,5 @@
  * @return Error code.
  */
-static errno_t usbmid_device_remove(usb_device_t *dev)
+static int usbmid_device_remove(usb_device_t *dev)
 {
 	assert(dev);
@@ -68,5 +68,5 @@
 
 	/* Remove ctl function */
-	errno_t ret = ddf_fun_unbind(usb_mid->ctl_fun);
+	int ret = ddf_fun_unbind(usb_mid->ctl_fun);
 	if (ret != EOK) {
 		usb_log_error("Failed to unbind USB MID ctl function: %s.\n",
@@ -87,5 +87,5 @@
 
 		/* Tell the child to go off-line. */
-		errno_t pret = ddf_fun_offline(iface->fun);
+		int pret = ddf_fun_offline(iface->fun);
 		if (pret != EOK) {
 			usb_log_warning("Failed to turn off child `%s': %s\n",
@@ -110,5 +110,5 @@
  * @return Error code.
  */
-static errno_t usbmid_device_gone(usb_device_t *dev)
+static int usbmid_device_gone(usb_device_t *dev)
 {
 	assert(dev);
@@ -119,5 +119,5 @@
 
 	/* Remove ctl function */
-	errno_t ret = ddf_fun_unbind(usb_mid->ctl_fun);
+	int ret = ddf_fun_unbind(usb_mid->ctl_fun);
 	if (ret != EOK) {
 		usb_log_error("Failed to unbind USB MID ctl function: %s.\n",
@@ -137,5 +137,5 @@
 		    ddf_fun_get_name(iface->fun));
 
-		const errno_t pret = usbmid_interface_destroy(iface);
+		const int pret = usbmid_interface_destroy(iface);
 		if (pret != EOK) {
 			usb_log_error("Failed to remove child `%s': %s\n",
Index: uspace/drv/bus/usb/usbmid/usbmid.c
===================================================================
--- uspace/drv/bus/usb/usbmid/usbmid.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/usbmid/usbmid.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
  * @return Error code.
  */
-static errno_t usb_iface_device_handle(ddf_fun_t *fun, devman_handle_t *handle)
+static int usb_iface_device_handle(ddf_fun_t *fun, devman_handle_t *handle)
 {
 	assert(fun);
@@ -61,5 +61,5 @@
 
 /** Callback for DDF USB get interface. */
-static errno_t usb_iface_iface_no(ddf_fun_t *fun, int *iface_no)
+static int usb_iface_iface_no(ddf_fun_t *fun, int *iface_no)
 {
 	usbmid_interface_t *iface = ddf_fun_data_get(fun);
@@ -83,9 +83,9 @@
 };
 
-errno_t usbmid_interface_destroy(usbmid_interface_t *mid_iface)
+int usbmid_interface_destroy(usbmid_interface_t *mid_iface)
 {
 	assert(mid_iface);
 	assert_link_not_used(&mid_iface->link);
-	const errno_t ret = ddf_fun_unbind(mid_iface->fun);
+	const int ret = ddf_fun_unbind(mid_iface->fun);
 	if (ret != EOK) {
 		return ret;
@@ -103,5 +103,5 @@
  * @return Error code.
  */
-errno_t usbmid_spawn_interface_child(usb_device_t *parent,
+int usbmid_spawn_interface_child(usb_device_t *parent,
     usbmid_interface_t **iface_ret,
     const usb_standard_device_descriptor_t *device_descriptor,
@@ -110,5 +110,5 @@
 	ddf_fun_t *child = NULL;
 	char *child_name = NULL;
-	errno_t rc;
+	int rc;
 
 	/*
@@ -117,8 +117,8 @@
 	 * class name something humanly understandable.
 	 */
-	int ret = asprintf(&child_name, "%s%hhu",
+	rc = asprintf(&child_name, "%s%hhu",
 	    usb_str_class(interface_descriptor->interface_class),
 	    interface_descriptor->interface_number);
-	if (ret < 0) {
+	if (rc < 0) {
 		return ENOMEM;
 	}
Index: uspace/drv/bus/usb/usbmid/usbmid.h
===================================================================
--- uspace/drv/bus/usb/usbmid/usbmid.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/usbmid/usbmid.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -62,10 +62,10 @@
 } usb_mid_t;
 
-extern errno_t usbmid_explore_device(usb_device_t *);
-extern errno_t usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t **,
+extern int usbmid_explore_device(usb_device_t *);
+extern int usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t **,
     const usb_standard_device_descriptor_t *,
     const usb_standard_interface_descriptor_t *);
 extern void usbmid_dump_descriptors(uint8_t *, size_t);
-extern errno_t usbmid_interface_destroy(usbmid_interface_t *mid_iface);
+extern int usbmid_interface_destroy(usbmid_interface_t *mid_iface);
 
 static inline usbmid_interface_t * usbmid_interface_from_link(link_t *item)
Index: uspace/drv/bus/usb/vhc/conndev.c
===================================================================
--- uspace/drv/bus/usb/vhc/conndev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/vhc/conndev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -75,6 +75,6 @@
 	}
 	
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
+	sysarg_t data_request_rc;
+	sysarg_t opening_request_rc;
 	async_wait_for(data_request, &data_request_rc);
 	async_wait_for(opening_request, &opening_request_rc);
@@ -102,5 +102,5 @@
 	
 	if (callback) {
-		errno_t rc = vhc_virtdev_plug(vhc, callback, &plugged_device_handle);
+		int rc = vhc_virtdev_plug(vhc, callback, &plugged_device_handle);
 		if (rc != EOK) {
 			async_answer_0(icallid, rc);
Index: uspace/drv/bus/usb/vhc/devconn.c
===================================================================
--- uspace/drv/bus/usb/vhc/devconn.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/vhc/devconn.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
 }
 
-static errno_t vhc_virtdev_plug_generic(vhc_data_t *vhc,
+static int vhc_virtdev_plug_generic(vhc_data_t *vhc,
     async_sess_t *sess, usbvirt_device_t *virtdev,
     uintptr_t *handle, bool connect, usb_address_t address)
@@ -85,15 +85,15 @@
 }
 
-errno_t vhc_virtdev_plug(vhc_data_t *vhc, async_sess_t *sess, uintptr_t *handle)
+int vhc_virtdev_plug(vhc_data_t *vhc, async_sess_t *sess, uintptr_t *handle)
 {
 	return vhc_virtdev_plug_generic(vhc, sess, NULL, handle, true, 0);
 }
 
-errno_t vhc_virtdev_plug_local(vhc_data_t *vhc, usbvirt_device_t *dev, uintptr_t *handle)
+int vhc_virtdev_plug_local(vhc_data_t *vhc, usbvirt_device_t *dev, uintptr_t *handle)
 {
 	return vhc_virtdev_plug_generic(vhc, NULL, dev, handle, true, 0);
 }
 
-errno_t vhc_virtdev_plug_hub(vhc_data_t *vhc, usbvirt_device_t *dev,
+int vhc_virtdev_plug_hub(vhc_data_t *vhc, usbvirt_device_t *dev,
     uintptr_t *handle, usb_address_t address)
 {
Index: uspace/drv/bus/usb/vhc/hub/hub.c
===================================================================
--- uspace/drv/bus/usb/vhc/hub/hub.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/vhc/hub/hub.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -63,5 +63,5 @@
 static void set_port_status_change(hub_port_t *, hub_status_change_t);
 static void clear_port_status_change(hub_port_t *, uint16_t);
-static errno_t set_port_state_delayed_fibril(void *);
+static int set_port_state_delayed_fibril(void *);
 static void set_port_state_delayed(hub_t *, size_t, suseconds_t,
     hub_port_state_t, hub_port_state_t);
@@ -163,5 +163,5 @@
  * @return Error code.
  */
-errno_t hub_disconnect_device(hub_t *hub, void *device)
+int hub_disconnect_device(hub_t *hub, void *device)
 {
 	size_t index = hub_find_device(hub, device);
@@ -461,5 +461,5 @@
  * @return Always EOK.
  */
-static errno_t set_port_state_delayed_fibril(void *arg)
+static int set_port_state_delayed_fibril(void *arg)
 {
 	struct delay_port_state_change *change
Index: uspace/drv/bus/usb/vhc/hub/hub.h
===================================================================
--- uspace/drv/bus/usb/vhc/hub/hub.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/vhc/hub/hub.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -102,5 +102,5 @@
 void hub_init(hub_t *);
 size_t hub_connect_device(hub_t *, void *);
-errno_t hub_disconnect_device(hub_t *, void *);
+int hub_disconnect_device(hub_t *, void *);
 size_t hub_find_device(hub_t *, void *);
 void hub_acquire(hub_t *);
Index: uspace/drv/bus/usb/vhc/hub/virthub.c
===================================================================
--- uspace/drv/bus/usb/vhc/hub/virthub.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/vhc/hub/virthub.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 #include <ddf/driver.h>
 
@@ -148,5 +147,5 @@
  * @return Error code.
  */
-errno_t virthub_init(usbvirt_device_t *dev, const char* name)
+int virthub_init(usbvirt_device_t *dev, const char* name)
 {
 	if (dev == NULL) {
@@ -156,16 +155,14 @@
 	dev->descriptors = &descriptors;
 	dev->address = 0;
-
-	char *n = str_dup(name);
-	if (!n)
+	dev->name = str_dup(name);
+	if (!dev->name)
 		return ENOMEM;
 
 	hub_t *hub = malloc(sizeof(hub_t));
 	if (hub == NULL) {
-		free(n);
+		free(dev->name);
 		return ENOMEM;
 	}
 
-	dev->name = n;
 	hub_init(hub);
 	dev->device_data = hub;
@@ -200,5 +197,5 @@
  * @return Error code.
  */
-errno_t virthub_disconnect_device(usbvirt_device_t *dev, vhc_virtdev_t *conn)
+int virthub_disconnect_device(usbvirt_device_t *dev, vhc_virtdev_t *conn)
 {
 	assert(dev != NULL);
Index: uspace/drv/bus/usb/vhc/hub/virthub.h
===================================================================
--- uspace/drv/bus/usb/vhc/hub/virthub.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/vhc/hub/virthub.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -80,7 +80,7 @@
 extern hub_descriptor_t hub_descriptor;
 
-errno_t virthub_init(usbvirt_device_t *, const char *name);
+int virthub_init(usbvirt_device_t *, const char *name);
 int virthub_connect_device(usbvirt_device_t *, vhc_virtdev_t *);
-errno_t virthub_disconnect_device(usbvirt_device_t *, vhc_virtdev_t *);
+int virthub_disconnect_device(usbvirt_device_t *, vhc_virtdev_t *);
 bool virthub_is_device_enabled(usbvirt_device_t *, vhc_virtdev_t *);
 void virthub_get_status(usbvirt_device_t *, char *, size_t);
Index: uspace/drv/bus/usb/vhc/hub/virthubops.c
===================================================================
--- uspace/drv/bus/usb/vhc/hub/virthubops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/vhc/hub/virthubops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -63,5 +63,5 @@
 
 /** Callback for data request. */
-static errno_t req_on_status_change_pipe(usbvirt_device_t *dev,
+static int req_on_status_change_pipe(usbvirt_device_t *dev,
     usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
     void *buffer, size_t buffer_size, size_t *actual_size)
@@ -109,5 +109,5 @@
  * @return Error code.
  */
-static errno_t req_clear_hub_feature(usbvirt_device_t *dev,
+static int req_clear_hub_feature(usbvirt_device_t *dev,
     const usb_device_request_setup_packet_t *request, uint8_t *data,
     size_t *act_size)
@@ -123,9 +123,9 @@
  * @return Error code.
  */
-static errno_t req_clear_port_feature(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	errno_t rc;
+static int req_clear_port_feature(usbvirt_device_t *dev,
+    const usb_device_request_setup_packet_t *request, uint8_t *data,
+    size_t *act_size)
+{
+	int rc;
 	size_t port = request->index - 1;
 	usb_hub_class_feature_t feature = request->value;
@@ -203,5 +203,5 @@
  * @return Error code.
  */
-static errno_t req_get_bus_state(usbvirt_device_t *dev,
+static int req_get_bus_state(usbvirt_device_t *dev,
     const usb_device_request_setup_packet_t *request, uint8_t *data,
     size_t *act_size)
@@ -217,5 +217,5 @@
  * @return Error code.
  */
-static errno_t req_get_descriptor(usbvirt_device_t *dev,
+static int req_get_descriptor(usbvirt_device_t *dev,
     const usb_device_request_setup_packet_t *request, uint8_t *data,
     size_t *act_size)
@@ -238,5 +238,5 @@
  * @return Error code.
  */
-static errno_t req_get_hub_status(usbvirt_device_t *dev,
+static int req_get_hub_status(usbvirt_device_t *dev,
     const usb_device_request_setup_packet_t *request, uint8_t *data,
     size_t *act_size)
@@ -257,5 +257,5 @@
  * @return Error code.
  */
-static errno_t req_get_port_status(usbvirt_device_t *dev,
+static int req_get_port_status(usbvirt_device_t *dev,
     const usb_device_request_setup_packet_t *request, uint8_t *data,
     size_t *act_size)
@@ -282,5 +282,5 @@
  * @return Error code.
  */
-static errno_t req_set_hub_feature(usbvirt_device_t *dev,
+static int req_set_hub_feature(usbvirt_device_t *dev,
     const usb_device_request_setup_packet_t *request, uint8_t *data,
     size_t *act_size)
@@ -296,9 +296,9 @@
  * @return Error code.
  */
-static errno_t req_set_port_feature(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	errno_t rc = ENOTSUP;
+static int req_set_port_feature(usbvirt_device_t *dev,
+    const usb_device_request_setup_packet_t *request, uint8_t *data,
+    size_t *act_size)
+{
+	int rc = ENOTSUP;
 	size_t port = request->index - 1;
 	usb_hub_class_feature_t feature = request->value;
Index: uspace/drv/bus/usb/vhc/main.c
===================================================================
--- uspace/drv/bus/usb/vhc/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/vhc/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
 };
 
-static errno_t vhc_control_node(ddf_dev_t *dev, ddf_fun_t **fun)
+static int vhc_control_node(ddf_dev_t *dev, ddf_fun_t **fun)
 {
 	assert(dev);
@@ -63,5 +63,5 @@
 	}
 	ddf_fun_set_ops(*fun, &vhc_ops);
-	const errno_t ret = ddf_fun_bind(*fun);
+	const int ret = ddf_fun_bind(*fun);
 	if (ret != EOK) {
 		ddf_fun_destroy(*fun);
@@ -77,9 +77,9 @@
 };
 
-static errno_t vhc_dev_add(ddf_dev_t *dev)
+static int vhc_dev_add(ddf_dev_t *dev)
 {
 	/* Initialize virtual structure */
 	ddf_fun_t *ctl_fun = NULL;
-	errno_t ret = vhc_control_node(dev, &ctl_fun);
+	int ret = vhc_control_node(dev, &ctl_fun);
 	if (ret != EOK) {
 		usb_log_error("Failed to setup control node.\n");
Index: uspace/drv/bus/usb/vhc/transfer.c
===================================================================
--- uspace/drv/bus/usb/vhc/transfer.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/vhc/transfer.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,8 +58,8 @@
 }
 
-static errno_t process_transfer_local(usb_transfer_batch_t *batch,
+static int process_transfer_local(usb_transfer_batch_t *batch,
     usbvirt_device_t *dev, size_t *actual_data_size)
 {
-	errno_t rc;
+	int rc;
 	
 	const usb_direction_t dir = usb_transfer_batch_direction(batch);
@@ -94,8 +94,8 @@
 }
 
-static errno_t process_transfer_remote(usb_transfer_batch_t *batch,
+static int process_transfer_remote(usb_transfer_batch_t *batch,
     async_sess_t *sess, size_t *actual_data_size)
 {
-	errno_t rc;
+	int rc;
 
 	const usb_direction_t dir = usb_transfer_batch_direction(batch);
@@ -143,5 +143,5 @@
 
 static void execute_transfer_callback_and_free(vhc_transfer_t *transfer,
-    size_t data_transfer_size, errno_t outcome)
+    size_t data_transfer_size, int outcome)
 {
 	assert(outcome != ENAK);
@@ -154,5 +154,5 @@
 }
 
-errno_t vhc_init(vhc_data_t *instance)
+int vhc_init(vhc_data_t *instance)
 {
 	assert(instance);
@@ -163,5 +163,5 @@
 }
 
-errno_t vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
+int vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
 {
 	assert(hcd);
@@ -199,5 +199,5 @@
 }
 
-errno_t vhc_transfer_queue_processor(void *arg)
+int vhc_transfer_queue_processor(void *arg)
 {
 	vhc_virtdev_t *dev = arg;
@@ -214,5 +214,5 @@
 		fibril_mutex_unlock(&dev->guard);
 
-		errno_t rc = EOK;
+		int rc = EOK;
 		size_t data_transfer_size = 0;
 		if (dev->dev_sess) {
Index: uspace/drv/bus/usb/vhc/vhcd.h
===================================================================
--- uspace/drv/bus/usb/vhc/vhcd.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/bus/usb/vhc/vhcd.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -71,12 +71,12 @@
     ipc_call_t *icall);
 
-errno_t vhc_virtdev_plug(vhc_data_t *, async_sess_t *, uintptr_t *);
-errno_t vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *);
-errno_t vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *, usb_address_t address);
+int vhc_virtdev_plug(vhc_data_t *, async_sess_t *, uintptr_t *);
+int vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *);
+int vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *, usb_address_t address);
 void vhc_virtdev_unplug(vhc_data_t *, uintptr_t);
 
-errno_t vhc_init(vhc_data_t *instance);
-errno_t vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);
-errno_t vhc_transfer_queue_processor(void *arg);
+int vhc_init(vhc_data_t *instance);
+int vhc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);
+int vhc_transfer_queue_processor(void *arg);
 
 #endif
Index: uspace/drv/char/i8042/i8042.c
===================================================================
--- uspace/drv/char/i8042/i8042.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/i8042/i8042.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -68,6 +68,6 @@
 
 static void i8042_char_conn(ipc_callid_t, ipc_call_t *, void *);
-static errno_t i8042_read(chardev_srv_t *, void *, size_t, size_t *);
-static errno_t i8042_write(chardev_srv_t *, const void *, size_t, size_t *);
+static int i8042_read(chardev_srv_t *, void *, size_t, size_t *);
+static int i8042_write(chardev_srv_t *, const void *, size_t, size_t *);
 
 static chardev_ops_t i8042_chardev_ops = {
@@ -129,5 +129,5 @@
 {
 	i8042_t *controller = ddf_dev_data_get(dev);
-	errno_t rc;
+	int rc;
 	
 	const uint8_t status = IPC_GET_ARG1(*call);
@@ -158,5 +158,5 @@
  *
  */
-errno_t i8042_init(i8042_t *dev, addr_range_t *regs, int irq_kbd,
+int i8042_init(i8042_t *dev, addr_range_t *regs, int irq_kbd,
     int irq_mouse, ddf_dev_t *ddf_dev)
 {
@@ -170,5 +170,5 @@
 	i8042_regs_t *ar;
 	
-	errno_t rc;
+	int rc;
 	bool kbd_bound = false;
 	bool aux_bound = false;
@@ -281,8 +281,8 @@
 	};
 	
-	int irq_kbd_cap;
-	rc = register_interrupt_handler(ddf_dev, irq_kbd,
-	    i8042_irq_handler, &irq_code, &irq_kbd_cap);
-	if (rc != EOK) {
+	const int irq_kbd_cap = register_interrupt_handler(ddf_dev, irq_kbd,
+	    i8042_irq_handler, &irq_code);
+	if (irq_kbd_cap < 0) {
+		rc = irq_kbd_cap;
 		ddf_msg(LVL_ERROR, "Failed set handler for kbd: %s.",
 		    ddf_dev_get_name(ddf_dev));
@@ -290,8 +290,8 @@
 	}
 	
-	int irq_mouse_cap;
-	rc = register_interrupt_handler(ddf_dev, irq_mouse,
-	    i8042_irq_handler, &irq_code, &irq_mouse_cap);
-	if (rc != EOK) {
+	const int irq_mouse_cap = register_interrupt_handler(ddf_dev, irq_mouse,
+	    i8042_irq_handler, &irq_code);
+	if (irq_mouse_cap < 0) {
+		rc = irq_mouse_cap;
 		ddf_msg(LVL_ERROR, "Failed set handler for mouse: %s.",
 		    ddf_dev_get_name(ddf_dev));
@@ -350,5 +350,5 @@
  *
  */
-static errno_t i8042_write(chardev_srv_t *srv, const void *data, size_t size,
+static int i8042_write(chardev_srv_t *srv, const void *data, size_t size,
     size_t *nwr)
 {
@@ -385,5 +385,5 @@
  *
  */
-static errno_t i8042_read(chardev_srv_t *srv, void *dest, size_t size,
+static int i8042_read(chardev_srv_t *srv, void *dest, size_t size,
     size_t *nread)
 {
@@ -391,5 +391,5 @@
 	size_t p;
 	uint8_t *destp = (uint8_t *)dest;
-	errno_t rc;
+	int rc;
 	
 	fibril_mutex_lock(&port->buf_lock);
Index: uspace/drv/char/i8042/i8042.h
===================================================================
--- uspace/drv/char/i8042/i8042.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/i8042/i8042.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -88,5 +88,5 @@
 } i8042_t;
 
-extern errno_t i8042_init(i8042_t *, addr_range_t *, int, int, ddf_dev_t *);
+extern int i8042_init(i8042_t *, addr_range_t *, int, int, ddf_dev_t *);
 
 #endif
Index: uspace/drv/char/i8042/main.c
===================================================================
--- uspace/drv/char/i8042/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/i8042/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,5 +55,5 @@
  *
  */
-static errno_t get_my_registers(ddf_dev_t *dev, addr_range_t *p_io_reg,
+static int get_my_registers(ddf_dev_t *dev, addr_range_t *p_io_reg,
     int *kbd_irq, int *mouse_irq)
 {
@@ -66,5 +66,5 @@
 	hw_res_list_parsed_t hw_resources;
 	hw_res_list_parsed_init(&hw_resources);
-	const errno_t ret = hw_res_get_list_parsed(parent_sess, &hw_resources, 0);
+	const int ret = hw_res_get_list_parsed(parent_sess, &hw_resources, 0);
 	if (ret != EOK)
 		return ret;
@@ -96,10 +96,10 @@
  *
  */
-static errno_t i8042_dev_add(ddf_dev_t *device)
+static int i8042_dev_add(ddf_dev_t *device)
 {
 	addr_range_t io_regs;
 	int kbd = 0;
 	int mouse = 0;
-	errno_t rc;
+	int rc;
 	
 	if (!device)
Index: uspace/drv/char/msim-con/main.c
===================================================================
--- uspace/drv/char/msim-con/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/msim-con/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,9 +43,9 @@
 #define NAME  "msim-con"
 
-static errno_t msim_con_dev_add(ddf_dev_t *dev);
-static errno_t msim_con_dev_remove(ddf_dev_t *dev);
-static errno_t msim_con_dev_gone(ddf_dev_t *dev);
-static errno_t msim_con_fun_online(ddf_fun_t *fun);
-static errno_t msim_con_fun_offline(ddf_fun_t *fun);
+static int msim_con_dev_add(ddf_dev_t *dev);
+static int msim_con_dev_remove(ddf_dev_t *dev);
+static int msim_con_dev_gone(ddf_dev_t *dev);
+static int msim_con_fun_online(ddf_fun_t *fun);
+static int msim_con_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -62,9 +62,9 @@
 };
 
-static errno_t msim_con_get_res(ddf_dev_t *dev, msim_con_res_t *res)
+static int msim_con_get_res(ddf_dev_t *dev, msim_con_res_t *res)
 {
 	async_sess_t *parent_sess;
 	hw_res_list_parsed_t hw_res;
-	errno_t rc;
+	int rc;
 
 	parent_sess = ddf_dev_parent_sess_get(dev);
@@ -97,9 +97,9 @@
 }
 
-static errno_t msim_con_dev_add(ddf_dev_t *dev)
+static int msim_con_dev_add(ddf_dev_t *dev)
 {
 	msim_con_t *msim_con;
 	msim_con_res_t res;
-	errno_t rc;
+	int rc;
 
         ddf_msg(LVL_DEBUG, "msim_con_dev_add(%p)", dev);
@@ -122,5 +122,5 @@
 }
 
-static errno_t msim_con_dev_remove(ddf_dev_t *dev)
+static int msim_con_dev_remove(ddf_dev_t *dev)
 {
         msim_con_t *msim_con = (msim_con_t *)ddf_dev_data_get(dev);
@@ -131,5 +131,5 @@
 }
 
-static errno_t msim_con_dev_gone(ddf_dev_t *dev)
+static int msim_con_dev_gone(ddf_dev_t *dev)
 {
         msim_con_t *msim_con = (msim_con_t *)ddf_dev_data_get(dev);
@@ -140,5 +140,5 @@
 }
 
-static errno_t msim_con_fun_online(ddf_fun_t *fun)
+static int msim_con_fun_online(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "msim_con_fun_online()");
@@ -146,5 +146,5 @@
 }
 
-static errno_t msim_con_fun_offline(ddf_fun_t *fun)
+static int msim_con_fun_offline(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "msim_con_fun_offline()");
Index: uspace/drv/char/msim-con/msim-con.c
===================================================================
--- uspace/drv/char/msim-con/msim-con.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/msim-con/msim-con.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,6 +43,6 @@
 static void msim_con_connection(ipc_callid_t, ipc_call_t *, void *);
 
-static errno_t msim_con_read(chardev_srv_t *, void *, size_t, size_t *);
-static errno_t msim_con_write(chardev_srv_t *, const void *, size_t, size_t *);
+static int msim_con_read(chardev_srv_t *, void *, size_t, size_t *);
+static int msim_con_write(chardev_srv_t *, const void *, size_t, size_t *);
 
 static chardev_ops_t msim_con_chardev_ops = {
@@ -66,5 +66,5 @@
 	msim_con_t *con = (msim_con_t *) arg;
 	uint8_t c;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&con->buf_lock);
@@ -80,10 +80,10 @@
 
 /** Add msim console device. */
-errno_t msim_con_add(msim_con_t *con, msim_con_res_t *res)
+int msim_con_add(msim_con_t *con, msim_con_res_t *res)
 {
 	ddf_fun_t *fun = NULL;
 	bool subscribed = false;
 	irq_cmd_t *msim_cmds = NULL;
-	errno_t rc;
+	int rc;
 
 	circ_buf_init(&con->cbuf, con->buf, msim_con_buf_size, 1);
@@ -125,5 +125,5 @@
 	con->irq_code.cmds = msim_cmds;
 
-	async_irq_subscribe(res->irq, msim_irq_handler, con, &con->irq_code, NULL);
+	async_irq_subscribe(res->irq, msim_irq_handler, con, &con->irq_code);
 	subscribed = true;
 
@@ -152,5 +152,5 @@
 
 /** Remove msim console device */
-errno_t msim_con_remove(msim_con_t *con)
+int msim_con_remove(msim_con_t *con)
 {
 	return ENOTSUP;
@@ -158,5 +158,5 @@
 
 /** Msim console device gone */
-errno_t msim_con_gone(msim_con_t *con)
+int msim_con_gone(msim_con_t *con)
 {
 	return ENOTSUP;
@@ -169,5 +169,5 @@
 
 /** Read from msim console device */
-static errno_t msim_con_read(chardev_srv_t *srv, void *buf, size_t size,
+static int msim_con_read(chardev_srv_t *srv, void *buf, size_t size,
     size_t *nread)
 {
@@ -175,5 +175,5 @@
 	size_t p;
 	uint8_t *bp = (uint8_t *) buf;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&con->buf_lock);
@@ -197,5 +197,5 @@
 
 /** Write to msim console device */
-static errno_t msim_con_write(chardev_srv_t *srv, const void *data, size_t size,
+static int msim_con_write(chardev_srv_t *srv, const void *data, size_t size,
     size_t *nwr)
 {
Index: uspace/drv/char/msim-con/msim-con.h
===================================================================
--- uspace/drv/char/msim-con/msim-con.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/msim-con/msim-con.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -70,7 +70,7 @@
 } msim_con_t;
 
-extern errno_t msim_con_add(msim_con_t *, msim_con_res_t *);
-extern errno_t msim_con_remove(msim_con_t *);
-extern errno_t msim_con_gone(msim_con_t *);
+extern int msim_con_add(msim_con_t *, msim_con_res_t *);
+extern int msim_con_remove(msim_con_t *);
+extern int msim_con_gone(msim_con_t *);
 
 #endif
Index: uspace/drv/char/ns8250/ns8250.c
===================================================================
--- uspace/drv/char/ns8250/ns8250.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/ns8250/ns8250.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,4 @@
 #include <stdio.h>
 #include <errno.h>
-#include <str_error.h>
 #include <stdbool.h>
 #include <fibril_synch.h>
@@ -251,5 +250,5 @@
  * @return		EOK on success or non-zero error code
  */
-static errno_t ns8250_read(chardev_srv_t *srv, void *buf, size_t count, size_t *nread)
+static int ns8250_read(chardev_srv_t *srv, void *buf, size_t count, size_t *nread)
 {
 	ns8250_t *ns = srv_ns8250(srv);
@@ -295,5 +294,5 @@
  * @return		EOK on success or non-zero error code
  */
-static errno_t ns8250_write(chardev_srv_t *srv, const void *buf, size_t count,
+static int ns8250_write(chardev_srv_t *srv, const void *buf, size_t count,
     size_t *nwritten)
 {
@@ -309,6 +308,6 @@
 }
 
-static errno_t ns8250_open(chardev_srvs_t *, chardev_srv_t *);
-static errno_t ns8250_close(chardev_srv_t *);
+static int ns8250_open(chardev_srvs_t *, chardev_srv_t *);
+static int ns8250_close(chardev_srv_t *);
 static void ns8250_default_handler(chardev_srv_t *, ipc_callid_t, ipc_call_t *);
 
@@ -324,6 +323,6 @@
 static void ns8250_char_conn(ipc_callid_t, ipc_call_t *, void *);
 
-static errno_t ns8250_dev_add(ddf_dev_t *dev);
-static errno_t ns8250_dev_remove(ddf_dev_t *dev);
+static int ns8250_dev_add(ddf_dev_t *dev);
+static int ns8250_dev_remove(ddf_dev_t *dev);
 
 /** The serial port device driver's standard operations. */
@@ -405,9 +404,9 @@
  *
  * @param ns		Serial port device
- * @return		Zero on success, error number otherwise
- */
-static errno_t ns8250_dev_initialize(ns8250_t *ns)
-{
-	errno_t ret = EOK;
+ * @return		Zero on success, negative error number otherwise
+ */
+static int ns8250_dev_initialize(ns8250_t *ns)
+{
+	int ret = EOK;
 	
 	ddf_msg(LVL_DEBUG, "ns8250_dev_initialize %s", ddf_dev_get_name(ns->dev));
@@ -499,10 +498,10 @@
  *
  * @param ns		Serial port device
- * @return		Zero on success, error number otherwise
- */
-static errno_t ns8250_interrupt_enable(ns8250_t *ns)
+ * @return		Zero on success, negative error number otherwise
+ */
+static int ns8250_interrupt_enable(ns8250_t *ns)
 {
 	/* Enable interrupt using IRC service. */
-	errno_t rc = hw_res_enable_interrupt(ns->parent_sess, ns->irq);
+	int rc = hw_res_enable_interrupt(ns->parent_sess, ns->irq);
 	if (rc != EOK)
 		return EIO;
@@ -544,8 +543,8 @@
  * @param port		The base address of the serial port device's ports.
  * @param baud_rate	The baud rate to be used by the device.
- * @return		Zero on success, error number otherwise (EINVAL
+ * @return		Zero on success, negative error number otherwise (EINVAL
  *			if the specified baud_rate is not valid).
  */
-static errno_t ns8250_port_set_baud_rate(ns8250_regs_t *regs, unsigned int baud_rate)
+static int ns8250_port_set_baud_rate(ns8250_regs_t *regs, unsigned int baud_rate)
 {
 	uint16_t divisor;
@@ -646,5 +645,5 @@
  *			is invalid.
  */
-static errno_t ns8250_port_set_com_props(ns8250_regs_t *regs, unsigned int parity,
+static int ns8250_port_set_com_props(ns8250_regs_t *regs, unsigned int parity,
     unsigned int word_length, unsigned int stop_bits)
 {
@@ -803,9 +802,8 @@
  * @param ns		Serial port device
  */
-static inline errno_t ns8250_register_interrupt_handler(ns8250_t *ns,
-    cap_handle_t *handle)
+static inline int ns8250_register_interrupt_handler(ns8250_t *ns)
 {
 	return register_interrupt_handler(ns->dev, ns->irq,
-	    ns8250_interrupt_handler, NULL, handle);
+	    ns8250_interrupt_handler, NULL);
 }
 
@@ -814,5 +812,5 @@
  * @param ns		Serial port device
  */
-static inline errno_t ns8250_unregister_interrupt_handler(ns8250_t *ns)
+static inline int ns8250_unregister_interrupt_handler(ns8250_t *ns)
 {
 	return unregister_interrupt_handler(ns->dev, ns->irq_cap);
@@ -825,5 +823,5 @@
  * @param dev		The serial port device.
  */
-static errno_t ns8250_dev_add(ddf_dev_t *dev)
+static int ns8250_dev_add(ddf_dev_t *dev)
 {
 	ns8250_t *ns = NULL;
@@ -831,5 +829,5 @@
 	bool need_cleanup = false;
 	bool need_unreg_intr_handler = false;
-	errno_t rc;
+	int rc;
 	
 	ddf_msg(LVL_DEBUG, "ns8250_dev_add %s (handle = %d)",
@@ -876,6 +874,6 @@
 	
 	/* Register interrupt handler. */
-	rc = ns8250_register_interrupt_handler(ns, &ns->irq_cap);
-	if (rc != EOK) {
+	ns->irq_cap = ns8250_register_interrupt_handler(ns);
+	if (ns->irq_cap < 0) {
 		ddf_msg(LVL_ERROR, "Failed to register interrupt handler.");
 		rc = EADDRNOTAVAIL;
@@ -888,5 +886,5 @@
 	if (rc != EOK) {
 		ddf_msg(LVL_ERROR, "Failed to enable the interrupt. Error code = "
-		    "%s.", str_error_name(rc));
+		    "%d.", rc);
 		goto fail;
 	}
@@ -928,8 +926,8 @@
 }
 
-static errno_t ns8250_dev_remove(ddf_dev_t *dev)
+static int ns8250_dev_remove(ddf_dev_t *dev)
 {
 	ns8250_t *ns = dev_ns8250(dev);
-	errno_t rc;
+	int rc;
 	
 	fibril_mutex_lock(&ns->mutex);
@@ -963,8 +961,8 @@
  * @param srv		Server-side connection structure
  */
-static errno_t ns8250_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
+static int ns8250_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
 {
 	ns8250_t *ns = srv_ns8250(srv);
-	errno_t res;
+	int res;
 	
 	fibril_mutex_lock(&ns->mutex);
@@ -987,5 +985,5 @@
  * @param srv		Server-side connection structure
  */
-static errno_t ns8250_close(chardev_srv_t *srv)
+static int ns8250_close(chardev_srv_t *srv)
 {
 	ns8250_t *data = srv_ns8250(srv);
@@ -1040,5 +1038,5 @@
  * @param stop_bits	The number of stop bits to be used.
  */
-static errno_t ns8250_set_props(ddf_dev_t *dev, unsigned int baud_rate,
+static int ns8250_set_props(ddf_dev_t *dev, unsigned int baud_rate,
     unsigned int parity, unsigned int word_length, unsigned int stop_bits)
 {
@@ -1049,5 +1047,5 @@
 	ns8250_t *data = dev_ns8250(dev);
 	ns8250_regs_t *regs = data->regs;
-	errno_t ret;
+	int ret;
 	
 	fibril_mutex_lock(&data->mutex);
@@ -1072,5 +1070,5 @@
 	ns8250_t *ns8250 = srv_ns8250(srv);
 	sysarg_t method = IPC_GET_IMETHOD(*call);
-	errno_t ret;
+	int ret;
 	unsigned int baud_rate, parity, word_length, stop_bits;
 	
Index: uspace/drv/char/pl050/pl050.c
===================================================================
--- uspace/drv/char/pl050/pl050.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/pl050/pl050.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,5 +35,4 @@
 #include <stdio.h>
 #include <errno.h>
-#include <str_error.h>
 #include <ddf/driver.h>
 #include <ddf/interrupt.h>
@@ -51,10 +50,10 @@
 };
 
-static errno_t pl050_dev_add(ddf_dev_t *);
-static errno_t pl050_fun_online(ddf_fun_t *);
-static errno_t pl050_fun_offline(ddf_fun_t *);
+static int pl050_dev_add(ddf_dev_t *);
+static int pl050_fun_online(ddf_fun_t *);
+static int pl050_fun_offline(ddf_fun_t *);
 static void pl050_char_conn(ipc_callid_t, ipc_call_t *, void *);
-static errno_t pl050_read(chardev_srv_t *, void *, size_t, size_t *);
-static errno_t pl050_write(chardev_srv_t *, const void *, size_t, size_t *);
+static int pl050_read(chardev_srv_t *, void *, size_t, size_t *);
+static int pl050_write(chardev_srv_t *, const void *, size_t, size_t *);
 
 static driver_ops_t driver_ops = {
@@ -158,9 +157,9 @@
 }
 
-static errno_t pl050_init(pl050_t *pl050)
+static int pl050_init(pl050_t *pl050)
 {
 	hw_res_list_parsed_t res;
 	void *regs;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_initialize(&pl050->buf_lock);
@@ -213,10 +212,10 @@
 	pl050->regs = regs;
 
-	int irq_cap;
-	rc = register_interrupt_handler(pl050->dev,
-	    res.irqs.irqs[0], pl050_interrupt, &pl050_irq_code, &irq_cap);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed registering interrupt handler. (%s)",
-		    str_error_name(rc));
+	const int irq_cap = register_interrupt_handler(pl050->dev,
+	    res.irqs.irqs[0], pl050_interrupt, &pl050_irq_code);
+	if (irq_cap < 0) {
+		rc = irq_cap;
+		ddf_msg(LVL_ERROR, "Failed registering interrupt handler. (%d)",
+		    rc);
 		goto error;
 	}
@@ -224,5 +223,5 @@
 	rc = hw_res_enable_interrupt(pl050->parent_sess, res.irqs.irqs[0]);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed enabling interrupt: %s", str_error(rc));
+		ddf_msg(LVL_ERROR, "Failed enabling interrupt. (%d)", rc);
 		goto error;
 	}
@@ -237,5 +236,5 @@
 }
 
-static errno_t pl050_read(chardev_srv_t *srv, void *buffer, size_t size,
+static int pl050_read(chardev_srv_t *srv, void *buffer, size_t size,
     size_t *nread)
 {
@@ -263,5 +262,5 @@
 }
 
-static errno_t pl050_write(chardev_srv_t *srv, const void *data, size_t size,
+static int pl050_write(chardev_srv_t *srv, const void *data, size_t size,
     size_t *nwritten)
 {
@@ -294,10 +293,10 @@
 
 /** Add device. */
-static errno_t pl050_dev_add(ddf_dev_t *dev)
+static int pl050_dev_add(ddf_dev_t *dev)
 {
 	ddf_fun_t *fun_a;
 	pl050_t *pl050 = NULL;
 	const char *mname;
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "pl050_dev_add()");
@@ -350,5 +349,5 @@
 	rc = ddf_fun_bind(fun_a);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a': %s", str_error(rc));
+		ddf_msg(LVL_ERROR, "Failed binding function 'a'. (%d)", rc);
 		ddf_fun_destroy(fun_a);
 		goto error;
@@ -363,5 +362,5 @@
 }
 
-static errno_t pl050_fun_online(ddf_fun_t *fun)
+static int pl050_fun_online(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "pl050_fun_online()");
@@ -369,5 +368,5 @@
 }
 
-static errno_t pl050_fun_offline(ddf_fun_t *fun)
+static int pl050_fun_offline(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "pl050_fun_offline()");
@@ -377,5 +376,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf(NAME ": HelenOS pl050 serial device driver\n");
Index: uspace/drv/char/ski-con/main.c
===================================================================
--- uspace/drv/char/ski-con/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/ski-con/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,9 +42,9 @@
 #define NAME  "ski-con"
 
-static errno_t ski_con_dev_add(ddf_dev_t *dev);
-static errno_t ski_con_dev_remove(ddf_dev_t *dev);
-static errno_t ski_con_dev_gone(ddf_dev_t *dev);
-static errno_t ski_con_fun_online(ddf_fun_t *fun);
-static errno_t ski_con_fun_offline(ddf_fun_t *fun);
+static int ski_con_dev_add(ddf_dev_t *dev);
+static int ski_con_dev_remove(ddf_dev_t *dev);
+static int ski_con_dev_gone(ddf_dev_t *dev);
+static int ski_con_fun_online(ddf_fun_t *fun);
+static int ski_con_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -61,5 +61,5 @@
 };
 
-static errno_t ski_con_dev_add(ddf_dev_t *dev)
+static int ski_con_dev_add(ddf_dev_t *dev)
 {
 	ski_con_t *ski_con;
@@ -77,5 +77,5 @@
 }
 
-static errno_t ski_con_dev_remove(ddf_dev_t *dev)
+static int ski_con_dev_remove(ddf_dev_t *dev)
 {
         ski_con_t *ski_con = (ski_con_t *)ddf_dev_data_get(dev);
@@ -86,5 +86,5 @@
 }
 
-static errno_t ski_con_dev_gone(ddf_dev_t *dev)
+static int ski_con_dev_gone(ddf_dev_t *dev)
 {
         ski_con_t *ski_con = (ski_con_t *)ddf_dev_data_get(dev);
@@ -95,5 +95,5 @@
 }
 
-static errno_t ski_con_fun_online(ddf_fun_t *fun)
+static int ski_con_fun_online(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "ski_con_fun_online()");
@@ -101,5 +101,5 @@
 }
 
-static errno_t ski_con_fun_offline(ddf_fun_t *fun)
+static int ski_con_fun_offline(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "ski_con_fun_offline()");
Index: uspace/drv/char/ski-con/ski-con.c
===================================================================
--- uspace/drv/char/ski-con/ski-con.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/ski-con/ski-con.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,10 +48,10 @@
 #define POLL_INTERVAL		10000
 
-static errno_t ski_con_fibril(void *arg);
+static int ski_con_fibril(void *arg);
 static int32_t ski_con_getchar(void);
 static void ski_con_connection(ipc_callid_t, ipc_call_t *, void *);
 
-static errno_t ski_con_read(chardev_srv_t *, void *, size_t, size_t *);
-static errno_t ski_con_write(chardev_srv_t *, const void *, size_t, size_t *);
+static int ski_con_read(chardev_srv_t *, void *, size_t, size_t *);
+static int ski_con_write(chardev_srv_t *, const void *, size_t, size_t *);
 
 static chardev_ops_t ski_con_chardev_ops = {
@@ -63,10 +63,10 @@
 
 /** Add ski console device. */
-errno_t ski_con_add(ski_con_t *con)
+int ski_con_add(ski_con_t *con)
 {
 	fid_t fid;
 	ddf_fun_t *fun = NULL;
 	bool bound = false;
-	errno_t rc;
+	int rc;
 
 	circ_buf_init(&con->cbuf, con->buf, ski_con_buf_size, 1);
@@ -116,5 +116,5 @@
 
 /** Remove ski console device */
-errno_t ski_con_remove(ski_con_t *con)
+int ski_con_remove(ski_con_t *con)
 {
 	return ENOTSUP;
@@ -122,5 +122,5 @@
 
 /** Ski console device gone */
-errno_t ski_con_gone(ski_con_t *con)
+int ski_con_gone(ski_con_t *con)
 {
 	return ENOTSUP;
@@ -128,9 +128,9 @@
 
 /** Poll Ski for keypresses. */
-static errno_t ski_con_fibril(void *arg)
+static int ski_con_fibril(void *arg)
 {
 	int32_t c;
 	ski_con_t *con = (ski_con_t *) arg;
-	errno_t rc;
+	int rc;
 
 	while (1) {
@@ -212,5 +212,5 @@
 
 /** Read from Ski console device */
-static errno_t ski_con_read(chardev_srv_t *srv, void *buf, size_t size,
+static int ski_con_read(chardev_srv_t *srv, void *buf, size_t size,
     size_t *nread)
 {
@@ -218,5 +218,5 @@
 	size_t p;
 	uint8_t *bp = (uint8_t *) buf;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&con->buf_lock);
@@ -240,5 +240,5 @@
 
 /** Write to Ski console device */
-static errno_t ski_con_write(chardev_srv_t *srv, const void *data, size_t size,
+static int ski_con_write(chardev_srv_t *srv, const void *data, size_t size,
     size_t *nwr)
 {
Index: uspace/drv/char/ski-con/ski-con.h
===================================================================
--- uspace/drv/char/ski-con/ski-con.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/ski-con/ski-con.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,7 +58,7 @@
 } ski_con_t;
 
-extern errno_t ski_con_add(ski_con_t *);
-extern errno_t ski_con_remove(ski_con_t *);
-extern errno_t ski_con_gone(ski_con_t *);
+extern int ski_con_add(ski_con_t *);
+extern int ski_con_remove(ski_con_t *);
+extern int ski_con_gone(ski_con_t *);
 
 #endif
Index: uspace/drv/char/sun4v-con/main.c
===================================================================
--- uspace/drv/char/sun4v-con/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/sun4v-con/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,9 +40,9 @@
 #define NAME  "sun4v-con"
 
-static errno_t sun4v_con_dev_add(ddf_dev_t *dev);
-static errno_t sun4v_con_dev_remove(ddf_dev_t *dev);
-static errno_t sun4v_con_dev_gone(ddf_dev_t *dev);
-static errno_t sun4v_con_fun_online(ddf_fun_t *fun);
-static errno_t sun4v_con_fun_offline(ddf_fun_t *fun);
+static int sun4v_con_dev_add(ddf_dev_t *dev);
+static int sun4v_con_dev_remove(ddf_dev_t *dev);
+static int sun4v_con_dev_gone(ddf_dev_t *dev);
+static int sun4v_con_fun_online(ddf_fun_t *fun);
+static int sun4v_con_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -59,9 +59,9 @@
 };
 
-static errno_t sun4v_con_get_res(ddf_dev_t *dev, sun4v_con_res_t *res)
+static int sun4v_con_get_res(ddf_dev_t *dev, sun4v_con_res_t *res)
 {
 	async_sess_t *parent_sess;
 	hw_res_list_parsed_t hw_res;
-	errno_t rc;
+	int rc;
 
 	parent_sess = ddf_dev_parent_sess_get(dev);
@@ -88,9 +88,9 @@
 
 
-static errno_t sun4v_con_dev_add(ddf_dev_t *dev)
+static int sun4v_con_dev_add(ddf_dev_t *dev)
 {
 	sun4v_con_t *sun4v_con;
 	sun4v_con_res_t res;
-	errno_t rc;
+	int rc;
 
         ddf_msg(LVL_DEBUG, "sun4v_con_dev_add(%p)", dev);
@@ -112,5 +112,5 @@
 }
 
-static errno_t sun4v_con_dev_remove(ddf_dev_t *dev)
+static int sun4v_con_dev_remove(ddf_dev_t *dev)
 {
         sun4v_con_t *sun4v_con = (sun4v_con_t *)ddf_dev_data_get(dev);
@@ -121,5 +121,5 @@
 }
 
-static errno_t sun4v_con_dev_gone(ddf_dev_t *dev)
+static int sun4v_con_dev_gone(ddf_dev_t *dev)
 {
         sun4v_con_t *sun4v_con = (sun4v_con_t *)ddf_dev_data_get(dev);
@@ -130,5 +130,5 @@
 }
 
-static errno_t sun4v_con_fun_online(ddf_fun_t *fun)
+static int sun4v_con_fun_online(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "sun4v_con_fun_online()");
@@ -136,5 +136,5 @@
 }
 
-static errno_t sun4v_con_fun_offline(ddf_fun_t *fun)
+static int sun4v_con_fun_offline(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "sun4v_con_fun_offline()");
Index: uspace/drv/char/sun4v-con/sun4v-con.c
===================================================================
--- uspace/drv/char/sun4v-con/sun4v-con.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/sun4v-con/sun4v-con.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <ddi.h>
 #include <errno.h>
-#include <str_error.h>
 #include <io/chardev_srv.h>
 #include <stdbool.h>
@@ -46,6 +45,6 @@
 #define POLL_INTERVAL  10000
 
-static errno_t sun4v_con_read(chardev_srv_t *, void *, size_t, size_t *);
-static errno_t sun4v_con_write(chardev_srv_t *, const void *, size_t, size_t *);
+static int sun4v_con_read(chardev_srv_t *, void *, size_t, size_t *);
+static int sun4v_con_write(chardev_srv_t *, const void *, size_t, size_t *);
 
 static chardev_ops_t sun4v_con_chardev_ops = {
@@ -69,8 +68,8 @@
 
 /** Add sun4v console device. */
-errno_t sun4v_con_add(sun4v_con_t *con, sun4v_con_res_t *res)
+int sun4v_con_add(sun4v_con_t *con, sun4v_con_res_t *res)
 {
 	ddf_fun_t *fun = NULL;
-	errno_t rc;
+	int rc;
 
 	con->res = *res;
@@ -93,5 +92,5 @@
 	    (void *) &con->input_buffer);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error mapping memory: %s", str_error_name(rc));
+		ddf_msg(LVL_ERROR, "Error mapping memory: %d", rc);
 		goto error;
 	}
@@ -102,5 +101,5 @@
 	    (void *) &con->output_buffer);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error mapping memory: %s", str_error_name(rc));
+		ddf_msg(LVL_ERROR, "Error mapping memory: %d", rc);
 		return rc;
 	}
@@ -129,5 +128,5 @@
 
 /** Remove sun4v console device */
-errno_t sun4v_con_remove(sun4v_con_t *con)
+int sun4v_con_remove(sun4v_con_t *con)
 {
 	return ENOTSUP;
@@ -135,5 +134,5 @@
 
 /** Msim console device gone */
-errno_t sun4v_con_gone(sun4v_con_t *con)
+int sun4v_con_gone(sun4v_con_t *con)
 {
 	return ENOTSUP;
@@ -141,5 +140,5 @@
 
 /** Read from Sun4v console device */
-static errno_t sun4v_con_read(chardev_srv_t *srv, void *buf, size_t size,
+static int sun4v_con_read(chardev_srv_t *srv, void *buf, size_t size,
     size_t *nread)
 {
@@ -165,5 +164,5 @@
 
 /** Write to Sun4v console device */
-static errno_t sun4v_con_write(chardev_srv_t *srv, const void *data, size_t size,
+static int sun4v_con_write(chardev_srv_t *srv, const void *data, size_t size,
     size_t *nwr)
 {
Index: uspace/drv/char/sun4v-con/sun4v-con.h
===================================================================
--- uspace/drv/char/sun4v-con/sun4v-con.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/char/sun4v-con/sun4v-con.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -62,7 +62,7 @@
 } sun4v_con_t;
 
-extern errno_t sun4v_con_add(sun4v_con_t *, sun4v_con_res_t *);
-extern errno_t sun4v_con_remove(sun4v_con_t *);
-extern errno_t sun4v_con_gone(sun4v_con_t *);
+extern int sun4v_con_add(sun4v_con_t *, sun4v_con_res_t *);
+extern int sun4v_con_remove(sun4v_con_t *);
+extern int sun4v_con_gone(sun4v_con_t *);
 
 #endif
Index: uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c
===================================================================
--- uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,9 +56,9 @@
 
 
-static errno_t change_mode(visualizer_t *vis, vslmode_t mode);
-static errno_t handle_damage(visualizer_t *vs,
+static int change_mode(visualizer_t *vis, vslmode_t mode);
+static int handle_damage(visualizer_t *vs,
     sysarg_t x0, sysarg_t y0, sysarg_t width, sysarg_t height,
     sysarg_t x_offset, sysarg_t y_offset);
-static errno_t dummy(visualizer_t *vs)
+static int dummy(visualizer_t *vs)
 {
 	return EOK;
@@ -115,5 +115,5 @@
 }
 
-errno_t amdm37x_dispc_init(amdm37x_dispc_t *instance, visualizer_t *vis)
+int amdm37x_dispc_init(amdm37x_dispc_t *instance, visualizer_t *vis)
 {
 	assert(instance);
@@ -134,5 +134,5 @@
 	}
 
-	errno_t ret = pio_enable((void*)AMDM37x_DISPC_BASE_ADDRESS,
+	int ret = pio_enable((void*)AMDM37x_DISPC_BASE_ADDRESS,
 	    AMDM37x_DISPC_SIZE, (void**)&instance->regs);
 	if (ret != EOK) {
@@ -152,10 +152,10 @@
 };
 
-errno_t amdm37x_dispc_fini(amdm37x_dispc_t *instance)
+int amdm37x_dispc_fini(amdm37x_dispc_t *instance)
 {
 	return EOK;
 };
 
-static errno_t amdm37x_dispc_setup_fb(amdm37x_dispc_regs_t *regs,
+static int amdm37x_dispc_setup_fb(amdm37x_dispc_regs_t *regs,
     unsigned x, unsigned y, unsigned bpp, uint32_t pa)
 {
@@ -260,5 +260,5 @@
 }
 
-static errno_t change_mode(visualizer_t *vis, vslmode_t mode)
+static int change_mode(visualizer_t *vis, vslmode_t mode)
 {
 	assert(vis);
@@ -276,5 +276,5 @@
 	uintptr_t pa;
 	void *buffer = AS_AREA_ANY;
-	errno_t ret = dmamem_map_anonymous(size, DMAMEM_4GiB,
+	int ret = dmamem_map_anonymous(size, DMAMEM_4GiB,
 	    AS_AREA_READ | AS_AREA_WRITE, 0, &pa, &buffer);
 	if (ret != EOK) {
@@ -299,5 +299,5 @@
 }
 
-static errno_t handle_damage(visualizer_t *vs,
+static int handle_damage(visualizer_t *vs,
     sysarg_t x0, sysarg_t y0, sysarg_t width, sysarg_t height,
     sysarg_t x_offset, sysarg_t y_offset)
Index: uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.h
===================================================================
--- uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -62,6 +62,6 @@
 } amdm37x_dispc_t;
 
-errno_t amdm37x_dispc_init(amdm37x_dispc_t *instance, visualizer_t *vis);
-errno_t amdm37x_dispc_fini(amdm37x_dispc_t *instance);
+int amdm37x_dispc_init(amdm37x_dispc_t *instance, visualizer_t *vis);
+int amdm37x_dispc_fini(amdm37x_dispc_t *instance);
 
 #endif
Index: uspace/drv/fb/amdm37x_dispc/main.c
===================================================================
--- uspace/drv/fb/amdm37x_dispc/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/fb/amdm37x_dispc/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,5 +54,5 @@
 }
 
-static errno_t amdm37x_dispc_dev_add(ddf_dev_t *dev)
+static int amdm37x_dispc_dev_add(ddf_dev_t *dev)
 {
 	assert(dev);
@@ -84,5 +84,5 @@
 	}
 
-	errno_t ret = amdm37x_dispc_init(dispc, vis);
+	int ret = amdm37x_dispc_init(dispc, vis);
 	if (ret != EOK) {
 		ddf_log_error("Failed to init dispc: %s\n", str_error(ret));
Index: uspace/drv/fb/kfb/kfb.c
===================================================================
--- uspace/drv/fb/kfb/kfb.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/fb/kfb/kfb.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include "kfb.h"
 
-static errno_t kgraph_dev_add(ddf_dev_t *dev)
+static int kgraph_dev_add(ddf_dev_t *dev)
 {
 	port_init(dev);
Index: uspace/drv/fb/kfb/port.c
===================================================================
--- uspace/drv/fb/kfb/port.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/fb/kfb/port.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -86,5 +86,5 @@
 static vslmode_list_element_t pixel_mode;
 
-static errno_t kfb_claim(visualizer_t *vs)
+static int kfb_claim(visualizer_t *vs)
 {
 	return physmem_map(kfb.paddr + kfb.offset,
@@ -93,7 +93,7 @@
 }
 
-static errno_t kfb_yield(visualizer_t *vs)
-{
-	errno_t rc;
+static int kfb_yield(visualizer_t *vs)
+{
+	int rc;
 
 	if (vs->mode_set) {
@@ -109,5 +109,5 @@
 }
 
-static errno_t kfb_handle_damage_pixels(visualizer_t *vs,
+static int kfb_handle_damage_pixels(visualizer_t *vs,
     sysarg_t x0, sysarg_t y0, sysarg_t width, sysarg_t height,
     sysarg_t x_offset, sysarg_t y_offset)
@@ -137,5 +137,5 @@
 }
 
-static errno_t kfb_change_mode(visualizer_t *vs, vslmode_t new_mode)
+static int kfb_change_mode(visualizer_t *vs, vslmode_t new_mode)
 {
 	vs->ops.handle_damage = kfb_handle_damage_pixels;
@@ -143,10 +143,10 @@
 }
 
-static errno_t kfb_suspend(visualizer_t *vs)
-{
-	return EOK;
-}
-
-static errno_t kfb_wakeup(visualizer_t *vs)
+static int kfb_suspend(visualizer_t *vs)
+{
+	return EOK;
+}
+
+static int kfb_wakeup(visualizer_t *vs)
 {
 	return EOK;
@@ -165,5 +165,5 @@
 {
 	visualizer_t *vsl;
-	errno_t rc;
+	int rc;
 
 	vsl = (visualizer_t *) ddf_fun_data_get((ddf_fun_t *)arg);
@@ -177,8 +177,8 @@
 }
 
-errno_t port_init(ddf_dev_t *dev)
+int port_init(ddf_dev_t *dev)
 {
 	sysarg_t present;
-	errno_t rc = sysinfo_get_value("fb", &present);
+	int rc = sysinfo_get_value("fb", &present);
 	if (rc != EOK)
 		present = false;
Index: uspace/drv/fb/kfb/port.h
===================================================================
--- uspace/drv/fb/kfb/port.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/fb/kfb/port.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include <ddf/driver.h>
 
-extern errno_t port_init(ddf_dev_t *);
+extern int port_init(ddf_dev_t *);
 
 #endif
Index: uspace/drv/hid/adb-kbd/adb-kbd.c
===================================================================
--- uspace/drv/hid/adb-kbd/adb-kbd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/adb-kbd/adb-kbd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,7 +48,7 @@
 
 /** Add ADB keyboard device */
-errno_t adb_kbd_add(adb_kbd_t *kbd)
-{
-	errno_t rc;
+int adb_kbd_add(adb_kbd_t *kbd)
+{
+	int rc;
 	bool bound = false;
 
@@ -119,5 +119,5 @@
 
 /** Remove ADB keyboard device */
-errno_t adb_kbd_remove(adb_kbd_t *con)
+int adb_kbd_remove(adb_kbd_t *con)
 {
 	return ENOTSUP;
@@ -125,5 +125,5 @@
 
 /** ADB keyboard device gone */
-errno_t adb_kbd_gone(adb_kbd_t *con)
+int adb_kbd_gone(adb_kbd_t *con)
 {
 	return ENOTSUP;
@@ -140,5 +140,5 @@
 		ipc_callid_t callid = async_get_call(&call);
 
-		errno_t retval = EOK;
+		int retval = EOK;
 
 		if (!IPC_GET_IMETHOD(call)) {
@@ -162,5 +162,5 @@
 	kbd_event_type_t etype;
 	unsigned int key;
-	errno_t rc;
+	int rc;
 
 	rc = adb_kbd_key_translate(b, &etype, &key);
Index: uspace/drv/hid/adb-kbd/adb-kbd.h
===================================================================
--- uspace/drv/hid/adb-kbd/adb-kbd.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/adb-kbd/adb-kbd.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,7 +44,7 @@
 } adb_kbd_t;
 
-extern errno_t adb_kbd_add(adb_kbd_t *);
-extern errno_t adb_kbd_remove(adb_kbd_t *);
-extern errno_t adb_kbd_gone(adb_kbd_t *);
+extern int adb_kbd_add(adb_kbd_t *);
+extern int adb_kbd_remove(adb_kbd_t *);
+extern int adb_kbd_gone(adb_kbd_t *);
 
 #endif
Index: uspace/drv/hid/adb-kbd/ctl.c
===================================================================
--- uspace/drv/hid/adb-kbd/ctl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/adb-kbd/ctl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -179,5 +179,5 @@
  * @return EOK on success, ENOENT if no translation exists
  */
-errno_t adb_kbd_key_translate(sysarg_t scancode, kbd_event_type_t *rtype,
+int adb_kbd_key_translate(sysarg_t scancode, kbd_event_type_t *rtype,
     unsigned int *rkey)
 {
Index: uspace/drv/hid/adb-kbd/ctl.h
===================================================================
--- uspace/drv/hid/adb-kbd/ctl.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/adb-kbd/ctl.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,5 +35,5 @@
 #define CTL_H
 
-extern errno_t adb_kbd_key_translate(sysarg_t, kbd_event_type_t *, unsigned int *);
+extern int adb_kbd_key_translate(sysarg_t, kbd_event_type_t *, unsigned int *);
 
 #endif
Index: uspace/drv/hid/adb-kbd/main.c
===================================================================
--- uspace/drv/hid/adb-kbd/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/adb-kbd/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,9 +42,9 @@
 #define NAME  "adb-kbd"
 
-static errno_t adb_kbd_dev_add(ddf_dev_t *dev);
-static errno_t adb_kbd_dev_remove(ddf_dev_t *dev);
-static errno_t adb_kbd_dev_gone(ddf_dev_t *dev);
-static errno_t adb_kbd_fun_online(ddf_fun_t *fun);
-static errno_t adb_kbd_fun_offline(ddf_fun_t *fun);
+static int adb_kbd_dev_add(ddf_dev_t *dev);
+static int adb_kbd_dev_remove(ddf_dev_t *dev);
+static int adb_kbd_dev_gone(ddf_dev_t *dev);
+static int adb_kbd_fun_online(ddf_fun_t *fun);
+static int adb_kbd_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -61,5 +61,5 @@
 };
 
-static errno_t adb_kbd_dev_add(ddf_dev_t *dev)
+static int adb_kbd_dev_add(ddf_dev_t *dev)
 {
 	adb_kbd_t *adb_kbd;
@@ -77,5 +77,5 @@
 }
 
-static errno_t adb_kbd_dev_remove(ddf_dev_t *dev)
+static int adb_kbd_dev_remove(ddf_dev_t *dev)
 {
         adb_kbd_t *adb_kbd = (adb_kbd_t *)ddf_dev_data_get(dev);
@@ -86,5 +86,5 @@
 }
 
-static errno_t adb_kbd_dev_gone(ddf_dev_t *dev)
+static int adb_kbd_dev_gone(ddf_dev_t *dev)
 {
         adb_kbd_t *adb_kbd = (adb_kbd_t *)ddf_dev_data_get(dev);
@@ -95,5 +95,5 @@
 }
 
-static errno_t adb_kbd_fun_online(ddf_fun_t *fun)
+static int adb_kbd_fun_online(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "adb_kbd_fun_online()");
@@ -101,5 +101,5 @@
 }
 
-static errno_t adb_kbd_fun_offline(ddf_fun_t *fun)
+static int adb_kbd_fun_offline(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "adb_kbd_fun_offline()");
Index: uspace/drv/hid/adb-mouse/adb-mouse.c
===================================================================
--- uspace/drv/hid/adb-mouse/adb-mouse.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/adb-mouse/adb-mouse.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -97,5 +97,5 @@
 		ipc_callid_t callid = async_get_call(&call);
 
-		errno_t retval = EOK;
+		int retval = EOK;
 
 		if (!IPC_GET_IMETHOD(call)) {
@@ -117,7 +117,7 @@
 
 /** Add ADB mouse device */
-errno_t adb_mouse_add(adb_mouse_t *mouse)
-{
-	errno_t rc;
+int adb_mouse_add(adb_mouse_t *mouse)
+{
+	int rc;
 	bool bound = false;
 
@@ -188,5 +188,5 @@
 
 /** Remove ADB mouse device */
-errno_t adb_mouse_remove(adb_mouse_t *con)
+int adb_mouse_remove(adb_mouse_t *con)
 {
 	return ENOTSUP;
@@ -194,5 +194,5 @@
 
 /** ADB mouse device gone */
-errno_t adb_mouse_gone(adb_mouse_t *con)
+int adb_mouse_gone(adb_mouse_t *con)
 {
 	return ENOTSUP;
Index: uspace/drv/hid/adb-mouse/adb-mouse.h
===================================================================
--- uspace/drv/hid/adb-mouse/adb-mouse.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/adb-mouse/adb-mouse.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,7 +47,7 @@
 } adb_mouse_t;
 
-extern errno_t adb_mouse_add(adb_mouse_t *);
-extern errno_t adb_mouse_remove(adb_mouse_t *);
-extern errno_t adb_mouse_gone(adb_mouse_t *);
+extern int adb_mouse_add(adb_mouse_t *);
+extern int adb_mouse_remove(adb_mouse_t *);
+extern int adb_mouse_gone(adb_mouse_t *);
 
 #endif
Index: uspace/drv/hid/adb-mouse/main.c
===================================================================
--- uspace/drv/hid/adb-mouse/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/adb-mouse/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,9 +42,9 @@
 #define NAME  "adb-mouse"
 
-static errno_t adb_mouse_dev_add(ddf_dev_t *dev);
-static errno_t adb_mouse_dev_remove(ddf_dev_t *dev);
-static errno_t adb_mouse_dev_gone(ddf_dev_t *dev);
-static errno_t adb_mouse_fun_online(ddf_fun_t *fun);
-static errno_t adb_mouse_fun_offline(ddf_fun_t *fun);
+static int adb_mouse_dev_add(ddf_dev_t *dev);
+static int adb_mouse_dev_remove(ddf_dev_t *dev);
+static int adb_mouse_dev_gone(ddf_dev_t *dev);
+static int adb_mouse_fun_online(ddf_fun_t *fun);
+static int adb_mouse_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -61,5 +61,5 @@
 };
 
-static errno_t adb_mouse_dev_add(ddf_dev_t *dev)
+static int adb_mouse_dev_add(ddf_dev_t *dev)
 {
 	adb_mouse_t *adb_mouse;
@@ -77,5 +77,5 @@
 }
 
-static errno_t adb_mouse_dev_remove(ddf_dev_t *dev)
+static int adb_mouse_dev_remove(ddf_dev_t *dev)
 {
         adb_mouse_t *adb_mouse = (adb_mouse_t *)ddf_dev_data_get(dev);
@@ -86,5 +86,5 @@
 }
 
-static errno_t adb_mouse_dev_gone(ddf_dev_t *dev)
+static int adb_mouse_dev_gone(ddf_dev_t *dev)
 {
         adb_mouse_t *adb_mouse = (adb_mouse_t *)ddf_dev_data_get(dev);
@@ -95,5 +95,5 @@
 }
 
-static errno_t adb_mouse_fun_online(ddf_fun_t *fun)
+static int adb_mouse_fun_online(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "adb_mouse_fun_online()");
@@ -101,5 +101,5 @@
 }
 
-static errno_t adb_mouse_fun_offline(ddf_fun_t *fun)
+static int adb_mouse_fun_offline(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "adb_mouse_fun_offline()");
Index: uspace/drv/hid/atkbd/atkbd.c
===================================================================
--- uspace/drv/hid/atkbd/atkbd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/atkbd/atkbd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -200,9 +200,9 @@
  *
  */
-static errno_t polling(void *arg)
+static int polling(void *arg)
 {
 	at_kbd_t *kbd = arg;
 	size_t nwr;
-	errno_t rc;
+	int rc;
 	
 	while (true) {
@@ -355,8 +355,8 @@
  *
  */
-errno_t at_kbd_init(at_kbd_t *kbd, ddf_dev_t *dev)
+int at_kbd_init(at_kbd_t *kbd, ddf_dev_t *dev)
 {
 	async_sess_t *parent_sess;
-	errno_t rc;
+	int rc;
 	
 	assert(kbd);
@@ -385,5 +385,5 @@
 	ddf_fun_set_ops(kbd->kbd_fun, &kbd_ops);
 	
-	errno_t ret = ddf_fun_bind(kbd->kbd_fun);
+	int ret = ddf_fun_bind(kbd->kbd_fun);
 	if (ret != EOK) {
 		ddf_msg(LVL_ERROR, "Failed binding function 'kbd'.");
Index: uspace/drv/hid/atkbd/atkbd.h
===================================================================
--- uspace/drv/hid/atkbd/atkbd.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/atkbd/atkbd.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,10 +49,10 @@
 	chardev_t *chardev;
 	/** Callback connection to client */
-	async_sess_t *client_sess;
+	async_sess_t *client_sess; 
 	/** Fibril retrieving and parsing data */
 	fid_t polling_fibril;
 } at_kbd_t;
 
-extern errno_t at_kbd_init(at_kbd_t *, ddf_dev_t *);
+extern int at_kbd_init(at_kbd_t *, ddf_dev_t *);
 
 #endif
Index: uspace/drv/hid/atkbd/main.c
===================================================================
--- uspace/drv/hid/atkbd/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/atkbd/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
 #define NAME "atkbd"
 
-static errno_t at_kbd_add(ddf_dev_t *device);
+static int at_kbd_add(ddf_dev_t *device);
 
 /** DDF driver ops. */
@@ -83,7 +83,7 @@
  *
  */
-static errno_t at_kbd_add(ddf_dev_t *device)
+static int at_kbd_add(ddf_dev_t *device)
 {
-	errno_t rc;
+	int rc;
 
 	if (!device)
Index: uspace/drv/hid/ps2mouse/main.c
===================================================================
--- uspace/drv/hid/ps2mouse/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/ps2mouse/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,5 @@
 #define NAME "ps2mouse"
 
-static errno_t mouse_add(ddf_dev_t *device);
+static int mouse_add(ddf_dev_t *device);
 
 /** DDF driver ops. */
@@ -78,7 +78,7 @@
  * @return Error code.
  */
-static errno_t mouse_add(ddf_dev_t *device)
+static int mouse_add(ddf_dev_t *device)
 {
-	errno_t rc;
+	int rc;
 
 	if (!device)
Index: uspace/drv/hid/ps2mouse/ps2mouse.c
===================================================================
--- uspace/drv/hid/ps2mouse/ps2mouse.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/ps2mouse/ps2mouse.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <stdbool.h>
 #include <errno.h>
-#include <str_error.h>
 #include <ddf/log.h>
 #include <io/keycode.h>
@@ -77,7 +76,7 @@
 	uint8_t data = 0; \
 	size_t nread; \
-	const errno_t rc = chardev_read((mouse)->chardev, &data, 1, &nread); \
+	const int rc = chardev_read((mouse)->chardev, &data, 1, &nread); \
 	if (rc != EOK) { \
-		ddf_msg(LVL_ERROR, "Failed reading byte: %s", str_error_name(rc));\
+		ddf_msg(LVL_ERROR, "Failed reading byte: %d", rc);\
 		return rc; \
 	} \
@@ -94,14 +93,14 @@
 	uint8_t data = (value); \
 	size_t nwr; \
-	const errno_t rc = chardev_write((mouse)->chardev, &data, 1, &nwr); \
+	const int rc = chardev_write((mouse)->chardev, &data, 1, &nwr); \
 	if (rc != EOK) { \
-		ddf_msg(LVL_ERROR, "Failed writing byte: %s", str_error_name(rc)); \
+		ddf_msg(LVL_ERROR, "Failed writing byte: %d", rc); \
 		return rc; \
 	} \
 } while (0)
 
-static errno_t polling_ps2(void *);
-static errno_t polling_intellimouse(void *);
-static errno_t probe_intellimouse(ps2_mouse_t *, bool);
+static int polling_ps2(void *);
+static int polling_intellimouse(void *);
+static int probe_intellimouse(ps2_mouse_t *, bool);
 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
 
@@ -120,9 +119,9 @@
  * @return EOK on success or non-zero error code
  */
-errno_t ps2_mouse_init(ps2_mouse_t *mouse, ddf_dev_t *dev)
+int ps2_mouse_init(ps2_mouse_t *mouse, ddf_dev_t *dev)
 {
 	async_sess_t *parent_sess;
 	bool bound = false;
-	errno_t rc;
+	int rc;
 
 	mouse->client_sess = NULL;
@@ -165,5 +164,5 @@
 
 	/* Probe IntelliMouse extensions. */
-	errno_t (*polling_f)(void*) = polling_ps2;
+	int (*polling_f)(void*) = polling_ps2;
 	if (probe_intellimouse(mouse, false) == EOK) {
 		ddf_msg(LVL_NOTE, "Enabled IntelliMouse extensions");
@@ -223,7 +222,7 @@
  * @return EOK on success or non-zero error code
  */
-static errno_t ps2_mouse_read_packet(ps2_mouse_t *mouse, void *pbuf, size_t psize)
-{
-	errno_t rc;
+static int ps2_mouse_read_packet(ps2_mouse_t *mouse, void *pbuf, size_t psize)
+{
+	int rc;
 	size_t pos;
 	size_t nread;
@@ -248,8 +247,8 @@
  * @return Never.
  */
-errno_t polling_ps2(void *arg)
+int polling_ps2(void *arg)
 {
 	ps2_mouse_t *mouse = (ps2_mouse_t *) arg;
-	errno_t rc;
+	int rc;
 
 	bool buttons[PS2_BUTTON_COUNT] = {};
@@ -300,8 +299,8 @@
  * @return Never.
  */
-static errno_t polling_intellimouse(void *arg)
+static int polling_intellimouse(void *arg)
 {
 	ps2_mouse_t *mouse = (ps2_mouse_t *) arg;
-	errno_t rc;
+	int rc;
 
 	bool buttons[INTELLIMOUSE_BUTTON_COUNT] = {};
@@ -373,5 +372,5 @@
  * See http://www.computer-engineering.org/ps2mouse/ for details.
  */
-static errno_t probe_intellimouse(ps2_mouse_t *mouse, bool buttons)
+static int probe_intellimouse(ps2_mouse_t *mouse, bool buttons)
 {
 	MOUSE_WRITE_BYTE(mouse, PS2_MOUSE_SET_SAMPLE_RATE);
Index: uspace/drv/hid/ps2mouse/ps2mouse.h
===================================================================
--- uspace/drv/hid/ps2mouse/ps2mouse.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/ps2mouse/ps2mouse.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,5 +53,5 @@
 } ps2_mouse_t;
 
-extern errno_t ps2_mouse_init(ps2_mouse_t *, ddf_dev_t *);
+extern int ps2_mouse_init(ps2_mouse_t *, ddf_dev_t *);
 
 #endif
Index: uspace/drv/hid/usbhid/blink1/blink1.c
===================================================================
--- uspace/drv/hid/usbhid/blink1/blink1.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/blink1/blink1.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,5 +60,5 @@
 } blink1_report_t;
 
-static errno_t usb_blink1_color_set(ddf_fun_t *fun, pixel_t pixel)
+static int usb_blink1_color_set(ddf_fun_t *fun, pixel_t pixel)
 {
 	usb_blink1_t *blink1_dev = (usb_blink1_t *) ddf_fun_data_get(fun);
@@ -93,5 +93,5 @@
 };
 
-errno_t usb_blink1_init(usb_hid_dev_t *hid_dev, void **data)
+int usb_blink1_init(usb_hid_dev_t *hid_dev, void **data)
 {
 	if (hid_dev == NULL) {
@@ -121,5 +121,5 @@
 	ddf_fun_set_ops(fun, &blink1_ops);
 	
-	errno_t rc = ddf_fun_bind(fun);
+	int rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
 		usb_log_error("Could not bind DDF function `%s': %s.\n",
@@ -159,5 +159,5 @@
 	usb_blink1_t *blink1_dev = (usb_blink1_t *) data;
 	
-	errno_t rc = ddf_fun_unbind(blink1_dev->fun);
+	int rc = ddf_fun_unbind(blink1_dev->fun);
 	if (rc != EOK) {
 		usb_log_error("Could not unbind function `%s', it "
Index: uspace/drv/hid/usbhid/blink1/blink1.h
===================================================================
--- uspace/drv/hid/usbhid/blink1/blink1.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/blink1/blink1.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,5 @@
 extern const char *HID_BLINK1_CATEGORY;
 
-extern errno_t usb_blink1_init(usb_hid_dev_t *, void **);
+extern int usb_blink1_init(usb_hid_dev_t *, void **);
 extern void usb_blink1_deinit(usb_hid_dev_t *, void *);
 
Index: uspace/drv/hid/usbhid/generic/hiddev.c
===================================================================
--- uspace/drv/hid/usbhid/generic/hiddev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/generic/hiddev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,9 +60,9 @@
 
 static size_t usb_generic_hid_get_event_length(ddf_fun_t *fun);
-static errno_t usb_generic_hid_get_event(ddf_fun_t *fun, uint8_t *buffer,
+static int usb_generic_hid_get_event(ddf_fun_t *fun, uint8_t *buffer,
     size_t size, size_t *act_size, int *event_nr, unsigned int flags);
-static errno_t usb_generic_hid_client_connected(ddf_fun_t *fun);
+static int usb_generic_hid_client_connected(ddf_fun_t *fun);
 static size_t usb_generic_get_report_descriptor_length(ddf_fun_t *fun);
-static errno_t usb_generic_get_report_descriptor(ddf_fun_t *fun, uint8_t *desc,
+static int usb_generic_get_report_descriptor(ddf_fun_t *fun, uint8_t *desc,
     size_t size, size_t *actual_size);
 
@@ -102,5 +102,5 @@
 }
 
-static errno_t usb_generic_hid_get_event(ddf_fun_t *fun, uint8_t *buffer,
+static int usb_generic_hid_get_event(ddf_fun_t *fun, uint8_t *buffer,
     size_t size, size_t *act_size, int *event_nr, unsigned int flags)
 {
@@ -143,5 +143,5 @@
 }
 
-static errno_t usb_generic_get_report_descriptor(ddf_fun_t *fun, uint8_t *desc,
+static int usb_generic_get_report_descriptor(ddf_fun_t *fun, uint8_t *desc,
     size_t size, size_t *actual_size)
 {
@@ -160,5 +160,5 @@
 }
 
-static errno_t usb_generic_hid_client_connected(ddf_fun_t *fun)
+static int usb_generic_hid_client_connected(ddf_fun_t *fun)
 {
 	usb_log_debug("Generic HID: Client connected.\n");
@@ -180,5 +180,5 @@
 }
 
-errno_t usb_generic_hid_init(usb_hid_dev_t *hid_dev, void **data)
+int usb_generic_hid_init(usb_hid_dev_t *hid_dev, void **data)
 {
 	usb_hid_gen_fun_t *hid_fun;
@@ -202,5 +202,5 @@
 	ddf_fun_set_ops(fun, &usb_generic_hid_ops);
 
-	errno_t rc = ddf_fun_bind(fun);
+	int rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
 		usb_log_error("Could not bind DDF function: %s.\n",
Index: uspace/drv/hid/usbhid/generic/hiddev.h
===================================================================
--- uspace/drv/hid/usbhid/generic/hiddev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/generic/hiddev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
 } usb_hid_gen_fun_t;
 
-extern errno_t usb_generic_hid_init(usb_hid_dev_t *, void **);
+extern int usb_generic_hid_init(usb_hid_dev_t *, void **);
 extern void usb_generic_hid_deinit(usb_hid_dev_t *, void *);
 extern bool usb_generic_hid_polling_callback(usb_hid_dev_t *, void *);
Index: uspace/drv/hid/usbhid/kbd/kbddev.c
===================================================================
--- uspace/drv/hid/usbhid/kbd/kbddev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/kbd/kbddev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -257,5 +257,5 @@
 
 	// TODO: what about the Report ID?
-	errno_t rc = usb_hid_report_output_translate(&hid_dev->report, 0,
+	int rc = usb_hid_report_output_translate(&hid_dev->report, 0,
 	    kbd_dev->output_buffer, kbd_dev->output_size);
 
@@ -435,5 +435,5 @@
 	}
 
-	errno_t ret =
+	int ret =
 	   usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
 	if (ret != EOK) {
@@ -480,5 +480,5 @@
 /* HID/KBD structure manipulation                                             */
 
-static errno_t kbd_dev_init(usb_kbd_t *kbd_dev, usb_hid_dev_t *hid_dev)
+static int kbd_dev_init(usb_kbd_t *kbd_dev, usb_hid_dev_t *hid_dev)
 {
 	assert(kbd_dev);
@@ -507,5 +507,5 @@
 	}
 
-	errno_t ret =
+	int ret =
 	    usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
 	if (ret != EOK) {
@@ -616,5 +616,5 @@
  * @return Other value inherited from function usbhid_dev_init().
  */
-errno_t usb_kbd_init(usb_hid_dev_t *hid_dev, void **data)
+int usb_kbd_init(usb_hid_dev_t *hid_dev, void **data)
 {
 	usb_log_debug("Initializing HID/KBD structure...\n");
@@ -642,5 +642,5 @@
 	}
 
-	errno_t ret = kbd_dev_init(kbd_dev, hid_dev);
+	int ret = kbd_dev_init(kbd_dev, hid_dev);
 	if (ret != EOK) {
 		usb_log_error("Failed to initialize KBD device  structure.\n");
@@ -775,8 +775,8 @@
 }
 
-errno_t usb_kbd_set_boot_protocol(usb_hid_dev_t *hid_dev)
+int usb_kbd_set_boot_protocol(usb_hid_dev_t *hid_dev)
 {
 	assert(hid_dev);
-	errno_t rc = usb_hid_parse_report_descriptor(
+	int rc = usb_hid_parse_report_descriptor(
 	    &hid_dev->report, USB_KBD_BOOT_REPORT_DESCRIPTOR,
 	    sizeof(USB_KBD_BOOT_REPORT_DESCRIPTOR));
Index: uspace/drv/hid/usbhid/kbd/kbddev.h
===================================================================
--- uspace/drv/hid/usbhid/kbd/kbddev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/kbd/kbddev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -115,5 +115,5 @@
 extern const char *HID_KBD_CATEGORY;
 
-extern errno_t usb_kbd_init(usb_hid_dev_t *, void **);
+extern int usb_kbd_init(usb_hid_dev_t *, void **);
 extern bool usb_kbd_polling_callback(usb_hid_dev_t *, void *);
 extern int usb_kbd_is_initialized(const usb_kbd_t *);
@@ -122,5 +122,5 @@
 extern void usb_kbd_push_ev(usb_kbd_t *, int, unsigned int);
 extern void usb_kbd_deinit(usb_hid_dev_t *, void *);
-extern errno_t usb_kbd_set_boot_protocol(usb_hid_dev_t *);
+extern int usb_kbd_set_boot_protocol(usb_hid_dev_t *);
 
 #endif /* USB_HID_KBDDEV_H_ */
Index: uspace/drv/hid/usbhid/kbd/kbdrepeat.c
===================================================================
--- uspace/drv/hid/usbhid/kbd/kbdrepeat.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/kbd/kbdrepeat.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -117,5 +117,5 @@
  * @retval EINVAL if no argument is supplied.
  */
-errno_t usb_kbd_repeat_fibril(void *arg)
+int usb_kbd_repeat_fibril(void *arg)
 {
 	usb_log_debug("Autorepeat fibril spawned.\n");
Index: uspace/drv/hid/usbhid/kbd/kbdrepeat.h
===================================================================
--- uspace/drv/hid/usbhid/kbd/kbdrepeat.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/kbd/kbdrepeat.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,5 +59,5 @@
 
 
-errno_t usb_kbd_repeat_fibril(void *arg);
+int usb_kbd_repeat_fibril(void *arg);
 
 void usb_kbd_repeat_start(struct usb_kbd_t *kbd, unsigned int key);
Index: uspace/drv/hid/usbhid/main.c
===================================================================
--- uspace/drv/hid/usbhid/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
  * @return Error code.
  */
-static errno_t usb_hid_device_add(usb_device_t *dev)
+static int usb_hid_device_add(usb_device_t *dev)
 {
 	usb_log_debug("%s\n", __FUNCTION__);
@@ -77,5 +77,5 @@
 	}
 
-	errno_t rc = usb_hid_init(hid_dev, dev);
+	int rc = usb_hid_init(hid_dev, dev);
 	if (rc != EOK) {
 		usb_log_error("Failed to initialize USB/HID device.\n");
@@ -122,5 +122,5 @@
  * @return Error code.
  */
-static errno_t usb_hid_device_rem(usb_device_t *dev)
+static int usb_hid_device_rem(usb_device_t *dev)
 {
 	// TODO: Stop device polling
@@ -135,5 +135,5 @@
  * @return Error code.
  */
-static errno_t usb_hid_device_gone(usb_device_t *dev)
+static int usb_hid_device_gone(usb_device_t *dev)
 {
 	assert(dev);
Index: uspace/drv/hid/usbhid/mouse/mousedev.c
===================================================================
--- uspace/drv/hid/usbhid/mouse/mousedev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/mouse/mousedev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -204,5 +204,5 @@
 		return true;
 	}
-	errno_t ret =
+	int ret =
 	   usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_BUTTON, 0);
 	if (ret != EOK) {
@@ -296,5 +296,5 @@
 }
 
-static errno_t mouse_dev_init(usb_mouse_t *mouse_dev, usb_hid_dev_t *hid_dev)
+static int mouse_dev_init(usb_mouse_t *mouse_dev, usb_hid_dev_t *hid_dev)
 {
 	// FIXME: This may not be optimal since stupid hardware vendor may
@@ -320,5 +320,5 @@
 }
 
-errno_t usb_mouse_init(usb_hid_dev_t *hid_dev, void **data)
+int usb_mouse_init(usb_hid_dev_t *hid_dev, void **data)
 {
 	usb_log_debug("Initializing HID/Mouse structure...\n");
@@ -347,5 +347,5 @@
 	}
 
-	errno_t ret = mouse_dev_init(mouse_dev, hid_dev);
+	int ret = mouse_dev_init(mouse_dev, hid_dev);
 	if (ret != EOK) {
 		usb_log_error("Failed to init HID mouse device structure.\n");
@@ -403,5 +403,5 @@
 	/* Hangup session to the console */
 	if (mouse_dev->mouse_sess != NULL) {
-		const errno_t ret = async_hangup(mouse_dev->mouse_sess);
+		const int ret = async_hangup(mouse_dev->mouse_sess);
 		if (ret != EOK)
 			usb_log_warning("Failed to hang up mouse session: "
@@ -413,7 +413,7 @@
 }
 
-errno_t usb_mouse_set_boot_protocol(usb_hid_dev_t *hid_dev)
-{
-	errno_t rc = usb_hid_parse_report_descriptor(
+int usb_mouse_set_boot_protocol(usb_hid_dev_t *hid_dev)
+{
+	int rc = usb_hid_parse_report_descriptor(
 	    &hid_dev->report, USB_MOUSE_BOOT_REPORT_DESCRIPTOR,
 	    sizeof(USB_MOUSE_BOOT_REPORT_DESCRIPTOR));
Index: uspace/drv/hid/usbhid/mouse/mousedev.h
===================================================================
--- uspace/drv/hid/usbhid/mouse/mousedev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/mouse/mousedev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,8 +59,8 @@
 extern const char *HID_MOUSE_CATEGORY;
 
-extern errno_t usb_mouse_init(usb_hid_dev_t *, void **);
+extern int usb_mouse_init(usb_hid_dev_t *, void **);
 extern bool usb_mouse_polling_callback(usb_hid_dev_t *, void *);
 extern void usb_mouse_deinit(usb_hid_dev_t *, void *);
-extern errno_t usb_mouse_set_boot_protocol(usb_hid_dev_t *);
+extern int usb_mouse_set_boot_protocol(usb_hid_dev_t *);
 
 #endif // USB_HID_MOUSEDEV_H_
Index: uspace/drv/hid/usbhid/multimedia/multimedia.c
===================================================================
--- uspace/drv/hid/usbhid/multimedia/multimedia.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/multimedia/multimedia.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -153,5 +153,5 @@
 }
 
-errno_t usb_multimedia_init(struct usb_hid_dev *hid_dev, void **data)
+int usb_multimedia_init(struct usb_hid_dev *hid_dev, void **data)
 {
 	if (hid_dev == NULL || hid_dev->usb_dev == NULL) {
@@ -182,5 +182,5 @@
 	//todo Autorepeat?
 
-	errno_t rc = ddf_fun_bind(fun);
+	int rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
 		usb_log_error("Could not bind DDF function: %s.\n",
@@ -248,5 +248,5 @@
 		return true; /* This might be a temporary failure. */
 
-	errno_t ret =
+	int ret =
 	    usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0);
 	if (ret != EOK) {
Index: uspace/drv/hid/usbhid/multimedia/multimedia.h
===================================================================
--- uspace/drv/hid/usbhid/multimedia/multimedia.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/multimedia/multimedia.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include "../usbhid.h"
 
-extern errno_t usb_multimedia_init(usb_hid_dev_t *, void **);
+extern int usb_multimedia_init(usb_hid_dev_t *, void **);
 extern void usb_multimedia_deinit(usb_hid_dev_t *, void *);
 extern bool usb_multimedia_polling_callback(usb_hid_dev_t *, void *);
Index: uspace/drv/hid/usbhid/usbhid.c
===================================================================
--- uspace/drv/hid/usbhid/usbhid.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/usbhid.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,5 +61,5 @@
 };
 
-static errno_t usb_hid_set_boot_kbd_subdriver(usb_hid_dev_t *hid_dev)
+static int usb_hid_set_boot_kbd_subdriver(usb_hid_dev_t *hid_dev)
 {
 	assert(hid_dev != NULL);
@@ -77,5 +77,5 @@
 }
 
-static errno_t usb_hid_set_boot_mouse_subdriver(usb_hid_dev_t *hid_dev)
+static int usb_hid_set_boot_mouse_subdriver(usb_hid_dev_t *hid_dev)
 {
 	assert(hid_dev != NULL);
@@ -93,5 +93,5 @@
 }
 
-static errno_t usb_hid_set_generic_hid_subdriver(usb_hid_dev_t *hid_dev)
+static int usb_hid_set_generic_hid_subdriver(usb_hid_dev_t *hid_dev)
 {
 	assert(hid_dev != NULL);
@@ -182,5 +182,5 @@
 }
 
-static errno_t usb_hid_save_subdrivers(usb_hid_dev_t *hid_dev,
+static int usb_hid_save_subdrivers(usb_hid_dev_t *hid_dev,
     const usb_hid_subdriver_t **subdrivers, unsigned count)
 {
@@ -215,5 +215,5 @@
 }
 
-static errno_t usb_hid_find_subdrivers(usb_hid_dev_t *hid_dev)
+static int usb_hid_find_subdrivers(usb_hid_dev_t *hid_dev)
 {
 	assert(hid_dev != NULL);
@@ -267,5 +267,5 @@
 }
 
-static errno_t usb_hid_check_pipes(usb_hid_dev_t *hid_dev, usb_device_t *dev)
+static int usb_hid_check_pipes(usb_hid_dev_t *hid_dev, usb_device_t *dev)
 {
 	assert(hid_dev);
@@ -293,5 +293,5 @@
 }
 
-static errno_t usb_hid_init_report(usb_hid_dev_t *hid_dev)
+static int usb_hid_init_report(usb_hid_dev_t *hid_dev)
 {
 	assert(hid_dev != NULL);
@@ -342,5 +342,5 @@
  * @return Error code.
  */
-errno_t usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev)
+int usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev)
 {
 	assert(hid_dev);
@@ -355,5 +355,5 @@
 	hid_dev->poll_pipe_mapping = NULL;
 
-	errno_t rc = usb_hid_check_pipes(hid_dev, dev);
+	int rc = usb_hid_check_pipes(hid_dev, dev);
 	if (rc != EOK) {
 		return rc;
@@ -420,5 +420,5 @@
 		if (hid_dev->subdrivers[i].init != NULL) {
 			usb_log_debug("Initializing subdriver %d.\n",i);
-			const errno_t pret = hid_dev->subdrivers[i].init(hid_dev,
+			const int pret = hid_dev->subdrivers[i].init(hid_dev,
 			    &hid_dev->subdrivers[i].data);
 			if (pret != EOK) {
@@ -473,5 +473,5 @@
 
 	/* Parse the input report */
-	const errno_t rc = usb_hid_parse_report(
+	const int rc = usb_hid_parse_report(
 	    &hid_dev->report, buffer, buffer_size, &hid_dev->report_id);
 	if (rc != EOK) {
Index: uspace/drv/hid/usbhid/usbhid.h
===================================================================
--- uspace/drv/hid/usbhid/usbhid.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/usbhid/usbhid.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,5 +55,5 @@
  * @return Error code.
  */
-typedef errno_t (*usb_hid_driver_init_t)(usb_hid_dev_t *dev, void **data);
+typedef int (*usb_hid_driver_init_t)(usb_hid_dev_t *dev, void **data);
 
 /** Subdriver deinitialization callback.
@@ -134,5 +134,5 @@
 extern const usb_endpoint_description_t *usb_hid_endpoints[];
 
-errno_t usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev);
+int usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev);
 
 void usb_hid_deinit(usb_hid_dev_t *hid_dev);
Index: uspace/drv/hid/xtkbd/main.c
===================================================================
--- uspace/drv/hid/xtkbd/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/xtkbd/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
 #define NAME "xtkbd"
 
-static errno_t xt_kbd_add(ddf_dev_t *device);
+static int xt_kbd_add(ddf_dev_t *device);
 
 /** DDF driver ops. */
@@ -83,7 +83,7 @@
  *
  */
-static errno_t xt_kbd_add(ddf_dev_t *device)
+static int xt_kbd_add(ddf_dev_t *device)
 {
-	errno_t rc;
+	int rc;
 
 	if (!device)
Index: uspace/drv/hid/xtkbd/xtkbd.c
===================================================================
--- uspace/drv/hid/xtkbd/xtkbd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/xtkbd/xtkbd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -205,9 +205,9 @@
  *
  */
-static errno_t polling(void *arg)
+static int polling(void *arg)
 {
 	xt_kbd_t *kbd = arg;
 	size_t nread;
-	errno_t rc;
+	int rc;
 	
 	while (true) {
@@ -353,5 +353,5 @@
 		
 		size_t nwr;
-		errno_t rc = chardev_write(kbd->chardev, &cmds[0], 1, &nwr);
+		int rc = chardev_write(kbd->chardev, &cmds[0], 1, &nwr);
 		if (rc != EOK) {
 			async_answer_0(icallid, rc);
@@ -410,9 +410,9 @@
  *
  */
-errno_t xt_kbd_init(xt_kbd_t *kbd, ddf_dev_t *dev)
+int xt_kbd_init(xt_kbd_t *kbd, ddf_dev_t *dev)
 {
 	async_sess_t *parent_sess;
 	bool bound = false;
-	errno_t rc;
+	int rc;
 	
 	kbd->client_sess = NULL;
Index: uspace/drv/hid/xtkbd/xtkbd.h
===================================================================
--- uspace/drv/hid/xtkbd/xtkbd.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/hid/xtkbd/xtkbd.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,5 +55,5 @@
 } xt_kbd_t;
 
-extern errno_t xt_kbd_init(xt_kbd_t *, ddf_dev_t *);
+extern int xt_kbd_init(xt_kbd_t *, ddf_dev_t *);
 
 #endif
Index: uspace/drv/intctl/apic/apic.c
===================================================================
--- uspace/drv/intctl/apic/apic.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/apic/apic.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,4 @@
 #include <stdbool.h>
 #include <errno.h>
-#include <str_error.h>
 #include <async.h>
 #include <stdio.h>
@@ -140,5 +139,5 @@
 }
 
-static errno_t apic_enable_irq(apic_t *apic, sysarg_t irq)
+static int apic_enable_irq(apic_t *apic, sysarg_t irq)
 {
 	io_redirection_reg_t reg;
@@ -207,10 +206,10 @@
 
 /** Add APIC device. */
-errno_t apic_add(apic_t *apic, apic_res_t *res)
+int apic_add(apic_t *apic, apic_res_t *res)
 {
 	sysarg_t have_apic;
 	ddf_fun_t *fun_a = NULL;
 	void *regs;
-	errno_t rc;
+	int rc;
 	
 	if ((sysinfo_get_value("apic", &have_apic) != EOK) || (!have_apic)) {
@@ -221,5 +220,5 @@
 	rc = pio_enable((void *) res->base, IO_APIC_SIZE, &regs);
 	if (rc != EOK) {
-		printf("%s: Failed to enable PIO for APIC: %s\n", NAME, str_error(rc));
+		printf("%s: Failed to enable PIO for APIC: %d\n", NAME, rc);
 		return EIO;
 	}
@@ -238,5 +237,5 @@
 	rc = ddf_fun_bind(fun_a);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a': %s", str_error(rc));
+		ddf_msg(LVL_ERROR, "Failed binding function 'a'. (%d)", rc);
 		goto error;
 	}
@@ -254,5 +253,5 @@
 
 /** Remove APIC device */
-errno_t apic_remove(apic_t *apic)
+int apic_remove(apic_t *apic)
 {
 	return ENOTSUP;
@@ -260,5 +259,5 @@
 
 /** APIC device gone */
-errno_t apic_gone(apic_t *apic)
+int apic_gone(apic_t *apic)
 {
 	return ENOTSUP;
Index: uspace/drv/intctl/apic/apic.h
===================================================================
--- uspace/drv/intctl/apic/apic.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/apic/apic.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,7 +52,7 @@
 } apic_t;
 
-extern errno_t apic_add(apic_t *, apic_res_t *);
-extern errno_t apic_remove(apic_t *);
-extern errno_t apic_gone(apic_t *);
+extern int apic_add(apic_t *, apic_res_t *);
+extern int apic_remove(apic_t *);
+extern int apic_gone(apic_t *);
 
 #endif
Index: uspace/drv/intctl/apic/main.c
===================================================================
--- uspace/drv/intctl/apic/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/apic/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,9 +43,9 @@
 #define NAME  "apic"
 
-static errno_t apic_dev_add(ddf_dev_t *dev);
-static errno_t apic_dev_remove(ddf_dev_t *dev);
-static errno_t apic_dev_gone(ddf_dev_t *dev);
-static errno_t apic_fun_online(ddf_fun_t *fun);
-static errno_t apic_fun_offline(ddf_fun_t *fun);
+static int apic_dev_add(ddf_dev_t *dev);
+static int apic_dev_remove(ddf_dev_t *dev);
+static int apic_dev_gone(ddf_dev_t *dev);
+static int apic_fun_online(ddf_fun_t *fun);
+static int apic_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -62,9 +62,9 @@
 };
 
-static errno_t apic_get_res(ddf_dev_t *dev, apic_res_t *res)
+static int apic_get_res(ddf_dev_t *dev, apic_res_t *res)
 {
 	async_sess_t *parent_sess;
 	hw_res_list_parsed_t hw_res;
-	errno_t rc;
+	int rc;
 
 	parent_sess = ddf_dev_parent_sess_get(dev);
@@ -90,9 +90,9 @@
 }
 
-static errno_t apic_dev_add(ddf_dev_t *dev)
+static int apic_dev_add(ddf_dev_t *dev)
 {
 	apic_t *apic;
 	apic_res_t apic_res;
-	errno_t rc;
+	int rc;
 
         ddf_msg(LVL_DEBUG, "apic_dev_add(%p)", dev);
@@ -114,5 +114,5 @@
 }
 
-static errno_t apic_dev_remove(ddf_dev_t *dev)
+static int apic_dev_remove(ddf_dev_t *dev)
 {
         apic_t *apic = (apic_t *)ddf_dev_data_get(dev);
@@ -123,5 +123,5 @@
 }
 
-static errno_t apic_dev_gone(ddf_dev_t *dev)
+static int apic_dev_gone(ddf_dev_t *dev)
 {
         apic_t *apic = (apic_t *)ddf_dev_data_get(dev);
@@ -132,5 +132,5 @@
 }
 
-static errno_t apic_fun_online(ddf_fun_t *fun)
+static int apic_fun_online(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "apic_fun_online()");
@@ -138,5 +138,5 @@
 }
 
-static errno_t apic_fun_offline(ddf_fun_t *fun)
+static int apic_fun_offline(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "apic_fun_offline()");
Index: uspace/drv/intctl/i8259/i8259.c
===================================================================
--- uspace/drv/intctl/i8259/i8259.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/i8259/i8259.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,4 @@
 #include <stdbool.h>
 #include <errno.h>
-#include <str_error.h>
 #include <async.h>
 #include <stdio.h>
@@ -64,5 +63,5 @@
 #define PIC_MAX_IRQ  15
 
-static errno_t pic_enable_irq(i8259_t *i8259, sysarg_t irq)
+static int pic_enable_irq(i8259_t *i8259, sysarg_t irq)
 {
 	if (irq > PIC_MAX_IRQ)
@@ -136,5 +135,5 @@
 
 /** Add i8259 device. */
-errno_t i8259_add(i8259_t *i8259, i8259_res_t *res)
+int i8259_add(i8259_t *i8259, i8259_res_t *res)
 {
 	sysarg_t have_i8259;
@@ -142,5 +141,5 @@
 	ioport8_t *regs1;
 	ddf_fun_t *fun_a = NULL;
-	errno_t rc;
+	int rc;
 	
 	if ((sysinfo_get_value("i8259", &have_i8259) != EOK) || (!have_i8259)) {
@@ -171,5 +170,5 @@
 	rc = ddf_fun_bind(fun_a);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a': %s", str_error(rc));
+		ddf_msg(LVL_ERROR, "Failed binding function 'a'. (%d)", rc);
 		goto error;
 	}
@@ -187,5 +186,5 @@
 
 /** Remove i8259 device */
-errno_t i8259_remove(i8259_t *i8259)
+int i8259_remove(i8259_t *i8259)
 {
 	return ENOTSUP;
@@ -193,5 +192,5 @@
 
 /** i8259 device gone */
-errno_t i8259_gone(i8259_t *i8259)
+int i8259_gone(i8259_t *i8259)
 {
 	return ENOTSUP;
Index: uspace/drv/intctl/i8259/i8259.h
===================================================================
--- uspace/drv/intctl/i8259/i8259.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/i8259/i8259.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,7 +52,7 @@
 } i8259_t;
 
-extern errno_t i8259_add(i8259_t *, i8259_res_t *);
-extern errno_t i8259_remove(i8259_t *);
-extern errno_t i8259_gone(i8259_t *);
+extern int i8259_add(i8259_t *, i8259_res_t *);
+extern int i8259_remove(i8259_t *);
+extern int i8259_gone(i8259_t *);
 
 #endif
Index: uspace/drv/intctl/i8259/main.c
===================================================================
--- uspace/drv/intctl/i8259/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/i8259/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,9 +43,9 @@
 #define NAME  "i8259"
 
-static errno_t i8259_dev_add(ddf_dev_t *dev);
-static errno_t i8259_dev_remove(ddf_dev_t *dev);
-static errno_t i8259_dev_gone(ddf_dev_t *dev);
-static errno_t i8259_fun_online(ddf_fun_t *fun);
-static errno_t i8259_fun_offline(ddf_fun_t *fun);
+static int i8259_dev_add(ddf_dev_t *dev);
+static int i8259_dev_remove(ddf_dev_t *dev);
+static int i8259_dev_gone(ddf_dev_t *dev);
+static int i8259_fun_online(ddf_fun_t *fun);
+static int i8259_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -62,9 +62,9 @@
 };
 
-static errno_t i8259_get_res(ddf_dev_t *dev, i8259_res_t *res)
+static int i8259_get_res(ddf_dev_t *dev, i8259_res_t *res)
 {
 	async_sess_t *parent_sess;
 	hw_res_list_parsed_t hw_res;
-	errno_t rc;
+	int rc;
 
 	parent_sess = ddf_dev_parent_sess_get(dev);
@@ -91,9 +91,9 @@
 }
 
-static errno_t i8259_dev_add(ddf_dev_t *dev)
+static int i8259_dev_add(ddf_dev_t *dev)
 {
 	i8259_t *i8259;
 	i8259_res_t i8259_res;
-	errno_t rc;
+	int rc;
 
         ddf_msg(LVL_DEBUG, "i8259_dev_add(%p)", dev);
@@ -115,5 +115,5 @@
 }
 
-static errno_t i8259_dev_remove(ddf_dev_t *dev)
+static int i8259_dev_remove(ddf_dev_t *dev)
 {
         i8259_t *i8259 = (i8259_t *)ddf_dev_data_get(dev);
@@ -124,5 +124,5 @@
 }
 
-static errno_t i8259_dev_gone(ddf_dev_t *dev)
+static int i8259_dev_gone(ddf_dev_t *dev)
 {
         i8259_t *i8259 = (i8259_t *)ddf_dev_data_get(dev);
@@ -133,5 +133,5 @@
 }
 
-static errno_t i8259_fun_online(ddf_fun_t *fun)
+static int i8259_fun_online(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "i8259_fun_online()");
@@ -139,5 +139,5 @@
 }
 
-static errno_t i8259_fun_offline(ddf_fun_t *fun)
+static int i8259_fun_offline(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "i8259_fun_offline()");
Index: uspace/drv/intctl/icp-ic/icp-ic.c
===================================================================
--- uspace/drv/intctl/icp-ic/icp-ic.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/icp-ic/icp-ic.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,4 @@
 #include <ddf/log.h>
 #include <errno.h>
-#include <str_error.h>
 #include <ipc/irc.h>
 #include <stdint.h>
@@ -52,5 +51,5 @@
 };
 
-static errno_t icpic_enable_irq(icpic_t *icpic, sysarg_t irq)
+static int icpic_enable_irq(icpic_t *icpic, sysarg_t irq)
 {
 	if (irq > icpic_max_irq)
@@ -112,9 +111,9 @@
 
 /** Add icp-ic device. */
-errno_t icpic_add(icpic_t *icpic, icpic_res_t *res)
+int icpic_add(icpic_t *icpic, icpic_res_t *res)
 {
 	ddf_fun_t *fun_a = NULL;
 	void *regs;
-	errno_t rc;
+	int rc;
 
 	rc = pio_enable((void *)res->base, sizeof(icpic_regs_t), &regs);
@@ -137,5 +136,5 @@
 	rc = ddf_fun_bind(fun_a);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a': %s", str_error(rc));
+		ddf_msg(LVL_ERROR, "Failed binding function 'a'. (%d)", rc);
 		goto error;
 	}
@@ -153,5 +152,5 @@
 
 /** Remove icp-ic device */
-errno_t icpic_remove(icpic_t *icpic)
+int icpic_remove(icpic_t *icpic)
 {
 	return ENOTSUP;
@@ -159,5 +158,5 @@
 
 /** icp-ic device gone */
-errno_t icpic_gone(icpic_t *icpic)
+int icpic_gone(icpic_t *icpic)
 {
 	return ENOTSUP;
Index: uspace/drv/intctl/icp-ic/icp-ic.h
===================================================================
--- uspace/drv/intctl/icp-ic/icp-ic.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/icp-ic/icp-ic.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,7 +53,7 @@
 } icpic_t;
 
-extern errno_t icpic_add(icpic_t *, icpic_res_t *);
-extern errno_t icpic_remove(icpic_t *);
-extern errno_t icpic_gone(icpic_t *);
+extern int icpic_add(icpic_t *, icpic_res_t *);
+extern int icpic_remove(icpic_t *);
+extern int icpic_gone(icpic_t *);
 
 #endif
Index: uspace/drv/intctl/icp-ic/main.c
===================================================================
--- uspace/drv/intctl/icp-ic/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/icp-ic/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,9 +43,9 @@
 #define NAME  "icp-ic"
 
-static errno_t icpic_dev_add(ddf_dev_t *dev);
-static errno_t icpic_dev_remove(ddf_dev_t *dev);
-static errno_t icpic_dev_gone(ddf_dev_t *dev);
-static errno_t icpic_fun_online(ddf_fun_t *fun);
-static errno_t icpic_fun_offline(ddf_fun_t *fun);
+static int icpic_dev_add(ddf_dev_t *dev);
+static int icpic_dev_remove(ddf_dev_t *dev);
+static int icpic_dev_gone(ddf_dev_t *dev);
+static int icpic_fun_online(ddf_fun_t *fun);
+static int icpic_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -62,9 +62,9 @@
 };
 
-static errno_t icpic_get_res(ddf_dev_t *dev, icpic_res_t *res)
+static int icpic_get_res(ddf_dev_t *dev, icpic_res_t *res)
 {
 	async_sess_t *parent_sess;
 	hw_res_list_parsed_t hw_res;
-	errno_t rc;
+	int rc;
 
 	parent_sess = ddf_dev_parent_sess_get(dev);
@@ -90,9 +90,9 @@
 }
 
-static errno_t icpic_dev_add(ddf_dev_t *dev)
+static int icpic_dev_add(ddf_dev_t *dev)
 {
 	icpic_t *icpic;
 	icpic_res_t icpic_res;
-	errno_t rc;
+	int rc;
 
         ddf_msg(LVL_DEBUG, "icpic_dev_add(%p)", dev);
@@ -114,5 +114,5 @@
 }
 
-static errno_t icpic_dev_remove(ddf_dev_t *dev)
+static int icpic_dev_remove(ddf_dev_t *dev)
 {
         icpic_t *icpic = (icpic_t *)ddf_dev_data_get(dev);
@@ -123,5 +123,5 @@
 }
 
-static errno_t icpic_dev_gone(ddf_dev_t *dev)
+static int icpic_dev_gone(ddf_dev_t *dev)
 {
         icpic_t *icpic = (icpic_t *)ddf_dev_data_get(dev);
@@ -132,5 +132,5 @@
 }
 
-static errno_t icpic_fun_online(ddf_fun_t *fun)
+static int icpic_fun_online(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "icpic_fun_online()");
@@ -138,5 +138,5 @@
 }
 
-static errno_t icpic_fun_offline(ddf_fun_t *fun)
+static int icpic_fun_offline(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "icpic_fun_offline()");
Index: uspace/drv/intctl/obio/main.c
===================================================================
--- uspace/drv/intctl/obio/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/obio/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,9 +43,9 @@
 #define NAME  "obio"
 
-static errno_t obio_dev_add(ddf_dev_t *dev);
-static errno_t obio_dev_remove(ddf_dev_t *dev);
-static errno_t obio_dev_gone(ddf_dev_t *dev);
-static errno_t obio_fun_online(ddf_fun_t *fun);
-static errno_t obio_fun_offline(ddf_fun_t *fun);
+static int obio_dev_add(ddf_dev_t *dev);
+static int obio_dev_remove(ddf_dev_t *dev);
+static int obio_dev_gone(ddf_dev_t *dev);
+static int obio_fun_online(ddf_fun_t *fun);
+static int obio_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -62,9 +62,9 @@
 };
 
-static errno_t obio_get_res(ddf_dev_t *dev, obio_res_t *res)
+static int obio_get_res(ddf_dev_t *dev, obio_res_t *res)
 {
 	async_sess_t *parent_sess;
 	hw_res_list_parsed_t hw_res;
-	errno_t rc;
+	int rc;
 
 	parent_sess = ddf_dev_parent_sess_get(dev);
@@ -90,9 +90,9 @@
 }
 
-static errno_t obio_dev_add(ddf_dev_t *dev)
+static int obio_dev_add(ddf_dev_t *dev)
 {
 	obio_t *obio;
 	obio_res_t obio_res;
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "obio_dev_add(%p)", dev);
@@ -114,5 +114,5 @@
 }
 
-static errno_t obio_dev_remove(ddf_dev_t *dev)
+static int obio_dev_remove(ddf_dev_t *dev)
 {
         obio_t *obio = (obio_t *)ddf_dev_data_get(dev);
@@ -123,5 +123,5 @@
 }
 
-static errno_t obio_dev_gone(ddf_dev_t *dev)
+static int obio_dev_gone(ddf_dev_t *dev)
 {
         obio_t *obio = (obio_t *)ddf_dev_data_get(dev);
@@ -132,5 +132,5 @@
 }
 
-static errno_t obio_fun_online(ddf_fun_t *fun)
+static int obio_fun_online(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "obio_fun_online()");
@@ -138,5 +138,5 @@
 }
 
-static errno_t obio_fun_offline(ddf_fun_t *fun)
+static int obio_fun_offline(ddf_fun_t *fun)
 {
         ddf_msg(LVL_DEBUG, "obio_fun_offline()");
Index: uspace/drv/intctl/obio/obio.c
===================================================================
--- uspace/drv/intctl/obio/obio.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/obio/obio.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,4 @@
 #include <ddi.h>
 #include <errno.h>
-#include <str_error.h>
 #include <inttypes.h>
 #include <ipc/irc.h>
@@ -114,8 +113,8 @@
 
 /** Add OBIO device. */
-errno_t obio_add(obio_t *obio, obio_res_t *res)
+int obio_add(obio_t *obio, obio_res_t *res)
 {
 	ddf_fun_t *fun_a = NULL;
-	errno_t rc;
+	int rc;
 
 	rc = pio_enable((void *)res->base, OBIO_SIZE, (void **) &obio->regs);
@@ -139,5 +138,5 @@
 	rc = ddf_fun_bind(fun_a);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a': %s", str_error(rc));
+		ddf_msg(LVL_ERROR, "Failed binding function 'a'. (%d)", rc);
 		goto error;
 	}
@@ -155,5 +154,5 @@
 
 /** Remove OBIO device */
-errno_t obio_remove(obio_t *obio)
+int obio_remove(obio_t *obio)
 {
 	return ENOTSUP;
@@ -161,5 +160,5 @@
 
 /** OBIO device gone */
-errno_t obio_gone(obio_t *obio)
+int obio_gone(obio_t *obio)
 {
 	return ENOTSUP;
Index: uspace/drv/intctl/obio/obio.h
===================================================================
--- uspace/drv/intctl/obio/obio.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/intctl/obio/obio.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,7 +52,7 @@
 } obio_t;
 
-extern errno_t obio_add(obio_t *, obio_res_t *);
-extern errno_t obio_remove(obio_t *);
-extern errno_t obio_gone(obio_t *);
+extern int obio_add(obio_t *, obio_res_t *);
+extern int obio_remove(obio_t *);
+extern int obio_gone(obio_t *);
 
 #endif
Index: uspace/drv/nic/ar9271/ar9271.c
===================================================================
--- uspace/drv/nic/ar9271/ar9271.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ar9271/ar9271.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,4 @@
 #include <ddf/interrupt.h>
 #include <errno.h>
-#include <str_error.h>
 #include <nic.h>
 #include <macros.h>
@@ -99,12 +98,12 @@
 
 /* Callback when new device is to be controlled by this driver. */
-static errno_t ar9271_add_device(ddf_dev_t *);
+static int ar9271_add_device(ddf_dev_t *);
 
 /* IEEE 802.11 callbacks */
-static errno_t ar9271_ieee80211_start(ieee80211_dev_t *);
-static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t);
-static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t);
-static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool);
-static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *,
+static int ar9271_ieee80211_start(ieee80211_dev_t *);
+static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t);
+static int ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t);
+static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool);
+static int ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *,
     bool);
 
@@ -128,7 +127,7 @@
 static ieee80211_iface_t ar9271_ieee80211_iface;
 
-static errno_t ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *);
-static errno_t ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *);
-static errno_t ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *,
+static int ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *);
+static int ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *);
+static int ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *,
     nic_role_t *);
 
@@ -144,5 +143,5 @@
  *
  */
-static errno_t ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
+static int ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
 {
 	assert(dev);
@@ -164,5 +163,5 @@
  *
  */
-static errno_t ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
+static int ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
 {
 	*state = NIC_CS_PLUGGED;
@@ -174,5 +173,5 @@
  *
  */
-static errno_t ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,
+static int ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,
     nic_channel_mode_t *duplex, nic_role_t *role)
 {
@@ -187,5 +186,5 @@
  *
  */
-static errno_t ar9271_on_multicast_mode_change(nic_t *nic,
+static int ar9271_on_multicast_mode_change(nic_t *nic,
     nic_multicast_mode_t mode, const nic_address_t *addr, size_t addr_cnt)
 {
@@ -210,5 +209,5 @@
  *
  */
-static errno_t ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
+static int ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
     const nic_address_t *addr, size_t addr_cnt)
 {
@@ -236,5 +235,5 @@
  *
  */
-static errno_t ar9271_on_broadcast_mode_change(nic_t *nic,
+static int ar9271_on_broadcast_mode_change(nic_t *nic,
     nic_broadcast_mode_t mode)
 {
@@ -258,5 +257,5 @@
 }
 
-static errno_t ar9271_data_polling(void *arg)
+static int ar9271_data_polling(void *arg)
 {
 	assert(arg);
@@ -319,5 +318,5 @@
  *
  */
-static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,
+static int ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,
     uint16_t freq)
 {
@@ -330,5 +329,5 @@
 	wmi_send_command(ar9271->htc_device, WMI_STOP_RECV, NULL, 0, NULL);
 	
-	errno_t rc = hw_freq_switch(ar9271, freq);
+	int rc = hw_freq_switch(ar9271, freq);
 	if (rc != EOK) {
 		usb_log_error("Failed to HW switch frequency.\n");
@@ -352,5 +351,5 @@
 }
 
-static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,
+static int ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,
     bool connected)
 {
@@ -401,5 +400,5 @@
 }
 
-static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,
+static int ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,
     ieee80211_key_config_t *key_conf, bool insert)
 {
@@ -519,5 +518,5 @@
 }
 
-static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,
+static int ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,
     void *buffer, size_t buffer_size)
 {
@@ -608,5 +607,5 @@
 }
 
-static errno_t ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)
+static int ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)
 {
 	assert(ieee80211_dev);
@@ -616,5 +615,5 @@
 	wmi_send_command(ar9271->htc_device, WMI_FLUSH_RECV, NULL, 0, NULL);
 	
-	errno_t rc = hw_reset(ar9271);
+	int rc = hw_reset(ar9271);
 	if (rc != EOK) {
 		usb_log_error("Failed to do HW reset.\n");
@@ -666,5 +665,5 @@
 }
 
-static errno_t ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device)
+static int ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device)
 {
 	ar9271->starting_up = true;
@@ -680,5 +679,5 @@
 	}
 	
-	errno_t rc = ath_usb_init(ar9271->ath_device, usb_device);
+	int rc = ath_usb_init(ar9271->ath_device, usb_device);
 	if (rc != EOK) {
 		free(ar9271->ath_device);
@@ -734,8 +733,8 @@
  * @param ar9271 AR9271 device structure
  *
- * @return EOK if succeed, error code otherwise
- *
- */
-static errno_t ar9271_upload_fw(ar9271_t *ar9271)
+ * @return EOK if succeed, negative error code otherwise
+ *
+ */
+static int ar9271_upload_fw(ar9271_t *ar9271)
 {
 	usb_device_t *usb_device = ar9271->usb_device;
@@ -775,5 +774,5 @@
 		memcpy(buffer, current_data, chunk_size);
 		usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device);
-		errno_t rc = usb_control_request_set(ctrl_pipe,
+		int rc = usb_control_request_set(ctrl_pipe,
 		    USB_REQUEST_TYPE_VENDOR,
 		    USB_REQUEST_RECIPIENT_DEVICE,
@@ -785,5 +784,5 @@
 			free(buffer);
 			usb_log_error("Error while uploading firmware. "
-			    "Error: %s\n", str_error_name(rc));
+			    "Error: %d\n", rc);
 			return rc;
 		}
@@ -803,5 +802,5 @@
 	*/
 	usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device);
-	errno_t rc = usb_control_request_set(ctrl_pipe,
+	int rc = usb_control_request_set(ctrl_pipe,
 	    USB_REQUEST_TYPE_VENDOR,
 	    USB_REQUEST_RECIPIENT_DEVICE,
@@ -834,8 +833,8 @@
 	/* USB framework initialization. */
 	const char *err_msg = NULL;
-	errno_t rc = usb_device_create_ddf(dev, endpoints, &err_msg);
+	int rc = usb_device_create_ddf(dev, endpoints, &err_msg);
 	if (rc != EOK) {
 		usb_log_error("Failed to create USB device: %s, "
-		    "ERR_NUM = %s\n", err_msg, str_error_name(rc));
+		    "ERR_NUM = %d\n", err_msg, rc);
 		return NULL;
 	}
@@ -854,6 +853,6 @@
 	if (rc != EOK) {
 		free(ar9271);
-		usb_log_error("Failed to initialize AR9271 structure: %s\n",
-		    str_error_name(rc));
+		usb_log_error("Failed to initialize AR9271 structure: %d\n",
+		    rc);
 		return NULL;
 	}
@@ -877,7 +876,7 @@
  * @param dev The device structure.
  *
- * @return EOK if succeed, error code otherwise
- */
-static errno_t ar9271_add_device(ddf_dev_t *dev)
+ * @return EOK if succeed, negative error code otherwise
+ */
+static int ar9271_add_device(ddf_dev_t *dev)
 {
 	assert(dev);
@@ -896,5 +895,5 @@
 	
 	/* Initialize AR9271 HTC services. */
-	errno_t rc = htc_init(ar9271->htc_device);
+	int rc = htc_init(ar9271->htc_device);
 	if (rc != EOK) {
 		ar9271_delete_dev_data(ar9271);
Index: uspace/drv/nic/ar9271/ath.h
===================================================================
--- uspace/drv/nic/ar9271/ath.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ar9271/ath.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,8 +40,8 @@
 /** Atheros wifi operations. */
 typedef struct {
-	errno_t (*send_ctrl_message)(struct ath *, void *, size_t);
-	errno_t (*read_ctrl_message)(struct ath *, void *, size_t, size_t *);
-	errno_t (*send_data_message)(struct ath *, void *, size_t);
-	errno_t (*read_data_message)(struct ath *, void *, size_t, size_t *);
+	int (*send_ctrl_message)(struct ath *, void *, size_t);
+	int (*read_ctrl_message)(struct ath *, void *, size_t, size_t *);
+	int (*send_data_message)(struct ath *, void *, size_t);
+	int (*read_data_message)(struct ath *, void *, size_t, size_t *);
 } ath_ops_t;
 
Index: uspace/drv/nic/ar9271/ath_usb.c
===================================================================
--- uspace/drv/nic/ar9271/ath_usb.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ar9271/ath_usb.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,8 +39,8 @@
 #include "ath_usb.h"
 
-static errno_t ath_usb_send_ctrl_message(ath_t *, void *, size_t);
-static errno_t ath_usb_read_ctrl_message(ath_t *, void *, size_t, size_t *);
-static errno_t ath_usb_send_data_message(ath_t *, void *, size_t);
-static errno_t ath_usb_read_data_message(ath_t *, void *, size_t, size_t *);
+static int ath_usb_send_ctrl_message(ath_t *, void *, size_t);
+static int ath_usb_read_ctrl_message(ath_t *, void *, size_t, size_t *);
+static int ath_usb_send_data_message(ath_t *, void *, size_t);
+static int ath_usb_read_data_message(ath_t *, void *, size_t, size_t *);
 
 static ath_ops_t ath_usb_ops = {
@@ -56,8 +56,8 @@
  * @param usb_device  Connected USB device.
  *
- * @return EOK if succeed, error code otherwise.
+ * @return EOK if succeed, negative error code otherwise.
  *
  */
-errno_t ath_usb_init(ath_t *ath, usb_device_t *usb_device)
+int ath_usb_init(ath_t *ath, usb_device_t *usb_device)
 {
 	ath_usb_t *ath_usb = malloc(sizeof(ath_usb_t));
@@ -91,8 +91,8 @@
  * @param buffer_size Buffer size.
  *
- * @return EOK if succeed, error code otherwise.
+ * @return EOK if succeed, negative error code otherwise.
  *
  */
-static errno_t ath_usb_send_ctrl_message(ath_t *ath, void *buffer,
+static int ath_usb_send_ctrl_message(ath_t *ath, void *buffer,
     size_t buffer_size)
 {
@@ -111,8 +111,8 @@
  * @param transferred_size Real size of read data.
  *
- * @return EOK if succeed, error code otherwise.
+ * @return EOK if succeed, negative error code otherwise.
  *
  */
-static errno_t ath_usb_read_ctrl_message(ath_t *ath, void *buffer,
+static int ath_usb_read_ctrl_message(ath_t *ath, void *buffer,
     size_t buffer_size, size_t *transferred_size)
 {
@@ -130,8 +130,8 @@
  * @param buffer_size Buffer size.
  *
- * @return EOK if succeed, error code otherwise.
+ * @return EOK if succeed, negative error code otherwise.
  *
  */
-static errno_t ath_usb_send_data_message(ath_t *ath, void *buffer,
+static int ath_usb_send_data_message(ath_t *ath, void *buffer,
     size_t buffer_size)
 {
@@ -151,5 +151,5 @@
 	    ath_usb->usb_device, ath_usb->output_data_pipe_number)->pipe;
 	
-	errno_t ret_val = usb_pipe_write(pipe, complete_buffer,
+	int ret_val = usb_pipe_write(pipe, complete_buffer,
 	    complete_buffer_size);
 	
@@ -166,8 +166,8 @@
  * @param transferred_size Real size of read data.
  *
- * @return EOK if succeed, error code otherwise.
+ * @return EOK if succeed, negative error code otherwise.
  *
  */
-static errno_t ath_usb_read_data_message(ath_t *ath, void *buffer,
+static int ath_usb_read_data_message(ath_t *ath, void *buffer,
     size_t buffer_size, size_t *transferred_size)
 {
Index: uspace/drv/nic/ar9271/ath_usb.h
===================================================================
--- uspace/drv/nic/ar9271/ath_usb.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ar9271/ath_usb.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,5 +59,5 @@
 } ath_usb_data_header_t;
 
-extern errno_t ath_usb_init(ath_t *, usb_device_t *);
+extern int ath_usb_init(ath_t *, usb_device_t *);
 
 #endif  /* ATHEROS_ATH_USB_H */
Index: uspace/drv/nic/ar9271/htc.c
===================================================================
--- uspace/drv/nic/ar9271/htc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ar9271/htc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <byteorder.h>
 #include <errno.h>
-#include <str_error.h>
 #include "wmi.h"
 #include "htc.h"
@@ -66,5 +65,5 @@
 }
 
-errno_t htc_init_new_vif(htc_device_t *htc_device)
+int htc_init_new_vif(htc_device_t *htc_device)
 {
 	htc_vif_msg_t vif_msg;
@@ -150,8 +149,8 @@
  * @param endpoint_id Destination endpoint.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_send_control_message(htc_device_t *htc_device, void *buffer,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int htc_send_control_message(htc_device_t *htc_device, void *buffer,
     size_t buffer_size, uint8_t endpoint_id)
 {
@@ -173,8 +172,8 @@
  * @param endpoint_id Destination endpoint.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_send_data_message(htc_device_t *htc_device, void *buffer,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int htc_send_data_message(htc_device_t *htc_device, void *buffer,
     size_t buffer_size, uint8_t endpoint_id)
 {
@@ -196,8 +195,8 @@
  * @param transferred_size Real size of read data.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_read_data_message(htc_device_t *htc_device, void *buffer,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int htc_read_data_message(htc_device_t *htc_device, void *buffer,
     size_t buffer_size, size_t *transferred_size)
 {
@@ -216,8 +215,8 @@
  * @param transferred_size Real size of read data.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_read_control_message(htc_device_t *htc_device, void *buffer,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int htc_read_control_message(htc_device_t *htc_device, void *buffer,
     size_t buffer_size, size_t *transferred_size)
 {
@@ -236,8 +235,8 @@
  *
  * @return EOK if succeed, EINVAL when failed to connect service,
- *         error code otherwise.
- *
- */
-static errno_t htc_connect_service(htc_device_t *htc_device,
+ *         negative error code otherwise.
+ *
+ */
+static int htc_connect_service(htc_device_t *htc_device,
     wmi_services_t service_id, int *response_endpoint_no)
 {
@@ -261,9 +260,9 @@
 	
 	/* Send HTC message. */
-	errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
+	int rc = htc_send_control_message(htc_device, buffer, buffer_size,
 	    htc_device->endpoints.ctrl_endpoint);
 	if (rc != EOK) {
 		free(buffer);
-		usb_log_error("Failed to send HTC message. Error: %s\n", str_error_name(rc));
+		usb_log_error("Failed to send HTC message. Error: %d\n", rc);
 		return rc;
 	}
@@ -279,5 +278,5 @@
 		free(buffer);
 		usb_log_error("Failed to receive HTC service connect response. "
-		    "Error: %s\n", str_error_name(rc));
+		    "Error: %d\n", rc);
 		return rc;
 	}
@@ -309,8 +308,8 @@
  * @param htc_device HTC device structure.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t htc_config_credits(htc_device_t *htc_device)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+static int htc_config_credits(htc_device_t *htc_device)
 {
 	size_t buffer_size = sizeof(htc_frame_header_t) +
@@ -327,10 +326,10 @@
 	
 	/* Send HTC message. */
-	errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
+	int rc = htc_send_control_message(htc_device, buffer, buffer_size,
 	    htc_device->endpoints.ctrl_endpoint);
 	if (rc != EOK) {
 		free(buffer);
 		usb_log_error("Failed to send HTC config message. "
-		    "Error: %s\n", str_error_name(rc));
+		    "Error: %d\n", rc);
 		return rc;
 	}
@@ -345,5 +344,5 @@
 	if (rc != EOK) {
 		usb_log_error("Failed to receive HTC config response message. "
-		    "Error: %s\n", str_error_name(rc));
+		    "Error: %d\n", rc);
 	}
 	
@@ -357,8 +356,8 @@
  * @param htc_device HTC device structure.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t htc_complete_setup(htc_device_t *htc_device)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+static int htc_complete_setup(htc_device_t *htc_device)
 {
 	size_t buffer_size = sizeof(htc_frame_header_t) +
@@ -373,9 +372,9 @@
 	
 	/* Send HTC message. */
-	errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
+	int rc = htc_send_control_message(htc_device, buffer, buffer_size,
 	    htc_device->endpoints.ctrl_endpoint);
 	if (rc != EOK)
 		usb_log_error("Failed to send HTC setup complete message. "
-		    "Error: %s\n", str_error_name(rc));
+		    "Error: %d\n", rc);
 	
 	free(buffer);
@@ -391,8 +390,8 @@
  *
  * @return EOK if succeed, EINVAL if response error,
- *         error code otherwise.
- *
- */
-static errno_t htc_check_ready(htc_device_t *htc_device)
+ *         negative error code otherwise.
+ *
+ */
+static int htc_check_ready(htc_device_t *htc_device)
 {
 	size_t buffer_size = htc_device->ath_device->ctrl_response_length;
@@ -400,10 +399,10 @@
 	
 	/* Read response from device. */
-	errno_t rc = htc_read_control_message(htc_device, buffer, buffer_size,
+	int rc = htc_read_control_message(htc_device, buffer, buffer_size,
 	    NULL);
 	if (rc != EOK) {
 		free(buffer);
 		usb_log_error("Failed to receive HTC check ready message. "
-		    "Error: %s\n", str_error_name(rc));
+		    "Error: %d\n", rc);
 		return rc;
 	}
@@ -427,8 +426,8 @@
  * @param htc_device HTC device structure to be initialized.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
     htc_device_t *htc_device)
 {
@@ -448,11 +447,11 @@
  * @param htc_device HTC device structure.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_init(htc_device_t *htc_device)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int htc_init(htc_device_t *htc_device)
 {
 	/* First check ready message in device. */
-	errno_t rc = htc_check_ready(htc_device);
+	int rc = htc_check_ready(htc_device);
 	if (rc != EOK) {
 		usb_log_error("Device is not in ready state after loading "
Index: uspace/drv/nic/ar9271/htc.h
===================================================================
--- uspace/drv/nic/ar9271/htc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ar9271/htc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -297,11 +297,11 @@
 } __attribute__((packed)) htc_setup_complete_msg_t;
 
-extern errno_t htc_device_init(ath_t *, ieee80211_dev_t *, htc_device_t *);
-extern errno_t htc_init(htc_device_t *);
-extern errno_t htc_init_new_vif(htc_device_t *);
-extern errno_t htc_read_control_message(htc_device_t *, void *, size_t, size_t *);
-extern errno_t htc_read_data_message(htc_device_t *, void *, size_t, size_t *);
-extern errno_t htc_send_control_message(htc_device_t *, void *, size_t, uint8_t);
-extern errno_t htc_send_data_message(htc_device_t *, void *, size_t, uint8_t);
+extern int htc_device_init(ath_t *, ieee80211_dev_t *, htc_device_t *);
+extern int htc_init(htc_device_t *);
+extern int htc_init_new_vif(htc_device_t *);
+extern int htc_read_control_message(htc_device_t *, void *, size_t, size_t *);
+extern int htc_read_data_message(htc_device_t *, void *, size_t, size_t *);
+extern int htc_send_control_message(htc_device_t *, void *, size_t, uint8_t);
+extern int htc_send_data_message(htc_device_t *, void *, size_t, uint8_t);
 
 #endif  /* ATHEROS_HTC_H */
Index: uspace/drv/nic/ar9271/hw.c
===================================================================
--- uspace/drv/nic/ar9271/hw.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ar9271/hw.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,8 +49,8 @@
  *
  * @return EOK if succeed, ETIMEOUT on timeout,
- *         error code otherwise.
+ *         negative error code otherwise.
  *
  */
-static errno_t hw_read_wait(ar9271_t *ar9271, uint32_t offset, uint32_t mask,
+static int hw_read_wait(ar9271_t *ar9271, uint32_t offset, uint32_t mask,
     uint32_t value)
 {
@@ -67,5 +67,5 @@
 }
 
-static errno_t hw_reset_power_on(ar9271_t *ar9271)
+static int hw_reset_power_on(ar9271_t *ar9271)
 {
 	wmi_reg_t buffer[] = {
@@ -93,5 +93,5 @@
 	wmi_reg_write(ar9271->htc_device, AR9271_RTC_RESET, 1);
 	
-	errno_t rc = hw_read_wait(ar9271,
+	int rc = hw_read_wait(ar9271,
 	    AR9271_RTC_STATUS,
 	    AR9271_RTC_STATUS_MASK,
@@ -105,5 +105,5 @@
 }
 
-static errno_t hw_set_reset(ar9271_t *ar9271, bool cold)
+static int hw_set_reset(ar9271_t *ar9271, bool cold)
 {
 	uint32_t reset_value = AR9271_RTC_RC_MAC_WARM;
@@ -135,5 +135,5 @@
 	wmi_reg_write(ar9271->htc_device, AR9271_RTC_RC, 0);
 	
-	errno_t rc = hw_read_wait(ar9271, AR9271_RTC_RC, AR9271_RTC_RC_MASK, 0);
+	int rc = hw_read_wait(ar9271, AR9271_RTC_RC, AR9271_RTC_RC_MASK, 0);
 	if (rc != EOK) {
 		usb_log_error("Failed to wait for RTC RC register.\n");
@@ -148,5 +148,5 @@
 }
 
-static errno_t hw_addr_init(ar9271_t *ar9271)
+static int hw_addr_init(ar9271_t *ar9271)
 {
 	uint32_t value;
@@ -164,5 +164,5 @@
 	nic_t *nic = nic_get_from_ddf_dev(ar9271->ddf_dev);
 	
-	errno_t rc = nic_report_address(nic, &ar9271_address);
+	int rc = nic_report_address(nic, &ar9271_address);
 	if (rc != EOK) {
 		usb_log_error("Failed to report NIC HW address.\n");
@@ -173,5 +173,5 @@
 }
 
-static errno_t hw_gpio_set_output(ar9271_t *ar9271, uint32_t gpio, uint32_t type)
+static int hw_gpio_set_output(ar9271_t *ar9271, uint32_t gpio, uint32_t type)
 {
 	uint32_t address;
@@ -204,5 +204,5 @@
 }
 
-static errno_t hw_gpio_set_value(ar9271_t *ar9271, uint32_t gpio, uint32_t value)
+static int hw_gpio_set_value(ar9271_t *ar9271, uint32_t gpio, uint32_t value)
 {
 	wmi_reg_set_clear_bit(ar9271->htc_device, AR9271_GPIO_IN_OUT,
@@ -215,10 +215,10 @@
  * @param ar9271 Device structure.
  *
- * @return EOK if succeed, error code otherwise.
+ * @return EOK if succeed, negative error code otherwise.
  *
  */
-static errno_t hw_init_proc(ar9271_t *ar9271)
-{
-	errno_t rc = hw_reset_power_on(ar9271);
+static int hw_init_proc(ar9271_t *ar9271)
+{
+	int rc = hw_reset_power_on(ar9271);
 	if (rc != EOK) {
 		usb_log_error("Failed to HW reset power on.\n");
@@ -241,7 +241,7 @@
 }
 
-static errno_t hw_init_led(ar9271_t *ar9271)
-{
-	errno_t rc = hw_gpio_set_output(ar9271, AR9271_LED_PIN,
+static int hw_init_led(ar9271_t *ar9271)
+{
+	int rc = hw_gpio_set_output(ar9271, AR9271_LED_PIN,
 	    AR9271_GPIO_OUT_MUX_AS_OUT);
 	if (rc != EOK) {
@@ -259,5 +259,5 @@
 }
 
-static errno_t hw_activate_phy(ar9271_t *ar9271)
+static int hw_activate_phy(ar9271_t *ar9271)
 {
 	wmi_reg_write(ar9271->htc_device, AR9271_PHY_ACTIVE, 1);
@@ -267,5 +267,5 @@
 }
 
-static errno_t hw_set_operating_mode(ar9271_t *ar9271,
+static int hw_set_operating_mode(ar9271_t *ar9271,
     ieee80211_operating_mode_t op_mode)
 {
@@ -295,7 +295,7 @@
 }
 
-static errno_t hw_reset_operating_mode(ar9271_t *ar9271)
-{
-	errno_t rc = hw_set_operating_mode(ar9271, IEEE80211_OPMODE_STATION);
+static int hw_reset_operating_mode(ar9271_t *ar9271)
+{
+	int rc = hw_set_operating_mode(ar9271, IEEE80211_OPMODE_STATION);
 	if (rc != EOK) {
 		usb_log_error("Failed to set opmode to station.\n");
@@ -306,5 +306,5 @@
 }
 
-static errno_t hw_noise_floor_calibration(ar9271_t *ar9271)
+static int hw_noise_floor_calibration(ar9271_t *ar9271)
 {
 	uint32_t value;
@@ -325,5 +325,5 @@
 	    AR9271_AGC_CONTROL_NF_CALIB);
 	
-	errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
+	int rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
 	    AR9271_AGC_CONTROL_NF_CALIB, 0);
 	if (rc != EOK) {
@@ -344,5 +344,5 @@
 }
 
-static errno_t hw_set_freq(ar9271_t *ar9271, uint16_t freq)
+static int hw_set_freq(ar9271_t *ar9271, uint16_t freq)
 {
 	/* Not supported channel frequency. */
@@ -373,9 +373,9 @@
 }
 
-errno_t hw_freq_switch(ar9271_t *ar9271, uint16_t freq)
+int hw_freq_switch(ar9271_t *ar9271, uint16_t freq)
 {
 	wmi_reg_write(ar9271->htc_device, AR9271_PHY_RFBUS_KILL, 0x1);
 	
-	errno_t rc = hw_read_wait(ar9271, AR9271_PHY_RFBUS_GRANT, 0x1, 0x1);
+	int rc = hw_read_wait(ar9271, AR9271_PHY_RFBUS_GRANT, 0x1, 0x1);
 	if (rc != EOK) {
 		usb_log_error("Failed to kill RF bus.\n");
@@ -407,5 +407,5 @@
 }
 
-errno_t hw_set_rx_filter(ar9271_t *ar9271, bool assoc)
+int hw_set_rx_filter(ar9271_t *ar9271, bool assoc)
 {
 	uint32_t additional_bits = 0;
@@ -425,5 +425,5 @@
 }
 
-errno_t hw_set_bssid(ar9271_t *ar9271)
+int hw_set_bssid(ar9271_t *ar9271)
 {
 	ieee80211_dev_t *ieee80211_dev = ar9271->ieee80211_dev;
@@ -445,10 +445,10 @@
 }
 
-errno_t hw_rx_init(ar9271_t *ar9271)
+int hw_rx_init(ar9271_t *ar9271)
 {
 	wmi_reg_write(ar9271->htc_device, AR9271_COMMAND,
 	    AR9271_COMMAND_RX_ENABLE);
 	
-	errno_t rc = hw_set_rx_filter(ar9271, false);
+	int rc = hw_set_rx_filter(ar9271, false);
 	if (rc != EOK) {
 		usb_log_error("Failed to set RX filtering.\n");
@@ -465,5 +465,5 @@
 }
 
-static errno_t hw_init_pll(ar9271_t *ar9271)
+static int hw_init_pll(ar9271_t *ar9271)
 {
 	/* Some magic here (set for 2GHz channels). But VERY important :-) */
@@ -510,5 +510,5 @@
 }
 
-static errno_t hw_calibration(ar9271_t *ar9271)
+static int hw_calibration(ar9271_t *ar9271)
 {
 	wmi_reg_set_bit(ar9271->htc_device, AR9271_CARRIER_LEAK_CONTROL,
@@ -523,5 +523,5 @@
 	    AR9271_AGC_CONTROL_CALIB);
 	
-	errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
+	int rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
 	    AR9271_AGC_CONTROL_CALIB, 0);
 	if (rc != EOK) {
@@ -540,5 +540,5 @@
 }
 
-errno_t hw_reset(ar9271_t *ar9271)
+int hw_reset(ar9271_t *ar9271)
 {
 	/* Set physical layer as deactivated. */
@@ -559,5 +559,5 @@
 		hw_set_reset(ar9271, true);
 	
-	errno_t rc = hw_init_pll(ar9271);
+	int rc = hw_init_pll(ar9271);
 	if (rc != EOK) {
 		usb_log_error("Failed to init PLL.\n");
@@ -636,9 +636,9 @@
  * @param ar9271 Device structure.
  *
- * @return EOK if succeed, error code otherwise.
+ * @return EOK if succeed, negative error code otherwise.
  */
-errno_t hw_init(ar9271_t *ar9271)
-{
-	errno_t rc = hw_init_proc(ar9271);
+int hw_init(ar9271_t *ar9271)
+{
+	int rc = hw_init_proc(ar9271);
 	if (rc != EOK) {
 		usb_log_error("Failed to HW reset device.\n");
Index: uspace/drv/nic/ar9271/hw.h
===================================================================
--- uspace/drv/nic/ar9271/hw.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ar9271/hw.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,10 +41,10 @@
 #define HW_WAIT_TIME_US  10
 
-extern errno_t hw_init(ar9271_t *);
-extern errno_t hw_freq_switch(ar9271_t *, uint16_t);
-extern errno_t hw_rx_init(ar9271_t *);
-extern errno_t hw_reset(ar9271_t *);
-extern errno_t hw_set_bssid(ar9271_t *);
-extern errno_t hw_set_rx_filter(ar9271_t *, bool);
+extern int hw_init(ar9271_t *);
+extern int hw_freq_switch(ar9271_t *, uint16_t);
+extern int hw_rx_init(ar9271_t *);
+extern int hw_reset(ar9271_t *);
+extern int hw_set_bssid(ar9271_t *);
+extern int hw_set_rx_filter(ar9271_t *, bool);
 
 #endif  /* ATHEROS_HW_H */
Index: uspace/drv/nic/ar9271/wmi.c
===================================================================
--- uspace/drv/nic/ar9271/wmi.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ar9271/wmi.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,5 +35,4 @@
 #include <usb/debug.h>
 #include <errno.h>
-#include <str_error.h>
 #include <stdlib.h>
 #include <mem.h>
@@ -47,8 +46,8 @@
  * @param res        Stored result.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)
 {
 	uint32_t cmd_value = host2uint32_t_be(reg_offset);
@@ -57,5 +56,5 @@
 	    malloc(htc_device->ath_device->ctrl_response_length);
 	
-	errno_t rc = wmi_send_command(htc_device, WMI_REG_READ,
+	int rc = wmi_send_command(htc_device, WMI_REG_READ,
 	    (uint8_t *) &cmd_value, sizeof(cmd_value), resp_buffer);
 	
@@ -79,8 +78,8 @@
  * @param val        Value to be written
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)
 {
 	uint32_t cmd_buffer[] = {
@@ -92,5 +91,5 @@
 	    malloc(htc_device->ath_device->ctrl_response_length);
 	
-	errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
+	int rc = wmi_send_command(htc_device, WMI_REG_WRITE,
 	    (uint8_t *) &cmd_buffer, sizeof(cmd_buffer), resp_buffer);
 	
@@ -112,13 +111,13 @@
  * @param clear_bit  Bit to be cleared.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
     uint32_t set_bit, uint32_t clear_bit)
 {
 	uint32_t value;
 	
-	errno_t rc = wmi_reg_read(htc_device, reg_offset, &value);
+	int rc = wmi_reg_read(htc_device, reg_offset, &value);
 	if (rc != EOK) {
 		usb_log_error("Failed to read registry value in RMW "
@@ -146,8 +145,8 @@
  * @param set_bit    Bit to be set.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,
     uint32_t set_bit)
 {
@@ -161,8 +160,8 @@
  * @param clear_bit  Bit to be cleared.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
     uint32_t clear_bit)
 {
@@ -176,8 +175,8 @@
  * @param elements   Number of elements in array.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,
     size_t elements)
 {
@@ -198,5 +197,5 @@
 	}
 	
-	errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
+	int rc = wmi_send_command(htc_device, WMI_REG_WRITE,
 	    (uint8_t *) buffer, buffer_size, resp_buffer);
 	
@@ -220,8 +219,8 @@
  * @param response_buffer Buffer with response data.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,
     uint8_t *command_buffer, uint32_t command_length, void *response_buffer)
 {
@@ -242,9 +241,9 @@
 	
 	/* Send message. */
-	errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
+	int rc = htc_send_control_message(htc_device, buffer, buffer_size,
 	    htc_device->endpoints.wmi_endpoint);
 	if (rc != EOK) {
 		free(buffer);
-		usb_log_error("Failed to send WMI message. Error: %s\n", str_error_name(rc));
+		usb_log_error("Failed to send WMI message. Error: %d\n", rc);
 		return rc;
 	}
@@ -269,5 +268,5 @@
 			free(buffer);
 			usb_log_error("Failed to receive WMI message response. "
-			    "Error: %s\n", str_error_name(rc));
+			    "Error: %d\n", rc);
 			return rc;
 		}
Index: uspace/drv/nic/ar9271/wmi.h
===================================================================
--- uspace/drv/nic/ar9271/wmi.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ar9271/wmi.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -117,11 +117,11 @@
 } wmi_reg_t;
 
-extern errno_t wmi_reg_read(htc_device_t *, uint32_t, uint32_t *);
-extern errno_t wmi_reg_write(htc_device_t *, uint32_t, uint32_t);
-extern errno_t wmi_reg_set_clear_bit(htc_device_t *, uint32_t, uint32_t, uint32_t);
-extern errno_t wmi_reg_set_bit(htc_device_t *, uint32_t, uint32_t);
-extern errno_t wmi_reg_clear_bit(htc_device_t *, uint32_t, uint32_t);
-extern errno_t wmi_reg_buffer_write(htc_device_t *, wmi_reg_t *, size_t);
-extern errno_t wmi_send_command(htc_device_t *, wmi_command_t, uint8_t *, uint32_t,
+extern int wmi_reg_read(htc_device_t *, uint32_t, uint32_t *);
+extern int wmi_reg_write(htc_device_t *, uint32_t, uint32_t);
+extern int wmi_reg_set_clear_bit(htc_device_t *, uint32_t, uint32_t, uint32_t);
+extern int wmi_reg_set_bit(htc_device_t *, uint32_t, uint32_t);
+extern int wmi_reg_clear_bit(htc_device_t *, uint32_t, uint32_t);
+extern int wmi_reg_buffer_write(htc_device_t *, wmi_reg_t *, size_t);
+extern int wmi_send_command(htc_device_t *, wmi_command_t, uint8_t *, uint32_t,
     void *);
 
Index: uspace/drv/nic/e1k/e1k.c
===================================================================
--- uspace/drv/nic/e1k/e1k.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/e1k/e1k.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -179,22 +179,22 @@
 FIBRIL_MUTEX_INITIALIZE(irq_reg_mutex);
 
-static errno_t e1000_get_address(e1000_t *, nic_address_t *);
+static int e1000_get_address(e1000_t *, nic_address_t *);
 static void e1000_eeprom_get_address(e1000_t *, nic_address_t *);
-static errno_t e1000_set_addr(ddf_fun_t *, const nic_address_t *);
-
-static errno_t e1000_defective_get_mode(ddf_fun_t *, uint32_t *);
-static errno_t e1000_defective_set_mode(ddf_fun_t *, uint32_t);
-
-static errno_t e1000_get_cable_state(ddf_fun_t *, nic_cable_state_t *);
-static errno_t e1000_get_device_info(ddf_fun_t *, nic_device_info_t *);
-static errno_t e1000_get_operation_mode(ddf_fun_t *, int *,
+static int e1000_set_addr(ddf_fun_t *, const nic_address_t *);
+
+static int e1000_defective_get_mode(ddf_fun_t *, uint32_t *);
+static int e1000_defective_set_mode(ddf_fun_t *, uint32_t);
+
+static int e1000_get_cable_state(ddf_fun_t *, nic_cable_state_t *);
+static int e1000_get_device_info(ddf_fun_t *, nic_device_info_t *);
+static int e1000_get_operation_mode(ddf_fun_t *, int *,
     nic_channel_mode_t *, nic_role_t *);
-static errno_t e1000_set_operation_mode(ddf_fun_t *, int,
+static int e1000_set_operation_mode(ddf_fun_t *, int,
     nic_channel_mode_t, nic_role_t);
-static errno_t e1000_autoneg_enable(ddf_fun_t *, uint32_t);
-static errno_t e1000_autoneg_disable(ddf_fun_t *);
-static errno_t e1000_autoneg_restart(ddf_fun_t *);
-
-static errno_t e1000_vlan_set_tag(ddf_fun_t *, uint16_t, bool, bool);
+static int e1000_autoneg_enable(ddf_fun_t *, uint32_t);
+static int e1000_autoneg_disable(ddf_fun_t *);
+static int e1000_autoneg_restart(ddf_fun_t *);
+
+static int e1000_vlan_set_tag(ddf_fun_t *, uint16_t, bool, bool);
 
 /** Network interface options for E1000 card driver */
@@ -219,5 +219,5 @@
 static ddf_dev_ops_t e1000_dev_ops;
 
-static errno_t e1000_dev_add(ddf_dev_t *);
+static int e1000_dev_add(ddf_dev_t *);
 
 /** Basic driver operations for E1000 driver */
@@ -233,6 +233,6 @@
 
 /* The default implementation callbacks */
-static errno_t e1000_on_activating(nic_t *);
-static errno_t e1000_on_stopping(nic_t *);
+static int e1000_on_activating(nic_t *);
+static int e1000_on_stopping(nic_t *);
 static void e1000_send_frame(nic_t *, void *, size_t);
 
@@ -288,5 +288,5 @@
  *
  */
-static errno_t e1000_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
+static int e1000_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
 {
 	assert(dev);
@@ -316,5 +316,5 @@
  *
  */
-static errno_t e1000_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
+static int e1000_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
 {
 	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
@@ -335,5 +335,5 @@
  *
  */
-static errno_t e1000_get_operation_mode(ddf_fun_t *fun, int *speed,
+static int e1000_get_operation_mode(ddf_fun_t *fun, int *speed,
     nic_channel_mode_t *duplex, nic_role_t *role)
 {
@@ -386,5 +386,5 @@
  *
  */
-static errno_t e1000_set_operation_mode(ddf_fun_t *fun, int speed,
+static int e1000_set_operation_mode(ddf_fun_t *fun, int speed,
     nic_channel_mode_t duplex, nic_role_t role)
 {
@@ -434,5 +434,5 @@
  *
  */
-static errno_t e1000_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
+static int e1000_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
 {
 	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
@@ -462,5 +462,5 @@
  *
  */
-static errno_t e1000_autoneg_disable(ddf_fun_t *fun)
+static int e1000_autoneg_disable(ddf_fun_t *fun)
 {
 	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
@@ -490,5 +490,5 @@
  *
  */
-static errno_t e1000_autoneg_restart(ddf_fun_t *dev)
+static int e1000_autoneg_restart(ddf_fun_t *dev)
 {
 	return e1000_autoneg_enable(dev, 0);
@@ -501,5 +501,5 @@
  *
  */
-static errno_t e1000_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
+static int e1000_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
 {
 	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
@@ -522,8 +522,8 @@
  *
  */
-static errno_t e1000_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
+static int e1000_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
 {
 	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
-	errno_t rc = EOK;
+	int rc = EOK;
 	
 	fibril_mutex_lock(&e1000->rx_lock);
@@ -827,9 +827,9 @@
  *
  */
-static errno_t e1000_on_multicast_mode_change(nic_t *nic, nic_multicast_mode_t mode,
+static int e1000_on_multicast_mode_change(nic_t *nic, nic_multicast_mode_t mode,
     const nic_address_t *addr, size_t addr_cnt)
 {
 	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-	errno_t rc = EOK;
+	int rc = EOK;
 	
 	fibril_mutex_lock(&e1000->rx_lock);
@@ -881,9 +881,9 @@
  *
  */
-static errno_t e1000_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
+static int e1000_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
     const nic_address_t *addr, size_t addr_cnt)
 {
 	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-	errno_t rc = EOK;
+	int rc = EOK;
 	
 	fibril_mutex_lock(&e1000->rx_lock);
@@ -937,8 +937,8 @@
  *
  */
-static errno_t e1000_on_broadcast_mode_change(nic_t *nic, nic_broadcast_mode_t mode)
+static int e1000_on_broadcast_mode_change(nic_t *nic, nic_broadcast_mode_t mode)
 {
 	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-	errno_t rc = EOK;
+	int rc = EOK;
 	
 	fibril_mutex_lock(&e1000->rx_lock);
@@ -1048,5 +1048,5 @@
  *
  */
-static errno_t e1000_vlan_set_tag(ddf_fun_t *fun, uint16_t tag, bool add,
+static int e1000_vlan_set_tag(ddf_fun_t *fun, uint16_t tag, bool add,
     bool strip)
 {
@@ -1259,10 +1259,9 @@
  * @param nic Driver data
  *
- * @param[out] handle  IRQ capability handle if the handler was registered
- *
- * @return An error code otherwise
- *
- */
-inline static errno_t e1000_register_int_handler(nic_t *nic, cap_handle_t *handle)
+ * @return IRQ capability handle if the handler was registered
+ * @return Negative error code otherwise
+ *
+ */
+inline static int e1000_register_int_handler(nic_t *nic)
 {
 	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
@@ -1275,9 +1274,9 @@
 	e1000_irq_code.cmds[2].addr = e1000->reg_base_phys + E1000_IMC;
 	
-	errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq,
-	    e1000_interrupt_handler, &e1000_irq_code, handle);
+	int cap = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq,
+	    e1000_interrupt_handler, &e1000_irq_code);
 	
 	fibril_mutex_unlock(&irq_reg_mutex);
-	return rc;
+	return cap;
 }
 
@@ -1319,5 +1318,5 @@
  *
  */
-static errno_t e1000_poll_mode_change(nic_t *nic, nic_poll_mode_t mode,
+static int e1000_poll_mode_change(nic_t *nic, nic_poll_mode_t mode,
     const struct timeval *period)
 {
@@ -1370,8 +1369,8 @@
  *
  * @return EOK if succeed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_initialize_rx_structure(nic_t *nic)
+ * @return Negative error code otherwise
+ *
+ */
+static int e1000_initialize_rx_structure(nic_t *nic)
 {
 	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
@@ -1379,5 +1378,5 @@
 	
 	e1000->rx_ring_virt = AS_AREA_ANY;
-	errno_t rc = dmamem_map_anonymous(
+	int rc = dmamem_map_anonymous(
 	    E1000_RX_FRAME_COUNT * sizeof(e1000_rx_descriptor_t),
 	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
@@ -1524,5 +1523,5 @@
  *
  * @return EOK if succeed
- * @return An error code otherwise
+ * @return Negative error code otherwise
  *
  */
@@ -1567,5 +1566,5 @@
  *
  */
-static errno_t e1000_initialize_tx_structure(e1000_t *e1000)
+static int e1000_initialize_tx_structure(e1000_t *e1000)
 {
 	size_t i;
@@ -1579,5 +1578,5 @@
 	e1000->tx_frame_virt = NULL;
 	
-	errno_t rc = dmamem_map_anonymous(
+	int rc = dmamem_map_anonymous(
 	    E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t),
 	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
@@ -1718,5 +1717,5 @@
  *
  */
-static errno_t e1000_reset(nic_t *nic)
+static int e1000_reset(nic_t *nic)
 {
 	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
@@ -1749,5 +1748,5 @@
  *
  */
-static errno_t e1000_on_activating(nic_t *nic)
+static int e1000_on_activating(nic_t *nic)
 {
 	assert(nic);
@@ -1761,5 +1760,5 @@
 	e1000_enable_interrupts(e1000);
 	
-	errno_t rc = hw_res_enable_interrupt(e1000->parent_sess, e1000->irq);
+	int rc = hw_res_enable_interrupt(e1000->parent_sess, e1000->irq);
 	if (rc != EOK) {
 		e1000_disable_interrupts(e1000);
@@ -1795,5 +1794,5 @@
  *
  */
-static errno_t e1000_on_down_unlocked(nic_t *nic)
+static int e1000_on_down_unlocked(nic_t *nic)
 {
 	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
@@ -1826,5 +1825,5 @@
  *
  */
-static errno_t e1000_on_down(nic_t *nic)
+static int e1000_on_down(nic_t *nic)
 {
 	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
@@ -1834,5 +1833,5 @@
 	fibril_mutex_lock(&e1000->ctrl_lock);
 	
-	errno_t rc = e1000_on_down_unlocked(nic);
+	int rc = e1000_on_down_unlocked(nic);
 	
 	fibril_mutex_unlock(&e1000->ctrl_lock);
@@ -1851,5 +1850,5 @@
  *
  */
-static errno_t e1000_on_stopping(nic_t *nic)
+static int e1000_on_stopping(nic_t *nic)
 {
 	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
@@ -1859,5 +1858,5 @@
 	fibril_mutex_lock(&e1000->ctrl_lock);
 	
-	errno_t rc = e1000_on_down_unlocked(nic);
+	int rc = e1000_on_down_unlocked(nic);
 	if (rc == EOK)
 		rc = e1000_reset(nic);
@@ -1940,8 +1939,8 @@
  *
  * @return EOK if succeed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_fill_resource_info(ddf_dev_t *dev,
+ * @return Negative error code otherwise
+ *
+ */
+static int e1000_fill_resource_info(ddf_dev_t *dev,
     const hw_res_list_parsed_t *hw_resources)
 {
@@ -1965,8 +1964,8 @@
  *
  * @return EOK if succeed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_get_resource_info(ddf_dev_t *dev)
+ * @return Negative error code otherwise
+ *
+ */
+static int e1000_get_resource_info(ddf_dev_t *dev)
 {
 	assert(dev != NULL);
@@ -1977,5 +1976,5 @@
 	
 	/* Get hw resources form parent driver */
-	errno_t rc = nic_get_resources(NIC_DATA_DEV(dev), &hw_res_parsed);
+	int rc = nic_get_resources(NIC_DATA_DEV(dev), &hw_res_parsed);
 	if (rc != EOK)
 		return rc;
@@ -1993,8 +1992,8 @@
  *
  * @return EOK if succeed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_device_initialize(ddf_dev_t *dev)
+ * @return Negative error code otherwise
+ *
+ */
+static int e1000_device_initialize(ddf_dev_t *dev)
 {
 	/* Allocate driver data for the device. */
@@ -2012,5 +2011,5 @@
 	
 	/* Obtain and fill hardware resources info */
-	errno_t rc = e1000_get_resource_info(dev);
+	int rc = e1000_get_resource_info(dev);
 	if (rc != EOK) {
 		ddf_msg(LVL_ERROR, "Cannot obtain hardware resources");
@@ -2107,12 +2106,12 @@
  *
  * @return EOK if successed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_pio_enable(ddf_dev_t *dev)
+ * @return Negative error code otherwise
+ *
+ */
+static int e1000_pio_enable(ddf_dev_t *dev)
 {
 	e1000_t *e1000 = DRIVER_DATA_DEV(dev);
 	
-	errno_t rc = pio_enable(e1000->reg_base_phys, 8 * PAGE_SIZE,
+	int rc = pio_enable(e1000->reg_base_phys, 8 * PAGE_SIZE,
 	    &e1000->reg_base_virt);
 	if (rc != EOK)
@@ -2127,10 +2126,10 @@
  *
  */
-errno_t e1000_dev_add(ddf_dev_t *dev)
+int e1000_dev_add(ddf_dev_t *dev)
 {
 	ddf_fun_t *fun;
 	
 	/* Initialize device structure for E1000 */
-	errno_t rc = e1000_device_initialize(dev);
+	int rc = e1000_device_initialize(dev);
 	if (rc != EOK)
 		return rc;
@@ -2165,7 +2164,7 @@
 	ddf_fun_set_ops(fun, &e1000_dev_ops);
 	
-	int irq_cap;
-	rc = e1000_register_int_handler(nic, &irq_cap);
-	if (rc != EOK) {
+	int irq_cap = e1000_register_int_handler(nic);
+	if (irq_cap < 0) {
+		rc = irq_cap;
 		goto err_fun_create;
 	}
@@ -2255,8 +2254,8 @@
  *
  * @return EOK if succeed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_get_address(e1000_t *e1000, nic_address_t *address)
+ * @return Negative error code otherwise
+ *
+ */
+static int e1000_get_address(e1000_t *e1000, nic_address_t *address)
 {
 	fibril_mutex_lock(&e1000->rx_lock);
@@ -2289,7 +2288,7 @@
  *
  * @return EOK if succeed
- * @return An error code otherwise
- */
-static errno_t e1000_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
+ * @return Negative error code otherwise
+ */
+static int e1000_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
 {
 	nic_t *nic = NIC_DATA_FUN(fun);
@@ -2299,5 +2298,5 @@
 	fibril_mutex_lock(&e1000->tx_lock);
 	
-	errno_t rc = nic_report_address(nic, addr);
+	int rc = nic_report_address(nic, addr);
 	if (rc == EOK)
 		e1000_write_receive_address(e1000, 0, addr, false);
Index: uspace/drv/nic/ne2k/dp8390.c
===================================================================
--- uspace/drv/nic/ne2k/dp8390.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ne2k/dp8390.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -194,5 +194,5 @@
  *
  */
-errno_t ne2k_probe(ne2k_t *ne2k)
+int ne2k_probe(ne2k_t *ne2k)
 {
 	unsigned int i;
@@ -250,5 +250,5 @@
  *
  */
-errno_t ne2k_up(ne2k_t *ne2k)
+int ne2k_up(ne2k_t *ne2k)
 {
 	if (!ne2k->probed)
Index: uspace/drv/nic/ne2k/dp8390.h
===================================================================
--- uspace/drv/nic/ne2k/dp8390.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ne2k/dp8390.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -265,6 +265,6 @@
 } ne2k_t;
 
-extern errno_t ne2k_probe(ne2k_t *);
-extern errno_t ne2k_up(ne2k_t *);
+extern int ne2k_probe(ne2k_t *);
+extern int ne2k_up(ne2k_t *);
 extern void ne2k_down(ne2k_t *);
 extern void ne2k_send(nic_t *, void *, size_t);
Index: uspace/drv/nic/ne2k/ne2k.c
===================================================================
--- uspace/drv/nic/ne2k/ne2k.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/ne2k/ne2k.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -124,5 +124,5 @@
 static void ne2k_interrupt_handler(ipc_call_t *, ddf_dev_t *);
 
-static errno_t ne2k_register_interrupt(nic_t *nic_data, cap_handle_t *handle)
+static int ne2k_register_interrupt(nic_t *nic_data)
 {
 	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
@@ -160,6 +160,7 @@
 	}
 
-	return register_interrupt_handler(nic_get_ddf_dev(nic_data),
-		ne2k->irq, ne2k_interrupt_handler, &ne2k->code, handle);
+	int irq_cap = register_interrupt_handler(nic_get_ddf_dev(nic_data),
+		ne2k->irq, ne2k_interrupt_handler, &ne2k->code);
+	return irq_cap;
 }
 
@@ -178,5 +179,5 @@
 }
 
-static errno_t ne2k_dev_init(nic_t *nic_data)
+static int ne2k_dev_init(nic_t *nic_data)
 {
 	/* Get HW resources */
@@ -184,5 +185,5 @@
 	hw_res_list_parsed_init(&hw_res_parsed);
 	
-	errno_t rc = nic_get_resources(nic_data, &hw_res_parsed);
+	int rc = nic_get_resources(nic_data, &hw_res_parsed);
 	
 	if (rc != EOK)
@@ -227,5 +228,6 @@
 	ne2k->probed = true;
 	
-	if (ne2k_register_interrupt(nic_data, NULL) != EOK)
+	int irq_cap = ne2k_register_interrupt(nic_data);
+	if (irq_cap < 0)
 		return EINVAL;
 	
@@ -243,10 +245,10 @@
 }
 
-static errno_t ne2k_on_activating(nic_t *nic_data)
+static int ne2k_on_activating(nic_t *nic_data)
 {
 	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
 
 	if (!ne2k->up) {
-		errno_t rc = ne2k_up(ne2k);
+		int rc = ne2k_up(ne2k);
 		if (rc != EOK)
 			return rc;
@@ -261,5 +263,5 @@
 }
 
-static errno_t ne2k_on_stopping(nic_t *nic_data)
+static int ne2k_on_stopping(nic_t *nic_data)
 {
 	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
@@ -271,8 +273,8 @@
 }
 
-static errno_t ne2k_set_address(ddf_fun_t *fun, const nic_address_t *address)
+static int ne2k_set_address(ddf_fun_t *fun, const nic_address_t *address)
 {
 	nic_t *nic_data = DRIVER_DATA(ddf_fun_get_dev(fun));
-	errno_t rc = nic_report_address(nic_data, address);
+	int rc = nic_report_address(nic_data, address);
 	if (rc != EOK) {
 		return EINVAL;
@@ -286,5 +288,5 @@
 }
 
-static errno_t ne2k_on_unicast_mode_change(nic_t *nic_data,
+static int ne2k_on_unicast_mode_change(nic_t *nic_data,
 	nic_unicast_mode_t new_mode,
 	const nic_address_t *address_list, size_t address_count)
@@ -313,5 +315,5 @@
 }
 
-static errno_t ne2k_on_multicast_mode_change(nic_t *nic_data,
+static int ne2k_on_multicast_mode_change(nic_t *nic_data,
 	nic_multicast_mode_t new_mode,
 	const nic_address_t *address_list, size_t address_count)
@@ -339,5 +341,5 @@
 }
 
-static errno_t ne2k_on_broadcast_mode_change(nic_t *nic_data,
+static int ne2k_on_broadcast_mode_change(nic_t *nic_data,
 	nic_broadcast_mode_t new_mode)
 {
@@ -355,5 +357,5 @@
 }
 
-static errno_t ne2k_dev_add(ddf_dev_t *dev)
+static int ne2k_dev_add(ddf_dev_t *dev)
 {
 	ddf_fun_t *fun;
@@ -387,5 +389,5 @@
 	}
 	
-	errno_t rc = ne2k_dev_init(nic_data);
+	int rc = ne2k_dev_init(nic_data);
 	if (rc != EOK) {
 		ne2k_dev_cleanup(dev);
Index: uspace/drv/nic/rtl8139/driver.c
===================================================================
--- uspace/drv/nic/rtl8139/driver.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/rtl8139/driver.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -217,5 +217,5 @@
  *  @param address  The place to store the address
  *
- *  @return EOK if succeed, error code otherwise
+ *  @return EOK if succeed, negative error code otherwise
  */
 inline static void rtl8139_hw_get_addr(rtl8139_t *rtl8139,
@@ -280,32 +280,32 @@
 }
 
-static errno_t rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *);
-static errno_t rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
-static errno_t rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
-static errno_t rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
+static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *);
+static int rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
+static int rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
+static int rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
     nic_channel_mode_t *duplex, nic_role_t *role);
-static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
+static int rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
     nic_channel_mode_t duplex, nic_role_t);
 
-static errno_t rtl8139_pause_get(ddf_fun_t*, nic_result_t*, nic_result_t*, 
+static int rtl8139_pause_get(ddf_fun_t*, nic_result_t*, nic_result_t*, 
     uint16_t *);
-static errno_t rtl8139_pause_set(ddf_fun_t*, int, int, uint16_t);
-
-static errno_t rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
-static errno_t rtl8139_autoneg_disable(ddf_fun_t *fun);
-static errno_t rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *our_advertisement,
+static int rtl8139_pause_set(ddf_fun_t*, int, int, uint16_t);
+
+static int rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
+static int rtl8139_autoneg_disable(ddf_fun_t *fun);
+static int rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *our_advertisement,
     uint32_t *their_advertisement, nic_result_t *result, 
     nic_result_t *their_result);
-static errno_t rtl8139_autoneg_restart(ddf_fun_t *fun);
-
-static errno_t rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
-static errno_t rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
-
-static errno_t rtl8139_wol_virtue_add(nic_t *nic_data,
+static int rtl8139_autoneg_restart(ddf_fun_t *fun);
+
+static int rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
+static int rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
+
+static int rtl8139_wol_virtue_add(nic_t *nic_data,
 	const nic_wol_virtue_t *virtue);
 static void rtl8139_wol_virtue_rem(nic_t *nic_data,
 	const nic_wol_virtue_t *virtue);
 
-static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
+static int rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
     const struct timeval *period);
 static void rtl8139_poll(nic_t *nic_data);
@@ -334,5 +334,5 @@
 static ddf_dev_ops_t rtl8139_dev_ops;
 
-static errno_t rtl8139_dev_add(ddf_dev_t *dev);
+static int rtl8139_dev_add(ddf_dev_t *dev);
 
 /** Basic driver operations for RTL8139 driver */
@@ -348,6 +348,6 @@
 
 /* The default implementation callbacks */
-static errno_t rtl8139_on_activated(nic_t *nic_data);
-static errno_t rtl8139_on_stopped(nic_t *nic_data);
+static int rtl8139_on_activated(nic_t *nic_data);
+static int rtl8139_on_stopped(nic_t *nic_data);
 static void rtl8139_send_frame(nic_t *nic_data, void *data, size_t size);
 
@@ -842,9 +842,8 @@
  *  @param nic_data  The driver data
  *
- *  @param[out] handle  IRQ capability handle if the handler was registered.
- *
- *  @return An error code otherwise.
- */
-inline static errno_t rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
+ *  @return IRQ capability handle if the handler was registered.
+ *  @return Negative error code otherwise.
+ */
+inline static int rtl8139_register_int_handler(nic_t *nic_data)
 {
 	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
@@ -857,10 +856,10 @@
 	rtl8139_irq_code.cmds[2].addr = rtl8139->io_addr + ISR;
 	rtl8139_irq_code.cmds[3].addr = rtl8139->io_addr + IMR;
-	errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),
-	    rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code, handle);
+	int cap = register_interrupt_handler(nic_get_ddf_dev(nic_data),
+	    rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code);
 
 	RTL8139_IRQ_STRUCT_UNLOCK();
 
-	return rc;
+	return cap;
 }
 
@@ -904,5 +903,5 @@
  *  @return EOK if activated successfully, error code otherwise
  */
-static errno_t rtl8139_on_activated(nic_t *nic_data)
+static int rtl8139_on_activated(nic_t *nic_data)
 {
 	assert(nic_data);
@@ -919,5 +918,5 @@
 	rtl8139_hw_int_set(rtl8139);
 
-	errno_t rc = hw_res_enable_interrupt(rtl8139->parent_sess, rtl8139->irq);
+	int rc = hw_res_enable_interrupt(rtl8139->parent_sess, rtl8139->irq);
 	if (rc != EOK) {
 		rtl8139_on_stopped(nic_data);
@@ -935,5 +934,5 @@
  *  @return EOK if succeed, error code otherwise
  */
-static errno_t rtl8139_on_stopped(nic_t *nic_data)
+static int rtl8139_on_stopped(nic_t *nic_data)
 {
 	assert(nic_data);
@@ -955,9 +954,9 @@
 
 
-static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
+static int rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     const nic_address_t *, size_t);
-static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
+static int rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     const nic_address_t *addr, size_t addr_count);
-static errno_t rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
+static int rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
 
 
@@ -1025,7 +1024,7 @@
  *  @param hw_resources  Devices hardware resources
  *
- *  @return EOK if succeed, error code otherwise
- */
-static errno_t rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
+ *  @return EOK if succeed, negative error code otherwise
+ */
+static int rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
     *hw_resources)
 {
@@ -1065,7 +1064,7 @@
  *  @param dev  The device structure
  *
- *  @return EOK if succeed, error code otherwise
- */
-static errno_t rtl8139_get_resource_info(ddf_dev_t *dev)
+ *  @return EOK if succeed, negative error code otherwise
+ */
+static int rtl8139_get_resource_info(ddf_dev_t *dev)
 {
 	assert(dev);
@@ -1078,10 +1077,10 @@
 
 	/* Get hw resources form parent driver */
-	errno_t rc = nic_get_resources(nic_data, &hw_res_parsed);
+	int rc = nic_get_resources(nic_data, &hw_res_parsed);
 	if (rc != EOK)
 		return rc;
 
 	/* Fill resources information to the device */
-	errno_t ret = rtl8139_fill_resource_info(dev, &hw_res_parsed);
+	int ret = rtl8139_fill_resource_info(dev, &hw_res_parsed);
 	hw_res_list_parsed_clean(&hw_res_parsed);
 
@@ -1098,8 +1097,8 @@
  * @return EOK in the case of success, error code otherwise
  */
-static errno_t rtl8139_buffers_create(rtl8139_t *rtl8139)
+static int rtl8139_buffers_create(rtl8139_t *rtl8139)
 {
 	size_t i = 0;
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "Creating buffers");
@@ -1147,11 +1146,11 @@
  *  @param dev  The device information
  *
- *  @return EOK if succeed, error code otherwise
- */
-static errno_t rtl8139_device_initialize(ddf_dev_t *dev)
+ *  @return EOK if succeed, negative error code otherwise
+ */
+static int rtl8139_device_initialize(ddf_dev_t *dev)
 {
 	ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", ddf_dev_get_name(dev));
 
-	errno_t ret = EOK;
+	int ret = EOK;
 
 	ddf_msg(LVL_DEBUG, "rtl8139: creating device data");
@@ -1206,7 +1205,7 @@
  * @param dev  The RTL8139 device.
  *
- * @return EOK if successed, error code otherwise
- */
-static errno_t rtl8139_pio_enable(ddf_dev_t *dev)
+ * @return EOK if successed, negative error code otherwise
+ */
+static int rtl8139_pio_enable(ddf_dev_t *dev)
 {
 	ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", ddf_dev_get_name(dev));
@@ -1256,7 +1255,7 @@
  * @param dev  The RTL8139 device.
  *
- * @return EOK if added successfully, error code otherwise
- */
-errno_t rtl8139_dev_add(ddf_dev_t *dev)
+ * @return EOK if added successfully, negative error code otherwise
+ */
+int rtl8139_dev_add(ddf_dev_t *dev)
 {
 	ddf_fun_t *fun;
@@ -1266,5 +1265,5 @@
 
 	/* Init device structure for rtl8139 */
-	errno_t rc = rtl8139_device_initialize(dev);
+	int rc = rtl8139_device_initialize(dev);
 	if (rc != EOK)
 		return rc;
@@ -1288,7 +1287,7 @@
 
 	/* Register interrupt handler */
-	int irq_cap;
-	rc = rtl8139_register_int_handler(nic_data, &irq_cap);
-	if (rc != EOK) {
+	int irq_cap = rtl8139_register_int_handler(nic_data);
+	if (irq_cap < 0) {
+		rc = irq_cap;
 		goto err_pio;
 	}
@@ -1339,7 +1338,7 @@
  *  @param max_len  Maximal addresss length to store
  *
- *  @return EOK if succeed, error code otherwise
- */
-static errno_t rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
+ *  @return EOK if succeed, negative error code otherwise
+ */
+static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
 {
 	assert(fun);
@@ -1352,5 +1351,5 @@
 	rtl8139_lock_all(rtl8139);
 
-	errno_t rc = nic_report_address(nic_data, addr);
+	int rc = nic_report_address(nic_data, addr);
 	if ( rc != EOK) {
 		rtl8139_unlock_all(rtl8139);
@@ -1371,5 +1370,5 @@
  *  @return EOK
  */
-static errno_t rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
+static int rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
 {
 	assert(fun);
@@ -1406,5 +1405,5 @@
  *  @return EOK
  */
-static errno_t rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
+static int rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
 {
 	assert(fun);
@@ -1425,5 +1424,5 @@
 /** Get operation mode of the device
  */
-static errno_t rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
+static int rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
     nic_channel_mode_t *duplex, nic_role_t *role)
 {
@@ -1502,5 +1501,5 @@
  *  @return EOK if succeed
  */
-static errno_t rtl8139_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 
+static int rtl8139_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 
     nic_result_t *we_receive, uint16_t *time)
 {
@@ -1537,5 +1536,5 @@
  *  @return EOK if succeed, INVAL if the pause frame has no sence
  */
-static errno_t rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 
+static int rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 
     uint16_t time)
 {
@@ -1567,5 +1566,5 @@
  *
  */
-static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
+static int rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
     nic_channel_mode_t duplex, nic_role_t role)
 {
@@ -1611,5 +1610,5 @@
  *  @returns EOK if advertisement mode set successfully
  */
-static errno_t rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
+static int rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
 {
 	assert(fun);
@@ -1657,5 +1656,5 @@
  *  @returns EOK
  */
-static errno_t rtl8139_autoneg_disable(ddf_fun_t *fun)
+static int rtl8139_autoneg_disable(ddf_fun_t *fun)
 {
 	assert(fun);
@@ -1708,5 +1707,5 @@
  *  @returns EOK
  */
-static errno_t rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
+static int rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
     uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result)
 {
@@ -1745,5 +1744,5 @@
  *  @returns EOK
  */
-static errno_t rtl8139_autoneg_restart(ddf_fun_t *fun)
+static int rtl8139_autoneg_restart(ddf_fun_t *fun)
 {
 	assert(fun);
@@ -1793,5 +1792,5 @@
  *  @returns EOK
  */
-static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
+static int rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     const nic_address_t *addr, size_t addr_cnt)
 {
@@ -1851,5 +1850,5 @@
  *  @returns EOK
  */
-static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
+static int rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     const nic_address_t *addr, size_t addr_count)
 {
@@ -1894,5 +1893,5 @@
  *  @returns EOK
  */
-static errno_t rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
+static int rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
 {
 	assert(nic_data);
@@ -1922,5 +1921,5 @@
  *  @param[out] mode    The current mode
  */
-static errno_t rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
+static int rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
 {
 	assert(fun);
@@ -1947,5 +1946,5 @@
  *  @returns EOK of mode was set
  */
-static errno_t rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
+static int rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
 {
 	assert(fun);
@@ -1979,5 +1978,5 @@
  *  @returns ELIMIT if no more methods of this kind can be enabled
  */
-static errno_t rtl8139_wol_virtue_add(nic_t *nic_data,
+static int rtl8139_wol_virtue_add(nic_t *nic_data,
 	const nic_wol_virtue_t *virtue)
 {
@@ -2058,9 +2057,9 @@
  *  @returns ENOTSUP if the mode is not supported
  */
-static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
+static int rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
     const struct timeval *period)
 {
 	assert(nic_data);
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
@@ -2143,5 +2142,5 @@
 	printf("%s: HelenOS RTL8139 network adapter driver\n", NAME);
 
-	errno_t rc = nic_driver_init(NAME);
+	int rc = nic_driver_init(NAME);
 	if (rc != EOK)
 		return rc;
Index: uspace/drv/nic/rtl8139/general.c
===================================================================
--- uspace/drv/nic/rtl8139/general.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/rtl8139/general.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -81,7 +81,7 @@
  *  @param time        The requested time
  *
- *  @return EOK if succeed, error code otherwise
+ *  @return EOK if succeed, negative error code otherwise
  */
-errno_t rtl8139_timer_act_init(rtl8139_timer_act_t * ta, uint32_t timer_freq,
+int rtl8139_timer_act_init(rtl8139_timer_act_t * ta, uint32_t timer_freq,
     const struct timeval *time) 
 {
Index: uspace/drv/nic/rtl8139/general.h
===================================================================
--- uspace/drv/nic/rtl8139/general.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/rtl8139/general.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,5 +61,5 @@
 extern void *rtl8139_memcpy_wrapped(void *, const void *, size_t, size_t,
     size_t);
-extern errno_t rtl8139_timer_act_init(rtl8139_timer_act_t *, uint32_t,
+extern int rtl8139_timer_act_init(rtl8139_timer_act_t *, uint32_t,
     const struct timeval *);
 extern int rtl8139_timer_act_step(rtl8139_timer_act_t *, uint32_t *);
Index: uspace/drv/nic/rtl8169/driver.c
===================================================================
--- uspace/drv/nic/rtl8169/driver.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/nic/rtl8169/driver.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -30,5 +30,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <align.h>
 #include <byteorder.h>
@@ -52,40 +51,40 @@
 FIBRIL_MUTEX_INITIALIZE(irq_reg_lock);
 
-static errno_t rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr);
-static errno_t rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
-static errno_t rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
-static errno_t rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
+static int rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr);
+static int rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
+static int rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
+static int rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
     nic_channel_mode_t *duplex, nic_role_t *role);
-static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
+static int rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
     nic_channel_mode_t duplex, nic_role_t role);
-static errno_t rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 
+static int rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 
     nic_result_t *we_receive, uint16_t *time);
-static errno_t rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 
+static int rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 
     uint16_t time);
-static errno_t rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
-static errno_t rtl8169_autoneg_disable(ddf_fun_t *fun);
-static errno_t rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
+static int rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
+static int rtl8169_autoneg_disable(ddf_fun_t *fun);
+static int rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
     uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result);
-static errno_t rtl8169_autoneg_restart(ddf_fun_t *fun);
-static errno_t rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
-static errno_t rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
-static errno_t rtl8169_on_activated(nic_t *nic_data);
-static errno_t rtl8169_on_stopped(nic_t *nic_data);
+static int rtl8169_autoneg_restart(ddf_fun_t *fun);
+static int rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
+static int rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
+static int rtl8169_on_activated(nic_t *nic_data);
+static int rtl8169_on_stopped(nic_t *nic_data);
 static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size);
 static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev);
-static inline errno_t rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle);
+static inline int rtl8169_register_int_handler(nic_t *nic_data);
 static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr);
 static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr);
 
 static void rtl8169_reset(rtl8169_t *rtl8169);
-static errno_t rtl8169_get_resource_info(ddf_dev_t *dev);
-static errno_t rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t *hw_resources);
+static int rtl8169_get_resource_info(ddf_dev_t *dev);
+static int rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t *hw_resources);
 static rtl8169_t *rtl8169_create_dev_data(ddf_dev_t *dev);
 
-static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
+static int rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     const nic_address_t *, size_t);
-static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
+static int rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     const nic_address_t *addr, size_t addr_count);
-static errno_t rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
+static int rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
 
 static uint16_t rtl8169_mii_read(rtl8169_t *rtl8169, uint8_t addr);
@@ -161,5 +160,5 @@
 static ddf_dev_ops_t rtl8169_dev_ops;
 
-static errno_t rtl8169_dev_add(ddf_dev_t *dev);
+static int rtl8169_dev_add(ddf_dev_t *dev);
 
 /** Basic driver operations for RTL8169 driver */
@@ -174,5 +173,5 @@
 };
 
-static errno_t rtl8169_get_resource_info(ddf_dev_t *dev)
+static int rtl8169_get_resource_info(ddf_dev_t *dev)
 {
 	assert(dev);
@@ -185,10 +184,10 @@
 
 	/* Get hw resources form parent driver */
-	errno_t rc = nic_get_resources(nic_data, &hw_res_parsed);
+	int rc = nic_get_resources(nic_data, &hw_res_parsed);
 	if (rc != EOK)
 		return rc;
 
 	/* Fill resources information to the device */
-	errno_t ret = rtl8169_fill_resource_info(dev, &hw_res_parsed);
+	int ret = rtl8169_fill_resource_info(dev, &hw_res_parsed);
 	hw_res_list_parsed_clean(&hw_res_parsed);
 
@@ -196,5 +195,5 @@
 }
 
-static errno_t rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
+static int rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
     *hw_resources)
 {
@@ -229,7 +228,7 @@
 }
 
-static errno_t rtl8169_allocate_buffers(rtl8169_t *rtl8169)
-{
-	errno_t rc;
+static int rtl8169_allocate_buffers(rtl8169_t *rtl8169)
+{
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "Allocating DMA buffer rings");
@@ -334,7 +333,7 @@
 }
 
-static errno_t rtl8169_dev_initialize(ddf_dev_t *dev)
-{
-	errno_t ret;
+static int rtl8169_dev_initialize(ddf_dev_t *dev)
+{
+	int ret;
 
 	rtl8169_t *rtl8169 = rtl8169_create_dev_data(dev);
@@ -360,5 +359,5 @@
 }
 
-inline static errno_t rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
+inline static int rtl8169_register_int_handler(nic_t *nic_data)
 {
 	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
@@ -368,15 +367,15 @@
 	rtl8169_irq_code.cmds[2].addr = rtl8169->regs + ISR;
 	rtl8169_irq_code.cmds[3].addr = rtl8169->regs + IMR;
-	errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),
-	    rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code, handle);
-
-	return rc;
-}
-
-static errno_t rtl8169_dev_add(ddf_dev_t *dev)
+	int irq_cap = register_interrupt_handler(nic_get_ddf_dev(nic_data),
+	    rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code);
+
+	return irq_cap;
+}
+
+static int rtl8169_dev_add(ddf_dev_t *dev)
 {
 	ddf_fun_t *fun;
 	nic_address_t nic_addr;
-	errno_t rc;
+	int rc;
 
 	assert(dev);
@@ -428,8 +427,8 @@
 		goto err_pio;
 
-	int irq_cap;
-	rc = rtl8169_register_int_handler(nic_data, &irq_cap);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to register IRQ handler (%s)", str_error_name(rc));
+	int irq_cap = rtl8169_register_int_handler(nic_data);
+	if (irq_cap < 0) {
+		rc = irq_cap;
+		ddf_msg(LVL_ERROR, "Failed to register IRQ handler (%d)", rc);
 		goto err_irq;
 	}
@@ -481,9 +480,9 @@
 }
 
-static errno_t rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
+static int rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&rtl8169->rx_lock);
@@ -502,5 +501,5 @@
 }
 
-static errno_t rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
+static int rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
@@ -528,5 +527,5 @@
 }
 
-static errno_t rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
+static int rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
 {
 	rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
@@ -541,5 +540,5 @@
 }
 
-static errno_t rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
+static int rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
     nic_channel_mode_t *duplex, nic_role_t *role)
 {
@@ -563,5 +562,5 @@
 }
 
-static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
+static int rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
     nic_channel_mode_t duplex, nic_role_t role)
 {
@@ -594,5 +593,5 @@
 }
 
-static errno_t rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 
+static int rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 
     nic_result_t *we_receive, uint16_t *time)
 {
@@ -600,5 +599,5 @@
 }
 
-static errno_t rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 
+static int rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 
     uint16_t time)
 {
@@ -606,5 +605,5 @@
 }
 
-static errno_t rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
+static int rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
 {
 	rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
@@ -630,5 +629,5 @@
 }
 
-static errno_t rtl8169_autoneg_disable(ddf_fun_t *fun)
+static int rtl8169_autoneg_disable(ddf_fun_t *fun)
 {
 	rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
@@ -641,5 +640,5 @@
 }
 
-static errno_t rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
+static int rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
     uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result)
 {
@@ -647,5 +646,5 @@
 }
 
-static errno_t rtl8169_autoneg_restart(ddf_fun_t *fun)
+static int rtl8169_autoneg_restart(ddf_fun_t *fun)
 {
 	rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
@@ -657,10 +656,10 @@
 }
 
-static errno_t rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
-{
-	return EOK;
-}
-
-static errno_t rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
+static int rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
+{
+	return EOK;
+}
+
+static int rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
 {
 	return EOK;
@@ -691,7 +690,7 @@
 }
 
-static errno_t rtl8169_on_activated(nic_t *nic_data)
-{
-	errno_t rc;
+static int rtl8169_on_activated(nic_t *nic_data)
+{
+	int rc;
 	uint64_t tmp;
 
@@ -707,5 +706,5 @@
 	rc = rtl8169_allocate_buffers(rtl8169);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error allocating buffers: %s", str_error_name(rc));
+		ddf_msg(LVL_ERROR, "Error allocating buffers: %d", rc);
 		return 0;
 	}
@@ -753,5 +752,5 @@
 }
 
-static errno_t rtl8169_on_stopped(nic_t *nic_data)
+static int rtl8169_on_stopped(nic_t *nic_data)
 {
 	ddf_msg(LVL_NOTE, "Stopping device");
@@ -819,5 +818,5 @@
 }
 
-static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
+static int rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     const nic_address_t *addr, size_t addr_count)
 {
@@ -871,5 +870,5 @@
 }
 
-static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
+static int rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     const nic_address_t *addr, size_t addr_count)
 {
@@ -915,5 +914,5 @@
 }
 
-static errno_t rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
+static int rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
 {
 	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
@@ -1208,5 +1207,5 @@
 int main(void)
 {
-	errno_t rc = nic_driver_init(NAME);
+	int rc = nic_driver_init(NAME);
 	if (rc != EOK)
 		return rc;
Index: uspace/drv/platform/amdm37x/amdm37x.c
===================================================================
--- uspace/drv/platform/amdm37x/amdm37x.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/platform/amdm37x/amdm37x.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,8 +53,8 @@
 
 
-errno_t amdm37x_init(amdm37x_t *device, bool trace)
+int amdm37x_init(amdm37x_t *device, bool trace)
 {
 	assert(device);
-	errno_t ret = EOK;
+	int ret = EOK;
 
 	ret = pio_enable((void*)USBHOST_CM_BASE_ADDRESS, USBHOST_CM_SIZE,
@@ -358,5 +358,5 @@
  * Select mode than can operate in FS/LS.
  */
-errno_t amdm37x_usb_tll_init(amdm37x_t *device)
+int amdm37x_usb_tll_init(amdm37x_t *device)
 {
 	/* Check access */
Index: uspace/drv/platform/amdm37x/amdm37x.h
===================================================================
--- uspace/drv/platform/amdm37x/amdm37x.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/platform/amdm37x/amdm37x.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -66,6 +66,6 @@
 } amdm37x_t;
 
-errno_t amdm37x_init(amdm37x_t *device, bool trace_io);
-errno_t amdm37x_usb_tll_init(amdm37x_t *device);
+int amdm37x_init(amdm37x_t *device, bool trace_io);
+int amdm37x_usb_tll_init(amdm37x_t *device);
 void amdm37x_setup_dpll_on_autoidle(amdm37x_t *device);
 void amdm37x_usb_clocks_set(amdm37x_t *device, bool enabled);
Index: uspace/drv/platform/amdm37x/main.c
===================================================================
--- uspace/drv/platform/amdm37x/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/platform/amdm37x/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,6 +49,5 @@
 typedef struct {
 	const char *name;
-	const char *id;
-	int score;
+	match_id_t match_id;
 	hw_resource_list_t hw_resources;
 } amdm37x_fun_t;
@@ -134,18 +133,15 @@
 {
 	.name = "ohci",
-	.id = "usb/host=ohci",
-	.score = 90,
+	.match_id = { .id = "usb/host=ohci", .score = 90 },
 	.hw_resources = { .resources = ohci_res, .count = ARRAY_SIZE(ohci_res) }
 },
 {
 	.name = "ehci",
-	.id = "usb/host=ehci",
-	.score = 90,
+	.match_id = { .id = "usb/host=ehci", .score = 90 },
 	.hw_resources = { .resources = ehci_res, .count = ARRAY_SIZE(ehci_res) }
 },
 {
 	.name = "fb",
-	.id = "amdm37x&dispc",
-	.score = 90,
+	.match_id = { .id = "amdm37x&dispc", .score = 90 },
 	.hw_resources = { .resources = disp_res, .count = ARRAY_SIZE(disp_res) }
 },
@@ -154,5 +150,5 @@
 
 static hw_resource_list_t *amdm37x_get_resources(ddf_fun_t *fnode);
-static errno_t amdm37x_enable_interrupt(ddf_fun_t *fun, int);
+static int amdm37x_enable_interrupt(ddf_fun_t *fun, int);
 
 static hw_res_ops_t fun_hw_res_ops = {
@@ -165,5 +161,5 @@
 };
 
-static errno_t amdm37x_add_fun(ddf_dev_t *dev, const amdm37x_fun_t *fun)
+static int amdm37x_add_fun(ddf_dev_t *dev, const amdm37x_fun_t *fun)
 {
 	assert(dev);
@@ -178,5 +174,6 @@
 	
 	/* Add match id */
-	errno_t ret = ddf_fun_add_match_id(fnode, fun->id, fun->score);
+	int ret = ddf_fun_add_match_id(fnode,
+	    fun->match_id.id, fun->match_id.score);
 	if (ret != EOK) {
 		ddf_fun_destroy(fnode);
@@ -212,8 +209,8 @@
  *            (both of HW and pseudo devices).
  *
- * @return Zero on success, error number otherwise.
- *
- */
-static errno_t amdm37x_dev_add(ddf_dev_t *dev)
+ * @return Zero on success, negative error number otherwise.
+ *
+ */
+static int amdm37x_dev_add(ddf_dev_t *dev)
 {
 	assert(dev);
@@ -221,5 +218,5 @@
 	if (!device)
 		return ENOMEM;
-	errno_t ret = amdm37x_init(device, DEBUG_CM);
+	int ret = amdm37x_init(device, DEBUG_CM);
 	if (ret != EOK) {
 		ddf_msg(LVL_FATAL, "Failed to setup hw access!.\n");
@@ -268,5 +265,5 @@
 }
 
-static errno_t amdm37x_enable_interrupt(ddf_fun_t *fun, int irq)
+static int amdm37x_enable_interrupt(ddf_fun_t *fun, int irq)
 {
 	//TODO: Implement
Index: uspace/drv/platform/icp/icp.c
===================================================================
--- uspace/drv/platform/icp/icp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/platform/icp/icp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -62,5 +62,5 @@
 } icp_fun_t;
 
-static errno_t icp_dev_add(ddf_dev_t *dev);
+static int icp_dev_add(ddf_dev_t *dev);
 
 static driver_ops_t icp_ops = {
@@ -178,5 +178,5 @@
 }
 
-static errno_t icp_fun_enable_interrupt(ddf_fun_t *fnode, int irq)
+static int icp_fun_enable_interrupt(ddf_fun_t *fnode, int irq)
 {
 	icp_fun_t *fun = icp_fun(fnode);
@@ -188,5 +188,5 @@
 }
 
-static errno_t icp_fun_disable_interrupt(ddf_fun_t *fnode, int irq)
+static int icp_fun_disable_interrupt(ddf_fun_t *fnode, int irq)
 {
 	icp_fun_t *fun = icp_fun(fnode);
@@ -198,5 +198,5 @@
 }
 
-static errno_t icp_fun_clear_interrupt(ddf_fun_t *fnode, int irq)
+static int icp_fun_clear_interrupt(ddf_fun_t *fnode, int irq)
 {
 	icp_fun_t *fun = icp_fun(fnode);
@@ -231,5 +231,5 @@
 };
 
-static errno_t icp_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
+static int icp_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
     icp_fun_t *fun_proto)
 {
@@ -237,5 +237,5 @@
 
 	ddf_fun_t *fnode = NULL;
-	errno_t rc;
+	int rc;
 
 	/* Create new device. */
@@ -275,7 +275,7 @@
 }
 
-static errno_t icp_add_functions(ddf_dev_t *dev)
-{
-	errno_t rc;
+static int icp_add_functions(ddf_dev_t *dev)
+{
+	int rc;
 
 	rc = icp_add_fun(dev, "intctl", "integratorcp/intctl",
@@ -296,5 +296,5 @@
 
 /** Add device. */
-static errno_t icp_dev_add(ddf_dev_t *dev)
+static int icp_dev_add(ddf_dev_t *dev)
 {
 	ddf_msg(LVL_NOTE, "icp_dev_add, device handle = %d",
@@ -311,5 +311,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf(NAME ": HelenOS IntegratorCP platform driver\n");
Index: uspace/drv/platform/mac/mac.c
===================================================================
--- uspace/drv/platform/mac/mac.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/platform/mac/mac.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -132,5 +132,5 @@
 	
 	ddf_fun_t *fnode = NULL;
-	errno_t rc;
+	int rc;
 	
 	/* Create new device. */
@@ -173,10 +173,10 @@
  *            (both of HW and pseudo devices).
  *
- * @return Zero on success, error number otherwise.
- *
- */
-static errno_t mac_dev_add(ddf_dev_t *dev)
-{
-	errno_t rc;
+ * @return Zero on success, negative error number otherwise.
+ *
+ */
+static int mac_dev_add(ddf_dev_t *dev)
+{
+	int rc;
 	uintptr_t cuda_physical;
 	sysarg_t cuda_inr;
@@ -227,5 +227,5 @@
 }
 
-static errno_t mac_enable_interrupt(ddf_fun_t *fun, int irq)
+static int mac_enable_interrupt(ddf_fun_t *fun, int irq)
 {
 	/* TODO */
Index: uspace/drv/platform/malta/malta.c
===================================================================
--- uspace/drv/platform/malta/malta.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/platform/malta/malta.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -77,5 +77,5 @@
 } malta_fun_t;
 
-static errno_t malta_dev_add(ddf_dev_t *dev);
+static int malta_dev_add(ddf_dev_t *dev);
 static void malta_init(void);
 
@@ -143,5 +143,5 @@
 }
 
-static errno_t malta_enable_interrupt(ddf_fun_t *fun, int irq)
+static int malta_enable_interrupt(ddf_fun_t *fun, int irq)
 {
 	/* TODO */
@@ -177,5 +177,5 @@
 	
 	ddf_fun_t *fnode = NULL;
-	errno_t rc;
+	int rc;
 	
 	/* Create new device. */
@@ -221,11 +221,11 @@
  * @param dev		The device which is root of the whole device tree (both
  *			of HW and pseudo devices).
- * @return		Zero on success, error number otherwise.
- */
-static errno_t malta_dev_add(ddf_dev_t *dev)
+ * @return		Zero on success, negative error number otherwise.
+ */
+static int malta_dev_add(ddf_dev_t *dev)
 {
 	ioport32_t *gt;
 	uint32_t val;
-	errno_t ret;
+	int ret;
 
 	ddf_msg(LVL_DEBUG, "malta_dev_add, device handle = %d",
Index: uspace/drv/platform/msim/msim.c
===================================================================
--- uspace/drv/platform/msim/msim.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/platform/msim/msim.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -62,5 +62,5 @@
 } msim_fun_t;
 
-static errno_t msim_dev_add(ddf_dev_t *dev);
+static int msim_dev_add(ddf_dev_t *dev);
 static void msim_init(void);
 
@@ -152,9 +152,9 @@
 }
 
-static errno_t msim_enable_interrupt(ddf_fun_t *fun, int irq)
+static int msim_enable_interrupt(ddf_fun_t *fun, int irq)
 {
 	/* Nothing to do. */
 
-	return EOK;
+	return true;
 }
 
@@ -186,5 +186,5 @@
 	
 	ddf_fun_t *fnode = NULL;
-	errno_t rc;
+	int rc;
 	
 	/* Create new device. */
@@ -238,5 +238,5 @@
  * @return Zero on success or non-zero error code.
  */
-static errno_t msim_dev_add(ddf_dev_t *dev)
+static int msim_dev_add(ddf_dev_t *dev)
 {
 	ddf_msg(LVL_DEBUG, "msim_dev_add, device handle = %d",
Index: uspace/drv/platform/pc/pc.c
===================================================================
--- uspace/drv/platform/pc/pc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/platform/pc/pc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,5 +59,5 @@
 } pc_fun_t;
 
-static errno_t pc_dev_add(ddf_dev_t *dev);
+static int pc_dev_add(ddf_dev_t *dev);
 static void pc_init(void);
 
@@ -125,5 +125,5 @@
 }
 
-static errno_t pc_enable_interrupt(ddf_fun_t *fun, int irq)
+static int pc_enable_interrupt(ddf_fun_t *fun, int irq)
 {
 	/* TODO */
@@ -159,5 +159,5 @@
 	
 	ddf_fun_t *fnode = NULL;
-	errno_t rc;
+	int rc;
 	
 	/* Create new device. */
@@ -203,7 +203,7 @@
  * @param dev		The device which is root of the whole device tree (both
  *			of HW and pseudo devices).
- * @return		Zero on success, error number otherwise.
- */
-static errno_t pc_dev_add(ddf_dev_t *dev)
+ * @return		Zero on success, negative error number otherwise.
+ */
+static int pc_dev_add(ddf_dev_t *dev)
 {
 	ddf_msg(LVL_DEBUG, "pc_dev_add, device handle = %d",
Index: uspace/drv/platform/ski/ski.c
===================================================================
--- uspace/drv/platform/ski/ski.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/platform/ski/ski.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
 #define NAME "ski"
 
-static errno_t ski_dev_add(ddf_dev_t *dev);
+static int ski_dev_add(ddf_dev_t *dev);
 
 static driver_ops_t ski_ops = {
@@ -57,10 +57,10 @@
 };
 
-static errno_t ski_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id)
+static int ski_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id)
 {
 	ddf_msg(LVL_NOTE, "Adding function '%s'.", name);
 
 	ddf_fun_t *fnode = NULL;
-	errno_t rc;
+	int rc;
 
 	/* Create new device. */
@@ -94,7 +94,7 @@
 }
 
-static errno_t ski_add_functions(ddf_dev_t *dev)
+static int ski_add_functions(ddf_dev_t *dev)
 {
-	errno_t rc;
+	int rc;
 
 	rc = ski_add_fun(dev, "console", "ski/console");
@@ -106,5 +106,5 @@
 
 /** Add device. */
-static errno_t ski_dev_add(ddf_dev_t *dev)
+static int ski_dev_add(ddf_dev_t *dev)
 {
 	ddf_msg(LVL_NOTE, "ski_dev_add, device handle = %d",
@@ -121,5 +121,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf(NAME ": Ski platform driver\n");
Index: uspace/drv/platform/sun4u/sun4u.c
===================================================================
--- uspace/drv/platform/sun4u/sun4u.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/platform/sun4u/sun4u.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -77,5 +77,5 @@
 } sun4u_fun_t;
 
-static errno_t sun4u_dev_add(ddf_dev_t *dev);
+static int sun4u_dev_add(ddf_dev_t *dev);
 static void sun4u_init(void);
 
@@ -159,5 +159,5 @@
 }
 
-static errno_t sun4u_enable_interrupt(ddf_fun_t *fun, int irq)
+static int sun4u_enable_interrupt(ddf_fun_t *fun, int irq)
 {
 	/* TODO */
@@ -193,5 +193,5 @@
 	
 	ddf_fun_t *fnode = NULL;
-	errno_t rc;
+	int rc;
 	
 	/* Create new device. */
@@ -240,7 +240,7 @@
  * @param dev		The device which is root of the whole device tree (both
  *			of HW and pseudo devices).
- * @return		Zero on success, error number otherwise.
- */
-static errno_t sun4u_dev_add(ddf_dev_t *dev)
+ * @return		Zero on success, negative error number otherwise.
+ */
+static int sun4u_dev_add(ddf_dev_t *dev)
 {
 	ddf_msg(LVL_DEBUG, "sun4u_dev_add, device handle = %d",
Index: uspace/drv/platform/sun4v/sun4v.c
===================================================================
--- uspace/drv/platform/sun4v/sun4v.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/platform/sun4v/sun4v.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,4 @@
 #include <ddf/log.h>
 #include <errno.h>
-#include <str_error.h>
 #include <ops/hw_res.h>
 #include <ops/pio_window.h>
@@ -55,5 +54,5 @@
 } sun4v_fun_t;
 
-static errno_t sun4v_dev_add(ddf_dev_t *dev);
+static int sun4v_dev_add(ddf_dev_t *dev);
 
 static driver_ops_t sun4v_ops = {
@@ -114,7 +113,7 @@
 }
 
-static errno_t sun4v_enable_interrupt(ddf_fun_t *fun, int irq)
-{
-	return EOK;
+static int sun4v_enable_interrupt(ddf_fun_t *fun, int irq)
+{
+	return true;
 }
 
@@ -138,5 +137,5 @@
 static ddf_dev_ops_t sun4v_fun_ops;
 
-static errno_t sun4v_add_fun(ddf_dev_t *dev, const char *name,
+static int sun4v_add_fun(ddf_dev_t *dev, const char *name,
     const char *str_match_id, sun4v_fun_t *fun_proto)
 {
@@ -144,5 +143,5 @@
 
 	ddf_fun_t *fnode = NULL;
-	errno_t rc;
+	int rc;
 
 	/* Create new device. */
@@ -188,7 +187,7 @@
 }
 
-static errno_t sun4v_add_functions(ddf_dev_t *dev)
-{
-	errno_t rc;
+static int sun4v_add_functions(ddf_dev_t *dev)
+{
+	int rc;
 
 	rc = sun4v_add_fun(dev, "console", "sun4v/console", &console_data);
@@ -200,5 +199,5 @@
 
 /** Add device. */
-static errno_t sun4v_dev_add(ddf_dev_t *dev)
+static int sun4v_dev_add(ddf_dev_t *dev)
 {
 	ddf_msg(LVL_DEBUG, "sun4v_dev_add, device handle = %d",
@@ -213,7 +212,7 @@
 }
 
-static errno_t sun4v_init(void)
-{
-	errno_t rc;
+static int sun4v_init(void)
+{
+	int rc;
 	sysarg_t paddr;
 
@@ -229,5 +228,5 @@
 	rc = sysinfo_get_value("niagara.inbuf.address", &paddr);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "niagara.inbuf.address not set: %s", str_error(rc));
+		ddf_msg(LVL_ERROR, "niagara.inbuf.address not set (%d)", rc);
 		return rc;
 	}
@@ -237,5 +236,5 @@
 	rc = sysinfo_get_value("niagara.outbuf.address", &paddr);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "niagara.outbuf.address not set: %s", str_error(rc));
+		ddf_msg(LVL_ERROR, "niagara.outbuf.address not set (%d)", rc);
 		return rc;
 	}
@@ -247,5 +246,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf(NAME ": Sun4v platform driver\n");
Index: uspace/drv/root/root/root.c
===================================================================
--- uspace/drv/root/root/root.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/root/root/root.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -64,7 +64,7 @@
 #define VIRTUAL_FUN_MATCH_SCORE 100
 
-static errno_t root_dev_add(ddf_dev_t *dev);
-static errno_t root_fun_online(ddf_fun_t *fun);
-static errno_t root_fun_offline(ddf_fun_t *fun);
+static int root_dev_add(ddf_dev_t *dev);
+static int root_fun_online(ddf_fun_t *fun);
+static int root_fun_offline(ddf_fun_t *fun);
 
 /** The root device driver's standard operations. */
@@ -84,11 +84,11 @@
  *
  * @param dev	Device
- * @return	EOK on success or an error code
- */
-static errno_t add_virtual_root_fun(ddf_dev_t *dev)
+ * @return	EOK on success or negative error code
+ */
+static int add_virtual_root_fun(ddf_dev_t *dev)
 {
 	const char *name = VIRTUAL_FUN_NAME;
 	ddf_fun_t *fun;
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "Adding new function for virtual devices. "
@@ -125,7 +125,7 @@
  *
  * @param dev	Device
- * @return	EOK on success or an error code
- */
-static errno_t add_platform_fun(ddf_dev_t *dev)
+ * @return	EOK on success or negative error code
+ */
+static int add_platform_fun(ddf_dev_t *dev)
 {
 	char *match_id;
@@ -135,5 +135,5 @@
 	const char *name = PLATFORM_FUN_NAME;
 	ddf_fun_t *fun;
-	errno_t rc;
+	int rc;
 
 	/* Get platform name from sysinfo. */
@@ -201,5 +201,5 @@
  *			of HW and pseudo devices).
  */
-static errno_t root_dev_add(ddf_dev_t *dev)
+static int root_dev_add(ddf_dev_t *dev)
 {
 	ddf_msg(LVL_DEBUG, "root_dev_add, device handle=%" PRIun,
@@ -211,5 +211,5 @@
 	 * vital for the system.
 	 */
-	errno_t res = add_virtual_root_fun(dev);
+	int res = add_virtual_root_fun(dev);
 	if (res != EOK)
 		ddf_msg(LVL_WARN, "Failed to add virtual child.");
@@ -223,5 +223,5 @@
 }
 
-static errno_t root_fun_online(ddf_fun_t *fun)
+static int root_fun_online(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "root_fun_online()");
@@ -229,5 +229,5 @@
 }
 
-static errno_t root_fun_offline(ddf_fun_t *fun)
+static int root_fun_offline(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "root_fun_offline()");
Index: uspace/drv/root/virt/virt.c
===================================================================
--- uspace/drv/root/virt/virt.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/root/virt/virt.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -62,8 +62,8 @@
 };
 
-static errno_t virt_dev_add(ddf_dev_t *dev);
-static errno_t virt_dev_remove(ddf_dev_t *dev);
-static errno_t virt_fun_online(ddf_fun_t *fun);
-static errno_t virt_fun_offline(ddf_fun_t *fun);
+static int virt_dev_add(ddf_dev_t *dev);
+static int virt_dev_remove(ddf_dev_t *dev);
+static int virt_fun_online(ddf_fun_t *fun);
+static int virt_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t virt_ops = {
@@ -98,12 +98,12 @@
  * @param vdev		The virtual device
  * @param vfun		Virtual function description
- * @return		EOK on success or an error code.
- */
-static errno_t virt_add_fun(virt_t *virt, virtual_function_t *vfun)
+ * @return		EOK on success or negative error code.
+ */
+static int virt_add_fun(virt_t *virt, virtual_function_t *vfun)
 {
 	ddf_dev_t *vdev = virt->dev;
 	ddf_fun_t *fun;
 	virt_fun_t *rvfun;
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "Registering function `%s' (match \"%s\")",
@@ -148,7 +148,7 @@
 }
 
-static errno_t virt_fun_remove(virt_fun_t *rvfun)
-{
-	errno_t rc;
+static int virt_fun_remove(virt_fun_t *rvfun)
+{
+	int rc;
 	const char *name = ddf_fun_get_name(rvfun->fun);
 
@@ -172,5 +172,5 @@
 
 
-static errno_t virt_dev_add(ddf_dev_t *dev)
+static int virt_dev_add(ddf_dev_t *dev)
 {
 	virt_t *virt;
@@ -205,8 +205,8 @@
 }
 
-static errno_t virt_dev_remove(ddf_dev_t *dev)
+static int virt_dev_remove(ddf_dev_t *dev)
 {
 	virt_t *virt = (virt_t *)ddf_dev_data_get(dev);
-	errno_t rc;
+	int rc;
 
 	while (!list_empty(&virt->functions)) {
@@ -224,5 +224,5 @@
 }
 
-static errno_t virt_fun_online(ddf_fun_t *fun)
+static int virt_fun_online(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "virt_fun_online()");
@@ -230,5 +230,5 @@
 }
 
-static errno_t virt_fun_offline(ddf_fun_t *fun)
+static int virt_fun_offline(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "virt_fun_offline()");
Index: uspace/drv/test/test1/test1.c
===================================================================
--- uspace/drv/test/test1/test1.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/test/test1/test1.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,13 +37,12 @@
 #include <ddf/driver.h>
 #include <ddf/log.h>
-#include <str.h>
 
 #include "test1.h"
 
-static errno_t test1_dev_add(ddf_dev_t *dev);
-static errno_t test1_dev_remove(ddf_dev_t *dev);
-static errno_t test1_dev_gone(ddf_dev_t *dev);
-static errno_t test1_fun_online(ddf_fun_t *fun);
-static errno_t test1_fun_offline(ddf_fun_t *fun);
+static int test1_dev_add(ddf_dev_t *dev);
+static int test1_dev_remove(ddf_dev_t *dev);
+static int test1_dev_gone(ddf_dev_t *dev);
+static int test1_fun_online(ddf_fun_t *fun);
+static int test1_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -74,10 +73,10 @@
  * @param score Device match score.
  */
-static errno_t register_fun_verbose(ddf_dev_t *parent, const char *message,
+static int register_fun_verbose(ddf_dev_t *parent, const char *message,
     const char *name, const char *match_id, int match_score,
-    errno_t expected_rc, ddf_fun_t **pfun)
+    int expected_rc, ddf_fun_t **pfun)
 {
 	ddf_fun_t *fun = NULL;
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "Registering function `%s': %s.", name, message);
@@ -142,10 +141,10 @@
  * @return Error code reporting success of the operation.
  */
-static errno_t test1_dev_add(ddf_dev_t *dev)
+static int test1_dev_add(ddf_dev_t *dev)
 {
 	ddf_fun_t *fun_a;
 	test1_t *test1;
 	const char *dev_name;
-	errno_t rc;
+	int rc;
 
 	dev_name = ddf_dev_get_name(dev);
@@ -197,7 +196,7 @@
 }
 
-static errno_t fun_remove(ddf_fun_t *fun, const char *name)
-{
-	errno_t rc;
+static int fun_remove(ddf_fun_t *fun, const char *name)
+{
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "fun_remove(%p, '%s')", fun, name);
@@ -218,7 +217,7 @@
 }
 
-static errno_t fun_unbind(ddf_fun_t *fun, const char *name)
-{
-	errno_t rc;
+static int fun_unbind(ddf_fun_t *fun, const char *name)
+{
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "fun_unbind(%p, '%s')", fun, name);
@@ -233,8 +232,8 @@
 }
 
-static errno_t test1_dev_remove(ddf_dev_t *dev)
+static int test1_dev_remove(ddf_dev_t *dev)
 {
 	test1_t *test1 = (test1_t *)ddf_dev_data_get(dev);
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "test1_dev_remove(%p)", dev);
@@ -261,8 +260,8 @@
 }
 
-static errno_t test1_dev_gone(ddf_dev_t *dev)
+static int test1_dev_gone(ddf_dev_t *dev)
 {
 	test1_t *test1 = (test1_t *)ddf_dev_data_get(dev);
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "test1_dev_remove(%p)", dev);
@@ -289,5 +288,5 @@
 }
 
-static errno_t test1_fun_online(ddf_fun_t *fun)
+static int test1_fun_online(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "test1_fun_online()");
@@ -295,5 +294,5 @@
 }
 
-static errno_t test1_fun_offline(ddf_fun_t *fun)
+static int test1_fun_offline(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "test1_fun_offline()");
Index: uspace/drv/test/test2/test2.c
===================================================================
--- uspace/drv/test/test2/test2.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/test/test2/test2.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,5 +34,4 @@
 #include <stdio.h>
 #include <errno.h>
-#include <str.h>
 #include <str_error.h>
 #include <ddf/driver.h>
@@ -41,9 +40,9 @@
 #define NAME "test2"
 
-static errno_t test2_dev_add(ddf_dev_t *dev);
-static errno_t test2_dev_remove(ddf_dev_t *dev);
-static errno_t test2_dev_gone(ddf_dev_t *dev);
-static errno_t test2_fun_online(ddf_fun_t *fun);
-static errno_t test2_fun_offline(ddf_fun_t *fun);
+static int test2_dev_add(ddf_dev_t *dev);
+static int test2_dev_remove(ddf_dev_t *dev);
+static int test2_dev_gone(ddf_dev_t *dev);
+static int test2_fun_online(ddf_fun_t *fun);
+static int test2_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -78,9 +77,9 @@
  * @param score Device match score.
  */
-static errno_t register_fun_verbose(ddf_dev_t *parent, const char *message,
+static int register_fun_verbose(ddf_dev_t *parent, const char *message,
     const char *name, const char *match_id, int match_score, ddf_fun_t **pfun)
 {
 	ddf_fun_t *fun;
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "Registering function `%s': %s.", name, message);
@@ -119,9 +118,9 @@
  * @return Always EOK.
  */
-static errno_t plug_unplug(void *arg)
+static int plug_unplug(void *arg)
 {
 	test2_t *test2 = (test2_t *) arg;
 	ddf_fun_t *fun_a;
-	errno_t rc;
+	int rc;
 
 	async_usleep(1000);
@@ -158,7 +157,7 @@
 }
 
-static errno_t fun_remove(ddf_fun_t *fun, const char *name)
-{
-	errno_t rc;
+static int fun_remove(ddf_fun_t *fun, const char *name)
+{
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "fun_remove(%p, '%s')", fun, name);
@@ -179,7 +178,7 @@
 }
 
-static errno_t fun_unbind(ddf_fun_t *fun, const char *name)
-{
-	errno_t rc;
+static int fun_unbind(ddf_fun_t *fun, const char *name)
+{
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "fun_unbind(%p, '%s')", fun, name);
@@ -194,5 +193,5 @@
 }
 
-static errno_t test2_dev_add(ddf_dev_t *dev)
+static int test2_dev_add(ddf_dev_t *dev)
 {
 	test2_t *test2;
@@ -225,8 +224,8 @@
 }
 
-static errno_t test2_dev_remove(ddf_dev_t *dev)
+static int test2_dev_remove(ddf_dev_t *dev)
 {
 	test2_t *test2 = (test2_t *)ddf_dev_data_get(dev);
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "test2_dev_remove(%p)", dev);
@@ -259,8 +258,8 @@
 }
 
-static errno_t test2_dev_gone(ddf_dev_t *dev)
+static int test2_dev_gone(ddf_dev_t *dev)
 {
 	test2_t *test2 = (test2_t *)ddf_dev_data_get(dev);
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "test2_dev_gone(%p)", dev);
@@ -294,5 +293,5 @@
 
 
-static errno_t test2_fun_online(ddf_fun_t *fun)
+static int test2_fun_online(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "test2_fun_online()");
@@ -300,5 +299,5 @@
 }
 
-static errno_t test2_fun_offline(ddf_fun_t *fun)
+static int test2_fun_offline(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "test2_fun_offline()");
Index: uspace/drv/test/test3/test3.c
===================================================================
--- uspace/drv/test/test3/test3.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/test/test3/test3.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,8 +41,8 @@
 #define NUM_FUNCS 20
 
-static errno_t test3_dev_add(ddf_dev_t *dev);
-static errno_t test3_dev_remove(ddf_dev_t *dev);
-static errno_t test3_fun_online(ddf_fun_t *fun);
-static errno_t test3_fun_offline(ddf_fun_t *fun);
+static int test3_dev_add(ddf_dev_t *dev);
+static int test3_dev_remove(ddf_dev_t *dev);
+static int test3_fun_online(ddf_fun_t *fun);
+static int test3_fun_offline(ddf_fun_t *fun);
 
 static driver_ops_t driver_ops = {
@@ -63,15 +63,15 @@
 } test3_t;
 
-static errno_t register_fun_and_add_to_category(ddf_dev_t *parent,
+static int register_fun_and_add_to_category(ddf_dev_t *parent,
     const char *base_name, size_t index, const char *class_name,
     ddf_fun_t **pfun)
 {
 	ddf_fun_t *fun = NULL;
-	errno_t rc;
+	int rc;
 	char *fun_name = NULL;
 	
-	if (asprintf(&fun_name, "%s%zu", base_name, index) < 0) {
-		ddf_msg(LVL_ERROR, "Failed to format string: No memory");
-		rc = ENOMEM;
+	rc = asprintf(&fun_name, "%s%zu", base_name, index);
+	if (rc < 0) {
+		ddf_msg(LVL_ERROR, "Failed to format string: %s", str_error(rc));
 		goto leave;
 	}
@@ -106,7 +106,7 @@
 }
 
-static errno_t fun_remove(ddf_fun_t *fun, const char *name)
+static int fun_remove(ddf_fun_t *fun, const char *name)
 {
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "fun_remove(%p, '%s')", fun, name);
@@ -127,7 +127,7 @@
 }
 
-static errno_t test3_dev_add(ddf_dev_t *dev)
+static int test3_dev_add(ddf_dev_t *dev)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	test3_t *test3;
 
@@ -153,14 +153,15 @@
 }
 
-static errno_t test3_dev_remove(ddf_dev_t *dev)
+static int test3_dev_remove(ddf_dev_t *dev)
 {
 	test3_t *test3 = (test3_t *)ddf_dev_data_get(dev);
 	char *fun_name;
-	errno_t rc;
+	int rc;
 	size_t i;
 
 	for (i = 0; i < NUM_FUNCS; i++) {
-		if (asprintf(&fun_name, "test3_%zu", i) < 0) {
-			ddf_msg(LVL_ERROR, "Failed to format string: No memory");
+		rc = asprintf(&fun_name, "test3_%zu", i);
+		if (rc < 0) {
+			ddf_msg(LVL_ERROR, "Failed to format string: %s", str_error(rc));
 			return ENOMEM;
 		}
@@ -176,5 +177,5 @@
 }
 
-static errno_t test3_fun_online(ddf_fun_t *fun)
+static int test3_fun_online(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "test3_fun_online()");
@@ -182,5 +183,5 @@
 }
 
-static errno_t test3_fun_offline(ddf_fun_t *fun)
+static int test3_fun_offline(ddf_fun_t *fun)
 {
 	ddf_msg(LVL_DEBUG, "test3_fun_offline()");
Index: uspace/drv/time/cmos-rtc/cmos-rtc.c
===================================================================
--- uspace/drv/time/cmos-rtc/cmos-rtc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/drv/time/cmos-rtc/cmos-rtc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -80,13 +80,13 @@
 static rtc_t *dev_rtc(ddf_dev_t *dev);
 static rtc_t *fun_rtc(ddf_fun_t *fun);
-static errno_t
+static int
 rtc_battery_status_get(ddf_fun_t *fun, battery_status_t *status);
-static errno_t  rtc_time_get(ddf_fun_t *fun, struct tm *t);
-static errno_t  rtc_time_set(ddf_fun_t *fun, struct tm *t);
-static errno_t  rtc_dev_add(ddf_dev_t *dev);
-static errno_t  rtc_dev_initialize(rtc_t *rtc);
+static int  rtc_time_get(ddf_fun_t *fun, struct tm *t);
+static int  rtc_time_set(ddf_fun_t *fun, struct tm *t);
+static int  rtc_dev_add(ddf_dev_t *dev);
+static int  rtc_dev_initialize(rtc_t *rtc);
 static bool rtc_pio_enable(rtc_t *rtc);
 static void rtc_dev_cleanup(rtc_t *rtc);
-static errno_t  rtc_open(ddf_fun_t *fun);
+static int  rtc_open(ddf_fun_t *fun);
 static void rtc_close(ddf_fun_t *fun);
 static bool rtc_update_in_progress(rtc_t *rtc);
@@ -94,9 +94,9 @@
 static unsigned bcd2bin(unsigned bcd);
 static unsigned bin2bcd(unsigned binary);
-static errno_t rtc_dev_remove(ddf_dev_t *dev);
+static int rtc_dev_remove(ddf_dev_t *dev);
 static void rtc_register_write(rtc_t *rtc, int reg, int data);
 static bool is_battery_ok(rtc_t *rtc);
-static errno_t  rtc_fun_online(ddf_fun_t *fun);
-static errno_t  rtc_fun_offline(ddf_fun_t *fun);
+static int  rtc_fun_online(ddf_fun_t *fun);
+static int  rtc_fun_offline(ddf_fun_t *fun);
 
 static ddf_dev_ops_t rtc_dev_ops;
@@ -190,10 +190,10 @@
  * @param rtc  Pointer to the RTC device
  *
- * @return  EOK on success or an error code
+ * @return  EOK on success or a negative error code
  */ 
-static errno_t
+static int
 rtc_dev_initialize(rtc_t *rtc)
 {
-	errno_t rc;
+	int rc;
 	size_t i;
 	hw_resource_t *res;
@@ -314,7 +314,7 @@
  * @param t    Pointer to the time variable
  *
- * @return  EOK on success or an error code
- */
-static errno_t
+ * @return  EOK on success or a negative error code
+ */
+static int
 rtc_time_get(ddf_fun_t *fun, struct tm *t)
 {
@@ -412,5 +412,5 @@
 	/* Try to normalize the content of the tm structure */
 	time_t r = mktime(t);
-	errno_t result;
+	int result;
 
 	if (r < 0)
@@ -436,7 +436,7 @@
  * @param t    The time value to set
  *
- * @return  EOK or an error code
- */
-static errno_t
+ * @return  EOK or a negative error code
+ */
+static int
 rtc_time_set(ddf_fun_t *fun, struct tm *t)
 {
@@ -544,7 +544,7 @@
  * @param status The status of the battery
  *
- * @return       EOK on success or an error code
- */
-static errno_t
+ * @return       EOK on success or a negative error code
+ */
+static int
 rtc_battery_status_get(ddf_fun_t *fun, battery_status_t *status)
 {
@@ -577,12 +577,12 @@
  * @param dev  The RTC device
  *
- * @return  EOK on success or an error code
- */
-static errno_t
+ * @return  EOK on success or a negative error code
+ */
+static int
 rtc_dev_add(ddf_dev_t *dev)
 {
 	rtc_t *rtc;
 	ddf_fun_t *fun = NULL;
-	errno_t rc;
+	int rc;
 	bool need_cleanup = false;
 
@@ -643,11 +643,11 @@
  * @param dev   The RTC device
  *
- * @return      EOK on success or an error code
- */
-static errno_t
+ * @return      EOK on success or a negative error code
+ */
+static int
 rtc_dev_remove(ddf_dev_t *dev)
 {
 	rtc_t *rtc = dev_rtc(dev);
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&rtc->mutex);
@@ -682,10 +682,10 @@
  * @param fun   The function node
  *
- * @return  EOK on success or an error code
- */
-static errno_t
+ * @return  EOK on success or a negative error code
+ */
+static int
 rtc_open(ddf_fun_t *fun)
 {
-	errno_t rc;
+	int rc;
 	rtc_t *rtc = fun_rtc(fun);
 
@@ -744,8 +744,8 @@
 }
 
-static errno_t
+static int
 rtc_fun_online(ddf_fun_t *fun)
 {
-	errno_t rc;
+	int rc;
 
 	ddf_msg(LVL_DEBUG, "rtc_fun_online()");
@@ -758,5 +758,5 @@
 }
 
-static errno_t
+static int
 rtc_fun_offline(ddf_fun_t *fun)
 {
Index: uspace/lib/bithenge/include/bithenge/blob.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/blob.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/include/bithenge/blob.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,10 +53,10 @@
 typedef struct bithenge_random_access_blob_ops_t {
 	/** @copydoc bithenge_blob_t::bithenge_blob_size */
-	errno_t (*size)(bithenge_blob_t *self, aoff64_t *size);
+	int (*size)(bithenge_blob_t *self, aoff64_t *size);
 	/** @copydoc bithenge_blob_t::bithenge_blob_read */
-	errno_t (*read)(bithenge_blob_t *self, aoff64_t offset, char *buffer,
+	int (*read)(bithenge_blob_t *self, aoff64_t offset, char *buffer,
 	    aoff64_t *size);
 	/** @copydoc bithenge_blob_t::bithenge_blob_read_bits */
-	errno_t (*read_bits)(bithenge_blob_t *self, aoff64_t offset, char *buffer,
+	int (*read_bits)(bithenge_blob_t *self, aoff64_t offset, char *buffer,
 	    aoff64_t *size, bool little_endian);
 	/** Destroy the blob.
@@ -94,5 +94,5 @@
 	 * @return EOK on success or an error code from errno.h.
 	 */
-	errno_t (*size)(bithenge_sequential_blob_t *self, aoff64_t *size);
+	int (*size)(bithenge_sequential_blob_t *self, aoff64_t *size);
 
 	/** Read the next part of the blob. If the requested data extends
@@ -108,5 +108,5 @@
 	 * @return EOK on success or an error code from errno.h.
 	 */
-	errno_t (*read)(bithenge_sequential_blob_t *self, char *buffer,
+	int (*read)(bithenge_sequential_blob_t *self, char *buffer,
 	    aoff64_t *size);
 
@@ -123,5 +123,5 @@
  * @return EOK on success or an error code from errno.h.
  */
-static inline errno_t bithenge_blob_size(bithenge_blob_t *self, aoff64_t *size)
+static inline int bithenge_blob_size(bithenge_blob_t *self, aoff64_t *size)
 {
 	assert(self);
@@ -145,5 +145,5 @@
  * @return EOK on success or an error code from errno.h.
  */
-static inline errno_t bithenge_blob_read(bithenge_blob_t *self, aoff64_t offset,
+static inline int bithenge_blob_read(bithenge_blob_t *self, aoff64_t offset,
     char *buffer, aoff64_t *size)
 {
@@ -173,5 +173,5 @@
  * @return EOK on success or an error code from errno.h.
  */
-static inline errno_t bithenge_blob_read_bits(bithenge_blob_t *self,
+static inline int bithenge_blob_read_bits(bithenge_blob_t *self,
     aoff64_t offset, char *buffer, aoff64_t *size, bool little_endian)
 {
@@ -190,10 +190,10 @@
  * @param[out] out Holds whether the blob is empty.
  * @return EOK on success or an error code from errno.h. */
-static inline errno_t bithenge_blob_empty(bithenge_blob_t *self, bool *out)
+static inline int bithenge_blob_empty(bithenge_blob_t *self, bool *out)
 {
 	assert(self);
 	assert(self->base.blob_ops);
 	aoff64_t size;
-	errno_t rc = bithenge_blob_size(self, &size);
+	int rc = bithenge_blob_size(self, &size);
 	*out = size == 0;
 	return rc;
@@ -235,19 +235,19 @@
 
 /** @memberof bithenge_blob_t */
-errno_t bithenge_init_random_access_blob(bithenge_blob_t *,
+int bithenge_init_random_access_blob(bithenge_blob_t *,
     const bithenge_random_access_blob_ops_t *);
 /** @memberof bithenge_sequential_blob_t */
-errno_t bithenge_init_sequential_blob(bithenge_sequential_blob_t *,
+int bithenge_init_sequential_blob(bithenge_sequential_blob_t *,
     const bithenge_sequential_blob_ops_t *);
 /** @memberof bithenge_blob_t */
-errno_t bithenge_new_blob_from_data(bithenge_node_t **, const void *, size_t);
-/** @memberof bithenge_blob_t */
-errno_t bithenge_new_blob_from_buffer(bithenge_node_t **, const void *, size_t,
+int bithenge_new_blob_from_data(bithenge_node_t **, const void *, size_t);
+/** @memberof bithenge_blob_t */
+int bithenge_new_blob_from_buffer(bithenge_node_t **, const void *, size_t,
     bool);
-errno_t bithenge_new_offset_blob(bithenge_node_t **, bithenge_blob_t *, aoff64_t);
-errno_t bithenge_new_subblob(bithenge_node_t **, bithenge_blob_t *, aoff64_t,
+int bithenge_new_offset_blob(bithenge_node_t **, bithenge_blob_t *, aoff64_t);
+int bithenge_new_subblob(bithenge_node_t **, bithenge_blob_t *, aoff64_t,
     aoff64_t);
 /** @memberof bithenge_blob_t */
-errno_t bithenge_blob_equal(bool *, bithenge_blob_t *, bithenge_blob_t *);
+int bithenge_blob_equal(bool *, bithenge_blob_t *, bithenge_blob_t *);
 
 #endif
Index: uspace/lib/bithenge/include/bithenge/compound.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/compound.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/include/bithenge/compound.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,9 +41,9 @@
 #include "transform.h"
 
-errno_t bithenge_new_composed_transform(bithenge_transform_t **,
+int bithenge_new_composed_transform(bithenge_transform_t **,
     bithenge_transform_t **, size_t);
-errno_t bithenge_if_transform(bithenge_transform_t **, bithenge_expression_t *,
+int bithenge_if_transform(bithenge_transform_t **, bithenge_expression_t *,
     bithenge_transform_t *, bithenge_transform_t *);
-errno_t bithenge_partial_transform(bithenge_transform_t **,
+int bithenge_partial_transform(bithenge_transform_t **,
     bithenge_transform_t *);
 
Index: uspace/lib/bithenge/include/bithenge/expression.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/expression.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/include/bithenge/expression.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,5 @@
 typedef struct bithenge_expression_ops {
 	/** @copydoc bithenge_expression_t::bithenge_expression_evaluate */
-	errno_t (*evaluate)(bithenge_expression_t *self, bithenge_scope_t *scope,
+	int (*evaluate)(bithenge_expression_t *self, bithenge_scope_t *scope,
 	    bithenge_node_t **out);
 	/** Destroy the expression.
@@ -85,5 +85,5 @@
  * @param[out] out Where the output tree will be stored.
  * @return EOK on success or an error code from errno.h. */
-static inline errno_t bithenge_expression_evaluate(bithenge_expression_t *self,
+static inline int bithenge_expression_evaluate(bithenge_expression_t *self,
     bithenge_scope_t *scope, bithenge_node_t **out)
 {
@@ -117,27 +117,27 @@
 } bithenge_binary_op_t;
 
-errno_t bithenge_init_expression(bithenge_expression_t *,
+int bithenge_init_expression(bithenge_expression_t *,
     const bithenge_expression_ops_t *);
-errno_t bithenge_binary_expression(bithenge_expression_t **, bithenge_binary_op_t,
+int bithenge_binary_expression(bithenge_expression_t **, bithenge_binary_op_t,
     bithenge_expression_t *, bithenge_expression_t *);
-errno_t bithenge_in_node_expression(bithenge_expression_t **);
-errno_t bithenge_current_node_expression(bithenge_expression_t **);
-errno_t bithenge_param_expression(bithenge_expression_t **, int);
-errno_t bithenge_const_expression(bithenge_expression_t **, bithenge_node_t *);
-errno_t bithenge_scope_member_expression(bithenge_expression_t **,
+int bithenge_in_node_expression(bithenge_expression_t **);
+int bithenge_current_node_expression(bithenge_expression_t **);
+int bithenge_param_expression(bithenge_expression_t **, int);
+int bithenge_const_expression(bithenge_expression_t **, bithenge_node_t *);
+int bithenge_scope_member_expression(bithenge_expression_t **,
     bithenge_node_t *);
-errno_t bithenge_subblob_expression(bithenge_expression_t **,
+int bithenge_subblob_expression(bithenge_expression_t **,
     bithenge_expression_t *, bithenge_expression_t *, bithenge_expression_t *,
     bool);
-errno_t bithenge_param_wrapper(bithenge_transform_t **, bithenge_transform_t *,
+int bithenge_param_wrapper(bithenge_transform_t **, bithenge_transform_t *,
     bithenge_expression_t **);
-errno_t bithenge_expression_transform(bithenge_transform_t **,
+int bithenge_expression_transform(bithenge_transform_t **,
     bithenge_expression_t *);
-errno_t bithenge_inputless_transform(bithenge_transform_t **,
+int bithenge_inputless_transform(bithenge_transform_t **,
     bithenge_expression_t *);
 
-errno_t bithenge_concat_blob(bithenge_node_t **, bithenge_blob_t *,
+int bithenge_concat_blob(bithenge_node_t **, bithenge_blob_t *,
     bithenge_blob_t *);
-errno_t bithenge_concat_blob_lazy(bithenge_node_t **, bithenge_blob_t *,
+int bithenge_concat_blob_lazy(bithenge_node_t **, bithenge_blob_t *,
     bithenge_expression_t *, bithenge_scope_t *);
 
Index: uspace/lib/bithenge/include/bithenge/file.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/file.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/include/bithenge/file.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,7 +41,7 @@
 #include "blob.h"
 
-errno_t bithenge_new_file_blob(bithenge_node_t **, const char *);
-errno_t bithenge_new_file_blob_from_fd(bithenge_node_t **, int);
-errno_t bithenge_new_file_blob_from_file(bithenge_node_t **, FILE *);
+int bithenge_new_file_blob(bithenge_node_t **, const char *);
+int bithenge_new_file_blob_from_fd(bithenge_node_t **, int);
+int bithenge_new_file_blob_from_file(bithenge_node_t **, FILE *);
 
 #endif
Index: uspace/lib/bithenge/include/bithenge/print.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/print.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/include/bithenge/print.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,6 +50,6 @@
 } bithenge_print_type_t;
 
-errno_t bithenge_print_node(bithenge_print_type_t, bithenge_node_t *);
-errno_t bithenge_print_node_to_string(char **, size_t *, bithenge_print_type_t,
+int bithenge_print_node(bithenge_print_type_t, bithenge_node_t *);
+int bithenge_print_node_to_string(char **, size_t *, bithenge_print_type_t,
     bithenge_node_t *);
 
Index: uspace/lib/bithenge/include/bithenge/script.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/script.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/include/bithenge/script.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include "transform.h"
 
-errno_t bithenge_parse_script(const char *, bithenge_transform_t **);
+int bithenge_parse_script(const char *, bithenge_transform_t **);
 
 #endif
Index: uspace/lib/bithenge/include/bithenge/sequence.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/sequence.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/include/bithenge/sequence.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,9 +40,9 @@
 #include "transform.h"
 
-errno_t bithenge_new_struct(bithenge_transform_t **,
+int bithenge_new_struct(bithenge_transform_t **,
     bithenge_named_transform_t *);
-errno_t bithenge_repeat_transform(bithenge_transform_t **, bithenge_transform_t *,
+int bithenge_repeat_transform(bithenge_transform_t **, bithenge_transform_t *,
     bithenge_expression_t *);
-errno_t bithenge_do_while_transform(bithenge_transform_t **,
+int bithenge_do_while_transform(bithenge_transform_t **,
     bithenge_transform_t *, bithenge_expression_t *);
 
Index: uspace/lib/bithenge/include/bithenge/source.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/source.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/include/bithenge/source.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include "tree.h"
 
-errno_t bithenge_node_from_source(bithenge_node_t **, const char *);
+int bithenge_node_from_source(bithenge_node_t **, const char *);
 
 #endif
Index: uspace/lib/bithenge/include/bithenge/transform.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/transform.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/include/bithenge/transform.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -76,11 +76,11 @@
 typedef struct bithenge_transform_ops {
 	/** @copydoc bithenge_transform_t::bithenge_transform_apply */
-	errno_t (*apply)(bithenge_transform_t *self, bithenge_scope_t *scope,
+	int (*apply)(bithenge_transform_t *self, bithenge_scope_t *scope,
 	    bithenge_node_t *in, bithenge_node_t **out);
 	/** @copydoc bithenge_transform_t::bithenge_transform_prefix_length */
-	errno_t (*prefix_length)(bithenge_transform_t *self,
+	int (*prefix_length)(bithenge_transform_t *self,
 	    bithenge_scope_t *scope, bithenge_blob_t *blob, aoff64_t *out);
 	/** @copydoc bithenge_transform_t::bithenge_transform_prefix_apply */
-	errno_t (*prefix_apply)(bithenge_transform_t *self,
+	int (*prefix_apply)(bithenge_transform_t *self,
 	    bithenge_scope_t *scope, bithenge_blob_t *blob,
 	    bithenge_node_t **out_node, aoff64_t *out_size);
@@ -158,21 +158,21 @@
 
 /** @memberof bithenge_transform_t */
-errno_t bithenge_init_transform(bithenge_transform_t *,
+int bithenge_init_transform(bithenge_transform_t *,
     const bithenge_transform_ops_t *, int);
 /** @memberof bithenge_transform_t */
-errno_t bithenge_transform_apply(bithenge_transform_t *, bithenge_scope_t *,
+int bithenge_transform_apply(bithenge_transform_t *, bithenge_scope_t *,
     bithenge_node_t *, bithenge_node_t **);
 /** @memberof bithenge_transform_t */
-errno_t bithenge_transform_prefix_length(bithenge_transform_t *,
+int bithenge_transform_prefix_length(bithenge_transform_t *,
     bithenge_scope_t *, bithenge_blob_t *, aoff64_t *);
 /** @memberof bithenge_transform_t */
-errno_t bithenge_transform_prefix_apply(bithenge_transform_t *, bithenge_scope_t *,
+int bithenge_transform_prefix_apply(bithenge_transform_t *, bithenge_scope_t *,
     bithenge_blob_t *, bithenge_node_t **, aoff64_t *);
-errno_t bithenge_new_barrier_transform(bithenge_transform_t **, int);
-errno_t bithenge_barrier_transform_set_subtransform(bithenge_transform_t *,
+int bithenge_new_barrier_transform(bithenge_transform_t **, int);
+int bithenge_barrier_transform_set_subtransform(bithenge_transform_t *,
     bithenge_transform_t *);
 
 /** @memberof bithenge_scope_t */
-errno_t bithenge_scope_new(bithenge_scope_t **, bithenge_scope_t *);
+int bithenge_scope_new(bithenge_scope_t **, bithenge_scope_t *);
 /** @memberof bithenge_scope_t */
 void bithenge_scope_dec_ref(bithenge_scope_t *);
@@ -182,5 +182,5 @@
 const char *bithenge_scope_get_error(bithenge_scope_t *);
 /** @memberof bithenge_scope_t */
-errno_t bithenge_scope_error(bithenge_scope_t *, const char *, ...);
+int bithenge_scope_error(bithenge_scope_t *, const char *, ...);
 /** @memberof bithenge_scope_t */
 bithenge_node_t *bithenge_scope_get_current_node(bithenge_scope_t *);
@@ -196,9 +196,9 @@
 bool bithenge_scope_is_barrier(bithenge_scope_t *);
 /** @memberof bithenge_scope_t */
-errno_t bithenge_scope_alloc_params(bithenge_scope_t *, int);
-/** @memberof bithenge_scope_t */
-errno_t bithenge_scope_set_param(bithenge_scope_t *, int, bithenge_node_t *);
-/** @memberof bithenge_scope_t */
-errno_t bithenge_scope_get_param(bithenge_scope_t *, int, bithenge_node_t **);
+int bithenge_scope_alloc_params(bithenge_scope_t *, int);
+/** @memberof bithenge_scope_t */
+int bithenge_scope_set_param(bithenge_scope_t *, int, bithenge_node_t *);
+/** @memberof bithenge_scope_t */
+int bithenge_scope_get_param(bithenge_scope_t *, int, bithenge_node_t **);
 
 #endif
Index: uspace/lib/bithenge/include/bithenge/tree.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/tree.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/include/bithenge/tree.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,4 @@
 
 #include <assert.h>
-#include <stdbool.h>
 #include "os.h"
 
@@ -82,12 +81,12 @@
  * @param data Data provided to @a bithenge_node_t::bithenge_node_for_each.
  * @return EOK on success or an error code from errno.h. */
-typedef errno_t (*bithenge_for_each_func_t)(bithenge_node_t *key, bithenge_node_t *value, void *data);
+typedef int (*bithenge_for_each_func_t)(bithenge_node_t *key, bithenge_node_t *value, void *data);
 
 /** Operations providing access to an internal node. */
 typedef struct bithenge_internal_node_ops_t {
 	/** @copydoc bithenge_node_t::bithenge_node_for_each */
-	errno_t (*for_each)(bithenge_node_t *self, bithenge_for_each_func_t func, void *data);
+	int (*for_each)(bithenge_node_t *self, bithenge_for_each_func_t func, void *data);
 	/** @copydoc bithenge_node_t::bithenge_node_get */
-	errno_t (*get)(bithenge_node_t *self, bithenge_node_t *key,
+	int (*get)(bithenge_node_t *self, bithenge_node_t *key,
 	    bithenge_node_t **out);
 	/** Destroys the internal node.
@@ -123,5 +122,5 @@
  * @param data Data to provide to the callback function.
  * @return EOK on success or an error code from errno.h. */
-static inline errno_t bithenge_node_for_each(bithenge_node_t *self,
+static inline int bithenge_node_for_each(bithenge_node_t *self,
     bithenge_for_each_func_t func, void *data)
 {
@@ -131,5 +130,5 @@
 
 /** @memberof bithenge_node_t */
-errno_t bithenge_node_get(bithenge_node_t *, bithenge_node_t *,
+int bithenge_node_get(bithenge_node_t *, bithenge_node_t *,
     bithenge_node_t **);
 
@@ -165,19 +164,19 @@
 
 /** @memberof bithenge_node_t */
-errno_t bithenge_init_internal_node(bithenge_node_t *,
+int bithenge_init_internal_node(bithenge_node_t *,
     const bithenge_internal_node_ops_t *);
 /** @memberof bithenge_node_t */
-errno_t bithenge_new_empty_internal_node(bithenge_node_t **);
+int bithenge_new_empty_internal_node(bithenge_node_t **);
 /** @memberof bithenge_node_t */
-errno_t bithenge_new_simple_internal_node(bithenge_node_t **, bithenge_node_t **,
+int bithenge_new_simple_internal_node(bithenge_node_t **, bithenge_node_t **,
     bithenge_int_t, bool needs_free);
 /** @memberof bithenge_node_t */
-errno_t bithenge_new_boolean_node(bithenge_node_t **, bool);
+int bithenge_new_boolean_node(bithenge_node_t **, bool);
 /** @memberof bithenge_node_t */
-errno_t bithenge_new_integer_node(bithenge_node_t **, bithenge_int_t);
+int bithenge_new_integer_node(bithenge_node_t **, bithenge_int_t);
 /** @memberof bithenge_node_t */
-errno_t bithenge_new_string_node(bithenge_node_t **, const char *, bool);
+int bithenge_new_string_node(bithenge_node_t **, const char *, bool);
 /** @memberof bithenge_node_t */
-errno_t bithenge_node_equal(bool *, bithenge_node_t *, bithenge_node_t *);
+int bithenge_node_equal(bool *, bithenge_node_t *, bithenge_node_t *);
 
 #endif
Index: uspace/lib/bithenge/src/blob.c
===================================================================
--- uspace/lib/bithenge/src/blob.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/blob.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
  * @return EOK on success or an error code from errno.h.
  */
-errno_t bithenge_init_random_access_blob(bithenge_blob_t *blob,
+int bithenge_init_random_access_blob(bithenge_blob_t *blob,
     const bithenge_random_access_blob_ops_t *ops)
 {
@@ -67,5 +67,5 @@
 }
 
-static errno_t sequential_buffer(bithenge_sequential_blob_t *blob, aoff64_t end)
+static int sequential_buffer(bithenge_sequential_blob_t *blob, aoff64_t end)
 {
 	bool need_realloc = false;
@@ -81,5 +81,5 @@
 	}
 	aoff64_t size = end - blob->data_size;
-	errno_t rc = blob->ops->read(blob, blob->buffer + blob->data_size, &size);
+	int rc = blob->ops->read(blob, blob->buffer + blob->data_size, &size);
 	if (rc != EOK)
 		return rc;
@@ -100,8 +100,8 @@
 }
 
-static errno_t sequential_size(bithenge_blob_t *base, aoff64_t *size)
+static int sequential_size(bithenge_blob_t *base, aoff64_t *size)
 {
 	bithenge_sequential_blob_t *blob = blob_as_sequential(base);
-	errno_t rc;
+	int rc;
 	if (blob->ops->size) {
 		rc = blob->ops->size(blob, size);
@@ -121,5 +121,5 @@
 }
 
-static errno_t sequential_read(bithenge_blob_t *base, aoff64_t offset,
+static int sequential_read(bithenge_blob_t *base, aoff64_t offset,
     char *buffer, aoff64_t *size)
 {
@@ -127,5 +127,5 @@
 	aoff64_t end = offset + *size;
 	if (end > blob->data_size) {
-		errno_t rc = sequential_buffer(blob, end);
+		int rc = sequential_buffer(blob, end);
 		if (rc != EOK)
 			return rc;
@@ -158,5 +158,5 @@
  * @return EOK on success or an error code from errno.h.
  */
-errno_t bithenge_init_sequential_blob(bithenge_sequential_blob_t *blob,
+int bithenge_init_sequential_blob(bithenge_sequential_blob_t *blob,
     const bithenge_sequential_blob_ops_t *ops)
 {
@@ -167,5 +167,5 @@
 	// ops->size is optional
 
-	errno_t rc = bithenge_init_random_access_blob(sequential_as_blob(blob),
+	int rc = bithenge_init_random_access_blob(sequential_as_blob(blob),
 	    &sequential_ops);
 	if (rc != EOK)
@@ -195,5 +195,5 @@
 }
 
-static errno_t memory_size(bithenge_blob_t *base, aoff64_t *size)
+static int memory_size(bithenge_blob_t *base, aoff64_t *size)
 {
 	memory_blob_t *blob = blob_as_memory(base);
@@ -204,5 +204,5 @@
 }
 
-static errno_t memory_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,
+static int memory_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,
     aoff64_t *size)
 {
@@ -240,8 +240,8 @@
  * function fails or the blob is destroyed.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_blob_from_buffer(bithenge_node_t **out, const void *buffer,
+int bithenge_new_blob_from_buffer(bithenge_node_t **out, const void *buffer,
     size_t len, bool needs_free)
 {
-	errno_t rc;
+	int rc;
 	assert(buffer || !len);
 
@@ -278,5 +278,5 @@
  * @param len The length of the data.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_blob_from_data(bithenge_node_t **out, const void *data,
+int bithenge_new_blob_from_data(bithenge_node_t **out, const void *data,
     size_t len)
 {
@@ -309,5 +309,5 @@
 }
 
-static errno_t subblob_size(bithenge_blob_t *base, aoff64_t *size)
+static int subblob_size(bithenge_blob_t *base, aoff64_t *size)
 {
 	subblob_t *blob = blob_as_subblob(base);
@@ -316,5 +316,5 @@
 		return EOK;
 	} else {
-		errno_t rc = bithenge_blob_size(blob->source, size);
+		int rc = bithenge_blob_size(blob->source, size);
 		*size -= blob->offset;
 		return rc;
@@ -322,5 +322,5 @@
 }
 
-static errno_t subblob_read(bithenge_blob_t *base, aoff64_t offset,
+static int subblob_read(bithenge_blob_t *base, aoff64_t offset,
     char *buffer, aoff64_t *size)
 {
@@ -335,5 +335,5 @@
 }
 
-static errno_t subblob_read_bits(bithenge_blob_t *base, aoff64_t offset,
+static int subblob_read_bits(bithenge_blob_t *base, aoff64_t offset,
     char *buffer, aoff64_t *size, bool little_endian)
 {
@@ -368,10 +368,10 @@
 }
 
-static errno_t new_subblob(bithenge_node_t **out, bithenge_blob_t *source,
+static int new_subblob(bithenge_node_t **out, bithenge_blob_t *source,
     aoff64_t offset, aoff64_t size, bool size_matters)
 {
 	assert(out);
 	assert(source);
-	errno_t rc;
+	int rc;
 	subblob_t *blob = 0;
 
@@ -436,5 +436,5 @@
  * @param offset The offset within the input blob at which the new blob will start.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_offset_blob(bithenge_node_t **out, bithenge_blob_t *source,
+int bithenge_new_offset_blob(bithenge_node_t **out, bithenge_blob_t *source,
     aoff64_t offset)
 {
@@ -449,5 +449,5 @@
  * @param size The size of the new blob.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_subblob(bithenge_node_t **out, bithenge_blob_t *source,
+int bithenge_new_subblob(bithenge_node_t **out, bithenge_blob_t *source,
     aoff64_t offset, aoff64_t size)
 {
@@ -461,5 +461,5 @@
  * @return EOK on success, or an error code from errno.h.
  */
-errno_t bithenge_blob_equal(bool *out, bithenge_blob_t *a, bithenge_blob_t *b)
+int bithenge_blob_equal(bool *out, bithenge_blob_t *a, bithenge_blob_t *b)
 {
 	assert(a);
@@ -467,5 +467,5 @@
 	assert(b);
 	assert(b->base.blob_ops);
-	errno_t rc;
+	int rc;
 	char buffer_a[4096], buffer_b[4096];
 	aoff64_t offset = 0, size_a = sizeof(buffer_a), size_b = sizeof(buffer_b);
Index: uspace/lib/bithenge/src/common.h
===================================================================
--- uspace/lib/bithenge/src/common.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/common.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include "failure.h"
 #else
-static inline errno_t bithenge_should_fail(void)
+static inline int bithenge_should_fail(void)
 {
 	return 0;
Index: uspace/lib/bithenge/src/compound.c
===================================================================
--- uspace/lib/bithenge/src/compound.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/compound.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -62,8 +62,8 @@
 }
 
-static errno_t compose_apply(bithenge_transform_t *base, bithenge_scope_t *scope,
+static int compose_apply(bithenge_transform_t *base, bithenge_scope_t *scope,
     bithenge_node_t *in, bithenge_node_t **out)
 {
-	errno_t rc;
+	int rc;
 	compose_transform_t *self = transform_as_compose(base);
 	bithenge_node_inc_ref(in);
@@ -84,5 +84,5 @@
 }
 
-static errno_t compose_prefix_length(bithenge_transform_t *base,
+static int compose_prefix_length(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_blob_t *blob, aoff64_t *out)
 {
@@ -115,5 +115,5 @@
  * @param num The number of transforms.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_composed_transform(bithenge_transform_t **out,
+int bithenge_new_composed_transform(bithenge_transform_t **out,
     bithenge_transform_t **xforms, size_t num)
 {
@@ -126,5 +126,5 @@
 	}
 
-	errno_t rc;
+	int rc;
 	compose_transform_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -168,9 +168,9 @@
 }
 
-static errno_t if_transform_choose(if_transform_t *self, bithenge_scope_t *scope,
+static int if_transform_choose(if_transform_t *self, bithenge_scope_t *scope,
     bool *out)
 {
 	bithenge_node_t *cond_node;
-	errno_t rc = bithenge_expression_evaluate(self->expr, scope, &cond_node);
+	int rc = bithenge_expression_evaluate(self->expr, scope, &cond_node);
 	if (rc != EOK)
 		return rc;
@@ -184,10 +184,10 @@
 }
 
-static errno_t if_transform_apply(bithenge_transform_t *base,
+static int if_transform_apply(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
 {
 	if_transform_t *self = transform_as_if(base);
 	bool cond;
-	errno_t rc = if_transform_choose(self, scope, &cond);
+	int rc = if_transform_choose(self, scope, &cond);
 	if (rc != EOK)
 		return rc;
@@ -196,10 +196,10 @@
 }
 
-static errno_t if_transform_prefix_length(bithenge_transform_t *base,
+static int if_transform_prefix_length(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_blob_t *in, aoff64_t *out)
 {
 	if_transform_t *self = transform_as_if(base);
 	bool cond;
-	errno_t rc = if_transform_choose(self, scope, &cond);
+	int rc = if_transform_choose(self, scope, &cond);
 	if (rc != EOK)
 		return rc;
@@ -231,9 +231,9 @@
  * @param false_xform The transform to apply if the expression is false.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_if_transform(bithenge_transform_t **out,
+int bithenge_if_transform(bithenge_transform_t **out,
     bithenge_expression_t *expr, bithenge_transform_t *true_xform,
     bithenge_transform_t *false_xform)
 {
-	errno_t rc;
+	int rc;
 	if_transform_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -282,5 +282,5 @@
 }
 
-static errno_t partial_transform_apply(bithenge_transform_t *base,
+static int partial_transform_apply(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
 {
@@ -309,8 +309,8 @@
  * @param xform The subtransform to apply.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_partial_transform(bithenge_transform_t **out,
+int bithenge_partial_transform(bithenge_transform_t **out,
     bithenge_transform_t *xform)
 {
-	errno_t rc;
+	int rc;
 	partial_transform_t *self = malloc(sizeof(*self));
 	if (!self) {
Index: uspace/lib/bithenge/src/expression.c
===================================================================
--- uspace/lib/bithenge/src/expression.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/expression.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,5 +48,5 @@
  * @param[in] ops Operations provided by the expression.
  * @return EOK or an error code from errno.h. */
-errno_t bithenge_init_expression(bithenge_expression_t *self,
+int bithenge_init_expression(bithenge_expression_t *self,
     const bithenge_expression_ops_t *ops)
 {
@@ -88,8 +88,8 @@
 }
 
-static errno_t binary_expression_evaluate(bithenge_expression_t *base,
+static int binary_expression_evaluate(bithenge_expression_t *base,
     bithenge_scope_t *scope, bithenge_node_t **out)
 {
-	errno_t rc;
+	int rc;
 	binary_expression_t *self = expression_as_binary(base);
 	bithenge_node_t *a, *b;
@@ -250,9 +250,9 @@
  * @param b The second operand.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_binary_expression(bithenge_expression_t **out,
+int bithenge_binary_expression(bithenge_expression_t **out,
     bithenge_binary_op_t op, bithenge_expression_t *a,
     bithenge_expression_t *b)
 {
-	errno_t rc;
+	int rc;
 	binary_expression_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -283,5 +283,5 @@
 /***************** in_node_expression                        *****************/
 
-static errno_t in_node_evaluate(bithenge_expression_t *self,
+static int in_node_evaluate(bithenge_expression_t *self,
     bithenge_scope_t *scope, bithenge_node_t **out)
 {
@@ -306,5 +306,5 @@
  * @param[out] out Holds the new expression.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_in_node_expression(bithenge_expression_t **out)
+int bithenge_in_node_expression(bithenge_expression_t **out)
 {
 	if (bithenge_should_fail())
@@ -319,5 +319,5 @@
 /***************** current_node_expression                   *****************/
 
-static errno_t current_node_evaluate(bithenge_expression_t *self,
+static int current_node_evaluate(bithenge_expression_t *self,
     bithenge_scope_t *scope, bithenge_node_t **out)
 {
@@ -340,5 +340,5 @@
  * @param[out] out Holds the new expression.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_current_node_expression(bithenge_expression_t **out)
+int bithenge_current_node_expression(bithenge_expression_t **out)
 {
 	bithenge_expression_inc_ref(&current_node_expression);
@@ -368,5 +368,5 @@
 }
 
-static errno_t param_expression_evaluate(bithenge_expression_t *base,
+static int param_expression_evaluate(bithenge_expression_t *base,
     bithenge_scope_t *scope, bithenge_node_t **out)
 {
@@ -390,7 +390,7 @@
  * @param index The index of the parameter to get.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_param_expression(bithenge_expression_t **out, int index)
-{
-	errno_t rc;
+int bithenge_param_expression(bithenge_expression_t **out, int index)
+{
+	int rc;
 	param_expression_t *self = malloc(sizeof(*self));
 	if (!self)
@@ -430,5 +430,5 @@
 }
 
-static errno_t const_expression_evaluate(bithenge_expression_t *base,
+static int const_expression_evaluate(bithenge_expression_t *base,
     bithenge_scope_t *scope, bithenge_node_t **out)
 {
@@ -455,8 +455,8 @@
  * @param node The constant.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_const_expression(bithenge_expression_t **out,
+int bithenge_const_expression(bithenge_expression_t **out,
     bithenge_node_t *node)
 {
-	errno_t rc;
+	int rc;
 	const_expression_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -501,5 +501,5 @@
 }
 
-static errno_t scope_member_expression_evaluate(bithenge_expression_t *base, 
+static int scope_member_expression_evaluate(bithenge_expression_t *base, 
     bithenge_scope_t *scope, bithenge_node_t **out)
 {
@@ -511,5 +511,5 @@
 			continue;
 		bithenge_node_inc_ref(self->key);
-		errno_t rc = bithenge_node_get(cur, self->key, out);
+		int rc = bithenge_node_get(cur, self->key, out);
 		bithenge_node_dec_ref(cur);
 		if (rc != ENOENT) /* EOK or error */
@@ -537,8 +537,8 @@
  * @param key The key to search for in nodes being created.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_scope_member_expression(bithenge_expression_t **out,
+int bithenge_scope_member_expression(bithenge_expression_t **out,
     bithenge_node_t *key)
 {
-	errno_t rc;
+	int rc;
 	scope_member_expression_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -582,10 +582,10 @@
 }
 
-static errno_t subblob_expression_evaluate(bithenge_expression_t *base, 
+static int subblob_expression_evaluate(bithenge_expression_t *base, 
     bithenge_scope_t *scope, bithenge_node_t **out)
 {
 	subblob_expression_t *self = expression_as_subblob(base);
 	bithenge_node_t *start_node;
-	errno_t rc = bithenge_expression_evaluate(self->start, scope, &start_node);
+	int rc = bithenge_expression_evaluate(self->start, scope, &start_node);
 	if (rc != EOK)
 		return rc;
@@ -658,9 +658,9 @@
  * it is relative to the start.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_subblob_expression(bithenge_expression_t **out,
+int bithenge_subblob_expression(bithenge_expression_t **out,
     bithenge_expression_t *blob, bithenge_expression_t *start,
     bithenge_expression_t *limit, bool absolute_limit)
 {
-	errno_t rc;
+	int rc;
 	subblob_expression_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -709,8 +709,8 @@
 }
 
-static errno_t param_wrapper_fill_scope(param_wrapper_t *self, bithenge_scope_t
+static int param_wrapper_fill_scope(param_wrapper_t *self, bithenge_scope_t
     *inner, bithenge_scope_t *outer)
 {
-	errno_t rc;
+	int rc;
 	int num_params = bithenge_transform_num_params(self->transform);
 	rc = bithenge_scope_alloc_params(inner, num_params);
@@ -730,10 +730,10 @@
 }
 
-static errno_t param_wrapper_apply(bithenge_transform_t *base,
+static int param_wrapper_apply(bithenge_transform_t *base,
     bithenge_scope_t *outer, bithenge_node_t *in, bithenge_node_t **out)
 {
 	param_wrapper_t *self = transform_as_param_wrapper(base);
 	bithenge_scope_t *inner;
-	errno_t rc = bithenge_scope_new(&inner, outer);
+	int rc = bithenge_scope_new(&inner, outer);
 	if (rc != EOK)
 		return rc;
@@ -750,10 +750,10 @@
 }
 
-static errno_t param_wrapper_prefix_length(bithenge_transform_t *base,
+static int param_wrapper_prefix_length(bithenge_transform_t *base,
     bithenge_scope_t *outer, bithenge_blob_t *in, aoff64_t *out)
 {
 	param_wrapper_t *self = transform_as_param_wrapper(base);
 	bithenge_scope_t *inner;
-	errno_t rc = bithenge_scope_new(&inner, outer);
+	int rc = bithenge_scope_new(&inner, outer);
 	if (rc != EOK)
 		return rc;
@@ -770,5 +770,5 @@
 }
 
-static errno_t param_wrapper_prefix_apply(bithenge_transform_t *base,
+static int param_wrapper_prefix_apply(bithenge_transform_t *base,
     bithenge_scope_t *outer, bithenge_blob_t *in, bithenge_node_t **out_node,
     aoff64_t *out_length)
@@ -776,5 +776,5 @@
 	param_wrapper_t *self = transform_as_param_wrapper(base);
 	bithenge_scope_t *inner;
-	errno_t rc = bithenge_scope_new(&inner, outer);
+	int rc = bithenge_scope_new(&inner, outer);
 	if (rc != EOK)
 		return rc;
@@ -816,8 +816,8 @@
  * @param params The expressions used to calculate the parameters.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_param_wrapper(bithenge_transform_t **out,
+int bithenge_param_wrapper(bithenge_transform_t **out,
     bithenge_transform_t *transform, bithenge_expression_t **params)
 {
-	errno_t rc;
+	int rc;
 	int num_params = bithenge_transform_num_params(transform);
 	param_wrapper_t *self = malloc(sizeof(*self));
@@ -868,10 +868,10 @@
 }
 
-static errno_t expression_transform_apply(bithenge_transform_t *base,
+static int expression_transform_apply(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
 {
 	expression_transform_t *self = transform_as_expression(base);
 	bithenge_scope_t *inner;
-	errno_t rc = bithenge_scope_new(&inner, scope);
+	int rc = bithenge_scope_new(&inner, scope);
 	if (rc != EOK)
 		return rc;
@@ -900,8 +900,8 @@
  * @param expr The expression to evaluate.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_expression_transform(bithenge_transform_t ** out,
+int bithenge_expression_transform(bithenge_transform_t ** out,
     bithenge_expression_t *expr)
 {
-	errno_t rc;
+	int rc;
 	expression_transform_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -929,5 +929,5 @@
 /***************** inputless_transform            *****************/
 
-static errno_t inputless_transform_prefix_length(bithenge_transform_t *base,
+static int inputless_transform_prefix_length(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_blob_t *in, aoff64_t *out)
 {
@@ -936,5 +936,5 @@
 }
 
-static errno_t inputless_transform_prefix_apply(bithenge_transform_t *base,
+static int inputless_transform_prefix_apply(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_blob_t *in, bithenge_node_t **out_node,
     aoff64_t *out_size)
@@ -957,8 +957,8 @@
  * @param expr The expression to evaluate.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_inputless_transform(bithenge_transform_t ** out,
+int bithenge_inputless_transform(bithenge_transform_t ** out,
     bithenge_expression_t *expr)
 {
-	errno_t rc;
+	int rc;
 	expression_transform_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -1004,10 +1004,10 @@
 }
 
-static errno_t concat_blob_evaluate_b(concat_blob_t *self)
+static int concat_blob_evaluate_b(concat_blob_t *self)
 {
 	if (self->b)
 		return EOK;
 	bithenge_node_t *b_node;
-	errno_t rc = bithenge_expression_evaluate(self->b_expr, self->scope,
+	int rc = bithenge_expression_evaluate(self->b_expr, self->scope,
 	    &b_node);
 	if (rc != EOK)
@@ -1026,8 +1026,8 @@
 }
 
-static errno_t concat_blob_size(bithenge_blob_t *base, aoff64_t *size)
+static int concat_blob_size(bithenge_blob_t *base, aoff64_t *size)
 {
 	concat_blob_t *self = blob_as_concat(base);
-	errno_t rc = concat_blob_evaluate_b(self);
+	int rc = concat_blob_evaluate_b(self);
 	if (rc != EOK)
 		return rc;
@@ -1037,8 +1037,8 @@
 }
 
-static errno_t concat_blob_read(bithenge_blob_t *base, aoff64_t offset,
+static int concat_blob_read(bithenge_blob_t *base, aoff64_t offset,
     char *buffer, aoff64_t *size)
 {
-	errno_t rc;
+	int rc;
 	concat_blob_t *self = blob_as_concat(base);
 
@@ -1065,8 +1065,8 @@
 }
 
-static errno_t concat_blob_read_bits(bithenge_blob_t *base, aoff64_t offset,
+static int concat_blob_read_bits(bithenge_blob_t *base, aoff64_t offset,
     char *buffer, aoff64_t *size, bool little_endian)
 {
-	errno_t rc;
+	int rc;
 	concat_blob_t *self = blob_as_concat(base);
 
@@ -1118,5 +1118,5 @@
  * @param b The second blob.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_concat_blob(bithenge_node_t **out, bithenge_blob_t *a,
+int bithenge_concat_blob(bithenge_node_t **out, bithenge_blob_t *a,
     bithenge_blob_t *b)
 {
@@ -1124,5 +1124,5 @@
 	assert(a);
 	assert(b);
-	errno_t rc;
+	int rc;
 	concat_blob_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -1160,5 +1160,5 @@
  * @param scope The scope in which @a b_expr should be evaluated.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_concat_blob_lazy(bithenge_node_t **out, bithenge_blob_t *a,
+int bithenge_concat_blob_lazy(bithenge_node_t **out, bithenge_blob_t *a,
     bithenge_expression_t *b_expr, bithenge_scope_t *scope)
 {
@@ -1167,5 +1167,5 @@
 	assert(b_expr);
 	assert(scope);
-	errno_t rc;
+	int rc;
 	concat_blob_t *self = malloc(sizeof(*self));
 	if (!self) {
Index: uspace/lib/bithenge/src/failure.c
===================================================================
--- uspace/lib/bithenge/src/failure.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/failure.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -85,5 +85,5 @@
 {
 	g_initialized = 1;
-	errno_t rc = atexit(atexit_handler);
+	int rc = atexit(atexit_handler);
 	if (rc)
 		exit(127);
@@ -96,5 +96,5 @@
 /* Record a hit for a backtrace address and return whether this is the first
  * hit. */
-static inline errno_t backtrace_item_hit(void *addr)
+static inline int backtrace_item_hit(void *addr)
 {
 	backtrace_item_t **bip;
@@ -120,5 +120,5 @@
 }
 
-errno_t bithenge_should_fail(void)
+int bithenge_should_fail(void)
 {
 	g_failure_index++;
@@ -202,5 +202,5 @@
 }
 
-errno_t bithenge_failure_ferror(FILE *stream)
+int bithenge_failure_ferror(FILE *stream)
 {
 	if (bithenge_should_fail())
@@ -216,5 +216,5 @@
 }
 
-errno_t bithenge_failure_open(const char *pathname, int flags)
+int bithenge_failure_open(const char *pathname, int flags)
 {
 	if (bithenge_should_fail()) {
@@ -225,5 +225,5 @@
 }
 
-errno_t bithenge_failure_fstat(int fd, vfs_stat_t *buf)
+int bithenge_failure_fstat(int fd, struct stat *buf)
 {
 	if (bithenge_should_fail()) {
Index: uspace/lib/bithenge/src/failure.h
===================================================================
--- uspace/lib/bithenge/src/failure.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/failure.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,13 +44,13 @@
 #include <stddef.h>
 
-errno_t bithenge_should_fail(void);
+int bithenge_should_fail(void);
 void *bithenge_failure_malloc(size_t);
 void *bithenge_failure_realloc(void *, size_t);
 ssize_t bithenge_failure_read(int, void *, size_t);
 off_t bithenge_failure_lseek(int, off_t, int);
-errno_t bithenge_failure_ferror(FILE *);
+int bithenge_failure_ferror(FILE *);
 char *bithenge_failure_str_ndup(const char *, size_t);
-errno_t bithenge_failure_open(const char *, int);
-errno_t bithenge_failure_fstat(int, vfs_stat_t *);
+int bithenge_failure_open(const char *, int);
+int bithenge_failure_fstat(int, struct stat *);
 
 #ifndef BITHENGE_FAILURE_DECLS_ONLY
Index: uspace/lib/bithenge/src/file.c
===================================================================
--- uspace/lib/bithenge/src/file.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/file.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -63,5 +63,5 @@
 }
 
-static errno_t file_size(bithenge_blob_t *base, aoff64_t *size)
+static int file_size(bithenge_blob_t *base, aoff64_t *size)
 {
 	file_blob_t *blob = blob_as_file(base);
@@ -70,5 +70,5 @@
 }
 
-static errno_t file_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,
+static int file_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,
     aoff64_t *size)
 {
@@ -78,5 +78,5 @@
 
 	size_t amount_read;
-	errno_t rc = vfs_read(blob->fd, &offset, buffer, *size, &amount_read);
+	int rc = vfs_read(blob->fd, &offset, buffer, *size, &amount_read);
 	if (rc != EOK)
 		return errno;
@@ -98,10 +98,10 @@
 };
 
-static errno_t new_file_blob(bithenge_node_t **out, int fd, bool needs_close)
+static int new_file_blob(bithenge_node_t **out, int fd, bool needs_close)
 {
 	assert(out);
 
-	vfs_stat_t stat;
-	errno_t rc = vfs_stat(fd, &stat);
+	struct stat stat;
+	int rc = vfs_stat(fd, &stat);
 	if (rc != EOK) {
 		if (needs_close)
@@ -141,12 +141,11 @@
  * @param filename The name of the file.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_file_blob(bithenge_node_t **out, const char *filename)
+int bithenge_new_file_blob(bithenge_node_t **out, const char *filename)
 {
 	assert(filename);
 
-	int fd;
-	errno_t rc = vfs_lookup_open(filename, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK)
-		return rc;
+	int fd = vfs_lookup_open(filename, WALK_REGULAR, MODE_READ);
+	if (fd < 0)
+		return errno;
 
 	return new_file_blob(out, fd, true);
@@ -158,5 +157,5 @@
  * @param fd The file descriptor.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_file_blob_from_fd(bithenge_node_t **out, int fd)
+int bithenge_new_file_blob_from_fd(bithenge_node_t **out, int fd)
 {
 	return new_file_blob(out, fd, false);
@@ -168,5 +167,5 @@
  * @param file The file pointer.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_file_blob_from_file(bithenge_node_t **out, FILE *file)
+int bithenge_new_file_blob_from_file(bithenge_node_t **out, FILE *file)
 {
 	int fd = fileno(file);
Index: uspace/lib/bithenge/src/helenos/block.c
===================================================================
--- uspace/lib/bithenge/src/helenos/block.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/helenos/block.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,5 +61,5 @@
 }
 
-static errno_t block_size(bithenge_blob_t *base, aoff64_t *size)
+static int block_size(bithenge_blob_t *base, aoff64_t *size)
 {
 	block_blob_t *self = blob_as_block(base);
@@ -68,5 +68,5 @@
 }
 
-static errno_t block_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,
+static int block_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,
     aoff64_t *size)
 {
@@ -96,10 +96,10 @@
  * @param service_id The service ID of the block device.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_block_blob(bithenge_node_t **out, service_id_t service_id)
+int bithenge_new_block_blob(bithenge_node_t **out, service_id_t service_id)
 {
 	assert(out);
 
 	// Initialize libblock
-	errno_t rc;
+	int rc;
 	rc = block_init(service_id, 2048);
 	if (rc != EOK)
Index: uspace/lib/bithenge/src/helenos/block.h
===================================================================
--- uspace/lib/bithenge/src/helenos/block.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/helenos/block.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 #include <bithenge/tree.h>
 
-errno_t bithenge_new_block_blob(bithenge_node_t **, service_id_t);
+int bithenge_new_block_blob(bithenge_node_t **, service_id_t);
 
 #endif
Index: uspace/lib/bithenge/src/helenos/common.h
===================================================================
--- uspace/lib/bithenge/src/helenos/common.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/helenos/common.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -64,5 +64,5 @@
 }
 
-static inline errno_t string_iterator_next(string_iterator_t *i, wchar_t *out)
+static inline int string_iterator_next(string_iterator_t *i, wchar_t *out)
 {
 	*out = i->ch;
@@ -81,9 +81,9 @@
 }
 
-static inline errno_t bithenge_parse_int(const char *start, bithenge_int_t *result)
+static inline int bithenge_parse_int(const char *start, bithenge_int_t *result)
 {
 	const char *real_start = *start == '-' ? start + 1 : start;
 	uint64_t val;
-	errno_t rc = str_uint64_t(real_start, NULL, 10, false, &val);
+	int rc = str_uint64_t(real_start, NULL, 10, false, &val);
 	*result = val;
 	if (*start == '-')
Index: uspace/lib/bithenge/src/linux/common.h
===================================================================
--- uspace/lib/bithenge/src/linux/common.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/linux/common.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,5 +55,5 @@
 }
 
-static inline errno_t string_iterator_next(string_iterator_t *i, wchar_t *out)
+static inline int string_iterator_next(string_iterator_t *i, wchar_t *out)
 {
 	wint_t rc = btowc(*(*i)++); // TODO
@@ -82,5 +82,5 @@
 }
 
-static inline errno_t str_lcmp(const char *s1, const char *s2, size_t max_len)
+static inline int str_lcmp(const char *s1, const char *s2, size_t max_len)
 {
 	return strncmp(s1, s2, max_len);
@@ -132,5 +132,5 @@
 }
 
-static inline errno_t bithenge_parse_int(const char *start, bithenge_int_t *result)
+static inline int bithenge_parse_int(const char *start, bithenge_int_t *result)
 {
 	errno = 0;
Index: uspace/lib/bithenge/src/print.c
===================================================================
--- uspace/lib/bithenge/src/print.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/print.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -73,5 +73,5 @@
 }
 
-static errno_t print_node(state_t *, bithenge_node_t *);
+static int print_node(state_t *, bithenge_node_t *);
 
 static void newline(state_t *state)
@@ -93,8 +93,8 @@
 }
 
-static errno_t print_internal_func(bithenge_node_t *key, bithenge_node_t *value, void *data)
+static int print_internal_func(bithenge_node_t *key, bithenge_node_t *value, void *data)
 {
 	state_t *state = (state_t *)data;
-	errno_t rc = EOK;
+	int rc = EOK;
 	if (!state->first)
 		state_printf(state, ",");
@@ -120,7 +120,7 @@
 }
 
-static errno_t print_internal(state_t *state, bithenge_node_t *node)
-{
-	errno_t rc;
+static int print_internal(state_t *state, bithenge_node_t *node)
+{
+	int rc;
 	state_printf(state, "{");
 	increase_depth(state);
@@ -137,5 +137,5 @@
 }
 
-static errno_t print_boolean(state_t *state, bithenge_node_t *node)
+static int print_boolean(state_t *state, bithenge_node_t *node)
 {
 	bool value = bithenge_boolean_node_value(node);
@@ -151,5 +151,5 @@
 }
 
-static errno_t print_integer(state_t *state, bithenge_node_t *node)
+static int print_integer(state_t *state, bithenge_node_t *node)
 {
 	bithenge_int_t value = bithenge_integer_node_value(node);
@@ -158,5 +158,5 @@
 }
 
-static errno_t print_string(state_t *state, bithenge_node_t *node)
+static int print_string(state_t *state, bithenge_node_t *node)
 {
 	const char *value = bithenge_string_node_value(node);
@@ -164,5 +164,5 @@
 	for (string_iterator_t i = string_iterator(value); !string_iterator_done(&i); ) {
 		wchar_t ch;
-		errno_t rc = string_iterator_next(&i, &ch);
+		int rc = string_iterator_next(&i, &ch);
 		if (rc != EOK)
 			return rc;
@@ -179,5 +179,5 @@
 }
 
-static errno_t print_blob(state_t *state, bithenge_node_t *node)
+static int print_blob(state_t *state, bithenge_node_t *node)
 {
 	bithenge_blob_t *blob = bithenge_node_as_blob(node);
@@ -185,5 +185,5 @@
 	uint8_t buffer[1024];
 	aoff64_t size = sizeof(buffer);
-	errno_t rc;
+	int rc;
 	state_printf(state,
 	    state->type == BITHENGE_PRINT_PYTHON ? "b\"" : "\"");
@@ -201,5 +201,5 @@
 }
 
-static errno_t print_node(state_t *state, bithenge_node_t *tree)
+static int print_node(state_t *state, bithenge_node_t *tree)
 {
 	switch (bithenge_node_type(tree)) {
@@ -222,5 +222,5 @@
  * @param tree The root node of the tree to print.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_print_node(bithenge_print_type_t type, bithenge_node_t *tree)
+int bithenge_print_node(bithenge_print_type_t type, bithenge_node_t *tree)
 {
 	state_t state = {type, true, 0, NULL, 0};
@@ -236,9 +236,9 @@
  * @param tree The root node of the tree to print.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_print_node_to_string(char **str, size_t *size,
+int bithenge_print_node_to_string(char **str, size_t *size,
     bithenge_print_type_t type, bithenge_node_t *tree)
 {
 	state_t state = {type, true, 0, *str, *size};
-	errno_t rc = print_node(&state, tree);
+	int rc = print_node(&state, tree);
 	*str = state.buffer;
 	*size = state.buffer_size;
Index: uspace/lib/bithenge/src/script.c
===================================================================
--- uspace/lib/bithenge/src/script.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/script.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -99,5 +99,5 @@
 	/** Rather than constantly checking return values, the parser uses this
 	 * to indicate whether an error has occurred. */
-	errno_t error;
+	int error;
 
 	/** The list of named transforms. */
@@ -148,5 +148,5 @@
 
 /** Note that an error has occurred if error is not EOK. */
-static void error_errno(state_t *state, errno_t error)
+static void error_errno(state_t *state, int error)
 {
 	// Don't overwrite a previous error.
@@ -276,5 +276,5 @@
 			state->buffer_pos++;
 		state->token = TOKEN_INTEGER;
-		errno_t rc = bithenge_parse_int(state->buffer +
+		int rc = bithenge_parse_int(state->buffer +
 		    state->old_buffer_pos, &state->token_int);
 		error_errno(state, rc);
@@ -520,5 +520,5 @@
 static bithenge_expression_t *parse_term(state_t *state)
 {
-	errno_t rc;
+	int rc;
 	if (state->token == TOKEN_TRUE || state->token == TOKEN_FALSE) {
 		bool val = state->token == TOKEN_TRUE;
@@ -630,5 +630,5 @@
 static bithenge_expression_t *parse_postfix_expression(state_t *state)
 {
-	errno_t rc;
+	int rc;
 	bithenge_expression_t *expr = parse_term(state);
 	while (state->error == EOK) {
@@ -737,5 +737,5 @@
 			break;
 		}
-		errno_t rc = bithenge_binary_expression(&expr, op, expr, expr2);
+		int rc = bithenge_binary_expression(&expr, op, expr, expr2);
 		if (rc != EOK) {
 			expr = NULL;
@@ -797,5 +797,5 @@
 
 	if (num_params) {
-		errno_t rc = bithenge_param_wrapper(&result, result, params);
+		int rc = bithenge_param_wrapper(&result, result, params);
 		if (rc != EOK) {
 			error_errno(state, rc);
@@ -813,5 +813,5 @@
 {
 	bithenge_node_t *node;
-	errno_t rc = bithenge_new_empty_internal_node(&node);
+	int rc = bithenge_new_empty_internal_node(&node);
 	if (rc != EOK) {
 		error_errno(state, rc);
@@ -869,5 +869,5 @@
 
 	bithenge_transform_t *if_xform;
-	errno_t rc = bithenge_if_transform(&if_xform, expr, true_xform,
+	int rc = bithenge_if_transform(&if_xform, expr, true_xform,
 	    false_xform);
 	if (rc != EOK) {
@@ -893,5 +893,5 @@
 			next_token(state);
 			bithenge_node_t *node;
-			errno_t rc = bithenge_new_boolean_node(&node, true);
+			int rc = bithenge_new_boolean_node(&node, true);
 			if (rc != EOK) {
 				error_errno(state, rc);
@@ -907,5 +907,5 @@
 			if (state->error == EOK) {
 				bithenge_expression_inc_ref(ref_expr);
-				errno_t rc = bithenge_binary_expression(&expr,
+				int rc = bithenge_binary_expression(&expr,
 				    BITHENGE_EXPRESSION_EQUALS, ref_expr,
 				    expr);
@@ -947,5 +947,5 @@
 	while (state->error == EOK && num >= 1) {
 		num--;
-		errno_t rc = bithenge_if_transform(&switch_xform, exprs[num],
+		int rc = bithenge_if_transform(&switch_xform, exprs[num],
 		    xforms[num], switch_xform);
 		if (rc != EOK) {
@@ -987,5 +987,5 @@
 
 	bithenge_transform_t *repeat_xform;
-	errno_t rc = bithenge_repeat_transform(&repeat_xform, xform, expr);
+	int rc = bithenge_repeat_transform(&repeat_xform, xform, expr);
 	if (rc != EOK) {
 		error_errno(state, rc);
@@ -1013,5 +1013,5 @@
 
 	bithenge_transform_t *do_while_xform;
-	errno_t rc = bithenge_do_while_transform(&do_while_xform, xform, expr);
+	int rc = bithenge_do_while_transform(&do_while_xform, xform, expr);
 	if (rc != EOK) {
 		error_errno(state, rc);
@@ -1031,5 +1031,5 @@
 
 		bithenge_expression_t *in_expr;
-		errno_t rc = bithenge_in_node_expression(&in_expr);
+		int rc = bithenge_in_node_expression(&in_expr);
 		if (rc != EOK)
 			error_errno(state, rc);
@@ -1061,5 +1061,5 @@
 	}
 
-	errno_t rc = bithenge_partial_transform(&xform, xform);
+	int rc = bithenge_partial_transform(&xform, xform);
 	if (rc != EOK) {
 		error_errno(state, rc);
@@ -1130,5 +1130,5 @@
 	subxforms[num].transform = NULL;
 	bithenge_transform_t *result;
-	errno_t rc = bithenge_new_struct(&result, subxforms);
+	int rc = bithenge_new_struct(&result, subxforms);
 	if (rc != EOK) {
 		error_errno(state, rc);
@@ -1153,5 +1153,5 @@
 
 		bithenge_transform_t *xform;
-		errno_t rc;
+		int rc;
 		if (state->in_node_used)
 			rc = bithenge_expression_transform(&xform, expr);
@@ -1211,5 +1211,5 @@
 	if (xforms) {
 		xforms[0] = result;
-		errno_t rc = bithenge_new_composed_transform(&result, xforms, num);
+		int rc = bithenge_new_composed_transform(&result, xforms, num);
 		if (rc != EOK) {
 			error_errno(state, rc);
@@ -1244,5 +1244,5 @@
 	bithenge_transform_t *barrier = NULL;
 	if (state->error == EOK) {
-		errno_t rc = bithenge_new_barrier_transform(&barrier,
+		int rc = bithenge_new_barrier_transform(&barrier,
 		    state->num_params);
 		if (rc != EOK) {
@@ -1259,5 +1259,5 @@
 
 	if (state->error == EOK) {
-		errno_t rc = bithenge_barrier_transform_set_subtransform(barrier,
+		int rc = bithenge_barrier_transform_set_subtransform(barrier,
 		    xform);
 		xform = NULL;
@@ -1321,5 +1321,5 @@
  * @return EOK on success, EINVAL on syntax error, or an error code from
  * errno.h. */
-errno_t bithenge_parse_script(const char *filename, bithenge_transform_t **out)
+int bithenge_parse_script(const char *filename, bithenge_transform_t **out)
 {
 	state_t state;
@@ -1328,5 +1328,5 @@
 		parse_definition(&state);
 	*out = get_named_transform(&state, "main");
-	errno_t rc = state.error;
+	int rc = state.error;
 	state_destroy(&state);
 	if (rc == EOK && !*out) {
Index: uspace/lib/bithenge/src/sequence.c
===================================================================
--- uspace/lib/bithenge/src/sequence.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/sequence.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,5 +58,5 @@
 
 typedef struct seq_node_ops {
-	errno_t (*get_transform)(seq_node_t *self, bithenge_transform_t **out,
+	int (*get_transform)(seq_node_t *self, bithenge_transform_t **out,
 	    bithenge_int_t index);
 } seq_node_ops_t;
@@ -72,5 +72,5 @@
 }
 
-static errno_t seq_node_field_offset(seq_node_t *self, aoff64_t *out, size_t index)
+static int seq_node_field_offset(seq_node_t *self, aoff64_t *out, size_t index)
 {
 	if (index == 0) {
@@ -83,5 +83,5 @@
 	for (; self->num_ends <= index; self->num_ends++) {
 		bithenge_transform_t *subxform;
-		errno_t rc = self->ops->get_transform(self, &subxform,
+		int rc = self->ops->get_transform(self, &subxform,
 		    self->num_ends);
 		if (rc != EOK)
@@ -136,9 +136,9 @@
 }
 
-static errno_t seq_node_subtransform(seq_node_t *self, bithenge_node_t **out,
+static int seq_node_subtransform(seq_node_t *self, bithenge_node_t **out,
     size_t index)
 {
 	aoff64_t start_pos;
-	errno_t rc = seq_node_field_offset(self, &start_pos, index);
+	int rc = seq_node_field_offset(self, &start_pos, index);
 	if (rc != EOK)
 		return rc;
@@ -194,5 +194,5 @@
 	} else {
 		aoff64_t end_pos;
-		errno_t rc = seq_node_field_offset(self, &end_pos, index + 1);
+		int rc = seq_node_field_offset(self, &end_pos, index + 1);
 		if (rc != EOK) {
 			bithenge_transform_dec_ref(subxform);
@@ -220,8 +220,8 @@
 }
 
-static errno_t seq_node_complete(seq_node_t *self, bool *out)
+static int seq_node_complete(seq_node_t *self, bool *out)
 {
 	aoff64_t blob_size, end_pos;
-	errno_t rc = bithenge_blob_size(self->blob, &blob_size);
+	int rc = bithenge_blob_size(self->blob, &blob_size);
 	if (rc != EOK)
 		return rc;
@@ -251,5 +251,5 @@
 }
 
-static errno_t seq_node_init(seq_node_t *self, const seq_node_ops_t *ops,
+static int seq_node_init(seq_node_t *self, const seq_node_ops_t *ops,
     bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_int_t num_xforms,
     bool end_on_empty)
@@ -319,8 +319,8 @@
 }
 
-static errno_t struct_node_for_each(bithenge_node_t *base,
+static int struct_node_for_each(bithenge_node_t *base,
     bithenge_for_each_func_t func, void *data)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	struct_node_t *self = node_as_struct(base);
 	bithenge_named_transform_t *subxforms =
@@ -368,10 +368,10 @@
 }
 
-static errno_t struct_node_get(bithenge_node_t *base, bithenge_node_t *key,
+static int struct_node_get(bithenge_node_t *base, bithenge_node_t *key,
     bithenge_node_t **out)
 {
 	struct_node_t *self = node_as_struct(base);
 
-	errno_t rc = ENOENT;
+	int rc = ENOENT;
 	if (bithenge_node_type(key) != BITHENGE_NODE_STRING)
 		goto end;
@@ -455,5 +455,5 @@
 };
 
-static errno_t struct_node_get_transform(seq_node_t *base,
+static int struct_node_get_transform(seq_node_t *base,
     bithenge_transform_t **out, bithenge_int_t index)
 {
@@ -468,5 +468,5 @@
 };
 
-static errno_t struct_transform_make_node(struct_transform_t *self,
+static int struct_transform_make_node(struct_transform_t *self,
     bithenge_node_t **out, bithenge_scope_t *scope, bithenge_blob_t *blob,
     bool prefix)
@@ -476,5 +476,5 @@
 		return ENOMEM;
 
-	errno_t rc = bithenge_init_internal_node(struct_as_node(node),
+	int rc = bithenge_init_internal_node(struct_as_node(node),
 	    &struct_node_ops);
 	if (rc != EOK) {
@@ -513,5 +513,5 @@
 }
 
-static errno_t struct_transform_apply(bithenge_transform_t *base,
+static int struct_transform_apply(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
 {
@@ -523,10 +523,10 @@
 }
 
-static errno_t struct_transform_prefix_length(bithenge_transform_t *base,
+static int struct_transform_prefix_length(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_blob_t *blob, aoff64_t *out)
 {
 	struct_transform_t *self = transform_as_struct(base);
 	bithenge_node_t *struct_node;
-	errno_t rc = struct_transform_make_node(self, &struct_node, scope, blob,
+	int rc = struct_transform_make_node(self, &struct_node, scope, blob,
 	    true);
 	if (rc != EOK)
@@ -539,10 +539,10 @@
 }
 
-static errno_t struct_transform_prefix_apply(bithenge_transform_t *base,
+static int struct_transform_prefix_apply(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
     aoff64_t *out_size)
 {
 	struct_transform_t *self = transform_as_struct(base);
-	errno_t rc = struct_transform_make_node(self, out_node, scope, blob,
+	int rc = struct_transform_make_node(self, out_node, scope, blob,
 	    true);
 	if (rc != EOK)
@@ -592,8 +592,8 @@
  * @param subtransforms The subtransforms and field names.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_struct(bithenge_transform_t **out,
+int bithenge_new_struct(bithenge_transform_t **out,
     bithenge_named_transform_t *subtransforms)
 {
-	errno_t rc;
+	int rc;
 	struct_transform_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -669,8 +669,8 @@
 }
 
-static errno_t repeat_node_for_each(bithenge_node_t *base,
+static int repeat_node_for_each(bithenge_node_t *base,
     bithenge_for_each_func_t func, void *data)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	repeat_node_t *self = node_as_repeat(base);
 
@@ -712,5 +712,5 @@
 }
 
-static errno_t repeat_node_get(bithenge_node_t *base, bithenge_node_t *key,
+static int repeat_node_get(bithenge_node_t *base, bithenge_node_t *key,
     bithenge_node_t **out)
 {
@@ -743,5 +743,5 @@
 };
 
-static errno_t repeat_node_get_transform(seq_node_t *base,
+static int repeat_node_get_transform(seq_node_t *base,
     bithenge_transform_t **out, bithenge_int_t index)
 {
@@ -756,5 +756,5 @@
 };
 
-static errno_t repeat_transform_make_node(repeat_transform_t *self,
+static int repeat_transform_make_node(repeat_transform_t *self,
     bithenge_node_t **out, bithenge_scope_t *scope, bithenge_blob_t *blob,
     bool prefix)
@@ -763,5 +763,5 @@
 	if (self->expr != NULL) {
 		bithenge_node_t *count_node;
-		errno_t rc = bithenge_expression_evaluate(self->expr, scope,
+		int rc = bithenge_expression_evaluate(self->expr, scope,
 		    &count_node);
 		if (rc != EOK)
@@ -781,5 +781,5 @@
 		return ENOMEM;
 
-	errno_t rc = bithenge_init_internal_node(repeat_as_node(node),
+	int rc = bithenge_init_internal_node(repeat_as_node(node),
 	    &repeat_node_ops);
 	if (rc != EOK) {
@@ -803,5 +803,5 @@
 }
 
-static errno_t repeat_transform_apply(bithenge_transform_t *base,
+static int repeat_transform_apply(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
 {
@@ -813,10 +813,10 @@
 }
 
-static errno_t repeat_transform_prefix_apply(bithenge_transform_t *base,
+static int repeat_transform_prefix_apply(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
     aoff64_t *out_size)
 {
 	repeat_transform_t *self = transform_as_repeat(base);
-	errno_t rc = repeat_transform_make_node(self, out_node, scope, blob, true);
+	int rc = repeat_transform_make_node(self, out_node, scope, blob, true);
 	if (rc != EOK)
 		return rc;
@@ -871,8 +871,8 @@
  * May be NULL, in which case @a xform will be applied indefinitely.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_repeat_transform(bithenge_transform_t **out,
+int bithenge_repeat_transform(bithenge_transform_t **out,
     bithenge_transform_t *xform, bithenge_expression_t *expr)
 {
-	errno_t rc;
+	int rc;
 	repeat_transform_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -947,8 +947,8 @@
 }
 
-static errno_t do_while_node_for_each(bithenge_node_t *base,
+static int do_while_node_for_each(bithenge_node_t *base,
     bithenge_for_each_func_t func, void *data)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	do_while_node_t *self = node_as_do_while(base);
 
@@ -1018,5 +1018,5 @@
 };
 
-static errno_t do_while_node_get_transform(seq_node_t *base,
+static int do_while_node_get_transform(seq_node_t *base,
     bithenge_transform_t **out, bithenge_int_t index)
 {
@@ -1031,5 +1031,5 @@
 };
 
-static errno_t do_while_transform_make_node(do_while_transform_t *self,
+static int do_while_transform_make_node(do_while_transform_t *self,
     bithenge_node_t **out, bithenge_scope_t *scope, bithenge_blob_t *blob)
 {
@@ -1038,5 +1038,5 @@
 		return ENOMEM;
 
-	errno_t rc = bithenge_init_internal_node(do_while_as_node(node),
+	int rc = bithenge_init_internal_node(do_while_as_node(node),
 	    &do_while_node_ops);
 	if (rc != EOK) {
@@ -1061,5 +1061,5 @@
 }
 
-static errno_t for_each_noop(bithenge_node_t *key, bithenge_node_t *value,
+static int for_each_noop(bithenge_node_t *key, bithenge_node_t *value,
     void *data)
 {
@@ -1069,10 +1069,10 @@
 }
 
-static errno_t do_while_transform_prefix_apply(bithenge_transform_t *base,
+static int do_while_transform_prefix_apply(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
     aoff64_t *out_size)
 {
 	do_while_transform_t *self = transform_as_do_while(base);
-	errno_t rc = do_while_transform_make_node(self, out_node, scope, blob);
+	int rc = do_while_transform_make_node(self, out_node, scope, blob);
 	if (rc != EOK)
 		return rc;
@@ -1116,8 +1116,8 @@
  * determine whether there will be more.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_do_while_transform(bithenge_transform_t **out,
+int bithenge_do_while_transform(bithenge_transform_t **out,
     bithenge_transform_t *xform, bithenge_expression_t *expr)
 {
-	errno_t rc;
+	int rc;
 	do_while_transform_t *self = malloc(sizeof(*self));
 	if (!self) {
Index: uspace/lib/bithenge/src/source.c
===================================================================
--- uspace/lib/bithenge/src/source.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/source.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,5 +58,5 @@
 }
 
-static errno_t blob_from_hex(bithenge_node_t **out, const char *hex)
+static int blob_from_hex(bithenge_node_t **out, const char *hex)
 {
 	size_t size = str_length(hex);
@@ -85,5 +85,5 @@
  * @param source Specifies the node to be created.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_node_from_source(bithenge_node_t **out, const char *source)
+int bithenge_node_from_source(bithenge_node_t **out, const char *source)
 {
 	if (str_chr(source, ':')) {
@@ -95,5 +95,5 @@
 			// Example: block:bd/initrd
 			service_id_t service_id;
-			errno_t rc = loc_service_get_id(source + 6, &service_id, 0);
+			int rc = loc_service_get_id(source + 6, &service_id, 0);
 			if (rc != EOK)
 				return rc;
Index: uspace/lib/bithenge/src/transform.c
===================================================================
--- uspace/lib/bithenge/src/transform.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/transform.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,5 +57,5 @@
  * within.
  * @return EOK or an error code from errno.h. */
-errno_t bithenge_init_transform(bithenge_transform_t *self,
+int bithenge_init_transform(bithenge_transform_t *self,
     const bithenge_transform_ops_t *ops, int num_params)
 {
@@ -83,5 +83,5 @@
  * @param[out] out Where the output tree will be stored.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_transform_apply(bithenge_transform_t *self,
+int bithenge_transform_apply(bithenge_transform_t *self,
     bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
 {
@@ -94,5 +94,5 @@
 		return EINVAL;
 	aoff64_t self_size, whole_size;
-	errno_t rc = bithenge_transform_prefix_apply(self, scope,
+	int rc = bithenge_transform_prefix_apply(self, scope,
 	    bithenge_node_as_blob(in), out, &self_size);
 	if (rc != EOK)
@@ -119,5 +119,5 @@
  * @return EOK on success, ENOTSUP if not supported, or another error code from
  * errno.h. */
-errno_t bithenge_transform_prefix_length(bithenge_transform_t *self,
+int bithenge_transform_prefix_length(bithenge_transform_t *self,
     bithenge_scope_t *scope, bithenge_blob_t *blob, aoff64_t *out)
 {
@@ -130,5 +130,5 @@
 
 	bithenge_node_t *node;
-	errno_t rc = bithenge_transform_prefix_apply(self, scope, blob, &node,
+	int rc = bithenge_transform_prefix_apply(self, scope, blob, &node,
 	    out);
 	if (rc != EOK)
@@ -150,5 +150,5 @@
  * @return EOK on success, ENOTSUP if not supported, or another error code from
  * errno.h. */
-errno_t bithenge_transform_prefix_apply(bithenge_transform_t *self,
+int bithenge_transform_prefix_apply(bithenge_transform_t *self,
     bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
     aoff64_t *out_size)
@@ -163,5 +163,5 @@
 
 	aoff64_t size;
-	errno_t rc = bithenge_transform_prefix_length(self, scope, blob, &size);
+	int rc = bithenge_transform_prefix_length(self, scope, blob, &size);
 	if (rc != EOK)
 		return rc;
@@ -188,5 +188,5 @@
  * @param outer The outer scope, or NULL.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_scope_new(bithenge_scope_t **out, bithenge_scope_t *outer)
+int bithenge_scope_new(bithenge_scope_t **out, bithenge_scope_t *outer)
 {
 	bithenge_scope_t *self = malloc(sizeof(*self));
@@ -251,5 +251,5 @@
  * @param format The format string.
  * @return EINVAL normally, or another error code from errno.h. */
-errno_t bithenge_scope_error(bithenge_scope_t *scope, const char *format, ...)
+int bithenge_scope_error(bithenge_scope_t *scope, const char *format, ...)
 {
 	if (scope->error)
@@ -271,5 +271,5 @@
 		if (format[0] == '%' && format[1] == 't') {
 			format += 2;
-			errno_t rc = bithenge_print_node_to_string(&out,
+			int rc = bithenge_print_node_to_string(&out,
 			    &space_left, BITHENGE_PRINT_PYTHON,
 			    va_arg(ap, bithenge_node_t *));
@@ -364,5 +364,5 @@
  * @param num_params The number of parameters to allocate.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_scope_alloc_params(bithenge_scope_t *scope, int num_params)
+int bithenge_scope_alloc_params(bithenge_scope_t *scope, int num_params)
 {
 	scope->params = malloc(sizeof(*scope->params) * num_params);
@@ -382,5 +382,5 @@
  * @param node The value to store in the parameter.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_scope_set_param( bithenge_scope_t *scope, int i,
+int bithenge_scope_set_param( bithenge_scope_t *scope, int i,
     bithenge_node_t *node)
 {
@@ -401,5 +401,5 @@
  * @param[out] out Stores a new reference to the parameter.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_scope_get_param(bithenge_scope_t *scope, int i,
+int bithenge_scope_get_param(bithenge_scope_t *scope, int i,
     bithenge_node_t **out)
 {
@@ -436,10 +436,10 @@
 }
 
-static errno_t barrier_transform_apply(bithenge_transform_t *base,
+static int barrier_transform_apply(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
 {
 	barrier_transform_t *self = transform_as_barrier(base);
 	bithenge_scope_t *inner_scope;
-	errno_t rc = bithenge_scope_new(&inner_scope, scope);
+	int rc = bithenge_scope_new(&inner_scope, scope);
 	if (rc != EOK)
 		return rc;
@@ -451,10 +451,10 @@
 }
 
-static errno_t barrier_transform_prefix_length(bithenge_transform_t *base,
+static int barrier_transform_prefix_length(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_blob_t *in, aoff64_t *out)
 {
 	barrier_transform_t *self = transform_as_barrier(base);
 	bithenge_scope_t *inner_scope;
-	errno_t rc = bithenge_scope_new(&inner_scope, scope);
+	int rc = bithenge_scope_new(&inner_scope, scope);
 	if (rc != EOK)
 		return rc;
@@ -467,5 +467,5 @@
 }
 
-static errno_t barrier_transform_prefix_apply(bithenge_transform_t *base,
+static int barrier_transform_prefix_apply(bithenge_transform_t *base,
     bithenge_scope_t *scope, bithenge_blob_t *in, bithenge_node_t **out_node,
     aoff64_t *out_length)
@@ -473,5 +473,5 @@
 	barrier_transform_t *self = transform_as_barrier(base);
 	bithenge_scope_t *inner_scope;
-	errno_t rc = bithenge_scope_new(&inner_scope, scope);
+	int rc = bithenge_scope_new(&inner_scope, scope);
 	if (rc != EOK)
 		return rc;
@@ -503,5 +503,5 @@
  * @param transform The subtransform to use for all operations.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_barrier_transform_set_subtransform(bithenge_transform_t *base,
+int bithenge_barrier_transform_set_subtransform(bithenge_transform_t *base,
     bithenge_transform_t *transform)
 {
@@ -527,7 +527,7 @@
  * @param num_params The number of parameters to require, which may be 0.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_barrier_transform(bithenge_transform_t **out, int num_params)
-{
-	errno_t rc;
+int bithenge_new_barrier_transform(bithenge_transform_t **out, int num_params)
+{
+	int rc;
 	barrier_transform_t *self = malloc(sizeof(*self));
 	if (!self) {
@@ -551,8 +551,8 @@
 /***************** ascii                                     *****************/
 
-static errno_t ascii_apply(bithenge_transform_t *self, bithenge_scope_t *scope,
+static int ascii_apply(bithenge_transform_t *self, bithenge_scope_t *scope,
     bithenge_node_t *in, bithenge_node_t **out)
 {
-	errno_t rc;
+	int rc;
 	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
 		return EINVAL;
@@ -596,5 +596,5 @@
 /***************** bit                                       *****************/
 
-static errno_t bit_prefix_apply(bithenge_transform_t *self,
+static int bit_prefix_apply(bithenge_transform_t *self,
     bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
     aoff64_t *out_size)
@@ -602,5 +602,5 @@
 	char buffer;
 	aoff64_t size = 1;
-	errno_t rc = bithenge_blob_read_bits(blob, 0, &buffer, &size, true);
+	int rc = bithenge_blob_read_bits(blob, 0, &buffer, &size, true);
 	if (rc != EOK)
 		return rc;
@@ -642,8 +642,8 @@
 }
 
-static errno_t bits_xe_size(bithenge_blob_t *base, aoff64_t *out)
+static int bits_xe_size(bithenge_blob_t *base, aoff64_t *out)
 {
 	bits_xe_blob_t *self = blob_as_bits_xe(base);
-	errno_t rc = bithenge_blob_size(self->bytes, out);
+	int rc = bithenge_blob_size(self->bytes, out);
 	*out *= 8;
 	return rc;
@@ -658,5 +658,5 @@
 }
 
-static errno_t bits_xe_read_bits(bithenge_blob_t *base, aoff64_t offset,
+static int bits_xe_read_bits(bithenge_blob_t *base, aoff64_t offset,
     char *buffer, aoff64_t *size, bool little_endian)
 {
@@ -676,5 +676,5 @@
 		bytes_buffer = (uint8_t *)buffer;
 
-	errno_t rc = bithenge_blob_read(self->bytes, bytes_offset,
+	int rc = bithenge_blob_read(self->bytes, bytes_offset,
 	    (char *)bytes_buffer, &bytes_size);
 	if (rc != EOK)
@@ -715,5 +715,5 @@
 };
 
-static errno_t bits_xe_apply(bithenge_transform_t *self, bithenge_scope_t *scope,
+static int bits_xe_apply(bithenge_transform_t *self, bithenge_scope_t *scope,
     bithenge_node_t *in, bithenge_node_t **out)
 {
@@ -723,5 +723,5 @@
 	if (!blob)
 		return ENOMEM;
-	errno_t rc = bithenge_init_random_access_blob(bits_xe_as_blob(blob),
+	int rc = bithenge_init_random_access_blob(bits_xe_as_blob(blob),
 	    &bits_xe_blob_ops);
 	if (rc != EOK) {
@@ -757,5 +757,5 @@
 /***************** invalid                                   *****************/
 
-static errno_t invalid_apply(bithenge_transform_t *self, bithenge_scope_t *scope,
+static int invalid_apply(bithenge_transform_t *self, bithenge_scope_t *scope,
     bithenge_node_t *in, bithenge_node_t **out)
 {
@@ -777,9 +777,9 @@
 /***************** known_length                              *****************/
 
-static errno_t known_length_apply(bithenge_transform_t *self,
+static int known_length_apply(bithenge_transform_t *self,
     bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
 {
 	bithenge_node_t *length_node;
-	errno_t rc = bithenge_scope_get_param(scope, 0, &length_node);
+	int rc = bithenge_scope_get_param(scope, 0, &length_node);
 	if (rc != EOK)
 		return rc;
@@ -805,9 +805,9 @@
 }
 
-static errno_t known_length_prefix_length(bithenge_transform_t *self,
+static int known_length_prefix_length(bithenge_transform_t *self,
     bithenge_scope_t *scope, bithenge_blob_t *in, aoff64_t *out)
 {
 	bithenge_node_t *length_node;
-	errno_t rc = bithenge_scope_get_param(scope, 0, &length_node);
+	int rc = bithenge_scope_get_param(scope, 0, &length_node);
 	if (rc != EOK)
 		return rc;
@@ -834,5 +834,5 @@
 };
 
-static errno_t nonzero_boolean_apply(bithenge_transform_t *self,
+static int nonzero_boolean_apply(bithenge_transform_t *self,
     bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
 {
@@ -853,5 +853,5 @@
 };
 
-static errno_t prefix_length_1(bithenge_transform_t *self, bithenge_scope_t *scope,
+static int prefix_length_1(bithenge_transform_t *self, bithenge_scope_t *scope,
     bithenge_blob_t *blob, aoff64_t *out)
 {
@@ -860,5 +860,5 @@
 }
 
-static errno_t prefix_length_2(bithenge_transform_t *self, bithenge_scope_t *scope,
+static int prefix_length_2(bithenge_transform_t *self, bithenge_scope_t *scope,
     bithenge_blob_t *blob, aoff64_t *out)
 {
@@ -867,5 +867,5 @@
 }
 
-static errno_t prefix_length_4(bithenge_transform_t *self, bithenge_scope_t *scope,
+static int prefix_length_4(bithenge_transform_t *self, bithenge_scope_t *scope,
     bithenge_blob_t *blob, aoff64_t *out)
 {
@@ -874,5 +874,5 @@
 }
 
-static errno_t prefix_length_8(bithenge_transform_t *self, bithenge_scope_t *scope,
+static int prefix_length_8(bithenge_transform_t *self, bithenge_scope_t *scope,
     bithenge_blob_t *blob, aoff64_t *out)
 {
@@ -883,9 +883,9 @@
 /** @cond internal */
 #define MAKE_UINT_TRANSFORM(NAME, TYPE, ENDIAN, PREFIX_LENGTH_FUNC)            \
-	static errno_t NAME##_apply(bithenge_transform_t *self,                    \
+	static int NAME##_apply(bithenge_transform_t *self,                    \
 	    bithenge_scope_t *scope, bithenge_node_t *in,                      \
 	    bithenge_node_t **out)                                             \
 	{                                                                      \
-		errno_t rc;                                                        \
+		int rc;                                                        \
 		if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)              \
 			return EINVAL;                                         \
@@ -927,5 +927,5 @@
 /***************** uint_be, uint_le                          *****************/
 
-static errno_t uint_xe_prefix_apply(bithenge_transform_t *self,
+static int uint_xe_prefix_apply(bithenge_transform_t *self,
     bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
     aoff64_t *out_size)
@@ -933,5 +933,5 @@
 	bool little_endian = (self == &bithenge_uint_le_transform);
 	bithenge_node_t *num_bits_node;
-	errno_t rc = bithenge_scope_get_param(scope, 0, &num_bits_node);
+	int rc = bithenge_scope_get_param(scope, 0, &num_bits_node);
 	if (rc != EOK)
 		return rc;
@@ -997,8 +997,8 @@
 /***************** zero_terminated                           *****************/
 
-static errno_t zero_terminated_apply(bithenge_transform_t *self,
+static int zero_terminated_apply(bithenge_transform_t *self,
     bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
 {
-	errno_t rc;
+	int rc;
 	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
 		return EINVAL;
@@ -1021,8 +1021,8 @@
 }
 
-static errno_t zero_terminated_prefix_length(bithenge_transform_t *self,
+static int zero_terminated_prefix_length(bithenge_transform_t *self,
     bithenge_scope_t *scope, bithenge_blob_t *blob, aoff64_t *out)
 {
-	errno_t rc;
+	int rc;
 	char buffer[4096];
 	aoff64_t offset = 0, size_read = sizeof(buffer);
Index: uspace/lib/bithenge/src/tree.c
===================================================================
--- uspace/lib/bithenge/src/tree.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/bithenge/src/tree.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -86,10 +86,10 @@
 } get_for_each_data_t;
 
-static errno_t get_for_each_func(bithenge_node_t *key, bithenge_node_t *value,
+static int get_for_each_func(bithenge_node_t *key, bithenge_node_t *value,
     void *raw_data)
 {
 	get_for_each_data_t *data = (get_for_each_data_t *)raw_data;
 	bool equal;
-	errno_t rc = bithenge_node_equal(&equal, key, data->key);
+	int rc = bithenge_node_equal(&equal, key, data->key);
 	bithenge_node_dec_ref(key);
 	if (rc != EOK)
@@ -113,5 +113,5 @@
  * @return EOK on success, ENOENT if not found, or another error code from
  * errno.h. */
-errno_t bithenge_node_get(bithenge_node_t *self, bithenge_node_t *key,
+int bithenge_node_get(bithenge_node_t *self, bithenge_node_t *key,
     bithenge_node_t **out)
 {
@@ -125,5 +125,5 @@
 		uint8_t byte;
 		aoff64_t size = 1;
-		errno_t rc = bithenge_blob_read(bithenge_node_as_blob(self),
+		int rc = bithenge_blob_read(bithenge_node_as_blob(self),
 		    offset, (char *)&byte, &size);
 		if (rc != EOK)
@@ -140,5 +140,5 @@
 	*out = NULL;
 	get_for_each_data_t data = {key, out};
-	errno_t rc = bithenge_node_for_each(self, get_for_each_func, &data);
+	int rc = bithenge_node_for_each(self, get_for_each_func, &data);
 	bithenge_node_dec_ref(key);
 	if (rc == EEXIST && *out)
@@ -155,5 +155,5 @@
  * @param[in] ops The operations provided.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_init_internal_node(bithenge_node_t *self,
+int bithenge_init_internal_node(bithenge_node_t *self,
     const bithenge_internal_node_ops_t *ops)
 {
@@ -169,5 +169,5 @@
 }
 
-static errno_t empty_internal_node_for_each(bithenge_node_t *base,
+static int empty_internal_node_for_each(bithenge_node_t *base,
     bithenge_for_each_func_t func, void *data)
 {
@@ -175,5 +175,5 @@
 }
 
-static errno_t empty_internal_node_get(bithenge_node_t *self, bithenge_node_t *key,
+static int empty_internal_node_get(bithenge_node_t *self, bithenge_node_t *key,
     bithenge_node_t **out)
 {
@@ -196,5 +196,5 @@
  * @param[out] out Holds the created node.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_empty_internal_node(bithenge_node_t **out)
+int bithenge_new_empty_internal_node(bithenge_node_t **out)
 {
 	if (bithenge_should_fail())
@@ -223,8 +223,8 @@
 }
 
-static errno_t simple_internal_node_for_each(bithenge_node_t *base,
+static int simple_internal_node_for_each(bithenge_node_t *base,
     bithenge_for_each_func_t func, void *data)
 {
-	errno_t rc;
+	int rc;
 	simple_internal_node_t *self = node_as_simple(base);
 	for (bithenge_int_t i = 0; i < self->len; i++) {
@@ -264,8 +264,8 @@
  * the nodes array rather than just dereferencing each node inside it.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_simple_internal_node(bithenge_node_t **out,
+int bithenge_new_simple_internal_node(bithenge_node_t **out,
     bithenge_node_t **nodes, bithenge_int_t len, bool needs_free)
 {
-	errno_t rc;
+	int rc;
 	assert(out);
 	simple_internal_node_t *self = malloc(sizeof(*self));
@@ -300,5 +300,5 @@
  * @param value The value for the node to hold.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_boolean_node(bithenge_node_t **out, bool value)
+int bithenge_new_boolean_node(bithenge_node_t **out, bool value)
 {
 	assert(out);
@@ -315,5 +315,5 @@
  * @param value The value for the node to hold.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_integer_node(bithenge_node_t **out, bithenge_int_t value)
+int bithenge_new_integer_node(bithenge_node_t **out, bithenge_int_t value)
 {
 	assert(out);
@@ -335,5 +335,5 @@
  * destroyed.
  * @return EOK on success or an error code from errno.h. */
-errno_t bithenge_new_string_node(bithenge_node_t **out, const char *value, bool needs_free)
+int bithenge_new_string_node(bithenge_node_t **out, const char *value, bool needs_free)
 {
 	assert(out);
@@ -359,5 +359,5 @@
  * @return EOK on success or an error code from errno.h.
  * @todo Add support for internal nodes. */
-errno_t bithenge_node_equal(bool *out, bithenge_node_t *a, bithenge_node_t *b)
+int bithenge_node_equal(bool *out, bithenge_node_t *a, bithenge_node_t *b)
 {
 	if (a->type != b->type) {
Index: uspace/lib/block/block.c
===================================================================
--- uspace/lib/block/block.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/block/block.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,4 @@
 #include <stdio.h>
 #include <stacktrace.h>
-#include <str_error.h>
 #include <offset.h>
 #include <inttypes.h>
@@ -88,6 +87,6 @@
 } devcon_t;
 
-static errno_t read_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);
-static errno_t write_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);
+static int read_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);
+static int write_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);
 static aoff64_t ba_ltop(devcon_t *, aoff64_t);
 
@@ -107,5 +106,5 @@
 }
 
-static errno_t devcon_add(service_id_t service_id, async_sess_t *sess,
+static int devcon_add(service_id_t service_id, async_sess_t *sess,
     size_t bsize, aoff64_t dev_size, bd_t *bd)
 {
@@ -146,5 +145,5 @@
 }
 
-errno_t block_init(service_id_t service_id, size_t comm_size)
+int block_init(service_id_t service_id, size_t comm_size)
 {
 	bd_t *bd;
@@ -156,5 +155,5 @@
 	}
 	
-	errno_t rc = bd_open(sess, &bd);
+	int rc = bd_open(sess, &bd);
 	if (rc != EOK) {
 		async_hangup(sess);
@@ -209,8 +208,8 @@
 }
 
-errno_t block_bb_read(service_id_t service_id, aoff64_t ba)
+int block_bb_read(service_id_t service_id, aoff64_t ba)
 {
 	void *bb_buf;
-	errno_t rc;
+	int rc;
 
 	devcon_t *devcon = devcon_search(service_id);
@@ -270,5 +269,5 @@
 };
 
-errno_t block_cache_init(service_id_t service_id, size_t size, unsigned blocks,
+int block_cache_init(service_id_t service_id, size_t size, unsigned blocks,
     enum cache_mode mode)
 {
@@ -307,9 +306,9 @@
 }
 
-errno_t block_cache_fini(service_id_t service_id)
+int block_cache_fini(service_id_t service_id)
 {
 	devcon_t *devcon = devcon_search(service_id);
 	cache_t *cache;
-	errno_t rc;
+	int rc;
 
 	if (!devcon)
@@ -381,7 +380,7 @@
  *				device.
  *
- * @return			EOK on success or an error code.
- */
-errno_t block_get(block_t **block, service_id_t service_id, aoff64_t ba, int flags)
+ * @return			EOK on success or a negative error code.
+ */
+int block_get(block_t **block, service_id_t service_id, aoff64_t ba, int flags)
 {
 	devcon_t *devcon;
@@ -390,5 +389,5 @@
 	link_t *link;
 	aoff64_t p_ba;
-	errno_t rc;
+	int rc;
 	
 	devcon = devcon_search(service_id);
@@ -578,7 +577,7 @@
  * @param block		Block of which a reference is to be released.
  *
- * @return		EOK on success or an error code.
- */
-errno_t block_put(block_t *block)
+ * @return		EOK on success or a negative error code.
+ */
+int block_put(block_t *block)
 {
 	devcon_t *devcon = devcon_search(block->service_id);
@@ -586,5 +585,5 @@
 	unsigned blocks_cached;
 	enum cache_mode mode;
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	assert(devcon);
@@ -699,7 +698,7 @@
  * @param block_size	Block size to be used for the transfer.
  *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_seqread(service_id_t service_id, void *buf, size_t *bufpos,
+ * @return		EOK on success or a negative return code on failure.
+ */
+int block_seqread(service_id_t service_id, void *buf, size_t *bufpos,
     size_t *buflen, aoff64_t *pos, void *dst, size_t size)
 {
@@ -735,5 +734,5 @@
 		if (*bufpos == *buflen) {
 			/* Refill the communication buffer with a new block. */
-			errno_t rc;
+			int rc;
 
 			rc = read_blocks(devcon, *pos / block_size, 1, buf,
@@ -758,7 +757,7 @@
  * @param src		Buffer for storing the data.
  *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_read_direct(service_id_t service_id, aoff64_t ba, size_t cnt, void *buf)
+ * @return		EOK on success or negative error code on failure.
+ */
+int block_read_direct(service_id_t service_id, aoff64_t ba, size_t cnt, void *buf)
 {
 	devcon_t *devcon;
@@ -777,7 +776,7 @@
  * @param src		The data to be written.
  *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_write_direct(service_id_t service_id, aoff64_t ba, size_t cnt,
+ * @return		EOK on success or negative error code on failure.
+ */
+int block_write_direct(service_id_t service_id, aoff64_t ba, size_t cnt,
     const void *data)
 {
@@ -796,7 +795,7 @@
  * @param cnt		Number of blocks.
  *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_sync_cache(service_id_t service_id, aoff64_t ba, size_t cnt)
+ * @return		EOK on success or negative error code on failure.
+ */
+int block_sync_cache(service_id_t service_id, aoff64_t ba, size_t cnt)
 {
 	devcon_t *devcon;
@@ -813,7 +812,7 @@
  * @param bsize		Output block size.
  *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_get_bsize(service_id_t service_id, size_t *bsize)
+ * @return		EOK on success or negative error code on failure.
+ */
+int block_get_bsize(service_id_t service_id, size_t *bsize)
 {
 	devcon_t *devcon;
@@ -830,7 +829,7 @@
  * @param nblocks	Output number of blocks.
  *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_get_nblocks(service_id_t service_id, aoff64_t *nblocks)
+ * @return		EOK on success or negative error code on failure.
+ */
+int block_get_nblocks(service_id_t service_id, aoff64_t *nblocks)
 {
 	devcon_t *devcon = devcon_search(service_id);
@@ -847,10 +846,10 @@
  * @param data			Buffer that receives the data
  * 
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_read_bytes_direct(service_id_t service_id, aoff64_t abs_offset,
+ * @return		EOK on success or negative error code on failure.
+ */
+int block_read_bytes_direct(service_id_t service_id, aoff64_t abs_offset,
     size_t bytes, void *data)
 {
-	errno_t rc;
+	int rc;
 	size_t phys_block_size;
 	size_t buf_size;
@@ -898,8 +897,8 @@
  *
  * @return Allocated TOC structure.
- * @return EOK on success or an error code.
- *
- */
-errno_t block_read_toc(service_id_t service_id, uint8_t session, void *buf,
+ * @return EOK on success or negative error code.
+ *
+ */
+int block_read_toc(service_id_t service_id, uint8_t session, void *buf,
     size_t bufsize)
 {
@@ -917,15 +916,15 @@
  * @param src		Buffer for storing the data.
  *
- * @return		EOK on success or an error code on failure.
- */
-static errno_t read_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *buf,
+ * @return		EOK on success or negative error code on failure.
+ */
+static int read_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *buf,
     size_t size)
 {
 	assert(devcon);
 	
-	errno_t rc = bd_read_blocks(devcon->bd, ba, cnt, buf, size);
+	int rc = bd_read_blocks(devcon->bd, ba, cnt, buf, size);
 	if (rc != EOK) {
-		printf("Error %s reading %zu blocks starting at block %" PRIuOFF64
-		    " from device handle %" PRIun "\n", str_error_name(rc), cnt, ba,
+		printf("Error %d reading %zu blocks starting at block %" PRIuOFF64
+		    " from device handle %" PRIun "\n", rc, cnt, ba,
 		    devcon->service_id);
 #ifndef NDEBUG
@@ -944,15 +943,15 @@
  * @param src		Buffer containing the data to write.
  *
- * @return		EOK on success or an error code on failure.
- */
-static errno_t write_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *data,
+ * @return		EOK on success or negative error code on failure.
+ */
+static int write_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *data,
     size_t size)
 {
 	assert(devcon);
 	
-	errno_t rc = bd_write_blocks(devcon->bd, ba, cnt, data, size);
+	int rc = bd_write_blocks(devcon->bd, ba, cnt, data, size);
 	if (rc != EOK) {
-		printf("Error %s writing %zu blocks starting at block %" PRIuOFF64
-		    " to device handle %" PRIun "\n", str_error_name(rc), cnt, ba, devcon->service_id);
+		printf("Error %d writing %zu blocks starting at block %" PRIuOFF64
+		    " to device handle %" PRIun "\n", rc, cnt, ba, devcon->service_id);
 #ifndef NDEBUG
 		stacktrace_print();
Index: uspace/lib/block/block.h
===================================================================
--- uspace/lib/block/block.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/block/block.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -85,5 +85,5 @@
 	/** Link for placing the block into the free block list. */
 	link_t free_link;
-	/** Link for placing the block into the block hash table. */
+	/** Link for placing the block into the block hash table. */ 
 	ht_link_t hash_link;
 	/** Buffer with the block data. */
@@ -99,26 +99,26 @@
 };
 
-extern errno_t block_init(service_id_t, size_t);
+extern int block_init(service_id_t, size_t);
 extern void block_fini(service_id_t);
 
-extern errno_t block_bb_read(service_id_t, aoff64_t);
+extern int block_bb_read(service_id_t, aoff64_t);
 extern void *block_bb_get(service_id_t);
 
-extern errno_t block_cache_init(service_id_t, size_t, unsigned, enum cache_mode);
-extern errno_t block_cache_fini(service_id_t);
+extern int block_cache_init(service_id_t, size_t, unsigned, enum cache_mode);
+extern int block_cache_fini(service_id_t);
 
-extern errno_t block_get(block_t **, service_id_t, aoff64_t, int);
-extern errno_t block_put(block_t *);
+extern int block_get(block_t **, service_id_t, aoff64_t, int);
+extern int block_put(block_t *);
 
-extern errno_t block_seqread(service_id_t, void *, size_t *, size_t *, aoff64_t *,
+extern int block_seqread(service_id_t, void *, size_t *, size_t *, aoff64_t *,
     void *, size_t);
 
-extern errno_t block_get_bsize(service_id_t, size_t *);
-extern errno_t block_get_nblocks(service_id_t, aoff64_t *);
-extern errno_t block_read_toc(service_id_t, uint8_t, void *, size_t);
-extern errno_t block_read_direct(service_id_t, aoff64_t, size_t, void *);
-extern errno_t block_read_bytes_direct(service_id_t, aoff64_t, size_t, void *);
-extern errno_t block_write_direct(service_id_t, aoff64_t, size_t, const void *);
-extern errno_t block_sync_cache(service_id_t, aoff64_t, size_t);
+extern int block_get_bsize(service_id_t, size_t *);
+extern int block_get_nblocks(service_id_t, aoff64_t *);
+extern int block_read_toc(service_id_t, uint8_t, void *, size_t);
+extern int block_read_direct(service_id_t, aoff64_t, size_t, void *);
+extern int block_read_bytes_direct(service_id_t, aoff64_t, size_t, void *);
+extern int block_write_direct(service_id_t, aoff64_t, size_t, const void *);
+extern int block_sync_cache(service_id_t, aoff64_t, size_t);
 
 #endif
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/Makefile	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -85,5 +85,4 @@
 	generic/str.c \
 	generic/str_error.c \
-	generic/strtol.c \
 	generic/l18n/langs.c \
 	generic/fibril.c \
Index: uspace/lib/c/arch/abs32le/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/abs32le/src/stacktrace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/abs32le/src/stacktrace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,10 +40,10 @@
 }
 
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
+int stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
 {
 	return 0;
 }
 
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
+int stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
 {
 	return 0;
Index: uspace/lib/c/arch/amd64/Makefile.common
===================================================================
--- uspace/lib/c/arch/amd64/Makefile.common	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/amd64/Makefile.common	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -31,8 +31,5 @@
 # XXX: clang doesn't support this flag, but the optimization is OS-specific,
 #      so it isn't used for amd64-unknown-elf target.
-
-ifneq ($(COMPILER),clang)
-	COMMON_CFLAGS += -mno-tls-direct-seg-refs
-endif
+GCC_CFLAGS += -mno-tls-direct-seg-refs
 
 LFLAGS += --gc-sections
Index: uspace/lib/c/arch/amd64/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/amd64/src/stacktrace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/amd64/src/stacktrace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,10 +49,10 @@
 }
 
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
+int stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
 {
 	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_FP_PREV, prev);
 }
 
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
+int stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
 {
 	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_RA, ra);
Index: uspace/lib/c/arch/arm32/include/libarch/atomic.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/atomic.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/arm32/include/libarch/atomic.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -82,5 +82,5 @@
 	ras_page[1] = 0xffffffff;
 	
-	return ret != 0;
+	return (bool) ret;
 }
 
Index: uspace/lib/c/arch/arm32/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/arm32/src/stacktrace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/arm32/src/stacktrace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,10 +49,10 @@
 }
 
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
+int stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
 {
 	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_FP_PREV, prev);
 }
 
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
+int stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
 {
 	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_RA, ra);
Index: uspace/lib/c/arch/ia32/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/syscall.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/ia32/include/libarch/syscall.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,5 +48,5 @@
 #define __syscall6  __syscall_slow
 
-extern sysarg_t (*__syscall_fast_func)(const sysarg_t, const sysarg_t,
+extern sysarg_t (* __syscall_fast_func)(const sysarg_t, const sysarg_t,
     const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t,
     const syscall_t);
Index: uspace/lib/c/arch/ia32/src/rtld/reloc.c
===================================================================
--- uspace/lib/c/arch/ia32/src/rtld/reloc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/ia32/src/rtld/reloc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,4 @@
 #include <stdlib.h>
 #include <inttypes.h>
-#include <str.h>
 
 #include <libarch/rtld/elf_dyn.h>
Index: uspace/lib/c/arch/ia32/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/ia32/src/stacktrace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/ia32/src/stacktrace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,10 +49,10 @@
 }
 
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
+int stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
 {
 	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_FP_PREV, prev);
 }
 
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
+int stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
 {
 	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_RA, ra);
Index: uspace/lib/c/arch/ia64/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/ia64/src/stacktrace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/ia64/src/stacktrace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 }
 
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
+int stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
 {
 	(void) st; (void) fp; (void) prev;
@@ -53,5 +53,5 @@
 }
 
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
+int stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
 {
 	(void) st; (void) fp; (void) ra;
Index: uspace/lib/c/arch/mips32/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/mips32/src/stacktrace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/mips32/src/stacktrace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 }
 
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
+int stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
 {
 	(void) st; (void) fp; (void) prev;
@@ -53,5 +53,5 @@
 }
 
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
+int stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
 {
 	(void) st; (void) fp; (void) ra;
Index: uspace/lib/c/arch/ppc32/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/ppc32/src/stacktrace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/ppc32/src/stacktrace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,10 +49,10 @@
 }
 
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
+int stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
 {
 	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_FP_PREV, prev);
 }
 
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
+int stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
 {
 	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_RA, ra);
Index: uspace/lib/c/arch/riscv64/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/riscv64/src/stacktrace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/riscv64/src/stacktrace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,10 +39,10 @@
 }
 
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
+int stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
 {
 	return 0;
 }
 
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
+int stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
 {
 	return 0;
Index: uspace/lib/c/arch/sparc64/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/sparc64/src/stacktrace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/arch/sparc64/src/stacktrace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,8 +50,8 @@
 }
 
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
+int stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
 {
 	uintptr_t bprev;
-	errno_t rc;
+	int rc;
 
 	rc = (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_FP_PREV, &bprev);
@@ -61,5 +61,5 @@
 }
 
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
+int stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
 {
 	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_RA, ra);
Index: uspace/lib/c/generic/adt/circ_buf.c
===================================================================
--- uspace/lib/c/generic/adt/circ_buf.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/adt/circ_buf.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -82,5 +82,5 @@
  * @return EOK on success, EAGAIN if circular buffer is full
  */
-errno_t circ_buf_push(circ_buf_t *cbuf, const void *data)
+int circ_buf_push(circ_buf_t *cbuf, const void *data)
 {
 	if (circ_buf_nfree(cbuf) == 0)
@@ -99,5 +99,5 @@
  * @return EOK on success, EAGAIN if circular buffer is full
  */
-errno_t circ_buf_pop(circ_buf_t *cbuf, void *datab)
+int circ_buf_pop(circ_buf_t *cbuf, void *datab)
 {
 	if (cbuf->nused == 0)
Index: uspace/lib/c/generic/adt/odict.c
===================================================================
--- uspace/lib/c/generic/adt/odict.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/adt/odict.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -92,7 +92,7 @@
  * @return EOK on success, EINVAL on failure
  */
-static errno_t odict_validate_tree(odlink_t *cur, int *rbd)
-{
-	errno_t rc;
+static int odict_validate_tree(odlink_t *cur, int *rbd)
+{
+	int rc;
 	int bd_a, bd_b;
 	int cur_d;
@@ -177,8 +177,8 @@
  * @param odict Ordered dictionary
  */
-errno_t odict_validate(odict_t *odict)
+int odict_validate(odict_t *odict)
 {
 	int bd;
-	errno_t rc;
+	int rc;
 
 	if (odict->root == NULL)
Index: uspace/lib/c/generic/arg_parse.c
===================================================================
--- uspace/lib/c/generic/arg_parse.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/arg_parse.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -65,5 +65,5 @@
  *
  */
-errno_t arg_parse_int(int argc, char *argv[], int *index, int *value,
+int arg_parse_int(int argc, char *argv[], int *index, int *value,
     int offset)
 {
@@ -105,10 +105,10 @@
  *
  */
-errno_t arg_parse_name_int(int argc, char *argv[], int *index, int *value,
+int arg_parse_name_int(int argc, char *argv[], int *index, int *value,
     int offset, arg_parser parser)
 {
 	char *arg;
 	
-	errno_t ret = arg_parse_string(argc, argv, index, &arg, offset);
+	int ret = arg_parse_string(argc, argv, index, &arg, offset);
 	if (ret != EOK)
 		return ret;
@@ -135,5 +135,5 @@
  *
  */
-errno_t arg_parse_string(int argc, char **argv, int *index, char **value,
+int arg_parse_string(int argc, char **argv, int *index, char **value,
     int offset)
 {
Index: uspace/lib/c/generic/as.c
===================================================================
--- uspace/lib/c/generic/as.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/as.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -74,7 +74,7 @@
  *
  */
-errno_t as_area_resize(void *address, size_t size, unsigned int flags)
+int as_area_resize(void *address, size_t size, unsigned int flags)
 {
-	return (errno_t) __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t) address,
+	return __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t) address,
 	    (sysarg_t) size, (sysarg_t) flags);
 }
@@ -88,7 +88,7 @@
  *
  */
-errno_t as_area_destroy(void *address)
+int as_area_destroy(void *address)
 {
-	return (errno_t) __SYSCALL1(SYS_AS_AREA_DESTROY, (sysarg_t) address);
+	return __SYSCALL1(SYS_AS_AREA_DESTROY, (sysarg_t) address);
 }
 
@@ -102,7 +102,7 @@
  *
  */
-errno_t as_area_change_flags(void *address, unsigned int flags)
+int as_area_change_flags(void *address, unsigned int flags)
 {
-	return (errno_t) __SYSCALL2(SYS_AS_AREA_CHANGE_FLAGS, (sysarg_t) address,
+	return __SYSCALL2(SYS_AS_AREA_CHANGE_FLAGS, (sysarg_t) address,
 	    (sysarg_t) flags);
 }
@@ -117,7 +117,7 @@
  *
  */
-errno_t as_get_physical_mapping(const void *virt, uintptr_t *phys)
+int as_get_physical_mapping(const void *virt, uintptr_t *phys)
 {
-	return (errno_t) __SYSCALL2(SYS_PAGE_FIND_MAPPING, (sysarg_t) virt,
+	return (int) __SYSCALL2(SYS_PAGE_FIND_MAPPING, (sysarg_t) virt,
 	    (sysarg_t) phys);
 }
Index: uspace/lib/c/generic/assert.c
===================================================================
--- uspace/lib/c/generic/assert.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/assert.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,17 +41,5 @@
 static atomic_t failed_asserts = {0};
 
-void __helenos_assert_quick_abort(const char *cond, const char *file, unsigned int line)
-{
-	/*
-	 * Send the message safely to kio. Nested asserts should not occur.
-	 */
-	kio_printf("Assertion failed (%s) in file \"%s\", line %u.\n",
-	    cond, file, line);
-	
-	/* Sometimes we know in advance that regular printf() would likely fail. */
-	abort();
-}
-
-void __helenos_assert_abort(const char *cond, const char *file, unsigned int line)
+void assert_abort(const char *cond, const char *file, unsigned int line)
 {
 	/*
Index: uspace/lib/c/generic/async.c
===================================================================
--- uspace/lib/c/generic/async.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/async.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -205,5 +205,5 @@
 	ipc_call_t *dataptr;
 	
-	errno_t retval;
+	sysarg_t retval;
 } amsg_t;
 
@@ -332,5 +332,5 @@
 		msg->destroyed = false;
 		msg->dataptr = NULL;
-		msg->retval = EINVAL;
+		msg->retval = (sysarg_t) EINVAL;
 		awaiter_initialize(&msg->wdata);
 	}
@@ -511,5 +511,5 @@
 static FIBRIL_CONDVAR_INITIALIZE(avail_phone_cv);
 
-errno_t async_create_port(iface_t iface, async_port_handler_t handler,
+int async_create_port(iface_t iface, async_port_handler_t handler,
     void *data, port_id_t *port_id)
 {
@@ -698,5 +698,5 @@
  *
  */
-static errno_t connection_fibril(void *arg)
+static int connection_fibril(void *arg)
 {
 	assert(arg);
@@ -763,5 +763,5 @@
 	
 	free(fibril_connection);
-	return EOK;
+	return 0;
 }
 
@@ -844,8 +844,8 @@
  * @param port_id ID of the newly created port.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t async_create_callback_port(async_exch_t *exch, iface_t iface, sysarg_t arg1,
+ * @return Zero on success or a negative error code.
+ *
+ */
+int async_create_callback_port(async_exch_t *exch, iface_t iface, sysarg_t arg1,
     sysarg_t arg2, async_port_handler_t handler, void *data, port_id_t *port_id)
 {
@@ -860,8 +860,8 @@
 	    &answer);
 	
-	errno_t ret;
+	sysarg_t ret;
 	async_wait_for(req, &ret);
 	if (ret != EOK)
-		return (errno_t) ret;
+		return (int) ret;
 	
 	sysarg_t phone_hash = IPC_GET_ARG5(answer);
@@ -1051,11 +1051,10 @@
  * @param ucode   Top-half pseudocode handler.
  *
- * @param[out] handle  IRQ capability handle on success.
- *
- * @return An error code.
- *
- */
-errno_t async_irq_subscribe(int inr, async_notification_handler_t handler,
-    void *data, const irq_code_t *ucode, cap_handle_t *handle)
+ * @return IRQ capability handle on success.
+ * @return Negative error code.
+ *
+ */
+int async_irq_subscribe(int inr, async_notification_handler_t handler,
+    void *data, const irq_code_t *ucode)
 {
 	notification_t *notification =
@@ -1077,10 +1076,5 @@
 	futex_up(&async_futex);
 	
-	cap_handle_t cap;
-	errno_t rc = ipc_irq_subscribe(inr, imethod, ucode, &cap);
-	if (rc == EOK && handle != NULL) {
-		*handle = cap;
-	}
-	return rc;
+	return ipc_irq_subscribe(inr, imethod, ucode);
 }
 
@@ -1089,8 +1083,8 @@
  * @param cap     IRQ capability handle. 
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t async_irq_unsubscribe(int cap)
+ * @return Zero on success or a negative error code.
+ *
+ */
+int async_irq_unsubscribe(int cap)
 {
 	// TODO: Remove entry from hash table
@@ -1106,8 +1100,8 @@
  * @param data    Notification handler client data.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t async_event_subscribe(event_type_t evno,
+ * @return Zero on success or a negative error code.
+ *
+ */
+int async_event_subscribe(event_type_t evno,
     async_notification_handler_t handler, void *data)
 {
@@ -1139,8 +1133,8 @@
  * @param data    Notification handler client data.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t async_event_task_subscribe(event_task_type_t evno,
+ * @return Zero on success or a negative error code.
+ *
+ */
+int async_event_task_subscribe(event_task_type_t evno,
     async_notification_handler_t handler, void *data)
 {
@@ -1173,5 +1167,5 @@
  *
  */
-errno_t async_event_unmask(event_type_t evno)
+int async_event_unmask(event_type_t evno)
 {
 	return ipc_event_unmask(evno);
@@ -1185,5 +1179,5 @@
  *
  */
-errno_t async_event_task_unmask(event_task_type_t evno)
+int async_event_task_unmask(event_task_type_t evno)
 {
 	return ipc_event_task_unmask(evno);
@@ -1437,5 +1431,5 @@
  *
  */
-static errno_t async_manager_worker(void)
+static int async_manager_worker(void)
 {
 	while (true) {
@@ -1489,14 +1483,13 @@
 		
 		ipc_call_t call;
-		errno_t rc = ipc_wait_cycle(&call, timeout, flags);
+		cap_handle_t chandle = ipc_wait_cycle(&call, timeout, flags);
 		
 		atomic_dec(&threads_in_ipc_wait);
 		
-		assert(rc == EOK);
-
-		if (call.cap_handle == CAP_NIL) {
-			if ((call.flags &
-			    (IPC_CALL_NOTIF | IPC_CALL_ANSWERED)) == 0) {
-				/* Neither a notification nor an answer. */
+		assert(chandle >= 0);
+
+		if (chandle == CAP_NIL) {
+			if (call.flags == 0) {
+				/* This neither a notification nor an answer. */
 				handle_expired_timeouts();
 				continue;
@@ -1507,5 +1500,5 @@
 			continue;
 
-		handle_call(call.cap_handle, &call);
+		handle_call(chandle, &call);
 	}
 
@@ -1521,5 +1514,5 @@
  *
  */
-static errno_t async_manager_fibril(void *arg)
+static int async_manager_fibril(void *arg)
 {
 	futex_up(&async_futex);
@@ -1597,5 +1590,5 @@
  *
  */
-void reply_received(void *arg, errno_t retval, ipc_call_t *data)
+void reply_received(void *arg, int retval, ipc_call_t *data)
 {
 	assert(arg);
@@ -1709,5 +1702,5 @@
  *
  */
-void async_wait_for(aid_t amsgid, errno_t *retval)
+void async_wait_for(aid_t amsgid, sysarg_t *retval)
 {
 	assert(amsgid);
@@ -1755,5 +1748,5 @@
  *
  */
-errno_t async_wait_timeout(aid_t amsgid, errno_t *retval, suseconds_t timeout)
+int async_wait_timeout(aid_t amsgid, sysarg_t *retval, suseconds_t timeout)
 {
 	assert(amsgid);
@@ -1856,15 +1849,16 @@
 void async_usleep(suseconds_t timeout)
 {
-	awaiter_t awaiter;
-	awaiter_initialize(&awaiter);
-	
-	awaiter.fid = fibril_get_id();
-	
-	getuptime(&awaiter.to_event.expires);
-	tv_add_diff(&awaiter.to_event.expires, timeout);
+	amsg_t *msg = amsg_create();
+	if (!msg)
+		return;
+	
+	msg->wdata.fid = fibril_get_id();
+	
+	getuptime(&msg->wdata.to_event.expires);
+	tv_add_diff(&msg->wdata.to_event.expires, timeout);
 	
 	futex_down(&async_futex);
 	
-	async_insert_timeout(&awaiter);
+	async_insert_timeout(&msg->wdata);
 	
 	/* Leave the async_futex locked when entering this function */
@@ -1872,4 +1866,6 @@
 	
 	/* Futex is up automatically after fibril_switch() */
+	
+	amsg_destroy(msg);
 }
 
@@ -1912,8 +1908,8 @@
  * @param r5      If non-NULL, storage for the 5th reply argument.
  *
- * @return Return code of the reply or an error code.
- *
- */
-errno_t async_req_fast(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
+ * @return Return code of the reply or a negative error code.
+ *
+ */
+sysarg_t async_req_fast(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2,
     sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
@@ -1926,5 +1922,5 @@
 	    &result);
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(aid, &rc);
 	
@@ -1964,8 +1960,8 @@
  * @param r5      If non-NULL, storage for the 5th reply argument.
  *
- * @return Return code of the reply or an error code.
- *
- */
-errno_t async_req_slow(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
+ * @return Return code of the reply or a negative error code.
+ *
+ */
+sysarg_t async_req_slow(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1,
     sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
@@ -1978,5 +1974,5 @@
 	    &result);
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(aid, &rc);
 	
@@ -2042,15 +2038,15 @@
 }
 
-errno_t async_answer_0(cap_handle_t chandle, errno_t retval)
+sysarg_t async_answer_0(cap_handle_t chandle, sysarg_t retval)
 {
 	return ipc_answer_0(chandle, retval);
 }
 
-errno_t async_answer_1(cap_handle_t chandle, errno_t retval, sysarg_t arg1)
+sysarg_t async_answer_1(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1)
 {
 	return ipc_answer_1(chandle, retval, arg1);
 }
 
-errno_t async_answer_2(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
+sysarg_t async_answer_2(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1,
     sysarg_t arg2)
 {
@@ -2058,5 +2054,5 @@
 }
 
-errno_t async_answer_3(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
+sysarg_t async_answer_3(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1,
     sysarg_t arg2, sysarg_t arg3)
 {
@@ -2064,5 +2060,5 @@
 }
 
-errno_t async_answer_4(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
+sysarg_t async_answer_4(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1,
     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
 {
@@ -2070,5 +2066,5 @@
 }
 
-errno_t async_answer_5(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
+sysarg_t async_answer_5(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1,
     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
 {
@@ -2076,5 +2072,5 @@
 }
 
-errno_t async_forward_fast(cap_handle_t chandle, async_exch_t *exch,
+int async_forward_fast(cap_handle_t chandle, async_exch_t *exch,
     sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
 {
@@ -2085,5 +2081,5 @@
 }
 
-errno_t async_forward_slow(cap_handle_t chandle, async_exch_t *exch,
+int async_forward_slow(cap_handle_t chandle, async_exch_t *exch,
     sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
     sysarg_t arg4, sysarg_t arg5, unsigned int mode)
@@ -2105,8 +2101,8 @@
  * @param arg3            User defined argument.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t async_connect_to_me(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
+ * @return Zero on success or a negative error code.
+ *
+ */
+int async_connect_to_me(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
     sysarg_t arg3)
 {
@@ -2118,20 +2114,16 @@
 	    &answer);
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(req, &rc);
 	if (rc != EOK)
-		return (errno_t) rc;
+		return (int) rc;
 	
 	return EOK;
 }
 
-static errno_t async_connect_me_to_internal(int phone, sysarg_t arg1, sysarg_t arg2,
-    sysarg_t arg3, sysarg_t arg4, int *out_phone)
+static int async_connect_me_to_internal(int phone, sysarg_t arg1, sysarg_t arg2,
+    sysarg_t arg3, sysarg_t arg4)
 {
 	ipc_call_t result;
-	
-	// XXX: Workaround for GCC's inability to infer association between
-	// rc == EOK and *out_phone being assigned.
-	*out_phone = -1;
 	
 	amsg_t *msg = amsg_create();
@@ -2145,5 +2137,5 @@
 	    msg, reply_received);
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for((aid_t) msg, &rc);
 	
@@ -2151,6 +2143,5 @@
 		return rc;
 	
-	*out_phone = (int) IPC_GET_ARG5(result);
-	return EOK;
+	return (int) IPC_GET_ARG5(result);
 }
 
@@ -2182,9 +2173,8 @@
 	}
 	
-	int phone;
-	errno_t rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,
-	    0, &phone);
-	if (rc != EOK) {
-		errno = rc;
+	int phone = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,
+	    0);
+	if (phone < 0) {
+		errno = phone;
 		free(sess);
 		return NULL;
@@ -2235,9 +2225,8 @@
 	}
 	
-	int phone;
-	errno_t rc = async_connect_me_to_internal(exch->phone, iface, arg2,
-	    arg3, 0, &phone);
-	if (rc != EOK) {
-		errno = rc;
+	int phone = async_connect_me_to_internal(exch->phone, iface, arg2,
+	    arg3, 0);
+	if (phone < 0) {
+		errno = phone;
 		free(sess);
 		return NULL;
@@ -2306,10 +2295,9 @@
 	}
 	
-	int phone;
-	errno_t rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,
-	    IPC_FLAG_BLOCKING, &phone);
-	
-	if (rc != EOK) {
-		errno = rc;
+	int phone = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,
+	    IPC_FLAG_BLOCKING);
+	
+	if (phone < 0) {
+		errno = phone;
 		free(sess);
 		return NULL;
@@ -2360,9 +2348,8 @@
 	}
 	
-	int phone;
-	errno_t rc = async_connect_me_to_internal(exch->phone, iface, arg2,
-	    arg3, IPC_FLAG_BLOCKING, &phone);
-	if (rc != EOK) {
-		errno = rc;
+	int phone = async_connect_me_to_internal(exch->phone, iface, arg2,
+	    arg3, IPC_FLAG_BLOCKING);
+	if (phone < 0) {
+		errno = phone;
 		free(sess);
 		return NULL;
@@ -2396,8 +2383,7 @@
 	}
 	
-	cap_handle_t phone;
-	errno_t rc = ipc_connect_kbox(id, &phone);
-	if (rc != EOK) {
-		errno = rc;
+	int phone = ipc_connect_kbox(id);
+	if (phone < 0) {
+		errno = phone;
 		free(sess);
 		return NULL;
@@ -2421,5 +2407,5 @@
 }
 
-static errno_t async_hangup_internal(int phone)
+static int async_hangup_internal(int phone)
 {
 	return ipc_hangup(phone);
@@ -2430,8 +2416,8 @@
  * @param sess Session to hung up.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t async_hangup(async_sess_t *sess)
+ * @return Zero on success or a negative error code.
+ *
+ */
+int async_hangup(async_sess_t *sess)
 {
 	async_exch_t *exch;
@@ -2444,5 +2430,5 @@
 	fibril_mutex_lock(&async_sess_mutex);
 	
-	errno_t rc = async_hangup_internal(sess->phone);
+	int rc = async_hangup_internal(sess->phone);
 	
 	while (!list_empty(&sess->exch_list)) {
@@ -2516,5 +2502,4 @@
 		} else if (mgmt == EXCHANGE_PARALLEL) {
 			int phone;
-			errno_t rc;
 			
 		retry:
@@ -2522,7 +2507,7 @@
 			 * Make a one-time attempt to connect a new data phone.
 			 */
-			rc = async_connect_me_to_internal(sess->phone, sess->arg1,
-			    sess->arg2, sess->arg3, 0, &phone);
-			if (rc == EOK) {
+			phone = async_connect_me_to_internal(sess->phone, sess->arg1,
+			    sess->arg2, sess->arg3, 0);
+			if (phone >= 0) {
 				exch = (async_exch_t *) malloc(sizeof(async_exch_t));
 				if (exch != NULL) {
@@ -2610,8 +2595,8 @@
  *              base address. Cannot be NULL.
  *
- * @return Zero on success or an error code from errno.h.
- *
- */
-errno_t async_share_in_start(async_exch_t *exch, size_t size, sysarg_t arg,
+ * @return Zero on success or a negative error code from errno.h.
+ *
+ */
+int async_share_in_start(async_exch_t *exch, size_t size, sysarg_t arg,
     unsigned int *flags, void **dst)
 {
@@ -2621,5 +2606,5 @@
 	sysarg_t _flags = 0;
 	sysarg_t _dst = (sysarg_t) -1;
-	errno_t res = async_req_2_4(exch, IPC_M_SHARE_IN, (sysarg_t) size,
+	int res = async_req_2_4(exch, IPC_M_SHARE_IN, (sysarg_t) size,
 	    arg, NULL, &_flags, NULL, &_dst);
 	
@@ -2673,5 +2658,5 @@
  *
  */
-errno_t async_share_in_finalize(cap_handle_t chandle, void *src, unsigned int flags)
+int async_share_in_finalize(cap_handle_t chandle, void *src, unsigned int flags)
 {
 	return ipc_answer_3(chandle, EOK, (sysarg_t) src, (sysarg_t) flags,
@@ -2685,8 +2670,8 @@
  * @param flags Flags to be used for sharing. Bits can be only cleared.
  *
- * @return Zero on success or an error code from errno.h.
- *
- */
-errno_t async_share_out_start(async_exch_t *exch, void *src, unsigned int flags)
+ * @return Zero on success or a negative error code from errno.h.
+ *
+ */
+int async_share_out_start(async_exch_t *exch, void *src, unsigned int flags)
 {
 	if (exch == NULL)
@@ -2743,5 +2728,5 @@
  *
  */
-errno_t async_share_out_finalize(cap_handle_t chandle, void **dst)
+int async_share_out_finalize(cap_handle_t chandle, void **dst)
 {
 	return ipc_answer_2(chandle, EOK, (sysarg_t) __entry, (sysarg_t) dst);
@@ -2771,8 +2756,8 @@
  * @param size Size of the destination buffer.
  *
- * @return Zero on success or an error code from errno.h.
- *
- */
-errno_t async_data_read_start(async_exch_t *exch, void *dst, size_t size)
+ * @return Zero on success or a negative error code from errno.h.
+ *
+ */
+int async_data_read_start(async_exch_t *exch, void *dst, size_t size)
 {
 	if (exch == NULL)
@@ -2848,5 +2833,5 @@
  *
  */
-errno_t async_data_read_finalize(cap_handle_t chandle, const void *src, size_t size)
+int async_data_read_finalize(cap_handle_t chandle, const void *src, size_t size)
 {
 	return ipc_answer_2(chandle, EOK, (sysarg_t) src, (sysarg_t) size);
@@ -2856,5 +2841,5 @@
  *
  */
-errno_t async_data_read_forward_fast(async_exch_t *exch, sysarg_t imethod,
+int async_data_read_forward_fast(async_exch_t *exch, sysarg_t imethod,
     sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4,
     ipc_call_t *dataptr)
@@ -2876,5 +2861,5 @@
 	}
 	
-	errno_t retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,
+	int retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,
 	    IPC_FF_ROUTE_FROM_ME);
 	if (retval != EOK) {
@@ -2884,8 +2869,8 @@
 	}
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(msg, &rc);
 	
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -2896,8 +2881,8 @@
  * @param size Size of the source buffer.
  *
- * @return Zero on success or an error code from errno.h.
- *
- */
-errno_t async_data_write_start(async_exch_t *exch, const void *src, size_t size)
+ * @return Zero on success or a negative error code from errno.h.
+ *
+ */
+int async_data_write_start(async_exch_t *exch, const void *src, size_t size)
 {
 	if (exch == NULL)
@@ -2973,5 +2958,5 @@
  *
  */
-errno_t async_data_write_finalize(cap_handle_t chandle, void *dst, size_t size)
+int async_data_write_finalize(cap_handle_t chandle, void *dst, size_t size)
 {
 	return ipc_answer_2(chandle, EOK, (sysarg_t) dst, (sysarg_t) size);
@@ -2999,5 +2984,5 @@
  *
  */
-errno_t async_data_write_accept(void **data, const bool nullterm,
+int async_data_write_accept(void **data, const bool nullterm,
     const size_t min_size, const size_t max_size, const size_t granularity,
     size_t *received)
@@ -3039,5 +3024,5 @@
 	}
 	
-	errno_t rc = async_data_write_finalize(chandle, arg_data, size);
+	int rc = async_data_write_finalize(chandle, arg_data, size);
 	if (rc != EOK) {
 		free(arg_data);
@@ -3062,5 +3047,5 @@
  *
  */
-void async_data_write_void(errno_t retval)
+void async_data_write_void(sysarg_t retval)
 {
 	cap_handle_t chandle;
@@ -3072,5 +3057,5 @@
  *
  */
-errno_t async_data_write_forward_fast(async_exch_t *exch, sysarg_t imethod,
+int async_data_write_forward_fast(async_exch_t *exch, sysarg_t imethod,
     sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4,
     ipc_call_t *dataptr)
@@ -3092,5 +3077,5 @@
 	}
 	
-	errno_t retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,
+	int retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,
 	    IPC_FF_ROUTE_FROM_ME);
 	if (retval != EOK) {
@@ -3100,8 +3085,8 @@
 	}
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(msg, &rc);
 	
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -3197,5 +3182,5 @@
 }
 
-errno_t async_state_change_start(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
+int async_state_change_start(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
     sysarg_t arg3, async_exch_t *other_exch)
 {
@@ -3225,5 +3210,5 @@
 }
 
-errno_t async_state_change_finalize(cap_handle_t chandle, async_exch_t *other_exch)
+int async_state_change_finalize(cap_handle_t chandle, async_exch_t *other_exch)
 {
 	return ipc_answer_1(chandle, EOK, other_exch->phone);
Index: uspace/lib/c/generic/bd.c
===================================================================
--- uspace/lib/c/generic/bd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/bd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,5 +48,5 @@
 static void bd_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
 
-errno_t bd_open(async_sess_t *sess, bd_t **rbd)
+int bd_open(async_sess_t *sess, bd_t **rbd)
 {
 	bd_t *bd = calloc(1, sizeof(bd_t));
@@ -59,5 +59,5 @@
 	
 	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_BLOCK_CB, 0, 0,
+	int rc = async_create_callback_port(exch, INTERFACE_BLOCK_CB, 0, 0,
 	    bd_cb_conn, bd, &port);
 	
@@ -83,5 +83,5 @@
 }
 
-errno_t bd_read_blocks(bd_t *bd, aoff64_t ba, size_t cnt, void *data, size_t size)
+int bd_read_blocks(bd_t *bd, aoff64_t ba, size_t cnt, void *data, size_t size)
 {
 	async_exch_t *exch = async_exchange_begin(bd->sess);
@@ -90,5 +90,5 @@
 	aid_t req = async_send_3(exch, BD_READ_BLOCKS, LOWER32(ba),
 	    UPPER32(ba), cnt, &answer);
-	errno_t rc = async_data_read_start(exch, data, size);
+	int rc = async_data_read_start(exch, data, size);
 	async_exchange_end(exch);
 
@@ -98,5 +98,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
@@ -107,5 +107,5 @@
 }
 
-errno_t bd_read_toc(bd_t *bd, uint8_t session, void *buf, size_t size)
+int bd_read_toc(bd_t *bd, uint8_t session, void *buf, size_t size)
 {
 	async_exch_t *exch = async_exchange_begin(bd->sess);
@@ -113,5 +113,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_1(exch, BD_READ_TOC, session, &answer);
-	errno_t rc = async_data_read_start(exch, buf, size);
+	int rc = async_data_read_start(exch, buf, size);
 	async_exchange_end(exch);
 
@@ -121,5 +121,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
@@ -130,5 +130,5 @@
 }
 
-errno_t bd_write_blocks(bd_t *bd, aoff64_t ba, size_t cnt, const void *data,
+int bd_write_blocks(bd_t *bd, aoff64_t ba, size_t cnt, const void *data,
     size_t size)
 {
@@ -138,5 +138,5 @@
 	aid_t req = async_send_3(exch, BD_WRITE_BLOCKS, LOWER32(ba),
 	    UPPER32(ba), cnt, &answer);
-	errno_t rc = async_data_write_start(exch, data, size);
+	int rc = async_data_write_start(exch, data, size);
 	async_exchange_end(exch);
 
@@ -146,5 +146,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	if (retval != EOK)
@@ -154,9 +154,9 @@
 }
 
-errno_t bd_sync_cache(bd_t *bd, aoff64_t ba, size_t cnt)
-{
-	async_exch_t *exch = async_exchange_begin(bd->sess);
-
-	errno_t rc = async_req_3_0(exch, BD_SYNC_CACHE, LOWER32(ba),
+int bd_sync_cache(bd_t *bd, aoff64_t ba, size_t cnt)
+{
+	async_exch_t *exch = async_exchange_begin(bd->sess);
+
+	int rc = async_req_3_0(exch, BD_SYNC_CACHE, LOWER32(ba),
 	    UPPER32(ba), cnt);
 	async_exchange_end(exch);
@@ -165,10 +165,10 @@
 }
 
-errno_t bd_get_block_size(bd_t *bd, size_t *rbsize)
+int bd_get_block_size(bd_t *bd, size_t *rbsize)
 {
 	sysarg_t bsize;
 	async_exch_t *exch = async_exchange_begin(bd->sess);
 
-	errno_t rc = async_req_0_1(exch, BD_GET_BLOCK_SIZE, &bsize);
+	int rc = async_req_0_1(exch, BD_GET_BLOCK_SIZE, &bsize);
 	async_exchange_end(exch);
 
@@ -180,5 +180,5 @@
 }
 
-errno_t bd_get_num_blocks(bd_t *bd, aoff64_t *rnb)
+int bd_get_num_blocks(bd_t *bd, aoff64_t *rnb)
 {
 	sysarg_t nb_l;
@@ -186,5 +186,5 @@
 	async_exch_t *exch = async_exchange_begin(bd->sess);
 
-	errno_t rc = async_req_0_2(exch, BD_GET_NUM_BLOCKS, &nb_l, &nb_h);
+	int rc = async_req_0_2(exch, BD_GET_NUM_BLOCKS, &nb_l, &nb_h);
 	async_exchange_end(exch);
 
Index: uspace/lib/c/generic/bd_srv.c
===================================================================
--- uspace/lib/c/generic/bd_srv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/bd_srv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
 	void *buf;
 	size_t size;
-	errno_t rc;
+	int rc;
 	ipc_callid_t rcallid;
 
@@ -95,5 +95,5 @@
 	void *buf;
 	size_t size;
-	errno_t rc;
+	int rc;
 	ipc_callid_t rcallid;
 
@@ -138,5 +138,5 @@
 	aoff64_t ba;
 	size_t cnt;
-	errno_t rc;
+	int rc;
 
 	ba = MERGE_LOUP32(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call));
@@ -159,5 +159,5 @@
 	void *data;
 	size_t size;
-	errno_t rc;
+	int rc;
 
 	ba = MERGE_LOUP32(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call));
@@ -183,5 +183,5 @@
     ipc_call_t *call)
 {
-	errno_t rc;
+	int rc;
 	size_t block_size;
 
@@ -198,5 +198,5 @@
     ipc_call_t *call)
 {
-	errno_t rc;
+	int rc;
 	aoff64_t num_blocks;
 
@@ -228,8 +228,8 @@
 }
 
-errno_t bd_conn(ipc_callid_t iid, ipc_call_t *icall, bd_srvs_t *srvs)
+int bd_conn(ipc_callid_t iid, ipc_call_t *icall, bd_srvs_t *srvs)
 {
 	bd_srv_t *srv;
-	errno_t rc;
+	int rc;
 
 	/* Accept the connection */
Index: uspace/lib/c/generic/cap.c
===================================================================
--- uspace/lib/c/generic/cap.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/cap.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -81,5 +81,5 @@
  * and @c cv_max gives the maximum value.
  */
-errno_t cap_to_blocks(cap_spec_t *cap, cap_vsel_t cvsel, size_t block_size,
+int cap_to_blocks(cap_spec_t *cap, cap_vsel_t cvsel, size_t block_size,
     uint64_t *rblocks)
 {
@@ -90,5 +90,5 @@
 	uint64_t blocks;
 	uint64_t rem;
-	errno_t rc;
+	int rc;
 
 	exp = cap->cunit * 3 - cap->dp;
@@ -144,5 +144,5 @@
 	unsigned sdig;
 	unsigned rdig;
-	errno_t rc;
+	int rc;
 
 	/* Change units so that we have at most @c scap_max_idig integer digits */
@@ -175,8 +175,7 @@
 }
 
-errno_t cap_format(cap_spec_t *cap, char **rstr)
-{
-	errno_t rc;
-	int ret;
+int cap_format(cap_spec_t *cap, char **rstr)
+{
+	int rc;
 	const char *sunit;
 	uint64_t ipart;
@@ -197,10 +196,10 @@
 	sunit = cu_str[cap->cunit];
 	if (cap->dp > 0) {
-		ret = asprintf(rstr, "%" PRIu64 ".%0*" PRIu64 " %s", ipart,
+		rc = asprintf(rstr, "%" PRIu64 ".%0*" PRIu64 " %s", ipart,
 		    (int)cap->dp, fpart, sunit);
 	} else {
-		ret = asprintf(rstr, "%" PRIu64 " %s", ipart, sunit);
-	}
-	if (ret < 0)
+		rc = asprintf(rstr, "%" PRIu64 " %s", ipart, sunit);
+	}
+	if (rc < 0)
 		return ENOMEM;
 
@@ -208,5 +207,5 @@
 }
 
-static errno_t cap_digit_val(char c, int *val)
+static int cap_digit_val(char c, int *val)
 {
 	switch (c) {
@@ -228,5 +227,5 @@
 }
 
-errno_t cap_parse(const char *str, cap_spec_t *cap)
+int cap_parse(const char *str, cap_spec_t *cap)
 {
 	const char *eptr;
Index: uspace/lib/c/generic/clipboard.c
===================================================================
--- uspace/lib/c/generic/clipboard.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/clipboard.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,5 +59,5 @@
 {
 	service_id_t sid;
-	errno_t rc;
+	int rc;
 	
 	fibril_mutex_lock(&clip_mutex);
@@ -95,8 +95,8 @@
  * @param str String to put to clipboard or NULL.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t clipboard_put_str(const char *str)
+ * @return Zero on success or negative error code.
+ *
+ */
+int clipboard_put_str(const char *str)
 {
 	size_t size = str_size(str);
@@ -104,28 +104,28 @@
 	if (size == 0) {
 		async_exch_t *exch = clip_exchange_begin();
-		errno_t rc = async_req_1_0(exch, CLIPBOARD_PUT_DATA,
+		sysarg_t rc = async_req_1_0(exch, CLIPBOARD_PUT_DATA,
 		    CLIPBOARD_TAG_NONE);
 		clip_exchange_end(exch);
 		
-		return (errno_t) rc;
+		return (int) rc;
 	} else {
 		async_exch_t *exch = clip_exchange_begin();
 		aid_t req = async_send_1(exch, CLIPBOARD_PUT_DATA, CLIPBOARD_TAG_DATA,
 		    NULL);
-		errno_t rc = async_data_write_start(exch, (void *) str, size);
+		sysarg_t rc = async_data_write_start(exch, (void *) str, size);
 		clip_exchange_end(exch);
 		
 		if (rc != EOK) {
-			errno_t rc_orig;
+			sysarg_t rc_orig;
 			async_wait_for(req, &rc_orig);
 			if (rc_orig == EOK)
-				return (errno_t) rc;
+				return (int) rc;
 			else
-				return (errno_t) rc_orig;
+				return (int) rc_orig;
 		}
 		
 		async_wait_for(req, &rc);
 		
-		return (errno_t) rc;
+		return (int) rc;
 	}
 }
@@ -137,8 +137,8 @@
  * @param str Here pointer to the newly allocated string is stored.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t clipboard_get_str(char **str)
+ * @return Zero on success or negative error code.
+ *
+ */
+int clipboard_get_str(char **str)
 {
 	/* Loop until clipboard read succesful */
@@ -148,10 +148,10 @@
 		sysarg_t size;
 		sysarg_t tag;
-		errno_t rc = async_req_0_2(exch, CLIPBOARD_CONTENT, &size, &tag);
+		sysarg_t rc = async_req_0_2(exch, CLIPBOARD_CONTENT, &size, &tag);
 		
 		clip_exchange_end(exch);
 		
 		if (rc != EOK)
-			return (errno_t) rc;
+			return (int) rc;
 		
 		char *sbuf;
@@ -176,5 +176,5 @@
 			clip_exchange_end(exch);
 			
-			if ((errno_t) rc == EOVERFLOW) {
+			if ((int) rc == EOVERFLOW) {
 				/*
 				 * The data in the clipboard has changed since
@@ -185,10 +185,10 @@
 			
 			if (rc != EOK) {
-				errno_t rc_orig;
+				sysarg_t rc_orig;
 				async_wait_for(req, &rc_orig);
 				if (rc_orig == EOK)
-					return (errno_t) rc;
+					return (int) rc;
 				else
-					return (errno_t) rc_orig;
+					return (int) rc_orig;
 			}
 			
Index: uspace/lib/c/generic/corecfg.c
===================================================================
--- uspace/lib/c/generic/corecfg.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/corecfg.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,8 +38,8 @@
 static async_sess_t *corecfg_sess = NULL;
 
-errno_t corecfg_init(void)
+int corecfg_init(void)
 {
 	service_id_t corecfg_svc;
-	errno_t rc;
+	int rc;
 
 	assert(corecfg_sess == NULL);
@@ -59,10 +59,10 @@
 
 /** Get core dump enable status. */
-errno_t corecfg_get_enable(bool *renable)
+int corecfg_get_enable(bool *renable)
 {
 	async_exch_t *exch = async_exchange_begin(corecfg_sess);
 	sysarg_t enable;
 
-	errno_t rc = async_req_0_1(exch, CORECFG_GET_ENABLE, &enable);
+	int rc = async_req_0_1(exch, CORECFG_GET_ENABLE, &enable);
 
 	async_exchange_end(exch);
@@ -76,8 +76,8 @@
 
 /** Enable or disable core dumps. */
-errno_t corecfg_set_enable(bool enable)
+int corecfg_set_enable(bool enable)
 {
 	async_exch_t *exch = async_exchange_begin(corecfg_sess);
-	errno_t rc = async_req_1_0(exch, CORECFG_SET_ENABLE, (sysarg_t) enable);
+	int rc = async_req_1_0(exch, CORECFG_SET_ENABLE, (sysarg_t) enable);
 
 	async_exchange_end(exch);
Index: uspace/lib/c/generic/ddi.c
===================================================================
--- uspace/lib/c/generic/ddi.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/ddi.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -69,7 +69,7 @@
  *
  */
-errno_t physmem_map(uintptr_t phys, size_t pages, unsigned int flags, void **virt)
-{
-	return (errno_t) __SYSCALL5(SYS_PHYSMEM_MAP, (sysarg_t) phys,
+int physmem_map(uintptr_t phys, size_t pages, unsigned int flags, void **virt)
+{
+	return __SYSCALL5(SYS_PHYSMEM_MAP, (sysarg_t) phys,
 	    pages, flags, (sysarg_t) virt, (sysarg_t) __entry);
 }
@@ -85,7 +85,7 @@
  *
  */
-errno_t physmem_unmap(void *virt)
-{
-	return (errno_t) __SYSCALL1(SYS_PHYSMEM_UNMAP, (sysarg_t) virt);
+int physmem_unmap(void *virt)
+{
+	return __SYSCALL1(SYS_PHYSMEM_UNMAP, (sysarg_t) virt);
 }
 
@@ -110,8 +110,8 @@
  *
  */
-errno_t dmamem_map(void *virt, size_t size, unsigned int map_flags,
+int dmamem_map(void *virt, size_t size, unsigned int map_flags,
     unsigned int flags, uintptr_t *phys)
 {
-	return (errno_t) __SYSCALL6(SYS_DMAMEM_MAP, (sysarg_t) size,
+	return (int) __SYSCALL6(SYS_DMAMEM_MAP, (sysarg_t) size,
 	    (sysarg_t) map_flags, (sysarg_t) flags & ~DMAMEM_FLAGS_ANONYMOUS,
 	    (sysarg_t) phys, (sysarg_t) virt, 0);
@@ -138,22 +138,22 @@
  *
  */
-errno_t dmamem_map_anonymous(size_t size, uintptr_t constraint,
+int dmamem_map_anonymous(size_t size, uintptr_t constraint,
     unsigned int map_flags, unsigned int flags, uintptr_t *phys, void **virt)
 {
 	*phys = constraint;
 	
-	return (errno_t) __SYSCALL6(SYS_DMAMEM_MAP, (sysarg_t) size,
+	return (int) __SYSCALL6(SYS_DMAMEM_MAP, (sysarg_t) size,
 	    (sysarg_t) map_flags, (sysarg_t) flags | DMAMEM_FLAGS_ANONYMOUS,
 	    (sysarg_t) phys, (sysarg_t) virt, (sysarg_t) __entry);
 }
 
-errno_t dmamem_unmap(void *virt, size_t size)
-{
-	return (errno_t) __SYSCALL3(SYS_DMAMEM_UNMAP, (sysarg_t) virt, (sysarg_t) size, 0);
-}
-
-errno_t dmamem_unmap_anonymous(void *virt)
-{
-	return (errno_t) __SYSCALL3(SYS_DMAMEM_UNMAP, (sysarg_t) virt, 0,
+int dmamem_unmap(void *virt, size_t size)
+{
+	return __SYSCALL3(SYS_DMAMEM_UNMAP, (sysarg_t) virt, (sysarg_t) size, 0);
+}
+
+int dmamem_unmap_anonymous(void *virt)
+{
+	return __SYSCALL3(SYS_DMAMEM_UNMAP, (sysarg_t) virt, 0,
 	    DMAMEM_FLAGS_ANONYMOUS);
 }
@@ -173,5 +173,5 @@
  *
  */
-static errno_t iospace_enable(task_id_t id, void *ioaddr, size_t size)
+static int iospace_enable(task_id_t id, void *ioaddr, size_t size)
 {
 	const ddi_ioarg_t arg = {
@@ -181,5 +181,5 @@
 	};
 	
-	return (errno_t) __SYSCALL1(SYS_IOSPACE_ENABLE, (sysarg_t) &arg);
+	return __SYSCALL1(SYS_IOSPACE_ENABLE, (sysarg_t) &arg);
 }
 
@@ -197,5 +197,5 @@
  *
  */
-static errno_t iospace_disable(task_id_t id, void *ioaddr, size_t size)
+static int iospace_disable(task_id_t id, void *ioaddr, size_t size)
 {
 	const ddi_ioarg_t arg = {
@@ -205,5 +205,5 @@
 	};
 	
-	return (errno_t) __SYSCALL1(SYS_IOSPACE_DISABLE, (sysarg_t) &arg);
+	return __SYSCALL1(SYS_IOSPACE_DISABLE, (sysarg_t) &arg);
 }
 
@@ -213,5 +213,5 @@
  * @param virt  Virtual address for application's PIO operations. 
  */
-errno_t pio_enable_range(addr_range_t *range, void **virt)
+int pio_enable_range(addr_range_t *range, void **virt)
 {
 	return pio_enable(RNGABSPTR(*range), RNGSZ(*range), virt);
@@ -226,8 +226,8 @@
  *
  * @return EOK on success.
- * @return An error code on failure.
- *
- */
-errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt)
+ * @return Negative error code on failure.
+ *
+ */
+int pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt)
 {
 	uintptr_t addr;
@@ -268,8 +268,8 @@
  *
  * @return EOK on success.
- * @return An error code on failure.
- *
- */
-errno_t pio_enable(void *pio_addr, size_t size, void **virt)
+ * @return Negative error code on failure.
+ *
+ */
+int pio_enable(void *pio_addr, size_t size, void **virt)
 {
 #ifdef IO_SPACE_BOUNDARY
@@ -291,5 +291,5 @@
 	
 	void *virt_page = AS_AREA_ANY;
-	errno_t rc = physmem_map(phys_frame, pages,
+	int rc = physmem_map(phys_frame, pages,
 	    AS_AREA_READ | AS_AREA_WRITE, &virt_page);
 	if (rc != EOK)
@@ -306,8 +306,8 @@
  *
  * @return EOK on success.
- * @return An error code on failure.
- *
- */
-errno_t pio_disable(void *virt, size_t size)
+ * @return Negative error code on failure.
+ *
+ */
+int pio_disable(void *virt, size_t size)
 {
 #ifdef IO_SPACE_BOUNDARY
Index: uspace/lib/c/generic/device/clock_dev.c
===================================================================
--- uspace/lib/c/generic/device/clock_dev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/device/clock_dev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,11 +44,11 @@
  * @param t        The current time that will be read from the device
  *
- * @return         EOK on success or an error code
+ * @return         EOK on success or a negative error code
  */
-errno_t
+int
 clock_dev_time_get(async_sess_t *sess, struct tm *t)
 {
 	aid_t req;
-	errno_t ret;
+	int ret;
 
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -60,5 +60,5 @@
 	async_exchange_end(exch);
 
-	errno_t rc;
+	sysarg_t rc;
 	if (ret != EOK) {
 		async_forget(req);
@@ -67,5 +67,5 @@
 
 	async_wait_for(req, &rc);
-	return (errno_t)rc;
+	return (int)rc;
 }
 
@@ -75,11 +75,11 @@
  * @param t      The current time that will be written to the device
  *
- * @return       EOK on success or an error code
+ * @return       EOK on success or a negative error code
  */
-errno_t
+int
 clock_dev_time_set(async_sess_t *sess, struct tm *t)
 {
 	aid_t req;
-	errno_t ret;
+	int ret;
 
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -91,5 +91,5 @@
 	async_exchange_end(exch);
 
-	errno_t rc;
+	sysarg_t rc;
 	if (ret != EOK) {
 		async_forget(req);
@@ -98,5 +98,5 @@
 
 	async_wait_for(req, &rc);
-	return (errno_t)rc;
+	return (int)rc;
 }
 
Index: uspace/lib/c/generic/device/hw_res.c
===================================================================
--- uspace/lib/c/generic/device/hw_res.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/device/hw_res.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include <stdlib.h>
 
-errno_t hw_res_get_resource_list(async_sess_t *sess,
+int hw_res_get_resource_list(async_sess_t *sess,
     hw_resource_list_t *hw_resources)
 {
@@ -45,5 +45,5 @@
 	async_exch_t *exch = async_exchange_begin(sess);
 	
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
+	int rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
 	    HW_RES_GET_RESOURCE_LIST, &count);
 	
@@ -75,9 +75,9 @@
 }
 
-errno_t hw_res_enable_interrupt(async_sess_t *sess, int irq)
+int hw_res_enable_interrupt(async_sess_t *sess, int irq)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
 	
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
+	int rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
 	    HW_RES_ENABLE_INTERRUPT, irq);
 	async_exchange_end(exch);
@@ -86,9 +86,9 @@
 }
 
-errno_t hw_res_disable_interrupt(async_sess_t *sess, int irq)
+int hw_res_disable_interrupt(async_sess_t *sess, int irq)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
 	
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
+	int rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
 	    HW_RES_DISABLE_INTERRUPT, irq);
 	async_exchange_end(exch);
@@ -97,9 +97,9 @@
 }
 
-errno_t hw_res_clear_interrupt(async_sess_t *sess, int irq)
+int hw_res_clear_interrupt(async_sess_t *sess, int irq)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
 	
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
+	int rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
 	    HW_RES_CLEAR_INTERRUPT, irq);
 	async_exchange_end(exch);
@@ -122,5 +122,5 @@
  *
  */
-errno_t hw_res_dma_channel_setup(async_sess_t *sess,
+int hw_res_dma_channel_setup(async_sess_t *sess,
     unsigned channel, uint32_t pa, uint32_t size, uint8_t mode)
 {
@@ -128,5 +128,5 @@
 	
 	const uint32_t packed = (channel & 0xffff) | (mode << 16);
-	const errno_t ret = async_req_4_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
+	const int ret = async_req_4_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
 	    HW_RES_DMA_CHANNEL_SETUP, packed, pa, size);
 	
@@ -140,15 +140,14 @@
  * @param channel DMA channel.
  *
- * @param[out] rem Number of bytes remaining in the buffer if positive.
- *
- * @return Error code.
+ * @return Number of bytes remaining in the buffer if positive.
+ * @return Error code if negative.
  *
  */
-errno_t hw_res_dma_channel_remain(async_sess_t *sess, unsigned channel, size_t *rem)
+int hw_res_dma_channel_remain(async_sess_t *sess, unsigned channel)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
 	
 	sysarg_t remain;
-	const errno_t ret = async_req_2_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
+	const int ret = async_req_2_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
 	    HW_RES_DMA_CHANNEL_REMAIN, channel, &remain);
 	
@@ -156,5 +155,5 @@
 	
 	if (ret == EOK)
-		*rem = remain;
+		return remain;
 	
 	return ret;
Index: uspace/lib/c/generic/device/hw_res_parsed.c
===================================================================
--- uspace/lib/c/generic/device/hw_res_parsed.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/device/hw_res_parsed.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -194,5 +194,5 @@
  *
  */
-errno_t hw_res_list_parse(const pio_window_t *win,
+int hw_res_list_parse(const pio_window_t *win,
     const hw_resource_list_t *res, hw_res_list_parsed_t *out, int flags)
 {
@@ -253,9 +253,9 @@
  *
  */
-errno_t hw_res_get_list_parsed(async_sess_t *sess,
+int hw_res_get_list_parsed(async_sess_t *sess,
     hw_res_list_parsed_t *hw_res_parsed, int flags)
 {
 	pio_window_t pio_window;
-	errno_t rc;
+	int rc;
 
 	if (!hw_res_parsed)
Index: uspace/lib/c/generic/device/led_dev.c
===================================================================
--- uspace/lib/c/generic/device/led_dev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/device/led_dev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include <device/led_dev.h>
 
-errno_t led_dev_color_set(async_sess_t *sess, pixel_t pixel)
+int led_dev_color_set(async_sess_t *sess, pixel_t pixel)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -48,8 +48,8 @@
 	async_exchange_end(exch);
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(req, &rc);
 	
-	return (errno_t) rc;
+	return (int) rc;
 }
 
Index: uspace/lib/c/generic/device/pio_window.c
===================================================================
--- uspace/lib/c/generic/device/pio_window.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/device/pio_window.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,7 +37,7 @@
 #include <async.h>
 
-errno_t pio_window_get(async_sess_t *sess, pio_window_t *pio_win)
+int pio_window_get(async_sess_t *sess, pio_window_t *pio_win)
 {
-	errno_t rc;
+	int rc;
 
 	async_exch_t *exch = async_exchange_begin(sess);
Index: uspace/lib/c/generic/devman.c
===================================================================
--- uspace/lib/c/generic/devman.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/devman.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -176,5 +176,5 @@
 
 /** Register running driver with device manager. */
-errno_t devman_driver_register(const char *name)
+int devman_driver_register(const char *name)
 {
 	async_exch_t *exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
@@ -182,5 +182,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_2(exch, DEVMAN_DRIVER_REGISTER, 0, 0, &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
+	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
 	
 	devman_exchange_end(exch);
@@ -210,8 +210,8 @@
  * @param funh      Place to store handle of the new function
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t devman_add_function(const char *name, fun_type_t ftype,
+ * @return EOK on success or negative error code.
+ *
+ */
+int devman_add_function(const char *name, fun_type_t ftype,
     match_id_list_t *match_ids, devman_handle_t devh, devman_handle_t *funh)
 {
@@ -222,5 +222,5 @@
 	aid_t req = async_send_3(exch, DEVMAN_ADD_FUNCTION, (sysarg_t) ftype,
 	    devh, match_count, &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
+	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
 	if (retval != EOK) {
 		devman_exchange_end(exch);
@@ -264,5 +264,5 @@
 }
 
-errno_t devman_add_device_to_category(devman_handle_t devman_handle,
+int devman_add_device_to_category(devman_handle_t devman_handle,
     const char *cat_name)
 {
@@ -272,5 +272,5 @@
 	aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_CATEGORY,
 	    devman_handle, &answer);
-	errno_t retval = async_data_write_start(exch, cat_name,
+	sysarg_t retval = async_data_write_start(exch, cat_name,
 	    str_size(cat_name));
 	
@@ -305,10 +305,10 @@
  * @param funh      Devman handle of the function
  *
- * @return EOK on success or an error code.
- */
-errno_t devman_remove_function(devman_handle_t funh)
+ * @return EOK on success or negative error code.
+ */
+int devman_remove_function(devman_handle_t funh)
 {
 	async_exch_t *exch;
-	errno_t retval;
+	sysarg_t retval;
 	
 	exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
@@ -316,8 +316,8 @@
 	devman_exchange_end(exch);
 	
-	return retval;
-}
-
-errno_t devman_drv_fun_online(devman_handle_t funh)
+	return (int) retval;
+}
+
+int devman_drv_fun_online(devman_handle_t funh)
 {
 	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
@@ -325,11 +325,11 @@
 		return ENOMEM;
 	
-	errno_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_ONLINE, funh);
-	
-	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_drv_fun_offline(devman_handle_t funh)
+	sysarg_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_ONLINE, funh);
+	
+	devman_exchange_end(exch);
+	return (int) retval;
+}
+
+int devman_drv_fun_offline(devman_handle_t funh)
 {
 	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
@@ -337,8 +337,8 @@
 		return ENOMEM;
 	
-	errno_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_OFFLINE, funh);
-	
-	devman_exchange_end(exch);
-	return retval;
+	sysarg_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_OFFLINE, funh);
+	
+	devman_exchange_end(exch);
+	return (int) retval;
 }
 
@@ -358,5 +358,5 @@
 }
 
-errno_t devman_fun_get_handle(const char *pathname, devman_handle_t *handle,
+int devman_fun_get_handle(const char *pathname, devman_handle_t *handle,
     unsigned int flags)
 {
@@ -374,5 +374,5 @@
 	aid_t req = async_send_2(exch, DEVMAN_DEVICE_GET_HANDLE, flags, 0,
 	    &answer);
-	errno_t retval = async_data_write_start(exch, pathname,
+	sysarg_t retval = async_data_write_start(exch, pathname,
 	    str_size(pathname));
 	
@@ -399,5 +399,5 @@
 }
 
-static errno_t devman_get_str_internal(sysarg_t method, sysarg_t arg1,
+static int devman_get_str_internal(sysarg_t method, sysarg_t arg1,
     sysarg_t arg2, sysarg_t *r1, char *buf, size_t buf_size)
 {
@@ -405,5 +405,5 @@
 	ipc_call_t dreply;
 	size_t act_size;
-	errno_t dretval;
+	sysarg_t dretval;
 	
 	exch = devman_exchange_begin_blocking(INTERFACE_DDF_CLIENT);
@@ -421,5 +421,5 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
@@ -437,5 +437,5 @@
 }
 
-errno_t devman_fun_get_path(devman_handle_t handle, char *buf, size_t buf_size)
+int devman_fun_get_path(devman_handle_t handle, char *buf, size_t buf_size)
 {
 	return devman_get_str_internal(DEVMAN_FUN_GET_PATH, handle, 0, NULL,
@@ -443,8 +443,8 @@
 }
 
-errno_t devman_fun_get_match_id(devman_handle_t handle, size_t index, char *buf,
+int devman_fun_get_match_id(devman_handle_t handle, size_t index, char *buf,
     size_t buf_size, unsigned int *rscore)
 {
-	errno_t rc;
+	int rc;
 	sysarg_t score = 0;
 
@@ -458,5 +458,5 @@
 }
 
-errno_t devman_fun_get_name(devman_handle_t handle, char *buf, size_t buf_size)
+int devman_fun_get_name(devman_handle_t handle, char *buf, size_t buf_size)
 {
 	return devman_get_str_internal(DEVMAN_FUN_GET_NAME, handle, 0, NULL,
@@ -464,5 +464,5 @@
 }
 
-errno_t devman_fun_get_driver_name(devman_handle_t handle, char *buf, size_t buf_size)
+int devman_fun_get_driver_name(devman_handle_t handle, char *buf, size_t buf_size)
 {
 	return devman_get_str_internal(DEVMAN_FUN_GET_DRIVER_NAME, handle, 0,
@@ -470,5 +470,5 @@
 }
 
-errno_t devman_fun_online(devman_handle_t funh)
+int devman_fun_online(devman_handle_t funh)
 {
 	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
@@ -476,11 +476,11 @@
 		return ENOMEM;
 	
-	errno_t retval = async_req_1_0(exch, DEVMAN_FUN_ONLINE, funh);
-	
-	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_fun_offline(devman_handle_t funh)
+	sysarg_t retval = async_req_1_0(exch, DEVMAN_FUN_ONLINE, funh);
+	
+	devman_exchange_end(exch);
+	return (int) retval;
+}
+
+int devman_fun_offline(devman_handle_t funh)
 {
 	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
@@ -488,11 +488,11 @@
 		return ENOMEM;
 	
-	errno_t retval = async_req_1_0(exch, DEVMAN_FUN_OFFLINE, funh);
-	
-	devman_exchange_end(exch);
-	return retval;
-}
-
-static errno_t devman_get_handles_once(sysarg_t method, sysarg_t arg1,
+	sysarg_t retval = async_req_1_0(exch, DEVMAN_FUN_OFFLINE, funh);
+	
+	devman_exchange_end(exch);
+	return (int) retval;
+}
+
+static int devman_get_handles_once(sysarg_t method, sysarg_t arg1,
     devman_handle_t *handle_buf, size_t buf_size, size_t *act_size)
 {
@@ -501,5 +501,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_1(exch, method, arg1, &answer);
-	errno_t rc = async_data_read_start(exch, handle_buf, buf_size);
+	int rc = async_data_read_start(exch, handle_buf, buf_size);
 	
 	devman_exchange_end(exch);
@@ -510,5 +510,5 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
@@ -529,7 +529,7 @@
  * @param data		Place to store pointer to array of handles
  * @param count		Place to store number of handles
- * @return 		EOK on success or an error code
- */
-static errno_t devman_get_handles_internal(sysarg_t method, sysarg_t arg1,
+ * @return 		EOK on success or negative error code
+ */
+static int devman_get_handles_internal(sysarg_t method, sysarg_t arg1,
     devman_handle_t **data, size_t *count)
 {
@@ -537,5 +537,5 @@
 	size_t act_size;
 	size_t alloc_size;
-	errno_t rc;
+	int rc;
 
 	*data = NULL;
@@ -574,5 +574,5 @@
 }
 
-errno_t devman_fun_get_child(devman_handle_t funh, devman_handle_t *devh)
+int devman_fun_get_child(devman_handle_t funh, devman_handle_t *devh)
 {
 	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
@@ -580,12 +580,12 @@
 		return ENOMEM;
 	
-	errno_t retval = async_req_1_1(exch, DEVMAN_FUN_GET_CHILD,
+	sysarg_t retval = async_req_1_1(exch, DEVMAN_FUN_GET_CHILD,
 	    funh, devh);
 	
 	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_dev_get_functions(devman_handle_t devh, devman_handle_t **funcs,
+	return (int) retval;
+}
+
+int devman_dev_get_functions(devman_handle_t devh, devman_handle_t **funcs,
     size_t *count)
 {
@@ -594,5 +594,5 @@
 }
 
-errno_t devman_dev_get_parent(devman_handle_t devh, devman_handle_t *funh)
+int devman_dev_get_parent(devman_handle_t devh, devman_handle_t *funh)
 {
 	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
@@ -600,12 +600,12 @@
 		return ENOMEM;
 	
-	errno_t retval = async_req_1_1(exch, DEVMAN_DEV_GET_PARENT,
+	sysarg_t retval = async_req_1_1(exch, DEVMAN_DEV_GET_PARENT,
 	    devh, funh);
 	
 	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle)
+	return (int) retval;
+}
+
+int devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle)
 {
 	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
@@ -613,12 +613,12 @@
 		return ENOMEM;
 	
-	errno_t retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE,
+	sysarg_t retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE,
 	    sid, handle);
 	
 	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_get_drivers(devman_handle_t **drvs,
+	return (int) retval;
+}
+
+int devman_get_drivers(devman_handle_t **drvs,
     size_t *count)
 {
@@ -626,5 +626,5 @@
 }
 
-errno_t devman_driver_get_devices(devman_handle_t drvh, devman_handle_t **devs,
+int devman_driver_get_devices(devman_handle_t drvh, devman_handle_t **devs,
     size_t *count)
 {
@@ -633,5 +633,5 @@
 }
 
-errno_t devman_driver_get_handle(const char *drvname, devman_handle_t *handle)
+int devman_driver_get_handle(const char *drvname, devman_handle_t *handle)
 {
 	async_exch_t *exch;
@@ -643,5 +643,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, DEVMAN_DRIVER_GET_HANDLE, &answer);
-	errno_t retval = async_data_write_start(exch, drvname,
+	sysarg_t retval = async_data_write_start(exch, drvname,
 	    str_size(drvname));
 	
@@ -668,8 +668,8 @@
 }
 
-errno_t devman_driver_get_match_id(devman_handle_t handle, size_t index, char *buf,
+int devman_driver_get_match_id(devman_handle_t handle, size_t index, char *buf,
     size_t buf_size, unsigned int *rscore)
 {
-	errno_t rc;
+	int rc;
 	sysarg_t score = 0;
 
@@ -683,5 +683,5 @@
 }
 
-errno_t devman_driver_get_name(devman_handle_t handle, char *buf, size_t buf_size)
+int devman_driver_get_name(devman_handle_t handle, char *buf, size_t buf_size)
 {
 	return devman_get_str_internal(DEVMAN_DRIVER_GET_NAME, handle, 0, NULL,
@@ -689,5 +689,5 @@
 }
 
-errno_t devman_driver_get_state(devman_handle_t drvh, driver_state_t *rstate)
+int devman_driver_get_state(devman_handle_t drvh, driver_state_t *rstate)
 {
 	sysarg_t state;
@@ -696,5 +696,5 @@
 		return ENOMEM;
 	
-	errno_t rc = async_req_1_1(exch, DEVMAN_DRIVER_GET_STATE, drvh,
+	int rc = async_req_1_1(exch, DEVMAN_DRIVER_GET_STATE, drvh,
 	    &state);
 	
@@ -707,5 +707,5 @@
 }
 
-errno_t devman_driver_load(devman_handle_t drvh)
+int devman_driver_load(devman_handle_t drvh)
 {
 	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
@@ -713,5 +713,5 @@
 		return ENOMEM;
 	
-	errno_t rc = async_req_1_0(exch, DEVMAN_DRIVER_LOAD, drvh);
+	int rc = async_req_1_0(exch, DEVMAN_DRIVER_LOAD, drvh);
 	
 	devman_exchange_end(exch);
@@ -719,5 +719,5 @@
 }
 
-errno_t devman_driver_unload(devman_handle_t drvh)
+int devman_driver_unload(devman_handle_t drvh)
 {
 	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
@@ -725,5 +725,5 @@
 		return ENOMEM;
 	
-	errno_t rc = async_req_1_0(exch, DEVMAN_DRIVER_UNLOAD, drvh);
+	int rc = async_req_1_0(exch, DEVMAN_DRIVER_UNLOAD, drvh);
 	
 	devman_exchange_end(exch);
Index: uspace/lib/c/generic/dhcp.c
===================================================================
--- uspace/lib/c/generic/dhcp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/dhcp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,8 +44,8 @@
 static async_sess_t *dhcp_sess = NULL;
 
-errno_t dhcp_init(void)
+int dhcp_init(void)
 {
 	service_id_t dhcp_svc;
-	errno_t rc;
+	int rc;
 
 	assert(dhcp_sess == NULL);
@@ -64,9 +64,9 @@
 }
 
-errno_t dhcp_link_add(sysarg_t link_id)
+int dhcp_link_add(sysarg_t link_id)
 {
 	async_exch_t *exch = async_exchange_begin(dhcp_sess);
 
-	errno_t rc = async_req_1_0(exch, DHCP_LINK_ADD, link_id);
+	int rc = async_req_1_0(exch, DHCP_LINK_ADD, link_id);
 	async_exchange_end(exch);
 
@@ -74,9 +74,9 @@
 }
 
-errno_t dhcp_link_remove(sysarg_t link_id)
+int dhcp_link_remove(sysarg_t link_id)
 {
 	async_exch_t *exch = async_exchange_begin(dhcp_sess);
 
-	errno_t rc = async_req_1_0(exch, DHCP_LINK_REMOVE, link_id);
+	int rc = async_req_1_0(exch, DHCP_LINK_REMOVE, link_id);
 	async_exchange_end(exch);
 
@@ -84,9 +84,9 @@
 }
 
-errno_t dhcp_discover(sysarg_t link_id)
+int dhcp_discover(sysarg_t link_id)
 {
 	async_exch_t *exch = async_exchange_begin(dhcp_sess);
 
-	errno_t rc = async_req_1_0(exch, DHCP_DISCOVER, link_id);
+	int rc = async_req_1_0(exch, DHCP_DISCOVER, link_id);
 	async_exchange_end(exch);
 
Index: uspace/lib/c/generic/dirent.c
===================================================================
--- uspace/lib/c/generic/dirent.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/dirent.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,14 +54,13 @@
 	}
 	
-	int fd;
-	errno_t rc = vfs_lookup(dirname, WALK_DIRECTORY, &fd);
-	if (rc != EOK) {
+	int fd = vfs_lookup(dirname, WALK_DIRECTORY);
+	if (fd < 0) {
 		free(dirp);
-		errno = rc;
+		errno = fd;
 		return NULL;
 	}
 	
-	rc = vfs_open(fd, MODE_READ);
-	if (rc != EOK) {
+	int rc = vfs_open(fd, MODE_READ);
+	if (rc < 0) {
 		free(dirp);
 		vfs_put(fd);
@@ -83,5 +82,5 @@
 struct dirent *readdir(DIR *dirp)
 {
-	errno_t rc;
+	int rc;
 	ssize_t len = 0;
 	
@@ -114,13 +113,11 @@
 int closedir(DIR *dirp)
 {
-	errno_t rc = vfs_put(dirp->fd);
+	int rc;
+	
+	rc = vfs_put(dirp->fd);
 	free(dirp);
 
-	if (rc == EOK) {
-		return 0;
-	} else {
-		errno = rc;
-		return -1;
-	}
+	/* On error errno was set by close() */
+	return rc;
 }
 
Index: uspace/lib/c/generic/dnsr.c
===================================================================
--- uspace/lib/c/generic/dnsr.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/dnsr.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -67,5 +67,5 @@
 }
 
-errno_t dnsr_name2host(const char *name, dnsr_hostinfo_t **rinfo, ip_ver_t ver)
+int dnsr_name2host(const char *name, dnsr_hostinfo_t **rinfo, ip_ver_t ver)
 {
 	async_exch_t *exch = dnsr_exchange_begin();
@@ -75,5 +75,5 @@
 	    &answer);
 	
-	errno_t rc = async_data_write_start(exch, name, str_size(name));
+	int rc = async_data_write_start(exch, name, str_size(name));
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -90,5 +90,5 @@
 	    sizeof(inet_addr_t), &answer_addr);
 	
-	errno_t retval_addr;
+	sysarg_t retval_addr;
 	async_wait_for(req_addr, &retval_addr);
 	
@@ -97,5 +97,5 @@
 		async_forget(req);
 		free(info);
-		return retval_addr;
+		return (int) retval_addr;
 	}
 	
@@ -107,5 +107,5 @@
 	dnsr_exchange_end(exch);
 	
-	errno_t retval_cname;
+	sysarg_t retval_cname;
 	async_wait_for(req_cname, &retval_cname);
 	
@@ -113,8 +113,8 @@
 		async_forget(req);
 		free(info);
-		return retval_cname;
+		return (int) retval_cname;
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
@@ -122,5 +122,5 @@
 		async_forget(req);
 		free(info);
-		return retval;
+		return (int) retval;
 	}
 	
@@ -150,5 +150,5 @@
 }
 
-errno_t dnsr_get_srvaddr(inet_addr_t *srvaddr)
+int dnsr_get_srvaddr(inet_addr_t *srvaddr)
 {
 	async_exch_t *exch = dnsr_exchange_begin();
@@ -156,5 +156,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, DNSR_GET_SRVADDR, &answer);
-	errno_t rc = async_data_read_start(exch, srvaddr, sizeof(inet_addr_t));
+	int rc = async_data_read_start(exch, srvaddr, sizeof(inet_addr_t));
 	
 	loc_exchange_end(exch);
@@ -165,11 +165,11 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
-	return retval;
+	return (int) retval;
 }
 
-errno_t dnsr_set_srvaddr(inet_addr_t *srvaddr)
+int dnsr_set_srvaddr(inet_addr_t *srvaddr)
 {
 	async_exch_t *exch = dnsr_exchange_begin();
@@ -177,5 +177,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, DNSR_SET_SRVADDR, &answer);
-	errno_t rc = async_data_write_start(exch, srvaddr, sizeof(inet_addr_t));
+	int rc = async_data_write_start(exch, srvaddr, sizeof(inet_addr_t));
 	
 	loc_exchange_end(exch);
@@ -186,8 +186,8 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
-	return retval;
+	return (int) retval;
 }
 
Index: uspace/lib/c/generic/elf/elf_load.c
===================================================================
--- uspace/lib/c/generic/elf/elf_load.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/elf/elf_load.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,5 +53,5 @@
  * @param file File handle 
  * @param info Place to store ELF program information
- * @return EE_OK on success or an EE_x error code
+ * @return EOK on success or non-zero error code
  */
 int elf_load(int file, elf_info_t *info)
@@ -79,17 +79,5 @@
 	DPRINTF( "- prog dynamic: %p\n", info->finfo.dynamic);
 
-	errno_t rc2 = rtld_prog_process(&info->finfo, &env);
-	switch (rc2) {
-	case EOK:
-		rc = EE_OK;
-		break;
-	case ENOMEM:
-		rc = EE_MEMORY;
-		break;
-	default:
-		DPRINTF("Unexpected error code from rtld_prog_process(): %s\n", str_error_name(rc2));
-		rc = EE_INVALID;
-	}
-
+	rc = rtld_prog_process(&info->finfo, &env);
 	info->env = env;
 #else
Index: uspace/lib/c/generic/elf/elf_mod.c
===================================================================
--- uspace/lib/c/generic/elf/elf_mod.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/elf/elf_mod.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -69,6 +69,5 @@
 	"incompatible image",
 	"unsupported image type",
-	"irrecoverable error",
-	"file io error"
+	"irrecoverable error"
 };
 
@@ -91,5 +90,5 @@
  *                  extracted from the binary.
  *
- * @return EE_OK on success or EE_xx error code.
+ * @return EOK on success or negative error code.
  *
  */
@@ -98,11 +97,8 @@
 	elf_ld_t elf;
 
-	int ofile;
-	errno_t rc = vfs_clone(file, -1, true, &ofile);
-	if (rc == EOK) {
-		rc = vfs_open(ofile, MODE_READ);
-	}
+	int ofile = vfs_clone(file, -1, true);
+	int rc = vfs_open(ofile, MODE_READ);
 	if (rc != EOK) {
-		return EE_IO;
+		return rc;
 	}
 
@@ -111,8 +107,8 @@
 	elf.flags = flags;
 
-	int ret = elf_load_module(&elf, so_bias);
+	rc = elf_load_module(&elf, so_bias);
 
 	vfs_put(ofile);
-	return ret;
+	return rc;
 }
 
@@ -120,13 +116,8 @@
     elf_finfo_t *info)
 {
-	int file;
-	errno_t rc = vfs_lookup(path, 0, &file);
-	if (rc == EOK) {
-		int ret = elf_load_file(file, so_bias, flags, info);
-		vfs_put(file);
-		return ret;
-	} else {
-		return EE_IO;
-	}
+	int file = vfs_lookup(path, 0);
+	int rc = elf_load_file(file, so_bias, flags, info);
+	vfs_put(file);
+	return rc;
 }
 
@@ -147,11 +138,10 @@
 	aoff64_t pos = 0;
 	size_t nr;
-	int i, ret;
-	errno_t rc;
+	int i, rc;
 
 	rc = vfs_read(elf->fd, &pos, header, sizeof(elf_header_t), &nr);
 	if (rc != EOK || nr != sizeof(elf_header_t)) {
 		DPRINTF("Read error.\n"); 
-		return EE_IO;
+		return EE_INVALID;
 	}
 
@@ -213,10 +203,10 @@
 		if (rc != EOK || nr != sizeof(elf_segment_header_t)) {
 			DPRINTF("Read error.\n");
-			return EE_IO;
+			return EE_INVALID;
 		}
 
-		ret = segment_header(elf, &segment_hdr);
-		if (ret != EE_OK)
-			return ret;
+		rc = segment_header(elf, &segment_hdr);
+		if (rc != EE_OK)
+			return rc;
 	}
 
@@ -232,10 +222,10 @@
 		if (rc != EOK || nr != sizeof(elf_section_header_t)) {
 			DPRINTF("Read error.\n");
-			return EE_IO;
+			return EE_INVALID;
 		}
 
-		ret = section_header(elf, &section_hdr);
-		if (ret != EE_OK)
-			return ret;
+		rc = section_header(elf, &section_hdr);
+		if (rc != EE_OK)
+			return rc;
 	}
 
@@ -341,5 +331,5 @@
 	size_t mem_sz;
 	aoff64_t pos;
-	errno_t rc;
+	int rc;
 	size_t nr;
 
@@ -403,5 +393,5 @@
 	if (rc != EOK || nr != entry->p_filesz) {
 		DPRINTF("read error\n");
-		return EE_IO;
+		return EE_INVALID;
 	}
 
@@ -414,5 +404,5 @@
 //	printf("set area flags to %d\n", flags);
 	rc = as_area_change_flags(seg_ptr, flags);
-	if (rc != EOK) {
+	if (rc != 0) {
 		DPRINTF("Failed to set memory area flags.\n");
 		return EE_MEMORY;
Index: uspace/lib/c/generic/event.c
===================================================================
--- uspace/lib/c/generic/event.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/event.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,10 +45,10 @@
  * @param imethod Use this interface and method for notifying me.
  *
- * @return Error code returned by the kernel.
+ * @return Value returned by the kernel.
  *
  */
-errno_t ipc_event_subscribe(event_type_t evno, sysarg_t imethod)
+int ipc_event_subscribe(event_type_t evno, sysarg_t imethod)
 {
-	return (errno_t) __SYSCALL2(SYS_IPC_EVENT_SUBSCRIBE, (sysarg_t) evno,
+	return __SYSCALL2(SYS_IPC_EVENT_SUBSCRIBE, (sysarg_t) evno,
 	    (sysarg_t) imethod);
 }
@@ -59,10 +59,10 @@
  * @param imethod Use this interface and method for notifying me.
  *
- * @return Error code returned by the kernel.
+ * @return Value returned by the kernel.
  *
  */
-errno_t ipc_event_task_subscribe(event_task_type_t evno, sysarg_t imethod)
+int ipc_event_task_subscribe(event_task_type_t evno, sysarg_t imethod)
 {
-	return (errno_t) __SYSCALL2(SYS_IPC_EVENT_SUBSCRIBE, (sysarg_t) evno,
+	return __SYSCALL2(SYS_IPC_EVENT_SUBSCRIBE, (sysarg_t) evno,
 	    (sysarg_t) imethod);
 }
@@ -72,10 +72,10 @@
  * @param evno    Event type to unsubscribe.
  *
- * @return Error code returned by the kernel.
+ * @return Value returned by the kernel.
  *
  */
-errno_t ipc_event_unsubscribe(event_type_t evno)
+int ipc_event_unsubscribe(event_type_t evno)
 {
-	return (errno_t) __SYSCALL1(SYS_IPC_EVENT_UNSUBSCRIBE, (sysarg_t) evno);
+	return __SYSCALL1(SYS_IPC_EVENT_UNSUBSCRIBE, (sysarg_t) evno);
 }
 
@@ -84,10 +84,10 @@
  * @param evno    Event type to unsubscribe.
  *
- * @return Error code returned by the kernel.
+ * @return Value returned by the kernel.
  *
  */
-errno_t ipc_event_task_unsubscribe(event_task_type_t evno)
+int ipc_event_task_unsubscribe(event_task_type_t evno)
 {
-	return (errno_t) __SYSCALL1(SYS_IPC_EVENT_UNSUBSCRIBE, (sysarg_t) evno);
+	return __SYSCALL1(SYS_IPC_EVENT_UNSUBSCRIBE, (sysarg_t) evno);
 }
 
@@ -96,10 +96,10 @@
  * @param evno Event type to unmask.
  *
- * @return Error code returned by the kernel.
+ * @return Value returned by the kernel.
  *
  */
-errno_t ipc_event_unmask(event_type_t evno)
+int ipc_event_unmask(event_type_t evno)
 {
-	return (errno_t) __SYSCALL1(SYS_IPC_EVENT_UNMASK, (sysarg_t) evno);
+	return __SYSCALL1(SYS_IPC_EVENT_UNMASK, (sysarg_t) evno);
 }
 
@@ -108,10 +108,10 @@
  * @param evno Event type to unmask.
  *
- * @return Error code returned by the kernel.
+ * @return Value returned by the kernel.
  *
  */
-errno_t ipc_event_task_unmask(event_task_type_t evno)
+int ipc_event_task_unmask(event_task_type_t evno)
 {
-	return (errno_t) __SYSCALL1(SYS_IPC_EVENT_UNMASK, (sysarg_t) evno);
+	return __SYSCALL1(SYS_IPC_EVENT_UNMASK, (sysarg_t) evno);
 }
 
Index: uspace/lib/c/generic/fibril.c
===================================================================
--- uspace/lib/c/generic/fibril.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/fibril.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -268,5 +268,5 @@
  *
  */
-fid_t fibril_create_generic(errno_t (*func)(void *), void *arg, size_t stksz)
+fid_t fibril_create_generic(int (*func)(void *), void *arg, size_t stksz)
 {
 	fibril_t *fibril;
Index: uspace/lib/c/generic/fibril_synch.c
===================================================================
--- uspace/lib/c/generic/fibril_synch.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/fibril_synch.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -352,5 +352,5 @@
 }
 
-errno_t
+int
 fibril_condvar_wait_timeout(fibril_condvar_t *fcv, fibril_mutex_t *fm,
     suseconds_t timeout)
@@ -392,5 +392,5 @@
 void fibril_condvar_wait(fibril_condvar_t *fcv, fibril_mutex_t *fm)
 {
-	errno_t rc;
+	int rc;
 
 	rc = fibril_condvar_wait_timeout(fcv, fm, 0);
@@ -434,8 +434,8 @@
  * @param arg	Timer
  */
-static errno_t fibril_timer_func(void *arg)
+static int fibril_timer_func(void *arg)
 {
 	fibril_timer_t *timer = (fibril_timer_t *) arg;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(timer->lockp);
Index: uspace/lib/c/generic/getopt.c
===================================================================
--- uspace/lib/c/generic/getopt.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/getopt.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
 int	optopt = '?';		/* character checked for validity */
 int	optreset;		/* reset getopt */
-char	*optarg;		/* argument associated with option */
+const char *optarg;		/* argument associated with option */
 
 
@@ -67,5 +67,5 @@
 #define INORDER (int)1
 
-static char EMSG[] = "";
+#define	EMSG	""
 
 static int getopt_internal(int, char **, const char *);
@@ -73,5 +73,5 @@
 static void permute_args(int, int, int, char **);
 
-static char *place = EMSG; /* option letter processing */
+static const char *place = EMSG; /* option letter processing */
 
 /* XXX: set optreset to 1 rather than these two */
@@ -336,5 +336,5 @@
 	if (retval == -2) {
 		char *current_argv;
-		char *has_equal;
+		const char *has_equal;
 		size_t current_argv_len;
 		int i, ambiguous, match;
Index: uspace/lib/c/generic/imath.c
===================================================================
--- uspace/lib/c/generic/imath.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/imath.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,5 +48,5 @@
  * @return EOK on success, ERANGE if result does not fit into result type
  */
-errno_t ipow10_u64(unsigned exp, uint64_t *res)
+int ipow10_u64(unsigned exp, uint64_t *res)
 {
 	unsigned a;
Index: uspace/lib/c/generic/inet.c
===================================================================
--- uspace/lib/c/generic/inet.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/inet.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 static uint8_t inet_protocol = 0;
 
-static errno_t inet_callback_create(void)
+static int inet_callback_create(void)
 {
 	async_exch_t *exch = async_exchange_begin(inet_sess);
@@ -50,5 +50,5 @@
 	
 	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_INET_CB, 0, 0,
+	int rc = async_create_callback_port(exch, INTERFACE_INET_CB, 0, 0,
 	    inet_cb_conn, NULL, &port);
 	
@@ -58,5 +58,5 @@
 		return rc;
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
@@ -64,8 +64,8 @@
 }
 
-static errno_t inet_set_proto(uint8_t protocol)
-{
-	async_exch_t *exch = async_exchange_begin(inet_sess);
-	errno_t rc = async_req_1_0(exch, INET_SET_PROTO, protocol);
+static int inet_set_proto(uint8_t protocol)
+{
+	async_exch_t *exch = async_exchange_begin(inet_sess);
+	int rc = async_req_1_0(exch, INET_SET_PROTO, protocol);
 	async_exchange_end(exch);
 	
@@ -73,8 +73,8 @@
 }
 
-errno_t inet_init(uint8_t protocol, inet_ev_ops_t *ev_ops)
+int inet_init(uint8_t protocol, inet_ev_ops_t *ev_ops)
 {
 	service_id_t inet_svc;
-	errno_t rc;
+	int rc;
 
 	assert(inet_sess == NULL);
@@ -110,5 +110,5 @@
 }
 
-errno_t inet_send(inet_dgram_t *dgram, uint8_t ttl, inet_df_t df)
+int inet_send(inet_dgram_t *dgram, uint8_t ttl, inet_df_t df)
 {
 	async_exch_t *exch = async_exchange_begin(inet_sess);
@@ -118,5 +118,5 @@
 	    ttl, df, &answer);
 	
-	errno_t rc = async_data_write_start(exch, &dgram->src, sizeof(inet_addr_t));
+	int rc = async_data_write_start(exch, &dgram->src, sizeof(inet_addr_t));
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -141,11 +141,11 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
-	return retval;
-}
-
-errno_t inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
+	return (int) retval;
+}
+
+int inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
 {
 	async_exch_t *exch = async_exchange_begin(inet_sess);
@@ -154,5 +154,5 @@
 	aid_t req = async_send_1(exch, INET_GET_SRCADDR, tos, &answer);
 	
-	errno_t rc = async_data_write_start(exch, remote, sizeof(inet_addr_t));
+	int rc = async_data_write_start(exch, remote, sizeof(inet_addr_t));
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -170,8 +170,8 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
-	return retval;
+	return (int) retval;
 }
 
@@ -197,5 +197,5 @@
 	}
 	
-	errno_t rc = async_data_write_finalize(callid, &dgram.src, size);
+	int rc = async_data_write_finalize(callid, &dgram.src, size);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
Index: uspace/lib/c/generic/inet/addr.c
===================================================================
--- uspace/lib/c/generic/inet/addr.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/inet/addr.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,4 @@
 #include <bitops.h>
 #include <inttypes.h>
-#include <str.h>
 
 #define INET_PREFIXSTRSIZE  5
@@ -291,5 +290,5 @@
 }
 
-static errno_t inet_addr_parse_v4(const char *str, inet_addr_t *raddr,
+static int inet_addr_parse_v4(const char *str, inet_addr_t *raddr,
     int *prefix, char **endptr)
 {
@@ -300,5 +299,5 @@
 
 	while (i < 4) {
-		errno_t rc = str_uint8_t(cur, (const char **)&cur, 10, false, &b);
+		int rc = str_uint8_t(cur, (const char **)&cur, 10, false, &b);
 		if (rc != EOK)
 			return rc;
@@ -340,5 +339,5 @@
 }
 
-static errno_t inet_addr_parse_v6(const char *str, inet_addr_t *raddr, int *prefix,
+static int inet_addr_parse_v6(const char *str, inet_addr_t *raddr, int *prefix,
     char **endptr)
 {
@@ -363,5 +362,5 @@
 		uint16_t bioctet;
 		const char *gend;
-		errno_t rc = str_uint16_t(cur, &gend, 16, false, &bioctet);
+		int rc = str_uint16_t(cur, &gend, 16, false, &bioctet);
 		if (rc != EOK)
 			break;
@@ -447,7 +446,7 @@
  *
  */
-errno_t inet_addr_parse(const char *text, inet_addr_t *addr, char **endptr)
-{
-	errno_t rc;
+int inet_addr_parse(const char *text, inet_addr_t *addr, char **endptr)
+{
+	int rc;
 
 	rc = inet_addr_parse_v4(text, addr, NULL, endptr);
@@ -474,7 +473,7 @@
  *
  */
-errno_t inet_naddr_parse(const char *text, inet_naddr_t *naddr, char **endptr)
-{
-	errno_t rc;
+int inet_naddr_parse(const char *text, inet_naddr_t *naddr, char **endptr)
+{
+	int rc;
 	inet_addr_t addr;
 	int prefix;
@@ -495,5 +494,5 @@
 }
 
-static errno_t inet_addr_format_v4(addr32_t addr, char **bufp)
+static int inet_addr_format_v4(addr32_t addr, char **bufp)
 {
 	int rc;
@@ -507,5 +506,5 @@
 }
 
-static errno_t inet_addr_format_v6(const addr128_t addr, char **bufp)
+static int inet_addr_format_v6(const addr128_t addr, char **bufp)
 {
 	*bufp = (char *) malloc(INET6_ADDRSTRLEN);
@@ -582,8 +581,7 @@
  *
  */
-errno_t inet_addr_format(const inet_addr_t *addr, char **bufp)
-{
-	errno_t rc;
-	int ret;
+int inet_addr_format(const inet_addr_t *addr, char **bufp)
+{
+	int rc;
 
 	rc = ENOTSUP;
@@ -591,6 +589,6 @@
 	switch (addr->version) {
 	case ip_any:
-		ret = asprintf(bufp, "none");
-		if (ret < 0)
+		rc = asprintf(bufp, "none");
+		if (rc < 0)
 			return ENOMEM;
 		rc = EOK;
@@ -617,8 +615,7 @@
  *
  */
-errno_t inet_naddr_format(const inet_naddr_t *naddr, char **bufp)
-{
-	errno_t rc;
-	int ret;
+int inet_naddr_format(const inet_naddr_t *naddr, char **bufp)
+{
+	int rc;
 	char *astr;
 
@@ -627,6 +624,6 @@
 	switch (naddr->version) {
 	case ip_any:
-		ret = asprintf(bufp, "none");
-		if (ret < 0)
+		rc = asprintf(bufp, "none");
+		if (rc < 0)
 			return ENOMEM;
 		rc = EOK;
@@ -637,6 +634,6 @@
 			return ENOMEM;
 
-		ret = asprintf(bufp, "%s/%" PRIu8, astr, naddr->prefix);
-		if (ret < 0) {
+		rc = asprintf(bufp, "%s/%" PRIu8, astr, naddr->prefix);
+		if (rc < 0) {
 			free(astr);
 			return ENOMEM;
@@ -650,6 +647,6 @@
 			return ENOMEM;
 
-		ret = asprintf(bufp, "%s/%" PRIu8, astr, naddr->prefix);
-		if (ret < 0) {
+		rc = asprintf(bufp, "%s/%" PRIu8, astr, naddr->prefix);
+		if (rc < 0) {
 			free(astr);
 			return ENOMEM;
Index: uspace/lib/c/generic/inet/host.c
===================================================================
--- uspace/lib/c/generic/inet/host.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/inet/host.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,5 +54,5 @@
  *         extra characters at the end. ENOMEM if out of memory
  */
-errno_t inet_host_parse(const char *str, inet_host_t **rhost,
+int inet_host_parse(const char *str, inet_host_t **rhost,
     char **endptr)
 {
@@ -61,5 +61,5 @@
 	char *name;
 	char *aend;
-	errno_t rc;
+	int rc;
 
 	host = calloc(1, sizeof(inet_host_t));
@@ -106,7 +106,7 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-errno_t inet_host_format(inet_host_t *host, char **rstr)
-{
-	errno_t rc;
+int inet_host_format(inet_host_t *host, char **rstr)
+{
+	int rc;
 	char *str = NULL;
 
@@ -161,8 +161,8 @@
  * @reutrn EOK on success, ENOENT on resolurion failure
  */
-errno_t inet_host_lookup_one(inet_host_t *host, ip_ver_t version, inet_addr_t *addr)
+int inet_host_lookup_one(inet_host_t *host, ip_ver_t version, inet_addr_t *addr)
 {
 	dnsr_hostinfo_t *hinfo = NULL;
-	errno_t rc;
+	int rc;
 
 	switch (host->hform) {
@@ -201,10 +201,10 @@
  *         ENOMEM if out of memory
  */
-errno_t inet_host_plookup_one(const char *str, ip_ver_t version, inet_addr_t *addr,
+int inet_host_plookup_one(const char *str, ip_ver_t version, inet_addr_t *addr,
     char **endptr, const char **errmsg)
 {
 	inet_host_t *host = NULL;
 	char *eptr;
-	errno_t rc;
+	int rc;
 
 	rc = inet_host_parse(str, &host, endptr != NULL ? &eptr : NULL);
Index: uspace/lib/c/generic/inet/hostname.c
===================================================================
--- uspace/lib/c/generic/inet/hostname.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/inet/hostname.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,5 +58,5 @@
  *         extra characters at the end. ENOMEM if out of memory
  */
-errno_t inet_hostname_parse(const char *str, char **rname, char **endptr)
+int inet_hostname_parse(const char *str, char **rname, char **endptr)
 {
 	const char *c;
Index: uspace/lib/c/generic/inet/hostport.c
===================================================================
--- uspace/lib/c/generic/inet/hostport.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/inet/hostport.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
  *         extra characters at the end. ENOMEM if out of memory
  */
-errno_t inet_hostport_parse(const char *str, inet_hostport_t **rhp,
+int inet_hostport_parse(const char *str, inet_hostport_t **rhp,
     char **endptr)
 {
@@ -65,5 +65,5 @@
 	char *aend;
 	const char *pend;
-	errno_t rc;
+	int rc;
 
 	hp = calloc(1, sizeof(inet_hostport_t));
@@ -137,8 +137,7 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-errno_t inet_hostport_format(inet_hostport_t *hp, char **rstr)
-{
-	errno_t rc;
-	int ret;
+int inet_hostport_format(inet_hostport_t *hp, char **rstr)
+{
+	int rc;
 	char *astr, *str;
 	char *hstr = NULL;
@@ -155,6 +154,6 @@
 			hstr = astr;
 		} else {
-			ret = asprintf(&hstr, "[%s]", astr);
-			if (ret < 0) {
+			rc = asprintf(&hstr, "[%s]", astr);
+			if (rc < 0) {
 				free(astr);
 				return ENOMEM;
@@ -172,6 +171,6 @@
 	}
 
-	ret = asprintf(&str, "%s:%u", hstr, hp->port);
-	if (ret < 0)
+	rc = asprintf(&str, "%s:%u", hstr, hp->port);
+	if (rc < 0)
 		return ENOMEM;
 
@@ -211,9 +210,9 @@
  * @return EOK on success, ENOENT on resolution failure
  */
-errno_t inet_hostport_lookup_one(inet_hostport_t *hp, ip_ver_t version,
+int inet_hostport_lookup_one(inet_hostport_t *hp, ip_ver_t version,
     inet_ep_t *ep)
 {
 	dnsr_hostinfo_t *hinfo = NULL;
-	errno_t rc;
+	int rc;
 
 	inet_ep_init(ep);
@@ -255,10 +254,10 @@
  *         ENOMEM if out of memory
  */
-errno_t inet_hostport_plookup_one(const char *str, ip_ver_t version, inet_ep_t *ep,
+int inet_hostport_plookup_one(const char *str, ip_ver_t version, inet_ep_t *ep,
     char **endptr, const char **errmsg)
 {
 	inet_hostport_t *hp = NULL;
 	char *eptr;
-	errno_t rc;
+	int rc;
 
 	rc = inet_hostport_parse(str, &hp, endptr != NULL ? &eptr : NULL);
Index: uspace/lib/c/generic/inet/tcp.c
===================================================================
--- uspace/lib/c/generic/inet/tcp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/inet/tcp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 
 static void tcp_cb_conn(ipc_callid_t, ipc_call_t *, void *);
-static errno_t tcp_conn_fibril(void *);
+static int tcp_conn_fibril(void *);
 
 /** Incoming TCP connection info
@@ -59,7 +59,7 @@
  *
  * @param tcp TCP service
- * @return EOK on success or an error code
- */
-static errno_t tcp_callback_create(tcp_t *tcp)
+ * @return EOK on success or negative error code
+ */
+static int tcp_callback_create(tcp_t *tcp)
 {
 	async_exch_t *exch = async_exchange_begin(tcp->sess);
@@ -68,5 +68,5 @@
 	
 	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_TCP_CB, 0, 0,
+	int rc = async_create_callback_port(exch, INTERFACE_TCP_CB, 0, 0,
 	    tcp_cb_conn, tcp, &port);
 	
@@ -76,5 +76,5 @@
 		return rc;
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
@@ -88,9 +88,9 @@
  *         cannot be contacted
  */
-errno_t tcp_create(tcp_t **rtcp)
+int tcp_create(tcp_t **rtcp)
 {
 	tcp_t *tcp;
 	service_id_t tcp_svcid;
-	errno_t rc;
+	int rc;
 
 	tcp = calloc(1, sizeof(tcp_t));
@@ -161,5 +161,5 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-static errno_t tcp_conn_new(tcp_t *tcp, sysarg_t id, tcp_cb_t *cb, void *arg,
+static int tcp_conn_new(tcp_t *tcp, sysarg_t id, tcp_cb_t *cb, void *arg,
     tcp_conn_t **rconn)
 {
@@ -205,7 +205,7 @@
  * @param rconn Place to store pointer to new connection
  *
- * @return EOK on success or an error code.
- */
-errno_t tcp_conn_create(tcp_t *tcp, inet_ep2_t *epp, tcp_cb_t *cb, void *arg,
+ * @return EOK on success or negative error code.
+ */
+int tcp_conn_create(tcp_t *tcp, inet_ep2_t *epp, tcp_cb_t *cb, void *arg,
     tcp_conn_t **rconn)
 {
@@ -216,10 +216,10 @@
 	exch = async_exchange_begin(tcp->sess);
 	aid_t req = async_send_0(exch, TCP_CONN_CREATE, &answer);
-	errno_t rc = async_data_write_start(exch, (void *)epp,
+	sysarg_t rc = async_data_write_start(exch, (void *)epp,
 	    sizeof(inet_ep2_t));
 	async_exchange_end(exch);
 
 	if (rc != EOK) {
-		errno_t rc_orig;
+		sysarg_t rc_orig;
 		async_wait_for(req, &rc_orig);
 		if (rc_orig != EOK)
@@ -240,5 +240,5 @@
 	return EOK;
 error:
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -260,5 +260,5 @@
 
 	exch = async_exchange_begin(conn->tcp->sess);
-	errno_t rc = async_req_1_0(exch, TCP_CONN_DESTROY, conn->id);
+	sysarg_t rc = async_req_1_0(exch, TCP_CONN_DESTROY, conn->id);
 	async_exchange_end(exch);
 
@@ -275,5 +275,5 @@
  * @return EOK on success, EINVAL if no connection with the given ID exists
  */
-static errno_t tcp_conn_get(tcp_t *tcp, sysarg_t id, tcp_conn_t **rconn)
+static int tcp_conn_get(tcp_t *tcp, sysarg_t id, tcp_conn_t **rconn)
 {
 	list_foreach(tcp->conn, ltcp, tcp_conn_t, conn) {
@@ -316,7 +316,7 @@
  * @param rlst Place to store pointer to new listener
  *
- * @return EOK on success or an error code
- */
-errno_t tcp_listener_create(tcp_t *tcp, inet_ep_t *ep, tcp_listen_cb_t *lcb,
+ * @return EOK on success or negative error code
+ */
+int tcp_listener_create(tcp_t *tcp, inet_ep_t *ep, tcp_listen_cb_t *lcb,
     void *larg, tcp_cb_t *cb, void *arg, tcp_listener_t **rlst)
 {
@@ -331,10 +331,10 @@
 	exch = async_exchange_begin(tcp->sess);
 	aid_t req = async_send_0(exch, TCP_LISTENER_CREATE, &answer);
-	errno_t rc = async_data_write_start(exch, (void *)ep,
+	sysarg_t rc = async_data_write_start(exch, (void *)ep,
 	    sizeof(inet_ep_t));
 	async_exchange_end(exch);
 
 	if (rc != EOK) {
-		errno_t rc_orig;
+		sysarg_t rc_orig;
 		async_wait_for(req, &rc_orig);
 		if (rc_orig != EOK)
@@ -360,5 +360,5 @@
 error:
 	free(lst);
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -377,5 +377,5 @@
 
 	exch = async_exchange_begin(lst->tcp->sess);
-	errno_t rc = async_req_1_0(exch, TCP_LISTENER_DESTROY, lst->id);
+	sysarg_t rc = async_req_1_0(exch, TCP_LISTENER_DESTROY, lst->id);
 	async_exchange_end(exch);
 
@@ -392,5 +392,5 @@
  * @return EOK on success, EINVAL if no listener with the given ID is found
  */
-static errno_t tcp_listener_get(tcp_t *tcp, sysarg_t id, tcp_listener_t **rlst)
+static int tcp_listener_get(tcp_t *tcp, sysarg_t id, tcp_listener_t **rlst)
 {
 	list_foreach(tcp->listener, ltcp, tcp_listener_t, lst) {
@@ -424,5 +424,5 @@
  * @return EOK if connection is established, EIO otherwise
  */
-errno_t tcp_conn_wait_connected(tcp_conn_t *conn)
+int tcp_conn_wait_connected(tcp_conn_t *conn)
 {
 	fibril_mutex_lock(&conn->lock);
@@ -446,10 +446,10 @@
  * @param bytes Data size in bytes
  *
- * @return EOK on success or an error code
- */
-errno_t tcp_conn_send(tcp_conn_t *conn, const void *data, size_t bytes)
-{
-	async_exch_t *exch;
-	errno_t rc;
+ * @return EOK on success or negative error code
+ */
+int tcp_conn_send(tcp_conn_t *conn, const void *data, size_t bytes)
+{
+	async_exch_t *exch;
+	sysarg_t rc;
 
 	exch = async_exchange_begin(conn->tcp->sess);
@@ -478,12 +478,12 @@
  *
  * @param conn Connection
- * @return EOK on success or an error code
- */
-errno_t tcp_conn_send_fin(tcp_conn_t *conn)
+ * @return EOK on success or negative error code
+ */
+int tcp_conn_send_fin(tcp_conn_t *conn)
 {
 	async_exch_t *exch;
 
 	exch = async_exchange_begin(conn->tcp->sess);
-	errno_t rc = async_req_1_0(exch, TCP_CONN_SEND_FIN, conn->id);
+	sysarg_t rc = async_req_1_0(exch, TCP_CONN_SEND_FIN, conn->id);
 	async_exchange_end(exch);
 
@@ -494,12 +494,12 @@
  *
  * @param conn Connection
- * @return EOK on success or an error code
- */
-errno_t tcp_conn_push(tcp_conn_t *conn)
+ * @return EOK on success or negative error code
+ */
+int tcp_conn_push(tcp_conn_t *conn)
 {
 	async_exch_t *exch;
 
 	exch = async_exchange_begin(conn->tcp->sess);
-	errno_t rc = async_req_1_0(exch, TCP_CONN_PUSH, conn->id);
+	sysarg_t rc = async_req_1_0(exch, TCP_CONN_PUSH, conn->id);
 	async_exchange_end(exch);
 
@@ -510,12 +510,12 @@
  *
  * @param conn Connection
- * @return EOK on success or an error code
- */
-errno_t tcp_conn_reset(tcp_conn_t *conn)
+ * @return EOK on success or negative error code
+ */
+int tcp_conn_reset(tcp_conn_t *conn)
 {
 	async_exch_t *exch;
 
 	exch = async_exchange_begin(conn->tcp->sess);
-	errno_t rc = async_req_1_0(exch, TCP_CONN_RESET, conn->id);
+	sysarg_t rc = async_req_1_0(exch, TCP_CONN_RESET, conn->id);
 	async_exchange_end(exch);
 
@@ -538,7 +538,7 @@
  *
  * @return EOK on success, EAGAIN if no received data is pending, or other
- *         error code in case of other error
- */
-errno_t tcp_conn_recv(tcp_conn_t *conn, void *buf, size_t bsize, size_t *nrecv)
+ *         negative error code in case of other error
+ */
+int tcp_conn_recv(tcp_conn_t *conn, void *buf, size_t bsize, size_t *nrecv)
 {
 	async_exch_t *exch;
@@ -553,5 +553,5 @@
 	exch = async_exchange_begin(conn->tcp->sess);
 	aid_t req = async_send_1(exch, TCP_CONN_RECV, conn->id, &answer);
-	errno_t rc = async_data_read_start(exch, buf, bsize);
+	int rc = async_data_read_start(exch, buf, bsize);
 	async_exchange_end(exch);
 
@@ -562,5 +562,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	if (retval != EOK) {
@@ -586,7 +586,7 @@
  * @param nrecv Place to store actual number of received bytes
  *
- * @return EOK on success or an error code
- */
-errno_t tcp_conn_recv_wait(tcp_conn_t *conn, void *buf, size_t bsize,
+ * @return EOK on success or negative error code
+ */
+int tcp_conn_recv_wait(tcp_conn_t *conn, void *buf, size_t bsize,
     size_t *nrecv)
 {
@@ -602,5 +602,5 @@
 	exch = async_exchange_begin(conn->tcp->sess);
 	aid_t req = async_send_1(exch, TCP_CONN_RECV_WAIT, conn->id, &answer);
-	errno_t rc = async_data_read_start(exch, buf, bsize);
+	int rc = async_data_read_start(exch, buf, bsize);
 	async_exchange_end(exch);
 
@@ -616,5 +616,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	if (retval != EOK) {
@@ -641,5 +641,5 @@
 	tcp_conn_t *conn;
 	sysarg_t conn_id;
-	errno_t rc;
+	int rc;
 
 	conn_id = IPC_GET_ARG1(*icall);
@@ -669,5 +669,5 @@
 	tcp_conn_t *conn;
 	sysarg_t conn_id;
-	errno_t rc;
+	int rc;
 
 	conn_id = IPC_GET_ARG1(*icall);
@@ -697,5 +697,5 @@
 	tcp_conn_t *conn;
 	sysarg_t conn_id;
-	errno_t rc;
+	int rc;
 
 	conn_id = IPC_GET_ARG1(*icall);
@@ -725,5 +725,5 @@
 	tcp_conn_t *conn;
 	sysarg_t conn_id;
-	errno_t rc;
+	int rc;
 
 	conn_id = IPC_GET_ARG1(*icall);
@@ -769,5 +769,5 @@
 	fid_t fid;
 	tcp_in_conn_t *cinfo;
-	errno_t rc;
+	int rc;
 
 	lst_id = IPC_GET_ARG1(*icall);
@@ -863,5 +863,5 @@
  * @param arg Argument, incoming connection information (@c tcp_in_conn_t)
  */
-static errno_t tcp_conn_fibril(void *arg)
+static int tcp_conn_fibril(void *arg)
 {
 	tcp_in_conn_t *cinfo = (tcp_in_conn_t *)arg;
Index: uspace/lib/c/generic/inet/udp.c
===================================================================
--- uspace/lib/c/generic/inet/udp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/inet/udp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,7 +46,7 @@
  *
  * @param udp UDP service
- * @return EOK on success or an error code
- */
-static errno_t udp_callback_create(udp_t *udp)
+ * @return EOK on success or negative error code
+ */
+static int udp_callback_create(udp_t *udp)
 {
 	async_exch_t *exch = async_exchange_begin(udp->sess);
@@ -55,5 +55,5 @@
 	
 	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_UDP_CB, 0, 0,
+	int rc = async_create_callback_port(exch, INTERFACE_UDP_CB, 0, 0,
 	    udp_cb_conn, udp, &port);
 	
@@ -63,5 +63,5 @@
 		return rc;
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
@@ -75,9 +75,9 @@
  *         cannot be contacted
  */
-errno_t udp_create(udp_t **rudp)
+int udp_create(udp_t **rudp)
 {
 	udp_t *udp;
 	service_id_t udp_svcid;
-	errno_t rc;
+	int rc;
 
 	udp = calloc(1, sizeof(udp_t));
@@ -158,7 +158,7 @@
  * @param rassoc Place to store pointer to new association
  *
- * @return EOK on success or an error code.
- */
-errno_t udp_assoc_create(udp_t *udp, inet_ep2_t *epp, udp_cb_t *cb, void *arg,
+ * @return EOK on success or negative error code.
+ */
+int udp_assoc_create(udp_t *udp, inet_ep2_t *epp, udp_cb_t *cb, void *arg,
     udp_assoc_t **rassoc)
 {
@@ -173,10 +173,10 @@
 	exch = async_exchange_begin(udp->sess);
 	aid_t req = async_send_0(exch, UDP_ASSOC_CREATE, &answer);
-	errno_t rc = async_data_write_start(exch, (void *)epp,
+	sysarg_t rc = async_data_write_start(exch, (void *)epp,
 	    sizeof(inet_ep2_t));
 	async_exchange_end(exch);
 
 	if (rc != EOK) {
-		errno_t rc_orig;
+		sysarg_t rc_orig;
 		async_wait_for(req, &rc_orig);
 		if (rc_orig != EOK)
@@ -200,5 +200,5 @@
 error:
 	free(assoc);
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -220,5 +220,5 @@
 
 	exch = async_exchange_begin(assoc->udp->sess);
-	errno_t rc = async_req_1_0(exch, UDP_ASSOC_DESTROY, assoc->id);
+	sysarg_t rc = async_req_1_0(exch, UDP_ASSOC_DESTROY, assoc->id);
 	async_exchange_end(exch);
 
@@ -232,10 +232,10 @@
  * @param flags Flags
  */
-errno_t udp_assoc_set_nolocal(udp_assoc_t *assoc)
+int udp_assoc_set_nolocal(udp_assoc_t *assoc)
 {
 	async_exch_t *exch;
 
 	exch = async_exchange_begin(assoc->udp->sess);
-	errno_t rc = async_req_1_0(exch, UDP_ASSOC_SET_NOLOCAL, assoc->id);
+	sysarg_t rc = async_req_1_0(exch, UDP_ASSOC_SET_NOLOCAL, assoc->id);
 	async_exchange_end(exch);
 
@@ -250,7 +250,7 @@
  * @param bytes Message size in bytes
  *
- * @return EOK on success or an error code
- */
-errno_t udp_assoc_send_msg(udp_assoc_t *assoc, inet_ep_t *dest, void *data,
+ * @return EOK on success or negative error code
+ */
+int udp_assoc_send_msg(udp_assoc_t *assoc, inet_ep_t *dest, void *data,
     size_t bytes)
 {
@@ -260,5 +260,5 @@
 	aid_t req = async_send_1(exch, UDP_ASSOC_SEND_MSG, assoc->id, NULL);
 
-	errno_t rc = async_data_write_start(exch, (void *)dest,
+	sysarg_t rc = async_data_write_start(exch, (void *)dest,
 	    sizeof(inet_ep_t));
 	if (rc != EOK) {
@@ -316,7 +316,7 @@
  * @param bsize Buffer size
  *
- * @return EOK on success or an error code.
- */
-errno_t udp_rmsg_read(udp_rmsg_t *rmsg, size_t off, void *buf, size_t bsize)
+ * @return EOK on success or negative error code.
+ */
+int udp_rmsg_read(udp_rmsg_t *rmsg, size_t off, void *buf, size_t bsize)
 {
 	async_exch_t *exch;
@@ -325,5 +325,5 @@
 	exch = async_exchange_begin(rmsg->udp->sess);
 	aid_t req = async_send_1(exch, UDP_RMSG_READ, off, &answer);
-	errno_t rc = async_data_read_start(exch, buf, bsize);
+	int rc = async_data_read_start(exch, buf, bsize);
 	async_exchange_end(exch);
 
@@ -333,5 +333,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	if (retval != EOK) {
@@ -380,7 +380,7 @@
  * @param rmsg Place to store message information
  *
- * @return EOK on success or an error code
- */
-static errno_t udp_rmsg_info(udp_t *udp, udp_rmsg_t *rmsg)
+ * @return EOK on success or negative error code
+ */
+static int udp_rmsg_info(udp_t *udp, udp_rmsg_t *rmsg)
 {
 	async_exch_t *exch;
@@ -390,5 +390,5 @@
 	exch = async_exchange_begin(udp->sess);
 	aid_t req = async_send_0(exch, UDP_RMSG_INFO, &answer);
-	errno_t rc = async_data_read_start(exch, &ep, sizeof(inet_ep_t));
+	int rc = async_data_read_start(exch, &ep, sizeof(inet_ep_t));
 	async_exchange_end(exch);
 
@@ -398,5 +398,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	if (retval != EOK)
@@ -413,12 +413,12 @@
  *
  * @param udp UDP client
- * @return EOK on success or an error code
- */
-static errno_t udp_rmsg_discard(udp_t *udp)
+ * @return EOK on success or negative error code
+ */
+static int udp_rmsg_discard(udp_t *udp)
 {
 	async_exch_t *exch;
 
 	exch = async_exchange_begin(udp->sess);
-	errno_t rc = async_req_0_0(exch, UDP_RMSG_DISCARD);
+	sysarg_t rc = async_req_0_0(exch, UDP_RMSG_DISCARD);
 	async_exchange_end(exch);
 
@@ -434,5 +434,5 @@
  * @return EOK on success, EINVAL if no association with the given ID exists
  */
-static errno_t udp_assoc_get(udp_t *udp, sysarg_t id, udp_assoc_t **rassoc)
+static int udp_assoc_get(udp_t *udp, sysarg_t id, udp_assoc_t **rassoc)
 {
 	list_foreach(udp->assoc, ludp, udp_assoc_t, assoc) {
@@ -459,5 +459,5 @@
 	udp_rmsg_t rmsg;
 	udp_assoc_t *assoc;
-	errno_t rc;
+	int rc;
 
 	while (true) {
Index: uspace/lib/c/generic/inetcfg.c
===================================================================
--- uspace/lib/c/generic/inetcfg.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/inetcfg.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 static async_sess_t *inetcfg_sess = NULL;
 
-static errno_t inetcfg_get_ids_once(sysarg_t method, sysarg_t arg1,
+static int inetcfg_get_ids_once(sysarg_t method, sysarg_t arg1,
     sysarg_t *id_buf, size_t buf_size, size_t *act_size)
 {
@@ -46,14 +46,14 @@
 	ipc_call_t answer;
 	aid_t req = async_send_1(exch, method, arg1, &answer);
-	errno_t rc = async_data_read_start(exch, id_buf, buf_size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
+	int rc = async_data_read_start(exch, id_buf, buf_size);
+
+	async_exchange_end(exch);
+
+	if (rc != EOK) {
+		async_forget(req);
+		return rc;
+	}
+
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
@@ -74,7 +74,7 @@
  * @param data		Place to store pointer to array of IDs
  * @param count		Place to store number of IDs
- * @return 		EOK on success or an error code
+ * @return 		EOK on success or negative error code
  */
-static errno_t inetcfg_get_ids_internal(sysarg_t method, sysarg_t arg1,
+static int inetcfg_get_ids_internal(sysarg_t method, sysarg_t arg1,
     sysarg_t **data, size_t *count)
 {
@@ -83,5 +83,5 @@
 
 	size_t act_size = 0;
-	errno_t rc = inetcfg_get_ids_once(method, arg1, NULL, 0,
+	int rc = inetcfg_get_ids_once(method, arg1, NULL, 0,
 	    &act_size);
 	if (rc != EOK)
@@ -113,8 +113,8 @@
 }
 
-errno_t inetcfg_init(void)
+int inetcfg_init(void)
 {
 	service_id_t inet_svc;
-	errno_t rc;
+	int rc;
 
 	assert(inetcfg_sess == NULL);
@@ -133,5 +133,5 @@
 }
 
-errno_t inetcfg_addr_create_static(const char *name, inet_naddr_t *naddr,
+int inetcfg_addr_create_static(const char *name, inet_naddr_t *naddr,
     sysarg_t link_id, sysarg_t *addr_id)
 {
@@ -142,5 +142,5 @@
 	    &answer);
 	
-	errno_t rc = async_data_write_start(exch, naddr, sizeof(inet_naddr_t));
+	int rc = async_data_write_start(exch, naddr, sizeof(inet_naddr_t));
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -158,17 +158,17 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
 	*addr_id = IPC_GET_ARG1(answer);
 	
-	return retval;
-}
-
-errno_t inetcfg_addr_delete(sysarg_t addr_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	errno_t rc = async_req_1_0(exch, INETCFG_ADDR_DELETE, addr_id);
+	return (int) retval;
+}
+
+int inetcfg_addr_delete(sysarg_t addr_id)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	int rc = async_req_1_0(exch, INETCFG_ADDR_DELETE, addr_id);
 	async_exchange_end(exch);
 
@@ -176,5 +176,5 @@
 }
 
-errno_t inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo)
+int inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo)
 {
 	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
@@ -187,5 +187,5 @@
 	    sizeof(inet_naddr_t), &answer_naddr);
 	
-	errno_t retval_naddr;
+	sysarg_t retval_naddr;
 	async_wait_for(req_naddr, &retval_naddr);
 	
@@ -193,5 +193,5 @@
 		async_exchange_end(exch);
 		async_forget(req);
-		return retval_naddr;
+		return (int) retval_naddr;
 	}
 	
@@ -203,17 +203,17 @@
 	async_exchange_end(exch);
 	
-	errno_t retval_name;
+	sysarg_t retval_name;
 	async_wait_for(req_name, &retval_name);
 	
 	if (retval_name != EOK) {
 		async_forget(req);
-		return retval_name;
-	}
-	
-	errno_t retval;
+		return (int) retval_name;
+	}
+	
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
 	if (retval != EOK)
-		return retval;
+		return (int) retval;
 	
 	size_t act_size = IPC_GET_ARG2(answer_name);
@@ -228,5 +228,5 @@
 }
 
-errno_t inetcfg_addr_get_id(const char *name, sysarg_t link_id, sysarg_t *addr_id)
+int inetcfg_addr_get_id(const char *name, sysarg_t link_id, sysarg_t *addr_id)
 {
 	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
@@ -234,5 +234,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_1(exch, INETCFG_ADDR_GET_ID, link_id, &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
+	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
 
 	async_exchange_end(exch);
@@ -249,5 +249,5 @@
 }
 
-errno_t inetcfg_get_addr_list(sysarg_t **addrs, size_t *count)
+int inetcfg_get_addr_list(sysarg_t **addrs, size_t *count)
 {
 	return inetcfg_get_ids_internal(INETCFG_GET_ADDR_LIST,
@@ -255,5 +255,5 @@
 }
 
-errno_t inetcfg_get_link_list(sysarg_t **links, size_t *count)
+int inetcfg_get_link_list(sysarg_t **links, size_t *count)
 {
 	return inetcfg_get_ids_internal(INETCFG_GET_LINK_LIST,
@@ -261,5 +261,5 @@
 }
 
-errno_t inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count)
+int inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count)
 {
 	return inetcfg_get_ids_internal(INETCFG_GET_SROUTE_LIST,
@@ -267,9 +267,9 @@
 }
 
-errno_t inetcfg_link_add(sysarg_t link_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	errno_t rc = async_req_1_0(exch, INETCFG_LINK_ADD, link_id);
+int inetcfg_link_add(sysarg_t link_id)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	int rc = async_req_1_0(exch, INETCFG_LINK_ADD, link_id);
 	async_exchange_end(exch);
 
@@ -277,8 +277,8 @@
 }
 
-errno_t inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo)
+int inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo)
 {
 	ipc_call_t dreply;
-	errno_t dretval;
+	sysarg_t dretval;
 	size_t act_size;
 	char name_buf[LOC_NAME_MAXLEN + 1];
@@ -289,5 +289,5 @@
 	aid_t req = async_send_1(exch, INETCFG_LINK_GET, link_id, &answer);
 	aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, &dreply);
-	errno_t rc = async_data_read_start(exch, &linfo->mac_addr, sizeof(addr48_t));
+	int rc = async_data_read_start(exch, &linfo->mac_addr, sizeof(addr48_t));
 	async_wait_for(dreq, &dretval);
 
@@ -299,5 +299,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
@@ -315,9 +315,9 @@
 }
 
-errno_t inetcfg_link_remove(sysarg_t link_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	errno_t rc = async_req_1_0(exch, INETCFG_LINK_REMOVE, link_id);
+int inetcfg_link_remove(sysarg_t link_id)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	int rc = async_req_1_0(exch, INETCFG_LINK_REMOVE, link_id);
 	async_exchange_end(exch);
 
@@ -325,5 +325,5 @@
 }
 
-errno_t inetcfg_sroute_create(const char *name, inet_naddr_t *dest,
+int inetcfg_sroute_create(const char *name, inet_naddr_t *dest,
     inet_addr_t *router, sysarg_t *sroute_id)
 {
@@ -333,5 +333,5 @@
 	aid_t req = async_send_0(exch, INETCFG_SROUTE_CREATE, &answer);
 	
-	errno_t rc = async_data_write_start(exch, dest, sizeof(inet_naddr_t));
+	int rc = async_data_write_start(exch, dest, sizeof(inet_naddr_t));
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -356,17 +356,17 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
 	*sroute_id = IPC_GET_ARG1(answer);
 	
-	return retval;
-}
-
-errno_t inetcfg_sroute_delete(sysarg_t sroute_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	errno_t rc = async_req_1_0(exch, INETCFG_SROUTE_DELETE, sroute_id);
+	return (int) retval;
+}
+
+int inetcfg_sroute_delete(sysarg_t sroute_id)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	int rc = async_req_1_0(exch, INETCFG_SROUTE_DELETE, sroute_id);
 	async_exchange_end(exch);
 
@@ -374,5 +374,5 @@
 }
 
-errno_t inetcfg_sroute_get(sysarg_t sroute_id, inet_sroute_info_t *srinfo)
+int inetcfg_sroute_get(sysarg_t sroute_id, inet_sroute_info_t *srinfo)
 {
 	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
@@ -385,5 +385,5 @@
 	    sizeof(inet_naddr_t), &answer_dest);
 	
-	errno_t retval_dest;
+	sysarg_t retval_dest;
 	async_wait_for(req_dest, &retval_dest);
 	
@@ -391,5 +391,5 @@
 		async_exchange_end(exch);
 		async_forget(req);
-		return retval_dest;
+		return (int) retval_dest;
 	}
 	
@@ -398,5 +398,5 @@
 	    sizeof(inet_addr_t), &answer_router);
 	
-	errno_t retval_router;
+	sysarg_t retval_router;
 	async_wait_for(req_router, &retval_router);
 	
@@ -404,5 +404,5 @@
 		async_exchange_end(exch);
 		async_forget(req);
-		return retval_router;
+		return (int) retval_router;
 	}
 	
@@ -414,17 +414,17 @@
 	async_exchange_end(exch);
 	
-	errno_t retval_name;
+	sysarg_t retval_name;
 	async_wait_for(req_name, &retval_name);
 	
 	if (retval_name != EOK) {
 		async_forget(req);
-		return retval_name;
-	}
-	
-	errno_t retval;
+		return (int) retval_name;
+	}
+	
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
 	if (retval != EOK)
-		return retval;
+		return (int) retval;
 	
 	size_t act_size = IPC_GET_ARG2(answer_name);
@@ -438,5 +438,5 @@
 }
 
-errno_t inetcfg_sroute_get_id(const char *name, sysarg_t *sroute_id)
+int inetcfg_sroute_get_id(const char *name, sysarg_t *sroute_id)
 {
 	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
@@ -444,5 +444,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, INETCFG_SROUTE_GET_ID, &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
+	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
 
 	async_exchange_end(exch);
Index: uspace/lib/c/generic/inetping.c
===================================================================
--- uspace/lib/c/generic/inetping.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/inetping.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,8 +44,8 @@
 static inetping_ev_ops_t *inetping_ev_ops;
 
-errno_t inetping_init(inetping_ev_ops_t *ev_ops)
+int inetping_init(inetping_ev_ops_t *ev_ops)
 {
 	service_id_t inetping_svc;
-	errno_t rc;
+	int rc;
 
 	assert(inetping_sess == NULL);
@@ -80,5 +80,5 @@
 }
 
-errno_t inetping_send(inetping_sdu_t *sdu)
+int inetping_send(inetping_sdu_t *sdu)
 {
 	async_exch_t *exch = async_exchange_begin(inetping_sess);
@@ -87,5 +87,5 @@
 	aid_t req = async_send_1(exch, INETPING_SEND, sdu->seq_no, &answer);
 
-	errno_t rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src));
+	int rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src));
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -110,11 +110,11 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
-	return retval;
-}
-
-errno_t inetping_get_srcaddr(const inet_addr_t *remote, inet_addr_t *local)
+	return (int) retval;
+}
+
+int inetping_get_srcaddr(const inet_addr_t *remote, inet_addr_t *local)
 {
 	async_exch_t *exch = async_exchange_begin(inetping_sess);
@@ -123,5 +123,5 @@
 	aid_t req = async_send_0(exch, INETPING_GET_SRCADDR, &answer);
 
-	errno_t rc = async_data_write_start(exch, remote, sizeof(*remote));
+	int rc = async_data_write_start(exch, remote, sizeof(*remote));
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -136,16 +136,16 @@
 	async_exchange_end(exch);
 
-	errno_t retval_local;
+	sysarg_t retval_local;
 	async_wait_for(req_local, &retval_local);
 
 	if (retval_local != EOK) {
 		async_forget(req);
-		return retval_local;
-	}
-
-	errno_t retval;
+		return (int) retval_local;
+	}
+
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
-	return retval;
+	return (int) retval;
 }
 
@@ -170,5 +170,5 @@
 	}
 
-	errno_t rc = async_data_write_finalize(callid, &sdu.src, size);
+	int rc = async_data_write_finalize(callid, &sdu.src, size);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
Index: uspace/lib/c/generic/io/asprintf.c
===================================================================
--- uspace/lib/c/generic/io/asprintf.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/asprintf.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -79,5 +79,5 @@
  * @args       Variable argument list
  *
- * @return Number of characters printed or an error code.
+ * @return Number of characters printed or a negative error code.
  *
  */
@@ -106,5 +106,5 @@
  * @fmt        Format string.
  *
- * @return Number of characters printed or an error code.
+ * @return Number of characters printed or a negative error code.
  *
  */
Index: uspace/lib/c/generic/io/chardev.c
===================================================================
--- uspace/lib/c/generic/io/chardev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/chardev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
  * @return EOK on success, ENOMEM if out of memory, EIO on I/O error
  */
-errno_t chardev_open(async_sess_t *sess, chardev_t **rchardev)
+int chardev_open(async_sess_t *sess, chardev_t **rchardev)
 {
 	chardev_t *chardev;
@@ -94,5 +94,5 @@
  * @return EOK on success or non-zero error code
  */
-errno_t chardev_read(chardev_t *chardev, void *buf, size_t size, size_t *nread)
+int chardev_read(chardev_t *chardev, void *buf, size_t size, size_t *nread)
 {
 	async_exch_t *exch = async_exchange_begin(chardev->sess);
@@ -105,5 +105,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, CHARDEV_READ, &answer);
-	errno_t rc = async_data_read_start(exch, buf, size);
+	int rc = async_data_read_start(exch, buf, size);
 	async_exchange_end(exch);
 
@@ -114,5 +114,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
@@ -124,5 +124,5 @@
 	*nread = IPC_GET_ARG2(answer);
 	/* In case of partial success, ARG1 contains the error code */
-	return (errno_t) IPC_GET_ARG1(answer);
+	return IPC_GET_ARG1(answer);
 
 }
@@ -144,5 +144,5 @@
  * @return EOK on success or non-zero error code
  */
-static errno_t chardev_write_once(chardev_t *chardev, const void *data,
+static int chardev_write_once(chardev_t *chardev, const void *data,
     size_t size, size_t *nwritten)
 {
@@ -150,5 +150,5 @@
 	ipc_call_t answer;
 	aid_t req;
-	errno_t rc;
+	int rc;
 
 	/* Break down large transfers */
@@ -166,5 +166,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	if (retval != EOK) {
@@ -175,5 +175,5 @@
 	*nwritten = IPC_GET_ARG2(answer);
 	/* In case of partial success, ARG1 contains the error code */
-	return (errno_t) IPC_GET_ARG1(answer);
+	return IPC_GET_ARG1(answer);
 }
 
@@ -193,10 +193,10 @@
  * @return EOK on success or non-zero error code
  */
-errno_t chardev_write(chardev_t *chardev, const void *data, size_t size,
+int chardev_write(chardev_t *chardev, const void *data, size_t size,
     size_t *nwritten)
 {
 	size_t nw;
 	size_t p;
-	errno_t rc;
+	int rc;
 
 	p = 0;
Index: uspace/lib/c/generic/io/chardev_srv.c
===================================================================
--- uspace/lib/c/generic/io/chardev_srv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/chardev_srv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
 	size_t size;
 	size_t nread;
-	errno_t rc;
+	int rc;
 	ipc_callid_t rcallid;
 
@@ -82,5 +82,5 @@
 
 	free(buf);
-	async_answer_2(callid, EOK, (sysarg_t) rc, nread);
+	async_answer_2(callid, EOK, rc, nread);
 }
 
@@ -91,5 +91,5 @@
 	size_t size;
 	size_t nwr;
-	errno_t rc;
+	int rc;
 
 	rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
@@ -111,5 +111,5 @@
 	}
 
-	async_answer_2(callid, EOK, (sysarg_t) rc, nwr);
+	async_answer_2(callid, EOK, rc, nwr);
 }
 
@@ -132,8 +132,8 @@
 }
 
-errno_t chardev_conn(ipc_callid_t iid, ipc_call_t *icall, chardev_srvs_t *srvs)
+int chardev_conn(ipc_callid_t iid, ipc_call_t *icall, chardev_srvs_t *srvs)
 {
 	chardev_srv_t *srv;
-	errno_t rc;
+	int rc;
 
 	/* Accept the connection */
Index: uspace/lib/c/generic/io/con_srv.c
===================================================================
--- uspace/lib/c/generic/io/con_srv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/con_srv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 #include <io/con_srv.h>
 
-static errno_t console_ev_encode(cons_event_t *event, ipc_call_t *call)
+static int console_ev_encode(cons_event_t *event, ipc_call_t *call)
 {
 	IPC_SET_ARG1(*call, event->type);
@@ -71,5 +71,5 @@
 	void *buf;
 	size_t size;
-	errno_t rc;
+	int rc;
 	ipc_callid_t rcallid;
 
@@ -93,7 +93,6 @@
 	}
 
-	size_t nread;
-	rc = srv->srvs->ops->read(srv, buf, size, &nread);
-	if (rc != EOK) {
+	rc = srv->srvs->ops->read(srv, buf, size);
+	if (rc < 0) {
 		async_answer_0(rcallid, rc);
 		async_answer_0(callid, rc);
@@ -102,8 +101,11 @@
 	}
 
-	async_data_read_finalize(rcallid, buf, nread);
+	async_data_read_finalize(rcallid, buf, size);
 	free(buf);
 
-	async_answer_1(callid, EOK, nread);
+	if (rc >= 0)
+		async_answer_1(callid, EOK, rc);
+	else
+		async_answer_0(callid, rc);
 }
 
@@ -113,5 +115,5 @@
 	void *data;
 	size_t size;
-	errno_t rc;
+	int rc;
 
 	rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
@@ -126,9 +128,11 @@
 	}
 
-	size_t nwritten = 0;
-	rc = srv->srvs->ops->write(srv, data, size, &nwritten);
+	rc = srv->srvs->ops->write(srv, data, size);
 	free(data);
 
-	async_answer_1(callid, rc, nwritten);
+	if (rc >= 0)
+		async_answer_1(callid, EOK, rc);
+	else
+		async_answer_0(callid, rc);
 }
 
@@ -178,5 +182,5 @@
     ipc_call_t *call)
 {
-	errno_t rc;
+	int rc;
 	sysarg_t col;
 	sysarg_t row;
@@ -194,5 +198,5 @@
     ipc_call_t *call)
 {
-	errno_t rc;
+	int rc;
 	sysarg_t cols;
 	sysarg_t rows;
@@ -210,5 +214,5 @@
     ipc_call_t *call)
 {
-	errno_t rc;
+	int rc;
 	console_caps_t ccap;
 
@@ -295,5 +299,5 @@
     ipc_call_t *call)
 {
-	errno_t rc;
+	int rc;
 	cons_event_t event;
 	ipc_call_t result;
@@ -340,8 +344,8 @@
 }
 
-errno_t con_conn(ipc_callid_t iid, ipc_call_t *icall, con_srvs_t *srvs)
+int con_conn(ipc_callid_t iid, ipc_call_t *icall, con_srvs_t *srvs)
 {
 	con_srv_t *srv;
-	errno_t rc;
+	int rc;
 
 	/* Accept the connection */
Index: uspace/lib/c/generic/io/console.c
===================================================================
--- uspace/lib/c/generic/io/console.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/console.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -90,8 +90,8 @@
 }
 
-errno_t console_get_size(console_ctrl_t *ctrl, sysarg_t *cols, sysarg_t *rows)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	errno_t rc = async_req_0_2(exch, CONSOLE_GET_SIZE, cols, rows);
+int console_get_size(console_ctrl_t *ctrl, sysarg_t *cols, sysarg_t *rows)
+{
+	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
+	int rc = async_req_0_2(exch, CONSOLE_GET_SIZE, cols, rows);
 	async_exchange_end(exch);
 	
@@ -129,8 +129,8 @@
 }
 
-errno_t console_get_color_cap(console_ctrl_t *ctrl, sysarg_t *ccap)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	errno_t rc = async_req_0_1(exch, CONSOLE_GET_COLOR_CAP, ccap);
+int console_get_color_cap(console_ctrl_t *ctrl, sysarg_t *ccap)
+{
+	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
+	int rc = async_req_0_1(exch, CONSOLE_GET_COLOR_CAP, ccap);
 	async_exchange_end(exch);
 	
@@ -138,8 +138,8 @@
 }
 
-errno_t console_get_pos(console_ctrl_t *ctrl, sysarg_t *col, sysarg_t *row)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	errno_t rc = async_req_0_2(exch, CONSOLE_GET_POS, col, row);
+int console_get_pos(console_ctrl_t *ctrl, sysarg_t *col, sysarg_t *row)
+{
+	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
+	int rc = async_req_0_2(exch, CONSOLE_GET_POS, col, row);
 	async_exchange_end(exch);
 	
@@ -154,5 +154,5 @@
 }
 
-static errno_t console_ev_decode(ipc_call_t *call, cons_event_t *event)
+static int console_ev_decode(ipc_call_t *call, cons_event_t *event)
 {
 	event->type = IPC_GET_ARG1(*call);
@@ -188,5 +188,5 @@
 		async_exchange_end(exch);
 		
-		errno_t rc;
+		sysarg_t rc;
 		async_wait_for(aid, &rc);
 		
@@ -202,5 +202,5 @@
 		}
 	} else {
-		errno_t retval;
+		sysarg_t retval;
 		async_wait_for(ctrl->input_aid, &retval);
 		
@@ -208,9 +208,9 @@
 		
 		if (retval != EOK) {
-			errno = retval;
-			return false;
-		}
-		
-		errno_t rc = console_ev_decode(&ctrl->input_call, event);
+			errno = (int) retval;
+			return false;
+		}
+		
+		int rc = console_ev_decode(&ctrl->input_call, event);
 		if (rc != EOK) {
 			errno = rc;
@@ -235,6 +235,6 @@
 	}
 	
-	errno_t retval;
-	errno_t rc = async_wait_timeout(ctrl->input_aid, &retval, *timeout);
+	sysarg_t retval;
+	int rc = async_wait_timeout(ctrl->input_aid, &retval, *timeout);
 	if (rc != EOK) {
 		*timeout = 0;
@@ -246,5 +246,5 @@
 	
 	if (retval != EOK) {
-		errno = retval;
+		errno = (int) retval;
 		return false;
 	}
Index: uspace/lib/c/generic/io/input.c
===================================================================
--- uspace/lib/c/generic/io/input.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/input.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,5 @@
 static void input_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
 
-errno_t input_open(async_sess_t *sess, input_ev_ops_t *ev_ops,
+int input_open(async_sess_t *sess, input_ev_ops_t *ev_ops,
     void *arg, input_t **rinput)
 {
@@ -59,5 +59,5 @@
 
 	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_INPUT_CB, 0, 0,
+	int rc = async_create_callback_port(exch, INTERFACE_INPUT_CB, 0, 0,
 	    input_cb_conn, input, &port);
 	
@@ -83,8 +83,8 @@
 }
 
-errno_t input_activate(input_t *input)
+int input_activate(input_t *input)
 {
 	async_exch_t *exch = async_exchange_begin(input->sess);
-	errno_t rc = async_req_0_0(exch, INPUT_ACTIVATE);
+	int rc = async_req_0_0(exch, INPUT_ACTIVATE);
 	async_exchange_end(exch);
 	
@@ -95,5 +95,5 @@
     ipc_call_t *call)
 {
-	errno_t rc = input->ev_ops->active(input);
+	int rc = input->ev_ops->active(input);
 	async_answer_0(callid, rc);
 }
@@ -102,5 +102,5 @@
     ipc_call_t *call)
 {
-	errno_t rc = input->ev_ops->deactive(input);
+	int rc = input->ev_ops->deactive(input);
 	async_answer_0(callid, rc);
 }
@@ -113,5 +113,5 @@
 	keymod_t mods;
 	wchar_t c;
-	errno_t rc;
+	int rc;
 
 	type = IPC_GET_ARG1(*call);
@@ -129,5 +129,5 @@
 	int dx;
 	int dy;
-	errno_t rc;
+	int rc;
 
 	dx = IPC_GET_ARG1(*call);
@@ -145,5 +145,5 @@
 	unsigned max_x;
 	unsigned max_y;
-	errno_t rc;
+	int rc;
 
 	x = IPC_GET_ARG1(*call);
@@ -161,5 +161,5 @@
 	int bnum;
 	int press;
-	errno_t rc;
+	int rc;
 
 	bnum = IPC_GET_ARG1(*call);
Index: uspace/lib/c/generic/io/io.c
===================================================================
--- uspace/lib/c/generic/io/io.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/io.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -108,8 +108,8 @@
 	 * This will probably be removed later.
 	 */
+	 
 	int infd = inbox_get("stdin");
 	if (infd >= 0) {
-		int stdinfd = -1;
-		(void) vfs_clone(infd, -1, false, &stdinfd);
+		int stdinfd = vfs_clone(infd, -1, false);
 		assert(stdinfd == 0);
 		vfs_open(stdinfd, MODE_READ);
@@ -122,9 +122,8 @@
 	int outfd = inbox_get("stdout");
 	if (outfd >= 0) {
-		int stdoutfd = -1;
-		(void) vfs_clone(outfd, -1, false, &stdoutfd);
+		int stdoutfd = vfs_clone(outfd, -1, false);
 		assert(stdoutfd <= 1);
 		while (stdoutfd < 1)
-			(void) vfs_clone(outfd, -1, false, &stdoutfd);
+			stdoutfd = vfs_clone(outfd, -1, false);
 		vfs_open(stdoutfd, MODE_APPEND);
 		stdout = fdopen(stdoutfd, "a");
@@ -136,9 +135,8 @@
 	int errfd = inbox_get("stderr");
 	if (errfd >= 0) {
-		int stderrfd = -1;
-		(void) vfs_clone(errfd, -1, false, &stderrfd);
+		int stderrfd = vfs_clone(errfd, -1, false);
 		assert(stderrfd <= 2);
 		while (stderrfd < 2)
-			(void) vfs_clone(errfd, -1, false, &stderrfd);
+			stderrfd = vfs_clone(errfd, -1, false);
 		vfs_open(stderrfd, MODE_APPEND);
 		stderr = fdopen(stderrfd, "a");
@@ -296,13 +294,12 @@
 	if (create)
 		flags |= WALK_MAY_CREATE;
-	int file;
-	errno_t rc = vfs_lookup(path, flags, &file);
-	if (rc != EOK) {
-		errno = rc;
+	int file = vfs_lookup(path, flags);
+	if (file < 0) {
+		errno = file;
 		free(stream);
 		return NULL;
 	}
 
-	rc = vfs_open(file, mode);
+	int rc = vfs_open(file, mode);
 	if (rc != EOK) {
 		errno = rc;
@@ -364,5 +361,5 @@
 static int _fclose_nofree(FILE *stream)
 {
-	errno_t rc = 0;
+	int rc = 0;
 	
 	fflush(stream);
@@ -376,6 +373,6 @@
 	list_remove(&stream->link);
 	
-	if (rc != EOK) {
-		errno = rc;
+	if (rc != 0) {
+		/* errno was set by close() */
 		return EOF;
 	}
@@ -433,5 +430,5 @@
 static size_t _fread(void *buf, size_t size, size_t nmemb, FILE *stream)
 {
-	errno_t rc;
+	int rc;
 	size_t nread;
 
@@ -462,5 +459,5 @@
 static size_t _fwrite(const void *buf, size_t size, size_t nmemb, FILE *stream)
 {
-	errno_t rc;
+	int rc;
 	size_t nwritten;
 
@@ -495,5 +492,5 @@
 static void _ffillbuf(FILE *stream)
 {
-	errno_t rc;
+	int rc;
 	size_t nread;
 
@@ -799,7 +796,7 @@
 }
 
-int fseek64(FILE *stream, off64_t offset, int whence)
-{
-	errno_t rc;
+int fseek(FILE *stream, long offset, int whence)
+{
+	int rc;
 
 	if (stream->error)
@@ -814,5 +811,5 @@
 	stream->ungetc_chars = 0;
 
-	vfs_stat_t st;
+	struct stat st;
 	switch (whence) {
 	case SEEK_SET:
@@ -837,6 +834,10 @@
 }
 
-off64_t ftell64(FILE *stream)
-{
+long ftell(FILE *stream)
+{
+	/* The native position is too large for the C99-ish interface. */
+	if (stream->pos - stream->ungetc_chars > LONG_MAX)
+		return EOF;
+
 	if (stream->error)
 		return EOF;
@@ -851,20 +852,4 @@
 }
 
-int fseek(FILE *stream, long offset, int whence)
-{
-	return fseek64(stream, offset, whence);
-}
-
-long ftell(FILE *stream)
-{
-	off64_t off = ftell64(stream);
-
-	/* The native position is too large for the C99-ish interface. */
-	if (off > LONG_MAX)
-		return EOF;
-
-	return off;
-}
-
 void rewind(FILE *stream)
 {
@@ -889,5 +874,5 @@
 	
 	if ((stream->fd >= 0) && (stream->need_sync)) {
-		errno_t rc;
+		int rc;
 
 		/**
@@ -946,5 +931,5 @@
 }
 
-errno_t vfs_fhandle(FILE *stream, int *handle)
+int vfs_fhandle(FILE *stream, int *handle)
 {
 	if (stream->fd >= 0) {
Index: uspace/lib/c/generic/io/kio.c
===================================================================
--- uspace/lib/c/generic/io/kio.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/kio.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,7 +43,7 @@
 #include <io/printf_core.h>
 
-errno_t kio_write(const void *buf, size_t size, size_t *nwritten)
+int kio_write(const void *buf, size_t size, size_t *nwritten)
 {
-	errno_t rc = (errno_t) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) buf, size);
+	int rc = (int) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) buf, size);
 	
 	if (rc == EOK)
Index: uspace/lib/c/generic/io/klog.c
===================================================================
--- uspace/lib/c/generic/io/klog.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/klog.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,14 +42,18 @@
 #include <abi/log.h>
 
-errno_t klog_write(log_level_t lvl, const void *buf, size_t size)
+size_t klog_write(log_level_t lvl, const void *buf, size_t size)
 {
-	return (errno_t) __SYSCALL4(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf,
+	ssize_t ret = (ssize_t) __SYSCALL4(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf,
 	    size, lvl);
+	
+	if (ret >= 0)
+		return (size_t) ret;
+	
+	return 0;
 }
 
-errno_t klog_read(void *data, size_t size, size_t *nread)
+int klog_read(void *data, size_t size)
 {
-	return (errno_t) __SYSCALL5(SYS_KLOG, KLOG_READ, (uintptr_t) data,
-	    size, 0, (sysarg_t) nread);
+	return (int) __SYSCALL4(SYS_KLOG, KLOG_READ, (uintptr_t) data, size, 0);
 }
 
Index: uspace/lib/c/generic/io/log.c
===================================================================
--- uspace/lib/c/generic/io/log.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/log.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,4 @@
 #include <io/log.h>
 #include <ipc/logger.h>
-#include <str.h>
 #include <ns.h>
 
@@ -75,5 +74,5 @@
  * @return Error code of the conversion or EOK on success.
  */
-static errno_t logger_message(async_sess_t *session, log_t log, log_level_t level, char *message)
+static int logger_message(async_sess_t *session, log_t log, log_level_t level, char *message)
 {
 	async_exch_t *exchange = async_exchange_begin(session);
@@ -89,6 +88,6 @@
 	aid_t reg_msg = async_send_2(exchange, LOGGER_WRITER_MESSAGE,
 	    log, level, NULL);
-	errno_t rc = async_data_write_start(exchange, message, str_size(message));
-	errno_t reg_msg_rc;
+	int rc = async_data_write_start(exchange, message, str_size(message));
+	sysarg_t reg_msg_rc;
 	async_wait_for(reg_msg, &reg_msg_rc);
 
@@ -128,5 +127,5 @@
  * @return Error code of the conversion or EOK on success.
  */
-errno_t log_level_from_str(const char *name, log_level_t *level_out)
+int log_level_from_str(const char *name, log_level_t *level_out)
 {
 	log_level_t level = LVL_FATAL;
@@ -161,5 +160,5 @@
  * @param prog_name Program name, will be printed as part of message
  */
-errno_t log_init(const char *prog_name)
+int log_init(const char *prog_name)
 {
 	log_prog_name = str_dup(prog_name);
@@ -199,6 +198,6 @@
 	aid_t reg_msg = async_send_1(exchange, LOGGER_WRITER_CREATE_LOG,
 	    parent, &answer);
-	errno_t rc = async_data_write_start(exchange, name, str_size(name));
-	errno_t reg_msg_rc;
+	int rc = async_data_write_start(exchange, name, str_size(name));
+	sysarg_t reg_msg_rc;
 	async_wait_for(reg_msg, &reg_msg_rc);
 
Index: uspace/lib/c/generic/io/logctl.c
===================================================================
--- uspace/lib/c/generic/io/logctl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/logctl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 static async_sess_t *logger_session = NULL;
 
-static errno_t start_logger_exchange(async_exch_t **exchange_out)
+static int start_logger_exchange(async_exch_t **exchange_out)
 {
 	assert(exchange_out != NULL);
@@ -78,12 +78,12 @@
  * @return Error code of the conversion or EOK on success.
  */
-errno_t logctl_set_default_level(log_level_t new_level)
+int logctl_set_default_level(log_level_t new_level)
 {
 	async_exch_t *exchange = NULL;
-	errno_t rc = start_logger_exchange(&exchange);
+	int rc = start_logger_exchange(&exchange);
 	if (rc != EOK)
 		return rc;
 
-	rc = (errno_t) async_req_1_0(exchange,
+	rc = (int) async_req_1_0(exchange,
 	    LOGGER_CONTROL_SET_DEFAULT_LEVEL, new_level);
 
@@ -101,8 +101,8 @@
  * @return Error code of the conversion or EOK on success.
  */
-errno_t logctl_set_log_level(const char *logname, log_level_t new_level)
+int logctl_set_log_level(const char *logname, log_level_t new_level)
 {
 	async_exch_t *exchange = NULL;
-	errno_t rc = start_logger_exchange(&exchange);
+	int rc = start_logger_exchange(&exchange);
 	if (rc != EOK)
 		return rc;
@@ -111,5 +111,5 @@
 	    new_level, NULL);
 	rc = async_data_write_start(exchange, logname, str_size(logname));
-	errno_t reg_msg_rc;
+	sysarg_t reg_msg_rc;
 	async_wait_for(reg_msg, &reg_msg_rc);
 
@@ -119,5 +119,5 @@
 		return rc;
 
-	return (errno_t) reg_msg_rc;
+	return (int) reg_msg_rc;
 }
 
@@ -126,8 +126,8 @@
  * @return Error code or EOK on success.
  */
-errno_t logctl_set_root(void)
+int logctl_set_root(void)
 {
 	async_exch_t *exchange = NULL;
-	errno_t rc = start_logger_exchange(&exchange);
+	int rc = start_logger_exchange(&exchange);
 	if (rc != EOK)
 		return rc;
@@ -137,5 +137,5 @@
 	rc = vfs_pass_handle(vfs_exch, vfs_root(), exchange);
 	vfs_exchange_end(vfs_exch);
-	errno_t reg_msg_rc;
+	sysarg_t reg_msg_rc;
 	async_wait_for(reg_msg, &reg_msg_rc);
 
@@ -145,5 +145,5 @@
 		return rc;
 
-	return (errno_t) reg_msg_rc;
+	return (int) reg_msg_rc;
 }
 
Index: uspace/lib/c/generic/io/output.c
===================================================================
--- uspace/lib/c/generic/io/output.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/output.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,8 +40,8 @@
 #include <io/output.h>
 
-errno_t output_yield(async_sess_t *sess)
+int output_yield(async_sess_t *sess)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_0_0(exch, OUTPUT_YIELD);
+	int ret = async_req_0_0(exch, OUTPUT_YIELD);
 	async_exchange_end(exch);
 	
@@ -49,8 +49,8 @@
 }
 
-errno_t output_claim(async_sess_t *sess)
+int output_claim(async_sess_t *sess)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_0_0(exch, OUTPUT_CLAIM);
+	int ret = async_req_0_0(exch, OUTPUT_CLAIM);
 	async_exchange_end(exch);
 	
@@ -58,8 +58,8 @@
 }
 
-errno_t output_get_dimensions(async_sess_t *sess, sysarg_t *maxx, sysarg_t *maxy)
+int output_get_dimensions(async_sess_t *sess, sysarg_t *maxx, sysarg_t *maxy)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_0_2(exch, OUTPUT_GET_DIMENSIONS, maxx, maxy);
+	int ret = async_req_0_2(exch, OUTPUT_GET_DIMENSIONS, maxx, maxy);
 	async_exchange_end(exch);
 	
@@ -67,10 +67,10 @@
 }
 
-errno_t output_get_caps(async_sess_t *sess, console_caps_t *ccaps)
+int output_get_caps(async_sess_t *sess, console_caps_t *ccaps)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
 	
 	sysarg_t rv;
-	errno_t ret = async_req_0_1(exch, OUTPUT_GET_CAPS, &rv);
+	int ret = async_req_0_1(exch, OUTPUT_GET_CAPS, &rv);
 	
 	async_exchange_end(exch);
@@ -89,10 +89,10 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, OUTPUT_FRONTBUF_CREATE, &answer);
-	errno_t rc = async_share_out_start(exch, frontbuf, AS_AREA_READ
+	int rc = async_share_out_start(exch, frontbuf, AS_AREA_READ
 	    | AS_AREA_WRITE | AS_AREA_CACHEABLE);
 	
 	async_exchange_end(exch);
 	
-	errno_t ret;
+	sysarg_t ret;
 	async_wait_for(req, &ret);
 	
@@ -103,8 +103,8 @@
 }
 
-errno_t output_set_style(async_sess_t *sess, console_style_t style)
+int output_set_style(async_sess_t *sess, console_style_t style)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_1_0(exch, OUTPUT_SET_STYLE, style);
+	int ret = async_req_1_0(exch, OUTPUT_SET_STYLE, style);
 	async_exchange_end(exch);
 	
@@ -112,8 +112,8 @@
 }
 
-errno_t output_cursor_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
+int output_cursor_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_1_0(exch, OUTPUT_CURSOR_UPDATE, frontbuf);
+	int ret = async_req_1_0(exch, OUTPUT_CURSOR_UPDATE, frontbuf);
 	async_exchange_end(exch);
 	
@@ -121,8 +121,8 @@
 }
 
-errno_t output_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
+int output_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_1_0(exch, OUTPUT_UPDATE, frontbuf);
+	int ret = async_req_1_0(exch, OUTPUT_UPDATE, frontbuf);
 	async_exchange_end(exch);
 	
@@ -130,9 +130,9 @@
 }
 
-errno_t output_damage(async_sess_t *sess, frontbuf_handle_t frontbuf, sysarg_t col,
+int output_damage(async_sess_t *sess, frontbuf_handle_t frontbuf, sysarg_t col,
     sysarg_t row, sysarg_t cols, sysarg_t rows)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_5_0(exch, OUTPUT_DAMAGE, frontbuf, col, row,
+	int ret = async_req_5_0(exch, OUTPUT_DAMAGE, frontbuf, col, row,
 	    cols, rows);
 	async_exchange_end(exch);
Index: uspace/lib/c/generic/io/serial.c
===================================================================
--- uspace/lib/c/generic/io/serial.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/serial.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
  * @return EOK on success, ENOMEM if out of memory, EIO on I/O error
  */
-errno_t serial_open(async_sess_t *sess, serial_t **rserial)
+int serial_open(async_sess_t *sess, serial_t **rserial)
 {
 	serial_t *serial;
@@ -68,10 +68,10 @@
 
 /** Set serial port communication properties. */
-errno_t serial_set_comm_props(serial_t *serial, unsigned rate,
+int serial_set_comm_props(serial_t *serial, unsigned rate,
     serial_parity_t parity, unsigned datab, unsigned stopb)
 {
 	async_exch_t *exch = async_exchange_begin(serial->sess);
 
-	errno_t rc = async_req_4_0(exch, SERIAL_SET_COM_PROPS, rate, parity,
+	int rc = async_req_4_0(exch, SERIAL_SET_COM_PROPS, rate, parity,
 	    datab, stopb);
 
@@ -81,5 +81,5 @@
 
 /** Get serial port communication properties. */
-errno_t serial_get_comm_props(serial_t *serial, unsigned *rrate,
+int serial_get_comm_props(serial_t *serial, unsigned *rrate,
     serial_parity_t *rparity, unsigned *rdatab, unsigned *rstopb)
 {
@@ -87,5 +87,5 @@
 	sysarg_t rate, parity, datab, stopb;
 
-	errno_t rc = async_req_0_4(exch, SERIAL_GET_COM_PROPS, &rate, &parity,
+	int rc = async_req_0_4(exch, SERIAL_GET_COM_PROPS, &rate, &parity,
 	    &datab, &stopb);
 
Index: uspace/lib/c/generic/io/table.c
===================================================================
--- uspace/lib/c/generic/io/table.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/table.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 
 static table_column_t *table_column_first(table_t *);
@@ -52,5 +51,5 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-static errno_t table_add_row(table_t *table, table_row_t **rrow)
+static int table_add_row(table_t *table, table_row_t **rrow)
 {
 	table_row_t *row;
@@ -75,5 +74,5 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-static errno_t table_row_add_cell(table_row_t *row, table_cell_t **rcell)
+static int table_row_add_cell(table_row_t *row, table_cell_t **rcell)
 {
 	table_cell_t *cell;
@@ -100,5 +99,5 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-static errno_t table_add_column(table_t *table, table_column_t **rcolumn)
+static int table_add_column(table_t *table, table_column_t **rcolumn)
 {
 	table_column_t *column;
@@ -122,7 +121,7 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-static errno_t table_write_next_cell(table_t *table)
-{
-	errno_t rc;
+static int table_write_next_cell(table_t *table)
+{
+	int rc;
 
 	rc = table_row_add_cell(table->wrow, &table->wcell);
@@ -156,7 +155,7 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-static errno_t table_write_next_row(table_t *table)
-{
-	errno_t rc;
+static int table_write_next_row(table_t *table)
+{
+	int rc;
 
 	rc = table_add_row(table, &table->wrow);
@@ -273,5 +272,5 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-static errno_t table_cell_extend(table_cell_t *cell, const char *str, size_t len)
+static int table_cell_extend(table_cell_t *cell, const char *str, size_t len)
 {
 	char *cstr;
@@ -299,8 +298,8 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-errno_t table_create(table_t **rtable)
+int table_create(table_t **rtable)
 {
 	table_t *table;
-	errno_t rc;
+	int rc;
 
 	table = calloc(1, sizeof(table_t));
@@ -378,5 +377,5 @@
  * @return EOK on success, EIO on I/O error
  */
-errno_t table_print_out(table_t *table, FILE *f)
+int table_print_out(table_t *table, FILE *f)
 {
 	table_row_t *row;
@@ -475,9 +474,8 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-errno_t table_printf(table_t *table, const char *fmt, ...)
+int table_printf(table_t *table, const char *fmt, ...)
 {
 	va_list args;
-	errno_t rc;
-	int ret;
+	int rc;
 	char *str;
 	char *sp, *ep;
@@ -488,8 +486,8 @@
 
 	va_start(args, fmt);
-	ret = vasprintf(&str, fmt, args);
+	rc = vasprintf(&str, fmt, args);
 	va_end(args);
 
-	if (ret < 0) {
+	if (rc < 0) {
 		table->error = ENOMEM;
 		return table->error;
@@ -549,5 +547,5 @@
  * @return EOK if no error indicated, non-zero error code otherwise
  */
-errno_t table_get_error(table_t *table)
+int table_get_error(table_t *table)
 {
 	return table->error;
Index: uspace/lib/c/generic/io/visualizer.c
===================================================================
--- uspace/lib/c/generic/io/visualizer.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/visualizer.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,23 +39,23 @@
 #include <io/visualizer.h>
 
-errno_t visualizer_claim(async_sess_t *sess, sysarg_t notif_callback_id)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_1_0(exch, VISUALIZER_CLAIM, notif_callback_id);
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-errno_t visualizer_yield(async_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_0_0(exch, VISUALIZER_YIELD);
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-errno_t visualizer_enumerate_modes(async_sess_t *sess, vslmode_t *mode, sysarg_t nth)
+int visualizer_claim(async_sess_t *sess, sysarg_t notif_callback_id)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_1_0(exch, VISUALIZER_CLAIM, notif_callback_id);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+int visualizer_yield(async_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_0(exch, VISUALIZER_YIELD);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+int visualizer_enumerate_modes(async_sess_t *sess, vslmode_t *mode, sysarg_t nth)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -64,21 +64,21 @@
 	aid_t req = async_send_1(exch, VISUALIZER_ENUMERATE_MODES, nth, &answer);
 
-	errno_t rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
-
-	async_exchange_end(exch);
-
-	errno_t ret;
-	async_wait_for(req, &ret);
-
-	if (rc != EOK) {
-		return rc;
-	} else if (ret != EOK) {
-		return ret;
-	} else {
-		return EOK;
-	}
-}
-
-errno_t visualizer_get_default_mode(async_sess_t *sess, vslmode_t *mode)
+	int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int visualizer_get_default_mode(async_sess_t *sess, vslmode_t *mode)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -87,21 +87,21 @@
 	aid_t req = async_send_0(exch, VISUALIZER_GET_DEFAULT_MODE, &answer);
 
-	errno_t rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
-
-	async_exchange_end(exch);
-
-	errno_t ret;
-	async_wait_for(req, &ret);
-
-	if (rc != EOK) {
-		return rc;
-	} else if (ret != EOK) {
-		return ret;
-	} else {
-		return EOK;
-	}
-}
-
-errno_t visualizer_get_current_mode(async_sess_t *sess, vslmode_t *mode)
+	int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int visualizer_get_current_mode(async_sess_t *sess, vslmode_t *mode)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -110,21 +110,21 @@
 	aid_t req = async_send_0(exch, VISUALIZER_GET_CURRENT_MODE, &answer);
 
-	errno_t rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
-
-	async_exchange_end(exch);
-
-	errno_t ret;
-	async_wait_for(req, &ret);
-
-	if (rc != EOK) {
-		return rc;
-	} else if (ret != EOK) {
-		return ret;
-	} else {
-		return EOK;
-	}
-}
-
-errno_t visualizer_get_mode(async_sess_t *sess, vslmode_t *mode, sysarg_t index)
+	int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int visualizer_get_mode(async_sess_t *sess, vslmode_t *mode, sysarg_t index)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -133,21 +133,21 @@
 	aid_t req = async_send_1(exch, VISUALIZER_GET_MODE, index, &answer);
 
-	errno_t rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
-
-	async_exchange_end(exch);
-
-	errno_t ret;
-	async_wait_for(req, &ret);
-
-	if (rc != EOK) {
-		return rc;
-	} else if (ret != EOK) {
-		return ret;
-	} else {
-		return EOK;
-	}
-}
-
-errno_t visualizer_set_mode(async_sess_t *sess, sysarg_t index, sysarg_t version, void *cells)
+	int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int visualizer_set_mode(async_sess_t *sess, sysarg_t index, sysarg_t version, void *cells)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -156,21 +156,21 @@
 	aid_t req = async_send_2(exch, VISUALIZER_SET_MODE, index, version, &answer);
 
-	errno_t rc = async_share_out_start(exch, cells, AS_AREA_READ | AS_AREA_CACHEABLE);
-
-	async_exchange_end(exch);
-
-	errno_t ret;
-	async_wait_for(req, &ret);
-
-	if (rc != EOK) {
-		return rc;
-	} else if (ret != EOK) {
-		return ret;
-	} else {
-		return EOK;
-	}
-}
-
-errno_t visualizer_update_damaged_region(async_sess_t *sess,
+	int rc = async_share_out_start(exch, cells, AS_AREA_READ | AS_AREA_CACHEABLE);
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int visualizer_update_damaged_region(async_sess_t *sess,
     sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height,
 	sysarg_t x_offset, sysarg_t y_offset)
@@ -182,5 +182,5 @@
 
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_5_0(exch, VISUALIZER_UPDATE_DAMAGED_REGION,
+	int ret = async_req_5_0(exch, VISUALIZER_UPDATE_DAMAGED_REGION,
 	    x, y, width, height, offsets);
 	async_exchange_end(exch);
@@ -189,17 +189,17 @@
 }
 
-errno_t visualizer_suspend(async_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_0_0(exch, VISUALIZER_SUSPEND);
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-errno_t visualizer_wakeup(async_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_0_0(exch, VISUALIZER_WAKE_UP);
+int visualizer_suspend(async_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_0(exch, VISUALIZER_SUSPEND);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+int visualizer_wakeup(async_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_0(exch, VISUALIZER_WAKE_UP);
 	async_exchange_end(exch);
 
Index: uspace/lib/c/generic/io/window.c
===================================================================
--- uspace/lib/c/generic/io/window.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/io/window.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,9 +40,9 @@
 #include <stdio.h>
 
-errno_t win_register(async_sess_t *sess, window_flags_t flags, service_id_t *in,
+int win_register(async_sess_t *sess, window_flags_t flags, service_id_t *in,
     service_id_t *out)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_1_2(exch, WINDOW_REGISTER, flags, in, out);
+	int ret = async_req_1_2(exch, WINDOW_REGISTER, flags, in, out);
 	async_exchange_end(exch);
 	
@@ -50,5 +50,5 @@
 }
 
-errno_t win_get_event(async_sess_t *sess, window_event_t *event)
+int win_get_event(async_sess_t *sess, window_event_t *event)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -57,9 +57,9 @@
 	aid_t req = async_send_0(exch, WINDOW_GET_EVENT, &answer);
 
-	errno_t rc = async_data_read_start(exch, event, sizeof(window_event_t));
+	int rc = async_data_read_start(exch, event, sizeof(window_event_t));
 
 	async_exchange_end(exch);
 
-	errno_t ret;
+	sysarg_t ret;
 	async_wait_for(req, &ret);
 
@@ -73,9 +73,9 @@
 }
 
-errno_t win_damage(async_sess_t *sess,
+int win_damage(async_sess_t *sess,
     sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_4_0(exch, WINDOW_DAMAGE, x, y, width, height);
+	int ret = async_req_4_0(exch, WINDOW_DAMAGE, x, y, width, height);
 	async_exchange_end(exch);
 
@@ -83,8 +83,8 @@
 }
 
-errno_t win_grab(async_sess_t *sess, sysarg_t pos_id, sysarg_t grab_flags)
+int win_grab(async_sess_t *sess, sysarg_t pos_id, sysarg_t grab_flags)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_2_0(exch, WINDOW_GRAB, pos_id, grab_flags);
+	int ret = async_req_2_0(exch, WINDOW_GRAB, pos_id, grab_flags);
 	async_exchange_end(exch);
 
@@ -92,5 +92,5 @@
 }
 
-errno_t win_resize(async_sess_t *sess, sysarg_t x, sysarg_t y, sysarg_t width,
+int win_resize(async_sess_t *sess, sysarg_t x, sysarg_t y, sysarg_t width,
     sysarg_t height, window_placement_flags_t placement_flags, void *cells)
 {
@@ -101,9 +101,9 @@
 	    (sysarg_t) placement_flags, &answer);
 	
-	errno_t rc = async_share_out_start(exch, cells, AS_AREA_READ | AS_AREA_CACHEABLE);
+	int rc = async_share_out_start(exch, cells, AS_AREA_READ | AS_AREA_CACHEABLE);
 	
 	async_exchange_end(exch);
 	
-	errno_t ret;
+	sysarg_t ret;
 	async_wait_for(req, &ret);
 	
@@ -116,8 +116,8 @@
 }
 
-errno_t win_close(async_sess_t *sess)
+int win_close(async_sess_t *sess)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_0_0(exch, WINDOW_CLOSE);
+	int ret = async_req_0_0(exch, WINDOW_CLOSE);
 	async_exchange_end(exch);
 
@@ -125,8 +125,8 @@
 }
 
-errno_t win_close_request(async_sess_t *sess)
+int win_close_request(async_sess_t *sess)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_0_0(exch, WINDOW_CLOSE_REQUEST);
+	int ret = async_req_0_0(exch, WINDOW_CLOSE_REQUEST);
 	async_exchange_end(exch);
 
Index: uspace/lib/c/generic/ipc.c
===================================================================
--- uspace/lib/c/generic/ipc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/ipc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -93,5 +93,5 @@
  * @param call     Structure returned by ipc_prepare_async().
  */
-static inline void ipc_finish_async(errno_t rc, async_call_t *call)
+static inline void ipc_finish_async(int rc, async_call_t *call)
 {
 	if (!call) {
@@ -136,5 +136,5 @@
 		return;
 	
-	errno_t rc = (errno_t) __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phandle, imethod, arg1,
+	int rc = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phandle, imethod, arg1,
 	    arg2, arg3, (sysarg_t) call);
 	
@@ -175,5 +175,5 @@
 	IPC_SET_ARG5(call->msg.data, arg5);
 	
-	errno_t rc = (errno_t) __SYSCALL3(SYS_IPC_CALL_ASYNC_SLOW, phandle,
+	int rc = __SYSCALL3(SYS_IPC_CALL_ASYNC_SLOW, phandle,
 	    (sysarg_t) &call->msg.data, (sysarg_t) call);
 	
@@ -197,8 +197,8 @@
  *
  */
-errno_t ipc_answer_fast(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
+sysarg_t ipc_answer_fast(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1,
     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
 {
-	return (errno_t) __SYSCALL6(SYS_IPC_ANSWER_FAST, chandle, (sysarg_t) retval, arg1, arg2,
+	return __SYSCALL6(SYS_IPC_ANSWER_FAST, chandle, retval, arg1, arg2,
 	    arg3, arg4);
 }
@@ -218,5 +218,5 @@
  *
  */
-errno_t ipc_answer_slow(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
+sysarg_t ipc_answer_slow(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1,
     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
 {
@@ -230,5 +230,5 @@
 	IPC_SET_ARG5(data, arg5);
 	
-	return (errno_t) __SYSCALL2(SYS_IPC_ANSWER_SLOW, chandle, (sysarg_t) &data);
+	return __SYSCALL2(SYS_IPC_ANSWER_SLOW, chandle, (sysarg_t) &data);
 }
 
@@ -254,19 +254,18 @@
  * @param usec   Timeout in microseconds
  * @param flags  Flags passed to SYS_IPC_WAIT (blocking, nonblocking).
- * @param[out] out_handle  Call handle.
- *
- * @return  Error code.
- */
-errno_t ipc_wait_cycle(ipc_call_t *call, sysarg_t usec, unsigned int flags)
-{
-	errno_t rc = (errno_t) __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, usec, flags);
+ *
+ * @return  Call handle.
+ * @return  Negative error code.
+ */
+cap_handle_t ipc_wait_cycle(ipc_call_t *call, sysarg_t usec, unsigned int flags)
+{
+	cap_handle_t chandle =
+	    __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, usec, flags);
 	
 	/* Handle received answers */
-	if ((rc == EOK) && (call->cap_handle == CAP_NIL) &&
-	    (call->flags & IPC_CALL_ANSWERED)) {
+	if ((chandle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED))
 		handle_answer(call);
-	}
-	
-	return rc;
+	
+	return chandle;
 }
 
@@ -286,16 +285,17 @@
  * @param usec  Timeout in microseconds
  *
- * @return  Error code.
- *
- */
-errno_t ipc_wait_for_call_timeout(ipc_call_t *call, sysarg_t usec)
-{
-	errno_t rc;
+ * @return  Call handle.
+ * @return  Negative error code.
+ *
+ */
+cap_handle_t ipc_wait_for_call_timeout(ipc_call_t *call, sysarg_t usec)
+{
+	cap_handle_t chandle;
 	
 	do {
-		rc = ipc_wait_cycle(call, usec, SYNCH_FLAGS_NONE);
-	} while ((rc == EOK) && (call->cap_handle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED));
-	
-	return rc;
+		chandle = ipc_wait_cycle(call, usec, SYNCH_FLAGS_NONE);
+	} while ((chandle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED));
+	
+	return chandle;
 }
 
@@ -306,17 +306,18 @@
  * @param call  Incoming call storage.
  *
- * @return  Error code.
- *
- */
-errno_t ipc_trywait_for_call(ipc_call_t *call)
-{
-	errno_t rc;
+ * @return  Call handle.
+ * @return  Negative error code.
+ *
+ */
+cap_handle_t ipc_trywait_for_call(ipc_call_t *call)
+{
+	cap_handle_t chandle;
 	
 	do {
-		rc = ipc_wait_cycle(call, SYNCH_NO_TIMEOUT,
+		chandle = ipc_wait_cycle(call, SYNCH_NO_TIMEOUT,
 		    SYNCH_FLAGS_NON_BLOCKING);
-	} while ((rc == EOK) && (call->cap_handle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED));
-	
-	return rc;
+	} while ((chandle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED));
+	
+	return chandle;
 }
 
@@ -325,10 +326,10 @@
  * @param phandle  Handle of the phone to be hung up.
  *
- * @return  Zero on success or an error code.
- *
- */
-errno_t ipc_hangup(cap_handle_t phandle)
-{
-	return (errno_t) __SYSCALL1(SYS_IPC_HANGUP, phandle);
+ * @return  Zero on success or a negative error code.
+ *
+ */
+int ipc_hangup(cap_handle_t phandle)
+{
+	return __SYSCALL1(SYS_IPC_HANGUP, phandle);
 }
 
@@ -350,12 +351,12 @@
  *
  */
-errno_t ipc_forward_fast(cap_handle_t chandle, cap_handle_t phandle,
+int ipc_forward_fast(cap_handle_t chandle, cap_handle_t phandle,
     sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
 {
-	return (errno_t) __SYSCALL6(SYS_IPC_FORWARD_FAST, chandle, phandle, imethod, arg1,
+	return __SYSCALL6(SYS_IPC_FORWARD_FAST, chandle, phandle, imethod, arg1,
 	    arg2, mode);
 }
 
-errno_t ipc_forward_slow(cap_handle_t chandle, cap_handle_t phandle,
+int ipc_forward_slow(cap_handle_t chandle, cap_handle_t phandle,
     sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
     sysarg_t arg4, sysarg_t arg5, unsigned int mode)
@@ -370,5 +371,5 @@
 	IPC_SET_ARG5(data, arg5);
 	
-	return (errno_t) __SYSCALL4(SYS_IPC_FORWARD_SLOW, chandle, phandle,
+	return __SYSCALL4(SYS_IPC_FORWARD_SLOW, chandle, phandle,
 	    (sysarg_t) &data, mode);
 }
@@ -377,7 +378,14 @@
  *
  */
-errno_t ipc_connect_kbox(task_id_t id, cap_handle_t *phone)
-{
-	return (errno_t) __SYSCALL2(SYS_IPC_CONNECT_KBOX, (sysarg_t) &id, (sysarg_t) phone);
+int ipc_connect_kbox(task_id_t id)
+{
+#ifdef __32_BITS__
+	sysarg64_t arg = (sysarg64_t) id;
+	return __SYSCALL1(SYS_IPC_CONNECT_KBOX, (sysarg_t) &arg);
+#endif
+	
+#ifdef __64_BITS__
+	return __SYSCALL1(SYS_IPC_CONNECT_KBOX, (sysarg_t) id);
+#endif
 }
 
Index: uspace/lib/c/generic/iplink.c
===================================================================
--- uspace/lib/c/generic/iplink.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/iplink.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 static void iplink_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
 
-errno_t iplink_open(async_sess_t *sess, iplink_ev_ops_t *ev_ops, void *arg,
+int iplink_open(async_sess_t *sess, iplink_ev_ops_t *ev_ops, void *arg,
     iplink_t **riplink)
 {
@@ -61,5 +61,5 @@
 
 	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_IPLINK_CB, 0, 0,
+	int rc = async_create_callback_port(exch, INTERFACE_IPLINK_CB, 0, 0,
 	    iplink_cb_conn, iplink, &port);
 	
@@ -85,5 +85,5 @@
 }
 
-errno_t iplink_send(iplink_t *iplink, iplink_sdu_t *sdu)
+int iplink_send(iplink_t *iplink, iplink_sdu_t *sdu)
 {
 	async_exch_t *exch = async_exchange_begin(iplink->sess);
@@ -93,20 +93,20 @@
 	    (sysarg_t) sdu->dest, &answer);
 	
-	errno_t rc = async_data_write_start(exch, sdu->data, sdu->size);
-	
-	async_exchange_end(exch);
-	
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-	
-	errno_t retval;
-	async_wait_for(req, &retval);
-	
-	return retval;
-}
-
-errno_t iplink_send6(iplink_t *iplink, iplink_sdu6_t *sdu)
+	int rc = async_data_write_start(exch, sdu->data, sdu->size);
+	
+	async_exchange_end(exch);
+	
+	if (rc != EOK) {
+		async_forget(req);
+		return rc;
+	}
+	
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	
+	return (int) retval;
+}
+
+int iplink_send6(iplink_t *iplink, iplink_sdu6_t *sdu)
 {
 	async_exch_t *exch = async_exchange_begin(iplink->sess);
@@ -115,5 +115,5 @@
 	aid_t req = async_send_0(exch, IPLINK_SEND6, &answer);
 	
-	errno_t rc = async_data_write_start(exch, &sdu->dest, sizeof(addr48_t));
+	int rc = async_data_write_start(exch, &sdu->dest, sizeof(addr48_t));
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -131,16 +131,16 @@
 	}
 	
-	errno_t retval;
-	async_wait_for(req, &retval);
-	
-	return retval;
-}
-
-errno_t iplink_get_mtu(iplink_t *iplink, size_t *rmtu)
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	
+	return (int) retval;
+}
+
+int iplink_get_mtu(iplink_t *iplink, size_t *rmtu)
 {
 	async_exch_t *exch = async_exchange_begin(iplink->sess);
 	
 	sysarg_t mtu;
-	errno_t rc = async_req_0_1(exch, IPLINK_GET_MTU, &mtu);
+	int rc = async_req_0_1(exch, IPLINK_GET_MTU, &mtu);
 	
 	async_exchange_end(exch);
@@ -153,5 +153,5 @@
 }
 
-errno_t iplink_get_mac48(iplink_t *iplink, addr48_t *mac)
+int iplink_get_mac48(iplink_t *iplink, addr48_t *mac)
 {
 	async_exch_t *exch = async_exchange_begin(iplink->sess);
@@ -160,5 +160,5 @@
 	aid_t req = async_send_0(exch, IPLINK_GET_MAC48, &answer);
 	
-	errno_t rc = async_data_read_start(exch, mac, sizeof(addr48_t));
+	int rc = async_data_read_start(exch, mac, sizeof(addr48_t));
 	
 	loc_exchange_end(exch);
@@ -169,11 +169,11 @@
 	}
 	
-	errno_t retval;
-	async_wait_for(req, &retval);
-	
-	return retval;
-}
-
-errno_t iplink_set_mac48(iplink_t *iplink, addr48_t mac)
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	
+	return (int) retval;
+}
+
+int iplink_set_mac48(iplink_t *iplink, addr48_t mac)
 {
 	async_exch_t *exch = async_exchange_begin(iplink->sess);
@@ -182,5 +182,5 @@
 	aid_t req = async_send_0(exch, IPLINK_GET_MAC48, &answer);
 	
-	errno_t rc = async_data_read_start(exch, mac, sizeof(addr48_t));
+	int rc = async_data_read_start(exch, mac, sizeof(addr48_t));
 	
 	loc_exchange_end(exch);
@@ -191,12 +191,12 @@
 	}
 	
-	errno_t retval;
-	async_wait_for(req, &retval);
-	
-	return retval;
-}
-
-
-errno_t iplink_addr_add(iplink_t *iplink, inet_addr_t *addr)
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	
+	return (int) retval;
+}
+
+
+int iplink_addr_add(iplink_t *iplink, inet_addr_t *addr)
 {
 	async_exch_t *exch = async_exchange_begin(iplink->sess);
@@ -205,19 +205,19 @@
 	aid_t req = async_send_0(exch, IPLINK_ADDR_ADD, &answer);
 	
-	errno_t rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
-	async_exchange_end(exch);
-	
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-	
-	errno_t retval;
-	async_wait_for(req, &retval);
-	
-	return retval;
-}
-
-errno_t iplink_addr_remove(iplink_t *iplink, inet_addr_t *addr)
+	int rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
+	async_exchange_end(exch);
+	
+	if (rc != EOK) {
+		async_forget(req);
+		return rc;
+	}
+	
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	
+	return (int) retval;
+}
+
+int iplink_addr_remove(iplink_t *iplink, inet_addr_t *addr)
 {
 	async_exch_t *exch = async_exchange_begin(iplink->sess);
@@ -226,16 +226,16 @@
 	aid_t req = async_send_0(exch, IPLINK_ADDR_REMOVE, &answer);
 	
-	errno_t rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
-	async_exchange_end(exch);
-	
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-	
-	errno_t retval;
-	async_wait_for(req, &retval);
-	
-	return retval;
+	int rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
+	async_exchange_end(exch);
+	
+	if (rc != EOK) {
+		async_forget(req);
+		return rc;
+	}
+	
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	
+	return (int) retval;
 }
 
@@ -252,5 +252,5 @@
 	ip_ver_t ver = IPC_GET_ARG1(*icall);
 	
-	errno_t rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
+	int rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
 	    &sdu.size);
 	if (rc != EOK) {
@@ -270,5 +270,5 @@
 	size_t size;
 	
-	errno_t rc = async_data_write_accept((void **)&addr, false,
+	int rc = async_data_write_accept((void **)&addr, false,
 	    sizeof(addr48_t), sizeof(addr48_t), 0, &size);
 	if (rc != EOK) {
Index: uspace/lib/c/generic/iplink_srv.c
===================================================================
--- uspace/lib/c/generic/iplink_srv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/iplink_srv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
 {
 	size_t mtu;
-	errno_t rc = srv->ops->get_mtu(srv, &mtu);
+	int rc = srv->ops->get_mtu(srv, &mtu);
 	async_answer_1(callid, rc, mtu);
 }
@@ -54,5 +54,5 @@
 {
 	addr48_t mac;
-	errno_t rc = srv->ops->get_mac48(srv, &mac);
+	int rc = srv->ops->get_mac48(srv, &mac);
 	if (rc != EOK) {
 		async_answer_0(iid, rc);
@@ -78,5 +78,5 @@
 		async_answer_0(callid, rc);
 	
-	async_answer_0(iid, rc);
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -84,28 +84,57 @@
     ipc_call_t *icall)
 {
-	errno_t rc;
+	int rc;
 	size_t size;
 	addr48_t mac;
 	ipc_callid_t callid;
 
+	rc = async_data_write_receive(&callid, &size);
+	if (rc != EOK) {
+		async_answer_0(callid, (sysarg_t) rc);
+		async_answer_0(iid, (sysarg_t) rc);
+	}
+
+	rc = srv->ops->set_mac48(srv, &mac);
+	if (rc != EOK) {
+		async_answer_0(iid, rc);
+		return;
+	}
+	
+	rc = async_data_read_finalize(callid, &mac, sizeof(addr48_t));
+	if (rc != EOK)
+		async_answer_0(callid, rc);
+	
+	async_answer_0(iid, (sysarg_t) rc);
+}
+
+static void iplink_addr_add_srv(iplink_srv_t *srv, ipc_callid_t iid,
+    ipc_call_t *icall)
+{
+	ipc_callid_t callid;
+	size_t size;
 	if (!async_data_write_receive(&callid, &size)) {
 		async_answer_0(callid, EREFUSED);
 		async_answer_0(iid, EREFUSED);
-	}
-
-	rc = srv->ops->set_mac48(srv, &mac);
-	if (rc != EOK) {
-		async_answer_0(iid, rc);
-		return;
-	}
-	
-	rc = async_data_read_finalize(callid, &mac, sizeof(addr48_t));
-	if (rc != EOK)
-		async_answer_0(callid, rc);
-	
-	async_answer_0(iid, rc);
-}
-
-static void iplink_addr_add_srv(iplink_srv_t *srv, ipc_callid_t iid,
+		return;
+	}
+	
+	if (size != sizeof(inet_addr_t)) {
+		async_answer_0(callid, EINVAL);
+		async_answer_0(iid, EINVAL);
+		return;
+	}
+	
+	inet_addr_t addr;
+	int rc = async_data_write_finalize(callid, &addr, size);
+	if (rc != EOK) {
+		async_answer_0(callid, (sysarg_t) rc);
+		async_answer_0(iid, (sysarg_t) rc);
+	}
+	
+	rc = srv->ops->addr_add(srv, &addr);
+	async_answer_0(iid, (sysarg_t) rc);
+}
+
+static void iplink_addr_remove_srv(iplink_srv_t *srv, ipc_callid_t iid,
     ipc_call_t *icall)
 {
@@ -125,17 +154,39 @@
 	
 	inet_addr_t addr;
-	errno_t rc = async_data_write_finalize(callid, &addr, size);
-	if (rc != EOK) {
-		async_answer_0(callid, rc);
+	int rc = async_data_write_finalize(callid, &addr, size);
+	if (rc != EOK) {
+		async_answer_0(callid, (sysarg_t) rc);
+		async_answer_0(iid, (sysarg_t) rc);
+	}
+	
+	rc = srv->ops->addr_remove(srv, &addr);
+	async_answer_0(iid, (sysarg_t) rc);
+}
+
+static void iplink_send_srv(iplink_srv_t *srv, ipc_callid_t iid,
+    ipc_call_t *icall)
+{
+	iplink_sdu_t sdu;
+	
+	sdu.src = IPC_GET_ARG1(*icall);
+	sdu.dest = IPC_GET_ARG2(*icall);
+	
+	int rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
+	    &sdu.size);
+	if (rc != EOK) {
 		async_answer_0(iid, rc);
-	}
-	
-	rc = srv->ops->addr_add(srv, &addr);
+		return;
+	}
+	
+	rc = srv->ops->send(srv, &sdu);
+	free(sdu.data);
 	async_answer_0(iid, rc);
 }
 
-static void iplink_addr_remove_srv(iplink_srv_t *srv, ipc_callid_t iid,
-    ipc_call_t *icall)
-{
+static void iplink_send6_srv(iplink_srv_t *srv, ipc_callid_t iid,
+    ipc_call_t *icall)
+{
+	iplink_sdu6_t sdu;
+	
 	ipc_callid_t callid;
 	size_t size;
@@ -146,54 +197,4 @@
 	}
 	
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(callid, EINVAL);
-		async_answer_0(iid, EINVAL);
-		return;
-	}
-	
-	inet_addr_t addr;
-	errno_t rc = async_data_write_finalize(callid, &addr, size);
-	if (rc != EOK) {
-		async_answer_0(callid, rc);
-		async_answer_0(iid, rc);
-	}
-	
-	rc = srv->ops->addr_remove(srv, &addr);
-	async_answer_0(iid, rc);
-}
-
-static void iplink_send_srv(iplink_srv_t *srv, ipc_callid_t iid,
-    ipc_call_t *icall)
-{
-	iplink_sdu_t sdu;
-	
-	sdu.src = IPC_GET_ARG1(*icall);
-	sdu.dest = IPC_GET_ARG2(*icall);
-	
-	errno_t rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
-	    &sdu.size);
-	if (rc != EOK) {
-		async_answer_0(iid, rc);
-		return;
-	}
-	
-	rc = srv->ops->send(srv, &sdu);
-	free(sdu.data);
-	async_answer_0(iid, rc);
-}
-
-static void iplink_send6_srv(iplink_srv_t *srv, ipc_callid_t iid,
-    ipc_call_t *icall)
-{
-	iplink_sdu6_t sdu;
-	
-	ipc_callid_t callid;
-	size_t size;
-	if (!async_data_write_receive(&callid, &size)) {
-		async_answer_0(callid, EREFUSED);
-		async_answer_0(iid, EREFUSED);
-		return;
-	}
-	
 	if (size != sizeof(addr48_t)) {
 		async_answer_0(callid, EINVAL);
@@ -202,8 +203,8 @@
 	}
 	
-	errno_t rc = async_data_write_finalize(callid, &sdu.dest, size);
-	if (rc != EOK) {
-		async_answer_0(callid, rc);
-		async_answer_0(iid, rc);
+	int rc = async_data_write_finalize(callid, &sdu.dest, size);
+	if (rc != EOK) {
+		async_answer_0(callid, (sysarg_t) rc);
+		async_answer_0(iid, (sysarg_t) rc);
 	}
 	
@@ -229,8 +230,8 @@
 }
 
-errno_t iplink_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
+int iplink_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
 {
 	iplink_srv_t *srv = (iplink_srv_t *) arg;
-	errno_t rc;
+	int rc;
 	
 	fibril_mutex_lock(&srv->lock);
@@ -302,5 +303,5 @@
 
 /* XXX Version should be part of @a sdu */
-errno_t iplink_ev_recv(iplink_srv_t *srv, iplink_recv_sdu_t *sdu, ip_ver_t ver)
+int iplink_ev_recv(iplink_srv_t *srv, iplink_recv_sdu_t *sdu, ip_ver_t ver)
 {
 	if (srv->client_sess == NULL)
@@ -313,5 +314,5 @@
 	    &answer);
 	
-	errno_t rc = async_data_write_start(exch, sdu->data, sdu->size);
+	int rc = async_data_write_start(exch, sdu->data, sdu->size);
 	async_exchange_end(exch);
 	
@@ -321,5 +322,5 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	if (retval != EOK)
@@ -329,5 +330,5 @@
 }
 
-errno_t iplink_ev_change_addr(iplink_srv_t *srv, addr48_t *addr)
+int iplink_ev_change_addr(iplink_srv_t *srv, addr48_t *addr)
 {
 	if (srv->client_sess == NULL)
@@ -339,5 +340,5 @@
 	aid_t req = async_send_0(exch, IPLINK_EV_CHANGE_ADDR, &answer);
 	
-	errno_t rc = async_data_write_start(exch, addr, sizeof(addr48_t));
+	int rc = async_data_write_start(exch, addr, sizeof(addr48_t));
 	async_exchange_end(exch);
 	
@@ -347,5 +348,5 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	if (retval != EOK)
Index: uspace/lib/c/generic/irc.c
===================================================================
--- uspace/lib/c/generic/irc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/irc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,10 +49,10 @@
  * @return	EOK on success, EIO on failure
  */
-static errno_t irc_init(void)
+static int irc_init(void)
 {
 	category_id_t irc_cat;
 	service_id_t *svcs;
 	size_t count;
-	errno_t rc;
+	int rc;
 
 	assert(irc_sess == NULL);
@@ -91,7 +91,7 @@
  * @param irq	IRQ number
  */
-errno_t irc_enable_interrupt(int irq)
+int irc_enable_interrupt(int irq)
 {
-	errno_t rc;
+	int rc;
 
 	if (irc_sess == NULL) {
@@ -114,7 +114,7 @@
  * @param irq	IRQ number
  */
-errno_t irc_disable_interrupt(int irq)
+int irc_disable_interrupt(int irq)
 {
-	errno_t rc;
+	int rc;
 
 	if (irc_sess == NULL) {
@@ -138,7 +138,7 @@
  * @param irq	IRQ number
  */
-errno_t irc_clear_interrupt(int irq)
+int irc_clear_interrupt(int irq)
 {
-	errno_t rc;
+	int rc;
 
 	if (irc_sess == NULL) {
Index: uspace/lib/c/generic/irq.c
===================================================================
--- uspace/lib/c/generic/irq.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/irq.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,17 +58,14 @@
  * @param ucode  Top-half pseudocode handler.
  *
- * @param[out] out_handle  IRQ capability handle returned by the kernel.
- *
+ * @return IRQ capability handle returned by the kernel.
  * @return Error code returned by the kernel.
  *
  */
-errno_t ipc_irq_subscribe(int inr, sysarg_t method, const irq_code_t *ucode,
-    cap_handle_t *out_handle)
+int ipc_irq_subscribe(int inr, sysarg_t method, const irq_code_t *ucode)
 {
 	if (ucode == NULL)
 		ucode = &default_ucode;
 	
-	return (errno_t) __SYSCALL4(SYS_IPC_IRQ_SUBSCRIBE, inr, method, (sysarg_t) ucode,
-	    (sysarg_t) out_handle);
+	return __SYSCALL3(SYS_IPC_IRQ_SUBSCRIBE, inr, method, (sysarg_t) ucode);
 }
 
@@ -80,7 +77,7 @@
  *
  */
-errno_t ipc_irq_unsubscribe(cap_handle_t cap)
+int ipc_irq_unsubscribe(int cap)
 {
-	return (errno_t) __SYSCALL1(SYS_IPC_IRQ_UNSUBSCRIBE, cap);
+	return __SYSCALL1(SYS_IPC_IRQ_UNSUBSCRIBE, cap);
 }
 
Index: uspace/lib/c/generic/loader.c
===================================================================
--- uspace/lib/c/generic/loader.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/loader.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,9 +52,11 @@
  * @param name Symbolic name to set on the newly created task.
  *
- * @return Error code.
- */
-errno_t loader_spawn(const char *name)
-{
-	return (errno_t) __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER,
+ * @return Pointer to the loader connection structure (should be
+ *         deallocated using free() after use).
+ *
+ */
+int loader_spawn(const char *name)
+{
+	return __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER,
 	    (sysarg_t) name, str_size(name));
 }
@@ -84,8 +86,8 @@
  * @param task_id Points to a variable where the ID should be stored.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_get_task_id(loader_t *ldr, task_id_t *task_id)
+ * @return Zero on success or negative error code.
+ *
+ */
+int loader_get_task_id(loader_t *ldr, task_id_t *task_id)
 {
 	/* Get task ID. */
@@ -94,5 +96,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, LOADER_GET_TASKID, &answer);
-	errno_t rc = async_data_read_start(exch, task_id, sizeof(task_id_t));
+	sysarg_t rc = async_data_read_start(exch, task_id, sizeof(task_id_t));
 	
 	async_exchange_end(exch);
@@ -100,9 +102,9 @@
 	if (rc != EOK) {
 		async_forget(req);
-		return (errno_t) rc;
+		return (int) rc;
 	}
 	
 	async_wait_for(req, &rc);
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -113,8 +115,8 @@
  * @param ldr  Loader connection structure.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_set_cwd(loader_t *ldr)
+ * @return Zero on success or negative error code.
+ *
+ */
+int loader_set_cwd(loader_t *ldr)
 {
 	char *cwd = (char *) malloc(MAX_PATH_LEN + 1);
@@ -131,5 +133,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, LOADER_SET_CWD, &answer);
-	errno_t rc = async_data_write_start(exch, cwd, len);
+	sysarg_t rc = async_data_write_start(exch, cwd, len);
 	
 	async_exchange_end(exch);
@@ -138,9 +140,9 @@
 	if (rc != EOK) {
 		async_forget(req);
-		return (errno_t) rc;
+		return (int) rc;
 	}
 	
 	async_wait_for(req, &rc);
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -151,8 +153,8 @@
  * @param file Program file.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_set_program(loader_t *ldr, const char *name, int file)
+ * @return Zero on success or negative error code.
+ *
+ */
+int loader_set_program(loader_t *ldr, const char *name, int file)
 {
 	async_exch_t *exch = async_exchange_begin(ldr->sess);
@@ -161,5 +163,5 @@
 	aid_t req = async_send_0(exch, LOADER_SET_PROGRAM, &answer);
 
-	errno_t rc = async_data_write_start(exch, name, str_size(name) + 1);
+	sysarg_t rc = async_data_write_start(exch, name, str_size(name) + 1);
 	if (rc == EOK) {
 		async_exch_t *vfs_exch = vfs_exchange_begin();
@@ -172,9 +174,9 @@
 	if (rc != EOK) {
 		async_forget(req);
-		return (errno_t) rc;
+		return (int) rc;
 	}
 
 	async_wait_for(req, &rc);
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -184,8 +186,8 @@
  * @param path Program path.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_set_program_path(loader_t *ldr, const char *path)
+ * @return Zero on success or negative error code.
+ *
+ */
+int loader_set_program_path(loader_t *ldr, const char *path)
 {
 	const char *name = str_rchr(path, '/');
@@ -196,11 +198,10 @@
 	}
 	
-	int fd;
-	errno_t rc = vfs_lookup(path, 0, &fd);
-	if (rc != EOK) {
-		return rc;
-	}
-	
-	rc = loader_set_program(ldr, name, fd);
+	int fd = vfs_lookup(path, 0);
+	if (fd < 0) {
+		return fd;
+	}
+	
+	int rc = loader_set_program(ldr, name, fd);
 	vfs_put(fd);
 	return rc;
@@ -217,8 +218,8 @@
  * @param argv NULL-terminated array of pointers to arguments.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_set_args(loader_t *ldr, const char *const argv[])
+ * @return Zero on success or negative error code.
+ *
+ */
+int loader_set_args(loader_t *ldr, const char *const argv[])
 {
 	/*
@@ -252,5 +253,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, LOADER_SET_ARGS, &answer);
-	errno_t rc = async_data_write_start(exch, (void *) arg_buf,
+	sysarg_t rc = async_data_write_start(exch, (void *) arg_buf,
 	    buffer_size);
 	
@@ -260,9 +261,9 @@
 	if (rc != EOK) {
 		async_forget(req);
-		return (errno_t) rc;
+		return (int) rc;
 	}
 	
 	async_wait_for(req, &rc);
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -273,8 +274,8 @@
  * @param file       The file's descriptor.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_add_inbox(loader_t *ldr, const char *name, int file)
+ * @return Zero on success or negative error code.
+ *
+ */
+int loader_add_inbox(loader_t *ldr, const char *name, int file)
 {
 	async_exch_t *exch = async_exchange_begin(ldr->sess);
@@ -283,5 +284,5 @@
 	aid_t req = async_send_0(exch, LOADER_ADD_INBOX, NULL);
 	
-	errno_t rc = async_data_write_start(exch, name, str_size(name) + 1);
+	sysarg_t rc = async_data_write_start(exch, name, str_size(name) + 1);
 	if (rc == EOK) {
 		rc = vfs_pass_handle(vfs_exch, file, exch);
@@ -297,5 +298,5 @@
 	}
 	
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -307,11 +308,11 @@
  * @param ldr Loader connection structure.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_load_program(loader_t *ldr)
-{
-	async_exch_t *exch = async_exchange_begin(ldr->sess);
-	errno_t rc = async_req_0_0(exch, LOADER_LOAD);
+ * @return Zero on success or negative error code.
+ *
+ */
+int loader_load_program(loader_t *ldr)
+{
+	async_exch_t *exch = async_exchange_begin(ldr->sess);
+	int rc = async_req_0_0(exch, LOADER_LOAD);
 	async_exchange_end(exch);
 	
@@ -330,11 +331,11 @@
  * @param ldr Loader connection structure.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_run(loader_t *ldr)
-{
-	async_exch_t *exch = async_exchange_begin(ldr->sess);
-	errno_t rc = async_req_0_0(exch, LOADER_RUN);
+ * @return Zero on success or negative error code.
+ *
+ */
+int loader_run(loader_t *ldr)
+{
+	async_exch_t *exch = async_exchange_begin(ldr->sess);
+	int rc = async_req_0_0(exch, LOADER_RUN);
 	async_exchange_end(exch);
 	
@@ -356,5 +357,5 @@
  * @param ldr Loader connection structure.
  *
- * @return Zero on success or an error code.
+ * @return Zero on success or negative error code.
  *
  */
Index: uspace/lib/c/generic/loc.c
===================================================================
--- uspace/lib/c/generic/loc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/loc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -103,5 +103,5 @@
  *
  */
-static errno_t loc_callback_create(void)
+static int loc_callback_create(void)
 {
 	if (!loc_callback_created) {
@@ -113,5 +113,5 @@
 		
 		port_id_t port;
-		errno_t rc = async_create_callback_port(exch, INTERFACE_LOC_CB, 0, 0,
+		int rc = async_create_callback_port(exch, INTERFACE_LOC_CB, 0, 0,
 		    loc_cb_conn, NULL, &port);
 		
@@ -121,5 +121,5 @@
 			return rc;
 		
-		errno_t retval;
+		sysarg_t retval;
 		async_wait_for(req, &retval);
 		if (retval != EOK)
@@ -239,5 +239,5 @@
 
 /** Register new driver with loc. */
-errno_t loc_server_register(const char *name)
+int loc_server_register(const char *name)
 {
 	async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
@@ -245,5 +245,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_2(exch, LOC_SERVER_REGISTER, 0, 0, &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
+	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
 	
 	if (retval != EOK) {
@@ -272,5 +272,5 @@
  *
  */
-errno_t loc_service_register(const char *fqsn, service_id_t *sid)
+int loc_service_register(const char *fqsn, service_id_t *sid)
 {
 	async_exch_t *exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
@@ -278,5 +278,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, LOC_SERVICE_REGISTER, &answer);
-	errno_t retval = async_data_write_start(exch, fqsn, str_size(fqsn));
+	sysarg_t retval = async_data_write_start(exch, fqsn, str_size(fqsn));
 	
 	if (retval != EOK) {
@@ -311,8 +311,8 @@
  * @param sid	Service ID
  */
-errno_t loc_service_unregister(service_id_t sid)
+int loc_service_unregister(service_id_t sid)
 {
 	async_exch_t *exch;
-	errno_t retval;
+	sysarg_t retval;
 	
 	exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
@@ -320,8 +320,8 @@
 	loc_exchange_end(exch);
 	
-	return (errno_t)retval;
-}
-
-errno_t loc_service_get_id(const char *fqdn, service_id_t *handle,
+	return (int)retval;
+}
+
+int loc_service_get_id(const char *fqdn, service_id_t *handle,
     unsigned int flags)
 {
@@ -339,5 +339,5 @@
 	aid_t req = async_send_2(exch, LOC_SERVICE_GET_ID, flags, 0,
 	    &answer);
-	errno_t retval = async_data_write_start(exch, fqdn, str_size(fqdn));
+	sysarg_t retval = async_data_write_start(exch, fqdn, str_size(fqdn));
 	
 	loc_exchange_end(exch);
@@ -371,7 +371,7 @@
  * @param name		Place to store pointer to new string. Caller should
  *			free it using free().
- * @return		EOK on success or an error code
- */
-static errno_t loc_get_name_internal(sysarg_t method, sysarg_t id, char **name)
+ * @return		EOK on success or negative error code
+ */
+static int loc_get_name_internal(sysarg_t method, sysarg_t id, char **name)
 {
 	async_exch_t *exch;
@@ -379,5 +379,5 @@
 	ipc_call_t dreply;
 	size_t act_size;
-	errno_t dretval;
+	sysarg_t dretval;
 	
 	*name = NULL;
@@ -397,5 +397,5 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
@@ -421,7 +421,7 @@
  * @param name		Place to store pointer to new string. Caller should
  *			free it using free().
- * @return		EOK on success or an error code
- */
-errno_t loc_category_get_name(category_id_t cat_id, char **name)
+ * @return		EOK on success or negative error code
+ */
+int loc_category_get_name(category_id_t cat_id, char **name)
 {
 	return loc_get_name_internal(LOC_CATEGORY_GET_NAME, cat_id, name);
@@ -435,7 +435,7 @@
  * @param name		Place to store pointer to new string. Caller should
  *			free it using free().
- * @return		EOK on success or an error code
- */
-errno_t loc_service_get_name(service_id_t svc_id, char **name)
+ * @return		EOK on success or negative error code
+ */
+int loc_service_get_name(service_id_t svc_id, char **name)
 {
 	return loc_get_name_internal(LOC_SERVICE_GET_NAME, svc_id, name);
@@ -449,12 +449,12 @@
  * @param name		Place to store pointer to new string. Caller should
  *			free it using free().
- * @return		EOK on success or an error code
- */
-errno_t loc_service_get_server_name(service_id_t svc_id, char **name)
+ * @return		EOK on success or negative error code
+ */
+int loc_service_get_server_name(service_id_t svc_id, char **name)
 {
 	return loc_get_name_internal(LOC_SERVICE_GET_SERVER_NAME, svc_id, name);
 }
 
-errno_t loc_namespace_get_id(const char *name, service_id_t *handle,
+int loc_namespace_get_id(const char *name, service_id_t *handle,
     unsigned int flags)
 {
@@ -472,5 +472,5 @@
 	aid_t req = async_send_2(exch, LOC_NAMESPACE_GET_ID, flags, 0,
 	    &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
+	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
 	
 	loc_exchange_end(exch);
@@ -503,7 +503,7 @@
  * @param cat_id	Place to store ID
  * @param flags		IPC_FLAG_BLOCKING to wait for location service to start
- * @return		EOK on success or an error code
- */
-errno_t loc_category_get_id(const char *name, category_id_t *cat_id,
+ * @return		EOK on success or negative error code
+ */
+int loc_category_get_id(const char *name, category_id_t *cat_id,
     unsigned int flags)
 {
@@ -521,5 +521,5 @@
 	aid_t req = async_send_0(exch, LOC_CATEGORY_GET_ID,
 	    &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
+	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
 	
 	loc_exchange_end(exch);
@@ -551,5 +551,5 @@
 	
 	sysarg_t type;
-	errno_t retval = async_req_1_1(exch, LOC_ID_PROBE, handle, &type);
+	int retval = async_req_1_1(exch, LOC_ID_PROBE, handle, &type);
 	
 	loc_exchange_end(exch);
@@ -574,7 +574,4 @@
 }
 
-/**
- * @return ID of a new NULL device, or -1 if failed.
- */
 int loc_null_create(void)
 {
@@ -582,5 +579,5 @@
 	
 	sysarg_t null_id;
-	errno_t retval = async_req_0_1(exch, LOC_NULL_CREATE, &null_id);
+	int retval = async_req_0_1(exch, LOC_NULL_CREATE, &null_id);
 	
 	loc_exchange_end(exch);
@@ -602,5 +599,5 @@
 {
 	sysarg_t count;
-	errno_t retval = async_req_0_1(exch, LOC_GET_NAMESPACE_COUNT, &count);
+	int retval = async_req_0_1(exch, LOC_GET_NAMESPACE_COUNT, &count);
 	if (retval != EOK)
 		return 0;
@@ -613,10 +610,10 @@
  * @param svc_id	Service ID
  * @param cat_id	Category ID
- * @return		EOK on success or an error code
- */
-errno_t loc_service_add_to_cat(service_id_t svc_id, service_id_t cat_id)
+ * @return		EOK on success or negative error code
+ */
+int loc_service_add_to_cat(service_id_t svc_id, service_id_t cat_id)
 {
 	async_exch_t *exch;
-	errno_t retval;
+	sysarg_t retval;
 	
 	exch = loc_exchange_begin_blocking(INTERFACE_LOC_SUPPLIER);
@@ -631,5 +628,5 @@
 {
 	sysarg_t count;
-	errno_t retval = async_req_1_1(exch, LOC_GET_SERVICE_COUNT, ns_handle,
+	int retval = async_req_1_1(exch, LOC_GET_SERVICE_COUNT, ns_handle,
 	    &count);
 	if (retval != EOK)
@@ -676,5 +673,5 @@
 		ipc_call_t answer;
 		aid_t req = async_send_0(exch, LOC_GET_NAMESPACES, &answer);
-		errno_t rc = async_data_read_start(exch, devs, count * sizeof(loc_sdesc_t));
+		int rc = async_data_read_start(exch, devs, count * sizeof(loc_sdesc_t));
 		
 		loc_exchange_end(exch);
@@ -695,5 +692,5 @@
 		}
 		
-		errno_t retval;
+		sysarg_t retval;
 		async_wait_for(req, &retval);
 		
@@ -725,5 +722,5 @@
 		ipc_call_t answer;
 		aid_t req = async_send_1(exch, LOC_GET_SERVICES, ns_handle, &answer);
-		errno_t rc = async_data_read_start(exch, devs, count * sizeof(loc_sdesc_t));
+		int rc = async_data_read_start(exch, devs, count * sizeof(loc_sdesc_t));
 		
 		loc_exchange_end(exch);
@@ -744,5 +741,5 @@
 		}
 		
-		errno_t retval;
+		sysarg_t retval;
 		async_wait_for(req, &retval);
 		
@@ -755,5 +752,5 @@
 }
 
-static errno_t loc_category_get_ids_once(sysarg_t method, sysarg_t arg1,
+static int loc_category_get_ids_once(sysarg_t method, sysarg_t arg1,
     sysarg_t *id_buf, size_t buf_size, size_t *act_size)
 {
@@ -762,5 +759,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_1(exch, method, arg1, &answer);
-	errno_t rc = async_data_read_start(exch, id_buf, buf_size);
+	int rc = async_data_read_start(exch, id_buf, buf_size);
 	
 	loc_exchange_end(exch);
@@ -771,5 +768,5 @@
 	}
 	
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 	
@@ -790,7 +787,7 @@
  * @param data		Place to store pointer to array of IDs
  * @param count		Place to store number of IDs
- * @return 		EOK on success or an error code
- */
-static errno_t loc_get_ids_internal(sysarg_t method, sysarg_t arg1,
+ * @return 		EOK on success or negative error code
+ */
+static int loc_get_ids_internal(sysarg_t method, sysarg_t arg1,
     sysarg_t **data, size_t *count)
 {
@@ -799,5 +796,5 @@
 	
 	size_t act_size = 0;
-	errno_t rc = loc_category_get_ids_once(method, arg1, NULL, 0,
+	int rc = loc_category_get_ids_once(method, arg1, NULL, 0,
 	    &act_size);
 	if (rc != EOK)
@@ -836,7 +833,7 @@
  * @param data		Place to store pointer to array of IDs
  * @param count		Place to store number of IDs
- * @return 		EOK on success or an error code
- */
-errno_t loc_category_get_svcs(category_id_t cat_id, service_id_t **data,
+ * @return 		EOK on success or negative error code
+ */
+int loc_category_get_svcs(category_id_t cat_id, service_id_t **data,
     size_t *count)
 {
@@ -851,7 +848,7 @@
  * @param data		Place to store pointer to array of IDs
  * @param count		Place to store number of IDs
- * @return 		EOK on success or an error code
- */
-errno_t loc_get_categories(category_id_t **data, size_t *count)
+ * @return 		EOK on success or negative error code
+ */
+int loc_get_categories(category_id_t **data, size_t *count)
 {
 	return loc_get_ids_internal(LOC_GET_CATEGORIES, 0,
@@ -859,5 +856,5 @@
 }
 
-errno_t loc_register_cat_change_cb(loc_cat_change_cb_t cb_fun)
+int loc_register_cat_change_cb(loc_cat_change_cb_t cb_fun)
 {
 	fibril_mutex_lock(&loc_callback_mutex);
Index: uspace/lib/c/generic/malloc.c
===================================================================
--- uspace/lib/c/generic/malloc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/malloc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -196,5 +196,20 @@
 static futex_t malloc_futex = FUTEX_INITIALIZER;
 
-#define malloc_assert(expr) safe_assert(expr)
+#ifndef NDEBUG
+
+#define malloc_assert(expr) \
+	do { \
+		if (!(expr)) {\
+			heap_unlock(); \
+			assert_abort(#expr, __FILE__, __LINE__); \
+		} \
+	} while (0)
+
+#else /* NDEBUG */
+
+#define malloc_assert(expr)
+
+#endif /* NDEBUG */
+
 
 #ifdef FUTEX_UPGRADABLE
@@ -396,5 +411,5 @@
 	
 	/* Resize the address space area */
-	errno_t ret = as_area_resize(area->start, asize, 0);
+	int ret = as_area_resize(area->start, asize, 0);
 	if (ret != EOK)
 		return false;
@@ -489,5 +504,5 @@
 			
 			/* Resize the address space area */
-			errno_t ret = as_area_resize(area->start, asize, 0);
+			int ret = as_area_resize(area->start, asize, 0);
 			if (ret != EOK)
 				abort();
@@ -874,11 +889,6 @@
  *
  */
-void *realloc(void * const addr, const size_t size)
-{
-	if (size == 0) {
-		free(addr);
-		return NULL;
-	}
-
+void *realloc(const void *addr, const size_t size)
+{
 	if (addr == NULL)
 		return malloc(size);
@@ -988,5 +998,5 @@
  *
  */
-void free(void * const addr)
+void free(const void *addr)
 {
 	if (addr == NULL)
Index: uspace/lib/c/generic/ns.c
===================================================================
--- uspace/lib/c/generic/ns.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/ns.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,7 +46,7 @@
 static async_sess_t *sess_ns = NULL;
 
-errno_t service_register(service_t service)
+int service_register(service_t service)
 {
-	errno_t retval;
+	sysarg_t retval;
 	ipc_call_t answer;
 	
@@ -57,5 +57,5 @@
 	async_exch_t *exch = async_exchange_begin(sess);
 	aid_t req = async_send_1(exch, NS_REGISTER, service, &answer);
-	errno_t rc = async_connect_to_me(exch, 0, service, 0);
+	int rc = async_connect_to_me(exch, 0, service, 0);
 	
 	async_exchange_end(exch);
@@ -123,5 +123,5 @@
 
 
-errno_t ns_ping(void)
+int ns_ping(void)
 {
 	async_sess_t *sess = ns_session_get();
@@ -130,5 +130,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_0_0(exch, NS_PING);
+	int rc = async_req_0_0(exch, NS_PING);
 	async_exchange_end(exch);
 	
@@ -136,5 +136,5 @@
 }
 
-errno_t ns_intro(task_id_t id)
+int ns_intro(task_id_t id)
 {
 	async_exch_t *exch;
@@ -144,5 +144,5 @@
 	
 	exch = async_exchange_begin(sess);
-	errno_t rc = async_req_2_0(exch, NS_ID_INTRO, LOWER32(id), UPPER32(id));
+	int rc = async_req_2_0(exch, NS_ID_INTRO, LOWER32(id), UPPER32(id));
 	async_exchange_end(exch);
 	
Index: uspace/lib/c/generic/perm.c
===================================================================
--- uspace/lib/c/generic/perm.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/perm.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,13 +48,13 @@
  *
  */
-errno_t perm_grant(task_id_t id, unsigned int perms)
+int perm_grant(task_id_t id, unsigned int perms)
 {
 #ifdef __32_BITS__
 	sysarg64_t arg = (sysarg64_t) id;
-	return (errno_t) __SYSCALL2(SYS_PERM_GRANT, (sysarg_t) &arg, (sysarg_t) perms);
+	return __SYSCALL2(SYS_PERM_GRANT, (sysarg_t) &arg, (sysarg_t) perms);
 #endif
 	
 #ifdef __64_BITS__
-	return (errno_t) __SYSCALL2(SYS_PERM_GRANT, (sysarg_t) id, (sysarg_t) perms);
+	return __SYSCALL2(SYS_PERM_GRANT, (sysarg_t) id, (sysarg_t) perms);
 #endif
 }
@@ -68,13 +68,13 @@
  *
  */
-errno_t perm_revoke(task_id_t id, unsigned int perms)
+int perm_revoke(task_id_t id, unsigned int perms)
 {
 #ifdef __32_BITS__
 	sysarg64_t arg = (sysarg64_t) id;
-	return (errno_t) __SYSCALL2(SYS_PERM_REVOKE, (sysarg_t) &arg, (sysarg_t) perms);
+	return __SYSCALL2(SYS_PERM_REVOKE, (sysarg_t) &arg, (sysarg_t) perms);
 #endif
 	
 #ifdef __64_BITS__
-	return (errno_t) __SYSCALL2(SYS_PERM_REVOKE, (sysarg_t) id, (sysarg_t) perms);
+	return __SYSCALL2(SYS_PERM_REVOKE, (sysarg_t) id, (sysarg_t) perms);
 #endif
 }
Index: uspace/lib/c/generic/pio_trace.c
===================================================================
--- uspace/lib/c/generic/pio_trace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/pio_trace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -106,5 +106,5 @@
 }
 
-errno_t pio_trace_enable(void *base, size_t size, trace_fnc log, void *data)
+int pio_trace_enable(void *base, size_t size, trace_fnc log, void *data)
 {
 	pio_regions_t *regions = get_regions();
Index: uspace/lib/c/generic/private/async.h
===================================================================
--- uspace/lib/c/generic/private/async.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/private/async.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -85,5 +85,5 @@
 extern void __async_init(void);
 extern void async_insert_timeout(awaiter_t *);
-extern void reply_received(void *, errno_t, ipc_call_t *);
+extern void reply_received(void *, int, ipc_call_t *);
 
 #endif
Index: uspace/lib/c/generic/rtld/dynamic.c
===================================================================
--- uspace/lib/c/generic/rtld/dynamic.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/rtld/dynamic.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <stdio.h>
 #include <inttypes.h>
-#include <str.h>
 
 #include <rtld/elf_dyn.h>
Index: uspace/lib/c/generic/rtld/module.c
===================================================================
--- uspace/lib/c/generic/rtld/module.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/rtld/module.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 
 #include <rtld/rtld.h>
@@ -55,5 +54,5 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-errno_t module_create_static_exec(rtld_t *rtld, module_t **rmodule)
+int module_create_static_exec(rtld_t *rtld, module_t **rmodule)
 {
 	module_t *module;
Index: uspace/lib/c/generic/rtld/rtld.c
===================================================================
--- uspace/lib/c/generic/rtld/rtld.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/rtld/rtld.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,4 @@
 #include <rtld/rtld_debug.h>
 #include <stdlib.h>
-#include <str.h>
 
 rtld_t *runtime_env;
@@ -46,7 +45,7 @@
 
 /** Initialize the runtime linker for use in a statically-linked executable. */
-errno_t rtld_init_static(void)
-{
-	errno_t rc;
+int rtld_init_static(void)
+{
+	int rc;
 
 	runtime_env = &rt_env_static;
@@ -71,5 +70,5 @@
  * @return EOK on success or non-zero error code
  */
-errno_t rtld_prog_process(elf_finfo_t *p_info, rtld_t **rre)
+int rtld_prog_process(elf_finfo_t *p_info, rtld_t **rre)
 {
 	rtld_t *env;
Index: uspace/lib/c/generic/rtld/symbol.c
===================================================================
--- uspace/lib/c/generic/rtld/symbol.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/rtld/symbol.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 
 #include <elf/elf.h>
Index: uspace/lib/c/generic/smc.c
===================================================================
--- uspace/lib/c/generic/smc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/smc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,7 +37,7 @@
 #include <smc.h>
 
-errno_t smc_coherence(void *address, size_t size)
+int smc_coherence(void *address, size_t size)
 {
-	return (errno_t) __SYSCALL2(SYS_SMC_COHERENCE, (sysarg_t) address,
+	return __SYSCALL2(SYS_SMC_COHERENCE, (sysarg_t) address,
 	    (sysarg_t) size);
 }
Index: uspace/lib/c/generic/stacktrace.c
===================================================================
--- uspace/lib/c/generic/stacktrace.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/stacktrace.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include <errno.h>
 
-static errno_t stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data);
+static int stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data);
 
 static stacktrace_ops_t basic_ops = {
@@ -51,5 +51,5 @@
 	stacktrace_t st;
 	uintptr_t nfp;
-	errno_t rc;
+	int rc;
 
 	st.op_arg = arg;
@@ -86,5 +86,5 @@
 }
 
-static errno_t stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data)
+static int stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data)
 {
 	(void) arg;
Index: uspace/lib/c/generic/stdio.c
===================================================================
--- uspace/lib/c/generic/stdio.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/stdio.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 int rename(const char *old_path, const char *new_path)
 {
-	errno_t rc;
+	int rc;
 
 	rc = vfs_rename_path(old_path, new_path);
@@ -54,5 +54,5 @@
 int remove(const char *path)
 {
-	errno_t rc;
+	int rc;
 
 	rc = vfs_unlink_path(path);
Index: uspace/lib/c/generic/stdlib.c
===================================================================
--- uspace/lib/c/generic/stdlib.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/stdlib.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,12 +35,12 @@
 #include <stdlib.h>
 
-static int glbl_seed = 1;
+static long glbl_seed = 1;
 
-int rand(void)
+long int random(void)
 {
 	return glbl_seed = ((1366 * glbl_seed + 150889) % RAND_MAX);
 }
 
-void srand(unsigned int seed)
+void srandom(unsigned int seed)
 {
 	glbl_seed = seed % RAND_MAX;
Index: uspace/lib/c/generic/str.c
===================================================================
--- uspace/lib/c/generic/str.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/str.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -196,5 +196,5 @@
  *         code was invalid.
  */
-errno_t chr_encode(const wchar_t ch, char *str, size_t *offset, size_t size)
+int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t size)
 {
 	if (*offset >= size)
@@ -839,5 +839,5 @@
  *			non-ASCII bytes.
  */
-errno_t spascii_to_str(char *dest, size_t size, const uint8_t *src, size_t n)
+int spascii_to_str(char *dest, size_t size, const uint8_t *src, size_t n)
 {
 	size_t sidx;
@@ -845,6 +845,6 @@
 	size_t dlast;
 	uint8_t byte;
-	errno_t rc;
-	errno_t result;
+	int rc;
+	int result;
 
 	/* There must be space for a null terminator in the buffer. */
@@ -918,11 +918,11 @@
  * @param src	Source utf16 string.
  *
- * @return EOK, if success, an error code otherwise.
- */
-errno_t utf16_to_str(char *dest, size_t size, const uint16_t *src)
+ * @return EOK, if success, negative otherwise.
+ */
+int utf16_to_str(char *dest, size_t size, const uint16_t *src)
 {
 	size_t idx = 0, dest_off = 0;
 	wchar_t ch;
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	/* There must be space for a null terminator in the buffer. */
@@ -961,9 +961,9 @@
  * @param src	Source string.
  *
- * @return EOK, if success, an error code otherwise.
- */
-errno_t str_to_utf16(uint16_t *dest, size_t dlen, const char *src)
-{
-	errno_t rc = EOK;
+ * @return EOK, if success, negative otherwise.
+ */
+int str_to_utf16(uint16_t *dest, size_t dlen, const char *src)
+{
+	int rc = EOK;
 	size_t offset = 0;
 	size_t idx = 0;
@@ -1273,4 +1273,128 @@
 }
 
+/** Convert string to a number.
+ * Core of strtol and strtoul functions.
+ *
+ * @param nptr		Pointer to string.
+ * @param endptr	If not NULL, function stores here pointer to the first
+ * 			invalid character.
+ * @param base		Zero or number between 2 and 36 inclusive.
+ * @param sgn		It's set to 1 if minus found.
+ * @return		Result of conversion.
+ */
+static unsigned long
+_strtoul(const char *nptr, char **endptr, int base, char *sgn)
+{
+	unsigned char c;
+	unsigned long result = 0;
+	unsigned long a, b;
+	const char *str = nptr;
+	const char *tmpptr;
+	
+	while (isspace(*str))
+		str++;
+	
+	if (*str == '-') {
+		*sgn = 1;
+		++str;
+	} else if (*str == '+')
+		++str;
+	
+	if (base) {
+		if ((base == 1) || (base > 36)) {
+			/* FIXME: set errno to EINVAL */
+			return 0;
+		}
+		if ((base == 16) && (*str == '0') && ((str[1] == 'x') ||
+		    (str[1] == 'X'))) {
+			str += 2;
+		}
+	} else {
+		base = 10;
+		
+		if (*str == '0') {
+			base = 8;
+			if ((str[1] == 'X') || (str[1] == 'x'))  {
+				base = 16;
+				str += 2;
+			}
+		}
+	}
+	
+	tmpptr = str;
+
+	while (*str) {
+		c = *str;
+		c = (c >= 'a' ? c - 'a' + 10 : (c >= 'A' ? c - 'A' + 10 :
+		    (c <= '9' ? c - '0' : 0xff)));
+		if (c >= base) {
+			break;
+		}
+		
+		a = (result & 0xff) * base + c;
+		b = (result >> 8) * base + (a >> 8);
+		
+		if (b > (ULONG_MAX >> 8)) {
+			/* overflow */
+			/* FIXME: errno = ERANGE*/
+			return ULONG_MAX;
+		}
+	
+		result = (b << 8) + (a & 0xff);
+		++str;
+	}
+	
+	if (str == tmpptr) {
+		/*
+		 * No number was found => first invalid character is the first
+		 * character of the string.
+		 */
+		/* FIXME: set errno to EINVAL */
+		str = nptr;
+		result = 0;
+	}
+	
+	if (endptr)
+		*endptr = (char *) str;
+
+	if (nptr == str) {
+		/*FIXME: errno = EINVAL*/
+		return 0;
+	}
+
+	return result;
+}
+
+/** Convert initial part of string to long int according to given base.
+ * The number may begin with an arbitrary number of whitespaces followed by
+ * optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be
+ * inserted and the number will be taken as hexadecimal one. If the base is 0
+ * and the number begin with a zero, number will be taken as octal one (as with
+ * base 8). Otherwise the base 0 is taken as decimal.
+ *
+ * @param nptr		Pointer to string.
+ * @param endptr	If not NULL, function stores here pointer to the first
+ * 			invalid character.
+ * @param base		Zero or number between 2 and 36 inclusive.
+ * @return		Result of conversion.
+ */
+long int strtol(const char *nptr, char **endptr, int base)
+{
+	char sgn = 0;
+	unsigned long number = 0;
+	
+	number = _strtoul(nptr, endptr, base, &sgn);
+
+	if (number > LONG_MAX) {
+		if ((sgn) && (number == (unsigned long) (LONG_MAX) + 1)) {
+			/* FIXME: set 0 to errno */
+			return number;
+		}
+		/* FIXME: set ERANGE to errno */
+		return (sgn ? LONG_MIN : LONG_MAX);
+	}
+	
+	return (sgn ? -number : number);
+}
 
 /** Duplicate string.
@@ -1333,4 +1457,27 @@
 	str_ncpy(dest, size + 1, src, size);
 	return dest;
+}
+
+/** Convert initial part of string to unsigned long according to given base.
+ * The number may begin with an arbitrary number of whitespaces followed by
+ * optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be
+ * inserted and the number will be taken as hexadecimal one. If the base is 0
+ * and the number begin with a zero, number will be taken as octal one (as with
+ * base 8). Otherwise the base 0 is taken as decimal.
+ *
+ * @param nptr		Pointer to string.
+ * @param endptr	If not NULL, function stores here pointer to the first
+ * 			invalid character
+ * @param base		Zero or number between 2 and 36 inclusive.
+ * @return		Result of conversion.
+ */
+unsigned long strtoul(const char *nptr, char **endptr, int base)
+{
+	char sgn = 0;
+	unsigned long number = 0;
+	
+	number = _strtoul(nptr, endptr, base, &sgn);
+
+	return (sgn ? -number : number);
 }
 
@@ -1392,5 +1539,5 @@
  *
  */
-static errno_t str_uint(const char *nptr, char **endptr, unsigned int base,
+static int str_uint(const char *nptr, char **endptr, unsigned int base,
     bool *neg, uint64_t *result)
 {
@@ -1513,5 +1660,5 @@
  *
  */
-errno_t str_uint8_t(const char *nptr, const char **endptr, unsigned int base,
+int str_uint8_t(const char *nptr, const char **endptr, unsigned int base,
     bool strict, uint8_t *result)
 {
@@ -1521,5 +1668,5 @@
 	char *lendptr;
 	uint64_t res;
-	errno_t ret = str_uint(nptr, &lendptr, base, &neg, &res);
+	int ret = str_uint(nptr, &lendptr, base, &neg, &res);
 	
 	if (endptr != NULL)
@@ -1560,5 +1707,5 @@
  *
  */
-errno_t str_uint16_t(const char *nptr, const char **endptr, unsigned int base,
+int str_uint16_t(const char *nptr, const char **endptr, unsigned int base,
     bool strict, uint16_t *result)
 {
@@ -1568,5 +1715,5 @@
 	char *lendptr;
 	uint64_t res;
-	errno_t ret = str_uint(nptr, &lendptr, base, &neg, &res);
+	int ret = str_uint(nptr, &lendptr, base, &neg, &res);
 	
 	if (endptr != NULL)
@@ -1607,5 +1754,5 @@
  *
  */
-errno_t str_uint32_t(const char *nptr, const char **endptr, unsigned int base,
+int str_uint32_t(const char *nptr, const char **endptr, unsigned int base,
     bool strict, uint32_t *result)
 {
@@ -1615,5 +1762,5 @@
 	char *lendptr;
 	uint64_t res;
-	errno_t ret = str_uint(nptr, &lendptr, base, &neg, &res);
+	int ret = str_uint(nptr, &lendptr, base, &neg, &res);
 	
 	if (endptr != NULL)
@@ -1654,5 +1801,5 @@
  *
  */
-errno_t str_uint64_t(const char *nptr, const char **endptr, unsigned int base,
+int str_uint64_t(const char *nptr, const char **endptr, unsigned int base,
     bool strict, uint64_t *result)
 {
@@ -1661,5 +1808,5 @@
 	bool neg;
 	char *lendptr;
-	errno_t ret = str_uint(nptr, &lendptr, base, &neg, result);
+	int ret = str_uint(nptr, &lendptr, base, &neg, result);
 	
 	if (endptr != NULL)
@@ -1693,5 +1840,5 @@
  *
  */
-errno_t str_size_t(const char *nptr, const char **endptr, unsigned int base,
+int str_size_t(const char *nptr, const char **endptr, unsigned int base,
     bool strict, size_t *result)
 {
@@ -1701,5 +1848,5 @@
 	char *lendptr;
 	uint64_t res;
-	errno_t ret = str_uint(nptr, &lendptr, base, &neg, &res);
+	int ret = str_uint(nptr, &lendptr, base, &neg, &res);
 	
 	if (endptr != NULL)
Index: uspace/lib/c/generic/str_error.c
===================================================================
--- uspace/lib/c/generic/str_error.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/str_error.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1,5 +1,4 @@
 /*
  * Copyright (c) 2010 Martin Decky
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
  * All rights reserved.
  *
@@ -39,59 +38,73 @@
 #include <fibril.h>
 
+#define MIN_ERRNO  -17
 #define NOERR_LEN  64
 
-/* The arrays below are automatically generated from the same file that
- * errno.h constants are generated from. Triple-include of the same list
- * with redefinitions of __errno() macro are used to ensure that the
- * information cannot get out of synch. This is inpired by musl libc.
- */
+// TODO: this file should be generated from errno declarations
 
-#undef __errno_entry
-#define __errno_entry(name, num, desc) name,
-
-static const errno_t err_num[] = {
-#include <abi/errno.in>
+static const char* err_name[] = {
+	"EOK",
+	"ENOENT",
+	"ENOMEM",
+	"ELIMIT",
+	"EREFUSED",
+	"EFORWARD",
+	"EPERM",
+	"EHANGUP",
+	"EPARTY",
+	"EEXIST",
+	"EBADMEM",
+	"ENOTSUP",
+	"EADDRNOTAVAIL",
+	"ETIMEOUT",
+	"EINVAL",
+	"EBUSY",
+	"EOVERFLOW",
+	"EINTR"
 };
 
-#undef __errno_entry
-#define __errno_entry(name, num, desc) #name,
-
-static const char* err_name[] = {
-#include <abi/errno.in>
-};
-
-#undef __errno_entry
-#define __errno_entry(name, num, desc) "[" #name "]" desc,
-
 static const char* err_desc[] = {
-#include <abi/errno.in>
+	"No error",
+	"No such entry",
+	"Not enough memory",
+	"Limit exceeded",
+	"Connection refused",
+	"Forwarding error",
+	"Permission denied",
+	"Answerbox closed connection",
+	"Other party error",
+	"Entry already exists",
+	"Bad memory pointer",
+	"Not supported",
+	"Address not available",
+	"Timeout expired",
+	"Invalid value",
+	"Resource is busy",
+	"Result does not fit its size",
+	"Operation interrupted"
 };
 
 static fibril_local char noerr[NOERR_LEN];
 
-/* Returns index corresponding to the given errno, or -1 if not found. */
-static int find_errno(errno_t e)
-{
-	/* Just a dumb linear search.
-	 * There are too few entries to warrant anything smarter.
-	 */
-
-	int len = sizeof(err_num) / sizeof(errno_t);
-
-	for (int i = 0; i < len; i++) {
-		if (err_num[i] == e) {
-			return i;
-		}
-	}
-
-	return -1;
-}
-
 const char *str_error_name(errno_t e)
 {
-	int i = find_errno(e);
+	if ((e <= 0) && (e >= MIN_ERRNO))
+		return err_name[-e];
 
-	if (i >= 0) {
-		return err_name[i];
+	/* Ad hoc descriptions of error codes interesting for USB. */
+	// FIXME: integrate these as first-class error values
+	switch (e) {
+		case ENOFS:
+			return "ENOFS";
+		case EBADCHECKSUM:
+			return "EBADCHECKSUM";
+		case ESTALL:
+			return "ESTALL";
+		case EAGAIN:
+			return "EAGAIN";
+		case EEMPTY:
+			return "EEMPTY";
+		default:
+			break;
 	}
 
@@ -102,8 +115,22 @@
 const char *str_error(errno_t e)
 {
-	int i = find_errno(e);
-
-	if (i >= 0) {
-		return err_desc[i];
+	if ((e <= 0) && (e >= MIN_ERRNO))
+		return err_desc[-e];
+	
+	/* Ad hoc descriptions of error codes interesting for USB. */
+	// FIXME: integrate these as first-class error values
+	switch (e) {
+		case ENOFS:
+			return "No such file system type";
+		case EBADCHECKSUM:
+			return "Bad checksum";
+		case ESTALL:
+			return "Operation stalled";
+		case EAGAIN:
+			return "Resource temporarily unavailable";
+		case EEMPTY:
+			return "Resource is empty";
+		default:
+			break;
 	}
 
Index: pace/lib/c/generic/strtol.c
===================================================================
--- uspace/lib/c/generic/strtol.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,267 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2008 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2011 Oleg Romanenko
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <inttypes.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <ctype.h>
-#include <assert.h>
-
-// TODO: unit tests
-
-static inline int _digit_value(int c)
-{
-	if (isdigit(c)) {
-		return c - '0';
-	} else if (islower(c)) {
-		return c - 'a' + 10;
-	} else if (isupper(c)) {
-		return c - 'A' + 10;
-	}
-	return INT_MAX;
-}
-
-/* FIXME: workaround for GCC "optimizing" the overflow check
- * into soft-emulated 128b multiplication using `__multi3`,
- * which we don't currently implement.
- */
-__attribute__((noinline)) static uintmax_t _max_value(int base)
-{
-	return UINTMAX_MAX / base;
-}
-
-static inline uintmax_t _strtoumax(
-    const char *restrict nptr, char **restrict endptr, int base,
-    bool *restrict sgn)
-{
-	assert(nptr != NULL);
-	assert(sgn != NULL);
-
-	/* Skip leading whitespace. */
-
-	while (isspace(*nptr)) {
-		nptr++;
-	}
-
-	/* Parse sign, if any. */
-
-	switch (*nptr) {
-	case '-':
-		*sgn = true;
-		nptr++;
-		break;
-	case '+':
-		nptr++;
-		break;
-	}
-
-	/* Figure out the base. */
-
-	if (base == 0) {
-		if (*nptr == '0') {
-			if (tolower(nptr[1]) == 'x') {
-				/* 0x... is hex. */
-				base = 16;
-				nptr += 2;
-			} else {
-				/* 0... is octal. */
-				base = 8;
-			}
-		} else {
-			/* Anything else is decimal by default. */
-			base = 10;
-		}
-	} else if (base == 16) {
-		/* Allow hex number to be prefixed with "0x". */
-		if (nptr[0] == '0' && tolower(nptr[1]) == 'x') {
-			nptr += 2;
-		}
-	} else if (base < 0 || base == 1 || base > 36) {
-		errno = EINVAL;
-		return 0;
-	}
-
-	/* Read the value. */
-
-	uintmax_t result = 0;
-	uintmax_t max = _max_value(base);
-	int digit;
-
-	while (digit = _digit_value(*nptr), digit < base) {
-
-		if (result > max ||
-		    __builtin_add_overflow(result * base, digit, &result)) {
-
-			errno = ERANGE;
-			result = UINTMAX_MAX;
-			break;
-		}
-
-		nptr++;
-	}
-
-	/* Set endptr. */
-
-	if (endptr != NULL) {
-		/* Move the pointer to the end of the number,
-		 * in case it isn't there already.
-		 */
-		while (_digit_value(*nptr) < base) {
-			nptr++;
-		}
-
-		*endptr = (char *) nptr;
-	}
-
-	return result;
-}
-
-static inline intmax_t _strtosigned(const char *nptr, char **endptr, int base,
-    intmax_t min, intmax_t max)
-{
-	bool sgn = false;
-	uintmax_t number = _strtoumax(nptr, endptr, base, &sgn);
-
-	if (number > (uintmax_t) max) {
-		if (sgn && (number - 1 == (uintmax_t) max)) {
-			return min;
-		}
-
-		errno = ERANGE;
-		return (sgn ? min : max);
-	}
-
-	return (sgn ? -number : number);
-}
-
-static inline uintmax_t _strtounsigned(const char *nptr, char **endptr, int base,
-    uintmax_t max)
-{
-	bool sgn = false;
-	uintmax_t number = _strtoumax(nptr, endptr, base, &sgn);
-
-	if (sgn) {
-		if (number == 0) {
-			return 0;
-		} else {
-			errno = ERANGE;
-			return max;
-		}
-	}
-
-	if (number > max) {
-		errno = ERANGE;
-		return max;
-	}
-
-	return number;
-}
-
-/** Convert initial part of string to long int according to given base.
- * The number may begin with an arbitrary number of whitespaces followed by
- * optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be
- * inserted and the number will be taken as hexadecimal one. If the base is 0
- * and the number begin with a zero, number will be taken as octal one (as with
- * base 8). Otherwise the base 0 is taken as decimal.
- *
- * @param nptr		Pointer to string.
- * @param[out] endptr	If not NULL, function stores here pointer to the first
- * 			invalid character.
- * @param base		Zero or number between 2 and 36 inclusive.
- * @return		Result of conversion.
- */
-long strtol(const char *nptr, char **endptr, int base)
-{
-	return _strtosigned(nptr, endptr, base, LONG_MIN, LONG_MAX);
-}
-
-/** Convert initial part of string to unsigned long according to given base.
- * The number may begin with an arbitrary number of whitespaces followed by
- * optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be
- * inserted and the number will be taken as hexadecimal one. If the base is 0
- * and the number begin with a zero, number will be taken as octal one (as with
- * base 8). Otherwise the base 0 is taken as decimal.
- *
- * @param nptr		Pointer to string.
- * @param[out] endptr	If not NULL, function stores here pointer to the first
- * 			invalid character
- * @param base		Zero or number between 2 and 36 inclusive.
- * @return		Result of conversion.
- */
-unsigned long strtoul(const char *nptr, char **endptr, int base)
-{
-	return _strtounsigned(nptr, endptr, base, ULONG_MAX);
-}
-
-long long strtoll(const char *nptr, char **endptr, int base)
-{
-	return _strtosigned(nptr, endptr, base, LLONG_MIN, LLONG_MAX);
-}
-
-unsigned long long strtoull(const char *nptr, char **endptr, int base)
-{
-	return _strtounsigned(nptr, endptr, base, ULLONG_MAX);
-}
-
-intmax_t strtoimax(const char *nptr, char **endptr, int base)
-{
-	return _strtosigned(nptr, endptr, base, INTMAX_MIN, INTMAX_MAX);
-}
-
-uintmax_t strtoumax(const char *nptr, char **endptr, int base)
-{
-	return _strtounsigned(nptr, endptr, base, UINTMAX_MAX);
-}
-
-int atoi(const char *nptr)
-{
-	return (int)strtol(nptr, NULL, 10);
-}
-
-long atol(const char *nptr)
-{
-	return strtol(nptr, NULL, 10);
-}
-
-long long atoll(const char *nptr)
-{
-	return strtoll(nptr, NULL, 10);
-}
-
-/** @}
- */
Index: uspace/lib/c/generic/sysinfo.c
===================================================================
--- uspace/lib/c/generic/sysinfo.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/sysinfo.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,7 +49,7 @@
  *
  */
-static errno_t sysinfo_get_keys_size(const char *path, size_t *size)
-{
-	return (errno_t) __SYSCALL3(SYS_SYSINFO_GET_KEYS_SIZE, (sysarg_t) path,
+static int sysinfo_get_keys_size(const char *path, size_t *size)
+{
+	return (int) __SYSCALL3(SYS_SYSINFO_GET_KEYS_SIZE, (sysarg_t) path,
 	    (sysarg_t) str_size(path), (sysarg_t) size);
 }
@@ -75,5 +75,5 @@
 	
 	/* Get the keys size */
-	errno_t ret = sysinfo_get_keys_size(path, size);
+	int ret = sysinfo_get_keys_size(path, size);
 	if ((ret != EOK) || (size == 0)) {
 		/*
@@ -92,5 +92,5 @@
 	/* Get the data */
 	size_t sz;
-	ret = (errno_t) __SYSCALL5(SYS_SYSINFO_GET_KEYS, (sysarg_t) path,
+	ret = __SYSCALL5(SYS_SYSINFO_GET_KEYS, (sysarg_t) path,
 	    (sysarg_t) str_size(path), (sysarg_t) data, (sysarg_t) *size,
 	    (sysarg_t) &sz);
@@ -127,7 +127,7 @@
  *
  */
-errno_t sysinfo_get_value(const char *path, sysarg_t *value)
-{
-	return (errno_t) __SYSCALL3(SYS_SYSINFO_GET_VALUE, (sysarg_t) path,
+int sysinfo_get_value(const char *path, sysarg_t *value)
+{
+	return (int) __SYSCALL3(SYS_SYSINFO_GET_VALUE, (sysarg_t) path,
 	    (sysarg_t) str_size(path), (sysarg_t) value);
 }
@@ -142,7 +142,7 @@
  *
  */
-static errno_t sysinfo_get_data_size(const char *path, size_t *size)
-{
-	return (errno_t) __SYSCALL3(SYS_SYSINFO_GET_DATA_SIZE, (sysarg_t) path,
+static int sysinfo_get_data_size(const char *path, size_t *size)
+{
+	return (int) __SYSCALL3(SYS_SYSINFO_GET_DATA_SIZE, (sysarg_t) path,
 	    (sysarg_t) str_size(path), (sysarg_t) size);
 }
@@ -168,5 +168,5 @@
 	
 	/* Get the binary data size */
-	errno_t ret = sysinfo_get_data_size(path, size);
+	int ret = sysinfo_get_data_size(path, size);
 	if ((ret != EOK) || (size == 0)) {
 		/*
@@ -186,5 +186,5 @@
 	/* Get the data */
 	size_t sz;
-	ret = (errno_t) __SYSCALL5(SYS_SYSINFO_GET_DATA, (sysarg_t) path,
+	ret = __SYSCALL5(SYS_SYSINFO_GET_DATA, (sysarg_t) path,
 	    (sysarg_t) str_size(path), (sysarg_t) data, (sysarg_t) *size,
 	    (sysarg_t) &sz);
Index: uspace/lib/c/generic/task.c
===================================================================
--- uspace/lib/c/generic/task.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/task.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -69,11 +69,11 @@
  *             program.
  *
- * @return Zero on success or an error code.
- */
-errno_t task_set_name(const char *name)
+ * @return Zero on success or negative error code.
+ */
+int task_set_name(const char *name)
 {
 	assert(name);
 	
-	return (errno_t) __SYSCALL2(SYS_TASK_SET_NAME, (sysarg_t) name, str_size(name));
+	return __SYSCALL2(SYS_TASK_SET_NAME, (sysarg_t) name, str_size(name));
 }
 
@@ -82,10 +82,10 @@
  * @param task_id ID of task to kill.
  *
- * @return Zero on success or an error code.
- */
-
-errno_t task_kill(task_id_t task_id)
-{
-	return (errno_t) __SYSCALL1(SYS_TASK_KILL, (sysarg_t) &task_id);
+ * @return Zero on success or negative error code.
+ */
+
+int task_kill(task_id_t task_id)
+{
+	return (int) __SYSCALL1(SYS_TASK_KILL, (sysarg_t) &task_id);
 }
 
@@ -101,8 +101,8 @@
  * @param argv Command-line arguments.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t task_spawnv(task_id_t *id, task_wait_t *wait, const char *path,
+ * @return Zero on success or negative error code.
+ *
+ */
+int task_spawnv(task_id_t *id, task_wait_t *wait, const char *path,
     const char *const args[])
 {
@@ -143,8 +143,8 @@
  * @param std_err File to use as stderr.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t task_spawnvf(task_id_t *id, task_wait_t *wait, const char *path,
+ * @return Zero on success or negative error code.
+ *
+ */
+int task_spawnvf(task_id_t *id, task_wait_t *wait, const char *path,
     const char *const args[], int fd_stdin, int fd_stdout, int fd_stderr)
 {
@@ -158,5 +158,5 @@
 	/* Get task ID. */
 	task_id_t task_id;
-	errno_t rc = loader_get_task_id(ldr, &task_id);
+	int rc = loader_get_task_id(ldr, &task_id);
 	if (rc != EOK)
 		goto error;
@@ -249,8 +249,8 @@
  * @param ap   Command-line arguments.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t task_spawn(task_id_t *task_id, task_wait_t *wait, const char *path,
+ * @return Zero on success or negative error code.
+ *
+ */
+int task_spawn(task_id_t *task_id, task_wait_t *wait, const char *path,
     int cnt, va_list ap)
 {
@@ -269,5 +269,5 @@
 	
 	/* Spawn task. */
-	errno_t rc = task_spawnv(task_id, wait, path, arglist);
+	int rc = task_spawnv(task_id, wait, path, arglist);
 	
 	/* Free argument list. */
@@ -287,8 +287,8 @@
  * @param ...  Command-line arguments.
  *
- * @return Zero on success or an error code.
- *
- */
-errno_t task_spawnl(task_id_t *task_id, task_wait_t *wait, const char *path, ...)
+ * @return Zero on success or negative error code.
+ *
+ */
+int task_spawnl(task_id_t *task_id, task_wait_t *wait, const char *path, ...)
 {
 	/* Count the number of arguments. */
@@ -306,5 +306,5 @@
 	
 	va_start(ap, path);
-	errno_t rc = task_spawn(task_id, wait, path, cnt, ap);
+	int rc = task_spawn(task_id, wait, path, cnt, ap);
 	va_end(ap);
 	
@@ -323,5 +323,5 @@
  * @return EOK on success, else error code.
  */
-errno_t task_setup_wait(task_id_t id, task_wait_t *wait)
+int task_setup_wait(task_id_t id, task_wait_t *wait)
 {
 	async_sess_t *sess_ns = ns_session_get();
@@ -364,10 +364,10 @@
  * @return EOK on success, else error code.
  */
-errno_t task_wait(task_wait_t *wait, task_exit_t *texit, int *retval)
+int task_wait(task_wait_t *wait, task_exit_t *texit, int *retval)
 {
 	assert(texit);
 	assert(retval);
 
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(wait->aid, &rc);
 
@@ -394,8 +394,8 @@
  * @return EOK on success, else error code.
  */
-errno_t task_wait_task_id(task_id_t id, task_exit_t *texit, int *retval)
+int task_wait_task_id(task_id_t id, task_exit_t *texit, int *retval)
 {
 	task_wait_t wait;
-	errno_t rc = task_setup_wait(id, &wait);
+	int rc = task_setup_wait(id, &wait);
 	if (rc != EOK)
 		return rc;
@@ -404,5 +404,5 @@
 }
 
-errno_t task_retval(int val)
+int task_retval(int val)
 {
 	async_sess_t *sess_ns = ns_session_get();
@@ -411,5 +411,5 @@
 
 	async_exch_t *exch = async_exchange_begin(sess_ns);
-	errno_t rc = (errno_t) async_req_1_0(exch, NS_RETVAL, val);
+	int rc = (int) async_req_1_0(exch, NS_RETVAL, val);
 	async_exchange_end(exch);
 	
Index: uspace/lib/c/generic/thread.c
===================================================================
--- uspace/lib/c/generic/thread.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/thread.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -105,5 +105,5 @@
  * @return Zero on success or a code from @ref errno.h on failure.
  */
-errno_t thread_create(void (* function)(void *), void *arg, const char *name,
+int thread_create(void (* function)(void *), void *arg, const char *name,
     thread_id_t *tid)
 {
@@ -132,5 +132,5 @@
 	uarg->uspace_uarg = uarg;
 	
-	errno_t rc = (errno_t) __SYSCALL4(SYS_THREAD_CREATE, (sysarg_t) uarg,
+	int rc = __SYSCALL4(SYS_THREAD_CREATE, (sysarg_t) uarg,
 	    (sysarg_t) name, (sysarg_t) str_size(name), (sysarg_t) tid);
 	
@@ -178,5 +178,5 @@
  * @return Thread exit status.
  */
-errno_t thread_join(thread_id_t thread)
+int thread_join(thread_id_t thread)
 {
 	return 0;
Index: uspace/lib/c/generic/time.c
===================================================================
--- uspace/lib/c/generic/time.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/time.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -585,5 +585,5 @@
 	if (clock_conn == NULL) {
 		category_id_t cat_id;
-		errno_t rc = loc_category_get_id("clock", &cat_id, IPC_FLAG_BLOCKING);
+		int rc = loc_category_get_id("clock", &cat_id, IPC_FLAG_BLOCKING);
 		if (rc != EOK)
 			goto fallback;
@@ -617,5 +617,5 @@
 	
 	struct tm time;
-	errno_t rc = clock_dev_time_get(clock_conn, &time);
+	int rc = clock_dev_time_get(clock_conn, &time);
 	if (rc != EOK)
 		goto fallback;
@@ -634,5 +634,5 @@
 	if (ktime == NULL) {
 		uintptr_t faddr;
-		errno_t rc = sysinfo_get_value("clock.faddr", &faddr);
+		int rc = sysinfo_get_value("clock.faddr", &faddr);
 		if (rc != EOK) {
 			errno = rc;
@@ -954,8 +954,8 @@
  * @param result Structure to store the result to
  *
- * @return EOK or an error code
- *
- */
-errno_t time_utc2tm(const time_t time, struct tm *restrict result)
+ * @return EOK or a negative error code
+ *
+ */
+int time_utc2tm(const time_t time, struct tm *restrict result)
 {
 	assert(result != NULL);
@@ -984,11 +984,11 @@
  *             ASCTIME_BUF_LEN bytes long.
  *
- * @return EOK or an error code.
- *
- */
-errno_t time_utc2str(const time_t time, char *restrict buf)
+ * @return EOK or a negative error code.
+ *
+ */
+int time_utc2str(const time_t time, char *restrict buf)
 {
 	struct tm tm;
-	errno_t ret = time_utc2tm(time, &tm);
+	int ret = time_utc2tm(time, &tm);
 	if (ret != EOK)
 		return ret;
@@ -1036,8 +1036,8 @@
  * @param result Structure to store the result to.
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t time_tv2tm(const struct timeval *tv, struct tm *restrict result)
+ * @return EOK on success or a negative error code.
+ *
+ */
+int time_tv2tm(const struct timeval *tv, struct tm *restrict result)
 {
 	// TODO: Deal with timezones.
@@ -1066,8 +1066,8 @@
  * @param result Structure to store the result to.
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t time_local2tm(const time_t time, struct tm *restrict result)
+ * @return EOK on success or a negative error code.
+ *
+ */
+int time_local2tm(const time_t time, struct tm *restrict result)
 {
 	struct timeval tv = {
@@ -1088,11 +1088,11 @@
  *              ASCTIME_BUF_LEN bytes long.
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t time_local2str(const time_t time, char *buf)
+ * @return EOK on success or a negative error code.
+ *
+ */
+int time_local2str(const time_t time, char *buf)
 {
 	struct tm loctime;
-	errno_t ret = time_local2tm(time, &loctime);
+	int ret = time_local2tm(time, &loctime);
 	if (ret != EOK)
 		return ret;
Index: uspace/lib/c/generic/udebug.c
===================================================================
--- uspace/lib/c/generic/udebug.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/udebug.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include <async.h>
 
-errno_t udebug_begin(async_sess_t *sess)
+int udebug_begin(async_sess_t *sess)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -45,5 +45,5 @@
 }
 
-errno_t udebug_end(async_sess_t *sess)
+int udebug_end(async_sess_t *sess)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -51,5 +51,5 @@
 }
 
-errno_t udebug_set_evmask(async_sess_t *sess, udebug_evmask_t mask)
+int udebug_set_evmask(async_sess_t *sess, udebug_evmask_t mask)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -57,5 +57,5 @@
 }
 
-errno_t udebug_thread_read(async_sess_t *sess, void *buffer, size_t n,
+int udebug_thread_read(async_sess_t *sess, void *buffer, size_t n,
     size_t *copied, size_t *needed)
 {
@@ -63,5 +63,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_THREAD_READ,
+	int rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_THREAD_READ,
 	    (sysarg_t) buffer, n, NULL, &a_copied, &a_needed);
 	
@@ -72,5 +72,5 @@
 }
 
-errno_t udebug_name_read(async_sess_t *sess, void *buffer, size_t n,
+int udebug_name_read(async_sess_t *sess, void *buffer, size_t n,
     size_t *copied, size_t *needed)
 {
@@ -78,5 +78,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_NAME_READ,
+	int rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_NAME_READ,
 	    (sysarg_t) buffer, n, NULL, &a_copied, &a_needed);
 	
@@ -87,5 +87,5 @@
 }
 
-errno_t udebug_areas_read(async_sess_t *sess, void *buffer, size_t n,
+int udebug_areas_read(async_sess_t *sess, void *buffer, size_t n,
     size_t *copied, size_t *needed)
 {
@@ -93,5 +93,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_AREAS_READ,
+	int rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_AREAS_READ,
 	    (sysarg_t) buffer, n, NULL, &a_copied, &a_needed);
 	
@@ -102,5 +102,5 @@
 }
 
-errno_t udebug_mem_read(async_sess_t *sess, void *buffer, uintptr_t addr, size_t n)
+int udebug_mem_read(async_sess_t *sess, void *buffer, uintptr_t addr, size_t n)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -109,5 +109,5 @@
 }
 
-errno_t udebug_args_read(async_sess_t *sess, thash_t tid, sysarg_t *buffer)
+int udebug_args_read(async_sess_t *sess, thash_t tid, sysarg_t *buffer)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -116,5 +116,5 @@
 }
 
-errno_t udebug_regs_read(async_sess_t *sess, thash_t tid, void *buffer)
+int udebug_regs_read(async_sess_t *sess, thash_t tid, void *buffer)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -123,5 +123,5 @@
 }
 
-errno_t udebug_go(async_sess_t *sess, thash_t tid, udebug_event_t *ev_type,
+int udebug_go(async_sess_t *sess, thash_t tid, udebug_event_t *ev_type,
     sysarg_t *val0, sysarg_t *val1)
 {
@@ -129,5 +129,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_2_3(exch, IPC_M_DEBUG, UDEBUG_M_GO,
+	int rc = async_req_2_3(exch, IPC_M_DEBUG, UDEBUG_M_GO,
 	    tid, &a_ev_type, val0, val1);
 	
@@ -136,5 +136,5 @@
 }
 
-errno_t udebug_stop(async_sess_t *sess, thash_t tid)
+int udebug_stop(async_sess_t *sess, thash_t tid)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
Index: uspace/lib/c/generic/uuid.c
===================================================================
--- uspace/lib/c/generic/uuid.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/uuid.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,7 +43,7 @@
  *
  * @param uuid Place to store generated UUID
- * @return EOK on success or an error code
+ * @return EOK on success or negative error code
  */
-errno_t uuid_generate(uuid_t *uuid)
+int uuid_generate(uuid_t *uuid)
 {
 	int i;
@@ -52,8 +52,8 @@
 	/* XXX This is a rather poor way of generating random numbers */
 	gettimeofday(&tv, NULL);
-	srand(tv.tv_sec ^ tv.tv_usec);
+	srandom(tv.tv_sec ^ tv.tv_usec);
 
 	for (i = 0; i < uuid_bytes; i++)
-		uuid->b[i] = rand();
+		uuid->b[i] = random();
 
 	/* Version 4 UUID from random or pseudo-random numbers */
@@ -100,9 +100,9 @@
  * @param endptr Place to store pointer to end of UUID or @c NULL
  *
- * @return EOK on success or an error code
+ * @return EOK on success or negative error code
  */
-errno_t uuid_parse(const char *str, uuid_t *uuid, const char **endptr)
+int uuid_parse(const char *str, uuid_t *uuid, const char **endptr)
 {
-	errno_t rc;
+	int rc;
 	const char *eptr;
 	uint32_t time_low;
@@ -167,5 +167,5 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-errno_t uuid_format(uuid_t *uuid, char **rstr)
+int uuid_format(uuid_t *uuid, char **rstr)
 {
 	return ENOTSUP;
Index: uspace/lib/c/generic/vbd.c
===================================================================
--- uspace/lib/c/generic/vbd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/vbd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,12 +44,12 @@
 #include <vbd.h>
 
-static errno_t vbd_get_ids_internal(vbd_t *, sysarg_t, sysarg_t, sysarg_t **,
+static int vbd_get_ids_internal(vbd_t *, sysarg_t, sysarg_t, sysarg_t **,
     size_t *);
 
-errno_t vbd_create(vbd_t **rvbd)
+int vbd_create(vbd_t **rvbd)
 {
 	vbd_t *vbd;
 	service_id_t vbd_svcid;
-	errno_t rc;
+	int rc;
 
 	vbd = calloc(1, sizeof(vbd_t));
@@ -95,7 +95,7 @@
  * @param count Place to store length of array (number of entries)
  *
- * @return EOK on success or an error code
- */
-errno_t vbd_get_disks(vbd_t *vbd, service_id_t **data, size_t *count)
+ * @return EOK on success or negative error code
+ */
+int vbd_get_disks(vbd_t *vbd, service_id_t **data, size_t *count)
 {
 	return vbd_get_ids_internal(vbd, VBD_GET_DISKS, 0, data, count);
@@ -103,31 +103,31 @@
 
 /** Get disk information. */
-errno_t vbd_disk_info(vbd_t *vbd, service_id_t sid, vbd_disk_info_t *vinfo)
-{
-	async_exch_t *exch;
-	errno_t retval;
+int vbd_disk_info(vbd_t *vbd, service_id_t sid, vbd_disk_info_t *vinfo)
+{
+	async_exch_t *exch;
+	sysarg_t retval;
 	ipc_call_t answer;
 
 	exch = async_exchange_begin(vbd->sess);
 	aid_t req = async_send_1(exch, VBD_DISK_INFO, sid, &answer);
-	errno_t rc = async_data_read_start(exch, vinfo, sizeof(vbd_disk_info_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return EIO;
-	}
-
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-errno_t vbd_label_create(vbd_t *vbd, service_id_t sid, label_type_t ltype)
-{
-	async_exch_t *exch;
-	errno_t retval;
+	int rc = async_data_read_start(exch, vinfo, sizeof(vbd_disk_info_t));
+	async_exchange_end(exch);
+
+	if (rc != EOK) {
+		async_forget(req);
+		return EIO;
+	}
+
+	async_wait_for(req, &retval);
+	if (retval != EOK)
+		return EIO;
+
+	return EOK;
+}
+
+int vbd_label_create(vbd_t *vbd, service_id_t sid, label_type_t ltype)
+{
+	async_exch_t *exch;
+	int retval;
 
 	exch = async_exchange_begin(vbd->sess);
@@ -141,8 +141,8 @@
 }
 
-errno_t vbd_label_delete(vbd_t *vbd, service_id_t sid)
-{
-	async_exch_t *exch;
-	errno_t retval;
+int vbd_label_delete(vbd_t *vbd, service_id_t sid)
+{
+	async_exch_t *exch;
+	int retval;
 
 	exch = async_exchange_begin(vbd->sess);
@@ -165,7 +165,7 @@
  * @param act_size Place to store actual size of complete data.
  *
- * @return EOK on success or an error code.
- */
-static errno_t vbd_get_ids_once(vbd_t *vbd, sysarg_t method, sysarg_t arg1,
+ * @return EOK on success or negative error code.
+ */
+static int vbd_get_ids_once(vbd_t *vbd, sysarg_t method, sysarg_t arg1,
     sysarg_t *id_buf, size_t buf_size, size_t *act_size)
 {
@@ -174,5 +174,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_1(exch, method, arg1, &answer);
-	errno_t rc = async_data_read_start(exch, id_buf, buf_size);
+	int rc = async_data_read_start(exch, id_buf, buf_size);
 
 	async_exchange_end(exch);
@@ -183,5 +183,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
@@ -203,7 +203,7 @@
  * @param data   Place to store pointer to array of IDs
  * @param count  Place to store number of IDs
- * @return       EOK on success or an error code
- */
-static errno_t vbd_get_ids_internal(vbd_t *vbd, sysarg_t method, sysarg_t arg1,
+ * @return       EOK on success or negative error code
+ */
+static int vbd_get_ids_internal(vbd_t *vbd, sysarg_t method, sysarg_t arg1,
     sysarg_t **data, size_t *count)
 {
@@ -212,5 +212,5 @@
 
 	size_t act_size = 0;
-	errno_t rc = vbd_get_ids_once(vbd, method, arg1, NULL, 0, &act_size);
+	int rc = vbd_get_ids_once(vbd, method, arg1, NULL, 0, &act_size);
 	if (rc != EOK)
 		return rc;
@@ -247,7 +247,7 @@
  * @param count Place to store length of array (number of entries)
  *
- * @return EOK on success or an error code
- */
-errno_t vbd_label_get_parts(vbd_t *vbd, service_id_t disk,
+ * @return EOK on success or negative error code
+ */
+int vbd_label_get_parts(vbd_t *vbd, service_id_t disk,
     service_id_t **data, size_t *count)
 {
@@ -256,37 +256,37 @@
 }
 
-errno_t vbd_part_get_info(vbd_t *vbd, vbd_part_id_t part, vbd_part_info_t *pinfo)
-{
-	async_exch_t *exch;
-	errno_t retval;
+int vbd_part_get_info(vbd_t *vbd, vbd_part_id_t part, vbd_part_info_t *pinfo)
+{
+	async_exch_t *exch;
+	sysarg_t retval;
 	ipc_call_t answer;
 
 	exch = async_exchange_begin(vbd->sess);
 	aid_t req = async_send_1(exch, VBD_PART_GET_INFO, part, &answer);
-	errno_t rc = async_data_read_start(exch, pinfo, sizeof(vbd_part_info_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return EIO;
-	}
-
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-errno_t vbd_part_create(vbd_t *vbd, service_id_t disk, vbd_part_spec_t *pspec,
+	int rc = async_data_read_start(exch, pinfo, sizeof(vbd_part_info_t));
+	async_exchange_end(exch);
+
+	if (rc != EOK) {
+		async_forget(req);
+		return EIO;
+	}
+
+	async_wait_for(req, &retval);
+	if (retval != EOK)
+		return EIO;
+
+	return EOK;
+}
+
+int vbd_part_create(vbd_t *vbd, service_id_t disk, vbd_part_spec_t *pspec,
     vbd_part_id_t *rpart)
 {
 	async_exch_t *exch;
-	errno_t retval;
+	sysarg_t retval;
 	ipc_call_t answer;
 
 	exch = async_exchange_begin(vbd->sess);
 	aid_t req = async_send_1(exch, VBD_PART_CREATE, disk, &answer);
-	errno_t rc = async_data_write_start(exch, pspec, sizeof(vbd_part_spec_t));
+	int rc = async_data_write_start(exch, pspec, sizeof(vbd_part_spec_t));
 	async_exchange_end(exch);
 
@@ -305,8 +305,8 @@
 }
 
-errno_t vbd_part_delete(vbd_t *vbd, vbd_part_id_t part)
-{
-	async_exch_t *exch;
-	errno_t retval;
+int vbd_part_delete(vbd_t *vbd, vbd_part_id_t part)
+{
+	async_exch_t *exch;
+	int retval;
 
 	exch = async_exchange_begin(vbd->sess);
@@ -332,16 +332,16 @@
  * @param ptype Place to store suggested partition type
  *
- * @return EOK on success or an error code
- */
-errno_t vbd_suggest_ptype(vbd_t *vbd, service_id_t disk, label_pcnt_t pcnt,
+ * @return EOK on success or negative error code
+ */
+int vbd_suggest_ptype(vbd_t *vbd, service_id_t disk, label_pcnt_t pcnt,
     label_ptype_t *ptype)
 {
 	async_exch_t *exch;
-	errno_t retval;
+	sysarg_t retval;
 	ipc_call_t answer;
 
 	exch = async_exchange_begin(vbd->sess);
 	aid_t req = async_send_2(exch, VBD_SUGGEST_PTYPE, disk, pcnt, &answer);
-	errno_t rc = async_data_read_start(exch, ptype, sizeof(label_ptype_t));
+	int rc = async_data_read_start(exch, ptype, sizeof(label_ptype_t));
 	async_exchange_end(exch);
 
Index: uspace/lib/c/generic/vfs/inbox.c
===================================================================
--- uspace/lib/c/generic/vfs/inbox.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/vfs/inbox.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -120,5 +120,5 @@
  *
  * @param name Name of the entry.
- * @return Requested file or -1 if not set.
+ * @return Requested file or ENOENT if not set.
  */
 int inbox_get(const char *name)
@@ -130,9 +130,9 @@
 			return e->file;
 		case 1:
-			return -1;
+			return ENOENT;
 		} 
 	}
 
-	return -1;
+	return ENOENT;
 }
 
Index: uspace/lib/c/generic/vfs/mtab.c
===================================================================
--- uspace/lib/c/generic/vfs/mtab.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/vfs/mtab.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,7 +40,6 @@
 #include <errno.h>
 #include <assert.h>
-#include <str.h>
 
-static void process_mp(const char *path, vfs_stat_t *stat, list_t *mtab_list)
+static void process_mp(const char *path, struct stat *stat, list_t *mtab_list)
 {
 	mtab_ent_t *ent;
@@ -54,5 +53,5 @@
 	ent->service_id = stat->service_id;
 
-	vfs_statfs_t stfs;
+	struct statfs stfs;
 	if (vfs_statfs_path(path, &stfs) == EOK)
 		str_cpy(ent->fs_name, sizeof(ent->fs_name), stfs.fs_name);
@@ -63,5 +62,5 @@
 }
 
-static errno_t vfs_get_mtab_visit(const char *path, list_t *mtab_list,
+static int vfs_get_mtab_visit(const char *path, list_t *mtab_list,
     fs_handle_t fs_handle, service_id_t service_id)
 {
@@ -75,12 +74,11 @@
 	while ((dirent = readdir(dir)) != NULL) {
 		char *child;
-		vfs_stat_t st;
-		errno_t rc;
-		int ret;
+		struct stat st;
+		int rc;
 
-		ret = asprintf(&child, "%s/%s", path, dirent->d_name);
-		if (ret < 0) {
+		rc = asprintf(&child, "%s/%s", path, dirent->d_name);
+		if (rc < 0) {
 			closedir(dir);
-			return ENOMEM;
+			return rc;
 		}
 
@@ -96,5 +94,5 @@
 
 		rc = vfs_stat_path(child, &st);
-		if (rc != EOK) {
+		if (rc != 0) {
 			free(child);
 			closedir(dir);
@@ -121,10 +119,10 @@
 }
 
-errno_t vfs_get_mtab_list(list_t *mtab_list)
+int vfs_get_mtab_list(list_t *mtab_list)
 {
-	vfs_stat_t st;
+	struct stat st;
 
-	errno_t rc = vfs_stat_path("/", &st);
-	if (rc != EOK)
+	int rc = vfs_stat_path("/", &st);
+	if (rc != 0)
 		return rc;
 
Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -86,5 +86,5 @@
  * and consume system resources.
  *
- * Functions that return errno_t return an error code on error and do not
+ * Functions that return int return an error code on error and do not
  * set errno. Depending on function, success is signalled by returning either
  * EOK or a non-negative file handle.
@@ -97,5 +97,5 @@
  * 	if (file < 0)
  * 		return file;
- * 	errno_t rc = vfs_open(file, MODE_READ);
+ * 	int rc = vfs_open(file, MODE_READ);
  * 	if (rc != EOK) {
  * 		(void) vfs_put(file);
@@ -128,5 +128,5 @@
 static int root_fd = -1;
 
-static errno_t get_parent_and_child(const char *path, int *parent, char **child)
+static int get_parent_and_child(const char *path, char **child)
 {
 	size_t size;
@@ -136,18 +136,14 @@
 
 	char *slash = str_rchr(apath, L'/');
+	int parent;
 	if (slash == apath) {
-		*parent = vfs_root();
-		if (*parent < 0) {
-			free(apath);
-			return EBADF;
-		}
+		parent = vfs_root();
 		*child = apath;
-		return EOK;
 	} else {
 		*slash = '\0';
-		errno_t rc = vfs_lookup(apath, WALK_DIRECTORY, parent);
-		if (rc != EOK) {
+		parent = vfs_lookup(apath, WALK_DIRECTORY);
+		if (parent < 0) {
 			free(apath);
-			return rc;
+			return parent;
 		}
 		*slash = '/';
@@ -155,11 +151,10 @@
 		free(apath);
 		if (!*child) {
-			vfs_put(*parent);
+			vfs_put(parent);
 			return ENOMEM;
 		}
-
-		return rc;
-	}
-
+	}
+
+	return parent;
 }
 
@@ -236,19 +231,12 @@
  *                      handle will be allocated from high indices
  *
- * @return              New file handle on success or an error code
- */
-errno_t vfs_clone(int file_from, int file_to, bool high, int *handle)
-{
-	assert(handle != NULL);
-
+ * @return              New file handle on success or a negative error code
+ */
+int vfs_clone(int file_from, int file_to, bool high)
+{
 	async_exch_t *vfs_exch = vfs_exchange_begin();
-	sysarg_t ret;
-	errno_t rc = async_req_3_1(vfs_exch, VFS_IN_CLONE, (sysarg_t) file_from,
-	    (sysarg_t) file_to, (sysarg_t) high, &ret);
+	int rc = async_req_3_0(vfs_exch, VFS_IN_CLONE, (sysarg_t) file_from,
+	    (sysarg_t) file_to, (sysarg_t) high);
 	vfs_exchange_end(vfs_exch);
-
-	if (rc == EOK) {
-		*handle = ret;
-	}
 	return rc;
 }
@@ -259,7 +247,7 @@
  * @param size          Size of @a buf
  *
- * @return              EOK on success or a non-error code
- */
-errno_t vfs_cwd_get(char *buf, size_t size)
+ * @return              EOK on success or a non-negative error code
+ */
+int vfs_cwd_get(char *buf, size_t size)
 {
 	fibril_mutex_lock(&cwd_mutex);
@@ -280,7 +268,7 @@
  * @param path  Path of the new working directory
  *
- * @return      EOK on success or an error code
- */
-errno_t vfs_cwd_set(const char *path)
+ * @return      EOK on success or a negative error code
+ */
+int vfs_cwd_set(const char *path)
 {
 	size_t abs_size;
@@ -289,9 +277,8 @@
 		return ENOMEM;
 	
-	int fd;
-	errno_t rc = vfs_lookup(abs, WALK_DIRECTORY, &fd);
-	if (rc != EOK) {
+	int fd = vfs_lookup(abs, WALK_DIRECTORY);
+	if (fd < 0) {
 		free(abs);
-		return rc;
+		return fd;
 	}
 	
@@ -352,7 +339,7 @@
 async_sess_t *vfs_fd_session(int file, iface_t iface)
 {
-	vfs_stat_t stat;
-	errno_t rc = vfs_stat(file, &stat);
-	if (rc != EOK)
+	struct stat stat;
+	int rc = vfs_stat(file, &stat);
+	if (rc != 0)
 		return NULL;
 	
@@ -370,10 +357,10 @@
  * @param info    Place to store volume identification information
  *
- * @return                      EOK on success or an error code
- */
-errno_t vfs_fsprobe(const char *fs_name, service_id_t serv,
+ * @return                      EOK on success or a negative error code
+ */
+int vfs_fsprobe(const char *fs_name, service_id_t serv,
     vfs_fs_probe_info_t *info)
 {
-	errno_t rc;
+	sysarg_t rc;
 	
 	ipc_call_t answer;
@@ -404,7 +391,7 @@
  *        fstypes->fstypes[0..]. To free the list use vfs_fstypes_free().
  *
- * @return                      EOK on success or an error code
- */
-errno_t vfs_fstypes(vfs_fstypes_t *fstypes)
+ * @return                      EOK on success or a negative error code
+ */
+int vfs_fstypes(vfs_fstypes_t *fstypes)
 {
 	sysarg_t size;
@@ -414,5 +401,5 @@
 
 	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_0_1(exch, VFS_IN_FSTYPES, &size);
+	int rc = async_req_0_1(exch, VFS_IN_FSTYPES, &size);
 
 	if (rc != EOK) {
@@ -499,13 +486,13 @@
  * @param[out] linkedfd If not NULL, will receive a file handle to the linked
  *                      child
- * @return              EOK on success or an error code
- */
-errno_t vfs_link(int parent, const char *child, vfs_file_kind_t kind, int *linkedfd)
+ * @return              EOK on success or a negative error code
+ */
+int vfs_link(int parent, const char *child, vfs_file_kind_t kind, int *linkedfd)
 {
 	int flags = (kind == KIND_DIRECTORY) ? WALK_DIRECTORY : WALK_REGULAR;
-	int file = -1;
-	errno_t rc = vfs_walk(parent, child, WALK_MUST_CREATE | flags, &file);
-	if (rc != EOK)
-		return rc;
+	int file = vfs_walk(parent, child, WALK_MUST_CREATE | flags);
+
+	if (file < 0)
+		return file;
 
 	if (linkedfd)
@@ -529,20 +516,19 @@
  * @param[out] linkedfd If not NULL, will receive a file handle to the linked
  *                      child
- * @return              EOK on success or an error code
- */
-errno_t vfs_link_path(const char *path, vfs_file_kind_t kind, int *linkedfd)
+ * @return              EOK on success or a negative error code
+ */
+int vfs_link_path(const char *path, vfs_file_kind_t kind, int *linkedfd)
 {
 	char *child;
-	int parent;
-	errno_t rc = get_parent_and_child(path, &parent, &child);
-	if (rc != EOK)
-		return rc;
-
-	rc = vfs_link(parent, child, kind, linkedfd);
+	int parent = get_parent_and_child(path, &child);
+	if (parent < 0)
+		return parent;
+
+	int rc = vfs_link(parent, child, kind, linkedfd);
 
 	free(child);
 	vfs_put(parent);
 	return rc;
-}
+}	
 
 /** Lookup a path relative to the local root
@@ -550,9 +536,9 @@
  * @param path  Path to be looked up
  * @param flags Walk flags
- * @param[out] handle Pointer to variable where handle is to be written.
- *
- * @return      EOK on success or an error code.
- */
-errno_t vfs_lookup(const char *path, int flags, int *handle)
+ *
+ * @return      File handle representing the result on success or a negative
+ *              error code on error
+ */
+int vfs_lookup(const char *path, int flags)
 {
 	size_t size;
@@ -560,5 +546,4 @@
 	if (!p)
 		return ENOMEM;
-
 	int root = vfs_root();
 	if (root < 0) {
@@ -566,9 +551,5 @@
 		return ENOENT;
 	}
-
-	// XXX: Workaround for GCC diagnostics.
-	*handle = -1;
-
-	errno_t rc = vfs_walk(root, p, flags, handle);
+	int rc = vfs_walk(root, p, flags);
 	vfs_put(root);
 	free(p);
@@ -583,23 +564,20 @@
  * @param flags Walk flags
  * @param mode  Mode in which to open file in
- * @param[out] handle Pointer to variable where handle is to be written.
- *
- * @return      EOK on success or an error code
- */
-errno_t vfs_lookup_open(const char *path, int flags, int mode, int *handle)
-{
-	int file;
-	errno_t rc = vfs_lookup(path, flags, &file);
-	if (rc != EOK)
-		return rc;
-
-	rc = vfs_open(file, mode);
+ *
+ * @return      EOK on success or a negative error code
+ */
+int vfs_lookup_open(const char *path, int flags, int mode)
+{
+	int file = vfs_lookup(path, flags);
+	if (file < 0)
+		return file;
+
+	int rc = vfs_open(file, mode);
 	if (rc != EOK) {
 		vfs_put(file);
 		return rc;
 	}
-
-	*handle = file;
-	return EOK;
+	
+	return file;
 }
 
@@ -614,10 +592,10 @@
  * @param[out] mountedfd        File handle of the mounted root if not NULL
  *
- * @return                      EOK on success or an error code
- */
-errno_t vfs_mount(int mp, const char *fs_name, service_id_t serv, const char *opts,
+ * @return                      EOK on success or a negative error code
+ */
+int vfs_mount(int mp, const char *fs_name, service_id_t serv, const char *opts,
     unsigned int flags, unsigned int instance, int *mountedfd)
 {
-	errno_t rc, rc1;
+	sysarg_t rc, rc1;
 	
 	if (!mountedfd)
@@ -658,7 +636,7 @@
  * @param[in] instance          Instance number of the file system server
  *
- * @return                      EOK on success or an error code
- */
-errno_t vfs_mount_path(const char *mp, const char *fs_name, const char *fqsn,
+ * @return                      EOK on success or a negative error code
+ */
+int vfs_mount_path(const char *mp, const char *fs_name, const char *fqsn,
     const char *opts, unsigned int flags, unsigned int instance)
 {
@@ -685,5 +663,5 @@
 	
 	service_id_t service_id;
-	errno_t res = loc_service_get_id(fqsn, &service_id, flags);
+	int res = loc_service_get_id(fqsn, &service_id, flags);
 	if (res != EOK) {
 		if (null_id != -1)
@@ -704,5 +682,5 @@
 	fibril_mutex_lock(&root_mutex);
 	
-	errno_t rc;
+	int rc;
 	
 	if (str_cmp(mpa, "/") == 0) {
@@ -729,10 +707,11 @@
 		}
 		
-		int mpfd;
-		rc = vfs_walk(root_fd, mpa, WALK_DIRECTORY, &mpfd);
-		if (rc == EOK) {
+		int mpfd = vfs_walk(root_fd, mpa, WALK_DIRECTORY);
+		if (mpfd >= 0) {
 			rc = vfs_mount(mpfd, fs_name, service_id, opts, flags,
 			    instance, NULL);
 			vfs_put(mpfd);
+		} else {
+			rc = mpfd;
 		}
 	}
@@ -743,5 +722,5 @@
 		loc_null_destroy(null_id);
 	
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -752,10 +731,10 @@
  * @param mode  Mode in which to open file in
  *
- * @return      EOK on success or an error code
- */
-errno_t vfs_open(int file, int mode)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_2_0(exch, VFS_IN_OPEN, file, mode);
+ * @return      EOK on success or a negative error code
+ */
+int vfs_open(int file, int mode)
+{
+	async_exch_t *exch = vfs_exchange_begin();
+	int rc = async_req_2_0(exch, VFS_IN_OPEN, file, mode);
 	vfs_exchange_end(exch);
 	
@@ -769,7 +748,7 @@
  * @param exch          Exchange to the acceptor
  *
- * @return              EOK on success or an error code
- */
-errno_t vfs_pass_handle(async_exch_t *vfs_exch, int file, async_exch_t *exch)
+ * @return              EOK on success or a negative error code
+ */
+int vfs_pass_handle(async_exch_t *vfs_exch, int file, async_exch_t *exch)
 {
 	return async_state_change_start(exch, VFS_PASS_HANDLE, (sysarg_t) file,
@@ -781,10 +760,10 @@
  * @param file  File handle to put
  *
- * @return      EOK on success or an error code
- */
-errno_t vfs_put(int file)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_1_0(exch, VFS_IN_PUT, file);
+ * @return      EOK on success or a negative error code
+ */
+int vfs_put(int file)
+{
+	async_exch_t *exch = vfs_exchange_begin();
+	int rc = async_req_1_0(exch, VFS_IN_PUT, file);
 	vfs_exchange_end(exch);
 	
@@ -796,9 +775,8 @@
  * @param high   If true, the received file handle will be allocated from high
  *               indices
- * @param[out] handle  Received handle.
- *
- * @return       EOK on success or an error code
- */
-errno_t vfs_receive_handle(bool high, int *handle)
+ *
+ * @return       EOK on success or a negative error code
+ */
+int vfs_receive_handle(bool high)
 {
 	ipc_callid_t callid;
@@ -813,13 +791,11 @@
 
 	sysarg_t ret;
-	errno_t rc = async_req_1_1(vfs_exch, VFS_IN_WAIT_HANDLE, high, &ret);
+	sysarg_t rc = async_req_1_1(vfs_exch, VFS_IN_WAIT_HANDLE, high, &ret);
 
 	async_exchange_end(vfs_exch);
 
-	if (rc == EOK) {
-		*handle = (int) ret;
-	}
-
-	return rc;
+	if (rc != EOK)
+		return rc;
+	return ret;
 }
 
@@ -839,10 +815,10 @@
  * @return              On failure, an error code
  */
-errno_t vfs_read(int file, aoff64_t *pos, void *buf, size_t nbyte, size_t *nread)
+int vfs_read(int file, aoff64_t *pos, void *buf, size_t nbyte, size_t *nread)
 {
 	ssize_t cnt = 0;
 	size_t nr = 0;
 	uint8_t *bp = (uint8_t *) buf;
-	errno_t rc;
+	int rc;
 	
 	do {
@@ -877,10 +853,10 @@
  * @param[out] nread	Actual number of bytes read (0 or more)
  *
- * @return              EOK on success or an error code
- */
-errno_t vfs_read_short(int file, aoff64_t pos, void *buf, size_t nbyte,
+ * @return              EOK on success or a negative error code
+ */
+int vfs_read_short(int file, aoff64_t pos, void *buf, size_t nbyte,
     ssize_t *nread)
 {
-	errno_t rc;
+	sysarg_t rc;
 	ipc_call_t answer;
 	aid_t req;
@@ -919,10 +895,10 @@
  * @param new   New path
  *
- * @return      EOK on success or an error code
- */
-errno_t vfs_rename_path(const char *old, const char *new)
-{
-	errno_t rc;
-	errno_t rc_orig;
+ * @return      EOK on success or a negative error code
+ */
+int vfs_rename_path(const char *old, const char *new)
+{
+	sysarg_t rc;
+	sysarg_t rc_orig;
 	aid_t req;
 	
@@ -986,10 +962,10 @@
  * @param length        New length
  *
- * @return              EOK on success or an error code
- */
-errno_t vfs_resize(int file, aoff64_t length)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_3_0(exch, VFS_IN_RESIZE, file, LOWER32(length),
+ * @return              EOK on success or a negative error code
+ */
+int vfs_resize(int file, aoff64_t length)
+{
+	async_exch_t *exch = vfs_exchange_begin();
+	int rc = async_req_3_0(exch, VFS_IN_RESIZE, file, LOWER32(length),
 	    UPPER32(length));
 	vfs_exchange_end(exch);
@@ -1000,20 +976,16 @@
 /** Return a new file handle representing the local root
  *
- * @return      A clone of the local root file handle or -1
+ * @return      A clone of the local root file handle or a negative error code
  */
 int vfs_root(void)
 {
-	fibril_mutex_lock(&root_mutex);
-	int fd;
-	if (root_fd < 0) {
-		fd = -1;
-	} else {
-		errno_t rc = vfs_clone(root_fd, -1, true, &fd);
-		if (rc != EOK) {
-			fd = -1;
-		}
-	}
+	fibril_mutex_lock(&root_mutex);	
+	int r;
+	if (root_fd < 0)
+		r = ENOENT;
+	else
+		r = vfs_clone(root_fd, -1, true);
 	fibril_mutex_unlock(&root_mutex);
-	return fd;
+	return r;
 }
 
@@ -1025,22 +997,12 @@
  *
  * @param nroot The new local root file handle
- *
- * @return  Error code
- */
-errno_t vfs_root_set(int nroot)
-{
-	int new_root;
-	errno_t rc = vfs_clone(nroot, -1, true, &new_root);
-	if (rc != EOK) {
-		return rc;
-	}
-
+ */
+void vfs_root_set(int nroot)
+{
 	fibril_mutex_lock(&root_mutex);
 	if (root_fd >= 0)
 		vfs_put(root_fd);
-	root_fd = new_root;
+	root_fd = vfs_clone(nroot, -1, true);
 	fibril_mutex_unlock(&root_mutex);
-
-	return EOK;
 }
 
@@ -1050,9 +1012,9 @@
  * @param[out] stat     Place to store file information
  *
- * @return              EOK on success or an error code
- */
-errno_t vfs_stat(int file, vfs_stat_t *stat)
-{
-	errno_t rc;
+ * @return              EOK on success or a negative error code
+ */
+int vfs_stat(int file, struct stat *stat)
+{
+	sysarg_t rc;
 	aid_t req;
 	
@@ -1060,9 +1022,9 @@
 	
 	req = async_send_1(exch, VFS_IN_STAT, file, NULL);
-	rc = async_data_read_start(exch, (void *) stat, sizeof(vfs_stat_t));
+	rc = async_data_read_start(exch, (void *) stat, sizeof(struct stat));
 	if (rc != EOK) {
 		vfs_exchange_end(exch);
 		
-		errno_t rc_orig;
+		sysarg_t rc_orig;
 		async_wait_for(req, &rc_orig);
 		
@@ -1084,14 +1046,13 @@
  * @param[out] stat     Place to store file information
  *
- * @return              EOK on success or an error code
- */
-errno_t vfs_stat_path(const char *path, vfs_stat_t *stat)
-{
-	int file;
-	errno_t rc = vfs_lookup(path, 0, &file);
-	if (rc != EOK)
-		return rc;
-	
-	rc = vfs_stat(file, stat);
+ * @return              EOK on success or a negative error code
+ */
+int vfs_stat_path(const char *path, struct stat *stat)
+{
+	int file = vfs_lookup(path, 0);
+	if (file < 0)
+		return file;
+	
+	int rc = vfs_stat(file, stat);
 
 	vfs_put(file);
@@ -1105,9 +1066,9 @@
  * @param[out] st       Buffer for storing information
  *
- * @return              EOK on success or an error code
- */
-errno_t vfs_statfs(int file, vfs_statfs_t *st)
-{
-	errno_t rc, ret;
+ * @return              EOK on success or a negative error code
+ */
+int vfs_statfs(int file, struct statfs *st)
+{
+	sysarg_t rc, ret;
 	aid_t req;
 
@@ -1130,14 +1091,13 @@
  * @param[out] st       Buffer for storing information
  *
- * @return              EOK on success or an error code
- */
-errno_t vfs_statfs_path(const char *path, vfs_statfs_t *st)
-{
-	int file;
-	errno_t rc = vfs_lookup(path, 0, &file);
-	if (rc != EOK)
-		return rc;
-	
-	rc = vfs_statfs(file, st);
+ * @return              EOK on success or a negative error code
+ */
+int vfs_statfs_path(const char *path, struct statfs *st)
+{
+	int file = vfs_lookup(path, 0);
+	if (file < 0)
+		return file;
+	
+	int rc = vfs_statfs(file, st);
 
 	vfs_put(file);
@@ -1150,10 +1110,10 @@
  * @param file  File handle to synchronize
  *
- * @return      EOK on success or an error code
- */
-errno_t vfs_sync(int file)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_1_0(exch, VFS_IN_SYNC, file);
+ * @return      EOK on success or a negative error code
+ */
+int vfs_sync(int file)
+{
+	async_exch_t *exch = vfs_exchange_begin();
+	int rc = async_req_1_0(exch, VFS_IN_SYNC, file);
 	vfs_exchange_end(exch);
 	
@@ -1172,9 +1132,9 @@
  * @param expect        File handle of the unlinked child
  *
- * @return              EOK on success or an error code
- */
-errno_t vfs_unlink(int parent, const char *child, int expect)
-{
-	errno_t rc;
+ * @return              EOK on success or a negative error code
+ */
+int vfs_unlink(int parent, const char *child, int expect)
+{
+	sysarg_t rc;
 	aid_t req;
 	
@@ -1186,9 +1146,9 @@
 	vfs_exchange_end(exch);
 	
-	errno_t rc_orig;
+	sysarg_t rc_orig;
 	async_wait_for(req, &rc_orig);
 	
 	if (rc_orig != EOK)
-		return (errno_t) rc_orig;
+		return (int) rc_orig;
 	return rc;
 }
@@ -1201,22 +1161,20 @@
  * @param path          Old path to be unlinked
  *
- * @return              EOK on success or an error code
- */
-errno_t vfs_unlink_path(const char *path)
-{
-	int expect;
-	errno_t rc = vfs_lookup(path, 0, &expect);
-	if (rc != EOK)
-		return rc;
+ * @return              EOK on success or a negative error code
+ */
+int vfs_unlink_path(const char *path)
+{
+	int expect = vfs_lookup(path, 0);
+	if (expect < 0)
+		return expect;
 
 	char *child;
-	int parent;
-	rc = get_parent_and_child(path, &parent, &child);
-	if (rc != EOK) {
+	int parent = get_parent_and_child(path, &child);
+	if (parent < 0) {
 		vfs_put(expect);
-		return rc;
-	}
-
-	rc = vfs_unlink(parent, child, expect);
+		return parent;
+	}
+
+	int rc = vfs_unlink(parent, child, expect);
 	
 	free(child);
@@ -1230,10 +1188,10 @@
  * @param mp    File handle representing the mount-point
  *
- * @return      EOK on success or an error code
- */
-errno_t vfs_unmount(int mp)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_1_0(exch, VFS_IN_UNMOUNT, mp);
+ * @return      EOK on success or a negative error code
+ */
+int vfs_unmount(int mp)
+{
+	async_exch_t *exch = vfs_exchange_begin();
+	int rc = async_req_1_0(exch, VFS_IN_UNMOUNT, mp);
 	vfs_exchange_end(exch);
 	return rc;
@@ -1244,14 +1202,13 @@
  * @param mpp   Mount-point path
  *
- * @return      EOK on success or an error code
- */
-errno_t vfs_unmount_path(const char *mpp)
-{
-	int mp;
-	errno_t rc = vfs_lookup(mpp, WALK_MOUNT_POINT | WALK_DIRECTORY, &mp);
-	if (rc != EOK)
-		return rc;
-	
-	rc = vfs_unmount(mp);
+ * @return      EOK on success or a negative error code
+ */
+int vfs_unmount_path(const char *mpp)
+{
+	int mp = vfs_lookup(mpp, WALK_MOUNT_POINT | WALK_DIRECTORY);
+	if (mp < 0)
+		return mp;
+	
+	int rc = vfs_unmount(mp);
 	vfs_put(mp);
 	return rc;
@@ -1263,9 +1220,9 @@
  * @param path          Parent-relative path to be walked
  * @param flags         Flags influencing the walk
- * @param[out] handle   File handle representing the result on success.
- *
- * @return              Error code.
- */
-errno_t vfs_walk(int parent, const char *path, int flags, int *handle)
+ *
+ * @retrun              File handle representing the result on success or
+ *                      a negative error code on error
+ */
+int vfs_walk(int parent, const char *path, int flags)
 {
 	async_exch_t *exch = vfs_exchange_begin();
@@ -1273,18 +1230,17 @@
 	ipc_call_t answer;
 	aid_t req = async_send_2(exch, VFS_IN_WALK, parent, flags, &answer);
-	errno_t rc = async_data_write_start(exch, path, str_size(path));
+	sysarg_t rc = async_data_write_start(exch, path, str_size(path));
 	vfs_exchange_end(exch);
 		
-	errno_t rc_orig;
+	sysarg_t rc_orig;
 	async_wait_for(req, &rc_orig);
 
 	if (rc_orig != EOK)
-		return (errno_t) rc_orig;
+		return (int) rc_orig;
 		
 	if (rc != EOK)
-		return (errno_t) rc;
-	
-	*handle = (int) IPC_GET_ARG1(answer);
-	return EOK;
+		return (int) rc;
+	
+	return (int) IPC_GET_ARG1(answer);
 }
 
@@ -1304,5 +1260,5 @@
  * @return              On failure, an error code
  */
-errno_t vfs_write(int file, aoff64_t *pos, const void *buf, size_t nbyte,
+int vfs_write(int file, aoff64_t *pos, const void *buf, size_t nbyte,
     size_t *nwritten)
 {
@@ -1310,5 +1266,5 @@
 	ssize_t nwr = 0;
 	const uint8_t *bp = (uint8_t *) buf;
-	errno_t rc;
+	int rc;
 
 	do {
@@ -1341,10 +1297,10 @@
  * @param[out] nread    Actual number of bytes written (0 or more)
  *
- * @return              EOK on success or an error code
- */
-errno_t vfs_write_short(int file, aoff64_t pos, const void *buf, size_t nbyte,
+ * @return              EOK on success or a negative error code
+ */
+int vfs_write_short(int file, aoff64_t pos, const void *buf, size_t nbyte,
     ssize_t *nwritten)
 {
-	errno_t rc;
+	sysarg_t rc;
 	ipc_call_t answer;
 	aid_t req;
Index: uspace/lib/c/generic/vol.c
===================================================================
--- uspace/lib/c/generic/vol.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/generic/vol.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,9 +48,9 @@
  *             cannot be contacted.
  */
-errno_t vol_create(vol_t **rvol)
+int vol_create(vol_t **rvol)
 {
 	vol_t *vol;
 	service_id_t vol_svcid;
-	errno_t rc;
+	int rc;
 
 	vol = calloc(1, sizeof(vol_t));
@@ -101,7 +101,7 @@
  * @param act_size Place to store actual size of complete data.
  *
- * @return EOK on success or an error code.
- */
-static errno_t vol_get_ids_once(vol_t *vol, sysarg_t method, sysarg_t arg1,
+ * @return EOK on success or negative error code.
+ */
+static int vol_get_ids_once(vol_t *vol, sysarg_t method, sysarg_t arg1,
     sysarg_t *id_buf, size_t buf_size, size_t *act_size)
 {
@@ -110,5 +110,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_1(exch, method, arg1, &answer);
-	errno_t rc = async_data_read_start(exch, id_buf, buf_size);
+	int rc = async_data_read_start(exch, id_buf, buf_size);
 
 	async_exchange_end(exch);
@@ -119,5 +119,5 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
@@ -139,7 +139,7 @@
  * @param data   Place to store pointer to array of IDs
  * @param count  Place to store number of IDs
- * @return       EOK on success or an error code
- */
-static errno_t vol_get_ids_internal(vol_t *vol, sysarg_t method, sysarg_t arg1,
+ * @return       EOK on success or negative error code
+ */
+static int vol_get_ids_internal(vol_t *vol, sysarg_t method, sysarg_t arg1,
     sysarg_t **data, size_t *count)
 {
@@ -148,5 +148,5 @@
 
 	size_t act_size = 0;
-	errno_t rc = vol_get_ids_once(vol, method, arg1, NULL, 0, &act_size);
+	int rc = vol_get_ids_once(vol, method, arg1, NULL, 0, &act_size);
 	if (rc != EOK)
 		return rc;
@@ -183,7 +183,7 @@
  * @param count Place to store length of array (number of entries)
  *
- * @return EOK on success or an error code
- */
-errno_t vol_get_parts(vol_t *vol, service_id_t **data, size_t *count)
+ * @return EOK on success or negative error code
+ */
+int vol_get_parts(vol_t *vol, service_id_t **data, size_t *count)
 {
 	return vol_get_ids_internal(vol, VOL_GET_PARTS, 0, data, count);
@@ -196,8 +196,8 @@
  * until it is discovered.
  */
-errno_t vol_part_add(vol_t *vol, service_id_t sid)
-{
-	async_exch_t *exch;
-	errno_t retval;
+int vol_part_add(vol_t *vol, service_id_t sid)
+{
+	async_exch_t *exch;
+	int retval;
 
 	exch = async_exchange_begin(vol->sess);
@@ -212,13 +212,13 @@
 
 /** Get partition information. */
-errno_t vol_part_info(vol_t *vol, service_id_t sid, vol_part_info_t *vinfo)
-{
-	async_exch_t *exch;
-	errno_t retval;
+int vol_part_info(vol_t *vol, service_id_t sid, vol_part_info_t *vinfo)
+{
+	async_exch_t *exch;
+	sysarg_t retval;
 	ipc_call_t answer;
 
 	exch = async_exchange_begin(vol->sess);
 	aid_t req = async_send_1(exch, VOL_PART_INFO, sid, &answer);
-	errno_t rc = async_data_read_start(exch, vinfo, sizeof(vol_part_info_t));
+	int rc = async_data_read_start(exch, vinfo, sizeof(vol_part_info_t));
 	async_exchange_end(exch);
 
@@ -237,8 +237,8 @@
 /** Erase partition (to the extent where we will consider it not containing
  * a file system. */
-errno_t vol_part_empty(vol_t *vol, service_id_t sid)
-{
-	async_exch_t *exch;
-	errno_t retval;
+int vol_part_empty(vol_t *vol, service_id_t sid)
+{
+	async_exch_t *exch;
+	int retval;
 
 	exch = async_exchange_begin(vol->sess);
@@ -253,14 +253,14 @@
 
 /** Get volume label support. */
-errno_t vol_part_get_lsupp(vol_t *vol, vol_fstype_t fstype,
+int vol_part_get_lsupp(vol_t *vol, vol_fstype_t fstype,
     vol_label_supp_t *vlsupp)
 {
 	async_exch_t *exch;
-	errno_t retval;
+	sysarg_t retval;
 	ipc_call_t answer;
 
 	exch = async_exchange_begin(vol->sess);
 	aid_t req = async_send_1(exch, VOL_PART_LSUPP, fstype, &answer);
-	errno_t rc = async_data_read_start(exch, vlsupp, sizeof(vol_label_supp_t));
+	int rc = async_data_read_start(exch, vlsupp, sizeof(vol_label_supp_t));
 	async_exchange_end(exch);
 
@@ -278,10 +278,10 @@
 
 /** Create file system. */
-errno_t vol_part_mkfs(vol_t *vol, service_id_t sid, vol_fstype_t fstype,
+int vol_part_mkfs(vol_t *vol, service_id_t sid, vol_fstype_t fstype,
     const char *label)
 {
 	async_exch_t *exch;
 	ipc_call_t answer;
-	errno_t retval;
+	sysarg_t retval;
 
 	exch = async_exchange_begin(vol->sess);
Index: uspace/lib/c/include/adt/circ_buf.h
===================================================================
--- uspace/lib/c/include/adt/circ_buf.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/adt/circ_buf.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #define LIBC_CIRC_BUF_H_
 
-#include <errno.h>
 #include <stddef.h>
 
@@ -58,6 +57,6 @@
 extern size_t circ_buf_nfree(circ_buf_t *);
 extern size_t circ_buf_nused(circ_buf_t *);
-extern errno_t circ_buf_push(circ_buf_t *, const void *);
-extern errno_t circ_buf_pop(circ_buf_t *, void *);
+extern int circ_buf_push(circ_buf_t *, const void *);
+extern int circ_buf_pop(circ_buf_t *, void *);
 
 #endif
Index: uspace/lib/c/include/adt/hash_table.h
===================================================================
--- uspace/lib/c/include/adt/hash_table.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/adt/hash_table.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -84,6 +84,6 @@
 	member_to_inst((item), type, member)
 
-extern bool hash_table_create(hash_table_t *, size_t, size_t,
-    hash_table_ops_t *);
+extern bool hash_table_create(hash_table_t *, size_t, size_t, 
+	hash_table_ops_t *);
 extern void hash_table_destroy(hash_table_t *);
 
@@ -98,6 +98,6 @@
 extern size_t hash_table_remove(hash_table_t *, void *);
 extern void hash_table_remove_item(hash_table_t *, ht_link_t *);
-extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *),
-    void *);
+extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *), 
+	void *);
 
 
Index: uspace/lib/c/include/adt/odict.h
===================================================================
--- uspace/lib/c/include/adt/odict.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/adt/odict.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #define LIBC_ODICT_H_
 
-#include <errno.h>
 #include <stdbool.h>
 #include <stddef.h>
@@ -62,5 +61,5 @@
 extern odlink_t *odict_find_leq(odict_t *, void *, odlink_t *);
 extern odlink_t *odict_find_lt(odict_t *, void *, odlink_t *);
-extern errno_t odict_validate(odict_t *);
+extern int odict_validate(odict_t *);
 
 #endif
Index: uspace/lib/c/include/arg_parse.h
===================================================================
--- uspace/lib/c/include/arg_parse.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/arg_parse.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,12 +36,10 @@
 #define LIBC_ARG_PARSE_H_
 
-#include <errno.h>
-
-typedef errno_t (*arg_parser)(const char *, int *);
+typedef int (*arg_parser)(const char *, int *);
 
 extern int arg_parse_short_long(const char *, const char *, const char *);
-extern errno_t arg_parse_int(int, char **, int *, int *, int);
-extern errno_t arg_parse_name_int(int, char **, int *, int *, int, arg_parser);
-extern errno_t arg_parse_string(int, char **, int *, char **, int);
+extern int arg_parse_int(int, char **, int *, int *, int);
+extern int arg_parse_name_int(int, char **, int *, int *, int, arg_parser);
+extern int arg_parse_string(int, char **, int *, char **, int);
 
 #endif
Index: uspace/lib/c/include/as.h
===================================================================
--- uspace/lib/c/include/as.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/as.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,9 +57,9 @@
 extern void *as_area_create(void *, size_t, unsigned int,
     as_area_pager_info_t *);
-extern errno_t as_area_resize(void *, size_t, unsigned int);
-extern errno_t as_area_change_flags(void *, unsigned int);
-extern errno_t as_area_destroy(void *);
+extern int as_area_resize(void *, size_t, unsigned int);
+extern int as_area_change_flags(void *, unsigned int);
+extern int as_area_destroy(void *);
 extern void *set_maxheapsize(size_t);
-extern errno_t as_get_physical_mapping(const void *, uintptr_t *);
+extern int as_get_physical_mapping(const void *, uintptr_t *);
 
 #endif
Index: uspace/lib/c/include/assert.h
===================================================================
--- uspace/lib/c/include/assert.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/assert.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,20 +34,8 @@
  */
 
-// XXX: The definition of `assert()` is not guarded.
-// One must not use `#pragma once` in this header.
-// This is in accordance with the C standard.
-
 #ifndef LIBC_ASSERT_H_
 #define LIBC_ASSERT_H_
 
 #define static_assert(expr)	_Static_assert(expr, "")
-
-extern void __helenos_assert_abort(const char *, const char *, unsigned int)
-    __attribute__((noreturn));
-
-extern void __helenos_assert_quick_abort(const char *, const char *, unsigned int)
-    __attribute__((noreturn));
-
-#endif
 
 /** Debugging assert macro
@@ -61,23 +49,22 @@
  */
 
-#undef assert
+#ifndef NDEBUG
 
-#ifndef NDEBUG
-	#define assert(expr) ((expr) ? (void) 0 : __helenos_assert_abort(#expr, __FILE__, __LINE__))
-#else
-	#define assert(expr) ((void) 0)
+#define assert(expr) \
+	do { \
+		if (!(expr)) \
+			assert_abort(#expr, __FILE__, __LINE__); \
+	} while (0)
+
+#else /* NDEBUG */
+
+#define assert(expr)
+
+#endif /* NDEBUG */
+
+extern void assert_abort(const char *, const char *, unsigned int)
+    __attribute__((noreturn));
+
 #endif
-
-#ifdef _HELENOS_SOURCE
-
-#undef safe_assert
-
-#ifndef NDEBUG
-	#define safe_assert(expr) ((expr) ? (void) 0 : __helenos_assert_quick_abort(#expr, __FILE__, __LINE__))
-#else
-	#define safe_assert(expr) ((void) 0)
-#endif
-
-#endif /* _HELENOS_SOURCE */
 
 /** @}
Index: uspace/lib/c/include/async.h
===================================================================
--- uspace/lib/c/include/async.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/async.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,5 +34,5 @@
 
 #if ((defined(LIBC_IPC_H_)) && (!defined(LIBC_ASYNC_C_)))
-#error Do not intermix low-level IPC interface and async framework
+	#error Do not intermix low-level IPC interface and async framework
 #endif
 
@@ -146,6 +146,6 @@
     sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
 
-extern void async_wait_for(aid_t, errno_t *);
-extern errno_t async_wait_timeout(aid_t, errno_t *, suseconds_t);
+extern void async_wait_for(aid_t, sysarg_t *);
+extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
 extern void async_forget(aid_t);
 
@@ -162,22 +162,22 @@
 extern void async_put_client_data_by_id(task_id_t);
 
-extern errno_t async_create_port(iface_t, async_port_handler_t, void *,
+extern int async_create_port(iface_t, async_port_handler_t, void *,
     port_id_t *);
 extern void async_set_fallback_port_handler(async_port_handler_t, void *);
-extern errno_t async_create_callback_port(async_exch_t *, iface_t, sysarg_t,
+extern int async_create_callback_port(async_exch_t *, iface_t, sysarg_t,
     sysarg_t, async_port_handler_t, void *, port_id_t *);
 
-extern errno_t async_irq_subscribe(int, async_notification_handler_t, void *,
-    const irq_code_t *, cap_handle_t *);
-extern errno_t async_irq_unsubscribe(cap_handle_t);
-
-extern errno_t async_event_subscribe(event_type_t, async_notification_handler_t,
+extern int async_irq_subscribe(int, async_notification_handler_t, void *,
+    const irq_code_t *);
+extern int async_irq_unsubscribe(int);
+
+extern int async_event_subscribe(event_type_t, async_notification_handler_t,
     void *);
-extern errno_t async_event_task_subscribe(event_task_type_t,
+extern int async_event_task_subscribe(event_task_type_t,
     async_notification_handler_t, void *);
-extern errno_t async_event_unsubscribe(event_type_t);
-extern errno_t async_event_task_unsubscribe(event_task_type_t);
-extern errno_t async_event_unmask(event_type_t);
-extern errno_t async_event_task_unmask(event_task_type_t);
+extern int async_event_unsubscribe(event_type_t);
+extern int async_event_task_unsubscribe(event_task_type_t);
+extern int async_event_unmask(event_type_t);
+extern int async_event_task_unmask(event_task_type_t);
 
 /*
@@ -198,12 +198,12 @@
  */
 
-extern errno_t async_answer_0(cap_handle_t, errno_t);
-extern errno_t async_answer_1(cap_handle_t, errno_t, sysarg_t);
-extern errno_t async_answer_2(cap_handle_t, errno_t, sysarg_t, sysarg_t);
-extern errno_t async_answer_3(cap_handle_t, errno_t, sysarg_t, sysarg_t,
+extern sysarg_t async_answer_0(cap_handle_t, sysarg_t);
+extern sysarg_t async_answer_1(cap_handle_t, sysarg_t, sysarg_t);
+extern sysarg_t async_answer_2(cap_handle_t, sysarg_t, sysarg_t, sysarg_t);
+extern sysarg_t async_answer_3(cap_handle_t, sysarg_t, sysarg_t, sysarg_t,
     sysarg_t);
-extern errno_t async_answer_4(cap_handle_t, errno_t, sysarg_t, sysarg_t,
+extern sysarg_t async_answer_4(cap_handle_t, sysarg_t, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t);
-extern errno_t async_answer_5(cap_handle_t, errno_t, sysarg_t, sysarg_t,
+extern sysarg_t async_answer_5(cap_handle_t, sysarg_t, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t, sysarg_t);
 
@@ -212,7 +212,7 @@
  */
 
-extern errno_t async_forward_fast(cap_handle_t, async_exch_t *, sysarg_t, sysarg_t,
+extern int async_forward_fast(cap_handle_t, async_exch_t *, sysarg_t, sysarg_t,
     sysarg_t, unsigned int);
-extern errno_t async_forward_slow(cap_handle_t, async_exch_t *, sysarg_t, sysarg_t,
+extern int async_forward_slow(cap_handle_t, async_exch_t *, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
 
@@ -338,8 +338,8 @@
 	    rc3, rc4, rc5)
 
-extern errno_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
+extern sysarg_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
     sysarg_t *);
-extern errno_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
+extern sysarg_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
     sysarg_t *, sysarg_t *);
@@ -355,7 +355,7 @@
 extern async_sess_t *async_connect_kbox(task_id_t);
 
-extern errno_t async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
-
-extern errno_t async_hangup(async_sess_t *);
+extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
+
+extern int async_hangup(async_sess_t *);
 extern void async_poke(void);
 
@@ -382,12 +382,12 @@
 	async_share_in_start(exch, size, arg, flags, dst)
 
-extern errno_t async_share_in_start(async_exch_t *, size_t, sysarg_t,
+extern int async_share_in_start(async_exch_t *, size_t, sysarg_t,
     unsigned int *, void **);
 extern bool async_share_in_receive(cap_handle_t *, size_t *);
-extern errno_t async_share_in_finalize(cap_handle_t, void *, unsigned int);
-
-extern errno_t async_share_out_start(async_exch_t *, void *, unsigned int);
+extern int async_share_in_finalize(cap_handle_t, void *, unsigned int);
+
+extern int async_share_out_start(async_exch_t *, void *, unsigned int);
 extern bool async_share_out_receive(cap_handle_t *, size_t *, unsigned int *);
-extern errno_t async_share_out_finalize(cap_handle_t, void **);
+extern int async_share_out_finalize(cap_handle_t, void **);
 
 /*
@@ -422,10 +422,10 @@
 
 extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
-extern errno_t async_data_read_start(async_exch_t *, void *, size_t);
+extern int async_data_read_start(async_exch_t *, void *, size_t);
 extern bool async_data_read_receive(cap_handle_t *, size_t *);
 extern bool async_data_read_receive_call(cap_handle_t *, ipc_call_t *, size_t *);
-extern errno_t async_data_read_finalize(cap_handle_t, const void *, size_t);
-
-extern errno_t async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
+extern int async_data_read_finalize(cap_handle_t, const void *, size_t);
+
+extern int async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
 
@@ -461,14 +461,14 @@
 	    answer)
 
-extern errno_t async_data_write_start(async_exch_t *, const void *, size_t);
+extern int async_data_write_start(async_exch_t *, const void *, size_t);
 extern bool async_data_write_receive(cap_handle_t *, size_t *);
 extern bool async_data_write_receive_call(cap_handle_t *, ipc_call_t *, size_t *);
-extern errno_t async_data_write_finalize(cap_handle_t, void *, size_t);
-
-extern errno_t async_data_write_accept(void **, const bool, const size_t,
+extern int async_data_write_finalize(cap_handle_t, void *, size_t);
+
+extern int async_data_write_accept(void **, const bool, const size_t,
     const size_t, const size_t, size_t *);
-extern void async_data_write_void(errno_t);
-
-extern errno_t async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
+extern void async_data_write_void(sysarg_t);
+
+extern int async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
 
@@ -476,9 +476,9 @@
 extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
 
-extern errno_t async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
+extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
     sysarg_t, async_exch_t *);
 extern bool async_state_change_receive(cap_handle_t *, sysarg_t *, sysarg_t *,
     sysarg_t *);
-extern errno_t async_state_change_finalize(cap_handle_t, async_exch_t *);
+extern int async_state_change_finalize(cap_handle_t, async_exch_t *);
 
 extern void *async_remote_state_acquire(async_sess_t *);
Index: uspace/lib/c/include/bd.h
===================================================================
--- uspace/lib/c/include/bd.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/bd.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,12 +43,12 @@
 } bd_t;
 
-extern errno_t bd_open(async_sess_t *, bd_t **);
+extern int bd_open(async_sess_t *, bd_t **);
 extern void bd_close(bd_t *);
-extern errno_t bd_read_blocks(bd_t *, aoff64_t, size_t, void *, size_t);
-extern errno_t bd_read_toc(bd_t *, uint8_t, void *, size_t);
-extern errno_t bd_write_blocks(bd_t *, aoff64_t, size_t, const void *, size_t);
-extern errno_t bd_sync_cache(bd_t *, aoff64_t, size_t);
-extern errno_t bd_get_block_size(bd_t *, size_t *);
-extern errno_t bd_get_num_blocks(bd_t *, aoff64_t *);
+extern int bd_read_blocks(bd_t *, aoff64_t, size_t, void *, size_t);
+extern int bd_read_toc(bd_t *, uint8_t, void *, size_t);
+extern int bd_write_blocks(bd_t *, aoff64_t, size_t, const void *, size_t);
+extern int bd_sync_cache(bd_t *, aoff64_t, size_t);
+extern int bd_get_block_size(bd_t *, size_t *);
+extern int bd_get_num_blocks(bd_t *, aoff64_t *);
 
 #endif
Index: uspace/lib/c/include/bd_srv.h
===================================================================
--- uspace/lib/c/include/bd_srv.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/bd_srv.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,17 +58,17 @@
 
 struct bd_ops {
-	errno_t (*open)(bd_srvs_t *, bd_srv_t *);
-	errno_t (*close)(bd_srv_t *);
-	errno_t (*read_blocks)(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-	errno_t (*read_toc)(bd_srv_t *, uint8_t, void *, size_t);
-	errno_t (*sync_cache)(bd_srv_t *, aoff64_t, size_t);
-	errno_t (*write_blocks)(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
-	errno_t (*get_block_size)(bd_srv_t *, size_t *);
-	errno_t (*get_num_blocks)(bd_srv_t *, aoff64_t *);
+	int (*open)(bd_srvs_t *, bd_srv_t *);
+	int (*close)(bd_srv_t *);
+	int (*read_blocks)(bd_srv_t *, aoff64_t, size_t, void *, size_t);
+	int (*read_toc)(bd_srv_t *, uint8_t, void *, size_t);
+	int (*sync_cache)(bd_srv_t *, aoff64_t, size_t);
+	int (*write_blocks)(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
+	int (*get_block_size)(bd_srv_t *, size_t *);
+	int (*get_num_blocks)(bd_srv_t *, aoff64_t *);
 };
 
 extern void bd_srvs_init(bd_srvs_t *);
 
-extern errno_t bd_conn(ipc_callid_t, ipc_call_t *, bd_srvs_t *);
+extern int bd_conn(ipc_callid_t, ipc_call_t *, bd_srvs_t *);
 
 #endif
Index: uspace/lib/c/include/cap.h
===================================================================
--- uspace/lib/c/include/cap.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/cap.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -90,9 +90,9 @@
 } cap_spec_t;
 
-extern errno_t cap_format(cap_spec_t *, char **);
-extern errno_t cap_parse(const char *, cap_spec_t *);
+extern int cap_format(cap_spec_t *, char **);
+extern int cap_parse(const char *, cap_spec_t *);
 extern void cap_simplify(cap_spec_t *);
 extern void cap_from_blocks(uint64_t, size_t, cap_spec_t *);
-extern errno_t cap_to_blocks(cap_spec_t *, cap_vsel_t, size_t, uint64_t *);
+extern int cap_to_blocks(cap_spec_t *, cap_vsel_t, size_t, uint64_t *);
 
 #endif
Index: uspace/lib/c/include/clipboard.h
===================================================================
--- uspace/lib/c/include/clipboard.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/clipboard.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,6 +36,6 @@
 #define LIBC_CLIPBOARD_H_
 
-extern errno_t clipboard_put_str(const char *);
-extern errno_t clipboard_get_str(char **);
+extern int clipboard_put_str(const char *);
+extern int clipboard_get_str(char **);
 
 #endif
Index: uspace/lib/c/include/corecfg.h
===================================================================
--- uspace/lib/c/include/corecfg.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/corecfg.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,10 +36,9 @@
 #define LIBC_CORECFG_H_
 
-#include <errno.h>
 #include <stdbool.h>
 
-extern errno_t corecfg_init(void);
-extern errno_t corecfg_set_enable(bool);
-extern errno_t corecfg_get_enable(bool *);
+extern int corecfg_init(void);
+extern int corecfg_set_enable(bool);
+extern int corecfg_get_enable(bool *);
 
 #endif
Index: uspace/lib/c/include/ctype.h
===================================================================
--- uspace/lib/c/include/ctype.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/ctype.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,24 +61,4 @@
 }
 
-static inline int isblank(int c)
-{
-	return c == ' ' || c == '\t';
-}
-
-static inline int iscntrl(int c)
-{
-	return (c >= 0 && c < 0x20) || c == 0x7E;
-}
-
-static inline int isprint(int c)
-{
-	return c >= 0 && c < 0x80 && !iscntrl(c);
-}
-
-static inline int isgraph(int c)
-{
-	return isprint(c) && c != ' ';
-}
-
 static inline int isspace(int c)
 {
@@ -95,16 +75,4 @@
 		return 0;
 	}
-}
-
-static inline int ispunct(int c)
-{
-	return !isspace(c) && !isalnum(c) && isprint(c);
-}
-
-static inline int isxdigit(int c)
-{
-	return isdigit(c) ||
-	    (c >= 'a' && c <= 'f') ||
-	    (c >= 'A' && c <= 'F');
 }
 
Index: uspace/lib/c/include/ddi.h
===================================================================
--- uspace/lib/c/include/ddi.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/ddi.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,22 +54,22 @@
 typedef volatile uint64_t ioport64_t;
 
-extern errno_t physmem_map(uintptr_t, size_t, unsigned int, void **);
-extern errno_t physmem_unmap(void *);
+extern int physmem_map(uintptr_t, size_t, unsigned int, void **);
+extern int physmem_unmap(void *);
 
-extern errno_t dmamem_map(void *, size_t, unsigned int, unsigned int, uintptr_t *);
-extern errno_t dmamem_map_anonymous(size_t, uintptr_t, unsigned int, unsigned int,
+extern int dmamem_map(void *, size_t, unsigned int, unsigned int, uintptr_t *);
+extern int dmamem_map_anonymous(size_t, uintptr_t, unsigned int, unsigned int,
     uintptr_t *, void **);
-extern errno_t dmamem_unmap(void *, size_t);
-extern errno_t dmamem_unmap_anonymous(void *);
+extern int dmamem_unmap(void *, size_t);
+extern int dmamem_unmap_anonymous(void *);
 
-extern errno_t pio_enable_range(addr_range_t *, void **);
-extern errno_t pio_enable_resource(pio_window_t *, hw_resource_t *, void **);
-extern errno_t pio_enable(void *, size_t, void **);
-extern errno_t pio_disable(void *, size_t);
+extern int pio_enable_range(addr_range_t *, void **);
+extern int pio_enable_resource(pio_window_t *, hw_resource_t *, void **);
+extern int pio_enable(void *, size_t, void **);
+extern int pio_disable(void *, size_t);
 
 typedef void (*trace_fnc)(const volatile void *place, uint64_t val,
     volatile void* base, size_t size, void *data, bool write);
 
-extern errno_t pio_trace_enable(void *, size_t, trace_fnc, void *);
+extern int pio_trace_enable(void *, size_t, trace_fnc, void *);
 extern void pio_trace_log(const volatile void *, uint64_t val, bool write);
 extern void pio_trace_disable(void *);
Index: uspace/lib/c/include/device/clock_dev.h
===================================================================
--- uspace/lib/c/include/device/clock_dev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/device/clock_dev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,6 +44,6 @@
 } clock_dev_method_t;
 
-extern errno_t clock_dev_time_get(async_sess_t *, struct tm *);
-extern errno_t clock_dev_time_set(async_sess_t *, struct tm *);
+extern int clock_dev_time_get(async_sess_t *, struct tm *);
+extern int clock_dev_time_set(async_sess_t *, struct tm *);
 
 #endif
Index: uspace/lib/c/include/device/hw_res.h
===================================================================
--- uspace/lib/c/include/device/hw_res.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/device/hw_res.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -116,12 +116,12 @@
 }
 
-extern errno_t hw_res_get_resource_list(async_sess_t *, hw_resource_list_t *);
-extern errno_t hw_res_enable_interrupt(async_sess_t *, int);
-extern errno_t hw_res_disable_interrupt(async_sess_t *, int);
-extern errno_t hw_res_clear_interrupt(async_sess_t *, int);
+extern int hw_res_get_resource_list(async_sess_t *, hw_resource_list_t *);
+extern int hw_res_enable_interrupt(async_sess_t *, int);
+extern int hw_res_disable_interrupt(async_sess_t *, int);
+extern int hw_res_clear_interrupt(async_sess_t *, int);
 
-extern errno_t hw_res_dma_channel_setup(async_sess_t *, unsigned int, uint32_t,
+extern int hw_res_dma_channel_setup(async_sess_t *, unsigned int, uint32_t,
     uint32_t, uint8_t);
-extern errno_t hw_res_dma_channel_remain(async_sess_t *, unsigned, size_t *);
+extern int hw_res_dma_channel_remain(async_sess_t *, unsigned);
 
 #endif
Index: uspace/lib/c/include/device/hw_res_parsed.h
===================================================================
--- uspace/lib/c/include/device/hw_res_parsed.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/device/hw_res_parsed.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -154,7 +154,7 @@
 }
 
-extern errno_t hw_res_list_parse(const pio_window_t *, const hw_resource_list_t *,
+extern int hw_res_list_parse(const pio_window_t *, const hw_resource_list_t *,
     hw_res_list_parsed_t *, int);
-extern errno_t hw_res_get_list_parsed(async_sess_t *, hw_res_list_parsed_t *, int);
+extern int hw_res_get_list_parsed(async_sess_t *, hw_res_list_parsed_t *, int);
 
 #endif
Index: uspace/lib/c/include/device/led_dev.h
===================================================================
--- uspace/lib/c/include/device/led_dev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/device/led_dev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 } led_dev_method_t;
 
-extern errno_t led_dev_color_set(async_sess_t *, pixel_t);
+extern int led_dev_color_set(async_sess_t *, pixel_t);
 
 #endif
Index: uspace/lib/c/include/device/pio_window.h
===================================================================
--- uspace/lib/c/include/device/pio_window.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/device/pio_window.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
 } pio_window_t;
 
-extern errno_t pio_window_get(async_sess_t *, pio_window_t *);
+extern int pio_window_get(async_sess_t *, pio_window_t *);
 
 #endif
Index: uspace/lib/c/include/devman.h
===================================================================
--- uspace/lib/c/include/devman.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/devman.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,10 +46,10 @@
 extern void devman_exchange_end(async_exch_t *);
 
-extern errno_t devman_driver_register(const char *);
-extern errno_t devman_add_function(const char *, fun_type_t, match_id_list_t *,
+extern int devman_driver_register(const char *);
+extern int devman_add_function(const char *, fun_type_t, match_id_list_t *,
     devman_handle_t, devman_handle_t *);
-extern errno_t devman_remove_function(devman_handle_t);
-extern errno_t devman_drv_fun_online(devman_handle_t);
-extern errno_t devman_drv_fun_offline(devman_handle_t);
+extern int devman_remove_function(devman_handle_t);
+extern int devman_drv_fun_online(devman_handle_t);
+extern int devman_drv_fun_offline(devman_handle_t);
 
 extern async_sess_t *devman_device_connect(devman_handle_t, unsigned int);
@@ -57,30 +57,30 @@
     unsigned int);
 
-extern errno_t devman_fun_get_handle(const char *, devman_handle_t *,
+extern int devman_fun_get_handle(const char *, devman_handle_t *,
     unsigned int);
-extern errno_t devman_fun_get_child(devman_handle_t, devman_handle_t *);
-extern errno_t devman_dev_get_parent(devman_handle_t, devman_handle_t *);
-extern errno_t devman_dev_get_functions(devman_handle_t, devman_handle_t **,
+extern int devman_fun_get_child(devman_handle_t, devman_handle_t *);
+extern int devman_dev_get_parent(devman_handle_t, devman_handle_t *);
+extern int devman_dev_get_functions(devman_handle_t, devman_handle_t **,
     size_t *);
-extern errno_t devman_fun_get_match_id(devman_handle_t, size_t, char *, size_t,
+extern int devman_fun_get_match_id(devman_handle_t, size_t, char *, size_t,
     unsigned int *);
-extern errno_t devman_fun_get_name(devman_handle_t, char *, size_t);
-extern errno_t devman_fun_get_driver_name(devman_handle_t, char *, size_t);
-extern errno_t devman_fun_get_path(devman_handle_t, char *, size_t);
-extern errno_t devman_fun_online(devman_handle_t);
-extern errno_t devman_fun_offline(devman_handle_t);
+extern int devman_fun_get_name(devman_handle_t, char *, size_t);
+extern int devman_fun_get_driver_name(devman_handle_t, char *, size_t);
+extern int devman_fun_get_path(devman_handle_t, char *, size_t);
+extern int devman_fun_online(devman_handle_t);
+extern int devman_fun_offline(devman_handle_t);
 
-extern errno_t devman_add_device_to_category(devman_handle_t, const char *);
-extern errno_t devman_fun_sid_to_handle(service_id_t, devman_handle_t *);
-extern errno_t devman_get_drivers(devman_handle_t **, size_t *);
-extern errno_t devman_driver_get_devices(devman_handle_t, devman_handle_t **,
+extern int devman_add_device_to_category(devman_handle_t, const char *);
+extern int devman_fun_sid_to_handle(service_id_t, devman_handle_t *);
+extern int devman_get_drivers(devman_handle_t **, size_t *);
+extern int devman_driver_get_devices(devman_handle_t, devman_handle_t **,
     size_t *);
-extern errno_t devman_driver_get_handle(const char *, devman_handle_t *);
-extern errno_t devman_driver_get_match_id(devman_handle_t, size_t, char *, size_t,
+extern int devman_driver_get_handle(const char *, devman_handle_t *);
+extern int devman_driver_get_match_id(devman_handle_t, size_t, char *, size_t,
     unsigned int *);
-extern errno_t devman_driver_get_name(devman_handle_t, char *, size_t);
-extern errno_t devman_driver_get_state(devman_handle_t, driver_state_t *);
-extern errno_t devman_driver_load(devman_handle_t);
-extern errno_t devman_driver_unload(devman_handle_t);
+extern int devman_driver_get_name(devman_handle_t, char *, size_t);
+extern int devman_driver_get_state(devman_handle_t, driver_state_t *);
+extern int devman_driver_load(devman_handle_t);
+extern int devman_driver_unload(devman_handle_t);
 
 #endif
Index: uspace/lib/c/include/elf/elf_mod.h
===================================================================
--- uspace/lib/c/include/elf/elf_mod.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/elf/elf_mod.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,5 +53,4 @@
 #define EE_LOADER		5	/* The image is actually a program loader. */
 #define EE_IRRECOVERABLE	6
-#define EE_IO			7	/* Could not read file. */
 
 typedef enum {
Index: uspace/lib/c/include/errno.h
===================================================================
--- uspace/lib/c/include/errno.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/errno.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #define LIBC_ERRNO_H_
 
-#include <_bits/errno.h>
 #include <abi/errno.h>
 
Index: uspace/lib/c/include/fibril.h
===================================================================
--- uspace/lib/c/include/fibril.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/fibril.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -71,9 +71,9 @@
 	void *stack;
 	void *arg;
-	errno_t (*func)(void *);
+	int (*func)(void *);
 	tcb_t *tcb;
 	
 	struct fibril *clean_after_me;
-	errno_t retval;
+	int retval;
 	int flags;
 	
@@ -93,5 +93,5 @@
 #define fibril_create(func, arg) \
 	fibril_create_generic((func), (arg), FIBRIL_DFLT_STK_SIZE)
-extern fid_t fibril_create_generic(errno_t (*func)(void *), void *arg, size_t);
+extern fid_t fibril_create_generic(int (*func)(void *), void *arg, size_t);
 extern void fibril_destroy(fid_t fid);
 extern fibril_t *fibril_setup(void);
@@ -102,4 +102,7 @@
 extern void fibril_remove_manager(void);
 extern fid_t fibril_get_id(void);
+extern void fibril_inc_sercount(void);
+extern void fibril_dec_sercount(void);
+extern int fibril_get_sercount(void);
 
 static inline int fibril_yield(void)
Index: uspace/lib/c/include/fibril_synch.h
===================================================================
--- uspace/lib/c/include/fibril_synch.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/fibril_synch.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -159,5 +159,5 @@
 
 extern void fibril_condvar_initialize(fibril_condvar_t *);
-extern errno_t fibril_condvar_wait_timeout(fibril_condvar_t *, fibril_mutex_t *,
+extern int fibril_condvar_wait_timeout(fibril_condvar_t *, fibril_mutex_t *,
     suseconds_t);
 extern void fibril_condvar_wait(fibril_condvar_t *, fibril_mutex_t *);
Index: uspace/lib/c/include/futex.h
===================================================================
--- uspace/lib/c/include/futex.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/futex.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 
 #include <atomic.h>
-#include <errno.h>
 #include <libc.h>
 
@@ -108,9 +107,9 @@
  * @param futex Futex.
  *
- * @return true if the futex was acquired.
- * @return false if the futex was not acquired.
+ * @return Non-zero if the futex was acquired.
+ * @return Zero if the futex was not acquired.
  *
  */
-static inline bool futex_trydown(futex_t *futex)
+static inline int futex_trydown(futex_t *futex)
 {
 	return cas(&futex->val, 1, 0);
@@ -122,14 +121,14 @@
  *
  * @return ENOENT if there is no such virtual address.
- * @return EOK on success.
- * @return Error code from <errno.h> otherwise.
+ * @return Zero in the uncontended case.
+ * @return Otherwise one of ESYNCH_OK_ATOMIC or ESYNCH_OK_BLOCKED.
  *
  */
-static inline errno_t futex_down(futex_t *futex)
+static inline int futex_down(futex_t *futex)
 {
 	if ((atomic_signed_t) atomic_predec(&futex->val) < 0)
-		return (errno_t) __SYSCALL1(SYS_FUTEX_SLEEP, (sysarg_t) &futex->val.count);
+		return __SYSCALL1(SYS_FUTEX_SLEEP, (sysarg_t) &futex->val.count);
 	
-	return EOK;
+	return 0;
 }
 
@@ -139,14 +138,13 @@
  *
  * @return ENOENT if there is no such virtual address.
- * @return EOK on success.
- * @return Error code from <errno.h> otherwise.
+ * @return Zero in the uncontended case.
  *
  */
-static inline errno_t futex_up(futex_t *futex)
+static inline int futex_up(futex_t *futex)
 {
 	if ((atomic_signed_t) atomic_postinc(&futex->val) < 0)
-		return (errno_t) __SYSCALL1(SYS_FUTEX_WAKEUP, (sysarg_t) &futex->val.count);
+		return __SYSCALL1(SYS_FUTEX_WAKEUP, (sysarg_t) &futex->val.count);
 	
-	return EOK;
+	return 0;
 }
 
Index: uspace/lib/c/include/getopt.h
===================================================================
--- uspace/lib/c/include/getopt.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/getopt.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,5 +57,5 @@
 
 /* HelenOS Port - These need to be exposed for legacy getopt() */
-extern char *optarg;
+extern const char *optarg;
 extern int optind, opterr, optopt;
 extern int optreset;
Index: uspace/lib/c/include/gsort.h
===================================================================
--- uspace/lib/c/include/gsort.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/gsort.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include <stdbool.h>
 
-typedef int (*sort_cmp_t)(void *, void *, void *);
+typedef int (* sort_cmp_t)(void *, void *, void *);
 
 extern bool gsort(void *, size_t, size_t, sort_cmp_t, void *);
Index: uspace/lib/c/include/imath.h
===================================================================
--- uspace/lib/c/include/imath.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/imath.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include <stdint.h>
 
-extern errno_t ipow10_u64(unsigned, uint64_t *);
+extern int ipow10_u64(unsigned, uint64_t *);
 extern unsigned ilog10_u64(uint64_t);
 
Index: uspace/lib/c/include/inet/addr.h
===================================================================
--- uspace/lib/c/include/inet/addr.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/addr.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #define LIBC_INET_ADDR_H_
 
-#include <errno.h>
 #include <stdint.h>
 
@@ -112,9 +111,9 @@
 extern int inet_naddr_compare_mask(const inet_naddr_t *, const inet_addr_t *);
 
-extern errno_t inet_addr_parse(const char *, inet_addr_t *, char **);
-extern errno_t inet_naddr_parse(const char *, inet_naddr_t *, char **);
+extern int inet_addr_parse(const char *, inet_addr_t *, char **);
+extern int inet_naddr_parse(const char *, inet_naddr_t *, char **);
 
-extern errno_t inet_addr_format(const inet_addr_t *, char **);
-extern errno_t inet_naddr_format(const inet_naddr_t *, char **);
+extern int inet_addr_format(const inet_addr_t *, char **);
+extern int inet_naddr_format(const inet_naddr_t *, char **);
 
 extern ip_ver_t inet_addr_get(const inet_addr_t *, addr32_t *, addr128_t *);
Index: uspace/lib/c/include/inet/dhcp.h
===================================================================
--- uspace/lib/c/include/inet/dhcp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/dhcp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,8 +38,8 @@
 #include <types/common.h>
 
-extern errno_t dhcp_init(void);
-extern errno_t dhcp_link_add(sysarg_t);
-extern errno_t dhcp_link_remove(sysarg_t);
-extern errno_t dhcp_discover(sysarg_t);
+extern int dhcp_init(void);
+extern int dhcp_link_add(sysarg_t);
+extern int dhcp_link_remove(sysarg_t);
+extern int dhcp_discover(sysarg_t);
 
 #endif
Index: uspace/lib/c/include/inet/dnsr.h
===================================================================
--- uspace/lib/c/include/inet/dnsr.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/dnsr.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,9 +50,9 @@
 } dnsr_hostinfo_t;
 
-extern errno_t dnsr_init(void);
-extern errno_t dnsr_name2host(const char *, dnsr_hostinfo_t **, ip_ver_t);
+extern int dnsr_init(void);
+extern int dnsr_name2host(const char *, dnsr_hostinfo_t **, ip_ver_t);
 extern void dnsr_hostinfo_destroy(dnsr_hostinfo_t *);
-extern errno_t dnsr_get_srvaddr(inet_addr_t *);
-extern errno_t dnsr_set_srvaddr(inet_addr_t *);
+extern int dnsr_get_srvaddr(inet_addr_t *);
+extern int dnsr_set_srvaddr(inet_addr_t *);
 
 #endif
Index: uspace/lib/c/include/inet/host.h
===================================================================
--- uspace/lib/c/include/inet/host.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/host.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,9 +40,9 @@
 #include <types/inet/hostport.h>
 
-extern errno_t inet_host_parse(const char *, inet_host_t **, char **);
-extern errno_t inet_host_format(inet_host_t *, char **);
+extern int inet_host_parse(const char *, inet_host_t **, char **);
+extern int inet_host_format(inet_host_t *, char **);
 extern void inet_host_destroy(inet_host_t *);
-extern errno_t inet_host_lookup_one(inet_host_t *, ip_ver_t, inet_addr_t *);
-extern errno_t inet_host_plookup_one(const char *, ip_ver_t, inet_addr_t *,
+extern int inet_host_lookup_one(inet_host_t *, ip_ver_t, inet_addr_t *);
+extern int inet_host_plookup_one(const char *, ip_ver_t, inet_addr_t *,
     char **, const char **);
 
Index: uspace/lib/c/include/inet/hostname.h
===================================================================
--- uspace/lib/c/include/inet/hostname.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/hostname.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,5 @@
 #define LIBC_INET_HOSTNAME_H_
 
-extern errno_t inet_hostname_parse(const char *, char **, char **);
+extern int inet_hostname_parse(const char *, char **, char **);
 
 #endif
Index: uspace/lib/c/include/inet/hostport.h
===================================================================
--- uspace/lib/c/include/inet/hostport.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/hostport.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,9 +40,9 @@
 #include <types/inet/hostport.h>
 
-extern errno_t inet_hostport_parse(const char *, inet_hostport_t **, char **);
-extern errno_t inet_hostport_format(inet_hostport_t *, char **);
+extern int inet_hostport_parse(const char *, inet_hostport_t **, char **);
+extern int inet_hostport_format(inet_hostport_t *, char **);
 extern void inet_hostport_destroy(inet_hostport_t *);
-extern errno_t inet_hostport_lookup_one(inet_hostport_t *, ip_ver_t, inet_ep_t *);
-extern errno_t inet_hostport_plookup_one(const char *, ip_ver_t, inet_ep_t *,
+extern int inet_hostport_lookup_one(inet_hostport_t *, ip_ver_t, inet_ep_t *);
+extern int inet_hostport_plookup_one(const char *, ip_ver_t, inet_ep_t *,
     char **, const char **);
 
Index: uspace/lib/c/include/inet/inet.h
===================================================================
--- uspace/lib/c/include/inet/inet.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/inet.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,7 +41,7 @@
 #include <types/inet.h>
 
-extern errno_t inet_init(uint8_t, inet_ev_ops_t *);
-extern errno_t inet_send(inet_dgram_t *, uint8_t, inet_df_t);
-extern errno_t inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
+extern int inet_init(uint8_t, inet_ev_ops_t *);
+extern int inet_send(inet_dgram_t *, uint8_t, inet_df_t);
+extern int inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
 
 #endif
Index: uspace/lib/c/include/inet/inetcfg.h
===================================================================
--- uspace/lib/c/include/inet/inetcfg.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/inetcfg.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,20 +40,20 @@
 #include <types/inetcfg.h>
 
-extern errno_t inetcfg_init(void);
-extern errno_t inetcfg_addr_create_static(const char *, inet_naddr_t *, sysarg_t, sysarg_t *);
-extern errno_t inetcfg_addr_delete(sysarg_t);
-extern errno_t inetcfg_addr_get(sysarg_t, inet_addr_info_t *);
-extern errno_t inetcfg_addr_get_id(const char *, sysarg_t, sysarg_t *);
-extern errno_t inetcfg_get_addr_list(sysarg_t **, size_t *);
-extern errno_t inetcfg_get_link_list(sysarg_t **, size_t *);
-extern errno_t inetcfg_get_sroute_list(sysarg_t **, size_t *);
-extern errno_t inetcfg_link_add(sysarg_t);
-extern errno_t inetcfg_link_get(sysarg_t, inet_link_info_t *);
-extern errno_t inetcfg_link_remove(sysarg_t);
-extern errno_t inetcfg_sroute_get(sysarg_t, inet_sroute_info_t *);
-extern errno_t inetcfg_sroute_get_id(const char *, sysarg_t *);
-extern errno_t inetcfg_sroute_create(const char *, inet_naddr_t *, inet_addr_t *,
+extern int inetcfg_init(void);
+extern int inetcfg_addr_create_static(const char *, inet_naddr_t *, sysarg_t, sysarg_t *);
+extern int inetcfg_addr_delete(sysarg_t);
+extern int inetcfg_addr_get(sysarg_t, inet_addr_info_t *);
+extern int inetcfg_addr_get_id(const char *, sysarg_t, sysarg_t *);
+extern int inetcfg_get_addr_list(sysarg_t **, size_t *);
+extern int inetcfg_get_link_list(sysarg_t **, size_t *);
+extern int inetcfg_get_sroute_list(sysarg_t **, size_t *);
+extern int inetcfg_link_add(sysarg_t);
+extern int inetcfg_link_get(sysarg_t, inet_link_info_t *);
+extern int inetcfg_link_remove(sysarg_t);
+extern int inetcfg_sroute_get(sysarg_t, inet_sroute_info_t *);
+extern int inetcfg_sroute_get_id(const char *, sysarg_t *);
+extern int inetcfg_sroute_create(const char *, inet_naddr_t *, inet_addr_t *,
     sysarg_t *);
-extern errno_t inetcfg_sroute_delete(sysarg_t);
+extern int inetcfg_sroute_delete(sysarg_t);
 
 #endif
Index: uspace/lib/c/include/inet/inetping.h
===================================================================
--- uspace/lib/c/include/inet/inetping.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/inetping.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,10 +40,10 @@
 
 typedef struct inetping_ev_ops {
-	errno_t (*recv)(inetping_sdu_t *);
+	int (*recv)(inetping_sdu_t *);
 } inetping_ev_ops_t;
 
-extern errno_t inetping_init(inetping_ev_ops_t *);
-extern errno_t inetping_send(inetping_sdu_t *);
-extern errno_t inetping_get_srcaddr(const inet_addr_t *, inet_addr_t *);
+extern int inetping_init(inetping_ev_ops_t *);
+extern int inetping_send(inetping_sdu_t *);
+extern int inetping_get_srcaddr(const inet_addr_t *, inet_addr_t *);
 
 #endif
Index: uspace/lib/c/include/inet/iplink.h
===================================================================
--- uspace/lib/c/include/inet/iplink.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/iplink.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -78,17 +78,17 @@
 
 typedef struct iplink_ev_ops {
-	errno_t (*recv)(iplink_t *, iplink_recv_sdu_t *, ip_ver_t);
-	errno_t (*change_addr)(iplink_t *, addr48_t);
+	int (*recv)(iplink_t *, iplink_recv_sdu_t *, ip_ver_t);
+	int (*change_addr)(iplink_t *, addr48_t);
 } iplink_ev_ops_t;
 
-extern errno_t iplink_open(async_sess_t *, iplink_ev_ops_t *, void *, iplink_t **);
+extern int iplink_open(async_sess_t *, iplink_ev_ops_t *, void *, iplink_t **);
 extern void iplink_close(iplink_t *);
-extern errno_t iplink_send(iplink_t *, iplink_sdu_t *);
-extern errno_t iplink_send6(iplink_t *, iplink_sdu6_t *);
-extern errno_t iplink_addr_add(iplink_t *, inet_addr_t *);
-extern errno_t iplink_addr_remove(iplink_t *, inet_addr_t *);
-extern errno_t iplink_get_mtu(iplink_t *, size_t *);
-extern errno_t iplink_get_mac48(iplink_t *, addr48_t *);
-extern errno_t iplink_set_mac48(iplink_t *, addr48_t);
+extern int iplink_send(iplink_t *, iplink_sdu_t *);
+extern int iplink_send6(iplink_t *, iplink_sdu6_t *);
+extern int iplink_addr_add(iplink_t *, inet_addr_t *);
+extern int iplink_addr_remove(iplink_t *, inet_addr_t *);
+extern int iplink_get_mtu(iplink_t *, size_t *);
+extern int iplink_get_mac48(iplink_t *, addr48_t *);
+extern int iplink_set_mac48(iplink_t *, addr48_t);
 extern void *iplink_get_userptr(iplink_t *);
 
Index: uspace/lib/c/include/inet/iplink_srv.h
===================================================================
--- uspace/lib/c/include/inet/iplink_srv.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/iplink_srv.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,20 +53,20 @@
 
 typedef struct iplink_ops {
-	errno_t (*open)(iplink_srv_t *);
-	errno_t (*close)(iplink_srv_t *);
-	errno_t (*send)(iplink_srv_t *, iplink_sdu_t *);
-	errno_t (*send6)(iplink_srv_t *, iplink_sdu6_t *);
-	errno_t (*get_mtu)(iplink_srv_t *, size_t *);
-	errno_t (*get_mac48)(iplink_srv_t *, addr48_t *);
-	errno_t (*set_mac48)(iplink_srv_t *, addr48_t *);
-	errno_t (*addr_add)(iplink_srv_t *, inet_addr_t *);
-	errno_t (*addr_remove)(iplink_srv_t *, inet_addr_t *);
+	int (*open)(iplink_srv_t *);
+	int (*close)(iplink_srv_t *);
+	int (*send)(iplink_srv_t *, iplink_sdu_t *);
+	int (*send6)(iplink_srv_t *, iplink_sdu6_t *);
+	int (*get_mtu)(iplink_srv_t *, size_t *);
+	int (*get_mac48)(iplink_srv_t *, addr48_t *);
+	int (*set_mac48)(iplink_srv_t *, addr48_t *);
+	int (*addr_add)(iplink_srv_t *, inet_addr_t *);
+	int (*addr_remove)(iplink_srv_t *, inet_addr_t *);
 } iplink_ops_t;
 
 extern void iplink_srv_init(iplink_srv_t *);
 
-extern errno_t iplink_conn(ipc_callid_t, ipc_call_t *, void *);
-extern errno_t iplink_ev_recv(iplink_srv_t *, iplink_recv_sdu_t *, ip_ver_t);
-extern errno_t iplink_ev_change_addr(iplink_srv_t *, addr48_t *);
+extern int iplink_conn(ipc_callid_t, ipc_call_t *, void *);
+extern int iplink_ev_recv(iplink_srv_t *, iplink_recv_sdu_t *, ip_ver_t);
+extern int iplink_ev_change_addr(iplink_srv_t *, addr48_t *);
 
 #endif
Index: uspace/lib/c/include/inet/tcp.h
===================================================================
--- uspace/lib/c/include/inet/tcp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/tcp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -98,23 +98,23 @@
 } tcp_t;
 
-extern errno_t tcp_create(tcp_t **);
+extern int tcp_create(tcp_t **);
 extern void tcp_destroy(tcp_t *);
-extern errno_t tcp_conn_create(tcp_t *, inet_ep2_t *, tcp_cb_t *, void *,
+extern int tcp_conn_create(tcp_t *, inet_ep2_t *, tcp_cb_t *, void *,
     tcp_conn_t **);
 extern void tcp_conn_destroy(tcp_conn_t *);
 extern void *tcp_conn_userptr(tcp_conn_t *);
-extern errno_t tcp_listener_create(tcp_t *, inet_ep_t *, tcp_listen_cb_t *, void *,
+extern int tcp_listener_create(tcp_t *, inet_ep_t *, tcp_listen_cb_t *, void *,
     tcp_cb_t *, void *, tcp_listener_t **);
 extern void tcp_listener_destroy(tcp_listener_t *);
 extern void *tcp_listener_userptr(tcp_listener_t *);
 
-extern errno_t tcp_conn_wait_connected(tcp_conn_t *);
-extern errno_t tcp_conn_send(tcp_conn_t *, const void *, size_t);
-extern errno_t tcp_conn_send_fin(tcp_conn_t *);
-extern errno_t tcp_conn_push(tcp_conn_t *);
-extern errno_t tcp_conn_reset(tcp_conn_t *);
+extern int tcp_conn_wait_connected(tcp_conn_t *);
+extern int tcp_conn_send(tcp_conn_t *, const void *, size_t);
+extern int tcp_conn_send_fin(tcp_conn_t *);
+extern int tcp_conn_push(tcp_conn_t *);
+extern int tcp_conn_reset(tcp_conn_t *);
 
-extern errno_t tcp_conn_recv(tcp_conn_t *, void *, size_t, size_t *);
-extern errno_t tcp_conn_recv_wait(tcp_conn_t *, void *, size_t, size_t *);
+extern int tcp_conn_recv(tcp_conn_t *, void *, size_t, size_t *);
+extern int tcp_conn_recv_wait(tcp_conn_t *, void *, size_t, size_t *);
 
 
Index: uspace/lib/c/include/inet/udp.h
===================================================================
--- uspace/lib/c/include/inet/udp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inet/udp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -91,14 +91,14 @@
 } udp_t;
 
-extern errno_t udp_create(udp_t **);
+extern int udp_create(udp_t **);
 extern void udp_destroy(udp_t *);
-extern errno_t udp_assoc_create(udp_t *, inet_ep2_t *, udp_cb_t *, void *,
+extern int udp_assoc_create(udp_t *, inet_ep2_t *, udp_cb_t *, void *,
     udp_assoc_t **);
-extern errno_t udp_assoc_set_nolocal(udp_assoc_t *);
+extern int udp_assoc_set_nolocal(udp_assoc_t *);
 extern void udp_assoc_destroy(udp_assoc_t *);
-extern errno_t udp_assoc_send_msg(udp_assoc_t *, inet_ep_t *, void *, size_t);
+extern int udp_assoc_send_msg(udp_assoc_t *, inet_ep_t *, void *, size_t);
 extern void *udp_assoc_userptr(udp_assoc_t *);
 extern size_t udp_rmsg_size(udp_rmsg_t *);
-extern errno_t udp_rmsg_read(udp_rmsg_t *, size_t, void *, size_t);
+extern int udp_rmsg_read(udp_rmsg_t *, size_t, void *, size_t);
 extern void udp_rmsg_remote_ep(udp_rmsg_t *, inet_ep_t *);
 extern uint8_t udp_rerr_type(udp_rerr_t *);
Index: uspace/lib/c/include/inttypes.h
===================================================================
--- uspace/lib/c/include/inttypes.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/inttypes.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,11 +38,4 @@
 #include <_bits/inttypes.h>
 
-#ifndef __HELENOS_DISABLE_INTMAX__
-intmax_t strtoimax(const char *__restrict__ nptr,
-    char **__restrict__ endptr, int base);
-uintmax_t strtoumax(const char *__restrict__ nptr,
-    char **__restrict__ endptr, int base);
-#endif
-
 #endif
 
Index: uspace/lib/c/include/io/chardev.h
===================================================================
--- uspace/lib/c/include/io/chardev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/chardev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,8 +41,8 @@
 } chardev_t;
 
-extern errno_t chardev_open(async_sess_t *, chardev_t **);
+extern int chardev_open(async_sess_t *, chardev_t **);
 extern void chardev_close(chardev_t *);
-extern errno_t chardev_read(chardev_t *, void *, size_t, size_t *);
-extern errno_t chardev_write(chardev_t *, const void *, size_t, size_t *);
+extern int chardev_read(chardev_t *, void *, size_t, size_t *);
+extern int chardev_write(chardev_t *, const void *, size_t, size_t *);
 
 #endif
Index: uspace/lib/c/include/io/chardev_srv.h
===================================================================
--- uspace/lib/c/include/io/chardev_srv.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/chardev_srv.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,8 +57,8 @@
 
 struct chardev_ops {
-	errno_t (*open)(chardev_srvs_t *, chardev_srv_t *);
-	errno_t (*close)(chardev_srv_t *);
-	errno_t (*read)(chardev_srv_t *, void *, size_t, size_t *);
-	errno_t (*write)(chardev_srv_t *, const void *, size_t, size_t *);
+	int (*open)(chardev_srvs_t *, chardev_srv_t *);
+	int (*close)(chardev_srv_t *);
+	int (*read)(chardev_srv_t *, void *, size_t, size_t *);
+	int (*write)(chardev_srv_t *, const void *, size_t, size_t *);
 	void (*def_handler)(chardev_srv_t *, ipc_callid_t, ipc_call_t *);
 };
@@ -66,5 +66,5 @@
 extern void chardev_srvs_init(chardev_srvs_t *);
 
-extern errno_t chardev_conn(ipc_callid_t, ipc_call_t *, chardev_srvs_t *);
+extern int chardev_conn(ipc_callid_t, ipc_call_t *, chardev_srvs_t *);
 
 #endif
Index: uspace/lib/c/include/io/con_srv.h
===================================================================
--- uspace/lib/c/include/io/con_srv.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/con_srv.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -67,14 +67,14 @@
 
 struct con_ops {
-	errno_t (*open)(con_srvs_t *, con_srv_t *);
-	errno_t (*close)(con_srv_t *);
-	errno_t (*read)(con_srv_t *, void *, size_t, size_t *);
-	errno_t (*write)(con_srv_t *, void *, size_t, size_t *);
+	int (*open)(con_srvs_t *, con_srv_t *);
+	int (*close)(con_srv_t *);
+	int (*read)(con_srv_t *, void *, size_t);
+	int (*write)(con_srv_t *, void *, size_t);
 	void (*sync)(con_srv_t *);
 	void (*clear)(con_srv_t *);
 	void (*set_pos)(con_srv_t *, sysarg_t col, sysarg_t row);
-	errno_t (*get_pos)(con_srv_t *, sysarg_t *, sysarg_t *);
-	errno_t (*get_size)(con_srv_t *, sysarg_t *, sysarg_t *);
-	errno_t (*get_color_cap)(con_srv_t *, console_caps_t *);
+	int (*get_pos)(con_srv_t *, sysarg_t *, sysarg_t *);
+	int (*get_size)(con_srv_t *, sysarg_t *, sysarg_t *);
+	int (*get_color_cap)(con_srv_t *, console_caps_t *);
 	void (*set_style)(con_srv_t *, console_style_t);
 	void (*set_color)(con_srv_t *, console_color_t, console_color_t,
@@ -82,10 +82,10 @@
 	void (*set_rgb_color)(con_srv_t *, pixel_t, pixel_t);
 	void (*set_cursor_visibility)(con_srv_t *, bool);
-	errno_t (*get_event)(con_srv_t *, cons_event_t *);
+	int (*get_event)(con_srv_t *, cons_event_t *);
 };
 
 extern void con_srvs_init(con_srvs_t *);
 
-extern errno_t con_conn(ipc_callid_t, ipc_call_t *, con_srvs_t *);
+extern int con_conn(ipc_callid_t, ipc_call_t *, con_srvs_t *);
 
 #endif
Index: uspace/lib/c/include/io/console.h
===================================================================
--- uspace/lib/c/include/io/console.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/console.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -73,6 +73,6 @@
 extern void console_clear(console_ctrl_t *);
 
-extern errno_t console_get_size(console_ctrl_t *, sysarg_t *, sysarg_t *);
-extern errno_t console_get_pos(console_ctrl_t *, sysarg_t *, sysarg_t *);
+extern int console_get_size(console_ctrl_t *, sysarg_t *, sysarg_t *);
+extern int console_get_pos(console_ctrl_t *, sysarg_t *, sysarg_t *);
 extern void console_set_pos(console_ctrl_t *, sysarg_t, sysarg_t);
 
@@ -82,5 +82,5 @@
 
 extern void console_cursor_visibility(console_ctrl_t *, bool);
-extern errno_t console_get_color_cap(console_ctrl_t *, sysarg_t *);
+extern int console_get_color_cap(console_ctrl_t *, sysarg_t *);
 extern bool console_get_event(console_ctrl_t *, cons_event_t *);
 extern bool console_get_event_timeout(console_ctrl_t *, cons_event_t *,
Index: uspace/lib/c/include/io/input.h
===================================================================
--- uspace/lib/c/include/io/input.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/input.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,15 +48,15 @@
 
 typedef struct input_ev_ops {
-	errno_t (*active)(input_t *);
-	errno_t (*deactive)(input_t *);
-	errno_t (*key)(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
-	errno_t (*move)(input_t *, int, int);
-	errno_t (*abs_move)(input_t *, unsigned, unsigned, unsigned, unsigned);
-	errno_t (*button)(input_t *, int, int);
+	int (*active)(input_t *);
+	int (*deactive)(input_t *);
+	int (*key)(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
+	int (*move)(input_t *, int, int);
+	int (*abs_move)(input_t *, unsigned, unsigned, unsigned, unsigned);
+	int (*button)(input_t *, int, int);
 } input_ev_ops_t;
 
-extern errno_t input_open(async_sess_t *, input_ev_ops_t *, void *, input_t **);
+extern int input_open(async_sess_t *, input_ev_ops_t *, void *, input_t **);
 extern void input_close(input_t *);
-extern errno_t input_activate(input_t *);
+extern int input_activate(input_t *);
 
 #endif
Index: uspace/lib/c/include/io/kio.h
===================================================================
--- uspace/lib/c/include/io/kio.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/kio.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,12 +39,10 @@
 #include <stdarg.h>
 #include <io/verify.h>
-#include <_bits/errno.h>
-#include <_bits/size_t.h>
 
-extern errno_t kio_write(const void *, size_t, size_t *);
+extern int kio_write(const void *, size_t, size_t *);
 extern void kio_update(void);
 extern void kio_command(const void *, size_t);
 extern int kio_printf(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
+    PRINTF_ATTRIBUTE(1, 2);
 extern int kio_vprintf(const char *, va_list);
 
Index: uspace/lib/c/include/io/klog.h
===================================================================
--- uspace/lib/c/include/io/klog.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/klog.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,15 +44,20 @@
 #include <abi/log.h>
 
-extern errno_t klog_write(log_level_t, const void *, size_t);
-extern errno_t klog_read(void *, size_t, size_t *);
+extern size_t klog_write(log_level_t, const void *, size_t);
+extern int klog_read(void *, size_t);
 
 #define KLOG_PRINTF(lvl, fmt, ...) ({ \
+	char *_fmt = str_dup(fmt); \
+	size_t _fmtsize = str_size(_fmt); \
+	if (_fmtsize > 0 && _fmt[_fmtsize - 1] == '\n') \
+		_fmt[_fmtsize - 1] = 0; \
 	char *_s; \
-	errno_t _rc = ENOMEM; \
-	if (asprintf(&_s, fmt, ##__VA_ARGS__) >= 0) { \
-		_rc = klog_write((lvl), _s, str_size(_s)); \
+	int _c = asprintf(&_s, _fmt, ##__VA_ARGS__); \
+	free(_fmt); \
+	if (_c >= 0) { \
+		_c = klog_write((lvl), _s, str_size(_s)); \
 		free(_s); \
 	}; \
-	(_rc != EOK); \
+	(_c >= 0); \
 })
 
Index: uspace/lib/c/include/io/log.h
===================================================================
--- uspace/lib/c/include/io/log.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/log.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,11 +54,11 @@
 
 extern const char *log_level_str(log_level_t);
-extern errno_t log_level_from_str(const char *, log_level_t *);
+extern int log_level_from_str(const char *, log_level_t *);
 
-extern errno_t log_init(const char *);
+extern int log_init(const char *);
 extern log_t log_create(const char *, log_t);
 
 extern void log_msg(log_t, log_level_t, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(3, 4);
+    PRINTF_ATTRIBUTE(3, 4);
 extern void log_msgv(log_t, log_level_t, const char *, va_list);
 
Index: uspace/lib/c/include/io/logctl.h
===================================================================
--- uspace/lib/c/include/io/logctl.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/logctl.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,7 +36,7 @@
 #include <io/log.h>
 
-extern errno_t logctl_set_default_level(log_level_t);
-extern errno_t logctl_set_log_level(const char *, log_level_t);
-extern errno_t logctl_set_root(void);
+extern int logctl_set_default_level(log_level_t);
+extern int logctl_set_log_level(const char *, log_level_t);
+extern int logctl_set_root(void);
 
 #endif
Index: uspace/lib/c/include/io/output.h
===================================================================
--- uspace/lib/c/include/io/output.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/output.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,16 +40,16 @@
 #include <io/console.h>
 
-extern errno_t output_yield(async_sess_t *);
-extern errno_t output_claim(async_sess_t *);
-extern errno_t output_get_dimensions(async_sess_t *, sysarg_t *, sysarg_t *);
-extern errno_t output_get_caps(async_sess_t *, console_caps_t *);
+extern int output_yield(async_sess_t *);
+extern int output_claim(async_sess_t *);
+extern int output_get_dimensions(async_sess_t *, sysarg_t *, sysarg_t *);
+extern int output_get_caps(async_sess_t *, console_caps_t *);
 
 extern frontbuf_handle_t output_frontbuf_create(async_sess_t *, chargrid_t *);
 
-extern errno_t output_cursor_update(async_sess_t *, frontbuf_handle_t);
-extern errno_t output_set_style(async_sess_t *, console_style_t);
+extern int output_cursor_update(async_sess_t *, frontbuf_handle_t);
+extern int output_set_style(async_sess_t *, console_style_t);
 
-extern errno_t output_update(async_sess_t *, frontbuf_handle_t);
-extern errno_t output_damage(async_sess_t *, frontbuf_handle_t,
+extern int output_update(async_sess_t *, frontbuf_handle_t);
+extern int output_damage(async_sess_t *, frontbuf_handle_t,
     sysarg_t, sysarg_t, sysarg_t, sysarg_t);
 
Index: uspace/lib/c/include/io/serial.h
===================================================================
--- uspace/lib/c/include/io/serial.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/serial.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,9 +43,9 @@
 } serial_t;
 
-extern errno_t serial_open(async_sess_t *, serial_t **);
+extern int serial_open(async_sess_t *, serial_t **);
 extern void serial_close(serial_t *);
-extern errno_t serial_set_comm_props(serial_t *, unsigned, serial_parity_t,
+extern int serial_set_comm_props(serial_t *, unsigned, serial_parity_t,
     unsigned, unsigned);
-extern errno_t serial_get_comm_props(serial_t *, unsigned *, serial_parity_t *,
+extern int serial_get_comm_props(serial_t *, unsigned *, serial_parity_t *,
     unsigned *, unsigned *);
 
Index: uspace/lib/c/include/io/table.h
===================================================================
--- uspace/lib/c/include/io/table.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/table.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,4 @@
 #include <stddef.h>
 #include <stdio.h>
-#include <errno.h>
 
 /** Table metrics */
@@ -83,5 +82,5 @@
 	bool header_row;
 	/** Encountered error while writing to table */
-	errno_t error;
+	int error;
 	/** Table rows */
 	list_t rows; /* of table_row_t */
@@ -98,10 +97,10 @@
 } table_t;
 
-extern errno_t table_create(table_t **);
+extern int table_create(table_t **);
 extern void table_destroy(table_t *);
-extern errno_t table_print_out(table_t *, FILE *);
+extern int table_print_out(table_t *, FILE *);
 extern void table_header_row(table_t *);
-extern errno_t table_printf(table_t *, const char *, ...);
-extern errno_t table_get_error(table_t *);
+extern int table_printf(table_t *, const char *, ...);
+extern int table_get_error(table_t *);
 extern void table_set_margin_left(table_t *, size_t);
 
Index: uspace/lib/c/include/io/verify.h
===================================================================
--- uspace/lib/c/include/io/verify.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/verify.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,19 +36,19 @@
 #define LIBC_IO_VERIFY_H_
 
-#ifndef _HELENOS_NVERIFY_PRINTF
+#ifndef NVERIFY_PRINTF
 
 #ifdef __clang__
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
+#define PRINTF_ATTRIBUTE(start, end) \
 	__attribute__((format(__printf__, start, end)))
 #else
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
+#define PRINTF_ATTRIBUTE(start, end) \
 	__attribute__((format(gnu_printf, start, end)))
 #endif
 
-#else /* _HELENOS_NVERIFY_PRINTF */
+#else /* NVERIFY_PRINTF */
 
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end)
+#define PRINTF_ATTRIBUTE(start, end)
 
-#endif /* _HELENOS_NVERIFY_PRINTF */
+#endif /* NVERIFY_PRINTF */
 
 #endif
Index: uspace/lib/c/include/io/visualizer.h
===================================================================
--- uspace/lib/c/include/io/visualizer.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/visualizer.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,18 +39,18 @@
 #include <io/mode.h>
 
-extern errno_t visualizer_claim(async_sess_t *, sysarg_t);
-extern errno_t visualizer_yield(async_sess_t *);
+extern int visualizer_claim(async_sess_t *, sysarg_t);
+extern int visualizer_yield(async_sess_t *);
 
-extern errno_t visualizer_enumerate_modes(async_sess_t *, vslmode_t *, sysarg_t);
-extern errno_t visualizer_get_default_mode(async_sess_t *, vslmode_t *);
-extern errno_t visualizer_get_current_mode(async_sess_t *, vslmode_t *);
-extern errno_t visualizer_get_mode(async_sess_t *, vslmode_t *, sysarg_t);
-extern errno_t visualizer_set_mode(async_sess_t *, sysarg_t, sysarg_t, void *);
+extern int visualizer_enumerate_modes(async_sess_t *, vslmode_t *, sysarg_t);
+extern int visualizer_get_default_mode(async_sess_t *, vslmode_t *);
+extern int visualizer_get_current_mode(async_sess_t *, vslmode_t *);
+extern int visualizer_get_mode(async_sess_t *, vslmode_t *, sysarg_t);
+extern int visualizer_set_mode(async_sess_t *, sysarg_t, sysarg_t, void *);
 
-extern errno_t visualizer_update_damaged_region(async_sess_t *,
+extern int visualizer_update_damaged_region(async_sess_t *,
     sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
 
-extern errno_t visualizer_suspend(async_sess_t *);
-extern errno_t visualizer_wakeup(async_sess_t *);
+extern int visualizer_suspend(async_sess_t *);
+extern int visualizer_wakeup(async_sess_t *);
 
 #endif
Index: uspace/lib/c/include/io/window.h
===================================================================
--- uspace/lib/c/include/io/window.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/io/window.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -113,15 +113,15 @@
 } window_event_t;
 
-extern errno_t win_register(async_sess_t *, window_flags_t, service_id_t *,
+extern int win_register(async_sess_t *, window_flags_t, service_id_t *,
     service_id_t *);
 
-extern errno_t win_get_event(async_sess_t *, window_event_t *);
+extern int win_get_event(async_sess_t *, window_event_t *);
 
-extern errno_t win_damage(async_sess_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
-extern errno_t win_grab(async_sess_t *, sysarg_t, sysarg_t);
-extern errno_t win_resize(async_sess_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+extern int win_damage(async_sess_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
+extern int win_grab(async_sess_t *, sysarg_t, sysarg_t);
+extern int win_resize(async_sess_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     window_placement_flags_t, void *);
-extern errno_t win_close(async_sess_t *);
-extern errno_t win_close_request(async_sess_t *);
+extern int win_close(async_sess_t *);
+extern int win_close_request(async_sess_t *);
 
 #endif
Index: uspace/lib/c/include/ipc/common.h
===================================================================
--- uspace/lib/c/include/ipc/common.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/ipc/common.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,4 @@
 	unsigned flags;
 	struct async_call *label;
-	cap_handle_t cap_handle;
 } ipc_call_t;
 
Index: uspace/lib/c/include/ipc/devman.h
===================================================================
--- uspace/lib/c/include/ipc/devman.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/ipc/devman.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -74,5 +74,5 @@
 	/** Id of device model.
 	 */
-	char *id;
+	const char *id;
 	/** Relevancy of device-to-driver match.
 	 * The higher is the product of scores specified for the device by the bus driver and by the leaf driver,
Index: uspace/lib/c/include/ipc/event.h
===================================================================
--- uspace/lib/c/include/ipc/event.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/ipc/event.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,10 +39,10 @@
 #include <types/common.h>
 
-extern errno_t ipc_event_subscribe(event_type_t, sysarg_t);
-extern errno_t ipc_event_task_subscribe(event_task_type_t, sysarg_t);
-extern errno_t ipc_event_unsubscribe(event_type_t);
-extern errno_t ipc_event_task_unsubscribe(event_task_type_t);
-extern errno_t ipc_event_unmask(event_type_t);
-extern errno_t ipc_event_task_unmask(event_task_type_t);
+extern int ipc_event_subscribe(event_type_t, sysarg_t);
+extern int ipc_event_task_subscribe(event_task_type_t, sysarg_t);
+extern int ipc_event_unsubscribe(event_type_t);
+extern int ipc_event_task_unsubscribe(event_task_type_t);
+extern int ipc_event_unmask(event_type_t);
+extern int ipc_event_task_unmask(event_task_type_t);
 
 #endif
Index: uspace/lib/c/include/ipc/ipc.h
===================================================================
--- uspace/lib/c/include/ipc/ipc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/ipc/ipc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,5 +34,5 @@
 
 #if ((defined(LIBC_ASYNC_H_)) && (!defined(LIBC_ASYNC_C_)))
-#error Do not intermix low-level IPC interface and async framework
+	#error Do not intermix low-level IPC interface and async framework
 #endif
 
@@ -46,7 +46,7 @@
 #include <abi/cap.h>
 
-typedef void (*ipc_async_callback_t)(void *, errno_t, ipc_call_t *);
+typedef void (*ipc_async_callback_t)(void *, int, ipc_call_t *);
 
-extern errno_t ipc_wait_cycle(ipc_call_t *, sysarg_t, unsigned int);
+extern cap_handle_t ipc_wait_cycle(ipc_call_t *, sysarg_t, unsigned int);
 extern void ipc_poke(void);
 
@@ -54,6 +54,6 @@
 	ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
 
-extern errno_t ipc_wait_for_call_timeout(ipc_call_t *, sysarg_t);
-extern errno_t ipc_trywait_for_call(ipc_call_t *);
+extern cap_handle_t ipc_wait_for_call_timeout(ipc_call_t *, sysarg_t);
+extern cap_handle_t ipc_trywait_for_call(ipc_call_t *);
 
 /*
@@ -78,7 +78,7 @@
 	    (arg5))
 
-extern errno_t ipc_answer_fast(cap_handle_t, errno_t, sysarg_t, sysarg_t,
+extern sysarg_t ipc_answer_fast(cap_handle_t, sysarg_t, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t);
-extern errno_t ipc_answer_slow(cap_handle_t, errno_t, sysarg_t, sysarg_t,
+extern sysarg_t ipc_answer_slow(cap_handle_t, sysarg_t, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t, sysarg_t);
 
@@ -115,12 +115,12 @@
     sysarg_t, sysarg_t, sysarg_t, void *, ipc_async_callback_t);
 
-extern errno_t ipc_hangup(cap_handle_t);
+extern int ipc_hangup(cap_handle_t);
 
-extern errno_t ipc_forward_fast(cap_handle_t, cap_handle_t, sysarg_t, sysarg_t,
+extern int ipc_forward_fast(cap_handle_t, cap_handle_t, sysarg_t, sysarg_t,
     sysarg_t, unsigned int);
-extern errno_t ipc_forward_slow(cap_handle_t, cap_handle_t, sysarg_t, sysarg_t,
+extern int ipc_forward_slow(cap_handle_t, cap_handle_t, sysarg_t, sysarg_t,
     sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
 
-extern errno_t ipc_connect_kbox(task_id_t, cap_handle_t *);
+extern int ipc_connect_kbox(task_id_t);
 
 #endif
Index: uspace/lib/c/include/ipc/irq.h
===================================================================
--- uspace/lib/c/include/ipc/irq.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/ipc/irq.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,8 +38,7 @@
 #include <types/common.h>
 #include <abi/ddi/irq.h>
-#include <abi/cap.h>
 
-extern errno_t ipc_irq_subscribe(int, sysarg_t, const irq_code_t *, cap_handle_t *);
-extern errno_t ipc_irq_unsubscribe(cap_handle_t);
+extern int ipc_irq_subscribe(int, sysarg_t, const irq_code_t *);
+extern int ipc_irq_unsubscribe(int);
 
 #endif
Index: uspace/lib/c/include/ipc/logger.h
===================================================================
--- uspace/lib/c/include/ipc/logger.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/ipc/logger.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,5 +54,5 @@
 	 * Returns: error code
 	 * Followed by: vfs_pass_handle() request.
-	 */
+	 */ 
 	LOGGER_CONTROL_SET_ROOT
 } logger_control_request_t;
Index: uspace/lib/c/include/ipc/tcp.h
===================================================================
--- uspace/lib/c/include/ipc/tcp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/ipc/tcp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2015 Jiri Svoboda
+ * Copyright (c) 2015 Jiri Svobda
  * All rights reserved.
  *
Index: uspace/lib/c/include/ipc/udp.h
===================================================================
--- uspace/lib/c/include/ipc/udp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/ipc/udp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2015 Jiri Svoboda
+ * Copyright (c) 2015 Jiri Svobda
  * All rights reserved.
  *
Index: uspace/lib/c/include/irc.h
===================================================================
--- uspace/lib/c/include/irc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/irc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,7 +36,7 @@
 #define LIBC_IRC_H_
 
-extern errno_t irc_enable_interrupt(int);
-extern errno_t irc_disable_interrupt(int);
-extern errno_t irc_clear_interrupt(int);
+extern int irc_enable_interrupt(int);
+extern int irc_disable_interrupt(int);
+extern int irc_clear_interrupt(int);
 
 #endif
Index: uspace/lib/c/include/loader/loader.h
===================================================================
--- uspace/lib/c/include/loader/loader.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/loader/loader.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,14 +43,14 @@
 typedef struct loader loader_t;
 
-extern errno_t loader_spawn(const char *);
+extern int loader_spawn(const char *);
 extern loader_t *loader_connect(void);
-extern errno_t loader_get_task_id(loader_t *, task_id_t *);
-extern errno_t loader_set_cwd(loader_t *);
-extern errno_t loader_set_program(loader_t *, const char *, int);
-extern errno_t loader_set_program_path(loader_t *, const char *);
-extern errno_t loader_set_args(loader_t *, const char *const[]);
-extern errno_t loader_add_inbox(loader_t *, const char *, int);
-extern errno_t loader_load_program(loader_t *);
-extern errno_t loader_run(loader_t *);
+extern int loader_get_task_id(loader_t *, task_id_t *);
+extern int loader_set_cwd(loader_t *);
+extern int loader_set_program(loader_t *, const char *, int);
+extern int loader_set_program_path(loader_t *, const char *);
+extern int loader_set_args(loader_t *, const char *const[]);
+extern int loader_add_inbox(loader_t *, const char *, int);
+extern int loader_load_program(loader_t *);
+extern int loader_run(loader_t *);
 extern void loader_abort(loader_t *);
 
Index: uspace/lib/c/include/loc.h
===================================================================
--- uspace/lib/c/include/loc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/loc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,19 +46,19 @@
 extern void loc_exchange_end(async_exch_t *);
 
-extern errno_t loc_server_register(const char *);
-extern errno_t loc_service_register(const char *, service_id_t *);
-extern errno_t loc_service_unregister(service_id_t);
-extern errno_t loc_service_add_to_cat(service_id_t, category_id_t);
+extern int loc_server_register(const char *);
+extern int loc_service_register(const char *, service_id_t *);
+extern int loc_service_unregister(service_id_t);
+extern int loc_service_add_to_cat(service_id_t, category_id_t);
 
-extern errno_t loc_service_get_id(const char *, service_id_t *,
+extern int loc_service_get_id(const char *, service_id_t *,
     unsigned int);
-extern errno_t loc_service_get_name(service_id_t, char **);
-extern errno_t loc_service_get_server_name(service_id_t, char **);
-extern errno_t loc_namespace_get_id(const char *, service_id_t *,
+extern int loc_service_get_name(service_id_t, char **);
+extern int loc_service_get_server_name(service_id_t, char **);
+extern int loc_namespace_get_id(const char *, service_id_t *,
     unsigned int);
-extern errno_t loc_category_get_id(const char *, category_id_t *,
+extern int loc_category_get_id(const char *, category_id_t *,
     unsigned int);
-extern errno_t loc_category_get_name(category_id_t, char **);
-extern errno_t loc_category_get_svcs(category_id_t, category_id_t **, size_t *);
+extern int loc_category_get_name(category_id_t, char **);
+extern int loc_category_get_svcs(category_id_t, category_id_t **, size_t *);
 extern loc_object_type_t loc_id_probe(service_id_t);
 
@@ -74,6 +74,6 @@
 extern size_t loc_get_namespaces(loc_sdesc_t **);
 extern size_t loc_get_services(service_id_t, loc_sdesc_t **);
-extern errno_t loc_get_categories(category_id_t **, size_t *);
-extern errno_t loc_register_cat_change_cb(loc_cat_change_cb_t);
+extern int loc_get_categories(category_id_t **, size_t *);
+extern int loc_register_cat_change_cb(loc_cat_change_cb_t);
 
 
Index: uspace/lib/c/include/malloc.h
===================================================================
--- uspace/lib/c/include/malloc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/malloc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,13 +38,13 @@
 #include <stddef.h>
 
-extern void *malloc(size_t size)
+extern void *malloc(const size_t size)
     __attribute__((malloc));
-extern void *calloc(size_t nmemb, size_t size)
+extern void *calloc(const size_t nmemb, const size_t size)
     __attribute__((malloc));
-extern void *memalign(size_t align, size_t size)
+extern void *memalign(const size_t align, const size_t size)
     __attribute__((malloc));
-extern void *realloc(void *addr, size_t size)
+extern void *realloc(const void *addr, const size_t size)
     __attribute__((warn_unused_result));
-extern void free(void *addr);
+extern void free(const void *addr);
 extern void *heap_check(void);
 
Index: uspace/lib/c/include/ns.h
===================================================================
--- uspace/lib/c/include/ns.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/ns.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,10 +40,10 @@
 #include <async.h>
 
-extern errno_t service_register(service_t);
+extern int service_register(service_t);
 extern async_sess_t *service_connect(service_t, iface_t, sysarg_t);
 extern async_sess_t *service_connect_blocking(service_t, iface_t, sysarg_t);
 
-extern errno_t ns_ping(void);
-extern errno_t ns_intro(task_id_t);
+extern int ns_ping(void);
+extern int ns_intro(task_id_t);
 extern async_sess_t *ns_session_get(void);
 
Index: uspace/lib/c/include/perm.h
===================================================================
--- uspace/lib/c/include/perm.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/perm.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,6 +38,6 @@
 #include <task.h>
 
-extern errno_t perm_grant(task_id_t, unsigned int);
-extern errno_t perm_revoke(task_id_t, unsigned int);
+extern int perm_grant(task_id_t, unsigned int);
+extern int perm_revoke(task_id_t, unsigned int);
 
 #endif
Index: uspace/lib/c/include/rtld/module.h
===================================================================
--- uspace/lib/c/include/rtld/module.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/rtld/module.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 #include <types/rtld/rtld.h>
 
-extern errno_t module_create_static_exec(rtld_t *, module_t **);
+extern int module_create_static_exec(rtld_t *, module_t **);
 extern void module_process_relocs(module_t *);
 extern module_t *module_find(rtld_t *, const char *);
Index: uspace/lib/c/include/rtld/rtld.h
===================================================================
--- uspace/lib/c/include/rtld/rtld.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/rtld/rtld.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,6 +45,6 @@
 extern rtld_t *runtime_env;
 
-extern errno_t rtld_init_static(void);
-extern errno_t rtld_prog_process(elf_finfo_t *, rtld_t **);
+extern int rtld_init_static(void);
+extern int rtld_prog_process(elf_finfo_t *, rtld_t **);
 extern tcb_t *rtld_tls_make(rtld_t *);
 extern unsigned long rtld_get_next_id(rtld_t *);
Index: uspace/lib/c/include/rtld/rtld_debug.h
===================================================================
--- uspace/lib/c/include/rtld/rtld_debug.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/rtld/rtld_debug.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,7 +42,7 @@
 
 #ifdef RTLD_DEBUG
-#define DPRINTF(format, ...) printf(format, ##__VA_ARGS__)
+	#define DPRINTF(format, ...) printf(format, ##__VA_ARGS__)
 #else
-#define DPRINTF(format, ...) if (0) printf(format, ##__VA_ARGS__)
+	#define DPRINTF(format, ...) if (0) printf(format, ##__VA_ARGS__)
 #endif
 
Index: uspace/lib/c/include/smc.h
===================================================================
--- uspace/lib/c/include/smc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/smc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include <stddef.h>
 
-extern errno_t smc_coherence(void *address, size_t size);
+extern int smc_coherence(void *address, size_t size);
 
 #endif
Index: uspace/lib/c/include/stacktrace.h
===================================================================
--- uspace/lib/c/include/stacktrace.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/stacktrace.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,10 +37,9 @@
 #define LIBC_STACKTRACE_H_
 
-#include <errno.h>
 #include <stdint.h>
 #include <stdbool.h>
 
 typedef struct {
-	errno_t (*read_uintptr)(void *, uintptr_t, uintptr_t *);
+	int (*read_uintptr)(void *, uintptr_t, uintptr_t *);
 } stacktrace_ops_t;
 
@@ -59,6 +58,6 @@
  */
 extern bool stacktrace_fp_valid(stacktrace_t *, uintptr_t);
-extern errno_t stacktrace_fp_prev(stacktrace_t *, uintptr_t, uintptr_t *);
-extern errno_t stacktrace_ra_get(stacktrace_t *, uintptr_t, uintptr_t *);
+extern int stacktrace_fp_prev(stacktrace_t *, uintptr_t, uintptr_t *);
+extern int stacktrace_ra_get(stacktrace_t *, uintptr_t, uintptr_t *);
 
 extern void stacktrace_prepare(void);
Index: uspace/lib/c/include/stdio.h
===================================================================
--- uspace/lib/c/include/stdio.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/stdio.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,7 +37,7 @@
 
 #include <stdarg.h>
+#include <str.h>
 #include <io/verify.h>
-#include <_bits/size_t.h>
-#include <_bits/wchar_t.h>
+#include <abi/kio.h>
 
 #define EOF  (-1)
@@ -58,76 +58,11 @@
 #define BUFSIZ  4096
 
-/** Forward declaration */
-struct _IO_FILE;
-typedef struct _IO_FILE FILE;
-
-extern FILE *stdin;
-extern FILE *stdout;
-extern FILE *stderr;
-
-/* Character and string input functions */
-extern int fgetc(FILE *);
-extern char *fgets(char *, int, FILE *);
-
-extern int getchar(void);
-
-/* Character and string output functions */
-extern int fputc(wchar_t, FILE *);
-extern int fputs(const char *, FILE *);
-
-extern int putchar(wchar_t);
-extern int puts(const char *);
-
-extern int ungetc(int, FILE *);
-
-/* Formatted string output functions */
-extern int fprintf(FILE *, const char*, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-extern int vfprintf(FILE *, const char *, va_list);
-
-extern int printf(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
-extern int vprintf(const char *, va_list);
-
-extern int snprintf(char *, size_t , const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(3, 4);
-extern int vasprintf(char **, const char *, va_list);
-extern int asprintf(char **, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-extern int vsnprintf(char *, size_t, const char *, va_list);
-
-/* File stream functions */
-extern FILE *fopen(const char *, const char *);
-extern FILE *freopen(const char *, const char *, FILE *);
-extern int fclose(FILE *);
-
-extern size_t fread(void *, size_t, size_t, FILE *);
-extern size_t fwrite(const void *, size_t, size_t, FILE *);
-
-extern int fseek(FILE *, long, int);
-extern void rewind(FILE *);
-extern long ftell(FILE *);
-extern int feof(FILE *);
-
-extern int fflush(FILE *);
-extern int ferror(FILE *);
-extern void clearerr(FILE *);
-
-extern void setvbuf(FILE *, void *, int, size_t);
-extern void setbuf(FILE *, void *);
-
-/* Misc file functions */
-extern int rename(const char *, const char *);
-extern int remove(const char *);
-
-#ifndef _HELENOS_SOURCE
-#define _IONBF 0
-#define _IOLBF 1
-#define _IOFBF 2
-#endif
-
-#ifdef _HELENOS_SOURCE
-
-/* Nonstandard extensions. */
+#define DEBUG(fmt, ...) \
+	{ \
+		char _buf[256]; \
+		int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \
+		if (_n > 0) \
+			(void) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) _buf, str_size(_buf)); \
+	}
 
 enum _buffer_type {
@@ -151,18 +86,73 @@
 };
 
-extern int vprintf_size(const char *, va_list);
-extern int printf_size(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
-extern FILE *fdopen(int, const char *);
-extern int fileno(FILE *);
+/** Forward declaration */
+struct _IO_FILE;
+typedef struct _IO_FILE FILE;
+
+extern FILE *stdin;
+extern FILE *stdout;
+extern FILE *stderr;
+
+/* Character and string input functions */
+extern int fgetc(FILE *);
+extern char *fgets(char *, int, FILE *);
+
+extern int getchar(void);
 extern char *gets(char *, size_t);
 
-#include <offset.h>
+/* Character and string output functions */
+extern int fputc(wchar_t, FILE *);
+extern int fputs(const char *, FILE *);
 
-extern int fseek64(FILE *, off64_t, int);
-extern off64_t ftell64(FILE *);
+extern int putchar(wchar_t);
+extern int puts(const char *);
 
-#endif
+extern int ungetc(int, FILE *);
 
+/* Formatted string output functions */
+extern int fprintf(FILE *, const char*, ...)
+    PRINTF_ATTRIBUTE(2, 3);
+extern int vfprintf(FILE *, const char *, va_list);
+
+extern int printf(const char *, ...)
+    PRINTF_ATTRIBUTE(1, 2);
+extern int vprintf(const char *, va_list);
+
+extern int snprintf(char *, size_t , const char *, ...)
+    PRINTF_ATTRIBUTE(3, 4);
+extern int vasprintf(char **, const char *, va_list);
+extern int asprintf(char **, const char *, ...)
+    PRINTF_ATTRIBUTE(2, 3);
+extern int vsnprintf(char *, size_t, const char *, va_list);
+
+extern int printf_size(const char *, ...)
+    PRINTF_ATTRIBUTE(1, 2);
+extern int vprintf_size(const char *, va_list);
+
+/* File stream functions */
+extern FILE *fopen(const char *, const char *);
+extern FILE *fdopen(int, const char *);
+extern FILE *freopen(const char *, const char *, FILE *);
+extern int fclose(FILE *);
+
+extern size_t fread(void *, size_t, size_t, FILE *);
+extern size_t fwrite(const void *, size_t, size_t, FILE *);
+
+extern int fseek(FILE *, long, int);
+extern void rewind(FILE *);
+extern long ftell(FILE *);
+extern int feof(FILE *);
+extern int fileno(FILE *);
+
+extern int fflush(FILE *);
+extern int ferror(FILE *);
+extern void clearerr(FILE *);
+
+extern void setvbuf(FILE *, void *, int, size_t);
+extern void setbuf(FILE *, void *);
+
+/* Misc file functions */
+extern int rename(const char *, const char *);
+extern int remove(const char *);
 
 #endif
Index: uspace/lib/c/include/stdlib.h
===================================================================
--- uspace/lib/c/include/stdlib.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/stdlib.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,18 +42,12 @@
 #define RAND_MAX  714025
 
-extern int rand(void);
-extern void srand(unsigned int seed);
+#define rand()       random()
+#define srand(seed)  srandom(seed)
+
+extern long int random(void);
+extern void srandom(unsigned int seed);
 
 extern void abort(void) __attribute__((noreturn));
 extern void exit(int) __attribute__((noreturn));
-
-extern int atoi(const char *);
-extern long atol(const char *);
-extern long long atoll(const char *);
-
-extern long strtol(const char *__restrict__, char **__restrict__, int);
-extern long long strtoll(const char *__restrict__, char **__restrict__, int);
-extern unsigned long strtoul(const char *__restrict__, char **__restrict__, int);
-extern unsigned long long strtoull(const char *__restrict__, char **__restrict__, int);
 
 #endif
Index: uspace/lib/c/include/str.h
===================================================================
--- uspace/lib/c/include/str.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/str.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #define LIBC_STR_H_
 
-#include <errno.h>
 #include <mem.h>
 #include <stddef.h>
@@ -59,5 +58,5 @@
 extern wchar_t str_decode(const char *str, size_t *offset, size_t sz);
 extern wchar_t str_decode_reverse(const char *str, size_t *offset, size_t sz);
-extern errno_t chr_encode(const wchar_t ch, char *str, size_t *offset, size_t sz);
+extern int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t sz);
 
 extern size_t str_size(const char *str);
@@ -93,11 +92,11 @@
 extern void str_append(char *dest, size_t size, const char *src);
 
-extern errno_t spascii_to_str(char *dest, size_t size, const uint8_t *src, size_t n);
+extern int spascii_to_str(char *dest, size_t size, const uint8_t *src, size_t n);
 extern void wstr_to_str(char *dest, size_t size, const wchar_t *src);
 extern char *wstr_to_astr(const wchar_t *src);
 extern void str_to_wstr(wchar_t *dest, size_t dlen, const char *src);
 extern wchar_t *str_to_awstr(const char *src);
-extern errno_t utf16_to_str(char *dest, size_t size, const uint16_t *src);
-extern errno_t str_to_utf16(uint16_t *dest, size_t dlen, const char *src);
+extern int utf16_to_str(char *dest, size_t size, const uint16_t *src);
+extern int str_to_utf16(uint16_t *dest, size_t dlen, const char *src);
 extern size_t utf16_wsize(const uint16_t *ustr);
 
@@ -116,13 +115,13 @@
 extern char *str_tok(char *, const char *, char **);
 
-extern errno_t str_uint8_t(const char *, const char **, unsigned int, bool,
+extern int str_uint8_t(const char *, const char **, unsigned int, bool,
     uint8_t *);
-extern errno_t str_uint16_t(const char *, const char **, unsigned int, bool,
+extern int str_uint16_t(const char *, const char **, unsigned int, bool,
     uint16_t *);
-extern errno_t str_uint32_t(const char *, const char **, unsigned int, bool,
+extern int str_uint32_t(const char *, const char **, unsigned int, bool,
     uint32_t *);
-extern errno_t str_uint64_t(const char *, const char **, unsigned int, bool,
+extern int str_uint64_t(const char *, const char **, unsigned int, bool,
     uint64_t *);
-extern errno_t str_size_t(const char *, const char **, unsigned int, bool,
+extern int str_size_t(const char *, const char **, unsigned int, bool,
     size_t *);
 
Index: uspace/lib/c/include/sys/time.h
===================================================================
--- uspace/lib/c/include/sys/time.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/sys/time.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,4 @@
 #define LIBC_SYS_TIME_H_
 
-#include <errno.h>
 #include <stddef.h>
 #include <stdint.h>
@@ -84,13 +83,13 @@
 
 extern void udelay(useconds_t);
-extern errno_t usleep(useconds_t);
+extern int usleep(useconds_t);
 
 extern time_t mktime(struct tm *);
-extern errno_t time_utc2tm(const time_t, struct tm *);
-extern errno_t time_utc2str(const time_t, char *);
+extern int time_utc2tm(const time_t, struct tm *);
+extern int time_utc2str(const time_t, char *);
 extern void time_tm2str(const struct tm *, char *);
-extern errno_t time_tv2tm(const struct timeval *, struct tm *);
-extern errno_t time_local2tm(const time_t, struct tm *);
-extern errno_t time_local2str(const time_t, char *);
+extern int time_tv2tm(const struct timeval *, struct tm *);
+extern int time_local2tm(const time_t, struct tm *);
+extern int time_local2str(const time_t, char *);
 extern double difftime(time_t, time_t);
 extern size_t strftime(char *__restrict__, size_t, const char *__restrict__,
Index: uspace/lib/c/include/syscall.h
===================================================================
--- uspace/lib/c/include/syscall.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/syscall.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 
 #ifndef LIBARCH_SYSCALL_GENERIC
-#error You cannot include this file directly
+	#error You cannot include this file directly
 #endif
 
Index: uspace/lib/c/include/sysinfo.h
===================================================================
--- uspace/lib/c/include/sysinfo.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/sysinfo.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 extern char *sysinfo_get_keys(const char *, size_t *);
 extern sysinfo_item_val_type_t sysinfo_get_val_type(const char *);
-extern errno_t sysinfo_get_value(const char *, sysarg_t *);
+extern int sysinfo_get_value(const char *, sysarg_t *);
 extern void *sysinfo_get_data(const char *, size_t *);
 extern void *sysinfo_get_property(const char *, const char *, size_t *);
Index: uspace/lib/c/include/task.h
===================================================================
--- uspace/lib/c/include/task.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/task.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,21 +51,21 @@
 
 extern task_id_t task_get_id(void);
-extern errno_t task_set_name(const char *);
-extern errno_t task_kill(task_id_t);
+extern int task_set_name(const char *);
+extern int task_kill(task_id_t);
 
-extern errno_t task_spawnv(task_id_t *, task_wait_t *, const char *path,
+extern int task_spawnv(task_id_t *, task_wait_t *, const char *path,
     const char *const []);
-extern errno_t task_spawnvf(task_id_t *, task_wait_t *, const char *path,
+extern int task_spawnvf(task_id_t *, task_wait_t *, const char *path,
     const char *const [], int, int, int);
-extern errno_t task_spawn(task_id_t *, task_wait_t *, const char *path, int,
+extern int task_spawn(task_id_t *, task_wait_t *, const char *path, int,
     va_list ap);
-extern errno_t task_spawnl(task_id_t *, task_wait_t *, const char *path, ...)
+extern int task_spawnl(task_id_t *, task_wait_t *, const char *path, ...)
     __attribute__((sentinel));
 
-extern errno_t task_setup_wait(task_id_t, task_wait_t *);
+extern int task_setup_wait(task_id_t, task_wait_t *);
 extern void task_cancel_wait(task_wait_t *);
-extern errno_t task_wait(task_wait_t *, task_exit_t *, int *);
-extern errno_t task_wait_task_id(task_id_t, task_exit_t *, int *);
-extern errno_t task_retval(int);
+extern int task_wait(task_wait_t *, task_exit_t *, int *);
+extern int task_wait_task_id(task_id_t, task_exit_t *, int *);
+extern int task_retval(int);
 
 #endif
Index: uspace/lib/c/include/thread.h
===================================================================
--- uspace/lib/c/include/thread.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/thread.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #define LIBC_THREAD_H_
 
-#include <errno.h>
 #include <libarch/thread.h>
 #include <stdint.h>
@@ -42,8 +41,8 @@
 #include <time.h>
 
-extern errno_t thread_create(void (*)(void *), void *, const char *, thread_id_t *);
+extern int thread_create(void (*)(void *), void *, const char *, thread_id_t *);
 extern void thread_exit(int) __attribute__((noreturn));
 extern void thread_detach(thread_id_t);
-extern errno_t thread_join(thread_id_t);
+extern int thread_join(thread_id_t);
 extern thread_id_t thread_get_id(void);
 extern int thread_usleep(useconds_t);
Index: uspace/lib/c/include/time.h
===================================================================
--- uspace/lib/c/include/time.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/time.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -31,5 +31,5 @@
  */
 /** @file
- */
+ */ 
 
 #ifndef LIBC_TIME_H_
Index: uspace/lib/c/include/types/common.h
===================================================================
--- uspace/lib/c/include/types/common.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/types/common.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,4 @@
 
 #include <_bits/all.h>
-#include <_bits/errno.h>
 
 #endif
Index: uspace/lib/c/include/types/inet.h
===================================================================
--- uspace/lib/c/include/types/inet.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/types/inet.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,5 +54,5 @@
 
 typedef struct {
-	errno_t (*recv)(inet_dgram_t *);
+	int (*recv)(inet_dgram_t *);
 } inet_ev_ops_t;
 
Index: uspace/lib/c/include/udebug.h
===================================================================
--- uspace/lib/c/include/udebug.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/udebug.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,19 +43,19 @@
 typedef sysarg_t thash_t;
 
-extern errno_t udebug_begin(async_sess_t *);
-extern errno_t udebug_end(async_sess_t *);
-extern errno_t udebug_set_evmask(async_sess_t *, udebug_evmask_t);
-extern errno_t udebug_thread_read(async_sess_t *, void *, size_t, size_t *,
+extern int udebug_begin(async_sess_t *);
+extern int udebug_end(async_sess_t *);
+extern int udebug_set_evmask(async_sess_t *, udebug_evmask_t);
+extern int udebug_thread_read(async_sess_t *, void *, size_t , size_t *,
     size_t *);
-extern errno_t udebug_name_read(async_sess_t *, void *, size_t, size_t *,
+extern int udebug_name_read(async_sess_t *, void *, size_t, size_t *,
     size_t *);
-extern errno_t udebug_areas_read(async_sess_t *, void *, size_t, size_t *,
+extern int udebug_areas_read(async_sess_t *, void *, size_t, size_t *,
     size_t *);
-extern errno_t udebug_mem_read(async_sess_t *, void *, uintptr_t, size_t);
-extern errno_t udebug_args_read(async_sess_t *, thash_t, sysarg_t *);
-extern errno_t udebug_regs_read(async_sess_t *, thash_t, void *);
-extern errno_t udebug_go(async_sess_t *, thash_t, udebug_event_t *, sysarg_t *,
+extern int udebug_mem_read(async_sess_t *, void *, uintptr_t, size_t);
+extern int udebug_args_read(async_sess_t *, thash_t, sysarg_t *);
+extern int udebug_regs_read(async_sess_t *, thash_t, void *);
+extern int udebug_go(async_sess_t *, thash_t, udebug_event_t *, sysarg_t *,
     sysarg_t *);
-extern errno_t udebug_stop(async_sess_t *, thash_t);
+extern int udebug_stop(async_sess_t *, thash_t);
 
 #endif
Index: uspace/lib/c/include/uuid.h
===================================================================
--- uspace/lib/c/include/uuid.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/uuid.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,9 +39,9 @@
 #include <types/uuid.h>
 
-extern errno_t uuid_generate(uuid_t *);
+extern int uuid_generate(uuid_t *);
 extern void uuid_encode(uuid_t *, uint8_t *);
 extern void uuid_decode(uint8_t *, uuid_t *);
-extern errno_t uuid_parse(const char *, uuid_t *, const char **);
-extern errno_t uuid_format(uuid_t *, char **);
+extern int uuid_parse(const char *, uuid_t *, const char **);
+extern int uuid_format(uuid_t *, char **);
 
 #endif
Index: uspace/lib/c/include/vbd.h
===================================================================
--- uspace/lib/c/include/vbd.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/vbd.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -95,18 +95,18 @@
 typedef sysarg_t vbd_part_id_t;
 
-extern errno_t vbd_create(vbd_t **);
+extern int vbd_create(vbd_t **);
 extern void vbd_destroy(vbd_t *);
-extern errno_t vbd_get_disks(vbd_t *, service_id_t **, size_t *);
-extern errno_t vbd_disk_info(vbd_t *, service_id_t, vbd_disk_info_t *);
-extern errno_t vbd_label_create(vbd_t *, service_id_t, label_type_t);
-extern errno_t vbd_label_delete(vbd_t *, service_id_t);
-extern errno_t vbd_label_get_parts(vbd_t *, service_id_t, service_id_t **,
+extern int vbd_get_disks(vbd_t *, service_id_t **, size_t *);
+extern int vbd_disk_info(vbd_t *, service_id_t, vbd_disk_info_t *);
+extern int vbd_label_create(vbd_t *, service_id_t, label_type_t);
+extern int vbd_label_delete(vbd_t *, service_id_t);
+extern int vbd_label_get_parts(vbd_t *, service_id_t, service_id_t **,
     size_t *);
-extern errno_t vbd_part_get_info(vbd_t *, vbd_part_id_t, vbd_part_info_t *);
-extern errno_t vbd_part_create(vbd_t *, service_id_t, vbd_part_spec_t *,
+extern int vbd_part_get_info(vbd_t *, vbd_part_id_t, vbd_part_info_t *);
+extern int vbd_part_create(vbd_t *, service_id_t, vbd_part_spec_t *,
     vbd_part_id_t *);
-extern errno_t vbd_part_delete(vbd_t *, vbd_part_id_t);
+extern int vbd_part_delete(vbd_t *, vbd_part_id_t);
 extern void vbd_pspec_init(vbd_part_spec_t *);
-extern errno_t vbd_suggest_ptype(vbd_t *, service_id_t, label_pcnt_t,
+extern int vbd_suggest_ptype(vbd_t *, service_id_t, label_pcnt_t,
     label_ptype_t *);
 
Index: uspace/lib/c/include/vfs/inbox.h
===================================================================
--- uspace/lib/c/include/vfs/inbox.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/vfs/inbox.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -29,5 +29,5 @@
 /** @addtogroup libc 
  * @{
- */
+ */ 
 
 /**
Index: uspace/lib/c/include/vfs/vfs.h
===================================================================
--- uspace/lib/c/include/vfs/vfs.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/vfs/vfs.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,5 +57,5 @@
 
 
-typedef struct {
+struct stat {
 	fs_handle_t fs_handle;
 	service_id_t service_id;
@@ -66,12 +66,12 @@
 	aoff64_t size;
 	service_id_t service;
-} vfs_stat_t;
+};
 
-typedef struct {
+struct statfs { 
 	char fs_name[FS_NAME_MAXLEN + 1];
 	uint32_t f_bsize;    /* fundamental file system block size */
 	uint64_t f_blocks;   /* total data blocks in file system */
 	uint64_t f_bfree;    /* free blocks in fs */
-} vfs_statfs_t;
+};
 
 /** List of file system types */
@@ -82,45 +82,45 @@
 } vfs_fstypes_t;
 
-extern errno_t vfs_fhandle(FILE *, int *);
+extern int vfs_fhandle(FILE *, int *);
 
 extern char *vfs_absolutize(const char *, size_t *);
-extern errno_t vfs_clone(int, int, bool, int *);
-extern errno_t vfs_cwd_get(char *path, size_t);
-extern errno_t vfs_cwd_set(const char *path);
+extern int vfs_clone(int, int, bool);
+extern int vfs_cwd_get(char *path, size_t);
+extern int vfs_cwd_set(const char *path);
 extern async_exch_t *vfs_exchange_begin(void);
 extern void vfs_exchange_end(async_exch_t *);
-extern errno_t vfs_fsprobe(const char *, service_id_t, vfs_fs_probe_info_t *);
-extern errno_t vfs_fstypes(vfs_fstypes_t *);
+extern int vfs_fsprobe(const char *, service_id_t, vfs_fs_probe_info_t *);
+extern int vfs_fstypes(vfs_fstypes_t *);
 extern void vfs_fstypes_free(vfs_fstypes_t *);
-extern errno_t vfs_link(int, const char *, vfs_file_kind_t, int *);
-extern errno_t vfs_link_path(const char *, vfs_file_kind_t, int *);
-extern errno_t vfs_lookup(const char *, int, int *);
-extern errno_t vfs_lookup_open(const char *, int, int, int *);
-extern errno_t vfs_mount_path(const char *, const char *, const char *,
+extern int vfs_link(int, const char *, vfs_file_kind_t, int *);
+extern int vfs_link_path(const char *, vfs_file_kind_t, int *);
+extern int vfs_lookup(const char *, int);
+extern int vfs_lookup_open(const char *, int, int);
+extern int vfs_mount_path(const char *, const char *, const char *,
     const char *, unsigned int, unsigned int);
-extern errno_t vfs_mount(int, const char *, service_id_t, const char *, unsigned,
+extern int vfs_mount(int, const char *, service_id_t, const char *, unsigned,
     unsigned, int *);
-extern errno_t vfs_open(int, int);
-extern errno_t vfs_pass_handle(async_exch_t *, int, async_exch_t *);
-extern errno_t vfs_put(int);
-extern errno_t vfs_read(int, aoff64_t *, void *, size_t, size_t *);
-extern errno_t vfs_read_short(int, aoff64_t, void *, size_t, ssize_t *);
-extern errno_t vfs_receive_handle(bool, int *);
-extern errno_t vfs_rename_path(const char *, const char *);
-extern errno_t vfs_resize(int, aoff64_t);
+extern int vfs_open(int, int);
+extern int vfs_pass_handle(async_exch_t *, int, async_exch_t *);
+extern int vfs_put(int);
+extern int vfs_read(int, aoff64_t *, void *, size_t, size_t *);
+extern int vfs_read_short(int, aoff64_t, void *, size_t, ssize_t *);
+extern int vfs_receive_handle(bool);
+extern int vfs_rename_path(const char *, const char *);
+extern int vfs_resize(int, aoff64_t);
 extern int vfs_root(void);
-extern errno_t vfs_root_set(int);
-extern errno_t vfs_stat(int, vfs_stat_t *);
-extern errno_t vfs_stat_path(const char *, vfs_stat_t *);
-extern errno_t vfs_statfs(int, vfs_statfs_t *);
-extern errno_t vfs_statfs_path(const char *, vfs_statfs_t *);
-extern errno_t vfs_sync(int);
-extern errno_t vfs_unlink(int, const char *, int);
-extern errno_t vfs_unlink_path(const char *);
-extern errno_t vfs_unmount(int);
-extern errno_t vfs_unmount_path(const char *);
-extern errno_t vfs_walk(int, const char *, int, int *);
-extern errno_t vfs_write(int, aoff64_t *, const void *, size_t, size_t *);
-extern errno_t vfs_write_short(int, aoff64_t, const void *, size_t, ssize_t *);
+extern void vfs_root_set(int);
+extern int vfs_stat(int, struct stat *);
+extern int vfs_stat_path(const char *, struct stat *);
+extern int vfs_statfs(int, struct statfs *);
+extern int vfs_statfs_path(const char *, struct statfs *);
+extern int vfs_sync(int);
+extern int vfs_unlink(int, const char *, int);
+extern int vfs_unlink_path(const char *);
+extern int vfs_unmount(int);
+extern int vfs_unmount_path(const char *);
+extern int vfs_walk(int, const char *, int);
+extern int vfs_write(int, aoff64_t *, const void *, size_t, size_t *);
+extern int vfs_write_short(int, aoff64_t, const void *, size_t, ssize_t *);
 
 #endif
Index: uspace/lib/c/include/vfs/vfs_mtab.h
===================================================================
--- uspace/lib/c/include/vfs/vfs_mtab.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/vfs/vfs_mtab.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
 } mtab_ent_t;
 
-extern errno_t vfs_get_mtab_list(list_t *);
+extern int vfs_get_mtab_list(list_t *);
 
 #endif
Index: uspace/lib/c/include/vol.h
===================================================================
--- uspace/lib/c/include/vol.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/include/vol.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,12 +42,12 @@
 #include <types/vol.h>
 
-extern errno_t vol_create(vol_t **);
+extern int vol_create(vol_t **);
 extern void vol_destroy(vol_t *);
-extern errno_t vol_get_parts(vol_t *, service_id_t **, size_t *);
-extern errno_t vol_part_add(vol_t *, service_id_t);
-extern errno_t vol_part_info(vol_t *, service_id_t, vol_part_info_t *);
-extern errno_t vol_part_empty(vol_t *, service_id_t);
-extern errno_t vol_part_get_lsupp(vol_t *, vol_fstype_t, vol_label_supp_t *);
-extern errno_t vol_part_mkfs(vol_t *, service_id_t, vol_fstype_t, const char *);
+extern int vol_get_parts(vol_t *, service_id_t **, size_t *);
+extern int vol_part_add(vol_t *, service_id_t);
+extern int vol_part_info(vol_t *, service_id_t, vol_part_info_t *);
+extern int vol_part_empty(vol_t *, service_id_t);
+extern int vol_part_get_lsupp(vol_t *, vol_fstype_t, vol_label_supp_t *);
+extern int vol_part_mkfs(vol_t *, service_id_t, vol_fstype_t, const char *);
 
 #endif
Index: uspace/lib/c/test/adt/circ_buf.c
===================================================================
--- uspace/lib/c/test/adt/circ_buf.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/test/adt/circ_buf.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
 	int i;
 	int j;
-	errno_t rc;
+	int rc;
 
 	circ_buf_init(&cbuf, buffer, buffer_size, sizeof(int));
Index: uspace/lib/c/test/io/table.c
===================================================================
--- uspace/lib/c/test/io/table.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/test/io/table.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,5 @@
 PCUT_TEST(smoke) {
 	table_t *table;
-	errno_t rc;
+	int rc;
 
 	rc = table_create(&table);
Index: uspace/lib/c/test/sprintf.c
===================================================================
--- uspace/lib/c/test/sprintf.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/c/test/sprintf.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -28,5 +28,4 @@
 
 #include <stdio.h>
-#include <str.h>
 #include <pcut/pcut.h>
 
Index: uspace/lib/clui/nchoice.c
===================================================================
--- uspace/lib/clui/nchoice.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/clui/nchoice.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,8 +43,8 @@
  *
  */
-errno_t nchoice_create(nchoice_t **rchoice)
+int nchoice_create(nchoice_t **rchoice)
 {
 	nchoice_t *choice = NULL;
-	errno_t rc;
+	int rc;
 
 	choice = calloc(1, sizeof(nchoice_t));
@@ -82,5 +82,5 @@
 
 /** Set numerica choice prompt text */
-errno_t nchoice_set_prompt(nchoice_t *choice, const char *prompt)
+int nchoice_set_prompt(nchoice_t *choice, const char *prompt)
 {
 	char *pstr;
@@ -96,5 +96,5 @@
 
 /** Add option to numerical choice */
-errno_t nchoice_add(nchoice_t *choice, const char *opttext, void *arg,
+int nchoice_add(nchoice_t *choice, const char *opttext, void *arg,
     nchoice_flag_t flags)
 {
@@ -127,9 +127,8 @@
 
 /** Get numerical choice from user */
-errno_t nchoice_get(nchoice_t *choice, void **rarg)
+int nchoice_get(nchoice_t *choice, void **rarg)
 {
 	int i;
-	errno_t rc;
-	int ret;
+	int rc;
 	char *str;
 	unsigned long c;
@@ -152,6 +151,6 @@
 
 	if (def_i > 0) {
-		ret = asprintf(&istr, "%d", def_i);
-		if (ret < 0)
+		rc = asprintf(&istr, "%d", def_i);
+		if (rc < 0)
 			return ENOMEM;
 	} else {
Index: uspace/lib/clui/nchoice.h
===================================================================
--- uspace/lib/clui/nchoice.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/clui/nchoice.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -65,9 +65,9 @@
 } nchoice_t;
 
-extern errno_t nchoice_create(nchoice_t **);
+extern int nchoice_create(nchoice_t **);
 extern void nchoice_destroy(nchoice_t *);
-extern errno_t nchoice_set_prompt(nchoice_t *, const char *);
-extern errno_t nchoice_add(nchoice_t *, const char *, void *, nchoice_flag_t);
-extern errno_t nchoice_get(nchoice_t *, void **);
+extern int nchoice_set_prompt(nchoice_t *, const char *);
+extern int nchoice_add(nchoice_t *, const char *, void *, nchoice_flag_t);
+extern int nchoice_get(nchoice_t *, void **);
 
 #endif
Index: uspace/lib/clui/tinput.c
===================================================================
--- uspace/lib/clui/tinput.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/clui/tinput.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -185,5 +185,5 @@
 }
 
-static errno_t tinput_display(tinput_t *ti)
+static int tinput_display(tinput_t *ti)
 {
 	sysarg_t col0, row0;
@@ -542,5 +542,5 @@
 {
 	char *str;
-	errno_t rc = clipboard_get_str(&str);
+	int rc = clipboard_get_str(&str);
 	
 	if ((rc != EOK) || (str == NULL)) {
@@ -667,5 +667,5 @@
 	size_t cnum;
 	size_t i;
-	errno_t rc;
+	int rc;
 
 	if (ti->compl_ops == NULL)
@@ -782,5 +782,5 @@
  * @return		EOK on success, ENOMEM if out of memory.
  */
-errno_t tinput_set_prompt(tinput_t *ti, const char *prompt)
+int tinput_set_prompt(tinput_t *ti, const char *prompt)
 {
 	if (ti->prompt != NULL)
@@ -863,5 +863,5 @@
  *
  */
-errno_t tinput_read_i(tinput_t *ti, const char *istr, char **dstr)
+int tinput_read_i(tinput_t *ti, const char *istr, char **dstr)
 {
 	console_flush(ti->console);
@@ -925,5 +925,5 @@
  *
  */
-errno_t tinput_read(tinput_t *ti, char **dstr)
+int tinput_read(tinput_t *ti, char **dstr)
 {
 	return tinput_read_i(ti, "", dstr);
Index: uspace/lib/clui/tinput.h
===================================================================
--- uspace/lib/clui/tinput.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/clui/tinput.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,7 +61,7 @@
  * @param state		Output, pointer to a client state object.
  *
- * @return		EOK on success, error code on failure.
+ * @return		EOK on success, negative error code on failure.
  */
-typedef errno_t (*tinput_compl_init_fn)(wchar_t *text, size_t pos, size_t *cstart,
+typedef int (*tinput_compl_init_fn)(wchar_t *text, size_t pos, size_t *cstart,
     void **state);
 
@@ -76,7 +76,7 @@
  * @param compl		Output, the completion text, ownership retained.
  *
- * @return		EOK on success, error code on failure.
+ * @return		EOK on success, negative error code on failure.
  */
-typedef errno_t (*tinput_compl_get_next_fn)(void *state, char **compl);
+typedef int (*tinput_compl_get_next_fn)(void *state, char **compl);
 
 
@@ -155,9 +155,9 @@
 
 extern tinput_t *tinput_new(void);
-extern errno_t tinput_set_prompt(tinput_t *, const char *);
+extern int tinput_set_prompt(tinput_t *, const char *);
 extern void tinput_set_compl_ops(tinput_t *, tinput_compl_ops_t *);
 extern void tinput_destroy(tinput_t *);
-extern errno_t tinput_read(tinput_t *, char **);
-extern errno_t tinput_read_i(tinput_t *, const char *, char **);
+extern int tinput_read(tinput_t *, char **);
+extern int tinput_read_i(tinput_t *, const char *, char **);
 
 #endif
Index: uspace/lib/compress/gzip.c
===================================================================
--- uspace/lib/compress/gzip.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/compress/gzip.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -85,5 +85,5 @@
  *
  */
-errno_t gzip_expand(void *src, size_t srclen, void **dest, size_t *destlen)
+int gzip_expand(void *src, size_t srclen, void **dest, size_t *destlen)
 {
 	gzip_header_t header;
@@ -174,5 +174,5 @@
 		return ENOMEM;
 	
-	errno_t ret = inflate(stream, stream_length, *dest, *destlen);
+	int ret = inflate(stream, stream_length, *dest, *destlen);
 	if (ret != EOK) {
 		free(dest);
Index: uspace/lib/compress/gzip.h
===================================================================
--- uspace/lib/compress/gzip.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/compress/gzip.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -32,5 +32,5 @@
 #include <stddef.h>
 
-extern errno_t gzip_expand(void *, size_t, void **, size_t *);
+extern int gzip_expand(void *, size_t, void **, size_t *);
 
 #endif
Index: uspace/lib/compress/inflate.c
===================================================================
--- uspace/lib/compress/inflate.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/compress/inflate.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -270,5 +270,5 @@
  *
  */
-static errno_t inflate_stored(inflate_state_t *state)
+static int inflate_stored(inflate_state_t *state)
 {
 	/* Discard bits in the bit buffer */
@@ -316,5 +316,5 @@
  *
  */
-static errno_t huffman_decode(inflate_state_t *state, huffman_t *huffman,
+static int huffman_decode(inflate_state_t *state, huffman_t *huffman,
     uint16_t *symbol)
 {
@@ -418,5 +418,5 @@
  *
  */
-static errno_t inflate_codes(inflate_state_t *state, huffman_t* len_code,
+static int inflate_codes(inflate_state_t *state, huffman_t* len_code,
     huffman_t* dist_code)
 {
@@ -424,5 +424,5 @@
 	
 	do {
-		errno_t err = huffman_decode(state, len_code, &symbol);
+		int err = huffman_decode(state, len_code, &symbol);
 		if (err != EOK) {
 			/* Error decoding */
@@ -484,5 +484,5 @@
  *
  */
-static errno_t inflate_fixed(inflate_state_t *state, huffman_t *len_code,
+static int inflate_fixed(inflate_state_t *state, huffman_t *len_code,
     huffman_t *dist_code)
 {
@@ -501,5 +501,5 @@
  *
  */
-static errno_t inflate_dynamic(inflate_state_t *state)
+static int inflate_dynamic(inflate_state_t *state)
 {
 	uint16_t length[MAX_CODE];
@@ -551,5 +551,5 @@
 	while (index < nlen + ndist) {
 		uint16_t symbol;
-		errno_t err = huffman_decode(state, &dyn_len_code, &symbol);
+		int err = huffman_decode(state, &dyn_len_code, &symbol);
 		if (err != EOK)
 			return EOK;
@@ -618,5 +618,5 @@
  *
  */
-errno_t inflate(void *src, size_t srclen, void *dest, size_t destlen)
+int inflate(void *src, size_t srclen, void *dest, size_t destlen)
 {
 	/* Initialize the state */
@@ -637,5 +637,5 @@
 	
 	uint16_t last;
-	errno_t ret = EOK;
+	int ret = 0;
 	
 	do {
Index: uspace/lib/compress/inflate.h
===================================================================
--- uspace/lib/compress/inflate.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/compress/inflate.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -32,5 +32,5 @@
 #include <stddef.h>
 
-extern errno_t inflate(void *, size_t, void *, size_t);
+extern int inflate(void *, size_t, void *, size_t);
 
 #endif
Index: uspace/lib/crypto/aes.c
===================================================================
--- uspace/lib/crypto/aes.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/crypto/aes.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -459,5 +459,5 @@
  *
  */
-errno_t aes_encrypt(uint8_t *key, uint8_t *input, uint8_t *output)
+int aes_encrypt(uint8_t *key, uint8_t *input, uint8_t *output)
 {
 	if ((!key) || (!input))
@@ -511,5 +511,5 @@
  *
  */
-errno_t aes_decrypt(uint8_t *key, uint8_t *input, uint8_t *output)
+int aes_decrypt(uint8_t *key, uint8_t *input, uint8_t *output)
 {
 	if ((!key) || (!input))
Index: uspace/lib/crypto/crypto.c
===================================================================
--- uspace/lib/crypto/crypto.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/crypto/crypto.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -194,5 +194,5 @@
  *
  */
-errno_t create_hash(uint8_t *input, size_t input_size, uint8_t *output,
+int create_hash(uint8_t *input, size_t input_size, uint8_t *output,
     hash_func_t hash_sel)
 {
@@ -266,5 +266,5 @@
  *
  */
-errno_t hmac(uint8_t *key, size_t key_size, uint8_t *msg, size_t msg_size, 
+int hmac(uint8_t *key, size_t key_size, uint8_t *msg, size_t msg_size, 
     uint8_t *hash, hash_func_t hash_sel)
 {
@@ -322,5 +322,5 @@
  *
  */
-errno_t pbkdf2(uint8_t *pass, size_t pass_size, uint8_t *salt, size_t salt_size,
+int pbkdf2(uint8_t *pass, size_t pass_size, uint8_t *salt, size_t salt_size,
     uint8_t *hash)
 {
Index: uspace/lib/crypto/crypto.h
===================================================================
--- uspace/lib/crypto/crypto.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/crypto/crypto.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -30,5 +30,4 @@
 #define LIBCRYPTO_H
 
-#include <errno.h>
 #include <stddef.h>
 #include <stdint.h>
@@ -51,10 +50,10 @@
 } hash_func_t;
 
-extern errno_t rc4(uint8_t *, size_t, uint8_t *, size_t, size_t, uint8_t *);
-extern errno_t aes_encrypt(uint8_t *, uint8_t *, uint8_t *);
-extern errno_t aes_decrypt(uint8_t *, uint8_t *, uint8_t *);
-extern errno_t create_hash(uint8_t *, size_t, uint8_t *, hash_func_t);
-extern errno_t hmac(uint8_t *, size_t, uint8_t *, size_t, uint8_t *, hash_func_t);
-extern errno_t pbkdf2(uint8_t *, size_t, uint8_t *, size_t, uint8_t *);
+extern int rc4(uint8_t *, size_t, uint8_t *, size_t, size_t, uint8_t *);
+extern int aes_encrypt(uint8_t *, uint8_t *, uint8_t *);
+extern int aes_decrypt(uint8_t *, uint8_t *, uint8_t *);
+extern int create_hash(uint8_t *, size_t, uint8_t *, hash_func_t);
+extern int hmac(uint8_t *, size_t, uint8_t *, size_t, uint8_t *, hash_func_t);
+extern int pbkdf2(uint8_t *, size_t, uint8_t *, size_t, uint8_t *);
 
 extern uint16_t crc16_ibm(uint16_t crc, uint8_t *buf, size_t len);
Index: uspace/lib/crypto/rc4.c
===================================================================
--- uspace/lib/crypto/rc4.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/crypto/rc4.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -88,5 +88,5 @@
  *
  */
-errno_t rc4(uint8_t *key, size_t key_size, uint8_t *input, size_t input_size,
+int rc4(uint8_t *key, size_t key_size, uint8_t *input, size_t input_size,
     size_t skip, uint8_t *output)
 {
Index: uspace/lib/draw/codec/tga.gz.c
===================================================================
--- uspace/lib/draw/codec/tga.gz.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/draw/codec/tga.gz.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,5 +59,5 @@
 	size_t size_expanded;
 	
-	errno_t ret = gzip_expand(data, size, &data_expanded, &size_expanded);
+	int ret = gzip_expand(data, size, &data_expanded, &size_expanded);
 	if (ret != EOK)
 		return NULL;
Index: uspace/lib/draw/font.c
===================================================================
--- uspace/lib/draw/font.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/draw/font.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,13 +60,13 @@
 }
 
-errno_t font_get_metrics(font_t *font, font_metrics_t *metrics) {
+int font_get_metrics(font_t *font, font_metrics_t *metrics) {
 	return font->backend->get_font_metrics(font->backend_data, metrics);
 }
 
-errno_t font_resolve_glyph(font_t *font, wchar_t c, glyph_id_t *glyph_id) {
+int font_resolve_glyph(font_t *font, wchar_t c, glyph_id_t *glyph_id) {
 	return font->backend->resolve_glyph(font->backend_data, c, glyph_id);
 }
 
-errno_t font_get_glyph_metrics(font_t *font, glyph_id_t glyph_id,
+int font_get_glyph_metrics(font_t *font, glyph_id_t glyph_id,
     glyph_metrics_t *glyph_metrics)
 {
@@ -75,5 +75,5 @@
 }
 
-errno_t font_render_glyph(font_t *font, drawctx_t *context, source_t *source,
+int font_render_glyph(font_t *font, drawctx_t *context, source_t *source,
     sysarg_t x, sysarg_t y, glyph_id_t glyph_id)
 {
@@ -83,8 +83,8 @@
 
 /* TODO this is bad interface */
-errno_t font_get_box(font_t *font, char *text, sysarg_t *width, sysarg_t *height)
+int font_get_box(font_t *font, char *text, sysarg_t *width, sysarg_t *height)
 {
 	font_metrics_t fm;
-	errno_t rc = font_get_metrics(font, &fm);
+	int rc = font_get_metrics(font, &fm);
 	if (rc != EOK)
 		return rc;
@@ -101,5 +101,5 @@
 		rc = font_resolve_glyph(font, c, &glyph_id);
 		if (rc != EOK) {
-			errno_t rc2 = font_resolve_glyph(font, U_SPECIAL, &glyph_id);
+			int rc2 = font_resolve_glyph(font, U_SPECIAL, &glyph_id);
 			if (rc2 != EOK) {
 				return rc;
@@ -121,5 +121,5 @@
 
 /* TODO this is bad interface */
-errno_t font_draw_text(font_t *font, drawctx_t *context, source_t *source,
+int font_draw_text(font_t *font, drawctx_t *context, source_t *source,
     const char *text, sysarg_t sx, sysarg_t sy)
 {
@@ -128,5 +128,5 @@
 
 	font_metrics_t fm;
-	errno_t rc = font_get_metrics(font, &fm);
+	int rc = font_get_metrics(font, &fm);
 	if (rc != EOK)
 		return rc;
@@ -144,5 +144,5 @@
 		rc = font_resolve_glyph(font, c, &glyph_id);
 		if (rc != EOK) {
-			errno_t rc2 = font_resolve_glyph(font, U_SPECIAL, &glyph_id);
+			int rc2 = font_resolve_glyph(font, U_SPECIAL, &glyph_id);
 			if (rc2 != EOK) {
 				return rc;
Index: uspace/lib/draw/font.h
===================================================================
--- uspace/lib/draw/font.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/draw/font.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -91,8 +91,8 @@
 
 typedef struct {
-	errno_t (*get_font_metrics)(void *, font_metrics_t *);
-	errno_t (*resolve_glyph)(void *, wchar_t, glyph_id_t *);
-	errno_t (*get_glyph_metrics)(void *, glyph_id_t, glyph_metrics_t *);
-	errno_t (*render_glyph)(void *, drawctx_t *, source_t *, sysarg_t,
+	int (*get_font_metrics)(void *, font_metrics_t *);
+	int (*resolve_glyph)(void *, wchar_t, glyph_id_t *);
+	int (*get_glyph_metrics)(void *, glyph_id_t, glyph_metrics_t *);
+	int (*render_glyph)(void *, drawctx_t *, source_t *, sysarg_t,
 	    sysarg_t, glyph_id_t);
 	void (*release)(void *);
@@ -105,13 +105,13 @@
 
 extern font_t *font_create(font_backend_t *, void *);
-extern errno_t font_get_metrics(font_t *, font_metrics_t *);
-extern errno_t font_resolve_glyph(font_t *, wchar_t, glyph_id_t *);
-extern errno_t font_get_glyph_metrics(font_t *, glyph_id_t, glyph_metrics_t *);
-extern errno_t font_render_glyph(font_t *, drawctx_t *, source_t *,
+extern int font_get_metrics(font_t *, font_metrics_t *);
+extern int font_resolve_glyph(font_t *, wchar_t, glyph_id_t *);
+extern int font_get_glyph_metrics(font_t *, glyph_id_t, glyph_metrics_t *);
+extern int font_render_glyph(font_t *, drawctx_t *, source_t *,
     sysarg_t, sysarg_t, glyph_id_t);
 extern void font_release(font_t *);
 
-extern errno_t font_get_box(font_t *, char *, sysarg_t *, sysarg_t *);
-extern errno_t font_draw_text(font_t *, drawctx_t *, source_t *, const char *,
+extern int font_get_box(font_t *, char *, sysarg_t *, sysarg_t *);
+extern int font_draw_text(font_t *, drawctx_t *, source_t *, const char *,
     sysarg_t, sysarg_t);
 
Index: uspace/lib/draw/font/bitmap_backend.c
===================================================================
--- uspace/lib/draw/font/bitmap_backend.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/draw/font/bitmap_backend.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,5 +59,5 @@
 } bitmap_backend_data_t;
 
-static errno_t bb_get_font_metrics(void *backend_data, font_metrics_t *font_metrics)
+static int bb_get_font_metrics(void *backend_data, font_metrics_t *font_metrics)
 {
 	bitmap_backend_data_t *data = (bitmap_backend_data_t *) backend_data;
@@ -68,5 +68,5 @@
 }
 
-static errno_t bb_resolve_glyph(void *backend_data, wchar_t c, glyph_id_t *glyph_id)
+static int bb_resolve_glyph(void *backend_data, wchar_t c, glyph_id_t *glyph_id)
 {
 	bitmap_backend_data_t *data = (bitmap_backend_data_t *) backend_data;
@@ -74,5 +74,5 @@
 }
 
-static errno_t bb_get_glyph_metrics(void *backend_data, glyph_id_t glyph_id,
+static int bb_get_glyph_metrics(void *backend_data, glyph_id_t glyph_id,
     glyph_metrics_t *glyph_metrics)
 {
@@ -89,5 +89,5 @@
 	glyph_metrics_t gm;
 	
-	errno_t rc = data->decoder->load_glyph_metrics(data->decoder_data, glyph_id,
+	int rc = data->decoder->load_glyph_metrics(data->decoder_data, glyph_id,
 	    &gm);
 	if (rc != EOK)
@@ -115,5 +115,5 @@
 }
 
-static errno_t get_glyph_surface(bitmap_backend_data_t *data, glyph_id_t glyph_id,
+static int get_glyph_surface(bitmap_backend_data_t *data, glyph_id_t glyph_id,
     surface_t **result)
 {
@@ -127,5 +127,5 @@
 	
 	surface_t *raw_surface;
-	errno_t rc = data->decoder->load_glyph_surface(data->decoder_data, glyph_id,
+	int rc = data->decoder->load_glyph_surface(data->decoder_data, glyph_id,
 	    &raw_surface);
 	if (rc != EOK)
@@ -173,5 +173,5 @@
 }
 
-static errno_t bb_render_glyph(void *backend_data, drawctx_t *context,
+static int bb_render_glyph(void *backend_data, drawctx_t *context,
     source_t *source, sysarg_t ox, sysarg_t oy, glyph_id_t glyph_id)
 {
@@ -179,5 +179,5 @@
 	
 	glyph_metrics_t glyph_metrics;
-	errno_t rc = bb_get_glyph_metrics(backend_data, glyph_id, &glyph_metrics);
+	int rc = bb_get_glyph_metrics(backend_data, glyph_id, &glyph_metrics);
 	if (rc != EOK)
 		return rc;
@@ -224,5 +224,5 @@
 };
 
-errno_t bitmap_font_create(bitmap_font_decoder_t *decoder, void *decoder_data,
+int bitmap_font_create(bitmap_font_decoder_t *decoder, void *decoder_data,
     uint32_t glyph_count, font_metrics_t font_metrics, uint16_t points,
     font_t **out_font)
Index: uspace/lib/draw/font/bitmap_backend.h
===================================================================
--- uspace/lib/draw/font/bitmap_backend.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/draw/font/bitmap_backend.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,11 +45,11 @@
 
 typedef struct {
-	errno_t (*resolve_glyph)(void *, const wchar_t, glyph_id_t *);
-	errno_t (*load_glyph_surface)(void *, glyph_id_t, surface_t **);
-	errno_t (*load_glyph_metrics)(void *, glyph_id_t, glyph_metrics_t *);
+	int (*resolve_glyph)(void *, const wchar_t, glyph_id_t *);
+	int (*load_glyph_surface)(void *, glyph_id_t, surface_t **);
+	int (*load_glyph_metrics)(void *, glyph_id_t, glyph_metrics_t *);
 	void (*release)(void *);
 } bitmap_font_decoder_t;
 
-extern errno_t bitmap_font_create(bitmap_font_decoder_t *, void *, uint32_t,
+extern int bitmap_font_create(bitmap_font_decoder_t *, void *, uint32_t,
     font_metrics_t, uint16_t, font_t **);
 
Index: uspace/lib/draw/font/embedded.c
===================================================================
--- uspace/lib/draw/font/embedded.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/draw/font/embedded.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,5 @@
 #include "bitmap_backend.h"
 
-static errno_t fde_resolve_glyph(void *unused, const wchar_t chr,
+static int fde_resolve_glyph(void *unused, const wchar_t chr,
     glyph_id_t *glyph_id)
 {
@@ -56,5 +56,5 @@
 }
 
-static errno_t fde_load_glyph_surface(void *unused, glyph_id_t glyph_id,
+static int fde_load_glyph_surface(void *unused, glyph_id_t glyph_id,
     surface_t **out_surface)
 {
@@ -75,5 +75,5 @@
 }
 
-static errno_t fde_load_glyph_metrics(void *unused, glyph_id_t glyph_id,
+static int fde_load_glyph_metrics(void *unused, glyph_id_t glyph_id,
     glyph_metrics_t *gm)
 {
@@ -106,5 +106,5 @@
 };
 
-errno_t embedded_font_create(font_t **font, uint16_t points)
+int embedded_font_create(font_t **font, uint16_t points)
 {
 	return bitmap_font_create(&fd_embedded, NULL, FONT_GLYPHS, font_metrics,
Index: uspace/lib/draw/font/embedded.h
===================================================================
--- uspace/lib/draw/font/embedded.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/draw/font/embedded.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include "../font.h"
 
-extern errno_t embedded_font_create(font_t **, uint16_t points);
+extern int embedded_font_create(font_t **, uint16_t points);
 
 #endif
Index: uspace/lib/draw/font/pcf.c
===================================================================
--- uspace/lib/draw/font/pcf.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/draw/font/pcf.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,4 @@
 #include <offset.h>
 #include <stdlib.h>
-#include <str.h>
 
 #include "pcf.h"
@@ -147,5 +146,5 @@
 }
 
-static errno_t pcf_resolve_glyph(void *opaque_data, const wchar_t chr,
+static int pcf_resolve_glyph(void *opaque_data, const wchar_t chr,
     glyph_id_t *glyph_id)
 {
@@ -184,5 +183,5 @@
 }
 
-static errno_t load_glyph_metrics(pcf_data_t *data, uint32_t glyph_id,
+static int load_glyph_metrics(pcf_data_t *data, uint32_t glyph_id,
     pcf_toc_entry_t *table, pcf_default_metrics_t *metrics)
 {
@@ -254,5 +253,5 @@
 }
 
-static errno_t pcf_load_glyph_surface(void *opaque_data, glyph_id_t glyph_id,
+static int pcf_load_glyph_surface(void *opaque_data, glyph_id_t glyph_id,
     surface_t **out_surface)
 {
@@ -261,5 +260,5 @@
 	pcf_default_metrics_t pcf_metrics;
 	memset(&pcf_metrics, 0, sizeof(pcf_default_metrics_t));
-	errno_t rc = load_glyph_metrics(data, glyph_id, &data->metrics_table,
+	int rc = load_glyph_metrics(data, glyph_id, &data->metrics_table,
 	    &pcf_metrics);
 	if (rc != EOK)
@@ -269,5 +268,6 @@
 	    (glyph_id * sizeof(uint32_t));
 	
-	if (fseek(data->file, offset, SEEK_SET) < 0)
+	rc = fseek(data->file, offset, SEEK_SET);
+	if (rc != 0)
 		return errno;
 	
@@ -284,5 +284,6 @@
 	    + bitmap_offset;
 	
-	if (fseek(data->file, offset, SEEK_SET) < 0)
+	rc = fseek(data->file, offset, SEEK_SET);
+	if (rc != 0)
 		return errno;
 	
@@ -340,5 +341,5 @@
 }
 
-static errno_t pcf_load_glyph_metrics(void *opaque_data, glyph_id_t glyph_id,
+static int pcf_load_glyph_metrics(void *opaque_data, glyph_id_t glyph_id,
     glyph_metrics_t *gm)
 {
@@ -347,5 +348,5 @@
 	pcf_default_metrics_t pcf_metrics;
 	memset(&pcf_metrics, 0, sizeof(pcf_default_metrics_t));
-	errno_t rc = load_glyph_metrics(data, glyph_id, &data->metrics_table,
+	int rc = load_glyph_metrics(data, glyph_id, &data->metrics_table,
 	    &pcf_metrics);
 	if (rc != EOK)
@@ -378,5 +379,5 @@
 };
 
-static errno_t pcf_read_toc(pcf_data_t *data)
+static int pcf_read_toc(pcf_data_t *data)
 {
 	int rc = fseek(data->file, 0, SEEK_END);
@@ -461,5 +462,5 @@
 }
 
-static errno_t pcf_seek_table_header(pcf_data_t *data, pcf_toc_entry_t *table)
+static int pcf_seek_table_header(pcf_data_t *data, pcf_toc_entry_t *table)
 {
 	uint32_t format;
@@ -479,7 +480,7 @@
 }
 
-static errno_t pcf_read_bitmap_table_header(pcf_data_t *data)
-{
-	errno_t rc = pcf_seek_table_header(data, &data->bitmap_table);
+static int pcf_read_bitmap_table_header(pcf_data_t *data)
+{
+	int rc = pcf_seek_table_header(data, &data->bitmap_table);
 	if (rc != EOK)
 		return rc;
@@ -499,7 +500,7 @@
 }
 
-static errno_t pcf_read_metrics_table_header(pcf_data_t *data)
-{
-	errno_t rc = pcf_seek_table_header(data, &data->metrics_table);
+static int pcf_read_metrics_table_header(pcf_data_t *data)
+{
+	int rc = pcf_seek_table_header(data, &data->metrics_table);
 	if (rc != EOK)
 		return rc;
@@ -532,7 +533,7 @@
 }
 
-static errno_t pcf_read_encodings_table_header(pcf_data_t *data)
-{
-	errno_t rc = pcf_seek_table_header(data, &data->encodings_table);
+static int pcf_read_encodings_table_header(pcf_data_t *data)
+{
+	int rc = pcf_seek_table_header(data, &data->encodings_table);
 	if (rc != EOK)
 		return rc;
@@ -559,7 +560,7 @@
 }
 
-static errno_t pcf_read_accelerators_table(pcf_data_t *data)
-{
-	errno_t rc = pcf_seek_table_header(data, &data->accelerators_table);
+static int pcf_read_accelerators_table(pcf_data_t *data)
+{
+	int rc = pcf_seek_table_header(data, &data->accelerators_table);
 	if (rc != EOK)
 		return rc;
@@ -580,7 +581,7 @@
 }
 
-errno_t pcf_font_create(font_t **font, char *filename, uint16_t points)
-{
-	errno_t rc;
+int pcf_font_create(font_t **font, char *filename, uint16_t points)
+{
+	int rc;
 	pcf_data_t *data = malloc(sizeof(pcf_data_t));
 	if (data == NULL)
Index: uspace/lib/draw/font/pcf.h
===================================================================
--- uspace/lib/draw/font/pcf.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/draw/font/pcf.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include "../font.h"
 
-extern errno_t pcf_font_create(font_t **, char *path, uint16_t points);
+extern int pcf_font_create(font_t **, char *path, uint16_t points);
 
 #endif
Index: uspace/lib/draw/surface.h
===================================================================
--- uspace/lib/draw/surface.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/draw/surface.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,6 +60,6 @@
 extern void surface_get_damaged_region(surface_t *, surface_coord_t *, surface_coord_t *,
     surface_coord_t *, surface_coord_t *);
-extern void surface_add_damaged_region(surface_t *, surface_coord_t, surface_coord_t,
-    surface_coord_t, surface_coord_t);
+extern void surface_add_damaged_region(surface_t *, surface_coord_t , surface_coord_t ,
+    surface_coord_t , surface_coord_t );
 extern void surface_reset_damaged_region(surface_t *);
 
Index: uspace/lib/drv/generic/driver.c
===================================================================
--- uspace/lib/drv/generic/driver.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/driver.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -124,5 +124,5 @@
 	
 	char *dev_name = NULL;
-	errno_t rc = async_data_write_accept((void **) &dev_name, true, 0, 0, 0, 0);
+	int rc = async_data_write_accept((void **) &dev_name, true, 0, 0, 0, 0);
 	if (rc != EOK) {
 		async_answer_0(iid, rc);
@@ -157,5 +157,5 @@
 	(void) parent_fun_handle;
 	
-	errno_t res = driver->driver_ops->dev_add(dev);
+	int res = driver->driver_ops->dev_add(dev);
 	
 	if (res != EOK) {
@@ -189,5 +189,5 @@
 	}
 	
-	errno_t rc;
+	int rc;
 	
 	if (driver->driver_ops->dev_remove != NULL)
@@ -196,13 +196,8 @@
 		rc = ENOTSUP;
 	
-	if (rc == EOK) {
-		fibril_mutex_lock(&devices_mutex);
-		list_remove(&dev->link);
-		fibril_mutex_unlock(&devices_mutex);
+	if (rc == EOK)
 		dev_del_ref(dev);
-	}
-	
-	dev_del_ref(dev);
-	async_answer_0(iid, rc);
+	
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -222,5 +217,5 @@
 	}
 	
-	errno_t rc;
+	int rc;
 	
 	if (driver->driver_ops->dev_gone != NULL)
@@ -229,13 +224,8 @@
 		rc = ENOTSUP;
 	
-	if (rc == EOK) {
-		fibril_mutex_lock(&devices_mutex);
-		list_remove(&dev->link);
-		fibril_mutex_unlock(&devices_mutex);
+	if (rc == EOK)
 		dev_del_ref(dev);
-	}
-	
-	dev_del_ref(dev);
-	async_answer_0(iid, rc);
+	
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -263,5 +253,5 @@
 	
 	/* Call driver entry point */
-	errno_t rc;
+	int rc;
 	
 	if (driver->driver_ops->fun_online != NULL)
@@ -272,5 +262,5 @@
 	fun_del_ref(fun);
 	
-	async_answer_0(iid, rc);
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -298,5 +288,5 @@
 	
 	/* Call driver entry point */
-	errno_t rc;
+	int rc;
 	
 	if (driver->driver_ops->fun_offline != NULL)
@@ -305,5 +295,5 @@
 		rc = ENOTSUP;
 	
-	async_answer_0(iid, rc);
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -414,5 +404,5 @@
 	 */
 	
-	errno_t ret = EOK;
+	int ret = EOK;
 	/* Open device function */
 	if (fun->ops != NULL && fun->ops->open != NULL)
@@ -676,5 +666,5 @@
  * @return	EOK on success, ENOMEM if out of memory
  */
-errno_t ddf_fun_set_name(ddf_fun_t *dev, const char *name)
+int ddf_fun_set_name(ddf_fun_t *dev, const char *name)
 {
 	assert(dev->name == NULL);
@@ -822,8 +812,8 @@
  * @param fun Function to bind
  *
- * @return EOK on success or an error code
- *
- */
-errno_t ddf_fun_bind(ddf_fun_t *fun)
+ * @return EOK on success or negative error code
+ *
+ */
+int ddf_fun_bind(ddf_fun_t *fun)
 {
 	assert(fun->bound == false);
@@ -832,5 +822,5 @@
 	
 	add_to_functions_list(fun);
-	errno_t res = devman_add_function(fun->name, fun->ftype, &fun->match_ids,
+	int res = devman_add_function(fun->name, fun->ftype, &fun->match_ids,
 	    fun->dev->handle, &fun->handle);
 	if (res != EOK) {
@@ -850,12 +840,12 @@
  * @param fun Function to unbind
  *
- * @return EOK on success or an error code
- *
- */
-errno_t ddf_fun_unbind(ddf_fun_t *fun)
+ * @return EOK on success or negative error code
+ *
+ */
+int ddf_fun_unbind(ddf_fun_t *fun)
 {
 	assert(fun->bound == true);
 	
-	errno_t res = devman_remove_function(fun->handle);
+	int res = devman_remove_function(fun->handle);
 	if (res != EOK)
 		return res;
@@ -871,12 +861,12 @@
  * @param fun Function to online
  *
- * @return EOK on success or an error code
- *
- */
-errno_t ddf_fun_online(ddf_fun_t *fun)
+ * @return EOK on success or negative error code
+ *
+ */
+int ddf_fun_online(ddf_fun_t *fun)
 {
 	assert(fun->bound == true);
 	
-	errno_t res = devman_drv_fun_online(fun->handle);
+	int res = devman_drv_fun_online(fun->handle);
 	if (res != EOK)
 		return res;
@@ -889,12 +879,12 @@
  * @param fun Function to offline
  *
- * @return EOK on success or an error code
- *
- */
-errno_t ddf_fun_offline(ddf_fun_t *fun)
+ * @return EOK on success or negative error code
+ *
+ */
+int ddf_fun_offline(ddf_fun_t *fun)
 {
 	assert(fun->bound == true);
 	
-	errno_t res = devman_drv_fun_offline(fun->handle);
+	int res = devman_drv_fun_offline(fun->handle);
 	if (res != EOK)
 		return res;
@@ -916,5 +906,5 @@
  *
  */
-errno_t ddf_fun_add_match_id(ddf_fun_t *fun, const char *match_id_str,
+int ddf_fun_add_match_id(ddf_fun_t *fun, const char *match_id_str,
     int match_score)
 {
@@ -963,5 +953,5 @@
  *
  */
-errno_t ddf_fun_add_to_category(ddf_fun_t *fun, const char *cat_name)
+int ddf_fun_add_to_category(ddf_fun_t *fun, const char *cat_name)
 {
 	assert(fun->bound == true);
@@ -984,5 +974,5 @@
 	 */
 	port_id_t port;
-	errno_t rc = async_create_port(INTERFACE_DDF_DRIVER, driver_connection_driver,
+	int rc = async_create_port(INTERFACE_DDF_DRIVER, driver_connection_driver,
 	    NULL, &port);
 	if (rc != EOK) {
Index: uspace/lib/drv/generic/interrupt.c
===================================================================
--- uspace/lib/drv/generic/interrupt.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/interrupt.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,13 +43,12 @@
 #include "private/driver.h"
 
-errno_t register_interrupt_handler(ddf_dev_t *dev, int irq,
-    interrupt_handler_t *handler, const irq_code_t *irq_code,
-    cap_handle_t *handle)
+int register_interrupt_handler(ddf_dev_t *dev, int irq,
+    interrupt_handler_t *handler, const irq_code_t *irq_code)
 {
 	return async_irq_subscribe(irq, (async_notification_handler_t) handler,
-	    dev, irq_code, handle);
+	    dev, irq_code);
 }
 
-errno_t unregister_interrupt_handler(ddf_dev_t *dev, cap_handle_t cap)
+int unregister_interrupt_handler(ddf_dev_t *dev, int cap)
 {
 	return async_irq_unsubscribe(cap);
Index: uspace/lib/drv/generic/log.c
===================================================================
--- uspace/lib/drv/generic/log.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/log.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
  *
  */
-errno_t ddf_log_init(const char *drv_name)
+int ddf_log_init(const char *drv_name)
 {
 	return log_init(drv_name);
Index: uspace/lib/drv/generic/logbuf.c
===================================================================
--- uspace/lib/drv/generic/logbuf.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/logbuf.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,5 +35,4 @@
 #include <ddf/log.h>
 #include <assert.h>
-#include <str.h>
 
 /** Formatting string for printing number of not-printed items. */
Index: uspace/lib/drv/generic/private/driver.h
===================================================================
--- uspace/lib/drv/generic/private/driver.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/private/driver.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,5 +57,5 @@
 	
 	/** Device name */
-	char *name;
+	const char *name;
 	
 	/** Driver-specific data associated with this device */
@@ -84,5 +84,5 @@
 	
 	/** Function name */
-	char *name;
+	const char *name;
 	
 	/** List of device ids for driver matching */
Index: uspace/lib/drv/generic/remote_ahci.c
===================================================================
--- uspace/lib/drv/generic/remote_ahci.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_ahci.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,4 @@
 #include <stdio.h>
 #include <macros.h>
-#include <str.h>
 #include "ahci_iface.h"
 #include "ddf/driver.h"
@@ -66,5 +65,5 @@
 	
 	char devn[MAX_NAME_LENGTH];
-	errno_t rc = devman_fun_get_name(funh, devn, MAX_NAME_LENGTH);
+	int rc = devman_fun_get_name(funh, devn, MAX_NAME_LENGTH);
 	if (rc != EOK)
 		return NULL;
@@ -84,5 +83,5 @@
 }
 
-errno_t ahci_get_sata_device_name(async_sess_t *sess, size_t sata_dev_name_length,
+int ahci_get_sata_device_name(async_sess_t *sess, size_t sata_dev_name_length,
     char *sata_dev_name)
 {
@@ -96,5 +95,5 @@
 	async_data_read_start(exch, sata_dev_name, sata_dev_name_length);
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(req, &rc);
 	
@@ -102,5 +101,5 @@
 }
 
-errno_t ahci_get_num_blocks(async_sess_t *sess, uint64_t *blocks)
+int ahci_get_num_blocks(async_sess_t *sess, uint64_t *blocks)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -110,5 +109,5 @@
 	sysarg_t blocks_hi;
 	sysarg_t blocks_lo;
-	errno_t rc = async_req_1_2(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
+	int rc = async_req_1_2(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
 	    IPC_M_AHCI_GET_NUM_BLOCKS, &blocks_hi, &blocks_lo);
 	
@@ -123,5 +122,5 @@
 }
 
-errno_t ahci_get_block_size(async_sess_t *sess, size_t *blocks_size)
+int ahci_get_block_size(async_sess_t *sess, size_t *blocks_size)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -130,5 +129,5 @@
 	
 	sysarg_t bs;
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
+	int rc = async_req_1_1(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
 	    IPC_M_AHCI_GET_BLOCK_SIZE, &bs);
 	
@@ -141,5 +140,5 @@
 }
 
-errno_t ahci_read_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
+int ahci_read_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
     void *buf)
 {
@@ -156,5 +155,5 @@
 	async_exchange_end(exch);
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(req, &rc);
 	
@@ -162,5 +161,5 @@
 }
 
-errno_t ahci_write_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
+int ahci_write_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
     void* buf)
 {
@@ -176,5 +175,5 @@
 	async_exchange_end(exch);
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(req, &rc);
 	
@@ -228,5 +227,5 @@
 	}	
 	
-	const errno_t ret = ahci_iface->get_sata_device_name(fun,
+	const int ret = ahci_iface->get_sata_device_name(fun,
 	    sata_dev_name_length, sata_dev_name);
 	
@@ -252,5 +251,5 @@
 	
 	uint64_t blocks;
-	const errno_t ret = ahci_iface->get_num_blocks(fun, &blocks);
+	const int ret = ahci_iface->get_num_blocks(fun, &blocks);
 	
 	if (ret != EOK)
@@ -271,5 +270,5 @@
 	
 	size_t blocks;
-	const errno_t ret = ahci_iface->get_block_size(fun, &blocks);
+	const int ret = ahci_iface->get_block_size(fun, &blocks);
 	
 	if (ret != EOK)
@@ -303,5 +302,5 @@
 	const size_t cnt = (size_t) DEV_IPC_GET_ARG3(*call);
 	
-	const errno_t ret = ahci_iface->read_blocks(fun, blocknum, cnt, buf);
+	const int ret = ahci_iface->read_blocks(fun, blocknum, cnt, buf);
 	
 	async_answer_0(callid, ret);
@@ -332,5 +331,5 @@
 	const size_t cnt = (size_t) DEV_IPC_GET_ARG3(*call);
 	
-	const errno_t ret = ahci_iface->write_blocks(fun, blocknum, cnt, buf);
+	const int ret = ahci_iface->write_blocks(fun, blocknum, cnt, buf);
 	
 	async_answer_0(callid, ret);
Index: uspace/lib/drv/generic/remote_audio_mixer.c
===================================================================
--- uspace/lib/drv/generic/remote_audio_mixer.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_audio_mixer.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -94,10 +94,10 @@
  * @return Error code.
  */
-errno_t audio_mixer_get_info(async_exch_t *exch, char **name, unsigned *items)
+int audio_mixer_get_info(async_exch_t *exch, const char **name, unsigned *items)
 {
 	if (!exch)
 		return EINVAL;
 	sysarg_t name_size, itemc;
-	const errno_t ret = async_req_1_2(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
+	const int ret = async_req_1_2(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
 	    IPC_M_AUDIO_MIXER_GET_INFO, &name_size, &itemc);
 	if (ret == EOK && name) {
@@ -109,5 +109,5 @@
 			return ENOMEM;
 		}
-		const errno_t ret =
+		const int ret =
 		    async_data_read_start(exch, name_place, name_size);
 		if (ret != EOK) {
@@ -130,11 +130,11 @@
  * @return Error code.
  */
-errno_t audio_mixer_get_item_info(async_exch_t *exch, unsigned item,
-    char **name, unsigned *levels)
+int audio_mixer_get_item_info(async_exch_t *exch, unsigned item,
+    const char **name, unsigned *levels)
 {
 	if (!exch)
 		return EINVAL;
 	sysarg_t name_size, lvls;
-	const errno_t ret = async_req_2_2(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
+	const int ret = async_req_2_2(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
 	    IPC_M_AUDIO_MIXER_GET_ITEM_INFO, item, &name_size, &lvls);
 	if (ret == EOK && name) {
@@ -146,5 +146,5 @@
 			return ENOMEM;
 		}
-		const errno_t ret =
+		const int ret =
 		    async_data_read_start(exch, name_place, name_size);
 		if (ret != EOK) {
@@ -166,5 +166,5 @@
  * @return Error code.
  */
-errno_t audio_mixer_set_item_level(async_exch_t *exch, unsigned item,
+int audio_mixer_set_item_level(async_exch_t *exch, unsigned item,
     unsigned level)
 {
@@ -183,5 +183,5 @@
  * @return Error code.
  */
-errno_t audio_mixer_get_item_level(async_exch_t *exch, unsigned item,
+int audio_mixer_get_item_level(async_exch_t *exch, unsigned item,
     unsigned *level)
 {
@@ -189,5 +189,5 @@
 		return EINVAL;
 	sysarg_t current;
-	const errno_t ret = async_req_2_1(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
+	const int ret = async_req_2_1(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
 	    IPC_M_AUDIO_MIXER_GET_ITEM_LEVEL, item, &current);
 	if (ret == EOK && level)
@@ -229,5 +229,5 @@
 	const char *name = NULL;
 	unsigned items = 0;
-	const errno_t ret = mixer_iface->get_info(fun, &name, &items);
+	const int ret = mixer_iface->get_info(fun, &name, &items);
 	const size_t name_size = name ? str_size(name) + 1 : 0;
 	async_answer_2(callid, ret, name_size, items);
@@ -261,5 +261,5 @@
 	const char *name = NULL;
 	unsigned values = 0;
-	const errno_t ret = mixer_iface->get_item_info(fun, item, &name, &values);
+	const int ret = mixer_iface->get_item_info(fun, item, &name, &values);
 	const size_t name_size = name ? str_size(name) + 1 : 0;
 	async_answer_2(callid, ret, name_size, values);
@@ -291,5 +291,5 @@
 	const unsigned item = DEV_IPC_GET_ARG1(*call);
 	const unsigned value = DEV_IPC_GET_ARG2(*call);
-	const errno_t ret = mixer_iface->set_item_level(fun, item, value);
+	const int ret = mixer_iface->set_item_level(fun, item, value);
 	async_answer_0(callid, ret);
 }
@@ -306,5 +306,5 @@
 	const unsigned item = DEV_IPC_GET_ARG1(*call);
 	unsigned current = 0;
-	const errno_t ret =
+	const int ret =
 	    mixer_iface->get_item_level(fun, item, &current);
 	async_answer_1(callid, ret, current);
Index: uspace/lib/drv/generic/remote_audio_pcm.c
===================================================================
--- uspace/lib/drv/generic/remote_audio_pcm.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_audio_pcm.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -114,5 +114,5 @@
 	static category_id_t pcm_id = 0;
 	if (!resolved) {
-		const errno_t ret = loc_category_get_id("audio-pcm", &pcm_id,
+		const int ret = loc_category_get_id("audio-pcm", &pcm_id,
 		    IPC_FLAG_BLOCKING);
 		if (ret != EOK)
@@ -123,5 +123,5 @@
 	service_id_t *svcs = NULL;
 	size_t count = 0;
-	const errno_t ret = loc_category_get_svcs(pcm_id, &svcs, &count);
+	const int ret = loc_category_get_svcs(pcm_id, &svcs, &count);
 	if (ret != EOK)
 		return NULL;
@@ -143,5 +143,5 @@
 {
 	devman_handle_t device_handle = 0;
-	const errno_t ret = devman_fun_get_handle(name, &device_handle, 0);
+	const int ret = devman_fun_get_handle(name, &device_handle, 0);
 	if (ret != EOK)
 		return NULL;
@@ -184,5 +184,5 @@
  * @note Caller is responsible for freeing newly allocated memory.
  */
-errno_t audio_pcm_get_info_str(audio_pcm_sess_t *sess, char **name)
+int audio_pcm_get_info_str(audio_pcm_sess_t *sess, const char **name)
 {
 	if (!name)
@@ -190,5 +190,5 @@
 	async_exch_t *exch = async_exchange_begin(sess);
 	sysarg_t name_size;
-	const errno_t ret = async_req_1_1(exch,
+	const int ret = async_req_1_1(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_GET_INFO_STR, &name_size);
@@ -202,5 +202,5 @@
 			return ENOMEM;
 		}
-		const errno_t ret =
+		const int ret =
 		    async_data_read_start(exch, name_place, name_size);
 		if (ret != EOK) {
@@ -221,15 +221,18 @@
  * @param sess Audio device session.
  * @param cap  Audio device capability.
- * @param[out] val  Place to store queried value.
- *
- * @return Error code.
- */
-errno_t audio_pcm_query_cap(audio_pcm_sess_t *sess, audio_cap_t cap, sysarg_t *value)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_1(exch,
+ * @param val  Place to store queried value.
+ *
+ * @return Error code.
+ */
+int audio_pcm_query_cap(audio_pcm_sess_t *sess, audio_cap_t cap)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	sysarg_t value = 0;
+	const int ret = async_req_2_1(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_QUERY_CAPS,
-	    cap, value);
-	async_exchange_end(exch);
+	    cap, &value);
+	async_exchange_end(exch);
+	if (ret == EOK)
+		return value;
 	return ret;
 }
@@ -245,5 +248,5 @@
  * Works for both playback and capture.
  */
-errno_t audio_pcm_get_buffer_pos(audio_pcm_sess_t *sess, size_t *pos)
+int audio_pcm_get_buffer_pos(audio_pcm_sess_t *sess, size_t *pos)
 {
 	if (!pos)
@@ -251,5 +254,5 @@
 	async_exch_t *exch = async_exchange_begin(sess);
 	sysarg_t value = 0;
-	const errno_t ret = async_req_1_1(exch,
+	const int ret = async_req_1_1(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_GET_BUFFER_POS, &value);
@@ -273,5 +276,5 @@
  * parameters to the nearest values supported by the device.
  */
-errno_t audio_pcm_test_format(audio_pcm_sess_t *sess, unsigned *channels,
+int audio_pcm_test_format(audio_pcm_sess_t *sess, unsigned *channels,
     unsigned *rate, pcm_sample_format_t *format)
 {
@@ -280,5 +283,5 @@
 	sysarg_t rate_arg = rate ? *rate : 0;
 	sysarg_t format_arg = format ? *format : 0;
-	const errno_t ret = async_req_4_3(exch,
+	const int ret = async_req_4_3(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_TEST_FORMAT, channels_arg, rate_arg, format_arg,
@@ -311,5 +314,5 @@
  * @return Error code.
  */
-errno_t audio_pcm_register_event_callback(audio_pcm_sess_t *sess,
+int audio_pcm_register_event_callback(audio_pcm_sess_t *sess,
     async_port_handler_t event_callback, void *arg)
 {
@@ -319,5 +322,5 @@
 	async_exch_t *exch = async_exchange_begin(sess);
 	
-	errno_t ret = async_req_1_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
+	int ret = async_req_1_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_REGISTER_EVENTS);
 	if (ret == EOK) {
@@ -338,8 +341,8 @@
  * @return Error code.
  */
-errno_t audio_pcm_unregister_event_callback(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_1_0(exch,
+int audio_pcm_unregister_event_callback(audio_pcm_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	const int ret = async_req_1_0(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_UNREGISTER_EVENTS);
@@ -357,5 +360,5 @@
  * @return Error code.
  */
-errno_t audio_pcm_get_buffer(audio_pcm_sess_t *sess, void **buffer, size_t *size)
+int audio_pcm_get_buffer(audio_pcm_sess_t *sess, void **buffer, size_t *size)
 {
 	if (!buffer || !size)
@@ -365,5 +368,5 @@
 
 	sysarg_t buffer_size = *size;
-	errno_t ret = async_req_2_1(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
+	int ret = async_req_2_1(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_GET_BUFFER, (sysarg_t)buffer_size, &buffer_size);
 	if (ret == EOK) {
@@ -388,8 +391,8 @@
  * @return Error code.
  */
-errno_t audio_pcm_release_buffer(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_1_0(exch,
+int audio_pcm_release_buffer(audio_pcm_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	const int ret = async_req_1_0(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_RELEASE_BUFFER);
@@ -412,5 +415,5 @@
  * 0 to turn off event generation.
  */
-errno_t audio_pcm_start_playback_fragment(audio_pcm_sess_t *sess, unsigned frames,
+int audio_pcm_start_playback_fragment(audio_pcm_sess_t *sess, unsigned frames,
     unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
 {
@@ -420,5 +423,5 @@
 	const sysarg_t packed = (channels << 16) | (format & UINT16_MAX);
 	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_4_0(exch,
+	const int ret = async_req_4_0(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_START_PLAYBACK,
@@ -434,8 +437,8 @@
  * @return Error code.
  */
-errno_t audio_pcm_last_playback_fragment(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
+int audio_pcm_last_playback_fragment(audio_pcm_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	const int ret = async_req_2_0(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_STOP_PLAYBACK, false);
@@ -454,5 +457,5 @@
  * @return Error code.
  */
-errno_t audio_pcm_start_playback(audio_pcm_sess_t *sess,
+int audio_pcm_start_playback(audio_pcm_sess_t *sess,
     unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
 {
@@ -468,8 +471,8 @@
  * @return Error code.
  */
-errno_t audio_pcm_stop_playback_immediate(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
+int audio_pcm_stop_playback_immediate(audio_pcm_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	const int ret = async_req_2_0(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_STOP_PLAYBACK, true);
@@ -485,8 +488,8 @@
  * @return Error code.
  */
-errno_t audio_pcm_stop_playback(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
+int audio_pcm_stop_playback(audio_pcm_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	const int ret = async_req_2_0(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_STOP_PLAYBACK, false);
@@ -509,5 +512,5 @@
  * 0 to turn off event generation.
  */
-errno_t audio_pcm_start_capture_fragment(audio_pcm_sess_t *sess, unsigned frames,
+int audio_pcm_start_capture_fragment(audio_pcm_sess_t *sess, unsigned frames,
     unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
 {
@@ -517,5 +520,5 @@
 	const sysarg_t packed = (channels << 16) | (format & UINT16_MAX);
 	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_4_0(exch,
+	const int ret = async_req_4_0(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_START_CAPTURE,
 	    frames, sample_rate, packed);
@@ -534,5 +537,5 @@
  * @return Error code.
  */
-errno_t audio_pcm_start_capture(audio_pcm_sess_t *sess,
+int audio_pcm_start_capture(audio_pcm_sess_t *sess,
     unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
 {
@@ -549,8 +552,8 @@
  * @return Error code.
  */
-errno_t audio_pcm_last_capture_fragment(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
+int audio_pcm_last_capture_fragment(audio_pcm_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	const int ret = async_req_2_0(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_STOP_CAPTURE, false);
@@ -566,8 +569,8 @@
  * @return Error code.
  */
-errno_t audio_pcm_stop_capture_immediate(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
+int audio_pcm_stop_capture_immediate(audio_pcm_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	const int ret = async_req_2_0(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_STOP_CAPTURE, true);
@@ -583,8 +586,8 @@
  * @return Error code.
  */
-errno_t audio_pcm_stop_capture(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
+int audio_pcm_stop_capture(audio_pcm_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	const int ret = async_req_2_0(exch,
 	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
 	    IPC_M_AUDIO_PCM_STOP_CAPTURE, false);
@@ -641,5 +644,5 @@
 	}
 	const char *name = NULL;
-	const errno_t ret = pcm_iface->get_info_str(fun, &name);
+	const int ret = pcm_iface->get_info_str(fun, &name);
 	const size_t name_size = name ? str_size(name) + 1 : 0;
 	async_answer_1(callid, ret, name_size);
@@ -692,5 +695,5 @@
 		return;
 	}
-	const errno_t ret = pcm_iface->set_event_session(fun, sess);
+	const int ret = pcm_iface->set_event_session(fun, sess);
 	if (ret != EOK) {
 		ddf_msg(LVL_DEBUG, "Failed to set event callback.");
@@ -722,5 +725,5 @@
 	const audio_pcm_iface_t *pcm_iface = iface;
 	size_t pos = 0;
-	const errno_t ret = pcm_iface->get_buffer_pos ?
+	const int ret = pcm_iface->get_buffer_pos ?
 	    pcm_iface->get_buffer_pos(fun, &pos) : ENOTSUP;
 	async_answer_1(callid, ret, pos);
@@ -733,5 +736,5 @@
 	unsigned rate = DEV_IPC_GET_ARG2(*call);
 	pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call);
-	const errno_t ret = pcm_iface->test_format ?
+	const int ret = pcm_iface->test_format ?
 	    pcm_iface->test_format(fun, &channels, &rate, &format) : ENOTSUP;
 	async_answer_3(callid, ret, channels, rate, format);
@@ -750,5 +753,5 @@
 	void *buffer = NULL;
 	size_t size = DEV_IPC_GET_ARG1(*call);
-	errno_t ret = pcm_iface->get_buffer(fun, &buffer, &size);
+	int ret = pcm_iface->get_buffer(fun, &buffer, &size);
 	async_answer_1(callid, ret, size);
 	if (ret != EOK || size == 0)
@@ -792,5 +795,5 @@
 	const audio_pcm_iface_t *pcm_iface = iface;
 
-	const errno_t ret = pcm_iface->release_buffer ?
+	const int ret = pcm_iface->release_buffer ?
 	    pcm_iface->release_buffer(fun) : ENOTSUP;
 	async_answer_0(callid, ret);
@@ -807,5 +810,5 @@
 	const pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call) & UINT16_MAX;
 
-	const errno_t ret = pcm_iface->start_playback
+	const int ret = pcm_iface->start_playback
 	    ? pcm_iface->start_playback(fun, frames, channels, rate, format)
 	    : ENOTSUP;
@@ -819,5 +822,5 @@
 	const bool immediate = DEV_IPC_GET_ARG1(*call);
 
-	const errno_t ret = pcm_iface->stop_playback ?
+	const int ret = pcm_iface->stop_playback ?
 	    pcm_iface->stop_playback(fun, immediate) : ENOTSUP;
 	async_answer_0(callid, ret);
@@ -834,5 +837,5 @@
 	const pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call) & UINT16_MAX;
 
-	const errno_t ret = pcm_iface->start_capture
+	const int ret = pcm_iface->start_capture
 	    ? pcm_iface->start_capture(fun, frames, channels, rate, format)
 	    : ENOTSUP;
@@ -846,5 +849,5 @@
 	const bool immediate = DEV_IPC_GET_ARG1(*call);
 
-	const errno_t ret = pcm_iface->stop_capture ?
+	const int ret = pcm_iface->stop_capture ?
 	    pcm_iface->stop_capture(fun, immediate) : ENOTSUP;
 	async_answer_0(callid, ret);
Index: uspace/lib/drv/generic/remote_battery_dev.c
===================================================================
--- uspace/lib/drv/generic/remote_battery_dev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_battery_dev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,7 +45,7 @@
  * @param status   Current status of the battery
  *
- * @return         EOK on success or an error code
+ * @return         EOK on success or a negative error code
  */
-errno_t
+int
 battery_status_get(async_sess_t *sess, battery_status_t *batt_status)
 {
@@ -54,5 +54,5 @@
 	async_exch_t *exch = async_exchange_begin(sess);
 
-	errno_t const rc = async_req_1_1(exch, DEV_IFACE_ID(BATTERY_DEV_IFACE),
+	int const rc = async_req_1_1(exch, DEV_IFACE_ID(BATTERY_DEV_IFACE),
 	    BATTERY_STATUS_GET, &status);
 
@@ -70,7 +70,7 @@
  * @param level    Battery charge level (0 - 100)
  *
- * @return         EOK on success or an error code
+ * @return         EOK on success or a negative error code
  */
-errno_t
+int
 battery_charge_level_get(async_sess_t *sess, int *level)
 {
@@ -79,5 +79,5 @@
 	async_exch_t *exch = async_exchange_begin(sess);
 
-	errno_t const rc = async_req_1_1(exch, DEV_IFACE_ID(BATTERY_DEV_IFACE),
+	int const rc = async_req_1_1(exch, DEV_IFACE_ID(BATTERY_DEV_IFACE),
 	    BATTERY_CHARGE_LEVEL_GET, &charge_level);
 
@@ -129,5 +129,5 @@
 
 	battery_status_t batt_status;
-	const errno_t rc = bops->battery_status_get(fun, &batt_status);
+	const int rc = bops->battery_status_get(fun, &batt_status);
 
 	if (rc != EOK)
@@ -155,5 +155,5 @@
 
 	int battery_level;
-	const errno_t rc = bops->battery_charge_level_get(fun, &battery_level);
+	const int rc = bops->battery_charge_level_get(fun, &battery_level);
 
 	if (rc != EOK)
Index: uspace/lib/drv/generic/remote_clock_dev.c
===================================================================
--- uspace/lib/drv/generic/remote_clock_dev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_clock_dev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -75,5 +75,5 @@
 	ipc_callid_t cid;
 	struct tm t;
-	errno_t rc;
+	int rc;
 	size_t len;
 
@@ -114,5 +114,5 @@
 {
 	clock_dev_ops_t *clock_dev_ops = (clock_dev_ops_t *) ops;
-	errno_t      rc;
+	int          rc;
 	struct tm    t;
 	ipc_callid_t cid;
Index: uspace/lib/drv/generic/remote_hw_res.c
===================================================================
--- uspace/lib/drv/generic/remote_hw_res.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_hw_res.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -79,5 +79,5 @@
 	
 	const int irq = DEV_IPC_GET_ARG1(*call);
-	const errno_t ret = hw_res_ops->enable_interrupt(fun, irq);
+	const int ret = hw_res_ops->enable_interrupt(fun, irq);
 	async_answer_0(callid, ret);
 }
@@ -94,5 +94,5 @@
 	
 	const int irq = DEV_IPC_GET_ARG1(*call);
-	const errno_t ret = hw_res_ops->disable_interrupt(fun, irq);
+	const int ret = hw_res_ops->disable_interrupt(fun, irq);
 	async_answer_0(callid, ret);
 }
@@ -109,5 +109,5 @@
 	
 	const int irq = DEV_IPC_GET_ARG1(*call);
-	const errno_t ret = hw_res_ops->enable_interrupt(fun, irq);
+	const int ret = hw_res_ops->enable_interrupt(fun, irq);
 	async_answer_0(callid, ret);
 }
@@ -153,5 +153,5 @@
 	const uint32_t size = DEV_IPC_GET_ARG3(*call);
 
-	const errno_t ret = hw_res_ops->dma_channel_setup(
+	const int ret = hw_res_ops->dma_channel_setup(
 	    fun, channel, address, size, mode);
 	async_answer_0(callid, ret);
@@ -169,5 +169,5 @@
 	const unsigned channel = DEV_IPC_GET_ARG1(*call);
 	size_t remain = 0;
-	const errno_t ret = hw_res_ops->dma_channel_remain(fun, channel, &remain);
+	const int ret = hw_res_ops->dma_channel_remain(fun, channel, &remain);
 	async_answer_1(callid, ret, remain);
 }
Index: uspace/lib/drv/generic/remote_ieee80211.c
===================================================================
--- uspace/lib/drv/generic/remote_ieee80211.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_ieee80211.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,8 +59,8 @@
  *
  * @return EOK If the operation was successfully completed,
- *         error code otherwise.
- *
- */
-errno_t ieee80211_get_scan_results(async_sess_t *dev_sess,
+ *         negative error code otherwise.
+ *
+ */
+int ieee80211_get_scan_results(async_sess_t *dev_sess,
     ieee80211_scan_results_t *results, bool now)
 {
@@ -71,13 +71,13 @@
 	aid_t aid = async_send_2(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
 	    IEEE80211_GET_SCAN_RESULTS, now, NULL);
-	errno_t rc = async_data_read_start(exch, results,
+	int rc = async_data_read_start(exch, results,
 	    sizeof(ieee80211_scan_results_t));
 	async_exchange_end(exch);
 	
-	errno_t res;
+	sysarg_t res;
 	async_wait_for(aid, &res);
 	
 	if(res != EOK)
-		return (errno_t) res;
+		return (int) res;
 	
 	return rc;
@@ -100,5 +100,5 @@
 	size_t count;
 	
-	errno_t rc = inetcfg_get_link_list(&link_list, &count);
+	int rc = inetcfg_get_link_list(&link_list, &count);
 	if (rc != EOK)
 		return -1;
@@ -123,12 +123,12 @@
  *
  * @return EOK If the operation was successfully completed,
- *         error code otherwise.
- *
- */
-errno_t ieee80211_connect(async_sess_t *dev_sess, char *ssid_start, char *password)
+ *         negative error code otherwise.
+ *
+ */
+int ieee80211_connect(async_sess_t *dev_sess, char *ssid_start, char *password)
 {
 	assert(ssid_start);
 	
-	errno_t rc_orig;
+	sysarg_t rc_orig;
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
@@ -137,5 +137,5 @@
 	    IEEE80211_CONNECT, NULL);
 	
-	errno_t rc = async_data_write_start(exch, ssid_start,
+	sysarg_t rc = async_data_write_start(exch, ssid_start,
 	    str_size(ssid_start) + 1);
 	if (rc != EOK) {
@@ -144,7 +144,7 @@
 		
 		if (rc_orig == EOK)
-			return (errno_t) rc;
-		
-		return (errno_t) rc_orig;
+			return (int) rc;
+		
+		return (int) rc_orig;
 	}
 	
@@ -159,7 +159,7 @@
 		
 		if (rc_orig == EOK)
-			return (errno_t) rc;
-		
-		return (errno_t) rc_orig;
+			return (int) rc;
+		
+		return (int) rc_orig;
 	}
 	
@@ -182,5 +182,5 @@
 	rc = dhcp_discover(link_id);
 	
-	return (errno_t) rc;
+	return (int) rc;
 }
 
@@ -190,11 +190,11 @@
  *
  * @return EOK If the operation was successfully completed,
- *         error code otherwise.
- *
- */
-errno_t ieee80211_disconnect(async_sess_t *dev_sess)
+ *         negative error code otherwise.
+ *
+ */
+int ieee80211_disconnect(async_sess_t *dev_sess)
 {
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
+	int rc = async_req_1_0(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
 	    IEEE80211_DISCONNECT);
 	async_exchange_end(exch);
@@ -278,5 +278,5 @@
 	bool now = IPC_GET_ARG2(*call);
 	
-	errno_t rc = ieee80211_iface->get_scan_results(fun, &scan_results, now);
+	int rc = ieee80211_iface->get_scan_results(fun, &scan_results, now);
 	if (rc == EOK) {
 		ipc_callid_t data_callid;
@@ -324,5 +324,5 @@
 	}
 	
-	errno_t rc = async_data_write_finalize(data_callid, ssid_start, len);
+	int rc = async_data_write_finalize(data_callid, ssid_start, len);
 	if (rc != EOK) {
 		async_answer_0(data_callid, EINVAL);
@@ -360,5 +360,5 @@
 	ieee80211_iface_t *ieee80211_iface = (ieee80211_iface_t *) iface;
 	assert(ieee80211_iface->disconnect);
-	errno_t rc = ieee80211_iface->disconnect(fun);
+	int rc = ieee80211_iface->disconnect(fun);
 	async_answer_0(callid, rc);
 }
Index: uspace/lib/drv/generic/remote_led_dev.c
===================================================================
--- uspace/lib/drv/generic/remote_led_dev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_led_dev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -77,5 +77,5 @@
 	}
 	
-	errno_t rc = (*led_dev_ops->color_set)(fun, color);
+	int rc = (*led_dev_ops->color_set)(fun, color);
 	async_answer_0(callid, rc);
 }
Index: uspace/lib/drv/generic/remote_nic.c
===================================================================
--- uspace/lib/drv/generic/remote_nic.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_nic.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -98,5 +98,5 @@
  *
  */
-errno_t nic_send_frame(async_sess_t *dev_sess, void *data, size_t size)
+int nic_send_frame(async_sess_t *dev_sess, void *data, size_t size)
 {
 	async_exch_t *exch = async_exchange_begin(dev_sess);
@@ -105,5 +105,5 @@
 	aid_t req = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_SEND_MESSAGE, &answer);
-	errno_t retval = async_data_write_start(exch, data, size);
+	sysarg_t retval = async_data_write_start(exch, data, size);
 	
 	async_exchange_end(exch);
@@ -126,10 +126,10 @@
  *
  */
-errno_t nic_callback_create(async_sess_t *dev_sess, async_port_handler_t cfun,
+int nic_callback_create(async_sess_t *dev_sess, async_port_handler_t cfun,
     void *carg)
 {
 	ipc_call_t answer;
-	errno_t rc;
-	errno_t retval;
+	int rc;
+	sysarg_t retval;
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
@@ -147,5 +147,5 @@
 	
 	async_wait_for(req, &retval);
-	return retval;
+	return (int) retval;
 }
 
@@ -158,5 +158,5 @@
  *
  */
-errno_t nic_get_state(async_sess_t *dev_sess, nic_device_state_t *state)
+int nic_get_state(async_sess_t *dev_sess, nic_device_state_t *state)
 {
 	assert(state);
@@ -165,5 +165,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_GET_STATE, &_state);
 	async_exchange_end(exch);
@@ -182,8 +182,8 @@
  *
  */
-errno_t nic_set_state(async_sess_t *dev_sess, nic_device_state_t state)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+int nic_set_state(async_sess_t *dev_sess, nic_device_state_t state)
+{
+	async_exch_t *exch = async_exchange_begin(dev_sess);
+	int rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_SET_STATE, state);
 	async_exchange_end(exch);
@@ -200,5 +200,5 @@
  *
  */
-errno_t nic_get_address(async_sess_t *dev_sess, nic_address_t *address)
+int nic_get_address(async_sess_t *dev_sess, nic_address_t *address)
 {
 	assert(address);
@@ -207,8 +207,8 @@
 	aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_GET_ADDRESS, NULL);
-	errno_t rc = async_data_read_start(exch, address, sizeof(nic_address_t));
-	async_exchange_end(exch);
-	
-	errno_t res;
+	int rc = async_data_read_start(exch, address, sizeof(nic_address_t));
+	async_exchange_end(exch);
+	
+	sysarg_t res;
 	async_wait_for(aid, &res);
 	
@@ -216,5 +216,5 @@
 		return rc;
 	
-	return res;
+	return (int) res;
 }
 
@@ -227,5 +227,5 @@
  *
  */
-errno_t nic_set_address(async_sess_t *dev_sess, const nic_address_t *address)
+int nic_set_address(async_sess_t *dev_sess, const nic_address_t *address)
 {
 	assert(address);
@@ -234,8 +234,8 @@
 	aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_SET_ADDRESS, NULL);
-	errno_t rc = async_data_write_start(exch, address, sizeof(nic_address_t));
-	async_exchange_end(exch);
-	
-	errno_t res;
+	int rc = async_data_write_start(exch, address, sizeof(nic_address_t));
+	async_exchange_end(exch);
+	
+	sysarg_t res;
 	async_wait_for(aid, &res);
 	
@@ -243,5 +243,5 @@
 		return rc;
 	
-	return res;
+	return (int) res;
 }
 
@@ -254,5 +254,5 @@
  *
  */
-errno_t nic_get_stats(async_sess_t *dev_sess, nic_device_stats_t *stats)
+int nic_get_stats(async_sess_t *dev_sess, nic_device_stats_t *stats)
 {
 	assert(stats);
@@ -260,5 +260,5 @@
 	async_exch_t *exch = async_exchange_begin(dev_sess);
 	
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_GET_STATS);
 	if (rc != EOK) {
@@ -284,5 +284,5 @@
  *
  */
-errno_t nic_get_device_info(async_sess_t *dev_sess, nic_device_info_t *device_info)
+int nic_get_device_info(async_sess_t *dev_sess, nic_device_info_t *device_info)
 {
 	assert(device_info);
@@ -292,8 +292,8 @@
 	aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_GET_DEVICE_INFO, NULL);
-	errno_t rc = async_data_read_start(exch, device_info, sizeof(nic_device_info_t));
-	async_exchange_end(exch);
-
-	errno_t res;
+	int rc = async_data_read_start(exch, device_info, sizeof(nic_device_info_t));
+	async_exchange_end(exch);
+
+	sysarg_t res;
 	async_wait_for(aid, &res);
 	
@@ -301,5 +301,5 @@
 		return rc;
 	
-	return res;
+	return (int) res;
 }
 
@@ -312,5 +312,5 @@
  *
  */
-errno_t nic_get_cable_state(async_sess_t *dev_sess, nic_cable_state_t *cable_state)
+int nic_get_cable_state(async_sess_t *dev_sess, nic_cable_state_t *cable_state)
 {
 	assert(cable_state);
@@ -319,5 +319,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_GET_CABLE_STATE, &_cable_state);
 	async_exchange_end(exch);
@@ -338,5 +338,5 @@
  *
  */
-errno_t nic_get_operation_mode(async_sess_t *dev_sess, int *speed,
+int nic_get_operation_mode(async_sess_t *dev_sess, int *speed,
    nic_channel_mode_t *duplex, nic_role_t *role)
 {
@@ -346,5 +346,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_1_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_GET_OPERATION_MODE, &_speed, &_duplex, &_role);
 	async_exchange_end(exch);
@@ -375,9 +375,9 @@
  *
  */
-errno_t nic_set_operation_mode(async_sess_t *dev_sess, int speed,
+int nic_set_operation_mode(async_sess_t *dev_sess, int speed,
     nic_channel_mode_t duplex, nic_role_t role)
 {
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_4_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_4_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_SET_OPERATION_MODE, (sysarg_t) speed, (sysarg_t) duplex,
 	    (sysarg_t) role);
@@ -400,8 +400,8 @@
  *
  */
-errno_t nic_autoneg_enable(async_sess_t *dev_sess, uint32_t advertisement)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+int nic_autoneg_enable(async_sess_t *dev_sess, uint32_t advertisement)
+{
+	async_exch_t *exch = async_exchange_begin(dev_sess);
+	int rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_AUTONEG_ENABLE, (sysarg_t) advertisement);
 	async_exchange_end(exch);
@@ -417,8 +417,8 @@
  *
  */
-errno_t nic_autoneg_disable(async_sess_t *dev_sess)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+int nic_autoneg_disable(async_sess_t *dev_sess)
+{
+	async_exch_t *exch = async_exchange_begin(dev_sess);
+	int rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_AUTONEG_DISABLE);
 	async_exchange_end(exch);
@@ -444,5 +444,5 @@
  *
  */
-errno_t nic_autoneg_probe(async_sess_t *dev_sess, uint32_t *our_advertisement,
+int nic_autoneg_probe(async_sess_t *dev_sess, uint32_t *our_advertisement,
     uint32_t *their_advertisement, nic_result_t *result,
     nic_result_t *their_result)
@@ -454,5 +454,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_4(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_1_4(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_AUTONEG_PROBE, &_our_advertisement, &_their_advertisement,
 	    &_result, &_their_result);
@@ -481,8 +481,8 @@
  *
  */
-errno_t nic_autoneg_restart(async_sess_t *dev_sess)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+int nic_autoneg_restart(async_sess_t *dev_sess)
+{
+	async_exch_t *exch = async_exchange_begin(dev_sess);
+	int rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_AUTONEG_RESTART);
 	async_exchange_end(exch);
@@ -501,5 +501,5 @@
  *
  */
-errno_t nic_get_pause(async_sess_t *dev_sess, nic_result_t *we_send,
+int nic_get_pause(async_sess_t *dev_sess, nic_result_t *we_send,
     nic_result_t *we_receive, uint16_t *pause)
 {
@@ -509,5 +509,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_1_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_GET_PAUSE, &_we_send, &_we_receive, &_pause);
 	async_exchange_end(exch);
@@ -539,9 +539,9 @@
  *
  */
-errno_t nic_set_pause(async_sess_t *dev_sess, int allow_send, int allow_receive,
+int nic_set_pause(async_sess_t *dev_sess, int allow_send, int allow_receive,
     uint16_t pause)
 {
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_4_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_4_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_SET_PAUSE, allow_send, allow_receive, pause);
 	async_exchange_end(exch);
@@ -566,5 +566,5 @@
  *
  */
-errno_t nic_unicast_get_mode(async_sess_t *dev_sess, nic_unicast_mode_t *mode,
+int nic_unicast_get_mode(async_sess_t *dev_sess, nic_unicast_mode_t *mode,
     size_t max_count, nic_address_t *address_list, size_t *address_count)
 {
@@ -579,5 +579,5 @@
 	async_exch_t *exch = async_exchange_begin(dev_sess);
 	
-	errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_UNICAST_GET_MODE, max_count, &_mode, &_address_count);
 	if (rc != EOK) {
@@ -609,5 +609,5 @@
  *
  */
-errno_t nic_unicast_set_mode(async_sess_t *dev_sess, nic_unicast_mode_t mode,
+int nic_unicast_set_mode(async_sess_t *dev_sess, nic_unicast_mode_t mode,
     const nic_address_t *address_list, size_t address_count)
 {
@@ -620,5 +620,5 @@
 	    NIC_UNICAST_SET_MODE, (sysarg_t) mode, address_count, NULL);
 	
-	errno_t rc;
+	int rc;
 	if (address_count)
 		rc = async_data_write_start(exch, address_list,
@@ -629,5 +629,5 @@
 	async_exchange_end(exch);
 	
-	errno_t res;
+	sysarg_t res;
 	async_wait_for(message_id, &res);
 	
@@ -635,5 +635,5 @@
 		return rc;
 	
-	return res;
+	return (int) res;
 }
 
@@ -655,5 +655,5 @@
  *
  */
-errno_t nic_multicast_get_mode(async_sess_t *dev_sess, nic_multicast_mode_t *mode,
+int nic_multicast_get_mode(async_sess_t *dev_sess, nic_multicast_mode_t *mode,
     size_t max_count, nic_address_t *address_list, size_t *address_count)
 {
@@ -668,5 +668,5 @@
 	
 	sysarg_t ac;
-	errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_MULTICAST_GET_MODE, max_count, &_mode, &ac);
 	if (rc != EOK) {
@@ -697,5 +697,5 @@
  *
  */
-errno_t nic_multicast_set_mode(async_sess_t *dev_sess, nic_multicast_mode_t mode,
+int nic_multicast_set_mode(async_sess_t *dev_sess, nic_multicast_mode_t mode,
     const nic_address_t *address_list, size_t address_count)
 {
@@ -708,5 +708,5 @@
 	    NIC_MULTICAST_SET_MODE, (sysarg_t) mode, address_count, NULL);
 	
-	errno_t rc;
+	int rc;
 	if (address_count)
 		rc = async_data_write_start(exch, address_list,
@@ -717,5 +717,5 @@
 	async_exchange_end(exch);
 	
-	errno_t res;
+	sysarg_t res;
 	async_wait_for(message_id, &res);
 	
@@ -723,5 +723,5 @@
 		return rc;
 	
-	return res;
+	return (int) res;
 }
 
@@ -734,5 +734,5 @@
  *
  */
-errno_t nic_broadcast_get_mode(async_sess_t *dev_sess, nic_broadcast_mode_t *mode)
+int nic_broadcast_get_mode(async_sess_t *dev_sess, nic_broadcast_mode_t *mode)
 {
 	assert(mode);
@@ -741,5 +741,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_BROADCAST_GET_MODE, &_mode);
 	async_exchange_end(exch);
@@ -758,8 +758,8 @@
  *
  */
-errno_t nic_broadcast_set_mode(async_sess_t *dev_sess, nic_broadcast_mode_t mode)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+int nic_broadcast_set_mode(async_sess_t *dev_sess, nic_broadcast_mode_t mode)
+{
+	async_exch_t *exch = async_exchange_begin(dev_sess);
+	int rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_BROADCAST_SET_MODE, mode);
 	async_exchange_end(exch);
@@ -776,5 +776,5 @@
  *
  */
-errno_t nic_defective_get_mode(async_sess_t *dev_sess, uint32_t *mode)
+int nic_defective_get_mode(async_sess_t *dev_sess, uint32_t *mode)
 {
 	assert(mode);
@@ -783,5 +783,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_DEFECTIVE_GET_MODE, &_mode);
 	async_exchange_end(exch);
@@ -800,8 +800,8 @@
  *
  */
-errno_t nic_defective_set_mode(async_sess_t *dev_sess, uint32_t mode)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+int nic_defective_set_mode(async_sess_t *dev_sess, uint32_t mode)
+{
+	async_exch_t *exch = async_exchange_begin(dev_sess);
+	int rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_DEFECTIVE_SET_MODE, mode);
 	async_exchange_end(exch);
@@ -822,5 +822,5 @@
  *
  */
-errno_t nic_blocked_sources_get(async_sess_t *dev_sess, size_t max_count,
+int nic_blocked_sources_get(async_sess_t *dev_sess, size_t max_count,
     nic_address_t *address_list, size_t *address_count)
 {
@@ -831,5 +831,5 @@
 	
 	sysarg_t ac;
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_BLOCKED_SOURCES_GET, max_count, &ac);
 	if (rc != EOK) {
@@ -858,5 +858,5 @@
  *
  */
-errno_t nic_blocked_sources_set(async_sess_t *dev_sess,
+int nic_blocked_sources_set(async_sess_t *dev_sess,
     const nic_address_t *address_list, size_t address_count)
 {
@@ -869,5 +869,5 @@
 	    NIC_BLOCKED_SOURCES_SET, address_count, NULL);
 	
-	errno_t rc;
+	int rc;
 	if (address_count)
 		rc = async_data_write_start(exch, address_list,
@@ -878,5 +878,5 @@
 	async_exchange_end(exch);
 	
-	errno_t res;
+	sysarg_t res;
 	async_wait_for(message_id, &res);
 	
@@ -884,5 +884,5 @@
 		return rc;
 	
-	return res;
+	return (int) res;
 }
 
@@ -895,10 +895,10 @@
  *
  */
-errno_t nic_vlan_get_mask(async_sess_t *dev_sess, nic_vlan_mask_t *mask)
+int nic_vlan_get_mask(async_sess_t *dev_sess, nic_vlan_mask_t *mask)
 {
 	assert(mask);
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_VLAN_GET_MASK);
 	if (rc != EOK) {
@@ -923,5 +923,5 @@
  *
  */
-errno_t nic_vlan_set_mask(async_sess_t *dev_sess, const nic_vlan_mask_t *mask)
+int nic_vlan_set_mask(async_sess_t *dev_sess, const nic_vlan_mask_t *mask)
 {
 	async_exch_t *exch = async_exchange_begin(dev_sess);
@@ -930,5 +930,5 @@
 	    NIC_VLAN_SET_MASK, mask != NULL, NULL);
 	
-	errno_t rc;
+	int rc;
 	if (mask != NULL)
 		rc = async_data_write_start(exch, mask, sizeof(nic_vlan_mask_t));
@@ -938,5 +938,5 @@
 	async_exchange_end(exch);
 	
-	errno_t res;
+	sysarg_t res;
 	async_wait_for(message_id, &res);
 	
@@ -944,5 +944,5 @@
 		return rc;
 	
-	return res;
+	return (int) res;
 }
 
@@ -963,8 +963,8 @@
  *
  */
-errno_t nic_vlan_set_tag(async_sess_t *dev_sess, uint16_t tag, bool add, bool strip)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_4_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+int nic_vlan_set_tag(async_sess_t *dev_sess, uint16_t tag, bool add, bool strip)
+{
+	async_exch_t *exch = async_exchange_begin(dev_sess);
+	int rc = async_req_4_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_VLAN_SET_TAG, (sysarg_t) tag, (sysarg_t) add, (sysarg_t) strip);
 	async_exchange_end(exch);
@@ -985,5 +985,5 @@
  *
  */
-errno_t nic_wol_virtue_add(async_sess_t *dev_sess, nic_wv_type_t type,
+int nic_wol_virtue_add(async_sess_t *dev_sess, nic_wv_type_t type,
     const void *data, size_t length, nic_wv_id_t *id)
 {
@@ -997,7 +997,7 @@
 	    NIC_WOL_VIRTUE_ADD, (sysarg_t) type, send_data, &result);
 	
-	errno_t res;
+	sysarg_t res;
 	if (send_data) {
-		errno_t rc = async_data_write_start(exch, data, length);
+		int rc = async_data_write_start(exch, data, length);
 		if (rc != EOK) {
 			async_exchange_end(exch);
@@ -1011,5 +1011,5 @@
 	
 	*id = IPC_GET_ARG1(result);
-	return res;
+	return (int) res;
 }
 
@@ -1022,8 +1022,8 @@
  *
  */
-errno_t nic_wol_virtue_remove(async_sess_t *dev_sess, nic_wv_id_t id)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+int nic_wol_virtue_remove(async_sess_t *dev_sess, nic_wv_id_t id)
+{
+	async_exch_t *exch = async_exchange_begin(dev_sess);
+	int rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_WOL_VIRTUE_REMOVE, (sysarg_t) id);
 	async_exchange_end(exch);
@@ -1045,5 +1045,5 @@
  *
  */
-errno_t nic_wol_virtue_probe(async_sess_t *dev_sess, nic_wv_id_t id,
+int nic_wol_virtue_probe(async_sess_t *dev_sess, nic_wv_id_t id,
     nic_wv_type_t *type, size_t max_length, void *data, size_t *length)
 {
@@ -1056,5 +1056,5 @@
 	async_exch_t *exch = async_exchange_begin(dev_sess);
 	
-	errno_t rc = async_req_3_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_3_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_WOL_VIRTUE_PROBE, (sysarg_t) id, max_length,
 	    &_type, &_length);
@@ -1095,5 +1095,5 @@
  *
  */
-errno_t nic_wol_virtue_list(async_sess_t *dev_sess, nic_wv_type_t type,
+int nic_wol_virtue_list(async_sess_t *dev_sess, nic_wv_type_t type,
     size_t max_count, nic_wv_id_t *id_list, size_t *id_count)
 {
@@ -1104,5 +1104,5 @@
 	
 	sysarg_t count;
-	errno_t rc = async_req_3_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_3_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_WOL_VIRTUE_LIST, (sysarg_t) type, max_count, &count);
 	
@@ -1135,5 +1135,5 @@
  *
  */
-errno_t nic_wol_virtue_get_caps(async_sess_t *dev_sess, nic_wv_type_t type,
+int nic_wol_virtue_get_caps(async_sess_t *dev_sess, nic_wv_type_t type,
     int *count)
 {
@@ -1143,5 +1143,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_WOL_VIRTUE_GET_CAPS, (sysarg_t) type, &_count);
 	async_exchange_end(exch);
@@ -1173,5 +1173,5 @@
  *
  */
-errno_t nic_wol_load_info(async_sess_t *dev_sess, nic_wv_type_t *matched_type,
+int nic_wol_load_info(async_sess_t *dev_sess, nic_wv_type_t *matched_type,
     size_t max_length, uint8_t *frame, size_t *frame_length)
 {
@@ -1186,5 +1186,5 @@
 	async_exch_t *exch = async_exchange_begin(dev_sess);
 	
-	errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_WOL_LOAD_INFO, max_length, &_matched_type, &_frame_length);
 	if (rc != EOK) {
@@ -1213,5 +1213,5 @@
  *
  */
-errno_t nic_offload_probe(async_sess_t *dev_sess, uint32_t *supported,
+int nic_offload_probe(async_sess_t *dev_sess, uint32_t *supported,
     uint32_t *active)
 {
@@ -1223,5 +1223,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_1_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_OFFLOAD_PROBE, &_supported, &_active);
 	async_exchange_end(exch);
@@ -1241,8 +1241,8 @@
  *
  */
-errno_t nic_offload_set(async_sess_t *dev_sess, uint32_t mask, uint32_t active)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_3_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+int nic_offload_set(async_sess_t *dev_sess, uint32_t mask, uint32_t active)
+{
+	async_exch_t *exch = async_exchange_begin(dev_sess);
+	int rc = async_req_3_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_AUTONEG_RESTART, (sysarg_t) mask, (sysarg_t) active);
 	async_exchange_end(exch);
@@ -1261,5 +1261,5 @@
  *
  */
-errno_t nic_poll_get_mode(async_sess_t *dev_sess, nic_poll_mode_t *mode,
+int nic_poll_get_mode(async_sess_t *dev_sess, nic_poll_mode_t *mode,
     struct timeval *period)
 {
@@ -1270,5 +1270,5 @@
 	async_exch_t *exch = async_exchange_begin(dev_sess);
 	
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
+	int rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
 	    NIC_POLL_GET_MODE, period != NULL, &_mode);
 	if (rc != EOK) {
@@ -1295,5 +1295,5 @@
  *
  */
-errno_t nic_poll_set_mode(async_sess_t *dev_sess, nic_poll_mode_t mode,
+int nic_poll_set_mode(async_sess_t *dev_sess, nic_poll_mode_t mode,
     const struct timeval *period)
 {
@@ -1303,5 +1303,5 @@
 	    NIC_POLL_SET_MODE, (sysarg_t) mode, period != NULL, NULL);
 	
-	errno_t rc;
+	int rc;
 	if (period)
 		rc = async_data_write_start(exch, period, sizeof(struct timeval));
@@ -1311,5 +1311,5 @@
 	async_exchange_end(exch);
 	
-	errno_t res;
+	sysarg_t res;
 	async_wait_for(message_id, &res);
 	
@@ -1317,5 +1317,5 @@
 		return rc;
 	
-	return res;
+	return (int) res;
 }
 
@@ -1327,8 +1327,8 @@
  *
  */
-errno_t nic_poll_now(async_sess_t *dev_sess)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), NIC_POLL_NOW);
+int nic_poll_now(async_sess_t *dev_sess)
+{
+	async_exch_t *exch = async_exchange_begin(dev_sess);
+	int rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), NIC_POLL_NOW);
 	async_exchange_end(exch);
 	
@@ -1344,5 +1344,5 @@
 	void *data;
 	size_t size;
-	errno_t rc;
+	int rc;
 	
 	rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
@@ -1363,5 +1363,5 @@
 	assert(nic_iface->callback_create);
 	
-	errno_t rc = nic_iface->callback_create(dev);
+	int rc = nic_iface->callback_create(dev);
 	async_answer_0(callid, rc);
 }
@@ -1375,5 +1375,5 @@
 	nic_device_state_t state = NIC_STATE_MAX;
 	
-	errno_t rc = nic_iface->get_state(dev, &state);
+	int rc = nic_iface->get_state(dev, &state);
 	async_answer_1(callid, rc, state);
 }
@@ -1387,5 +1387,5 @@
 	nic_device_state_t state = (nic_device_state_t) IPC_GET_ARG2(*call);
 	
-	errno_t rc = nic_iface->set_state(dev, state);
+	int rc = nic_iface->set_state(dev, state);
 	async_answer_0(callid, rc);
 }
@@ -1400,5 +1400,5 @@
 	memset(&address, 0, sizeof(nic_address_t));
 	
-	errno_t rc = nic_iface->get_address(dev, &address);
+	int rc = nic_iface->get_address(dev, &address);
 	if (rc == EOK) {
 		size_t max_len;
@@ -1451,5 +1451,5 @@
 	
 	if (nic_iface->set_address != NULL) {
-		errno_t rc = nic_iface->set_address(dev, &address);
+		int rc = nic_iface->set_address(dev, &address);
 		async_answer_0(callid, rc);
 	} else
@@ -1469,5 +1469,5 @@
 	memset(&stats, 0, sizeof(nic_device_stats_t));
 	
-	errno_t rc = nic_iface->get_stats(dev, &stats);
+	int rc = nic_iface->get_stats(dev, &stats);
 	if (rc == EOK) {
 		ipc_callid_t data_callid;
@@ -1504,5 +1504,5 @@
 	memset(&info, 0, sizeof(nic_device_info_t));
 	
-	errno_t rc = nic_iface->get_device_info(dev, &info);
+	int rc = nic_iface->get_device_info(dev, &info);
 	if (rc == EOK) {
 		ipc_callid_t data_callid;
@@ -1538,5 +1538,5 @@
 	nic_cable_state_t cs = NIC_CS_UNKNOWN;
 	
-	errno_t rc = nic_iface->get_cable_state(dev, &cs);
+	int rc = nic_iface->get_cable_state(dev, &cs);
 	async_answer_1(callid, rc, (sysarg_t) cs);
 }
@@ -1555,5 +1555,5 @@
 	nic_role_t role = NIC_ROLE_UNKNOWN;
 	
-	errno_t rc = nic_iface->get_operation_mode(dev, &speed, &duplex, &role);
+	int rc = nic_iface->get_operation_mode(dev, &speed, &duplex, &role);
 	async_answer_3(callid, rc, (sysarg_t) speed, (sysarg_t) duplex,
 	    (sysarg_t) role);
@@ -1573,5 +1573,5 @@
 	nic_role_t role = (nic_role_t) IPC_GET_ARG4(*call);
 	
-	errno_t rc = nic_iface->set_operation_mode(dev, speed, duplex, role);
+	int rc = nic_iface->set_operation_mode(dev, speed, duplex, role);
 	async_answer_0(callid, rc);
 }
@@ -1588,5 +1588,5 @@
 	uint32_t advertisement = (uint32_t) IPC_GET_ARG2(*call);
 	
-	errno_t rc = nic_iface->autoneg_enable(dev, advertisement);
+	int rc = nic_iface->autoneg_enable(dev, advertisement);
 	async_answer_0(callid, rc);
 }
@@ -1601,5 +1601,5 @@
 	}
 	
-	errno_t rc = nic_iface->autoneg_disable(dev);
+	int rc = nic_iface->autoneg_disable(dev);
 	async_answer_0(callid, rc);
 }
@@ -1619,5 +1619,5 @@
 	nic_result_t their_result = NIC_RESULT_NOT_AVAILABLE;
 	
-	errno_t rc = nic_iface->autoneg_probe(dev, &our_adv, &their_adv, &result,
+	int rc = nic_iface->autoneg_probe(dev, &our_adv, &their_adv, &result,
 	    &their_result);
 	async_answer_4(callid, rc, our_adv, their_adv, (sysarg_t) result,
@@ -1634,5 +1634,5 @@
 	}
 	
-	errno_t rc = nic_iface->autoneg_restart(dev);
+	int rc = nic_iface->autoneg_restart(dev);
 	async_answer_0(callid, rc);
 }
@@ -1651,5 +1651,5 @@
 	uint16_t pause;
 	
-	errno_t rc = nic_iface->get_pause(dev, &we_send, &we_receive, &pause);
+	int rc = nic_iface->get_pause(dev, &we_send, &we_receive, &pause);
 	async_answer_3(callid, rc, we_send, we_receive, pause);
 }
@@ -1668,5 +1668,5 @@
 	uint16_t pause = (uint16_t) IPC_GET_ARG4(*call);
 	
-	errno_t rc = nic_iface->set_pause(dev, allow_send, allow_receive,
+	int rc = nic_iface->set_pause(dev, allow_send, allow_receive,
 	    pause);
 	async_answer_0(callid, rc);
@@ -1697,5 +1697,5 @@
 	size_t address_count = 0;
 	
-	errno_t rc = nic_iface->unicast_get_mode(dev, &mode, max_count, address_list,
+	int rc = nic_iface->unicast_get_mode(dev, &mode, max_count, address_list,
 	    &address_count);
 	
@@ -1768,5 +1768,5 @@
 	
 	if (nic_iface->unicast_set_mode != NULL) {
-		errno_t rc = nic_iface->unicast_set_mode(dev, mode, address_list,
+		int rc = nic_iface->unicast_set_mode(dev, mode, address_list,
 		    address_count);
 		async_answer_0(callid, rc);
@@ -1801,5 +1801,5 @@
 	size_t address_count = 0;
 	
-	errno_t rc = nic_iface->multicast_get_mode(dev, &mode, max_count, address_list,
+	int rc = nic_iface->multicast_get_mode(dev, &mode, max_count, address_list,
 	    &address_count);
 	
@@ -1872,5 +1872,5 @@
 	
 	if (nic_iface->multicast_set_mode != NULL) {
-		errno_t rc = nic_iface->multicast_set_mode(dev, mode, address_list,
+		int rc = nic_iface->multicast_set_mode(dev, mode, address_list,
 		    address_count);
 		async_answer_0(callid, rc);
@@ -1892,5 +1892,5 @@
 	nic_broadcast_mode_t mode = NIC_BROADCAST_ACCEPTED;
 	
-	errno_t rc = nic_iface->broadcast_get_mode(dev, &mode);
+	int rc = nic_iface->broadcast_get_mode(dev, &mode);
 	async_answer_1(callid, rc, mode);
 }
@@ -1907,5 +1907,5 @@
 	nic_broadcast_mode_t mode = IPC_GET_ARG2(*call);
 	
-	errno_t rc = nic_iface->broadcast_set_mode(dev, mode);
+	int rc = nic_iface->broadcast_set_mode(dev, mode);
 	async_answer_0(callid, rc);
 }
@@ -1922,5 +1922,5 @@
 	uint32_t mode = 0;
 	
-	errno_t rc = nic_iface->defective_get_mode(dev, &mode);
+	int rc = nic_iface->defective_get_mode(dev, &mode);
 	async_answer_1(callid, rc, mode);
 }
@@ -1937,5 +1937,5 @@
 	uint32_t mode = IPC_GET_ARG2(*call);
 	
-	errno_t rc = nic_iface->defective_set_mode(dev, mode);
+	int rc = nic_iface->defective_set_mode(dev, mode);
 	async_answer_0(callid, rc);
 }
@@ -1964,5 +1964,5 @@
 	size_t address_count = 0;
 	
-	errno_t rc = nic_iface->blocked_sources_get(dev, max_count, address_list,
+	int rc = nic_iface->blocked_sources_get(dev, max_count, address_list,
 	    &address_count);
 	
@@ -2034,5 +2034,5 @@
 	
 	if (nic_iface->blocked_sources_set != NULL) {
-		errno_t rc = nic_iface->blocked_sources_set(dev, address_list,
+		int rc = nic_iface->blocked_sources_set(dev, address_list,
 		    address_count);
 		async_answer_0(callid, rc);
@@ -2055,5 +2055,5 @@
 	memset(&vlan_mask, 0, sizeof(nic_vlan_mask_t));
 	
-	errno_t rc = nic_iface->vlan_get_mask(dev, &vlan_mask);
+	int rc = nic_iface->vlan_get_mask(dev, &vlan_mask);
 	if (rc == EOK) {
 		ipc_callid_t data_callid;
@@ -2111,5 +2111,5 @@
 	
 	if (nic_iface->vlan_set_mask != NULL) {
-		errno_t rc = nic_iface->vlan_set_mask(dev, vlan_mask_pointer);
+		int rc = nic_iface->vlan_set_mask(dev, vlan_mask_pointer);
 		async_answer_0(callid, rc);
 	} else
@@ -2131,5 +2131,5 @@
 	bool strip = (int) IPC_GET_ARG4(*call);
 	
-	errno_t rc = nic_iface->vlan_set_tag(dev, tag, add, strip);
+	int rc = nic_iface->vlan_set_tag(dev, tag, add, strip);
 	async_answer_0(callid, rc);
 }
@@ -2180,5 +2180,5 @@
 	nic_wv_type_t type = (nic_wv_type_t) IPC_GET_ARG2(*call);
 	
-	errno_t rc = nic_iface->wol_virtue_add(dev, type, data, length, &id);
+	int rc = nic_iface->wol_virtue_add(dev, type, data, length, &id);
 	async_answer_1(callid, rc, (sysarg_t) id);
 	free(data);
@@ -2197,5 +2197,5 @@
 	nic_wv_id_t id = (nic_wv_id_t) IPC_GET_ARG2(*call);
 	
-	errno_t rc = nic_iface->wol_virtue_remove(dev, id);
+	int rc = nic_iface->wol_virtue_remove(dev, id);
 	async_answer_0(callid, rc);
 }
@@ -2228,5 +2228,5 @@
 	memset(data, 0, max_length);
 	
-	errno_t rc = nic_iface->wol_virtue_probe(dev, id, &type, max_length,
+	int rc = nic_iface->wol_virtue_probe(dev, id, &type, max_length,
 	    data, &length);
 	
@@ -2278,5 +2278,5 @@
 	memset(id_list, 0, max_count * sizeof (nic_wv_id_t));
 	
-	errno_t rc = nic_iface->wol_virtue_list(dev, type, max_count, id_list,
+	int rc = nic_iface->wol_virtue_list(dev, type, max_count, id_list,
 	    &count);
 	
@@ -2315,5 +2315,5 @@
 	nic_wv_type_t type = (nic_wv_type_t) IPC_GET_ARG2(*call);
 	
-	errno_t rc = nic_iface->wol_virtue_get_caps(dev, type, &count);
+	int rc = nic_iface->wol_virtue_get_caps(dev, type, &count);
 	async_answer_1(callid, rc, (sysarg_t) count);
 }
@@ -2343,5 +2343,5 @@
 	memset(data, 0, max_length);
 	
-	errno_t rc = nic_iface->wol_load_info(dev, &type, max_length, data,
+	int rc = nic_iface->wol_load_info(dev, &type, max_length, data,
 	    &frame_length);
 	if (rc == EOK) {
@@ -2376,5 +2376,5 @@
 	uint32_t active = 0;
 	
-	errno_t rc = nic_iface->offload_probe(dev, &supported, &active);
+	int rc = nic_iface->offload_probe(dev, &supported, &active);
 	async_answer_2(callid, rc, supported, active);
 }
@@ -2392,5 +2392,5 @@
 	uint32_t active = (uint32_t) IPC_GET_ARG3(*call);
 	
-	errno_t rc = nic_iface->offload_set(dev, mask, active);
+	int rc = nic_iface->offload_set(dev, mask, active);
 	async_answer_0(callid, rc);
 }
@@ -2412,5 +2412,5 @@
 	};
 	
-	errno_t rc = nic_iface->poll_get_mode(dev, &mode, &period);
+	int rc = nic_iface->poll_get_mode(dev, &mode, &period);
 	if ((rc == EOK) && (request_data)) {
 		size_t max_len;
@@ -2470,5 +2470,5 @@
 	
 	if (nic_iface->poll_set_mode != NULL) {
-		errno_t rc = nic_iface->poll_set_mode(dev, mode, period);
+		int rc = nic_iface->poll_set_mode(dev, mode, period);
 		async_answer_0(callid, rc);
 	} else
@@ -2485,5 +2485,5 @@
 	}
 	
-	errno_t rc = nic_iface->poll_now(dev);
+	int rc = nic_iface->poll_now(dev);
 	async_answer_0(callid, rc);
 }
Index: uspace/lib/drv/generic/remote_pci.c
===================================================================
--- uspace/lib/drv/generic/remote_pci.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_pci.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,10 +51,10 @@
 } pci_dev_iface_funcs_t;
 
-errno_t pci_config_space_read_8(async_sess_t *sess, uint32_t address, uint8_t *val)
+int pci_config_space_read_8(async_sess_t *sess, uint32_t address, uint8_t *val)
 {
 	sysarg_t res = 0;
 	
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
+	int rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
 	    IPC_M_CONFIG_SPACE_READ_8, address, &res);
 	async_exchange_end(exch);
@@ -64,5 +64,5 @@
 }
 
-errno_t pci_config_space_read_16(async_sess_t *sess, uint32_t address,
+int pci_config_space_read_16(async_sess_t *sess, uint32_t address,
     uint16_t *val)
 {
@@ -70,5 +70,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
+	int rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
 	    IPC_M_CONFIG_SPACE_READ_16, address, &res);
 	async_exchange_end(exch);
@@ -78,5 +78,5 @@
 }
 
-errno_t pci_config_space_read_32(async_sess_t *sess, uint32_t address,
+int pci_config_space_read_32(async_sess_t *sess, uint32_t address,
     uint32_t *val)
 {
@@ -84,5 +84,5 @@
 	
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
+	int rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
 	    IPC_M_CONFIG_SPACE_READ_32, address, &res);
 	async_exchange_end(exch);
@@ -92,8 +92,8 @@
 }
 
-errno_t pci_config_space_write_8(async_sess_t *sess, uint32_t address, uint8_t val)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
+int pci_config_space_write_8(async_sess_t *sess, uint32_t address, uint8_t val)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
 	    IPC_M_CONFIG_SPACE_WRITE_8, address, val);
 	async_exchange_end(exch);
@@ -102,9 +102,9 @@
 }
 
-errno_t pci_config_space_write_16(async_sess_t *sess, uint32_t address,
+int pci_config_space_write_16(async_sess_t *sess, uint32_t address,
     uint16_t val)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
+	int rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
 	    IPC_M_CONFIG_SPACE_WRITE_16, address, val);
 	async_exchange_end(exch);
@@ -113,9 +113,9 @@
 }
 
-errno_t pci_config_space_write_32(async_sess_t *sess, uint32_t address,
+int pci_config_space_write_32(async_sess_t *sess, uint32_t address,
     uint32_t val)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
+	int rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
 	    IPC_M_CONFIG_SPACE_WRITE_32, address, val);
 	async_exchange_end(exch);
@@ -160,5 +160,5 @@
 	uint32_t address = DEV_IPC_GET_ARG1(*call);
 	uint8_t value;
-	errno_t ret = pci_iface->config_space_read_8(fun, address, &value);
+	int ret = pci_iface->config_space_read_8(fun, address, &value);
 	if (ret != EOK) {
 		async_answer_0(callid, ret);
@@ -178,5 +178,5 @@
 	uint32_t address = DEV_IPC_GET_ARG1(*call);
 	uint16_t value;
-	errno_t ret = pci_iface->config_space_read_16(fun, address, &value);
+	int ret = pci_iface->config_space_read_16(fun, address, &value);
 	if (ret != EOK) {
 		async_answer_0(callid, ret);
@@ -195,5 +195,5 @@
 	uint32_t address = DEV_IPC_GET_ARG1(*call);
 	uint32_t value;
-	errno_t ret = pci_iface->config_space_read_32(fun, address, &value);
+	int ret = pci_iface->config_space_read_32(fun, address, &value);
 	if (ret != EOK) {
 		async_answer_0(callid, ret);
@@ -213,5 +213,5 @@
 	uint32_t address = DEV_IPC_GET_ARG1(*call);
 	uint8_t value = DEV_IPC_GET_ARG2(*call);
-	errno_t ret = pci_iface->config_space_write_8(fun, address, value);
+	int ret = pci_iface->config_space_write_8(fun, address, value);
 	if (ret != EOK) {
 		async_answer_0(callid, ret);
@@ -231,5 +231,5 @@
 	uint32_t address = DEV_IPC_GET_ARG1(*call);
 	uint16_t value = DEV_IPC_GET_ARG2(*call);
-	errno_t ret = pci_iface->config_space_write_16(fun, address, value);
+	int ret = pci_iface->config_space_write_16(fun, address, value);
 	if (ret != EOK) {
 		async_answer_0(callid, ret);
@@ -249,5 +249,5 @@
 	uint32_t address = DEV_IPC_GET_ARG1(*call);
 	uint32_t value = DEV_IPC_GET_ARG2(*call);
-	errno_t ret = pci_iface->config_space_write_32(fun, address, value);
+	int ret = pci_iface->config_space_write_32(fun, address, value);
 	if (ret != EOK) {
 		async_answer_0(callid, ret);
Index: uspace/lib/drv/generic/remote_usb.c
===================================================================
--- uspace/lib/drv/generic/remote_usb.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_usb.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -79,10 +79,10 @@
  * @return Error code.
  */
-errno_t usb_get_my_interface(async_exch_t *exch, int *usb_iface)
+int usb_get_my_interface(async_exch_t *exch, int *usb_iface)
 {
 	if (!exch)
 		return EBADMEM;
 	sysarg_t iface_no;
-	const errno_t ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
+	const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
 	    IPC_M_USB_GET_MY_INTERFACE, &iface_no);
 	if (ret == EOK && usb_iface)
@@ -99,8 +99,8 @@
  *
  */
-errno_t usb_get_my_device_handle(async_exch_t *exch, devman_handle_t *handle)
+int usb_get_my_device_handle(async_exch_t *exch, devman_handle_t *handle)
 {
 	devman_handle_t h = 0;
-	const errno_t ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
+	const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
 	    IPC_M_USB_GET_MY_DEVICE_HANDLE, &h);
 	if (ret == EOK && handle)
@@ -114,5 +114,5 @@
  * @return Error code.
  */
-errno_t usb_reserve_default_address(async_exch_t *exch, usb_speed_t speed)
+int usb_reserve_default_address(async_exch_t *exch, usb_speed_t speed)
 {
 	if (!exch)
@@ -129,5 +129,5 @@
  *
  */
-errno_t usb_release_default_address(async_exch_t *exch)
+int usb_release_default_address(async_exch_t *exch)
 {
 	if (!exch)
@@ -145,9 +145,9 @@
  *
  */
-errno_t usb_device_enumerate(async_exch_t *exch, unsigned port)
-{
-	if (!exch)
-		return EBADMEM;
-	const errno_t ret = async_req_2_0(exch, DEV_IFACE_ID(USB_DEV_IFACE),
+int usb_device_enumerate(async_exch_t *exch, unsigned port)
+{
+	if (!exch)
+		return EBADMEM;
+	const int ret = async_req_2_0(exch, DEV_IFACE_ID(USB_DEV_IFACE),
 	    IPC_M_USB_DEVICE_ENUMERATE, port);
 	return ret;
@@ -162,5 +162,5 @@
  *
  */
-errno_t usb_device_remove(async_exch_t *exch, unsigned port)
+int usb_device_remove(async_exch_t *exch, unsigned port)
 {
 	if (!exch)
@@ -177,5 +177,5 @@
 } pack8_t;
 
-errno_t usb_register_endpoint(async_exch_t *exch, usb_endpoint_t endpoint,
+int usb_register_endpoint(async_exch_t *exch, usb_endpoint_t endpoint,
     usb_transfer_type_t type, usb_direction_t direction,
     size_t mps, unsigned packets, unsigned interval)
@@ -194,5 +194,5 @@
 }
 
-errno_t usb_unregister_endpoint(async_exch_t *exch, usb_endpoint_t endpoint,
+int usb_unregister_endpoint(async_exch_t *exch, usb_endpoint_t endpoint,
     usb_direction_t direction)
 {
@@ -203,5 +203,5 @@
 }
 
-errno_t usb_read(async_exch_t *exch, usb_endpoint_t endpoint, uint64_t setup,
+int usb_read(async_exch_t *exch, usb_endpoint_t endpoint, uint64_t setup,
     void *data, size_t size, size_t *rec_size)
 {
@@ -233,6 +233,6 @@
 
 	/* Wait for the answer. */
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
+	sysarg_t data_request_rc;
+	sysarg_t opening_request_rc;
 	async_wait_for(data_request, &data_request_rc);
 	async_wait_for(opening_request, &opening_request_rc);
@@ -241,11 +241,11 @@
 		/* Prefer the return code of the opening request. */
 		if (opening_request_rc != EOK) {
-			return (errno_t) opening_request_rc;
+			return (int) opening_request_rc;
 		} else {
-			return (errno_t) data_request_rc;
+			return (int) data_request_rc;
 		}
 	}
 	if (opening_request_rc != EOK) {
-		return (errno_t) opening_request_rc;
+		return (int) opening_request_rc;
 	}
 
@@ -254,5 +254,5 @@
 }
 
-errno_t usb_write(async_exch_t *exch, usb_endpoint_t endpoint, uint64_t setup,
+int usb_write(async_exch_t *exch, usb_endpoint_t endpoint, uint64_t setup,
     const void *data, size_t size)
 {
@@ -273,5 +273,5 @@
 	/* Send the data if any. */
 	if (size > 0) {
-		const errno_t ret = async_data_write_start(exch, data, size);
+		const int ret = async_data_write_start(exch, data, size);
 		if (ret != EOK) {
 			async_forget(opening_request);
@@ -281,8 +281,8 @@
 
 	/* Wait for the answer. */
-	errno_t opening_request_rc;
+	sysarg_t opening_request_rc;
 	async_wait_for(opening_request, &opening_request_rc);
 
-	return (errno_t) opening_request_rc;
+	return (int) opening_request_rc;
 }
 
@@ -330,5 +330,5 @@
 
 	int iface_no;
-	const errno_t ret = usb_iface->get_my_interface(fun, &iface_no);
+	const int ret = usb_iface->get_my_interface(fun, &iface_no);
 	if (ret != EOK) {
 		async_answer_0(callid, ret);
@@ -349,5 +349,5 @@
 
 	devman_handle_t handle;
-	const errno_t ret = usb_iface->get_my_device_handle(fun, &handle);
+	const int ret = usb_iface->get_my_device_handle(fun, &handle);
 	if (ret != EOK) {
 		async_answer_0(callid, ret);
@@ -368,5 +368,5 @@
 
 	usb_speed_t speed = DEV_IPC_GET_ARG1(*call);
-	const errno_t ret = usb_iface->reserve_default_address(fun, speed);
+	const int ret = usb_iface->reserve_default_address(fun, speed);
 	async_answer_0(callid, ret);
 }
@@ -382,5 +382,5 @@
 	}
 
-	const errno_t ret = usb_iface->release_default_address(fun);
+	const int ret = usb_iface->release_default_address(fun);
 	async_answer_0(callid, ret);
 }
@@ -397,5 +397,5 @@
 
 	const unsigned port = DEV_IPC_GET_ARG1(*call);
-	const errno_t ret = usb_iface->device_enumerate(fun, port);
+	const int ret = usb_iface->device_enumerate(fun, port);
 	async_answer_0(callid, ret);
 }
@@ -412,5 +412,5 @@
 
 	const unsigned port = DEV_IPC_GET_ARG1(*call);
-	const errno_t ret = usb_iface->device_remove(fun, port);
+	const int ret = usb_iface->device_remove(fun, port);
 	async_answer_0(callid, ret);
 }
@@ -435,5 +435,5 @@
 	unsigned interval = pack.arr[3];
 
-	const errno_t ret = usb_iface->register_endpoint(fun, endpoint,
+	const int ret = usb_iface->register_endpoint(fun, endpoint,
 	    transfer_type, direction, max_packet_size, packets, interval);
 
@@ -454,5 +454,5 @@
 	usb_direction_t direction = (usb_direction_t) DEV_IPC_GET_ARG2(*call);
 
-	errno_t rc = usb_iface->unregister_endpoint(fun, endpoint, direction);
+	int rc = usb_iface->unregister_endpoint(fun, endpoint, direction);
 
 	async_answer_0(callid, rc);
@@ -491,5 +491,5 @@
 }
 
-static void callback_out(errno_t outcome, void *arg)
+static void callback_out(int outcome, void *arg)
 {
 	async_transaction_t *trans = arg;
@@ -500,5 +500,5 @@
 }
 
-static void callback_in(errno_t outcome, size_t actual_size, void *arg)
+static void callback_in(int outcome, size_t actual_size, void *arg)
 {
 	async_transaction_t *trans = (async_transaction_t *)arg;
@@ -563,5 +563,5 @@
 	}
 
-	const errno_t rc = usb_iface->read(
+	const int rc = usb_iface->read(
 	    fun, ep, setup, trans->buffer, size, callback_in, trans);
 
@@ -601,5 +601,5 @@
 	size_t size = 0;
 	if (data_buffer_len > 0) {
-		const errno_t rc = async_data_write_accept(&trans->buffer, false,
+		const int rc = async_data_write_accept(&trans->buffer, false,
 		    1, data_buffer_len, 0, &size);
 
@@ -611,5 +611,5 @@
 	}
 
-	const errno_t rc = usb_iface->write(
+	const int rc = usb_iface->write(
 	    fun, ep, setup, trans->buffer, size, callback_out, trans);
 
Index: uspace/lib/drv/generic/remote_usbhc.c
===================================================================
--- uspace/lib/drv/generic/remote_usbhc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_usbhc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -96,5 +96,5 @@
 } usbhc_iface_funcs_t;
 
-errno_t usbhc_read(async_exch_t *exch, usb_address_t address,
+int usbhc_read(async_exch_t *exch, usb_address_t address,
     usb_endpoint_t endpoint, uint64_t setup, void *data, size_t size,
     size_t *rec_size)
@@ -131,6 +131,6 @@
 
 	/* Wait for the answer. */
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
+	sysarg_t data_request_rc;
+	sysarg_t opening_request_rc;
 	async_wait_for(data_request, &data_request_rc);
 	async_wait_for(opening_request, &opening_request_rc);
@@ -139,11 +139,11 @@
 		/* Prefer the return code of the opening request. */
 		if (opening_request_rc != EOK) {
-			return (errno_t) opening_request_rc;
+			return (int) opening_request_rc;
 		} else {
-			return (errno_t) data_request_rc;
+			return (int) data_request_rc;
 		}
 	}
 	if (opening_request_rc != EOK) {
-		return (errno_t) opening_request_rc;
+		return (int) opening_request_rc;
 	}
 
@@ -152,5 +152,5 @@
 }
 
-errno_t usbhc_write(async_exch_t *exch, usb_address_t address,
+int usbhc_write(async_exch_t *exch, usb_address_t address,
     usb_endpoint_t endpoint, uint64_t setup, const void *data, size_t size)
 {
@@ -174,5 +174,5 @@
 	/* Send the data if any. */
 	if (size > 0) {
-		const errno_t ret = async_data_write_start(exch, data, size);
+		const int ret = async_data_write_start(exch, data, size);
 		if (ret != EOK) {
 			async_forget(opening_request);
@@ -182,8 +182,8 @@
 
 	/* Wait for the answer. */
-	errno_t opening_request_rc;
+	sysarg_t opening_request_rc;
 	async_wait_for(opening_request, &opening_request_rc);
 
-	return (errno_t) opening_request_rc;
+	return (int) opening_request_rc;
 }
 
@@ -235,5 +235,5 @@
 }
 
-static void callback_out(errno_t outcome, void *arg)
+static void callback_out(int outcome, void *arg)
 {
 	async_transaction_t *trans = arg;
@@ -244,5 +244,5 @@
 }
 
-static void callback_in(errno_t outcome, size_t actual_size, void *arg)
+static void callback_in(int outcome, size_t actual_size, void *arg)
 {
 	async_transaction_t *trans = (async_transaction_t *)arg;
@@ -306,5 +306,5 @@
 	}
 
-	const errno_t rc = hc_iface->read(
+	const int rc = hc_iface->read(
 	    fun, target, setup, trans->buffer, size, callback_in, trans);
 
@@ -344,5 +344,5 @@
 	size_t size = 0;
 	if (data_buffer_len > 0) {
-		const errno_t rc = async_data_write_accept(&trans->buffer, false,
+		const int rc = async_data_write_accept(&trans->buffer, false,
 		    1, USB_MAX_PAYLOAD_SIZE,
 		    0, &size);
@@ -355,5 +355,5 @@
 	}
 
-	const errno_t rc = hc_iface->write(
+	const int rc = hc_iface->write(
 	    fun, target, setup, trans->buffer, size, callback_out, trans);
 
Index: uspace/lib/drv/generic/remote_usbhid.c
===================================================================
--- uspace/lib/drv/generic/remote_usbhid.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/generic/remote_usbhid.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -94,8 +94,8 @@
  * @param dev_sess Session to DDF device providing USB HID interface.
  *
- * @return Number of usages returned or an error code.
- *
- */
-errno_t usbhid_dev_get_event_length(async_sess_t *dev_sess, size_t *size)
+ * @return Number of usages returned or negative error code.
+ *
+ */
+int usbhid_dev_get_event_length(async_sess_t *dev_sess, size_t *size)
 {
 	if (!dev_sess)
@@ -105,5 +105,5 @@
 	
 	sysarg_t len;
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(USBHID_DEV_IFACE),
+	int rc = async_req_1_1(exch, DEV_IFACE_ID(USBHID_DEV_IFACE),
 	    IPC_M_USBHID_GET_EVENT_LENGTH, &len);
 	
@@ -132,5 +132,5 @@
  *
  */
-errno_t usbhid_dev_get_event(async_sess_t *dev_sess, uint8_t *buf,
+int usbhid_dev_get_event(async_sess_t *dev_sess, uint8_t *buf,
     size_t size, size_t *actual_size, int *event_nr, unsigned int flags)
 {
@@ -174,6 +174,6 @@
 	}
 	
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
+	sysarg_t data_request_rc;
+	sysarg_t opening_request_rc;
 	async_wait_for(data_request, &data_request_rc);
 	async_wait_for(opening_request, &opening_request_rc);
@@ -182,11 +182,11 @@
 		/* Prefer return code of the opening request. */
 		if (opening_request_rc != EOK)
-			return (errno_t) opening_request_rc;
+			return (int) opening_request_rc;
 		else
-			return (errno_t) data_request_rc;
+			return (int) data_request_rc;
 	}
 	
 	if (opening_request_rc != EOK)
-		return (errno_t) opening_request_rc;
+		return (int) opening_request_rc;
 	
 	size_t act_size = IPC_GET_ARG2(data_request_call);
@@ -204,5 +204,5 @@
 }
 
-errno_t usbhid_dev_get_report_descriptor_length(async_sess_t *dev_sess,
+int usbhid_dev_get_report_descriptor_length(async_sess_t *dev_sess,
     size_t *size)
 {
@@ -213,5 +213,5 @@
 	
 	sysarg_t arg_size;
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(USBHID_DEV_IFACE),
+	int rc = async_req_1_1(exch, DEV_IFACE_ID(USBHID_DEV_IFACE),
 	    IPC_M_USBHID_GET_REPORT_DESCRIPTOR_LENGTH, &arg_size);
 	
@@ -226,5 +226,5 @@
 }
 
-errno_t usbhid_dev_get_report_descriptor(async_sess_t *dev_sess, uint8_t *buf,
+int usbhid_dev_get_report_descriptor(async_sess_t *dev_sess, uint8_t *buf,
     size_t size, size_t *actual_size)
 {
@@ -259,6 +259,6 @@
 	}
 	
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
+	sysarg_t data_request_rc;
+	sysarg_t opening_request_rc;
 	async_wait_for(data_request, &data_request_rc);
 	async_wait_for(opening_request, &opening_request_rc);
@@ -267,11 +267,11 @@
 		/* Prefer return code of the opening request. */
 		if (opening_request_rc != EOK)
-			return (errno_t) opening_request_rc;
+			return (int) opening_request_rc;
 		else
-			return (errno_t) data_request_rc;
+			return (int) data_request_rc;
 	}
 	
 	if (opening_request_rc != EOK)
-		return (errno_t) opening_request_rc;
+		return (int) opening_request_rc;
 	
 	size_t act_size = IPC_GET_ARG2(data_request_call);
@@ -362,5 +362,5 @@
 	}
 
-	errno_t rc;
+	int rc;
 
 	uint8_t *data = malloc(len);
@@ -438,5 +438,5 @@
 
 	size_t act_len = 0;
-	errno_t rc = hid_iface->get_report_descriptor(fun, descriptor, len,
+	int rc = hid_iface->get_report_descriptor(fun, descriptor, len,
 	    &act_len);
 	if (act_len > len) {
Index: uspace/lib/drv/include/ahci_iface.h
===================================================================
--- uspace/lib/drv/include/ahci_iface.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ahci_iface.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,19 +41,19 @@
 #include <async.h>
 
-extern async_sess_t *ahci_get_sess(devman_handle_t, char **);
+extern async_sess_t* ahci_get_sess(devman_handle_t, char **);
 
-extern errno_t ahci_get_sata_device_name(async_sess_t *, size_t, char *);
-extern errno_t ahci_get_num_blocks(async_sess_t *, uint64_t *);
-extern errno_t ahci_get_block_size(async_sess_t *, size_t *);
-extern errno_t ahci_read_blocks(async_sess_t *, uint64_t, size_t, void *);
-extern errno_t ahci_write_blocks(async_sess_t *, uint64_t, size_t, void *);
+extern int ahci_get_sata_device_name(async_sess_t *, size_t, char *);
+extern int ahci_get_num_blocks(async_sess_t *, uint64_t *);
+extern int ahci_get_block_size(async_sess_t *, size_t *);
+extern int ahci_read_blocks(async_sess_t *, uint64_t, size_t, void *);
+extern int ahci_write_blocks(async_sess_t *, uint64_t, size_t, void *);
 
 /** AHCI device communication interface. */
 typedef struct {
-	errno_t (*get_sata_device_name)(ddf_fun_t *, size_t, char *);
-	errno_t (*get_num_blocks)(ddf_fun_t *, uint64_t *);
-	errno_t (*get_block_size)(ddf_fun_t *, size_t *);
-	errno_t (*read_blocks)(ddf_fun_t *, uint64_t, size_t, void *);
-	errno_t (*write_blocks)(ddf_fun_t *, uint64_t, size_t, void *);
+	int (*get_sata_device_name)(ddf_fun_t *, size_t, char *);
+	int (*get_num_blocks)(ddf_fun_t *, uint64_t *);
+	int (*get_block_size)(ddf_fun_t *, size_t *);
+	int (*read_blocks)(ddf_fun_t *, uint64_t, size_t, void *);
+	int (*write_blocks)(ddf_fun_t *, uint64_t, size_t, void *);
 } ahci_iface_t;
 
Index: uspace/lib/drv/include/audio_mixer_iface.h
===================================================================
--- uspace/lib/drv/include/audio_mixer_iface.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/audio_mixer_iface.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,17 +43,17 @@
 #include "ddf/driver.h"
 
-errno_t audio_mixer_get_info(async_exch_t *, char **, unsigned *);
-errno_t audio_mixer_get_item_info(async_exch_t *, unsigned,
-    char **, unsigned *);
-errno_t audio_mixer_get_item_level(async_exch_t *, unsigned, unsigned *);
-errno_t audio_mixer_set_item_level(async_exch_t *, unsigned, unsigned);
+int audio_mixer_get_info(async_exch_t *, const char **, unsigned *);
+int audio_mixer_get_item_info(async_exch_t *, unsigned,
+    const char **, unsigned *);
+int audio_mixer_get_item_level(async_exch_t *, unsigned, unsigned *);
+int audio_mixer_set_item_level(async_exch_t *, unsigned, unsigned);
 
 
 /** Audio mixer communication interface. */
 typedef struct {
-	errno_t (*get_info)(ddf_fun_t *, const char **, unsigned *);
-	errno_t (*get_item_info)(ddf_fun_t *, unsigned, const char **, unsigned *);
-	errno_t (*get_item_level)(ddf_fun_t *, unsigned, unsigned *);
-	errno_t (*set_item_level)(ddf_fun_t *, unsigned, unsigned);
+	int (*get_info)(ddf_fun_t *, const char **, unsigned *);
+	int (*get_item_info)(ddf_fun_t *, unsigned, const char **, unsigned *);
+	int (*get_item_level)(ddf_fun_t *, unsigned, unsigned *);
+	int (*set_item_level)(ddf_fun_t *, unsigned, unsigned);
 } audio_mixer_iface_t;
 
Index: uspace/lib/drv/include/audio_pcm_iface.h
===================================================================
--- uspace/lib/drv/include/audio_pcm_iface.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/audio_pcm_iface.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -80,51 +80,51 @@
 void audio_pcm_close(audio_pcm_sess_t *);
 
-errno_t audio_pcm_get_info_str(audio_pcm_sess_t *, char **);
-errno_t audio_pcm_test_format(audio_pcm_sess_t *, unsigned *, unsigned *,
+int audio_pcm_get_info_str(audio_pcm_sess_t *, const char **);
+int audio_pcm_test_format(audio_pcm_sess_t *, unsigned *, unsigned *,
     pcm_sample_format_t *);
-errno_t audio_pcm_query_cap(audio_pcm_sess_t *, audio_cap_t, sysarg_t *);
-errno_t audio_pcm_register_event_callback(audio_pcm_sess_t *,
+int audio_pcm_query_cap(audio_pcm_sess_t *, audio_cap_t);
+int audio_pcm_register_event_callback(audio_pcm_sess_t *,
     async_port_handler_t, void *);
-errno_t audio_pcm_unregister_event_callback(audio_pcm_sess_t *);
+int audio_pcm_unregister_event_callback(audio_pcm_sess_t *);
 
-errno_t audio_pcm_get_buffer(audio_pcm_sess_t *, void **, size_t *);
-errno_t audio_pcm_get_buffer_pos(audio_pcm_sess_t *, size_t *);
-errno_t audio_pcm_release_buffer(audio_pcm_sess_t *);
+int audio_pcm_get_buffer(audio_pcm_sess_t *, void **, size_t *);
+int audio_pcm_get_buffer_pos(audio_pcm_sess_t *, size_t *);
+int audio_pcm_release_buffer(audio_pcm_sess_t *);
 
-errno_t audio_pcm_start_playback_fragment(audio_pcm_sess_t *, unsigned,
+int audio_pcm_start_playback_fragment(audio_pcm_sess_t *, unsigned,
     unsigned, unsigned, pcm_sample_format_t);
-errno_t audio_pcm_last_playback_fragment(audio_pcm_sess_t *);
+int audio_pcm_last_playback_fragment(audio_pcm_sess_t *);
 
-errno_t audio_pcm_start_playback(audio_pcm_sess_t *,
+int audio_pcm_start_playback(audio_pcm_sess_t *,
     unsigned, unsigned, pcm_sample_format_t);
-errno_t audio_pcm_stop_playback_immediate(audio_pcm_sess_t *);
-errno_t audio_pcm_stop_playback(audio_pcm_sess_t *);
+int audio_pcm_stop_playback_immediate(audio_pcm_sess_t *);
+int audio_pcm_stop_playback(audio_pcm_sess_t *);
 
-errno_t audio_pcm_start_capture_fragment(audio_pcm_sess_t *, unsigned,
+int audio_pcm_start_capture_fragment(audio_pcm_sess_t *, unsigned,
     unsigned, unsigned, pcm_sample_format_t);
-errno_t audio_pcm_last_capture_fragment(audio_pcm_sess_t *);
+int audio_pcm_last_capture_fragment(audio_pcm_sess_t *);
 
-errno_t audio_pcm_start_capture(audio_pcm_sess_t *,
+int audio_pcm_start_capture(audio_pcm_sess_t *,
     unsigned, unsigned, pcm_sample_format_t);
-errno_t audio_pcm_stop_capture_immediate(audio_pcm_sess_t *);
-errno_t audio_pcm_stop_capture(audio_pcm_sess_t *);
+int audio_pcm_stop_capture_immediate(audio_pcm_sess_t *);
+int audio_pcm_stop_capture(audio_pcm_sess_t *);
 
 /** Audio pcm communication interface. */
 typedef struct {
-	errno_t (*get_info_str)(ddf_fun_t *, const char **);
-	errno_t (*test_format)(ddf_fun_t *, unsigned *, unsigned *,
+	int (*get_info_str)(ddf_fun_t *, const char **);
+	int (*test_format)(ddf_fun_t *, unsigned *, unsigned *,
 	    pcm_sample_format_t *);
 	unsigned (*query_cap)(ddf_fun_t *, audio_cap_t);
-	errno_t (*get_buffer_pos)(ddf_fun_t *, size_t *);
-	errno_t (*get_buffer)(ddf_fun_t *, void **, size_t *);
-	errno_t (*release_buffer)(ddf_fun_t *);
-	errno_t (*set_event_session)(ddf_fun_t *, async_sess_t *);
-	async_sess_t *(*get_event_session)(ddf_fun_t *);
-	errno_t (*start_playback)(ddf_fun_t *, unsigned,
+	int (*get_buffer_pos)(ddf_fun_t *, size_t *);
+	int (*get_buffer)(ddf_fun_t *, void **, size_t *);
+	int (*release_buffer)(ddf_fun_t *);
+	int (*set_event_session)(ddf_fun_t *, async_sess_t *);
+	async_sess_t * (*get_event_session)(ddf_fun_t *);
+	int (*start_playback)(ddf_fun_t *, unsigned,
 	    unsigned, unsigned, pcm_sample_format_t);
-	errno_t (*stop_playback)(ddf_fun_t *, bool);
-	errno_t (*start_capture)(ddf_fun_t *, unsigned,
+	int (*stop_playback)(ddf_fun_t *, bool);
+	int (*start_capture)(ddf_fun_t *, unsigned,
 	    unsigned, unsigned, pcm_sample_format_t);
-	errno_t (*stop_capture)(ddf_fun_t *, bool);
+	int (*stop_capture)(ddf_fun_t *, bool);
 } audio_pcm_iface_t;
 
Index: uspace/lib/drv/include/battery_iface.h
===================================================================
--- uspace/lib/drv/include/battery_iface.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/battery_iface.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,6 +49,6 @@
 } battery_dev_method_t;
 
-extern errno_t battery_status_get(async_sess_t *, battery_status_t *);
-extern errno_t battery_charge_level_get(async_sess_t *, int *);
+extern int battery_status_get(async_sess_t *, battery_status_t *);
+extern int battery_charge_level_get(async_sess_t *, int *);
 
 #endif
Index: uspace/lib/drv/include/ddf/driver.h
===================================================================
--- uspace/lib/drv/include/ddf/driver.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ddf/driver.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
 	 * device.
 	 */
-	errno_t (*open)(ddf_fun_t *);
+	int (*open)(ddf_fun_t *);
 	
 	/**
@@ -88,17 +88,17 @@
 typedef struct driver_ops {
 	/** Callback method for passing a new device to the device driver */
-	errno_t (*dev_add)(ddf_dev_t *);
+	int (*dev_add)(ddf_dev_t *);
 	
 	/** Ask driver to remove a device */
-	errno_t (*dev_remove)(ddf_dev_t *);
+	int (*dev_remove)(ddf_dev_t *);
 	
 	/** Inform driver a device disappeared */
-	errno_t (*dev_gone)(ddf_dev_t *);
+	int (*dev_gone)(ddf_dev_t *);
 	
 	/** Ask driver to online a specific function */
-	errno_t (*fun_online)(ddf_fun_t *);
+	int (*fun_online)(ddf_fun_t *);
 	
 	/** Ask driver to offline a specific function */
-	errno_t (*fun_offline)(ddf_fun_t *);
+	int (*fun_offline)(ddf_fun_t *);
 } driver_ops_t;
 
@@ -124,14 +124,14 @@
 extern void *ddf_fun_data_get(ddf_fun_t *);
 extern const char *ddf_fun_get_name(ddf_fun_t *);
-extern errno_t ddf_fun_set_name(ddf_fun_t *, const char *);
+extern int ddf_fun_set_name(ddf_fun_t *, const char *);
 extern ddf_dev_t *ddf_fun_get_dev(ddf_fun_t *);
-extern errno_t ddf_fun_bind(ddf_fun_t *);
-extern errno_t ddf_fun_unbind(ddf_fun_t *);
-extern errno_t ddf_fun_online(ddf_fun_t *);
-extern errno_t ddf_fun_offline(ddf_fun_t *);
-extern errno_t ddf_fun_add_match_id(ddf_fun_t *, const char *, int);
+extern int ddf_fun_bind(ddf_fun_t *);
+extern int ddf_fun_unbind(ddf_fun_t *);
+extern int ddf_fun_online(ddf_fun_t *);
+extern int ddf_fun_offline(ddf_fun_t *);
+extern int ddf_fun_add_match_id(ddf_fun_t *, const char *, int);
 extern void ddf_fun_set_ops(ddf_fun_t *, const ddf_dev_ops_t *);
 extern void ddf_fun_set_conn_handler(ddf_fun_t *, async_port_handler_t);
-extern errno_t ddf_fun_add_to_category(ddf_fun_t *, const char *);
+extern int ddf_fun_add_to_category(ddf_fun_t *, const char *);
 
 #endif
Index: uspace/lib/drv/include/ddf/interrupt.h
===================================================================
--- uspace/lib/drv/include/ddf/interrupt.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ddf/interrupt.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,7 +50,7 @@
 typedef void interrupt_handler_t(ipc_call_t *, ddf_dev_t *);
 
-extern errno_t register_interrupt_handler(ddf_dev_t *, int, interrupt_handler_t *,
-    const irq_code_t *, cap_handle_t *);
-extern errno_t unregister_interrupt_handler(ddf_dev_t *, cap_handle_t);
+extern int register_interrupt_handler(ddf_dev_t *, int, interrupt_handler_t *,
+    const irq_code_t *);
+extern int unregister_interrupt_handler(ddf_dev_t *, int);
 
 #endif
Index: uspace/lib/drv/include/ddf/log.h
===================================================================
--- uspace/lib/drv/include/ddf/log.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ddf/log.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,7 +37,7 @@
 #include <io/verify.h>
 
-extern errno_t ddf_log_init(const char *);
+extern int ddf_log_init(const char *);
 extern void ddf_msg(log_level_t, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
+    PRINTF_ATTRIBUTE(2, 3);
 
 extern void ddf_dump_buffer(char *, size_t, const void *, size_t, size_t,
Index: uspace/lib/drv/include/ieee80211_iface.h
===================================================================
--- uspace/lib/drv/include/ieee80211_iface.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ieee80211_iface.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,8 +39,8 @@
 #include <async.h>
 
-extern errno_t ieee80211_get_scan_results(async_sess_t *,
+extern int ieee80211_get_scan_results(async_sess_t *,
     ieee80211_scan_results_t *, bool);
-extern errno_t ieee80211_connect(async_sess_t *, char *, char *);
-extern errno_t ieee80211_disconnect(async_sess_t *);
+extern int ieee80211_connect(async_sess_t *, char *, char *);
+extern int ieee80211_disconnect(async_sess_t *);
 
 #endif
Index: uspace/lib/drv/include/nic_iface.h
===================================================================
--- uspace/lib/drv/include/nic_iface.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/nic_iface.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,67 +47,67 @@
 } nic_event_t;
 
-extern errno_t nic_send_frame(async_sess_t *, void *, size_t);
-extern errno_t nic_callback_create(async_sess_t *, async_port_handler_t, void *);
-extern errno_t nic_get_state(async_sess_t *, nic_device_state_t *);
-extern errno_t nic_set_state(async_sess_t *, nic_device_state_t);
-extern errno_t nic_get_address(async_sess_t *, nic_address_t *);
-extern errno_t nic_set_address(async_sess_t *, const nic_address_t *);
-extern errno_t nic_get_stats(async_sess_t *, nic_device_stats_t *);
-extern errno_t nic_get_device_info(async_sess_t *, nic_device_info_t *);
-extern errno_t nic_get_cable_state(async_sess_t *, nic_cable_state_t *);
+extern int nic_send_frame(async_sess_t *, void *, size_t);
+extern int nic_callback_create(async_sess_t *, async_port_handler_t, void *);
+extern int nic_get_state(async_sess_t *, nic_device_state_t *);
+extern int nic_set_state(async_sess_t *, nic_device_state_t);
+extern int nic_get_address(async_sess_t *, nic_address_t *);
+extern int nic_set_address(async_sess_t *, const nic_address_t *);
+extern int nic_get_stats(async_sess_t *, nic_device_stats_t *);
+extern int nic_get_device_info(async_sess_t *, nic_device_info_t *);
+extern int nic_get_cable_state(async_sess_t *, nic_cable_state_t *);
 
-extern errno_t nic_get_operation_mode(async_sess_t *, int *, nic_channel_mode_t *,
+extern int nic_get_operation_mode(async_sess_t *, int *, nic_channel_mode_t *,
     nic_role_t *);
-extern errno_t nic_set_operation_mode(async_sess_t *, int, nic_channel_mode_t,
+extern int nic_set_operation_mode(async_sess_t *, int, nic_channel_mode_t,
     nic_role_t);
-extern errno_t nic_autoneg_enable(async_sess_t *, uint32_t);
-extern errno_t nic_autoneg_disable(async_sess_t *);
-extern errno_t nic_autoneg_probe(async_sess_t *, uint32_t *, uint32_t *,
+extern int nic_autoneg_enable(async_sess_t *, uint32_t);
+extern int nic_autoneg_disable(async_sess_t *);
+extern int nic_autoneg_probe(async_sess_t *, uint32_t *, uint32_t *,
     nic_result_t *, nic_result_t *);
-extern errno_t nic_autoneg_restart(async_sess_t *);
-extern errno_t nic_get_pause(async_sess_t *, nic_result_t *, nic_result_t *,
+extern int nic_autoneg_restart(async_sess_t *);
+extern int nic_get_pause(async_sess_t *, nic_result_t *, nic_result_t *,
     uint16_t *);
-extern errno_t nic_set_pause(async_sess_t *, int, int, uint16_t);
+extern int nic_set_pause(async_sess_t *, int, int, uint16_t);
 
-extern errno_t nic_unicast_get_mode(async_sess_t *, nic_unicast_mode_t *, size_t,
+extern int nic_unicast_get_mode(async_sess_t *, nic_unicast_mode_t *, size_t,
     nic_address_t *, size_t *);
-extern errno_t nic_unicast_set_mode(async_sess_t *, nic_unicast_mode_t,
+extern int nic_unicast_set_mode(async_sess_t *, nic_unicast_mode_t,
     const nic_address_t *, size_t);
-extern errno_t nic_multicast_get_mode(async_sess_t *, nic_multicast_mode_t *,
+extern int nic_multicast_get_mode(async_sess_t *, nic_multicast_mode_t *,
     size_t, nic_address_t *, size_t *);
-extern errno_t nic_multicast_set_mode(async_sess_t *, nic_multicast_mode_t,
+extern int nic_multicast_set_mode(async_sess_t *, nic_multicast_mode_t,
     const nic_address_t *, size_t);
-extern errno_t nic_broadcast_get_mode(async_sess_t *, nic_broadcast_mode_t *);
-extern errno_t nic_broadcast_set_mode(async_sess_t *, nic_broadcast_mode_t);
-extern errno_t nic_defective_get_mode(async_sess_t *, uint32_t *);
-extern errno_t nic_defective_set_mode(async_sess_t *, uint32_t);
-extern errno_t nic_blocked_sources_get(async_sess_t *, size_t, nic_address_t *,
+extern int nic_broadcast_get_mode(async_sess_t *, nic_broadcast_mode_t *);
+extern int nic_broadcast_set_mode(async_sess_t *, nic_broadcast_mode_t);
+extern int nic_defective_get_mode(async_sess_t *, uint32_t *);
+extern int nic_defective_set_mode(async_sess_t *, uint32_t);
+extern int nic_blocked_sources_get(async_sess_t *, size_t, nic_address_t *,
     size_t *);
-extern errno_t nic_blocked_sources_set(async_sess_t *, const nic_address_t *,
+extern int nic_blocked_sources_set(async_sess_t *, const nic_address_t *,
     size_t);
 
-extern errno_t nic_vlan_get_mask(async_sess_t *, nic_vlan_mask_t *);
-extern errno_t nic_vlan_set_mask(async_sess_t *, const nic_vlan_mask_t *);
-extern errno_t nic_vlan_set_tag(async_sess_t *, uint16_t, bool, bool);
+extern int nic_vlan_get_mask(async_sess_t *, nic_vlan_mask_t *);
+extern int nic_vlan_set_mask(async_sess_t *, const nic_vlan_mask_t *);
+extern int nic_vlan_set_tag(async_sess_t *, uint16_t, bool, bool);
 
-extern errno_t nic_wol_virtue_add(async_sess_t *, nic_wv_type_t, const void *,
+extern int nic_wol_virtue_add(async_sess_t *, nic_wv_type_t, const void *,
     size_t, nic_wv_id_t *);
-extern errno_t nic_wol_virtue_remove(async_sess_t *, nic_wv_id_t);
-extern errno_t nic_wol_virtue_probe(async_sess_t *, nic_wv_id_t, nic_wv_type_t *,
+extern int nic_wol_virtue_remove(async_sess_t *, nic_wv_id_t);
+extern int nic_wol_virtue_probe(async_sess_t *, nic_wv_id_t, nic_wv_type_t *,
     size_t, void *, size_t *);
-extern errno_t nic_wol_virtue_list(async_sess_t *, nic_wv_type_t, size_t,
+extern int nic_wol_virtue_list(async_sess_t *, nic_wv_type_t, size_t,
     nic_wv_id_t *, size_t *);
-extern errno_t nic_wol_virtue_get_caps(async_sess_t *, nic_wv_type_t, int *);
-extern errno_t nic_wol_load_info(async_sess_t *, nic_wv_type_t *, size_t, uint8_t *,
+extern int nic_wol_virtue_get_caps(async_sess_t *, nic_wv_type_t, int *);
+extern int nic_wol_load_info(async_sess_t *, nic_wv_type_t *, size_t, uint8_t *,
     size_t *);
 
-extern errno_t nic_offload_probe(async_sess_t *, uint32_t *, uint32_t *);
-extern errno_t nic_offload_set(async_sess_t *, uint32_t, uint32_t);
+extern int nic_offload_probe(async_sess_t *, uint32_t *, uint32_t *);
+extern int nic_offload_set(async_sess_t *, uint32_t, uint32_t);
 
-extern errno_t nic_poll_get_mode(async_sess_t *, nic_poll_mode_t *,
+extern int nic_poll_get_mode(async_sess_t *, nic_poll_mode_t *,
     struct timeval *);
-extern errno_t nic_poll_set_mode(async_sess_t *, nic_poll_mode_t,
+extern int nic_poll_set_mode(async_sess_t *, nic_poll_mode_t,
     const struct timeval *);
-extern errno_t nic_poll_now(async_sess_t *);
+extern int nic_poll_now(async_sess_t *);
 
 #endif
Index: uspace/lib/drv/include/ops/battery_dev.h
===================================================================
--- uspace/lib/drv/include/ops/battery_dev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ops/battery_dev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,6 +40,6 @@
 
 typedef struct {
-	errno_t (*battery_status_get)(ddf_fun_t *, battery_status_t *);
-	errno_t (*battery_charge_level_get)(ddf_fun_t *, int *);
+	int (*battery_status_get)(ddf_fun_t *, battery_status_t *);
+	int (*battery_charge_level_get)(ddf_fun_t *, int *);
 } battery_dev_ops_t;
 
Index: uspace/lib/drv/include/ops/clock_dev.h
===================================================================
--- uspace/lib/drv/include/ops/clock_dev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ops/clock_dev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,6 +40,6 @@
 
 typedef struct {
-	errno_t (*time_get)(ddf_fun_t *, struct tm *);
-	errno_t (*time_set)(ddf_fun_t *, struct tm *);
+	int (*time_get)(ddf_fun_t *, struct tm *);
+	int (*time_set)(ddf_fun_t *, struct tm *);
 } clock_dev_ops_t;
 
Index: uspace/lib/drv/include/ops/hw_res.h
===================================================================
--- uspace/lib/drv/include/ops/hw_res.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ops/hw_res.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,9 +44,9 @@
 typedef struct {
 	hw_resource_list_t *(*get_resource_list)(ddf_fun_t *);
-	errno_t (*enable_interrupt)(ddf_fun_t *, int);
-	errno_t (*disable_interrupt)(ddf_fun_t *, int);
-	errno_t (*clear_interrupt)(ddf_fun_t *, int);
-	errno_t (*dma_channel_setup)(ddf_fun_t *, unsigned, uint32_t, uint32_t, uint8_t);
-	errno_t (*dma_channel_remain)(ddf_fun_t *, unsigned, size_t *);
+	int (*enable_interrupt)(ddf_fun_t *, int);
+	int (*disable_interrupt)(ddf_fun_t *, int);
+	int (*clear_interrupt)(ddf_fun_t *, int);
+	int (*dma_channel_setup)(ddf_fun_t *, unsigned, uint32_t, uint32_t, uint8_t);
+	int (*dma_channel_remain)(ddf_fun_t *, unsigned, size_t *);
 } hw_res_ops_t;
 
Index: uspace/lib/drv/include/ops/ieee80211.h
===================================================================
--- uspace/lib/drv/include/ops/ieee80211.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ops/ieee80211.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,8 +48,8 @@
 	 * @param now     Whether to initiate scan immediately.
 	 *
-	 * @return EOK if succeed, error code otherwise.
+	 * @return EOK if succeed, negative error code otherwise.
 	 *
 	 */
-	errno_t (*get_scan_results)(ddf_fun_t *, ieee80211_scan_results_t *, bool);
+	int (*get_scan_results)(ddf_fun_t *, ieee80211_scan_results_t *, bool);
 	
 	/** Connect IEEE 802.11 device to specified network.
@@ -59,8 +59,8 @@
 	 * @param password Network password (empty string if not needed).
 	 *
-	 * @return EOK if succeed, error code otherwise.
+	 * @return EOK if succeed, negative error code otherwise.
 	 *
 	 */
-	errno_t (*connect)(ddf_fun_t *, char *, char *);
+	int (*connect)(ddf_fun_t *, char *, char *);
 	
 	/** Disconnect IEEE 802.11 device from network.
@@ -68,8 +68,8 @@
 	 * @param fun IEEE 802.11 function.
 	 *
-	 * @return EOK if succeed, error code otherwise.
+	 * @return EOK if succeed, negative error code otherwise.
 	 *
 	 */
-	errno_t (*disconnect)(ddf_fun_t *);
+	int (*disconnect)(ddf_fun_t *);
 } ieee80211_iface_t;
 
Index: uspace/lib/drv/include/ops/led_dev.h
===================================================================
--- uspace/lib/drv/include/ops/led_dev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ops/led_dev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 
 typedef struct {
-	errno_t (*color_set)(ddf_fun_t *, pixel_t);
+	int (*color_set)(ddf_fun_t *, pixel_t);
 } led_dev_ops_t;
 
Index: uspace/lib/drv/include/ops/nic.h
===================================================================
--- uspace/lib/drv/include/ops/nic.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ops/nic.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,68 +44,68 @@
 typedef struct nic_iface {
 	/** Mandatory methods */
-	errno_t (*send_frame)(ddf_fun_t *, void *, size_t);
-	errno_t (*callback_create)(ddf_fun_t *);
-	errno_t (*get_state)(ddf_fun_t *, nic_device_state_t *);
-	errno_t (*set_state)(ddf_fun_t *, nic_device_state_t);
-	errno_t (*get_address)(ddf_fun_t *, nic_address_t *);
+	int (*send_frame)(ddf_fun_t *, void *, size_t);
+	int (*callback_create)(ddf_fun_t *);
+	int (*get_state)(ddf_fun_t *, nic_device_state_t *);
+	int (*set_state)(ddf_fun_t *, nic_device_state_t);
+	int (*get_address)(ddf_fun_t *, nic_address_t *);
 	
 	/** Optional methods */
-	errno_t (*set_address)(ddf_fun_t *, const nic_address_t *);
-	errno_t (*get_stats)(ddf_fun_t *, nic_device_stats_t *);
-	errno_t (*get_device_info)(ddf_fun_t *, nic_device_info_t *);
-	errno_t (*get_cable_state)(ddf_fun_t *, nic_cable_state_t *);
+	int (*set_address)(ddf_fun_t *, const nic_address_t *);
+	int (*get_stats)(ddf_fun_t *, nic_device_stats_t *);
+	int (*get_device_info)(ddf_fun_t *, nic_device_info_t *);
+	int (*get_cable_state)(ddf_fun_t *, nic_cable_state_t *);
 	
-	errno_t (*get_operation_mode)(ddf_fun_t *, int *, nic_channel_mode_t *,
+	int (*get_operation_mode)(ddf_fun_t *, int *, nic_channel_mode_t *,
 	    nic_role_t *);
-	errno_t (*set_operation_mode)(ddf_fun_t *, int, nic_channel_mode_t,
+	int (*set_operation_mode)(ddf_fun_t *, int, nic_channel_mode_t,
 	    nic_role_t);
-	errno_t (*autoneg_enable)(ddf_fun_t *, uint32_t);
-	errno_t (*autoneg_disable)(ddf_fun_t *);
-	errno_t (*autoneg_probe)(ddf_fun_t *, uint32_t *, uint32_t *,
+	int (*autoneg_enable)(ddf_fun_t *, uint32_t);
+	int (*autoneg_disable)(ddf_fun_t *);
+	int (*autoneg_probe)(ddf_fun_t *, uint32_t *, uint32_t *,
 	    nic_result_t *, nic_result_t *);
-	errno_t (*autoneg_restart)(ddf_fun_t *);
-	errno_t (*get_pause)(ddf_fun_t *, nic_result_t *, nic_result_t *,
-	    uint16_t *);
-	errno_t (*set_pause)(ddf_fun_t *, int, int, uint16_t);
+	int (*autoneg_restart)(ddf_fun_t *);
+	int (*get_pause)(ddf_fun_t *, nic_result_t *, nic_result_t *,
+		uint16_t *);
+	int (*set_pause)(ddf_fun_t *, int, int, uint16_t);
 	
-	errno_t (*unicast_get_mode)(ddf_fun_t *, nic_unicast_mode_t *, size_t,
+	int (*unicast_get_mode)(ddf_fun_t *, nic_unicast_mode_t *, size_t,
 	    nic_address_t *, size_t *);
-	errno_t (*unicast_set_mode)(ddf_fun_t *, nic_unicast_mode_t,
+	int (*unicast_set_mode)(ddf_fun_t *, nic_unicast_mode_t,
 	    const nic_address_t *, size_t);
-	errno_t (*multicast_get_mode)(ddf_fun_t *, nic_multicast_mode_t *, size_t,
+	int (*multicast_get_mode)(ddf_fun_t *, nic_multicast_mode_t *, size_t,
 	    nic_address_t *, size_t *);
-	errno_t (*multicast_set_mode)(ddf_fun_t *, nic_multicast_mode_t,
+	int (*multicast_set_mode)(ddf_fun_t *, nic_multicast_mode_t,
 	    const nic_address_t *, size_t);
-	errno_t (*broadcast_get_mode)(ddf_fun_t *, nic_broadcast_mode_t *);
-	errno_t (*broadcast_set_mode)(ddf_fun_t *, nic_broadcast_mode_t);
-	errno_t (*defective_get_mode)(ddf_fun_t *, uint32_t *);
-	errno_t (*defective_set_mode)(ddf_fun_t *, uint32_t);
-	errno_t (*blocked_sources_get)(ddf_fun_t *, size_t, nic_address_t *,
+	int (*broadcast_get_mode)(ddf_fun_t *, nic_broadcast_mode_t *);
+	int (*broadcast_set_mode)(ddf_fun_t *, nic_broadcast_mode_t);
+	int (*defective_get_mode)(ddf_fun_t *, uint32_t *);
+	int (*defective_set_mode)(ddf_fun_t *, uint32_t);
+	int (*blocked_sources_get)(ddf_fun_t *, size_t, nic_address_t *,
 	    size_t *);
-	errno_t (*blocked_sources_set)(ddf_fun_t *, const nic_address_t *, size_t);
+	int (*blocked_sources_set)(ddf_fun_t *, const nic_address_t *, size_t);
 	
-	errno_t (*vlan_get_mask)(ddf_fun_t *, nic_vlan_mask_t *);
-	errno_t (*vlan_set_mask)(ddf_fun_t *, const nic_vlan_mask_t *);
-	errno_t (*vlan_set_tag)(ddf_fun_t *, uint16_t, bool, bool);
+	int (*vlan_get_mask)(ddf_fun_t *, nic_vlan_mask_t *);
+	int (*vlan_set_mask)(ddf_fun_t *, const nic_vlan_mask_t *);
+	int (*vlan_set_tag)(ddf_fun_t *, uint16_t, bool, bool);
 	
-	errno_t (*wol_virtue_add)(ddf_fun_t *, nic_wv_type_t, const void *,
+	int (*wol_virtue_add)(ddf_fun_t *, nic_wv_type_t, const void *,
 	    size_t, nic_wv_id_t *);
-	errno_t (*wol_virtue_remove)(ddf_fun_t *, nic_wv_id_t);
-	errno_t (*wol_virtue_probe)(ddf_fun_t *, nic_wv_id_t, nic_wv_type_t *,
+	int (*wol_virtue_remove)(ddf_fun_t *, nic_wv_id_t);
+	int (*wol_virtue_probe)(ddf_fun_t *, nic_wv_id_t, nic_wv_type_t *,
 	    size_t, void *, size_t *);
-	errno_t (*wol_virtue_list)(ddf_fun_t *, nic_wv_type_t, size_t,
+	int (*wol_virtue_list)(ddf_fun_t *, nic_wv_type_t, size_t,
 	    nic_wv_id_t *, size_t *);
-	errno_t (*wol_virtue_get_caps)(ddf_fun_t *, nic_wv_type_t, int *);
-	errno_t (*wol_load_info)(ddf_fun_t *, nic_wv_type_t *, size_t,
+	int (*wol_virtue_get_caps)(ddf_fun_t *, nic_wv_type_t, int *);
+	int (*wol_load_info)(ddf_fun_t *, nic_wv_type_t *, size_t,
 	    uint8_t *, size_t *);
 	
-	errno_t (*offload_probe)(ddf_fun_t *, uint32_t *, uint32_t *);
-	errno_t (*offload_set)(ddf_fun_t *, uint32_t, uint32_t);
+	int (*offload_probe)(ddf_fun_t *, uint32_t *, uint32_t *);
+	int (*offload_set)(ddf_fun_t *, uint32_t, uint32_t);
 	
-	errno_t (*poll_get_mode)(ddf_fun_t *, nic_poll_mode_t *,
+	int (*poll_get_mode)(ddf_fun_t *, nic_poll_mode_t *,
 	    struct timeval *);
-	errno_t (*poll_set_mode)(ddf_fun_t *, nic_poll_mode_t,
+	int (*poll_set_mode)(ddf_fun_t *, nic_poll_mode_t,
 	    const struct timeval *);
-	errno_t (*poll_now)(ddf_fun_t *);
+	int (*poll_now)(ddf_fun_t *);
 } nic_iface_t;
 
Index: uspace/lib/drv/include/ops/pio_window.h
===================================================================
--- uspace/lib/drv/include/ops/pio_window.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/ops/pio_window.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 
 typedef struct {
-	pio_window_t *(*get_pio_window)(ddf_fun_t *);
+	pio_window_t *(* get_pio_window)(ddf_fun_t *);
 } pio_window_ops_t;
 
Index: uspace/lib/drv/include/pci_dev_iface.h
===================================================================
--- uspace/lib/drv/include/pci_dev_iface.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/pci_dev_iface.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,21 +45,21 @@
 #define PCI_BASE_CLASS	0x0B
 
-extern errno_t pci_config_space_read_8(async_sess_t *, uint32_t, uint8_t *);
-extern errno_t pci_config_space_read_16(async_sess_t *, uint32_t, uint16_t *);
-extern errno_t pci_config_space_read_32(async_sess_t *, uint32_t, uint32_t *);
+extern int pci_config_space_read_8(async_sess_t *, uint32_t, uint8_t *);
+extern int pci_config_space_read_16(async_sess_t *, uint32_t, uint16_t *);
+extern int pci_config_space_read_32(async_sess_t *, uint32_t, uint32_t *);
 
-extern errno_t pci_config_space_write_8(async_sess_t *, uint32_t, uint8_t);
-extern errno_t pci_config_space_write_16(async_sess_t *, uint32_t, uint16_t);
-extern errno_t pci_config_space_write_32(async_sess_t *, uint32_t, uint32_t);
+extern int pci_config_space_write_8(async_sess_t *, uint32_t, uint8_t);
+extern int pci_config_space_write_16(async_sess_t *, uint32_t, uint16_t);
+extern int pci_config_space_write_32(async_sess_t *, uint32_t, uint32_t);
 
 /** PCI device communication interface. */
 typedef struct {
-	errno_t (*config_space_read_8)(ddf_fun_t *, uint32_t address, uint8_t *data);
-	errno_t (*config_space_read_16)(ddf_fun_t *, uint32_t address, uint16_t *data);
-	errno_t (*config_space_read_32)(ddf_fun_t *, uint32_t address, uint32_t *data);
+	int (*config_space_read_8)(ddf_fun_t *, uint32_t address, uint8_t *data);
+	int (*config_space_read_16)(ddf_fun_t *, uint32_t address, uint16_t *data);
+	int (*config_space_read_32)(ddf_fun_t *, uint32_t address, uint32_t *data);
 
-	errno_t (*config_space_write_8)(ddf_fun_t *, uint32_t address, uint8_t data);
-	errno_t (*config_space_write_16)(ddf_fun_t *, uint32_t address, uint16_t data);
-	errno_t (*config_space_write_32)(ddf_fun_t *, uint32_t address, uint32_t data);
+	int (*config_space_write_8)(ddf_fun_t *, uint32_t address, uint8_t data);
+	int (*config_space_write_16)(ddf_fun_t *, uint32_t address, uint16_t data);
+	int (*config_space_write_32)(ddf_fun_t *, uint32_t address, uint32_t data);
 } pci_dev_iface_t;
 
Index: uspace/lib/drv/include/usb_iface.h
===================================================================
--- uspace/lib/drv/include/usb_iface.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/usb_iface.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -95,47 +95,47 @@
 extern void usb_dev_disconnect(usb_dev_session_t *);
 
-extern errno_t usb_get_my_interface(async_exch_t *, int *);
-extern errno_t usb_get_my_device_handle(async_exch_t *, devman_handle_t *);
+extern int usb_get_my_interface(async_exch_t *, int *);
+extern int usb_get_my_device_handle(async_exch_t *, devman_handle_t *);
 
-extern errno_t usb_reserve_default_address(async_exch_t *, usb_speed_t);
-extern errno_t usb_release_default_address(async_exch_t *);
+extern int usb_reserve_default_address(async_exch_t *, usb_speed_t);
+extern int usb_release_default_address(async_exch_t *);
 
-extern errno_t usb_device_enumerate(async_exch_t *, unsigned port);
-extern errno_t usb_device_remove(async_exch_t *, unsigned port);
+extern int usb_device_enumerate(async_exch_t *, unsigned port);
+extern int usb_device_remove(async_exch_t *, unsigned port);
 
-extern errno_t usb_register_endpoint(async_exch_t *, usb_endpoint_t,
+extern int usb_register_endpoint(async_exch_t *, usb_endpoint_t,
     usb_transfer_type_t, usb_direction_t, size_t, unsigned, unsigned);
-extern errno_t usb_unregister_endpoint(async_exch_t *, usb_endpoint_t,
+extern int usb_unregister_endpoint(async_exch_t *, usb_endpoint_t,
     usb_direction_t);
-extern errno_t usb_read(async_exch_t *, usb_endpoint_t, uint64_t, void *, size_t,
+extern int usb_read(async_exch_t *, usb_endpoint_t, uint64_t, void *, size_t,
     size_t *);
-extern errno_t usb_write(async_exch_t *, usb_endpoint_t, uint64_t, const void *,
+extern int usb_write(async_exch_t *, usb_endpoint_t, uint64_t, const void *,
     size_t);
 
 /** Callback for outgoing transfer. */
-typedef void (*usb_iface_transfer_out_callback_t)(errno_t, void *);
+typedef void (*usb_iface_transfer_out_callback_t)(int, void *);
 
 /** Callback for incoming transfer. */
-typedef void (*usb_iface_transfer_in_callback_t)(errno_t, size_t, void *);
+typedef void (*usb_iface_transfer_in_callback_t)(int, size_t, void *);
 
 /** USB device communication interface. */
 typedef struct {
-	errno_t (*get_my_interface)(ddf_fun_t *, int *);
-	errno_t (*get_my_device_handle)(ddf_fun_t *, devman_handle_t *);
+	int (*get_my_interface)(ddf_fun_t *, int *);
+	int (*get_my_device_handle)(ddf_fun_t *, devman_handle_t *);
 
-	errno_t (*reserve_default_address)(ddf_fun_t *, usb_speed_t);
-	errno_t (*release_default_address)(ddf_fun_t *);
+	int (*reserve_default_address)(ddf_fun_t *, usb_speed_t);
+	int (*release_default_address)(ddf_fun_t *);
 
-	errno_t (*device_enumerate)(ddf_fun_t *, unsigned);
-	errno_t (*device_remove)(ddf_fun_t *, unsigned);
+	int (*device_enumerate)(ddf_fun_t *, unsigned);
+	int (*device_remove)(ddf_fun_t *, unsigned);
 
-	errno_t (*register_endpoint)(ddf_fun_t *, usb_endpoint_t,
+	int (*register_endpoint)(ddf_fun_t *, usb_endpoint_t,
 	    usb_transfer_type_t, usb_direction_t, size_t, unsigned, unsigned);
-	errno_t (*unregister_endpoint)(ddf_fun_t *, usb_endpoint_t,
+	int (*unregister_endpoint)(ddf_fun_t *, usb_endpoint_t,
 	    usb_direction_t);
 
-	errno_t (*read)(ddf_fun_t *, usb_endpoint_t, uint64_t, uint8_t *, size_t,
+	int (*read)(ddf_fun_t *, usb_endpoint_t, uint64_t, uint8_t *, size_t,
 	    usb_iface_transfer_in_callback_t, void *);
-	errno_t (*write)(ddf_fun_t *, usb_endpoint_t, uint64_t, const uint8_t *,
+	int (*write)(ddf_fun_t *, usb_endpoint_t, uint64_t, const uint8_t *,
 	    size_t, usb_iface_transfer_out_callback_t, void *);
 } usb_iface_t;
Index: uspace/lib/drv/include/usbhc_iface.h
===================================================================
--- uspace/lib/drv/include/usbhc_iface.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/usbhc_iface.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,20 +44,20 @@
 #include <stdbool.h>
 
-extern errno_t usbhc_read(async_exch_t *, usb_address_t, usb_endpoint_t,
+extern int usbhc_read(async_exch_t *, usb_address_t, usb_endpoint_t,
     uint64_t, void *, size_t, size_t *);
-extern errno_t usbhc_write(async_exch_t *, usb_address_t, usb_endpoint_t,
+extern int usbhc_write(async_exch_t *, usb_address_t, usb_endpoint_t,
     uint64_t, const void *, size_t);
 
 /** Callback for outgoing transfer. */
-typedef void (*usbhc_iface_transfer_out_callback_t)(errno_t, void *);
+typedef void (*usbhc_iface_transfer_out_callback_t)(int, void *);
 
 /** Callback for incoming transfer. */
-typedef void (*usbhc_iface_transfer_in_callback_t)(errno_t, size_t, void *);
+typedef void (*usbhc_iface_transfer_in_callback_t)(int, size_t, void *);
 
 /** USB host controller communication interface. */
 typedef struct {
-	errno_t (*read)(ddf_fun_t *, usb_target_t, uint64_t, uint8_t *, size_t,
+	int (*read)(ddf_fun_t *, usb_target_t, uint64_t, uint8_t *, size_t,
 	    usbhc_iface_transfer_in_callback_t, void *);
-	errno_t (*write)(ddf_fun_t *, usb_target_t, uint64_t, const uint8_t *,
+	int (*write)(ddf_fun_t *, usb_target_t, uint64_t, const uint8_t *,
 	    size_t, usbhc_iface_transfer_out_callback_t, void *);
 } usbhc_iface_t;
Index: uspace/lib/drv/include/usbhid_iface.h
===================================================================
--- uspace/lib/drv/include/usbhid_iface.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/drv/include/usbhid_iface.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,9 +39,9 @@
 #include "ddf/driver.h"
 
-extern errno_t usbhid_dev_get_event_length(async_sess_t *, size_t *);
-extern errno_t usbhid_dev_get_event(async_sess_t *, uint8_t *, size_t, size_t *,
+extern int usbhid_dev_get_event_length(async_sess_t *, size_t *);
+extern int usbhid_dev_get_event(async_sess_t *, uint8_t *, size_t, size_t *,
     int *, unsigned int);
-extern errno_t usbhid_dev_get_report_descriptor_length(async_sess_t *, size_t *);
-extern errno_t usbhid_dev_get_report_descriptor(async_sess_t *, uint8_t *, size_t,
+extern int usbhid_dev_get_report_descriptor_length(async_sess_t *, size_t *);
+extern int usbhid_dev_get_report_descriptor(async_sess_t *, uint8_t *, size_t,
     size_t *);
 
@@ -63,5 +63,5 @@
 	 * @return Error code.
 	 */
-	errno_t (*get_event)(ddf_fun_t *fun, uint8_t *buffer, size_t size,
+	int (*get_event)(ddf_fun_t *fun, uint8_t *buffer, size_t size,
 	    size_t *act_size, int *event_nr, unsigned int flags);
 	
@@ -81,5 +81,5 @@
 	 * @return Error code.
 	 */
-	errno_t (*get_report_descriptor)(ddf_fun_t *fun, uint8_t *desc,
+	int (*get_report_descriptor)(ddf_fun_t *fun, uint8_t *desc, 
 	    size_t size, size_t *act_size);
 } usbhid_iface_t;
Index: uspace/lib/ext4/include/ext4/balloc.h
===================================================================
--- uspace/lib/ext4/include/ext4/balloc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/balloc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,10 +37,10 @@
 #include "types.h"
 
-extern errno_t ext4_balloc_free_block(ext4_inode_ref_t *, uint32_t);
-extern errno_t ext4_balloc_free_blocks(ext4_inode_ref_t *, uint32_t, uint32_t);
+extern int ext4_balloc_free_block(ext4_inode_ref_t *, uint32_t);
+extern int ext4_balloc_free_blocks(ext4_inode_ref_t *, uint32_t, uint32_t);
 extern uint32_t ext4_balloc_get_first_data_block_in_group(ext4_superblock_t *,
     ext4_block_group_ref_t *);
-extern errno_t ext4_balloc_alloc_block(ext4_inode_ref_t *, uint32_t *);
-extern errno_t ext4_balloc_try_alloc_block(ext4_inode_ref_t *, uint32_t, bool *);
+extern int ext4_balloc_alloc_block(ext4_inode_ref_t *, uint32_t *);
+extern int ext4_balloc_try_alloc_block(ext4_inode_ref_t *, uint32_t, bool *);
 
 #endif
Index: uspace/lib/ext4/include/ext4/bitmap.h
===================================================================
--- uspace/lib/ext4/include/ext4/bitmap.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/bitmap.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,7 +40,7 @@
 extern void ext4_bitmap_set_bit(uint8_t *, uint32_t);
 extern bool ext4_bitmap_is_free_bit(uint8_t *, uint32_t);
-extern errno_t ext4_bitmap_find_free_byte_and_set_bit(uint8_t *, uint32_t,
+extern int ext4_bitmap_find_free_byte_and_set_bit(uint8_t *, uint32_t,
     uint32_t *, uint32_t);
-extern errno_t ext4_bitmap_find_free_bit_and_set(uint8_t *, uint32_t, uint32_t *,
+extern int ext4_bitmap_find_free_bit_and_set(uint8_t *, uint32_t, uint32_t *,
     uint32_t);
 
Index: uspace/lib/ext4/include/ext4/directory.h
===================================================================
--- uspace/lib/ext4/include/ext4/directory.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/directory.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,25 +53,25 @@
     ext4_directory_entry_ll_t *, uint8_t);
 
-extern errno_t ext4_directory_iterator_init(ext4_directory_iterator_t *,
+extern int ext4_directory_iterator_init(ext4_directory_iterator_t *,
     ext4_inode_ref_t *, aoff64_t);
-extern errno_t ext4_directory_iterator_next(ext4_directory_iterator_t *);
-extern errno_t ext4_directory_iterator_fini(ext4_directory_iterator_t *);
+extern int ext4_directory_iterator_next(ext4_directory_iterator_t *);
+extern int ext4_directory_iterator_fini(ext4_directory_iterator_t *);
 
 extern void ext4_directory_write_entry(ext4_superblock_t *,
     ext4_directory_entry_ll_t *, uint16_t, ext4_inode_ref_t *,
     const char *, size_t);
-extern errno_t ext4_directory_add_entry(ext4_inode_ref_t *, const char *,
+extern int ext4_directory_add_entry(ext4_inode_ref_t *, const char *,
     ext4_inode_ref_t *);
-extern errno_t ext4_directory_find_entry(ext4_directory_search_result_t *,
+extern int ext4_directory_find_entry(ext4_directory_search_result_t *,
     ext4_inode_ref_t *, const char *);
-extern errno_t ext4_directory_remove_entry(ext4_inode_ref_t *, const char *);
+extern int ext4_directory_remove_entry(ext4_inode_ref_t *, const char *);
 
-extern errno_t ext4_directory_try_insert_entry(ext4_superblock_t *, block_t *,
+extern int ext4_directory_try_insert_entry(ext4_superblock_t *, block_t *,
     ext4_inode_ref_t *, const char *, uint32_t);
 
-extern errno_t ext4_directory_find_in_block(block_t *, ext4_superblock_t *, size_t,
+extern int ext4_directory_find_in_block(block_t *, ext4_superblock_t *, size_t,
     const char *, ext4_directory_entry_ll_t **);
 
-extern errno_t ext4_directory_destroy_result(ext4_directory_search_result_t *);
+extern int ext4_directory_destroy_result(ext4_directory_search_result_t *);
 
 #endif
Index: uspace/lib/ext4/include/ext4/directory_index.h
===================================================================
--- uspace/lib/ext4/include/ext4/directory_index.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/directory_index.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -65,8 +65,8 @@
     uint32_t);
 
-extern errno_t ext4_directory_dx_init(ext4_inode_ref_t *);
-extern errno_t ext4_directory_dx_find_entry(ext4_directory_search_result_t *,
+extern int ext4_directory_dx_init(ext4_inode_ref_t *);
+extern int ext4_directory_dx_find_entry(ext4_directory_search_result_t *,
     ext4_inode_ref_t *, size_t, const char *);
-extern errno_t ext4_directory_dx_add_entry(ext4_inode_ref_t *, ext4_inode_ref_t *,
+extern int ext4_directory_dx_add_entry(ext4_inode_ref_t *, ext4_inode_ref_t *,
     const char *);
 
Index: uspace/lib/ext4/include/ext4/extent.h
===================================================================
--- uspace/lib/ext4/include/ext4/extent.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/extent.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,8 +61,8 @@
 extern void ext4_extent_header_set_generation(ext4_extent_header_t *, uint32_t);
 
-extern errno_t ext4_extent_find_block(ext4_inode_ref_t *, uint32_t, uint32_t *);
-extern errno_t ext4_extent_release_blocks_from(ext4_inode_ref_t *, uint32_t);
+extern int ext4_extent_find_block(ext4_inode_ref_t *, uint32_t, uint32_t *);
+extern int ext4_extent_release_blocks_from(ext4_inode_ref_t *, uint32_t);
 
-extern errno_t ext4_extent_append_block(ext4_inode_ref_t *, uint32_t *, uint32_t *,
+extern int ext4_extent_append_block(ext4_inode_ref_t *, uint32_t *, uint32_t *,
     bool);
 
Index: uspace/lib/ext4/include/ext4/filesystem.h
===================================================================
--- uspace/lib/ext4/include/ext4/filesystem.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/filesystem.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,8 +39,8 @@
 #include "ext4/types.h"
 
-extern errno_t ext4_filesystem_probe(service_id_t);
-extern errno_t ext4_filesystem_open(ext4_instance_t *, service_id_t,
+extern int ext4_filesystem_probe(service_id_t);
+extern int ext4_filesystem_open(ext4_instance_t *, service_id_t,
     enum cache_mode, aoff64_t *, ext4_filesystem_t **);
-extern errno_t ext4_filesystem_close(ext4_filesystem_t *);
+extern int ext4_filesystem_close(ext4_filesystem_t *);
 extern uint32_t ext4_filesystem_blockaddr2_index_in_group(ext4_superblock_t *,
     uint32_t);
@@ -48,20 +48,20 @@
     uint32_t, uint32_t);
 extern uint32_t ext4_filesystem_blockaddr2group(ext4_superblock_t *, uint64_t);
-extern errno_t ext4_filesystem_get_block_group_ref(ext4_filesystem_t *, uint32_t,
+extern int ext4_filesystem_get_block_group_ref(ext4_filesystem_t *, uint32_t,
     ext4_block_group_ref_t **);
-extern errno_t ext4_filesystem_put_block_group_ref(ext4_block_group_ref_t *);
-extern errno_t ext4_filesystem_get_inode_ref(ext4_filesystem_t *, uint32_t,
+extern int ext4_filesystem_put_block_group_ref(ext4_block_group_ref_t *);
+extern int ext4_filesystem_get_inode_ref(ext4_filesystem_t *, uint32_t,
     ext4_inode_ref_t **);
-extern errno_t ext4_filesystem_put_inode_ref(ext4_inode_ref_t *);
-extern errno_t ext4_filesystem_alloc_inode(ext4_filesystem_t *, ext4_inode_ref_t **,
+extern int ext4_filesystem_put_inode_ref(ext4_inode_ref_t *);
+extern int ext4_filesystem_alloc_inode(ext4_filesystem_t *, ext4_inode_ref_t **,
     int);
-extern errno_t ext4_filesystem_free_inode(ext4_inode_ref_t *);
-extern errno_t ext4_filesystem_truncate_inode(ext4_inode_ref_t *, aoff64_t);
-extern errno_t ext4_filesystem_get_inode_data_block_index(ext4_inode_ref_t *,
+extern int ext4_filesystem_free_inode(ext4_inode_ref_t *);
+extern int ext4_filesystem_truncate_inode(ext4_inode_ref_t *, aoff64_t);
+extern int ext4_filesystem_get_inode_data_block_index(ext4_inode_ref_t *,
     aoff64_t iblock, uint32_t *);
-extern errno_t ext4_filesystem_set_inode_data_block_index(ext4_inode_ref_t *,
+extern int ext4_filesystem_set_inode_data_block_index(ext4_inode_ref_t *,
     aoff64_t, uint32_t);
-extern errno_t ext4_filesystem_release_inode_block(ext4_inode_ref_t *, uint32_t);
-extern errno_t ext4_filesystem_append_inode_block(ext4_inode_ref_t *, uint32_t *,
+extern int ext4_filesystem_release_inode_block(ext4_inode_ref_t *, uint32_t);
+extern int ext4_filesystem_append_inode_block(ext4_inode_ref_t *, uint32_t *,
     uint32_t *);
 uint32_t ext4_filesystem_bg_get_backup_blocks(ext4_block_group_ref_t *bg);
Index: uspace/lib/ext4/include/ext4/hash.h
===================================================================
--- uspace/lib/ext4/include/ext4/hash.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/hash.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,5 @@
 #include "ext4/types.h"
 
-extern errno_t ext4_hash_string(ext4_hash_info_t *, int, const char *);
+extern int ext4_hash_string(ext4_hash_info_t *, int, const char *);
 
 #endif
Index: uspace/lib/ext4/include/ext4/ialloc.h
===================================================================
--- uspace/lib/ext4/include/ext4/ialloc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/ialloc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,6 +36,6 @@
 #include "ext4/types.h"
 
-extern errno_t ext4_ialloc_free_inode(ext4_filesystem_t *, uint32_t, bool);
-extern errno_t ext4_ialloc_alloc_inode(ext4_filesystem_t *, uint32_t *, bool);
+extern int ext4_ialloc_free_inode(ext4_filesystem_t *, uint32_t, bool);
+extern int ext4_ialloc_alloc_inode(ext4_filesystem_t *, uint32_t *, bool);
 
 #endif
Index: uspace/lib/ext4/include/ext4/inode.h
===================================================================
--- uspace/lib/ext4/include/ext4/inode.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/inode.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,5 +59,5 @@
 extern uint64_t ext4_inode_get_blocks_count(ext4_superblock_t *,
     ext4_inode_t *);
-extern errno_t ext4_inode_set_blocks_count(ext4_superblock_t *, ext4_inode_t *,
+extern int ext4_inode_set_blocks_count(ext4_superblock_t *, ext4_inode_t *,
     uint64_t);
 extern uint32_t ext4_inode_get_flags(ext4_inode_t *);
@@ -73,5 +73,5 @@
 extern uint32_t ext4_inode_get_indirect_block(ext4_inode_t *, uint32_t);
 extern void ext4_inode_set_indirect_block(ext4_inode_t *, uint32_t, uint32_t);
-extern ext4_extent_header_t *ext4_inode_get_extent_header(ext4_inode_t *);
+extern ext4_extent_header_t * ext4_inode_get_extent_header(ext4_inode_t *);
 extern bool ext4_inode_is_type(ext4_superblock_t *, ext4_inode_t *, uint32_t);
 extern bool ext4_inode_has_flag(ext4_inode_t *, uint32_t);
Index: uspace/lib/ext4/include/ext4/ops.h
===================================================================
--- uspace/lib/ext4/include/ext4/ops.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/ops.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,9 +40,9 @@
 extern libfs_ops_t ext4_libfs_ops;
 
-extern errno_t ext4_global_init(void);
-extern errno_t ext4_global_fini(void);
+extern int ext4_global_init(void);
+extern int ext4_global_fini(void);
 
-extern errno_t ext4_node_get_core(fs_node_t **, ext4_instance_t *, fs_index_t);
-extern errno_t ext4_node_put(fs_node_t *);
+extern int ext4_node_get_core(fs_node_t **, ext4_instance_t *, fs_index_t);
+extern int ext4_node_put(fs_node_t *);
 
 
Index: uspace/lib/ext4/include/ext4/superblock.h
===================================================================
--- uspace/lib/ext4/include/ext4/superblock.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/superblock.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -113,14 +113,14 @@
     uint32_t);
 
-extern const uint8_t *ext4_superblock_get_uuid(ext4_superblock_t *);
+extern const uint8_t * ext4_superblock_get_uuid(ext4_superblock_t *);
 extern void ext4_superblock_set_uuid(ext4_superblock_t *, const uint8_t *);
-extern const char *ext4_superblock_get_volume_name(ext4_superblock_t *);
+extern const char * ext4_superblock_get_volume_name(ext4_superblock_t *);
 extern void ext4_superblock_set_volume_name(ext4_superblock_t *, const char *);
-extern const char *ext4_superblock_get_last_mounted(ext4_superblock_t *);
+extern const char * ext4_superblock_get_last_mounted(ext4_superblock_t *);
 extern void ext4_superblock_set_last_mounted(ext4_superblock_t *, const char *);
 
 extern uint32_t ext4_superblock_get_last_orphan(ext4_superblock_t *);
 extern void ext4_superblock_set_last_orphan(ext4_superblock_t *, uint32_t);
-extern const uint32_t *ext4_superblock_get_hash_seed(ext4_superblock_t *);
+extern const uint32_t * ext4_superblock_get_hash_seed(ext4_superblock_t *);
 extern void ext4_superblock_set_hash_seed(ext4_superblock_t *,
     const uint32_t *);
@@ -152,8 +152,8 @@
 extern bool ext4_superblock_has_feature_read_only(ext4_superblock_t *,
     uint32_t);
-extern errno_t ext4_superblock_read_direct(service_id_t, ext4_superblock_t **);
-extern errno_t ext4_superblock_write_direct(service_id_t, ext4_superblock_t *);
+extern int ext4_superblock_read_direct(service_id_t, ext4_superblock_t **);
+extern int ext4_superblock_write_direct(service_id_t, ext4_superblock_t *);
 extern void ext4_superblock_release(ext4_superblock_t *);
-extern errno_t ext4_superblock_check_sanity(ext4_superblock_t *);
+extern int ext4_superblock_check_sanity(ext4_superblock_t *);
 
 extern uint32_t ext4_superblock_get_block_group_count(ext4_superblock_t *);
Index: uspace/lib/ext4/include/ext4/types.h
===================================================================
--- uspace/lib/ext4/include/ext4/types.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/include/ext4/types.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -476,4 +476,5 @@
 } ext4_directory_dx_block_t;
 
+#define EXT4_ERR_BAD_DX_DIR       (-75000)
 #define EXT4_DIRECTORY_HTREE_EOF  UINT32_C(0x7fffffff)
 
Index: uspace/lib/ext4/src/balloc.c
===================================================================
--- uspace/lib/ext4/src/balloc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/src/balloc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,5 +53,5 @@
  *
  */
-errno_t ext4_balloc_free_block(ext4_inode_ref_t *inode_ref, uint32_t block_addr)
+int ext4_balloc_free_block(ext4_inode_ref_t *inode_ref, uint32_t block_addr)
 {
 	ext4_filesystem_t *fs = inode_ref->fs;
@@ -65,5 +65,5 @@
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
-	errno_t rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
+	int rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
 	if (rc != EOK)
 		return rc;
@@ -118,5 +118,5 @@
 }
 
-static errno_t ext4_balloc_free_blocks_internal(ext4_inode_ref_t *inode_ref,
+static int ext4_balloc_free_blocks_internal(ext4_inode_ref_t *inode_ref,
     uint32_t first, uint32_t count)
 {
@@ -134,5 +134,5 @@
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
-	errno_t rc = ext4_filesystem_get_block_group_ref(fs, block_group_first, &bg_ref);
+	int rc = ext4_filesystem_get_block_group_ref(fs, block_group_first, &bg_ref);
 	if (rc != EOK)
 		return rc;
@@ -198,8 +198,8 @@
  *
  */
-errno_t ext4_balloc_free_blocks(ext4_inode_ref_t *inode_ref,
+int ext4_balloc_free_blocks(ext4_inode_ref_t *inode_ref,
     uint32_t first, uint32_t count)
 {
-	errno_t r;
+	int r;
 	uint32_t gid;
 	uint64_t limit;
@@ -293,5 +293,5 @@
  *
  */
-static errno_t ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref, uint32_t *goal)
+static int ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref, uint32_t *goal)
 {
 	*goal = 0;
@@ -307,5 +307,5 @@
 	/* If inode has some blocks, get last block address + 1 */
 	if (inode_block_count > 0) {
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
+		int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
 		    inode_block_count - 1, goal);
 		if (rc != EOK)
@@ -325,5 +325,5 @@
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
-	errno_t rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
+	int rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
 	    block_group, &bg_ref);
 	if (rc != EOK)
@@ -343,5 +343,5 @@
  *
  */
-errno_t ext4_balloc_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t *fblock)
+int ext4_balloc_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t *fblock)
 {
 	uint32_t allocated_block = 0;
@@ -354,5 +354,5 @@
 	
 	/* Find GOAL */
-	errno_t rc = ext4_balloc_find_goal(inode_ref, &goal);
+	int rc = ext4_balloc_find_goal(inode_ref, &goal);
 	if (rc != EOK)
 		return rc;
@@ -625,8 +625,8 @@
  *
  */
-errno_t ext4_balloc_try_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t fblock,
+int ext4_balloc_try_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t fblock,
     bool *free)
 {
-	errno_t rc;
+	int rc;
 	
 	ext4_filesystem_t *fs = inode_ref->fs;
Index: uspace/lib/ext4/src/bitmap.c
===================================================================
--- uspace/lib/ext4/src/bitmap.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/src/bitmap.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -169,5 +169,5 @@
  *
  */
-errno_t ext4_bitmap_find_free_byte_and_set_bit(uint8_t *bitmap, uint32_t start,
+int ext4_bitmap_find_free_byte_and_set_bit(uint8_t *bitmap, uint32_t start,
     uint32_t *index, uint32_t max)
 {
@@ -211,5 +211,5 @@
  *
  */
-errno_t ext4_bitmap_find_free_bit_and_set(uint8_t *bitmap, uint32_t start_idx,
+int ext4_bitmap_find_free_bit_and_set(uint8_t *bitmap, uint32_t start_idx,
     uint32_t *index, uint32_t max)
 {
Index: uspace/lib/ext4/src/directory.c
===================================================================
--- uspace/lib/ext4/src/directory.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/src/directory.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -169,6 +169,6 @@
 }
 
-static errno_t ext4_directory_iterator_seek(ext4_directory_iterator_t *, aoff64_t);
-static errno_t ext4_directory_iterator_set(ext4_directory_iterator_t *, uint32_t);
+static int ext4_directory_iterator_seek(ext4_directory_iterator_t *, aoff64_t);
+static int ext4_directory_iterator_set(ext4_directory_iterator_t *, uint32_t);
 
 /** Initialize directory iterator.
@@ -183,5 +183,5 @@
  *
  */
-errno_t ext4_directory_iterator_init(ext4_directory_iterator_t *it,
+int ext4_directory_iterator_init(ext4_directory_iterator_t *it,
     ext4_inode_ref_t *inode_ref, aoff64_t pos)
 {
@@ -201,5 +201,5 @@
  *
  */
-errno_t ext4_directory_iterator_next(ext4_directory_iterator_t *it)
+int ext4_directory_iterator_next(ext4_directory_iterator_t *it)
 {
 	assert(it->current != NULL);
@@ -220,5 +220,5 @@
  *
  */
-errno_t ext4_directory_iterator_seek(ext4_directory_iterator_t *it, aoff64_t pos)
+int ext4_directory_iterator_seek(ext4_directory_iterator_t *it, aoff64_t pos)
 {
 	uint64_t size = ext4_inode_get_size(it->inode_ref->fs->superblock,
@@ -231,5 +231,5 @@
 	if (pos >= size) {
 		if (it->current_block) {
-			errno_t rc = block_put(it->current_block);
+			int rc = block_put(it->current_block);
 			it->current_block = NULL;
 			
@@ -255,5 +255,5 @@
 	    (current_block_idx != next_block_idx)) {
 		if (it->current_block) {
-			errno_t rc = block_put(it->current_block);
+			int rc = block_put(it->current_block);
 			it->current_block = NULL;
 			
@@ -263,5 +263,5 @@
 		
 		uint32_t next_block_phys_idx;
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(it->inode_ref,
+		int rc = ext4_filesystem_get_inode_data_block_index(it->inode_ref,
 		    next_block_idx, &next_block_phys_idx);
 		if (rc != EOK)
@@ -289,5 +289,5 @@
  *
  */
-static errno_t ext4_directory_iterator_set(ext4_directory_iterator_t *it,
+static int ext4_directory_iterator_set(ext4_directory_iterator_t *it,
     uint32_t block_size)
 {
@@ -331,5 +331,5 @@
  *
  */
-errno_t ext4_directory_iterator_fini(ext4_directory_iterator_t *it)
+int ext4_directory_iterator_fini(ext4_directory_iterator_t *it)
 {
 	it->inode_ref = NULL;
@@ -386,5 +386,5 @@
  *
  */
-errno_t ext4_directory_add_entry(ext4_inode_ref_t *parent, const char *name,
+int ext4_directory_add_entry(ext4_inode_ref_t *parent, const char *name,
     ext4_inode_ref_t *child)
 {
@@ -395,5 +395,5 @@
 	    EXT4_FEATURE_COMPAT_DIR_INDEX)) &&
 	    (ext4_inode_has_flag(parent->inode, EXT4_INODE_FLAG_INDEX))) {
-		errno_t rc = ext4_directory_dx_add_entry(parent, child, name);
+		int rc = ext4_directory_dx_add_entry(parent, child, name);
 
 		/* Check if index is not corrupted */
@@ -419,5 +419,5 @@
 	bool success = false;
 	for (iblock = 0; iblock < total_blocks; ++iblock) {
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(parent,
+		int rc = ext4_filesystem_get_inode_data_block_index(parent,
 		    iblock, &fblock);
 		if (rc != EOK)
@@ -447,5 +447,5 @@
 	iblock = 0;
 	fblock = 0;
-	errno_t rc = ext4_filesystem_append_inode_block(parent, &fblock, &iblock);
+	int rc = ext4_filesystem_append_inode_block(parent, &fblock, &iblock);
 	if (rc != EOK)
 		return rc;
@@ -479,5 +479,5 @@
  *
  */
-errno_t ext4_directory_find_entry(ext4_directory_search_result_t *result,
+int ext4_directory_find_entry(ext4_directory_search_result_t *result,
     ext4_inode_ref_t *parent, const char *name)
 {
@@ -490,5 +490,5 @@
 	    EXT4_FEATURE_COMPAT_DIR_INDEX)) &&
 	    (ext4_inode_has_flag(parent->inode, EXT4_INODE_FLAG_INDEX))) {
-		errno_t rc = ext4_directory_dx_find_entry(result, parent, name_len,
+		int rc = ext4_directory_dx_find_entry(result, parent, name_len,
 		    name);
 		
@@ -517,5 +517,5 @@
 	for (iblock = 0; iblock < total_blocks; ++iblock) {
 		/* Load block address */
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(parent, iblock,
+		int rc = ext4_filesystem_get_inode_data_block_index(parent, iblock,
 		    &fblock);
 		if (rc != EOK)
@@ -561,5 +561,5 @@
  *
  */
-errno_t ext4_directory_remove_entry(ext4_inode_ref_t *parent, const char *name)
+int ext4_directory_remove_entry(ext4_inode_ref_t *parent, const char *name)
 {
 	/* Check if removing from directory */
@@ -570,5 +570,5 @@
 	/* Try to find entry */
 	ext4_directory_search_result_t result;
-	errno_t rc = ext4_directory_find_entry(&result, parent, name);
+	int rc = ext4_directory_find_entry(&result, parent, name);
 	if (rc != EOK)
 		return rc;
@@ -626,5 +626,5 @@
  *
  */
-errno_t ext4_directory_try_insert_entry(ext4_superblock_t *sb,
+int ext4_directory_try_insert_entry(ext4_superblock_t *sb,
     block_t *target_block, ext4_inode_ref_t *child, const char *name,
     uint32_t name_len)
@@ -705,5 +705,5 @@
  *
  */
-errno_t ext4_directory_find_in_block(block_t *block, ext4_superblock_t *sb,
+int ext4_directory_find_in_block(block_t *block, ext4_superblock_t *sb,
     size_t name_len, const char *name, ext4_directory_entry_ll_t **res_entry)
 {
@@ -756,5 +756,5 @@
  *
  */
-errno_t ext4_directory_destroy_result(ext4_directory_search_result_t *result)
+int ext4_directory_destroy_result(ext4_directory_search_result_t *result)
 {
 	if (result->block)
Index: uspace/lib/ext4/src/directory_index.c
===================================================================
--- uspace/lib/ext4/src/directory_index.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/src/directory_index.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -236,9 +236,9 @@
  *
  */
-errno_t ext4_directory_dx_init(ext4_inode_ref_t *dir)
+int ext4_directory_dx_init(ext4_inode_ref_t *dir)
 {
 	/* Load block 0, where will be index root located */
 	uint32_t fblock;
-	errno_t rc = ext4_filesystem_get_inode_data_block_index(dir, 0,
+	int rc = ext4_filesystem_get_inode_data_block_index(dir, 0,
 	    &fblock);
 	if (rc != EOK)
@@ -322,5 +322,5 @@
  *
  */
-static errno_t ext4_directory_hinfo_init(ext4_hash_info_t *hinfo,
+static int ext4_directory_hinfo_init(ext4_hash_info_t *hinfo,
     block_t *root_block, ext4_superblock_t *sb, size_t name_len,
     const char *name)
@@ -384,5 +384,5 @@
  *
  */
-static errno_t ext4_directory_dx_get_leaf(ext4_hash_info_t *hinfo,
+static int ext4_directory_dx_get_leaf(ext4_hash_info_t *hinfo,
     ext4_inode_ref_t *inode_ref, block_t *root_block,
     ext4_directory_dx_block_t **dx_block, ext4_directory_dx_block_t *dx_blocks)
@@ -443,5 +443,5 @@
 		
 		uint32_t fblock;
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
+		int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
 		    next_block, &fblock);
 		if (rc != EOK)
@@ -484,5 +484,5 @@
  *
  */
-static errno_t ext4_directory_dx_next_block(ext4_inode_ref_t *inode_ref,
+static int ext4_directory_dx_next_block(ext4_inode_ref_t *inode_ref,
     uint32_t hash, ext4_directory_dx_block_t *dx_block,
     ext4_directory_dx_block_t *dx_blocks)
@@ -520,5 +520,5 @@
 		uint32_t block_addr;
 		
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
+		int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
 		    block_idx, &block_addr);
 		if (rc != EOK)
@@ -556,11 +556,11 @@
  *
  */
-errno_t ext4_directory_dx_find_entry(ext4_directory_search_result_t *result,
+int ext4_directory_dx_find_entry(ext4_directory_search_result_t *result,
     ext4_inode_ref_t *inode_ref, size_t name_len, const char *name)
 {
 	/* Load direct block 0 (index root) */
 	uint32_t root_block_addr;
-	errno_t rc2;
-	errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 0,
+	int rc2;
+	int rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 0,
 	    &root_block_addr);
 	if (rc != EOK)
@@ -728,9 +728,9 @@
  *
  */
-static errno_t ext4_directory_dx_split_data(ext4_inode_ref_t *inode_ref,
+static int ext4_directory_dx_split_data(ext4_inode_ref_t *inode_ref,
     ext4_hash_info_t *hinfo, block_t *old_data_block,
     ext4_directory_dx_block_t *index_block, block_t **new_data_block)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	
 	/* Allocate buffer for directory entries */
@@ -897,5 +897,5 @@
  *
  */
-static errno_t ext4_directory_dx_split_index(ext4_inode_ref_t *inode_ref,
+static int ext4_directory_dx_split_index(ext4_inode_ref_t *inode_ref,
 		ext4_directory_dx_block_t *dx_blocks, ext4_directory_dx_block_t *dx_block)
 {
@@ -937,5 +937,5 @@
 		uint32_t new_fblock;
 		uint32_t new_iblock;
-		errno_t rc = ext4_filesystem_append_inode_block(inode_ref,
+		int rc = ext4_filesystem_append_inode_block(inode_ref,
 		    &new_fblock, &new_iblock);
 		if (rc != EOK)
@@ -1045,12 +1045,12 @@
  *
  */
-errno_t ext4_directory_dx_add_entry(ext4_inode_ref_t *parent,
+int ext4_directory_dx_add_entry(ext4_inode_ref_t *parent,
     ext4_inode_ref_t *child, const char *name)
 {
-	errno_t rc2 = EOK;
+	int rc2 = EOK;
 	
 	/* Get direct block 0 (index root) */
 	uint32_t root_block_addr;
-	errno_t rc = ext4_filesystem_get_inode_data_block_index(parent, 0,
+	int rc = ext4_filesystem_get_inode_data_block_index(parent, 0,
 	    &root_block_addr);
 	if (rc != EOK)
Index: uspace/lib/ext4/src/extent.c
===================================================================
--- uspace/lib/ext4/src/extent.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/src/extent.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -372,8 +372,8 @@
  *
  */
-errno_t ext4_extent_find_block(ext4_inode_ref_t *inode_ref, uint32_t iblock,
+int ext4_extent_find_block(ext4_inode_ref_t *inode_ref, uint32_t iblock,
     uint32_t *fblock)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	/* Compute bound defined by i-node size */
 	uint64_t inode_size =
@@ -454,5 +454,5 @@
  *
  */
-static errno_t ext4_extent_find_extent(ext4_inode_ref_t *inode_ref, uint32_t iblock,
+static int ext4_extent_find_extent(ext4_inode_ref_t *inode_ref, uint32_t iblock,
     ext4_extent_path_t **ret_path)
 {
@@ -475,5 +475,5 @@
 	/* Walk through the extent tree */
 	uint16_t pos = 0;
-	errno_t rc;
+	int rc;
 	while (ext4_extent_header_get_depth(eh) != 0) {
 		/* Search index in index node by iblock */
@@ -515,5 +515,5 @@
 	;
 
-	errno_t rc2 = EOK;
+	int rc2 = EOK;
 
 	/*
@@ -543,5 +543,5 @@
  *
  */
-static errno_t ext4_extent_release(ext4_inode_ref_t *inode_ref,
+static int ext4_extent_release(ext4_inode_ref_t *inode_ref,
     ext4_extent_t *extent)
 {
@@ -565,5 +565,5 @@
  *
  */
-static errno_t ext4_extent_release_branch(ext4_inode_ref_t *inode_ref,
+static int ext4_extent_release_branch(ext4_inode_ref_t *inode_ref,
 		ext4_extent_index_t *index)
 {
@@ -571,5 +571,5 @@
 	
 	block_t* block;
-	errno_t rc = block_get(&block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NONE);
+	int rc = block_get(&block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NONE);
 	if (rc != EOK)
 		return rc;
@@ -618,10 +618,10 @@
  *
  */
-errno_t ext4_extent_release_blocks_from(ext4_inode_ref_t *inode_ref,
+int ext4_extent_release_blocks_from(ext4_inode_ref_t *inode_ref,
     uint32_t iblock_from)
 {
 	/* Find the first extent to modify */
 	ext4_extent_path_t *path;
-	errno_t rc = ext4_extent_find_extent(inode_ref, iblock_from, &path);
+	int rc = ext4_extent_find_extent(inode_ref, iblock_from, &path);
 	if (rc != EOK)
 		return rc;
@@ -736,5 +736,5 @@
 	;
 
-	errno_t rc2 = EOK;
+	int rc2 = EOK;
 
 	/*
@@ -767,5 +767,5 @@
  *
  */
-static errno_t ext4_extent_append_extent(ext4_inode_ref_t *inode_ref,
+static int ext4_extent_append_extent(ext4_inode_ref_t *inode_ref,
     ext4_extent_path_t *path, uint32_t iblock)
 {
@@ -785,5 +785,5 @@
 			/* Full node - allocate block for new one */
 			uint32_t fblock;
-			errno_t rc = ext4_balloc_alloc_block(inode_ref, &fblock);
+			int rc = ext4_balloc_alloc_block(inode_ref, &fblock);
 			if (rc != EOK)
 				return rc;
@@ -863,5 +863,5 @@
 	if (entries == limit) {
 		uint32_t new_fblock;
-		errno_t rc = ext4_balloc_alloc_block(inode_ref, &new_fblock);
+		int rc = ext4_balloc_alloc_block(inode_ref, &new_fblock);
 		if (rc != EOK)
 			return rc;
@@ -964,5 +964,5 @@
  *
  */
-errno_t ext4_extent_append_block(ext4_inode_ref_t *inode_ref, uint32_t *iblock,
+int ext4_extent_append_block(ext4_inode_ref_t *inode_ref, uint32_t *iblock,
     uint32_t *fblock, bool update_size)
 {
@@ -982,5 +982,5 @@
 	/* Load the nearest leaf (with extent) */
 	ext4_extent_path_t *path;
-	errno_t rc = ext4_extent_find_extent(inode_ref, new_block_idx, &path);
+	int rc = ext4_extent_find_extent(inode_ref, new_block_idx, &path);
 	if (rc != EOK)
 		return rc;
@@ -1088,5 +1088,5 @@
 	;
 
-	errno_t rc2 = EOK;
+	int rc2 = EOK;
 
 	/* Set return values */
Index: uspace/lib/ext4/src/filesystem.c
===================================================================
--- uspace/lib/ext4/src/filesystem.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/src/filesystem.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,5 +54,5 @@
 #include "ext4/superblock.h"
 
-static errno_t ext4_filesystem_check_features(ext4_filesystem_t *, bool *);
+static int ext4_filesystem_check_features(ext4_filesystem_t *, bool *);
 
 /** Initialize filesystem for opening.
@@ -67,8 +67,8 @@
  *
  */
-static errno_t ext4_filesystem_init(ext4_filesystem_t *fs, service_id_t service_id,
+static int ext4_filesystem_init(ext4_filesystem_t *fs, service_id_t service_id,
     enum cache_mode cmode)
 {
-	errno_t rc;
+	int rc;
 	ext4_superblock_t *temp_superblock = NULL;
 
@@ -161,11 +161,11 @@
  * @param service_id Block device to probe
  *
- * @return EOK or an error code.
- *
- */
-errno_t ext4_filesystem_probe(service_id_t service_id)
+ * @return EOK or negative error code.
+ *
+ */
+int ext4_filesystem_probe(service_id_t service_id)
 {
 	ext4_filesystem_t *fs = NULL;
-	errno_t rc;
+	int rc;
 
 	fs = calloc(1, sizeof(ext4_filesystem_t));
@@ -195,10 +195,10 @@
  *
  */
-errno_t ext4_filesystem_open(ext4_instance_t *inst, service_id_t service_id,
+int ext4_filesystem_open(ext4_instance_t *inst, service_id_t service_id,
     enum cache_mode cmode, aoff64_t *size, ext4_filesystem_t **rfs)
 {
 	ext4_filesystem_t *fs = NULL;
 	fs_node_t *root_node = NULL;
-	errno_t rc;
+	int rc;
 
 	fs = calloc(1, sizeof(ext4_filesystem_t));
@@ -252,13 +252,13 @@
  * @param fs Filesystem to be destroyed
  *
- * @return EOK or an error code. On error the state of the file
+ * @return EOK or negative error code. On error the state of the file
  *         system is unchanged.
  *
  */
-errno_t ext4_filesystem_close(ext4_filesystem_t *fs)
+int ext4_filesystem_close(ext4_filesystem_t *fs)
 {
 	/* Write the superblock to the device */
 	ext4_superblock_set_state(fs->superblock, EXT4_SUPERBLOCK_STATE_VALID_FS);
-	errno_t rc = ext4_superblock_write_direct(fs->device, fs->superblock);
+	int rc = ext4_superblock_write_direct(fs->device, fs->superblock);
 	if (rc != EOK)
 		return rc;
@@ -281,5 +281,5 @@
  *
  */
-static errno_t ext4_filesystem_check_features(ext4_filesystem_t *fs,
+static int ext4_filesystem_check_features(ext4_filesystem_t *fs,
     bool *read_only)
 {
@@ -380,5 +380,5 @@
  *
  */
-static errno_t ext4_filesystem_init_block_bitmap(ext4_block_group_ref_t *bg_ref)
+static int ext4_filesystem_init_block_bitmap(ext4_block_group_ref_t *bg_ref)
 {
 	uint64_t itb;
@@ -394,5 +394,5 @@
 	
 	block_t *bitmap_block;
-	errno_t rc = block_get(&bitmap_block, bg_ref->fs->device,
+	int rc = block_get(&bitmap_block, bg_ref->fs->device,
 	    bitmap_block_addr, BLOCK_FLAGS_NOREAD);
 	if (rc != EOK)
@@ -451,5 +451,5 @@
  *
  */
-static errno_t ext4_filesystem_init_inode_bitmap(ext4_block_group_ref_t *bg_ref)
+static int ext4_filesystem_init_inode_bitmap(ext4_block_group_ref_t *bg_ref)
 {
 	/* Load bitmap */
@@ -458,5 +458,5 @@
 	block_t *bitmap_block;
 	
-	errno_t rc = block_get(&bitmap_block, bg_ref->fs->device,
+	int rc = block_get(&bitmap_block, bg_ref->fs->device,
 	    bitmap_block_addr, BLOCK_FLAGS_NOREAD);
 	if (rc != EOK)
@@ -494,5 +494,5 @@
  *
  */
-static errno_t ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
+static int ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
 {
 	ext4_superblock_t *sb = bg_ref->fs->superblock;
@@ -519,5 +519,5 @@
 	for (uint32_t fblock = first_block; fblock <= last_block; ++fblock) {
 		block_t *block;
-		errno_t rc = block_get(&block, bg_ref->fs->device, fblock,
+		int rc = block_get(&block, bg_ref->fs->device, fblock,
 		    BLOCK_FLAGS_NOREAD);
 		if (rc != EOK)
@@ -544,5 +544,5 @@
  *
  */
-errno_t ext4_filesystem_get_block_group_ref(ext4_filesystem_t *fs, uint32_t bgid,
+int ext4_filesystem_get_block_group_ref(ext4_filesystem_t *fs, uint32_t bgid,
     ext4_block_group_ref_t **ref)
 {
@@ -568,5 +568,5 @@
 	
 	/* Load block with descriptors */
-	errno_t rc = block_get(&newref->block, fs->device, block_id, 0);
+	int rc = block_get(&newref->block, fs->device, block_id, 0);
 	if (rc != EOK) {
 		free(newref);
@@ -804,5 +804,5 @@
  *
  */
-errno_t ext4_filesystem_put_block_group_ref(ext4_block_group_ref_t *ref)
+int ext4_filesystem_put_block_group_ref(ext4_block_group_ref_t *ref)
 {
 	/* Check if reference modified */
@@ -819,5 +819,5 @@
 	
 	/* Put back block, that contains block group descriptor */
-	errno_t rc = block_put(ref->block);
+	int rc = block_put(ref->block);
 	free(ref);
 	
@@ -834,5 +834,5 @@
  *
  */
-errno_t ext4_filesystem_get_inode_ref(ext4_filesystem_t *fs, uint32_t index,
+int ext4_filesystem_get_inode_ref(ext4_filesystem_t *fs, uint32_t index,
     ext4_inode_ref_t **ref)
 {
@@ -857,5 +857,5 @@
 	/* Load block group, where i-node is located */
 	ext4_block_group_ref_t *bg_ref;
-	errno_t rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
+	int rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
 	if (rc != EOK) {
 		free(newref);
@@ -909,5 +909,5 @@
  *
  */
-errno_t ext4_filesystem_put_inode_ref(ext4_inode_ref_t *ref)
+int ext4_filesystem_put_inode_ref(ext4_inode_ref_t *ref)
 {
 	/* Check if reference modified */
@@ -918,5 +918,5 @@
 	
 	/* Put back block, that contains i-node */
-	errno_t rc = block_put(ref->block);
+	int rc = block_put(ref->block);
 	free(ref);
 	
@@ -933,5 +933,5 @@
  *
  */
-errno_t ext4_filesystem_alloc_inode(ext4_filesystem_t *fs,
+int ext4_filesystem_alloc_inode(ext4_filesystem_t *fs,
     ext4_inode_ref_t **inode_ref, int flags)
 {
@@ -943,5 +943,5 @@
 	/* Allocate inode by allocation algorithm */
 	uint32_t index;
-	errno_t rc = ext4_ialloc_alloc_inode(fs, &index, is_dir);
+	int rc = ext4_ialloc_alloc_inode(fs, &index, is_dir);
 	if (rc != EOK)
 		return rc;
@@ -1025,5 +1025,5 @@
  *
  */
-errno_t ext4_filesystem_free_inode(ext4_inode_ref_t *inode_ref)
+int ext4_filesystem_free_inode(ext4_inode_ref_t *inode_ref)
 {
 	ext4_filesystem_t *fs = inode_ref->fs;
@@ -1042,5 +1042,5 @@
 	uint32_t fblock = ext4_inode_get_indirect_block(inode_ref->inode, 0);
 	if (fblock != 0) {
-		errno_t rc = ext4_balloc_free_block(inode_ref, fblock);
+		int rc = ext4_balloc_free_block(inode_ref, fblock);
 		if (rc != EOK)
 			return rc;
@@ -1056,5 +1056,5 @@
 	fblock = ext4_inode_get_indirect_block(inode_ref->inode, 1);
 	if (fblock != 0) {
-		errno_t rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
+		int rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
 		if (rc != EOK)
 			return rc;
@@ -1088,5 +1088,5 @@
 	fblock = ext4_inode_get_indirect_block(inode_ref->inode, 2);
 	if (fblock != 0) {
-		errno_t rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
+		int rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
 		if (rc != EOK)
 			return rc;
@@ -1153,5 +1153,5 @@
 	    inode_ref->inode, fs->superblock);
 	if (xattr_block) {
-		errno_t rc = ext4_balloc_free_block(inode_ref, xattr_block);
+		int rc = ext4_balloc_free_block(inode_ref, xattr_block);
 		if (rc != EOK)
 			return rc;
@@ -1161,5 +1161,5 @@
 	
 	/* Free inode by allocator */
-	errno_t rc;
+	int rc;
 	if (ext4_inode_is_type(fs->superblock, inode_ref->inode,
 	    EXT4_INODE_MODE_DIRECTORY))
@@ -1179,5 +1179,5 @@
  *
  */
-errno_t ext4_filesystem_truncate_inode(ext4_inode_ref_t *inode_ref,
+int ext4_filesystem_truncate_inode(ext4_inode_ref_t *inode_ref,
     aoff64_t new_size)
 {
@@ -1212,5 +1212,5 @@
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
 		/* Extents require special operation */
-		errno_t rc = ext4_extent_release_blocks_from(inode_ref,
+		int rc = ext4_extent_release_blocks_from(inode_ref,
 		    old_blocks_count - diff_blocks_count);
 		if (rc != EOK)
@@ -1221,5 +1221,5 @@
 		/* Starting from 1 because of logical blocks are numbered from 0 */
 		for (uint32_t i = 1; i <= diff_blocks_count; ++i) {
-			errno_t rc = ext4_filesystem_release_inode_block(inode_ref,
+			int rc = ext4_filesystem_release_inode_block(inode_ref,
 			    old_blocks_count - i);
 			if (rc != EOK)
@@ -1244,5 +1244,5 @@
  *
  */
-errno_t ext4_filesystem_get_inode_data_block_index(ext4_inode_ref_t *inode_ref,
+int ext4_filesystem_get_inode_data_block_index(ext4_inode_ref_t *inode_ref,
     aoff64_t iblock, uint32_t *fblock)
 {
@@ -1261,5 +1261,5 @@
 	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
-		errno_t rc = ext4_extent_find_block(inode_ref, iblock, &current_block);
+		int rc = ext4_extent_find_block(inode_ref, iblock, &current_block);
 		if (rc != EOK)
 			return rc;
@@ -1311,5 +1311,5 @@
 	while (level > 0) {
 		/* Load indirect block */
-		errno_t rc = block_get(&block, fs->device, current_block, 0);
+		int rc = block_get(&block, fs->device, current_block, 0);
 		if (rc != EOK)
 			return rc;
@@ -1357,5 +1357,5 @@
  *
  */
-errno_t ext4_filesystem_set_inode_data_block_index(ext4_inode_ref_t *inode_ref,
+int ext4_filesystem_set_inode_data_block_index(ext4_inode_ref_t *inode_ref,
     aoff64_t iblock, uint32_t fblock)
 {
@@ -1407,5 +1407,5 @@
 	if (current_block == 0) {
 		/* Allocate new indirect block */
-		errno_t rc = ext4_balloc_alloc_block(inode_ref, &new_block_addr);
+		int rc = ext4_balloc_alloc_block(inode_ref, &new_block_addr);
 		if (rc != EOK)
 			return rc;
@@ -1441,5 +1441,5 @@
 	 */
 	while (level > 0) {
-		errno_t rc = block_get(&block, fs->device, current_block, 0);
+		int rc = block_get(&block, fs->device, current_block, 0);
 		if (rc != EOK)
 			return rc;
@@ -1518,5 +1518,5 @@
  *
  */
-errno_t ext4_filesystem_release_inode_block(ext4_inode_ref_t *inode_ref,
+int ext4_filesystem_release_inode_block(ext4_inode_ref_t *inode_ref,
     uint32_t iblock)
 {
@@ -1575,5 +1575,5 @@
 			return EOK;
 		
-		errno_t rc = block_get(&block, fs->device, current_block, 0);
+		int rc = block_get(&block, fs->device, current_block, 0);
 		if (rc != EOK)
 			return rc;
@@ -1625,5 +1625,5 @@
  *
  */
-errno_t ext4_filesystem_append_inode_block(ext4_inode_ref_t *inode_ref,
+int ext4_filesystem_append_inode_block(ext4_inode_ref_t *inode_ref,
     uint32_t *fblock, uint32_t *iblock)
 {
@@ -1649,5 +1649,5 @@
 	/* Allocate new physical block */
 	uint32_t phys_block;
-	errno_t rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
+	int rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
 	if (rc != EOK)
 		return rc;
Index: uspace/lib/ext4/src/hash.c
===================================================================
--- uspace/lib/ext4/src/hash.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/src/hash.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include "ext4/hash.h"
 
-errno_t ext4_hash_string(ext4_hash_info_t *hinfo, int len, const char *name)
+int ext4_hash_string(ext4_hash_info_t *hinfo, int len, const char *name)
 {
 	// TODO
Index: uspace/lib/ext4/src/ialloc.c
===================================================================
--- uspace/lib/ext4/src/ialloc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/src/ialloc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -97,5 +97,5 @@
  *
  */
-errno_t ext4_ialloc_free_inode(ext4_filesystem_t *fs, uint32_t index, bool is_dir)
+int ext4_ialloc_free_inode(ext4_filesystem_t *fs, uint32_t index, bool is_dir)
 {
 	ext4_superblock_t *sb = fs->superblock;
@@ -105,5 +105,5 @@
 	
 	ext4_block_group_ref_t *bg_ref;
-	errno_t rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
+	int rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
 	if (rc != EOK)
 		return rc;
@@ -175,5 +175,5 @@
  *
  */
-errno_t ext4_ialloc_alloc_inode(ext4_filesystem_t *fs, uint32_t *index, bool is_dir)
+int ext4_ialloc_alloc_inode(ext4_filesystem_t *fs, uint32_t *index, bool is_dir)
 {
 	ext4_superblock_t *sb = fs->superblock;
@@ -188,5 +188,5 @@
 		/* Load block group to check */
 		ext4_block_group_ref_t *bg_ref;
-		errno_t rc = ext4_filesystem_get_block_group_ref(fs, bgid, &bg_ref);
+		int rc = ext4_filesystem_get_block_group_ref(fs, bgid, &bg_ref);
 		if (rc != EOK)
 			return rc;
Index: uspace/lib/ext4/src/inode.c
===================================================================
--- uspace/lib/ext4/src/inode.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/src/inode.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -324,5 +324,5 @@
  *
  */
-errno_t ext4_inode_set_blocks_count(ext4_superblock_t *sb, ext4_inode_t *inode,
+int ext4_inode_set_blocks_count(ext4_superblock_t *sb, ext4_inode_t *inode,
     uint64_t count)
 {
Index: uspace/lib/ext4/src/ops.c
===================================================================
--- uspace/lib/ext4/src/ops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/src/ops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,23 +58,23 @@
 /* Forward declarations of auxiliary functions */
 
-static errno_t ext4_read_directory(ipc_callid_t, aoff64_t, size_t,
+static int ext4_read_directory(ipc_callid_t, aoff64_t, size_t,
     ext4_instance_t *, ext4_inode_ref_t *, size_t *);
-static errno_t ext4_read_file(ipc_callid_t, aoff64_t, size_t, ext4_instance_t *,
+static int ext4_read_file(ipc_callid_t, aoff64_t, size_t, ext4_instance_t *,
     ext4_inode_ref_t *, size_t *);
 static bool ext4_is_dots(const uint8_t *, size_t);
-static errno_t ext4_instance_get(service_id_t, ext4_instance_t **);
+static int ext4_instance_get(service_id_t, ext4_instance_t **);
 
 /* Forward declarations of ext4 libfs operations. */
 
-static errno_t ext4_root_get(fs_node_t **, service_id_t);
-static errno_t ext4_match(fs_node_t **, fs_node_t *, const char *);
-static errno_t ext4_node_get(fs_node_t **, service_id_t, fs_index_t);
-static errno_t ext4_node_open(fs_node_t *);
-       errno_t ext4_node_put(fs_node_t *);
-static errno_t ext4_create_node(fs_node_t **, service_id_t, int);
-static errno_t ext4_destroy_node(fs_node_t *);
-static errno_t ext4_link(fs_node_t *, fs_node_t *, const char *);
-static errno_t ext4_unlink(fs_node_t *, fs_node_t *, const char *);
-static errno_t ext4_has_children(bool *, fs_node_t *);
+static int ext4_root_get(fs_node_t **, service_id_t);
+static int ext4_match(fs_node_t **, fs_node_t *, const char *);
+static int ext4_node_get(fs_node_t **, service_id_t, fs_index_t);
+static int ext4_node_open(fs_node_t *);
+       int ext4_node_put(fs_node_t *);
+static int ext4_create_node(fs_node_t **, service_id_t, int);
+static int ext4_destroy_node(fs_node_t *);
+static int ext4_link(fs_node_t *, fs_node_t *, const char *);
+static int ext4_unlink(fs_node_t *, fs_node_t *, const char *);
+static int ext4_has_children(bool *, fs_node_t *);
 static fs_index_t ext4_index_get(fs_node_t *);
 static aoff64_t ext4_size_get(fs_node_t *);
@@ -83,7 +83,7 @@
 static bool ext4_is_file(fs_node_t *node);
 static service_id_t ext4_service_get(fs_node_t *node);
-static errno_t ext4_size_block(service_id_t, uint32_t *);
-static errno_t ext4_total_block_count(service_id_t, uint64_t *);
-static errno_t ext4_free_block_count(service_id_t, uint64_t *);
+static int ext4_size_block(service_id_t, uint32_t *);
+static int ext4_total_block_count(service_id_t, uint64_t *);
+static int ext4_free_block_count(service_id_t, uint64_t *);
 
 /* Static variables */
@@ -138,5 +138,5 @@
  *
  */
-errno_t ext4_global_init(void)
+int ext4_global_init(void)
 {
 	if (!hash_table_create(&open_nodes, 0, 0, &open_nodes_ops))
@@ -152,5 +152,5 @@
  * @return Error code
  */
-errno_t ext4_global_fini(void)
+int ext4_global_fini(void)
 {
 	hash_table_destroy(&open_nodes);
@@ -170,5 +170,5 @@
  *
  */
-errno_t ext4_instance_get(service_id_t service_id, ext4_instance_t **inst)
+int ext4_instance_get(service_id_t service_id, ext4_instance_t **inst)
 {
 	fibril_mutex_lock(&instance_list_mutex);
@@ -199,5 +199,5 @@
  *
  */
-errno_t ext4_root_get(fs_node_t **rfn, service_id_t service_id)
+int ext4_root_get(fs_node_t **rfn, service_id_t service_id)
 {
 	return ext4_node_get(rfn, service_id, EXT4_INODE_ROOT_INDEX);
@@ -215,5 +215,5 @@
  *
  */
-errno_t ext4_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
+int ext4_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
 {
 	ext4_node_t *eparent = EXT4_NODE(pfn);
@@ -226,5 +226,5 @@
 	/* Try to find entry */
 	ext4_directory_search_result_t result;
-	errno_t rc = ext4_directory_find_entry(&result, eparent->inode_ref,
+	int rc = ext4_directory_find_entry(&result, eparent->inode_ref,
 	    component);
 	if (rc != EOK) {
@@ -247,5 +247,5 @@
 
 	/* Destroy search result structure */
-	errno_t const rc2 = ext4_directory_destroy_result(&result);
+	int const rc2 = ext4_directory_destroy_result(&result);
 	return rc == EOK ? rc2 : rc;
 }
@@ -262,8 +262,8 @@
  *
  */
-errno_t ext4_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
+int ext4_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
 {
 	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
+	int rc = ext4_instance_get(service_id, &inst);
 	if (rc != EOK)
 		return rc;
@@ -281,5 +281,5 @@
  *
  */
-errno_t ext4_node_get_core(fs_node_t **rfn, ext4_instance_t *inst,
+int ext4_node_get_core(fs_node_t **rfn, ext4_instance_t *inst,
     fs_index_t index)
 {
@@ -322,5 +322,5 @@
 	/* Load i-node from filesystem */
 	ext4_inode_ref_t *inode_ref;
-	errno_t rc = ext4_filesystem_get_inode_ref(inst->filesystem, index,
+	int rc = ext4_filesystem_get_inode_ref(inst->filesystem, index,
 	    &inode_ref);
 	if (rc != EOK) {
@@ -355,5 +355,5 @@
  *
  */
-static errno_t ext4_node_put_core(ext4_node_t *enode)
+static int ext4_node_put_core(ext4_node_t *enode)
 {
 	hash_table_remove_item(&open_nodes, &enode->link);
@@ -362,5 +362,5 @@
 	
 	/* Put inode back in filesystem */
-	errno_t rc = ext4_filesystem_put_inode_ref(enode->inode_ref);
+	int rc = ext4_filesystem_put_inode_ref(enode->inode_ref);
 	if (rc != EOK)
 		return rc;
@@ -382,5 +382,5 @@
  *
  */
-errno_t ext4_node_open(fs_node_t *fn)
+int ext4_node_open(fs_node_t *fn)
 {
 	/* Stateless operation */
@@ -396,5 +396,5 @@
  *
  */
-errno_t ext4_node_put(fs_node_t *fn)
+int ext4_node_put(fs_node_t *fn)
 {
 	fibril_mutex_lock(&open_nodes_lock);
@@ -404,5 +404,5 @@
 	enode->references--;
 	if (enode->references == 0) {
-		errno_t rc = ext4_node_put_core(enode);
+		int rc = ext4_node_put_core(enode);
 		if (rc != EOK) {
 			fibril_mutex_unlock(&open_nodes_lock);
@@ -425,5 +425,5 @@
  *
  */
-errno_t ext4_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
+int ext4_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
 {
 	/* Allocate enode */
@@ -443,5 +443,5 @@
 	/* Load instance */
 	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
+	int rc = ext4_instance_get(service_id, &inst);
 	if (rc != EOK) {
 		free(enode);
@@ -486,9 +486,9 @@
  *
  */
-errno_t ext4_destroy_node(fs_node_t *fn)
+int ext4_destroy_node(fs_node_t *fn)
 {
 	/* If directory, check for children */
 	bool has_children;
-	errno_t rc = ext4_has_children(&has_children, fn);
+	int rc = ext4_has_children(&has_children, fn);
 	if (rc != EOK) {
 		ext4_node_put(fn);
@@ -537,5 +537,5 @@
  *
  */
-errno_t ext4_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
+int ext4_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
 {
 	/* Check maximum name length */
@@ -548,5 +548,5 @@
 	
 	/* Add entry to parent directory */
-	errno_t rc = ext4_directory_add_entry(parent->inode_ref, name,
+	int rc = ext4_directory_add_entry(parent->inode_ref, name,
 	    child->inode_ref);
 	if (rc != EOK)
@@ -610,8 +610,8 @@
  *
  */
-errno_t ext4_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *name)
+int ext4_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *name)
 {
 	bool has_children;
-	errno_t rc = ext4_has_children(&has_children, cfn);
+	int rc = ext4_has_children(&has_children, cfn);
 	if (rc != EOK)
 		return rc;
@@ -683,5 +683,5 @@
  *
  */
-errno_t ext4_has_children(bool *has_children, fs_node_t *fn)
+int ext4_has_children(bool *has_children, fs_node_t *fn)
 {
 	ext4_node_t *enode = EXT4_NODE(fn);
@@ -696,5 +696,5 @@
 	
 	ext4_directory_iterator_t it;
-	errno_t rc = ext4_directory_iterator_init(&it, enode->inode_ref, 0);
+	int rc = ext4_directory_iterator_init(&it, enode->inode_ref, 0);
 	if (rc != EOK)
 		return rc;
@@ -824,8 +824,8 @@
 }
 
-errno_t ext4_size_block(service_id_t service_id, uint32_t *size)
+int ext4_size_block(service_id_t service_id, uint32_t *size)
 {
 	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
+	int rc = ext4_instance_get(service_id, &inst);
 	if (rc != EOK)
 		return rc;
@@ -840,8 +840,8 @@
 }
 
-errno_t ext4_total_block_count(service_id_t service_id, uint64_t *count)
+int ext4_total_block_count(service_id_t service_id, uint64_t *count)
 {
 	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
+	int rc = ext4_instance_get(service_id, &inst);
 	if (rc != EOK)
 		return rc;
@@ -856,8 +856,8 @@
 }
 
-errno_t ext4_free_block_count(service_id_t service_id, uint64_t *count)
+int ext4_free_block_count(service_id_t service_id, uint64_t *count)
 {
 	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
+	int rc = ext4_instance_get(service_id, &inst);
 	if (rc != EOK)
 		return rc;
@@ -907,5 +907,5 @@
  * @return Error code
  */
-static errno_t ext4_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
+static int ext4_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
 {
 	return ext4_filesystem_probe(service_id);
@@ -924,5 +924,5 @@
  *
  */
-static errno_t ext4_mounted(service_id_t service_id, const char *opts,
+static int ext4_mounted(service_id_t service_id, const char *opts,
     fs_index_t *index, aoff64_t *size)
 {
@@ -948,5 +948,5 @@
 	/* Initialize the filesystem */
 	aoff64_t rnsize;
-	errno_t rc = ext4_filesystem_open(inst, service_id, cmode, &rnsize, &fs);
+	int rc = ext4_filesystem_open(inst, service_id, cmode, &rnsize, &fs);
 	if (rc != EOK) {
 		free(inst);
@@ -974,8 +974,8 @@
  *
  */
-static errno_t ext4_unmounted(service_id_t service_id)
+static int ext4_unmounted(service_id_t service_id)
 {
 	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
+	int rc = ext4_instance_get(service_id, &inst);
 	if (rc != EOK)
 		return rc;
@@ -1016,5 +1016,5 @@
  *
  */
-static errno_t ext4_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
+static int ext4_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *rbytes)
 {
@@ -1030,5 +1030,5 @@
 	
 	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
+	int rc = ext4_instance_get(service_id, &inst);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
@@ -1059,5 +1059,5 @@
 	}
 	
-	errno_t const rc2 = ext4_filesystem_put_inode_ref(inode_ref);
+	int const rc2 = ext4_filesystem_put_inode_ref(inode_ref);
 	
 	return rc == EOK ? rc2 : rc;
@@ -1095,9 +1095,9 @@
  *
  */
-errno_t ext4_read_directory(ipc_callid_t callid, aoff64_t pos, size_t size,
+int ext4_read_directory(ipc_callid_t callid, aoff64_t pos, size_t size,
     ext4_instance_t *inst, ext4_inode_ref_t *inode_ref, size_t *rbytes)
 {
 	ext4_directory_iterator_t it;
-	errno_t rc = ext4_directory_iterator_init(&it, inode_ref, pos);
+	int rc = ext4_directory_iterator_init(&it, inode_ref, pos);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
@@ -1186,5 +1186,5 @@
  *
  */
-errno_t ext4_read_file(ipc_callid_t callid, aoff64_t pos, size_t size,
+int ext4_read_file(ipc_callid_t callid, aoff64_t pos, size_t size,
     ext4_instance_t *inst, ext4_inode_ref_t *inode_ref, size_t *rbytes)
 {
@@ -1211,5 +1211,5 @@
 	/* Get the real block number */
 	uint32_t fs_block;
-	errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
+	int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
 	    file_block, &fs_block);
 	if (rc != EOK) {
@@ -1275,9 +1275,9 @@
  *
  */
-static errno_t ext4_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
+static int ext4_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *wbytes, aoff64_t *nsize)
 {
 	fs_node_t *fn;
-	errno_t rc = ext4_node_get(&fn, service_id, index);
+	int rc = ext4_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
@@ -1397,5 +1397,5 @@
 	;
 
-	errno_t const rc2 = ext4_node_put(fn);
+	int const rc2 = ext4_node_put(fn);
 	return rc == EOK ? rc2 : rc;
 }
@@ -1412,9 +1412,9 @@
  *
  */
-static errno_t ext4_truncate(service_id_t service_id, fs_index_t index,
+static int ext4_truncate(service_id_t service_id, fs_index_t index,
     aoff64_t new_size)
 {
 	fs_node_t *fn;
-	errno_t rc = ext4_node_get(&fn, service_id, index);
+	int rc = ext4_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
@@ -1424,5 +1424,5 @@
 	
 	rc = ext4_filesystem_truncate_inode(inode_ref, new_size);
-	errno_t const rc2 = ext4_node_put(fn);
+	int const rc2 = ext4_node_put(fn);
 	
 	return rc == EOK ? rc2 : rc;
@@ -1437,5 +1437,5 @@
  *
  */
-static errno_t ext4_close(service_id_t service_id, fs_index_t index)
+static int ext4_close(service_id_t service_id, fs_index_t index)
 {
 	return EOK;
@@ -1450,8 +1450,8 @@
  *
  */
-static errno_t ext4_destroy(service_id_t service_id, fs_index_t index)
+static int ext4_destroy(service_id_t service_id, fs_index_t index)
 {
 	fs_node_t *fn;
-	errno_t rc = ext4_node_get(&fn, service_id, index);
+	int rc = ext4_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
@@ -1467,8 +1467,8 @@
  *
  */
-static errno_t ext4_sync(service_id_t service_id, fs_index_t index)
+static int ext4_sync(service_id_t service_id, fs_index_t index)
 {
 	fs_node_t *fn;
-	errno_t rc = ext4_node_get(&fn, service_id, index);
+	int rc = ext4_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
Index: uspace/lib/ext4/src/superblock.c
===================================================================
--- uspace/lib/ext4/src/superblock.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ext4/src/superblock.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1127,5 +1127,5 @@
  *
  */
-errno_t ext4_superblock_read_direct(service_id_t service_id, ext4_superblock_t **sb)
+int ext4_superblock_read_direct(service_id_t service_id, ext4_superblock_t **sb)
 {
 	/* Allocated memory for superblock structure */
@@ -1135,5 +1135,5 @@
 	
 	/* Read data from block device */
-	errno_t rc = block_read_bytes_direct(service_id, EXT4_SUPERBLOCK_OFFSET,
+	int rc = block_read_bytes_direct(service_id, EXT4_SUPERBLOCK_OFFSET,
 	    EXT4_SUPERBLOCK_SIZE, data);
 	
@@ -1157,9 +1157,9 @@
  *
  */
-errno_t ext4_superblock_write_direct(service_id_t service_id, ext4_superblock_t *sb)
+int ext4_superblock_write_direct(service_id_t service_id, ext4_superblock_t *sb)
 {
 	/* Load physical block size from block device */
 	size_t phys_block_size;
-	errno_t rc = block_get_bsize(service_id, &phys_block_size);
+	int rc = block_get_bsize(service_id, &phys_block_size);
 	if (rc != EOK)
 		return rc;
@@ -1199,5 +1199,5 @@
  *
  */
-errno_t ext4_superblock_check_sanity(ext4_superblock_t *sb)
+int ext4_superblock_check_sanity(ext4_superblock_t *sb)
 {
 	if (ext4_superblock_get_magic(sb) != EXT4_SUPERBLOCK_MAGIC)
Index: uspace/lib/fdisk/include/fdisk.h
===================================================================
--- uspace/lib/fdisk/include/fdisk.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/fdisk/include/fdisk.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,40 +41,40 @@
 #include <types/vol.h>
 
-extern errno_t fdisk_create(fdisk_t **);
+extern int fdisk_create(fdisk_t **);
 extern void fdisk_destroy(fdisk_t *);
-extern errno_t fdisk_dev_list_get(fdisk_t *, fdisk_dev_list_t **);
+extern int fdisk_dev_list_get(fdisk_t *, fdisk_dev_list_t **);
 extern void fdisk_dev_list_free(fdisk_dev_list_t *);
 extern fdisk_dev_info_t *fdisk_dev_first(fdisk_dev_list_t *);
 extern fdisk_dev_info_t *fdisk_dev_next(fdisk_dev_info_t *);
-extern errno_t fdisk_dev_info_get_svcname(fdisk_dev_info_t *, char **);
+extern int fdisk_dev_info_get_svcname(fdisk_dev_info_t *, char **);
 extern void fdisk_dev_info_get_svcid(fdisk_dev_info_t *, service_id_t *);
-extern errno_t fdisk_dev_info_capacity(fdisk_dev_info_t *, cap_spec_t *);
+extern int fdisk_dev_info_capacity(fdisk_dev_info_t *, cap_spec_t *);
 
-extern errno_t fdisk_dev_open(fdisk_t *, service_id_t, fdisk_dev_t **);
+extern int fdisk_dev_open(fdisk_t *, service_id_t, fdisk_dev_t **);
 extern void fdisk_dev_close(fdisk_dev_t *);
-extern errno_t fdisk_dev_erase(fdisk_dev_t *);
+extern int fdisk_dev_erase(fdisk_dev_t *);
 extern void fdisk_dev_get_flags(fdisk_dev_t *, fdisk_dev_flags_t *);
-extern errno_t fdisk_dev_get_svcname(fdisk_dev_t *, char **);
-extern errno_t fdisk_dev_capacity(fdisk_dev_t *, cap_spec_t *);
+extern int fdisk_dev_get_svcname(fdisk_dev_t *, char **);
+extern int fdisk_dev_capacity(fdisk_dev_t *, cap_spec_t *);
 
-extern errno_t fdisk_label_get_info(fdisk_dev_t *, fdisk_label_info_t *);
-extern errno_t fdisk_label_create(fdisk_dev_t *, label_type_t);
-extern errno_t fdisk_label_destroy(fdisk_dev_t *);
+extern int fdisk_label_get_info(fdisk_dev_t *, fdisk_label_info_t *);
+extern int fdisk_label_create(fdisk_dev_t *, label_type_t);
+extern int fdisk_label_destroy(fdisk_dev_t *);
 
 extern fdisk_part_t *fdisk_part_first(fdisk_dev_t *);
 extern fdisk_part_t *fdisk_part_next(fdisk_part_t *);
-extern errno_t fdisk_part_get_info(fdisk_part_t *, fdisk_part_info_t *);
-extern errno_t fdisk_part_get_max_avail(fdisk_dev_t *, fdisk_spc_t, cap_spec_t *);
-extern errno_t fdisk_part_get_tot_avail(fdisk_dev_t *, fdisk_spc_t, cap_spec_t *);
-extern errno_t fdisk_part_create(fdisk_dev_t *, fdisk_part_spec_t *,
+extern int fdisk_part_get_info(fdisk_part_t *, fdisk_part_info_t *);
+extern int fdisk_part_get_max_avail(fdisk_dev_t *, fdisk_spc_t, cap_spec_t *);
+extern int fdisk_part_get_tot_avail(fdisk_dev_t *, fdisk_spc_t, cap_spec_t *);
+extern int fdisk_part_create(fdisk_dev_t *, fdisk_part_spec_t *,
     fdisk_part_t **);
-extern errno_t fdisk_part_destroy(fdisk_part_t *);
+extern int fdisk_part_destroy(fdisk_part_t *);
 extern void fdisk_pspec_init(fdisk_part_spec_t *);
 
-extern errno_t fdisk_ltype_format(label_type_t, char **);
-extern errno_t fdisk_fstype_format(vol_fstype_t, char **);
-extern errno_t fdisk_pkind_format(label_pkind_t, char **);
+extern int fdisk_ltype_format(label_type_t, char **);
+extern int fdisk_fstype_format(vol_fstype_t, char **);
+extern int fdisk_pkind_format(label_pkind_t, char **);
 
-extern errno_t fdisk_get_vollabel_support(fdisk_dev_t *, vol_fstype_t,
+extern int fdisk_get_vollabel_support(fdisk_dev_t *, vol_fstype_t,
     vol_label_supp_t *);
 
Index: uspace/lib/fdisk/src/fdisk.c
===================================================================
--- uspace/lib/fdisk/src/fdisk.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/fdisk/src/fdisk.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,14 +46,14 @@
 #include <vol.h>
 
-static errno_t fdisk_dev_add_parts(fdisk_dev_t *);
+static int fdisk_dev_add_parts(fdisk_dev_t *);
 static void fdisk_dev_remove_parts(fdisk_dev_t *);
-static errno_t fdisk_part_spec_prepare(fdisk_dev_t *, fdisk_part_spec_t *,
+static int fdisk_part_spec_prepare(fdisk_dev_t *, fdisk_part_spec_t *,
     vbd_part_spec_t *);
 static void fdisk_pri_part_insert_lists(fdisk_dev_t *, fdisk_part_t *);
 static void fdisk_log_part_insert_lists(fdisk_dev_t *, fdisk_part_t *);
-static errno_t fdisk_update_dev_info(fdisk_dev_t *);
+static int fdisk_update_dev_info(fdisk_dev_t *);
 static uint64_t fdisk_ba_align_up(fdisk_dev_t *, uint64_t);
 static uint64_t fdisk_ba_align_down(fdisk_dev_t *, uint64_t);
-static errno_t fdisk_part_get_max_free_range(fdisk_dev_t *, fdisk_spc_t, aoff64_t *,
+static int fdisk_part_get_max_free_range(fdisk_dev_t *, fdisk_spc_t, aoff64_t *,
     aoff64_t *);
 static void fdisk_free_range_first(fdisk_dev_t *, fdisk_spc_t, fdisk_free_range_t *);
@@ -70,8 +70,8 @@
 }
 
-errno_t fdisk_create(fdisk_t **rfdisk)
+int fdisk_create(fdisk_t **rfdisk)
 {
 	fdisk_t *fdisk = NULL;
-	errno_t rc;
+	int rc;
 
 	fdisk = calloc(1, sizeof(fdisk_t));
@@ -111,5 +111,5 @@
 }
 
-errno_t fdisk_dev_list_get(fdisk_t *fdisk, fdisk_dev_list_t **rdevlist)
+int fdisk_dev_list_get(fdisk_t *fdisk, fdisk_dev_list_t **rdevlist)
 {
 	fdisk_dev_list_t *devlist = NULL;
@@ -117,5 +117,5 @@
 	service_id_t *svcs = NULL;
 	size_t count, i;
-	errno_t rc;
+	int rc;
 
 	devlist = calloc(1, sizeof(fdisk_dev_list_t));
@@ -199,8 +199,8 @@
 }
 
-errno_t fdisk_dev_info_get_svcname(fdisk_dev_info_t *info, char **rname)
+int fdisk_dev_info_get_svcname(fdisk_dev_info_t *info, char **rname)
 {
 	char *name;
-	errno_t rc;
+	int rc;
 
 	if (info->svcname == NULL) {
@@ -219,8 +219,8 @@
 }
 
-errno_t fdisk_dev_info_capacity(fdisk_dev_info_t *info, cap_spec_t *cap)
+int fdisk_dev_info_capacity(fdisk_dev_info_t *info, cap_spec_t *cap)
 {
 	vbd_disk_info_t vinfo;
-	errno_t rc;
+	int rc;
 
 	rc = vbd_disk_info(info->devlist->fdisk->vbd, info->svcid, &vinfo);
@@ -233,5 +233,5 @@
 
 /** Add partition to our inventory. */
-static errno_t fdisk_part_add(fdisk_dev_t *dev, vbd_part_id_t partid,
+static int fdisk_part_add(fdisk_dev_t *dev, vbd_part_id_t partid,
     fdisk_part_t **rpart)
 {
@@ -239,5 +239,5 @@
 	vbd_part_info_t pinfo;
 	vol_part_info_t vpinfo;
-	errno_t rc;
+	int rc;
 
 	part = calloc(1, sizeof(fdisk_part_t));
@@ -381,9 +381,9 @@
 }
 
-static errno_t fdisk_dev_add_parts(fdisk_dev_t *dev)
+static int fdisk_dev_add_parts(fdisk_dev_t *dev)
 {
 	service_id_t *psids = NULL;
 	size_t nparts, i;
-	errno_t rc;
+	int rc;
 
 	rc = fdisk_update_dev_info(dev);
@@ -424,10 +424,10 @@
 }
 
-errno_t fdisk_dev_open(fdisk_t *fdisk, service_id_t sid, fdisk_dev_t **rdev)
+int fdisk_dev_open(fdisk_t *fdisk, service_id_t sid, fdisk_dev_t **rdev)
 {
 	fdisk_dev_t *dev = NULL;
 	service_id_t *psids = NULL;
 	size_t nparts, i;
-	errno_t rc;
+	int rc;
 
 	dev = calloc(1, sizeof(fdisk_dev_t));
@@ -479,8 +479,8 @@
 
 /** Erase contents of unlabeled disk. */
-errno_t fdisk_dev_erase(fdisk_dev_t *dev)
+int fdisk_dev_erase(fdisk_dev_t *dev)
 {
 	fdisk_part_t *part;
-	errno_t rc;
+	int rc;
 
 	if (dev->dinfo.ltype != lt_none)
@@ -523,8 +523,8 @@
 }
 
-errno_t fdisk_dev_get_svcname(fdisk_dev_t *dev, char **rname)
+int fdisk_dev_get_svcname(fdisk_dev_t *dev, char **rname)
 {
 	char *name;
-	errno_t rc;
+	int rc;
 
 	rc = loc_service_get_name(dev->sid, &name);
@@ -536,5 +536,5 @@
 }
 
-errno_t fdisk_dev_capacity(fdisk_dev_t *dev, cap_spec_t *cap)
+int fdisk_dev_capacity(fdisk_dev_t *dev, cap_spec_t *cap)
 {
 	cap_from_blocks(dev->dinfo.nblocks, dev->dinfo.block_size, cap);
@@ -542,10 +542,10 @@
 }
 
-errno_t fdisk_label_get_info(fdisk_dev_t *dev, fdisk_label_info_t *info)
+int fdisk_label_get_info(fdisk_dev_t *dev, fdisk_label_info_t *info)
 {
 	vbd_disk_info_t vinfo;
 	uint64_t b0, nb;
 	uint64_t hdrb;
-	errno_t rc;
+	int rc;
 
 	rc = vbd_disk_info(dev->fdisk->vbd, dev->sid, &vinfo);
@@ -580,8 +580,8 @@
 }
 
-errno_t fdisk_label_create(fdisk_dev_t *dev, label_type_t ltype)
+int fdisk_label_create(fdisk_dev_t *dev, label_type_t ltype)
 {
 	fdisk_part_t *part;
-	errno_t rc;
+	int rc;
 
 	/* Disk must not contain a label. */
@@ -612,9 +612,9 @@
 }
 
-errno_t fdisk_label_destroy(fdisk_dev_t *dev)
+int fdisk_label_destroy(fdisk_dev_t *dev)
 {
 	fdisk_part_t *part;
 	fdisk_dev_flags_t dflags;
-	errno_t rc;
+	int rc;
 
 	part = fdisk_part_first(dev);
@@ -667,5 +667,5 @@
 }
 
-errno_t fdisk_part_get_info(fdisk_part_t *part, fdisk_part_info_t *info)
+int fdisk_part_get_info(fdisk_part_t *part, fdisk_part_info_t *info)
 {
 	info->capacity = part->capacity;
@@ -678,7 +678,7 @@
 
 /** Get size of largest free block. */
-errno_t fdisk_part_get_max_avail(fdisk_dev_t *dev, fdisk_spc_t spc, cap_spec_t *cap)
-{
-	errno_t rc;
+int fdisk_part_get_max_avail(fdisk_dev_t *dev, fdisk_spc_t spc, cap_spec_t *cap)
+{
+	int rc;
 	uint64_t b0;
 	uint64_t nb;
@@ -702,5 +702,5 @@
 
 /** Get total free space capacity. */
-errno_t fdisk_part_get_tot_avail(fdisk_dev_t *dev, fdisk_spc_t spc,
+int fdisk_part_get_tot_avail(fdisk_dev_t *dev, fdisk_spc_t spc,
     cap_spec_t *cap)
 {
@@ -729,5 +729,5 @@
 }
 
-errno_t fdisk_part_create(fdisk_dev_t *dev, fdisk_part_spec_t *pspec,
+int fdisk_part_create(fdisk_dev_t *dev, fdisk_part_spec_t *pspec,
     fdisk_part_t **rpart)
 {
@@ -737,5 +737,5 @@
 	vol_part_info_t vpinfo;
 	const char *label;
-	errno_t rc;
+	int rc;
 
 	label = pspec->label != NULL ? pspec->label : "";
@@ -796,7 +796,7 @@
 }
 
-errno_t fdisk_part_destroy(fdisk_part_t *part)
-{
-	errno_t rc;
+int fdisk_part_destroy(fdisk_part_t *part)
+{
+	int rc;
 
 	rc = vbd_part_delete(part->dev->fdisk->vbd, part->part_id);
@@ -813,5 +813,5 @@
 }
 
-errno_t fdisk_ltype_format(label_type_t ltype, char **rstr)
+int fdisk_ltype_format(label_type_t ltype, char **rstr)
 {
 	const char *sltype;
@@ -839,5 +839,5 @@
 }
 
-errno_t fdisk_fstype_format(vol_fstype_t fstype, char **rstr)
+int fdisk_fstype_format(vol_fstype_t fstype, char **rstr)
 {
 	const char *sfstype;
@@ -871,5 +871,5 @@
 }
 
-errno_t fdisk_pkind_format(label_pkind_t pkind, char **rstr)
+int fdisk_pkind_format(label_pkind_t pkind, char **rstr)
 {
 	const char *spkind;
@@ -898,5 +898,5 @@
 
 /** Get free partition index. */
-static errno_t fdisk_part_get_free_idx(fdisk_dev_t *dev, int *rindex)
+static int fdisk_part_get_free_idx(fdisk_dev_t *dev, int *rindex)
 {
 	link_t *link;
@@ -926,5 +926,5 @@
  * Get free range of blocks of at least the specified size (first fit).
  */
-static errno_t fdisk_part_get_free_range(fdisk_dev_t *dev, aoff64_t nblocks,
+static int fdisk_part_get_free_range(fdisk_dev_t *dev, aoff64_t nblocks,
     fdisk_spc_t spc, aoff64_t *rblock0, aoff64_t *rnblocks)
 {
@@ -952,5 +952,5 @@
  * Get free range of blocks of the maximum size.
  */
-static errno_t fdisk_part_get_max_free_range(fdisk_dev_t *dev, fdisk_spc_t spc,
+static int fdisk_part_get_max_free_range(fdisk_dev_t *dev, fdisk_spc_t spc,
     aoff64_t *rblock0, aoff64_t *rnblocks)
 {
@@ -981,5 +981,5 @@
 
 /** Prepare new partition specification for VBD. */
-static errno_t fdisk_part_spec_prepare(fdisk_dev_t *dev, fdisk_part_spec_t *pspec,
+static int fdisk_part_spec_prepare(fdisk_dev_t *dev, fdisk_part_spec_t *pspec,
     vbd_part_spec_t *vpspec)
 {
@@ -994,5 +994,5 @@
 	fdisk_spc_t spc;
 	int index;
-	errno_t rc;
+	int rc;
 
 	rc = cap_to_blocks(&pspec->capacity, cv_nom, dev->dinfo.block_size,
@@ -1103,7 +1103,7 @@
 }
 
-static errno_t fdisk_update_dev_info(fdisk_dev_t *dev)
-{
-	errno_t rc;
+static int fdisk_update_dev_info(fdisk_dev_t *dev)
+{
+	int rc;
 	size_t align_bytes;
 	uint64_t avail_cap;
@@ -1223,5 +1223,5 @@
 
 /** Get volume label support. */
-errno_t fdisk_get_vollabel_support(fdisk_dev_t *dev, vol_fstype_t fstype,
+int fdisk_get_vollabel_support(fdisk_dev_t *dev, vol_fstype_t fstype,
     vol_label_supp_t *vlsupp)
 {
Index: uspace/lib/fmtutil/fmtutil.c
===================================================================
--- uspace/lib/fmtutil/fmtutil.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/fmtutil/fmtutil.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -31,5 +31,4 @@
 #include <fmtutil.h>
 #include <stdlib.h>
-#include <str.h>
 
 typedef struct {
@@ -39,5 +38,5 @@
 } printmode_t;
 
-errno_t print_wrapped_console(const char *str, align_mode_t alignment)
+int print_wrapped_console(const char *str, align_mode_t alignment)
 {
 	console_ctrl_t *console = console_init(stdin, stdout);
@@ -47,5 +46,5 @@
 	}
 	sysarg_t con_rows, con_cols, con_col, con_row;
-	errno_t rc = console_get_size(console, &con_cols, &con_rows);
+	int rc = console_get_size(console, &con_cols, &con_rows);
 	if (rc != EOK) {
 		return rc;
@@ -64,15 +63,15 @@
  *
  **/
-static errno_t print_line(wchar_t *wstr, size_t chars, bool last, void *data)
+static int print_line(wchar_t *wstr, size_t chars, bool last, void *data)
 {
 	printmode_t *pm = (printmode_t *) data;
 	wchar_t old_char = wstr[chars];
 	wstr[chars] = 0;
-	errno_t rc = print_aligned_w(wstr, pm->width, last, pm->alignment);
+	int rc = print_aligned_w(wstr, pm->width, last, pm->alignment);
 	wstr[chars] = old_char;
 	return rc;
 }
 
-errno_t print_wrapped(const char *str, size_t width, align_mode_t mode)
+int print_wrapped(const char *str, size_t width, align_mode_t mode)
 {
 	printmode_t pm;
@@ -84,10 +83,10 @@
 		return ENOMEM;
 	}
-	errno_t rc = wrap(wstr, width, print_line, &pm);
+	int rc = wrap(wstr, width, print_line, &pm);
 	free(wstr);
 	return rc;
 }
 
-errno_t print_aligned_w(const wchar_t *wstr, size_t width, bool last,
+int print_aligned_w(const wchar_t *wstr, size_t width, bool last,
     align_mode_t mode)
 {
@@ -170,5 +169,5 @@
 	return EOK;
 }
-errno_t print_aligned(const char *str, size_t width, bool last, align_mode_t mode)
+int print_aligned(const char *str, size_t width, bool last, align_mode_t mode)
 {
 	wchar_t *wstr = str_to_awstr(str);
@@ -176,10 +175,10 @@
 		return ENOMEM;
 	}
-	errno_t rc = print_aligned_w(wstr, width, last, mode);
+	int rc = print_aligned_w(wstr, width, last, mode);
 	free(wstr);
 	return rc;
 }
 
-errno_t wrap(wchar_t *wstr, size_t width, line_consumer_fn consumer, void *data)
+int wrap(wchar_t *wstr, size_t width, line_consumer_fn consumer, void *data)
 {
 	size_t word_start = 0;
Index: uspace/lib/fmtutil/fmtutil.h
===================================================================
--- uspace/lib/fmtutil/fmtutil.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/fmtutil/fmtutil.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,12 +42,12 @@
  * @param data user data
  * 
- * @returns EOK on success or an error code on failure
+ * @returns EOK on success or error code on failure
  */
-typedef errno_t (*line_consumer_fn)(wchar_t *, size_t, bool, void *);
+typedef int (*line_consumer_fn)(wchar_t *, size_t, bool, void *);
 
-extern errno_t print_aligned_w(const wchar_t *, size_t, bool, align_mode_t);
-extern errno_t print_aligned(const char *, size_t, bool, align_mode_t);
-extern errno_t print_wrapped(const char *, size_t, align_mode_t);
-extern errno_t print_wrapped_console(const char *, align_mode_t);
+extern int print_aligned_w(const wchar_t *, size_t, bool, align_mode_t);
+extern int print_aligned(const char *, size_t, bool, align_mode_t);
+extern int print_wrapped(const char *, size_t, align_mode_t);
+extern int print_wrapped_console(const char *, align_mode_t);
 
 /** Wrap characters in a wide string to the given length.
@@ -58,3 +58,3 @@
  * @param data user data to pass to the consumer function
  */
-extern errno_t wrap(wchar_t *, size_t, line_consumer_fn, void *);
+extern int wrap(wchar_t *, size_t, line_consumer_fn, void *);
Index: uspace/lib/fs/libfs.c
===================================================================
--- uspace/lib/fs/libfs.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/fs/libfs.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -84,5 +84,5 @@
 {
 	service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
-	errno_t rc;
+	int rc;
 	vfs_fs_probe_info_t info;
 	
@@ -112,5 +112,5 @@
 	service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
 	char *opts;
-	errno_t rc;
+	int rc;
 	
 	/* Accept the mount options. */
@@ -136,5 +136,5 @@
 {
 	service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
-	errno_t rc; 
+	int rc; 
 
 	rc = vfs_out_ops->unmounted(service_id);
@@ -160,5 +160,5 @@
 	    IPC_GET_ARG4(*req));
 	size_t rbytes;
-	errno_t rc;
+	int rc;
 
 	rc = vfs_out_ops->read(service_id, index, pos, &rbytes);
@@ -178,5 +178,5 @@
 	size_t wbytes;
 	aoff64_t nsize;
-	errno_t rc;
+	int rc;
 
 	rc = vfs_out_ops->write(service_id, index, pos, &wbytes, &nsize);
@@ -195,5 +195,5 @@
 	aoff64_t size = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*req),
 	    IPC_GET_ARG4(*req));
-	errno_t rc;
+	int rc;
 
 	rc = vfs_out_ops->truncate(service_id, index, size);
@@ -206,5 +206,5 @@
 	service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
 	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
-	errno_t rc;
+	int rc;
 
 	rc = vfs_out_ops->close(service_id, index);
@@ -218,5 +218,5 @@
 	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
 
-	errno_t rc;
+	int rc;
 	fs_node_t *node = NULL;
 	rc = libfs_ops->node_get(&node, service_id, index);
@@ -244,5 +244,5 @@
 	service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
 	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
-	errno_t rc;
+	int rc;
 
 	rc = vfs_out_ops->sync(service_id, index);
@@ -260,5 +260,5 @@
 	service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
 	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
-	errno_t rc;
+	int rc;
 
 	fs_node_t *node = NULL;
@@ -364,5 +364,5 @@
  *
  */
-errno_t fs_register(async_sess_t *sess, vfs_info_t *info, vfs_out_ops_t *vops,
+int fs_register(async_sess_t *sess, vfs_info_t *info, vfs_out_ops_t *vops,
     libfs_ops_t *lops)
 {
@@ -381,5 +381,5 @@
 	 * Send our VFS info structure to VFS.
 	 */
-	errno_t rc = async_data_write_start(exch, info, sizeof(*info));
+	int rc = async_data_write_start(exch, info, sizeof(*info));
 	
 	if (rc != EOK) {
@@ -446,5 +446,5 @@
 }
 
-static errno_t plb_get_component(char *dest, unsigned *sz, unsigned *ppos,
+static int plb_get_component(char *dest, unsigned *sz, unsigned *ppos,
     unsigned last)
 {
@@ -476,5 +476,5 @@
 }
 
-static errno_t receive_fname(char *buffer)
+static int receive_fname(char *buffer)
 {
 	size_t size;
@@ -500,5 +500,5 @@
 	
 	char component[NAME_MAX + 1];
-	errno_t rc = receive_fname(component);
+	int rc = receive_fname(component);
 	if (rc != EOK) {
 		async_answer_0(rid, rc);
@@ -555,5 +555,5 @@
 	
 	char component[NAME_MAX + 1];
-	errno_t rc;
+	int rc;
 	
 	fs_node_t *par = NULL;
@@ -656,5 +656,5 @@
 		if (rc == EOK) {
 			aoff64_t size = ops->size_get(cur);
-			async_answer_5(rid, EOK, fs_handle,
+			async_answer_5(rid, fs_handle, service_id,
 			    ops->index_get(cur),
 			    (ops->is_directory(cur) << 16) | last,
@@ -699,5 +699,5 @@
 out1:
 	if (!cur) {
-		async_answer_5(rid, EOK, fs_handle, ops->index_get(par),
+		async_answer_5(rid, fs_handle, service_id, ops->index_get(par),
 		    (ops->is_directory(par) << 16) | last_next,
 		    LOWER32(ops->size_get(par)), UPPER32(ops->size_get(par)));
@@ -705,5 +705,5 @@
 	}
 	
-	async_answer_5(rid, EOK, fs_handle, ops->index_get(cur),
+	async_answer_5(rid, fs_handle, service_id, ops->index_get(cur),
 	    (ops->is_directory(cur) << 16) | last, LOWER32(ops->size_get(cur)),
 	    UPPER32(ops->size_get(cur)));
@@ -727,5 +727,5 @@
 
 	fs_node_t *fn;
-	errno_t rc = ops->node_get(&fn, service_id, index);
+	int rc = ops->node_get(&fn, service_id, index);
 	on_error(rc, answer_and_return(rid, rc));
 
@@ -733,5 +733,5 @@
 	size_t size;
 	if ((!async_data_read_receive(&callid, &size)) ||
-	    (size != sizeof(vfs_stat_t))) {
+	    (size != sizeof(struct stat))) {
 		ops->node_put(fn);
 		async_answer_0(callid, EINVAL);
@@ -740,6 +740,6 @@
 	}
 
-	vfs_stat_t stat;
-	memset(&stat, 0, sizeof(vfs_stat_t));
+	struct stat stat;
+	memset(&stat, 0, sizeof(struct stat));
 
 	stat.fs_handle = fs_handle;
@@ -755,5 +755,5 @@
 
 
-	async_data_read_finalize(callid, &stat, sizeof(vfs_stat_t));
+	async_data_read_finalize(callid, &stat, sizeof(struct stat));
 	async_answer_0(rid, EOK);
 }
@@ -766,5 +766,5 @@
 
 	fs_node_t *fn;
-	errno_t rc = ops->node_get(&fn, service_id, index);
+	int rc = ops->node_get(&fn, service_id, index);
 	on_error(rc, answer_and_return(rid, rc));
 
@@ -772,10 +772,10 @@
 	size_t size;
 	if ((!async_data_read_receive(&callid, &size)) ||
-	    (size != sizeof(vfs_statfs_t))) {
+	    (size != sizeof(struct statfs))) {
 		goto error;
 	}
 
-	vfs_statfs_t st;
-	memset(&st, 0, sizeof(vfs_statfs_t));
+	struct statfs st;
+	memset(&st, 0, sizeof(struct statfs));
 
 	str_cpy(st.fs_name, sizeof(st.fs_name), fs_name);
@@ -800,5 +800,5 @@
 
 	ops->node_put(fn);
-	async_data_read_finalize(callid, &st, sizeof(vfs_statfs_t));
+	async_data_read_finalize(callid, &st, sizeof(struct statfs));
 	async_answer_0(rid, EOK);
 	return;
@@ -826,5 +826,5 @@
 	
 	fs_node_t *fn;
-	errno_t rc = ops->node_get(&fn, service_id, index);
+	int rc = ops->node_get(&fn, service_id, index);
 	on_error(rc, answer_and_return(rid, rc));
 	
@@ -853,5 +853,5 @@
 } fs_instance_t;
 
-errno_t fs_instance_create(service_id_t service_id, void *data)
+int fs_instance_create(service_id_t service_id, void *data)
 {
 	fs_instance_t *inst = malloc(sizeof(fs_instance_t));
@@ -884,5 +884,5 @@
 }
 
-errno_t fs_instance_get(service_id_t service_id, void **idp)
+int fs_instance_get(service_id_t service_id, void **idp)
 {
 	fibril_mutex_lock(&instances_mutex);
@@ -898,5 +898,5 @@
 }
 
-errno_t fs_instance_destroy(service_id_t service_id)
+int fs_instance_destroy(service_id_t service_id)
 {
 	fibril_mutex_lock(&instances_mutex);
Index: uspace/lib/fs/libfs.h
===================================================================
--- uspace/lib/fs/libfs.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/fs/libfs.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,14 +43,14 @@
 
 typedef struct {
-	errno_t (*fsprobe)(service_id_t, vfs_fs_probe_info_t *);
-	errno_t (*mounted)(service_id_t, const char *, fs_index_t *, aoff64_t *);
-	errno_t (*unmounted)(service_id_t);
-	errno_t (*read)(service_id_t, fs_index_t, aoff64_t, size_t *);
-	errno_t (*write)(service_id_t, fs_index_t, aoff64_t, size_t *,
+	int (* fsprobe)(service_id_t, vfs_fs_probe_info_t *);
+	int (* mounted)(service_id_t, const char *, fs_index_t *, aoff64_t *);
+	int (* unmounted)(service_id_t);
+	int (* read)(service_id_t, fs_index_t, aoff64_t, size_t *);
+	int (* write)(service_id_t, fs_index_t, aoff64_t, size_t *,
 	    aoff64_t *);
-	errno_t (*truncate)(service_id_t, fs_index_t, aoff64_t);
-	errno_t (*close)(service_id_t, fs_index_t);
-	errno_t (*destroy)(service_id_t, fs_index_t);
-	errno_t (*sync)(service_id_t, fs_index_t);
+	int (* truncate)(service_id_t, fs_index_t, aoff64_t);
+	int (* close)(service_id_t, fs_index_t);
+	int (* destroy)(service_id_t, fs_index_t);
+	int (* sync)(service_id_t, fs_index_t);
 } vfs_out_ops_t;
 
@@ -65,27 +65,27 @@
 	 * argument holds the output argument.
 	 */
-	errno_t (*root_get)(fs_node_t **, service_id_t);
-	errno_t (*match)(fs_node_t **, fs_node_t *, const char *);
-	errno_t (*node_get)(fs_node_t **, service_id_t, fs_index_t);
-	errno_t (*node_open)(fs_node_t *);
-	errno_t (*node_put)(fs_node_t *);
-	errno_t (*create)(fs_node_t **, service_id_t, int);
-	errno_t (*destroy)(fs_node_t *);
-	errno_t (*link)(fs_node_t *, fs_node_t *, const char *);
-	errno_t (*unlink)(fs_node_t *, fs_node_t *, const char *);
-	errno_t (*has_children)(bool *, fs_node_t *);
+	int (* root_get)(fs_node_t **, service_id_t);
+	int (* match)(fs_node_t **, fs_node_t *, const char *);
+	int (* node_get)(fs_node_t **, service_id_t, fs_index_t);
+	int (* node_open)(fs_node_t *);
+	int (* node_put)(fs_node_t *);
+	int (* create)(fs_node_t **, service_id_t, int);
+	int (* destroy)(fs_node_t *);
+	int (* link)(fs_node_t *, fs_node_t *, const char *);
+	int (* unlink)(fs_node_t *, fs_node_t *, const char *);
+	int (* has_children)(bool *, fs_node_t *);
 	/*
 	 * The second set of methods are usually mere getters that do not
 	 * return an integer error code.
 	 */
-	fs_index_t (*index_get)(fs_node_t *);
-	aoff64_t (*size_get)(fs_node_t *);
-	unsigned int (*lnkcnt_get)(fs_node_t *);
-	bool (*is_directory)(fs_node_t *);
-	bool (*is_file)(fs_node_t *);
-	service_id_t (*service_get)(fs_node_t *);
-	errno_t (*size_block)(service_id_t, uint32_t *);
-	errno_t (*total_block_count)(service_id_t, uint64_t *);
-	errno_t (*free_block_count)(service_id_t, uint64_t *);
+	fs_index_t (* index_get)(fs_node_t *);
+	aoff64_t (* size_get)(fs_node_t *);
+	unsigned int (* lnkcnt_get)(fs_node_t *);
+	bool (* is_directory)(fs_node_t *);
+	bool (* is_file)(fs_node_t *);
+	service_id_t (* service_get)(fs_node_t *);
+	int (* size_block)(service_id_t, uint32_t *);
+	int (* total_block_count)(service_id_t, uint64_t *);
+	int (* free_block_count)(service_id_t, uint64_t *);
 } libfs_ops_t;
 
@@ -95,12 +95,12 @@
 } fs_reg_t;
 
-extern errno_t fs_register(async_sess_t *, vfs_info_t *, vfs_out_ops_t *,
+extern int fs_register(async_sess_t *, vfs_info_t *, vfs_out_ops_t *,
     libfs_ops_t *);
 
 extern void fs_node_initialize(fs_node_t *);
 
-extern errno_t fs_instance_create(service_id_t, void *);
-extern errno_t fs_instance_get(service_id_t, void **);
-extern errno_t fs_instance_destroy(service_id_t);
+extern int fs_instance_create(service_id_t, void *);
+extern int fs_instance_get(service_id_t, void **);
+extern int fs_instance_destroy(service_id_t);
 
 #endif
Index: uspace/lib/graph/graph.c
===================================================================
--- uspace/lib/graph/graph.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/graph/graph.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -86,5 +86,5 @@
 }
 
-errno_t graph_register_visualizer(visualizer_t *vs)
+int graph_register_visualizer(visualizer_t *vs)
 {
 	char node[LOC_NAME_MAXLEN + 1];
@@ -93,5 +93,5 @@
 	
 	category_id_t cat;
-	errno_t rc = loc_category_get_id("visualizer", &cat, 0);
+	int rc = loc_category_get_id("visualizer", &cat, 0);
 	if (rc != EOK)
 		return rc;
@@ -114,5 +114,5 @@
 }
 
-errno_t graph_register_renderer(renderer_t *rnd)
+int graph_register_renderer(renderer_t *rnd)
 {
 	char node[LOC_NAME_MAXLEN + 1];
@@ -121,5 +121,5 @@
 	
 	category_id_t cat;
-	errno_t rc = loc_category_get_id("renderer", &cat, 0);
+	int rc = loc_category_get_id("renderer", &cat, 0);
 	if (rc != EOK)
 		return rc;
@@ -178,8 +178,8 @@
 }
 
-errno_t graph_unregister_visualizer(visualizer_t *vs)
+int graph_unregister_visualizer(visualizer_t *vs)
 {
 	fibril_mutex_lock(&visualizer_list_mtx);
-	errno_t rc = loc_service_unregister(vs->reg_svc_handle);
+	int rc = loc_service_unregister(vs->reg_svc_handle);
 	list_remove(&vs->link);
 	fibril_mutex_unlock(&visualizer_list_mtx);
@@ -188,8 +188,8 @@
 }
 
-errno_t graph_unregister_renderer(renderer_t *rnd)
+int graph_unregister_renderer(renderer_t *rnd)
 {
 	fibril_mutex_lock(&renderer_list_mtx);
-	errno_t rc = loc_service_unregister(rnd->reg_svc_handle);
+	int rc = loc_service_unregister(rnd->reg_svc_handle);
 	list_remove(&rnd->link);
 	fibril_mutex_unlock(&renderer_list_mtx);
@@ -219,8 +219,8 @@
 }
 
-errno_t graph_notify_mode_change(async_sess_t *sess, sysarg_t handle, sysarg_t mode_idx)
+int graph_notify_mode_change(async_sess_t *sess, sysarg_t handle, sysarg_t mode_idx)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_2_0(exch, VISUALIZER_MODE_CHANGE, handle, mode_idx);
+	int ret = async_req_2_0(exch, VISUALIZER_MODE_CHANGE, handle, mode_idx);
 	async_exchange_end(exch);
 	
@@ -228,8 +228,8 @@
 }
 
-errno_t graph_notify_disconnect(async_sess_t *sess, sysarg_t handle)
+int graph_notify_disconnect(async_sess_t *sess, sysarg_t handle)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_1_0(exch, VISUALIZER_DISCONNECT, handle);
+	int ret = async_req_1_0(exch, VISUALIZER_DISCONNECT, handle);
 	async_exchange_end(exch);
 	
@@ -242,5 +242,5 @@
 {
 	vs->client_side_handle = IPC_GET_ARG1(*icall);
-	errno_t rc = vs->ops.claim(vs);
+	int rc = vs->ops.claim(vs);
 	async_answer_0(iid, rc);
 }
@@ -257,5 +257,5 @@
 	
 	/* Driver might also deallocate resources for the current mode. */
-	errno_t rc = vs->ops.yield(vs);
+	int rc = vs->ops.yield(vs);
 	
 	/* Now that the driver was given a chance to deallocate resources,
@@ -285,5 +285,5 @@
 		    list_get_instance(link, vslmode_list_element_t, link);
 		
-		errno_t rc = async_data_read_finalize(callid, &mode_elem->mode, len);
+		int rc = async_data_read_finalize(callid, &mode_elem->mode, len);
 		async_answer_0(iid, rc);
 	} else {
@@ -317,5 +317,5 @@
 	
 	if (mode_elem != NULL) {
-		errno_t rc = async_data_read_finalize(callid, &mode_elem->mode, len);
+		int rc = async_data_read_finalize(callid, &mode_elem->mode, len);
 		async_answer_0(iid, rc);
 	} else {
@@ -340,5 +340,5 @@
 	
 	if (vs->mode_set) {
-		errno_t rc = async_data_read_finalize(callid, &vs->cur_mode, len);
+		int rc = async_data_read_finalize(callid, &vs->cur_mode, len);
 		async_answer_0(iid, rc);
 	} else {
@@ -372,5 +372,5 @@
 	
 	if (mode_elem != NULL) {
-		errno_t rc = async_data_read_finalize(callid, &mode_elem->mode, len);
+		int rc = async_data_read_finalize(callid, &mode_elem->mode, len);
 		async_answer_0(iid, rc);
 	} else {
@@ -429,5 +429,5 @@
 	
 	void *new_cell_storage;
-	errno_t rc = async_share_out_finalize(callid, &new_cell_storage);
+	int rc = async_share_out_finalize(callid, &new_cell_storage);
 	if ((rc != EOK) || (new_cell_storage == AS_MAP_FAILED)) {
 		async_answer_0(iid, ENOMEM);
@@ -472,5 +472,5 @@
 	sysarg_t y_offset = (IPC_GET_ARG5(*icall) & 0x0000ffff);
 	
-	errno_t rc = vs->ops.handle_damage(vs,
+	int rc = vs->ops.handle_damage(vs,
 	    IPC_GET_ARG1(*icall), IPC_GET_ARG2(*icall),
 	    IPC_GET_ARG3(*icall), IPC_GET_ARG4(*icall),
@@ -481,5 +481,5 @@
 static void vs_suspend(visualizer_t *vs, ipc_callid_t iid, ipc_call_t *icall)
 {
-	errno_t rc = vs->ops.suspend(vs);
+	int rc = vs->ops.suspend(vs);
 	async_answer_0(iid, rc);
 }
@@ -487,5 +487,5 @@
 static void vs_wakeup(visualizer_t *vs, ipc_callid_t iid, ipc_call_t *icall)
 {
-	errno_t rc = vs->ops.wakeup(vs);
+	int rc = vs->ops.wakeup(vs);
 	async_answer_0(iid, rc);
 }
Index: uspace/lib/graph/graph.h
===================================================================
--- uspace/lib/graph/graph.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/graph/graph.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,5 +54,5 @@
 	 * Device driver shall allocate any necessary internal structures
 	 * specific for a claimed visualizer. */
-	errno_t (*claim)(struct visualizer *vs);
+	int (* claim)(struct visualizer *vs);
 	
 	/**
@@ -61,5 +61,5 @@
 	 * the mode is set and if so it shall change its internal state
 	 * accordingly (e.g. deallocate frame buffers). */
-	errno_t (*yield)(struct visualizer *vs);
+	int (* yield)(struct visualizer *vs);
 	
 	/**
@@ -72,5 +72,5 @@
 	 * optimization), the pointer to the handle_damage operation can be
 	 * changed at this point. */
-	errno_t (*change_mode)(struct visualizer *vs, vslmode_t new_mode);
+	int (* change_mode)(struct visualizer *vs, vslmode_t new_mode);
 	
 	/**
@@ -82,7 +82,7 @@
 	 * shall be added to the coordinates and if necessary the result shall be
 	 * wrapped around the edge of the backbuffer). */
-	errno_t (*handle_damage)(struct visualizer *vs,
+	int (* handle_damage)(struct visualizer *vs,
 	    sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height,
-	    sysarg_t x_offset, sysarg_t y_offset);
+		sysarg_t x_offset, sysarg_t y_offset);
 	
 	/**
@@ -90,10 +90,10 @@
 	 * case, device driver might enable power saving mode on the device
 	 * corresponding to the visualizer. */
-	errno_t (*suspend)(struct visualizer *vs);
+	int (* suspend)(struct visualizer *vs);
 	
 	/**
 	 * When upper layers detect activity on suspended visualizer, device
 	 * driver shall disable power saving mode on the corresponding device. */
-	errno_t (*wakeup)(struct visualizer *vs);
+	int (* wakeup)(struct visualizer *vs);
 } visualizer_ops_t;
 
@@ -290,5 +290,5 @@
  * list is guarded by the mutex, visualizers might be added even after the
  * initialialization of the device driver. */
-extern errno_t graph_register_visualizer(visualizer_t *);
+extern int graph_register_visualizer(visualizer_t *);
 
 /** 
@@ -301,5 +301,5 @@
  * from the driver visualizer list. Function shall be called by device driver
  * before deallocating the resources for the visualizer. */
-extern errno_t graph_unregister_visualizer(visualizer_t *);
+extern int graph_unregister_visualizer(visualizer_t *);
 
 /** 
@@ -310,7 +310,7 @@
 
 extern renderer_t *graph_alloc_renderer(void);
-extern errno_t graph_register_renderer(renderer_t *);
+extern int graph_register_renderer(renderer_t *);
 extern renderer_t *graph_get_renderer(sysarg_t);
-extern errno_t graph_unregister_renderer(renderer_t *);
+extern int graph_unregister_renderer(renderer_t *);
 extern void graph_destroy_renderer(renderer_t *);
 
@@ -321,5 +321,5 @@
  * callback connection that the visualizer with a specified service ID should
  * be switched to the mode with the given index. */
-extern errno_t graph_notify_mode_change(async_sess_t *, sysarg_t, sysarg_t);
+extern int graph_notify_mode_change(async_sess_t *, sysarg_t, sysarg_t);
 
 /**
@@ -327,5 +327,5 @@
  * callback connection that the visualizer with a specified service ID has
  * lost its output device (e.g. virtual monitor was closed by a user). */
-extern errno_t graph_notify_disconnect(async_sess_t *, sysarg_t);
+extern int graph_notify_disconnect(async_sess_t *, sysarg_t);
 
 /*----------------------------------------------------------------------------*/
Index: uspace/lib/gui/button.c
===================================================================
--- uspace/lib/gui/button.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/gui/button.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -174,5 +174,5 @@
 		btn->caption = str_dup(caption);
 	
-	errno_t rc = embedded_font_create(&btn->font, points);
+	int rc = embedded_font_create(&btn->font, points);
 	if (rc != EOK) {
 		free(btn->caption);
Index: uspace/lib/gui/label.c
===================================================================
--- uspace/lib/gui/label.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/gui/label.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -163,5 +163,5 @@
 		lbl->caption = str_dup(caption);
 	
-	errno_t rc = embedded_font_create(&lbl->font, points);
+	int rc = embedded_font_create(&lbl->font, points);
 	if (rc != EOK) {
 		free(lbl->caption);
Index: uspace/lib/gui/terminal.c
===================================================================
--- uspace/lib/gui/terminal.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/gui/terminal.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,4 @@
 #include <atomic.h>
 #include <stdarg.h>
-#include <str.h>
 #include "window.h"
 #include "terminal.h"
@@ -63,14 +62,14 @@
 static LIST_INITIALIZE(terms);
 
-static errno_t term_open(con_srvs_t *, con_srv_t *);
-static errno_t term_close(con_srv_t *);
-static errno_t term_read(con_srv_t *, void *, size_t, size_t *);
-static errno_t term_write(con_srv_t *, void *, size_t, size_t *);
+static int term_open(con_srvs_t *, con_srv_t *);
+static int term_close(con_srv_t *);
+static int term_read(con_srv_t *, void *, size_t);
+static int term_write(con_srv_t *, void *, size_t);
 static void term_sync(con_srv_t *);
 static void term_clear(con_srv_t *);
 static void term_set_pos(con_srv_t *, sysarg_t col, sysarg_t row);
-static errno_t term_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t term_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t term_get_color_cap(con_srv_t *, console_caps_t *);
+static int term_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
+static int term_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
+static int term_get_color_cap(con_srv_t *, console_caps_t *);
 static void term_set_style(con_srv_t *, console_style_t);
 static void term_set_color(con_srv_t *, console_color_t, console_color_t,
@@ -78,5 +77,5 @@
 static void term_set_rgb_color(con_srv_t *, pixel_t, pixel_t);
 static void term_set_cursor_visibility(con_srv_t *, bool);
-static errno_t term_get_event(con_srv_t *, cons_event_t *);
+static int term_get_event(con_srv_t *, cons_event_t *);
 
 static con_ops_t con_ops = {
@@ -377,15 +376,15 @@
 }
 
-static errno_t term_open(con_srvs_t *srvs, con_srv_t *srv)
+static int term_open(con_srvs_t *srvs, con_srv_t *srv)
 {
 	return EOK;
 }
 
-static errno_t term_close(con_srv_t *srv)
+static int term_close(con_srv_t *srv)
 {
 	return EOK;
 }
 
-static errno_t term_read(con_srv_t *srv, void *buf, size_t size, size_t *nread)
+static int term_read(con_srv_t *srv, void *buf, size_t size)
 {
 	terminal_t *term = srv_to_terminal(srv);
@@ -432,6 +431,5 @@
 	}
 	
-	*nread = size;
-	return EOK;
+	return size;
 }
 
@@ -464,5 +462,5 @@
 }
 
-static errno_t term_write(con_srv_t *srv, void *data, size_t size, size_t *nwritten)
+static int term_write(con_srv_t *srv, void *data, size_t size)
 {
 	terminal_t *term = srv_to_terminal(srv);
@@ -472,49 +470,48 @@
 		term_write_char(term, str_decode(data, &off, size));
 	
-	*nwritten = size;
+	return size;
+}
+
+static void term_sync(con_srv_t *srv)
+{
+	terminal_t *term = srv_to_terminal(srv);
+	
+	term_update(term);
+}
+
+static void term_clear(con_srv_t *srv)
+{
+	terminal_t *term = srv_to_terminal(srv);
+	
+	fibril_mutex_lock(&term->mtx);
+	chargrid_clear(term->frontbuf);
+	fibril_mutex_unlock(&term->mtx);
+	
+	term_update(term);
+}
+
+static void term_set_pos(con_srv_t *srv, sysarg_t col, sysarg_t row)
+{
+	terminal_t *term = srv_to_terminal(srv);
+	
+	fibril_mutex_lock(&term->mtx);
+	chargrid_set_cursor(term->frontbuf, col, row);
+	fibril_mutex_unlock(&term->mtx);
+	
+	term_update(term);
+}
+
+static int term_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
+{
+	terminal_t *term = srv_to_terminal(srv);
+	
+	fibril_mutex_lock(&term->mtx);
+	chargrid_get_cursor(term->frontbuf, col, row);
+	fibril_mutex_unlock(&term->mtx);
+	
 	return EOK;
 }
 
-static void term_sync(con_srv_t *srv)
-{
-	terminal_t *term = srv_to_terminal(srv);
-	
-	term_update(term);
-}
-
-static void term_clear(con_srv_t *srv)
-{
-	terminal_t *term = srv_to_terminal(srv);
-	
-	fibril_mutex_lock(&term->mtx);
-	chargrid_clear(term->frontbuf);
-	fibril_mutex_unlock(&term->mtx);
-	
-	term_update(term);
-}
-
-static void term_set_pos(con_srv_t *srv, sysarg_t col, sysarg_t row)
-{
-	terminal_t *term = srv_to_terminal(srv);
-	
-	fibril_mutex_lock(&term->mtx);
-	chargrid_set_cursor(term->frontbuf, col, row);
-	fibril_mutex_unlock(&term->mtx);
-	
-	term_update(term);
-}
-
-static errno_t term_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
-{
-	terminal_t *term = srv_to_terminal(srv);
-	
-	fibril_mutex_lock(&term->mtx);
-	chargrid_get_cursor(term->frontbuf, col, row);
-	fibril_mutex_unlock(&term->mtx);
-	
-	return EOK;
-}
-
-static errno_t term_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
+static int term_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
 {
 	terminal_t *term = srv_to_terminal(srv);
@@ -528,5 +525,5 @@
 }
 
-static errno_t term_get_color_cap(con_srv_t *srv, console_caps_t *caps)
+static int term_get_color_cap(con_srv_t *srv, console_caps_t *caps)
 {
 	(void) srv;
@@ -576,5 +573,5 @@
 }
 
-static errno_t term_get_event(con_srv_t *srv, cons_event_t *event)
+static int term_get_event(con_srv_t *srv, cons_event_t *event)
 {
 	terminal_t *term = srv_to_terminal(srv);
@@ -752,5 +749,5 @@
 	term->srvs.sarg = term;
 	
-	errno_t rc = loc_server_register(NAME);
+	int rc = loc_server_register(NAME);
 	if (rc != EOK) {
 		widget_deinit(&term->widget);
Index: uspace/lib/gui/terminal.h
===================================================================
--- uspace/lib/gui/terminal.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/gui/terminal.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,4 @@
 #include <adt/prodcons.h>
 #include <atomic.h>
-#include <str.h>
 #include "widget.h"
 
Index: uspace/lib/gui/window.c
===================================================================
--- uspace/lib/gui/window.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/gui/window.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -163,5 +163,5 @@
 	
 	font_t *font;
-	errno_t rc = embedded_font_create(&font, 16);
+	int rc = embedded_font_create(&font, 16);
 	if (rc != EOK) {
 		window_yield(widget->window);
@@ -404,5 +404,5 @@
 	
 	/* Inform compositor about new surface. */
-	errno_t rc = win_resize(win->osess, offset_x, offset_y, width, height,
+	int rc = win_resize(win->osess, offset_x, offset_y, width, height,
 	    placement_flags, surface_direct_access(new_surface));
 	
@@ -493,5 +493,5 @@
 
 /* Window event loop. Runs in own dedicated fibril. */
-static errno_t event_loop(void *arg)
+static int event_loop(void *arg)
 {
 	bool is_main = false;
@@ -561,7 +561,7 @@
 
 /* Input fetcher from compositor. Runs in own dedicated fibril. */
-static errno_t fetch_input(void *arg)
-{
-	errno_t rc;
+static int fetch_input(void *arg)
+{
+	int rc;
 	bool terminate = false;
 	window_t *win = (window_t *) arg;
@@ -618,5 +618,5 @@
 	
 	service_id_t reg_dsid;
-	errno_t rc = loc_service_get_id(winreg, &reg_dsid, 0);
+	int rc = loc_service_get_id(winreg, &reg_dsid, 0);
 	if (rc != EOK) {
 		free(win);
@@ -677,5 +677,5 @@
 }
 
-errno_t window_set_caption(window_t *win, const char *caption)
+int window_set_caption(window_t *win, const char *caption)
 {
 	char *cap;
Index: uspace/lib/gui/window.h
===================================================================
--- uspace/lib/gui/window.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/gui/window.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -78,5 +78,5 @@
 
 /** Change window caption. */
-extern errno_t window_set_caption(window_t *, const char *);
+extern int window_set_caption(window_t *, const char *);
 
 /**
Index: uspace/lib/hound/include/hound/client.h
===================================================================
--- uspace/lib/hound/include/hound/client.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/hound/include/hound/client.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,20 +47,20 @@
 typedef struct hound_stream hound_stream_t;
 
-hound_context_t *hound_context_create_playback(const char *name,
+hound_context_t * hound_context_create_playback(const char *name,
     pcm_format_t format, size_t bsize);
-hound_context_t *hound_context_create_capture(const char *name,
+hound_context_t * hound_context_create_capture(const char *name,
     pcm_format_t format, size_t bsize);
 void hound_context_destroy(hound_context_t *hound);
 
-errno_t hound_context_set_main_stream_params(hound_context_t *hound,
+int hound_context_set_main_stream_params(hound_context_t *hound,
     pcm_format_t format, size_t bsize);
 
-errno_t hound_context_get_available_targets(hound_context_t *hound,
-    char ***names, size_t *count);
-errno_t hound_context_get_connected_targets(hound_context_t *hound,
-    char ***names, size_t *count);
+int hound_context_get_available_targets(hound_context_t *hound,
+    const char ***names, size_t *count);
+int hound_context_get_connected_targets(hound_context_t *hound,
+    const char ***names, size_t *count);
 
-errno_t hound_context_connect_target(hound_context_t *hound, const char *target);
-errno_t hound_context_disconnect_target(hound_context_t *hound, const char *target);
+int hound_context_connect_target(hound_context_t *hound, const char* target);
+int hound_context_disconnect_target(hound_context_t *hound, const char* target);
 
 hound_stream_t *hound_stream_create(hound_context_t *hound, unsigned flags,
@@ -68,14 +68,14 @@
 void hound_stream_destroy(hound_stream_t *stream);
 
-errno_t hound_stream_write(hound_stream_t *stream, const void *data, size_t size);
-errno_t hound_stream_read(hound_stream_t *stream, void *data, size_t size);
-errno_t hound_stream_drain(hound_stream_t *stream);
+int hound_stream_write(hound_stream_t *stream, const void *data, size_t size);
+int hound_stream_read(hound_stream_t *stream, void *data, size_t size);
+int hound_stream_drain(hound_stream_t *stream);
 
-errno_t hound_write_main_stream(hound_context_t *hound,
+int hound_write_main_stream(hound_context_t *hound,
     const void *data, size_t size);
-errno_t hound_read_main_stream(hound_context_t *hound, void *data, size_t size);
-errno_t hound_write_replace_main_stream(hound_context_t *hound,
+int hound_read_main_stream(hound_context_t *hound, void *data, size_t size);
+int hound_write_replace_main_stream(hound_context_t *hound,
     const void *data, size_t size);
-errno_t hound_write_immediate(hound_context_t *hound,
+int hound_write_immediate(hound_context_t *hound,
     pcm_format_t format, const void *data, size_t size);
 
Index: uspace/lib/hound/include/hound/protocol.h
===================================================================
--- uspace/lib/hound/include/hound/protocol.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/hound/include/hound/protocol.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,12 +58,22 @@
 typedef intptr_t hound_context_id_t;
 
+/**
+ * Check context id for errors.
+ * @param id Context id
+ * @return Error code.
+ */
+static inline int hound_context_id_err(hound_context_id_t id)
+{
+	return id > 0 ? EOK : (id == 0 ? ENOENT : id);
+}
+
 hound_sess_t *hound_service_connect(const char *service);
 void hound_service_disconnect(hound_sess_t *sess);
 
-errno_t hound_service_register_context(hound_sess_t *sess,
-    const char *name, bool record, hound_context_id_t *id);
-errno_t hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id);
+hound_context_id_t hound_service_register_context(hound_sess_t *sess,
+    const char *name, bool record);
+int hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id);
 
-errno_t hound_service_get_list(hound_sess_t *sess, char ***ids, size_t *count,
+int hound_service_get_list(hound_sess_t *sess, const char ***ids, size_t *count,
     int flags, const char *connection);
 
@@ -76,22 +86,22 @@
  * @return Error code.
  */
-static inline errno_t hound_service_get_list_all(hound_sess_t *sess,
-    char ***ids, size_t *count, int flags)
+static inline int hound_service_get_list_all(hound_sess_t *sess,
+    const char ***ids, size_t *count, int flags)
 {
 	return hound_service_get_list(sess, ids, count, flags, NULL);
 }
 
-errno_t hound_service_connect_source_sink(hound_sess_t *sess, const char *source,
+int hound_service_connect_source_sink(hound_sess_t *sess, const char *source,
     const char *sink);
-errno_t hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source,
+int hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source,
     const char *sink);
 
-errno_t hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id,
+int hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id,
     int flags, pcm_format_t format, size_t bsize);
-errno_t hound_service_stream_drain(async_exch_t *exch);
-errno_t hound_service_stream_exit(async_exch_t *exch);
+int hound_service_stream_drain(async_exch_t *exch);
+int hound_service_stream_exit(async_exch_t *exch);
 
-errno_t hound_service_stream_write(async_exch_t *exch, const void *data, size_t size);
-errno_t hound_service_stream_read(async_exch_t *exch, void *data, size_t size);
+int hound_service_stream_write(async_exch_t *exch, const void *data, size_t size);
+int hound_service_stream_read(async_exch_t *exch, void *data, size_t size);
 
 /* Server */
@@ -100,26 +110,26 @@
 typedef struct hound_server_iface {
 	/** Create new context */
-	errno_t (*add_context)(void *, hound_context_id_t *, const char *, bool);
+	int (*add_context)(void *, hound_context_id_t *, const char *, bool);
 	/** Destroy existing context */
-	errno_t (*rem_context)(void *, hound_context_id_t);
+	int (*rem_context)(void *, hound_context_id_t);
 	/** Query context direction */
 	bool (*is_record_context)(void *, hound_context_id_t);
 	/** Get string identifiers of specified objects */
-	errno_t (*get_list)(void *, char ***, size_t *, const char *, int);
+	int (*get_list)(void *, const char ***, size_t *, const char *, int);
 	/** Create connection between source and sink */
-	errno_t (*connect)(void *, const char *, const char *);
+	int (*connect)(void *, const char *, const char *);
 	/** Destroy connection between source and sink */
-	errno_t (*disconnect)(void *, const char *, const char *);
+	int (*disconnect)(void *, const char *, const char *);
 	/** Create new stream tied to the context */
-	errno_t (*add_stream)(void *, hound_context_id_t, int, pcm_format_t, size_t,
+	int (*add_stream)(void *, hound_context_id_t, int, pcm_format_t, size_t,
 	    void **);
 	/** Destroy existing stream */
-	errno_t (*rem_stream)(void *, void *);
+	int (*rem_stream)(void *, void *);
 	/** Block until the stream buffer is empty */
-	errno_t (*drain_stream)(void *);
+	int (*drain_stream)(void *);
 	/** Write new data to the stream */
-	errno_t (*stream_data_write)(void *, const void *, size_t);
+	int (*stream_data_write)(void *, const void *, size_t);
 	/** Read data from the stream */
-	errno_t (*stream_data_read)(void *, void *, size_t);
+	int (*stream_data_read)(void *, void *, size_t);
 	void *server;
 } hound_server_iface_t;
Index: uspace/lib/hound/include/hound/server.h
===================================================================
--- uspace/lib/hound/include/hound/server.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/hound/include/hound/server.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,10 +41,10 @@
 
 typedef void (*dev_change_callback_t)(void);
-typedef errno_t (*device_callback_t)(service_id_t, const char *);
+typedef int (*device_callback_t)(service_id_t, const char *);
 
-errno_t hound_server_register(const char *name, service_id_t *id);
+int hound_server_register(const char *name, service_id_t *id);
 void hound_server_unregister(service_id_t id);
-errno_t hound_server_set_device_change_callback(dev_change_callback_t cb);
-errno_t hound_server_devices_iterate(device_callback_t callback);
+int hound_server_set_device_change_callback(dev_change_callback_t cb);
+int hound_server_devices_iterate(device_callback_t callback);
 
 #endif
Index: uspace/lib/hound/src/client.c
===================================================================
--- uspace/lib/hound/src/client.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/hound/src/client.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -76,5 +76,5 @@
 	hound_sess_t *session;
 	/** context name, reported to the daemon */
-	char *name;
+	const char *name;
 	/** True if the instance is record context */
 	bool record;
@@ -123,8 +123,7 @@
 			return NULL;
 		}
-		errno_t rc = hound_service_register_context(
-		    new_context->session, new_context->name, record,
-		    &new_context->id);
-		if (rc != EOK) {
+		new_context->id = hound_service_register_context(
+		    new_context->session, new_context->name, record);
+		if (hound_context_id_err(new_context->id) != EOK) {
 			hound_service_disconnect(new_context->session);
 			free(new_context->name);
@@ -195,6 +194,6 @@
  * The function will return deice sinks or source based on the context type.
  */
-errno_t hound_context_get_available_targets(hound_context_t *hound,
-    char ***names, size_t *count)
+int hound_context_get_available_targets(hound_context_t *hound,
+    const char ***names, size_t *count)
 {
 	assert(hound);
@@ -212,6 +211,6 @@
  * @return Error code.
  */
-errno_t hound_context_get_connected_targets(hound_context_t *hound,
-    char ***names, size_t *count)
+int hound_context_get_connected_targets(hound_context_t *hound,
+    const char ***names, size_t *count)
 {
 	assert(hound);
@@ -232,12 +231,12 @@
  * connect to the first possible target if it is passed this value.
  */
-errno_t hound_context_connect_target(hound_context_t *hound, const char* target)
+int hound_context_connect_target(hound_context_t *hound, const char* target)
 {
 	assert(hound);
 	assert(target);
 
-	char **tgt = NULL;
+	const char **tgt = NULL;
 	size_t count = 1;
-	errno_t ret = EOK;
+	int ret = EOK;
 	if (str_cmp(target, HOUND_DEFAULT_TARGET) == 0) {
 		ret = hound_context_get_available_targets(hound, &tgt, &count);
@@ -269,5 +268,5 @@
  * @return Error code.
  */
-errno_t hound_context_disconnect_target(hound_context_t *hound, const char* target)
+int hound_context_disconnect_target(hound_context_t *hound, const char* target)
 {
 	assert(hound);
@@ -305,5 +304,5 @@
 		new_stream->context = hound;
 		new_stream->flags = flags;
-		const errno_t ret = hound_service_stream_enter(new_stream->exch,
+		const int ret = hound_service_stream_enter(new_stream->exch,
 		    hound->id, flags, format, bsize);
 		if (ret != EOK) {
@@ -343,5 +342,5 @@
  * @return error code.
  */
-errno_t hound_stream_write(hound_stream_t *stream, const void *data, size_t size)
+int hound_stream_write(hound_stream_t *stream, const void *data, size_t size)
 {
 	assert(stream);
@@ -358,5 +357,5 @@
  * @return error code.
  */
-errno_t hound_stream_read(hound_stream_t *stream, void *data, size_t size)
+int hound_stream_read(hound_stream_t *stream, void *data, size_t size)
 {
 	assert(stream);
@@ -371,5 +370,5 @@
  * @return Error code.
  */
-errno_t hound_stream_drain(hound_stream_t *stream)
+int hound_stream_drain(hound_stream_t *stream)
 {
 	assert(stream);
@@ -402,5 +401,5 @@
  * @return error code.
  */
-errno_t hound_write_main_stream(hound_context_t *hound,
+int hound_write_main_stream(hound_context_t *hound,
     const void *data, size_t size)
 {
@@ -422,5 +421,5 @@
  * @return error code.
  */
-errno_t hound_read_main_stream(hound_context_t *hound, void *data, size_t size)
+int hound_read_main_stream(hound_context_t *hound, void *data, size_t size)
 {
 	assert(hound);
@@ -442,5 +441,5 @@
  * NOT IMPLEMENTED
  */
-errno_t hound_write_replace_main_stream(hound_context_t *hound,
+int hound_write_replace_main_stream(hound_context_t *hound,
     const void *data, size_t size)
 {
@@ -460,5 +459,5 @@
  * NOT IMPLEMENTED
  */
-errno_t hound_context_set_main_stream_params(hound_context_t *hound,
+int hound_context_set_main_stream_params(hound_context_t *hound,
     pcm_format_t format, size_t bsize)
 {
@@ -479,5 +478,5 @@
  * to drain and destroys it before returning.
  */
-errno_t hound_write_immediate(hound_context_t *hound, pcm_format_t format,
+int hound_write_immediate(hound_context_t *hound, pcm_format_t format,
     const void *data, size_t size)
 {
@@ -488,5 +487,5 @@
 	if (!tmpstream)
 		return ENOMEM;
-	const errno_t ret = hound_stream_write(tmpstream, data, size);
+	const int ret = hound_stream_write(tmpstream, data, size);
 	if (ret == EOK) {
 		//TODO drain?
Index: uspace/lib/hound/src/protocol.c
===================================================================
--- uspace/lib/hound/src/protocol.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/hound/src/protocol.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -93,5 +93,5 @@
 {
 	service_id_t id = 0;
-	const errno_t ret =
+	const int ret =
 	    loc_service_get_id(service, &id, IPC_FLAG_BLOCKING);
 	if (ret != EOK)
@@ -115,11 +115,8 @@
  * @param name Valid string identifier
  * @param record True if the application context wishes to receive data.
- *
- * @param[out] id  Return context ID.
- *
- * @return EOK on success, Error code on failure.
- */
-errno_t hound_service_register_context(hound_sess_t *sess,
-    const char *name, bool record, hound_context_id_t *id)
+ * @return Valid ID on success, Error code on failure.
+ */
+hound_context_id_t hound_service_register_context(hound_sess_t *sess,
+    const char *name, bool record)
 {
 	assert(sess);
@@ -129,5 +126,5 @@
 	aid_t mid =
 	    async_send_1(exch, IPC_M_HOUND_CONTEXT_REGISTER, record, &call);
-	errno_t ret = mid ? EOK : EPARTY;
+	int ret = mid ? EOK : EPARTY;
 
 	if (ret == EOK)
@@ -137,12 +134,8 @@
 
 	if (ret == EOK)
-		async_wait_for(mid, &ret);
+		async_wait_for(mid, (sysarg_t *)&ret);
 
 	async_exchange_end(exch);
-	if (ret == EOK) {
-		*id = (hound_context_id_t)IPC_GET_ARG1(call);
-	}
-
-	return ret;
+	return ret == EOK ? (hound_context_id_t)IPC_GET_ARG1(call) : ret;
 }
 
@@ -153,9 +146,9 @@
  * @return Error code.
  */
-errno_t hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id)
+int hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id)
 {
 	assert(sess);
 	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret =
+	const int ret =
 	    async_req_1_0(exch, IPC_M_HOUND_CONTEXT_UNREGISTER, id);
 	async_exchange_end(exch);
@@ -173,5 +166,5 @@
  * @retval Error code.
  */
-errno_t hound_service_get_list(hound_sess_t *sess, char ***ids, size_t *count,
+int hound_service_get_list(hound_sess_t *sess, const char ***ids, size_t *count,
     int flags, const char *connection)
 {
@@ -189,7 +182,7 @@
 	ipc_call_t res_call;
 	aid_t mid = async_send_3(exch, IPC_M_HOUND_GET_LIST, flags, *count,
-	    connection != NULL, &res_call);
-
-	errno_t ret = EOK;
+	    (bool)connection, &res_call);
+
+	int ret = EOK;
 	if (mid && connection)
 		ret = async_data_write_start(exch, connection,
@@ -197,5 +190,5 @@
 
 	if (ret == EOK)
-		async_wait_for(mid, &ret);
+		async_wait_for(mid, (sysarg_t*)&ret);
 
 	if (ret != EOK) {
@@ -206,5 +199,5 @@
 
 	/* Start receiving names */
-	char **names = NULL;
+	const char **names = NULL;
 	if (name_count) {
 		size_t *sizes = calloc(name_count, sizeof(size_t));
@@ -247,5 +240,5 @@
  * @return Error code.
  */
-errno_t hound_service_connect_source_sink(hound_sess_t *sess, const char *source,
+int hound_service_connect_source_sink(hound_sess_t *sess, const char *source,
     const char *sink)
 {
@@ -259,10 +252,10 @@
 	ipc_call_t call;
 	aid_t id = async_send_0(exch, IPC_M_HOUND_CONNECT, &call);
-	errno_t ret = id ? EOK : EPARTY;
+	int ret = id ? EOK : EPARTY;
 	if (ret == EOK)
 		ret = async_data_write_start(exch, source, str_size(source));
 	if (ret == EOK)
 		ret = async_data_write_start(exch, sink, str_size(sink));
-	async_wait_for(id, &ret);
+	async_wait_for(id, (sysarg_t*)&ret);
 	async_exchange_end(exch);
 	return ret;
@@ -276,5 +269,5 @@
  * @return Error code.
  */
-errno_t hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source,
+int hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source,
     const char *sink)
 {
@@ -285,10 +278,10 @@
 	ipc_call_t call;
 	aid_t id = async_send_0(exch, IPC_M_HOUND_DISCONNECT, &call);
-	errno_t ret = id ? EOK : EPARTY;
+	int ret = id ? EOK : EPARTY;
 	if (ret == EOK)
 		ret = async_data_write_start(exch, source, str_size(source));
 	if (ret == EOK)
 		ret = async_data_write_start(exch, sink, str_size(sink));
-	async_wait_for(id, &ret);
+	async_wait_for(id, (sysarg_t*)&ret);
 	async_exchange_end(exch);
 	return ENOTSUP;
@@ -304,5 +297,5 @@
  * @return Error code.
  */
-errno_t hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id,
+int hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id,
     int flags, pcm_format_t format, size_t bsize)
 {
@@ -321,5 +314,5 @@
  * @return Error code.
  */
-errno_t hound_service_stream_exit(async_exch_t *exch)
+int hound_service_stream_exit(async_exch_t *exch)
 {
 	return async_req_0_0(exch, IPC_M_HOUND_STREAM_EXIT);
@@ -331,5 +324,5 @@
  * @return Error code.
  */
-errno_t hound_service_stream_drain(async_exch_t *exch)
+int hound_service_stream_drain(async_exch_t *exch)
 {
 	return async_req_0_0(exch, IPC_M_HOUND_STREAM_DRAIN);
@@ -343,5 +336,5 @@
  * @return Error code.
  */
-errno_t hound_service_stream_write(async_exch_t *exch, const void *data, size_t size)
+int hound_service_stream_write(async_exch_t *exch, const void *data, size_t size)
 {
 	return async_data_write_start(exch, data, size);
@@ -355,5 +348,5 @@
  * @return Error code.
  */
-errno_t hound_service_stream_read(async_exch_t *exch, void *data, size_t size)
+int hound_service_stream_read(async_exch_t *exch, void *data, size_t size)
 {
 	return async_data_read_start(exch, data, size);
@@ -407,5 +400,5 @@
 
 			/* Get context name */
-			errno_t ret =
+			int ret =
 			    async_data_write_accept(&name, true, 0, 0, 0, 0);
 			if (ret != EOK) {
@@ -434,5 +427,5 @@
 			/* get id, 1st param */
 			hound_context_id_t id = IPC_GET_ARG1(call);
-			const errno_t ret =
+			const int ret =
 			    server_iface->rem_context(server_iface->server, id);
 			async_answer_0(callid, ret);
@@ -446,10 +439,10 @@
 			}
 
-			char **list = NULL;
+			const char **list = NULL;
 			const int flags = IPC_GET_ARG1(call);
 			size_t count = IPC_GET_ARG2(call);
 			const bool conn = IPC_GET_ARG3(call);
 			char *conn_name = NULL;
-			errno_t ret = EOK;
+			int ret = EOK;
 
 			/* get connected actor name if provided */
@@ -513,5 +506,5 @@
 
 			/* read source name */
-			errno_t ret =
+			int ret =
 			    async_data_write_accept(&source, true, 0, 0, 0, 0);
 			/* read sink name */
@@ -539,5 +532,5 @@
 
 			/* read source name */
-			errno_t ret =
+			int ret =
 			    async_data_write_accept(&source, true, 0, 0, 0, 0);
 			/*read sink name */
@@ -574,5 +567,5 @@
 
 			void *stream;
-			errno_t ret = server_iface->add_stream(server_iface->server,
+			int ret = server_iface->add_stream(server_iface->server,
 			    id, flags, f, bsize, &stream);
 			if (ret != EOK) {
@@ -626,5 +619,5 @@
 	ipc_call_t call;
 	size_t size = 0;
-	errno_t ret_answer = EOK;
+	int ret_answer = EOK;
 	/* accept data write or drain */
 	while (async_data_write_receive_call(&callid, &call, &size)
@@ -632,5 +625,5 @@
 		/* check drain first */
 		if (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN) {
-			errno_t ret = ENOTSUP;
+			int ret = ENOTSUP;
 			if (server_iface->drain_stream)
 				ret = server_iface->drain_stream(stream);
@@ -650,5 +643,5 @@
 			continue;
 		}
-		const errno_t ret = async_data_write_finalize(callid, buffer, size);
+		const int ret = async_data_write_finalize(callid, buffer, size);
 		if (ret == EOK) {
 			/* push data to stream */
@@ -657,5 +650,5 @@
 		}
 	}
-	const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT
+	const int ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT
 	    ? EOK : EINVAL;
 
@@ -673,5 +666,5 @@
 	ipc_call_t call;
 	size_t size = 0;
-	errno_t ret_answer = EOK;
+	int ret_answer = EOK;
 	/* accept data read and drain */
 	while (async_data_read_receive_call(&callid, &call, &size)
@@ -679,5 +672,5 @@
 		/* drain does not make much sense but it is allowed */
 		if (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN) {
-			errno_t ret = ENOTSUP;
+			int ret = ENOTSUP;
 			if (server_iface->drain_stream)
 				ret = server_iface->drain_stream(stream);
@@ -695,5 +688,5 @@
 			continue;
 		}
-		errno_t ret = server_iface->stream_data_read(stream, buffer, size);
+		int ret = server_iface->stream_data_read(stream, buffer, size);
 		if (ret == EOK) {
 			ret_answer =
@@ -701,5 +694,5 @@
 		}
 	}
-	const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT
+	const int ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT
 	    ? EOK : EINVAL;
 
@@ -718,10 +711,10 @@
  * @return Error code.
  */
-errno_t hound_server_register(const char *name, service_id_t *id)
+int hound_server_register(const char *name, service_id_t *id)
 {
 	if (!name || !id)
 		return EINVAL;
 
-	errno_t ret = loc_server_register(name);
+	int ret = loc_server_register(name);
 	if (ret != EOK)
 		return ret;
@@ -744,5 +737,5 @@
  * @return Error code.
  */
-errno_t hound_server_set_device_change_callback(dev_change_callback_t cb)
+int hound_server_set_device_change_callback(dev_change_callback_t cb)
 {
 	return loc_register_cat_change_cb(cb);
@@ -754,5 +747,5 @@
  * @return Error code.
  */
-errno_t hound_server_devices_iterate(device_callback_t callback)
+int hound_server_devices_iterate(device_callback_t callback)
 {
 	if (!callback)
@@ -762,5 +755,5 @@
 
 	if (!resolved) {
-		const errno_t ret = loc_category_get_id("audio-pcm", &cat_id,
+		const int ret = loc_category_get_id("audio-pcm", &cat_id,
 		    IPC_FLAG_BLOCKING);
 		if (ret != EOK)
@@ -771,5 +764,5 @@
 	service_id_t *svcs = NULL;
 	size_t count = 0;
-	const errno_t ret = loc_category_get_svcs(cat_id, &svcs, &count);
+	const int ret = loc_category_get_svcs(cat_id, &svcs, &count);
 	if (ret != EOK)
 		return ret;
Index: uspace/lib/http/include/http/errno.h
===================================================================
--- uspace/lib/http/include/http/errno.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/http/include/http/errno.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2013 Martin Sucha
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup http
+ * @{
+ */
+/**
+ * @file
+ */
+
+#ifndef HTTP_ERRNO_H_
+#define HTTP_ERRNO_H_
+
+#include <errno.h>
+
+#define HTTP_EMULTIPLE_HEADERS -20001
+#define HTTP_EMISSING_HEADER -20002
+#define HTTP_EPARSE -20003
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/http/include/http/http.h
===================================================================
--- uspace/lib/http/include/http/http.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/http/include/http/http.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -84,12 +84,12 @@
 
 extern http_t *http_create(const char *, uint16_t);
-extern errno_t http_connect(http_t *);
+extern int http_connect(http_t *);
 
 extern void http_header_init(http_header_t *);
 extern http_header_t *http_header_create(const char *, const char *);
-extern errno_t http_header_receive_name(receive_buffer_t *, receive_buffer_mark_t *);
-extern errno_t http_header_receive_value(receive_buffer_t *, receive_buffer_mark_t *,
+extern int http_header_receive_name(receive_buffer_t *, receive_buffer_mark_t *);
+extern int http_header_receive_value(receive_buffer_t *, receive_buffer_mark_t *,
     receive_buffer_mark_t *);
-extern errno_t http_header_receive(receive_buffer_t *, http_header_t *, size_t,
+extern int http_header_receive(receive_buffer_t *, http_header_t *, size_t,
     size_t *);
 extern void http_header_normalize_value(char *);
@@ -99,10 +99,10 @@
 
 extern void http_headers_init(http_headers_t *);
-extern errno_t http_headers_find_single(http_headers_t *, const char *,
+extern int http_headers_find_single(http_headers_t *, const char *,
     http_header_t **);
-extern errno_t http_headers_append(http_headers_t *, const char *, const char *);
-extern errno_t http_headers_set(http_headers_t *, const char *, const char *);
-extern errno_t http_headers_get(http_headers_t *, const char *, char **);
-extern errno_t http_headers_receive(receive_buffer_t *, http_headers_t *, size_t,
+extern int http_headers_append(http_headers_t *, const char *, const char *);
+extern int http_headers_set(http_headers_t *, const char *, const char *);
+extern int http_headers_get(http_headers_t *, const char *, char **);
+extern int http_headers_receive(receive_buffer_t *, http_headers_t *, size_t,
     unsigned);
 extern void http_headers_clear(http_headers_t *);
@@ -125,12 +125,12 @@
 extern http_request_t *http_request_create(const char *, const char *);
 extern void http_request_destroy(http_request_t *);
-extern errno_t http_request_format(http_request_t *, char **, size_t *);
-extern errno_t http_send_request(http_t *, http_request_t *);
-extern errno_t http_receive_status(receive_buffer_t *, http_version_t *, uint16_t *,
+extern int http_request_format(http_request_t *, char **, size_t *);
+extern int http_send_request(http_t *, http_request_t *);
+extern int http_receive_status(receive_buffer_t *, http_version_t *, uint16_t *,
     char **);
-extern errno_t http_receive_response(receive_buffer_t *, http_response_t **,
+extern int http_receive_response(receive_buffer_t *, http_response_t **,
     size_t, unsigned);
 extern void http_response_destroy(http_response_t *);
-extern errno_t http_close(http_t *);
+extern int http_close(http_t *);
 extern void http_destroy(http_t *);
 
Index: uspace/lib/http/include/http/receive-buffer.h
===================================================================
--- uspace/lib/http/include/http/receive-buffer.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/http/include/http/receive-buffer.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,7 +47,7 @@
  * @param buf_size buffer size
  * @param nrecv number of bytes actually received
- * @return EOK on success or an error code
+ * @return EOK on success or error code
  */
-typedef errno_t (*receive_func_t)(void *, void *, size_t, size_t *);
+typedef int (*receive_func_t)(void *, void *, size_t, size_t *);
 
 typedef struct {
@@ -70,6 +70,6 @@
 typedef bool (*char_class_func_t)(char);
 
-extern errno_t recv_buffer_init(receive_buffer_t *, size_t, receive_func_t, void *);
-extern errno_t recv_buffer_init_const(receive_buffer_t *, void *, size_t);
+extern int recv_buffer_init(receive_buffer_t *, size_t, receive_func_t, void *);
+extern int recv_buffer_init_const(receive_buffer_t *, void *, size_t);
 extern void recv_buffer_fini(receive_buffer_t *);
 extern void recv_reset(receive_buffer_t *);
@@ -77,15 +77,15 @@
 extern void recv_unmark(receive_buffer_t *, receive_buffer_mark_t *);
 extern void recv_mark_update(receive_buffer_t *, receive_buffer_mark_t *);
-extern errno_t recv_cut(receive_buffer_t *, receive_buffer_mark_t *,
+extern int recv_cut(receive_buffer_t *, receive_buffer_mark_t *,
     receive_buffer_mark_t *, void **, size_t *);
-extern errno_t recv_cut_str(receive_buffer_t *, receive_buffer_mark_t *,
+extern int recv_cut_str(receive_buffer_t *, receive_buffer_mark_t *,
     receive_buffer_mark_t *, char **);
-extern errno_t recv_char(receive_buffer_t *, char *, bool);
-extern errno_t recv_buffer(receive_buffer_t *, char *, size_t, size_t *);
-extern errno_t recv_discard(receive_buffer_t *, char, size_t *);
-extern errno_t recv_discard_str(receive_buffer_t *, const char *, size_t *);
-extern errno_t recv_while(receive_buffer_t *, char_class_func_t);
-extern errno_t recv_eol(receive_buffer_t *, size_t *);
-extern errno_t recv_line(receive_buffer_t *, char *, size_t, size_t *);
+extern int recv_char(receive_buffer_t *, char *, bool);
+extern int recv_buffer(receive_buffer_t *, char *, size_t, size_t *);
+extern int recv_discard(receive_buffer_t *, char, size_t *);
+extern int recv_discard_str(receive_buffer_t *, const char *, size_t *);
+extern int recv_while(receive_buffer_t *, char_class_func_t);
+extern int recv_eol(receive_buffer_t *, size_t *);
+extern int recv_line(receive_buffer_t *, char *, size_t, size_t *);
 
 #endif
Index: uspace/lib/http/src/headers.c
===================================================================
--- uspace/lib/http/src/headers.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/http/src/headers.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,5 +34,4 @@
  */
 
-#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -42,4 +41,5 @@
 #include <http/http.h>
 #include <http/ctype.h>
+#include <http/errno.h>
 
 #define HTTP_HEADER_LINE "%s: %s\r\n"
@@ -94,5 +94,5 @@
 }
 
-errno_t http_header_receive_name(receive_buffer_t *rb,
+int http_header_receive_name(receive_buffer_t *rb,
     receive_buffer_mark_t *name_end)
 {
@@ -102,5 +102,5 @@
 			recv_mark_update(rb, name_end);
 		
-		errno_t rc = recv_char(rb, &c, true);
+		int rc = recv_char(rb, &c, true);
 		if (rc != EOK)
 			return rc;
@@ -113,8 +113,8 @@
 }
 
-errno_t http_header_receive_value(receive_buffer_t *rb,
+int http_header_receive_value(receive_buffer_t *rb,
     receive_buffer_mark_t *value_start, receive_buffer_mark_t *value_end)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	char c = 0;
 	
@@ -167,5 +167,5 @@
 }
 
-errno_t http_header_receive(receive_buffer_t *rb, http_header_t *header,
+int http_header_receive(receive_buffer_t *rb, http_header_t *header,
     size_t size_limit, size_t *out_bytes_used)
 {
@@ -176,5 +176,5 @@
 	recv_mark(rb, &mark_end);
 	
-	errno_t rc = http_header_receive_name(rb, &mark_end);
+	int rc = http_header_receive_name(rb, &mark_end);
 	if (rc != EOK)
 		goto end;
@@ -259,5 +259,5 @@
 }
 
-errno_t http_headers_find_single(http_headers_t *headers, const char *name,
+int http_headers_find_single(http_headers_t *headers, const char *name,
     http_header_t **out_header)
 {
@@ -282,5 +282,5 @@
 }
 
-errno_t http_headers_append(http_headers_t *headers, const char *name,
+int http_headers_append(http_headers_t *headers, const char *name,
     const char *value)
 {
@@ -293,9 +293,9 @@
 }
 
-errno_t http_headers_set(http_headers_t *headers, const char *name,
+int http_headers_set(http_headers_t *headers, const char *name,
     const char *value)
 {
 	http_header_t *header = NULL;
-	errno_t rc = http_headers_find_single(headers, name, &header);
+	int rc = http_headers_find_single(headers, name, &header);
 	if (rc != EOK && rc != HTTP_EMISSING_HEADER)
 		return rc;
@@ -313,8 +313,8 @@
 }
 
-errno_t http_headers_get(http_headers_t *headers, const char *name, char **value)
+int http_headers_get(http_headers_t *headers, const char *name, char **value)
 {
 	http_header_t *header = NULL;
-	errno_t rc = http_headers_find_single(headers, name, &header);
+	int rc = http_headers_find_single(headers, name, &header);
 	if (rc != EOK)
 		return rc;
@@ -324,8 +324,8 @@
 }
 
-errno_t http_headers_receive(receive_buffer_t *rb, http_headers_t *headers,
+int http_headers_receive(receive_buffer_t *rb, http_headers_t *headers,
     size_t limit_alloc, unsigned limit_count)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	unsigned added = 0;
 	
Index: uspace/lib/http/src/http.c
===================================================================
--- uspace/lib/http/src/http.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/http/src/http.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 #include <http/receive-buffer.h>
 
-static errno_t http_receive(void *client_data, void *buf, size_t buf_size,
+static int http_receive(void *client_data, void *buf, size_t buf_size,
     size_t *nrecv)
 {
@@ -69,5 +69,5 @@
 	
 	http->buffer_size = 4096;
-	errno_t rc = recv_buffer_init(&http->recv_buffer, http->buffer_size,
+	int rc = recv_buffer_init(&http->recv_buffer, http->buffer_size,
 	    http_receive, http);
 	if (rc != EOK) {
@@ -79,10 +79,10 @@
 }
 
-errno_t http_connect(http_t *http)
+int http_connect(http_t *http)
 {
 	if (http->conn != NULL)
 		return EBUSY;
 	
-	errno_t rc = inet_host_plookup_one(http->host, ip_any, &http->addr, NULL,
+	int rc = inet_host_plookup_one(http->host, ip_any, &http->addr, NULL,
 	    NULL);
 	if (rc != EOK)
@@ -110,5 +110,5 @@
 }
 
-errno_t http_close(http_t *http)
+int http_close(http_t *http)
 {
 	if (http->conn == NULL)
Index: uspace/lib/http/src/receive-buffer.c
===================================================================
--- uspace/lib/http/src/receive-buffer.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/http/src/receive-buffer.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 #include <http/receive-buffer.h>
 
-errno_t recv_buffer_init(receive_buffer_t *rb, size_t buffer_size,
+int recv_buffer_init(receive_buffer_t *rb, size_t buffer_size,
     receive_func_t receive, void *client_data)
 {
@@ -61,5 +61,5 @@
 }
 
-static errno_t dummy_receive(void *unused, void *buf, size_t buf_size,
+static int dummy_receive(void *unused, void *buf, size_t buf_size,
     size_t *nrecv)
 {
@@ -68,7 +68,7 @@
 }
 
-errno_t recv_buffer_init_const(receive_buffer_t *rb, void *buf, size_t size)
-{
-	errno_t rc = recv_buffer_init(rb, size, dummy_receive, NULL);
+int recv_buffer_init_const(receive_buffer_t *rb, void *buf, size_t size)
+{
+	int rc = recv_buffer_init(rb, size, dummy_receive, NULL);
 	if (rc != EOK)
 		return rc;
@@ -107,5 +107,5 @@
 }
 
-errno_t recv_cut(receive_buffer_t *rb, receive_buffer_mark_t *a, receive_buffer_mark_t *b, void **out_buf, size_t *out_size)
+int recv_cut(receive_buffer_t *rb, receive_buffer_mark_t *a, receive_buffer_mark_t *b, void **out_buf, size_t *out_size)
 {
 	if (a->offset > b->offset)
@@ -123,5 +123,5 @@
 }
 
-errno_t recv_cut_str(receive_buffer_t *rb, receive_buffer_mark_t *a, receive_buffer_mark_t *b, char **out_buf)
+int recv_cut_str(receive_buffer_t *rb, receive_buffer_mark_t *a, receive_buffer_mark_t *b, char **out_buf)
 {
 	if (a->offset > b->offset)
@@ -147,5 +147,5 @@
 
 /** Receive one character (with buffering) */
-errno_t recv_char(receive_buffer_t *rb, char *c, bool consume)
+int recv_char(receive_buffer_t *rb, char *c, bool consume)
 {
 	if (rb->out == rb->in) {
@@ -170,5 +170,5 @@
 		
 		size_t nrecv;
-		errno_t rc = rb->receive(rb->client_data, rb->buffer + rb->in, free, &nrecv);
+		int rc = rb->receive(rb->client_data, rb->buffer + rb->in, free, &nrecv);
 		if (rc != EOK)
 			return rc;
@@ -183,5 +183,5 @@
 }
 
-errno_t recv_buffer(receive_buffer_t *rb, char *buf, size_t buf_size,
+int recv_buffer(receive_buffer_t *rb, char *buf, size_t buf_size,
     size_t *nrecv)
 {
@@ -200,10 +200,10 @@
 /** Receive a character and if it is c, discard it from input buffer
  * @param ndisc Place to store number of characters discarded
- * @return EOK or an error code
- */
-errno_t recv_discard(receive_buffer_t *rb, char discard, size_t *ndisc)
+ * @return EOK or error code
+ */
+int recv_discard(receive_buffer_t *rb, char discard, size_t *ndisc)
 {
 	char c = 0;
-	errno_t rc = recv_char(rb, &c, false);
+	int rc = recv_char(rb, &c, false);
 	if (rc != EOK)
 		return rc;
@@ -221,12 +221,12 @@
 /** Receive a prefix of constant string discard and return number of bytes read
  * @param ndisc Place to store number of characters discarded
- * @return EOK or an error code
- */
-errno_t recv_discard_str(receive_buffer_t *rb, const char *discard, size_t *ndisc)
+ * @return EOK or error code
+ */
+int recv_discard_str(receive_buffer_t *rb, const char *discard, size_t *ndisc)
 {
 	size_t discarded = 0;
 	while (*discard) {
 		size_t nd;
-		errno_t rc = recv_discard(rb, *discard, &nd);
+		int rc = recv_discard(rb, *discard, &nd);
 		if (rc != EOK)
 			return rc;
@@ -241,9 +241,9 @@
 }
 
-errno_t recv_while(receive_buffer_t *rb, char_class_func_t class)
+int recv_while(receive_buffer_t *rb, char_class_func_t class)
 {
 	while (true) {
 		char c = 0;
-		errno_t rc = recv_char(rb, &c, false);
+		int rc = recv_char(rb, &c, false);
 		if (rc != EOK)
 			return rc;
@@ -264,10 +264,10 @@
  * @param nrecv Place to store number of bytes received (zero if
  *              no newline is present in the stream)
- * @return EOK on success or an error code
- */
-errno_t recv_eol(receive_buffer_t *rb, size_t *nrecv)
+ * @return EOK on success or error code
+ */
+int recv_eol(receive_buffer_t *rb, size_t *nrecv)
 {
 	char c = 0;
-	errno_t rc = recv_char(rb, &c, false);
+	int rc = recv_char(rb, &c, false);
 	if (rc != EOK)
 		return rc;
@@ -292,5 +292,5 @@
 
 /* Receive a single line */
-errno_t recv_line(receive_buffer_t *rb, char *line, size_t size, size_t *nrecv)
+int recv_line(receive_buffer_t *rb, char *line, size_t size, size_t *nrecv)
 {
 	size_t written = 0;
@@ -299,5 +299,5 @@
 	while (written < size) {
 		char c = 0;
-		errno_t rc = recv_char(rb, &c, true);
+		int rc = recv_char(rb, &c, true);
 		if (rc != EOK)
 			return rc;
Index: uspace/lib/http/src/request.c
===================================================================
--- uspace/lib/http/src/request.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/http/src/request.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -90,5 +90,5 @@
 }
 
-errno_t http_request_format(http_request_t *req, char **out_buf,
+int http_request_format(http_request_t *req, char **out_buf,
     size_t *out_buf_size)
 {
@@ -96,5 +96,5 @@
 	ssize_t meth_size = http_encode_method(NULL, 0, req->method, req->path);
 	if (meth_size < 0)
-		return EINVAL;
+		return meth_size;
 	size_t size = meth_size;
 	
@@ -102,5 +102,5 @@
 		ssize_t header_size = http_header_encode(header, NULL, 0);
 		if (header_size < 0)
-			return EINVAL;
+			return header_size;
 		size += header_size;
 	}
@@ -116,5 +116,5 @@
 	if (written < 0) {
 		free(buf);
-		return EINVAL;
+		return written;
 	}
 	pos += written;
@@ -125,5 +125,5 @@
 		if (written < 0) {
 			free(buf);
-			return EINVAL;
+			return written;
 		}
 		pos += written;
@@ -141,10 +141,10 @@
 }
 
-errno_t http_send_request(http_t *http, http_request_t *req)
+int http_send_request(http_t *http, http_request_t *req)
 {
 	char *buf = NULL;
 	size_t buf_size = 0;
 	
-	errno_t rc = http_request_format(req, &buf, &buf_size);
+	int rc = http_request_format(req, &buf, &buf_size);
 	if (rc != EOK)
 		return rc;
Index: uspace/lib/http/src/response.c
===================================================================
--- uspace/lib/http/src/response.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/http/src/response.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,5 +34,4 @@
  */
 
-#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -41,4 +40,5 @@
 
 #include <http/http.h>
+#include <http/errno.h>
 
 static bool is_digit(char c)
@@ -47,5 +47,5 @@
 }
 
-static errno_t receive_number(receive_buffer_t *rb, char **str)
+static int receive_number(receive_buffer_t *rb, char **str)
 {
 	receive_buffer_mark_t start;
@@ -53,6 +53,6 @@
 	
 	recv_mark(rb, &start);
-	errno_t rc = recv_while(rb, is_digit);
-	if (rc != EOK) {
+	int rc = recv_while(rb, is_digit);
+	if (rc < 0) {
 		recv_unmark(rb, &start);
 		return rc;
@@ -66,8 +66,8 @@
 }
 
-static errno_t receive_uint8_t(receive_buffer_t *rb, uint8_t *out_value)
+static int receive_uint8_t(receive_buffer_t *rb, uint8_t *out_value)
 {
 	char *str = NULL;
-	errno_t rc = receive_number(rb, &str);
+	int rc = receive_number(rb, &str);
 	
 	if (rc != EOK)
@@ -80,8 +80,8 @@
 }
 
-static errno_t receive_uint16_t(receive_buffer_t *rb, uint16_t *out_value)
+static int receive_uint16_t(receive_buffer_t *rb, uint16_t *out_value)
 {
 	char *str = NULL;
-	errno_t rc = receive_number(rb, &str);
+	int rc = receive_number(rb, &str);
 	
 	if (rc != EOK)
@@ -94,8 +94,8 @@
 }
 
-static errno_t expect(receive_buffer_t *rb, const char *expect)
+static int expect(receive_buffer_t *rb, const char *expect)
 {
 	size_t ndisc;
-	errno_t rc = recv_discard_str(rb, expect, &ndisc);
+	int rc = recv_discard_str(rb, expect, &ndisc);
 	if (rc != EOK)
 		return rc;
@@ -110,5 +110,5 @@
 }
 
-errno_t http_receive_status(receive_buffer_t *rb, http_version_t *out_version,
+int http_receive_status(receive_buffer_t *rb, http_version_t *out_version,
     uint16_t *out_status, char **out_message)
 {
@@ -117,5 +117,5 @@
 	char *message = NULL;
 	
-	errno_t rc = expect(rb, "HTTP/");
+	int rc = expect(rb, "HTTP/");
 	if (rc != EOK)
 		return rc;
@@ -149,5 +149,5 @@
 	
 	rc = recv_while(rb, is_not_newline);
-	if (rc != EOK) {
+	if (rc < 0) {
 		recv_unmark(rb, &msg_start);
 		return rc;
@@ -187,5 +187,5 @@
 }
 
-errno_t http_receive_response(receive_buffer_t *rb, http_response_t **out_response,
+int http_receive_response(receive_buffer_t *rb, http_response_t **out_response,
     size_t max_headers_size, unsigned max_headers_count)
 {
@@ -196,5 +196,5 @@
 	http_headers_init(&resp->headers);
 	
-	errno_t rc = http_receive_status(rb, &resp->version, &resp->status,
+	int rc = http_receive_status(rb, &resp->version, &resp->status,
 	    &resp->message);
 	if (rc != EOK)
Index: uspace/lib/ieee80211/include/ieee80211.h
===================================================================
--- uspace/lib/ieee80211/include/ieee80211.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ieee80211/include/ieee80211.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -103,8 +103,8 @@
 	 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
 	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*start)(struct ieee80211_dev *);
+	 * @return EOK if succeed, negative error code otherwise.
+	 *
+	 */
+	int (*start)(struct ieee80211_dev *);
 	
 	/** Scan neighborhood for networks.
@@ -115,8 +115,8 @@
 	 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
 	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*scan)(struct ieee80211_dev *);
+	 * @return EOK if succeed, negative error code otherwise.
+	 *
+	 */
+	int (*scan)(struct ieee80211_dev *);
 	
 	/** Handler for TX frames to be send from device.
@@ -129,8 +129,8 @@
 	 * @param buffer_size   Size of buffer.
 	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*tx_handler)(struct ieee80211_dev *, void *, size_t);
+	 * @return EOK if succeed, negative error code otherwise.
+	 *
+	 */
+	int (*tx_handler)(struct ieee80211_dev *, void *, size_t);
 	
 	/** Set device operating frequency to given value.
@@ -139,8 +139,8 @@
 	 * @param freq          New device operating frequency.
 	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*set_freq)(struct ieee80211_dev *, uint16_t);
+	 * @return EOK if succeed, negative error code otherwise.
+	 *
+	 */
+	int (*set_freq)(struct ieee80211_dev *, uint16_t);
 	
 	/** Callback to inform device about BSSID change.
@@ -149,8 +149,8 @@
 	 * @param connected     True if connected to new BSSID, otherwise false.
 	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*bssid_change)(struct ieee80211_dev *, bool);
+	 * @return EOK if succeed, negative error code otherwise.
+	 *
+	 */
+	int (*bssid_change)(struct ieee80211_dev *, bool);
 	
 	/** Callback to setup encryption key in IEEE 802.11 device.
@@ -161,8 +161,8 @@
 	 *                      false to remove it.
 	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*key_config)(struct ieee80211_dev *,
+	 * @return EOK if succeed, negative error code otherwise.
+	 *
+	 */
+	int (*key_config)(struct ieee80211_dev *,
 	    ieee80211_key_config_t *key_conf, bool);
 } ieee80211_ops_t;
@@ -170,6 +170,6 @@
 /* Initialization functions. */
 extern ieee80211_dev_t *ieee80211_device_create(void);
-extern errno_t ieee80211_device_init(ieee80211_dev_t *, ddf_dev_t *);
-extern errno_t ieee80211_init(ieee80211_dev_t *, ieee80211_ops_t *,
+extern int ieee80211_device_init(ieee80211_dev_t *, ddf_dev_t *);
+extern int ieee80211_init(ieee80211_dev_t *, ieee80211_ops_t *,
     ieee80211_iface_t *, nic_iface_t *, ddf_dev_ops_t *);
 
@@ -201,5 +201,5 @@
 
 /* Worker functions. */
-extern errno_t ieee80211_rx_handler(ieee80211_dev_t *, void *, size_t);
+extern int ieee80211_rx_handler(ieee80211_dev_t *, void *, size_t);
 
 #endif
Index: uspace/lib/ieee80211/include/ieee80211_iface_impl.h
===================================================================
--- uspace/lib/ieee80211/include/ieee80211_iface_impl.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ieee80211/include/ieee80211_iface_impl.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,8 +43,8 @@
 #include "ieee80211.h"
 
-extern errno_t ieee80211_get_scan_results_impl(ddf_fun_t *,
+extern int ieee80211_get_scan_results_impl(ddf_fun_t *,
     ieee80211_scan_results_t *, bool);
-extern errno_t ieee80211_connect_impl(ddf_fun_t *, char *, char *);
-extern errno_t ieee80211_disconnect_impl(ddf_fun_t *);
+extern int ieee80211_connect_impl(ddf_fun_t *, char *, char *);
+extern int ieee80211_disconnect_impl(ddf_fun_t *);
 
 #endif  /* LIB_IEEE80211_IFACE_IMPL_H */
Index: uspace/lib/ieee80211/include/ieee80211_impl.h
===================================================================
--- uspace/lib/ieee80211/include/ieee80211_impl.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ieee80211/include/ieee80211_impl.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,20 +42,20 @@
 #include "ieee80211_private.h"
 
-extern errno_t ieee80211_start_impl(ieee80211_dev_t *);
-extern errno_t ieee80211_tx_handler_impl(ieee80211_dev_t *, void *, size_t);
-extern errno_t ieee80211_set_freq_impl(ieee80211_dev_t *, uint16_t);
-extern errno_t ieee80211_bssid_change_impl(ieee80211_dev_t *, bool);
-extern errno_t ieee80211_key_config_impl(ieee80211_dev_t *,
+extern int ieee80211_start_impl(ieee80211_dev_t *);
+extern int ieee80211_tx_handler_impl(ieee80211_dev_t *, void *, size_t);
+extern int ieee80211_set_freq_impl(ieee80211_dev_t *, uint16_t);
+extern int ieee80211_bssid_change_impl(ieee80211_dev_t *, bool);
+extern int ieee80211_key_config_impl(ieee80211_dev_t *,
     ieee80211_key_config_t *, bool);
-extern errno_t ieee80211_scan_impl(ieee80211_dev_t *);
-extern errno_t ieee80211_prf(uint8_t *, uint8_t *, uint8_t *, size_t);
-extern errno_t ieee80211_rc4_key_unwrap(uint8_t *, uint8_t *, size_t, uint8_t *);
-extern errno_t ieee80211_aes_key_unwrap(uint8_t *, uint8_t *, size_t, uint8_t *);
-extern errno_t ieee80211_michael_mic(uint8_t *, uint8_t *, size_t, uint8_t *);
+extern int ieee80211_scan_impl(ieee80211_dev_t *);
+extern int ieee80211_prf(uint8_t *, uint8_t *, uint8_t *, size_t);
+extern int ieee80211_rc4_key_unwrap(uint8_t *, uint8_t *, size_t, uint8_t *);
+extern int ieee80211_aes_key_unwrap(uint8_t *, uint8_t *, size_t, uint8_t *);
+extern int ieee80211_michael_mic(uint8_t *, uint8_t *, size_t, uint8_t *);
 extern uint16_t uint16le_from_seq(void *);
 extern uint32_t uint32le_from_seq(void *);
 extern uint16_t uint16be_from_seq(void *);
 extern uint32_t uint32be_from_seq(void *);
-extern errno_t rnd_sequence(uint8_t *, size_t);
+extern int rnd_sequence(uint8_t *, size_t);
 extern uint8_t *min_sequence(uint8_t *, uint8_t *, size_t);
 extern uint8_t *max_sequence(uint8_t *, uint8_t *, size_t);
Index: uspace/lib/ieee80211/include/ieee80211_private.h
===================================================================
--- uspace/lib/ieee80211/include/ieee80211_private.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ieee80211/include/ieee80211_private.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -410,8 +410,8 @@
 extern ieee80211_auth_phase_t ieee80211_get_auth_phase(ieee80211_dev_t *);
 extern void ieee80211_set_auth_phase(ieee80211_dev_t *, ieee80211_auth_phase_t);
-extern errno_t ieee80211_probe_request(ieee80211_dev_t *, char *);
-extern errno_t ieee80211_authenticate(ieee80211_dev_t *);
-extern errno_t ieee80211_associate(ieee80211_dev_t *, char *);
-extern errno_t ieee80211_deauthenticate(ieee80211_dev_t *);
+extern int ieee80211_probe_request(ieee80211_dev_t *, char *);
+extern int ieee80211_authenticate(ieee80211_dev_t *);
+extern int ieee80211_associate(ieee80211_dev_t *, char *);
+extern int ieee80211_deauthenticate(ieee80211_dev_t *);
 
 #endif
Index: uspace/lib/ieee80211/src/ieee80211.c
===================================================================
--- uspace/lib/ieee80211/src/ieee80211.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ieee80211/src/ieee80211.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -496,5 +496,5 @@
 }
 
-static errno_t ieee80211_scan(void *arg)
+static int ieee80211_scan(void *arg)
 {
 	assert(arg);
@@ -514,8 +514,8 @@
  * @param fun NIC function.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ieee80211_open(ddf_fun_t *fun)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+static int ieee80211_open(ddf_fun_t *fun)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
@@ -527,5 +527,5 @@
 	ieee80211_dev->started = true;
 	
-	errno_t rc = ieee80211_dev->ops->start(ieee80211_dev);
+	int rc = ieee80211_dev->ops->start(ieee80211_dev);
 	if (rc != EOK)
 		return rc;
@@ -655,5 +655,5 @@
  *
  */
-static errno_t ieee80211_implement(ieee80211_dev_t *ieee80211_dev,
+static int ieee80211_implement(ieee80211_dev_t *ieee80211_dev,
     ieee80211_ops_t *ieee80211_ops, ieee80211_iface_t *ieee80211_iface,
     nic_iface_t *nic_iface, ddf_dev_ops_t *nic_dev_ops)
@@ -728,8 +728,8 @@
  * @param ddf_dev       Pointer to backing DDF device structure.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_device_init(ieee80211_dev_t *ieee80211_dev, ddf_dev_t *ddf_dev)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int ieee80211_device_init(ieee80211_dev_t *ieee80211_dev, ddf_dev_t *ddf_dev)
 {
 	ieee80211_dev->ddf_dev = ddf_dev;
@@ -768,12 +768,12 @@
  *                        interface operations.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_init(ieee80211_dev_t *ieee80211_dev,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int ieee80211_init(ieee80211_dev_t *ieee80211_dev,
     ieee80211_ops_t *ieee80211_ops, ieee80211_iface_t *ieee80211_iface,
     nic_iface_t *ieee80211_nic_iface, ddf_dev_ops_t *ieee80211_nic_dev_ops)
 {
-	errno_t rc = ieee80211_implement(ieee80211_dev,
+	int rc = ieee80211_implement(ieee80211_dev,
 	    ieee80211_ops, ieee80211_iface,
 	    ieee80211_nic_iface, ieee80211_nic_dev_ops);
@@ -847,8 +847,8 @@
  * @param ssid          Probing SSID or NULL if broadcast.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_probe_request(ieee80211_dev_t *ieee80211_dev, char *ssid)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int ieee80211_probe_request(ieee80211_dev_t *ieee80211_dev, char *ssid)
 {
 	nic_t *nic = nic_get_from_ddf_dev(ieee80211_dev->ddf_dev);
@@ -914,8 +914,8 @@
  * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_authenticate(ieee80211_dev_t *ieee80211_dev)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int ieee80211_authenticate(ieee80211_dev_t *ieee80211_dev)
 {
 	nic_t *nic = nic_get_from_ddf_dev(ieee80211_dev->ddf_dev);
@@ -964,8 +964,8 @@
  *                      or NULL for open networks.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_associate(ieee80211_dev_t *ieee80211_dev, char *password)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int ieee80211_associate(ieee80211_dev_t *ieee80211_dev, char *password)
 {
 	nic_t *nic = nic_get_from_ddf_dev(ieee80211_dev->ddf_dev);
@@ -1054,8 +1054,8 @@
  * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_deauthenticate(ieee80211_dev_t *ieee80211_dev)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int ieee80211_deauthenticate(ieee80211_dev_t *ieee80211_dev)
 {
 	ieee80211_scan_result_t *auth_data =
@@ -1238,8 +1238,8 @@
  * @param mgmt_header   Pointer to start of management frame header.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ieee80211_process_probe_response(ieee80211_dev_t *ieee80211_dev,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+static int ieee80211_process_probe_response(ieee80211_dev_t *ieee80211_dev,
     ieee80211_mgmt_header_t *mgmt_header, size_t buffer_size)
 {
@@ -1324,8 +1324,8 @@
  * @param mgmt_header   Pointer to start of management frame header.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ieee80211_process_auth_response(ieee80211_dev_t *ieee80211_dev,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+static int ieee80211_process_auth_response(ieee80211_dev_t *ieee80211_dev,
     ieee80211_mgmt_header_t *mgmt_header)
 {
@@ -1353,8 +1353,8 @@
  * @param mgmt_header   Pointer to start of management frame header.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ieee80211_process_assoc_response(ieee80211_dev_t *ieee80211_dev,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+static int ieee80211_process_assoc_response(ieee80211_dev_t *ieee80211_dev,
     ieee80211_mgmt_header_t *mgmt_header)
 {
@@ -1381,5 +1381,5 @@
 }
 
-static errno_t ieee80211_process_4way_handshake(ieee80211_dev_t *ieee80211_dev,
+static int ieee80211_process_4way_handshake(ieee80211_dev_t *ieee80211_dev,
     void *buffer, size_t buffer_size)
 {
@@ -1491,5 +1491,5 @@
 			    (buffer + sizeof(ieee80211_eapol_key_frame_t));
 			
-			errno_t rc;
+			int rc;
 			uint8_t work_key[32];
 			
@@ -1610,5 +1610,5 @@
 }
 
-static errno_t ieee80211_process_eapol_frame(ieee80211_dev_t *ieee80211_dev,
+static int ieee80211_process_eapol_frame(ieee80211_dev_t *ieee80211_dev,
     void *buffer, size_t buffer_size)
 {
@@ -1629,8 +1629,8 @@
  * @param buffer_size   Size of buffer.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ieee80211_process_data(ieee80211_dev_t *ieee80211_dev,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+static int ieee80211_process_data(ieee80211_dev_t *ieee80211_dev,
     void *buffer, size_t buffer_size)
 {
@@ -1693,8 +1693,8 @@
  * @param buffer_size   Size of buffer.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_rx_handler(ieee80211_dev_t *ieee80211_dev, void *buffer,
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int ieee80211_rx_handler(ieee80211_dev_t *ieee80211_dev, void *buffer,
     size_t buffer_size)
 {
Index: uspace/lib/ieee80211/src/ieee80211_iface_impl.c
===================================================================
--- uspace/lib/ieee80211/src/ieee80211_iface_impl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ieee80211/src/ieee80211_iface_impl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
  *
  */
-errno_t ieee80211_get_scan_results_impl(ddf_fun_t *fun,
+int ieee80211_get_scan_results_impl(ddf_fun_t *fun,
     ieee80211_scan_results_t *results, bool now)
 {
@@ -98,5 +98,5 @@
  *
  */
-static errno_t ieee80211_connect_proc(ieee80211_dev_t *ieee80211_dev,
+static int ieee80211_connect_proc(ieee80211_dev_t *ieee80211_dev,
     ieee80211_scan_result_link_t *auth_data, char *password)
 {
@@ -104,5 +104,5 @@
 	
 	/* Set channel. */
-	errno_t rc = ieee80211_dev->ops->set_freq(ieee80211_dev,
+	int rc = ieee80211_dev->ops->set_freq(ieee80211_dev,
 	    ieee80211_channel_to_freq(auth_data->scan_result.channel));
 	if (rc != EOK)
@@ -178,5 +178,5 @@
  *
  */
-errno_t ieee80211_connect_impl(ddf_fun_t *fun, char *ssid_start, char *password)
+int ieee80211_connect_impl(ddf_fun_t *fun, char *ssid_start, char *password)
 {
 	assert(ssid_start);
@@ -190,5 +190,5 @@
 	
 	if (ieee80211_is_connected(ieee80211_dev)) {
-		errno_t rc = ieee80211_dev->iface->disconnect(fun);
+		int rc = ieee80211_dev->iface->disconnect(fun);
 		if (rc != EOK)
 			return rc;
@@ -197,5 +197,5 @@
 	ieee80211_set_connect_request(ieee80211_dev);
 	
-	errno_t rc = ENOENT;
+	int rc = ENOENT;
 	fibril_mutex_lock(&ieee80211_dev->scan_mutex);
 	
@@ -224,5 +224,5 @@
  *
  */
-errno_t ieee80211_disconnect_impl(ddf_fun_t *fun)
+int ieee80211_disconnect_impl(ddf_fun_t *fun)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
@@ -236,5 +236,5 @@
 	
 	fibril_mutex_lock(&ieee80211_dev->ap_list.results_mutex);
-	errno_t rc = ieee80211_deauthenticate(ieee80211_dev);
+	int rc = ieee80211_deauthenticate(ieee80211_dev);
 	fibril_mutex_unlock(&ieee80211_dev->ap_list.results_mutex);
 	
Index: uspace/lib/ieee80211/src/ieee80211_impl.c
===================================================================
--- uspace/lib/ieee80211/src/ieee80211_impl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/ieee80211/src/ieee80211_impl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
  *
  */
-errno_t ieee80211_start_impl(ieee80211_dev_t *ieee80211_dev)
+int ieee80211_start_impl(ieee80211_dev_t *ieee80211_dev)
 {
 	return EOK;
@@ -63,5 +63,5 @@
  *
  */
-errno_t ieee80211_tx_handler_impl(ieee80211_dev_t *ieee80211_dev, void *buffer,
+int ieee80211_tx_handler_impl(ieee80211_dev_t *ieee80211_dev, void *buffer,
     size_t buffer_size)
 {
@@ -77,5 +77,5 @@
  *
  */
-errno_t ieee80211_set_freq_impl(ieee80211_dev_t *ieee80211_dev, uint16_t freq)
+int ieee80211_set_freq_impl(ieee80211_dev_t *ieee80211_dev, uint16_t freq)
 {
 	return EOK;
@@ -89,5 +89,5 @@
  *
  */
-errno_t ieee80211_bssid_change_impl(ieee80211_dev_t *ieee80211_dev,
+int ieee80211_bssid_change_impl(ieee80211_dev_t *ieee80211_dev,
     bool connected)
 {
@@ -102,5 +102,5 @@
  *
  */
-errno_t ieee80211_key_config_impl(ieee80211_dev_t *ieee80211_dev,
+int ieee80211_key_config_impl(ieee80211_dev_t *ieee80211_dev,
     ieee80211_key_config_t *key_conf, bool insert)
 {
@@ -113,8 +113,8 @@
  * @param clear         Whether to clear current scan results.
  *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_scan_impl(ieee80211_dev_t *ieee80211_dev)
+ * @return EOK if succeed, negative error code otherwise.
+ *
+ */
+int ieee80211_scan_impl(ieee80211_dev_t *ieee80211_dev)
 {
 	fibril_mutex_lock(&ieee80211_dev->scan_mutex);
@@ -178,5 +178,5 @@
  *
  */
-errno_t ieee80211_prf(uint8_t *key, uint8_t *data, uint8_t *hash,
+int ieee80211_prf(uint8_t *key, uint8_t *data, uint8_t *hash,
     size_t output_size)
 {
@@ -212,5 +212,5 @@
 }
 
-errno_t ieee80211_rc4_key_unwrap(uint8_t *key, uint8_t *data, size_t data_size,
+int ieee80211_rc4_key_unwrap(uint8_t *key, uint8_t *data, size_t data_size,
     uint8_t *output)
 {
@@ -218,5 +218,5 @@
 }
 
-errno_t ieee80211_aes_key_unwrap(uint8_t *kek, uint8_t *data, size_t data_size,
+int ieee80211_aes_key_unwrap(uint8_t *kek, uint8_t *data, size_t data_size,
     uint8_t *output)
 {
@@ -285,5 +285,5 @@
 }
 
-errno_t ieee80211_michael_mic(uint8_t *key, uint8_t *buffer, size_t size,
+int ieee80211_michael_mic(uint8_t *key, uint8_t *buffer, size_t size,
     uint8_t *mic)
 {
@@ -372,5 +372,5 @@
 }
 
-errno_t rnd_sequence(uint8_t *sequence, size_t length)
+int rnd_sequence(uint8_t *sequence, size_t length)
 {
 	if (!sequence)
Index: uspace/lib/label/include/label/empty.h
===================================================================
--- uspace/lib/label/include/label/empty.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/label/include/label/empty.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,7 +41,7 @@
 #include <types/liblabel.h>
 
-extern errno_t label_bd_is_empty(label_bd_t *, bool *);
-extern errno_t label_bd_empty(label_bd_t *);
-extern errno_t label_part_empty(label_part_t *);
+extern int label_bd_is_empty(label_bd_t *, bool *);
+extern int label_bd_empty(label_bd_t *);
+extern int label_part_empty(label_part_t *);
 
 #endif
Index: uspace/lib/label/include/label/label.h
===================================================================
--- uspace/lib/label/include/label/label.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/label/include/label/label.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,9 +40,9 @@
 #include <types/liblabel.h>
 
-extern errno_t label_open(label_bd_t *, label_t **);
-extern errno_t label_create(label_bd_t *, label_type_t, label_t **);
+extern int label_open(label_bd_t *, label_t **);
+extern int label_create(label_bd_t *, label_type_t, label_t **);
 extern void label_close(label_t *);
-extern errno_t label_destroy(label_t *);
-extern errno_t label_get_info(label_t *, label_info_t *);
+extern int label_destroy(label_t *);
+extern int label_get_info(label_t *, label_info_t *);
 
 extern label_part_t *label_part_first(label_t *);
@@ -50,9 +50,9 @@
 extern void label_part_get_info(label_part_t *, label_part_info_t *);
 
-extern errno_t label_part_create(label_t *, label_part_spec_t *,
+extern int label_part_create(label_t *, label_part_spec_t *,
     label_part_t **);
-extern errno_t label_part_destroy(label_part_t *);
+extern int label_part_destroy(label_part_t *);
 extern void label_pspec_init(label_part_spec_t *);
-extern errno_t label_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
+extern int label_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
 
 #endif
Index: uspace/lib/label/include/types/liblabel.h
===================================================================
--- uspace/lib/label/include/types/liblabel.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/label/include/types/liblabel.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,15 +54,15 @@
 /** Ops for individual label type */
 typedef struct {
-	errno_t (*open)(label_bd_t *, label_t **);
-	errno_t (*create)(label_bd_t *, label_t **);
+	int (*open)(label_bd_t *, label_t **);
+	int (*create)(label_bd_t *, label_t **);
 	void (*close)(label_t *);
-	errno_t (*destroy)(label_t *);
-	errno_t (*get_info)(label_t *, label_info_t *);
+	int (*destroy)(label_t *);
+	int (*get_info)(label_t *, label_info_t *);
 	label_part_t *(*part_first)(label_t *);
 	label_part_t *(*part_next)(label_part_t *);
 	void (*part_get_info)(label_part_t *, label_part_info_t *);
-	errno_t (*part_create)(label_t *, label_part_spec_t *, label_part_t **);
-	errno_t (*part_destroy)(label_part_t *);
-	errno_t (*suggest_ptype)(label_t *, label_pcnt_t, label_ptype_t *);
+	int (*part_create)(label_t *, label_part_spec_t *, label_part_t **);
+	int (*part_destroy)(label_part_t *);
+	int (*suggest_ptype)(label_t *, label_pcnt_t, label_ptype_t *);
 } label_ops_t;
 
@@ -144,11 +144,11 @@
 struct label_bd_ops {
 	/** Get block size */
-	errno_t (*get_bsize)(void *, size_t *);
+	int (*get_bsize)(void *, size_t *);
 	/** Get number of blocks */
-	errno_t (*get_nblocks)(void *, aoff64_t *);
+	int (*get_nblocks)(void *, aoff64_t *);
 	/** Read blocks */
-	errno_t (*read)(void *, aoff64_t, size_t, void *);
+	int (*read)(void *, aoff64_t, size_t, void *);
 	/** Write blocks */
-	errno_t (*write)(void *, aoff64_t, size_t, const void *);
+	int (*write)(void *, aoff64_t, size_t, const void *);
 };
 
Index: uspace/lib/label/src/dummy.c
===================================================================
--- uspace/lib/label/src/dummy.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/label/src/dummy.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,15 +40,15 @@
 #include "dummy.h"
 
-static errno_t dummy_open(label_bd_t *, label_t **);
-static errno_t dummy_create(label_bd_t *, label_t **);
+static int dummy_open(label_bd_t *, label_t **);
+static int dummy_create(label_bd_t *, label_t **);
 static void dummy_close(label_t *);
-static errno_t dummy_destroy(label_t *);
-static errno_t dummy_get_info(label_t *, label_info_t *);
+static int dummy_destroy(label_t *);
+static int dummy_get_info(label_t *, label_info_t *);
 static label_part_t *dummy_part_first(label_t *);
 static label_part_t *dummy_part_next(label_part_t *);
 static void dummy_part_get_info(label_part_t *, label_part_info_t *);
-static errno_t dummy_part_create(label_t *, label_part_spec_t *, label_part_t **);
-static errno_t dummy_part_destroy(label_part_t *);
-static errno_t dummy_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
+static int dummy_part_create(label_t *, label_part_spec_t *, label_part_t **);
+static int dummy_part_destroy(label_part_t *);
+static int dummy_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
 
 label_ops_t dummy_label_ops = {
@@ -66,5 +66,5 @@
 };
 
-static errno_t dummy_open(label_bd_t *bd, label_t **rlabel)
+static int dummy_open(label_bd_t *bd, label_t **rlabel)
 {
 	label_t *label = NULL;
@@ -73,5 +73,5 @@
 	aoff64_t nblocks;
 	uint64_t ba_min, ba_max;
-	errno_t rc;
+	int rc;
 
 	rc = bd->ops->get_bsize(bd->arg, &bsize);
@@ -128,5 +128,5 @@
 }
 
-static errno_t dummy_create(label_bd_t *bd, label_t **rlabel)
+static int dummy_create(label_bd_t *bd, label_t **rlabel)
 {
 	return ENOTSUP;
@@ -148,10 +148,10 @@
 }
 
-static errno_t dummy_destroy(label_t *label)
-{
-	return ENOTSUP;
-}
-
-static errno_t dummy_get_info(label_t *label, label_info_t *linfo)
+static int dummy_destroy(label_t *label)
+{
+	return ENOTSUP;
+}
+
+static int dummy_get_info(label_t *label, label_info_t *linfo)
 {
 	memset(linfo, 0, sizeof(label_info_t));
@@ -193,5 +193,5 @@
 }
 
-static errno_t dummy_part_create(label_t *label, label_part_spec_t *pspec,
+static int dummy_part_create(label_t *label, label_part_spec_t *pspec,
     label_part_t **rpart)
 {
@@ -199,10 +199,10 @@
 }
 
-static errno_t dummy_part_destroy(label_part_t *part)
-{
-	return ENOTSUP;
-}
-
-static errno_t dummy_suggest_ptype(label_t *label, label_pcnt_t pcnt,
+static int dummy_part_destroy(label_part_t *part)
+{
+	return ENOTSUP;
+}
+
+static int dummy_suggest_ptype(label_t *label, label_pcnt_t pcnt,
     label_ptype_t *ptype)
 {
Index: uspace/lib/label/src/empty.c
===================================================================
--- uspace/lib/label/src/empty.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/label/src/empty.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -97,7 +97,7 @@
 }
 
-errno_t label_bd_is_empty(label_bd_t *bd, bool *rempty)
-{
-	errno_t rc;
+int label_bd_is_empty(label_bd_t *bd, bool *rempty)
+{
+	int rc;
 	void *buf = NULL;
 	aoff64_t nblocks;
@@ -174,7 +174,7 @@
 }
 
-errno_t label_bd_empty(label_bd_t *bd)
-{
-	errno_t rc;
+int label_bd_empty(label_bd_t *bd)
+{
+	int rc;
 	void *buf = NULL;
 	aoff64_t nblocks;
@@ -236,7 +236,7 @@
 }
 
-errno_t label_part_empty(label_part_t *part)
-{
-	errno_t rc;
+int label_part_empty(label_part_t *part)
+{
+	int rc;
 	void *buf = NULL;
 	aoff64_t block0;
Index: uspace/lib/label/src/gpt.c
===================================================================
--- uspace/lib/label/src/gpt.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/label/src/gpt.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,30 +46,30 @@
 #include "gpt.h"
 
-static errno_t gpt_open(label_bd_t *, label_t **);
-static errno_t gpt_create(label_bd_t *, label_t **);
+static int gpt_open(label_bd_t *, label_t **);
+static int gpt_create(label_bd_t *, label_t **);
 static void gpt_close(label_t *);
-static errno_t gpt_destroy(label_t *);
-static errno_t gpt_get_info(label_t *, label_info_t *);
+static int gpt_destroy(label_t *);
+static int gpt_get_info(label_t *, label_info_t *);
 static label_part_t *gpt_part_first(label_t *);
 static label_part_t *gpt_part_next(label_part_t *);
 static void gpt_part_get_info(label_part_t *, label_part_info_t *);
-static errno_t gpt_part_create(label_t *, label_part_spec_t *, label_part_t **);
-static errno_t gpt_part_destroy(label_part_t *);
-static errno_t gpt_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
-
-static errno_t gpt_check_free_idx(label_t *, int);
-static errno_t gpt_check_free_range(label_t *, uint64_t, uint64_t);
+static int gpt_part_create(label_t *, label_part_spec_t *, label_part_t **);
+static int gpt_part_destroy(label_part_t *);
+static int gpt_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
+
+static int gpt_check_free_idx(label_t *, int);
+static int gpt_check_free_range(label_t *, uint64_t, uint64_t);
 
 static void gpt_unused_pte(gpt_entry_t *);
-static errno_t gpt_part_to_pte(label_part_t *, gpt_entry_t *);
-static errno_t gpt_pte_to_part(label_t *, gpt_entry_t *, int);
-static errno_t gpt_pte_update(label_t *, gpt_entry_t *, int);
-
-static errno_t gpt_update_pt_crc(label_t *, uint32_t);
+static int gpt_part_to_pte(label_part_t *, gpt_entry_t *);
+static int gpt_pte_to_part(label_t *, gpt_entry_t *, int);
+static int gpt_pte_update(label_t *, gpt_entry_t *, int);
+
+static int gpt_update_pt_crc(label_t *, uint32_t);
 static void gpt_hdr_compute_crc(gpt_header_t *, size_t);
-static errno_t gpt_hdr_get_crc(gpt_header_t *, size_t, uint32_t *);
-
-static errno_t gpt_pmbr_create(label_bd_t *, size_t, uint64_t);
-static errno_t gpt_pmbr_destroy(label_bd_t *, size_t);
+static int gpt_hdr_get_crc(gpt_header_t *, size_t, uint32_t *);
+
+static int gpt_pmbr_create(label_bd_t *, size_t, uint64_t);
+static int gpt_pmbr_destroy(label_bd_t *, size_t);
 
 const uint8_t efi_signature[8] = {
@@ -92,5 +92,5 @@
 };
 
-static errno_t gpt_open(label_bd_t *bd, label_t **rlabel)
+static int gpt_open(label_bd_t *bd, label_t **rlabel)
 {
 	label_t *label = NULL;
@@ -111,5 +111,5 @@
 	uint32_t hdr_crc;
 	int i, j;
-	errno_t rc;
+	int rc;
 
 	gpt_hdr[0] = NULL;
@@ -345,5 +345,5 @@
 }
 
-static errno_t gpt_create(label_bd_t *bd, label_t **rlabel)
+static int gpt_create(label_bd_t *bd, label_t **rlabel)
 {
 	label_t *label = NULL;
@@ -362,5 +362,5 @@
 	uuid_t disk_uuid;
 	int i, j;
-	errno_t rc;
+	int rc;
 
 	rc = bd->ops->get_bsize(bd->arg, &bsize);
@@ -510,5 +510,5 @@
 }
 
-static errno_t gpt_destroy(label_t *label)
+static int gpt_destroy(label_t *label)
 {
 	gpt_header_t *gpt_hdr = NULL;
@@ -516,5 +516,5 @@
 	label_part_t *part;
 	int i;
-	errno_t rc;
+	int rc;
 
 	part = gpt_part_first(label);
@@ -580,5 +580,5 @@
 }
 
-static errno_t gpt_get_info(label_t *label, label_info_t *linfo)
+static int gpt_get_info(label_t *label, label_info_t *linfo)
 {
 	memset(linfo, 0, sizeof(label_info_t));
@@ -624,10 +624,10 @@
 }
 
-static errno_t gpt_part_create(label_t *label, label_part_spec_t *pspec,
+static int gpt_part_create(label_t *label, label_part_spec_t *pspec,
     label_part_t **rpart)
 {
 	label_part_t *part;
 	gpt_entry_t pte;
-	errno_t rc;
+	int rc;
 
 	part = calloc(1, sizeof(label_part_t));
@@ -696,8 +696,8 @@
 }
 
-static errno_t gpt_part_destroy(label_part_t *part)
+static int gpt_part_destroy(label_part_t *part)
 {
 	gpt_entry_t pte;
-	errno_t rc;
+	int rc;
 
 	/* Prepare unused partition table entry */
@@ -715,9 +715,9 @@
 }
 
-static errno_t gpt_suggest_ptype(label_t *label, label_pcnt_t pcnt,
+static int gpt_suggest_ptype(label_t *label, label_pcnt_t pcnt,
     label_ptype_t *ptype)
 {
 	const char *ptid;
-	errno_t rc;
+	int rc;
 
 	ptid = NULL;
@@ -748,5 +748,5 @@
 
 /** Verify that the specified index is valid and free. */
-static errno_t gpt_check_free_idx(label_t *label, int index)
+static int gpt_check_free_idx(label_t *label, int index)
 {
 	label_part_t *part;
@@ -771,5 +771,5 @@
 }
 
-static errno_t gpt_check_free_range(label_t *label, uint64_t block0,
+static int gpt_check_free_range(label_t *label, uint64_t block0,
     uint64_t nblocks)
 {
@@ -796,5 +796,5 @@
 }
 
-static errno_t gpt_part_to_pte(label_part_t *part, gpt_entry_t *pte)
+static int gpt_part_to_pte(label_part_t *part, gpt_entry_t *pte)
 {
 	uint64_t eblock;
@@ -814,5 +814,5 @@
 }
 
-static errno_t gpt_pte_to_part(label_t *label, gpt_entry_t *pte, int index)
+static int gpt_pte_to_part(label_t *label, gpt_entry_t *pte, int index)
 {
 	label_part_t *part;
@@ -856,5 +856,5 @@
  * @a pte.
  */
-static errno_t gpt_pte_update(label_t *label, gpt_entry_t *pte, int index)
+static int gpt_pte_update(label_t *label, gpt_entry_t *pte, int index)
 {
 	size_t pos;
@@ -866,5 +866,5 @@
 	uint32_t crc;
 	int i;
-	errno_t rc;
+	int rc;
 
 	/* Byte offset of partition entry */
@@ -921,8 +921,8 @@
 }
 
-static errno_t gpt_update_pt_crc(label_t *label, uint32_t crc)
+static int gpt_update_pt_crc(label_t *label, uint32_t crc)
 {
 	gpt_header_t *gpt_hdr;
-	errno_t rc;
+	int rc;
 	int i;
 
@@ -968,5 +968,5 @@
 }
 
-static errno_t gpt_hdr_get_crc(gpt_header_t *hdr, size_t hdr_size, uint32_t *crc)
+static int gpt_hdr_get_crc(gpt_header_t *hdr, size_t hdr_size, uint32_t *crc)
 {
 	gpt_header_t *c;
@@ -985,9 +985,9 @@
 
 /** Create GPT Protective MBR */
-static errno_t gpt_pmbr_create(label_bd_t *bd, size_t bsize, uint64_t nblocks)
+static int gpt_pmbr_create(label_bd_t *bd, size_t bsize, uint64_t nblocks)
 {
 	mbr_br_block_t *pmbr = NULL;
 	uint64_t pmbr_nb;
-	errno_t rc;
+	int rc;
 
 	pmbr = calloc(1, bsize);
@@ -1023,8 +1023,8 @@
 
 /** Destroy GPT Protective MBR */
-static errno_t gpt_pmbr_destroy(label_bd_t *bd, size_t bsize)
+static int gpt_pmbr_destroy(label_bd_t *bd, size_t bsize)
 {
 	mbr_br_block_t *pmbr = NULL;
-	errno_t rc;
+	int rc;
 
 	pmbr = calloc(1, bsize);
Index: uspace/lib/label/src/label.c
===================================================================
--- uspace/lib/label/src/label.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/label/src/label.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,8 +51,8 @@
 };
 
-errno_t label_open(label_bd_t *bd, label_t **rlabel)
+int label_open(label_bd_t *bd, label_t **rlabel)
 {
 	label_ops_t **ops;
-	errno_t rc;
+	int rc;
 
 	ops = &probe_list[0];
@@ -67,5 +67,5 @@
 }
 
-errno_t label_create(label_bd_t *bd, label_type_t ltype, label_t **rlabel)
+int label_create(label_bd_t *bd, label_type_t ltype, label_t **rlabel)
 {
 	label_ops_t *ops = NULL;
@@ -96,10 +96,10 @@
 }
 
-errno_t label_destroy(label_t *label)
+int label_destroy(label_t *label)
 {
 	return label->ops->destroy(label);
 }
 
-errno_t label_get_info(label_t *label, label_info_t *linfo)
+int label_get_info(label_t *label, label_info_t *linfo)
 {
 	return label->ops->get_info(label, linfo);
@@ -121,5 +121,5 @@
 }
 
-errno_t label_part_create(label_t *label, label_part_spec_t *pspec,
+int label_part_create(label_t *label, label_part_spec_t *pspec,
     label_part_t **rpart)
 {
@@ -127,5 +127,5 @@
 }
 
-errno_t label_part_destroy(label_part_t *part)
+int label_part_destroy(label_part_t *part)
 {
 	return part->label->ops->part_destroy(part);
@@ -137,5 +137,5 @@
 }
 
-errno_t label_suggest_ptype(label_t *label, label_pcnt_t pcnt,
+int label_suggest_ptype(label_t *label, label_pcnt_t pcnt,
     label_ptype_t *ptype)
 {
Index: uspace/lib/label/src/mbr.c
===================================================================
--- uspace/lib/label/src/mbr.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/label/src/mbr.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,31 +43,31 @@
 #include "mbr.h"
 
-static errno_t mbr_open(label_bd_t *, label_t **);
-static errno_t mbr_open_ext(label_t *);
-static errno_t mbr_create(label_bd_t *, label_t **);
+static int mbr_open(label_bd_t *, label_t **);
+static int mbr_open_ext(label_t *);
+static int mbr_create(label_bd_t *, label_t **);
 static void mbr_close(label_t *);
-static errno_t mbr_destroy(label_t *);
-static errno_t mbr_get_info(label_t *, label_info_t *);
+static int mbr_destroy(label_t *);
+static int mbr_get_info(label_t *, label_info_t *);
 static label_part_t *mbr_part_first(label_t *);
 static label_part_t *mbr_part_next(label_part_t *);
 static void mbr_part_get_info(label_part_t *, label_part_info_t *);
-static errno_t mbr_part_create(label_t *, label_part_spec_t *, label_part_t **);
-static errno_t mbr_part_destroy(label_part_t *);
-static errno_t mbr_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
-
-static errno_t mbr_check_free_idx(label_t *, int);
-static errno_t mbr_check_free_pri_range(label_t *, uint64_t, uint64_t);
-static errno_t mbr_check_free_log_range(label_t *, uint64_t, uint64_t, uint64_t);
+static int mbr_part_create(label_t *, label_part_spec_t *, label_part_t **);
+static int mbr_part_destroy(label_part_t *);
+static int mbr_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
+
+static int mbr_check_free_idx(label_t *, int);
+static int mbr_check_free_pri_range(label_t *, uint64_t, uint64_t);
+static int mbr_check_free_log_range(label_t *, uint64_t, uint64_t, uint64_t);
 
 static void mbr_unused_pte(mbr_pte_t *);
-static errno_t mbr_part_to_pte(label_part_t *, mbr_pte_t *);
-static errno_t mbr_pte_to_part(label_t *, mbr_pte_t *, int);
-static errno_t mbr_pte_to_log_part(label_t *, uint64_t, mbr_pte_t *);
+static int mbr_part_to_pte(label_part_t *, mbr_pte_t *);
+static int mbr_pte_to_part(label_t *, mbr_pte_t *, int);
+static int mbr_pte_to_log_part(label_t *, uint64_t, mbr_pte_t *);
 static void mbr_log_part_to_ptes(label_part_t *, mbr_pte_t *, mbr_pte_t *);
-static errno_t mbr_pte_update(label_t *, mbr_pte_t *, int);
-static errno_t mbr_log_part_insert(label_t *, label_part_t *);
-static errno_t mbr_ebr_create(label_t *, label_part_t *);
-static errno_t mbr_ebr_delete(label_t *, label_part_t *);
-static errno_t mbr_ebr_update_next(label_t *, label_part_t *);
+static int mbr_pte_update(label_t *, mbr_pte_t *, int);
+static int mbr_log_part_insert(label_t *, label_part_t *);
+static int mbr_ebr_create(label_t *, label_part_t *);
+static int mbr_ebr_delete(label_t *, label_part_t *);
+static int mbr_ebr_update_next(label_t *, label_part_t *);
 static void mbr_update_log_indices(label_t *);
 
@@ -86,5 +86,5 @@
 };
 
-static errno_t mbr_open(label_bd_t *bd, label_t **rlabel)
+static int mbr_open(label_bd_t *bd, label_t **rlabel)
 {
 	label_t *label = NULL;
@@ -96,5 +96,5 @@
 	aoff64_t nblocks;
 	uint32_t entry;
-	errno_t rc;
+	int rc;
 
 	rc = bd->ops->get_bsize(bd->arg, &bsize);
@@ -202,5 +202,5 @@
 
 /** Open extended partition */
-static errno_t mbr_open_ext(label_t *label)
+static int mbr_open_ext(label_t *label)
 {
 	mbr_br_block_t *ebr = NULL;
@@ -215,5 +215,5 @@
 	uint64_t pnblocks;
 	uint64_t ep_b0;
-	errno_t rc;
+	int rc;
 
 	ebr = calloc(1, label->block_size);
@@ -300,5 +300,5 @@
 }
 
-static errno_t mbr_create(label_bd_t *bd, label_t **rlabel)
+static int mbr_create(label_bd_t *bd, label_t **rlabel)
 {
 	label_t *label = NULL;
@@ -307,5 +307,5 @@
 	size_t bsize;
 	int i;
-	errno_t rc;
+	int rc;
 
 	rc = bd->ops->get_bsize(bd->arg, &bsize);
@@ -389,9 +389,9 @@
 }
 
-static errno_t mbr_destroy(label_t *label)
+static int mbr_destroy(label_t *label)
 {
 	mbr_br_block_t *mbr = NULL;
 	label_part_t *part;
-	errno_t rc;
+	int rc;
 
 	part = mbr_part_first(label);
@@ -428,5 +428,5 @@
 }
 
-static errno_t mbr_get_info(label_t *label, label_info_t *linfo)
+static int mbr_get_info(label_t *label, label_info_t *linfo)
 {
 	memset(linfo, 0, sizeof(label_info_t));
@@ -546,5 +546,5 @@
 }
 
-static errno_t mbr_part_create(label_t *label, label_part_spec_t *pspec,
+static int mbr_part_create(label_t *label, label_part_spec_t *pspec,
     label_part_t **rpart)
 {
@@ -553,5 +553,5 @@
 	label_part_t *next;
 	mbr_pte_t pte;
-	errno_t rc;
+	int rc;
 
 	if (pspec->ptype.fmt != lptf_num)
@@ -694,5 +694,5 @@
 }
 
-static errno_t mbr_part_destroy(label_part_t *part)
+static int mbr_part_destroy(label_part_t *part)
 {
 	mbr_pte_t pte;
@@ -700,5 +700,5 @@
 	label_part_t *next;
 	uint64_t ep_b0;
-	errno_t rc;
+	int rc;
 
 	if (link_used(&part->lpri)) {
@@ -776,5 +776,5 @@
 }
 
-static errno_t mbr_suggest_ptype(label_t *label, label_pcnt_t pcnt,
+static int mbr_suggest_ptype(label_t *label, label_pcnt_t pcnt,
     label_ptype_t *ptype)
 {
@@ -813,5 +813,5 @@
 
 /** Verify that the specified index is valid and free. */
-static errno_t mbr_check_free_idx(label_t *label, int index)
+static int mbr_check_free_idx(label_t *label, int index)
 {
 	label_part_t *part;
@@ -830,5 +830,5 @@
 }
 
-static errno_t mbr_check_free_pri_range(label_t *label, uint64_t block0,
+static int mbr_check_free_pri_range(label_t *label, uint64_t block0,
     uint64_t nblocks)
 {
@@ -850,5 +850,5 @@
 }
 
-static errno_t mbr_check_free_log_range(label_t *label, uint64_t hdr_blocks,
+static int mbr_check_free_log_range(label_t *label, uint64_t hdr_blocks,
     uint64_t block0, uint64_t nblocks)
 {
@@ -877,5 +877,5 @@
 }
 
-static errno_t mbr_part_to_pte(label_part_t *part, mbr_pte_t *pte)
+static int mbr_part_to_pte(label_part_t *part, mbr_pte_t *pte)
 {
 	if ((part->block0 >> 32) != 0)
@@ -893,5 +893,5 @@
 }
 
-static errno_t mbr_pte_to_part(label_t *label, mbr_pte_t *pte, int index)
+static int mbr_pte_to_part(label_t *label, mbr_pte_t *pte, int index)
 {
 	label_part_t *part;
@@ -931,5 +931,5 @@
 }
 
-static errno_t mbr_pte_to_log_part(label_t *label, uint64_t ebr_b0,
+static int mbr_pte_to_log_part(label_t *label, uint64_t ebr_b0,
     mbr_pte_t *pte)
 {
@@ -1009,8 +1009,8 @@
  * @a pte.
  */
-static errno_t mbr_pte_update(label_t *label, mbr_pte_t *pte, int index)
+static int mbr_pte_update(label_t *label, mbr_pte_t *pte, int index)
 {
 	mbr_br_block_t *br;
-	errno_t rc;
+	int rc;
 
 	br = calloc(1, label->block_size);
@@ -1040,5 +1040,5 @@
 
 /** Insert logical partition into logical partition list. */
-static errno_t mbr_log_part_insert(label_t *label, label_part_t *part)
+static int mbr_log_part_insert(label_t *label, label_part_t *part)
 {
 	label_part_t *cur;
@@ -1066,9 +1066,9 @@
  * @return EOK on success or non-zero error code
  */
-static errno_t mbr_ebr_create(label_t *label, label_part_t *part)
+static int mbr_ebr_create(label_t *label, label_part_t *part)
 {
 	mbr_br_block_t *br;
 	uint64_t ba;
-	errno_t rc;
+	int rc;
 
 	br = calloc(1, label->block_size);
@@ -1099,9 +1099,9 @@
 }
 
-static errno_t mbr_ebr_delete(label_t *label, label_part_t *part)
+static int mbr_ebr_delete(label_t *label, label_part_t *part)
 {
 	mbr_br_block_t *br;
 	uint64_t ba;
-	errno_t rc;
+	int rc;
 
 	br = calloc(1, label->block_size);
@@ -1125,10 +1125,10 @@
 
 /** Update 'next' PTE in EBR of partition. */
-static errno_t mbr_ebr_update_next(label_t *label, label_part_t *part)
+static int mbr_ebr_update_next(label_t *label, label_part_t *part)
 {
 	mbr_br_block_t *br;
 	uint64_t ba;
 	uint16_t sgn;
-	errno_t rc;
+	int rc;
 
 	ba = part->block0 - part->hdr_blocks;
Index: uspace/lib/label/test/label.c
===================================================================
--- uspace/lib/label/test/label.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/label/test/label.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,8 +37,8 @@
 PCUT_TEST_SUITE(label);
 
-static errno_t label_test_get_bsize(void *, size_t *);
-static errno_t label_test_get_nblocks(void *, aoff64_t *);
-static errno_t label_test_read(void *, aoff64_t, size_t, void *);
-static errno_t label_test_write(void *, aoff64_t, size_t, const void *);
+static int label_test_get_bsize(void *, size_t *);
+static int label_test_get_nblocks(void *, aoff64_t *);
+static int label_test_read(void *, aoff64_t, size_t, void *);
+static int label_test_write(void *, aoff64_t, size_t, const void *);
 
 label_bd_ops_t label_test_ops = {
@@ -67,5 +67,5 @@
  * @param rbd Place to store pointer to new pretended block device
  */
-static errno_t test_bd_create(size_t bsize, aoff64_t nblocks, test_bd_t **rbd)
+static int test_bd_create(size_t bsize, aoff64_t nblocks, test_bd_t **rbd)
 {
 	test_bd_t *bd;
@@ -99,5 +99,5 @@
 
 /** Get block size wrapper for liblabel */
-static errno_t label_test_get_bsize(void *arg, size_t *bsize)
+static int label_test_get_bsize(void *arg, size_t *bsize)
 {
 	test_bd_t *bd = (test_bd_t *)arg;
@@ -108,5 +108,5 @@
 
 /** Get number of blocks wrapper for liblabel */
-static errno_t label_test_get_nblocks(void *arg, aoff64_t *nblocks)
+static int label_test_get_nblocks(void *arg, aoff64_t *nblocks)
 {
 	test_bd_t *bd = (test_bd_t *)arg;
@@ -117,5 +117,5 @@
 
 /** Read blocks wrapper for liblabel */
-static errno_t label_test_read(void *arg, aoff64_t ba, size_t cnt, void *buf)
+static int label_test_read(void *arg, aoff64_t ba, size_t cnt, void *buf)
 {
 	test_bd_t *bd = (test_bd_t *)arg;
@@ -129,5 +129,5 @@
 
 /** Write blocks wrapper for liblabel */
-static errno_t label_test_write(void *arg, aoff64_t ba, size_t cnt, const void *data)
+static int label_test_write(void *arg, aoff64_t ba, size_t cnt, const void *data)
 {
 	test_bd_t *bd = (test_bd_t *)arg;
@@ -146,5 +146,5 @@
 	label_part_t *part;
 	test_bd_t *bd = NULL;
-	errno_t rc;
+	int rc;
 
 	rc = test_bd_create(test_block_size, test_nblocks, &bd);
@@ -181,5 +181,5 @@
 	label_part_t *part;
 	test_bd_t *bd = NULL;
-	errno_t rc;
+	int rc;
 
 	rc = test_bd_create(test_block_size, test_nblocks, &bd);
@@ -242,5 +242,5 @@
 	label_part_t *part;
 	test_bd_t *bd = NULL;
-	errno_t rc;
+	int rc;
 
 	rc = test_bd_create(test_block_size, test_nblocks, &bd);
@@ -304,5 +304,5 @@
 	label_ptype_t ptype;
 	test_bd_t *bd = NULL;
-	errno_t rc;
+	int rc;
 
 	rc = test_bd_create(test_block_size, test_nblocks, &bd);
@@ -393,5 +393,5 @@
 	label_part_info_t pinfo, lpinfo, epinfo;
 	test_bd_t *bd = NULL;
-	errno_t rc;
+	int rc;
 
 	rc = test_bd_create(test_block_size, test_nblocks, &bd);
@@ -531,5 +531,5 @@
 	label_ptype_t ptype;
 	test_bd_t *bd = NULL;
-	errno_t rc;
+	int rc;
 
 	rc = test_bd_create(test_block_size, test_nblocks, &bd);
Index: uspace/lib/nettl/include/nettl/amap.h
===================================================================
--- uspace/lib/nettl/include/nettl/amap.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nettl/include/nettl/amap.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -91,10 +91,10 @@
 } amap_flags_t;
 
-extern errno_t amap_create(amap_t **);
+extern int amap_create(amap_t **);
 extern void amap_destroy(amap_t *);
-extern errno_t amap_insert(amap_t *, inet_ep2_t *, void *, amap_flags_t,
+extern int amap_insert(amap_t *, inet_ep2_t *, void *, amap_flags_t,
     inet_ep2_t *);
 extern void amap_remove(amap_t *, inet_ep2_t *);
-extern errno_t amap_find_match(amap_t *, inet_ep2_t *, void **);
+extern int amap_find_match(amap_t *, inet_ep2_t *, void **);
 
 #endif
Index: uspace/lib/nettl/include/nettl/portrng.h
===================================================================
--- uspace/lib/nettl/include/nettl/portrng.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nettl/include/nettl/portrng.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,9 +58,9 @@
 } portrng_flags_t;
 
-extern errno_t portrng_create(portrng_t **);
+extern int portrng_create(portrng_t **);
 extern void portrng_destroy(portrng_t *);
-extern errno_t portrng_alloc(portrng_t *, uint16_t, void *,
+extern int portrng_alloc(portrng_t *, uint16_t, void *,
     portrng_flags_t, uint16_t *);
-extern errno_t portrng_find_port(portrng_t *, uint16_t, void **);
+extern int portrng_find_port(portrng_t *, uint16_t, void **);
 extern void portrng_free_port(portrng_t *, uint16_t);
 extern bool portrng_empty(portrng_t *);
Index: uspace/lib/nettl/src/amap.c
===================================================================
--- uspace/lib/nettl/src/amap.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nettl/src/amap.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -80,8 +80,8 @@
  * @return EOk on success, ENOMEM if out of memory
  */
-errno_t amap_create(amap_t **rmap)
+int amap_create(amap_t **rmap)
 {
 	amap_t *map;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_create()");
@@ -131,5 +131,5 @@
  * @return EOK on success, ENOENT if not found
  */
-static errno_t amap_repla_find(amap_t *map, inet_ep_t *rep, inet_addr_t *la,
+static int amap_repla_find(amap_t *map, inet_ep_t *rep, inet_addr_t *la,
     amap_repla_t **rrepla)
 {
@@ -175,9 +175,9 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-static errno_t amap_repla_insert(amap_t *map, inet_ep_t *rep, inet_addr_t *la,
+static int amap_repla_insert(amap_t *map, inet_ep_t *rep, inet_addr_t *la,
     amap_repla_t **rrepla)
 {
 	amap_repla_t *repla;
-	errno_t rc;
+	int rc;
 
 	repla = calloc(1, sizeof(amap_repla_t));
@@ -225,5 +225,5 @@
  * @return EOK on success, ENOENT if not found.
  */
-static errno_t amap_laddr_find(amap_t *map, inet_addr_t *addr,
+static int amap_laddr_find(amap_t *map, inet_addr_t *addr,
     amap_laddr_t **rladdr)
 {
@@ -248,9 +248,9 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-static errno_t amap_laddr_insert(amap_t *map, inet_addr_t *addr,
+static int amap_laddr_insert(amap_t *map, inet_addr_t *addr,
     amap_laddr_t **rladdr)
 {
 	amap_laddr_t *laddr;
-	errno_t rc;
+	int rc;
 
 	laddr = calloc(1, sizeof(amap_laddr_t));
@@ -297,5 +297,5 @@
  * @return EOK on success, ENOENT if not found.
  */
-static errno_t amap_llink_find(amap_t *map, sysarg_t link_id,
+static int amap_llink_find(amap_t *map, sysarg_t link_id,
     amap_llink_t **rllink)
 {
@@ -320,9 +320,9 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-static errno_t amap_llink_insert(amap_t *map, sysarg_t link_id,
+static int amap_llink_insert(amap_t *map, sysarg_t link_id,
     amap_llink_t **rllink)
 {
 	amap_llink_t *llink;
-	errno_t rc;
+	int rc;
 
 	llink = calloc(1, sizeof(amap_llink_t));
@@ -372,10 +372,10 @@
  *         ENOMEM if out of memory
  */
-static errno_t amap_insert_repla(amap_t *map, inet_ep2_t *epp, void *arg,
+static int amap_insert_repla(amap_t *map, inet_ep2_t *epp, void *arg,
     amap_flags_t flags, inet_ep2_t *aepp)
 {
 	amap_repla_t *repla;
 	inet_ep2_t mepp;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert_repla()");
@@ -417,10 +417,10 @@
  *         ENOMEM if out of memory
  */
-static errno_t amap_insert_laddr(amap_t *map, inet_ep2_t *epp, void *arg,
+static int amap_insert_laddr(amap_t *map, inet_ep2_t *epp, void *arg,
     amap_flags_t flags, inet_ep2_t *aepp)
 {
 	amap_laddr_t *laddr;
 	inet_ep2_t mepp;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert_laddr()");
@@ -461,10 +461,10 @@
  *         ENOMEM if out of memory
  */
-static errno_t amap_insert_llink(amap_t *map, inet_ep2_t *epp, void *arg,
+static int amap_insert_llink(amap_t *map, inet_ep2_t *epp, void *arg,
     amap_flags_t flags, inet_ep2_t *aepp)
 {
 	amap_llink_t *llink;
 	inet_ep2_t mepp;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert_llink()");
@@ -505,9 +505,9 @@
  *         ENOMEM if out of memory
  */
-static errno_t amap_insert_unspec(amap_t *map, inet_ep2_t *epp, void *arg,
+static int amap_insert_unspec(amap_t *map, inet_ep2_t *epp, void *arg,
     amap_flags_t flags, inet_ep2_t *aepp)
 {
 	inet_ep2_t mepp;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert_unspec()");
@@ -538,10 +538,10 @@
  *         ENOMEM if out of memory
  */
-errno_t amap_insert(amap_t *map, inet_ep2_t *epp, void *arg, amap_flags_t flags,
+int amap_insert(amap_t *map, inet_ep2_t *epp, void *arg, amap_flags_t flags,
     inet_ep2_t *aepp)
 {
 	bool raddr, rport, laddr, llink;
 	inet_ep2_t mepp;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert()");
@@ -599,5 +599,5 @@
 {
 	amap_repla_t *repla;
-	errno_t rc;
+	int rc;
 
 	rc = amap_repla_find(map, &epp->remote, &epp->local.addr, &repla);
@@ -624,5 +624,5 @@
 {
 	amap_laddr_t *laddr;
-	errno_t rc;
+	int rc;
 
 	rc = amap_laddr_find(map, &epp->local.addr, &laddr);
@@ -649,5 +649,5 @@
 {
 	amap_llink_t *llink;
-	errno_t rc;
+	int rc;
 
 	rc = amap_llink_find(map, epp->local_link, &llink);
@@ -721,7 +721,7 @@
  * @return	EOK on success, ENOENT if not found.
  */
-errno_t amap_find_match(amap_t *map, inet_ep2_t *epp, void **rarg)
-{
-	errno_t rc;
+int amap_find_match(amap_t *map, inet_ep2_t *epp, void **rarg)
+{
+	int rc;
 	amap_repla_t *repla;
 	amap_laddr_t *laddr;
Index: uspace/lib/nettl/src/portrng.c
===================================================================
--- uspace/lib/nettl/src/portrng.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nettl/src/portrng.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-errno_t portrng_create(portrng_t **rpr)
+int portrng_create(portrng_t **rpr)
 {
 	portrng_t *pr;
@@ -93,5 +93,5 @@
  *         @c pf_allow_system was not set.
  */
-errno_t portrng_alloc(portrng_t *pr, uint16_t pnum, void *arg,
+int portrng_alloc(portrng_t *pr, uint16_t pnum, void *arg,
     portrng_flags_t flags, uint16_t *apnum)
 {
@@ -163,5 +163,5 @@
  * @return EOK on success, ENOENT if specified port number is not allocated
  */
-errno_t portrng_find_port(portrng_t *pr, uint16_t pnum, void **rarg)
+int portrng_find_port(portrng_t *pr, uint16_t pnum, void **rarg)
 {
 	list_foreach(pr->used, lprng, portrng_port_t, port) {
Index: uspace/lib/nic/include/nic.h
===================================================================
--- uspace/lib/nic/include/nic.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/include/nic.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,5 +57,5 @@
 	nic_wv_id_t id;
 	nic_wv_type_t type;
-	void *data;
+	const void *data;
 	size_t length;
 	struct nic_wol_virtue *next;
@@ -87,5 +87,5 @@
 /**
  * The handler for transitions between driver states.
- * If the handler returns error code, the transition between
+ * If the handler returns negative error code, the transition between
  * states is canceled (the state is not changed).
  *
@@ -93,7 +93,7 @@
  *
  * @return EOK	If everything is all right.
- * @return error code on error.
- */
-typedef errno_t (*state_change_handler)(nic_t *);
+ * @return negative error code on error.
+ */
+typedef int (*state_change_handler)(nic_t *);
 
 /**
@@ -108,5 +108,5 @@
  * @return ENOTSUP	If this mode is not supported
  */
-typedef errno_t (*unicast_mode_change_handler)(nic_t *,
+typedef int (*unicast_mode_change_handler)(nic_t *,
     nic_unicast_mode_t, const nic_address_t *, size_t);
 
@@ -122,5 +122,5 @@
  * @return ENOTSUP	If this mode is not supported
  */
-typedef errno_t (*multicast_mode_change_handler)(nic_t *,
+typedef int (*multicast_mode_change_handler)(nic_t *,
     nic_multicast_mode_t, const nic_address_t *, size_t);
 
@@ -134,5 +134,5 @@
  * @return ENOTSUP	If this mode is not supported
  */
-typedef errno_t (*broadcast_mode_change_handler)(nic_t *, nic_broadcast_mode_t);
+typedef int (*broadcast_mode_change_handler)(nic_t *, nic_broadcast_mode_t);
 
 /**
@@ -172,5 +172,5 @@
  * 					limit of these HW filters was reached.
  */
-typedef errno_t (*wol_virtue_add_handler)(nic_t *, const nic_wol_virtue_t *);
+typedef int (*wol_virtue_add_handler)(nic_t *, const nic_wol_virtue_t *);
 
 /**
@@ -195,5 +195,5 @@
  * @return EINVAL	If this mode cannot be set up under no circumstances
  */
-typedef errno_t (*poll_mode_change_handler)(nic_t *,
+typedef int (*poll_mode_change_handler)(nic_t *,
     nic_poll_mode_t, const struct timeval *);
 
@@ -211,10 +211,10 @@
 
 /* Functions called in the main function */
-extern errno_t nic_driver_init(const char *);
+extern int nic_driver_init(const char *);
 extern void nic_driver_implement(driver_ops_t *, ddf_dev_ops_t *,
     nic_iface_t *);
 
 /* Functions called in add_device */
-extern errno_t nic_get_resources(nic_t *, hw_res_list_parsed_t *);
+extern int nic_get_resources(nic_t *, hw_res_list_parsed_t *);
 extern void nic_set_specific(nic_t *, void *);
 extern void nic_set_send_frame_handler(nic_t *, send_frame_handler);
@@ -239,6 +239,6 @@
 extern nic_device_state_t nic_query_state(nic_t *);
 extern void nic_set_tx_busy(nic_t *, int);
-extern errno_t nic_report_address(nic_t *, const nic_address_t *);
-extern errno_t nic_report_poll_mode(nic_t *, nic_poll_mode_t, struct timeval *);
+extern int nic_report_address(nic_t *, const nic_address_t *);
+extern int nic_report_poll_mode(nic_t *, nic_poll_mode_t, struct timeval *);
 extern void nic_query_address(nic_t *, nic_address_t *);
 extern void nic_received_frame(nic_t *, nic_frame_t *);
@@ -268,5 +268,5 @@
 extern void nic_query_blocked_sources(const nic_t *,
     size_t, nic_address_t *, size_t *);
-extern errno_t nic_query_vlan_mask(const nic_t *, nic_vlan_mask_t *);
+extern int nic_query_vlan_mask(const nic_t *, nic_vlan_mask_t *);
 extern int nic_query_wol_max_caps(const nic_t *, nic_wv_type_t);
 extern void nic_set_wol_max_caps(nic_t *, nic_wv_type_t, int);
Index: uspace/lib/nic/include/nic_addr_db.h
===================================================================
--- uspace/lib/nic/include/nic_addr_db.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/include/nic_addr_db.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,12 +55,12 @@
 
 
-extern errno_t nic_addr_db_init(nic_addr_db_t *db, size_t addr_len);
+extern int nic_addr_db_init(nic_addr_db_t *db, size_t addr_len);
 extern void nic_addr_db_clear(nic_addr_db_t *db);
 extern void nic_addr_db_destroy(nic_addr_db_t *db);
-extern errno_t nic_addr_db_insert(nic_addr_db_t *db, const uint8_t *addr);
-extern errno_t nic_addr_db_remove(nic_addr_db_t *db, const uint8_t *addr);
-extern bool nic_addr_db_contains(const nic_addr_db_t *db, const uint8_t *addr);
+extern int nic_addr_db_insert(nic_addr_db_t *db, const uint8_t *addr);
+extern int nic_addr_db_remove(nic_addr_db_t *db, const uint8_t *addr);
+extern int nic_addr_db_contains(const nic_addr_db_t *db, const uint8_t *addr);
 extern void nic_addr_db_foreach(const nic_addr_db_t *db,
-    void (*func)(const uint8_t *, void *), void *arg);
+	void (*func)(const uint8_t *, void *), void *arg);
 
 #endif
Index: uspace/lib/nic/include/nic_ev.h
===================================================================
--- uspace/lib/nic/include/nic_ev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/include/nic_ev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,7 +43,7 @@
 #include <stddef.h>
 
-extern errno_t nic_ev_addr_changed(async_sess_t *, const nic_address_t *);
-extern errno_t nic_ev_device_state(async_sess_t *, sysarg_t);
-extern errno_t nic_ev_received(async_sess_t *, void *, size_t);
+extern int nic_ev_addr_changed(async_sess_t *, const nic_address_t *);
+extern int nic_ev_device_state(async_sess_t *, sysarg_t);
+extern int nic_ev_received(async_sess_t *, void *, size_t);
 
 #endif
Index: uspace/lib/nic/include/nic_impl.h
===================================================================
--- uspace/lib/nic/include/nic_impl.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/include/nic_impl.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,42 +46,42 @@
  * inject some adaptation layer between the DDF call and NICF implementation */
 
-extern errno_t nic_get_address_impl(ddf_fun_t *dev_fun, nic_address_t *address);
-extern errno_t nic_send_frame_impl(ddf_fun_t *dev_fun, void *data, size_t size);
-extern errno_t nic_callback_create_impl(ddf_fun_t *dev_fun);
-extern errno_t nic_get_state_impl(ddf_fun_t *dev_fun, nic_device_state_t *state);
-extern errno_t nic_set_state_impl(ddf_fun_t *dev_fun, nic_device_state_t state);
-extern errno_t nic_get_stats_impl(ddf_fun_t *dev_fun, nic_device_stats_t *stats);
-extern errno_t nic_unicast_get_mode_impl(ddf_fun_t *dev_fun,
+extern int nic_get_address_impl(ddf_fun_t *dev_fun, nic_address_t *address);
+extern int nic_send_frame_impl(ddf_fun_t *dev_fun, void *data, size_t size);
+extern int nic_callback_create_impl(ddf_fun_t *dev_fun);
+extern int nic_get_state_impl(ddf_fun_t *dev_fun, nic_device_state_t *state);
+extern int nic_set_state_impl(ddf_fun_t *dev_fun, nic_device_state_t state);
+extern int nic_get_stats_impl(ddf_fun_t *dev_fun, nic_device_stats_t *stats);
+extern int nic_unicast_get_mode_impl(ddf_fun_t *dev_fun,
     nic_unicast_mode_t *, size_t, nic_address_t *, size_t *);
-extern errno_t nic_unicast_set_mode_impl(ddf_fun_t *dev_fun,
+extern int nic_unicast_set_mode_impl(ddf_fun_t *dev_fun,
     nic_unicast_mode_t, const nic_address_t *, size_t);
-extern errno_t nic_multicast_get_mode_impl(ddf_fun_t *dev_fun,
+extern int nic_multicast_get_mode_impl(ddf_fun_t *dev_fun,
     nic_multicast_mode_t *, size_t, nic_address_t *, size_t *);
-extern errno_t nic_multicast_set_mode_impl(ddf_fun_t *dev_fun,
+extern int nic_multicast_set_mode_impl(ddf_fun_t *dev_fun,
     nic_multicast_mode_t, const nic_address_t *, size_t);
-extern errno_t nic_broadcast_get_mode_impl(ddf_fun_t *, nic_broadcast_mode_t *);
-extern errno_t nic_broadcast_set_mode_impl(ddf_fun_t *, nic_broadcast_mode_t);
-extern errno_t nic_blocked_sources_get_impl(ddf_fun_t *,
+extern int nic_broadcast_get_mode_impl(ddf_fun_t *, nic_broadcast_mode_t *);
+extern int nic_broadcast_set_mode_impl(ddf_fun_t *, nic_broadcast_mode_t);
+extern int nic_blocked_sources_get_impl(ddf_fun_t *,
     size_t, nic_address_t *, size_t *);
-extern errno_t nic_blocked_sources_set_impl(ddf_fun_t *, const nic_address_t *, size_t);
-extern errno_t nic_vlan_get_mask_impl(ddf_fun_t *, nic_vlan_mask_t *);
-extern errno_t nic_vlan_set_mask_impl(ddf_fun_t *, const nic_vlan_mask_t *);
-extern errno_t nic_wol_virtue_add_impl(ddf_fun_t *dev_fun, nic_wv_type_t type,
+extern int nic_blocked_sources_set_impl(ddf_fun_t *, const nic_address_t *, size_t);
+extern int nic_vlan_get_mask_impl(ddf_fun_t *, nic_vlan_mask_t *);
+extern int nic_vlan_set_mask_impl(ddf_fun_t *, const nic_vlan_mask_t *);
+extern int nic_wol_virtue_add_impl(ddf_fun_t *dev_fun, nic_wv_type_t type,
     const void *data, size_t length, nic_wv_id_t *new_id);
-extern errno_t nic_wol_virtue_remove_impl(ddf_fun_t *dev_fun, nic_wv_id_t id);
-extern errno_t nic_wol_virtue_probe_impl(ddf_fun_t *dev_fun, nic_wv_id_t id,
+extern int nic_wol_virtue_remove_impl(ddf_fun_t *dev_fun, nic_wv_id_t id);
+extern int nic_wol_virtue_probe_impl(ddf_fun_t *dev_fun, nic_wv_id_t id,
     nic_wv_type_t *type, size_t max_length, void *data, size_t *length);
-extern errno_t nic_wol_virtue_list_impl(ddf_fun_t *dev_fun, nic_wv_type_t type,
+extern int nic_wol_virtue_list_impl(ddf_fun_t *dev_fun, nic_wv_type_t type,
     size_t max_count, nic_wv_id_t *id_list, size_t *id_count);
-extern errno_t nic_wol_virtue_get_caps_impl(ddf_fun_t *, nic_wv_type_t, int *);
-extern errno_t nic_poll_get_mode_impl(ddf_fun_t *,
+extern int nic_wol_virtue_get_caps_impl(ddf_fun_t *, nic_wv_type_t, int *);
+extern int nic_poll_get_mode_impl(ddf_fun_t *,
     nic_poll_mode_t *, struct timeval *);
-extern errno_t nic_poll_set_mode_impl(ddf_fun_t *,
+extern int nic_poll_set_mode_impl(ddf_fun_t *,
     nic_poll_mode_t, const struct timeval *);
-extern errno_t nic_poll_now_impl(ddf_fun_t *);
+extern int nic_poll_now_impl(ddf_fun_t *);
 
 extern void nic_default_handler_impl(ddf_fun_t *dev_fun,
-    ipc_callid_t callid, ipc_call_t *call);
-extern errno_t nic_open_impl(ddf_fun_t *fun);
+	ipc_callid_t callid, ipc_call_t *call);
+extern int nic_open_impl(ddf_fun_t *fun);
 extern void nic_close_impl(ddf_fun_t *fun);
 
Index: uspace/lib/nic/include/nic_rx_control.h
===================================================================
--- uspace/lib/nic/include/nic_rx_control.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/include/nic_rx_control.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -114,9 +114,9 @@
 } __attribute__ ((packed)) vlan_header_t;
 
-extern errno_t nic_rxc_init(nic_rxc_t *rxc);
-extern errno_t nic_rxc_clear(nic_rxc_t *rxc);
-extern errno_t nic_rxc_set_addr(nic_rxc_t *rxc,
+extern int nic_rxc_init(nic_rxc_t *rxc);
+extern int nic_rxc_clear(nic_rxc_t *rxc);
+extern int nic_rxc_set_addr(nic_rxc_t *rxc,
 	const nic_address_t *prev_addr, const nic_address_t *curr_addr);
-extern bool nic_rxc_check(const nic_rxc_t *rxc,
+extern int nic_rxc_check(const nic_rxc_t *rxc,
 	const void *data, size_t size, nic_frame_type_t *frame_type);
 extern void nic_rxc_hw_filtering(nic_rxc_t *rxc,
@@ -126,20 +126,20 @@
 extern void nic_rxc_unicast_get_mode(const nic_rxc_t *, nic_unicast_mode_t *,
 	size_t max_count, nic_address_t *address_list, size_t *address_count);
-extern errno_t nic_rxc_unicast_set_mode(nic_rxc_t *rxc, nic_unicast_mode_t mode,
+extern int nic_rxc_unicast_set_mode(nic_rxc_t *rxc, nic_unicast_mode_t mode,
 	const nic_address_t *address_list, size_t address_count);
 extern void nic_rxc_multicast_get_mode(const nic_rxc_t *,
 	nic_multicast_mode_t *, size_t, nic_address_t *, size_t *);
-extern errno_t nic_rxc_multicast_set_mode(nic_rxc_t *, nic_multicast_mode_t mode,
+extern int nic_rxc_multicast_set_mode(nic_rxc_t *, nic_multicast_mode_t mode,
 	const nic_address_t *address_list, size_t address_count);
 extern void nic_rxc_broadcast_get_mode(const nic_rxc_t *,
 	nic_broadcast_mode_t *mode);
-extern errno_t nic_rxc_broadcast_set_mode(nic_rxc_t *,
+extern int nic_rxc_broadcast_set_mode(nic_rxc_t *,
 	nic_broadcast_mode_t mode);
 extern void nic_rxc_blocked_sources_get(const nic_rxc_t *,
 	size_t max_count, nic_address_t *address_list, size_t *address_count);
-extern errno_t nic_rxc_blocked_sources_set(nic_rxc_t *,
+extern int nic_rxc_blocked_sources_set(nic_rxc_t *,
 	const nic_address_t *address_list, size_t address_count);
-extern errno_t nic_rxc_vlan_get_mask(const nic_rxc_t *rxc, nic_vlan_mask_t *mask);
-extern errno_t nic_rxc_vlan_set_mask(nic_rxc_t *rxc, const nic_vlan_mask_t *mask);
+extern int nic_rxc_vlan_get_mask(const nic_rxc_t *rxc, nic_vlan_mask_t *mask);
+extern int nic_rxc_vlan_set_mask(nic_rxc_t *rxc, const nic_vlan_mask_t *mask);
 
 #endif
Index: uspace/lib/nic/include/nic_wol_virtues.h
===================================================================
--- uspace/lib/nic/include/nic_wol_virtues.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/include/nic_wol_virtues.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -74,14 +74,14 @@
 } nic_wol_virtues_t;
 
-extern errno_t nic_wol_virtues_init(nic_wol_virtues_t *);
+extern int nic_wol_virtues_init(nic_wol_virtues_t *);
 extern void nic_wol_virtues_clear(nic_wol_virtues_t *);
-extern errno_t nic_wol_virtues_verify(nic_wv_type_t, const void *, size_t);
-extern errno_t nic_wol_virtues_list(const nic_wol_virtues_t *, nic_wv_type_t type,
-    size_t max_count, nic_wv_id_t *id_list, size_t *id_count);
-extern errno_t nic_wol_virtues_add(nic_wol_virtues_t *, nic_wol_virtue_t *);
+extern int nic_wol_virtues_verify(nic_wv_type_t, const void *, size_t);
+extern int nic_wol_virtues_list(const nic_wol_virtues_t *, nic_wv_type_t type,
+	size_t max_count, nic_wv_id_t *id_list, size_t *id_count);
+extern int nic_wol_virtues_add(nic_wol_virtues_t *, nic_wol_virtue_t *);
 extern nic_wol_virtue_t *nic_wol_virtues_remove(nic_wol_virtues_t *,
-    nic_wv_id_t);
+	nic_wv_id_t);
 extern const nic_wol_virtue_t *nic_wol_virtues_find(const nic_wol_virtues_t *,
-    nic_wv_id_t);
+	nic_wv_id_t);
 
 #endif
Index: uspace/lib/nic/src/nic_addr_db.c
===================================================================
--- uspace/lib/nic/src/nic_addr_db.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/src/nic_addr_db.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -120,5 +120,5 @@
  * @return ENOMEM	If there was not enough memory to initialize the storage
  */
-errno_t nic_addr_db_init(nic_addr_db_t *db, size_t addr_len)
+int nic_addr_db_init(nic_addr_db_t *db, size_t addr_len)
 {
 	assert(db);
@@ -168,5 +168,5 @@
  * @return EEXIST	If this adress already is in the db
  */
-errno_t nic_addr_db_insert(nic_addr_db_t *db, const uint8_t *addr)
+int nic_addr_db_insert(nic_addr_db_t *db, const uint8_t *addr)
 {
 	assert(db && addr);
@@ -200,5 +200,5 @@
  * @return ENOENT	If there is no address
  */
-errno_t nic_addr_db_remove(nic_addr_db_t *db, const uint8_t *addr)
+int nic_addr_db_remove(nic_addr_db_t *db, const uint8_t *addr)
 {
 	assert(db && addr);
@@ -223,5 +223,5 @@
  * @return true if the address is in the db, false otherwise
  */
-bool nic_addr_db_contains(const nic_addr_db_t *db, const uint8_t *addr)
+int nic_addr_db_contains(const nic_addr_db_t *db, const uint8_t *addr)
 {
 	assert(db && addr);
Index: uspace/lib/nic/src/nic_driver.c
===================================================================
--- uspace/lib/nic/src/nic_driver.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/src/nic_driver.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,5 +61,5 @@
  * @param name	Name of the device/driver (used in logging)
  */
-errno_t nic_driver_init(const char *name)
+int nic_driver_init(const char *name)
 {
 	list_initialize(&nic_globals.frame_list_cache);
@@ -241,7 +241,7 @@
  * @param[out]	resources	Parsed lists of resources.
  *
- * @return EOK or an error code
- */
-errno_t nic_get_resources(nic_t *nic_data, hw_res_list_parsed_t *resources)
+ * @return EOK or negative error code
+ */
+int nic_get_resources(nic_t *nic_data, hw_res_list_parsed_t *resources)
 {
 	ddf_dev_t *dev = nic_data->dev;
@@ -399,8 +399,8 @@
  *  @return EINVAL
  */
-errno_t nic_report_poll_mode(nic_t *nic_data, nic_poll_mode_t mode,
+int nic_report_poll_mode(nic_t *nic_data, nic_poll_mode_t mode,
 	struct timeval *period)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	fibril_rwlock_write_lock(&nic_data->main_lock);
 	nic_data->poll_mode = mode;
@@ -423,5 +423,5 @@
  *
  */
-errno_t nic_report_address(nic_t *nic_data, const nic_address_t *address)
+int nic_report_address(nic_t *nic_data, const nic_address_t *address)
 {
 	assert(nic_data);
@@ -434,5 +434,5 @@
 	/* Notify NIL layer (and uppper) if bound - not in add_device */
 	if (nic_data->client_session != NULL) {
-		errno_t rc = nic_ev_addr_changed(nic_data->client_session,
+		int rc = nic_ev_addr_changed(nic_data->client_session,
 		    address);
 
@@ -450,5 +450,5 @@
 	 * calls this should not happen.
 	 */
-	errno_t rc = nic_rxc_set_addr(&nic_data->rx_control,
+	int rc = nic_rxc_set_addr(&nic_data->rx_control,
 	    &nic_data->mac, address);
 	
@@ -521,5 +521,5 @@
 	fibril_rwlock_read_lock(&nic_data->rxc_lock);
 	nic_frame_type_t frame_type;
-	bool check = nic_rxc_check(&nic_data->rx_control, frame->data,
+	int check = nic_rxc_check(&nic_data->rx_control, frame->data,
 	    frame->size, &frame_type);
 	fibril_rwlock_read_unlock(&nic_data->rxc_lock);
@@ -808,5 +808,5 @@
  * @return ENOENT
  */
-errno_t nic_query_vlan_mask(const nic_t *nic_data, nic_vlan_mask_t *mask)
+int nic_query_vlan_mask(const nic_t *nic_data, nic_vlan_mask_t *mask)
 {
 	assert(mask);
@@ -1039,5 +1039,5 @@
  *  @return 0, never reached
  */
-static errno_t period_fibril_fun(void *data)
+static int period_fibril_fun(void *data)
 {
 	nic_t *nic = data;
@@ -1092,5 +1092,5 @@
 		fibril_rwlock_read_unlock(&nic->main_lock);
 	}
-	return EOK;
+	return 0;
 }
 
Index: uspace/lib/nic/src/nic_ev.c
===================================================================
--- uspace/lib/nic/src/nic_ev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/src/nic_ev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 
 /** Device address changed. */
-errno_t nic_ev_addr_changed(async_sess_t *sess, const nic_address_t *addr)
+int nic_ev_addr_changed(async_sess_t *sess, const nic_address_t *addr)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -48,5 +48,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, NIC_EV_ADDR_CHANGED, &answer);
-	errno_t retval = async_data_write_start(exch, addr,
+	sysarg_t retval = async_data_write_start(exch, addr,
 	    sizeof(nic_address_t));
 
@@ -63,7 +63,7 @@
 
 /** Device state changed. */
-errno_t nic_ev_device_state(async_sess_t *sess, sysarg_t state)
+int nic_ev_device_state(async_sess_t *sess, sysarg_t state)
 {
-	errno_t rc;
+	int rc;
 
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -75,5 +75,5 @@
 
 /** Frame received. */
-errno_t nic_ev_received(async_sess_t *sess, void *data, size_t size)
+int nic_ev_received(async_sess_t *sess, void *data, size_t size)
 {
 	async_exch_t *exch = async_exchange_begin(sess);
@@ -81,5 +81,5 @@
 	ipc_call_t answer;
 	aid_t req = async_send_0(exch, NIC_EV_RECEIVED, &answer);
-	errno_t retval = async_data_write_start(exch, data, size);
+	sysarg_t retval = async_data_write_start(exch, data, size);
 
 	async_exchange_end(exch);
Index: uspace/lib/nic/src/nic_impl.c
===================================================================
--- uspace/lib/nic/src/nic_impl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/src/nic_impl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,5 @@
  * @return EOK always.
  */
-errno_t nic_get_state_impl(ddf_fun_t *fun, nic_device_state_t *state)
+int nic_get_state_impl(ddf_fun_t *fun, nic_device_state_t *state)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
@@ -72,5 +72,5 @@
  * @return EINVAL	If the state cannot be changed
  */
-errno_t nic_set_state_impl(ddf_fun_t *fun, nic_device_state_t state)
+int nic_set_state_impl(ddf_fun_t *fun, nic_device_state_t state)
 {
 	if (state >= NIC_STATE_MAX) {
@@ -108,5 +108,5 @@
 	}
 	if (event_handler != NULL) {
-		errno_t rc = event_handler(nic_data);
+		int rc = event_handler(nic_data);
 		if (rc != EOK) {
 			fibril_rwlock_write_unlock(&nic_data->main_lock);
@@ -117,5 +117,5 @@
 	if (state == NIC_STATE_STOPPED) {
 		/* Notify upper layers that we are reseting the MAC */
-		errno_t rc = nic_ev_addr_changed(nic_data->client_session,
+		int rc = nic_ev_addr_changed(nic_data->client_session,
 			&nic_data->default_mac);
 		nic_data->poll_mode = nic_data->default_poll_mode;
@@ -168,5 +168,5 @@
  * @return EBUSY	If the device is not in state when the frame can be sent.
  */
-errno_t nic_send_frame_impl(ddf_fun_t *fun, void *data, size_t size)
+int nic_send_frame_impl(ddf_fun_t *fun, void *data, size_t size)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
@@ -189,7 +189,7 @@
  * @param	fun
  *
- * @return EOK		On success, or an error code.
- */
-errno_t nic_callback_create_impl(ddf_fun_t *fun)
+ * @return EOK		On success, or negative error code.
+ */
+int nic_callback_create_impl(ddf_fun_t *fun)
 {
 	nic_t *nic = nic_get_from_ddf_fun(fun);
@@ -216,5 +216,5 @@
  * @return ELIMIT	If the buffer is too short
  */
-errno_t nic_get_address_impl(ddf_fun_t *fun, nic_address_t *address)
+int nic_get_address_impl(ddf_fun_t *fun, nic_address_t *address)
 {
 	assert(address);
@@ -235,5 +235,5 @@
  * @return EOK (cannot fail)
  */
-errno_t nic_get_stats_impl(ddf_fun_t *fun, nic_device_stats_t *stats)
+int nic_get_stats_impl(ddf_fun_t *fun, nic_device_stats_t *stats)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
@@ -257,5 +257,5 @@
  * @return EOK
  */
-errno_t nic_unicast_get_mode_impl(ddf_fun_t *fun, nic_unicast_mode_t *mode,
+int nic_unicast_get_mode_impl(ddf_fun_t *fun, nic_unicast_mode_t *mode,
 	size_t max_count, nic_address_t *addr_list, size_t *addr_count)
 {
@@ -281,5 +281,5 @@
  * @return ENOMEM
  */
-errno_t nic_unicast_set_mode_impl(ddf_fun_t *fun,
+int nic_unicast_set_mode_impl(ddf_fun_t *fun,
 	nic_unicast_mode_t mode, const nic_address_t *addr_list, size_t addr_count)
 {
@@ -294,5 +294,5 @@
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_write_lock(&nic_data->rxc_lock);
-	errno_t rc = ENOTSUP;
+	int rc = ENOTSUP;
 	if (nic_data->on_unicast_mode_change) {
 		rc = nic_data->on_unicast_mode_change(nic_data,
@@ -324,5 +324,5 @@
  * @return EOK
  */
-errno_t nic_multicast_get_mode_impl(ddf_fun_t *fun, nic_multicast_mode_t *mode,
+int nic_multicast_get_mode_impl(ddf_fun_t *fun, nic_multicast_mode_t *mode,
 	size_t max_count, nic_address_t *addr_list, size_t *addr_count)
 {
@@ -348,5 +348,5 @@
  * @return ENOMEM
  */
-errno_t nic_multicast_set_mode_impl(ddf_fun_t *fun,	nic_multicast_mode_t mode,
+int nic_multicast_set_mode_impl(ddf_fun_t *fun,	nic_multicast_mode_t mode,
 	const nic_address_t *addr_list, size_t addr_count)
 {
@@ -361,5 +361,5 @@
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_write_lock(&nic_data->rxc_lock);
-	errno_t rc = ENOTSUP;
+	int rc = ENOTSUP;
 	if (nic_data->on_multicast_mode_change) {
 		rc = nic_data->on_multicast_mode_change(nic_data, mode, addr_list, addr_count);
@@ -381,5 +381,5 @@
  * @return EOK
  */
-errno_t nic_broadcast_get_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t *mode)
+int nic_broadcast_get_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t *mode)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
@@ -401,9 +401,9 @@
  * @return ENOMEM
  */
-errno_t nic_broadcast_set_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t mode)
+int nic_broadcast_set_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t mode)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_write_lock(&nic_data->rxc_lock);
-	errno_t rc = ENOTSUP;
+	int rc = ENOTSUP;
 	if (nic_data->on_broadcast_mode_change) {
 		rc = nic_data->on_broadcast_mode_change(nic_data, mode);
@@ -427,5 +427,5 @@
  * @return EOK
  */
-errno_t nic_blocked_sources_get_impl(ddf_fun_t *fun,
+int nic_blocked_sources_get_impl(ddf_fun_t *fun,
 	size_t max_count, nic_address_t *addr_list, size_t *addr_count)
 {
@@ -450,5 +450,5 @@
  * @return ENOMEM
  */
-errno_t nic_blocked_sources_set_impl(ddf_fun_t *fun,
+int nic_blocked_sources_set_impl(ddf_fun_t *fun,
 	const nic_address_t *addr_list, size_t addr_count)
 {
@@ -458,5 +458,5 @@
 		nic_data->on_blocked_sources_change(nic_data, addr_list, addr_count);
 	}
-	errno_t rc = nic_rxc_blocked_sources_set(&nic_data->rx_control,
+	int rc = nic_rxc_blocked_sources_set(&nic_data->rx_control,
 		addr_list, addr_count);
 	fibril_rwlock_write_unlock(&nic_data->rxc_lock);
@@ -473,9 +473,9 @@
  * @return ENOENT	If the mask is not set
  */
-errno_t nic_vlan_get_mask_impl(ddf_fun_t *fun, nic_vlan_mask_t *mask)
+int nic_vlan_get_mask_impl(ddf_fun_t *fun, nic_vlan_mask_t *mask)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->rxc_lock);
-	errno_t rc = nic_rxc_vlan_get_mask(&nic_data->rx_control, mask);
+	int rc = nic_rxc_vlan_get_mask(&nic_data->rx_control, mask);
 	fibril_rwlock_read_unlock(&nic_data->rxc_lock);
 	return rc;
@@ -491,9 +491,9 @@
  * @return ENOMEM
  */
-errno_t nic_vlan_set_mask_impl(ddf_fun_t *fun, const nic_vlan_mask_t *mask)
+int nic_vlan_set_mask_impl(ddf_fun_t *fun, const nic_vlan_mask_t *mask)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_write_lock(&nic_data->rxc_lock);
-	errno_t rc = nic_rxc_vlan_set_mask(&nic_data->rx_control, mask);
+	int rc = nic_rxc_vlan_set_mask(&nic_data->rx_control, mask);
 	if (rc == EOK && nic_data->on_vlan_mask_change) {
 		nic_data->on_vlan_mask_change(nic_data, mask);
@@ -518,5 +518,5 @@
  * @return ENOMEM	If there was not enough memory to complete the operation
  */
-errno_t nic_wol_virtue_add_impl(ddf_fun_t *fun, nic_wv_type_t type,
+int nic_wol_virtue_add_impl(ddf_fun_t *fun, nic_wv_type_t type,
 	const void *data, size_t length, nic_wv_id_t *new_id)
 {
@@ -560,5 +560,5 @@
 	}
 	/* Call the user-defined add callback */
-	errno_t rc = nic_data->on_wol_virtue_add(nic_data, virtue);
+	int rc = nic_data->on_wol_virtue_add(nic_data, virtue);
 	if (rc != EOK) {
 		free(virtue->data);
@@ -593,5 +593,5 @@
  * @return ENOENT	If the virtue identifier is not valid.
  */
-errno_t nic_wol_virtue_remove_impl(ddf_fun_t *fun, nic_wv_id_t id)
+int nic_wol_virtue_remove_impl(ddf_fun_t *fun, nic_wv_id_t id)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
@@ -629,5 +629,5 @@
  * @return ENOMEM	If there was not enough memory to complete the operation
  */
-errno_t nic_wol_virtue_probe_impl(ddf_fun_t *fun, nic_wv_id_t id,
+int nic_wol_virtue_probe_impl(ddf_fun_t *fun, nic_wv_id_t id,
 	nic_wv_type_t *type, size_t max_length, void *data, size_t *length)
 {
@@ -667,10 +667,10 @@
  * @return ENOMEM	If there was not enough memory to complete the operation
  */
-errno_t nic_wol_virtue_list_impl(ddf_fun_t *fun, nic_wv_type_t type,
+int nic_wol_virtue_list_impl(ddf_fun_t *fun, nic_wv_type_t type,
 	size_t max_count, nic_wv_id_t *id_list, size_t *id_count)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->wv_lock);
-	errno_t rc = nic_wol_virtues_list(&nic_data->wol_virtues, type,
+	int rc = nic_wol_virtues_list(&nic_data->wol_virtues, type,
 		max_count, id_list, id_count);
 	fibril_rwlock_read_unlock(&nic_data->wv_lock);
@@ -688,5 +688,5 @@
  * @return EOK		If the operation was successfully completed
   */
-errno_t nic_wol_virtue_get_caps_impl(ddf_fun_t *fun, nic_wv_type_t type, int *count)
+int nic_wol_virtue_get_caps_impl(ddf_fun_t *fun, nic_wv_type_t type, int *count)
 {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
@@ -710,5 +710,5 @@
  * @return EPARTY	Error in communication protocol
  */
-errno_t nic_poll_get_mode_impl(ddf_fun_t *fun,
+int nic_poll_get_mode_impl(ddf_fun_t *fun,
 	nic_poll_mode_t *mode, struct timeval *period)
 {
@@ -733,5 +733,5 @@
  * @return EPARTY	Error in communication protocol
  */
-errno_t nic_poll_set_mode_impl(ddf_fun_t *fun,
+int nic_poll_set_mode_impl(ddf_fun_t *fun,
 	nic_poll_mode_t mode, const struct timeval *period)
 {
@@ -754,5 +754,5 @@
 	}
 	fibril_rwlock_write_lock(&nic_data->main_lock);
-	errno_t rc = nic_data->on_poll_mode_change(nic_data, mode, period);
+	int rc = nic_data->on_poll_mode_change(nic_data, mode, period);
 	assert(rc == EOK || rc == ENOTSUP || rc == EINVAL);
 	if (rc == ENOTSUP && (nic_data->on_poll_request != NULL) && 
@@ -783,5 +783,5 @@
  * @return EINVAL	If the NIC is not in state where it allows on demand polling
  */
-errno_t nic_poll_now_impl(ddf_fun_t *fun) {
+int nic_poll_now_impl(ddf_fun_t *fun) {
 	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->main_lock);
@@ -821,5 +821,5 @@
  * @return EOK always.
  */
-errno_t nic_open_impl(ddf_fun_t *fun)
+int nic_open_impl(ddf_fun_t *fun)
 {
 	return EOK;
Index: uspace/lib/nic/src/nic_rx_control.c
===================================================================
--- uspace/lib/nic/src/nic_rx_control.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/src/nic_rx_control.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,8 +52,8 @@
  * @return EINVAL	Internal error, should not happen
  */
-errno_t nic_rxc_init(nic_rxc_t *rxc)
+int nic_rxc_init(nic_rxc_t *rxc)
 {
 	memset(rxc, 0, sizeof(nic_rxc_t));
-	errno_t rc;
+	int rc;
 	rc = nic_addr_db_init(&rxc->blocked_sources, ETH_ADDR);
 	if (rc != EOK) {
@@ -84,5 +84,5 @@
  * @param filters
  */
-errno_t nic_rxc_clear(nic_rxc_t *rxc)
+int nic_rxc_clear(nic_rxc_t *rxc)
 {
 	nic_addr_db_destroy(&rxc->unicast_addrs);
@@ -103,9 +103,9 @@
  *
  */
-errno_t nic_rxc_set_addr(nic_rxc_t *rxc, const nic_address_t *prev_addr,
+int nic_rxc_set_addr(nic_rxc_t *rxc, const nic_address_t *prev_addr,
     const nic_address_t *curr_addr)
 {
 	if (prev_addr != NULL) {
-		errno_t rc = nic_addr_db_remove(&rxc->unicast_addrs,
+		int rc = nic_addr_db_remove(&rxc->unicast_addrs,
 		    (const uint8_t *) &prev_addr->address);
 		if (rc != EOK)
@@ -173,5 +173,5 @@
  * @return ENOMEM	If there was not enough memory
  */
-errno_t nic_rxc_unicast_set_mode(nic_rxc_t *rxc, nic_unicast_mode_t mode,
+int nic_rxc_unicast_set_mode(nic_rxc_t *rxc, nic_unicast_mode_t mode,
 	const nic_address_t *address_list, size_t address_count)
 {
@@ -188,5 +188,5 @@
 	size_t i;
 	for (i = 0; i < address_count; ++i) {
-		errno_t rc = nic_addr_db_insert(&rxc->unicast_addrs,
+		int rc = nic_addr_db_insert(&rxc->unicast_addrs,
 			(const uint8_t *) &address_list[i].address);
 		if (rc == ENOMEM) {
@@ -237,5 +237,5 @@
  * @return ENOMEM	If there was not enough memory
  */
-errno_t nic_rxc_multicast_set_mode(nic_rxc_t *rxc, nic_multicast_mode_t mode,
+int nic_rxc_multicast_set_mode(nic_rxc_t *rxc, nic_multicast_mode_t mode,
 	const nic_address_t *address_list, size_t address_count)
 {
@@ -251,5 +251,5 @@
 	size_t i;
 	for (i = 0; i < address_count; ++i) {
-		errno_t rc = nic_addr_db_insert(&rxc->multicast_addrs,
+		int rc = nic_addr_db_insert(&rxc->multicast_addrs,
 			(const uint8_t *)&address_list[i].address);
 		if (rc == ENOMEM) {
@@ -279,5 +279,5 @@
  * @return EOK		On success
  */
-errno_t nic_rxc_broadcast_set_mode(nic_rxc_t *rxc, nic_broadcast_mode_t mode)
+int nic_rxc_broadcast_set_mode(nic_rxc_t *rxc, nic_broadcast_mode_t mode)
 {
 	rxc->broadcast_mode = mode;
@@ -320,5 +320,5 @@
  * @return ENOMEM	If there was not enough memory
  */
-errno_t nic_rxc_blocked_sources_set(nic_rxc_t *rxc,
+int nic_rxc_blocked_sources_set(nic_rxc_t *rxc,
 	const nic_address_t *address_list, size_t address_count)
 {
@@ -330,5 +330,5 @@
 	size_t i;
 	for (i = 0; i < address_count; ++i) {
-		errno_t rc = nic_addr_db_insert(&rxc->blocked_sources,
+		int rc = nic_addr_db_insert(&rxc->blocked_sources,
 			(const uint8_t *) &address_list[i].address);
 		if (rc == ENOMEM) {
@@ -348,5 +348,5 @@
  * @return ENOENT
  */
-errno_t nic_rxc_vlan_get_mask(const nic_rxc_t *rxc, nic_vlan_mask_t *mask)
+int nic_rxc_vlan_get_mask(const nic_rxc_t *rxc, nic_vlan_mask_t *mask)
 {
 	if (rxc->vlan_mask == NULL) {
@@ -366,5 +366,5 @@
  * @return ENOMEM
  */
-errno_t nic_rxc_vlan_set_mask(nic_rxc_t *rxc, const nic_vlan_mask_t *mask)
+int nic_rxc_vlan_set_mask(nic_rxc_t *rxc, const nic_vlan_mask_t *mask)
 {
 	if (mask == NULL) {
@@ -394,5 +394,5 @@
  * @return True if the frame passes, false if it does not
  */
-bool nic_rxc_check(const nic_rxc_t *rxc, const void *data, size_t size,
+int nic_rxc_check(const nic_rxc_t *rxc, const void *data, size_t size,
 	nic_frame_type_t *frame_type)
 {
Index: uspace/lib/nic/src/nic_wol_virtues.c
===================================================================
--- uspace/lib/nic/src/nic_wol_virtues.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/nic/src/nic_wol_virtues.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -71,5 +71,5 @@
  * @return ENOMEM	On not enough memory
  */
-errno_t nic_wol_virtues_init(nic_wol_virtues_t *wvs)
+int nic_wol_virtues_init(nic_wol_virtues_t *wvs)
 {
 	memset(wvs, 0, sizeof(nic_wol_virtues_t));
@@ -124,5 +124,5 @@
  * @return ENOTSUP	This type is unknown
  */
-errno_t nic_wol_virtues_verify(nic_wv_type_t type, const void *data, size_t length)
+int nic_wol_virtues_verify(nic_wv_type_t type, const void *data, size_t length)
 {
 	switch (type) {
@@ -160,5 +160,5 @@
  * @return ENOMEM	Not enough memory to activate the virtue
  */
-errno_t nic_wol_virtues_add(nic_wol_virtues_t *wvs, nic_wol_virtue_t *virtue)
+int nic_wol_virtues_add(nic_wol_virtues_t *wvs, nic_wol_virtue_t *virtue)
 {
 	if (!nic_wv_is_multi(virtue->type) &&
@@ -247,5 +247,5 @@
  * @return EINVAL	If the filter type is invalid
  */
-errno_t nic_wol_virtues_list(const nic_wol_virtues_t *wvs, nic_wv_type_t type,
+int nic_wol_virtues_list(const nic_wol_virtues_t *wvs, nic_wv_type_t type,
 	size_t max_count, nic_wv_id_t *id_list, size_t *id_count)
 {
Index: uspace/lib/packet/include/netdb.h
===================================================================
--- uspace/lib/packet/include/netdb.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/packet/include/netdb.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup netdb
+ *  @{
+ */
+
+/** @file
+ *  Structures and interfaces according to the BSD netdb.h file.
+ */
+
+#ifndef __NET_NETDB_H__
+#define __NET_NETDB_H__
+
+#include <sys/types.h>
+
+/** Structure returned by network data base library.
+ *  All addresses are supplied in host order, and returned in network order (suitable for use in system calls).
+ */
+struct	hostent {
+	/** Official host name.
+	 */
+	char * h_name;
+	/** Alias list.
+	 */
+	char **	h_aliases;
+	/** Host address type.
+	 */
+	int h_addrtype;
+	/** Address length.
+	 */
+	int h_length;
+	/** List of addresses from name server.
+	 */
+	char **	h_addr_list;
+	/** Address, for backward compatiblity.
+	 */
+#define	h_addr	h_addr_list[0]
+};
+
+/** @name Host entry address types definitions.
+ */
+/*@{*/
+
+/** Authoritative Answer Host not found address type.
+ */
+#define	HOST_NOT_FOUND	1
+
+/** Non-Authoritive Host not found, or SERVERFAIL address type.
+ */
+#define	TRY_AGAIN	2
+
+/** Non recoverable errors, FORMERR, REFUSED, NOTIMP address type.
+ */
+#define	NO_RECOVERY	3
+
+/** Valid name, no data record of requested type address type.
+ */
+#define	NO_DATA		4
+
+/** No address, look for MX record address type.
+ */
+#define	NO_ADDRESS	NO_DATA
+
+/*@}*/
+
+/** Returns host entry by the host address.
+ *  @param[in] address The host address.
+ *  @param[in] len The address length.
+ *  @param[in] type The address type.
+ *  @returns Host entry information.
+ */
+//struct hostent *	gethostbyaddr(const void * address, int len, int type);
+
+/** Returns host entry by the host name.
+ *  @param[in] name The host name.
+ *  @returns Host entry information.
+ */
+//struct hostent *	gethostbyname(const char * name);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/packet/include/tcp_codes.h
===================================================================
--- uspace/lib/packet/include/tcp_codes.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/packet/include/tcp_codes.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup tcp
+ *  @{
+ */
+
+/** @file
+ *  TCP options definitions.
+ */
+
+#ifndef __NET_TCP_CODES_H__
+#define __NET_TCP_CODES_H__
+
+/** End of list TCP option.
+ */
+#define TCPOPT_END_OF_LIST				0x0
+
+/** No operation TCP option.
+ */
+#define TCPOPT_NO_OPERATION				0x1
+
+/** Maximum segment size TCP option.
+ */
+#define TCPOPT_MAX_SEGMENT_SIZE			0x2
+
+/** Maximum segment size TCP option length.
+ */
+#define TCPOPT_MAX_SEGMENT_SIZE_LENGTH	4
+
+/** Window scale TCP option.
+ */
+#define TCPOPT_WINDOW_SCALE				0x3
+
+/** Window scale TCP option length.
+ */
+#define TCPOPT_WINDOW_SCALE_LENGTH		3
+
+/** Selective acknowledgement permitted TCP option.
+ */
+#define TCPOPT_SACK_PERMITTED			0x4
+
+/** Selective acknowledgement permitted TCP option length.
+ */
+#define TCPOPT_SACK_PERMITTED_LENGTH	2
+
+/** Selective acknowledgement TCP option.
+ *  Has variable length.
+ */
+#define TCPOPT_SACK						0x5
+
+/** Timestamp TCP option.
+ */
+#define TCPOPT_TIMESTAMP				0x8
+
+/** Timestamp TCP option length.
+ */
+#define TCPOPT_TIMESTAMP_LENGTH			10
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/pcm/include/pcm/format.h
===================================================================
--- uspace/lib/pcm/include/pcm/format.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcm/include/pcm/format.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -99,8 +99,8 @@
 }
 void pcm_format_silence(void *dst, size_t size, const pcm_format_t *f);
-errno_t pcm_format_convert_and_mix(void *dst, size_t dst_size, const void *src,
+int pcm_format_convert_and_mix(void *dst, size_t dst_size, const void *src,
     size_t src_size, const pcm_format_t *sf, const pcm_format_t *df);
-errno_t pcm_format_mix(void *dst, const void *src, size_t size, const pcm_format_t *f);
-errno_t pcm_format_convert(pcm_format_t a, void* srca, size_t sizea,
+int pcm_format_mix(void *dst, const void *src, size_t size, const pcm_format_t *f);
+int pcm_format_convert(pcm_format_t a, void* srca, size_t sizea,
     pcm_format_t b, void* srcb, size_t *sizeb);
 
Index: uspace/lib/pcm/include/pcm/sample_format.h
===================================================================
--- uspace/lib/pcm/include/pcm/sample_format.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcm/include/pcm/sample_format.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -184,11 +184,11 @@
 	switch(format) {
 	case PCM_SAMPLE_UINT8:
-		return "8 bit unsigned";
+		return "8 bit unsinged";
 	case PCM_SAMPLE_SINT8:
-		return "8 bit signed";
+		return "8 bit singed";
 	case PCM_SAMPLE_UINT16_LE:
 		return "16 bit unsigned(LE)";
 	case PCM_SAMPLE_SINT16_LE:
-		return "16 bit signed(LE)";
+		return "16 bit singed(LE)";
 	case PCM_SAMPLE_UINT16_BE:
 		return "16 bit unsigned(BE)";
Index: uspace/lib/pcm/src/format.c
===================================================================
--- uspace/lib/pcm/src/format.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcm/src/format.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -170,5 +170,5 @@
  * @return Error code.
  */
-errno_t pcm_format_mix(void *dst, const void *src, size_t size, const pcm_format_t *f)
+int pcm_format_mix(void *dst, const void *src, size_t size, const pcm_format_t *f)
 {
 	return pcm_format_convert_and_mix(dst, size, src, size, f, f);
@@ -188,5 +188,5 @@
  * If there are not enough data in the source buffer silent data is assumed.
  */
-errno_t pcm_format_convert_and_mix(void *dst, size_t dst_size, const void *src,
+int pcm_format_convert_and_mix(void *dst, size_t dst_size, const void *src,
     size_t src_size, const pcm_format_t *sf, const pcm_format_t *df)
 {
Index: uspace/lib/pcut/helenos.mak
===================================================================
--- uspace/lib/pcut/helenos.mak	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/helenos.mak	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,4 +39,3 @@
 
 EXTRA_CFLAGS = -D__helenos__
-
 LIBRARY = libpcut
Index: uspace/lib/pcut/include/pcut/asserts.h
===================================================================
--- uspace/lib/pcut/include/pcut/asserts.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/include/pcut/asserts.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -77,5 +77,5 @@
  * @param size Size of the buffer.
  */
-void pcut_str_error(errno_t error, char *buffer, int size);
+void pcut_str_error(int error, char *buffer, int size);
 
 /** Raise assertion error (internal version).
@@ -264,6 +264,6 @@
 #define PCUT_ASSERT_ERRNO_VAL_WITH_NAME(expected_value, expected_quoted, actual_value) \
 	do {\
-		errno_t pcut_expected_eval = (expected_value); \
-		errno_t pcut_actual_eval = (actual_value); \
+		int pcut_expected_eval = (expected_value); \
+		int pcut_actual_eval = (actual_value); \
 		if (pcut_expected_eval != pcut_actual_eval) { \
 			char pcut_expected_description[100]; \
Index: uspace/lib/pcut/include/pcut/pcut.h
===================================================================
--- uspace/lib/pcut/include/pcut/pcut.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/include/pcut/pcut.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,17 +36,3 @@
 #include <pcut/tests.h>
 
-
-/** PCUT outcome: test passed. */
-#define PCUT_OUTCOME_PASS 0
-
-/** PCUT outcome: test failed. */
-#define PCUT_OUTCOME_FAIL 1
-
-/** PCUT outcome: test failed unexpectedly. */
-#define PCUT_OUTCOME_INTERNAL_ERROR 2
-
-/** PCUT outcome: invalid invocation of the final program. */
-#define PCUT_OUTCOME_BAD_INVOCATION 3
-
-
 #endif
Index: uspace/lib/pcut/src/assert.c
===================================================================
--- uspace/lib/pcut/src/assert.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/assert.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,10 +35,6 @@
  */
 
-/*
- * We need _BSD_SOURCE because of vsnprintf() when compiling under C89.
- * In newer versions of features.h, _DEFAULT_SOURCE must be defined as well.
- */
+/** We need _BSD_SOURCE because of vsnprintf() when compiling under C89. */
 #define _BSD_SOURCE
-#define _DEFAULT_SOURCE
 
 #include "internal.h"
Index: uspace/lib/pcut/src/internal.h
===================================================================
--- uspace/lib/pcut/src/internal.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/internal.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -79,4 +79,14 @@
 #define PCUT_RUN_MODE_SINGLE 2
 
+/** Test outcome: test passed. */
+#define TEST_OUTCOME_PASS 1
+
+/** Test outcome: test failed. */
+#define TEST_OUTCOME_FAIL 2
+
+/** Test outcome: test failed unexpectedly. */
+#define TEST_OUTCOME_ERROR 3
+
+
 /*
  * Use sprintf_s in Windows but only with Microsoft compiler.
@@ -99,5 +109,5 @@
 int pcut_is_arg_with_number(const char *arg, const char *opt, int *value);
 
-int pcut_run_test_forking(const char *self_path, pcut_item_t *test);
+void pcut_run_test_forking(const char *self_path, pcut_item_t *test);
 int pcut_run_test_forked(pcut_item_t *test);
 int pcut_run_test_single(pcut_item_t *test);
@@ -125,5 +135,5 @@
 	/** Test completed. */
 	void (*test_done)(pcut_item_t *, int, const char *, const char *,
-	    const char *);
+		const char *);
 };
 
@@ -135,8 +145,8 @@
 void pcut_report_test_start(pcut_item_t *test);
 void pcut_report_test_done(pcut_item_t *test, int outcome,
-    const char *error_message, const char *teardown_error_message,
-    const char *extra_output);
+		const char *error_message, const char *teardown_error_message,
+		const char *extra_output);
 void pcut_report_test_done_unparsed(pcut_item_t *test, int outcome,
-    const char *unparsed_output, size_t unparsed_output_size);
+		const char *unparsed_output, size_t unparsed_output_size);
 void pcut_report_done(void);
 
Index: uspace/lib/pcut/src/main.c
===================================================================
--- uspace/lib/pcut/src/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -90,11 +90,8 @@
  * @param last Pointer to first item after this suite is stored here.
  * @param prog_path Path to the current binary (used in forked mode).
- * @return Error code.
- */
-static int run_suite(pcut_item_t *suite, pcut_item_t **last, const char *prog_path) {
+ */
+static void run_suite(pcut_item_t *suite, pcut_item_t **last, const char *prog_path) {
 	int is_first_test = 1;
 	int total_count = 0;
-	int ret_code = PCUT_OUTCOME_PASS;
-	int ret_code_tmp;
 
 	pcut_item_t *it = pcut_get_real_next(suite);
@@ -117,19 +114,8 @@
 
 		if (pcut_run_mode == PCUT_RUN_MODE_FORKING) {
-			ret_code_tmp = pcut_run_test_forking(prog_path, it);
-		} else {
-			ret_code_tmp = pcut_run_test_single(it);
-		}
-
-		/*
-		 * Override final return code in case of failure.
-		 *
-		 * In this case we suppress any special error codes as
-		 * to the outside, there was a failure.
-		 */
-		if (ret_code_tmp != PCUT_OUTCOME_PASS) {
-			ret_code = PCUT_OUTCOME_FAIL;
-		}
-
+			pcut_run_test_forking(prog_path, it);
+		} else {
+			pcut_run_test_single(it);
+		}
 		total_count++;
 	}
@@ -144,6 +130,4 @@
 		*last = it;
 	}
-
-	return ret_code;
 }
 
@@ -197,6 +181,4 @@
 	int run_only_test = -1;
 
-	int rc, rc_tmp;
-
 	if (main_extras == NULL) {
 		main_extras = empty_main_extra;
@@ -221,5 +203,5 @@
 			if (pcut_str_equals(argv[i], "-l")) {
 				pcut_print_tests(items);
-				return PCUT_OUTCOME_PASS;
+				return 0;
 			}
 			if (pcut_str_equals(argv[i], "-x")) {
@@ -247,5 +229,5 @@
 	if ((run_only_suite >= 0) && (run_only_test >= 0)) {
 		printf("Specify either -s or -t!\n");
-		return PCUT_OUTCOME_BAD_INVOCATION;
+		return 1;
 	}
 
@@ -254,24 +236,25 @@
 		if (suite == NULL) {
 			printf("Suite not found, aborting!\n");
-			return PCUT_OUTCOME_BAD_INVOCATION;
+			return 2;
 		}
 		if (suite->kind != PCUT_KIND_TESTSUITE) {
 			printf("Invalid suite id!\n");
-			return PCUT_OUTCOME_BAD_INVOCATION;
+			return 3;
 		}
 
 		run_suite(suite, NULL, argv[0]);
-		return PCUT_OUTCOME_PASS;
+		return 0;
 	}
 
 	if (run_only_test > 0) {
+		int rc;
 		pcut_item_t *test = pcut_find_by_id(items, run_only_test);
 		if (test == NULL) {
 			printf("Test not found, aborting!\n");
-			return PCUT_OUTCOME_BAD_INVOCATION;
+			return 2;
 		}
 		if (test->kind != PCUT_KIND_TEST) {
 			printf("Invalid test id!\n");
-			return PCUT_OUTCOME_BAD_INVOCATION;
+			return 3;
 		}
 
@@ -287,6 +270,4 @@
 	/* Otherwise, run the whole thing. */
 	pcut_report_init(items);
-
-	rc = PCUT_OUTCOME_PASS;
 
 	it = items;
@@ -294,8 +275,5 @@
 		if (it->kind == PCUT_KIND_TESTSUITE) {
 			pcut_item_t *tmp;
-			rc_tmp = run_suite(it, &tmp, argv[0]);
-			if (rc_tmp != PCUT_OUTCOME_PASS) {
-				rc = rc_tmp;
-			}
+			run_suite(it, &tmp, argv[0]);
 			it = tmp;
 		} else {
@@ -306,4 +284,4 @@
 	pcut_report_done();
 
-	return rc;
-}
+	return 0;
+}
Index: uspace/lib/pcut/src/os/generic.c
===================================================================
--- uspace/lib/pcut/src/os/generic.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/os/generic.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,5 +34,4 @@
 #include <stdlib.h>
 #include <stdio.h>
-#include <sys/types.h>
 #include <errno.h>
 #include <assert.h>
@@ -95,9 +94,9 @@
 static int convert_wait_status_to_outcome(int status) {
 	if (status < 0) {
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return TEST_OUTCOME_ERROR;
 	} else if (status == 0) {
-		return PCUT_OUTCOME_PASS;
+		return TEST_OUTCOME_PASS;
 	} else {
-		return PCUT_OUTCOME_FAIL;
+		return TEST_OUTCOME_FAIL;
 	}
 }
@@ -108,6 +107,6 @@
  * @param test Test to be run.
  */
-int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
-	int rc, outcome;
+void pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
+	int rc;
 	FILE *tempfile;
 	char tempfile_name[PCUT_TEMP_FILENAME_BUFFER_SIZE];
@@ -127,19 +126,17 @@
 	PCUT_DEBUG("system() returned 0x%04X", rc);
 
-	outcome = convert_wait_status_to_outcome(rc);
+	rc = convert_wait_status_to_outcome(rc);
 
 	tempfile = fopen(tempfile_name, "rb");
 	if (tempfile == NULL) {
 		pcut_report_test_done(test, TEST_OUTCOME_ERROR, "Failed to open temporary file.", NULL, NULL);
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 
 	fread(extra_output_buffer, 1, OUTPUT_BUFFER_SIZE, tempfile);
 	fclose(tempfile);
-	remove(tempfile_name);
+	unlink(tempfile_name);
 
-	pcut_report_test_done_unparsed(test, outcome, extra_output_buffer, OUTPUT_BUFFER_SIZE);
-
-	return outcome;
+	pcut_report_test_done_unparsed(test, rc, extra_output_buffer, OUTPUT_BUFFER_SIZE);
 }
 
Index: uspace/lib/pcut/src/os/helenos.c
===================================================================
--- uspace/lib/pcut/src/os/helenos.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/os/helenos.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -68,5 +68,5 @@
 }
 
-void pcut_str_error(errno_t error, char *buffer, int size) {
+void pcut_str_error(int error, char *buffer, int size) {
 	const char *str = str_error(error);
 	if (str == NULL) {
@@ -130,5 +130,5 @@
  * @return EOK Always.
  */
-static errno_t test_timeout_handler_fibril(void *arg) {
+static int test_timeout_handler_fibril(void *arg) {
 	pcut_item_t *test = arg;
 	int timeout_sec = pcut_get_test_timeout(test);
@@ -139,5 +139,5 @@
 		goto leave_no_kill;
 	}
-	errno_t rc = fibril_condvar_wait_timeout(&forced_termination_cv,
+	int rc = fibril_condvar_wait_timeout(&forced_termination_cv,
 		&forced_termination_mutex, timeout_us);
 	if (rc == ETIMEOUT) {
@@ -154,14 +154,13 @@
  * @param test Test to be run.
  */
-int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
+void pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
 	before_test_start(test);
 
 	char tempfile_name[PCUT_TEMP_FILENAME_BUFFER_SIZE];
 	snprintf(tempfile_name, PCUT_TEMP_FILENAME_BUFFER_SIZE - 1, "pcut_%lld.tmp", (unsigned long long) task_get_id());
-	int tempfile;
-	errno_t rc = vfs_lookup_open(tempfile_name, WALK_REGULAR | WALK_MAY_CREATE, MODE_READ | MODE_WRITE, &tempfile);
-	if (rc != EOK) {
-		pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, "Failed to create temporary file.", NULL, NULL);
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+	int tempfile = vfs_lookup_open(tempfile_name, WALK_REGULAR | WALK_MAY_CREATE, MODE_READ | MODE_WRITE);
+	if (tempfile < 0) {
+		pcut_report_test_done(test, TEST_OUTCOME_ERROR, "Failed to create temporary file.", NULL, NULL);
+		return;
 	}
 
@@ -175,11 +174,11 @@
 	};
 
-	int status = PCUT_OUTCOME_PASS;
+	int status = TEST_OUTCOME_PASS;
 
 	task_wait_t test_task_wait;
-	rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments,
+	int rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments,
 	    fileno(stdin), tempfile, tempfile);
 	if (rc != EOK) {
-		status = PCUT_OUTCOME_INTERNAL_ERROR;
+		status = TEST_OUTCOME_ERROR;
 		goto leave_close_tempfile;
 	}
@@ -199,11 +198,11 @@
 	rc = task_wait(&test_task_wait, &task_exit, &task_retval);
 	if (rc != EOK) {
-		status = PCUT_OUTCOME_INTERNAL_ERROR;
+		status = TEST_OUTCOME_ERROR;
 		goto leave_close_tempfile;
 	}
 	if (task_exit == TASK_EXIT_UNEXPECTED) {
-		status = PCUT_OUTCOME_INTERNAL_ERROR;
+		status = TEST_OUTCOME_ERROR;
 	} else {
-		status = task_retval == 0 ? PCUT_OUTCOME_PASS : PCUT_OUTCOME_FAIL;
+		status = task_retval == 0 ? TEST_OUTCOME_PASS : TEST_OUTCOME_FAIL;
 	}
 
@@ -222,6 +221,4 @@
 
 	pcut_report_test_done_unparsed(test, status, extra_output_buffer, OUTPUT_BUFFER_SIZE);
-
-	return status;
 }
 
Index: uspace/lib/pcut/src/os/unix.c
===================================================================
--- uspace/lib/pcut/src/os/unix.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/os/unix.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,11 +36,7 @@
 /** We need _BSD_SOURCE because of snprintf() when compiling under C89. */
 #define _BSD_SOURCE
-
-/** Newer versions of features.h needs _DEFAULT_SOURCE. */
-#define _DEFAULT_SOURCE
-
 #include <stdlib.h>
 #include <unistd.h>
-#include <sys/types.h>
+#include <stddef.h>
 #include <signal.h>
 #include <errno.h>
@@ -124,12 +120,12 @@
 	if (WIFEXITED(status)) {
 		if (WEXITSTATUS(status) != 0) {
-			return PCUT_OUTCOME_FAIL;
+			return TEST_OUTCOME_FAIL;
 		} else {
-			return PCUT_OUTCOME_PASS;
+			return TEST_OUTCOME_PASS;
 		}
 	}
 
 	if (WIFSIGNALED(status)) {
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return TEST_OUTCOME_ERROR;
 	}
 
@@ -142,7 +138,7 @@
  * @param test Test to be run.
  */
-int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
+void pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
 	int link_stdout[2], link_stderr[2];
-	int rc, status, outcome;
+	int rc, status;
 	size_t stderr_size;
 
@@ -156,6 +152,6 @@
 		snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1,
 				"pipe() failed: %s.", strerror(rc));
-		pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, error_message_buffer, NULL, NULL);
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		pcut_report_test_done(test, TEST_OUTCOME_ERROR, error_message_buffer, NULL, NULL);
+		return;
 	}
 	rc = pipe(link_stderr);
@@ -163,6 +159,6 @@
 		snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1,
 				"pipe() failed: %s.", strerror(rc));
-		pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, error_message_buffer, NULL, NULL);
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		pcut_report_test_done(test, TEST_OUTCOME_ERROR, error_message_buffer, NULL, NULL);
+		return;
 	}
 
@@ -171,5 +167,5 @@
 		snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1,
 			"fork() failed: %s.", strerror(rc));
-		outcome = PCUT_OUTCOME_INTERNAL_ERROR;
+		rc = TEST_OUTCOME_ERROR;
 		goto leave_close_pipes;
 	}
@@ -182,7 +178,7 @@
 		close(link_stderr[0]);
 
-		outcome = pcut_run_test_forked(test);
-
-		exit(outcome);
+		rc = pcut_run_test_forked(test);
+
+		exit(rc);
 	}
 
@@ -199,5 +195,5 @@
 	alarm(0);
 
-	outcome = convert_wait_status_to_outcome(status);
+	rc = convert_wait_status_to_outcome(status);
 
 	goto leave_close_parent_pipe;
@@ -210,7 +206,5 @@
 	close(link_stderr[0]);
 
-	pcut_report_test_done_unparsed(test, outcome, extra_output_buffer, OUTPUT_BUFFER_SIZE);
-
-	return outcome;
+	pcut_report_test_done_unparsed(test, rc, extra_output_buffer, OUTPUT_BUFFER_SIZE);
 }
 
Index: uspace/lib/pcut/src/os/windows.c
===================================================================
--- uspace/lib/pcut/src/os/windows.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/os/windows.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -144,5 +144,5 @@
  * @param test Test to be run.
  */
-int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
+void pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
 	/* TODO: clean-up if something goes wrong "in the middle" */
 	BOOL okay = FALSE;
@@ -173,10 +173,10 @@
 	if (!okay) {
 		report_func_fail(test, "CreatePipe(/* stdout */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 	okay = SetHandleInformation(link_stdout[0], HANDLE_FLAG_INHERIT, 0);
 	if (!okay) {
 		report_func_fail(test, "SetHandleInformation(/* stdout */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 
@@ -185,10 +185,10 @@
 	if (!okay) {
 		report_func_fail(test, "CreatePipe(/* stderr */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 	okay = SetHandleInformation(link_stderr[0], HANDLE_FLAG_INHERIT, 0);
 	if (!okay) {
 		report_func_fail(test, "SetHandleInformation(/* stderr */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 
@@ -197,10 +197,10 @@
 	if (!okay) {
 		report_func_fail(test, "CreatePipe(/* stdin */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 	okay = SetHandleInformation(link_stdin[1], HANDLE_FLAG_INHERIT, 0);
 	if (!okay) {
 		report_func_fail(test, "SetHandleInformation(/* stdin */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 
@@ -224,5 +224,5 @@
 	if (!okay) {
 		report_func_fail(test, "CreateProcess()");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 
@@ -236,15 +236,15 @@
 	if (!okay) {
 		report_func_fail(test, "CloseHandle(/* stdout */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 	okay = CloseHandle(link_stderr[1]);
 	if (!okay) {
 		report_func_fail(test, "CloseHandle(/* stderr */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 	okay = CloseHandle(link_stdin[0]);
 	if (!okay) {
 		report_func_fail(test, "CloseHandle(/* stdin */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 
@@ -267,5 +267,5 @@
 	if (test_output_thread_reader == NULL) {
 		report_func_fail(test, "CreateThread(/* read test stdout */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 
@@ -281,5 +281,5 @@
 		if (!okay) {
 			report_func_fail(test, "TerminateProcess(/* PROCESS_INFORMATION.hProcess */)");
-			return PCUT_ERROR_INTERNAL_FAILURE;
+			return;
 		}
 		rc = WaitForSingleObject(process_info.hProcess, INFINITE);
@@ -287,5 +287,5 @@
 	if (rc != WAIT_OBJECT_0) {
 		report_func_fail(test, "WaitForSingleObject(/* PROCESS_INFORMATION.hProcess */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 
@@ -294,13 +294,13 @@
 	if (!okay) {
 		report_func_fail(test, "GetExitCodeProcess()");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
+		return;
 	}
 
 	if (rc == 0) {
-		outcome = PCUT_OUTCOME_PASS;
+		outcome = TEST_OUTCOME_PASS;
 	} else if ((rc > 0) && (rc < 10) && !timed_out) {
-		outcome = PCUT_OUTCOME_FAIL;
+		outcome = TEST_OUTCOME_FAIL;
 	} else {
-		outcome = PCUT_OUTCOME_INTERNAL_ERROR;
+		outcome = TEST_OUTCOME_ERROR;
 	}
 
@@ -309,10 +309,8 @@
 	if (rc != WAIT_OBJECT_0) {
 		report_func_fail(test, "WaitForSingleObject(/* stdout reader thread */)");
-		return PCUT_ERROR_INTERNAL_FAILURE;
+		return;
 	}
 
 	pcut_report_test_done_unparsed(test, outcome, extra_output_buffer, OUTPUT_BUFFER_SIZE);
-
-	return outcome;
 }
 
Index: uspace/lib/pcut/src/print.c
===================================================================
--- uspace/lib/pcut/src/print.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/print.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -81,8 +81,4 @@
 			printf("    Test `%s' [%d]\n", it->name, it->id);
 			break;
-		case PCUT_KIND_SETUP:
-		case PCUT_KIND_TEARDOWN:
-			/* Fall-through, do nothing. */
-			break;
 		default:
 			assert(0 && "unreachable case in item-kind switch");
Index: uspace/lib/pcut/src/report/report.c
===================================================================
--- uspace/lib/pcut/src/report/report.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/report/report.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -33,7 +33,5 @@
 
 #include "../internal.h"
-#ifdef __helenos__
-#include <str.h>
-#else
+#ifndef __helenos__
 #include <string.h>
 #endif
Index: uspace/lib/pcut/src/report/tap.c
===================================================================
--- uspace/lib/pcut/src/report/tap.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/report/tap.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,7 +42,4 @@
 static int test_counter;
 
-/** Counter of all failures. */
-static int failed_test_counter;
-
 /** Counter for tests in a current suite. */
 static int tests_in_suite;
@@ -58,5 +55,4 @@
 	int tests_total = pcut_count_tests(all_items);
 	test_counter = 0;
-	failed_test_counter = 0;
 
 	printf("1..%d\n", tests_total);
@@ -79,11 +75,6 @@
  */
 static void tap_suite_done(pcut_item_t *suite) {
-	if (failed_tests_in_suite == 0) {
-		printf("#> Finished suite %s (passed).\n",
-				suite->name);
-	} else {
-		printf("#> Finished suite %s (failed %d of %d).\n",
-				suite->name, failed_tests_in_suite, tests_in_suite);
-	}
+	printf("#> Finished suite %s (failed %d of %d).\n",
+			suite->name, failed_tests_in_suite, tests_in_suite);
 }
 
@@ -138,21 +129,23 @@
 	const char *fail_error_str = NULL;
 
-	if (outcome != PCUT_OUTCOME_PASS) {
+	if (outcome != TEST_OUTCOME_PASS) {
 		failed_tests_in_suite++;
-		failed_test_counter++;
 	}
 
 	switch (outcome) {
-	case PCUT_OUTCOME_PASS:
+	case TEST_OUTCOME_PASS:
 		status_str = "ok";
 		fail_error_str = "";
 		break;
-	case PCUT_OUTCOME_FAIL:
+	case TEST_OUTCOME_FAIL:
 		status_str = "not ok";
 		fail_error_str = " failed";
 		break;
-	default:
+	case TEST_OUTCOME_ERROR:
 		status_str = "not ok";
 		fail_error_str = " aborted";
+		break;
+	default:
+		/* Shall not get here. */
 		break;
 	}
@@ -167,9 +160,4 @@
 /** Report testing done. */
 static void tap_done(void) {
-	if (failed_test_counter == 0) {
-		printf("#> Done: all tests passed.\n");
-	} else {
-		printf("#> Done: %d of %d tests failed.\n", failed_test_counter, test_counter);
-	}
 }
 
Index: uspace/lib/pcut/src/report/xml.c
===================================================================
--- uspace/lib/pcut/src/report/xml.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/report/xml.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -135,17 +135,20 @@
 	const char *status_str = NULL;
 
-	if (outcome != PCUT_OUTCOME_PASS) {
+	if (outcome != TEST_OUTCOME_PASS) {
 		failed_tests_in_suite++;
 	}
 
 	switch (outcome) {
-	case PCUT_OUTCOME_PASS:
+	case TEST_OUTCOME_PASS:
 		status_str = "pass";
 		break;
-	case PCUT_OUTCOME_FAIL:
+	case TEST_OUTCOME_FAIL:
 		status_str = "fail";
 		break;
+	case TEST_OUTCOME_ERROR:
+		status_str = "error";
+		break;
 	default:
-		status_str = "error";
+		/* Shall not get here. */
 		break;
 	}
Index: uspace/lib/pcut/src/run.c
===================================================================
--- uspace/lib/pcut/src/run.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/src/run.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -73,8 +73,9 @@
 static int default_suite_initialized = 0;
 
-static void init_default_suite_when_needed() {
-	if (default_suite_initialized) {
+static void init_default_suite_when_needed(void)
+{
+	if (default_suite_initialized)
 		return;
-	}
+	
 	default_suite.id = -1;
 	default_suite.kind = PCUT_KIND_TESTSUITE;
@@ -91,11 +92,13 @@
  * @return Always a valid test suite item.
  */
-static pcut_item_t *pcut_find_parent_suite(pcut_item_t *it) {
+static pcut_item_t *pcut_find_parent_suite(pcut_item_t *it)
+{
 	while (it != NULL) {
-		if (it->kind == PCUT_KIND_TESTSUITE) {
+		if (it->kind == PCUT_KIND_TESTSUITE)
 			return it;
-		}
+		
 		it = it->previous;
 	}
+	
 	init_default_suite_when_needed();
 	return &default_suite;
@@ -106,8 +109,8 @@
  * @param func Function to run (can be NULL).
  */
-static void run_setup_teardown(pcut_setup_func_t func) {
-	if (func != NULL) {
+static void run_setup_teardown(pcut_setup_func_t func)
+{
+	if (func != NULL)
 		func();
-	}
 }
 
@@ -119,11 +122,11 @@
  * @param outcome Outcome of the current test.
  */
-static void leave_test(int outcome) {
+static void leave_test(int outcome)
+{
 	PCUT_DEBUG("leave_test(outcome=%d), will_exit=%s", outcome,
-		leave_means_exit ? "yes" : "no");
-	if (leave_means_exit) {
+	    leave_means_exit ? "yes" : "no");
+	if (leave_means_exit)
 		exit(outcome);
-	}
-
+	
 #ifndef PCUT_NO_LONG_JUMP
 	longjmp(start_test_jump, 1);
@@ -138,6 +141,8 @@
  * @param message Message describing the failure.
  */
-void pcut_failed_assertion(const char *message) {
+void pcut_failed_assertion(const char *message)
+{
 	static const char *prev_message = NULL;
+	
 	/*
 	 * The assertion failed. We need to abort the current test,
@@ -145,28 +150,27 @@
 	 * include running the tear-down routine.
 	 */
-	if (print_test_error) {
+	if (print_test_error)
 		pcut_print_fail_message(message);
-	}
-
+	
 	if (execute_teardown_on_failure) {
 		execute_teardown_on_failure = 0;
 		prev_message = message;
 		run_setup_teardown(current_suite->teardown_func);
-
+		
 		/* Tear-down was okay. */
 		if (report_test_result) {
-			pcut_report_test_done(current_test, PCUT_OUTCOME_FAIL,
+			pcut_report_test_done(current_test, TEST_OUTCOME_FAIL,
 				message, NULL, NULL);
 		}
 	} else {
 		if (report_test_result) {
-			pcut_report_test_done(current_test, PCUT_OUTCOME_FAIL,
+			pcut_report_test_done(current_test, TEST_OUTCOME_FAIL,
 				prev_message, message, NULL);
 		}
 	}
-
+	
 	prev_message = NULL;
-
-	leave_test(PCUT_OUTCOME_FAIL); /* No return. */
+	
+	leave_test(TEST_OUTCOME_FAIL); /* No return. */
 }
 
@@ -176,5 +180,6 @@
  * @return Error status (zero means success).
  */
-static int run_test(pcut_item_t *test) {
+static int run_test(pcut_item_t *test)
+{
 	/*
 	 * Set here as the returning point in case of test failure.
@@ -182,20 +187,19 @@
 	 * test execution.
 	 */
+	
 #ifndef PCUT_NO_LONG_JUMP
 	int test_finished = setjmp(start_test_jump);
-	if (test_finished) {
-		return PCUT_OUTCOME_FAIL;
-	}
+	if (test_finished)
+		return 1;
 #endif
-
-	if (report_test_result) {
+	
+	if (report_test_result)
 		pcut_report_test_start(test);
-	}
-
+	
 	current_suite = pcut_find_parent_suite(test);
 	current_test = test;
-
+	
 	pcut_hook_before_test(test);
-
+	
 	/*
 	 * If anything goes wrong, execute the tear-down function
@@ -203,10 +207,10 @@
 	 */
 	execute_teardown_on_failure = 1;
-
+	
 	/*
 	 * Run the set-up function.
 	 */
 	run_setup_teardown(current_suite->setup_func);
-
+	
 	/*
 	 * The setup function was performed, it is time to run
@@ -214,5 +218,5 @@
 	 */
 	test->test_func();
-
+	
 	/*
 	 * Finally, run the tear-down function. We need to clear
@@ -221,15 +225,14 @@
 	execute_teardown_on_failure = 0;
 	run_setup_teardown(current_suite->teardown_func);
-
+	
 	/*
 	 * If we got here, it means everything went well with
 	 * this test.
 	 */
-	if (report_test_result) {
-		pcut_report_test_done(current_test, PCUT_OUTCOME_PASS,
-			NULL, NULL, NULL);
-	}
-
-	return PCUT_OUTCOME_PASS;
+	if (report_test_result)
+		pcut_report_test_done(current_test, TEST_OUTCOME_PASS,
+		    NULL, NULL, NULL);
+	
+	return 0;
 }
 
@@ -242,16 +245,15 @@
  * @return Error status (zero means success).
  */
-int pcut_run_test_forked(pcut_item_t *test) {
-	int rc;
-
+int pcut_run_test_forked(pcut_item_t *test)
+{
 	report_test_result = 0;
 	print_test_error = 1;
 	leave_means_exit = 1;
-
-	rc = run_test(test);
-
+	
+	int rc = run_test(test);
+	
 	current_test = NULL;
 	current_suite = NULL;
-
+	
 	return rc;
 }
@@ -265,16 +267,15 @@
  * @return Error status (zero means success).
  */
-int pcut_run_test_single(pcut_item_t *test) {
-	int rc;
-
+int pcut_run_test_single(pcut_item_t *test)
+{
 	report_test_result = 1;
 	print_test_error = 0;
 	leave_means_exit = 0;
-
-	rc = run_test(test);
-
+	
+	int rc = run_test(test);
+	
 	current_test = NULL;
 	current_suite = NULL;
-
+	
 	return rc;
 }
@@ -285,16 +286,16 @@
  * @return Timeout in seconds.
  */
-int pcut_get_test_timeout(pcut_item_t *test) {
+int pcut_get_test_timeout(pcut_item_t *test)
+{
 	int timeout = PCUT_DEFAULT_TEST_TIMEOUT;
 	pcut_extra_t *extras = test->extras;
-
-
+	
 	while (extras->type != PCUT_EXTRA_LAST) {
-		if (extras->type == PCUT_EXTRA_TIMEOUT) {
+		if (extras->type == PCUT_EXTRA_TIMEOUT)
 			timeout = extras->timeout;
-		}
+		
 		extras++;
 	}
-
+	
 	return timeout;
 }
Index: uspace/lib/pcut/tests/abort.expected
===================================================================
--- uspace/lib/pcut/tests/abort.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/abort.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -3,3 +3,2 @@
 not ok 1 access_null_pointer aborted
 #> Finished suite Default (failed 1 of 1).
-#> Done: 1 of 1 tests failed.
Index: uspace/lib/pcut/tests/asserts.expected
===================================================================
--- uspace/lib/pcut/tests/asserts.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/asserts.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -18,3 +18,2 @@
 # error: asserts.c:72: Expected false but got <42>
 #> Finished suite Default (failed 7 of 9).
-#> Done: 7 of 9 tests failed.
Index: uspace/lib/pcut/tests/beforeafter.c
===================================================================
--- uspace/lib/pcut/tests/beforeafter.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/beforeafter.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -28,5 +28,4 @@
 
 #define _BSD_SOURCE
-#define _DEFAULT_SOURCE
 
 #include <pcut/pcut.h>
Index: uspace/lib/pcut/tests/beforeafter.expected
===================================================================
--- uspace/lib/pcut/tests/beforeafter.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/beforeafter.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -2,7 +2,6 @@
 #> Starting suite suite_with_setup_and_teardown.
 ok 1 test_with_setup_and_teardown
-#> Finished suite suite_with_setup_and_teardown (passed).
+#> Finished suite suite_with_setup_and_teardown (failed 0 of 1).
 #> Starting suite another_without_setup.
 ok 2 test_without_any_setup_or_teardown
-#> Finished suite another_without_setup (passed).
-#> Done: all tests passed.
+#> Finished suite another_without_setup (failed 0 of 1).
Index: uspace/lib/pcut/tests/errno.c
===================================================================
--- uspace/lib/pcut/tests/errno.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/errno.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 
 PCUT_TEST(errno_value) {
-	errno_t value = EOK;
+	int value = EOK;
 	PCUT_ASSERT_ERRNO_VAL(EOK, value);
 	value = ENOENT;
Index: uspace/lib/pcut/tests/errno.expected
===================================================================
--- uspace/lib/pcut/tests/errno.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/errno.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -6,3 +6,2 @@
 # error: errno.c:54: Expected error 0 (EOK, *****) but got error ***** (*****)
 #> Finished suite Default (failed 2 of 2).
-#> Done: 2 of 2 tests failed.
Index: uspace/lib/pcut/tests/inithook.expected
===================================================================
--- uspace/lib/pcut/tests/inithook.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/inithook.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -3,4 +3,3 @@
 ok 1 check_init_counter
 ok 2 check_init_counter_2
-#> Finished suite Default (passed).
-#> Done: all tests passed.
+#> Finished suite Default (failed 0 of 2).
Index: uspace/lib/pcut/tests/manytests.expected
===================================================================
--- uspace/lib/pcut/tests/manytests.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/manytests.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -81,4 +81,3 @@
 ok 79 my_test_079
 ok 80 my_test_080
-#> Finished suite Default (passed).
-#> Done: all tests passed.
+#> Finished suite Default (failed 0 of 80).
Index: uspace/lib/pcut/tests/multisuite.expected
===================================================================
--- uspace/lib/pcut/tests/multisuite.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/multisuite.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -11,3 +11,2 @@
 ok 4 test_same_numbers
 #> Finished suite intmin (failed 1 of 2).
-#> Done: 3 of 4 tests failed.
Index: uspace/lib/pcut/tests/preinithook.expected
===================================================================
--- uspace/lib/pcut/tests/preinithook.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/preinithook.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -3,4 +3,3 @@
 ok 1 check_init_counter
 ok 2 check_init_counter_2
-#> Finished suite Default (passed).
-#> Done: all tests passed.
+#> Finished suite Default (failed 0 of 2).
Index: uspace/lib/pcut/tests/printing.expected
===================================================================
--- uspace/lib/pcut/tests/printing.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/printing.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -9,3 +9,2 @@
 # stdio: Printed from a test to stdout!
 #> Finished suite Default (failed 1 of 3).
-#> Done: 1 of 3 tests failed.
Index: uspace/lib/pcut/tests/simple.expected
===================================================================
--- uspace/lib/pcut/tests/simple.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/simple.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -8,3 +8,2 @@
 # error: simple.c:46: Expected <abc> but got <abd> ("abc" != "XXXabd" + 3)
 #> Finished suite Default (failed 3 of 3).
-#> Done: 3 of 3 tests failed.
Index: uspace/lib/pcut/tests/skip.expected
===================================================================
--- uspace/lib/pcut/tests/skip.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/skip.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -3,4 +3,3 @@
 ok 1 normal_test
 ok 2 again_normal_test
-#> Finished suite Default (passed).
-#> Done: all tests passed.
+#> Finished suite Default (failed 0 of 2).
Index: uspace/lib/pcut/tests/suites.expected
===================================================================
--- uspace/lib/pcut/tests/suites.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/suites.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -10,3 +10,2 @@
 # error: suites.c:49: Expected <5> but got <654> (5 != intmin(654, 5))
 #> Finished suite intmin (failed 1 of 1).
-#> Done: 3 of 3 tests failed.
Index: uspace/lib/pcut/tests/teardown.expected
===================================================================
--- uspace/lib/pcut/tests/teardown.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/teardown.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -21,3 +21,2 @@
 # stdio: This is failing teardown-function.
 #> Finished suite with_failing_teardown (failed 3 of 3).
-#> Done: 4 of 5 tests failed.
Index: uspace/lib/pcut/tests/teardownaborts.expected
===================================================================
--- uspace/lib/pcut/tests/teardownaborts.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/teardownaborts.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -5,3 +5,2 @@
 # stdio: Tear-down will cause null pointer access...
 #> Finished suite Default (failed 1 of 1).
-#> Done: 1 of 1 tests failed.
Index: uspace/lib/pcut/tests/timeout.c
===================================================================
--- uspace/lib/pcut/tests/timeout.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/timeout.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -29,13 +29,10 @@
 #include <pcut/pcut.h>
 
-#ifdef __helenos__
+#ifdef __unix
+// FIXME
 #include <thread.h>
-#else
-#ifdef __unix
-#include <unistd.h>
 #endif
 #if defined(__WIN64) || defined(__WIN32) || defined(_WIN32)
 #include <windows.h>
-#endif
 #endif
 
@@ -44,13 +41,10 @@
 
 static void my_sleep(int sec) {
-#ifdef __helenos__
+#ifdef __unix
+// FIXME
 	thread_sleep(sec);
-#else
-#ifdef __unix
-	sleep(sec);
 #endif
 #if defined(__WIN64) || defined(__WIN32) || defined(_WIN32)
 	Sleep(1000 * sec);
-#endif
 #endif
 }
Index: uspace/lib/pcut/tests/timeout.expected
===================================================================
--- uspace/lib/pcut/tests/timeout.expected	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/timeout.expected	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -7,3 +7,2 @@
 # stdio: Text after the sleep.
 #> Finished suite Default (failed 1 of 2).
-#> Done: 1 of 2 tests failed.
Index: uspace/lib/pcut/tests/xmlreport.c
===================================================================
--- uspace/lib/pcut/tests/xmlreport.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/pcut/tests/xmlreport.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -30,6 +30,4 @@
 #include "tested.h"
 
-#include <pcut/pcut.h>
-#include "tested.h"
 
 PCUT_INIT
Index: uspace/lib/posix/Makefile
===================================================================
--- uspace/lib/posix/Makefile	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/Makefile	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,27 +37,16 @@
 LIBC_FILE = $(LIBC_PREFIX)/libc.a
 
+FIXED_POSIX_LIBRARY = libposixaslibc.a
 FIXED_C_LIBRARY = libc4posix.a
 MERGED_C_LIBRARY = libc.a
 MERGE_LIBRARIES = \
 	$(FIXED_C_LIBRARY) \
-	$(LIBRARY).a \
+	$(FIXED_POSIX_LIBRARY) \
 	$(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a \
 	$(LIBSOFTINT_PREFIX)/libsoftint.a
 
-SPECS = gcc.specs
-LIBC_LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
-LIBC_STARTUP_FILE = $(shell sed -n -e 's/^.*STARTUP(\(.*\)).*$$/\1/p' $(LIBC_LINKER_SCRIPT))
-EXPORT_LINKER_SCRIPT = link.ld
-EXPORT_STARTUP_FILE = crt0.o
-
-EXPORT_FILES = \
-	../math/libmath.a \
-	../clui/libclui.a \
-	$(MERGED_C_LIBRARY) \
-	$(EXPORT_STARTUP_FILE) \
-	$(EXPORT_LINKER_SCRIPT) \
-	$(SPECS)
-
 REDEFS_HIDE_LIBC = redefs-hide-libc-symbols.list
+REDEFS_SHOW_LIBPOSIX = redefs-show-posix-symbols.list
+COLLISIONS_LIST = collisions.list
 
 PRE_DEPEND = $(INCLUDE_LIBC)
@@ -65,31 +54,36 @@
 	$(INCLUDE_LIBC) \
 	$(REDEFS_HIDE_LIBC) \
+	$(REDEFS_SHOW_LIBPOSIX) \
+	$(COLLISIONS_LIST) \
 	libc.o
 
-EXTRA_OUTPUT = $(FIXED_C_LIBRARY) $(FIXED_POSIX_LIBRARY) $(MERGED_C_LIBRARY) $(SPECS) $(EXPORT_LINKER_SCRIPT) $(EXPORT_STARTUP_FILE)
+EXTRA_OUTPUT = $(FIXED_C_LIBRARY) $(FIXED_POSIX_LIBRARY) $(MERGED_C_LIBRARY)
 
 SOURCES = \
-	src/ctype.c \
-	src/dlfcn.c \
-	src/fcntl.c \
-	src/fnmatch.c \
-	src/locale.c \
-	src/pthread/condvar.c \
-	src/pthread/keys.c \
-	src/pthread/mutex.c \
-	src/pthread/threads.c \
-	src/pwd.c \
-	src/signal.c \
-	src/stdio.c \
-	src/stdio/scanf.c \
-	src/stdlib.c \
-	src/stdlib/strtold.c \
-	src/string.c \
-	src/strings.c \
-	src/sys/mman.c \
-	src/sys/stat.c \
-	src/sys/wait.c \
-	src/time.c \
-	src/unistd.c
+	source/ctype.c \
+	source/dlfcn.c \
+	source/errno.c \
+	source/fcntl.c \
+	source/fnmatch.c \
+	source/getopt.c \
+	source/locale.c \
+	source/pthread/condvar.c \
+	source/pthread/keys.c \
+	source/pthread/mutex.c \
+	source/pthread/threads.c \
+	source/pwd.c \
+	source/signal.c \
+	source/stdio.c \
+	source/stdio/scanf.c \
+	source/stdlib.c \
+	source/stdlib/strtol.c \
+	source/stdlib/strtold.c \
+	source/string.c \
+	source/strings.c \
+	source/sys/mman.c \
+	source/sys/stat.c \
+	source/sys/wait.c \
+	source/time.c \
+	source/unistd.c
 
 TEST_SOURCES = \
@@ -97,83 +91,16 @@
 	test/scanf.c
 
-EXPORT_CPPFLAGS = \
-	-specs $$(HELENOS_EXPORT_ROOT)/lib/gcc.specs \
-	-isystem $$(HELENOS_EXPORT_ROOT)/include
-
-EXPORT_LDFLAGS = \
-	-L$$(HELENOS_EXPORT_ROOT)/lib \
-	--whole-archive -lc -lmath --no-whole-archive \
-	-T link.ld
-
-EXPORT_CFLAGS = \
-	$(EXPORT_CPPFLAGS) \
-	$(addprefix -Xlinker , $(EXPORT_LDFLAGS))
-
 include $(USPACE_PREFIX)/Makefile.common
 
-$(SPECS): $(CONFIG_MAKEFILE)
-	echo '*self_spec:' > $@.new
-	echo '+ $(COMMON_CFLAGS)' >> $@.new
-	echo >> $@.new
-	echo '*lib:' >> $@.new
-	echo '--whole-archive -lc -lmath --no-whole-archive' >> $@.new
-	echo >> $@.new
-	mv $@.new $@
+$(INCLUDE_LIBC): ../c/include
+	ln -s -f -n ../$^ $@
 
-$(EXPORT_LINKER_SCRIPT): $(LIBC_LINKER_SCRIPT)
-	sed 's/STARTUP(.*)/STARTUP(crt0.o)/' $< > $@
+$(FIXED_C_LIBRARY): $(LIBC_FILE) $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX)
+	$(OBJCOPY) --redefine-syms=$(REDEFS_HIDE_LIBC) $(LIBC_FILE) $@
+	$(OBJCOPY) --redefine-syms=$(REDEFS_SHOW_LIBPOSIX) $@ $@
 
-$(EXPORT_STARTUP_FILE): $(LIBC_STARTUP_FILE)
-	cp $< $@
-
-$(INCLUDE_LIBC): $(shell find ../c/include -name '*.h')
-	cp -r -L --remove-destination -T ../c/include $@
-	find ../c/include -type f -and -not -name '*.h' -delete
-
-export: $(EXPORT_DIR)/config.mk $(EXPORT_DIR)/config.rc
-
-$(EXPORT_DIR)/config.mk: export-libs export-includes
-	echo '# Generated file, do not modify.' >> $@.new
-	echo '# Do not forget to set HELENOS_EXPORT_ROOT.' >> $@.new
-	echo 'HELENOS_CROSS_PATH="$(shell dirname $(CC))"' >> $@.new
-	echo 'HELENOS_TARGET="$(TARGET)"' >> $@.new
-	echo 'HELENOS_CPPFLAGS="$(EXPORT_CPPFLAGS)"' >> $@.new
-	echo 'HELENOS_CFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
-	echo 'HELENOS_LDFLAGS="$(EXPORT_LDFLAGS)"' >> $@.new
-	mv $@.new $@
-
-$(EXPORT_DIR)/config.rc: $(EXPORT_DIR)/config.mk
-	sed 's:$$(HELENOS_EXPORT_ROOT):$$HELENOS_EXPORT_ROOT:g' < $< >$@
-
-export-libs: $(EXPORT_FILES) export-includes
-	mkdir -p $(EXPORT_DIR)/lib
-	cp -L $(EXPORT_FILES) $(EXPORT_DIR)/lib
-
-export-includes: $(INCLUDE_LIBC) $(shell find ./include ../c/arch/$(UARCH)/include $(ROOT_PATH)/abi/include -name '*.h')
-	mkdir -p $(EXPORT_DIR)/include
-	rm -rf $(EXPORT_DIR)/include.new
-	cp -r -L -T ./include/posix $(EXPORT_DIR)/include.new
-	cp -r -L -T ./include/libc $(EXPORT_DIR)/include.new/libc
-	cp -r -L ../c/arch/$(UARCH)/include/* $(EXPORT_DIR)/include.new/libc
-	cp -r -L $(ROOT_PATH)/abi/include/* $(EXPORT_DIR)/include.new
-	mkdir -p $(EXPORT_DIR)/include.new/libclui
-	cp -L ../clui/tinput.h $(EXPORT_DIR)/include.new/libclui
-	
-	find "$(EXPORT_DIR)/include.new/libc" "$(EXPORT_DIR)/include.new/libclui" -name '*.h' -exec sed \
-		-e 's:#include <:#include <libc/:' \
-		-e 's:#include <libc/abi/:#include <abi/:' \
-		-e 's:#include <libc/_bits/:#include <_bits/:' \
-		-e 's:#include <libc/libc/:#include <libc/:' \
-		-i {} \;
-	find "$(EXPORT_DIR)/include.new" -name '*.h' -exec sed \
-		-e 's:#include "posix/:#include ":' \
-		-e 's:#include <posix/:#include <:' \
-		-i {} \;
-	
-	rm -rf $(EXPORT_DIR)/include
-	mv $(EXPORT_DIR)/include.new $(EXPORT_DIR)/include
-
-$(FIXED_C_LIBRARY): $(LIBC_FILE) $(REDEFS_HIDE_LIBC)
-	$(OBJCOPY) --redefine-syms=$(REDEFS_HIDE_LIBC) $(LIBC_FILE) $@
+$(FIXED_POSIX_LIBRARY): $(LIBRARY).a $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX)
+	$(OBJCOPY) --redefine-syms=$(REDEFS_HIDE_LIBC) $(LIBRARY).a $@
+	$(OBJCOPY) --redefine-syms=$(REDEFS_SHOW_LIBPOSIX) $@ $@
 
 $(MERGED_C_LIBRARY): $(MERGE_LIBRARIES)
@@ -181,4 +108,13 @@
 	$(AR) rc $@ libc.o
 
-$(REDEFS_HIDE_LIBC): $(SOURCES)
-	sed -n -e 's/_HIDE_LIBC_SYMBOL(\(.*\))/\1 __helenos_libc_\1/p' $(SOURCES) >$@
+$(REDEFS_HIDE_LIBC): $(COLLISIONS_LIST)
+	sed 's/.*/& __helenos_libc_&/' <$(COLLISIONS_LIST) >$@
+
+$(REDEFS_SHOW_LIBPOSIX): $(COLLISIONS_LIST)
+	sed 's/.*/posix_& &/' <$(COLLISIONS_LIST) >$@
+
+$(COLLISIONS_LIST): include/posix/*.h include/posix/*/*.h
+	find ./include/posix -name '*.h' -exec \
+		sed -n -e '/^#/d' -e 's/__POSIX_DEF__/\n&/gp' {} \; | \
+		sed -n -e 's/__POSIX_DEF__(\([^)]*\)).*/\1/p' | \
+		sort -u >$@
Index: uspace/lib/posix/include/posix/assert.h
===================================================================
--- uspace/lib/posix/include/posix/assert.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/assert.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1,1 +1,48 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Program assertion.
+ */
+
+/* NO include guard on purpose. */
+
 #include "libc/assert.h"
+
+#undef assert
+
+#ifndef NDEBUG
+	#define assert(expr) ((expr) ? (void) 0 : assert_abort(#expr, __FILE__, __LINE__))
+#else
+	#define assert(expr) ((void) 0)
+#endif
+
+/** @}
+ */
Index: uspace/lib/posix/include/posix/ctype.h
===================================================================
--- uspace/lib/posix/include/posix/ctype.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/ctype.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,12 +37,27 @@
 #define POSIX_CTYPE_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "libc/ctype.h"
 
+/* Classification of Characters */
+extern int __POSIX_DEF__(isxdigit)(int c);
+extern int __POSIX_DEF__(isblank)(int c);
+extern int __POSIX_DEF__(iscntrl)(int c);
+extern int __POSIX_DEF__(isgraph)(int c);
+extern int __POSIX_DEF__(isprint)(int c);
+extern int __POSIX_DEF__(ispunct)(int c);
+
 /* Obsolete Functions and Macros */
-extern int isascii(int c);
-extern int toascii(int c);
+extern int __POSIX_DEF__(isascii)(int c);
+extern int __POSIX_DEF__(toascii)(int c);
+#undef _tolower
+#define _tolower(c) ((c) - 'A' + 'a')
+#undef _toupper
+#define _toupper(c) ((c) - 'a' + 'A')
 
-#define _tolower(c) ((c) - 'A' + 'a')
-#define _toupper(c) ((c) - 'a' + 'A')
+
 
 #endif /* POSIX_CTYPE_H_ */
Index: uspace/lib/posix/include/posix/dirent.h
===================================================================
--- uspace/lib/posix/include/posix/dirent.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/dirent.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,4 +36,8 @@
 #define POSIX_DIRENT_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include <libc/dirent.h>
 
Index: uspace/lib/posix/include/posix/dlfcn.h
===================================================================
--- uspace/lib/posix/include/posix/dlfcn.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/dlfcn.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,5 +34,7 @@
 #define POSIX_DLFCN_H_
 
-#include "libc/dlfcn.h"
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
 
 #define RTLD_LAZY 1
@@ -41,8 +43,10 @@
 #define RTLD_LOCAL 0
 
-extern void *dlopen(const char *, int);
-extern void *dlsym(void *, const char *);
-extern int dlclose(void *);
-extern char *dlerror(void);
+
+extern void *__POSIX_DEF__(dlopen)(const char *, int);
+extern void *__POSIX_DEF__(dlsym)(void *, const char *);
+extern int __POSIX_DEF__(dlclose)(void *);
+extern char *__POSIX_DEF__(dlerror)(void);
+
 
 #endif
Index: uspace/lib/posix/include/posix/errno.h
===================================================================
--- uspace/lib/posix/include/posix/errno.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/errno.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1,1 +1,326 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file System error numbers.
+ */
+
+#ifndef POSIX_ERRNO_H_
+#define POSIX_ERRNO_H_
+
 #include "libc/errno.h"
+
+/* IMPORTANT:
+ * Since libc uses negative errorcodes, some sort of conversion is necessary to
+ * keep POSIX programs and libraries from breaking. This file maps POSIX error
+ * codes to absolute values of corresponding libc codes where available, and
+ * assigns new code where there is no prior definition in libc.
+ *
+ * A new errno variable is defined. When accessed, the function first looks at
+ * libc errno and iff it is != 0, sets the POSIX errno to absolute value of
+ * libc errno. Given that no library function sets errno to 0 and that all
+ * POSIX libraries will be used solely by POSIX programs (thus, there only needs
+ * to be one way correspondence between errno and posix_errno), this approach
+ * should work as expected in most cases and does not require any wrappers for
+ * libc routines that would just change errno values.
+ *
+ * There is no conditioning by LIBPOSIX_INTERNAL for redefinitions of macros.
+ * If there is a need to check errno for a value not defined by POSIX, it's
+ * necessary to compare errno against abs(ECODE), because there is no
+ * redefinition for such error codes.
+ *
+ * XXX: maybe all HOS error codes should be redefined
+ *
+ * NOTE: This redefinition is slightly POSIX incompatible, since the
+ *  specification requires the macro values to be usable in preprocessing
+ *  directives. I don't think that's very important, though.
+ */
+
+#undef errno
+#define errno (*__posix_errno())
+
+extern int *__posix_errno(void);
+
+#define __TOP_ERRNO (-EAGAIN)
+
+enum {
+	POSIX_E2BIG = __TOP_ERRNO + 1,
+	POSIX_EACCES = __TOP_ERRNO + 2,
+	POSIX_EADDRNOTAVAIL = -EADDRNOTAVAIL,
+	POSIX_EAGAIN = -EAGAIN,
+	POSIX_EALREADY = __TOP_ERRNO + 3,
+	POSIX_EBADF = -EBADF,
+	POSIX_EBADMSG = __TOP_ERRNO + 4,
+	POSIX_EBUSY = -EBUSY,
+	POSIX_ECANCELED = __TOP_ERRNO + 5,
+	POSIX_ECHILD = __TOP_ERRNO + 6,
+	POSIX_ECONNABORTED = __TOP_ERRNO + 7,
+	POSIX_ECONNREFUSED = __TOP_ERRNO + 8,
+	POSIX_ECONNRESET = __TOP_ERRNO + 9,
+	POSIX_EDEADLK = __TOP_ERRNO + 10,
+	POSIX_EDOM = __TOP_ERRNO + 11,
+	POSIX_EDQUOT = __TOP_ERRNO + 12,
+	POSIX_EEXIST = -EEXIST,
+	POSIX_EFAULT = __TOP_ERRNO + 13,
+	POSIX_EFBIG = __TOP_ERRNO + 14,
+	POSIX_EHOSTUNREACH = __TOP_ERRNO + 15,
+	POSIX_EIDRM = __TOP_ERRNO + 16,
+	POSIX_EILSEQ = __TOP_ERRNO + 17,
+	POSIX_EINTR = -EINTR,
+	POSIX_EINVAL = -EINVAL,
+	POSIX_EIO = -EIO,
+	POSIX_EISCONN = __TOP_ERRNO + 18,
+	POSIX_EISDIR = -EISDIR,
+	POSIX_ELOOP = __TOP_ERRNO + 19,
+	POSIX_EMFILE = -EMFILE,
+	POSIX_EMLINK = -EMLINK,
+	POSIX_EMSGSIZE = __TOP_ERRNO + 20,
+	POSIX_EMULTIHOP = __TOP_ERRNO + 21,
+	POSIX_ENAMETOOLONG = -ENAMETOOLONG,
+	POSIX_ENETDOWN = __TOP_ERRNO + 22,
+	POSIX_ENETRESET = __TOP_ERRNO + 23,
+	POSIX_ENETUNREACH = __TOP_ERRNO + 24,
+	POSIX_ENFILE = __TOP_ERRNO + 25,
+	POSIX_ENOBUFS = __TOP_ERRNO + 26,
+	POSIX_ENODEV = __TOP_ERRNO + 27,
+	POSIX_ENOENT = -ENOENT,
+	POSIX_ENOEXEC = __TOP_ERRNO + 28,
+	POSIX_ENOLCK = __TOP_ERRNO + 29,
+	POSIX_ENOLINK = __TOP_ERRNO + 30,
+	POSIX_ENOMEM = -ENOMEM,
+	POSIX_ENOMSG = __TOP_ERRNO + 31,
+	POSIX_ENOPROTOOPT = __TOP_ERRNO + 32,
+	POSIX_ENOSPC = -ENOSPC,
+	POSIX_ENOSR = __TOP_ERRNO + 33,
+	POSIX_ENOSTR = __TOP_ERRNO + 34,
+	POSIX_ENOSYS = __TOP_ERRNO + 35,
+	POSIX_ENOTDIR = -ENOTDIR,
+	POSIX_ENOTEMPTY = -ENOTEMPTY,
+	POSIX_ENOTRECOVERABLE = __TOP_ERRNO + 36,
+	POSIX_ENOTSUP = -ENOTSUP,
+	POSIX_ENOTTY = __TOP_ERRNO + 37,
+	POSIX_ENXIO = __TOP_ERRNO + 38,
+	POSIX_EOPNOTSUPP = __TOP_ERRNO + 39,
+	POSIX_EOVERFLOW = -EOVERFLOW,
+	POSIX_EOWNERDEAD = __TOP_ERRNO + 40,
+	POSIX_EPERM = -EPERM,
+	POSIX_EPIPE = __TOP_ERRNO + 41,
+	POSIX_EPROTO = __TOP_ERRNO + 42,
+	POSIX_EPROTOTYPE = __TOP_ERRNO + 43,
+	POSIX_ERANGE = -ERANGE,
+	POSIX_EROFS = __TOP_ERRNO + 44,
+	POSIX_ESPIPE = __TOP_ERRNO + 45,
+	POSIX_ESRCH = __TOP_ERRNO + 46,
+	POSIX_ESTALE = __TOP_ERRNO + 47,
+	POSIX_ETIME = __TOP_ERRNO + 48,
+	POSIX_ETIMEDOUT = __TOP_ERRNO + 49,
+	POSIX_ETXTBSY = __TOP_ERRNO + 50,
+	POSIX_EWOULDBLOCK = __TOP_ERRNO + 51,
+	POSIX_EXDEV = -EXDEV,
+	POSIX_EINPROGRESS = __TOP_ERRNO + 52,
+	POSIX_ENOTSOCK = __TOP_ERRNO + 53,
+	POSIX_EDESTADDRREQ = __TOP_ERRNO + 54,
+	POSIX_EPROTONOSUPPORT = __TOP_ERRNO + 55,
+	POSIX_EAFNOSUPPORT = __TOP_ERRNO + 56,
+	POSIX_EADDRINUSE = __TOP_ERRNO + 57,
+	POSIX_ENOTCONN = __TOP_ERRNO + 58,
+	POSIX_ENODATA = __TOP_ERRNO + 59,
+};
+
+#undef __TOP_ERRNO
+
+#undef E2BIG
+#undef EACCES
+#undef EADDRINUSE
+#undef EADDRNOTAVAIL
+#undef EAFNOSUPPORT
+#undef EAGAIN
+#undef EALREADY
+#undef EBADF
+#undef EBADMSG
+#undef EBUSY
+#undef ECANCELED
+#undef ECHILD
+#undef ECONNABORTED
+#undef ECONNREFUSED
+#undef ECONNRESET
+#undef EDEADLK
+#undef EDESTADDRREQ
+#undef EDOM
+#undef EDQUOT
+#undef EEXIST
+#undef EFAULT
+#undef EFBIG
+#undef EHOSTUNREACH
+#undef EIDRM
+#undef EILSEQ
+#undef EINPROGRESS
+#undef EINTR
+#undef EINVAL
+#undef EIO
+#undef EISCONN
+#undef EISDIR
+#undef ELOOP
+#undef EMFILE
+#undef EMLINK
+#undef EMSGSIZE
+#undef EMULTIHOP
+#undef ENAMETOOLONG
+#undef ENETDOWN
+#undef ENETRESET
+#undef ENETUNREACH
+#undef ENFILE
+#undef ENOBUFS
+#undef ENODATA
+#undef ENODEV
+#undef ENOENT
+#undef ENOEXEC
+#undef ENOLCK
+#undef ENOLINK
+#undef ENOMEM
+#undef ENOMSG
+#undef ENOPROTOOPT
+#undef ENOSPC
+#undef ENOSR
+#undef ENOSTR
+#undef ENOSYS
+#undef ENOTCONN
+#undef ENOTDIR
+#undef ENOTEMPTY
+#undef ENOTRECOVERABLE
+#undef ENOTSOCK
+#undef ENOTSUP
+#undef ENOTTY
+#undef ENXIO
+#undef EOPNOTSUPP
+#undef EOVERFLOW
+#undef EOWNERDEAD
+#undef EPERM
+#undef EPIPE
+#undef EPROTO
+#undef EPROTONOSUPPORT
+#undef EPROTOTYPE
+#undef ERANGE
+#undef EROFS
+#undef ESPIPE
+#undef ESRCH
+#undef ESTALE
+#undef ETIME
+#undef ETIMEDOUT
+#undef ETXTBSY
+#undef EWOULDBLOCK
+#undef EXDEV
+
+#define E2BIG POSIX_E2BIG
+#define EACCES POSIX_EACCES
+#define EADDRINUSE POSIX_EADDRINUSE
+#define EADDRNOTAVAIL POSIX_EADDRNOTAVAIL
+#define EAFNOSUPPORT POSIX_EAFNOSUPPORT
+#define EAGAIN POSIX_EAGAIN
+#define EALREADY POSIX_EALREADY
+#define EBADF POSIX_EBADF
+#define EBADMSG POSIX_EBADMSG
+#define EBUSY POSIX_EBUSY
+#define ECANCELED POSIX_ECANCELED
+#define ECHILD POSIX_ECHILD
+#define ECONNABORTED POSIX_ECONNABORTED
+#define ECONNREFUSED POSIX_ECONNREFUSED
+#define ECONNRESET POSIX_ECONNRESET
+#define EDEADLK POSIX_EDEADLK
+#define EDESTADDRREQ POSIX_EDESTADDRREQ
+#define EDOM POSIX_EDOM
+#define EDQUOT POSIX_EDQUOT
+#define EEXIST POSIX_EEXIST
+#define EFAULT POSIX_EFAULT
+#define EFBIG POSIX_EFBIG
+#define EHOSTUNREACH POSIX_EHOSTUNREACH
+#define EIDRM POSIX_EIDRM
+#define EILSEQ POSIX_EILSEQ
+#define EINPROGRESS POSIX_EINPROGRESS
+#define EINTR POSIX_EINTR
+#define EINVAL POSIX_EINVAL
+#define EIO POSIX_EIO
+#define EISCONN POSIX_EISCONN
+#define EISDIR POSIX_EISDIR
+#define ELOOP POSIX_ELOOP
+#define EMFILE POSIX_EMFILE
+#define EMLINK POSIX_EMLINK
+#define EMSGSIZE POSIX_EMSGSIZE
+#define EMULTIHOP POSIX_EMULTIHOP
+#define ENAMETOOLONG POSIX_ENAMETOOLONG
+#define ENETDOWN POSIX_ENETDOWN
+#define ENETRESET POSIX_ENETRESET
+#define ENETUNREACH POSIX_ENETUNREACH
+#define ENFILE POSIX_ENFILE
+#define ENOBUFS POSIX_ENOBUFS
+#define ENODATA POSIX_ENODATA
+#define ENODEV POSIX_ENODEV
+#define ENOENT POSIX_ENOENT
+#define ENOEXEC POSIX_ENOEXEC
+#define ENOLCK POSIX_ENOLCK
+#define ENOLINK POSIX_ENOLINK
+#define ENOMEM POSIX_ENOMEM
+#define ENOMSG POSIX_ENOMSG
+#define ENOPROTOOPT POSIX_ENOPROTOOPT
+#define ENOSPC POSIX_ENOSPC
+#define ENOSR POSIX_ENOSR
+#define ENOSTR POSIX_ENOSTR
+#define ENOSYS POSIX_ENOSYS
+#define ENOTCONN POSIX_ENOTCONN
+#define ENOTDIR POSIX_ENOTDIR
+#define ENOTEMPTY POSIX_ENOTEMPTY
+#define ENOTRECOVERABLE POSIX_ENOTRECOVERABLE
+#define ENOTSOCK POSIX_ENOTSOCK
+#define ENOTSUP POSIX_ENOTSUP
+#define ENOTTY POSIX_ENOTTY
+#define ENXIO POSIX_ENXIO
+#define EOPNOTSUPP POSIX_EOPNOTSUPP
+#define EOVERFLOW POSIX_EOVERFLOW
+#define EOWNERDEAD POSIX_EOWNERDEAD
+#define EPERM POSIX_EPERM
+#define EPIPE POSIX_EPIPE
+#define EPROTO POSIX_EPROTO
+#define EPROTONOSUPPORT POSIX_EPROTONOSUPPORT
+#define EPROTOTYPE POSIX_EPROTOTYPE
+#define ERANGE POSIX_ERANGE
+#define EROFS POSIX_EROFS
+#define ESPIPE POSIX_ESPIPE
+#define ESRCH POSIX_ESRCH
+#define ESTALE POSIX_ESTALE
+#define ETIME POSIX_ETIME
+#define ETIMEDOUT POSIX_ETIMEDOUT
+#define ETXTBSY POSIX_ETXTBSY
+#define EWOULDBLOCK POSIX_EWOULDBLOCK
+#define EXDEV POSIX_EXDEV
+
+#endif /* POSIX_ERRNO_H_ */
+
+/** @}
+ */
Index: uspace/lib/posix/include/posix/fcntl.h
===================================================================
--- uspace/lib/posix/include/posix/fcntl.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/fcntl.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,10 @@
 #define POSIX_FCNTL_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "sys/types.h"
+#include "errno.h"
 
 #undef O_CREAT
@@ -89,6 +94,7 @@
 #define FD_CLOEXEC         1 /* Close on exec. */
 
-extern int open(const char *pathname, int flags, ...);
-extern int fcntl(int fd, int cmd, ...);
+extern int __POSIX_DEF__(open)(const char *pathname, int flags, ...);
+extern int __POSIX_DEF__(fcntl)(int fd, int cmd, ...);
+
 
 #endif /* POSIX_FCNTL_H_ */
Index: uspace/lib/posix/include/posix/fenv.h
===================================================================
--- uspace/lib/posix/include/posix/fenv.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/fenv.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,4 +37,5 @@
 #define POSIX_FENV_H_
 
+
 #define FE_DIVBYZERO 1
 #define FE_INEXACT 2
Index: uspace/lib/posix/include/posix/float.h
===================================================================
--- uspace/lib/posix/include/posix/float.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/float.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,40 +41,40 @@
 /* define some standard C constants in terms of GCC built-ins */
 #ifdef __GNUC__
-#undef DBL_MANT_DIG
-#define DBL_MANT_DIG __DBL_MANT_DIG__
-#undef DBL_MIN_EXP
-#define DBL_MIN_EXP __DBL_MIN_EXP__
-#undef DBL_MAX_EXP
-#define DBL_MAX_EXP __DBL_MAX_EXP__
-#undef DBL_MAX
-#define DBL_MAX __DBL_MAX__
-#undef DBL_MAX_10_EXP
-#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
-#undef DBL_MIN_10_EXP
-#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
-#undef DBL_MIN
-#define DBL_MIN __DBL_MIN__
-#undef DBL_DIG
-#define DBL_DIG __DBL_DIG__
-#undef DBL_EPSILON
-#define DBL_EPSILON __DBL_EPSILON__
-#undef LDBL_EPSILON
-#define LDBL_EPSILON __LDBL_EPSILON__
-#undef FLT_RADIX
-#define FLT_RADIX __FLT_RADIX__
-#undef FLT_MIN
-#define FLT_MIN __FLT_MIN__
-#undef FLT_MAX
-#define FLT_MAX __FLT_MAX__
-#undef FLT_EPSILON
-#define FLT_EPSILON __FLT_EPSILON__
-#undef FLT_MANT_DIG
-#define FLT_MANT_DIG __FLT_MANT_DIG__
-#undef LDBL_MIN
-#define LDBL_MIN __LDBL_MIN__
-#undef LDBL_MAX
-#define LDBL_MAX __LDBL_MAX__
-#undef LDBL_MANT_DIG 
-#define LDBL_MANT_DIG __LDBL_MANT_DIG__
+	#undef DBL_MANT_DIG
+	#define DBL_MANT_DIG __DBL_MANT_DIG__
+	#undef DBL_MIN_EXP
+	#define DBL_MIN_EXP __DBL_MIN_EXP__
+	#undef DBL_MAX_EXP
+	#define DBL_MAX_EXP __DBL_MAX_EXP__
+	#undef DBL_MAX
+	#define DBL_MAX __DBL_MAX__
+	#undef DBL_MAX_10_EXP
+	#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
+	#undef DBL_MIN_10_EXP
+	#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
+	#undef DBL_MIN
+	#define DBL_MIN __DBL_MIN__
+	#undef DBL_DIG
+	#define DBL_DIG __DBL_DIG__
+	#undef DBL_EPSILON
+	#define DBL_EPSILON __DBL_EPSILON__
+	#undef LDBL_EPSILON
+	#define LDBL_EPSILON __LDBL_EPSILON__
+	#undef FLT_RADIX
+	#define FLT_RADIX __FLT_RADIX__
+	#undef FLT_MIN
+	#define FLT_MIN __FLT_MIN__
+	#undef FLT_MAX
+	#define FLT_MAX __FLT_MAX__
+	#undef FLT_EPSILON
+	#define FLT_EPSILON __FLT_EPSILON__
+	#undef FLT_MANT_DIG
+	#define FLT_MANT_DIG __FLT_MANT_DIG__
+	#undef LDBL_MIN
+	#define LDBL_MIN __LDBL_MIN__
+	#undef LDBL_MAX
+	#define LDBL_MAX __LDBL_MAX__
+	#undef LDBL_MANT_DIG 
+	#define LDBL_MANT_DIG __LDBL_MANT_DIG__
 #else
 /* For something else than GCC, following definitions are provided.
Index: uspace/lib/posix/include/posix/fnmatch.h
===================================================================
--- uspace/lib/posix/include/posix/fnmatch.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/fnmatch.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,4 +36,8 @@
 #define POSIX_FNMATCH_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 /* Error Values */
 #undef FNM_NOMATCH
@@ -56,5 +60,5 @@
 #define FNM_CASEFOLD 16
 
-extern int fnmatch(const char *pattern, const char *string, int flags);
+extern int __POSIX_DEF__(fnmatch)(const char *pattern, const char *string, int flags);
 
 
Index: uspace/lib/posix/include/posix/getopt.h
===================================================================
--- uspace/lib/posix/include/posix/getopt.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/getopt.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,6 +35,26 @@
 #define POSIX_GETOPT_H
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "unistd.h"
-#include "libc/getopt.h"
+
+/* Option Arguments */
+#define no_argument        0
+#define required_argument  1
+#define optional_argument  2
+
+#ifndef LIBPOSIX_INTERNAL
+struct option {
+	const char *name;
+	int has_arg;
+	int *flag;
+	int val;
+};
+#endif
+
+extern int __POSIX_DEF__(getopt_long)(int, char * const [], const char *, const struct option *, int *);
+
 
 #endif
Index: uspace/lib/posix/include/posix/inttypes.h
===================================================================
--- uspace/lib/posix/include/posix/inttypes.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/inttypes.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,6 +36,16 @@
 #define POSIX_INTTYPES_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "stdint.h"
 #include "libc/inttypes.h"
+
+extern intmax_t __POSIX_DEF__(strtoimax)(const char *__restrict__ nptr,
+    char **__restrict__ endptr, int base);
+extern uintmax_t __POSIX_DEF__(strtoumax)(const char *__restrict__ nptr,
+    char **__restrict__ endptr, int base);
+
 
 #endif /* POSIX_INTTYPES_H_ */
Index: uspace/lib/posix/include/posix/locale.h
===================================================================
--- uspace/lib/posix/include/posix/locale.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/locale.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,9 +36,16 @@
 #define POSIX_LOCALE_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include <_bits/NULL.h>
 
 #ifndef __locale_t_defined
-#define __locale_t_defined
-typedef struct __posix_locale *locale_t;
+	#define __locale_t_defined
+	typedef struct __posix_locale *__POSIX_DEF__(locale_t);
+	#ifndef LIBPOSIX_INTERNAL
+		#define locale_t __POSIX_DEF__(locale_t)
+	#endif
 #endif
 
@@ -77,5 +84,5 @@
 #define LC_GLOBAL_LOCALE NULL
 
-struct lconv {
+struct __POSIX_DEF__(lconv) {
 	char *currency_symbol;
 	char *decimal_point;
@@ -104,13 +111,13 @@
 };
 
-extern char *setlocale(int category, const char *locale);
-extern struct lconv *localeconv(void);
+extern char *__POSIX_DEF__(setlocale)(int category, const char *locale);
+extern struct __POSIX_DEF__(lconv) *__POSIX_DEF__(localeconv)(void);
 
 /* POSIX Extensions */
-extern locale_t duplocale(locale_t locobj);
-extern void freelocale(locale_t locobj);
-extern locale_t newlocale(int category_mask, const char *locale,
-    locale_t base);
-extern locale_t uselocale(locale_t newloc);
+extern __POSIX_DEF__(locale_t) __POSIX_DEF__(duplocale)(__POSIX_DEF__(locale_t) locobj);
+extern void __POSIX_DEF__(freelocale)(__POSIX_DEF__(locale_t) locobj);
+extern __POSIX_DEF__(locale_t) __POSIX_DEF__(newlocale)(int category_mask, const char *locale,
+    __POSIX_DEF__(locale_t) base);
+extern __POSIX_DEF__(locale_t) __POSIX_DEF__(uselocale)(__POSIX_DEF__(locale_t) newloc);
 
 
Index: uspace/lib/posix/include/posix/math.h
===================================================================
--- uspace/lib/posix/include/posix/math.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/math.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 
 #ifdef __GNUC__
-#define HUGE_VAL (__builtin_huge_val())
+	#define HUGE_VAL (__builtin_huge_val())
 #endif
 
Index: uspace/lib/posix/include/posix/pthread.h
===================================================================
--- uspace/lib/posix/include/posix/pthread.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/pthread.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -32,4 +32,8 @@
 #ifndef POSIX_PTHREAD_H_
 #define POSIX_PTHREAD_H_
+
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
 
 #include "libc/thread.h"
@@ -95,5 +99,5 @@
 extern int pthread_cond_signal(pthread_cond_t *);
 extern int pthread_cond_timedwait(pthread_cond_t *__restrict__,
-    pthread_mutex_t *__restrict__, const struct timespec *__restrict__);
+    pthread_mutex_t *__restrict__, const struct __POSIX_DEF__(timespec) *__restrict__);
 extern int pthread_cond_wait(pthread_cond_t *__restrict__,
     pthread_mutex_t *__restrict__);
@@ -105,5 +109,5 @@
 extern int pthread_setspecific(pthread_key_t, const void *);
 extern int pthread_key_delete(pthread_key_t);
-extern int pthread_key_create(pthread_key_t *, void (*)(void *));
+extern int pthread_key_create(pthread_key_t *, void (*)(void*));
 
 #endif
Index: uspace/lib/posix/include/posix/pwd.h
===================================================================
--- uspace/lib/posix/include/posix/pwd.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/pwd.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,25 +36,29 @@
 #define POSIX_PWD_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "sys/types.h"
 
-struct passwd {
+struct __POSIX_DEF__(passwd) {
 	char *pw_name;
-	uid_t pw_uid;
-	gid_t pw_gid;
+	__POSIX_DEF__(uid_t) pw_uid;
+	__POSIX_DEF__(gid_t) pw_gid;
 	char *pw_dir;
 	char *pw_shell;
 };
 
-extern struct passwd *getpwent(void);
-extern void setpwent(void);
-extern void endpwent(void);
+extern struct __POSIX_DEF__(passwd) *__POSIX_DEF__(getpwent)(void);
+extern void __POSIX_DEF__(setpwent)(void);
+extern void __POSIX_DEF__(endpwent)(void);
 
-extern struct passwd *getpwnam(const char *name);
-extern int getpwnam_r(const char *name, struct passwd *pwd,
-    char *buffer, size_t bufsize, struct passwd **result);
+extern struct __POSIX_DEF__(passwd) *__POSIX_DEF__(getpwnam)(const char *name);
+extern int __POSIX_DEF__(getpwnam_r)(const char *name, struct __POSIX_DEF__(passwd) *pwd,
+    char *buffer, size_t bufsize, struct __POSIX_DEF__(passwd) **result);
 
-extern struct passwd *getpwuid(uid_t uid);
-extern int getpwuid_r(uid_t uid, struct passwd *pwd,
-    char *buffer, size_t bufsize, struct passwd **result);
+extern struct __POSIX_DEF__(passwd) *__POSIX_DEF__(getpwuid)(__POSIX_DEF__(uid_t) uid);
+extern int __POSIX_DEF__(getpwuid_r)(__POSIX_DEF__(uid_t) uid, struct __POSIX_DEF__(passwd) *pwd,
+    char *buffer, size_t bufsize, struct __POSIX_DEF__(passwd) **result);
 
 
Index: uspace/lib/posix/include/posix/signal.h
===================================================================
--- uspace/lib/posix/include/posix/signal.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/signal.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,4 +36,8 @@
 #define POSIX_SIGNAL_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "sys/types.h"
 #include <posix/ucontext.h>
@@ -59,6 +63,6 @@
 	int si_errno;
 
-	pid_t si_pid;
-	uid_t si_uid;
+	__POSIX_DEF__(pid_t) si_pid;
+	__POSIX_DEF__(uid_t) si_uid;
 	void *si_addr;
 	int si_status;
@@ -66,16 +70,16 @@
 	long si_band;
 
-	union sigval si_value;
-} siginfo_t;
-
-struct sigaction {
+	union __POSIX_DEF__(sigval) si_value;
+} __POSIX_DEF__(siginfo_t);
+
+struct __POSIX_DEF__(sigaction) {
 	void (*sa_handler)(int);
-	sigset_t sa_mask;
+	__POSIX_DEF__(sigset_t) sa_mask;
 	int sa_flags;
-	void (*sa_sigaction)(int, siginfo_t *, void *);
+	void (*sa_sigaction)(int, __POSIX_DEF__(siginfo_t) *, void *);
 };
 
 
-/* Values of sigevent::sigev_notify */
+/* Values of __POSIX_DEF__(sigevent)::sigev_notify */
 #undef SIGEV_NONE
 #undef SIGEV_SIGNAL
@@ -225,25 +229,25 @@
 };
 
-extern int sigaction(int sig, const struct sigaction *__restrict__ act,
-    struct sigaction *__restrict__ oact);
-
-extern void (*signal(int sig, void (*func)(int)))(int);
-extern int raise(int sig);
-extern int kill(pid_t pid, int sig);
-extern int killpg(pid_t pid, int sig);
-
-extern void psiginfo(const siginfo_t *pinfo, const char *message);
-extern void psignal(int signum, const char *message);
-
-extern int sigemptyset(sigset_t *set);
-extern int sigfillset(sigset_t *set);
-extern int sigaddset(sigset_t *set, int signo);
-extern int sigdelset(sigset_t *set, int signo);
-extern int sigismember(const sigset_t *set, int signo);
-
-extern int thread_sigmask(int how, const sigset_t *__restrict__ set,
-    sigset_t *__restrict__ oset);
-extern int sigprocmask(int how, const sigset_t *__restrict__ set,
-    sigset_t *__restrict__ oset);
+extern int __POSIX_DEF__(sigaction)(int sig, const struct __POSIX_DEF__(sigaction) *__restrict__ act,
+    struct __POSIX_DEF__(sigaction) *__restrict__ oact);
+
+extern void (*__POSIX_DEF__(signal)(int sig, void (*func)(int)))(int);
+extern int __POSIX_DEF__(raise)(int sig);
+extern int __POSIX_DEF__(kill)(__POSIX_DEF__(pid_t) pid, int sig);
+extern int __POSIX_DEF__(killpg)(__POSIX_DEF__(pid_t) pid, int sig);
+
+extern void __POSIX_DEF__(psiginfo)(const __POSIX_DEF__(siginfo_t) *pinfo, const char *message);
+extern void __POSIX_DEF__(psignal)(int signum, const char *message);
+
+extern int __POSIX_DEF__(sigemptyset)(__POSIX_DEF__(sigset_t) *set);
+extern int __POSIX_DEF__(sigfillset)(__POSIX_DEF__(sigset_t) *set);
+extern int __POSIX_DEF__(sigaddset)(__POSIX_DEF__(sigset_t) *set, int signo);
+extern int __POSIX_DEF__(sigdelset)(__POSIX_DEF__(sigset_t) *set, int signo);
+extern int __POSIX_DEF__(sigismember)(const __POSIX_DEF__(sigset_t) *set, int signo);
+
+extern int __POSIX_DEF__(thread_sigmask)(int how, const __POSIX_DEF__(sigset_t) *__restrict__ set,
+    __POSIX_DEF__(sigset_t) *__restrict__ oset);
+extern int __POSIX_DEF__(sigprocmask)(int how, const __POSIX_DEF__(sigset_t) *__restrict__ set,
+    __POSIX_DEF__(sigset_t) *__restrict__ oset);
 
 
Index: uspace/lib/posix/include/posix/stddef.h
===================================================================
--- uspace/lib/posix/include/posix/stddef.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/stddef.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,4 +36,8 @@
 #define POSIX_STDDEF_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "sys/types.h"
 
Index: uspace/lib/posix/include/posix/stdint.h
===================================================================
--- uspace/lib/posix/include/posix/stdint.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/stdint.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,4 +36,8 @@
 #define POSIX_STDINT_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "libc/stdint.h"
 
Index: uspace/lib/posix/include/posix/stdio.h
===================================================================
--- uspace/lib/posix/include/posix/stdio.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/stdio.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,12 @@
 #define POSIX_STDIO_H_
 
-#include "libc/stdio.h"
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+/* DEBUG macro does not belong to POSIX stdio.h. Its unconditional
+ * definition in the native stdio.h causes unexpected behaviour of
+ * applications which uses their own DEBUG macro (e.g. debugging
+ * output is printed even if not desirable). */
+#undef DEBUG
+#endif
 
 #include "stddef.h"
@@ -65,4 +72,15 @@
 typedef struct _IO_FILE FILE;
 
+#ifndef LIBPOSIX_INTERNAL
+	enum _buffer_type {
+		/** No buffering */
+		_IONBF,
+		/** Line buffering */
+		_IOLBF,
+		/** Full buffering */
+		_IOFBF
+	};
+#endif
+
 extern FILE *stdin;
 extern FILE *stdout;
@@ -81,14 +99,14 @@
 extern int puts(const char *);
 
-extern int fprintf(FILE *, const char*, ...) _HELENOS_PRINTF_ATTRIBUTE(2, 3);
+extern int fprintf(FILE *, const char*, ...) PRINTF_ATTRIBUTE(2, 3);
 extern int vfprintf(FILE *, const char *, va_list);
 
-extern int printf(const char *, ...) _HELENOS_PRINTF_ATTRIBUTE(1, 2);
+extern int printf(const char *, ...) PRINTF_ATTRIBUTE(1, 2);
 extern int vprintf(const char *, va_list);
 
-extern int snprintf(char *, size_t , const char *, ...) _HELENOS_PRINTF_ATTRIBUTE(3, 4);
+extern int snprintf(char *, size_t , const char *, ...) PRINTF_ATTRIBUTE(3, 4);
 #ifdef _GNU_SOURCE
 extern int vasprintf(char **, const char *, va_list);
-extern int asprintf(char **, const char *, ...) _HELENOS_PRINTF_ATTRIBUTE(2, 3);
+extern int asprintf(char **, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
 #endif
 extern int vsnprintf(char *, size_t, const char *, va_list);
@@ -117,84 +135,84 @@
 #undef L_ctermid
 #define L_ctermid PATH_MAX
-extern char *ctermid(char *s);
+extern char *__POSIX_DEF__(ctermid)(char *s);
 
 /* Error Recovery */
-extern void clearerr(FILE *stream);
+extern void __POSIX_DEF__(clearerr)(FILE *stream);
 
 /* Input/Output */
 #undef putc
 #define putc fputc
-extern int fputs(const char *__restrict__ s, FILE *__restrict__ stream);
+extern int __POSIX_DEF__(fputs)(const char *__restrict__ s, FILE *__restrict__ stream);
 #undef getc
 #define getc fgetc
-extern int ungetc(int c, FILE *stream);
-extern ssize_t getdelim(char **__restrict__ lineptr, size_t *__restrict__ n,
+extern int __POSIX_DEF__(ungetc)(int c, FILE *stream);
+extern ssize_t __POSIX_DEF__(getdelim)(char **__restrict__ lineptr, size_t *__restrict__ n,
     int delimiter, FILE *__restrict__ stream);
-extern ssize_t getline(char **__restrict__ lineptr, size_t *__restrict__ n,
+extern ssize_t __POSIX_DEF__(getline)(char **__restrict__ lineptr, size_t *__restrict__ n,
     FILE *__restrict__ stream);
 
 /* Opening Streams */
-extern FILE *freopen(const char *__restrict__ filename,
+extern FILE *__POSIX_DEF__(freopen)(const char *__restrict__ filename,
     const char *__restrict__ mode, FILE *__restrict__ stream);
 
 /* Error Messages */
-extern void perror(const char *s);
+extern void __POSIX_DEF__(perror)(const char *s);
 
 /* File Positioning */
 typedef struct {
 	off64_t offset;
-} fpos_t;
-
-extern int fsetpos(FILE *stream, const fpos_t *pos);
-extern int fgetpos(FILE *__restrict__ stream, fpos_t *__restrict__ pos);
-extern int fseek(FILE *stream, long offset, int whence);
-extern int fseeko(FILE *stream, off_t offset, int whence);
-extern long ftell(FILE *stream);
-extern off_t ftello(FILE *stream);
+} __POSIX_DEF__(fpos_t);
+
+extern int __POSIX_DEF__(fsetpos)(FILE *stream, const __POSIX_DEF__(fpos_t) *pos);
+extern int __POSIX_DEF__(fgetpos)(FILE *__restrict__ stream, __POSIX_DEF__(fpos_t) *__restrict__ pos);
+extern int __POSIX_DEF__(fseek)(FILE *stream, long offset, int whence);
+extern int __POSIX_DEF__(fseeko)(FILE *stream, __POSIX_DEF__(off_t) offset, int whence);
+extern long __POSIX_DEF__(ftell)(FILE *stream);
+extern __POSIX_DEF__(off_t) __POSIX_DEF__(ftello)(FILE *stream);
 
 /* Flushing Buffers */
-extern int fflush(FILE *stream);
+extern int __POSIX_DEF__(fflush)(FILE *stream);
 
 /* Formatted Output */
-extern int dprintf(int fildes, const char *__restrict__ format, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-extern int vdprintf(int fildes, const char *__restrict__ format, va_list ap);
-extern int sprintf(char *__restrict__ s, const char *__restrict__ format, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-extern int vsprintf(char *__restrict__ s, const char *__restrict__ format, va_list ap);
+extern int __POSIX_DEF__(dprintf)(int fildes, const char *__restrict__ format, ...)
+    PRINTF_ATTRIBUTE(2, 3);
+extern int __POSIX_DEF__(vdprintf)(int fildes, const char *__restrict__ format, va_list ap);
+extern int __POSIX_DEF__(sprintf)(char *__restrict__ s, const char *__restrict__ format, ...)
+    PRINTF_ATTRIBUTE(2, 3);
+extern int __POSIX_DEF__(vsprintf)(char *__restrict__ s, const char *__restrict__ format, va_list ap);
 
 /* Formatted Input */
-extern int fscanf(
+extern int __POSIX_DEF__(fscanf)(
     FILE *__restrict__ stream, const char *__restrict__ format, ...);
-extern int vfscanf(
+extern int __POSIX_DEF__(vfscanf)(
     FILE *__restrict__ stream, const char *__restrict__ format, va_list arg);
-extern int scanf(const char *__restrict__ format, ...);
-extern int vscanf(const char *__restrict__ format, va_list arg);
-extern int sscanf(
+extern int __POSIX_DEF__(scanf)(const char *__restrict__ format, ...);
+extern int __POSIX_DEF__(vscanf)(const char *__restrict__ format, va_list arg);
+extern int __POSIX_DEF__(sscanf)(
     const char *__restrict__ s, const char *__restrict__ format, ...);
-extern int vsscanf(
+extern int __POSIX_DEF__(vsscanf)(
     const char *__restrict__ s, const char *__restrict__ format, va_list arg);
 
 /* File Locking */
-extern void flockfile(FILE *file);
-extern int ftrylockfile(FILE *file);
-extern void funlockfile(FILE *file);
-extern int getc_unlocked(FILE *stream);
-extern int getchar_unlocked(void);
-extern int putc_unlocked(int c, FILE *stream);
-extern int putchar_unlocked(int c);
+extern void __POSIX_DEF__(flockfile)(FILE *file);
+extern int __POSIX_DEF__(ftrylockfile)(FILE *file);
+extern void __POSIX_DEF__(funlockfile)(FILE *file);
+extern int __POSIX_DEF__(getc_unlocked)(FILE *stream);
+extern int __POSIX_DEF__(getchar_unlocked)(void);
+extern int __POSIX_DEF__(putc_unlocked)(int c, FILE *stream);
+extern int __POSIX_DEF__(putchar_unlocked)(int c);
 
 /* Deleting Files */
-extern int remove(const char *path);
+extern int __POSIX_DEF__(remove)(const char *path);
 
 /* Renaming Files */
-extern int rename(const char *oldname, const char *newname);
+extern int __POSIX_DEF__(rename)(const char *oldname, const char *newname);
 
 /* Temporary Files */
 #undef L_tmpnam
 #define L_tmpnam PATH_MAX
-extern char *tmpnam(char *s);
-extern char *tempnam(const char *dir, const char *pfx);
-extern FILE *tmpfile(void);
+extern char *__POSIX_DEF__(tmpnam)(char *s);
+extern char *__POSIX_DEF__(tempnam)(const char *dir, const char *pfx);
+extern FILE *__POSIX_DEF__(tmpfile)(void);
 
 
Index: uspace/lib/posix/include/posix/stdlib.h
===================================================================
--- uspace/lib/posix/include/posix/stdlib.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/stdlib.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,4 +37,8 @@
 #define POSIX_STDLIB_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "sys/types.h"
 
@@ -49,12 +53,12 @@
 #define EXIT_SUCCESS 0
 #define _Exit exit
-extern int atexit(void (*func)(void));
+extern int __POSIX_DEF__(atexit)(void (*func)(void));
 extern void exit(int status) __attribute__((noreturn));
 extern void abort(void) __attribute__((noreturn));
 
 /* Absolute Value */
-extern int abs(int i);
-extern long labs(long i);
-extern long long llabs(long long i);
+extern int __POSIX_DEF__(abs)(int i);
+extern long __POSIX_DEF__(labs)(long i);
+extern long long __POSIX_DEF__(llabs)(long long i);
 
 /* Integer Division */
@@ -62,69 +66,69 @@
 typedef struct {
 	int quot, rem;
-} div_t;
+} __POSIX_DEF__(div_t);
 
 typedef struct {
 	long quot, rem;
-} ldiv_t;
+} __POSIX_DEF__(ldiv_t);
 
 typedef struct {
 	long long quot, rem;
-} lldiv_t;
+} __POSIX_DEF__(lldiv_t);
 
-extern div_t div(int numer, int denom);
-extern ldiv_t ldiv(long numer, long denom);
-extern lldiv_t lldiv(long long numer, long long denom);
+extern __POSIX_DEF__(div_t) __POSIX_DEF__(div)(int numer, int denom);
+extern __POSIX_DEF__(ldiv_t) __POSIX_DEF__(ldiv)(long numer, long denom);
+extern __POSIX_DEF__(lldiv_t) __POSIX_DEF__(lldiv)(long long numer, long long denom);
 
 /* Array Functions */
-extern void qsort(void *array, size_t count, size_t size,
+extern void __POSIX_DEF__(qsort)(void *array, size_t count, size_t size,
     int (*compare)(const void *, const void *));
-extern void *bsearch(const void *key, const void *base,
+extern void *__POSIX_DEF__(bsearch)(const void *key, const void *base,
     size_t nmemb, size_t size, int (*compar)(const void *, const void *));
 
 /* Environment Access */
-extern char *getenv(const char *name);
-extern int putenv(char *string);
-extern int system(const char *string);
+extern char *__POSIX_DEF__(getenv)(const char *name);
+extern int __POSIX_DEF__(putenv)(char *string);
+extern int __POSIX_DEF__(system)(const char *string);
 
 /* Symbolic Links */
-extern char *realpath(const char *__restrict__ name, char *__restrict__ resolved);
+extern char *__POSIX_DEF__(realpath)(const char *__restrict__ name, char *__restrict__ resolved);
 
 /* Floating Point Conversion */
-extern double atof(const char *nptr);
-extern float strtof(const char *__restrict__ nptr, char **__restrict__ endptr);
-extern double strtod(const char *__restrict__ nptr, char **__restrict__ endptr);
-extern long double strtold(const char *__restrict__ nptr, char **__restrict__ endptr);
+extern double __POSIX_DEF__(atof)(const char *nptr);
+extern float __POSIX_DEF__(strtof)(const char *__restrict__ nptr, char **__restrict__ endptr);
+extern double __POSIX_DEF__(strtod)(const char *__restrict__ nptr, char **__restrict__ endptr);
+extern long double __POSIX_DEF__(strtold)(const char *__restrict__ nptr, char **__restrict__ endptr);
 
 /* Integer Conversion */
-extern int atoi(const char *nptr);
-extern long int atol(const char *nptr);
-extern long long int atoll(const char *nptr);
-extern long int strtol(const char *__restrict__ nptr,
+extern int __POSIX_DEF__(atoi)(const char *nptr);
+extern long int __POSIX_DEF__(atol)(const char *nptr);
+extern long long int __POSIX_DEF__(atoll)(const char *nptr);
+extern long int __POSIX_DEF__(strtol)(const char *__restrict__ nptr,
     char **__restrict__ endptr, int base);
-extern long long int strtoll(const char *__restrict__ nptr,
+extern long long int __POSIX_DEF__(strtoll)(const char *__restrict__ nptr,
     char **__restrict__ endptr, int base);
-extern unsigned long int strtoul(const char *__restrict__ nptr,
+extern unsigned long int __POSIX_DEF__(strtoul)(const char *__restrict__ nptr,
     char **__restrict__ endptr, int base);
-extern unsigned long long int strtoull(
+extern unsigned long long int __POSIX_DEF__(strtoull)(
     const char *__restrict__ nptr, char **__restrict__ endptr, int base);
 
 /* Memory Allocation */
-extern void *malloc(size_t size)
+extern void *__POSIX_DEF__(malloc)(size_t size)
     __attribute__((malloc));
-extern void *calloc(size_t nelem, size_t elsize)
+extern void *__POSIX_DEF__(calloc)(size_t nelem, size_t elsize)
     __attribute__((malloc));
-extern void *realloc(void *ptr, size_t size)
+extern void *__POSIX_DEF__(realloc)(void *ptr, size_t size)
     __attribute__((warn_unused_result));
-extern void free(void *ptr);
+extern void __POSIX_DEF__(free)(void *ptr);
 
 /* Temporary Files */
-extern int mkstemp(char *tmpl);
+extern int __POSIX_DEF__(mkstemp)(char *tmpl);
 
 /* Pseudo-random number generator */
-extern int rand(void);
-extern void srand(unsigned int seed);
+extern int __POSIX_DEF__(rand)(void);
+extern void __POSIX_DEF__(srand)(unsigned int seed);
 
 /* Legacy Declarations */
-extern char *mktemp(char *tmpl);
+extern char *__POSIX_DEF__(mktemp)(char *tmpl);
 extern int bsd_getloadavg(double loadavg[], int nelem);
 
Index: uspace/lib/posix/include/posix/string.h
===================================================================
--- uspace/lib/posix/include/posix/string.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/string.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,4 +37,8 @@
 #define POSIX_STRING_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "sys/types.h"
 
@@ -70,54 +74,54 @@
 
 /* Copying and Concatenation */
-extern char *strcpy(char *__restrict__ dest, const char *__restrict__ src);
-extern char *strncpy(char *__restrict__ dest, const char *__restrict__ src, size_t n);
-extern char *stpcpy(char *__restrict__ dest, const char *__restrict__ src);
-extern char *stpncpy(char *__restrict__ dest, const char *__restrict__ src, size_t n);
-extern char *strcat(char *__restrict__ dest, const char *__restrict__ src);
-extern char *strncat(char *__restrict__ dest, const char *__restrict__ src, size_t n);
-extern void *memccpy(void *__restrict__ dest, const void *__restrict__ src, int c, size_t n);
-extern char *strdup(const char *s);
-extern char *strndup(const char *s, size_t n);
+extern char *__POSIX_DEF__(strcpy)(char *__restrict__ dest, const char *__restrict__ src);
+extern char *__POSIX_DEF__(strncpy)(char *__restrict__ dest, const char *__restrict__ src, size_t n);
+extern char *__POSIX_DEF__(stpcpy)(char *__restrict__ dest, const char *__restrict__ src);
+extern char *__POSIX_DEF__(stpncpy)(char *__restrict__ dest, const char *__restrict__ src, size_t n);
+extern char *__POSIX_DEF__(strcat)(char *__restrict__ dest, const char *__restrict__ src);
+extern char *__POSIX_DEF__(strncat)(char *__restrict__ dest, const char *__restrict__ src, size_t n);
+extern void *__POSIX_DEF__(memccpy)(void *__restrict__ dest, const void *__restrict__ src, int c, size_t n);
+extern char *__POSIX_DEF__(strdup)(const char *s);
+extern char *__POSIX_DEF__(strndup)(const char *s, size_t n);
 
 /* String/Array Comparison */
-extern int memcmp(const void *mem1, const void *mem2, size_t n);
-extern int strcmp(const char *s1, const char *s2);
-extern int strncmp(const char *s1, const char *s2, size_t n);
+extern int __POSIX_DEF__(memcmp)(const void *mem1, const void *mem2, size_t n);
+extern int __POSIX_DEF__(strcmp)(const char *s1, const char *s2);
+extern int __POSIX_DEF__(strncmp)(const char *s1, const char *s2, size_t n);
 
 /* Search Functions */
-extern void *memchr(const void *mem, int c, size_t n);
-extern char *strchr(const char *s, int c);
-extern char *strrchr(const char *s, int c);
+extern void *__POSIX_DEF__(memchr)(const void *mem, int c, size_t n);
+extern char *__POSIX_DEF__(strchr)(const char *s, int c);
+extern char *__POSIX_DEF__(strrchr)(const char *s, int c);
 extern char *gnu_strchrnul(const char *s, int c);
-extern char *strpbrk(const char *s1, const char *s2);
-extern size_t strcspn(const char *s1, const char *s2);
-extern size_t strspn(const char *s1, const char *s2);
-extern char *strstr(const char *haystack, const char *needle);
+extern char *__POSIX_DEF__(strpbrk)(const char *s1, const char *s2);
+extern size_t __POSIX_DEF__(strcspn)(const char *s1, const char *s2);
+extern size_t __POSIX_DEF__(strspn)(const char *s1, const char *s2);
+extern char *__POSIX_DEF__(strstr)(const char *haystack, const char *needle);
 
 /* Tokenization functions. */
-extern char *strtok_r(char *, const char *, char **);
-extern char *strtok(char *, const char *);
+extern char *__POSIX_DEF__(strtok_r)(char *, const char *, char **);
+extern char *__POSIX_DEF__(strtok)(char *, const char *);
 
 
 /* Collation Functions */
-extern int strcoll(const char *s1, const char *s2);
-extern size_t strxfrm(char *__restrict__ s1, const char *__restrict__ s2, size_t n);
+extern int __POSIX_DEF__(strcoll)(const char *s1, const char *s2);
+extern size_t __POSIX_DEF__(strxfrm)(char *__restrict__ s1, const char *__restrict__ s2, size_t n);
 
 /* Error Messages */
-extern char *strerror(int errnum);
-extern int strerror_r(int errnum, char *buf, size_t bufsz);
+extern char *__POSIX_DEF__(strerror)(int errnum);
+extern int __POSIX_DEF__(strerror_r)(int errnum, char *buf, size_t bufsz);
 
 /* String Length */
-extern size_t strlen(const char *s);
-extern size_t strnlen(const char *s, size_t n);
+extern size_t __POSIX_DEF__(strlen)(const char *s);
+extern size_t __POSIX_DEF__(strnlen)(const char *s, size_t n);
 
 /* Signal Messages */
-extern char *strsignal(int signum);
+extern char *__POSIX_DEF__(strsignal)(int signum);
 
 /* Legacy Declarations */
 #ifndef POSIX_STRINGS_H_
-extern int ffs(int i);
-extern int strcasecmp(const char *s1, const char *s2);
-extern int strncasecmp(const char *s1, const char *s2, size_t n);
+extern int __POSIX_DEF__(ffs)(int i);
+extern int __POSIX_DEF__(strcasecmp)(const char *s1, const char *s2);
+extern int __POSIX_DEF__(strncasecmp)(const char *s1, const char *s2, size_t n);
 #endif
 
Index: uspace/lib/posix/include/posix/strings.h
===================================================================
--- uspace/lib/posix/include/posix/strings.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/strings.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,15 +37,20 @@
 #define POSIX_STRINGS_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
+
 #include "libc/types/common.h"
 
 /* Search Functions */
 #ifndef POSIX_STRING_H_
-extern int ffs(int i);
+extern int __POSIX_DEF__(ffs)(int i);
 #endif
 
 /* String/Array Comparison */
 #ifndef POSIX_STRING_H_
-extern int strcasecmp(const char *s1, const char *s2);
-extern int strncasecmp(const char *s1, const char *s2, size_t n);
+extern int __POSIX_DEF__(strcasecmp)(const char *s1, const char *s2);
+extern int __POSIX_DEF__(strncasecmp)(const char *s1, const char *s2, size_t n);
 #endif
 
@@ -57,9 +62,9 @@
 
 /* Legacy Functions */
-extern int bcmp(const void *mem1, const void *mem2, size_t n);
-extern void bcopy(const void *src, void *dest, size_t n);
-extern void bzero(void *mem, size_t n);
-extern char *index(const char *s, int c);
-extern char *rindex(const char *s, int c);
+extern int __POSIX_DEF__(bcmp)(const void *mem1, const void *mem2, size_t n);
+extern void __POSIX_DEF__(bcopy)(const void *src, void *dest, size_t n);
+extern void __POSIX_DEF__(bzero)(void *mem, size_t n);
+extern char *__POSIX_DEF__(index)(const char *s, int c);
+extern char *__POSIX_DEF__(rindex)(const char *s, int c);
 
 
Index: uspace/lib/posix/include/posix/sys/mman.h
===================================================================
--- uspace/lib/posix/include/posix/sys/mman.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/sys/mman.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,4 +36,8 @@
 #define POSIX_SYS_MMAN_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "types.h"
 #include <abi/mm/as.h>
@@ -56,7 +60,8 @@
 #define PROT_EXEC  AS_AREA_EXEC
 
-extern void *mmap(void *start, size_t length, int prot, int flags, int fd,
-    off_t offset);
-extern int munmap(void *start, size_t length);
+extern void *
+__POSIX_DEF__(mmap)(void *start, size_t length, int prot, int flags, int fd,
+    __POSIX_DEF__(off_t) offset);
+extern int __POSIX_DEF__(munmap)(void *start, size_t length);
 
 
Index: uspace/lib/posix/include/posix/sys/stat.h
===================================================================
--- uspace/lib/posix/include/posix/sys/stat.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/sys/stat.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,4 +39,8 @@
 #include "types.h"
 #include "../time.h"
+
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
 
 /* values are the same as on Linux */
@@ -108,15 +112,15 @@
 #define S_ISSOCK(m) ((m & S_IFSOCK) != 0) /* socket? (Not in POSIX.1-1996.) */
 
-struct stat {
-	dev_t     st_dev;     /* ID of device containing file */
-	ino_t     st_ino;     /* inode number */
-	mode_t    st_mode;    /* protection */
-	nlink_t   st_nlink;   /* number of hard links */
-	uid_t     st_uid;     /* user ID of owner */
-	gid_t     st_gid;     /* group ID of owner */
-	dev_t     st_rdev;    /* device ID (if special file) */
-	off_t     st_size;    /* total size, in bytes */
-	blksize_t st_blksize; /* blocksize for file system I/O */
-	blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
+struct __POSIX_DEF__(stat) {
+	__POSIX_DEF__(dev_t)     st_dev;     /* ID of device containing file */
+	__POSIX_DEF__(ino_t)     st_ino;     /* inode number */
+	__POSIX_DEF__(mode_t)    st_mode;    /* protection */
+	__POSIX_DEF__(nlink_t)   st_nlink;   /* number of hard links */
+	__POSIX_DEF__(uid_t)     st_uid;     /* user ID of owner */
+	__POSIX_DEF__(gid_t)     st_gid;     /* group ID of owner */
+	__POSIX_DEF__(dev_t)     st_rdev;    /* device ID (if special file) */
+	__POSIX_DEF__(off_t)     st_size;    /* total size, in bytes */
+	__POSIX_DEF__(blksize_t) st_blksize; /* blocksize for file system I/O */
+	__POSIX_DEF__(blkcnt_t)  st_blocks;  /* number of 512B blocks allocated */
 	time_t          st_atime;   /* time of last access */
 	time_t          st_mtime;   /* time of last modification */
@@ -124,10 +128,10 @@
 };
 
-extern int fstat(int fd, struct stat *st);
-extern int lstat(const char *__restrict__ path, struct stat *__restrict__ st);
-extern int stat(const char *__restrict__ path, struct stat *__restrict__ st);
-extern int chmod(const char *path, mode_t mode);
-extern mode_t umask(mode_t mask);
-extern int mkdir(const char *path, mode_t mode);
+extern int __POSIX_DEF__(fstat)(int fd, struct __POSIX_DEF__(stat) *st);
+extern int __POSIX_DEF__(lstat)(const char *__restrict__ path, struct __POSIX_DEF__(stat) *__restrict__ st);
+extern int __POSIX_DEF__(stat)(const char *__restrict__ path, struct __POSIX_DEF__(stat) *__restrict__ st);
+extern int __POSIX_DEF__(chmod)(const char *path, __POSIX_DEF__(mode_t) mode);
+extern __POSIX_DEF__(mode_t) __POSIX_DEF__(umask)(__POSIX_DEF__(mode_t) mask);
+extern int __POSIX_DEF__(mkdir)(const char *path, __POSIX_DEF__(mode_t) mode);
 
 
Index: uspace/lib/posix/include/posix/sys/time.h
===================================================================
--- uspace/lib/posix/include/posix/sys/time.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/sys/time.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,4 +34,8 @@
 #define POSIX_SYS_TIME_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "libc/sys/time.h"
 
Index: uspace/lib/posix/include/posix/sys/types.h
===================================================================
--- uspace/lib/posix/include/posix/sys/types.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/sys/types.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,25 +37,29 @@
 #define POSIX_SYS_TYPES_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "libc/offset.h"
 #include "libc/sys/time.h"
 #include "libc/types/common.h"
 
-typedef unsigned int ino_t;
-typedef unsigned int nlink_t;
-typedef unsigned int uid_t;
-typedef unsigned int gid_t;
-typedef off64_t off_t;
-typedef long blksize_t;
-typedef long blkcnt_t;
-typedef int64_t pid_t;
-typedef sysarg_t dev_t;
-typedef unsigned int mode_t;
+typedef unsigned int __POSIX_DEF__(ino_t);
+typedef unsigned int __POSIX_DEF__(nlink_t);
+typedef unsigned int __POSIX_DEF__(uid_t);
+typedef unsigned int __POSIX_DEF__(gid_t);
+typedef off64_t __POSIX_DEF__(off_t);
+typedef long __POSIX_DEF__(blksize_t);
+typedef long __POSIX_DEF__(blkcnt_t);
+typedef int64_t __POSIX_DEF__(pid_t);
+typedef sysarg_t __POSIX_DEF__(dev_t);
+typedef unsigned int __POSIX_DEF__(mode_t);
 
 /* PThread Types */
-typedef struct thread_attr thread_attr_t;
+typedef struct __POSIX_DEF__(thread_attr) __POSIX_DEF__(thread_attr_t);
 
 /* Clock Types */
-typedef long clock_t;
-typedef int clockid_t;
+typedef long __POSIX_DEF__(clock_t);
+typedef int __POSIX_DEF__(clockid_t);
 
 
Index: uspace/lib/posix/include/posix/sys/wait.h
===================================================================
--- uspace/lib/posix/include/posix/sys/wait.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/sys/wait.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,4 +36,8 @@
 #define POSIX_SYS_WAIT_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "types.h"
 
@@ -52,6 +56,6 @@
 extern int __posix_wtermsig(int status);
 
-extern pid_t wait(int *stat_ptr);
-extern pid_t waitpid(pid_t pid, int *stat_ptr, int options);
+extern __POSIX_DEF__(pid_t) __POSIX_DEF__(wait)(int *stat_ptr);
+extern __POSIX_DEF__(pid_t) __POSIX_DEF__(waitpid)(__POSIX_DEF__(pid_t) pid, int *stat_ptr, int options);
 
 
Index: uspace/lib/posix/include/posix/time.h
===================================================================
--- uspace/lib/posix/include/posix/time.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/time.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,4 +37,8 @@
 #define POSIX_TIME_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "sys/types.h"
 
@@ -47,63 +51,69 @@
 #ifndef __locale_t_defined
 	#define __locale_t_defined
-	typedef struct __posix_locale *locale_t;
+	typedef struct __posix_locale *__POSIX_DEF__(locale_t);
+	#ifndef LIBPOSIX_INTERNAL
+		#define locale_t __POSIX_DEF__(locale_t)
+	#endif
 #endif
 
 #ifndef POSIX_SIGNAL_H_
-	struct sigevent;
+	struct __POSIX_DEF__(sigevent);
+	#ifndef LIBPOSIX_INTERNAL
+		#define sigevent __POSIX_DEF__(sigevent)
+	#endif
 #endif
 
 #undef CLOCK_REALTIME
-#define CLOCK_REALTIME ((clockid_t) 0)
+#define CLOCK_REALTIME ((__POSIX_DEF__(clockid_t)) 0)
 
-struct timespec {
+struct __POSIX_DEF__(timespec) {
 	time_t tv_sec; /* Seconds. */
 	long tv_nsec; /* Nanoseconds. */
 };
 
-struct itimerspec {
-	struct timespec it_interval; /* Timer period. */
-	struct timespec it_value; /* Timer expiration. */
+struct __POSIX_DEF__(itimerspec) {
+	struct __POSIX_DEF__(timespec) it_interval; /* Timer period. */
+	struct __POSIX_DEF__(timespec) it_value; /* Timer expiration. */
 };
 
-typedef struct __posix_timer *timer_t;
+typedef struct __posix_timer *__POSIX_DEF__(timer_t);
 
 /* Timezones */
-extern int daylight;
-extern long timezone;
-extern char *tzname[2];
-extern void tzset(void);
+extern int __POSIX_DEF__(daylight);
+extern long __POSIX_DEF__(timezone);
+extern char *__POSIX_DEF__(tzname)[2];
+extern void __POSIX_DEF__(tzset)(void);
 
 /* Time */
-extern time_t time(time_t *t);
+extern time_t __POSIX_DEF__(time)(time_t *t);
 
 /* Broken-down Time */
-extern struct tm *gmtime_r(const time_t *__restrict__ timer,
+extern struct tm *__POSIX_DEF__(gmtime_r)(const time_t *__restrict__ timer,
     struct tm *__restrict__ result);
-extern struct tm *gmtime(const time_t *__restrict__ timep);
-extern struct tm *localtime_r(const time_t *__restrict__ timer,
+extern struct tm *__POSIX_DEF__(gmtime)(const time_t *__restrict__ timep);
+extern struct tm *__POSIX_DEF__(localtime_r)(const time_t *__restrict__ timer,
     struct tm *__restrict__ result);
-extern struct tm *localtime(const time_t *__restrict__ timep);
+extern struct tm *__POSIX_DEF__(localtime)(const time_t *__restrict__ timep);
 
 /* Formatting Calendar Time */
-extern char *asctime_r(const struct tm *__restrict__ timeptr,
+extern char *__POSIX_DEF__(asctime_r)(const struct tm *__restrict__ timeptr,
     char *__restrict__ buf);
-extern char *asctime(const struct tm *__restrict__ timeptr);
-extern char *ctime_r(const time_t *timer, char *buf);
-extern char *ctime(const time_t *timer);
+extern char *__POSIX_DEF__(asctime)(const struct tm *__restrict__ timeptr);
+extern char *__POSIX_DEF__(ctime_r)(const time_t *timer, char *buf);
+extern char *__POSIX_DEF__(ctime)(const time_t *timer);
 extern time_t time(time_t *t);
 
 /* Clocks */
-extern int clock_getres(clockid_t clock_id,
-    struct timespec *res);
-extern int clock_gettime(clockid_t clock_id,
-    struct timespec *tp);
-extern int clock_settime(clockid_t clock_id,
-    const struct timespec *tp);
-extern int clock_nanosleep(clockid_t clock_id, int flags,
-    const struct timespec *rqtp, struct timespec *rmtp);
+extern int __POSIX_DEF__(clock_getres)(__POSIX_DEF__(clockid_t) clock_id,
+    struct __POSIX_DEF__(timespec) *res);
+extern int __POSIX_DEF__(clock_gettime)(__POSIX_DEF__(clockid_t) clock_id,
+    struct __POSIX_DEF__(timespec) *tp);
+extern int __POSIX_DEF__(clock_settime)(__POSIX_DEF__(clockid_t) clock_id,
+    const struct __POSIX_DEF__(timespec) *tp); 
+extern int __POSIX_DEF__(clock_nanosleep)(__POSIX_DEF__(clockid_t) clock_id, int flags,
+    const struct __POSIX_DEF__(timespec) *rqtp, struct __POSIX_DEF__(timespec) *rmtp);
 
 /* CPU Time */
-extern clock_t clock(void);
+extern __POSIX_DEF__(clock_t) __POSIX_DEF__(clock)(void);
 
 
Index: uspace/lib/posix/include/posix/ucontext.h
===================================================================
--- uspace/lib/posix/include/posix/ucontext.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/ucontext.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,24 +36,28 @@
 #define POSIX_UCONTEXT_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "sys/types.h"
 
-typedef int sig_atomic_t;
-typedef uint32_t sigset_t;
-typedef struct mcontext {
+typedef int __POSIX_DEF__(sig_atomic_t);
+typedef uint32_t __POSIX_DEF__(sigset_t);
+typedef struct __POSIX_DEF__(mcontext) {
 	/* must not be empty to avoid compiler warnings (-pedantic) */
 	int dummy;
-} mcontext_t;
+} __POSIX_DEF__(mcontext_t);
 
-union sigval {
+union __POSIX_DEF__(sigval) {
 	int sival_int;
 	void *sival_ptr;
 };
 
-struct sigevent {
+struct __POSIX_DEF__(sigevent) {
 	int sigev_notify; /* Notification type. */
 	int sigev_signo; /* Signal number. */
-	union sigval sigev_value; /* Signal value. */
-	void (*sigev_notify_function)(union sigval); /* Notification function. */
-	thread_attr_t *sigev_notify_attributes; /* Notification attributes. */
+	union __POSIX_DEF__(sigval) sigev_value; /* Signal value. */
+	void (*sigev_notify_function)(union __POSIX_DEF__(sigval)); /* Notification function. */
+	__POSIX_DEF__(thread_attr_t) *sigev_notify_attributes; /* Notification attributes. */
 };
 
@@ -62,12 +66,12 @@
 	size_t ss_size;
 	int ss_flags;
-} stack_t;
+} __POSIX_DEF__(stack_t);
 
-typedef struct ucontext {
-	struct ucontext *uc_link;
-	sigset_t uc_sigmask;
-	stack_t uc_stack;
-	mcontext_t uc_mcontext;
-} ucontext_t;
+typedef struct __POSIX_DEF__(ucontext) {
+	struct __POSIX_DEF__(ucontext) *uc_link;
+	__POSIX_DEF__(sigset_t) uc_sigmask;
+	__POSIX_DEF__(stack_t) uc_stack;
+	__POSIX_DEF__(mcontext_t) uc_mcontext;
+} __POSIX_DEF__(ucontext_t);
 
 
Index: uspace/lib/posix/include/posix/unistd.h
===================================================================
--- uspace/lib/posix/include/posix/unistd.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/include/posix/unistd.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,4 +37,8 @@
 #define POSIX_UNISTD_H_
 
+#ifndef __POSIX_DEF__
+#define __POSIX_DEF__(x) x
+#endif
+
 #include "sys/types.h"
 #include "stddef.h"
@@ -47,45 +51,45 @@
 #define _exit exit
 
-extern char *optarg;
+extern char *__POSIX_DEF__(optarg);
 extern int optind, opterr, optopt;
-extern int getopt(int, char * const [], const char *);
+extern int __POSIX_DEF__(getopt)(int, char * const [], const char *);
 
 /* Environment */
-extern char **environ;
+extern char **__POSIX_DEF__(environ);
 
 /* Sleeping */
-extern unsigned int sleep(unsigned int);
+extern unsigned int __POSIX_DEF__(sleep)(unsigned int);
 
 /* Login Information */
-extern char *getlogin(void);
-extern int getlogin_r(char *name, size_t namesize);
+extern char *__POSIX_DEF__(getlogin)(void);
+extern int __POSIX_DEF__(getlogin_r)(char *name, size_t namesize);
 
 /* Identifying Terminals */
-extern int isatty(int fd);
+extern int __POSIX_DEF__(isatty)(int fd);
 
 /* Working Directory */
-extern char *getcwd(char *buf, size_t size);
-extern int chdir(const char *path);
+extern char *__POSIX_DEF__(getcwd)(char *buf, size_t size);
+extern int __POSIX_DEF__(chdir)(const char *path);
 
 /* Query Memory Parameters */
-extern int getpagesize(void);
+extern int __POSIX_DEF__(getpagesize)(void);
 
 /* Process Identification */
-extern pid_t getpid(void);
-extern uid_t getuid(void);
-extern gid_t getgid(void);
+extern __POSIX_DEF__(pid_t) __POSIX_DEF__(getpid)(void);
+extern __POSIX_DEF__(uid_t) __POSIX_DEF__(getuid)(void);
+extern __POSIX_DEF__(gid_t) __POSIX_DEF__(getgid)(void);
 
 /* File Manipulation */
-extern int close(int fildes);
-extern ssize_t read(int fildes, void *buf, size_t nbyte);
-extern ssize_t write(int fildes, const void *buf, size_t nbyte);
-extern off_t lseek(int fildes,
-    off_t offset, int whence);
-extern int fsync(int fildes);
-extern int ftruncate(int fildes, off_t length);
-extern int rmdir(const char *path);
-extern int unlink(const char *path);
-extern int dup(int fildes);
-extern int dup2(int fildes, int fildes2);
+extern int __POSIX_DEF__(close)(int fildes);
+extern ssize_t __POSIX_DEF__(read)(int fildes, void *buf, size_t nbyte);
+extern ssize_t __POSIX_DEF__(write)(int fildes, const void *buf, size_t nbyte);
+extern __POSIX_DEF__(off_t) __POSIX_DEF__(lseek)(int fildes,
+    __POSIX_DEF__(off_t) offset, int whence);
+extern int __POSIX_DEF__(fsync)(int fildes);
+extern int __POSIX_DEF__(ftruncate)(int fildes, __POSIX_DEF__(off_t) length);
+extern int __POSIX_DEF__(rmdir)(const char *path);
+extern int __POSIX_DEF__(unlink)(const char *path);
+extern int __POSIX_DEF__(dup)(int fildes);
+extern int __POSIX_DEF__(dup2)(int fildes, int fildes2);
 
 /* Standard Streams */
@@ -106,5 +110,5 @@
 #define	W_OK 2 /* Test for write permission. */
 #define	R_OK 4 /* Test for read permission. */
-extern int access(const char *path, int amode);
+extern int __POSIX_DEF__(access)(const char *path, int amode);
 
 /* System Parameters */
@@ -115,5 +119,5 @@
 	_SC_CLK_TCK
 };
-extern long sysconf(int name);
+extern long __POSIX_DEF__(sysconf)(int name);
 
 /* Path Configuration Parameters */
@@ -139,18 +143,18 @@
 	_PC_VDISABLE
 };
-extern long pathconf(const char *path, int name);
+extern long __POSIX_DEF__(pathconf)(const char *path, int name);
 
 /* Creating a Process */
-extern pid_t fork(void);
+extern __POSIX_DEF__(pid_t) __POSIX_DEF__(fork)(void);
 
 /* Executing a File */
-extern int execv(const char *path, char *const argv[]);
-extern int execvp(const char *file, char *const argv[]);
+extern int __POSIX_DEF__(execv)(const char *path, char *const argv[]);
+extern int __POSIX_DEF__(execvp)(const char *file, char *const argv[]);
 
 /* Creating a Pipe */
-extern int pipe(int fildes[2]);
+extern int __POSIX_DEF__(pipe)(int fildes[2]);
 
 /* Issue alarm signal. */
-extern unsigned int alarm(unsigned int);
+extern unsigned int __POSIX_DEF__(alarm)(unsigned int);
 
 #endif /* POSIX_UNISTD_H_ */
Index: uspace/lib/posix/source/ctype.c
===================================================================
--- uspace/lib/posix/source/ctype.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/ctype.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Character classification.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "posix/ctype.h"
+
+/**
+ * Checks whether character is a hexadecimal digit.
+ *
+ * @param c Character to inspect.
+ * @return Non-zero if character match the definition, zero otherwise.
+ */
+int posix_isxdigit(int c)
+{
+	return isdigit(c) ||
+	    (c >= 'a' && c <= 'f') ||
+	    (c >= 'A' && c <= 'F');
+}
+
+/**
+ * Checks whether character is a word separator.
+ *
+ * @param c Character to inspect.
+ * @return Non-zero if character match the definition, zero otherwise.
+ */
+int posix_isblank(int c)
+{
+	return c == ' ' || c == '\t';
+}
+
+/**
+ * Checks whether character is a control character.
+ *
+ * @param c Character to inspect.
+ * @return Non-zero if character match the definition, zero otherwise.
+ */
+int posix_iscntrl(int c)
+{
+	return c < 0x20 || c == 0x7E;
+}
+
+/**
+ * Checks whether character is any printing character except space.
+ *
+ * @param c Character to inspect.
+ * @return Non-zero if character match the definition, zero otherwise.
+ */
+int posix_isgraph(int c)
+{
+	return posix_isprint(c) && c != ' ';
+}
+
+/**
+ * Checks whether character is a printing character.
+ *
+ * @param c Character to inspect.
+ * @return Non-zero if character match the definition, zero otherwise.
+ */
+int posix_isprint(int c)
+{
+	return posix_isascii(c) && !posix_iscntrl(c);
+}
+
+/**
+ * Checks whether character is a punctuation.
+ *
+ * @param c Character to inspect.
+ * @return Non-zero if character match the definition, zero otherwise.
+ */
+int posix_ispunct(int c)
+{
+	return !isspace(c) && !isalnum(c) && posix_isprint(c);
+}
+
+/**
+ * Checks whether character is ASCII. (obsolete)
+ *
+ * @param c Character to inspect.
+ * @return Non-zero if character match the definition, zero otherwise.
+ */
+int posix_isascii(int c)
+{
+	return c >= 0 && c < 128;
+}
+
+/**
+ * Converts argument to a 7-bit ASCII character. (obsolete)
+ *
+ * @param c Character to convert.
+ * @return Coverted character.
+ */
+int posix_toascii(int c)
+{
+	return c & 0x7F;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/dlfcn.c
===================================================================
--- uspace/lib/posix/source/dlfcn.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/dlfcn.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "internal/common.h"
+#include "posix/dlfcn.h"
+
+#include "libc/dlfcn.h"
+
+void *posix_dlopen(const char *filename, int flags)
+{
+	if (flags != 0) {
+		fprintf(stderr, "dlopen() not implemented with non-zero flags (%s:%d), something will NOT work.\n", __FILE__, __LINE__);
+	}
+	
+	return dlopen(filename, 0);
+}
+
+void *posix_dlsym(void *handle, const char *symbol)
+{
+	return dlsym(handle, symbol);
+}
+
+int posix_dlclose(void *handle)
+{
+	not_implemented();
+	return 0;
+}
+
+char *posix_dlerror(void)
+{
+	not_implemented();
+	return (char *)"dlerror()";
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/errno.c
===================================================================
--- uspace/lib/posix/source/errno.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/errno.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file System error numbers.
+ */
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "posix/errno.h"
+
+#include "posix/stdlib.h"
+#include "libc/fibril.h"
+
+static fibril_local int _posix_errno;
+
+int *__posix_errno(void)
+{
+	if (*__errno() != 0) {
+		_posix_errno = posix_abs(*__errno());
+		*__errno() = 0;
+	}
+	return &_posix_errno;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/fcntl.c
===================================================================
--- uspace/lib/posix/source/fcntl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/fcntl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file File control.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "internal/common.h"
+#include "posix/fcntl.h"
+
+#include "libc/vfs/vfs.h"
+#include "posix/errno.h"
+
+/**
+ * Performs set of operations on the opened files.
+ *
+ * @param fd File descriptor of the opened file.
+ * @param cmd Operation to carry out.
+ * @return Non-negative on success. Might have special meaning corresponding
+ *     to the requested operation.
+ */
+int posix_fcntl(int fd, int cmd, ...)
+{
+	int flags;
+
+	switch (cmd) {
+	case F_DUPFD:
+	case F_DUPFD_CLOEXEC:
+		/* VFS currently does not provide the functionality to duplicate
+		 * opened file descriptor. */
+		// FIXME: implement this once dup() is available
+		errno = ENOTSUP;
+		return -1;
+	case F_GETFD:
+		/* FD_CLOEXEC is not supported. There are no other flags. */
+		return 0;
+	case F_SETFD:
+		/* FD_CLOEXEC is not supported. Ignore arguments and report success. */
+		return 0;
+	case F_GETFL:
+		/* File status flags (i.e. O_APPEND) are currently private to the
+		 * VFS server so it cannot be easily retrieved. */
+		flags = 0;
+		/* File access flags are currently not supported for file descriptors.
+		 * Provide full access. */
+		flags |= O_RDWR;
+		return flags;
+	case F_SETFL:
+		/* File access flags are currently not supported for file descriptors.
+		 * Ignore arguments and report success. */
+		return 0;
+	case F_GETOWN:
+	case F_SETOWN:
+	case F_GETLK:
+	case F_SETLK:
+	case F_SETLKW:
+		/* Signals (SIGURG) and file locks are not supported. */
+		errno = ENOTSUP;
+		return -1;
+	default:
+		/* Unknown command */
+		errno = EINVAL;
+		return -1;
+	}
+}
+
+/**
+ * Open, possibly create, a file.
+ *
+ * @param pathname Path to the file.
+ * @param posix_flags Access mode flags.
+ */
+int posix_open(const char *pathname, int posix_flags, ...)
+{
+	int rc;
+	posix_mode_t posix_mode = 0;
+	if (posix_flags & O_CREAT) {
+		va_list args;
+		va_start(args, posix_flags);
+		posix_mode = va_arg(args, posix_mode_t);
+		va_end(args);
+		(void) posix_mode;
+	}
+
+	if (((posix_flags & (O_RDONLY | O_WRONLY | O_RDWR)) == 0) ||
+	    ((posix_flags & (O_RDONLY | O_WRONLY)) == (O_RDONLY | O_WRONLY)) ||
+	    ((posix_flags & (O_RDONLY | O_RDWR)) == (O_RDONLY | O_RDWR)) ||
+	    ((posix_flags & (O_WRONLY | O_RDWR)) == (O_WRONLY | O_RDWR))) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	int flags = WALK_REGULAR;
+	if (posix_flags & O_CREAT) {
+		if (posix_flags & O_EXCL)
+			flags |= WALK_MUST_CREATE;
+		else
+			flags |= WALK_MAY_CREATE;
+	}
+
+	int mode =
+	    ((posix_flags & O_RDWR) ? MODE_READ | MODE_WRITE : 0) |
+	    ((posix_flags & O_RDONLY) ? MODE_READ : 0) |
+	    ((posix_flags & O_WRONLY) ? MODE_WRITE : 0) |
+	    ((posix_flags & O_APPEND) ? MODE_APPEND : 0);
+
+	int file = rcerrno(vfs_lookup, pathname, flags);
+	if (file < 0)
+		return -1;
+
+	rc = rcerrno(vfs_open, file, mode);
+	if (rc != EOK) {
+		vfs_put(file);
+		return -1;
+	}
+
+	if (posix_flags & O_TRUNC) {
+		if (posix_flags & (O_RDWR | O_WRONLY)) {
+			rc = rcerrno(vfs_resize, file, 0);
+			if (rc != EOK) {
+				vfs_put(file);
+				return -1;
+			}
+		}
+	}
+
+	return file;
+}
+
+/** @}
+ */
+
Index: uspace/lib/posix/source/fnmatch.c
===================================================================
--- uspace/lib/posix/source/fnmatch.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/fnmatch.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,717 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Filename-matching.
+ */
+
+/* This file contains an implementation of the fnmatch() pattern matching
+ * function. There is more code than necessary to account for the possibility
+ * of adding POSIX-like locale support to the system in the future. Functions
+ * that are only necessary for locale support currently simply use single
+ * characters for "collation elements". 
+ * When (or if) locales are properly implemented, extending this implementation
+ * will be fairly straightforward.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "libc/stdbool.h"
+#include "posix/ctype.h"
+#include "posix/string.h"
+#include "posix/stdlib.h"
+#include "posix/assert.h"
+
+#include "internal/common.h"
+#include "posix/fnmatch.h"
+
+/* Returned by _match... functions. */
+#define INVALID_PATTERN -1
+
+/* Type for collating element, simple identity with characters now,
+ * but may be extended for better locale support.
+ */
+typedef int coll_elm_t;
+
+/** Return value indicating that the element in question
+ * is not valid in the current locale. (That is, if locales are supported.)
+ */
+#define COLL_ELM_INVALID -1
+
+/**
+ * Get collating element matching a string.
+ *
+ * @param str String representation of the element.
+ * @return Matching collating element or COLL_ELM_INVALID.
+ */
+static coll_elm_t _coll_elm_get(const char* str)
+{
+	if (str[0] == '\0' || str[1] != '\0') {
+		return COLL_ELM_INVALID;
+	}
+	return str[0];
+}
+
+/**
+ * Get collating element matching a single character.
+ *
+ * @param c Character representation of the element.
+ * @return Matching collating element.
+ */
+static coll_elm_t _coll_elm_char(int c)
+{
+	return c;
+}
+
+/**
+ * Match collating element with a beginning of a string.
+ *
+ * @param elm Collating element to match.
+ * @param str String which beginning should match the element.
+ * @return 0 if the element doesn't match, or the number of characters matched.
+ */
+static int _coll_elm_match(coll_elm_t elm, const char *str)
+{
+	return elm == *str;
+}
+
+/**
+ * Checks whether a string begins with a collating element in the given range.
+ * Ordering depends on the locale (if locales are supported).
+ *
+ * @param first First element of the range.
+ * @param second Last element of the range.
+ * @param str String to match.
+ * @return 0 if there is no match, or the number of characters matched.
+ */
+static int _coll_elm_between(coll_elm_t first, coll_elm_t second,
+    const char *str)
+{
+	return *str >= first && *str <= second;
+}
+
+/**
+ * Read a string delimited by [? and ?].
+ *
+ * @param pattern Pointer to the string to read from. Its position is moved
+ *    to the first character after the closing ].
+ * @param seq The character on the inside of brackets.
+ * @param buf Read buffer.
+ * @param buf_sz Read buffer's size. If the buffer is not large enough for
+ *    the entire string, the string is cut with no error indication.
+ * @param flags Flags modifying the behavior.
+ * @return True on success, false if the pattern is invalid.
+ */
+static bool _get_delimited(
+    const char **pattern, int seq,
+    char *buf, size_t buf_sz, int flags)
+{
+	const bool noescape = (flags & FNM_NOESCAPE) != 0;
+	const bool pathname = (flags & FNM_PATHNAME) != 0;
+
+	const char *p = *pattern;
+	assert(p[0] == '[' && p[1] == seq /* Caller should ensure this. */);
+	p += 2;
+
+	while (true) {
+		if (*p == seq && *(p + 1) == ']') {
+			/* String properly ended, return. */
+			*pattern = p + 2;
+			*buf = '\0';
+			return true;
+		}
+		if (!noescape && *p == '\\') {
+			p++;
+		}
+		if (*p == '\0') {
+			/* String not ended properly, invalid pattern. */
+			return false;
+		}
+		if (pathname && *p == '/') {
+			/* Slash in a pathname pattern is invalid. */
+			return false;
+		}
+		if (buf_sz > 1) {
+			/* Only add to the buffer if there is space. */
+			*buf = *p;
+			buf++;
+			buf_sz--;
+		}
+		p++;
+	}
+}
+
+/************** CHARACTER CLASSES ****************/
+
+#define MAX_CLASS_OR_COLL_LEN 6
+
+struct _char_class {
+	const char *name;
+	int (*func) (int);
+};
+
+/* List of supported character classes. */
+static const struct _char_class _char_classes[] = {
+	{ "alnum", isalnum },
+	{ "alpha", isalpha },
+	{ "blank", posix_isblank },
+	{ "cntrl", posix_iscntrl },
+	{ "digit", isdigit },
+	{ "graph", posix_isgraph },
+	{ "lower", islower },
+	{ "print", posix_isprint },
+	{ "punct", posix_ispunct },
+	{ "space", isspace },
+	{ "upper", isupper },
+	{ "xdigit", posix_isxdigit }
+};
+
+/**
+ * Compare function for binary search in the _char_classes array.
+ * 
+ * @param key Key of the searched element.
+ * @param elem Element of _char_classes array.
+ * @return Ordering indicator (-1 less than, 0 equal, 1 greater than).
+ */
+static int _class_compare(const void *key, const void *elem)
+{
+	const struct _char_class *class = elem;
+	return posix_strcmp((const char *) key, class->name);
+}
+
+/**
+ * Returns whether the given character belongs to the specified character class.
+ * 
+ * @param cname Name of the character class.
+ * @param c Character.
+ * @return True if the character belongs to the class, false otherwise.
+ */
+static bool _is_in_class (const char *cname, int c)
+{
+	/* Search for class in the array of supported character classes. */
+	const struct _char_class *class = posix_bsearch(cname, _char_classes,
+	    sizeof(_char_classes) / sizeof(struct _char_class),
+	    sizeof(struct _char_class), _class_compare);
+
+	if (class == NULL) {
+		/* No such class supported - treat as an empty class. */
+		return false;
+	} else {
+		/* Class matched. */
+		return class->func(c);
+	}
+}
+
+/**
+ * Tries to parse an initial part of the pattern as a character class pattern,
+ * and if successful, matches the beginning of the given string against the class.
+ * 
+ * @param pattern Pointer to the pattern to match. Must begin with a class
+ *    specifier and is repositioned to the first character after the specifier
+ *    if successful.
+ * @param str String to match.
+ * @param flags Flags modifying the behavior (see fnmatch()).
+ * @return INVALID_PATTERN if the pattern doesn't start with a valid class
+ *    specifier, 0 if the beginning of the matched string doesn't belong
+ *    to the class, or positive number of characters matched.
+ */
+static int _match_char_class(const char **pattern, const char *str, int flags)
+{
+	char class[MAX_CLASS_OR_COLL_LEN + 1];
+
+	if (!_get_delimited(pattern, ':', class, sizeof(class), flags)) {
+		return INVALID_PATTERN;
+	}
+
+	return _is_in_class(class, *str);
+}
+
+/************** END CHARACTER CLASSES ****************/
+
+/**
+ * Reads the next collating element in the pattern, taking into account
+ * locale (if supported) and flags (see fnmatch()).
+ * 
+ * @param pattern Pattern.
+ * @param flags Flags given to fnmatch().
+ * @return Collating element on success,
+ *     or COLL_ELM_INVALID if the pattern is invalid.
+ */
+static coll_elm_t _next_coll_elm(const char **pattern, int flags)
+{
+	assert(pattern != NULL);
+	assert(*pattern != NULL);
+	assert(**pattern != '\0');
+
+	const char *p = *pattern;
+	const bool noescape = (flags & FNM_NOESCAPE) != 0;
+	const bool pathname = (flags & FNM_PATHNAME) != 0;
+
+	if (*p == '[') {
+		if (*(p + 1) == '.') {
+			char buf[MAX_CLASS_OR_COLL_LEN + 1];
+			if (!_get_delimited(pattern, '.', buf, sizeof(buf), flags)) {
+				return COLL_ELM_INVALID;
+			}
+			return _coll_elm_get(buf);
+		}
+
+		if (*(p + 1) == '=') {
+			char buf[MAX_CLASS_OR_COLL_LEN + 1];
+			if (!_get_delimited(pattern, '=', buf, sizeof(buf), flags)) {
+				return COLL_ELM_INVALID;
+			}
+			return _coll_elm_get(buf);
+		}
+	}
+
+	if (!noescape && *p == '\\') {
+		p++;
+		if (*p == '\0') {
+			*pattern = p;
+			return COLL_ELM_INVALID;
+		}
+	}
+	if (pathname && *p == '/') {
+		return COLL_ELM_INVALID;
+	}
+	
+	*pattern = p + 1;
+	return _coll_elm_char(*p);
+}
+
+/**
+ * Matches the beginning of the given string against a bracket expression
+ * the pattern begins with.
+ * 
+ * @param pattern Pointer to the beginning of a bracket expression in a pattern.
+ *     On success, the pointer is moved to the first character after the
+ *     bracket expression.
+ * @param str Unmatched part of the string.
+ * @param flags Flags given to fnmatch().
+ * @return INVALID_PATTERN if the pattern is invalid, 0 if there is no match
+ *     or the number of matched characters on success.
+ */
+static int _match_bracket_expr(const char **pattern, const char *str, int flags)
+{
+	const bool pathname = (flags & FNM_PATHNAME) != 0;
+	const bool special_period = (flags & FNM_PERIOD) != 0;
+	const char *p = *pattern;
+	bool negative = false;
+	int matched = 0;
+
+	#define _matched(match) { \
+		int _match = match; \
+		if (_match < 0) { \
+			/* Invalid pattern */ \
+			return _match; \
+		} else if (matched == 0 && _match > 0) { \
+			/* First match */ \
+			matched = _match; \
+		} \
+	}
+
+	assert(*p == '[');  /* calling code should ensure this */
+	p++;
+
+	if (*str == '\0' || (pathname && *str == '/') ||
+	    (pathname && special_period && *str == '.' && *(str - 1) == '/')) {
+		/* No bracket expression matches end of string,
+		 * slash in pathname match or initial period with FNM_PERIOD
+		 * option.
+		 */
+		return 0;
+	}
+
+	if (*p == '^' || *p == '!') {
+		negative = true;
+		p++;
+	}
+
+	if (*p == ']') {
+		/* When ']' is first, treat it as a normal character. */
+		_matched(*str == ']');
+		p++;
+	}
+	
+	coll_elm_t current_elm = COLL_ELM_INVALID;
+	
+	while (*p != ']') {
+		if (*p == '-' && *(p + 1) != ']' &&
+		    current_elm != COLL_ELM_INVALID) {
+			/* Range expression. */
+			p++;
+			coll_elm_t end_elm = _next_coll_elm(&p, flags);
+			if (end_elm == COLL_ELM_INVALID) {
+				return INVALID_PATTERN;
+			}
+			_matched(_coll_elm_between(current_elm, end_elm, str));
+			continue;
+		}
+	
+		if (*p == '[' && *(p + 1) == ':') {
+			current_elm = COLL_ELM_INVALID;
+			_matched(_match_char_class(&p, str, flags));
+			continue;
+		}
+		
+		current_elm = _next_coll_elm(&p, flags);
+		if (current_elm == COLL_ELM_INVALID) {
+			return INVALID_PATTERN;
+		}
+		_matched(_coll_elm_match(current_elm, str));
+	}
+
+	/* No error occured - update pattern pointer. */
+	*pattern = p + 1;
+
+	if (matched == 0) {
+		/* No match found */
+		return negative;
+	} else {
+		/* Matched 'match' characters. */
+		return negative ? 0 : matched;
+	}
+
+	#undef _matched
+}
+
+/**
+ * Matches a portion of the pattern containing no asterisks (*) against
+ * the given string.
+ * 
+ * @param pattern Pointer to the unmatched portion of the pattern.
+ *     On success, the pointer is moved to the first asterisk, or to the
+ *     terminating nul character, whichever occurs first.
+ * @param string Pointer to the input string. On success, the pointer is moved
+ *     to the first character that wasn't explicitly matched.
+ * @param flags Flags given to fnmatch().
+ * @return True if the entire subpattern matched. False otherwise.
+ */
+static bool _partial_match(const char **pattern, const char **string, int flags)
+{
+	/* Only a single *-delimited subpattern is matched here.
+	 * So in this function, '*' is understood as the end of pattern.
+	 */
+
+	const bool pathname = (flags & FNM_PATHNAME) != 0;
+	const bool special_period = (flags & FNM_PERIOD) != 0;
+	const bool noescape = (flags & FNM_NOESCAPE) != 0;
+	const bool leading_dir = (flags & FNM_LEADING_DIR) != 0;
+
+	const char *s = *string;
+	const char *p = *pattern;
+
+	while (*p != '*') {
+		/* Bracket expression. */
+		if (*p == '[') {
+			int matched = _match_bracket_expr(&p, s, flags);
+			if (matched == 0) {
+				/* Doesn't match. */
+				return false;
+			}
+			if (matched != INVALID_PATTERN) {
+				s += matched;
+				continue;
+			}
+
+			assert(matched == INVALID_PATTERN);
+			/* Fall through to match [ as an ordinary character. */
+		}
+
+		/* Wildcard match. */
+		if (*p == '?') {
+			if (*s == '\0') {
+				/* No character to match. */
+				return false;
+			}
+			if (pathname && *s == '/') {
+				/* Slash must be matched explicitly. */
+				return false;
+			}
+			if (special_period && pathname &&
+			    *s == '.' && *(s - 1) == '/') {
+				/* Initial period must be matched explicitly. */
+				return false;
+			}
+			
+			/* None of the above, match anything else. */
+			p++;
+			s++;
+			continue;
+		}
+
+		if (!noescape && *p == '\\') {
+			/* Escaped character. */
+			p++;
+		}
+
+		if (*p == '\0') {
+			/* End of pattern, must match end of string or
+			 * an end of subdirectory name (optional).
+			 */
+
+			if (*s == '\0' || (leading_dir && *s == '/')) {
+				break;
+			}
+
+			return false;
+		}
+
+		if (*p == *s) {
+			/* Exact match. */
+			p++;
+			s++;
+			continue;
+		}
+
+		/* Nothing matched. */
+		return false;
+	}
+
+	/* Entire sub-pattern matched. */
+	
+	/* postconditions */
+	assert(*p == '\0' || *p == '*');
+	assert(*p != '\0' || *s == '\0' || (leading_dir && *s == '/'));
+	
+	*pattern = p;
+	*string = s;
+	return true;
+}
+
+/**
+ * Match string against a pattern.
+ * 
+ * @param pattern Pattern.
+ * @param string String to match.
+ * @param flags Flags given to fnmatch().
+ * @return True if the string matched the pattern, false otherwise.
+ */
+static bool _full_match(const char *pattern, const char *string, int flags)
+{
+	const bool pathname = (flags & FNM_PATHNAME) != 0;
+	const bool special_period = (flags & FNM_PERIOD) != 0;
+	const bool leading_dir = (flags & FNM_LEADING_DIR) != 0;
+
+	if (special_period && *string == '.') {
+		/* Initial dot must be matched by an explicit dot in pattern. */
+		if (*pattern != '.') {
+			return false;
+		}
+		pattern++;
+		string++;
+	}
+
+	if (*pattern != '*') {
+		if (!_partial_match(&pattern, &string, flags)) {
+			/* The initial match must succeed. */
+			return false;
+		}
+	}
+
+	while (*pattern != '\0') {
+		assert(*pattern == '*');
+		pattern++;
+
+		bool matched = false;
+
+		const char *end;
+		if (pathname && special_period &&
+		    *string == '.' && *(string - 1) == '/') {
+			end = string;
+		} else {
+			end = gnu_strchrnul(string, pathname ? '/' : '\0');
+		}
+
+		/* Try to match every possible offset. */
+		while (string <= end) {
+			if (_partial_match(&pattern, &string, flags)) {
+				matched = true;
+				break;
+			}
+			string++;
+		}
+
+		if (matched) {
+			continue;
+		}
+
+		return false;
+	}
+
+	return *string == '\0' || (leading_dir && *string == '/');
+}
+
+/**
+ * Transform the entire string to lowercase.
+ * 
+ * @param s Input string.
+ * @return Newly allocated copy of the input string with all uppercase
+ *     characters folded to their lowercase variants.
+ */
+static char *_casefold(const char *s)
+{
+	assert(s != NULL);
+	char *result = posix_strdup(s);
+	for (char *i = result; *i != '\0'; ++i) {
+		*i = tolower(*i);
+	}
+	return result;
+}
+
+/**
+ * Filename pattern matching.
+ *
+ * @param pattern Pattern to match the string against.
+ * @param string Matched string.
+ * @param flags Flags altering the matching of special characters
+ *     (mainly for dot and slash).
+ * @return Zero if the string matches the pattern, FNM_NOMATCH otherwise.
+ */
+int posix_fnmatch(const char *pattern, const char *string, int flags)
+{
+	assert(pattern != NULL);
+	assert(string != NULL);
+
+	// TODO: don't fold everything in advance, but only when needed
+
+	if ((flags & FNM_CASEFOLD) != 0) {
+		/* Just fold the entire pattern and string. */
+		pattern = _casefold(pattern);
+		string = _casefold(string);
+	}
+
+	bool result = _full_match(pattern, string, flags);
+
+	if ((flags & FNM_CASEFOLD) != 0) {
+		if (pattern) {
+			free((char *) pattern);
+		}
+		if (string) {
+			free((char *) string);
+		}
+	}
+
+	return result ? 0 : FNM_NOMATCH;
+}
+
+// FIXME: put the testcases to the app/tester after fnmatch is included into libc
+
+#if 0
+
+#include <stdio.h>
+
+void __posix_fnmatch_test()
+{
+	int fail = 0;
+
+	#undef assert
+	#define assert(x) { if (x) printf("SUCCESS: "#x"\n"); else { printf("FAILED: "#x"\n"); fail++; } }
+	#define match(s1, s2, flags) assert(posix_fnmatch(s1, s2, flags) == 0)
+	#define nomatch(s1, s2, flags) assert(posix_fnmatch(s1, s2, flags) == FNM_NOMATCH)
+
+	static_assert(FNM_PATHNAME == FNM_FILE_NAME);
+	match("", "", 0);
+	match("*", "hello", 0);
+	match("hello", "hello", 0);
+	match("hello*", "hello", 0);
+	nomatch("hello?", "hello", 0);
+	match("*hello", "prdel hello", 0);
+	match("he[sl]lo", "hello", 0);
+	match("he[sl]lo", "heslo", 0);
+	nomatch("he[sl]lo", "heblo", 0);
+	nomatch("he[^sl]lo", "hello", 0);
+	nomatch("he[^sl]lo", "heslo", 0);
+	match("he[^sl]lo", "heblo", 0);
+	nomatch("he[!sl]lo", "hello", 0);
+	nomatch("he[!sl]lo", "heslo", 0);
+	match("he[!sl]lo", "heblo", 0);
+	match("al*[c-t]a*vis*ta", "alheimer talir jehovista", 0);
+	match("al*[c-t]a*vis*ta", "alfons had jehovista", 0);
+	match("[a-ce-z]", "a", 0);
+	match("[a-ce-z]", "c", 0);
+	nomatch("[a-ce-z]", "d", 0);
+	match("[a-ce-z]", "e", 0);
+	match("[a-ce-z]", "z", 0);
+	nomatch("[^a-ce-z]", "a", 0);
+	nomatch("[^a-ce-z]", "c", 0);
+	match("[^a-ce-z]", "d", 0);
+	nomatch("[^a-ce-z]", "e", 0);
+	nomatch("[^a-ce-z]", "z", 0);
+	match("helen??", "helenos", 0);
+	match("****booo****", "booo", 0);
+	
+	match("hello[[:space:]]world", "hello world", 0);
+	nomatch("hello[[:alpha:]]world", "hello world", 0);
+	
+	match("/hoooo*", "/hooooooo/hooo", 0);
+	nomatch("/hoooo*", "/hooooooo/hooo", FNM_PATHNAME);
+	nomatch("/hoooo*/", "/hooooooo/hooo", FNM_PATHNAME);
+	match("/hoooo*/*", "/hooooooo/hooo", FNM_PATHNAME);
+	match("/hoooo*/hooo", "/hooooooo/hooo", FNM_PATHNAME);
+	match("/hoooo*", "/hooooooo/hooo", FNM_PATHNAME | FNM_LEADING_DIR);
+	nomatch("/hoooo*/", "/hooooooo/hooo", FNM_PATHNAME | FNM_LEADING_DIR);
+	nomatch("/hoooo", "/hooooooo/hooo", FNM_LEADING_DIR);
+	match("/hooooooo", "/hooooooo/hooo", FNM_LEADING_DIR);
+	
+	match("*", "hell", 0);
+	match("*?", "hell", 0);
+	match("?*?", "hell", 0);
+	match("?*??", "hell", 0);
+	match("??*??", "hell", 0);
+	nomatch("???*??", "hell", 0);
+	
+	nomatch("", "hell", 0);
+	nomatch("?", "hell", 0);
+	nomatch("??", "hell", 0);
+	nomatch("???", "hell", 0);
+	match("????", "hell", 0);
+	
+	match("*", "h.ello", FNM_PERIOD);
+	match("*", "h.ello", FNM_PATHNAME | FNM_PERIOD);
+	nomatch("*", ".hello", FNM_PERIOD);
+	match("h?ello", "h.ello", FNM_PERIOD);
+	nomatch("?hello", ".hello", FNM_PERIOD);
+	match("/home/user/.*", "/home/user/.hello", FNM_PATHNAME | FNM_PERIOD);
+	match("/home/user/*", "/home/user/.hello", FNM_PERIOD);
+	nomatch("/home/user/*", "/home/user/.hello", FNM_PATHNAME | FNM_PERIOD);
+
+	nomatch("HeLlO", "hello", 0);
+	match("HeLlO", "hello", FNM_CASEFOLD);
+
+	printf("Failed: %d\n", fail);
+}
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/posix/source/getopt.c
===================================================================
--- uspace/lib/posix/source/getopt.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/getopt.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Command line argument parsing.
+ */
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "internal/common.h"
+#include "libc/getopt.h"
+#include "posix/getopt.h"
+
+
+int posix_getopt_long(int argc, char * const argv[],
+    const char *opt_string, const struct option *long_opts, int *long_index)
+{
+	int rc = getopt_long(argc, argv, opt_string, long_opts, long_index);
+	posix_optarg = (char *) optarg;
+	return rc;
+}
+
+int posix_getopt(int argc, char * const argv[], const char *opt_string)
+{
+	int rc = getopt(argc, argv, opt_string);
+	posix_optarg = (char *) optarg;
+	return rc;
+}
Index: uspace/lib/posix/source/internal/common.h
===================================================================
--- uspace/lib/posix/source/internal/common.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/internal/common.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Helper definitions common for all libposix files.
+ */
+
+#ifndef LIBPOSIX_COMMON_H_
+#define LIBPOSIX_COMMON_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <offset.h>
+#include <vfs/vfs.h>
+
+#define not_implemented() do { \
+		static int __not_implemented_counter = 0; \
+		if (__not_implemented_counter == 0) { \
+			fprintf(stderr, "%s() not implemented in %s:%d, something will NOT work.\n", \
+				__func__, __FILE__, __LINE__); \
+		} \
+		__not_implemented_counter++; \
+	} while (0)
+
+/* Convert negative errno to positive errno */
+#define negerrno(func, ...) ({ \
+	int rc = func(__VA_ARGS__); \
+	if (rc < 0) { \
+		errno = -errno; \
+	} \
+	rc; \
+})
+
+/* Convert error code to positive errno and -1 return value */
+#define rcerrno(func, ...) ({ \
+	int rc = func(__VA_ARGS__); \
+	if (rc < 0) \
+		errno = -rc; \
+	rc; \
+})
+
+extern aoff64_t posix_pos[MAX_OPEN_FILES];
+
+#endif /* LIBPOSIX_COMMON_H_ */
+
+/** @}
+ */
Index: uspace/lib/posix/source/locale.c
===================================================================
--- uspace/lib/posix/source/locale.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/locale.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Locale-specific definitions.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "internal/common.h"
+#include "posix/locale.h"
+
+#include "posix/errno.h"
+#include "posix/limits.h"
+#include "posix/string.h"
+
+/* Just a very basic dummy implementation.
+ * This should allow code using locales to work properly, but doesn't provide
+ * any localization functionality.
+ * Should be extended/rewritten when or if HelenOS supports locales natively.
+ */
+
+struct __posix_locale {
+	int _dummy;
+};
+
+const struct posix_lconv C_LOCALE = {
+	.currency_symbol = (char *) "",
+	.decimal_point = (char *) ".",
+	.frac_digits = CHAR_MAX,
+	.grouping = (char *) "",
+	.int_curr_symbol = (char *) "",
+	.int_frac_digits = CHAR_MAX,
+	.int_n_cs_precedes = CHAR_MAX,
+	.int_n_sep_by_space = CHAR_MAX,
+	.int_n_sign_posn = CHAR_MAX,
+	.int_p_cs_precedes = CHAR_MAX,
+	.int_p_sep_by_space = CHAR_MAX,
+	.int_p_sign_posn = CHAR_MAX,
+	.mon_decimal_point = (char *) "",
+	.mon_grouping = (char *) "",
+	.mon_thousands_sep = (char *) "",
+	.negative_sign = (char *) "",
+	.n_cs_precedes = CHAR_MAX,
+	.n_sep_by_space = CHAR_MAX,
+	.n_sign_posn = CHAR_MAX,
+	.positive_sign = (char *) "",
+	.p_cs_precedes = CHAR_MAX,
+	.p_sep_by_space = CHAR_MAX,
+	.p_sign_posn = CHAR_MAX,
+	.thousands_sep = (char *) ""
+};
+
+/**
+ * Set program locale.
+ * 
+ * @param category What category to set.
+ * @param locale Locale name.
+ * @return Original locale name on success, NULL on failure.
+ */
+char *posix_setlocale(int category, const char *locale)
+{
+	// TODO
+	if (locale == NULL || *locale == '\0' ||
+	    posix_strcmp(locale, "C") == 0) {
+		return (char *) "C";
+	}
+	return NULL;
+}
+
+/**
+ * Return locale-specific information.
+ * 
+ * @return Information about the current locale.
+ */
+struct posix_lconv *posix_localeconv(void)
+{
+	// TODO
+	return (struct posix_lconv *) &C_LOCALE;
+}
+
+/**
+ * Duplicate locale object.
+ * 
+ * @param locobj Object to duplicate.
+ * @return Duplicated object.
+ */
+posix_locale_t posix_duplocale(posix_locale_t locobj)
+{
+	if (locobj == NULL) {
+		errno = EINVAL;
+		return NULL;
+	}
+	posix_locale_t copy = malloc(sizeof(struct __posix_locale));
+	if (copy == NULL) {
+		errno = ENOMEM;
+		return NULL;
+	}
+	memcpy(copy, locobj, sizeof(struct __posix_locale));
+	return copy;
+}
+
+/**
+ * Free locale object.
+ * 
+ * @param locobj Object to free.
+ */
+void posix_freelocale(posix_locale_t locobj)
+{
+	if (locobj) {
+		free(locobj);
+	}
+}
+
+/**
+ * Create or modify a locale object.
+ * 
+ * @param category_mask Mask of categories to be set or modified.
+ * @param locale Locale to be used.
+ * @param base Object to modify. 0 if new object is to be created.
+ * @return The new/modified locale object.
+ */
+posix_locale_t posix_newlocale(int category_mask, const char *locale,
+    posix_locale_t base)
+{
+	if (locale == NULL ||
+	    (category_mask & LC_ALL_MASK) != category_mask) {
+		errno = EINVAL;
+		return NULL;
+	}
+	// TODO
+	posix_locale_t new = malloc(sizeof(struct __posix_locale));
+	if (new == NULL) {
+		errno = ENOMEM;
+		return NULL;
+	}
+	if (base != NULL) {
+		posix_freelocale(base);
+	}
+	return new;
+}
+
+/**
+ * Set locale for the current thread.
+ * 
+ * @param newloc Locale to use.
+ * @return The previously set locale or LC_GLOBAL_LOCALE
+ */
+posix_locale_t posix_uselocale(posix_locale_t newloc)
+{
+	// TODO
+	return LC_GLOBAL_LOCALE;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/pthread/condvar.c
===================================================================
--- uspace/lib/posix/source/pthread/condvar.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/pthread/condvar.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2013 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Pthread: condition variables.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "posix/pthread.h"
+#include "errno.h"
+#include "../internal/common.h"
+
+int pthread_cond_init(pthread_cond_t *restrict condvar,
+    const pthread_condattr_t *restrict attr)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_cond_destroy(pthread_cond_t *condvar)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_cond_broadcast(pthread_cond_t *condvar)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_cond_signal(pthread_cond_t *condvar)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_cond_timedwait(pthread_cond_t *restrict condvar,
+    pthread_mutex_t *restrict mutex, const struct __POSIX_DEF__(timespec) *restrict timeout)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_cond_wait(pthread_cond_t *restrict condvar,
+    pthread_mutex_t *restrict mutex)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+
+int pthread_condattr_init(pthread_condattr_t *attr)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_condattr_destroy(pthread_condattr_t *attr)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+
+/** @}
+ */
Index: uspace/lib/posix/source/pthread/keys.c
===================================================================
--- uspace/lib/posix/source/pthread/keys.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/pthread/keys.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2013 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Pthread: keys and thread-specific storage.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "posix/stdlib.h"
+#include "posix/pthread.h"
+#include "errno.h"
+#include "../internal/common.h"
+
+
+void *pthread_getspecific(pthread_key_t key)
+{
+	not_implemented();
+	return NULL;
+}
+
+int pthread_setspecific(pthread_key_t key, const void *data)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_key_delete(pthread_key_t key)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_key_create(pthread_key_t *key, void (*destructor)(void*))
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/pthread/mutex.c
===================================================================
--- uspace/lib/posix/source/pthread/mutex.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/pthread/mutex.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2013 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Pthread: mutexes.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "posix/pthread.h"
+#include "errno.h"
+#include "../internal/common.h"
+
+
+int pthread_mutex_init(pthread_mutex_t *restrict mutex,
+    const pthread_mutexattr_t *restrict attr)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_mutex_destroy(pthread_mutex_t *mutex)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_mutex_lock(pthread_mutex_t *mutex)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_mutex_trylock(pthread_mutex_t *mutex)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_mutex_unlock(pthread_mutex_t *mutex)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_mutexattr_init(pthread_mutexattr_t *attr)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict attr,
+    int *restrict type)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+
+
+/** @}
+ */
Index: uspace/lib/posix/source/pthread/threads.c
===================================================================
--- uspace/lib/posix/source/pthread/threads.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/pthread/threads.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2013 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Pthread: thread management.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "posix/pthread.h"
+#include "errno.h"
+#include "posix/stdlib.h"
+#include "libc/thread.h"
+#include "../internal/common.h"
+
+pthread_t pthread_self(void)
+{
+	return thread_get_id();
+}
+
+int pthread_equal(pthread_t thread1, pthread_t thread2)
+{
+	return thread1 == thread2;
+}
+
+int pthread_create(pthread_t *thread_id, const pthread_attr_t *attributes,
+    void *(*start_routine)(void *), void *arg)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_join(pthread_t thread, void **ret_val)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_detach(pthread_t thread)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_attr_init(pthread_attr_t *attr)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+int pthread_attr_destroy(pthread_attr_t *attr)
+{
+	not_implemented();
+	return ENOTSUP;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/pwd.c
===================================================================
--- uspace/lib/posix/source/pwd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/pwd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Password handling.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "libc/stdbool.h"
+#include "posix/pwd.h"
+#include "posix/string.h"
+#include "posix/errno.h"
+#include "posix/assert.h"
+
+static bool entry_read = false;
+
+/* dummy user account */
+static const struct posix_passwd dummy_pwd = {
+	.pw_name = (char *) "user",
+	.pw_uid = 0,
+	.pw_gid = 0,
+	.pw_dir = (char *) "/",
+	.pw_shell = (char *) "/app/bdsh"
+};
+
+/**
+ * Retrieve next broken-down entry from the user database.
+ *
+ * Since HelenOS doesn't have user accounts, this always returns
+ * the same made-up entry.
+ *
+ * @return Next user database entry or NULL if not possible. Since HelenOS
+ *     doesn't have user accounts, this always returns the same made-up entry.
+ */
+struct posix_passwd *posix_getpwent(void)
+{
+	if (entry_read) {
+		return NULL;
+	}
+
+	entry_read = true;
+	return (struct posix_passwd *) &dummy_pwd;
+}
+
+/**
+ * Rewind the user list.
+ */
+void posix_setpwent(void)
+{
+	entry_read = false;
+}
+
+/**
+ * Ends enumerating and releases all resources. (Noop)
+ */
+void posix_endpwent(void)
+{
+	/* noop */
+}
+
+/**
+ * Find an entry by name.
+ *
+ * @param name Name of the entry.
+ * @return Either found entry or NULL if no such entry exists.
+ */
+struct posix_passwd *posix_getpwnam(const char *name)
+{
+	assert(name != NULL);
+
+	if (posix_strcmp(name, "user") != 0) {
+		return NULL;
+	}
+
+	return (struct posix_passwd *) &dummy_pwd;
+}
+
+/**
+ * Find an entry by name, thread safely.
+ *
+ * @param name Name of the entry.
+ * @param pwd Original structure.
+ * @param buffer Buffer for the strings referenced from the result structure.
+ * @param bufsize Length of the buffer.
+ * @param result Where to store updated structure.
+ * @return Zero on success (either found or not found, but without an error),
+ *     non-zero error number if error occured.
+ */
+int posix_getpwnam_r(const char *name, struct posix_passwd *pwd,
+    char *buffer, size_t bufsize, struct posix_passwd **result)
+{
+	assert(name != NULL);
+	assert(pwd != NULL);
+	assert(buffer != NULL);
+	assert(result != NULL);
+	
+	if (posix_strcmp(name, "user") != 0) {
+		*result = NULL;
+		return 0;
+	}
+	
+	return posix_getpwuid_r(0, pwd, buffer, bufsize, result);
+}
+
+/**
+ * Find an entry by UID.
+ *
+ * @param uid UID of the entry.
+ * @return Either found entry or NULL if no such entry exists.
+ */
+struct posix_passwd *posix_getpwuid(posix_uid_t uid)
+{
+	if (uid != 0) {
+		return NULL;
+	}
+
+	return (struct posix_passwd *) &dummy_pwd;
+}
+
+/**
+ * Find an entry by UID, thread safely.
+ *
+ * @param uid UID of the entry.
+ * @param pwd Original structure.
+ * @param buffer Buffer for the strings referenced from the result structure.
+ * @param bufsize Length of the buffer.
+ * @param result Where to store updated structure.
+ * @return Zero on success (either found or not found, but without an error),
+ *     non-zero error number if error occured.
+ */
+int posix_getpwuid_r(posix_uid_t uid, struct posix_passwd *pwd,
+    char *buffer, size_t bufsize, struct posix_passwd **result)
+{
+	assert(pwd != NULL);
+	assert(buffer != NULL);
+	assert(result != NULL);
+	
+	static const char bf[] = { 'u', 's', 'e', 'r', '\0',
+	    '/', '\0', 'b', 'd', 's', 'h', '\0' };
+	
+	if (uid != 0) {
+		*result = NULL;
+		return 0;
+	}
+	if (bufsize < sizeof(bf)) {
+		*result = NULL;
+		return ERANGE;
+	}
+
+	memcpy(buffer, bf, sizeof(bf));
+
+	pwd->pw_name = (char *) bf;
+	pwd->pw_uid = 0;
+	pwd->pw_gid = 0;
+	pwd->pw_dir = (char *) bf + 5;
+	pwd->pw_shell = (char *) bf + 7;
+	*result = (struct posix_passwd *) pwd;
+
+	return 0;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/signal.c
===================================================================
--- uspace/lib/posix/source/signal.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/signal.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,567 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Signal handling.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "posix/signal.h"
+#include "internal/common.h"
+#include "posix/limits.h"
+#include "posix/stdlib.h"
+#include "posix/string.h"
+#include "posix/errno.h"
+
+#include "libc/fibril_synch.h"
+#include "libc/task.h"
+
+/* This file implements a fairly dumb and incomplete "simulation" of
+ * POSIX signals. Since HelenOS doesn't support signals and mostly doesn't
+ * have any equivalent functionality, most of the signals are useless. The
+ * main purpose of this implementation is thus to help port applications using
+ * signals with minimal modification, but if the application uses signals for
+ * anything non-trivial, it's quite probable it won't work properly even if
+ * it builds without problems.
+ */
+
+/* Used to serialize signal handling. */
+static FIBRIL_MUTEX_INITIALIZE(_signal_mutex);
+
+static LIST_INITIALIZE(_signal_queue);
+
+static posix_sigset_t _signal_mask = 0;
+
+#define DEFAULT_HANDLER { .sa_handler = SIG_DFL, \
+    .sa_mask = 0, .sa_flags = 0, .sa_sigaction = NULL }
+
+/* Actions associated with each signal number. */
+static struct posix_sigaction _signal_actions[_TOP_SIGNAL + 1] = {
+	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
+	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
+	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
+	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
+	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
+	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
+	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER
+};
+
+/**
+ * Default signal handler. Executes the default action for each signal,
+ * as reasonable within HelenOS.
+ *
+ * @param signo Signal number.
+ */
+void __posix_default_signal_handler(int signo)
+{
+	switch (signo) {
+	case SIGABRT:
+		abort();
+	case SIGQUIT:
+		fprintf(stderr, "Quit signal raised. Exiting.\n");
+		exit(EXIT_FAILURE);
+	case SIGINT:
+		fprintf(stderr, "Interrupt signal caught. Exiting.\n");
+		exit(EXIT_FAILURE);
+	case SIGTERM:
+		fprintf(stderr, "Termination signal caught. Exiting.\n");
+		exit(EXIT_FAILURE);
+	case SIGSTOP:
+		fprintf(stderr, "Stop signal caught, but unsupported. Ignoring.\n");
+		break;
+	case SIGKILL:
+		/* This will only occur when raise or similar is called. */
+		/* Commit suicide. */
+		task_kill(task_get_id());
+		
+		/* Should not be reached. */
+		abort();
+	case SIGFPE:
+	case SIGBUS:
+	case SIGILL:
+	case SIGSEGV:
+		posix_psignal(signo, "Hardware exception raised by user code");
+		abort();
+	case SIGSYS:
+	case SIGXCPU:
+	case SIGXFSZ:
+	case SIGTRAP:
+	case SIGHUP:
+	case SIGPIPE:
+	case SIGPOLL:
+	case SIGURG:
+	case SIGTSTP:
+	case SIGTTIN:
+	case SIGTTOU:
+		posix_psignal(signo, "Unsupported signal caught");
+		abort();
+	case SIGCHLD:
+	case SIGUSR1:
+	case SIGUSR2:
+	case SIGALRM:
+	case SIGVTALRM:
+	case SIGPROF:
+	case SIGCONT:
+		/* ignored */
+		break;
+	}
+}
+
+/**
+ * Just an empty function to get an unique pointer value for comparison.
+ *
+ * @param signo Signal number.
+ */
+void __posix_hold_signal_handler(int signo)
+{
+	/* Nothing */
+}
+
+/**
+ * Empty function to be used as ignoring handler.
+ * 
+ * @param signo Signal number.
+ */
+void __posix_ignore_signal_handler(int signo)
+{
+	/* Nothing */
+}
+
+/**
+ * Clear the signal set.
+ * 
+ * @param set Pointer to the signal set.
+ * @return Always returns zero.
+ */
+int posix_sigemptyset(posix_sigset_t *set)
+{
+	assert(set != NULL);
+
+	*set = 0;
+	return 0;
+}
+
+/**
+ * Fill the signal set (i.e. add all signals).
+ * 
+ * @param set Pointer to the signal set.
+ * @return Always returns zero.
+ */
+int posix_sigfillset(posix_sigset_t *set)
+{
+	assert(set != NULL);
+
+	*set = UINT32_MAX;
+	return 0;
+}
+
+/**
+ * Add a signal to the set.
+ * 
+ * @param set Pointer to the signal set.
+ * @param signo Signal number to add.
+ * @return Always returns zero.
+ */
+int posix_sigaddset(posix_sigset_t *set, int signo)
+{
+	assert(set != NULL);
+
+	*set |= (1 << signo);
+	return 0;
+}
+
+/**
+ * Delete a signal from the set.
+ * 
+ * @param set Pointer to the signal set.
+ * @param signo Signal number to remove.
+ * @return Always returns zero.
+ */
+int posix_sigdelset(posix_sigset_t *set, int signo)
+{
+	assert(set != NULL);
+
+	*set &= ~(1 << signo);
+	return 0;
+}
+
+/**
+ * Inclusion test for a signal set.
+ * 
+ * @param set Pointer to the signal set.
+ * @param signo Signal number to query.
+ * @return 1 if the signal is in the set, 0 otherwise.
+ */
+int posix_sigismember(const posix_sigset_t *set, int signo)
+{
+	assert(set != NULL);
+	
+	return (*set & (1 << signo)) != 0;
+}
+
+/**
+ * Unsafe variant of the sigaction() function.
+ * Doesn't do any checking of its arguments and
+ * does not deal with thread-safety.
+ * 
+ * @param sig
+ * @param act
+ * @param oact
+ */
+static void _sigaction_unsafe(int sig, const struct posix_sigaction *restrict act,
+    struct posix_sigaction *restrict oact)
+{
+	if (oact != NULL) {
+		memcpy(oact, &_signal_actions[sig],
+		    sizeof(struct posix_sigaction));
+	}
+
+	if (act != NULL) {
+		memcpy(&_signal_actions[sig], act,
+		    sizeof(struct posix_sigaction));
+	}
+}
+
+/**
+ * Sets a new action for the given signal number.
+ * 
+ * @param sig Signal number to set action for.
+ * @param act If not NULL, contents of this structure are
+ *     used as the new action for the signal.
+ * @param oact If not NULL, the original action associated with the signal
+ *     is stored in the structure pointer to. 
+ * @return -1 with errno set on failure, 0 on success.
+ */
+int posix_sigaction(int sig, const struct posix_sigaction *restrict act,
+    struct posix_sigaction *restrict oact)
+{
+	if (sig > _TOP_SIGNAL || (act != NULL &&
+	    (sig == SIGKILL || sig == SIGSTOP))) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	if (sig > _TOP_CATCHABLE_SIGNAL) {
+		posix_psignal(sig,
+		    "WARNING: registering handler for a partially"
+		    " or fully unsupported signal. This handler may only be"
+		    " invoked by the raise() function, which may not be what"
+		    " the application developer intended");
+	}
+
+	fibril_mutex_lock(&_signal_mutex);
+	_sigaction_unsafe(sig, act, oact);
+	fibril_mutex_unlock(&_signal_mutex);
+
+	return 0;
+}
+
+/**
+ * Sets a new handler for the given signal number.
+ * 
+ * @param sig Signal number to set handler for.
+ * @param func Handler function.
+ * @return SIG_ERR on failure, original handler on success.
+ */
+void (*posix_signal(int sig, void (*func)(int)))(int)
+{
+	struct posix_sigaction new = {
+		.sa_handler = func,
+		.sa_mask = 0,
+		.sa_flags = 0,
+		.sa_sigaction = NULL
+	};
+	struct posix_sigaction old;
+	if (posix_sigaction(sig, func == NULL ? NULL : &new, &old) == 0) {
+		return old.sa_handler;
+	} else {
+		return SIG_ERR;
+	}
+}
+
+typedef struct {
+	link_t link;
+	int signo;
+	posix_siginfo_t siginfo;
+} signal_queue_item;
+
+/**
+ * Queue blocked signal.
+ *
+ * @param signo Signal number.
+ * @param siginfo Additional information about the signal.
+ */
+static void _queue_signal(int signo, posix_siginfo_t *siginfo)
+{
+	assert(signo >= 0 && signo <= _TOP_SIGNAL);
+	assert(siginfo != NULL);
+	
+	signal_queue_item *item = malloc(sizeof(signal_queue_item));
+	link_initialize(&(item->link));
+	item->signo = signo;
+	memcpy(&item->siginfo, siginfo, sizeof(posix_siginfo_t));
+	list_append(&(item->link), &_signal_queue);
+}
+
+
+/**
+ * Executes an action associated with the given signal.
+ *
+ * @param signo Signal number.
+ * @param siginfo Additional information about the circumstances of this raise.
+ * @return 0 if the action has been successfully executed. -1 if the signal is
+ *     blocked.
+ */
+static int _raise_sigaction(int signo, posix_siginfo_t *siginfo)
+{
+	assert(signo >= 0 && signo <= _TOP_SIGNAL);
+	assert(siginfo != NULL);
+
+	fibril_mutex_lock(&_signal_mutex);
+
+	struct posix_sigaction action = _signal_actions[signo];
+
+	if (posix_sigismember(&_signal_mask, signo) ||
+	    action.sa_handler == SIG_HOLD) {
+		_queue_signal(signo, siginfo);
+		fibril_mutex_unlock(&_signal_mutex);
+		return -1;
+	}
+
+	/* Modifying signal mask is unnecessary,
+	 * signal handling is serialized.
+	 */
+
+	if ((action.sa_flags & SA_RESETHAND) && signo != SIGILL && signo != SIGTRAP) {
+		_signal_actions[signo] = (struct posix_sigaction) DEFAULT_HANDLER;
+	}
+
+	if (action.sa_flags & SA_SIGINFO) {
+		assert(action.sa_sigaction != NULL);
+		action.sa_sigaction(signo, siginfo, NULL);
+	} else {
+		assert(action.sa_handler != NULL);
+		action.sa_handler(signo);
+	}
+
+	fibril_mutex_unlock(&_signal_mutex);
+
+	return 0;
+}
+
+/**
+ * Raise all unblocked previously queued signals.
+ */
+static void _dequeue_unblocked_signals(void)
+{
+	link_t *iterator = _signal_queue.head.next;
+	link_t *next;
+	
+	while (iterator != &(_signal_queue).head) {
+		next = iterator->next;
+		
+		signal_queue_item *item =
+		    list_get_instance(iterator, signal_queue_item, link);
+		
+		if (!posix_sigismember(&_signal_mask, item->signo) &&
+		    _signal_actions[item->signo].sa_handler != SIG_HOLD) {
+			list_remove(&(item->link));
+			_raise_sigaction(item->signo, &(item->siginfo));
+			free(item);
+		}
+		
+		iterator = next;
+	}
+}
+
+/**
+ * Raise a signal for the calling process.
+ * 
+ * @param sig Signal number.
+ * @return -1 with errno set on failure, 0 on success.
+ */
+int posix_raise(int sig)
+{
+	if (sig >= 0 && sig <= _TOP_SIGNAL) {
+		posix_siginfo_t siginfo = {
+			.si_signo = sig,
+			.si_code = SI_USER
+		};
+		return _raise_sigaction(sig, &siginfo);
+	} else {
+		errno = EINVAL;
+		return -1;
+	}
+}
+
+/**
+ * Raises a signal for a selected process.
+ * 
+ * @param pid PID of the process for which the signal shall be raised.
+ * @param signo Signal to raise.
+ * @return -1 with errno set on failure (possible errors include unsupported
+ *     action, invalid signal number, lack of permissions, etc.), 0 on success.
+ */
+int posix_kill(posix_pid_t pid, int signo)
+{
+	if (pid < 1) {
+		// TODO
+		errno = ENOTSUP;
+		return -1;
+	}
+
+	if (signo > _TOP_SIGNAL) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	if (pid == (posix_pid_t) task_get_id()) {
+		return posix_raise(signo);
+	}
+
+	switch (signo) {
+	case SIGKILL:
+		task_kill(pid);
+		break;
+	default:
+		/* Nothing else supported yet. */
+		errno = ENOTSUP;
+		return -1;
+	}
+
+	return 0;
+}
+
+/**
+ * Send a signal to a process group. Always fails at the moment because of
+ * lack of this functionality in HelenOS.
+ * 
+ * @param pid PID of the process group.
+ * @param sig Signal number.
+ * @return -1 on failure, 0 on success (see kill()).
+ */
+int posix_killpg(posix_pid_t pid, int sig)
+{
+	assert(pid > 1);
+	return posix_kill(-pid, sig);
+}
+
+/**
+ * Outputs information about the signal to the standard error stream.
+ * 
+ * @param pinfo SigInfo struct to write.
+ * @param message String to output alongside human-readable signal description.
+ */
+void posix_psiginfo(const posix_siginfo_t *pinfo, const char *message)
+{
+	assert(pinfo != NULL);
+	posix_psignal(pinfo->si_signo, message);
+	// TODO: print si_code
+}
+
+/**
+ * Outputs information about the signal to the standard error stream.
+ * 
+ * @param signum Signal number.
+ * @param message String to output alongside human-readable signal description.
+ */
+void posix_psignal(int signum, const char *message)
+{
+	char *sigmsg = posix_strsignal(signum);
+	if (message == NULL || *message == '\0') {
+		fprintf(stderr, "%s\n", sigmsg);
+	} else {
+		fprintf(stderr, "%s: %s\n", message, sigmsg);
+	}
+}
+
+/**
+ * Manipulate the signal mask of the calling thread.
+ * 
+ * @param how What to do with the mask.
+ * @param set Signal set to work with.
+ * @param oset If not NULL, the original signal mask is coppied here.
+ * @return 0 success, errorcode on failure.
+ */
+int posix_thread_sigmask(int how, const posix_sigset_t *restrict set,
+    posix_sigset_t *restrict oset)
+{
+	fibril_mutex_lock(&_signal_mutex);
+
+	if (oset != NULL) {
+		*oset = _signal_mask;
+	}
+	if (set != NULL) {
+		switch (how) {
+		case SIG_BLOCK:
+			_signal_mask |= *set;
+			break;
+		case SIG_UNBLOCK:
+			_signal_mask &= ~*set;
+			break;
+		case SIG_SETMASK:
+			_signal_mask = *set;
+			break;
+		default:
+			fibril_mutex_unlock(&_signal_mutex);
+			return EINVAL;
+		}
+	}
+	
+	_dequeue_unblocked_signals();
+
+	fibril_mutex_unlock(&_signal_mutex);
+
+	return 0;
+}
+
+/**
+ * Manipulate the signal mask of the process.
+ * 
+ * @param how What to do with the mask.
+ * @param set Signal set to work with.
+ * @param oset If not NULL, the original signal mask is coppied here.
+ * @return 0 on success, -1 with errno set on failure.
+ */
+int posix_sigprocmask(int how, const posix_sigset_t *restrict set,
+    posix_sigset_t *restrict oset)
+{
+	int result = posix_thread_sigmask(how, set, oset);
+	if (result != 0) {
+		errno = result;
+		return -1;
+	}
+	return 0;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/stdio.c
===================================================================
--- uspace/lib/posix/source/stdio.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/stdio.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,711 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Standard buffered input/output.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "internal/common.h"
+#include "posix/stdio.h"
+
+#include "posix/assert.h"
+#include "posix/errno.h"
+#include "posix/stdlib.h"
+#include "posix/string.h"
+#include "posix/sys/types.h"
+#include "posix/unistd.h"
+
+#include "libc/stdio.h"
+#include "libc/io/printf_core.h"
+#include "libc/str.h"
+#include "libc/malloc.h"
+#include "libc/adt/list.h"
+
+/** Clears the stream's error and end-of-file indicators.
+ *
+ * @param stream Stream whose indicators shall be cleared.
+ */
+void posix_clearerr(FILE *stream)
+{
+	clearerr(stream);
+}
+
+/**
+ * Generate a pathname for the controlling terminal.
+ *
+ * @param s Allocated buffer to which the pathname shall be put.
+ * @return Either s or static location filled with the requested pathname.
+ */
+char *posix_ctermid(char *s)
+{
+	/* Currently always returns an error value (empty string). */
+	// TODO: return a real terminal path
+
+	static char dummy_path[L_ctermid] = {'\0'};
+
+	if (s == NULL) {
+		return dummy_path;
+	}
+
+	s[0] = '\0';
+	return s;
+}
+
+/**
+ * Put a string on the stream.
+ * 
+ * @param s String to be written.
+ * @param stream Output stream.
+ * @return Non-negative on success, EOF on failure.
+ */
+int posix_fputs(const char *restrict s, FILE *restrict stream)
+{
+	return fputs(s, stream);
+}
+
+/**
+ * Push byte back into input stream.
+ * 
+ * @param c Byte to be pushed back.
+ * @param stream Stream to where the byte shall be pushed.
+ * @return Provided byte on success or EOF if not possible.
+ */
+int posix_ungetc(int c, FILE *stream)
+{
+	return ungetc(c, stream);
+}
+
+/**
+ * Read a stream until the delimiter (or EOF) is encountered.
+ *
+ * @param lineptr Pointer to the output buffer in which there will be stored
+ *     nul-terminated string together with the delimiter (if encountered).
+ *     Will be resized if necessary.
+ * @param n Pointer to the size of the output buffer. Will be increased if
+ *     necessary.
+ * @param delimiter Delimiter on which to finish reading the stream.
+ * @param stream Input stream.
+ * @return Number of fetched characters (including delimiter if encountered)
+ *     or -1 on error (set in errno).
+ */
+ssize_t posix_getdelim(char **restrict lineptr, size_t *restrict n,
+    int delimiter, FILE *restrict stream)
+{
+	/* Check arguments for sanity. */
+	if (!lineptr || !n) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	size_t alloc_step = 80; /* Buffer size gain during reallocation. */
+	char *pos = *lineptr; /* Next free byte of the output buffer. */
+	size_t cnt = 0; /* Number of fetched characters. */
+	int c = fgetc(stream); /* Current input character. Might be EOF. */
+
+	do {
+		/* Mask EOF as NUL to terminate string. */
+		if (c == EOF) {
+			c = '\0';
+		}
+
+		/* Ensure there is still space left in the buffer. */
+		if (pos == *lineptr + *n) {
+			*lineptr = realloc(*lineptr, *n + alloc_step);
+			if (*lineptr) {
+				pos = *lineptr + *n;
+				*n += alloc_step;
+			} else {
+				errno = ENOMEM;
+				return -1;
+			}
+		}
+
+		/* Store the fetched character. */
+		*pos = c;
+
+		/* Fetch the next character according to the current character. */
+		if (c != '\0') {
+			++pos;
+			++cnt;
+			if (c == delimiter) {
+				/* Delimiter was just stored. Provide EOF as the next
+				 * character - it will be masked as NUL and output string
+				 * will be properly terminated. */
+				c = EOF;
+			} else {
+				/* Neither delimiter nor EOF were encountered. Just fetch
+				 * the next character from the stream. */
+				c = fgetc(stream);
+			}
+		}
+	} while (c != '\0');
+
+	if (errno == EOK && cnt > 0) {
+		return cnt;
+	} else {
+		/* Either some error occured or the stream was already at EOF. */
+		return -1;
+	}
+}
+
+/**
+ * Read a stream until the newline (or EOF) is encountered.
+ * 
+ * @param lineptr Pointer to the output buffer in which there will be stored
+ *     nul-terminated string together with the delimiter (if encountered).
+ *     Will be resized if necessary.
+ * @param n Pointer to the size of the output buffer. Will be increased if
+ *     necessary.
+ * @param stream Input stream.
+ * @return Number of fetched characters (including newline if encountered)
+ *     or -1 on error (set in errno).
+ */
+ssize_t posix_getline(char **restrict lineptr, size_t *restrict n,
+    FILE *restrict stream)
+{
+	return posix_getdelim(lineptr, n, '\n', stream);
+}
+
+/**
+ * Reopen a file stream.
+ * 
+ * @param filename Pathname of a file to be reopened or NULL for changing
+ *     the mode of the stream.
+ * @param mode Mode to be used for reopening the file or changing current
+ *     mode of the stream.
+ * @param stream Current stream associated with the opened file.
+ * @return On success, either a stream of the reopened file or the provided
+ *     stream with a changed mode. NULL otherwise.
+ */
+FILE *posix_freopen(const char *restrict filename, 
+    const char *restrict mode, FILE *restrict stream)
+{
+	return freopen(filename, mode, stream);
+}
+
+/**
+ * Write error messages to standard error.
+ *
+ * @param s Error message.
+ */
+void posix_perror(const char *s)
+{
+	if (s == NULL || s[0] == '\0') {
+		fprintf(stderr, "%s\n", posix_strerror(errno));
+	} else {
+		fprintf(stderr, "%s: %s\n", s, posix_strerror(errno));
+	}
+}
+
+/** Restores stream a to position previously saved with fgetpos().
+ *
+ * @param stream Stream to restore
+ * @param pos Position to restore
+ * @return Zero on success, non-zero (with errno set) on failure
+ */
+int posix_fsetpos(FILE *stream, const posix_fpos_t *pos)
+{
+	return fseek(stream, pos->offset, SEEK_SET);
+}
+
+/** Saves the stream's position for later use by fsetpos().
+ *
+ * @param stream Stream to save
+ * @param pos Place to store the position
+ * @return Zero on success, non-zero (with errno set) on failure
+ */
+int posix_fgetpos(FILE *restrict stream, posix_fpos_t *restrict pos)
+{
+	off64_t ret = ftell(stream);
+	if (ret != -1) {
+		pos->offset = ret;
+		return 0;
+	} else {
+		return -1;
+	}
+}
+
+/**
+ * Reposition a file-position indicator in a stream.
+ * 
+ * @param stream Stream to seek in.
+ * @param offset Direction and amount of bytes to seek.
+ * @param whence From where to seek.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_fseek(FILE *stream, long offset, int whence)
+{
+	return fseek(stream, (off64_t) offset, whence);
+}
+
+/**
+ * Reposition a file-position indicator in a stream.
+ * 
+ * @param stream Stream to seek in.
+ * @param offset Direction and amount of bytes to seek.
+ * @param whence From where to seek.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_fseeko(FILE *stream, posix_off_t offset, int whence)
+{
+	return fseek(stream, (off64_t) offset, whence);
+}
+
+/**
+ * Discover current file offset in a stream.
+ * 
+ * @param stream Stream for which the offset shall be retrieved.
+ * @return Current offset or -1 if not possible.
+ */
+long posix_ftell(FILE *stream)
+{
+	return (long) ftell(stream);
+}
+
+/**
+ * Discover current file offset in a stream.
+ * 
+ * @param stream Stream for which the offset shall be retrieved.
+ * @return Current offset or -1 if not possible.
+ */
+posix_off_t posix_ftello(FILE *stream)
+{
+	return (posix_off_t) ftell(stream);
+}
+
+/**
+ * Discard prefetched data or write unwritten data.
+ * 
+ * @param stream Stream that shall be flushed.
+ * @return Zero on success, EOF on failure.
+ */
+int posix_fflush(FILE *stream)
+{
+	return negerrno(fflush, stream);
+}
+
+/**
+ * Print formatted output to the opened file.
+ *
+ * @param fildes File descriptor of the opened file.
+ * @param format Format description.
+ * @return Either the number of printed characters or negative value on error.
+ */
+int posix_dprintf(int fildes, const char *restrict format, ...)
+{
+	va_list list;
+	va_start(list, format);
+	int result = posix_vdprintf(fildes, format, list);
+	va_end(list);
+	return result;
+}
+
+/**
+ * Write ordinary string to the opened file.
+ *
+ * @param str String to be written.
+ * @param size Size of the string (in bytes)..
+ * @param fd File descriptor of the opened file.
+ * @return The number of written characters.
+ */
+static int _dprintf_str_write(const char *str, size_t size, void *fd)
+{
+	const int fildes = *(int *) fd;
+	size_t wr;
+	int rc = vfs_write(fildes, &posix_pos[fildes], str, size, &wr);
+	if (rc != EOK)
+		return rc;
+	return str_nlength(str, wr);
+}
+
+/**
+ * Write wide string to the opened file.
+ * 
+ * @param str String to be written.
+ * @param size Size of the string (in bytes).
+ * @param fd File descriptor of the opened file.
+ * @return The number of written characters.
+ */
+static int _dprintf_wstr_write(const wchar_t *str, size_t size, void *fd)
+{
+	size_t offset = 0;
+	size_t chars = 0;
+	size_t sz;
+	char buf[4];
+	
+	while (offset < size) {
+		sz = 0;
+		if (chr_encode(str[chars], buf, &sz, sizeof(buf)) != EOK) {
+			break;
+		}
+		
+		const int fildes = *(int *) fd;
+		size_t nwr;
+		if (vfs_write(fildes, &posix_pos[fildes], buf, sz, &nwr) != EOK)
+			break;
+		
+		chars++;
+		offset += sizeof(wchar_t);
+	}
+	
+	return chars;
+}
+
+/**
+ * Print formatted output to the opened file.
+ * 
+ * @param fildes File descriptor of the opened file.
+ * @param format Format description.
+ * @param ap Print arguments.
+ * @return Either the number of printed characters or negative value on error.
+ */
+int posix_vdprintf(int fildes, const char *restrict format, va_list ap)
+{
+	printf_spec_t spec = {
+		.str_write = _dprintf_str_write,
+		.wstr_write = _dprintf_wstr_write,
+		.data = &fildes
+	};
+	
+	return printf_core(format, &spec, ap);
+}
+
+/**
+ * Print formatted output to the string.
+ * 
+ * @param s Output string.
+ * @param format Format description.
+ * @return Either the number of printed characters (excluding null byte) or
+ *     negative value on error.
+ */
+int posix_sprintf(char *s, const char *restrict format, ...)
+{
+	va_list list;
+	va_start(list, format);
+	int result = posix_vsprintf(s, format, list);
+	va_end(list);
+	return result;
+}
+
+/**
+ * Print formatted output to the string.
+ * 
+ * @param s Output string.
+ * @param format Format description.
+ * @param ap Print arguments.
+ * @return Either the number of printed characters (excluding null byte) or
+ *     negative value on error.
+ */
+int posix_vsprintf(char *s, const char *restrict format, va_list ap)
+{
+	return vsnprintf(s, STR_NO_LIMIT, format, ap);
+}
+
+/**
+ * Convert formatted input from the stream.
+ * 
+ * @param stream Input stream.
+ * @param format Format description.
+ * @return The number of converted output items or EOF on failure.
+ */
+int posix_fscanf(FILE *restrict stream, const char *restrict format, ...)
+{
+	va_list list;
+	va_start(list, format);
+	int result = posix_vfscanf(stream, format, list);
+	va_end(list);
+	return result;
+}
+
+/**
+ * Convert formatted input from the standard input.
+ * 
+ * @param format Format description.
+ * @return The number of converted output items or EOF on failure.
+ */
+int posix_scanf(const char *restrict format, ...)
+{
+	va_list list;
+	va_start(list, format);
+	int result = posix_vscanf(format, list);
+	va_end(list);
+	return result;
+}
+
+/**
+ * Convert formatted input from the standard input.
+ * 
+ * @param format Format description.
+ * @param arg Output items.
+ * @return The number of converted output items or EOF on failure.
+ */
+int posix_vscanf(const char *restrict format, va_list arg)
+{
+	return posix_vfscanf(stdin, format, arg);
+}
+
+/**
+ * Convert formatted input from the string.
+ * 
+ * @param s Input string.
+ * @param format Format description.
+ * @return The number of converted output items or EOF on failure.
+ */
+int posix_sscanf(const char *restrict s, const char *restrict format, ...)
+{
+	va_list list;
+	va_start(list, format);
+	int result = posix_vsscanf(s, format, list);
+	va_end(list);
+	return result;
+}
+
+/**
+ * Acquire file stream for the thread.
+ *
+ * @param file File stream to lock.
+ */
+void posix_flockfile(FILE *file)
+{
+	/* dummy */
+}
+
+/**
+ * Acquire file stream for the thread (non-blocking).
+ *
+ * @param file File stream to lock.
+ * @return Zero for success and non-zero if the lock cannot be acquired.
+ */
+int posix_ftrylockfile(FILE *file)
+{
+	/* dummy */
+	return 0;
+}
+
+/**
+ * Relinquish the ownership of the locked file stream.
+ *
+ * @param file File stream to unlock.
+ */
+void posix_funlockfile(FILE *file)
+{
+	/* dummy */
+}
+
+/**
+ * Get a byte from a stream (thread-unsafe).
+ *
+ * @param stream Input file stream.
+ * @return Either read byte or EOF.
+ */
+int posix_getc_unlocked(FILE *stream)
+{
+	return getc(stream);
+}
+
+/**
+ * Get a byte from the standard input stream (thread-unsafe).
+ *
+ * @return Either read byte or EOF.
+ */
+int posix_getchar_unlocked(void)
+{
+	return getchar();
+}
+
+/**
+ * Put a byte on a stream (thread-unsafe).
+ *
+ * @param c Byte to output.
+ * @param stream Output file stream.
+ * @return Either written byte or EOF.
+ */
+int posix_putc_unlocked(int c, FILE *stream)
+{
+	return putc(c, stream);
+}
+
+/**
+ * Put a byte on the standard output stream (thread-unsafe).
+ * 
+ * @param c Byte to output.
+ * @return Either written byte or EOF.
+ */
+int posix_putchar_unlocked(int c)
+{
+	return putchar(c);
+}
+
+/**
+ * Remove a file or directory.
+ *
+ * @param path Pathname of the file that shall be removed.
+ * @return Zero on success, -1 (with errno set) otherwise.
+ */
+int posix_remove(const char *path)
+{
+	if (rcerrno(vfs_unlink_path, path) != EOK)
+		return -1;
+	else
+		return 0;
+}
+
+/**
+ * Rename a file or directory.
+ *
+ * @param old Old pathname.
+ * @param new New pathname.
+ * @return Zero on success, -1 (with errno set) otherwise.
+ */
+int posix_rename(const char *old, const char *new)
+{
+	int rc = rcerrno(vfs_rename_path, old, new);
+	if (rc != EOK)
+		return -1;
+	else
+		return 0;
+}
+
+/**
+ * Get a unique temporary file name (obsolete).
+ *
+ * @param s Buffer for the file name. Must be at least L_tmpnam bytes long.
+ * @return The value of s on success, NULL on failure.
+ */
+char *posix_tmpnam(char *s)
+{
+	assert(L_tmpnam >= posix_strlen("/tmp/tnXXXXXX"));
+	
+	static char buffer[L_tmpnam + 1];
+	if (s == NULL) {
+		s = buffer;
+	}
+	
+	posix_strcpy(s, "/tmp/tnXXXXXX");
+	posix_mktemp(s);
+	
+	if (*s == '\0') {
+		/* Errno set by mktemp(). */
+		return NULL;
+	}
+	
+	return s;
+}
+
+/**
+ * Get an unique temporary file name with additional constraints (obsolete).
+ *
+ * @param dir Path to directory, where the file should be created.
+ * @param pfx Optional prefix up to 5 characters long.
+ * @return Newly allocated unique path for temporary file. NULL on failure.
+ */
+char *posix_tempnam(const char *dir, const char *pfx)
+{
+	/* Sequence number of the filename. */
+	static int seq = 0;
+	
+	size_t dir_len = posix_strlen(dir);
+	if (dir[dir_len - 1] == '/') {
+		dir_len--;
+	}
+	
+	size_t pfx_len = posix_strlen(pfx);
+	if (pfx_len > 5) {
+		pfx_len = 5;
+	}
+	
+	char *result = malloc(dir_len + /* slash*/ 1 +
+	    pfx_len + /* three-digit seq */ 3 + /* .tmp */ 4 + /* nul */ 1);
+	
+	if (result == NULL) {
+		errno = ENOMEM;
+		return NULL;
+	}
+	
+	char *res_ptr = result;
+	posix_strncpy(res_ptr, dir, dir_len);
+	res_ptr += dir_len;
+	posix_strncpy(res_ptr, pfx, pfx_len);
+	res_ptr += pfx_len;
+	
+	for (; seq < 1000; ++seq) {
+		snprintf(res_ptr, 8, "%03d.tmp", seq);
+		
+		int orig_errno = errno;
+		errno = 0;
+		/* Check if the file exists. */
+		if (posix_access(result, F_OK) == -1) {
+			if (errno == ENOENT) {
+				errno = orig_errno;
+				break;
+			} else {
+				/* errno set by access() */
+				return NULL;
+			}
+		}
+	}
+	
+	if (seq == 1000) {
+		free(result);
+		errno = EINVAL;
+		return NULL;
+	}
+	
+	return result;
+}
+
+/**
+ * Create and open an unique temporary file.
+ * The file is automatically removed when the stream is closed.
+ *
+ * @param dir Path to directory, where the file should be created.
+ * @param pfx Optional prefix up to 5 characters long.
+ * @return Newly allocated unique path for temporary file. NULL on failure.
+ */
+FILE *posix_tmpfile(void)
+{
+	char filename[] = "/tmp/tfXXXXXX";
+	int fd = posix_mkstemp(filename);
+	if (fd == -1) {
+		/* errno set by mkstemp(). */
+		return NULL;
+	}
+	
+	/* Unlink the created file, so that it's removed on close(). */
+	posix_unlink(filename);
+	return fdopen(fd, "w+");
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/stdio/scanf.c
===================================================================
--- uspace/lib/posix/source/stdio/scanf.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/stdio/scanf.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,1223 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Implementation of the scanf backend.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "posix/assert.h"
+#include "posix/errno.h"
+
+#include "posix/stdio.h"
+#include "posix/stdlib.h"
+#include "posix/stddef.h"
+#include "posix/string.h"
+#include "posix/ctype.h"
+#include "posix/sys/types.h"
+
+#include "../internal/common.h"
+#include "libc/malloc.h"
+#include "libc/stdbool.h"
+
+/** Unified data type for possible data sources for scanf. */
+typedef union __data_source {
+	FILE *stream; /**< Input file stream. */
+	const char *string; /**< Input string. */
+} _data_source;
+
+/** Internal state of the input provider. */
+enum {
+	/** Partly constructed but not yet functional. */
+	_PROV_CONSTRUCTED,
+	/** Ready to serve any request. */
+	_PROV_READY,
+	/** Cursor is temporarily lent to the external entity. No action is
+	  * possible until the cursor is returned.  */
+	_PROV_CURSOR_LENT,
+};
+
+/** Universal abstraction over data input for scanf. */
+typedef struct __input_provider {
+	/** Source of data elements. */
+	_data_source source;
+	/** How many elements was already processed. */
+	int consumed;
+	/** How many elements was already fetched from the source. */
+	int fetched;
+	/** Elements are fetched from the source in batches (e.g. by getline())
+	  * to allow using strtol/strtod family even on streams. */
+	char *window;
+	/** Size of the current window. */
+	size_t window_size;
+	/** Points to the next element to be processed inside the current window. */
+	const char *cursor;
+	/** Internal state of the provider. */
+	int state;
+
+	/** Take control over data source. Finish initialization of the internal
+	  * structures (e.g. allocation of window). */
+	void (*capture)(struct __input_provider *);
+	/** Get a single element from the source and update the internal structures
+	  * accordingly (e.g. greedy update of the window). Return -1 if the
+	  * element cannot be obtained. */
+	int (*pop)(struct __input_provider *);
+	/** Undo the most recent not-undone pop operation. Might be necesarry to
+	  * flush current window and seek data source backwards. Return 0 if the
+	  * pop history is exhausted, non-zero on success. */
+	int (*undo)(struct __input_provider *);
+	/** Lend the cursor to the caller.  */
+	const char * (*borrow_cursor)(struct __input_provider *);
+	/** Take control over possibly incremented cursor and update the internal
+	  * structures if necessary. */
+	void (*return_cursor)(struct __input_provider *, const char *);
+	/** Release the control over the source. That is, synchronize any
+	  * fetched but non-consumed elements (e.g. by seeking) and destruct
+	  * internal structures (e.g. window deallocation). */
+	void (*release)(struct __input_provider *);
+} _input_provider;
+
+/** @see __input_provider */
+static void _capture_stream(_input_provider *self)
+{
+	assert(self->source.stream);
+	assert(self->state == _PROV_CONSTRUCTED);
+	/* Caller could already pre-allocated the window. */
+	assert((self->window == NULL && self->window_size == 0) ||
+	    (self->window && self->window_size > 0));
+
+	/* Initialize internal structures. */
+	self->consumed = 0;
+	ssize_t fetched = posix_getline(
+	    &self->window, &self->window_size, self->source.stream);
+	if (fetched != -1) {
+		self->fetched = fetched;
+		self->cursor = self->window;
+	} else {
+		/* EOF encountered. */
+		self->fetched = 0;
+		self->cursor = NULL;
+	}
+	self->state = _PROV_READY;
+}
+
+/** @see __input_provider */
+static void _capture_string(_input_provider *self)
+{
+	assert(self->source.string);
+	assert(self->state == _PROV_CONSTRUCTED);
+
+	/* Initialize internal structures. */
+	self->consumed = 0;
+	self->fetched = posix_strlen(self->source.string);
+	self->window = (char *) self->source.string;
+	self->window_size = self->fetched + 1;
+	self->cursor = self->window;
+	self->state = _PROV_READY;
+}
+
+/** @see __input_provider */
+static int _pop_stream(_input_provider *self)
+{
+	assert(self->state == _PROV_READY);
+
+	if (self->cursor) {
+		int c = *self->cursor;
+		++self->consumed;
+		++self->cursor;
+		/* Do we need to fetch a new line from the source? */
+		if (*self->cursor == '\0') {
+			ssize_t fetched = posix_getline(&self->window,
+			    &self->window_size, self->source.stream);
+			if (fetched != -1) {
+				self->fetched += fetched;
+				self->cursor = self->window;
+			} else {
+				/* EOF encountered. */
+				self->cursor = NULL;
+			}
+		}
+		return c;
+	} else {
+		/* Already at EOF. */
+		return -1;
+	}
+}
+
+/** @see __input_provider */
+static int _pop_string(_input_provider *self)
+{
+	assert(self->state == _PROV_READY);
+
+	if (*self->cursor != '\0') {
+		int c = *self->cursor;
+		++self->consumed;
+		++self->cursor;
+		return c;
+	} else {
+		/* String depleted. */
+		return -1;
+	}
+}
+
+/** @see __input_provider */
+static int _undo_stream(_input_provider *self)
+{
+	assert(self->state == _PROV_READY);
+
+	if (self->consumed == 0) {
+		/* Undo history exhausted. */
+		return 0;
+	}
+
+	if (!self->cursor || self->window == self->cursor) {
+		/* Complex case. Either at EOF (cursor == NULL) or there is no more
+		 * place to retreat to inside the window. Seek the source backwards
+		 * and flush the window. Regarding the scanf, this could happend only
+		 * when matching unbounded string (%s) or unbounded scanset (%[) not
+		 * containing newline, while at the same time newline is the character
+		 * that breaks the matching process. */
+		int rc = posix_fseek(
+		    self->source.stream, -1, SEEK_CUR);
+		if (rc == -1) {
+			/* Seek failed.  */
+			return 0;
+		}
+		ssize_t fetched = posix_getline(&self->window,
+		    &self->window_size, self->source.stream);
+		if (fetched != -1) {
+			assert(fetched == 1);
+			self->fetched = self->consumed + 1;
+			self->cursor = self->window;
+		} else {
+			/* Stream is broken. */
+			return 0;
+		}
+	} else {
+		/* Simple case. Still inside window. */
+		--self->cursor;
+	}
+	--self->consumed;
+	return 1; /* Success. */
+}
+
+/** @see __input_provider */
+static int _undo_string(_input_provider *self)
+{
+	assert(self->state == _PROV_READY);
+
+	if (self->consumed > 0) {
+		--self->consumed;
+		--self->cursor;
+	} else {
+		/* Undo history exhausted. */
+		return 0;
+	}
+	return 1; /* Success. */
+}
+
+/** @see __input_provider */
+static const char *_borrow_cursor_universal(_input_provider *self)
+{
+	assert(self->state == _PROV_READY);
+
+	self->state = _PROV_CURSOR_LENT;
+	return self->cursor;
+}
+
+/** @see __input_provider */
+static void _return_cursor_stream(_input_provider *self, const char *cursor)
+{
+	assert(self->state == _PROV_CURSOR_LENT);
+
+	/* Check how much of the window did external entity consumed. */
+	self->consumed += cursor - self->cursor;
+	self->cursor = cursor;
+	if (*self->cursor == '\0') {
+		/* Window was completely consumed, fetch new data. */
+		ssize_t fetched = posix_getline(&self->window,
+		    &self->window_size, self->source.stream);
+		if (fetched != -1) {
+			self->fetched += fetched;
+			self->cursor = self->window;
+		} else {
+			/* EOF encountered. */
+			self->cursor = NULL;
+		}
+	}
+	self->state = _PROV_READY;
+}
+
+/** @see __input_provider */
+static void _return_cursor_string(_input_provider *self, const char *cursor)
+{
+	assert(self->state == _PROV_CURSOR_LENT);
+
+	/* Check how much of the window did external entity consumed. */
+	self->consumed += cursor - self->cursor;
+	self->cursor = cursor;
+	self->state = _PROV_READY;
+}
+
+/** @see __input_provider */
+static void _release_stream(_input_provider *self)
+{
+	assert(self->state == _PROV_READY);
+	assert(self->consumed >= self->fetched);
+
+	/* Try to correct the difference between the stream position and what was
+	 * actually consumed. If it is not possible, continue anyway. */
+	posix_fseek(self->source.stream, self->consumed - self->fetched, SEEK_CUR);
+
+	/* Destruct internal structures. */
+	self->fetched = 0;
+	self->cursor = NULL;
+	if (self->window) {
+		free(self->window);
+		self->window = NULL;
+	}
+	self->window_size = 0;
+	self->state = _PROV_CONSTRUCTED;
+}
+
+/** @see __input_provider */
+static void _release_string(_input_provider *self)
+{
+	assert(self->state == _PROV_READY);
+
+	/* Destruct internal structures. */
+	self->fetched = 0;
+	self->cursor = NULL;
+	self->window = NULL;
+	self->window_size = 0;
+	self->state = _PROV_CONSTRUCTED;
+}
+
+/** Length modifier values. */
+enum {
+	LMOD_NONE,
+	LMOD_hh,
+	LMOD_h,
+	LMOD_l,
+	LMOD_ll,
+	LMOD_j,
+	LMOD_z,
+	LMOD_t,
+	LMOD_L,
+	LMOD_p, /* Reserved for %p conversion. */
+};
+
+/**
+ * Decides whether provided characters specify length modifier. If so, the
+ * recognized modifier is stored through provider pointer.
+ *
+ * @param c Candidate on the length modifier.
+ * @param _c Next character (might be NUL).
+ * @param modifier Pointer to the modifier value.
+ * @return Whether the modifier was recognized or not.
+ */
+static inline int is_length_mod(int c, int _c, int *modifier)
+{
+	assert(modifier);
+
+	switch (c) {
+	case 'h':
+		/* Check whether the modifier was not already recognized. */
+		if (*modifier == LMOD_NONE) {
+			*modifier = _c == 'h' ? LMOD_hh : LMOD_h;
+		} else {
+			/* Format string is invalid. Notify the caller. */
+			*modifier = LMOD_NONE;
+		}
+		return 1;
+	case 'l':
+		if (*modifier == LMOD_NONE) {
+			*modifier = _c == 'l' ? LMOD_ll : LMOD_l;
+		} else {
+			*modifier = LMOD_NONE;
+		}
+		return 1;
+	case 'j':
+		*modifier = *modifier == LMOD_NONE ? LMOD_j : LMOD_NONE;
+		return 1;
+	case 'z':
+		*modifier = *modifier == LMOD_NONE ? LMOD_z : LMOD_NONE;
+		return 1;
+	case 't':
+		*modifier = *modifier == LMOD_NONE ? LMOD_t : LMOD_NONE;
+		return 1;
+	case 'L':
+		*modifier = *modifier == LMOD_NONE ? LMOD_L : LMOD_NONE;
+		return 1;
+	default:
+		return 0;
+	}
+}
+
+/**
+ * Decides whether provided character specifies integer conversion. If so, the
+ * semantics of the conversion is stored through provided pointers..
+ * 
+ * @param c Candidate on the integer conversion.
+ * @param is_unsigned Pointer to store whether the conversion is signed or not.
+ * @param base Pointer to store the base of the integer conversion.
+ * @return Whether the conversion was recognized or not.
+ */
+static inline int is_int_conv(int c, bool *is_unsigned, int *base)
+{
+	assert(is_unsigned && base);
+
+	switch (c) {
+	case 'd':
+		*is_unsigned = false;
+		*base = 10;
+		return 1;
+	case 'i':
+		*is_unsigned = false;
+		*base = 0;
+		return 1;
+	case 'o':
+		*is_unsigned = true;
+		*base = 8;
+		return 1;
+	case 'u':
+		*is_unsigned = true;
+		*base = 10;
+		return 1;
+	case 'p': /* According to POSIX, %p modifier is implementation defined but
+			   * must correspond to its printf counterpart. */
+	case 'x':
+	case 'X':
+		*is_unsigned = true;
+		*base = 16;
+		return 1;
+		return 1;
+	default:
+		return 0;
+	}
+}
+
+/**
+ * Decides whether provided character specifies conversion of the floating
+ * point number.
+ *
+ * @param c Candidate on the floating point conversion.
+ * @return Whether the conversion was recognized or not.
+ */
+static inline int is_float_conv(int c)
+{
+	switch (c) {
+	case 'a':
+	case 'A':
+	case 'e':
+	case 'E':
+	case 'f':
+	case 'F':
+	case 'g':
+	case 'G':
+		return 1;
+	default:
+		return 0;
+	}
+}
+
+/**
+ * Decides whether provided character specifies conversion of the character
+ * sequence.
+ *
+ * @param c Candidate on the character sequence conversion.
+ * @param modifier Pointer to store length modifier for wide chars.
+ * @return Whether the conversion was recognized or not.
+ */
+static inline int is_seq_conv(int c, int *modifier)
+{
+	assert(modifier);
+	
+	switch (c) {
+	case 'S':
+		*modifier = LMOD_l;
+		/* Fallthrough */
+	case 's':
+		return 1;
+	case 'C':
+		*modifier = LMOD_l;
+		/* Fallthrough */
+	case 'c':
+		return 1;
+	case '[':
+		return 1;
+	default:
+		return 0;
+	}
+}
+
+/**
+ * Backend for the whole family of scanf functions. Uses input provider
+ * to abstract over differences between strings and streams. Should be
+ * POSIX compliant (apart from the not supported stuff).
+ *
+ * NOT SUPPORTED: locale (see strtold), wide chars, numbered output arguments
+ * 
+ * @param in Input provider.
+ * @param fmt Format description.
+ * @param arg Output arguments.
+ * @return The number of converted output items or EOF on failure.
+ */
+static inline int _internal_scanf(
+    _input_provider *in, const char *restrict fmt, va_list arg)
+{
+	int c = -1;
+	int converted_cnt = 0;
+	bool converting = false;
+	bool matching_failure = false;
+
+	bool assign_supress = false;
+	bool assign_alloc = false;
+	long width = -1;
+	int length_mod = LMOD_NONE;
+	bool int_conv_unsigned = false;
+	int int_conv_base = 0;
+
+	/* Buffers allocated by scanf for optional 'm' specifier must be remembered
+	 * to deallocaate them in case of an error. Because each of those buffers
+	 * corresponds to one of the argument from va_list, there is an upper bound
+	 * on the number of those arguments. In case of C99, this uppper bound is
+	 * 127 arguments. */
+	char *buffers[127];
+	for (int i = 0; i < 127; ++i) {
+		buffers[i] = NULL;
+	}
+	int next_unused_buffer_idx = 0;
+
+	in->capture(in);
+
+	/* Interpret format string. Control shall prematurely jump from the cycle
+	 * on input failure, matching failure or illegal format string. In order
+	 * to keep error reporting simple enough and to keep input consistent,
+	 * error condition shall be always manifested as jump from the cycle,
+	 * not function return. Format string pointer shall be updated specifically
+	 * for each sub-case (i.e. there shall be no loop-wide increment).*/
+	while (*fmt) {
+
+		if (converting) {
+
+			/* Processing inside conversion specifier. Either collect optional
+			 * parameters or execute the conversion. When the conversion
+			 * is successfully completed, increment conversion count and switch
+			 * back to normal mode. */
+			if (*fmt == '*') {
+				/* Assignment-supression (optional). */
+				if (assign_supress) {
+					/* Already set. Illegal format string. */
+					break;
+				}
+				assign_supress = true;
+				++fmt;
+			} else if (*fmt == 'm') {
+				/* Assignment-allocation (optional). */
+				if (assign_alloc) {
+					/* Already set. Illegal format string. */
+					break;
+				}
+				assign_alloc = true;
+				++fmt;
+			} else if (*fmt == '$') {
+				/* Reference to numbered output argument. */
+				// TODO
+				not_implemented();
+			} else if (isdigit(*fmt)) {
+				/* Maximum field length (optional). */
+				if (width != -1) {
+					/* Already set. Illegal format string. */
+					break;
+				}
+				char *fmt_new = NULL;
+				width = posix_strtol(fmt, &fmt_new, 10);
+				if (width != 0) {
+					fmt = fmt_new;
+				} else {
+					/* Since POSIX requires width to be non-zero, it is
+					 * sufficient to interpret zero width as error without
+					 * referring to errno. */
+					break;
+				}
+			} else if (is_length_mod(*fmt, *(fmt + 1), &length_mod)) {
+				/* Length modifier (optional). */
+				if (length_mod == LMOD_NONE) {
+					/* Already set. Illegal format string. The actual detection
+					 * is carried out in the is_length_mod(). */
+					break;
+				}
+				if (length_mod == LMOD_hh || length_mod == LMOD_ll) {
+					/* Modifier was two characters long. */
+					++fmt;
+				}
+				++fmt;
+			} else if (is_int_conv(*fmt, &int_conv_unsigned, &int_conv_base)) {
+				/* Integer conversion. */
+
+				/* Check sanity of optional parts of conversion specifier. */
+				if (assign_alloc || length_mod == LMOD_L) {
+					/* Illegal format string. */
+					break;
+				}
+
+				/* Conversion of the integer with %p specifier needs special
+				 * handling, because it is not allowed to have arbitrary
+				 * length modifier.  */
+				if (*fmt == 'p') {
+					if (length_mod == LMOD_NONE) {
+						length_mod = LMOD_p;
+					} else {
+						/* Already set. Illegal format string. */
+						break;
+					}
+				}
+
+				/* First consume any white spaces, so we can borrow cursor
+				 * from the input provider. This way, the cursor will either
+				 * point to the non-white space while the input will be
+				 * prefetched up to the newline (which is suitable for strtol),
+				 * or the input will be at EOF. */
+				do {
+					c = in->pop(in);
+				} while (isspace(c));
+
+				/* After skipping the white spaces, can we actually continue? */
+				if (c == -1) {
+					/* Input failure. */
+					break;
+				} else {
+					/* Everything is OK, just undo the last pop, so the cursor
+					 * can be borrowed. */
+					in->undo(in);
+				}
+
+				const char *cur_borrowed = NULL;
+				const char *cur_limited = NULL;
+				char *cur_updated = NULL;
+
+				/* Borrow the cursor. Until it is returned to the provider
+				 * we cannot jump from the cycle, because it would leave
+				 * the input inconsistent. */
+				cur_borrowed = in->borrow_cursor(in);
+
+				/* If the width is limited, the cursor horizont must be
+				 * decreased accordingly. Otherwise the strtol could read more
+				 * than allowed by width. */
+				if (width != -1) {
+					cur_limited = posix_strndup(cur_borrowed, width);
+				} else {
+					cur_limited = cur_borrowed;
+				}
+				cur_updated = (char *) cur_limited;
+
+				long long sres = 0;
+				unsigned long long ures = 0;
+				errno = 0; /* Reset errno to recognize error later. */
+				/* Try to convert the integer. */
+				if (int_conv_unsigned) {
+					ures = posix_strtoull(cur_limited, &cur_updated, int_conv_base);
+				} else {
+					sres = posix_strtoll(cur_limited, &cur_updated, int_conv_base);
+				}
+
+				/* Update the cursor so it can be returned to the provider. */
+				cur_borrowed += cur_updated - cur_limited;
+				if (width != -1 && cur_limited != NULL) {
+					/* Deallocate duplicated part of the cursor view. */
+					free(cur_limited);
+				}
+				cur_limited = NULL;
+				cur_updated = NULL;
+				/* Return the cursor to the provider. Input consistency is again
+				 * the job of the provider, so we can report errors from
+				 * now on. */
+				in->return_cursor(in, cur_borrowed);
+				cur_borrowed = NULL;
+
+				/* Check whether the conversion was successful. */
+				if (errno != EOK) {
+					matching_failure = true;
+					break;
+				}
+
+				/* If not supressed, assign the converted integer into
+				 * the next output argument. */
+				if (!assign_supress) {
+					if (int_conv_unsigned) {
+						switch (length_mod) {
+						case LMOD_hh: ; /* Label cannot be part of declaration. */
+							unsigned char *phh = va_arg(arg, unsigned char *);
+							*phh = (unsigned char) ures;
+							break;
+						case LMOD_h: ;
+							unsigned short *ph = va_arg(arg, unsigned short *);
+							*ph = (unsigned short) ures;
+							break;
+						case LMOD_NONE: ;
+							unsigned *pdef = va_arg(arg, unsigned *);
+							*pdef = (unsigned) ures;
+							break;
+						case LMOD_l: ;
+							unsigned long *pl = va_arg(arg, unsigned long *);
+							*pl = (unsigned long) ures;
+							break;
+						case LMOD_ll: ;
+							unsigned long long *pll = va_arg(arg, unsigned long long *);
+							*pll = (unsigned long long) ures;
+							break;
+						case LMOD_j: ;
+							uintmax_t *pj = va_arg(arg, uintmax_t *);
+							*pj = (uintmax_t) ures;
+							break;
+						case LMOD_z: ;
+							size_t *pz = va_arg(arg, size_t *);
+							*pz = (size_t) ures;
+							break;
+						case LMOD_t: ;
+							// XXX: What is unsigned counterpart of the ptrdiff_t?
+							size_t *pt = va_arg(arg, size_t *);
+							*pt = (size_t) ures;
+							break;
+						case LMOD_p: ;
+							void **pp = va_arg(arg, void **);
+							*pp = (void *) (uintptr_t) ures;
+							break;
+						default:
+							assert(false);
+						}
+					} else {
+						switch (length_mod) {
+						case LMOD_hh: ; /* Label cannot be part of declaration. */
+							signed char *phh = va_arg(arg, signed char *);
+							*phh = (signed char) sres;
+							break;
+						case LMOD_h: ;
+							short *ph = va_arg(arg, short *);
+							*ph = (short) sres;
+							break;
+						case LMOD_NONE: ;
+							int *pdef = va_arg(arg, int *);
+							*pdef = (int) sres;
+							break;
+						case LMOD_l: ;
+							long *pl = va_arg(arg, long *);
+							*pl = (long) sres;
+							break;
+						case LMOD_ll: ;
+							long long *pll = va_arg(arg, long long *);
+							*pll = (long long) sres;
+							break;
+						case LMOD_j: ;
+							intmax_t *pj = va_arg(arg, intmax_t *);
+							*pj = (intmax_t) sres;
+							break;
+						case LMOD_z: ;
+							ssize_t *pz = va_arg(arg, ssize_t *);
+							*pz = (ssize_t) sres;
+							break;
+						case LMOD_t: ;
+							ptrdiff_t *pt = va_arg(arg, ptrdiff_t *);
+							*pt = (ptrdiff_t) sres;
+							break;
+						default:
+							assert(false);
+						}
+					}
+					++converted_cnt;
+				}
+
+				converting = false;
+				++fmt;
+			} else if (is_float_conv(*fmt)) {
+				/* Floating point number conversion. */
+
+				/* Check sanity of optional parts of conversion specifier. */
+				if (assign_alloc) {
+					/* Illegal format string. */
+					break;
+				}
+				if (length_mod != LMOD_NONE &&
+				    length_mod != LMOD_l &&
+				    length_mod != LMOD_L) {
+					/* Illegal format string. */
+					break;
+				}
+
+				/* First consume any white spaces, so we can borrow cursor
+				 * from the input provider. This way, the cursor will either
+				 * point to the non-white space while the input will be
+				 * prefetched up to the newline (which is suitable for strtof),
+				 * or the input will be at EOF. */
+				do {
+					c = in->pop(in);
+				} while (isspace(c));
+
+				/* After skipping the white spaces, can we actually continue? */
+				if (c == -1) {
+					/* Input failure. */
+					break;
+				} else {
+					/* Everything is OK, just undo the last pop, so the cursor
+					 * can be borrowed. */
+					in->undo(in);
+				}
+
+				const char *cur_borrowed = NULL;
+				const char *cur_limited = NULL;
+				char *cur_updated = NULL;
+
+				/* Borrow the cursor. Until it is returned to the provider
+				 * we cannot jump from the cycle, because it would leave
+				 * the input inconsistent. */
+				cur_borrowed = in->borrow_cursor(in);
+
+				/* If the width is limited, the cursor horizont must be
+				 * decreased accordingly. Otherwise the strtof could read more
+				 * than allowed by width. */
+				if (width != -1) {
+					cur_limited = posix_strndup(cur_borrowed, width);
+				} else {
+					cur_limited = cur_borrowed;
+				}
+				cur_updated = (char *) cur_limited;
+
+				float fres = 0.0;
+				double dres = 0.0;
+				long double ldres = 0.0;
+				errno = 0; /* Reset errno to recognize error later. */
+				/* Try to convert the floating point nubmer. */
+				switch (length_mod) {
+				case LMOD_NONE:
+					fres = posix_strtof(cur_limited, &cur_updated);
+					break;
+				case LMOD_l:
+					dres = posix_strtod(cur_limited, &cur_updated);
+					break;
+				case LMOD_L:
+					ldres = posix_strtold(cur_limited, &cur_updated);
+					break;
+				default:
+					assert(false);
+				}
+
+				/* Update the cursor so it can be returned to the provider. */
+				cur_borrowed += cur_updated - cur_limited;
+				if (width != -1 && cur_limited != NULL) {
+					/* Deallocate duplicated part of the cursor view. */
+					free(cur_limited);
+				}
+				cur_limited = NULL;
+				cur_updated = NULL;
+				/* Return the cursor to the provider. Input consistency is again
+				 * the job of the provider, so we can report errors from
+				 * now on. */
+				in->return_cursor(in, cur_borrowed);
+				cur_borrowed = NULL;
+
+				/* Check whether the conversion was successful. */
+				if (errno != EOK) {
+					matching_failure = true;
+					break;
+				}
+
+				/* If nto supressed, assign the converted floating point number
+				 * into the next output argument. */
+				if (!assign_supress) {
+					switch (length_mod) {
+					case LMOD_NONE: ; /* Label cannot be part of declaration. */
+						float *pf = va_arg(arg, float *);
+						*pf = fres;
+						break;
+					case LMOD_l: ;
+						double *pd = va_arg(arg, double *);
+						*pd = dres;
+						break;
+					case LMOD_L: ;
+						long double *pld = va_arg(arg, long double *);
+						*pld = ldres;
+						break;
+					default:
+						assert(false);
+					}
+					++converted_cnt;
+				}
+
+				converting = false;
+				++fmt;
+			} else if (is_seq_conv(*fmt, &length_mod)) {
+				/* Character sequence conversion. */
+				
+				/* Check sanity of optional parts of conversion specifier. */
+				if (length_mod != LMOD_NONE &&
+				    length_mod != LMOD_l) {
+					/* Illegal format string. */
+					break;
+				}
+
+				if (length_mod == LMOD_l) {
+					/* Wide chars not supported. */
+					// TODO
+					not_implemented();
+				}
+
+				int term_size = 1; /* Size of the terminator (0 or 1)). */
+				if (*fmt == 'c') {
+					term_size = 0;
+					width = width == -1 ? 1 : width;
+				}
+
+				if (*fmt == 's') {
+					/* Skip white spaces. */
+					do {
+						c = in->pop(in);
+					} while (isspace(c));
+				} else {
+					/* Fetch a single character. */
+					c = in->pop(in);
+				}
+
+				/* Check whether there is still input to read. */
+				if (c == -1) {
+					/* Input failure. */
+					break;
+				}
+
+				/* Prepare scanset. */
+				char terminate_on[256];
+				for (int i = 0; i < 256; ++i) {
+					terminate_on[i] = 0;
+				}
+				if (*fmt == 'c') {
+					++fmt;
+				} else if (*fmt == 's') {
+					terminate_on[' '] = 1;
+					terminate_on['\n'] = 1;
+					terminate_on['\t'] = 1;
+					terminate_on['\f'] = 1;
+					terminate_on['\r'] = 1;
+					terminate_on['\v'] = 1;
+					++fmt;
+				} else {
+					assert(*fmt == '[');
+					bool not = false;
+					bool dash = false;
+					++fmt;
+					/* Check for negation. */
+					if (*fmt == '^') {
+						not = true;
+						++fmt;
+					}
+					/* Check for escape sequences. */
+					if (*fmt == '-' || *fmt == ']') {
+						terminate_on[(int) *fmt] = 1;
+						++fmt;
+					}
+					/* Check for ordinary characters and ranges. */
+					while (*fmt != '\0' && *fmt != ']') {
+						if (dash) {
+							for (char chr = *(fmt - 2); chr <= *fmt; ++chr) {
+								terminate_on[(int) chr] = 1;
+							}
+							dash = false;
+						} else if (*fmt == '-') {
+							dash = true;
+						} else {
+							terminate_on[(int) *fmt] = 1;
+						}
+						++fmt;
+					}
+					/* Check for escape sequence. */
+					if (dash == true) {
+						terminate_on['-'] = 1;
+					}
+					/* Check whether the specifier was correctly terminated.*/
+					if (*fmt == '\0') {
+						/* Illegal format string. */
+						break;
+					} else {
+						++fmt;
+					}
+					/* Inverse the scanset if necessary. */
+					if (not == false) {
+						for (int i = 0; i < 256; ++i) {
+							terminate_on[i] = terminate_on[i] ? 0 : 1;
+						}
+					}
+				}
+
+				char * buf = NULL;
+				size_t buf_size = 0;
+				char * cur = NULL;
+				size_t alloc_step = 80; /* Buffer size gain during reallocation. */
+				int my_buffer_idx = 0;
+
+				/* Retrieve the buffer into which popped characters
+				 * will be stored. */
+				if (!assign_supress) {
+					if (assign_alloc) {
+						/* We must allocate our own buffer. */
+						buf_size =
+						    width == -1 ? alloc_step : (size_t) width + term_size;
+						buf = malloc(buf_size);
+						if (!buf) {
+							/* No memory. */
+							break;
+						}
+						my_buffer_idx = next_unused_buffer_idx;
+						++next_unused_buffer_idx;
+						buffers[my_buffer_idx] = buf;
+						cur = buf;
+					} else {
+						/* Caller provided its buffer. */
+						buf = va_arg(arg, char *);
+						cur = buf;
+						buf_size =
+						    width == -1 ? SIZE_MAX : (size_t) width + term_size;
+					}
+				}
+
+				/* Match the string. The next character is already popped. */
+				while ((width == -1 || width > 0) && c != -1 && !terminate_on[c]) {
+
+					/* Check whether the buffer is still sufficiently large. */
+					if (!assign_supress) {
+						/* Always reserve space for the null terminator. */
+						if (cur == buf + buf_size - term_size) {
+							/* Buffer size must be increased. */
+							buf = realloc(buf, buf_size + alloc_step);
+							if (buf) {
+								buffers[my_buffer_idx] = buf;
+								cur = buf + buf_size - term_size;
+								buf_size += alloc_step;
+							} else {
+								/* Break just from this tight loop. Errno will
+								 * be checked after it. */
+								break;
+							}
+						}
+						/* Store the input character. */
+						*cur = c;
+					}
+
+					width = width == -1 ? -1 : width - 1;
+					++cur;
+					c = in->pop(in);
+				}
+				if (errno == ENOMEM) {
+					/* No memory. */
+					break;
+				}
+				if (c != -1) {
+					/* There is still more input, so undo the last pop. */
+					in->undo(in);
+				}
+
+				/* Check for failures. */
+				if (cur == buf) {
+					/* Matching failure. Input failure was already checked
+					 * earlier. */
+					matching_failure = true;
+					if (!assign_supress && assign_alloc) {
+						/* Roll back. */
+						free(buf);
+						buffers[my_buffer_idx] = NULL;
+						--next_unused_buffer_idx;
+					}
+					break;
+				}
+
+				/* Store the terminator. */
+				if (!assign_supress && term_size > 0) {
+					/* Space for the terminator was reserved. */
+					*cur = '\0';
+				}
+
+				/* Store the result if not already stored. */
+				if (!assign_supress) {
+					if (assign_alloc) {
+						char **pbuf = va_arg(arg, char **);
+						*pbuf = buf;
+					}
+					++converted_cnt;
+				}
+				
+				converting = false;
+				/* Format string pointer already incremented. */
+			} else if (*fmt == 'n') {
+				/* Report the number of consumed bytes so far. */
+
+				/* Sanity check. */
+				bool sane =
+				    width == -1 &&
+				    length_mod == LMOD_NONE &&
+				    assign_alloc == false &&
+				    assign_supress == false;
+
+				if (sane) {
+					int *pi = va_arg(arg, int *);
+					*pi = in->consumed;
+				} else {
+					/* Illegal format string. */
+					break;
+				}
+
+				/* This shall not be counted as conversion. */
+				converting = false;
+				++fmt;
+			} else {
+				/* Illegal format string. */
+				break;
+			}
+			
+		} else {
+
+			/* Processing outside conversion specifier. Either skip white
+			 * spaces or match characters one by one. If conversion specifier
+			 * is detected, switch to coversion mode. */
+			if (isspace(*fmt)) {
+				/* Skip white spaces in the format string. */
+				while (isspace(*fmt)) {
+					++fmt;
+				}
+				/* Skip white spaces in the input. */
+				do {
+					c = in->pop(in);
+				} while (isspace(c));
+				if (c != -1) {
+					/* Input is not at EOF, so undo the last pop operation. */
+					in->undo(in);
+				}
+			} else if (*fmt == '%' && *(fmt + 1) != '%') {
+				/* Conversion specifier detected. Switch modes. */
+				converting = true;
+				/* Reset the conversion context. */
+				assign_supress = false;
+				assign_alloc = false;
+				width = -1;
+				length_mod = LMOD_NONE;
+				int_conv_unsigned = false;
+				int_conv_base = 0;
+				++fmt;
+			} else {
+				/* One by one matching. */
+				if (*fmt == '%') {
+					/* Escape sequence detected. */
+					++fmt;
+					assert(*fmt == '%');
+				}
+				c = in->pop(in);
+				if (c == -1) {
+					/* Input failure. */
+					break;
+				} else if (c != *fmt) {
+					/* Matching failure. */
+					in->undo(in);
+					matching_failure = true;
+					break;
+				} else {
+					++fmt;
+				}
+			}
+			
+		}
+
+	}
+
+	in->release(in);
+
+	/* This somewhat complicated return value decision is required by POSIX. */
+	int rc;
+	if (matching_failure) {
+		rc = converted_cnt;
+	} else {
+		if (errno == EOK) {
+			rc = converted_cnt > 0 ? converted_cnt : EOF;
+		} else {
+			rc = EOF;
+		}
+	}
+	if (rc == EOF) {
+		/* Caller will not know how many arguments were successfully converted,
+		 * so the deallocation of buffers is our responsibility. */
+		for (int i = 0; i < next_unused_buffer_idx; ++i) {
+			free(buffers[i]);
+			buffers[i] = NULL;
+		}
+		next_unused_buffer_idx = 0;
+	}
+	return rc;
+}
+
+/**
+ * Convert formatted input from the stream.
+ *
+ * @param stream Input stream.
+ * @param format Format description.
+ * @param arg Output items.
+ * @return The number of converted output items or EOF on failure.
+ */
+int posix_vfscanf(
+    FILE *restrict stream, const char *restrict format, va_list arg)
+{
+	_input_provider provider = {
+	    { 0 }, 0, 0, NULL, 0, NULL, _PROV_CONSTRUCTED,
+	    _capture_stream, _pop_stream, _undo_stream,
+	    _borrow_cursor_universal, _return_cursor_stream, _release_stream
+	};
+	provider.source.stream = stream;
+	return _internal_scanf(&provider, format, arg);
+}
+
+/**
+ * Convert formatted input from the string.
+ *
+ * @param s Input string.
+ * @param format Format description.
+ * @param arg Output items.
+ * @return The number of converted output items or EOF on failure.
+ */
+int posix_vsscanf(
+    const char *restrict s, const char *restrict format, va_list arg)
+{
+	_input_provider provider = {
+	    { 0 }, 0, 0, NULL, 0, NULL, _PROV_CONSTRUCTED,
+	    _capture_string, _pop_string, _undo_string,
+	    _borrow_cursor_universal, _return_cursor_string, _release_string
+	};
+	provider.source.string = s;
+	return _internal_scanf(&provider, format, arg);
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/stdlib.c
===================================================================
--- uspace/lib/posix/source/stdlib.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/stdlib.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,504 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Standard library definitions.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "internal/common.h"
+#include "posix/stdlib.h"
+
+#include "posix/errno.h"
+#include "posix/fcntl.h"
+#include "posix/limits.h"
+#include "posix/string.h"
+#include "posix/sys/stat.h"
+#include "posix/unistd.h"
+
+#include "libc/qsort.h"
+#include "libc/str.h"
+#include "libc/vfs/vfs.h"
+#include "libc/stats.h"
+
+/**
+ * 
+ * @param array
+ * @param count
+ * @param size
+ * @param compare
+ */
+int posix_atexit(void (*func)(void))
+{
+	// TODO: low priority, just a compile-time dependency of binutils
+	not_implemented();
+	return 0;
+}
+
+/**
+ * Integer absolute value.
+ * 
+ * @param i Input value.
+ * @return Absolute value of the parameter.
+ */
+int posix_abs(int i)
+{
+	return i < 0 ? -i : i;
+}
+
+/**
+ * Long integer absolute value.
+ * 
+ * @param i Input value.
+ * @return Absolute value of the parameter.
+ */
+long posix_labs(long i)
+{
+	return i < 0 ? -i : i;
+}
+
+/**
+ * Long long integer absolute value.
+ * 
+ * @param i Input value.
+ * @return Absolute value of the parameter.
+ */
+long long posix_llabs(long long i)
+{
+	return i < 0 ? -i : i;
+}
+
+/**
+ * Compute the quotient and remainder of an integer division.
+ *
+ * @param numer Numerator.
+ * @param denom Denominator.
+ * @return Quotient and remainder packed into structure.
+ */
+posix_div_t posix_div(int numer, int denom)
+{
+	return (posix_div_t) { .quot = numer / denom, .rem = numer % denom };
+}
+
+/**
+ * Compute the quotient and remainder of a long integer division.
+ *
+ * @param numer Numerator.
+ * @param denom Denominator.
+ * @return Quotient and remainder packed into structure.
+ */
+posix_ldiv_t posix_ldiv(long numer, long denom)
+{
+	return (posix_ldiv_t) { .quot = numer / denom, .rem = numer % denom };
+}
+
+/**
+ * Compute the quotient and remainder of a long long integer division.
+ *
+ * @param numer Numerator.
+ * @param denom Denominator.
+ * @return Quotient and remainder packed into structure.
+ */
+posix_lldiv_t posix_lldiv(long long numer, long long denom)
+{
+	return (posix_lldiv_t) { .quot = numer / denom, .rem = numer % denom };
+}
+
+/**
+ * Array sorting utilizing the quicksort algorithm.
+ *
+ * @param array Array of elements to sort.
+ * @param count Number of elements in the array.
+ * @param size Width of each element.
+ * @param compare Decides relative ordering of two elements.
+ */
+void posix_qsort(void *array, size_t count, size_t size,
+    int (*compare)(const void *, const void *))
+{
+	qsort(array, count, size, compare);
+}
+
+/**
+ * Binary search in a sorted array.
+ *
+ * @param key Object to search for.
+ * @param base Pointer to the first element of the array.
+ * @param nmemb Number of elements in the array.
+ * @param size Size of each array element.
+ * @param compar Comparison function.
+ * @return Pointer to a matching element, or NULL if none can be found.
+ */
+void *posix_bsearch(const void *key, const void *base,
+    size_t nmemb, size_t size, int (*compar)(const void *, const void *))
+{
+	while (nmemb > 0) {
+		const void *middle = base + (nmemb / 2) * size;
+		int cmp = compar(key, middle);
+		if (cmp == 0) {
+			return (void *) middle;
+		}
+		if (middle == base) {
+			/* There is just one member left to check and it
+			 * didn't match the key. Avoid infinite loop.
+			 */
+			break;
+		}
+		if (cmp < 0) {
+			nmemb = nmemb / 2;
+		} else if (cmp > 0) {
+			nmemb = nmemb - (nmemb / 2);
+			base = middle;
+		}
+	}
+	
+	return NULL;
+}
+
+/**
+ * Retrieve a value of the given environment variable.
+ *
+ * Since HelenOS doesn't support env variables at the moment,
+ * this function always returns NULL.
+ *
+ * @param name Name of the variable.
+ * @return Value of the variable or NULL if such variable does not exist.
+ */
+char *posix_getenv(const char *name)
+{
+	return NULL;
+}
+
+/**
+ * 
+ * @param name
+ * @param resolved
+ * @return
+ */
+int posix_putenv(char *string)
+{
+	// TODO: low priority, just a compile-time dependency of binutils
+	not_implemented();
+	return 0;
+}
+
+/**
+ * Issue a command.
+ *
+ * @param string String to be passed to a command interpreter or NULL.
+ * @return Termination status of the command if the command is not NULL,
+ *     otherwise indicate whether there is a command interpreter (non-zero)
+ *     or not (zero).
+ */
+int posix_system(const char *string) {
+	// TODO: does nothing at the moment
+	not_implemented();
+	return 0;
+}
+
+/**
+ * Resolve absolute pathname.
+ * 
+ * @param name Pathname to be resolved.
+ * @param resolved Either buffer for the resolved absolute pathname or NULL.
+ * @return On success, either resolved (if it was not NULL) or pointer to the
+ *     newly allocated buffer containing the absolute pathname (if resolved was
+ *     NULL). Otherwise NULL.
+ *
+ */
+char *posix_realpath(const char *restrict name, char *restrict resolved)
+{
+	#ifndef PATH_MAX
+		assert(resolved == NULL);
+	#endif
+	
+	if (name == NULL) {
+		errno = EINVAL;
+		return NULL;
+	}
+	
+	// TODO: symlink resolution
+	
+	/* Function absolutize is implemented in libc and declared in vfs.h.
+	 * No more processing is required as HelenOS doesn't have symlinks
+	 * so far (as far as I can tell), although this function will need
+	 * to be updated when that support is implemented.
+	 */
+	char* absolute = vfs_absolutize(name, NULL);
+	
+	if (absolute == NULL) {
+		/* POSIX requires some specific errnos to be set
+		 * for some cases, but there is no way to find out from
+		 * absolutize().
+		 */
+		errno = EINVAL;
+		return NULL;
+	}
+	
+	if (resolved == NULL) {
+		return absolute;
+	} else {
+		#ifdef PATH_MAX
+			str_cpy(resolved, PATH_MAX, absolute);
+		#endif
+		free(absolute);
+		return resolved;
+	}
+}
+
+/**
+ * Converts a string representation of a floating-point number to
+ * its native representation. See posix_strtold().
+ *
+ * @param nptr String representation of a floating-point number.
+ * @return Double-precision number resulting from the string conversion.
+ */
+double posix_atof(const char *nptr)
+{
+	return posix_strtod(nptr, NULL);
+}
+
+/**
+ * Converts a string representation of a floating-point number to
+ * its native representation. See posix_strtold().
+ *
+ * @param nptr String representation of a floating-point number.
+ * @param endptr Pointer to the final part of the string which
+ *     was not used for conversion.
+ * @return Single-precision number resulting from the string conversion.
+ */
+float posix_strtof(const char *restrict nptr, char **restrict endptr)
+{
+	return (float) posix_strtold(nptr, endptr);
+}
+
+/**
+ * Converts a string representation of a floating-point number to
+ * its native representation. See posix_strtold().
+ *
+ * @param nptr String representation of a floating-point number.
+ * @param endptr Pointer to the final part of the string which
+ *     was not used for conversion.
+ * @return Double-precision number resulting from the string conversion.
+ */
+double posix_strtod(const char *restrict nptr, char **restrict endptr)
+{
+	return (double) posix_strtold(nptr, endptr);
+}
+
+/**
+ * Allocate memory chunk.
+ *
+ * @param size Size of the chunk to allocate.
+ * @return Either pointer to the allocated chunk or NULL if not possible.
+ */
+void *posix_malloc(size_t size)
+{
+	return malloc(size);
+}
+
+/**
+ * Allocate memory for an array of elements.
+ *
+ * @param nelem Number of elements in the array.
+ * @param elsize Size of each element.
+ * @return Either pointer to the allocated array or NULL if not possible.
+ */
+void *posix_calloc(size_t nelem, size_t elsize)
+{
+	return calloc(nelem, elsize);
+}
+
+/**
+ * Reallocate memory chunk to a new size.
+ *
+ * @param ptr Memory chunk to reallocate. Might be NULL.
+ * @param size Size of the reallocated chunk. Might be zero.
+ * @return Either NULL or the pointer to the newly reallocated chunk.
+ */
+void *posix_realloc(void *ptr, size_t size)
+{
+	if (ptr != NULL && size == 0) {
+		/* Native realloc does not handle this special case. */
+		free(ptr);
+		return NULL;
+	} else {
+		return realloc(ptr, size);
+	}
+}
+
+/**
+ * Free allocated memory chunk.
+ *
+ * @param ptr Memory chunk to be freed.
+ */
+void posix_free(void *ptr)
+{
+	if (ptr) {
+		free(ptr);
+	}
+}
+
+/**
+ * Generate a pseudo random integer in the range 0 to RAND_MAX inclusive.
+ *
+ * @return The pseudo random integer.
+ */
+int posix_rand(void)
+{
+	return (int) random();
+}
+
+/**
+ * Initialize a new sequence of pseudo-random integers.
+ *
+ * @param seed The seed of the new sequence.
+ */
+void posix_srand(unsigned int seed)
+{
+	srandom(seed);
+}
+
+/**
+ * Creates and opens an unique temporary file from template.
+ *
+ * @param tmpl Template. Last six characters must be XXXXXX.
+ * @return The opened file descriptor or -1 on error.
+ */
+int posix_mkstemp(char *tmpl)
+{
+	int fd = -1;
+	
+	char *tptr = tmpl + posix_strlen(tmpl) - 6;
+	
+	while (fd < 0) {
+		if (*posix_mktemp(tmpl) == '\0') {
+			/* Errno set by mktemp(). */
+			return -1;
+		}
+		
+		fd = posix_open(tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+		
+		if (fd == -1) {
+			/* Restore template to it's original state. */
+			snprintf(tptr, 7, "XXXXXX");
+		}
+	}
+	
+	return fd;
+}
+
+/**
+ * Creates an unique temporary file name from template.
+ *
+ * @param tmpl Template. Last six characters must be XXXXXX.
+ * @return The value of tmpl. The template is modified in place.
+ *    If no temporary file name can be created, template is
+ *    reduced to an empty string.
+ */
+char *posix_mktemp(char *tmpl)
+{
+	int tmpl_len = posix_strlen(tmpl);
+	if (tmpl_len < 6) {
+		errno = EINVAL;
+		*tmpl = '\0';
+		return tmpl;
+	}
+	
+	char *tptr = tmpl + tmpl_len - 6;
+	if (posix_strcmp(tptr, "XXXXXX") != 0) {
+		errno = EINVAL;
+		*tmpl = '\0';
+		return tmpl;
+	}
+	
+	static int seq = 0;
+	
+	for (; seq < 1000000; ++seq) {
+		snprintf(tptr, 7, "%06d", seq);
+		
+		int orig_errno = errno;
+		errno = 0;
+		/* Check if the file exists. */
+		if (posix_access(tmpl, F_OK) == -1) {
+			if (errno == ENOENT) {
+				errno = orig_errno;
+				break;
+			} else {
+				/* errno set by access() */
+				*tmpl = '\0';
+				return tmpl;
+			}
+		}
+	}
+	
+	if (seq == 10000000) {
+		errno = EEXIST;
+		*tmpl = '\0';
+		return tmpl;
+	}
+	
+	return tmpl;
+}
+
+/**
+ * Get system load average statistics.
+ *
+ * @param loadavg Array where the load averages shall be placed.
+ * @param nelem Maximum number of elements to be placed into the array.
+ * @return Number of elements placed into the array on success, -1 otherwise.
+ */
+int bsd_getloadavg(double loadavg[], int nelem)
+{
+	assert(nelem > 0);
+	
+	size_t count;
+	load_t *loads = stats_get_load(&count);
+	
+	if (loads == NULL) {
+		return -1;
+	}
+	
+	if (((size_t) nelem) < count) {
+		count = nelem;
+	}
+	
+	for (size_t i = 0; i < count; ++i) {
+		loadavg[i] = (double) loads[i];
+	}
+	
+	free(loads);
+	return count;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/stdlib/strtol.c
===================================================================
--- uspace/lib/posix/source/stdlib/strtol.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/stdlib/strtol.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,397 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Backend for integer conversions.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "../internal/common.h"
+#include "posix/stdlib.h"
+
+#include "posix/ctype.h"
+#include "posix/errno.h"
+#include "posix/inttypes.h"
+#include "posix/limits.h"
+
+/**
+ * Decides whether a digit belongs to a particular base.
+ *
+ * @param c Character representation of the digit.
+ * @param base Base against which the digit shall be tested.
+ * @return True if the digit belongs to the base, false otherwise.
+ */
+static inline bool is_digit_in_base(int c, int base)
+{
+	if (base <= 10) {
+		return c >= '0' && c < '0' + base;
+	} else {
+		return isdigit(c) ||
+		    (tolower(c) >= 'a' && tolower(c) < ('a' + base - 10));
+	}
+}
+
+/**
+ * Derive a digit from its character representation.
+ *
+ * @param c Character representation of the digit.
+ * @return Digit value represented by an integer.
+ */
+static inline int digit_value(int c)
+{
+	if (c <= '9') {
+		return c - '0';
+	} else {
+		return 10 + tolower(c) - 'a';
+	}
+}
+
+/**
+ * Generic function for parsing an integer from it's string representation.
+ * Different variants differ in lower and upper bounds.
+ * The parsed string returned by this function is always positive, sign
+ * information is provided via a dedicated parameter.
+ *
+ * @param nptr Input string.
+ * @param endptr If non-NULL, *endptr is set to the position of the first
+ *     unrecognized character. If no digit has been parsed, value of
+ *     nptr is stored there (regardless of any skipped characters at the
+ *     beginning).
+ * @param base Expected base of the string representation. If 0, base is
+ *    determined to be decimal, octal or hexadecimal using the same rules
+ *    as C syntax. Otherwise, value must be between 2 and 36, inclusive.
+ * @param min_value Lower bound for the resulting conversion.
+ * @param max_value Upper bound for the resulting conversion.
+ * @param out_negative Either NULL for unsigned conversion or a pointer to the
+ *     bool variable into which shall be placed the negativity of the resulting
+ *     converted value.
+ * @return The absolute value of the parsed value, or the closest in-range value
+ *     if the parsed value is out of range. If the input is invalid, zero is
+ *     returned and errno is set to EINVAL.
+ */
+static inline uintmax_t internal_strtol(
+    const char *restrict nptr, char **restrict endptr, int base,
+    const intmax_t min_value, const uintmax_t max_value,
+    bool *restrict out_negative)
+{
+	if (nptr == NULL) {
+		errno = EINVAL;
+		return 0;
+	}
+	
+	if (base < 0 || base == 1 || base > 36) {
+		errno = EINVAL;
+		return 0;
+	}
+	
+	/* The maximal absolute value that can be returned in this run.
+	 * Depends on sign.
+	 */
+	uintmax_t real_max_value = max_value;
+	
+	/* Current index in the input string. */
+	size_t i = 0;
+	bool negative = false;
+	
+	/* Skip whitespace. */
+	while (isspace(nptr[i])) {
+		i++;
+	}
+	
+	/* Parse sign. */
+	switch (nptr[i]) {
+	case '-':
+		negative = true;
+		
+		/* The strange computation is are there to avoid a corner case
+		 * where -min_value can't be represented in intmax_t.
+		 * (I'm not exactly sure what the semantics are in such a
+		 *  case, but this should be safe for any case.)
+		 */
+		real_max_value = (min_value == 0)
+		    ? 0
+		    :(((uintmax_t) -(min_value + 1)) + 1);
+		
+		/* Fallthrough */
+	case '+':
+		i++;
+	}
+	
+	/* Figure out the base. */
+	switch (base) {
+	case 0:
+		if (nptr[i] == '0') {
+			if (tolower(nptr[i + 1]) == 'x') {
+				/* 0x... is hex. */
+				base = 16;
+				i += 2;
+			} else {
+				/* 0... is octal. */
+				base = 8;
+			}
+		} else {
+			/* Anything else is decimal by default. */
+			base = 10;
+		}
+		break;
+	case 16:
+		/* Allow hex number to be prefixed with "0x". */
+		if (nptr[i] == '0' && tolower(nptr[i + 1]) == 'x') {
+			i += 2;
+		}
+		break;
+	}
+	
+	if (!is_digit_in_base(nptr[i], base)) {
+		/* No digits to parse, invalid input. */
+		
+		errno = EINVAL;
+		if (endptr != NULL) {
+			*endptr = (char *) nptr;
+		}
+		return 0;
+	}
+	
+	/* Maximal value to which a digit can be added without a risk
+	 * of overflow.
+	 */
+	uintmax_t max_safe_value = (real_max_value - base + 1) / base;
+	
+	uintmax_t result = 0;
+	
+	if (real_max_value == 0) {
+		/* Special case when a negative number is parsed as
+		 * unsigned integer. Only -0 is accepted.
+		 */
+		
+		while (is_digit_in_base(nptr[i], base)) {
+			if (nptr[i] != '0') {
+				errno = ERANGE;
+				result = 0;
+			}
+			i++;
+		}
+	}
+	
+	while (is_digit_in_base(nptr[i], base)) {
+		int digit = digit_value(nptr[i]);
+		
+		if (result > max_safe_value) {
+			/* corner case, check for overflow */
+			
+			uintmax_t boundary = (real_max_value - digit) / base;
+			
+			if (result > boundary) {
+				/* overflow */
+				errno = ERANGE;
+				result = real_max_value;
+				break;
+			}
+		}
+		
+		result = result * base + digit;
+		i++;
+	}
+	
+	if (endptr != NULL) {
+		/* Move the pointer to the end of the number,
+		 * in case it isn't there already.
+		 */
+		while (is_digit_in_base(nptr[i], base)) {
+			i++;
+		}
+		
+		*endptr = (char *) &nptr[i];
+	}
+	if (out_negative != NULL) {
+		*out_negative = negative;
+	}
+	return result;
+}
+
+/**
+ * Convert a string to an integer.
+ *
+ * @param nptr Input string.
+ * @return Result of the conversion.
+ */
+int posix_atoi(const char *nptr)
+{
+	bool neg = false;
+	uintmax_t result =
+	    internal_strtol(nptr, NULL, 10, INT_MIN, INT_MAX, &neg);
+
+	return (neg ? ((int) -result) : (int) result);
+}
+
+/**
+ * Convert a string to a long integer.
+ *
+ * @param nptr Input string.
+ * @return Result of the conversion.
+ */
+long posix_atol(const char *nptr)
+{
+	bool neg = false;
+	uintmax_t result =
+	    internal_strtol(nptr, NULL, 10, LONG_MIN, LONG_MAX, &neg);
+
+	return (neg ? ((long) -result) : (long) result);
+}
+
+/**
+ * Convert a string to a long long integer.
+ *
+ * @param nptr Input string.
+ * @return Result of the conversion.
+ */
+long long posix_atoll(const char *nptr)
+{
+	bool neg = false;
+	uintmax_t result =
+	    internal_strtol(nptr, NULL, 10, LLONG_MIN, LLONG_MAX, &neg);
+
+	return (neg ? ((long long) -result) : (long long) result);
+}
+
+/**
+ * Convert a string to a long integer.
+ *
+ * @param nptr Input string.
+ * @param endptr Pointer to the final part of the string which
+ *     was not used for conversion.
+ * @param base Expected base of the string representation.
+ * @return Result of the conversion.
+ */
+long posix_strtol(const char *restrict nptr, char **restrict endptr, int base)
+{
+	bool neg = false;
+	uintmax_t result =
+	    internal_strtol(nptr, endptr, base, LONG_MIN, LONG_MAX, &neg);
+
+	return (neg ? ((long) -result) : ((long) result));
+}
+
+/**
+ * Convert a string to a long long integer.
+ *
+ * @param nptr Input string.
+ * @param endptr Pointer to the final part of the string which
+ *     was not used for conversion.
+ * @param base Expected base of the string representation.
+ * @return Result of the conversion.
+ */
+long long posix_strtoll(
+    const char *restrict nptr, char **restrict endptr, int base)
+{
+	bool neg = false;
+	uintmax_t result =
+	    internal_strtol(nptr, endptr, base, LLONG_MIN, LLONG_MAX, &neg);
+
+	return (neg ? ((long long) -result) : (long long) result);
+}
+
+/**
+ * Convert a string to a largest signed integer type.
+ *
+ * @param nptr Input string.
+ * @param endptr Pointer to the final part of the string which
+ *     was not used for conversion.
+ * @param base Expected base of the string representation.
+ * @return Result of the conversion.
+ */
+intmax_t posix_strtoimax(
+    const char *restrict nptr, char **restrict endptr, int base)
+{
+	bool neg = false;
+	uintmax_t result =
+	    internal_strtol(nptr, endptr, base, INTMAX_MIN, INTMAX_MAX, &neg);
+
+	return (neg ? ((intmax_t) -result) : (intmax_t) result);
+}
+
+/**
+ * Convert a string to an unsigned long integer.
+ *
+ * @param nptr Input string.
+ * @param endptr Pointer to the final part of the string which
+ *     was not used for conversion.
+ * @param base Expected base of the string representation.
+ * @return Result of the conversion.
+ */
+unsigned long posix_strtoul(
+    const char *restrict nptr, char **restrict endptr, int base)
+{
+	uintmax_t result =
+	    internal_strtol(nptr, endptr, base, 0, ULONG_MAX, NULL);
+
+	return (unsigned long) result;
+}
+
+/**
+ * Convert a string to an unsigned long long integer.
+ *
+ * @param nptr Input string.
+ * @param endptr Pointer to the final part of the string which
+ *     was not used for conversion.
+ * @param base Expected base of the string representation.
+ * @return Result of the conversion.
+ */
+unsigned long long posix_strtoull(
+    const char *restrict nptr, char **restrict endptr, int base)
+{
+	uintmax_t result =
+	    internal_strtol(nptr, endptr, base, 0, ULLONG_MAX, NULL);
+
+	return (unsigned long long) result;
+}
+
+/**
+ * Convert a string to a largest unsigned integer type.
+ *
+ * @param nptr Input string.
+ * @param endptr Pointer to the final part of the string which
+ *     was not used for conversion.
+ * @param base Expected base of the string representation.
+ * @return Result of the conversion.
+ */
+uintmax_t posix_strtoumax(
+    const char *restrict nptr, char **restrict endptr, int base)
+{
+	uintmax_t result =
+	    internal_strtol(nptr, endptr, base, 0, UINTMAX_MAX, NULL);
+
+	return result;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/stdlib/strtold.c
===================================================================
--- uspace/lib/posix/source/stdlib/strtold.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/stdlib/strtold.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,490 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Backend for floating point conversions.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "../internal/common.h"
+#include "libc/stdbool.h"
+#include "posix/stdlib.h"
+
+#include "posix/assert.h"
+#include "posix/ctype.h"
+#include "posix/stdint.h"
+#include "posix/strings.h"
+#include "posix/errno.h"
+#include "posix/limits.h"
+
+#include "posix/float.h"
+
+#ifndef HUGE_VALL
+	#define HUGE_VALL (+1.0l / +0.0l)
+#endif
+
+#ifndef abs
+	#define abs(x) (((x) < 0) ? -(x) : (x))
+#endif
+
+/* If the constants are not defined, use double precision as default. */
+#ifndef LDBL_MANT_DIG
+	#define LDBL_MANT_DIG 53
+#endif
+#ifndef LDBL_MAX_EXP
+	#define LDBL_MAX_EXP 1024
+#endif
+#ifndef LDBL_MIN_EXP
+	#define LDBL_MIN_EXP (-1021)
+#endif
+#ifndef LDBL_DIG
+	#define LDBL_DIG 15
+#endif
+#ifndef LDBL_MIN
+	#define LDBL_MIN 2.2250738585072014E-308
+#endif
+
+/* power functions ************************************************************/
+
+#if LDBL_MAX_EXP >= 16384
+const int MAX_POW5 = 12;
+#else
+const int MAX_POW5 = 8;
+#endif
+
+/* The value at index i is approximately 5**(2**i). */
+long double pow5[] = {
+	0x5p0l,
+	0x19p0l,
+	0x271p0l,
+	0x5F5E1p0l,
+	0x2386F26FC1p0l,
+	0x4EE2D6D415B85ACEF81p0l,
+	0x184F03E93FF9F4DAA797ED6E38ED6p36l,
+	0x127748F9301D319BF8CDE66D86D62p185l,
+	0x154FDD7F73BF3BD1BBB77203731FDp482l,
+#if LDBL_MAX_EXP >= 16384
+	0x1C633415D4C1D238D98CAB8A978A0p1076l,
+	0x192ECEB0D02EA182ECA1A7A51E316p2265l,
+	0x13D1676BB8A7ABBC94E9A519C6535p4643l,
+	0x188C0A40514412F3592982A7F0094p9398l,
+#endif
+};
+
+#if LDBL_MAX_EXP >= 16384
+const int MAX_POW2 = 15;
+#else
+const int MAX_POW2 = 9;
+#endif
+
+/* Powers of two. */
+long double pow2[] = {
+	0x1P1l,
+	0x1P2l,
+	0x1P4l,
+	0x1P8l,
+	0x1P16l,
+	0x1P32l,
+	0x1P64l,
+	0x1P128l,
+	0x1P256l,
+	0x1P512l,
+#if LDBL_MAX_EXP >= 16384
+	0x1P1024l,
+	0x1P2048l,
+	0x1P4096l,
+	0x1P8192l,
+#endif
+};
+
+/**
+ * Multiplies a number by a power of five.
+ * The result may be inexact and may not be the best possible approximation.
+ *
+ * @param mant Number to be multiplied.
+ * @param exp Base 5 exponent.
+ * @return mant multiplied by 5**exp
+ */
+static long double mul_pow5(long double mant, int exp)
+{
+	if (mant == 0.0l || mant == HUGE_VALL) {
+		return mant;
+	}
+	
+	if (abs(exp) >> (MAX_POW5 + 1) != 0) {
+		/* Too large exponent. */
+		errno = ERANGE;
+		return exp < 0 ? LDBL_MIN : HUGE_VALL;
+	}
+	
+	if (exp < 0) {
+		exp = abs(exp);
+		for (int bit = 0; bit <= MAX_POW5; ++bit) {
+			/* Multiply by powers of five bit-by-bit. */
+			if (((exp >> bit) & 1) != 0) {
+				mant /= pow5[bit];
+				if (mant == 0.0l) {
+					/* Underflow. */
+					mant = LDBL_MIN;
+					errno = ERANGE;
+					break;
+				}
+			}
+		}
+	} else {
+		for (int bit = 0; bit <= MAX_POW5; ++bit) {
+			/* Multiply by powers of five bit-by-bit. */
+			if (((exp >> bit) & 1) != 0) {
+				mant *= pow5[bit];
+				if (mant == HUGE_VALL) {
+					/* Overflow. */
+					errno = ERANGE;
+					break;
+				}
+			}
+		}
+	}
+	
+	return mant;
+}
+
+/**
+ * Multiplies a number by a power of two. This is always exact.
+ *
+ * @param mant Number to be multiplied.
+ * @param exp Base 2 exponent.
+ * @return mant multiplied by 2**exp.
+ */
+static long double mul_pow2(long double mant, int exp)
+{
+	if (mant == 0.0l || mant == HUGE_VALL) {
+		return mant;
+	}
+	
+	if (exp > LDBL_MAX_EXP || exp < LDBL_MIN_EXP) {
+		errno = ERANGE;
+		return exp < 0 ? LDBL_MIN : HUGE_VALL;
+	}
+	
+	if (exp < 0) {
+		exp = abs(exp);
+		for (int i = 0; i <= MAX_POW2; ++i) {
+			if (((exp >> i) & 1) != 0) {
+				mant /= pow2[i];
+				if (mant == 0.0l) {
+					mant = LDBL_MIN;
+					errno = ERANGE;
+					break;
+				}
+			}
+		}
+	} else {
+		for (int i = 0; i <= MAX_POW2; ++i) {
+			if (((exp >> i) & 1) != 0) {
+				mant *= pow2[i];
+				if (mant == HUGE_VALL) {
+					errno = ERANGE;
+					break;
+				}
+			}
+		}
+	}
+	
+	return mant;
+}
+
+/* end power functions ********************************************************/
+
+
+
+/**
+ * Convert decimal string representation of the floating point number.
+ * Function expects the string pointer to be already pointed at the first
+ * digit (i.e. leading optional sign was already consumed by the caller).
+ * 
+ * @param sptr Pointer to the storage of the string pointer. Upon successful
+ *     conversion, the string pointer is updated to point to the first
+ *     unrecognized character.
+ * @return An approximate representation of the input floating-point number.
+ */
+static long double parse_decimal(const char **sptr)
+{
+	assert(sptr != NULL);
+	assert (*sptr != NULL);
+	
+	const int DEC_BASE = 10;
+	const char DECIMAL_POINT = '.';
+	const char EXPONENT_MARK = 'e';
+	
+	const char *str = *sptr;
+	long double significand = 0;
+	long exponent = 0;
+	
+	/* number of digits parsed so far */
+	int parsed_digits = 0;
+	bool after_decimal = false;
+	
+	while (isdigit(*str) || (!after_decimal && *str == DECIMAL_POINT)) {
+		if (*str == DECIMAL_POINT) {
+			after_decimal = true;
+			str++;
+			continue;
+		}
+		
+		if (parsed_digits == 0 && *str == '0') {
+			/* Nothing, just skip leading zeros. */
+		} else if (parsed_digits < LDBL_DIG) {
+			significand = significand * DEC_BASE + (*str - '0');
+			parsed_digits++;
+		} else {
+			exponent++;
+		}
+		
+		if (after_decimal) {
+			/* Decrement exponent if we are parsing the fractional part. */
+			exponent--;
+		}
+		
+		str++;
+	}
+	
+	/* exponent */
+	if (tolower(*str) == EXPONENT_MARK) {
+		str++;
+		
+		/* Returns MIN/MAX value on error, which is ok. */
+		long exp = strtol(str, (char **) &str, DEC_BASE);
+		
+		if (exponent > 0 && exp > LONG_MAX - exponent) {
+			exponent = LONG_MAX;
+		} else if (exponent < 0 && exp < LONG_MIN - exponent) {
+			exponent = LONG_MIN;
+		} else {
+			exponent += exp;
+		}
+	}
+	
+	*sptr = str;
+	
+	/* Return multiplied by a power of ten. */
+	return mul_pow2(mul_pow5(significand, exponent), exponent);
+}
+
+/**
+ * Derive a hexadecimal digit from its character representation.
+ * 
+ * @param ch Character representation of the hexadecimal digit.
+ * @return Digit value represented by an integer.
+ */
+static inline int hex_value(char ch)
+{
+	if (ch <= '9') {
+		return ch - '0';
+	} else {
+		return 10 + tolower(ch) - 'a';
+	}
+}
+
+/**
+ * Convert hexadecimal string representation of the floating point number.
+ * Function expects the string pointer to be already pointed at the first
+ * digit (i.e. leading optional sign and 0x prefix were already consumed
+ * by the caller).
+ *
+ * @param sptr Pointer to the storage of the string pointer. Upon successful
+ *     conversion, the string pointer is updated to point to the first
+ *     unrecognized character.
+ * @return Representation of the input floating-point number.
+ */
+static long double parse_hexadecimal(const char **sptr)
+{
+	assert(sptr != NULL && *sptr != NULL);
+	
+	const int DEC_BASE = 10;
+	const int HEX_BASE = 16;
+	const char DECIMAL_POINT = '.';
+	const char EXPONENT_MARK = 'p';
+	
+	const char *str = *sptr;
+	long double significand = 0;
+	long exponent = 0;
+	
+	/* number of bits parsed so far */
+	int parsed_bits = 0;
+	bool after_decimal = false;
+	
+	while (posix_isxdigit(*str) || (!after_decimal && *str == DECIMAL_POINT)) {
+		if (*str == DECIMAL_POINT) {
+			after_decimal = true;
+			str++;
+			continue;
+		}
+		
+		if (parsed_bits == 0 && *str == '0') {
+			/* Nothing, just skip leading zeros. */
+		} else if (parsed_bits <= LDBL_MANT_DIG) {
+			significand = significand * HEX_BASE + hex_value(*str);
+			parsed_bits += 4;
+		} else {
+			exponent += 4;
+		}
+		
+		if (after_decimal) {
+			exponent -= 4;
+		}
+		
+		str++;
+	}
+	
+	/* exponent */
+	if (tolower(*str) == EXPONENT_MARK) {
+		str++;
+		
+		/* Returns MIN/MAX value on error, which is ok. */
+		long exp = strtol(str, (char **) &str, DEC_BASE);
+		
+		if (exponent > 0 && exp > LONG_MAX - exponent) {
+			exponent = LONG_MAX;
+		} else if (exponent < 0 && exp < LONG_MIN - exponent) {
+			exponent = LONG_MIN;
+		} else {
+			exponent += exp;
+		}
+	}
+	
+	*sptr = str;
+	
+	/* Return multiplied by a power of two. */
+	return mul_pow2(significand, exponent);
+}
+
+/**
+ * Converts a string representation of a floating-point number to
+ * its native representation. Largely POSIX compliant, except for
+ * locale differences (always uses '.' at the moment) and rounding.
+ * Decimal strings are NOT guaranteed to be correctly rounded. This function
+ * should return a good enough approximation for most purposes but if you
+ * depend on a precise conversion, use hexadecimal representation.
+ * Hexadecimal strings are currently always rounded towards zero, regardless
+ * of the current rounding mode.
+ *
+ * @param nptr Input string.
+ * @param endptr If non-NULL, *endptr is set to the position of the first
+ *     unrecognized character.
+ * @return An approximate representation of the input floating-point number.
+ */
+long double posix_strtold(const char *restrict nptr, char **restrict endptr)
+{
+	assert(nptr != NULL);
+	
+	const int RADIX = '.';
+	
+	/* minus sign */
+	bool negative = false;
+	/* current position in the string */
+	int i = 0;
+	
+	/* skip whitespace */
+	while (isspace(nptr[i])) {
+		i++;
+	}
+	
+	/* parse sign */
+	switch (nptr[i]) {
+	case '-':
+		negative = true;
+		/* Fallthrough */
+	case '+':
+		i++;
+	}
+	
+	/* check for NaN */
+	if (posix_strncasecmp(&nptr[i], "nan", 3) == 0) {
+		// FIXME: return NaN
+		// TODO: handle the parenthesised case
+		
+		if (endptr != NULL) {
+			*endptr = (char *) nptr;
+		}
+		errno = EINVAL;
+		return 0;
+	}
+	
+	/* check for Infinity */
+	if (posix_strncasecmp(&nptr[i], "inf", 3) == 0) {
+		i += 3;
+		if (posix_strncasecmp(&nptr[i], "inity", 5) == 0) {
+			i += 5;
+		}
+		
+		if (endptr != NULL) {
+			*endptr = (char *) &nptr[i];
+		}
+		return negative ? -HUGE_VALL : +HUGE_VALL;
+	}
+
+	/* check for a hex number */
+	if (nptr[i] == '0' && tolower(nptr[i + 1]) == 'x' &&
+	    (posix_isxdigit(nptr[i + 2]) ||
+	    (nptr[i + 2] == RADIX && posix_isxdigit(nptr[i + 3])))) {
+		i += 2;
+		
+		const char *ptr = &nptr[i];
+		/* this call sets errno if appropriate. */
+		long double result = parse_hexadecimal(&ptr);
+		if (endptr != NULL) {
+			*endptr = (char *) ptr;
+		}
+		return negative ? -result : result;
+	}
+	
+	/* check for a decimal number */
+	if (isdigit(nptr[i]) || (nptr[i] == RADIX && isdigit(nptr[i + 1]))) {
+		const char *ptr = &nptr[i];
+		/* this call sets errno if appropriate. */
+		long double result = parse_decimal(&ptr);
+		if (endptr != NULL) {
+			*endptr = (char *) ptr;
+		}
+		return negative ? -result : result;
+	}
+	
+	/* nothing to parse */
+	if (endptr != NULL) {
+		*endptr = (char *) nptr;
+	}
+	errno = EINVAL;
+	return 0;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/string.c
===================================================================
--- uspace/lib/posix/source/string.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/string.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,808 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file String manipulation.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "internal/common.h"
+#include "posix/string.h"
+
+#include "posix/assert.h"
+#include "posix/errno.h"
+#include "posix/limits.h"
+#include "posix/stdlib.h"
+#include "posix/signal.h"
+
+#include "libc/str_error.h"
+
+/**
+ * The same as strpbrk, except it returns pointer to the nul terminator
+ * if no occurence is found.
+ *
+ * @param s1 String in which to look for the bytes.
+ * @param s2 String of bytes to look for.
+ * @return Pointer to the found byte on success, pointer to the
+ *     string terminator otherwise.
+ */
+static char *strpbrk_null(const char *s1, const char *s2)
+{
+	while (!posix_strchr(s2, *s1)) {
+		++s1;
+	}
+	
+	return (char *) s1;
+}
+
+/**
+ * Copy a string.
+ *
+ * @param dest Destination pre-allocated buffer.
+ * @param src Source string to be copied.
+ * @return Pointer to the destination buffer.
+ */
+char *posix_strcpy(char *restrict dest, const char *restrict src)
+{
+	posix_stpcpy(dest, src);
+	return dest;
+}
+
+/**
+ * Copy fixed length string.
+ *
+ * @param dest Destination pre-allocated buffer.
+ * @param src Source string to be copied.
+ * @param n Number of bytes to be stored into destination buffer.
+ * @return Pointer to the destination buffer.
+ */
+char *posix_strncpy(char *restrict dest, const char *restrict src, size_t n)
+{
+	posix_stpncpy(dest, src, n);
+	return dest;
+}
+
+/**
+ * Copy a string.
+ *
+ * @param dest Destination pre-allocated buffer.
+ * @param src Source string to be copied.
+ * @return Pointer to the nul character in the destination string.
+ */
+char *posix_stpcpy(char *restrict dest, const char *restrict src)
+{
+	assert(dest != NULL);
+	assert(src != NULL);
+
+	for (size_t i = 0; ; ++i) {
+		dest[i] = src[i];
+		
+		if (src[i] == '\0') {
+			/* pointer to the terminating nul character */
+			return &dest[i];
+		}
+	}
+	
+	/* unreachable */
+	return NULL;
+}
+
+/**
+ * Copy fixed length string.
+ *
+ * @param dest Destination pre-allocated buffer.
+ * @param src Source string to be copied.
+ * @param n Number of bytes to be stored into destination buffer.
+ * @return Pointer to the first written nul character or &dest[n].
+ */
+char *posix_stpncpy(char *restrict dest, const char *restrict src, size_t n)
+{
+	assert(dest != NULL);
+	assert(src != NULL);
+
+	for (size_t i = 0; i < n; ++i) {
+		dest[i] = src[i];
+	
+		/* the standard requires that nul characters
+		 * are appended to the length of n, in case src is shorter
+		 */
+		if (src[i] == '\0') {
+			char *result = &dest[i];
+			for (++i; i < n; ++i) {
+				dest[i] = '\0';
+			}
+			return result;
+		}
+	}
+	
+	return &dest[n];
+}
+
+/**
+ * Concatenate two strings.
+ *
+ * @param dest String to which src shall be appended.
+ * @param src String to be appended after dest.
+ * @return Pointer to destination buffer.
+ */
+char *posix_strcat(char *restrict dest, const char *restrict src)
+{
+	assert(dest != NULL);
+	assert(src != NULL);
+
+	posix_strcpy(posix_strchr(dest, '\0'), src);
+	return dest;
+}
+
+/**
+ * Concatenate a string with part of another.
+ *
+ * @param dest String to which part of src shall be appended.
+ * @param src String whose part shall be appended after dest.
+ * @param n Number of bytes to append after dest.
+ * @return Pointer to destination buffer.
+ */
+char *posix_strncat(char *restrict dest, const char *restrict src, size_t n)
+{
+	assert(dest != NULL);
+	assert(src != NULL);
+
+	char *zeroptr = posix_strncpy(posix_strchr(dest, '\0'), src, n);
+	/* strncpy doesn't append the nul terminator, so we do it here */
+	zeroptr[n] = '\0';
+	return dest;
+}
+
+/**
+ * Copy limited number of bytes in memory.
+ *
+ * @param dest Destination buffer.
+ * @param src Source buffer.
+ * @param c Character after which the copying shall stop.
+ * @param n Number of bytes that shall be copied if not stopped earlier by c.
+ * @return Pointer to the first byte after c in dest if found, NULL otherwise.
+ */
+void *posix_memccpy(void *restrict dest, const void *restrict src, int c, size_t n)
+{
+	assert(dest != NULL);
+	assert(src != NULL);
+	
+	unsigned char* bdest = dest;
+	const unsigned char* bsrc = src;
+	
+	for (size_t i = 0; i < n; ++i) {
+		bdest[i] = bsrc[i];
+	
+		if (bsrc[i] == (unsigned char) c) {
+			/* pointer to the next byte */
+			return &bdest[i + 1];
+		}
+	}
+	
+	return NULL;
+}
+
+/**
+ * Duplicate a string.
+ *
+ * @param s String to be duplicated.
+ * @return Newly allocated copy of the string.
+ */
+char *posix_strdup(const char *s)
+{
+	return posix_strndup(s, SIZE_MAX);
+}
+
+/**
+ * Duplicate a specific number of bytes from a string.
+ *
+ * @param s String to be duplicated.
+ * @param n Maximum length of the resulting string..
+ * @return Newly allocated string copy of length at most n.
+ */
+char *posix_strndup(const char *s, size_t n)
+{
+	assert(s != NULL);
+
+	size_t len = posix_strnlen(s, n);
+	char *dup = malloc(len + 1);
+	if (dup == NULL) {
+		return NULL;
+	}
+
+	memcpy(dup, s, len);
+	dup[len] = '\0';
+
+	return dup;
+}
+
+/**
+ * Compare bytes in memory.
+ *
+ * @param mem1 First area of memory to be compared.
+ * @param mem2 Second area of memory to be compared.
+ * @param n Maximum number of bytes to be compared.
+ * @return Difference of the first pair of inequal bytes,
+ *     or 0 if areas have the same content.
+ */
+int posix_memcmp(const void *mem1, const void *mem2, size_t n)
+{
+	assert(mem1 != NULL);
+	assert(mem2 != NULL);
+
+	const unsigned char *s1 = mem1;
+	const unsigned char *s2 = mem2;
+	
+	for (size_t i = 0; i < n; ++i) {
+		if (s1[i] != s2[i]) {
+			return s1[i] - s2[i];
+		}
+	}
+	
+	return 0;
+}
+
+/**
+ * Compare two strings.
+ *
+ * @param s1 First string to be compared.
+ * @param s2 Second string to be compared.
+ * @return Difference of the first pair of inequal characters,
+ *     or 0 if strings have the same content.
+ */
+int posix_strcmp(const char *s1, const char *s2)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	return posix_strncmp(s1, s2, STR_NO_LIMIT);
+}
+
+/**
+ * Compare part of two strings.
+ *
+ * @param s1 First string to be compared.
+ * @param s2 Second string to be compared.
+ * @param n Maximum number of characters to be compared.
+ * @return Difference of the first pair of inequal characters,
+ *     or 0 if strings have the same content.
+ */
+int posix_strncmp(const char *s1, const char *s2, size_t n)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	for (size_t i = 0; i < n; ++i) {
+		if (s1[i] != s2[i]) {
+			return s1[i] - s2[i];
+		}
+		if (s1[i] == '\0') {
+			break;
+		}
+	}
+
+	return 0;
+}
+
+/**
+ * Find byte in memory.
+ *
+ * @param mem Memory area in which to look for the byte.
+ * @param c Byte to look for.
+ * @param n Maximum number of bytes to be inspected.
+ * @return Pointer to the specified byte on success,
+ *     NULL pointer otherwise.
+ */
+void *posix_memchr(const void *mem, int c, size_t n)
+{
+	assert(mem != NULL);
+	
+	const unsigned char *s = mem;
+	
+	for (size_t i = 0; i < n; ++i) {
+		if (s[i] == (unsigned char) c) {
+			return (void *) &s[i];
+		}
+	}
+	return NULL;
+}
+
+/**
+ * Scan string for a first occurence of a character.
+ *
+ * @param s String in which to look for the character.
+ * @param c Character to look for.
+ * @return Pointer to the specified character on success,
+ *     NULL pointer otherwise.
+ */
+char *posix_strchr(const char *s, int c)
+{
+	assert(s != NULL);
+	
+	char *res = gnu_strchrnul(s, c);
+	return (*res == c) ? res : NULL;
+}
+
+/**
+ * Scan string for a last occurence of a character.
+ *
+ * @param s String in which to look for the character.
+ * @param c Character to look for.
+ * @return Pointer to the specified character on success,
+ *     NULL pointer otherwise.
+ */
+char *posix_strrchr(const char *s, int c)
+{
+	assert(s != NULL);
+	
+	const char *ptr = posix_strchr(s, '\0');
+	
+	/* the same as in strchr, except it loops in reverse direction */
+	while (*ptr != (char) c) {
+		if (ptr == s) {
+			return NULL;
+		}
+
+		ptr--;
+	}
+
+	return (char *) ptr;
+}
+
+/**
+ * Scan string for a first occurence of a character.
+ *
+ * @param s String in which to look for the character.
+ * @param c Character to look for.
+ * @return Pointer to the specified character on success, pointer to the
+ *     string terminator otherwise.
+ */
+char *gnu_strchrnul(const char *s, int c)
+{
+	assert(s != NULL);
+	
+	while (*s != c && *s != '\0') {
+		s++;
+	}
+	
+	return (char *) s;
+}
+
+/**
+ * Scan a string for a first occurence of one of provided bytes.
+ *
+ * @param s1 String in which to look for the bytes.
+ * @param s2 String of bytes to look for.
+ * @return Pointer to the found byte on success,
+ *     NULL pointer otherwise.
+ */
+char *posix_strpbrk(const char *s1, const char *s2)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	char *ptr = strpbrk_null(s1, s2);
+	return (*ptr == '\0') ? NULL : ptr;
+}
+
+/**
+ * Get the length of a complementary substring.
+ *
+ * @param s1 String that shall be searched for complementary prefix.
+ * @param s2 String of bytes that shall not occur in the prefix.
+ * @return Length of the prefix.
+ */
+size_t posix_strcspn(const char *s1, const char *s2)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	char *ptr = strpbrk_null(s1, s2);
+	return (size_t) (ptr - s1);
+}
+
+/**
+ * Get length of a substring.
+ *
+ * @param s1 String that shall be searched for prefix.
+ * @param s2 String of bytes that the prefix must consist of.
+ * @return Length of the prefix.
+ */
+size_t posix_strspn(const char *s1, const char *s2)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	const char *ptr;
+	for (ptr = s1; *ptr != '\0'; ++ptr) {
+		if (!posix_strchr(s2, *ptr)) {
+			break;
+		}
+	}
+	return ptr - s1;
+}
+
+/**
+ * Find a substring. Uses Knuth-Morris-Pratt algorithm.
+ *
+ * @param s1 String in which to look for a substring.
+ * @param s2 Substring to look for.
+ * @return Pointer to the first character of the substring in s1, or NULL if
+ *     not found.
+ */
+char *posix_strstr(const char *haystack, const char *needle)
+{
+	assert(haystack != NULL);
+	assert(needle != NULL);
+	
+	/* Special case - needle is an empty string. */
+	if (needle[0] == '\0') {
+		return (char *) haystack;
+	}
+	
+	/* Preprocess needle. */
+	size_t nlen = posix_strlen(needle);
+	size_t prefix_table[nlen + 1];
+	
+	{
+		size_t i = 0;
+		ssize_t j = -1;
+		
+		prefix_table[i] = j;
+		
+		while (i < nlen) {
+			while (j >= 0 && needle[i] != needle[j]) {
+				j = prefix_table[j];
+			}
+			i++; j++;
+			prefix_table[i] = j;
+		}
+	}
+	
+	/* Search needle using the precomputed table. */
+	size_t npos = 0;
+	
+	for (size_t hpos = 0; haystack[hpos] != '\0'; ++hpos) {
+		while (npos != 0 && haystack[hpos] != needle[npos]) {
+			npos = prefix_table[npos];
+		}
+		
+		if (haystack[hpos] == needle[npos]) {
+			npos++;
+			
+			if (npos == nlen) {
+				return (char *) (haystack + hpos - nlen + 1);
+			}
+		}
+	}
+	
+	return NULL;
+}
+
+/** Split string by delimiters.
+ *
+ * @param s             String to be tokenized. May not be NULL.
+ * @param delim		String with the delimiters.
+ * @return              Pointer to the prefix of @a s before the first
+ *                      delimiter character. NULL if no such prefix
+ *                      exists.
+ */
+char *posix_strtok(char *s, const char *delim)
+{
+	static char *next;
+
+	return posix_strtok_r(s, delim, &next);
+}
+
+
+/** Split string by delimiters.
+ *
+ * @param s             String to be tokenized. May not be NULL.
+ * @param delim		String with the delimiters.
+ * @param next		Variable which will receive the pointer to the
+ *                      continuation of the string following the first
+ *                      occurrence of any of the delimiter characters.
+ *                      May be NULL.
+ * @return              Pointer to the prefix of @a s before the first
+ *                      delimiter character. NULL if no such prefix
+ *                      exists.
+ */
+char *posix_strtok_r(char *s, const char *delim, char **next)
+{
+	char *start, *end;
+
+	if (s == NULL)
+		s = *next;
+
+	/* Skip over leading delimiters. */
+	while (*s && (posix_strchr(delim, *s) != NULL)) ++s;
+	start = s;
+
+	/* Skip over token characters. */
+	while (*s && (posix_strchr(delim, *s) == NULL)) ++s;
+	end = s;
+	*next = (*s ? s + 1 : s);
+
+	if (start == end) {
+		return NULL;	/* No more tokens. */
+	}
+
+	/* Overwrite delimiter with NULL terminator. */
+	*end = '\0';
+	return start;
+}
+
+/**
+ * String comparison using collating information.
+ *
+ * Currently ignores locale and just calls strcmp.
+ *
+ * @param s1 First string to be compared.
+ * @param s2 Second string to be compared.
+ * @return Difference of the first pair of inequal characters,
+ *     or 0 if strings have the same content.
+ */
+int posix_strcoll(const char *s1, const char *s2)
+{
+	assert(s1 != NULL);
+	assert(s2 != NULL);
+
+	return posix_strcmp(s1, s2);
+}
+
+/**
+ * Transform a string in such a way that the resulting string yields the same
+ * results when passed to the strcmp as if the original string is passed to
+ * the strcoll.
+ *
+ * Since strcoll is equal to strcmp here, this just makes a copy.
+ *
+ * @param s1 Transformed string.
+ * @param s2 Original string.
+ * @param n Maximum length of the transformed string.
+ * @return Length of the transformed string.
+ */
+size_t posix_strxfrm(char *restrict s1, const char *restrict s2, size_t n)
+{
+	assert(s1 != NULL || n == 0);
+	assert(s2 != NULL);
+
+	size_t len = posix_strlen(s2);
+
+	if (n > len) {
+		posix_strcpy(s1, s2);
+	}
+
+	return len;
+}
+
+/**
+ * Get error message string.
+ *
+ * @param errnum Error code for which to obtain human readable string.
+ * @return Error message.
+ */
+char *posix_strerror(int errnum)
+{
+	static const char *error_msgs[] = {
+		[E2BIG] = "[E2BIG] Argument list too long",
+		[EACCES] = "[EACCES] Permission denied",
+		[EADDRINUSE] = "[EADDRINUSE] Address in use",
+		[EADDRNOTAVAIL] = "[EADDRNOTAVAIL] Address not available",
+		[EAFNOSUPPORT] = "[EAFNOSUPPORT] Address family not supported",
+		[EAGAIN] = "[EAGAIN] Resource unavailable, try again",
+		[EALREADY] = "[EALREADY] Connection already in progress",
+		[EBADF] = "[EBADF] Bad file descriptor",
+		[EBADMSG] = "[EBADMSG] Bad message",
+		[EBUSY] = "[EBUSY] Device or resource busy",
+		[ECANCELED] = "[ECANCELED] Operation canceled",
+		[ECHILD] = "[ECHILD] No child processes",
+		[ECONNABORTED] = "[ECONNABORTED] Connection aborted",
+		[ECONNREFUSED] = "[ECONNREFUSED] Connection refused",
+		[ECONNRESET] = "[ECONNRESET] Connection reset",
+		[EDEADLK] = "[EDEADLK] Resource deadlock would occur",
+		[EDESTADDRREQ] = "[EDESTADDRREQ] Destination address required",
+		[EDOM] = "[EDOM] Mathematics argument out of domain of function",
+		[EDQUOT] = "[EDQUOT] Reserved",
+		[EEXIST] = "[EEXIST] File exists",
+		[EFAULT] = "[EFAULT] Bad address",
+		[EFBIG] = "[EFBIG] File too large",
+		[EHOSTUNREACH] = "[EHOSTUNREACH] Host is unreachable",
+		[EIDRM] = "[EIDRM] Identifier removed",
+		[EILSEQ] = "[EILSEQ] Illegal byte sequence",
+		[EINPROGRESS] = "[EINPROGRESS] Operation in progress",
+		[EINTR] = "[EINTR] Interrupted function",
+		[EINVAL] = "[EINVAL] Invalid argument",
+		[EIO] = "[EIO] I/O error",
+		[EISCONN] = "[EISCONN] Socket is connected",
+		[EISDIR] = "[EISDIR] Is a directory",
+		[ELOOP] = "[ELOOP] Too many levels of symbolic links",
+		[EMFILE] = "[EMFILE] File descriptor value too large",
+		[EMLINK] = "[EMLINK] Too many links",
+		[EMSGSIZE] = "[EMSGSIZE] Message too large",
+		[EMULTIHOP] = "[EMULTIHOP] Reserved",
+		[ENAMETOOLONG] = "[ENAMETOOLONG] Filename too long",
+		[ENETDOWN] = "[ENETDOWN] Network is down",
+		[ENETRESET] = "[ENETRESET] Connection aborted by network",
+		[ENETUNREACH] = "[ENETUNREACH] Network unreachable",
+		[ENFILE] = "[ENFILE] Too many files open in system",
+		[ENOBUFS] = "[ENOBUFS] No buffer space available",
+		[ENODATA] = "[ENODATA] No message is available on the STREAM head read queue",
+		[ENODEV] = "[ENODEV] No such device",
+		[ENOENT] = "[ENOENT] No such file or directory",
+		[ENOEXEC] = "[ENOEXEC] Executable file format error",
+		[ENOLCK] = "[ENOLCK] No locks available",
+		[ENOLINK] = "[ENOLINK] Reserved",
+		[ENOMEM] = "[ENOMEM] Not enough space",
+		[ENOMSG] = "[ENOMSG] No message of the desired type",
+		[ENOPROTOOPT] = "[ENOPROTOOPT] Protocol not available",
+		[ENOSPC] = "[ENOSPC] No space left on device",
+		[ENOSR] = "[ENOSR] No STREAM resources.",
+		[ENOSTR] = "[ENOSTR] Not a STREAM",
+		[ENOSYS] = "[ENOSYS] Function not supported",
+		[ENOTCONN] = "[ENOTCONN] The socket is not connected",
+		[ENOTDIR] = "[ENOTDIR] Not a directory",
+		[ENOTEMPTY] = "[ENOTEMPTY] Directory not empty",
+		[ENOTRECOVERABLE] = "[ENOTRECOVERABLE] State not recoverable",
+		[ENOTSOCK] = "[ENOTSOCK] Not a socket",
+		[ENOTSUP] = "[ENOTSUP] Not supported",
+		[ENOTTY] = "[ENOTTY] Inappropriate I/O control operation",
+		[ENXIO] = "[ENXIO] No such device or address",
+		[EOPNOTSUPP] = "[EOPNOTSUPP] Operation not supported",
+		[EOVERFLOW] = "[EOVERFLOW] Value too large to be stored in data type",
+		[EOWNERDEAD] = "[EOWNERDEAD] Previous owned died",
+		[EPERM] = "[EPERM] Operation not permitted",
+		[EPIPE] = "[EPIPE] Broken pipe",
+		[EPROTO] = "[EPROTO] Protocol error",
+		[EPROTONOSUPPORT] = "[EPROTONOSUPPORT] Protocol not supported",
+		[EPROTOTYPE] = "[EPROTOTYPE] Protocol wrong type for socket",
+		[ERANGE] = "[ERANGE] Result too large",
+		[EROFS] = "[EROFS] Read-only file system",
+		[ESPIPE] = "[ESPIPE] Invalid seek",
+		[ESRCH] = "[ESRCH] No such process",
+		[ESTALE] = "[ESTALE] Reserved",
+		[ETIME] = "[ETIME] Stream ioctl() timeout",
+		[ETIMEDOUT] = "[ETIMEDOUT] Connection timed out",
+		[ETXTBSY] = "[ETXTBSY] Text file busy",
+		[EWOULDBLOCK] = "[EWOULDBLOCK] Operation would block",
+		[EXDEV] = "[EXDEV] Cross-device link",
+	};
+
+	return (char *) error_msgs[posix_abs(errnum)];
+}
+
+/**
+ * Get error message string.
+ *
+ * @param errnum Error code for which to obtain human readable string.
+ * @param buf Buffer to store a human readable string to.
+ * @param bufsz Size of buffer pointed to by buf.
+ * @return Zero on success, errno otherwise.
+ */
+int posix_strerror_r(int errnum, char *buf, size_t bufsz)
+{
+	assert(buf != NULL);
+	
+	char *errstr = posix_strerror(errnum);
+	
+	if (posix_strlen(errstr) + 1 > bufsz) {
+		return ERANGE;
+	} else {
+		posix_strcpy(buf, errstr);
+	}
+
+	return 0;
+}
+
+/**
+ * Get length of the string.
+ *
+ * @param s String which length shall be determined.
+ * @return Length of the string.
+ */
+size_t posix_strlen(const char *s)
+{
+	assert(s != NULL);
+	
+	return (size_t) (posix_strchr(s, '\0') - s);
+}
+
+/**
+ * Get limited length of the string.
+ *
+ * @param s String which length shall be determined.
+ * @param n Maximum number of bytes that can be examined to determine length.
+ * @return The lower of either string length or n limit.
+ */
+size_t posix_strnlen(const char *s, size_t n)
+{
+	assert(s != NULL);
+	
+	for (size_t sz = 0; sz < n; ++sz) {
+		
+		if (s[sz] == '\0') {
+			return sz;
+		}
+	}
+	
+	return n;
+}
+
+/**
+ * Get description of a signal.
+ *
+ * @param signum Signal number.
+ * @return Human readable signal description.
+ */
+char *posix_strsignal(int signum)
+{
+	static const char *const sigstrings[] = {
+		[SIGABRT] = "SIGABRT (Process abort signal)",
+		[SIGALRM] = "SIGALRM (Alarm clock)",
+		[SIGBUS] = "SIGBUS (Access to an undefined portion of a memory object)",
+		[SIGCHLD] = "SIGCHLD (Child process terminated, stopped, or continued)",
+		[SIGCONT] = "SIGCONT (Continue executing, if stopped)",
+		[SIGFPE] = "SIGFPE (Erroneous arithmetic operation)",
+		[SIGHUP] = "SIGHUP (Hangup)",
+		[SIGILL] = "SIGILL (Illegal instruction)",
+		[SIGINT] = "SIGINT (Terminal interrupt signal)",
+		[SIGKILL] = "SIGKILL (Kill process)",
+		[SIGPIPE] = "SIGPIPE (Write on a pipe with no one to read it)",
+		[SIGQUIT] = "SIGQUIT (Terminal quit signal)",
+		[SIGSEGV] = "SIGSEGV (Invalid memory reference)",
+		[SIGSTOP] = "SIGSTOP (Stop executing)",
+		[SIGTERM] = "SIGTERM (Termination signal)",
+		[SIGTSTP] = "SIGTSTP (Terminal stop signal)",
+		[SIGTTIN] = "SIGTTIN (Background process attempting read)",
+		[SIGTTOU] = "SIGTTOU (Background process attempting write)",
+		[SIGUSR1] = "SIGUSR1 (User-defined signal 1)",
+		[SIGUSR2] = "SIGUSR2 (User-defined signal 2)",
+		[SIGPOLL] = "SIGPOLL (Pollable event)",
+		[SIGPROF] = "SIGPROF (Profiling timer expired)",
+		[SIGSYS] = "SIGSYS (Bad system call)",
+		[SIGTRAP] = "SIGTRAP (Trace/breakpoint trap)",
+		[SIGURG] = "SIGURG (High bandwidth data is available at a socket)",
+		[SIGVTALRM] = "SIGVTALRM (Virtual timer expired)",
+		[SIGXCPU] = "SIGXCPU (CPU time limit exceeded)",
+		[SIGXFSZ] = "SIGXFSZ (File size limit exceeded)"
+	};
+
+	if (signum <= _TOP_SIGNAL) {
+		return (char *) sigstrings[signum];
+	}
+
+	return (char *) "ERROR, Invalid signal number";
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/strings.c
===================================================================
--- uspace/lib/posix/source/strings.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/strings.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Additional string manipulation.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "internal/common.h"
+#include "posix/strings.h"
+
+#include "posix/string.h"
+#include "posix/ctype.h"
+
+#include "libc/mem.h"
+
+/**
+ * Find first set bit (beginning with the least significant bit).
+ *
+ * @param i Integer in which to look for the first set bit.
+ * @return Index of first set bit. Bits are numbered starting at one.
+ */
+int posix_ffs(int i)
+{
+	if (i == 0) {
+		return 0;
+	}
+
+	int result = 0;
+
+	// XXX: assumes at most 32-bit int
+	if (!(i & 0xFFFF)) {
+		result |= 16;
+		i >>= 16;
+	}
+	if (!(i & 0xFF)) {
+		result |= 8;
+		i >>= 8;
+	}
+	if (!(i & 0xF)) {
+		result |= 4;
+		i >>= 4;
+	}
+	if (!(i & 0x3)) {
+		result |= 2;
+		i >>= 2;
+	}
+	if (!(i & 0x1)) {
+		result |= 1;
+	}
+
+	return result + 1;
+}
+
+/**
+ * Compare two strings (case-insensitive).
+ *
+ * @param s1 First string to be compared.
+ * @param s2 Second string to be compared.
+ * @return Difference of the first pair of inequal characters,
+ *     or 0 if strings have the same content.
+ */
+int posix_strcasecmp(const char *s1, const char *s2)
+{
+	return posix_strncasecmp(s1, s2, STR_NO_LIMIT);
+}
+
+/**
+ * Compare part of two strings (case-insensitive).
+ *
+ * @param s1 First string to be compared.
+ * @param s2 Second string to be compared.
+ * @param n Maximum number of characters to be compared.
+ * @return Difference of the first pair of inequal characters,
+ *     or 0 if strings have the same content.
+ */
+int posix_strncasecmp(const char *s1, const char *s2, size_t n)
+{
+	for (size_t i = 0; i < n; ++i) {
+		int cmp = tolower(s1[i]) - tolower(s2[i]);
+		if (cmp != 0) {
+			return cmp;
+		}
+		
+		if (s1[i] == 0) {
+			return 0;
+		}
+	}
+	
+	return 0;
+}
+
+/**
+ * Compare two memory areas.
+ *
+ * @param mem1 Pointer to the first area to compare.
+ * @param mem2 Pointer to the second area to compare.
+ * @param n Common size of both areas.
+ * @return If n is 0, return zero. If the areas match, return
+ *     zero. Otherwise return non-zero.
+ */
+int posix_bcmp(const void *mem1, const void *mem2, size_t n)
+{
+	return memcmp(mem1, mem2, n);
+}
+
+/**
+ * Copy bytes in memory with overlapping areas.
+ *
+ * @param src Source area.
+ * @param dest Destination area.
+ * @param n Number of bytes to copy.
+ */
+void posix_bcopy(const void *src, void *dest, size_t n)
+{
+	/* Note that memmove has different order of arguments. */
+	memmove(dest, src, n);
+}
+
+/**
+ * Reset bytes in memory area to zero.
+ *
+ * @param mem Memory area to be zeroed.
+ * @param n Number of bytes to reset.
+ */
+void posix_bzero(void *mem, size_t n)
+{
+	memset(mem, 0, n);
+}
+
+/**
+ * Scan string for a first occurence of a character.
+ *
+ * @param s String in which to look for the character.
+ * @param c Character to look for.
+ * @return Pointer to the specified character on success,
+ *     NULL pointer otherwise.
+ */
+char *posix_index(const char *s, int c)
+{
+	return posix_strchr(s, c);
+}
+
+/**
+ * Scan string for a last occurence of a character.
+ *
+ * @param s String in which to look for the character.
+ * @param c Character to look for.
+ * @return Pointer to the specified character on success,
+ *     NULL pointer otherwise.
+ */
+char *posix_rindex(const char *s, int c)
+{
+	return posix_strrchr(s, c);
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/sys/mman.c
===================================================================
--- uspace/lib/posix/source/sys/mman.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/sys/mman.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2006 Ondrej Palkovsky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "../internal/common.h"
+#include <posix/sys/mman.h>
+#include <posix/sys/types.h>
+#include <libc/as.h>
+#include <posix/unistd.h>
+
+void *posix_mmap(void *start, size_t length, int prot, int flags, int fd,
+    __POSIX_DEF__(off_t) offset)
+{
+	if (!start)
+		start = AS_AREA_ANY;
+	
+//	if (!((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE)))
+//		return MAP_FAILED;
+	
+	if (!(flags & MAP_ANONYMOUS))
+		return MAP_FAILED;
+	
+	return as_area_create(start, length, prot, AS_AREA_UNPAGED);
+}
+
+int posix_munmap(void *start, size_t length)
+{
+	return as_area_destroy(start);
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/sys/stat.c
===================================================================
--- uspace/lib/posix/source/sys/stat.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/sys/stat.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file File status handling.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "../internal/common.h"
+#include "posix/sys/stat.h"
+#include "libc/vfs/vfs.h"
+
+#include "posix/errno.h"
+#include "libc/mem.h"
+
+/**
+ * Convert HelenOS stat struct into POSIX stat struct (if possible).
+ *
+ * @param dest POSIX stat struct.
+ * @param src HelenOS stat struct.
+ *
+ * @return 0 on success, -1 on error.
+ */
+static int stat_to_posix(struct posix_stat *dest, struct stat *src)
+{
+	memset(dest, 0, sizeof(struct posix_stat));
+	
+	dest->st_dev = src->service;
+	dest->st_ino = src->index;
+	
+	/* HelenOS doesn't support permissions, so we set them all */
+	dest->st_mode = S_IRWXU | S_IRWXG | S_IRWXO;
+	if (src->is_file) {
+		dest->st_mode |= S_IFREG;
+	}
+	if (src->is_directory) {
+		dest->st_mode |= S_IFDIR;
+	}
+	
+	dest->st_nlink = src->lnkcnt;
+	dest->st_size = src->size;
+
+	if (src->size > INT64_MAX) {
+		errno = ERANGE;
+		return -1;
+	}
+
+	return 0;
+}
+
+/**
+ * Retrieve file status for file associated with file descriptor.
+ *
+ * @param fd File descriptor of the opened file.
+ * @param st Status structure to be filled with information.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_fstat(int fd, struct posix_stat *st)
+{
+	struct stat hst;
+	int rc = rcerrno(vfs_stat, fd, &hst);
+	if (rc < 0)
+		return -1;
+	return stat_to_posix(st, &hst);
+}
+
+/**
+ * Retrieve file status for symbolic link.
+ * 
+ * @param path Path to the symbolic link.
+ * @param st Status structure to be filled with information.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_lstat(const char *restrict path, struct posix_stat *restrict st)
+{
+	/* There are currently no symbolic links in HelenOS. */
+	return posix_stat(path, st);
+}
+
+/**
+ * Retrieve file status for regular file (or symbolic link target).
+ *
+ * @param path Path to the file/link.
+ * @param st Status structure to be filled with information.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_stat(const char *restrict path, struct posix_stat *restrict st)
+{
+	struct stat hst;
+	int rc = rcerrno(vfs_stat_path, path, &hst);
+	if (rc < 0)
+		return -1;
+	return stat_to_posix(st, &hst);
+}
+
+/**
+ * Change permission bits for the file if possible.
+ * 
+ * @param path Path to the file.
+ * @param mode Permission bits to be set.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_chmod(const char *path, posix_mode_t mode)
+{
+	/* HelenOS doesn't support permissions, return success. */
+	return 0;
+}
+
+/**
+ * Set the file mode creation mask of the process.
+ * 
+ * @param mask Set permission bits are cleared in the related creation
+ *     functions. Non-permission bits are ignored.
+ * @return Previous file mode creation mask.
+ */
+posix_mode_t posix_umask(posix_mode_t mask)
+{
+	/* HelenOS doesn't support permissions, return empty mask. */
+	return 0;
+}
+
+/**
+ * Create a directory.
+ * 
+ * @param path Path to the new directory.
+ * @param mode Permission bits to be set.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_mkdir(const char *path, posix_mode_t mode)
+{
+	int rc = rcerrno(vfs_link_path, path, KIND_DIRECTORY, NULL);
+	if (rc != EOK)
+		return -1;
+	else
+		return 0;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/sys/wait.c
===================================================================
--- uspace/lib/posix/source/sys/wait.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/sys/wait.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Support for waiting.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "../internal/common.h"
+#include "posix/sys/wait.h"
+
+#include "libc/task.h"
+#include "posix/assert.h"
+#include "posix/errno.h"
+#include "posix/limits.h"
+#include "posix/signal.h"
+
+int __posix_wifexited(int status) {
+	return status != INT_MIN;
+}
+
+int __posix_wexitstatus(int status) {
+	assert(__posix_wifexited(status));
+	return status;
+}
+
+int __posix_wifsignaled(int status) {
+	return status == INT_MIN;
+}
+
+int __posix_wtermsig(int status) {
+	assert(__posix_wifsignaled(status));
+	/* There is no way to distinguish reason
+	 * for unexpected termination at the moment.
+	 */
+	return SIGABRT;
+}
+
+/**
+ * Wait for any child process to stop or terminate.
+ * 
+ * @param stat_ptr Location of the final status code of the child process.
+ * @return ID of the child process for which status is reported,
+ *     -1 on signal interrupt, (pid_t)-1 otherwise.
+ */
+posix_pid_t posix_wait(int *stat_ptr)
+{
+	/* HelenOS does not support this. */
+	errno = ENOSYS;
+	return (posix_pid_t) -1;
+}
+
+/**
+ * Wait for a child process to stop or terminate.
+ * 
+ * @param pid What child process shall the caller wait for. See POSIX manual
+ *     for details.
+ * @param stat_ptr Location of the final status code of the child process.
+ * @param options Constraints of the waiting. See POSIX manual for details.
+ * @return ID of the child process for which status is reported,
+ *     -1 on signal interrupt, 0 if non-blocking wait is requested but there is
+ *     no child process whose status can be reported, (pid_t)-1 otherwise.
+ */
+posix_pid_t posix_waitpid(posix_pid_t pid, int *stat_ptr, int options)
+{
+	assert(stat_ptr != NULL);
+	assert(options == 0 /* None of the options are supported. */);
+	
+	task_exit_t texit;
+	int retval;
+	
+	int rc = task_wait_task_id((task_id_t) pid, &texit, &retval);
+	
+	if (rc < 0) {
+		/* Unable to retrieve status. */
+		errno = -rc;
+		return (posix_pid_t) -1;
+	}
+	
+	if (texit == TASK_EXIT_NORMAL) {
+		// FIXME: relies on application not returning this value
+		assert(retval != INT_MIN);
+		*stat_ptr = retval;
+	} else {
+		/* Reserve the lowest value for unexpected termination. */
+		*stat_ptr = INT_MIN;
+	}
+	
+	return pid;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/time.c
===================================================================
--- uspace/lib/posix/source/time.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/time.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Time measurement support.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "internal/common.h"
+#include "posix/time.h"
+
+#include "posix/ctype.h"
+#include "posix/errno.h"
+#include "posix/signal.h"
+#include "posix/assert.h"
+
+#include "libc/async.h"
+#include "libc/malloc.h"
+#include "libc/task.h"
+#include "libc/stats.h"
+#include "libc/stddef.h"
+#include "libc/sys/time.h"
+
+// TODO: test everything in this file
+
+/* In some places in this file, phrase "normalized broken-down time" is used.
+ * This means time broken down to components (year, month, day, hour, min, sec),
+ * in which every component is in its proper bounds. Non-normalized time could
+ * e.g. be 2011-54-5 29:13:-5, which would semantically mean start of year 2011
+ * + 53 months + 4 days + 29 hours + 13 minutes - 5 seconds.
+ */
+
+int posix_daylight;
+long posix_timezone;
+char *posix_tzname[2];
+
+/**
+ * Set timezone conversion information.
+ */
+void posix_tzset(void)
+{
+	// TODO: read environment
+	posix_tzname[0] = (char *) "GMT";
+	posix_tzname[1] = (char *) "GMT";
+	posix_daylight = 0;
+	posix_timezone = 0;
+}
+
+/**
+ * Get the time in seconds
+ *
+ * @param t If t is non-NULL, the return value is also stored in the memory
+ *          pointed to by t.
+ * @return  On success, the value of time in seconds since the Epoch
+ *          is returned. On error, (time_t)-1 is returned.
+ */
+time_t posix_time(time_t *t)
+{
+	return time(t);
+}
+
+/**
+ * Converts a time value to a broken-down UTC time.
+ * 
+ * @param timer Time to convert.
+ * @param result Structure to store the result to.
+ * @return Value of result on success, NULL on overflow.
+ */
+struct tm *posix_gmtime_r(const time_t *restrict timer,
+    struct tm *restrict result)
+{
+	int rc = time_utc2tm(*timer, result);
+	if (rc != EOK) {
+		errno = rc;
+		return NULL;
+	}
+
+	return result;
+}
+
+/**
+ * Converts a time value to a broken-down UTC time.
+ * (non reentrant version)
+ *
+ * @param timep  Time to convert
+ * @return       Pointer to a statically allocated structure that stores
+ *               the result, NULL in case of error.
+ */
+struct tm *posix_gmtime(const time_t *restrict timep)
+{
+	static struct tm result;
+
+	return posix_gmtime_r(timep, &result);
+}
+
+/**
+ * Converts a time value to a broken-down local time.
+ * 
+ * @param timer Time to convert.
+ * @param result Structure to store the result to.
+ * @return Value of result on success, NULL on overflow.
+ */
+struct tm *posix_localtime_r(const time_t *restrict timer,
+    struct tm *restrict result)
+{
+	// TODO: deal with timezone
+	// currently assumes system and all times are in GMT
+	return posix_gmtime_r(timer, result);
+}
+
+/**
+ * Converts a time value to a broken-down local time.
+ * (non reentrant version)
+ *
+ * @param timep    Time to convert.
+ * @return         Pointer to a statically allocated structure that stores
+ *                 the result, NULL in case of error.
+ */
+struct tm *posix_localtime(const time_t *restrict timep)
+{
+	static struct tm result;
+
+	return posix_localtime_r(timep, &result);
+}
+
+/**
+ * Converts broken-down time to a string in format
+ * "Sun Jan 1 00:00:00 1970\n". (Obsolete)
+ *
+ * @param timeptr Broken-down time structure.
+ * @param buf Buffer to store string to, must be at least ASCTIME_BUF_LEN
+ *     bytes long.
+ * @return Value of buf.
+ */
+char *posix_asctime_r(const struct tm *restrict timeptr,
+    char *restrict buf)
+{
+	time_tm2str(timeptr, buf);
+	return buf;
+}
+
+/**
+ * Convers broken-down time to a string in format
+ * "Sun Jan 1 00:00:00 1970\n". (Obsolete)
+ * (non reentrant version)
+ *
+ * @param timeptr    Broken-down time structure.
+ * @return           Pointer to a statically allocated buffer that stores
+ *                   the result, NULL in case of error.
+ */
+char *posix_asctime(const struct tm *restrict timeptr)
+{
+	static char buf[ASCTIME_BUF_LEN];
+
+	return posix_asctime_r(timeptr, buf);
+}
+
+/**
+ * Converts the calendar time to a string in format
+ * "Sun Jan 1 00:00:00 1970\n" (Obsolete)
+ * 
+ * @param timer Time to convert.
+ * @param buf Buffer to store string to. Must be at least ASCTIME_BUF_LEN
+ *     bytes long.
+ * @return Pointer to buf on success, NULL on failure.
+ */
+char *posix_ctime_r(const time_t *timer, char *buf)
+{
+	int r = time_local2str(*timer, buf);
+	if (r != EOK) {
+		errno = r;
+		return NULL;
+	}
+
+	return buf;
+}
+
+/**
+ * Converts the calendar time to a string in format
+ * "Sun Jan 1 00:00:00 1970\n" (Obsolete)
+ * (non reentrant version)
+ *
+ * @param timep    Time to convert.
+ * @return         Pointer to a statically allocated buffer that stores
+ *                 the result, NULL in case of error.
+ */
+char *posix_ctime(const time_t *timep)
+{
+	static char buf[ASCTIME_BUF_LEN];
+
+	return posix_ctime_r(timep, buf);
+}
+
+/**
+ * Get clock resolution. Only CLOCK_REALTIME is supported.
+ *
+ * @param clock_id Clock ID.
+ * @param res Pointer to the variable where the resolution is to be written.
+ * @return 0 on success, -1 with errno set on failure.
+ */
+int posix_clock_getres(posix_clockid_t clock_id, struct posix_timespec *res)
+{
+	assert(res != NULL);
+
+	switch (clock_id) {
+		case CLOCK_REALTIME:
+			res->tv_sec = 0;
+			res->tv_nsec = 1000; /* Microsecond resolution. */
+			return 0;
+		default:
+			errno = EINVAL;
+			return -1;
+	}
+}
+
+/**
+ * Get time. Only CLOCK_REALTIME is supported.
+ * 
+ * @param clock_id ID of the clock to query.
+ * @param tp Pointer to the variable where the time is to be written.
+ * @return 0 on success, -1 with errno on failure.
+ */
+int posix_clock_gettime(posix_clockid_t clock_id, struct posix_timespec *tp)
+{
+	assert(tp != NULL);
+
+	switch (clock_id) {
+		case CLOCK_REALTIME:
+			;
+			struct timeval tv;
+			gettimeofday(&tv, NULL);
+			tp->tv_sec = tv.tv_sec;
+			tp->tv_nsec = tv.tv_usec * 1000;
+			return 0;
+		default:
+			errno = EINVAL;
+			return -1;
+	}
+}
+
+/**
+ * Set time on a specified clock. As HelenOS doesn't support this yet,
+ * this function always fails.
+ * 
+ * @param clock_id ID of the clock to set.
+ * @param tp Time to set.
+ * @return 0 on success, -1 with errno on failure.
+ */
+int posix_clock_settime(posix_clockid_t clock_id,
+    const struct posix_timespec *tp)
+{
+	assert(tp != NULL);
+
+	switch (clock_id) {
+		case CLOCK_REALTIME:
+			// TODO: setting clock
+			// FIXME: HelenOS doesn't actually support hardware
+			//        clock yet
+			errno = EPERM;
+			return -1;
+		default:
+			errno = EINVAL;
+			return -1;
+	}
+}
+
+/**
+ * Sleep on a specified clock.
+ * 
+ * @param clock_id ID of the clock to sleep on (only CLOCK_REALTIME supported).
+ * @param flags Flags (none supported).
+ * @param rqtp Sleep time.
+ * @param rmtp Remaining time is written here if sleep is interrupted.
+ * @return 0 on success, -1 with errno set on failure.
+ */
+int posix_clock_nanosleep(posix_clockid_t clock_id, int flags,
+    const struct posix_timespec *rqtp, struct posix_timespec *rmtp)
+{
+	assert(rqtp != NULL);
+	assert(rmtp != NULL);
+
+	switch (clock_id) {
+		case CLOCK_REALTIME:
+			// TODO: interruptible sleep
+			if (rqtp->tv_sec != 0) {
+				async_sleep(rqtp->tv_sec);
+			}
+			if (rqtp->tv_nsec != 0) {
+				async_usleep(rqtp->tv_nsec / 1000);
+			}
+			return 0;
+		default:
+			errno = EINVAL;
+			return -1;
+	}
+}
+
+/**
+ * Get CPU time used since the process invocation.
+ *
+ * @return Consumed CPU cycles by this process or -1 if not available.
+ */
+posix_clock_t posix_clock(void)
+{
+	posix_clock_t total_cycles = -1;
+	stats_task_t *task_stats = stats_get_task(task_get_id());
+	if (task_stats) {
+		total_cycles = (posix_clock_t) (task_stats->kcycles +
+		    task_stats->ucycles);
+		free(task_stats);
+		task_stats = 0;
+	}
+
+	return total_cycles;
+}
+
+/** @}
+ */
Index: uspace/lib/posix/source/unistd.c
===================================================================
--- uspace/lib/posix/source/unistd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/posix/source/unistd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,500 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * Copyright (c) 2011 Petr Koupy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file Miscellaneous standard definitions.
+ */
+
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
+
+#include "internal/common.h"
+#include "posix/unistd.h"
+
+#include "posix/errno.h"
+#include "posix/string.h"
+#include "posix/fcntl.h"
+
+#include "libc/task.h"
+#include "libc/thread.h"
+#include "libc/stats.h"
+#include "libc/malloc.h"
+#include "libc/vfs/vfs.h"
+
+#include <libarch/config.h>
+
+aoff64_t posix_pos[MAX_OPEN_FILES];
+
+/* Array of environment variable strings (NAME=VALUE). */
+char **posix_environ = NULL;
+char *posix_optarg;
+
+/**
+ * Sleep for the specified number of seconds.
+ *
+ * Note that POSIX allows this call to be interrupted and then the return
+ * value represents remaining seconds for the sleep. HelenOS does not offer
+ * such functionality and thus always the whole sleep is taken.
+ *
+ * @param seconds Number of seconds to sleep.
+ * @return Always 0 on HelenOS.
+ */
+unsigned int posix_sleep(unsigned int seconds)
+{
+	return thread_sleep(seconds);
+}
+
+/**
+ * Get current user name.
+ *
+ * @return User name (static) string or NULL if not found.
+ */
+char *posix_getlogin(void)
+{
+	/* There is currently no support for user accounts in HelenOS. */
+	return (char *) "user";
+}
+
+/**
+ * Get current user name.
+ *
+ * @param name Pointer to a user supplied buffer.
+ * @param namesize Length of the buffer.
+ * @return Zero on success, error code otherwise.
+ */
+int posix_getlogin_r(char *name, size_t namesize)
+{
+	/* There is currently no support for user accounts in HelenOS. */
+	if (namesize >= 5) {
+		posix_strcpy(name, (char *) "user");
+		return 0;
+	} else {
+		errno = ERANGE;
+		return -1;
+	}
+}
+
+/**
+ * Test whether open file descriptor is associated with a terminal.
+ *
+ * @param fd Open file descriptor to test.
+ * @return Boolean result of the test.
+ */
+int posix_isatty(int fd)
+{
+	// TODO
+	/* Always returns false, because there is no easy way to find
+	 * out under HelenOS. */
+	return 0;
+}
+
+/**
+ * Get the pathname of the current working directory.
+ *
+ * @param buf Buffer into which the pathname shall be put.
+ * @param size Size of the buffer.
+ * @return Buffer pointer on success, NULL on failure.
+ */
+char *posix_getcwd(char *buf, size_t size)
+{
+	int rc = rcerrno(vfs_cwd_get, buf, size);
+	if (rc != EOK) 
+		return NULL;
+	return buf;
+}
+
+/**
+ * Change the current working directory.
+ *
+ * @param path New working directory.
+ */
+int posix_chdir(const char *path)
+{
+	int rc = rcerrno(vfs_cwd_set, path);
+	if (rc != EOK)
+		return -1;
+	return 0;
+}
+
+/**
+ * Determine the page size of the current run of the process.
+ *
+ * @return Page size of the process.
+ */
+int posix_getpagesize(void)
+{
+	return PAGE_SIZE;
+}
+
+/**
+ * Get the process ID of the calling process.
+ *
+ * @return Process ID.
+ */
+posix_pid_t posix_getpid(void)
+{
+	return task_get_id();
+}
+
+/**
+ * Get the real user ID of the calling process.
+ *
+ * @return User ID.
+ */
+posix_uid_t posix_getuid(void)
+{
+	/* There is currently no support for user accounts in HelenOS. */
+	return 0;
+}
+
+/**
+ * Get the real group ID of the calling process.
+ * 
+ * @return Group ID.
+ */
+posix_gid_t posix_getgid(void)
+{
+	/* There is currently no support for user accounts in HelenOS. */
+	return 0;
+}
+
+/**
+ * Close a file.
+ *
+ * @param fildes File descriptor of the opened file.
+ * @return 0 on success, -1 on error.
+ */
+int posix_close(int fildes)
+{
+	posix_pos[fildes] = 0;
+	int rc = rcerrno(vfs_put, fildes);
+	if (rc != EOK)
+		return -1;
+	else
+		return 0;
+}
+
+/**
+ * Read from a file.
+ *
+ * @param fildes File descriptor of the opened file.
+ * @param buf Buffer to which the read bytes shall be stored.
+ * @param nbyte Upper limit on the number of read bytes.
+ * @return Number of read bytes on success, -1 otherwise.
+ */
+ssize_t posix_read(int fildes, void *buf, size_t nbyte)
+{
+	size_t nread;
+	int rc;
+
+	rc = rcerrno(vfs_read, fildes, &posix_pos[fildes], buf, nbyte, &nread);
+	if (rc != EOK)
+		return -1;
+	return (ssize_t) nread;
+}
+
+/**
+ * Write to a file.
+ *
+ * @param fildes File descriptor of the opened file.
+ * @param buf Buffer to write.
+ * @param nbyte Size of the buffer.
+ * @return Number of written bytes on success, -1 otherwise.
+ */
+ssize_t posix_write(int fildes, const void *buf, size_t nbyte)
+{
+	size_t nwr;
+	int rc;
+
+	rc = rcerrno(vfs_write, fildes, &posix_pos[fildes], buf, nbyte, &nwr);
+	if (rc != EOK)
+		return -1;
+	return nwr;
+}
+
+/**
+ * Reposition read/write file offset
+ *
+ * @param fildes File descriptor of the opened file.
+ * @param offset New offset in the file.
+ * @param whence The position from which the offset argument is specified.
+ * @return Upon successful completion, returns the resulting offset
+ *         as measured in bytes from the beginning of the file, -1 otherwise.
+ */
+posix_off_t posix_lseek(int fildes, posix_off_t offset, int whence)
+{
+	struct stat st;
+	int rc;
+
+	switch (whence) {
+	case SEEK_SET:
+		posix_pos[fildes] = offset;
+		break;
+	case SEEK_CUR:
+		posix_pos[fildes] += offset;
+		break;
+	case SEEK_END:
+		rc = rcerrno(vfs_stat, fildes, &st);
+		if (rc != EOK)
+			return -1;
+		posix_pos[fildes] = st.size + offset;
+		break;
+	}
+	if (posix_pos[fildes] > INT64_MAX) {
+		/* The native width is too large for the POSIX interface. */
+		errno = ERANGE;
+		return -1;
+	}
+	return posix_pos[fildes];
+}
+
+/**
+ * Requests outstanding data to be written to the underlying storage device.
+ *
+ * @param fildes File descriptor of the opened file.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_fsync(int fildes)
+{
+	if (rcerrno(vfs_sync, fildes) != EOK)
+		return -1;
+	else
+		return 0;
+}
+
+/**
+ * Truncate a file to a specified length.
+ *
+ * @param fildes File descriptor of the opened file.
+ * @param length New length of the file.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_ftruncate(int fildes, posix_off_t length)
+{
+	if (rcerrno(vfs_resize, fildes, (aoff64_t) length) != EOK)
+		return -1;
+	else
+		return 0;
+}
+
+/**
+ * Remove a directory.
+ *
+ * @param path Directory pathname.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_rmdir(const char *path)
+{
+	if (rcerrno(vfs_unlink_path, path) != EOK)
+		return -1;
+	else
+		return 0;
+}
+
+/**
+ * Remove a link to a file.
+ * 
+ * @param path File pathname.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_unlink(const char *path)
+{
+	if (rcerrno(vfs_unlink_path, path) != EOK)
+		return -1;
+	else
+		return 0;
+}
+
+/**
+ * Duplicate an open file descriptor.
+ *
+ * @param fildes File descriptor to be duplicated.
+ * @return On success, new file descriptor for the same file, otherwise -1.
+ */
+int posix_dup(int fildes)
+{
+	return posix_fcntl(fildes, F_DUPFD, 0);
+}
+
+/**
+ * Duplicate an open file descriptor.
+ * 
+ * @param fildes File descriptor to be duplicated.
+ * @param fildes2 File descriptor to be paired with the same file description
+ *     as is paired fildes.
+ * @return fildes2 on success, -1 otherwise.
+ */
+int posix_dup2(int fildes, int fildes2)
+{
+	return negerrno(vfs_clone, fildes, fildes2, false);
+}
+
+/**
+ * Determine accessibility of a file.
+ *
+ * @param path File to check accessibility for.
+ * @param amode Either check for existence or intended access mode.
+ * @return Zero on success, -1 otherwise.
+ */
+int posix_access(const char *path, int amode)
+{
+	if (amode == F_OK || (amode & (X_OK | W_OK | R_OK))) {
+		/* HelenOS doesn't support permissions, permission checks
+		 * are equal to existence check.
+		 *
+		 * Check file existence by attempting to open it.
+		 */
+		int fd = posix_open(path, O_RDONLY);
+		if (fd < 0)
+			return -1;
+		posix_close(fd);
+		return 0;
+	} else {
+		/* Invalid amode argument. */
+		errno = EINVAL;
+		return -1;
+	}
+}
+
+/**
+ * Get configurable system variables.
+ * 
+ * @param name Variable name.
+ * @return Variable value.
+ */
+long posix_sysconf(int name)
+{
+	long clk_tck = 0;
+	size_t cpu_count = 0;
+	stats_cpu_t *cpu_stats = stats_get_cpus(&cpu_count);
+	if (cpu_stats && cpu_count > 0) {
+		clk_tck = ((long) cpu_stats[0].frequency_mhz) * 1000000L;
+	}
+	if (cpu_stats) {
+		free(cpu_stats);
+		cpu_stats = 0;
+	}
+
+	long phys_pages = 0;
+	long avphys_pages = 0;
+	stats_physmem_t *mem_stats = stats_get_physmem();
+	if (mem_stats) {
+		phys_pages = (long) (mem_stats->total / posix_getpagesize());
+		avphys_pages = (long) (mem_stats->free / posix_getpagesize());
+		free(mem_stats);
+		mem_stats = 0;
+	}
+
+	switch (name) {
+	case _SC_PHYS_PAGES:
+		return phys_pages;
+	case _SC_AVPHYS_PAGES:
+		return avphys_pages;
+	case _SC_PAGESIZE:
+		return posix_getpagesize();
+	case _SC_CLK_TCK:
+		return clk_tck;
+	default:
+		errno = EINVAL;
+		return -1;
+	}
+}
+
+/**
+ * 
+ * @param path
+ * @param name
+ * @return
+ */
+long posix_pathconf(const char *path, int name)
+{
+	// TODO: low priority, just a compile-time dependency of binutils
+	not_implemented();
+	return -1;
+}
+
+/**
+ * 
+ * @return
+ */
+posix_pid_t posix_fork(void)
+{
+	// TODO: low priority, just a compile-time dependency of binutils
+	not_implemented();
+	return -1;
+}
+
+/**
+ * 
+ * @param path
+ * @param argv
+ * @return
+ */
+int posix_execv(const char *path, char *const argv[])
+{
+	// TODO: low priority, just a compile-time dependency of binutils
+	not_implemented();
+	return -1;
+}
+
+/**
+ * 
+ * @param file
+ * @param argv
+ * @return
+ */
+int posix_execvp(const char *file, char *const argv[])
+{
+	// TODO: low priority, just a compile-time dependency of binutils
+	not_implemented();
+	return -1;
+}
+
+/**
+ * 
+ * @param fildes
+ * @return
+ */
+int posix_pipe(int fildes[2])
+{
+	// TODO: low priority, just a compile-time dependency of binutils
+	not_implemented();
+	return -1;
+}
+
+unsigned int posix_alarm(unsigned int seconds)
+{
+	not_implemented();
+	return 0;
+}
+
+/** @}
+ */
Index: pace/lib/posix/src/ctype.c
===================================================================
--- uspace/lib/posix/src/ctype.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Character classification.
- */
-
-#include "posix/ctype.h"
-
-/**
- * Checks whether character is ASCII. (obsolete)
- *
- * @param c Character to inspect.
- * @return Non-zero if character match the definition, zero otherwise.
- */
-int isascii(int c)
-{
-	return c >= 0 && c < 128;
-}
-
-/**
- * Converts argument to a 7-bit ASCII character. (obsolete)
- *
- * @param c Character to convert.
- * @return Coverted character.
- */
-int toascii(int c)
-{
-	return c & 0x7F;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/dlfcn.c
===================================================================
--- uspace/lib/posix/src/dlfcn.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2017 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-
-#include "internal/common.h"
-#include "posix/dlfcn.h"
-
-_HIDE_LIBC_SYMBOL(dlopen)
-extern void *__helenos_libc_dlopen(const char *filename, int flags);
-
-void *dlopen(const char *filename, int flags)
-{
-	if (flags != 0) {
-		fprintf(stderr, "dlopen() not implemented with non-zero flags (%s:%d), something will NOT work.\n", __FILE__, __LINE__);
-	}
-	
-	return __helenos_libc_dlopen(filename, 0);
-}
-
-int dlclose(void *handle)
-{
-	not_implemented();
-	return 0;
-}
-
-char *dlerror(void)
-{
-	not_implemented();
-	return (char *)"dlerror()";
-}
-
-/** @}
- */
Index: pace/lib/posix/src/fcntl.c
===================================================================
--- uspace/lib/posix/src/fcntl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,158 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file File control.
- */
-
-#include "internal/common.h"
-#include "posix/fcntl.h"
-
-#include "libc/vfs/vfs.h"
-
-#include <errno.h>
-
-/**
- * Performs set of operations on the opened files.
- *
- * @param fd File descriptor of the opened file.
- * @param cmd Operation to carry out.
- * @return Non-negative on success. Might have special meaning corresponding
- *     to the requested operation.
- */
-int fcntl(int fd, int cmd, ...)
-{
-	int flags;
-
-	switch (cmd) {
-	case F_DUPFD:
-	case F_DUPFD_CLOEXEC:
-		/* VFS currently does not provide the functionality to duplicate
-		 * opened file descriptor. */
-		// FIXME: implement this once dup() is available
-		errno = ENOTSUP;
-		return -1;
-	case F_GETFD:
-		/* FD_CLOEXEC is not supported. There are no other flags. */
-		return 0;
-	case F_SETFD:
-		/* FD_CLOEXEC is not supported. Ignore arguments and report success. */
-		return 0;
-	case F_GETFL:
-		/* File status flags (i.e. O_APPEND) are currently private to the
-		 * VFS server so it cannot be easily retrieved. */
-		flags = 0;
-		/* File access flags are currently not supported for file descriptors.
-		 * Provide full access. */
-		flags |= O_RDWR;
-		return flags;
-	case F_SETFL:
-		/* File access flags are currently not supported for file descriptors.
-		 * Ignore arguments and report success. */
-		return 0;
-	case F_GETOWN:
-	case F_SETOWN:
-	case F_GETLK:
-	case F_SETLK:
-	case F_SETLKW:
-		/* Signals (SIGURG) and file locks are not supported. */
-		errno = ENOTSUP;
-		return -1;
-	default:
-		/* Unknown command */
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-/**
- * Open, possibly create, a file.
- *
- * @param pathname Path to the file.
- * @param posix_flags Access mode flags.
- */
-int open(const char *pathname, int posix_flags, ...)
-{
-	mode_t posix_mode = 0;
-	if (posix_flags & O_CREAT) {
-		va_list args;
-		va_start(args, posix_flags);
-		posix_mode = va_arg(args, mode_t);
-		va_end(args);
-		(void) posix_mode;
-	}
-
-	if (((posix_flags & (O_RDONLY | O_WRONLY | O_RDWR)) == 0) ||
-	    ((posix_flags & (O_RDONLY | O_WRONLY)) == (O_RDONLY | O_WRONLY)) ||
-	    ((posix_flags & (O_RDONLY | O_RDWR)) == (O_RDONLY | O_RDWR)) ||
-	    ((posix_flags & (O_WRONLY | O_RDWR)) == (O_WRONLY | O_RDWR))) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	int flags = WALK_REGULAR;
-	if (posix_flags & O_CREAT) {
-		if (posix_flags & O_EXCL)
-			flags |= WALK_MUST_CREATE;
-		else
-			flags |= WALK_MAY_CREATE;
-	}
-
-	int mode =
-	    ((posix_flags & O_RDWR) ? MODE_READ | MODE_WRITE : 0) |
-	    ((posix_flags & O_RDONLY) ? MODE_READ : 0) |
-	    ((posix_flags & O_WRONLY) ? MODE_WRITE : 0) |
-	    ((posix_flags & O_APPEND) ? MODE_APPEND : 0);
-
-	int file;
-
-	if (failed(vfs_lookup(pathname, flags, &file)))
-		return -1;
-
-	if (failed(vfs_open(file, mode))) {
-		vfs_put(file);
-		return -1;
-	}
-
-	if (posix_flags & O_TRUNC) {
-		if (posix_flags & (O_RDWR | O_WRONLY)) {
-			if (failed(vfs_resize(file, 0))) {
-				vfs_put(file);
-				return -1;
-			}
-		}
-	}
-
-	return file;
-}
-
-/** @}
- */
-
Index: pace/lib/posix/src/fnmatch.c
===================================================================
--- uspace/lib/posix/src/fnmatch.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,714 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Filename-matching.
- */
-
-/* This file contains an implementation of the fnmatch() pattern matching
- * function. There is more code than necessary to account for the possibility
- * of adding POSIX-like locale support to the system in the future. Functions
- * that are only necessary for locale support currently simply use single
- * characters for "collation elements". 
- * When (or if) locales are properly implemented, extending this implementation
- * will be fairly straightforward.
- */
-
-#include "libc/stdbool.h"
-#include "posix/ctype.h"
-#include "posix/string.h"
-#include "posix/stdlib.h"
-#include <assert.h>
-
-#include "internal/common.h"
-#include "posix/fnmatch.h"
-
-/* Returned by _match... functions. */
-#define INVALID_PATTERN -1
-
-/* Type for collating element, simple identity with characters now,
- * but may be extended for better locale support.
- */
-typedef int coll_elm_t;
-
-/** Return value indicating that the element in question
- * is not valid in the current locale. (That is, if locales are supported.)
- */
-#define COLL_ELM_INVALID -1
-
-/**
- * Get collating element matching a string.
- *
- * @param str String representation of the element.
- * @return Matching collating element or COLL_ELM_INVALID.
- */
-static coll_elm_t _coll_elm_get(const char* str)
-{
-	if (str[0] == '\0' || str[1] != '\0') {
-		return COLL_ELM_INVALID;
-	}
-	return str[0];
-}
-
-/**
- * Get collating element matching a single character.
- *
- * @param c Character representation of the element.
- * @return Matching collating element.
- */
-static coll_elm_t _coll_elm_char(int c)
-{
-	return c;
-}
-
-/**
- * Match collating element with a beginning of a string.
- *
- * @param elm Collating element to match.
- * @param str String which beginning should match the element.
- * @return 0 if the element doesn't match, or the number of characters matched.
- */
-static int _coll_elm_match(coll_elm_t elm, const char *str)
-{
-	return elm == *str;
-}
-
-/**
- * Checks whether a string begins with a collating element in the given range.
- * Ordering depends on the locale (if locales are supported).
- *
- * @param first First element of the range.
- * @param second Last element of the range.
- * @param str String to match.
- * @return 0 if there is no match, or the number of characters matched.
- */
-static int _coll_elm_between(coll_elm_t first, coll_elm_t second,
-    const char *str)
-{
-	return *str >= first && *str <= second;
-}
-
-/**
- * Read a string delimited by [? and ?].
- *
- * @param pattern Pointer to the string to read from. Its position is moved
- *    to the first character after the closing ].
- * @param seq The character on the inside of brackets.
- * @param buf Read buffer.
- * @param buf_sz Read buffer's size. If the buffer is not large enough for
- *    the entire string, the string is cut with no error indication.
- * @param flags Flags modifying the behavior.
- * @return True on success, false if the pattern is invalid.
- */
-static bool _get_delimited(
-    const char **pattern, int seq,
-    char *buf, size_t buf_sz, int flags)
-{
-	const bool noescape = (flags & FNM_NOESCAPE) != 0;
-	const bool pathname = (flags & FNM_PATHNAME) != 0;
-
-	const char *p = *pattern;
-	assert(p[0] == '[' && p[1] == seq /* Caller should ensure this. */);
-	p += 2;
-
-	while (true) {
-		if (*p == seq && *(p + 1) == ']') {
-			/* String properly ended, return. */
-			*pattern = p + 2;
-			*buf = '\0';
-			return true;
-		}
-		if (!noescape && *p == '\\') {
-			p++;
-		}
-		if (*p == '\0') {
-			/* String not ended properly, invalid pattern. */
-			return false;
-		}
-		if (pathname && *p == '/') {
-			/* Slash in a pathname pattern is invalid. */
-			return false;
-		}
-		if (buf_sz > 1) {
-			/* Only add to the buffer if there is space. */
-			*buf = *p;
-			buf++;
-			buf_sz--;
-		}
-		p++;
-	}
-}
-
-/************** CHARACTER CLASSES ****************/
-
-#define MAX_CLASS_OR_COLL_LEN 6
-
-struct _char_class {
-	const char *name;
-	int (*func) (int);
-};
-
-/* List of supported character classes. */
-static const struct _char_class _char_classes[] = {
-	{ "alnum", isalnum },
-	{ "alpha", isalpha },
-	{ "blank", isblank },
-	{ "cntrl", iscntrl },
-	{ "digit", isdigit },
-	{ "graph", isgraph },
-	{ "lower", islower },
-	{ "print", isprint },
-	{ "punct", ispunct },
-	{ "space", isspace },
-	{ "upper", isupper },
-	{ "xdigit", isxdigit }
-};
-
-/**
- * Compare function for binary search in the _char_classes array.
- * 
- * @param key Key of the searched element.
- * @param elem Element of _char_classes array.
- * @return Ordering indicator (-1 less than, 0 equal, 1 greater than).
- */
-static int _class_compare(const void *key, const void *elem)
-{
-	const struct _char_class *class = elem;
-	return strcmp((const char *) key, class->name);
-}
-
-/**
- * Returns whether the given character belongs to the specified character class.
- * 
- * @param cname Name of the character class.
- * @param c Character.
- * @return True if the character belongs to the class, false otherwise.
- */
-static bool _is_in_class (const char *cname, int c)
-{
-	/* Search for class in the array of supported character classes. */
-	const struct _char_class *class = bsearch(cname, _char_classes,
-	    sizeof(_char_classes) / sizeof(struct _char_class),
-	    sizeof(struct _char_class), _class_compare);
-
-	if (class == NULL) {
-		/* No such class supported - treat as an empty class. */
-		return false;
-	} else {
-		/* Class matched. */
-		return class->func(c);
-	}
-}
-
-/**
- * Tries to parse an initial part of the pattern as a character class pattern,
- * and if successful, matches the beginning of the given string against the class.
- * 
- * @param pattern Pointer to the pattern to match. Must begin with a class
- *    specifier and is repositioned to the first character after the specifier
- *    if successful.
- * @param str String to match.
- * @param flags Flags modifying the behavior (see fnmatch()).
- * @return INVALID_PATTERN if the pattern doesn't start with a valid class
- *    specifier, 0 if the beginning of the matched string doesn't belong
- *    to the class, or positive number of characters matched.
- */
-static int _match_char_class(const char **pattern, const char *str, int flags)
-{
-	char class[MAX_CLASS_OR_COLL_LEN + 1];
-
-	if (!_get_delimited(pattern, ':', class, sizeof(class), flags)) {
-		return INVALID_PATTERN;
-	}
-
-	return _is_in_class(class, *str);
-}
-
-/************** END CHARACTER CLASSES ****************/
-
-/**
- * Reads the next collating element in the pattern, taking into account
- * locale (if supported) and flags (see fnmatch()).
- * 
- * @param pattern Pattern.
- * @param flags Flags given to fnmatch().
- * @return Collating element on success,
- *     or COLL_ELM_INVALID if the pattern is invalid.
- */
-static coll_elm_t _next_coll_elm(const char **pattern, int flags)
-{
-	assert(pattern != NULL);
-	assert(*pattern != NULL);
-	assert(**pattern != '\0');
-
-	const char *p = *pattern;
-	const bool noescape = (flags & FNM_NOESCAPE) != 0;
-	const bool pathname = (flags & FNM_PATHNAME) != 0;
-
-	if (*p == '[') {
-		if (*(p + 1) == '.') {
-			char buf[MAX_CLASS_OR_COLL_LEN + 1];
-			if (!_get_delimited(pattern, '.', buf, sizeof(buf), flags)) {
-				return COLL_ELM_INVALID;
-			}
-			return _coll_elm_get(buf);
-		}
-
-		if (*(p + 1) == '=') {
-			char buf[MAX_CLASS_OR_COLL_LEN + 1];
-			if (!_get_delimited(pattern, '=', buf, sizeof(buf), flags)) {
-				return COLL_ELM_INVALID;
-			}
-			return _coll_elm_get(buf);
-		}
-	}
-
-	if (!noescape && *p == '\\') {
-		p++;
-		if (*p == '\0') {
-			*pattern = p;
-			return COLL_ELM_INVALID;
-		}
-	}
-	if (pathname && *p == '/') {
-		return COLL_ELM_INVALID;
-	}
-	
-	*pattern = p + 1;
-	return _coll_elm_char(*p);
-}
-
-/**
- * Matches the beginning of the given string against a bracket expression
- * the pattern begins with.
- * 
- * @param pattern Pointer to the beginning of a bracket expression in a pattern.
- *     On success, the pointer is moved to the first character after the
- *     bracket expression.
- * @param str Unmatched part of the string.
- * @param flags Flags given to fnmatch().
- * @return INVALID_PATTERN if the pattern is invalid, 0 if there is no match
- *     or the number of matched characters on success.
- */
-static int _match_bracket_expr(const char **pattern, const char *str, int flags)
-{
-	const bool pathname = (flags & FNM_PATHNAME) != 0;
-	const bool special_period = (flags & FNM_PERIOD) != 0;
-	const char *p = *pattern;
-	bool negative = false;
-	int matched = 0;
-
-	#define _matched(match) { \
-		int _match = match; \
-		if (_match < 0) { \
-			/* Invalid pattern */ \
-			return _match; \
-		} else if (matched == 0 && _match > 0) { \
-			/* First match */ \
-			matched = _match; \
-		} \
-	}
-
-	assert(*p == '[');  /* calling code should ensure this */
-	p++;
-
-	if (*str == '\0' || (pathname && *str == '/') ||
-	    (pathname && special_period && *str == '.' && *(str - 1) == '/')) {
-		/* No bracket expression matches end of string,
-		 * slash in pathname match or initial period with FNM_PERIOD
-		 * option.
-		 */
-		return 0;
-	}
-
-	if (*p == '^' || *p == '!') {
-		negative = true;
-		p++;
-	}
-
-	if (*p == ']') {
-		/* When ']' is first, treat it as a normal character. */
-		_matched(*str == ']');
-		p++;
-	}
-	
-	coll_elm_t current_elm = COLL_ELM_INVALID;
-	
-	while (*p != ']') {
-		if (*p == '-' && *(p + 1) != ']' &&
-		    current_elm != COLL_ELM_INVALID) {
-			/* Range expression. */
-			p++;
-			coll_elm_t end_elm = _next_coll_elm(&p, flags);
-			if (end_elm == COLL_ELM_INVALID) {
-				return INVALID_PATTERN;
-			}
-			_matched(_coll_elm_between(current_elm, end_elm, str));
-			continue;
-		}
-	
-		if (*p == '[' && *(p + 1) == ':') {
-			current_elm = COLL_ELM_INVALID;
-			_matched(_match_char_class(&p, str, flags));
-			continue;
-		}
-		
-		current_elm = _next_coll_elm(&p, flags);
-		if (current_elm == COLL_ELM_INVALID) {
-			return INVALID_PATTERN;
-		}
-		_matched(_coll_elm_match(current_elm, str));
-	}
-
-	/* No error occured - update pattern pointer. */
-	*pattern = p + 1;
-
-	if (matched == 0) {
-		/* No match found */
-		return negative;
-	} else {
-		/* Matched 'match' characters. */
-		return negative ? 0 : matched;
-	}
-
-	#undef _matched
-}
-
-/**
- * Matches a portion of the pattern containing no asterisks (*) against
- * the given string.
- * 
- * @param pattern Pointer to the unmatched portion of the pattern.
- *     On success, the pointer is moved to the first asterisk, or to the
- *     terminating nul character, whichever occurs first.
- * @param string Pointer to the input string. On success, the pointer is moved
- *     to the first character that wasn't explicitly matched.
- * @param flags Flags given to fnmatch().
- * @return True if the entire subpattern matched. False otherwise.
- */
-static bool _partial_match(const char **pattern, const char **string, int flags)
-{
-	/* Only a single *-delimited subpattern is matched here.
-	 * So in this function, '*' is understood as the end of pattern.
-	 */
-
-	const bool pathname = (flags & FNM_PATHNAME) != 0;
-	const bool special_period = (flags & FNM_PERIOD) != 0;
-	const bool noescape = (flags & FNM_NOESCAPE) != 0;
-	const bool leading_dir = (flags & FNM_LEADING_DIR) != 0;
-
-	const char *s = *string;
-	const char *p = *pattern;
-
-	while (*p != '*') {
-		/* Bracket expression. */
-		if (*p == '[') {
-			int matched = _match_bracket_expr(&p, s, flags);
-			if (matched == 0) {
-				/* Doesn't match. */
-				return false;
-			}
-			if (matched != INVALID_PATTERN) {
-				s += matched;
-				continue;
-			}
-
-			assert(matched == INVALID_PATTERN);
-			/* Fall through to match [ as an ordinary character. */
-		}
-
-		/* Wildcard match. */
-		if (*p == '?') {
-			if (*s == '\0') {
-				/* No character to match. */
-				return false;
-			}
-			if (pathname && *s == '/') {
-				/* Slash must be matched explicitly. */
-				return false;
-			}
-			if (special_period && pathname &&
-			    *s == '.' && *(s - 1) == '/') {
-				/* Initial period must be matched explicitly. */
-				return false;
-			}
-			
-			/* None of the above, match anything else. */
-			p++;
-			s++;
-			continue;
-		}
-
-		if (!noescape && *p == '\\') {
-			/* Escaped character. */
-			p++;
-		}
-
-		if (*p == '\0') {
-			/* End of pattern, must match end of string or
-			 * an end of subdirectory name (optional).
-			 */
-
-			if (*s == '\0' || (leading_dir && *s == '/')) {
-				break;
-			}
-
-			return false;
-		}
-
-		if (*p == *s) {
-			/* Exact match. */
-			p++;
-			s++;
-			continue;
-		}
-
-		/* Nothing matched. */
-		return false;
-	}
-
-	/* Entire sub-pattern matched. */
-	
-	/* postconditions */
-	assert(*p == '\0' || *p == '*');
-	assert(*p != '\0' || *s == '\0' || (leading_dir && *s == '/'));
-	
-	*pattern = p;
-	*string = s;
-	return true;
-}
-
-/**
- * Match string against a pattern.
- * 
- * @param pattern Pattern.
- * @param string String to match.
- * @param flags Flags given to fnmatch().
- * @return True if the string matched the pattern, false otherwise.
- */
-static bool _full_match(const char *pattern, const char *string, int flags)
-{
-	const bool pathname = (flags & FNM_PATHNAME) != 0;
-	const bool special_period = (flags & FNM_PERIOD) != 0;
-	const bool leading_dir = (flags & FNM_LEADING_DIR) != 0;
-
-	if (special_period && *string == '.') {
-		/* Initial dot must be matched by an explicit dot in pattern. */
-		if (*pattern != '.') {
-			return false;
-		}
-		pattern++;
-		string++;
-	}
-
-	if (*pattern != '*') {
-		if (!_partial_match(&pattern, &string, flags)) {
-			/* The initial match must succeed. */
-			return false;
-		}
-	}
-
-	while (*pattern != '\0') {
-		assert(*pattern == '*');
-		pattern++;
-
-		bool matched = false;
-
-		const char *end;
-		if (pathname && special_period &&
-		    *string == '.' && *(string - 1) == '/') {
-			end = string;
-		} else {
-			end = gnu_strchrnul(string, pathname ? '/' : '\0');
-		}
-
-		/* Try to match every possible offset. */
-		while (string <= end) {
-			if (_partial_match(&pattern, &string, flags)) {
-				matched = true;
-				break;
-			}
-			string++;
-		}
-
-		if (matched) {
-			continue;
-		}
-
-		return false;
-	}
-
-	return *string == '\0' || (leading_dir && *string == '/');
-}
-
-/**
- * Transform the entire string to lowercase.
- * 
- * @param s Input string.
- * @return Newly allocated copy of the input string with all uppercase
- *     characters folded to their lowercase variants.
- */
-static char *_casefold(const char *s)
-{
-	assert(s != NULL);
-	char *result = strdup(s);
-	for (char *i = result; *i != '\0'; ++i) {
-		*i = tolower(*i);
-	}
-	return result;
-}
-
-/**
- * Filename pattern matching.
- *
- * @param pattern Pattern to match the string against.
- * @param string Matched string.
- * @param flags Flags altering the matching of special characters
- *     (mainly for dot and slash).
- * @return Zero if the string matches the pattern, FNM_NOMATCH otherwise.
- */
-int fnmatch(const char *pattern, const char *string, int flags)
-{
-	assert(pattern != NULL);
-	assert(string != NULL);
-
-	// TODO: don't fold everything in advance, but only when needed
-
-	if ((flags & FNM_CASEFOLD) != 0) {
-		/* Just fold the entire pattern and string. */
-		pattern = _casefold(pattern);
-		string = _casefold(string);
-	}
-
-	bool result = _full_match(pattern, string, flags);
-
-	if ((flags & FNM_CASEFOLD) != 0) {
-		if (pattern) {
-			free((char *) pattern);
-		}
-		if (string) {
-			free((char *) string);
-		}
-	}
-
-	return result ? 0 : FNM_NOMATCH;
-}
-
-// FIXME: put the testcases to the app/tester after fnmatch is included into libc
-
-#if 0
-
-#include <stdio.h>
-
-void __posix_fnmatch_test()
-{
-	int fail = 0;
-
-	#undef assert
-	#define assert(x) { if (x) printf("SUCCESS: "#x"\n"); else { printf("FAILED: "#x"\n"); fail++; } }
-	#define match(s1, s2, flags) assert(fnmatch(s1, s2, flags) == 0)
-	#define nomatch(s1, s2, flags) assert(fnmatch(s1, s2, flags) == FNM_NOMATCH)
-
-	static_assert(FNM_PATHNAME == FNM_FILE_NAME);
-	match("", "", 0);
-	match("*", "hello", 0);
-	match("hello", "hello", 0);
-	match("hello*", "hello", 0);
-	nomatch("hello?", "hello", 0);
-	match("*hello", "prdel hello", 0);
-	match("he[sl]lo", "hello", 0);
-	match("he[sl]lo", "heslo", 0);
-	nomatch("he[sl]lo", "heblo", 0);
-	nomatch("he[^sl]lo", "hello", 0);
-	nomatch("he[^sl]lo", "heslo", 0);
-	match("he[^sl]lo", "heblo", 0);
-	nomatch("he[!sl]lo", "hello", 0);
-	nomatch("he[!sl]lo", "heslo", 0);
-	match("he[!sl]lo", "heblo", 0);
-	match("al*[c-t]a*vis*ta", "alheimer talir jehovista", 0);
-	match("al*[c-t]a*vis*ta", "alfons had jehovista", 0);
-	match("[a-ce-z]", "a", 0);
-	match("[a-ce-z]", "c", 0);
-	nomatch("[a-ce-z]", "d", 0);
-	match("[a-ce-z]", "e", 0);
-	match("[a-ce-z]", "z", 0);
-	nomatch("[^a-ce-z]", "a", 0);
-	nomatch("[^a-ce-z]", "c", 0);
-	match("[^a-ce-z]", "d", 0);
-	nomatch("[^a-ce-z]", "e", 0);
-	nomatch("[^a-ce-z]", "z", 0);
-	match("helen??", "helenos", 0);
-	match("****booo****", "booo", 0);
-	
-	match("hello[[:space:]]world", "hello world", 0);
-	nomatch("hello[[:alpha:]]world", "hello world", 0);
-	
-	match("/hoooo*", "/hooooooo/hooo", 0);
-	nomatch("/hoooo*", "/hooooooo/hooo", FNM_PATHNAME);
-	nomatch("/hoooo*/", "/hooooooo/hooo", FNM_PATHNAME);
-	match("/hoooo*/*", "/hooooooo/hooo", FNM_PATHNAME);
-	match("/hoooo*/hooo", "/hooooooo/hooo", FNM_PATHNAME);
-	match("/hoooo*", "/hooooooo/hooo", FNM_PATHNAME | FNM_LEADING_DIR);
-	nomatch("/hoooo*/", "/hooooooo/hooo", FNM_PATHNAME | FNM_LEADING_DIR);
-	nomatch("/hoooo", "/hooooooo/hooo", FNM_LEADING_DIR);
-	match("/hooooooo", "/hooooooo/hooo", FNM_LEADING_DIR);
-	
-	match("*", "hell", 0);
-	match("*?", "hell", 0);
-	match("?*?", "hell", 0);
-	match("?*??", "hell", 0);
-	match("??*??", "hell", 0);
-	nomatch("???*??", "hell", 0);
-	
-	nomatch("", "hell", 0);
-	nomatch("?", "hell", 0);
-	nomatch("??", "hell", 0);
-	nomatch("???", "hell", 0);
-	match("????", "hell", 0);
-	
-	match("*", "h.ello", FNM_PERIOD);
-	match("*", "h.ello", FNM_PATHNAME | FNM_PERIOD);
-	nomatch("*", ".hello", FNM_PERIOD);
-	match("h?ello", "h.ello", FNM_PERIOD);
-	nomatch("?hello", ".hello", FNM_PERIOD);
-	match("/home/user/.*", "/home/user/.hello", FNM_PATHNAME | FNM_PERIOD);
-	match("/home/user/*", "/home/user/.hello", FNM_PERIOD);
-	nomatch("/home/user/*", "/home/user/.hello", FNM_PATHNAME | FNM_PERIOD);
-
-	nomatch("HeLlO", "hello", 0);
-	match("HeLlO", "hello", FNM_CASEFOLD);
-
-	printf("Failed: %d\n", fail);
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/posix/src/internal/common.h
===================================================================
--- uspace/lib/posix/src/internal/common.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Helper definitions common for all libposix files.
- */
-
-#ifndef LIBPOSIX_COMMON_H_
-#define LIBPOSIX_COMMON_H_
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <offset.h>
-#include <vfs/vfs.h>
-
-#define not_implemented() do { \
-		static int __not_implemented_counter = 0; \
-		if (__not_implemented_counter == 0) { \
-			fprintf(stderr, "%s() not implemented in %s:%d, something will NOT work.\n", \
-				__func__, __FILE__, __LINE__); \
-		} \
-		__not_implemented_counter++; \
-	} while (0)
-
-// Just a marker for external tools.
-#define _HIDE_LIBC_SYMBOL(symbol)
-
-/* Checks if the value is a failing error code.
- * If so, writes the error code to errno and returns true.
- */
-static inline bool failed(int rc) {
-	if (rc != EOK) {
-		errno = rc;
-		return true;
-	}
-	return false;
-}
-
-extern aoff64_t posix_pos[MAX_OPEN_FILES];
-
-#endif /* LIBPOSIX_COMMON_H_ */
-
-/** @}
- */
Index: pace/lib/posix/src/locale.c
===================================================================
--- uspace/lib/posix/src/locale.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,182 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Locale-specific definitions.
- */
-
-#include "internal/common.h"
-#include "posix/locale.h"
-
-#include <errno.h>
-
-#include "posix/limits.h"
-#include "posix/string.h"
-
-/* Just a very basic dummy implementation.
- * This should allow code using locales to work properly, but doesn't provide
- * any localization functionality.
- * Should be extended/rewritten when or if HelenOS supports locales natively.
- */
-
-struct __posix_locale {
-	int _dummy;
-};
-
-const struct lconv C_LOCALE = {
-	.currency_symbol = (char *) "",
-	.decimal_point = (char *) ".",
-	.frac_digits = CHAR_MAX,
-	.grouping = (char *) "",
-	.int_curr_symbol = (char *) "",
-	.int_frac_digits = CHAR_MAX,
-	.int_n_cs_precedes = CHAR_MAX,
-	.int_n_sep_by_space = CHAR_MAX,
-	.int_n_sign_posn = CHAR_MAX,
-	.int_p_cs_precedes = CHAR_MAX,
-	.int_p_sep_by_space = CHAR_MAX,
-	.int_p_sign_posn = CHAR_MAX,
-	.mon_decimal_point = (char *) "",
-	.mon_grouping = (char *) "",
-	.mon_thousands_sep = (char *) "",
-	.negative_sign = (char *) "",
-	.n_cs_precedes = CHAR_MAX,
-	.n_sep_by_space = CHAR_MAX,
-	.n_sign_posn = CHAR_MAX,
-	.positive_sign = (char *) "",
-	.p_cs_precedes = CHAR_MAX,
-	.p_sep_by_space = CHAR_MAX,
-	.p_sign_posn = CHAR_MAX,
-	.thousands_sep = (char *) ""
-};
-
-/**
- * Set program locale.
- * 
- * @param category What category to set.
- * @param locale Locale name.
- * @return Original locale name on success, NULL on failure.
- */
-char *setlocale(int category, const char *locale)
-{
-	// TODO
-	if (locale == NULL || *locale == '\0' ||
-	    strcmp(locale, "C") == 0) {
-		return (char *) "C";
-	}
-	return NULL;
-}
-
-/**
- * Return locale-specific information.
- * 
- * @return Information about the current locale.
- */
-struct lconv *localeconv(void)
-{
-	// TODO
-	return (struct lconv *) &C_LOCALE;
-}
-
-/**
- * Duplicate locale object.
- * 
- * @param locobj Object to duplicate.
- * @return Duplicated object.
- */
-locale_t duplocale(locale_t locobj)
-{
-	if (locobj == NULL) {
-		errno = EINVAL;
-		return NULL;
-	}
-	locale_t copy = malloc(sizeof(struct __posix_locale));
-	if (copy == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-	memcpy(copy, locobj, sizeof(struct __posix_locale));
-	return copy;
-}
-
-/**
- * Free locale object.
- * 
- * @param locobj Object to free.
- */
-void freelocale(locale_t locobj)
-{
-	if (locobj) {
-		free(locobj);
-	}
-}
-
-/**
- * Create or modify a locale object.
- * 
- * @param category_mask Mask of categories to be set or modified.
- * @param locale Locale to be used.
- * @param base Object to modify. 0 if new object is to be created.
- * @return The new/modified locale object.
- */
-locale_t newlocale(int category_mask, const char *locale,
-    locale_t base)
-{
-	if (locale == NULL ||
-	    (category_mask & LC_ALL_MASK) != category_mask) {
-		errno = EINVAL;
-		return NULL;
-	}
-	// TODO
-	locale_t new = malloc(sizeof(struct __posix_locale));
-	if (new == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-	if (base != NULL) {
-		freelocale(base);
-	}
-	return new;
-}
-
-/**
- * Set locale for the current thread.
- * 
- * @param newloc Locale to use.
- * @return The previously set locale or LC_GLOBAL_LOCALE
- */
-locale_t uselocale(locale_t newloc)
-{
-	// TODO
-	return LC_GLOBAL_LOCALE;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/pthread/condvar.c
===================================================================
--- uspace/lib/posix/src/pthread/condvar.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Pthread: condition variables.
- */
-
-#include "posix/pthread.h"
-#include "errno.h"
-#include "../internal/common.h"
-
-int pthread_cond_init(pthread_cond_t *restrict condvar,
-    const pthread_condattr_t *restrict attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_cond_destroy(pthread_cond_t *condvar)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_cond_broadcast(pthread_cond_t *condvar)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_cond_signal(pthread_cond_t *condvar)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_cond_timedwait(pthread_cond_t *restrict condvar,
-    pthread_mutex_t *restrict mutex, const struct timespec *restrict timeout)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_cond_wait(pthread_cond_t *restrict condvar,
-    pthread_mutex_t *restrict mutex)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-
-int pthread_condattr_init(pthread_condattr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_condattr_destroy(pthread_condattr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-
-/** @}
- */
Index: pace/lib/posix/src/pthread/keys.c
===================================================================
--- uspace/lib/posix/src/pthread/keys.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Pthread: keys and thread-specific storage.
- */
-
-#include "posix/stdlib.h"
-#include "posix/pthread.h"
-#include <errno.h>
-#include "../internal/common.h"
-
-
-void *pthread_getspecific(pthread_key_t key)
-{
-	not_implemented();
-	return NULL;
-}
-
-int pthread_setspecific(pthread_key_t key, const void *data)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_key_delete(pthread_key_t key)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_key_create(pthread_key_t *key, void (*destructor)(void*))
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/pthread/mutex.c
===================================================================
--- uspace/lib/posix/src/pthread/mutex.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Pthread: mutexes.
- */
-
-#include "posix/pthread.h"
-#include <errno.h>
-#include "../internal/common.h"
-
-
-int pthread_mutex_init(pthread_mutex_t *restrict mutex,
-    const pthread_mutexattr_t *restrict attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutex_destroy(pthread_mutex_t *mutex)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutex_lock(pthread_mutex_t *mutex)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutex_trylock(pthread_mutex_t *mutex)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutex_unlock(pthread_mutex_t *mutex)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutexattr_init(pthread_mutexattr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict attr,
-    int *restrict type)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-
-
-/** @}
- */
Index: pace/lib/posix/src/pthread/threads.c
===================================================================
--- uspace/lib/posix/src/pthread/threads.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Pthread: thread management.
- */
-
-#include "posix/pthread.h"
-#include "errno.h"
-#include "posix/stdlib.h"
-#include "libc/thread.h"
-#include "../internal/common.h"
-
-pthread_t pthread_self(void)
-{
-	return thread_get_id();
-}
-
-int pthread_equal(pthread_t thread1, pthread_t thread2)
-{
-	return thread1 == thread2;
-}
-
-int pthread_create(pthread_t *thread_id, const pthread_attr_t *attributes,
-    void *(*start_routine)(void *), void *arg)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_join(pthread_t thread, void **ret_val)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_detach(pthread_t thread)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_attr_init(pthread_attr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_attr_destroy(pthread_attr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/pwd.c
===================================================================
--- uspace/lib/posix/src/pwd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Password handling.
- */
-
-#include "libc/stdbool.h"
-#include "posix/pwd.h"
-#include "posix/string.h"
-#include <errno.h>
-#include <assert.h>
-
-static bool entry_read = false;
-
-/* dummy user account */
-static const struct passwd dummy_pwd = {
-	.pw_name = (char *) "user",
-	.pw_uid = 0,
-	.pw_gid = 0,
-	.pw_dir = (char *) "/",
-	.pw_shell = (char *) "/app/bdsh"
-};
-
-/**
- * Retrieve next broken-down entry from the user database.
- *
- * Since HelenOS doesn't have user accounts, this always returns
- * the same made-up entry.
- *
- * @return Next user database entry or NULL if not possible. Since HelenOS
- *     doesn't have user accounts, this always returns the same made-up entry.
- */
-struct passwd *getpwent(void)
-{
-	if (entry_read) {
-		return NULL;
-	}
-
-	entry_read = true;
-	return (struct passwd *) &dummy_pwd;
-}
-
-/**
- * Rewind the user list.
- */
-void setpwent(void)
-{
-	entry_read = false;
-}
-
-/**
- * Ends enumerating and releases all resources. (Noop)
- */
-void endpwent(void)
-{
-	/* noop */
-}
-
-/**
- * Find an entry by name.
- *
- * @param name Name of the entry.
- * @return Either found entry or NULL if no such entry exists.
- */
-struct passwd *getpwnam(const char *name)
-{
-	assert(name != NULL);
-
-	if (strcmp(name, "user") != 0) {
-		return NULL;
-	}
-
-	return (struct passwd *) &dummy_pwd;
-}
-
-/**
- * Find an entry by name, thread safely.
- *
- * @param name Name of the entry.
- * @param pwd Original structure.
- * @param buffer Buffer for the strings referenced from the result structure.
- * @param bufsize Length of the buffer.
- * @param result Where to store updated structure.
- * @return Zero on success (either found or not found, but without an error),
- *     non-zero error number if error occured.
- */
-int getpwnam_r(const char *name, struct passwd *pwd,
-    char *buffer, size_t bufsize, struct passwd **result)
-{
-	assert(name != NULL);
-	assert(pwd != NULL);
-	assert(buffer != NULL);
-	assert(result != NULL);
-	
-	if (strcmp(name, "user") != 0) {
-		*result = NULL;
-		return 0;
-	}
-	
-	return getpwuid_r(0, pwd, buffer, bufsize, result);
-}
-
-/**
- * Find an entry by UID.
- *
- * @param uid UID of the entry.
- * @return Either found entry or NULL if no such entry exists.
- */
-struct passwd *getpwuid(uid_t uid)
-{
-	if (uid != 0) {
-		return NULL;
-	}
-
-	return (struct passwd *) &dummy_pwd;
-}
-
-/**
- * Find an entry by UID, thread safely.
- *
- * @param uid UID of the entry.
- * @param pwd Original structure.
- * @param buffer Buffer for the strings referenced from the result structure.
- * @param bufsize Length of the buffer.
- * @param result Where to store updated structure.
- * @return Zero on success (either found or not found, but without an error),
- *     non-zero error number if error occured.
- */
-int getpwuid_r(uid_t uid, struct passwd *pwd,
-    char *buffer, size_t bufsize, struct passwd **result)
-{
-	assert(pwd != NULL);
-	assert(buffer != NULL);
-	assert(result != NULL);
-	
-	static const char bf[] = { 'u', 's', 'e', 'r', '\0',
-	    '/', '\0', 'b', 'd', 's', 'h', '\0' };
-	
-	if (uid != 0) {
-		*result = NULL;
-		return 0;
-	}
-	if (bufsize < sizeof(bf)) {
-		*result = NULL;
-		return ERANGE;
-	}
-
-	memcpy(buffer, bf, sizeof(bf));
-
-	pwd->pw_name = (char *) bf;
-	pwd->pw_uid = 0;
-	pwd->pw_gid = 0;
-	pwd->pw_dir = (char *) bf + 5;
-	pwd->pw_shell = (char *) bf + 7;
-	*result = (struct passwd *) pwd;
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/signal.c
===================================================================
--- uspace/lib/posix/src/signal.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,565 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Signal handling.
- */
-
-#include "posix/signal.h"
-#include "internal/common.h"
-#include "posix/limits.h"
-#include "posix/stdlib.h"
-#include "posix/string.h"
-
-#include <errno.h>
-
-#include "libc/fibril_synch.h"
-#include "libc/task.h"
-
-/* This file implements a fairly dumb and incomplete "simulation" of
- * POSIX signals. Since HelenOS doesn't support signals and mostly doesn't
- * have any equivalent functionality, most of the signals are useless. The
- * main purpose of this implementation is thus to help port applications using
- * signals with minimal modification, but if the application uses signals for
- * anything non-trivial, it's quite probable it won't work properly even if
- * it builds without problems.
- */
-
-/* Used to serialize signal handling. */
-static FIBRIL_MUTEX_INITIALIZE(_signal_mutex);
-
-static LIST_INITIALIZE(_signal_queue);
-
-static sigset_t _signal_mask = 0;
-
-#define DEFAULT_HANDLER { .sa_handler = SIG_DFL, \
-    .sa_mask = 0, .sa_flags = 0, .sa_sigaction = NULL }
-
-/* Actions associated with each signal number. */
-static struct sigaction _signal_actions[_TOP_SIGNAL + 1] = {
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, 
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER
-};
-
-/**
- * Default signal handler. Executes the default action for each signal,
- * as reasonable within HelenOS.
- *
- * @param signo Signal number.
- */
-void __posix_default_signal_handler(int signo)
-{
-	switch (signo) {
-	case SIGABRT:
-		abort();
-	case SIGQUIT:
-		fprintf(stderr, "Quit signal raised. Exiting.\n");
-		exit(EXIT_FAILURE);
-	case SIGINT:
-		fprintf(stderr, "Interrupt signal caught. Exiting.\n");
-		exit(EXIT_FAILURE);
-	case SIGTERM:
-		fprintf(stderr, "Termination signal caught. Exiting.\n");
-		exit(EXIT_FAILURE);
-	case SIGSTOP:
-		fprintf(stderr, "Stop signal caught, but unsupported. Ignoring.\n");
-		break;
-	case SIGKILL:
-		/* This will only occur when raise or similar is called. */
-		/* Commit suicide. */
-		task_kill(task_get_id());
-		
-		/* Should not be reached. */
-		abort();
-	case SIGFPE:
-	case SIGBUS:
-	case SIGILL:
-	case SIGSEGV:
-		psignal(signo, "Hardware exception raised by user code");
-		abort();
-	case SIGSYS:
-	case SIGXCPU:
-	case SIGXFSZ:
-	case SIGTRAP:
-	case SIGHUP:
-	case SIGPIPE:
-	case SIGPOLL:
-	case SIGURG:
-	case SIGTSTP:
-	case SIGTTIN:
-	case SIGTTOU:
-		psignal(signo, "Unsupported signal caught");
-		abort();
-	case SIGCHLD:
-	case SIGUSR1:
-	case SIGUSR2:
-	case SIGALRM:
-	case SIGVTALRM:
-	case SIGPROF:
-	case SIGCONT:
-		/* ignored */
-		break;
-	}
-}
-
-/**
- * Just an empty function to get an unique pointer value for comparison.
- *
- * @param signo Signal number.
- */
-void __posix_hold_signal_handler(int signo)
-{
-	/* Nothing */
-}
-
-/**
- * Empty function to be used as ignoring handler.
- * 
- * @param signo Signal number.
- */
-void __posix_ignore_signal_handler(int signo)
-{
-	/* Nothing */
-}
-
-/**
- * Clear the signal set.
- * 
- * @param set Pointer to the signal set.
- * @return Always returns zero.
- */
-int sigemptyset(sigset_t *set)
-{
-	assert(set != NULL);
-
-	*set = 0;
-	return 0;
-}
-
-/**
- * Fill the signal set (i.e. add all signals).
- * 
- * @param set Pointer to the signal set.
- * @return Always returns zero.
- */
-int sigfillset(sigset_t *set)
-{
-	assert(set != NULL);
-
-	*set = UINT32_MAX;
-	return 0;
-}
-
-/**
- * Add a signal to the set.
- * 
- * @param set Pointer to the signal set.
- * @param signo Signal number to add.
- * @return Always returns zero.
- */
-int sigaddset(sigset_t *set, int signo)
-{
-	assert(set != NULL);
-
-	*set |= (1 << signo);
-	return 0;
-}
-
-/**
- * Delete a signal from the set.
- * 
- * @param set Pointer to the signal set.
- * @param signo Signal number to remove.
- * @return Always returns zero.
- */
-int sigdelset(sigset_t *set, int signo)
-{
-	assert(set != NULL);
-
-	*set &= ~(1 << signo);
-	return 0;
-}
-
-/**
- * Inclusion test for a signal set.
- * 
- * @param set Pointer to the signal set.
- * @param signo Signal number to query.
- * @return 1 if the signal is in the set, 0 otherwise.
- */
-int sigismember(const sigset_t *set, int signo)
-{
-	assert(set != NULL);
-	
-	return (*set & (1 << signo)) != 0;
-}
-
-/**
- * Unsafe variant of the sigaction() function.
- * Doesn't do any checking of its arguments and
- * does not deal with thread-safety.
- * 
- * @param sig
- * @param act
- * @param oact
- */
-static void _sigaction_unsafe(int sig, const struct sigaction *restrict act,
-    struct sigaction *restrict oact)
-{
-	if (oact != NULL) {
-		memcpy(oact, &_signal_actions[sig],
-		    sizeof(struct sigaction));
-	}
-
-	if (act != NULL) {
-		memcpy(&_signal_actions[sig], act,
-		    sizeof(struct sigaction));
-	}
-}
-
-/**
- * Sets a new action for the given signal number.
- * 
- * @param sig Signal number to set action for.
- * @param act If not NULL, contents of this structure are
- *     used as the new action for the signal.
- * @param oact If not NULL, the original action associated with the signal
- *     is stored in the structure pointer to. 
- * @return -1 with errno set on failure, 0 on success.
- */
-int sigaction(int sig, const struct sigaction *restrict act,
-    struct sigaction *restrict oact)
-{
-	if (sig > _TOP_SIGNAL || (act != NULL &&
-	    (sig == SIGKILL || sig == SIGSTOP))) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (sig > _TOP_CATCHABLE_SIGNAL) {
-		psignal(sig,
-		    "WARNING: registering handler for a partially"
-		    " or fully unsupported signal. This handler may only be"
-		    " invoked by the raise() function, which may not be what"
-		    " the application developer intended");
-	}
-
-	fibril_mutex_lock(&_signal_mutex);
-	_sigaction_unsafe(sig, act, oact);
-	fibril_mutex_unlock(&_signal_mutex);
-
-	return 0;
-}
-
-/**
- * Sets a new handler for the given signal number.
- * 
- * @param sig Signal number to set handler for.
- * @param func Handler function.
- * @return SIG_ERR on failure, original handler on success.
- */
-void (*signal(int sig, void (*func)(int)))(int)
-{
-	struct sigaction new = {
-		.sa_handler = func,
-		.sa_mask = 0,
-		.sa_flags = 0,
-		.sa_sigaction = NULL
-	};
-	struct sigaction old;
-	if (sigaction(sig, func == NULL ? NULL : &new, &old) == 0) {
-		return old.sa_handler;
-	} else {
-		return SIG_ERR;
-	}
-}
-
-typedef struct {
-	link_t link;
-	int signo;
-	siginfo_t siginfo;
-} signal_queue_item;
-
-/**
- * Queue blocked signal.
- *
- * @param signo Signal number.
- * @param siginfo Additional information about the signal.
- */
-static void _queue_signal(int signo, siginfo_t *siginfo)
-{
-	assert(signo >= 0 && signo <= _TOP_SIGNAL);
-	assert(siginfo != NULL);
-	
-	signal_queue_item *item = malloc(sizeof(signal_queue_item));
-	link_initialize(&(item->link));
-	item->signo = signo;
-	memcpy(&item->siginfo, siginfo, sizeof(siginfo_t));
-	list_append(&(item->link), &_signal_queue);
-}
-
-
-/**
- * Executes an action associated with the given signal.
- *
- * @param signo Signal number.
- * @param siginfo Additional information about the circumstances of this raise.
- * @return 0 if the action has been successfully executed. -1 if the signal is
- *     blocked.
- */
-static int _raise_sigaction(int signo, siginfo_t *siginfo)
-{
-	assert(signo >= 0 && signo <= _TOP_SIGNAL);
-	assert(siginfo != NULL);
-
-	fibril_mutex_lock(&_signal_mutex);
-
-	struct sigaction action = _signal_actions[signo];
-
-	if (sigismember(&_signal_mask, signo) ||
-	    action.sa_handler == SIG_HOLD) {
-		_queue_signal(signo, siginfo);
-		fibril_mutex_unlock(&_signal_mutex);
-		return -1;
-	}
-
-	/* Modifying signal mask is unnecessary,
-	 * signal handling is serialized.
-	 */
-
-	if ((action.sa_flags & SA_RESETHAND) && signo != SIGILL && signo != SIGTRAP) {
-		_signal_actions[signo] = (struct sigaction) DEFAULT_HANDLER;
-	}
-
-	if (action.sa_flags & SA_SIGINFO) {
-		assert(action.sa_sigaction != NULL);
-		action.sa_sigaction(signo, siginfo, NULL);
-	} else {
-		assert(action.sa_handler != NULL);
-		action.sa_handler(signo);
-	}
-
-	fibril_mutex_unlock(&_signal_mutex);
-
-	return 0;
-}
-
-/**
- * Raise all unblocked previously queued signals.
- */
-static void _dequeue_unblocked_signals(void)
-{
-	link_t *iterator = _signal_queue.head.next;
-	link_t *next;
-	
-	while (iterator != &(_signal_queue).head) {
-		next = iterator->next;
-		
-		signal_queue_item *item =
-		    list_get_instance(iterator, signal_queue_item, link);
-		
-		if (!sigismember(&_signal_mask, item->signo) &&
-		    _signal_actions[item->signo].sa_handler != SIG_HOLD) {
-			list_remove(&(item->link));
-			_raise_sigaction(item->signo, &(item->siginfo));
-			free(item);
-		}
-		
-		iterator = next;
-	}
-}
-
-/**
- * Raise a signal for the calling process.
- * 
- * @param sig Signal number.
- * @return -1 with errno set on failure, 0 on success.
- */
-int raise(int sig)
-{
-	if (sig >= 0 && sig <= _TOP_SIGNAL) {
-		siginfo_t siginfo = {
-			.si_signo = sig,
-			.si_code = SI_USER
-		};
-		return _raise_sigaction(sig, &siginfo);
-	} else {
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-/**
- * Raises a signal for a selected process.
- * 
- * @param pid PID of the process for which the signal shall be raised.
- * @param signo Signal to raise.
- * @return -1 with errno set on failure (possible errors include unsupported
- *     action, invalid signal number, lack of permissions, etc.), 0 on success.
- */
-int kill(pid_t pid, int signo)
-{
-	if (pid < 1) {
-		// TODO
-		errno = ENOTSUP;
-		return -1;
-	}
-
-	if (signo > _TOP_SIGNAL) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (pid == (pid_t) task_get_id()) {
-		return raise(signo);
-	}
-
-	switch (signo) {
-	case SIGKILL:
-		task_kill(pid);
-		break;
-	default:
-		/* Nothing else supported yet. */
-		errno = ENOTSUP;
-		return -1;
-	}
-
-	return 0;
-}
-
-/**
- * Send a signal to a process group. Always fails at the moment because of
- * lack of this functionality in HelenOS.
- * 
- * @param pid PID of the process group.
- * @param sig Signal number.
- * @return -1 on failure, 0 on success (see kill()).
- */
-int killpg(pid_t pid, int sig)
-{
-	assert(pid > 1);
-	return kill(-pid, sig);
-}
-
-/**
- * Outputs information about the signal to the standard error stream.
- * 
- * @param pinfo SigInfo struct to write.
- * @param message String to output alongside human-readable signal description.
- */
-void psiginfo(const siginfo_t *pinfo, const char *message)
-{
-	assert(pinfo != NULL);
-	psignal(pinfo->si_signo, message);
-	// TODO: print si_code
-}
-
-/**
- * Outputs information about the signal to the standard error stream.
- * 
- * @param signum Signal number.
- * @param message String to output alongside human-readable signal description.
- */
-void psignal(int signum, const char *message)
-{
-	char *sigmsg = strsignal(signum);
-	if (message == NULL || *message == '\0') {
-		fprintf(stderr, "%s\n", sigmsg);
-	} else {
-		fprintf(stderr, "%s: %s\n", message, sigmsg);
-	}
-}
-
-/**
- * Manipulate the signal mask of the calling thread.
- * 
- * @param how What to do with the mask.
- * @param set Signal set to work with.
- * @param oset If not NULL, the original signal mask is coppied here.
- * @return 0 success, errorcode on failure.
- */
-int thread_sigmask(int how, const sigset_t *restrict set,
-    sigset_t *restrict oset)
-{
-	fibril_mutex_lock(&_signal_mutex);
-
-	if (oset != NULL) {
-		*oset = _signal_mask;
-	}
-	if (set != NULL) {
-		switch (how) {
-		case SIG_BLOCK:
-			_signal_mask |= *set;
-			break;
-		case SIG_UNBLOCK:
-			_signal_mask &= ~*set;
-			break;
-		case SIG_SETMASK:
-			_signal_mask = *set;
-			break;
-		default:
-			fibril_mutex_unlock(&_signal_mutex);
-			return EINVAL;
-		}
-	}
-	
-	_dequeue_unblocked_signals();
-
-	fibril_mutex_unlock(&_signal_mutex);
-
-	return 0;
-}
-
-/**
- * Manipulate the signal mask of the process.
- * 
- * @param how What to do with the mask.
- * @param set Signal set to work with.
- * @param oset If not NULL, the original signal mask is coppied here.
- * @return 0 on success, -1 with errno set on failure.
- */
-int sigprocmask(int how, const sigset_t *restrict set,
-    sigset_t *restrict oset)
-{
-	int result = thread_sigmask(how, set, oset);
-	if (result != 0) {
-		errno = result;
-		return -1;
-	}
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/stdio.c
===================================================================
--- uspace/lib/posix/src/stdio.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,594 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Standard buffered input/output.
- */
-
-#include "internal/common.h"
-#include "posix/stdio.h"
-
-#include <assert.h>
-
-#include <errno.h>
-
-#include "posix/stdlib.h"
-#include "posix/string.h"
-#include "posix/sys/types.h"
-#include "posix/unistd.h"
-
-#include "libc/stdio.h"
-#include "libc/io/printf_core.h"
-#include "libc/str.h"
-#include "libc/malloc.h"
-#include "libc/adt/list.h"
-
-/**
- * Generate a pathname for the controlling terminal.
- *
- * @param s Allocated buffer to which the pathname shall be put.
- * @return Either s or static location filled with the requested pathname.
- */
-char *ctermid(char *s)
-{
-	/* Currently always returns an error value (empty string). */
-	// TODO: return a real terminal path
-
-	static char dummy_path[L_ctermid] = {'\0'};
-
-	if (s == NULL) {
-		return dummy_path;
-	}
-
-	s[0] = '\0';
-	return s;
-}
-
-/**
- * Read a stream until the delimiter (or EOF) is encountered.
- *
- * @param lineptr Pointer to the output buffer in which there will be stored
- *     nul-terminated string together with the delimiter (if encountered).
- *     Will be resized if necessary.
- * @param n Pointer to the size of the output buffer. Will be increased if
- *     necessary.
- * @param delimiter Delimiter on which to finish reading the stream.
- * @param stream Input stream.
- * @return Number of fetched characters (including delimiter if encountered)
- *     or -1 on error (set in errno).
- */
-ssize_t getdelim(char **restrict lineptr, size_t *restrict n,
-    int delimiter, FILE *restrict stream)
-{
-	/* Check arguments for sanity. */
-	if (!lineptr || !n) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	size_t alloc_step = 80; /* Buffer size gain during reallocation. */
-	char *pos = *lineptr; /* Next free byte of the output buffer. */
-	size_t cnt = 0; /* Number of fetched characters. */
-	int c = fgetc(stream); /* Current input character. Might be EOF. */
-
-	do {
-		/* Mask EOF as NUL to terminate string. */
-		if (c == EOF) {
-			c = '\0';
-		}
-
-		/* Ensure there is still space left in the buffer. */
-		if (pos == *lineptr + *n) {
-			*lineptr = realloc(*lineptr, *n + alloc_step);
-			if (*lineptr) {
-				pos = *lineptr + *n;
-				*n += alloc_step;
-			} else {
-				errno = ENOMEM;
-				return -1;
-			}
-		}
-
-		/* Store the fetched character. */
-		*pos = c;
-
-		/* Fetch the next character according to the current character. */
-		if (c != '\0') {
-			++pos;
-			++cnt;
-			if (c == delimiter) {
-				/* Delimiter was just stored. Provide EOF as the next
-				 * character - it will be masked as NUL and output string
-				 * will be properly terminated. */
-				c = EOF;
-			} else {
-				/* Neither delimiter nor EOF were encountered. Just fetch
-				 * the next character from the stream. */
-				c = fgetc(stream);
-			}
-		}
-	} while (c != '\0');
-
-	if (errno == EOK && cnt > 0) {
-		return cnt;
-	} else {
-		/* Either some error occured or the stream was already at EOF. */
-		return -1;
-	}
-}
-
-/**
- * Read a stream until the newline (or EOF) is encountered.
- * 
- * @param lineptr Pointer to the output buffer in which there will be stored
- *     nul-terminated string together with the delimiter (if encountered).
- *     Will be resized if necessary.
- * @param n Pointer to the size of the output buffer. Will be increased if
- *     necessary.
- * @param stream Input stream.
- * @return Number of fetched characters (including newline if encountered)
- *     or -1 on error (set in errno).
- */
-ssize_t getline(char **restrict lineptr, size_t *restrict n,
-    FILE *restrict stream)
-{
-	return getdelim(lineptr, n, '\n', stream);
-}
-
-/**
- * Write error messages to standard error.
- *
- * @param s Error message.
- */
-void perror(const char *s)
-{
-	if (s == NULL || s[0] == '\0') {
-		fprintf(stderr, "%s\n", strerror(errno));
-	} else {
-		fprintf(stderr, "%s: %s\n", s, strerror(errno));
-	}
-}
-
-/** Restores stream a to position previously saved with fgetpos().
- *
- * @param stream Stream to restore
- * @param pos Position to restore
- * @return Zero on success, non-zero (with errno set) on failure
- */
-int fsetpos(FILE *stream, const fpos_t *pos)
-{
-	return fseek64(stream, pos->offset, SEEK_SET);
-}
-
-/** Saves the stream's position for later use by fsetpos().
- *
- * @param stream Stream to save
- * @param pos Place to store the position
- * @return Zero on success, non-zero (with errno set) on failure
- */
-int fgetpos(FILE *restrict stream, fpos_t *restrict pos)
-{
-	off64_t ret = ftell64(stream);
-	if (ret != -1) {
-		pos->offset = ret;
-		return 0;
-	} else {
-		return -1;
-	}
-}
-
-/**
- * Reposition a file-position indicator in a stream.
- * 
- * @param stream Stream to seek in.
- * @param offset Direction and amount of bytes to seek.
- * @param whence From where to seek.
- * @return Zero on success, -1 otherwise.
- */
-int fseeko(FILE *stream, off_t offset, int whence)
-{
-	return fseek64(stream, offset, whence);
-}
-
-/**
- * Discover current file offset in a stream.
- * 
- * @param stream Stream for which the offset shall be retrieved.
- * @return Current offset or -1 if not possible.
- */
-off_t ftello(FILE *stream)
-{
-	return ftell64(stream);
-}
-
-/**
- * Print formatted output to the opened file.
- *
- * @param fildes File descriptor of the opened file.
- * @param format Format description.
- * @return Either the number of printed characters or negative value on error.
- */
-int dprintf(int fildes, const char *restrict format, ...)
-{
-	va_list list;
-	va_start(list, format);
-	int result = vdprintf(fildes, format, list);
-	va_end(list);
-	return result;
-}
-
-/**
- * Write ordinary string to the opened file.
- *
- * @param str String to be written.
- * @param size Size of the string (in bytes)..
- * @param fd File descriptor of the opened file.
- * @return The number of written characters.
- */
-static int _dprintf_str_write(const char *str, size_t size, void *fd)
-{
-	const int fildes = *(int *) fd;
-	size_t wr;
-	if (failed(vfs_write(fildes, &posix_pos[fildes], str, size, &wr)))
-		return -1;
-	return str_nlength(str, wr);
-}
-
-/**
- * Write wide string to the opened file.
- * 
- * @param str String to be written.
- * @param size Size of the string (in bytes).
- * @param fd File descriptor of the opened file.
- * @return The number of written characters.
- */
-static int _dprintf_wstr_write(const wchar_t *str, size_t size, void *fd)
-{
-	size_t offset = 0;
-	size_t chars = 0;
-	size_t sz;
-	char buf[4];
-	
-	while (offset < size) {
-		sz = 0;
-		if (chr_encode(str[chars], buf, &sz, sizeof(buf)) != EOK) {
-			break;
-		}
-		
-		const int fildes = *(int *) fd;
-		size_t nwr;
-		if (vfs_write(fildes, &posix_pos[fildes], buf, sz, &nwr) != EOK)
-			break;
-		
-		chars++;
-		offset += sizeof(wchar_t);
-	}
-	
-	return chars;
-}
-
-/**
- * Print formatted output to the opened file.
- * 
- * @param fildes File descriptor of the opened file.
- * @param format Format description.
- * @param ap Print arguments.
- * @return Either the number of printed characters or negative value on error.
- */
-int vdprintf(int fildes, const char *restrict format, va_list ap)
-{
-	printf_spec_t spec = {
-		.str_write = _dprintf_str_write,
-		.wstr_write = _dprintf_wstr_write,
-		.data = &fildes
-	};
-	
-	return printf_core(format, &spec, ap);
-}
-
-/**
- * Print formatted output to the string.
- * 
- * @param s Output string.
- * @param format Format description.
- * @return Either the number of printed characters (excluding null byte) or
- *     negative value on error.
- */
-int sprintf(char *s, const char *restrict format, ...)
-{
-	va_list list;
-	va_start(list, format);
-	int result = vsprintf(s, format, list);
-	va_end(list);
-	return result;
-}
-
-/**
- * Print formatted output to the string.
- * 
- * @param s Output string.
- * @param format Format description.
- * @param ap Print arguments.
- * @return Either the number of printed characters (excluding null byte) or
- *     negative value on error.
- */
-int vsprintf(char *s, const char *restrict format, va_list ap)
-{
-	return vsnprintf(s, STR_NO_LIMIT, format, ap);
-}
-
-/**
- * Convert formatted input from the stream.
- * 
- * @param stream Input stream.
- * @param format Format description.
- * @return The number of converted output items or EOF on failure.
- */
-int fscanf(FILE *restrict stream, const char *restrict format, ...)
-{
-	va_list list;
-	va_start(list, format);
-	int result = vfscanf(stream, format, list);
-	va_end(list);
-	return result;
-}
-
-/**
- * Convert formatted input from the standard input.
- * 
- * @param format Format description.
- * @return The number of converted output items or EOF on failure.
- */
-int scanf(const char *restrict format, ...)
-{
-	va_list list;
-	va_start(list, format);
-	int result = vscanf(format, list);
-	va_end(list);
-	return result;
-}
-
-/**
- * Convert formatted input from the standard input.
- * 
- * @param format Format description.
- * @param arg Output items.
- * @return The number of converted output items or EOF on failure.
- */
-int vscanf(const char *restrict format, va_list arg)
-{
-	return vfscanf(stdin, format, arg);
-}
-
-/**
- * Convert formatted input from the string.
- * 
- * @param s Input string.
- * @param format Format description.
- * @return The number of converted output items or EOF on failure.
- */
-int sscanf(const char *restrict s, const char *restrict format, ...)
-{
-	va_list list;
-	va_start(list, format);
-	int result = vsscanf(s, format, list);
-	va_end(list);
-	return result;
-}
-
-/**
- * Acquire file stream for the thread.
- *
- * @param file File stream to lock.
- */
-void flockfile(FILE *file)
-{
-	/* dummy */
-}
-
-/**
- * Acquire file stream for the thread (non-blocking).
- *
- * @param file File stream to lock.
- * @return Zero for success and non-zero if the lock cannot be acquired.
- */
-int ftrylockfile(FILE *file)
-{
-	/* dummy */
-	return 0;
-}
-
-/**
- * Relinquish the ownership of the locked file stream.
- *
- * @param file File stream to unlock.
- */
-void funlockfile(FILE *file)
-{
-	/* dummy */
-}
-
-/**
- * Get a byte from a stream (thread-unsafe).
- *
- * @param stream Input file stream.
- * @return Either read byte or EOF.
- */
-int getc_unlocked(FILE *stream)
-{
-	return getc(stream);
-}
-
-/**
- * Get a byte from the standard input stream (thread-unsafe).
- *
- * @return Either read byte or EOF.
- */
-int getchar_unlocked(void)
-{
-	return getchar();
-}
-
-/**
- * Put a byte on a stream (thread-unsafe).
- *
- * @param c Byte to output.
- * @param stream Output file stream.
- * @return Either written byte or EOF.
- */
-int putc_unlocked(int c, FILE *stream)
-{
-	return putc(c, stream);
-}
-
-/**
- * Put a byte on the standard output stream (thread-unsafe).
- * 
- * @param c Byte to output.
- * @return Either written byte or EOF.
- */
-int putchar_unlocked(int c)
-{
-	return putchar(c);
-}
-
-/**
- * Get a unique temporary file name (obsolete).
- *
- * @param s Buffer for the file name. Must be at least L_tmpnam bytes long.
- * @return The value of s on success, NULL on failure.
- */
-char *tmpnam(char *s)
-{
-	assert(L_tmpnam >= strlen("/tmp/tnXXXXXX"));
-	
-	static char buffer[L_tmpnam + 1];
-	if (s == NULL) {
-		s = buffer;
-	}
-	
-	strcpy(s, "/tmp/tnXXXXXX");
-	mktemp(s);
-	
-	if (*s == '\0') {
-		/* Errno set by mktemp(). */
-		return NULL;
-	}
-	
-	return s;
-}
-
-/**
- * Get an unique temporary file name with additional constraints (obsolete).
- *
- * @param dir Path to directory, where the file should be created.
- * @param pfx Optional prefix up to 5 characters long.
- * @return Newly allocated unique path for temporary file. NULL on failure.
- */
-char *tempnam(const char *dir, const char *pfx)
-{
-	/* Sequence number of the filename. */
-	static int seq = 0;
-	
-	size_t dir_len = strlen(dir);
-	if (dir[dir_len - 1] == '/') {
-		dir_len--;
-	}
-	
-	size_t pfx_len = strlen(pfx);
-	if (pfx_len > 5) {
-		pfx_len = 5;
-	}
-	
-	char *result = malloc(dir_len + /* slash*/ 1 +
-	    pfx_len + /* three-digit seq */ 3 + /* .tmp */ 4 + /* nul */ 1);
-	
-	if (result == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-	
-	char *res_ptr = result;
-	strncpy(res_ptr, dir, dir_len);
-	res_ptr += dir_len;
-	strncpy(res_ptr, pfx, pfx_len);
-	res_ptr += pfx_len;
-	
-	for (; seq < 1000; ++seq) {
-		snprintf(res_ptr, 8, "%03d.tmp", seq);
-		
-		int orig_errno = errno;
-		errno = EOK;
-		/* Check if the file exists. */
-		if (access(result, F_OK) == -1) {
-			if (errno == ENOENT) {
-				errno = orig_errno;
-				break;
-			} else {
-				/* errno set by access() */
-				return NULL;
-			}
-		}
-	}
-	
-	if (seq == 1000) {
-		free(result);
-		errno = EINVAL;
-		return NULL;
-	}
-	
-	return result;
-}
-
-/**
- * Create and open an unique temporary file.
- * The file is automatically removed when the stream is closed.
- *
- * @param dir Path to directory, where the file should be created.
- * @param pfx Optional prefix up to 5 characters long.
- * @return Newly allocated unique path for temporary file. NULL on failure.
- */
-FILE *tmpfile(void)
-{
-	char filename[] = "/tmp/tfXXXXXX";
-	int fd = mkstemp(filename);
-	if (fd == -1) {
-		/* errno set by mkstemp(). */
-		return NULL;
-	}
-	
-	/* Unlink the created file, so that it's removed on close(). */
-	unlink(filename);
-	return fdopen(fd, "w+");
-}
-
-/** @}
- */
Index: pace/lib/posix/src/stdio/scanf.c
===================================================================
--- uspace/lib/posix/src/stdio/scanf.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,1225 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Implementation of the scanf backend.
- */
-
-#include <assert.h>
-
-#include <errno.h>
-
-#include "posix/stdio.h"
-#include "posix/stdlib.h"
-#include "posix/stddef.h"
-#include "posix/string.h"
-#include "posix/ctype.h"
-#include "posix/sys/types.h"
-
-#include "../internal/common.h"
-#include "libc/malloc.h"
-#include "libc/stdbool.h"
-
-/** Unified data type for possible data sources for scanf. */
-typedef union __data_source {
-	FILE *stream; /**< Input file stream. */
-	const char *string; /**< Input string. */
-} _data_source;
-
-/** Internal state of the input provider. */
-enum {
-	/** Partly constructed but not yet functional. */
-	_PROV_CONSTRUCTED,
-	/** Ready to serve any request. */
-	_PROV_READY,
-	/** Cursor is temporarily lent to the external entity. No action is
-	  * possible until the cursor is returned.  */
-	_PROV_CURSOR_LENT,
-};
-
-/** Universal abstraction over data input for scanf. */
-typedef struct __input_provider {
-	/** Source of data elements. */
-	_data_source source;
-	/** How many elements was already processed. */
-	int consumed;
-	/** How many elements was already fetched from the source. */
-	int fetched;
-	/** Elements are fetched from the source in batches (e.g. by getline())
-	  * to allow using strtol/strtod family even on streams. */
-	char *window;
-	/** Size of the current window. */
-	size_t window_size;
-	/** Points to the next element to be processed inside the current window. */
-	const char *cursor;
-	/** Internal state of the provider. */
-	int state;
-
-	/** Take control over data source. Finish initialization of the internal
-	  * structures (e.g. allocation of window). */
-	void (*capture)(struct __input_provider *);
-	/** Get a single element from the source and update the internal structures
-	  * accordingly (e.g. greedy update of the window). Return -1 if the
-	  * element cannot be obtained. */
-	int (*pop)(struct __input_provider *);
-	/** Undo the most recent not-undone pop operation. Might be necesarry to
-	  * flush current window and seek data source backwards. Return 0 if the
-	  * pop history is exhausted, non-zero on success. */
-	int (*undo)(struct __input_provider *);
-	/** Lend the cursor to the caller.  */
-	const char * (*borrow_cursor)(struct __input_provider *);
-	/** Take control over possibly incremented cursor and update the internal
-	  * structures if necessary. */
-	void (*return_cursor)(struct __input_provider *, const char *);
-	/** Release the control over the source. That is, synchronize any
-	  * fetched but non-consumed elements (e.g. by seeking) and destruct
-	  * internal structures (e.g. window deallocation). */
-	void (*release)(struct __input_provider *);
-} _input_provider;
-
-/** @see __input_provider */
-static void _capture_stream(_input_provider *self)
-{
-	assert(self->source.stream);
-	assert(self->state == _PROV_CONSTRUCTED);
-	/* Caller could already pre-allocated the window. */
-	assert((self->window == NULL && self->window_size == 0) ||
-	    (self->window && self->window_size > 0));
-
-	/* Initialize internal structures. */
-	self->consumed = 0;
-	ssize_t fetched = getline(
-	    &self->window, &self->window_size, self->source.stream);
-	if (fetched != -1) {
-		self->fetched = fetched;
-		self->cursor = self->window;
-	} else {
-		/* EOF encountered. */
-		self->fetched = 0;
-		self->cursor = NULL;
-	}
-	self->state = _PROV_READY;
-}
-
-/** @see __input_provider */
-static void _capture_string(_input_provider *self)
-{
-	assert(self->source.string);
-	assert(self->state == _PROV_CONSTRUCTED);
-
-	/* Initialize internal structures. */
-	self->consumed = 0;
-	self->fetched = strlen(self->source.string);
-	self->window = (char *) self->source.string;
-	self->window_size = self->fetched + 1;
-	self->cursor = self->window;
-	self->state = _PROV_READY;
-}
-
-/** @see __input_provider */
-static int _pop_stream(_input_provider *self)
-{
-	assert(self->state == _PROV_READY);
-
-	if (self->cursor) {
-		int c = *self->cursor;
-		++self->consumed;
-		++self->cursor;
-		/* Do we need to fetch a new line from the source? */
-		if (*self->cursor == '\0') {
-			ssize_t fetched = getline(&self->window,
-			    &self->window_size, self->source.stream);
-			if (fetched != -1) {
-				self->fetched += fetched;
-				self->cursor = self->window;
-			} else {
-				/* EOF encountered. */
-				self->cursor = NULL;
-			}
-		}
-		return c;
-	} else {
-		/* Already at EOF. */
-		return -1;
-	}
-}
-
-/** @see __input_provider */
-static int _pop_string(_input_provider *self)
-{
-	assert(self->state == _PROV_READY);
-
-	if (*self->cursor != '\0') {
-		int c = *self->cursor;
-		++self->consumed;
-		++self->cursor;
-		return c;
-	} else {
-		/* String depleted. */
-		return -1;
-	}
-}
-
-/** @see __input_provider */
-static int _undo_stream(_input_provider *self)
-{
-	assert(self->state == _PROV_READY);
-
-	if (self->consumed == 0) {
-		/* Undo history exhausted. */
-		return 0;
-	}
-
-	if (!self->cursor || self->window == self->cursor) {
-		/* Complex case. Either at EOF (cursor == NULL) or there is no more
-		 * place to retreat to inside the window. Seek the source backwards
-		 * and flush the window. Regarding the scanf, this could happend only
-		 * when matching unbounded string (%s) or unbounded scanset (%[) not
-		 * containing newline, while at the same time newline is the character
-		 * that breaks the matching process. */
-		int rc = fseek(self->source.stream, -1, SEEK_CUR);
-		if (rc == -1) {
-			/* Seek failed.  */
-			return 0;
-		}
-		ssize_t fetched = getline(&self->window,
-		    &self->window_size, self->source.stream);
-		if (fetched != -1) {
-			assert(fetched == 1);
-			self->fetched = self->consumed + 1;
-			self->cursor = self->window;
-		} else {
-			/* Stream is broken. */
-			return 0;
-		}
-	} else {
-		/* Simple case. Still inside window. */
-		--self->cursor;
-	}
-	--self->consumed;
-	return 1; /* Success. */
-}
-
-/** @see __input_provider */
-static int _undo_string(_input_provider *self)
-{
-	assert(self->state == _PROV_READY);
-
-	if (self->consumed > 0) {
-		--self->consumed;
-		--self->cursor;
-	} else {
-		/* Undo history exhausted. */
-		return 0;
-	}
-	return 1; /* Success. */
-}
-
-/** @see __input_provider */
-static const char *_borrow_cursor_universal(_input_provider *self)
-{
-	assert(self->state == _PROV_READY);
-
-	self->state = _PROV_CURSOR_LENT;
-	return self->cursor;
-}
-
-/** @see __input_provider */
-static void _return_cursor_stream(_input_provider *self, const char *cursor)
-{
-	assert(self->state == _PROV_CURSOR_LENT);
-
-	/* Check how much of the window did external entity consumed. */
-	self->consumed += cursor - self->cursor;
-	self->cursor = cursor;
-	if (*self->cursor == '\0') {
-		/* Window was completely consumed, fetch new data. */
-		ssize_t fetched = getline(&self->window,
-		    &self->window_size, self->source.stream);
-		if (fetched != -1) {
-			self->fetched += fetched;
-			self->cursor = self->window;
-		} else {
-			/* EOF encountered. */
-			self->cursor = NULL;
-		}
-	}
-	self->state = _PROV_READY;
-}
-
-/** @see __input_provider */
-static void _return_cursor_string(_input_provider *self, const char *cursor)
-{
-	assert(self->state == _PROV_CURSOR_LENT);
-
-	/* Check how much of the window did external entity consumed. */
-	self->consumed += cursor - self->cursor;
-	self->cursor = cursor;
-	self->state = _PROV_READY;
-}
-
-/** @see __input_provider */
-static void _release_stream(_input_provider *self)
-{
-	assert(self->state == _PROV_READY);
-	assert(self->consumed >= self->fetched);
-
-	/* Try to correct the difference between the stream position and what was
-	 * actually consumed. If it is not possible, continue anyway. */
-	fseek(self->source.stream, self->consumed - self->fetched, SEEK_CUR);
-
-	/* Destruct internal structures. */
-	self->fetched = 0;
-	self->cursor = NULL;
-	if (self->window) {
-		free(self->window);
-		self->window = NULL;
-	}
-	self->window_size = 0;
-	self->state = _PROV_CONSTRUCTED;
-}
-
-/** @see __input_provider */
-static void _release_string(_input_provider *self)
-{
-	assert(self->state == _PROV_READY);
-
-	/* Destruct internal structures. */
-	self->fetched = 0;
-	self->cursor = NULL;
-	self->window = NULL;
-	self->window_size = 0;
-	self->state = _PROV_CONSTRUCTED;
-}
-
-/** Length modifier values. */
-enum {
-	LMOD_NONE,
-	LMOD_hh,
-	LMOD_h,
-	LMOD_l,
-	LMOD_ll,
-	LMOD_j,
-	LMOD_z,
-	LMOD_t,
-	LMOD_L,
-	LMOD_p, /* Reserved for %p conversion. */
-};
-
-/**
- * Decides whether provided characters specify length modifier. If so, the
- * recognized modifier is stored through provider pointer.
- *
- * @param c Candidate on the length modifier.
- * @param _c Next character (might be NUL).
- * @param modifier Pointer to the modifier value.
- * @return Whether the modifier was recognized or not.
- */
-static inline int is_length_mod(int c, int _c, int *modifier)
-{
-	assert(modifier);
-
-	switch (c) {
-	case 'h':
-		/* Check whether the modifier was not already recognized. */
-		if (*modifier == LMOD_NONE) {
-			*modifier = _c == 'h' ? LMOD_hh : LMOD_h;
-		} else {
-			/* Format string is invalid. Notify the caller. */
-			*modifier = LMOD_NONE;
-		}
-		return 1;
-	case 'l':
-		if (*modifier == LMOD_NONE) {
-			*modifier = _c == 'l' ? LMOD_ll : LMOD_l;
-		} else {
-			*modifier = LMOD_NONE;
-		}
-		return 1;
-	case 'j':
-		*modifier = *modifier == LMOD_NONE ? LMOD_j : LMOD_NONE;
-		return 1;
-	case 'z':
-		*modifier = *modifier == LMOD_NONE ? LMOD_z : LMOD_NONE;
-		return 1;
-	case 't':
-		*modifier = *modifier == LMOD_NONE ? LMOD_t : LMOD_NONE;
-		return 1;
-	case 'L':
-		*modifier = *modifier == LMOD_NONE ? LMOD_L : LMOD_NONE;
-		return 1;
-	default:
-		return 0;
-	}
-}
-
-/**
- * Decides whether provided character specifies integer conversion. If so, the
- * semantics of the conversion is stored through provided pointers..
- * 
- * @param c Candidate on the integer conversion.
- * @param is_unsigned Pointer to store whether the conversion is signed or not.
- * @param base Pointer to store the base of the integer conversion.
- * @return Whether the conversion was recognized or not.
- */
-static inline int is_int_conv(int c, bool *is_unsigned, int *base)
-{
-	assert(is_unsigned && base);
-
-	switch (c) {
-	case 'd':
-		*is_unsigned = false;
-		*base = 10;
-		return 1;
-	case 'i':
-		*is_unsigned = false;
-		*base = 0;
-		return 1;
-	case 'o':
-		*is_unsigned = true;
-		*base = 8;
-		return 1;
-	case 'u':
-		*is_unsigned = true;
-		*base = 10;
-		return 1;
-	case 'p': /* According to POSIX, %p modifier is implementation defined but
-			   * must correspond to its printf counterpart. */
-	case 'x':
-	case 'X':
-		*is_unsigned = true;
-		*base = 16;
-		return 1;
-		return 1;
-	default:
-		return 0;
-	}
-}
-
-/**
- * Decides whether provided character specifies conversion of the floating
- * point number.
- *
- * @param c Candidate on the floating point conversion.
- * @return Whether the conversion was recognized or not.
- */
-static inline int is_float_conv(int c)
-{
-	switch (c) {
-	case 'a':
-	case 'A':
-	case 'e':
-	case 'E':
-	case 'f':
-	case 'F':
-	case 'g':
-	case 'G':
-		return 1;
-	default:
-		return 0;
-	}
-}
-
-/**
- * Decides whether provided character specifies conversion of the character
- * sequence.
- *
- * @param c Candidate on the character sequence conversion.
- * @param modifier Pointer to store length modifier for wide chars.
- * @return Whether the conversion was recognized or not.
- */
-static inline int is_seq_conv(int c, int *modifier)
-{
-	assert(modifier);
-	
-	switch (c) {
-	case 'S':
-		*modifier = LMOD_l;
-		/* Fallthrough */
-	case 's':
-		return 1;
-	case 'C':
-		*modifier = LMOD_l;
-		/* Fallthrough */
-	case 'c':
-		return 1;
-	case '[':
-		return 1;
-	default:
-		return 0;
-	}
-}
-
-/**
- * Backend for the whole family of scanf functions. Uses input provider
- * to abstract over differences between strings and streams. Should be
- * POSIX compliant (apart from the not supported stuff).
- *
- * NOT SUPPORTED: locale (see strtold), wide chars, numbered output arguments
- * 
- * @param in Input provider.
- * @param fmt Format description.
- * @param arg Output arguments.
- * @return The number of converted output items or EOF on failure.
- */
-static inline int _internal_scanf(
-    _input_provider *in, const char *restrict fmt, va_list arg)
-{
-	int c = -1;
-	int converted_cnt = 0;
-	bool converting = false;
-	bool matching_failure = false;
-
-	bool assign_supress = false;
-	bool assign_alloc = false;
-	long width = -1;
-	int length_mod = LMOD_NONE;
-	bool int_conv_unsigned = false;
-	int int_conv_base = 0;
-
-	/* Buffers allocated by scanf for optional 'm' specifier must be remembered
-	 * to deallocaate them in case of an error. Because each of those buffers
-	 * corresponds to one of the argument from va_list, there is an upper bound
-	 * on the number of those arguments. In case of C99, this uppper bound is
-	 * 127 arguments. */
-	char *buffers[127];
-	for (int i = 0; i < 127; ++i) {
-		buffers[i] = NULL;
-	}
-	int next_unused_buffer_idx = 0;
-
-	in->capture(in);
-
-	/* Interpret format string. Control shall prematurely jump from the cycle
-	 * on input failure, matching failure or illegal format string. In order
-	 * to keep error reporting simple enough and to keep input consistent,
-	 * error condition shall be always manifested as jump from the cycle,
-	 * not function return. Format string pointer shall be updated specifically
-	 * for each sub-case (i.e. there shall be no loop-wide increment).*/
-	while (*fmt) {
-
-		if (converting) {
-
-			/* Processing inside conversion specifier. Either collect optional
-			 * parameters or execute the conversion. When the conversion
-			 * is successfully completed, increment conversion count and switch
-			 * back to normal mode. */
-			if (*fmt == '*') {
-				/* Assignment-supression (optional). */
-				if (assign_supress) {
-					/* Already set. Illegal format string. */
-					break;
-				}
-				assign_supress = true;
-				++fmt;
-			} else if (*fmt == 'm') {
-				/* Assignment-allocation (optional). */
-				if (assign_alloc) {
-					/* Already set. Illegal format string. */
-					break;
-				}
-				assign_alloc = true;
-				++fmt;
-			} else if (*fmt == '$') {
-				/* Reference to numbered output argument. */
-				// TODO
-				not_implemented();
-			} else if (isdigit(*fmt)) {
-				/* Maximum field length (optional). */
-				if (width != -1) {
-					/* Already set. Illegal format string. */
-					break;
-				}
-				char *fmt_new = NULL;
-				width = strtol(fmt, &fmt_new, 10);
-				if (width != 0) {
-					fmt = fmt_new;
-				} else {
-					/* Since POSIX requires width to be non-zero, it is
-					 * sufficient to interpret zero width as error without
-					 * referring to errno. */
-					break;
-				}
-			} else if (is_length_mod(*fmt, *(fmt + 1), &length_mod)) {
-				/* Length modifier (optional). */
-				if (length_mod == LMOD_NONE) {
-					/* Already set. Illegal format string. The actual detection
-					 * is carried out in the is_length_mod(). */
-					break;
-				}
-				if (length_mod == LMOD_hh || length_mod == LMOD_ll) {
-					/* Modifier was two characters long. */
-					++fmt;
-				}
-				++fmt;
-			} else if (is_int_conv(*fmt, &int_conv_unsigned, &int_conv_base)) {
-				/* Integer conversion. */
-
-				/* Check sanity of optional parts of conversion specifier. */
-				if (assign_alloc || length_mod == LMOD_L) {
-					/* Illegal format string. */
-					break;
-				}
-
-				/* Conversion of the integer with %p specifier needs special
-				 * handling, because it is not allowed to have arbitrary
-				 * length modifier.  */
-				if (*fmt == 'p') {
-					if (length_mod == LMOD_NONE) {
-						length_mod = LMOD_p;
-					} else {
-						/* Already set. Illegal format string. */
-						break;
-					}
-				}
-
-				/* First consume any white spaces, so we can borrow cursor
-				 * from the input provider. This way, the cursor will either
-				 * point to the non-white space while the input will be
-				 * prefetched up to the newline (which is suitable for strtol),
-				 * or the input will be at EOF. */
-				do {
-					c = in->pop(in);
-				} while (isspace(c));
-
-				/* After skipping the white spaces, can we actually continue? */
-				if (c == -1) {
-					/* Input failure. */
-					break;
-				} else {
-					/* Everything is OK, just undo the last pop, so the cursor
-					 * can be borrowed. */
-					in->undo(in);
-				}
-
-				const char *cur_borrowed = NULL;
-				char *cur_duplicated = NULL;
-				const char *cur_limited = NULL;
-				const char *cur_updated = NULL;
-
-				/* Borrow the cursor. Until it is returned to the provider
-				 * we cannot jump from the cycle, because it would leave
-				 * the input inconsistent. */
-				cur_borrowed = in->borrow_cursor(in);
-
-				/* If the width is limited, the cursor horizont must be
-				 * decreased accordingly. Otherwise the strtol could read more
-				 * than allowed by width. */
-				if (width != -1) {
-					cur_duplicated = strndup(cur_borrowed, width);
-					cur_limited = cur_duplicated;
-				} else {
-					cur_limited = cur_borrowed;
-				}
-				cur_updated = cur_limited;
-
-				long long sres = 0;
-				unsigned long long ures = 0;
-				errno = 0; /* Reset errno to recognize error later. */
-				/* Try to convert the integer. */
-				if (int_conv_unsigned) {
-					ures = strtoull(cur_limited, (char **) &cur_updated, int_conv_base);
-				} else {
-					sres = strtoll(cur_limited, (char **) &cur_updated, int_conv_base);
-				}
-
-				/* Update the cursor so it can be returned to the provider. */
-				cur_borrowed += cur_updated - cur_limited;
-				if (cur_duplicated != NULL) {
-					/* Deallocate duplicated part of the cursor view. */
-					free(cur_duplicated);
-				}
-				cur_limited = NULL;
-				cur_updated = NULL;
-				cur_duplicated = NULL;
-				/* Return the cursor to the provider. Input consistency is again
-				 * the job of the provider, so we can report errors from
-				 * now on. */
-				in->return_cursor(in, cur_borrowed);
-				cur_borrowed = NULL;
-
-				/* Check whether the conversion was successful. */
-				if (errno != EOK) {
-					matching_failure = true;
-					break;
-				}
-
-				/* If not supressed, assign the converted integer into
-				 * the next output argument. */
-				if (!assign_supress) {
-					if (int_conv_unsigned) {
-						switch (length_mod) {
-						case LMOD_hh: ; /* Label cannot be part of declaration. */
-							unsigned char *phh = va_arg(arg, unsigned char *);
-							*phh = (unsigned char) ures;
-							break;
-						case LMOD_h: ;
-							unsigned short *ph = va_arg(arg, unsigned short *);
-							*ph = (unsigned short) ures;
-							break;
-						case LMOD_NONE: ;
-							unsigned *pdef = va_arg(arg, unsigned *);
-							*pdef = (unsigned) ures;
-							break;
-						case LMOD_l: ;
-							unsigned long *pl = va_arg(arg, unsigned long *);
-							*pl = (unsigned long) ures;
-							break;
-						case LMOD_ll: ;
-							unsigned long long *pll = va_arg(arg, unsigned long long *);
-							*pll = (unsigned long long) ures;
-							break;
-						case LMOD_j: ;
-							uintmax_t *pj = va_arg(arg, uintmax_t *);
-							*pj = (uintmax_t) ures;
-							break;
-						case LMOD_z: ;
-							size_t *pz = va_arg(arg, size_t *);
-							*pz = (size_t) ures;
-							break;
-						case LMOD_t: ;
-							// XXX: What is unsigned counterpart of the ptrdiff_t?
-							size_t *pt = va_arg(arg, size_t *);
-							*pt = (size_t) ures;
-							break;
-						case LMOD_p: ;
-							void **pp = va_arg(arg, void **);
-							*pp = (void *) (uintptr_t) ures;
-							break;
-						default:
-							assert(false);
-						}
-					} else {
-						switch (length_mod) {
-						case LMOD_hh: ; /* Label cannot be part of declaration. */
-							signed char *phh = va_arg(arg, signed char *);
-							*phh = (signed char) sres;
-							break;
-						case LMOD_h: ;
-							short *ph = va_arg(arg, short *);
-							*ph = (short) sres;
-							break;
-						case LMOD_NONE: ;
-							int *pdef = va_arg(arg, int *);
-							*pdef = (int) sres;
-							break;
-						case LMOD_l: ;
-							long *pl = va_arg(arg, long *);
-							*pl = (long) sres;
-							break;
-						case LMOD_ll: ;
-							long long *pll = va_arg(arg, long long *);
-							*pll = (long long) sres;
-							break;
-						case LMOD_j: ;
-							intmax_t *pj = va_arg(arg, intmax_t *);
-							*pj = (intmax_t) sres;
-							break;
-						case LMOD_z: ;
-							ssize_t *pz = va_arg(arg, ssize_t *);
-							*pz = (ssize_t) sres;
-							break;
-						case LMOD_t: ;
-							ptrdiff_t *pt = va_arg(arg, ptrdiff_t *);
-							*pt = (ptrdiff_t) sres;
-							break;
-						default:
-							assert(false);
-						}
-					}
-					++converted_cnt;
-				}
-
-				converting = false;
-				++fmt;
-			} else if (is_float_conv(*fmt)) {
-				/* Floating point number conversion. */
-
-				/* Check sanity of optional parts of conversion specifier. */
-				if (assign_alloc) {
-					/* Illegal format string. */
-					break;
-				}
-				if (length_mod != LMOD_NONE &&
-				    length_mod != LMOD_l &&
-				    length_mod != LMOD_L) {
-					/* Illegal format string. */
-					break;
-				}
-
-				/* First consume any white spaces, so we can borrow cursor
-				 * from the input provider. This way, the cursor will either
-				 * point to the non-white space while the input will be
-				 * prefetched up to the newline (which is suitable for strtof),
-				 * or the input will be at EOF. */
-				do {
-					c = in->pop(in);
-				} while (isspace(c));
-
-				/* After skipping the white spaces, can we actually continue? */
-				if (c == -1) {
-					/* Input failure. */
-					break;
-				} else {
-					/* Everything is OK, just undo the last pop, so the cursor
-					 * can be borrowed. */
-					in->undo(in);
-				}
-
-				const char *cur_borrowed = NULL;
-				const char *cur_limited = NULL;
-				char *cur_duplicated = NULL;
-				const char *cur_updated = NULL;
-
-				/* Borrow the cursor. Until it is returned to the provider
-				 * we cannot jump from the cycle, because it would leave
-				 * the input inconsistent. */
-				cur_borrowed = in->borrow_cursor(in);
-
-				/* If the width is limited, the cursor horizont must be
-				 * decreased accordingly. Otherwise the strtof could read more
-				 * than allowed by width. */
-				if (width != -1) {
-					cur_duplicated = strndup(cur_borrowed, width);
-					cur_limited = cur_duplicated;
-				} else {
-					cur_limited = cur_borrowed;
-				}
-				cur_updated = cur_limited;
-
-				float fres = 0.0;
-				double dres = 0.0;
-				long double ldres = 0.0;
-				errno = 0; /* Reset errno to recognize error later. */
-				/* Try to convert the floating point nubmer. */
-				switch (length_mod) {
-				case LMOD_NONE:
-					fres = strtof(cur_limited, (char **) &cur_updated);
-					break;
-				case LMOD_l:
-					dres = strtod(cur_limited, (char **) &cur_updated);
-					break;
-				case LMOD_L:
-					ldres = strtold(cur_limited, (char **) &cur_updated);
-					break;
-				default:
-					assert(false);
-				}
-
-				/* Update the cursor so it can be returned to the provider. */
-				cur_borrowed += cur_updated - cur_limited;
-				if (cur_duplicated != NULL) {
-					/* Deallocate duplicated part of the cursor view. */
-					free(cur_duplicated);
-				}
-				cur_limited = NULL;
-				cur_updated = NULL;
-				/* Return the cursor to the provider. Input consistency is again
-				 * the job of the provider, so we can report errors from
-				 * now on. */
-				in->return_cursor(in, cur_borrowed);
-				cur_borrowed = NULL;
-
-				/* Check whether the conversion was successful. */
-				if (errno != EOK) {
-					matching_failure = true;
-					break;
-				}
-
-				/* If nto supressed, assign the converted floating point number
-				 * into the next output argument. */
-				if (!assign_supress) {
-					switch (length_mod) {
-					case LMOD_NONE: ; /* Label cannot be part of declaration. */
-						float *pf = va_arg(arg, float *);
-						*pf = fres;
-						break;
-					case LMOD_l: ;
-						double *pd = va_arg(arg, double *);
-						*pd = dres;
-						break;
-					case LMOD_L: ;
-						long double *pld = va_arg(arg, long double *);
-						*pld = ldres;
-						break;
-					default:
-						assert(false);
-					}
-					++converted_cnt;
-				}
-
-				converting = false;
-				++fmt;
-			} else if (is_seq_conv(*fmt, &length_mod)) {
-				/* Character sequence conversion. */
-				
-				/* Check sanity of optional parts of conversion specifier. */
-				if (length_mod != LMOD_NONE &&
-				    length_mod != LMOD_l) {
-					/* Illegal format string. */
-					break;
-				}
-
-				if (length_mod == LMOD_l) {
-					/* Wide chars not supported. */
-					// TODO
-					not_implemented();
-				}
-
-				int term_size = 1; /* Size of the terminator (0 or 1)). */
-				if (*fmt == 'c') {
-					term_size = 0;
-					width = width == -1 ? 1 : width;
-				}
-
-				if (*fmt == 's') {
-					/* Skip white spaces. */
-					do {
-						c = in->pop(in);
-					} while (isspace(c));
-				} else {
-					/* Fetch a single character. */
-					c = in->pop(in);
-				}
-
-				/* Check whether there is still input to read. */
-				if (c == -1) {
-					/* Input failure. */
-					break;
-				}
-
-				/* Prepare scanset. */
-				char terminate_on[256];
-				for (int i = 0; i < 256; ++i) {
-					terminate_on[i] = 0;
-				}
-				if (*fmt == 'c') {
-					++fmt;
-				} else if (*fmt == 's') {
-					terminate_on[' '] = 1;
-					terminate_on['\n'] = 1;
-					terminate_on['\t'] = 1;
-					terminate_on['\f'] = 1;
-					terminate_on['\r'] = 1;
-					terminate_on['\v'] = 1;
-					++fmt;
-				} else {
-					assert(*fmt == '[');
-					bool not = false;
-					bool dash = false;
-					++fmt;
-					/* Check for negation. */
-					if (*fmt == '^') {
-						not = true;
-						++fmt;
-					}
-					/* Check for escape sequences. */
-					if (*fmt == '-' || *fmt == ']') {
-						terminate_on[(int) *fmt] = 1;
-						++fmt;
-					}
-					/* Check for ordinary characters and ranges. */
-					while (*fmt != '\0' && *fmt != ']') {
-						if (dash) {
-							for (char chr = *(fmt - 2); chr <= *fmt; ++chr) {
-								terminate_on[(int) chr] = 1;
-							}
-							dash = false;
-						} else if (*fmt == '-') {
-							dash = true;
-						} else {
-							terminate_on[(int) *fmt] = 1;
-						}
-						++fmt;
-					}
-					/* Check for escape sequence. */
-					if (dash == true) {
-						terminate_on['-'] = 1;
-					}
-					/* Check whether the specifier was correctly terminated.*/
-					if (*fmt == '\0') {
-						/* Illegal format string. */
-						break;
-					} else {
-						++fmt;
-					}
-					/* Inverse the scanset if necessary. */
-					if (not == false) {
-						for (int i = 0; i < 256; ++i) {
-							terminate_on[i] = terminate_on[i] ? 0 : 1;
-						}
-					}
-				}
-
-				char * buf = NULL;
-				size_t buf_size = 0;
-				char * cur = NULL;
-				size_t alloc_step = 80; /* Buffer size gain during reallocation. */
-				int my_buffer_idx = 0;
-
-				/* Retrieve the buffer into which popped characters
-				 * will be stored. */
-				if (!assign_supress) {
-					if (assign_alloc) {
-						/* We must allocate our own buffer. */
-						buf_size =
-						    width == -1 ? alloc_step : (size_t) width + term_size;
-						buf = malloc(buf_size);
-						if (!buf) {
-							/* No memory. */
-							break;
-						}
-						my_buffer_idx = next_unused_buffer_idx;
-						++next_unused_buffer_idx;
-						buffers[my_buffer_idx] = buf;
-						cur = buf;
-					} else {
-						/* Caller provided its buffer. */
-						buf = va_arg(arg, char *);
-						cur = buf;
-						buf_size =
-						    width == -1 ? SIZE_MAX : (size_t) width + term_size;
-					}
-				}
-
-				/* Match the string. The next character is already popped. */
-				while ((width == -1 || width > 0) && c != -1 && !terminate_on[c]) {
-
-					/* Check whether the buffer is still sufficiently large. */
-					if (!assign_supress) {
-						/* Always reserve space for the null terminator. */
-						if (cur == buf + buf_size - term_size) {
-							/* Buffer size must be increased. */
-							buf = realloc(buf, buf_size + alloc_step);
-							if (buf) {
-								buffers[my_buffer_idx] = buf;
-								cur = buf + buf_size - term_size;
-								buf_size += alloc_step;
-							} else {
-								/* Break just from this tight loop. Errno will
-								 * be checked after it. */
-								break;
-							}
-						}
-						/* Store the input character. */
-						*cur = c;
-					}
-
-					width = width == -1 ? -1 : width - 1;
-					++cur;
-					c = in->pop(in);
-				}
-				if (errno == ENOMEM) {
-					/* No memory. */
-					break;
-				}
-				if (c != -1) {
-					/* There is still more input, so undo the last pop. */
-					in->undo(in);
-				}
-
-				/* Check for failures. */
-				if (cur == buf) {
-					/* Matching failure. Input failure was already checked
-					 * earlier. */
-					matching_failure = true;
-					if (!assign_supress && assign_alloc) {
-						/* Roll back. */
-						free(buf);
-						buffers[my_buffer_idx] = NULL;
-						--next_unused_buffer_idx;
-					}
-					break;
-				}
-
-				/* Store the terminator. */
-				if (!assign_supress && term_size > 0) {
-					/* Space for the terminator was reserved. */
-					*cur = '\0';
-				}
-
-				/* Store the result if not already stored. */
-				if (!assign_supress) {
-					if (assign_alloc) {
-						char **pbuf = va_arg(arg, char **);
-						*pbuf = buf;
-					}
-					++converted_cnt;
-				}
-				
-				converting = false;
-				/* Format string pointer already incremented. */
-			} else if (*fmt == 'n') {
-				/* Report the number of consumed bytes so far. */
-
-				/* Sanity check. */
-				bool sane =
-				    width == -1 &&
-				    length_mod == LMOD_NONE &&
-				    assign_alloc == false &&
-				    assign_supress == false;
-
-				if (sane) {
-					int *pi = va_arg(arg, int *);
-					*pi = in->consumed;
-				} else {
-					/* Illegal format string. */
-					break;
-				}
-
-				/* This shall not be counted as conversion. */
-				converting = false;
-				++fmt;
-			} else {
-				/* Illegal format string. */
-				break;
-			}
-			
-		} else {
-
-			/* Processing outside conversion specifier. Either skip white
-			 * spaces or match characters one by one. If conversion specifier
-			 * is detected, switch to coversion mode. */
-			if (isspace(*fmt)) {
-				/* Skip white spaces in the format string. */
-				while (isspace(*fmt)) {
-					++fmt;
-				}
-				/* Skip white spaces in the input. */
-				do {
-					c = in->pop(in);
-				} while (isspace(c));
-				if (c != -1) {
-					/* Input is not at EOF, so undo the last pop operation. */
-					in->undo(in);
-				}
-			} else if (*fmt == '%' && *(fmt + 1) != '%') {
-				/* Conversion specifier detected. Switch modes. */
-				converting = true;
-				/* Reset the conversion context. */
-				assign_supress = false;
-				assign_alloc = false;
-				width = -1;
-				length_mod = LMOD_NONE;
-				int_conv_unsigned = false;
-				int_conv_base = 0;
-				++fmt;
-			} else {
-				/* One by one matching. */
-				if (*fmt == '%') {
-					/* Escape sequence detected. */
-					++fmt;
-					assert(*fmt == '%');
-				}
-				c = in->pop(in);
-				if (c == -1) {
-					/* Input failure. */
-					break;
-				} else if (c != *fmt) {
-					/* Matching failure. */
-					in->undo(in);
-					matching_failure = true;
-					break;
-				} else {
-					++fmt;
-				}
-			}
-			
-		}
-
-	}
-
-	in->release(in);
-
-	/* This somewhat complicated return value decision is required by POSIX. */
-	int rc;
-	if (matching_failure) {
-		rc = converted_cnt;
-	} else {
-		if (errno == EOK) {
-			rc = converted_cnt > 0 ? converted_cnt : EOF;
-		} else {
-			rc = EOF;
-		}
-	}
-	if (rc == EOF) {
-		/* Caller will not know how many arguments were successfully converted,
-		 * so the deallocation of buffers is our responsibility. */
-		for (int i = 0; i < next_unused_buffer_idx; ++i) {
-			free(buffers[i]);
-			buffers[i] = NULL;
-		}
-		next_unused_buffer_idx = 0;
-	}
-	return rc;
-}
-
-/**
- * Convert formatted input from the stream.
- *
- * @param stream Input stream.
- * @param format Format description.
- * @param arg Output items.
- * @return The number of converted output items or EOF on failure.
- */
-int vfscanf(
-    FILE *restrict stream, const char *restrict format, va_list arg)
-{
-	_input_provider provider = {
-	    { 0 }, 0, 0, NULL, 0, NULL, _PROV_CONSTRUCTED,
-	    _capture_stream, _pop_stream, _undo_stream,
-	    _borrow_cursor_universal, _return_cursor_stream, _release_stream
-	};
-	provider.source.stream = stream;
-	return _internal_scanf(&provider, format, arg);
-}
-
-/**
- * Convert formatted input from the string.
- *
- * @param s Input string.
- * @param format Format description.
- * @param arg Output items.
- * @return The number of converted output items or EOF on failure.
- */
-int vsscanf(
-    const char *restrict s, const char *restrict format, va_list arg)
-{
-	_input_provider provider = {
-	    { 0 }, 0, 0, NULL, 0, NULL, _PROV_CONSTRUCTED,
-	    _capture_string, _pop_string, _undo_string,
-	    _borrow_cursor_universal, _return_cursor_string, _release_string
-	};
-	provider.source.string = s;
-	return _internal_scanf(&provider, format, arg);
-}
-
-/** @}
- */
Index: pace/lib/posix/src/stdlib.c
===================================================================
--- uspace/lib/posix/src/stdlib.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,415 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Standard library definitions.
- */
-
-#include "internal/common.h"
-#include "posix/stdlib.h"
-
-#include <errno.h>
-
-#include "posix/fcntl.h"
-#include "posix/limits.h"
-#include "posix/string.h"
-#include "posix/sys/stat.h"
-#include "posix/unistd.h"
-
-#include "libc/qsort.h"
-#include "libc/str.h"
-#include "libc/vfs/vfs.h"
-#include "libc/stats.h"
-
-/**
- * 
- * @param array
- * @param count
- * @param size
- * @param compare
- */
-int atexit(void (*func)(void))
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return 0;
-}
-
-/**
- * Integer absolute value.
- * 
- * @param i Input value.
- * @return Absolute value of the parameter.
- */
-int abs(int i)
-{
-	return i < 0 ? -i : i;
-}
-
-/**
- * Long integer absolute value.
- * 
- * @param i Input value.
- * @return Absolute value of the parameter.
- */
-long labs(long i)
-{
-	return i < 0 ? -i : i;
-}
-
-/**
- * Long long integer absolute value.
- * 
- * @param i Input value.
- * @return Absolute value of the parameter.
- */
-long long llabs(long long i)
-{
-	return i < 0 ? -i : i;
-}
-
-/**
- * Compute the quotient and remainder of an integer division.
- *
- * @param numer Numerator.
- * @param denom Denominator.
- * @return Quotient and remainder packed into structure.
- */
-div_t div(int numer, int denom)
-{
-	return (div_t) { .quot = numer / denom, .rem = numer % denom };
-}
-
-/**
- * Compute the quotient and remainder of a long integer division.
- *
- * @param numer Numerator.
- * @param denom Denominator.
- * @return Quotient and remainder packed into structure.
- */
-ldiv_t ldiv(long numer, long denom)
-{
-	return (ldiv_t) { .quot = numer / denom, .rem = numer % denom };
-}
-
-/**
- * Compute the quotient and remainder of a long long integer division.
- *
- * @param numer Numerator.
- * @param denom Denominator.
- * @return Quotient and remainder packed into structure.
- */
-lldiv_t lldiv(long long numer, long long denom)
-{
-	return (lldiv_t) { .quot = numer / denom, .rem = numer % denom };
-}
-
-/**
- * Binary search in a sorted array.
- *
- * @param key Object to search for.
- * @param base Pointer to the first element of the array.
- * @param nmemb Number of elements in the array.
- * @param size Size of each array element.
- * @param compar Comparison function.
- * @return Pointer to a matching element, or NULL if none can be found.
- */
-void *bsearch(const void *key, const void *base,
-    size_t nmemb, size_t size, int (*compar)(const void *, const void *))
-{
-	while (nmemb > 0) {
-		const void *middle = base + (nmemb / 2) * size;
-		int cmp = compar(key, middle);
-		if (cmp == 0) {
-			return (void *) middle;
-		}
-		if (middle == base) {
-			/* There is just one member left to check and it
-			 * didn't match the key. Avoid infinite loop.
-			 */
-			break;
-		}
-		if (cmp < 0) {
-			nmemb = nmemb / 2;
-		} else if (cmp > 0) {
-			nmemb = nmemb - (nmemb / 2);
-			base = middle;
-		}
-	}
-	
-	return NULL;
-}
-
-/**
- * Retrieve a value of the given environment variable.
- *
- * Since HelenOS doesn't support env variables at the moment,
- * this function always returns NULL.
- *
- * @param name Name of the variable.
- * @return Value of the variable or NULL if such variable does not exist.
- */
-char *getenv(const char *name)
-{
-	return NULL;
-}
-
-/**
- * 
- * @param name
- * @param resolved
- * @return
- */
-int putenv(char *string)
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return 0;
-}
-
-/**
- * Issue a command.
- *
- * @param string String to be passed to a command interpreter or NULL.
- * @return Termination status of the command if the command is not NULL,
- *     otherwise indicate whether there is a command interpreter (non-zero)
- *     or not (zero).
- */
-int system(const char *string) {
-	// TODO: does nothing at the moment
-	not_implemented();
-	return 0;
-}
-
-/**
- * Resolve absolute pathname.
- * 
- * @param name Pathname to be resolved.
- * @param resolved Either buffer for the resolved absolute pathname or NULL.
- * @return On success, either resolved (if it was not NULL) or pointer to the
- *     newly allocated buffer containing the absolute pathname (if resolved was
- *     NULL). Otherwise NULL.
- *
- */
-char *realpath(const char *restrict name, char *restrict resolved)
-{
-	#ifndef PATH_MAX
-		assert(resolved == NULL);
-	#endif
-	
-	if (name == NULL) {
-		errno = EINVAL;
-		return NULL;
-	}
-	
-	// TODO: symlink resolution
-	
-	/* Function absolutize is implemented in libc and declared in vfs.h.
-	 * No more processing is required as HelenOS doesn't have symlinks
-	 * so far (as far as I can tell), although this function will need
-	 * to be updated when that support is implemented.
-	 */
-	char* absolute = vfs_absolutize(name, NULL);
-	
-	if (absolute == NULL) {
-		/* POSIX requires some specific errnos to be set
-		 * for some cases, but there is no way to find out from
-		 * absolutize().
-		 */
-		errno = EINVAL;
-		return NULL;
-	}
-	
-	if (resolved == NULL) {
-		return absolute;
-	} else {
-		#ifdef PATH_MAX
-			str_cpy(resolved, PATH_MAX, absolute);
-		#endif
-		free(absolute);
-		return resolved;
-	}
-}
-
-/**
- * Converts a string representation of a floating-point number to
- * its native representation. See strtold().
- *
- * @param nptr String representation of a floating-point number.
- * @return Double-precision number resulting from the string conversion.
- */
-double atof(const char *nptr)
-{
-	return strtod(nptr, NULL);
-}
-
-/**
- * Converts a string representation of a floating-point number to
- * its native representation. See strtold().
- *
- * @param nptr String representation of a floating-point number.
- * @param endptr Pointer to the final part of the string which
- *     was not used for conversion.
- * @return Single-precision number resulting from the string conversion.
- */
-float strtof(const char *restrict nptr, char **restrict endptr)
-{
-	return (float) strtold(nptr, endptr);
-}
-
-/**
- * Converts a string representation of a floating-point number to
- * its native representation. See strtold().
- *
- * @param nptr String representation of a floating-point number.
- * @param endptr Pointer to the final part of the string which
- *     was not used for conversion.
- * @return Double-precision number resulting from the string conversion.
- */
-double strtod(const char *restrict nptr, char **restrict endptr)
-{
-	return (double) strtold(nptr, endptr);
-}
-
-/**
- * Creates and opens an unique temporary file from template.
- *
- * @param tmpl Template. Last six characters must be XXXXXX.
- * @return The opened file descriptor or -1 on error.
- */
-int mkstemp(char *tmpl)
-{
-	int fd = -1;
-	
-	char *tptr = tmpl + strlen(tmpl) - 6;
-	
-	while (fd < 0) {
-		if (*mktemp(tmpl) == '\0') {
-			/* Errno set by mktemp(). */
-			return -1;
-		}
-		
-		fd = open(tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
-		
-		if (fd == -1) {
-			/* Restore template to it's original state. */
-			snprintf(tptr, 7, "XXXXXX");
-		}
-	}
-	
-	return fd;
-}
-
-/**
- * Creates an unique temporary file name from template.
- *
- * @param tmpl Template. Last six characters must be XXXXXX.
- * @return The value of tmpl. The template is modified in place.
- *    If no temporary file name can be created, template is
- *    reduced to an empty string.
- */
-char *mktemp(char *tmpl)
-{
-	int tmpl_len = strlen(tmpl);
-	if (tmpl_len < 6) {
-		errno = EINVAL;
-		*tmpl = '\0';
-		return tmpl;
-	}
-	
-	char *tptr = tmpl + tmpl_len - 6;
-	if (strcmp(tptr, "XXXXXX") != 0) {
-		errno = EINVAL;
-		*tmpl = '\0';
-		return tmpl;
-	}
-	
-	static int seq = 0;
-	
-	for (; seq < 1000000; ++seq) {
-		snprintf(tptr, 7, "%06d", seq);
-		
-		int orig_errno = errno;
-		errno = 0;
-		/* Check if the file exists. */
-		if (access(tmpl, F_OK) == -1) {
-			if (errno == ENOENT) {
-				errno = orig_errno;
-				break;
-			} else {
-				/* errno set by access() */
-				*tmpl = '\0';
-				return tmpl;
-			}
-		}
-	}
-	
-	if (seq == 10000000) {
-		errno = EEXIST;
-		*tmpl = '\0';
-		return tmpl;
-	}
-	
-	return tmpl;
-}
-
-/**
- * Get system load average statistics.
- *
- * @param loadavg Array where the load averages shall be placed.
- * @param nelem Maximum number of elements to be placed into the array.
- * @return Number of elements placed into the array on success, -1 otherwise.
- */
-int bsd_getloadavg(double loadavg[], int nelem)
-{
-	assert(nelem > 0);
-	
-	size_t count;
-	load_t *loads = stats_get_load(&count);
-	
-	if (loads == NULL) {
-		return -1;
-	}
-	
-	if (((size_t) nelem) < count) {
-		count = nelem;
-	}
-	
-	for (size_t i = 0; i < count; ++i) {
-		loadavg[i] = (double) loads[i];
-	}
-	
-	free(loads);
-	return count;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/stdlib/strtold.c
===================================================================
--- uspace/lib/posix/src/stdlib/strtold.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,491 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Backend for floating point conversions.
- */
-
-#include "../internal/common.h"
-#include "libc/stdbool.h"
-#include "posix/stdlib.h"
-
-#include <assert.h>
-#include "posix/ctype.h"
-#include "posix/stdint.h"
-#include "posix/strings.h"
-
-#include <errno.h>
-
-#include "posix/limits.h"
-
-#include "posix/float.h"
-
-#include "libc/str.h"
-
-#ifndef HUGE_VALL
-	#define HUGE_VALL (+1.0l / +0.0l)
-#endif
-
-#ifndef abs
-	#define abs(x) (((x) < 0) ? -(x) : (x))
-#endif
-
-/* If the constants are not defined, use double precision as default. */
-#ifndef LDBL_MANT_DIG
-	#define LDBL_MANT_DIG 53
-#endif
-#ifndef LDBL_MAX_EXP
-	#define LDBL_MAX_EXP 1024
-#endif
-#ifndef LDBL_MIN_EXP
-	#define LDBL_MIN_EXP (-1021)
-#endif
-#ifndef LDBL_DIG
-	#define LDBL_DIG 15
-#endif
-#ifndef LDBL_MIN
-	#define LDBL_MIN 2.2250738585072014E-308
-#endif
-
-/* power functions ************************************************************/
-
-#if LDBL_MAX_EXP >= 16384
-const int MAX_POW5 = 12;
-#else
-const int MAX_POW5 = 8;
-#endif
-
-/* The value at index i is approximately 5**(2**i). */
-long double pow5[] = {
-	0x5p0l,
-	0x19p0l,
-	0x271p0l,
-	0x5F5E1p0l,
-	0x2386F26FC1p0l,
-	0x4EE2D6D415B85ACEF81p0l,
-	0x184F03E93FF9F4DAA797ED6E38ED6p36l,
-	0x127748F9301D319BF8CDE66D86D62p185l,
-	0x154FDD7F73BF3BD1BBB77203731FDp482l,
-#if LDBL_MAX_EXP >= 16384
-	0x1C633415D4C1D238D98CAB8A978A0p1076l,
-	0x192ECEB0D02EA182ECA1A7A51E316p2265l,
-	0x13D1676BB8A7ABBC94E9A519C6535p4643l,
-	0x188C0A40514412F3592982A7F0094p9398l,
-#endif
-};
-
-#if LDBL_MAX_EXP >= 16384
-const int MAX_POW2 = 15;
-#else
-const int MAX_POW2 = 9;
-#endif
-
-/* Powers of two. */
-long double pow2[] = {
-	0x1P1l,
-	0x1P2l,
-	0x1P4l,
-	0x1P8l,
-	0x1P16l,
-	0x1P32l,
-	0x1P64l,
-	0x1P128l,
-	0x1P256l,
-	0x1P512l,
-#if LDBL_MAX_EXP >= 16384
-	0x1P1024l,
-	0x1P2048l,
-	0x1P4096l,
-	0x1P8192l,
-#endif
-};
-
-/**
- * Multiplies a number by a power of five.
- * The result may be inexact and may not be the best possible approximation.
- *
- * @param mant Number to be multiplied.
- * @param exp Base 5 exponent.
- * @return mant multiplied by 5**exp
- */
-static long double mul_pow5(long double mant, int exp)
-{
-	if (mant == 0.0l || mant == HUGE_VALL) {
-		return mant;
-	}
-	
-	if (abs(exp) >> (MAX_POW5 + 1) != 0) {
-		/* Too large exponent. */
-		errno = ERANGE;
-		return exp < 0 ? LDBL_MIN : HUGE_VALL;
-	}
-	
-	if (exp < 0) {
-		exp = abs(exp);
-		for (int bit = 0; bit <= MAX_POW5; ++bit) {
-			/* Multiply by powers of five bit-by-bit. */
-			if (((exp >> bit) & 1) != 0) {
-				mant /= pow5[bit];
-				if (mant == 0.0l) {
-					/* Underflow. */
-					mant = LDBL_MIN;
-					errno = ERANGE;
-					break;
-				}
-			}
-		}
-	} else {
-		for (int bit = 0; bit <= MAX_POW5; ++bit) {
-			/* Multiply by powers of five bit-by-bit. */
-			if (((exp >> bit) & 1) != 0) {
-				mant *= pow5[bit];
-				if (mant == HUGE_VALL) {
-					/* Overflow. */
-					errno = ERANGE;
-					break;
-				}
-			}
-		}
-	}
-	
-	return mant;
-}
-
-/**
- * Multiplies a number by a power of two. This is always exact.
- *
- * @param mant Number to be multiplied.
- * @param exp Base 2 exponent.
- * @return mant multiplied by 2**exp.
- */
-static long double mul_pow2(long double mant, int exp)
-{
-	if (mant == 0.0l || mant == HUGE_VALL) {
-		return mant;
-	}
-	
-	if (exp > LDBL_MAX_EXP || exp < LDBL_MIN_EXP) {
-		errno = ERANGE;
-		return exp < 0 ? LDBL_MIN : HUGE_VALL;
-	}
-	
-	if (exp < 0) {
-		exp = abs(exp);
-		for (int i = 0; i <= MAX_POW2; ++i) {
-			if (((exp >> i) & 1) != 0) {
-				mant /= pow2[i];
-				if (mant == 0.0l) {
-					mant = LDBL_MIN;
-					errno = ERANGE;
-					break;
-				}
-			}
-		}
-	} else {
-		for (int i = 0; i <= MAX_POW2; ++i) {
-			if (((exp >> i) & 1) != 0) {
-				mant *= pow2[i];
-				if (mant == HUGE_VALL) {
-					errno = ERANGE;
-					break;
-				}
-			}
-		}
-	}
-	
-	return mant;
-}
-
-/* end power functions ********************************************************/
-
-
-
-/**
- * Convert decimal string representation of the floating point number.
- * Function expects the string pointer to be already pointed at the first
- * digit (i.e. leading optional sign was already consumed by the caller).
- * 
- * @param sptr Pointer to the storage of the string pointer. Upon successful
- *     conversion, the string pointer is updated to point to the first
- *     unrecognized character.
- * @return An approximate representation of the input floating-point number.
- */
-static long double parse_decimal(const char **sptr)
-{
-	assert(sptr != NULL);
-	assert (*sptr != NULL);
-	
-	const int DEC_BASE = 10;
-	const char DECIMAL_POINT = '.';
-	const char EXPONENT_MARK = 'e';
-	
-	const char *str = *sptr;
-	long double significand = 0;
-	long exponent = 0;
-	
-	/* number of digits parsed so far */
-	int parsed_digits = 0;
-	bool after_decimal = false;
-	
-	while (isdigit(*str) || (!after_decimal && *str == DECIMAL_POINT)) {
-		if (*str == DECIMAL_POINT) {
-			after_decimal = true;
-			str++;
-			continue;
-		}
-		
-		if (parsed_digits == 0 && *str == '0') {
-			/* Nothing, just skip leading zeros. */
-		} else if (parsed_digits < LDBL_DIG) {
-			significand = significand * DEC_BASE + (*str - '0');
-			parsed_digits++;
-		} else {
-			exponent++;
-		}
-		
-		if (after_decimal) {
-			/* Decrement exponent if we are parsing the fractional part. */
-			exponent--;
-		}
-		
-		str++;
-	}
-	
-	/* exponent */
-	if (tolower(*str) == EXPONENT_MARK) {
-		str++;
-		
-		/* Returns MIN/MAX value on error, which is ok. */
-		long exp = strtol(str, (char **) &str, DEC_BASE);
-		
-		if (exponent > 0 && exp > LONG_MAX - exponent) {
-			exponent = LONG_MAX;
-		} else if (exponent < 0 && exp < LONG_MIN - exponent) {
-			exponent = LONG_MIN;
-		} else {
-			exponent += exp;
-		}
-	}
-	
-	*sptr = str;
-	
-	/* Return multiplied by a power of ten. */
-	return mul_pow2(mul_pow5(significand, exponent), exponent);
-}
-
-/**
- * Derive a hexadecimal digit from its character representation.
- * 
- * @param ch Character representation of the hexadecimal digit.
- * @return Digit value represented by an integer.
- */
-static inline int hex_value(char ch)
-{
-	if (ch <= '9') {
-		return ch - '0';
-	} else {
-		return 10 + tolower(ch) - 'a';
-	}
-}
-
-/**
- * Convert hexadecimal string representation of the floating point number.
- * Function expects the string pointer to be already pointed at the first
- * digit (i.e. leading optional sign and 0x prefix were already consumed
- * by the caller).
- *
- * @param sptr Pointer to the storage of the string pointer. Upon successful
- *     conversion, the string pointer is updated to point to the first
- *     unrecognized character.
- * @return Representation of the input floating-point number.
- */
-static long double parse_hexadecimal(const char **sptr)
-{
-	assert(sptr != NULL && *sptr != NULL);
-	
-	const int DEC_BASE = 10;
-	const int HEX_BASE = 16;
-	const char DECIMAL_POINT = '.';
-	const char EXPONENT_MARK = 'p';
-	
-	const char *str = *sptr;
-	long double significand = 0;
-	long exponent = 0;
-	
-	/* number of bits parsed so far */
-	int parsed_bits = 0;
-	bool after_decimal = false;
-	
-	while (isxdigit(*str) || (!after_decimal && *str == DECIMAL_POINT)) {
-		if (*str == DECIMAL_POINT) {
-			after_decimal = true;
-			str++;
-			continue;
-		}
-		
-		if (parsed_bits == 0 && *str == '0') {
-			/* Nothing, just skip leading zeros. */
-		} else if (parsed_bits <= LDBL_MANT_DIG) {
-			significand = significand * HEX_BASE + hex_value(*str);
-			parsed_bits += 4;
-		} else {
-			exponent += 4;
-		}
-		
-		if (after_decimal) {
-			exponent -= 4;
-		}
-		
-		str++;
-	}
-	
-	/* exponent */
-	if (tolower(*str) == EXPONENT_MARK) {
-		str++;
-		
-		/* Returns MIN/MAX value on error, which is ok. */
-		long exp = strtol(str, (char **) &str, DEC_BASE);
-		
-		if (exponent > 0 && exp > LONG_MAX - exponent) {
-			exponent = LONG_MAX;
-		} else if (exponent < 0 && exp < LONG_MIN - exponent) {
-			exponent = LONG_MIN;
-		} else {
-			exponent += exp;
-		}
-	}
-	
-	*sptr = str;
-	
-	/* Return multiplied by a power of two. */
-	return mul_pow2(significand, exponent);
-}
-
-/**
- * Converts a string representation of a floating-point number to
- * its native representation. Largely POSIX compliant, except for
- * locale differences (always uses '.' at the moment) and rounding.
- * Decimal strings are NOT guaranteed to be correctly rounded. This function
- * should return a good enough approximation for most purposes but if you
- * depend on a precise conversion, use hexadecimal representation.
- * Hexadecimal strings are currently always rounded towards zero, regardless
- * of the current rounding mode.
- *
- * @param nptr Input string.
- * @param endptr If non-NULL, *endptr is set to the position of the first
- *     unrecognized character.
- * @return An approximate representation of the input floating-point number.
- */
-long double strtold(const char *restrict nptr, char **restrict endptr)
-{
-	assert(nptr != NULL);
-	
-	const int RADIX = '.';
-	
-	/* minus sign */
-	bool negative = false;
-	/* current position in the string */
-	int i = 0;
-	
-	/* skip whitespace */
-	while (isspace(nptr[i])) {
-		i++;
-	}
-	
-	/* parse sign */
-	switch (nptr[i]) {
-	case '-':
-		negative = true;
-		/* Fallthrough */
-	case '+':
-		i++;
-	}
-	
-	/* check for NaN */
-	if (strncasecmp(&nptr[i], "nan", 3) == 0) {
-		// FIXME: return NaN
-		// TODO: handle the parenthesised case
-		
-		if (endptr != NULL) {
-			*endptr = (char *) nptr;
-		}
-		errno = EINVAL;
-		return 0;
-	}
-	
-	/* check for Infinity */
-	if (strncasecmp(&nptr[i], "inf", 3) == 0) {
-		i += 3;
-		if (strncasecmp(&nptr[i], "inity", 5) == 0) {
-			i += 5;
-		}
-		
-		if (endptr != NULL) {
-			*endptr = (char *) &nptr[i];
-		}
-		return negative ? -HUGE_VALL : +HUGE_VALL;
-	}
-
-	/* check for a hex number */
-	if (nptr[i] == '0' && tolower(nptr[i + 1]) == 'x' &&
-	    (isxdigit(nptr[i + 2]) ||
-	    (nptr[i + 2] == RADIX && isxdigit(nptr[i + 3])))) {
-		i += 2;
-		
-		const char *ptr = &nptr[i];
-		/* this call sets errno if appropriate. */
-		long double result = parse_hexadecimal(&ptr);
-		if (endptr != NULL) {
-			*endptr = (char *) ptr;
-		}
-		return negative ? -result : result;
-	}
-	
-	/* check for a decimal number */
-	if (isdigit(nptr[i]) || (nptr[i] == RADIX && isdigit(nptr[i + 1]))) {
-		const char *ptr = &nptr[i];
-		/* this call sets errno if appropriate. */
-		long double result = parse_decimal(&ptr);
-		if (endptr != NULL) {
-			*endptr = (char *) ptr;
-		}
-		return negative ? -result : result;
-	}
-	
-	/* nothing to parse */
-	if (endptr != NULL) {
-		*endptr = (char *) nptr;
-	}
-	errno = EINVAL;
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/string.c
===================================================================
--- uspace/lib/posix/src/string.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,699 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file String manipulation.
- */
-
-#include "internal/common.h"
-#include "posix/string.h"
-
-#include <assert.h>
-
-#include <errno.h>
-
-#include "posix/limits.h"
-#include "posix/stdlib.h"
-#include "posix/signal.h"
-
-#include "libc/str.h"
-#include "libc/str_error.h"
-
-/**
- * The same as strpbrk, except it returns pointer to the nul terminator
- * if no occurence is found.
- *
- * @param s1 String in which to look for the bytes.
- * @param s2 String of bytes to look for.
- * @return Pointer to the found byte on success, pointer to the
- *     string terminator otherwise.
- */
-static char *strpbrk_null(const char *s1, const char *s2)
-{
-	while (!strchr(s2, *s1)) {
-		++s1;
-	}
-	
-	return (char *) s1;
-}
-
-/**
- * Copy a string.
- *
- * @param dest Destination pre-allocated buffer.
- * @param src Source string to be copied.
- * @return Pointer to the destination buffer.
- */
-char *strcpy(char *restrict dest, const char *restrict src)
-{
-	stpcpy(dest, src);
-	return dest;
-}
-
-/**
- * Copy fixed length string.
- *
- * @param dest Destination pre-allocated buffer.
- * @param src Source string to be copied.
- * @param n Number of bytes to be stored into destination buffer.
- * @return Pointer to the destination buffer.
- */
-char *strncpy(char *restrict dest, const char *restrict src, size_t n)
-{
-	stpncpy(dest, src, n);
-	return dest;
-}
-
-/**
- * Copy a string.
- *
- * @param dest Destination pre-allocated buffer.
- * @param src Source string to be copied.
- * @return Pointer to the nul character in the destination string.
- */
-char *stpcpy(char *restrict dest, const char *restrict src)
-{
-	assert(dest != NULL);
-	assert(src != NULL);
-
-	for (size_t i = 0; ; ++i) {
-		dest[i] = src[i];
-		
-		if (src[i] == '\0') {
-			/* pointer to the terminating nul character */
-			return &dest[i];
-		}
-	}
-	
-	/* unreachable */
-	return NULL;
-}
-
-/**
- * Copy fixed length string.
- *
- * @param dest Destination pre-allocated buffer.
- * @param src Source string to be copied.
- * @param n Number of bytes to be stored into destination buffer.
- * @return Pointer to the first written nul character or &dest[n].
- */
-char *stpncpy(char *restrict dest, const char *restrict src, size_t n)
-{
-	assert(dest != NULL);
-	assert(src != NULL);
-
-	for (size_t i = 0; i < n; ++i) {
-		dest[i] = src[i];
-	
-		/* the standard requires that nul characters
-		 * are appended to the length of n, in case src is shorter
-		 */
-		if (src[i] == '\0') {
-			char *result = &dest[i];
-			for (++i; i < n; ++i) {
-				dest[i] = '\0';
-			}
-			return result;
-		}
-	}
-	
-	return &dest[n];
-}
-
-/**
- * Concatenate two strings.
- *
- * @param dest String to which src shall be appended.
- * @param src String to be appended after dest.
- * @return Pointer to destination buffer.
- */
-char *strcat(char *restrict dest, const char *restrict src)
-{
-	assert(dest != NULL);
-	assert(src != NULL);
-
-	strcpy(strchr(dest, '\0'), src);
-	return dest;
-}
-
-/**
- * Concatenate a string with part of another.
- *
- * @param dest String to which part of src shall be appended.
- * @param src String whose part shall be appended after dest.
- * @param n Number of bytes to append after dest.
- * @return Pointer to destination buffer.
- */
-char *strncat(char *restrict dest, const char *restrict src, size_t n)
-{
-	assert(dest != NULL);
-	assert(src != NULL);
-
-	char *zeroptr = strncpy(strchr(dest, '\0'), src, n);
-	/* strncpy doesn't append the nul terminator, so we do it here */
-	zeroptr[n] = '\0';
-	return dest;
-}
-
-/**
- * Copy limited number of bytes in memory.
- *
- * @param dest Destination buffer.
- * @param src Source buffer.
- * @param c Character after which the copying shall stop.
- * @param n Number of bytes that shall be copied if not stopped earlier by c.
- * @return Pointer to the first byte after c in dest if found, NULL otherwise.
- */
-void *memccpy(void *restrict dest, const void *restrict src, int c, size_t n)
-{
-	assert(dest != NULL);
-	assert(src != NULL);
-	
-	unsigned char* bdest = dest;
-	const unsigned char* bsrc = src;
-	
-	for (size_t i = 0; i < n; ++i) {
-		bdest[i] = bsrc[i];
-	
-		if (bsrc[i] == (unsigned char) c) {
-			/* pointer to the next byte */
-			return &bdest[i + 1];
-		}
-	}
-	
-	return NULL;
-}
-
-/**
- * Duplicate a string.
- *
- * @param s String to be duplicated.
- * @return Newly allocated copy of the string.
- */
-char *strdup(const char *s)
-{
-	return strndup(s, SIZE_MAX);
-}
-
-/**
- * Duplicate a specific number of bytes from a string.
- *
- * @param s String to be duplicated.
- * @param n Maximum length of the resulting string..
- * @return Newly allocated string copy of length at most n.
- */
-char *strndup(const char *s, size_t n)
-{
-	assert(s != NULL);
-
-	size_t len = strnlen(s, n);
-	char *dup = malloc(len + 1);
-	if (dup == NULL) {
-		return NULL;
-	}
-
-	memcpy(dup, s, len);
-	dup[len] = '\0';
-
-	return dup;
-}
-
-/**
- * Compare two strings.
- *
- * @param s1 First string to be compared.
- * @param s2 Second string to be compared.
- * @return Difference of the first pair of inequal characters,
- *     or 0 if strings have the same content.
- */
-int strcmp(const char *s1, const char *s2)
-{
-	assert(s1 != NULL);
-	assert(s2 != NULL);
-
-	return strncmp(s1, s2, STR_NO_LIMIT);
-}
-
-/**
- * Compare part of two strings.
- *
- * @param s1 First string to be compared.
- * @param s2 Second string to be compared.
- * @param n Maximum number of characters to be compared.
- * @return Difference of the first pair of inequal characters,
- *     or 0 if strings have the same content.
- */
-int strncmp(const char *s1, const char *s2, size_t n)
-{
-	assert(s1 != NULL);
-	assert(s2 != NULL);
-
-	for (size_t i = 0; i < n; ++i) {
-		if (s1[i] != s2[i]) {
-			return s1[i] - s2[i];
-		}
-		if (s1[i] == '\0') {
-			break;
-		}
-	}
-
-	return 0;
-}
-
-/**
- * Find byte in memory.
- *
- * @param mem Memory area in which to look for the byte.
- * @param c Byte to look for.
- * @param n Maximum number of bytes to be inspected.
- * @return Pointer to the specified byte on success,
- *     NULL pointer otherwise.
- */
-void *memchr(const void *mem, int c, size_t n)
-{
-	assert(mem != NULL);
-	
-	const unsigned char *s = mem;
-	
-	for (size_t i = 0; i < n; ++i) {
-		if (s[i] == (unsigned char) c) {
-			return (void *) &s[i];
-		}
-	}
-	return NULL;
-}
-
-/**
- * Scan string for a first occurence of a character.
- *
- * @param s String in which to look for the character.
- * @param c Character to look for.
- * @return Pointer to the specified character on success,
- *     NULL pointer otherwise.
- */
-char *strchr(const char *s, int c)
-{
-	assert(s != NULL);
-	
-	char *res = gnu_strchrnul(s, c);
-	return (*res == c) ? res : NULL;
-}
-
-/**
- * Scan string for a last occurence of a character.
- *
- * @param s String in which to look for the character.
- * @param c Character to look for.
- * @return Pointer to the specified character on success,
- *     NULL pointer otherwise.
- */
-char *strrchr(const char *s, int c)
-{
-	assert(s != NULL);
-	
-	const char *ptr = strchr(s, '\0');
-	
-	/* the same as in strchr, except it loops in reverse direction */
-	while (*ptr != (char) c) {
-		if (ptr == s) {
-			return NULL;
-		}
-
-		ptr--;
-	}
-
-	return (char *) ptr;
-}
-
-/**
- * Scan string for a first occurence of a character.
- *
- * @param s String in which to look for the character.
- * @param c Character to look for.
- * @return Pointer to the specified character on success, pointer to the
- *     string terminator otherwise.
- */
-char *gnu_strchrnul(const char *s, int c)
-{
-	assert(s != NULL);
-	
-	while (*s != c && *s != '\0') {
-		s++;
-	}
-	
-	return (char *) s;
-}
-
-/**
- * Scan a string for a first occurence of one of provided bytes.
- *
- * @param s1 String in which to look for the bytes.
- * @param s2 String of bytes to look for.
- * @return Pointer to the found byte on success,
- *     NULL pointer otherwise.
- */
-char *strpbrk(const char *s1, const char *s2)
-{
-	assert(s1 != NULL);
-	assert(s2 != NULL);
-
-	char *ptr = strpbrk_null(s1, s2);
-	return (*ptr == '\0') ? NULL : ptr;
-}
-
-/**
- * Get the length of a complementary substring.
- *
- * @param s1 String that shall be searched for complementary prefix.
- * @param s2 String of bytes that shall not occur in the prefix.
- * @return Length of the prefix.
- */
-size_t strcspn(const char *s1, const char *s2)
-{
-	assert(s1 != NULL);
-	assert(s2 != NULL);
-
-	char *ptr = strpbrk_null(s1, s2);
-	return (size_t) (ptr - s1);
-}
-
-/**
- * Get length of a substring.
- *
- * @param s1 String that shall be searched for prefix.
- * @param s2 String of bytes that the prefix must consist of.
- * @return Length of the prefix.
- */
-size_t strspn(const char *s1, const char *s2)
-{
-	assert(s1 != NULL);
-	assert(s2 != NULL);
-
-	const char *ptr;
-	for (ptr = s1; *ptr != '\0'; ++ptr) {
-		if (!strchr(s2, *ptr)) {
-			break;
-		}
-	}
-	return ptr - s1;
-}
-
-/**
- * Find a substring. Uses Knuth-Morris-Pratt algorithm.
- *
- * @param s1 String in which to look for a substring.
- * @param s2 Substring to look for.
- * @return Pointer to the first character of the substring in s1, or NULL if
- *     not found.
- */
-char *strstr(const char *haystack, const char *needle)
-{
-	assert(haystack != NULL);
-	assert(needle != NULL);
-	
-	/* Special case - needle is an empty string. */
-	if (needle[0] == '\0') {
-		return (char *) haystack;
-	}
-	
-	/* Preprocess needle. */
-	size_t nlen = strlen(needle);
-	size_t prefix_table[nlen + 1];
-	
-	{
-		size_t i = 0;
-		ssize_t j = -1;
-		
-		prefix_table[i] = j;
-		
-		while (i < nlen) {
-			while (j >= 0 && needle[i] != needle[j]) {
-				j = prefix_table[j];
-			}
-			i++; j++;
-			prefix_table[i] = j;
-		}
-	}
-	
-	/* Search needle using the precomputed table. */
-	size_t npos = 0;
-	
-	for (size_t hpos = 0; haystack[hpos] != '\0'; ++hpos) {
-		while (npos != 0 && haystack[hpos] != needle[npos]) {
-			npos = prefix_table[npos];
-		}
-		
-		if (haystack[hpos] == needle[npos]) {
-			npos++;
-			
-			if (npos == nlen) {
-				return (char *) (haystack + hpos - nlen + 1);
-			}
-		}
-	}
-	
-	return NULL;
-}
-
-/** Split string by delimiters.
- *
- * @param s             String to be tokenized. May not be NULL.
- * @param delim		String with the delimiters.
- * @return              Pointer to the prefix of @a s before the first
- *                      delimiter character. NULL if no such prefix
- *                      exists.
- */
-char *strtok(char *s, const char *delim)
-{
-	static char *next;
-
-	return strtok_r(s, delim, &next);
-}
-
-
-/** Split string by delimiters.
- *
- * @param s             String to be tokenized. May not be NULL.
- * @param delim		String with the delimiters.
- * @param next		Variable which will receive the pointer to the
- *                      continuation of the string following the first
- *                      occurrence of any of the delimiter characters.
- *                      May be NULL.
- * @return              Pointer to the prefix of @a s before the first
- *                      delimiter character. NULL if no such prefix
- *                      exists.
- */
-char *strtok_r(char *s, const char *delim, char **next)
-{
-	char *start, *end;
-
-	if (s == NULL)
-		s = *next;
-
-	/* Skip over leading delimiters. */
-	while (*s && (strchr(delim, *s) != NULL)) ++s;
-	start = s;
-
-	/* Skip over token characters. */
-	while (*s && (strchr(delim, *s) == NULL)) ++s;
-	end = s;
-	*next = (*s ? s + 1 : s);
-
-	if (start == end) {
-		return NULL;	/* No more tokens. */
-	}
-
-	/* Overwrite delimiter with NULL terminator. */
-	*end = '\0';
-	return start;
-}
-
-/**
- * String comparison using collating information.
- *
- * Currently ignores locale and just calls strcmp.
- *
- * @param s1 First string to be compared.
- * @param s2 Second string to be compared.
- * @return Difference of the first pair of inequal characters,
- *     or 0 if strings have the same content.
- */
-int strcoll(const char *s1, const char *s2)
-{
-	assert(s1 != NULL);
-	assert(s2 != NULL);
-
-	return strcmp(s1, s2);
-}
-
-/**
- * Transform a string in such a way that the resulting string yields the same
- * results when passed to the strcmp as if the original string is passed to
- * the strcoll.
- *
- * Since strcoll is equal to strcmp here, this just makes a copy.
- *
- * @param s1 Transformed string.
- * @param s2 Original string.
- * @param n Maximum length of the transformed string.
- * @return Length of the transformed string.
- */
-size_t strxfrm(char *restrict s1, const char *restrict s2, size_t n)
-{
-	assert(s1 != NULL || n == 0);
-	assert(s2 != NULL);
-
-	size_t len = strlen(s2);
-
-	if (n > len) {
-		strcpy(s1, s2);
-	}
-
-	return len;
-}
-
-/**
- * Get error message string.
- *
- * @param errnum Error code for which to obtain human readable string.
- * @return Error message.
- */
-char *strerror(int errnum)
-{
-	// FIXME: move strerror() and strerror_r() to libc.
-	return (char *) str_error(errnum);
-}
-
-/**
- * Get error message string.
- *
- * @param errnum Error code for which to obtain human readable string.
- * @param buf Buffer to store a human readable string to.
- * @param bufsz Size of buffer pointed to by buf.
- * @return Zero on success, errno otherwise.
- */
-int strerror_r(int errnum, char *buf, size_t bufsz)
-{
-	assert(buf != NULL);
-	
-	char *errstr = strerror(errnum);
-	
-	if (strlen(errstr) + 1 > bufsz) {
-		return ERANGE;
-	} else {
-		strcpy(buf, errstr);
-	}
-
-	return EOK;
-}
-
-/**
- * Get length of the string.
- *
- * @param s String which length shall be determined.
- * @return Length of the string.
- */
-size_t strlen(const char *s)
-{
-	assert(s != NULL);
-	
-	return (size_t) (strchr(s, '\0') - s);
-}
-
-/**
- * Get limited length of the string.
- *
- * @param s String which length shall be determined.
- * @param n Maximum number of bytes that can be examined to determine length.
- * @return The lower of either string length or n limit.
- */
-size_t strnlen(const char *s, size_t n)
-{
-	assert(s != NULL);
-	
-	for (size_t sz = 0; sz < n; ++sz) {
-		
-		if (s[sz] == '\0') {
-			return sz;
-		}
-	}
-	
-	return n;
-}
-
-/**
- * Get description of a signal.
- *
- * @param signum Signal number.
- * @return Human readable signal description.
- */
-char *strsignal(int signum)
-{
-	static const char *const sigstrings[] = {
-		[SIGABRT] = "SIGABRT (Process abort signal)",
-		[SIGALRM] = "SIGALRM (Alarm clock)",
-		[SIGBUS] = "SIGBUS (Access to an undefined portion of a memory object)",
-		[SIGCHLD] = "SIGCHLD (Child process terminated, stopped, or continued)",
-		[SIGCONT] = "SIGCONT (Continue executing, if stopped)",
-		[SIGFPE] = "SIGFPE (Erroneous arithmetic operation)",
-		[SIGHUP] = "SIGHUP (Hangup)",
-		[SIGILL] = "SIGILL (Illegal instruction)",
-		[SIGINT] = "SIGINT (Terminal interrupt signal)",
-		[SIGKILL] = "SIGKILL (Kill process)",
-		[SIGPIPE] = "SIGPIPE (Write on a pipe with no one to read it)",
-		[SIGQUIT] = "SIGQUIT (Terminal quit signal)",
-		[SIGSEGV] = "SIGSEGV (Invalid memory reference)",
-		[SIGSTOP] = "SIGSTOP (Stop executing)",
-		[SIGTERM] = "SIGTERM (Termination signal)",
-		[SIGTSTP] = "SIGTSTP (Terminal stop signal)",
-		[SIGTTIN] = "SIGTTIN (Background process attempting read)",
-		[SIGTTOU] = "SIGTTOU (Background process attempting write)",
-		[SIGUSR1] = "SIGUSR1 (User-defined signal 1)",
-		[SIGUSR2] = "SIGUSR2 (User-defined signal 2)",
-		[SIGPOLL] = "SIGPOLL (Pollable event)",
-		[SIGPROF] = "SIGPROF (Profiling timer expired)",
-		[SIGSYS] = "SIGSYS (Bad system call)",
-		[SIGTRAP] = "SIGTRAP (Trace/breakpoint trap)",
-		[SIGURG] = "SIGURG (High bandwidth data is available at a socket)",
-		[SIGVTALRM] = "SIGVTALRM (Virtual timer expired)",
-		[SIGXCPU] = "SIGXCPU (CPU time limit exceeded)",
-		[SIGXFSZ] = "SIGXFSZ (File size limit exceeded)"
-	};
-
-	if (signum <= _TOP_SIGNAL) {
-		return (char *) sigstrings[signum];
-	}
-
-	return (char *) "ERROR, Invalid signal number";
-}
-
-/** @}
- */
Index: pace/lib/posix/src/strings.c
===================================================================
--- uspace/lib/posix/src/strings.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,186 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Additional string manipulation.
- */
-
-#include "internal/common.h"
-#include "posix/strings.h"
-
-#include "posix/string.h"
-#include "posix/ctype.h"
-
-#include "libc/mem.h"
-#include "libc/str.h"
-
-/**
- * Find first set bit (beginning with the least significant bit).
- *
- * @param i Integer in which to look for the first set bit.
- * @return Index of first set bit. Bits are numbered starting at one.
- */
-int ffs(int i)
-{
-	if (i == 0) {
-		return 0;
-	}
-
-	int result = 0;
-
-	// XXX: assumes at most 32-bit int
-	if (!(i & 0xFFFF)) {
-		result |= 16;
-		i >>= 16;
-	}
-	if (!(i & 0xFF)) {
-		result |= 8;
-		i >>= 8;
-	}
-	if (!(i & 0xF)) {
-		result |= 4;
-		i >>= 4;
-	}
-	if (!(i & 0x3)) {
-		result |= 2;
-		i >>= 2;
-	}
-	if (!(i & 0x1)) {
-		result |= 1;
-	}
-
-	return result + 1;
-}
-
-/**
- * Compare two strings (case-insensitive).
- *
- * @param s1 First string to be compared.
- * @param s2 Second string to be compared.
- * @return Difference of the first pair of inequal characters,
- *     or 0 if strings have the same content.
- */
-int strcasecmp(const char *s1, const char *s2)
-{
-	return strncasecmp(s1, s2, STR_NO_LIMIT);
-}
-
-/**
- * Compare part of two strings (case-insensitive).
- *
- * @param s1 First string to be compared.
- * @param s2 Second string to be compared.
- * @param n Maximum number of characters to be compared.
- * @return Difference of the first pair of inequal characters,
- *     or 0 if strings have the same content.
- */
-int strncasecmp(const char *s1, const char *s2, size_t n)
-{
-	for (size_t i = 0; i < n; ++i) {
-		int cmp = tolower(s1[i]) - tolower(s2[i]);
-		if (cmp != 0) {
-			return cmp;
-		}
-		
-		if (s1[i] == 0) {
-			return 0;
-		}
-	}
-	
-	return 0;
-}
-
-/**
- * Compare two memory areas.
- *
- * @param mem1 Pointer to the first area to compare.
- * @param mem2 Pointer to the second area to compare.
- * @param n Common size of both areas.
- * @return If n is 0, return zero. If the areas match, return
- *     zero. Otherwise return non-zero.
- */
-int bcmp(const void *mem1, const void *mem2, size_t n)
-{
-	return memcmp(mem1, mem2, n);
-}
-
-/**
- * Copy bytes in memory with overlapping areas.
- *
- * @param src Source area.
- * @param dest Destination area.
- * @param n Number of bytes to copy.
- */
-void bcopy(const void *src, void *dest, size_t n)
-{
-	/* Note that memmove has different order of arguments. */
-	memmove(dest, src, n);
-}
-
-/**
- * Reset bytes in memory area to zero.
- *
- * @param mem Memory area to be zeroed.
- * @param n Number of bytes to reset.
- */
-void bzero(void *mem, size_t n)
-{
-	memset(mem, 0, n);
-}
-
-/**
- * Scan string for a first occurence of a character.
- *
- * @param s String in which to look for the character.
- * @param c Character to look for.
- * @return Pointer to the specified character on success,
- *     NULL pointer otherwise.
- */
-char *index(const char *s, int c)
-{
-	return strchr(s, c);
-}
-
-/**
- * Scan string for a last occurence of a character.
- *
- * @param s String in which to look for the character.
- * @param c Character to look for.
- * @return Pointer to the specified character on success,
- *     NULL pointer otherwise.
- */
-char *rindex(const char *s, int c)
-{
-	return strrchr(s, c);
-}
-
-/** @}
- */
Index: pace/lib/posix/src/sys/mman.c
===================================================================
--- uspace/lib/posix/src/sys/mman.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file
- */
-
-#include "../internal/common.h"
-#include <posix/sys/mman.h>
-#include <posix/sys/types.h>
-#include <libc/as.h>
-#include <posix/unistd.h>
-
-void *mmap(void *start, size_t length, int prot, int flags, int fd,
-    off_t offset)
-{
-	if (!start)
-		start = AS_AREA_ANY;
-	
-//	if (!((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE)))
-//		return MAP_FAILED;
-	
-	if (!(flags & MAP_ANONYMOUS))
-		return MAP_FAILED;
-	
-	return as_area_create(start, length, prot, AS_AREA_UNPAGED);
-}
-
-int munmap(void *start, size_t length)
-{
-	int rc = as_area_destroy(start);
-	if (rc != EOK) {
-		errno = rc;
-		return -1;
-	}
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/sys/stat.c
===================================================================
--- uspace/lib/posix/src/sys/stat.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file File status handling.
- */
-
-#include "../internal/common.h"
-#include "posix/sys/stat.h"
-#include "libc/vfs/vfs.h"
-
-#include <errno.h>
-#include "libc/mem.h"
-
-/**
- * Convert HelenOS stat struct into POSIX stat struct (if possible).
- *
- * @param dest POSIX stat struct.
- * @param src HelenOS stat struct.
- *
- * @return 0 on success, -1 on error.
- */
-static int stat_to_posix(struct stat *dest, vfs_stat_t *src)
-{
-	memset(dest, 0, sizeof(struct stat));
-	
-	dest->st_dev = src->service;
-	dest->st_ino = src->index;
-	
-	/* HelenOS doesn't support permissions, so we set them all */
-	dest->st_mode = S_IRWXU | S_IRWXG | S_IRWXO;
-	if (src->is_file) {
-		dest->st_mode |= S_IFREG;
-	}
-	if (src->is_directory) {
-		dest->st_mode |= S_IFDIR;
-	}
-	
-	dest->st_nlink = src->lnkcnt;
-	dest->st_size = src->size;
-
-	if (src->size > INT64_MAX) {
-		errno = ERANGE;
-		return -1;
-	}
-
-	return 0;
-}
-
-/**
- * Retrieve file status for file associated with file descriptor.
- *
- * @param fd File descriptor of the opened file.
- * @param st Status structure to be filled with information.
- * @return Zero on success, -1 otherwise.
- */
-int fstat(int fd, struct stat *st)
-{
-	vfs_stat_t hst;
-	if (failed(vfs_stat(fd, &hst)))
-		return -1;
-	return stat_to_posix(st, &hst);
-}
-
-/**
- * Retrieve file status for symbolic link.
- * 
- * @param path Path to the symbolic link.
- * @param st Status structure to be filled with information.
- * @return Zero on success, -1 otherwise.
- */
-int lstat(const char *restrict path, struct stat *restrict st)
-{
-	/* There are currently no symbolic links in HelenOS. */
-	return stat(path, st);
-}
-
-/**
- * Retrieve file status for regular file (or symbolic link target).
- *
- * @param path Path to the file/link.
- * @param st Status structure to be filled with information.
- * @return Zero on success, -1 otherwise.
- */
-int stat(const char *restrict path, struct stat *restrict st)
-{
-	vfs_stat_t hst;
-	if (failed(vfs_stat_path(path, &hst)))
-		return -1;
-	return stat_to_posix(st, &hst);
-}
-
-/**
- * Change permission bits for the file if possible.
- * 
- * @param path Path to the file.
- * @param mode Permission bits to be set.
- * @return Zero on success, -1 otherwise.
- */
-int chmod(const char *path, mode_t mode)
-{
-	/* HelenOS doesn't support permissions, return success. */
-	return 0;
-}
-
-/**
- * Set the file mode creation mask of the process.
- * 
- * @param mask Set permission bits are cleared in the related creation
- *     functions. Non-permission bits are ignored.
- * @return Previous file mode creation mask.
- */
-mode_t umask(mode_t mask)
-{
-	/* HelenOS doesn't support permissions, return empty mask. */
-	return 0;
-}
-
-/**
- * Create a directory.
- * 
- * @param path Path to the new directory.
- * @param mode Permission bits to be set.
- * @return Zero on success, -1 otherwise.
- */
-int mkdir(const char *path, mode_t mode)
-{
-	if (failed(vfs_link_path(path, KIND_DIRECTORY, NULL)))
-		return -1;
-	else
-		return 0;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/sys/wait.c
===================================================================
--- uspace/lib/posix/src/sys/wait.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Support for waiting.
- */
-
-#include "../internal/common.h"
-#include "posix/sys/wait.h"
-
-#include "libc/task.h"
-#include <assert.h>
-
-#include <errno.h>
-
-#include "posix/limits.h"
-#include "posix/signal.h"
-
-int __posix_wifexited(int status) {
-	return status != INT_MIN;
-}
-
-int __posix_wexitstatus(int status) {
-	assert(__posix_wifexited(status));
-	return status;
-}
-
-int __posix_wifsignaled(int status) {
-	return status == INT_MIN;
-}
-
-int __posix_wtermsig(int status) {
-	assert(__posix_wifsignaled(status));
-	/* There is no way to distinguish reason
-	 * for unexpected termination at the moment.
-	 */
-	return SIGABRT;
-}
-
-/**
- * Wait for any child process to stop or terminate.
- * 
- * @param stat_ptr Location of the final status code of the child process.
- * @return ID of the child process for which status is reported,
- *     -1 on signal interrupt, (pid_t)-1 otherwise.
- */
-pid_t wait(int *stat_ptr)
-{
-	/* HelenOS does not support this. */
-	errno = ENOSYS;
-	return (pid_t) -1;
-}
-
-/**
- * Wait for a child process to stop or terminate.
- * 
- * @param pid What child process shall the caller wait for. See POSIX manual
- *     for details.
- * @param stat_ptr Location of the final status code of the child process.
- * @param options Constraints of the waiting. See POSIX manual for details.
- * @return ID of the child process for which status is reported,
- *     -1 on signal interrupt, 0 if non-blocking wait is requested but there is
- *     no child process whose status can be reported, (pid_t)-1 otherwise.
- */
-pid_t waitpid(pid_t pid, int *stat_ptr, int options)
-{
-	assert(stat_ptr != NULL);
-	assert(options == 0 /* None of the options are supported. */);
-	
-	task_exit_t texit;
-	int retval;
-	
-	if (failed(task_wait_task_id((task_id_t) pid, &texit, &retval))) {
-		/* Unable to retrieve status. */
-		return (pid_t) -1;
-	}
-	
-	if (texit == TASK_EXIT_NORMAL) {
-		// FIXME: relies on application not returning this value
-		assert(retval != INT_MIN);
-		*stat_ptr = retval;
-	} else {
-		/* Reserve the lowest value for unexpected termination. */
-		*stat_ptr = INT_MIN;
-	}
-	
-	return pid;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/time.c
===================================================================
--- uspace/lib/posix/src/time.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,330 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Time measurement support.
- */
-
-#include "internal/common.h"
-#include "posix/time.h"
-
-#include "posix/ctype.h"
-
-#include <errno.h>
-
-#include "posix/signal.h"
-#include <assert.h>
-
-#include "libc/async.h"
-#include "libc/malloc.h"
-#include "libc/task.h"
-#include "libc/stats.h"
-#include "libc/stddef.h"
-#include "libc/sys/time.h"
-
-// TODO: test everything in this file
-
-/* In some places in this file, phrase "normalized broken-down time" is used.
- * This means time broken down to components (year, month, day, hour, min, sec),
- * in which every component is in its proper bounds. Non-normalized time could
- * e.g. be 2011-54-5 29:13:-5, which would semantically mean start of year 2011
- * + 53 months + 4 days + 29 hours + 13 minutes - 5 seconds.
- */
-
-int posix_daylight;
-long posix_timezone;
-char *posix_tzname[2];
-
-/**
- * Set timezone conversion information.
- */
-void tzset(void)
-{
-	// TODO: read environment
-	posix_tzname[0] = (char *) "GMT";
-	posix_tzname[1] = (char *) "GMT";
-	posix_daylight = 0;
-	posix_timezone = 0;
-}
-
-/**
- * Converts a time value to a broken-down UTC time.
- * 
- * @param timer Time to convert.
- * @param result Structure to store the result to.
- * @return Value of result on success, NULL on overflow.
- */
-struct tm *gmtime_r(const time_t *restrict timer,
-    struct tm *restrict result)
-{
-	if (failed(time_utc2tm(*timer, result))) {
-		return NULL;
-	}
-
-	return result;
-}
-
-/**
- * Converts a time value to a broken-down UTC time.
- * (non reentrant version)
- *
- * @param timep  Time to convert
- * @return       Pointer to a statically allocated structure that stores
- *               the result, NULL in case of error.
- */
-struct tm *gmtime(const time_t *restrict timep)
-{
-	static struct tm result;
-
-	return gmtime_r(timep, &result);
-}
-
-/**
- * Converts a time value to a broken-down local time.
- * 
- * @param timer Time to convert.
- * @param result Structure to store the result to.
- * @return Value of result on success, NULL on overflow.
- */
-struct tm *localtime_r(const time_t *restrict timer,
-    struct tm *restrict result)
-{
-	// TODO: deal with timezone
-	// currently assumes system and all times are in GMT
-	return gmtime_r(timer, result);
-}
-
-/**
- * Converts a time value to a broken-down local time.
- * (non reentrant version)
- *
- * @param timep    Time to convert.
- * @return         Pointer to a statically allocated structure that stores
- *                 the result, NULL in case of error.
- */
-struct tm *localtime(const time_t *restrict timep)
-{
-	static struct tm result;
-
-	return localtime_r(timep, &result);
-}
-
-/**
- * Converts broken-down time to a string in format
- * "Sun Jan 1 00:00:00 1970\n". (Obsolete)
- *
- * @param timeptr Broken-down time structure.
- * @param buf Buffer to store string to, must be at least ASCTIME_BUF_LEN
- *     bytes long.
- * @return Value of buf.
- */
-char *asctime_r(const struct tm *restrict timeptr,
-    char *restrict buf)
-{
-	time_tm2str(timeptr, buf);
-	return buf;
-}
-
-/**
- * Convers broken-down time to a string in format
- * "Sun Jan 1 00:00:00 1970\n". (Obsolete)
- * (non reentrant version)
- *
- * @param timeptr    Broken-down time structure.
- * @return           Pointer to a statically allocated buffer that stores
- *                   the result, NULL in case of error.
- */
-char *asctime(const struct tm *restrict timeptr)
-{
-	static char buf[ASCTIME_BUF_LEN];
-
-	return asctime_r(timeptr, buf);
-}
-
-/**
- * Converts the calendar time to a string in format
- * "Sun Jan 1 00:00:00 1970\n" (Obsolete)
- * 
- * @param timer Time to convert.
- * @param buf Buffer to store string to. Must be at least ASCTIME_BUF_LEN
- *     bytes long.
- * @return Pointer to buf on success, NULL on failure.
- */
-char *ctime_r(const time_t *timer, char *buf)
-{
-	if (failed(time_local2str(*timer, buf))) {
-		return NULL;
-	}
-
-	return buf;
-}
-
-/**
- * Converts the calendar time to a string in format
- * "Sun Jan 1 00:00:00 1970\n" (Obsolete)
- * (non reentrant version)
- *
- * @param timep    Time to convert.
- * @return         Pointer to a statically allocated buffer that stores
- *                 the result, NULL in case of error.
- */
-char *ctime(const time_t *timep)
-{
-	static char buf[ASCTIME_BUF_LEN];
-
-	return ctime_r(timep, buf);
-}
-
-/**
- * Get clock resolution. Only CLOCK_REALTIME is supported.
- *
- * @param clock_id Clock ID.
- * @param res Pointer to the variable where the resolution is to be written.
- * @return 0 on success, -1 with errno set on failure.
- */
-int clock_getres(clockid_t clock_id, struct timespec *res)
-{
-	assert(res != NULL);
-
-	switch (clock_id) {
-		case CLOCK_REALTIME:
-			res->tv_sec = 0;
-			res->tv_nsec = 1000; /* Microsecond resolution. */
-			return 0;
-		default:
-			errno = EINVAL;
-			return -1;
-	}
-}
-
-/**
- * Get time. Only CLOCK_REALTIME is supported.
- * 
- * @param clock_id ID of the clock to query.
- * @param tp Pointer to the variable where the time is to be written.
- * @return 0 on success, -1 with errno on failure.
- */
-int clock_gettime(clockid_t clock_id, struct timespec *tp)
-{
-	assert(tp != NULL);
-
-	switch (clock_id) {
-		case CLOCK_REALTIME:
-			;
-			struct timeval tv;
-			gettimeofday(&tv, NULL);
-			tp->tv_sec = tv.tv_sec;
-			tp->tv_nsec = tv.tv_usec * 1000;
-			return 0;
-		default:
-			errno = EINVAL;
-			return -1;
-	}
-}
-
-/**
- * Set time on a specified clock. As HelenOS doesn't support this yet,
- * this function always fails.
- * 
- * @param clock_id ID of the clock to set.
- * @param tp Time to set.
- * @return 0 on success, -1 with errno on failure.
- */
-int clock_settime(clockid_t clock_id,
-    const struct timespec *tp)
-{
-	assert(tp != NULL);
-
-	switch (clock_id) {
-		case CLOCK_REALTIME:
-			// TODO: setting clock
-			// FIXME: HelenOS doesn't actually support hardware
-			//        clock yet
-			errno = EPERM;
-			return -1;
-		default:
-			errno = EINVAL;
-			return -1;
-	}
-}
-
-/**
- * Sleep on a specified clock.
- * 
- * @param clock_id ID of the clock to sleep on (only CLOCK_REALTIME supported).
- * @param flags Flags (none supported).
- * @param rqtp Sleep time.
- * @param rmtp Remaining time is written here if sleep is interrupted.
- * @return 0 on success, -1 with errno set on failure.
- */
-int clock_nanosleep(clockid_t clock_id, int flags,
-    const struct timespec *rqtp, struct timespec *rmtp)
-{
-	assert(rqtp != NULL);
-	assert(rmtp != NULL);
-
-	switch (clock_id) {
-		case CLOCK_REALTIME:
-			// TODO: interruptible sleep
-			if (rqtp->tv_sec != 0) {
-				async_sleep(rqtp->tv_sec);
-			}
-			if (rqtp->tv_nsec != 0) {
-				async_usleep(rqtp->tv_nsec / 1000);
-			}
-			return 0;
-		default:
-			errno = EINVAL;
-			return -1;
-	}
-}
-
-/**
- * Get CPU time used since the process invocation.
- *
- * @return Consumed CPU cycles by this process or -1 if not available.
- */
-clock_t clock(void)
-{
-	clock_t total_cycles = -1;
-	stats_task_t *task_stats = stats_get_task(task_get_id());
-	if (task_stats) {
-		total_cycles = (clock_t) (task_stats->kcycles +
-		    task_stats->ucycles);
-		free(task_stats);
-		task_stats = 0;
-	}
-
-	return total_cycles;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/unistd.c
===================================================================
--- uspace/lib/posix/src/unistd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,491 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Miscellaneous standard definitions.
- */
-
-#include "internal/common.h"
-#include "posix/unistd.h"
-
-#include <errno.h>
-
-#include "posix/string.h"
-#include "posix/fcntl.h"
-
-#include "libc/task.h"
-#include "libc/thread.h"
-#include "libc/stats.h"
-#include "libc/malloc.h"
-#include "libc/vfs/vfs.h"
-
-#include <libarch/config.h>
-
-// FIXME: replace with a hash table
-aoff64_t posix_pos[MAX_OPEN_FILES];
-
-/* Array of environment variable strings (NAME=VALUE). */
-char **environ = NULL;
-
-/**
- * Sleep for the specified number of seconds.
- *
- * Note that POSIX allows this call to be interrupted and then the return
- * value represents remaining seconds for the sleep. HelenOS does not offer
- * such functionality and thus always the whole sleep is taken.
- *
- * @param seconds Number of seconds to sleep.
- * @return Always 0 on HelenOS.
- */
-unsigned int sleep(unsigned int seconds)
-{
-	return thread_sleep(seconds);
-}
-
-/**
- * Get current user name.
- *
- * @return User name (static) string or NULL if not found.
- */
-char *getlogin(void)
-{
-	/* There is currently no support for user accounts in HelenOS. */
-	return (char *) "user";
-}
-
-/**
- * Get current user name.
- *
- * @param name Pointer to a user supplied buffer.
- * @param namesize Length of the buffer.
- * @return Zero on success, error code otherwise.
- */
-int getlogin_r(char *name, size_t namesize)
-{
-	/* There is currently no support for user accounts in HelenOS. */
-	if (namesize >= 5) {
-		strcpy(name, (char *) "user");
-		return 0;
-	} else {
-		errno = ERANGE;
-		return -1;
-	}
-}
-
-/**
- * Test whether open file descriptor is associated with a terminal.
- *
- * @param fd Open file descriptor to test.
- * @return Boolean result of the test.
- */
-int isatty(int fd)
-{
-	// TODO
-	/* Always returns false, because there is no easy way to find
-	 * out under HelenOS. */
-	return 0;
-}
-
-/**
- * Get the pathname of the current working directory.
- *
- * @param buf Buffer into which the pathname shall be put.
- * @param size Size of the buffer.
- * @return Buffer pointer on success, NULL on failure.
- */
-char *getcwd(char *buf, size_t size)
-{
-	if (failed(vfs_cwd_get(buf, size))) 
-		return NULL;
-	return buf;
-}
-
-/**
- * Change the current working directory.
- *
- * @param path New working directory.
- */
-int chdir(const char *path)
-{
-	if (failed(vfs_cwd_set(path)))
-		return -1;
-	return 0;
-}
-
-/**
- * Determine the page size of the current run of the process.
- *
- * @return Page size of the process.
- */
-int getpagesize(void)
-{
-	return PAGE_SIZE;
-}
-
-/**
- * Get the process ID of the calling process.
- *
- * @return Process ID.
- */
-pid_t getpid(void)
-{
-	return task_get_id();
-}
-
-/**
- * Get the real user ID of the calling process.
- *
- * @return User ID.
- */
-uid_t getuid(void)
-{
-	/* There is currently no support for user accounts in HelenOS. */
-	return 0;
-}
-
-/**
- * Get the real group ID of the calling process.
- * 
- * @return Group ID.
- */
-gid_t getgid(void)
-{
-	/* There is currently no support for user accounts in HelenOS. */
-	return 0;
-}
-
-/**
- * Close a file.
- *
- * @param fildes File descriptor of the opened file.
- * @return 0 on success, -1 on error.
- */
-int close(int fildes)
-{
-	posix_pos[fildes] = 0;
-	if (failed(vfs_put(fildes)))
-		return -1;
-	else
-		return 0;
-}
-
-/**
- * Read from a file.
- *
- * @param fildes File descriptor of the opened file.
- * @param buf Buffer to which the read bytes shall be stored.
- * @param nbyte Upper limit on the number of read bytes.
- * @return Number of read bytes on success, -1 otherwise.
- */
-ssize_t read(int fildes, void *buf, size_t nbyte)
-{
-	size_t nread;
-	if (failed(vfs_read(fildes, &posix_pos[fildes], buf, nbyte, &nread)))
-		return -1;
-	return (ssize_t) nread;
-}
-
-/**
- * Write to a file.
- *
- * @param fildes File descriptor of the opened file.
- * @param buf Buffer to write.
- * @param nbyte Size of the buffer.
- * @return Number of written bytes on success, -1 otherwise.
- */
-ssize_t write(int fildes, const void *buf, size_t nbyte)
-{
-	size_t nwr;
-	if (failed(vfs_write(fildes, &posix_pos[fildes], buf, nbyte, &nwr)))
-		return -1;
-	return nwr;
-}
-
-/**
- * Reposition read/write file offset
- *
- * @param fildes File descriptor of the opened file.
- * @param offset New offset in the file.
- * @param whence The position from which the offset argument is specified.
- * @return Upon successful completion, returns the resulting offset
- *         as measured in bytes from the beginning of the file, -1 otherwise.
- */
-off_t lseek(int fildes, off_t offset, int whence)
-{
-	vfs_stat_t st;
-
-	switch (whence) {
-	case SEEK_SET:
-		posix_pos[fildes] = offset;
-		break;
-	case SEEK_CUR:
-		posix_pos[fildes] += offset;
-		break;
-	case SEEK_END:
-		if (failed(vfs_stat(fildes, &st)))
-			return -1;
-		posix_pos[fildes] = st.size + offset;
-		break;
-	}
-	if (posix_pos[fildes] > INT64_MAX) {
-		/* The native width is too large for the POSIX interface. */
-		errno = ERANGE;
-		return -1;
-	}
-	return posix_pos[fildes];
-}
-
-/**
- * Requests outstanding data to be written to the underlying storage device.
- *
- * @param fildes File descriptor of the opened file.
- * @return Zero on success, -1 otherwise.
- */
-int fsync(int fildes)
-{
-	if (failed(vfs_sync(fildes)))
-		return -1;
-	else
-		return 0;
-}
-
-/**
- * Truncate a file to a specified length.
- *
- * @param fildes File descriptor of the opened file.
- * @param length New length of the file.
- * @return Zero on success, -1 otherwise.
- */
-int ftruncate(int fildes, off_t length)
-{
-	if (failed(vfs_resize(fildes, (aoff64_t) length)))
-		return -1;
-	else
-		return 0;
-}
-
-/**
- * Remove a directory.
- *
- * @param path Directory pathname.
- * @return Zero on success, -1 otherwise.
- */
-int rmdir(const char *path)
-{
-	if (failed(vfs_unlink_path(path)))
-		return -1;
-	else
-		return 0;
-}
-
-/**
- * Remove a link to a file.
- * 
- * @param path File pathname.
- * @return Zero on success, -1 otherwise.
- */
-int unlink(const char *path)
-{
-	if (failed(vfs_unlink_path(path)))
-		return -1;
-	else
-		return 0;
-}
-
-/**
- * Duplicate an open file descriptor.
- *
- * @param fildes File descriptor to be duplicated.
- * @return On success, new file descriptor for the same file, otherwise -1.
- */
-int dup(int fildes)
-{
-	return fcntl(fildes, F_DUPFD, 0);
-}
-
-/**
- * Duplicate an open file descriptor.
- * 
- * @param fildes File descriptor to be duplicated.
- * @param fildes2 File descriptor to be paired with the same file description
- *     as is paired fildes.
- * @return fildes2 on success, -1 otherwise.
- */
-int dup2(int fildes, int fildes2)
-{
-	int file;
-	if (failed(vfs_clone(fildes, fildes2, false, &file))) {
-		return -1;
-	}
-	return file;
-}
-
-/**
- * Determine accessibility of a file.
- *
- * @param path File to check accessibility for.
- * @param amode Either check for existence or intended access mode.
- * @return Zero on success, -1 otherwise.
- */
-int access(const char *path, int amode)
-{
-	if (amode == F_OK || (amode & (X_OK | W_OK | R_OK))) {
-		/* HelenOS doesn't support permissions, permission checks
-		 * are equal to existence check.
-		 *
-		 * Check file existence by attempting to open it.
-		 */
-		int fd = open(path, O_RDONLY);
-		if (fd < 0)
-			return -1;
-		close(fd);
-		return 0;
-	} else {
-		/* Invalid amode argument. */
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-/**
- * Get configurable system variables.
- * 
- * @param name Variable name.
- * @return Variable value.
- */
-long sysconf(int name)
-{
-	long clk_tck = 0;
-	size_t cpu_count = 0;
-	stats_cpu_t *cpu_stats = stats_get_cpus(&cpu_count);
-	if (cpu_stats && cpu_count > 0) {
-		clk_tck = ((long) cpu_stats[0].frequency_mhz) * 1000000L;
-	}
-	if (cpu_stats) {
-		free(cpu_stats);
-		cpu_stats = 0;
-	}
-
-	long phys_pages = 0;
-	long avphys_pages = 0;
-	stats_physmem_t *mem_stats = stats_get_physmem();
-	if (mem_stats) {
-		phys_pages = (long) (mem_stats->total / getpagesize());
-		avphys_pages = (long) (mem_stats->free / getpagesize());
-		free(mem_stats);
-		mem_stats = 0;
-	}
-
-	switch (name) {
-	case _SC_PHYS_PAGES:
-		return phys_pages;
-	case _SC_AVPHYS_PAGES:
-		return avphys_pages;
-	case _SC_PAGESIZE:
-		return getpagesize();
-	case _SC_CLK_TCK:
-		return clk_tck;
-	default:
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-/**
- * 
- * @param path
- * @param name
- * @return
- */
-long pathconf(const char *path, int name)
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return -1;
-}
-
-/**
- * 
- * @return
- */
-pid_t fork(void)
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return -1;
-}
-
-/**
- * 
- * @param path
- * @param argv
- * @return
- */
-int execv(const char *path, char *const argv[])
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return -1;
-}
-
-/**
- * 
- * @param file
- * @param argv
- * @return
- */
-int execvp(const char *file, char *const argv[])
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return -1;
-}
-
-/**
- * 
- * @param fildes
- * @return
- */
-int pipe(int fildes[2])
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return -1;
-}
-
-unsigned int alarm(unsigned int seconds)
-{
-	not_implemented();
-	return 0;
-}
-
-/** @}
- */
Index: uspace/lib/posix/test/scanf.c
===================================================================
--- uspace/lib/posix/test/scanf.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/posix/test/scanf.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -27,8 +27,8 @@
  */
 
+#define LIBPOSIX_INTERNAL
+#define __POSIX_DEF__(x) posix_##x
 
-
-#include <errno.h>
-
+#include "posix/errno.h"
 #include "posix/stdio.h"
 
@@ -51,5 +51,5 @@
 PCUT_TEST(int_decimal) {
 	int number;
-	int rc = sscanf("4242", "%d", &number);
+	int rc = posix_sscanf("4242", "%d", &number);
 	PCUT_ASSERT_INT_EQUALS(1, rc);
 	PCUT_ASSERT_INT_EQUALS(4242, number);
@@ -58,5 +58,5 @@
 PCUT_TEST(int_negative_decimal) {
 	int number;
-	int rc = sscanf("-53", "%d", &number);
+	int rc = posix_sscanf("-53", "%d", &number);
 	PCUT_ASSERT_INT_EQUALS(1, rc);
 	PCUT_ASSERT_INT_EQUALS(-53, number);
@@ -82,5 +82,5 @@
 	void *p;
 
-	int rc = sscanf(
+	int rc = posix_sscanf(
 		"\n j tt % \t -121314 98765 aqw 0765 0x77 0xABCDEF88 -99 884",
 		" j tt %%%3hhd%1hhu%3hd %3hu%u aqw%n %lo%llx %p %li %lld",
@@ -107,5 +107,5 @@
 	long double ld;
 
-	int rc = sscanf(
+	int rc = posix_sscanf(
 		"\n \t\t1.0 -0x555.AP10 1234.5678e12",
 		"%f %lf %Lf",
@@ -123,5 +123,5 @@
 	char *pstr;
 
-	int rc = sscanf(
+	int rc = posix_sscanf(
 		"\n\n\thello world    \n",
 		"%5s %ms",
@@ -140,5 +140,5 @@
 	char *pscanset;
 
-	int rc = sscanf(
+	int rc = posix_sscanf(
 		"\n\n\th-e-l-l-o world-]    \n",
 		" %9[-eh-o] %m[^]-]",
@@ -157,5 +157,5 @@
 	char *pseq;
 
-	int rc = sscanf(
+	int rc = posix_sscanf(
 		"\n\n\thello world    \n",
 		" %5c %mc",
Index: uspace/lib/softint/include/lltype.h
===================================================================
--- uspace/lib/softint/include/lltype.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/softint/include/lltype.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,9 +43,9 @@
 
 #ifdef __BE__
-#define LO 1
-#define HI 0
+	#define LO 1
+	#define HI 0
 #else
-#define LO 0
-#define HI 1
+	#define LO 0
+	#define HI 1
 #endif
 
Index: uspace/lib/trackmod/protracker.c
===================================================================
--- uspace/lib/trackmod/protracker.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/trackmod/protracker.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -79,5 +79,5 @@
  * @return         EOK on success, EINVAL if tag is not recognized.
  */
-static errno_t smp_tag_decode(uint8_t *tag, size_t *channels)
+static int smp_tag_decode(uint8_t *tag, size_t *channels)
 {
 	size_t nentries = sizeof(smp_tags) / sizeof(smptag_desc_t);
@@ -138,9 +138,9 @@
  * @return       EOK on success, ENOMEM if out of memory, EIO on I/O error.
  */
-static errno_t protracker_load_patterns(FILE *f, trackmod_module_t *module)
+static int protracker_load_patterns(FILE *f, trackmod_module_t *module)
 {
 	size_t cells;
 	size_t i, j;
-	errno_t rc;
+	int rc;
 	size_t nread;
 	uint32_t *buf = NULL;
@@ -191,8 +191,8 @@
  * @return       EOk on success, ENOMEM if out of memory, EIO on I/O error.
  */
-static errno_t protracker_load_samples(FILE *f, protracker_smp_t *smp,
+static int protracker_load_samples(FILE *f, protracker_smp_t *smp,
     trackmod_module_t *module)
 {
-	errno_t rc;
+	int rc;
 	size_t i;
 	uint8_t ftval;
@@ -256,5 +256,5 @@
  *                or if any error is found in the format of the file.
  */
-errno_t trackmod_protracker_load(char *fname, trackmod_module_t **rmodule)
+int trackmod_protracker_load(char *fname, trackmod_module_t **rmodule)
 {
 	FILE *f = NULL;
@@ -269,5 +269,5 @@
 	size_t i;
 	size_t nread;
-	errno_t rc;
+	int rc;
 
 	f = fopen(fname, "rb");
@@ -302,5 +302,6 @@
 		memcpy(&mod15, &mod31, sizeof(protracker_15smp_t));
 
-		if (fseek(f, sizeof(protracker_15smp_t), SEEK_SET) < 0) {
+		rc = fseek(f, sizeof(protracker_15smp_t), SEEK_SET);
+		if (rc != 0) {
 			printf("Error seeking.\n");
 			rc = EIO;
Index: uspace/lib/trackmod/protracker.h
===================================================================
--- uspace/lib/trackmod/protracker.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/trackmod/protracker.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include "types/trackmod.h"
 
-extern errno_t trackmod_protracker_load(char *, trackmod_module_t **);
+extern int trackmod_protracker_load(char *, trackmod_module_t **);
 
 #endif
Index: uspace/lib/trackmod/trackmod.c
===================================================================
--- uspace/lib/trackmod/trackmod.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/trackmod/trackmod.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -152,7 +152,7 @@
 }
 
-errno_t trackmod_module_load(char *fname, trackmod_module_t **rmodule)
-{
-	errno_t rc;
+int trackmod_module_load(char *fname, trackmod_module_t **rmodule)
+{
+	int rc;
 
 	rc = trackmod_xm_load(fname, rmodule);
@@ -780,5 +780,5 @@
  * @param rmodplay Place to store pointer to module playback object
  */
-errno_t trackmod_modplay_create(trackmod_module_t *module,
+int trackmod_modplay_create(trackmod_module_t *module,
     unsigned smp_freq, trackmod_modplay_t **rmodplay)
 {
Index: uspace/lib/trackmod/trackmod.h
===================================================================
--- uspace/lib/trackmod/trackmod.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/trackmod/trackmod.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,7 +40,7 @@
 
 extern trackmod_module_t *trackmod_module_new(void);
-extern errno_t trackmod_module_load(char *, trackmod_module_t **);
+extern int trackmod_module_load(char *, trackmod_module_t **);
 extern void trackmod_module_destroy(trackmod_module_t *);
-extern errno_t trackmod_modplay_create(trackmod_module_t *, unsigned,
+extern int trackmod_modplay_create(trackmod_module_t *, unsigned,
     trackmod_modplay_t **);
 extern void trackmod_modplay_destroy(trackmod_modplay_t *);
Index: uspace/lib/trackmod/xm.c
===================================================================
--- uspace/lib/trackmod/xm.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/trackmod/xm.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,7 +53,7 @@
  * @return EOK on success, EIO on format error, ENOMEM if out of memory.
  */
-static errno_t trackmod_xm_load_order_list(xm_hdr_t *xm_hdr, trackmod_module_t *module)
-{
-	errno_t rc;
+static int trackmod_xm_load_order_list(xm_hdr_t *xm_hdr, trackmod_module_t *module)
+{
+	int rc;
 	size_t i;
 
@@ -94,5 +94,5 @@
  * @return	  EOK on success, EINVAL if there is error in the coded data.
  */
-static errno_t trackmod_xm_decode_pattern(uint8_t *data, size_t dsize,
+static int trackmod_xm_decode_pattern(uint8_t *data, size_t dsize,
     trackmod_pattern_t *pattern)
 {
@@ -162,5 +162,5 @@
  * @return EOK on success, EIO on format error, ENOMEM if out of memory.
  */
-static errno_t trackmod_xm_load_patterns(FILE *f, trackmod_module_t *module)
+static int trackmod_xm_load_patterns(FILE *f, trackmod_module_t *module)
 {
 	size_t i;
@@ -173,6 +173,5 @@
 	uint8_t *buf = NULL;
 	long seek_amount;
-	errno_t rc;
-	int ret;
+	int rc;
 
 	module->pattern = calloc(sizeof(trackmod_pattern_t), module->patterns);
@@ -183,6 +182,6 @@
 
 	for (i = 0; i < module->patterns; i++) {
-		ret = fread(&pattern, 1, sizeof(xm_pattern_t), f);
-		if (ret != sizeof(xm_pattern_t)) {
+		rc = fread(&pattern, 1, sizeof(xm_pattern_t), f);
+		if (rc != sizeof(xm_pattern_t)) {
 			rc = EIO;
 			goto error;
@@ -281,5 +280,5 @@
  * @return EOK on success, EIO on format error, ENOMEM if out of memory.
  */
-static errno_t trackmod_xm_load_instruments(xm_hdr_t *xm_hdr, FILE *f,
+static int trackmod_xm_load_instruments(xm_hdr_t *xm_hdr, FILE *f,
     trackmod_module_t *module)
 {
@@ -297,6 +296,5 @@
 	void *smp_data;
 	long pos;
-	errno_t rc;
-	int ret;
+	int rc;
 
 	module->instrs = uint16_t_le2host(xm_hdr->instruments);
@@ -307,6 +305,6 @@
 	for (i = 0; i < module->instrs; i++) {
 		pos = ftell(f);
-		ret = fread(&instr, 1, sizeof(xm_instr_t), f);
-		if (ret != sizeof(xm_instr_t)) {
+		rc = fread(&instr, 1, sizeof(xm_instr_t), f);
+		if (rc != sizeof(xm_instr_t)) {
 			rc = EIO;
 			goto error;
@@ -317,6 +315,6 @@
 
 		if (samples > 0) {
-			ret = fread(&instrx, 1, sizeof(xm_instr_ext_t), f);
-			if (ret != sizeof(xm_instr_ext_t)) {
+			rc = fread(&instrx, 1, sizeof(xm_instr_ext_t), f);
+			if (rc != sizeof(xm_instr_ext_t)) {
 				rc = EIO;
 				goto error;
@@ -348,6 +346,6 @@
 			pos = ftell(f);
 
-			ret = fread(&smp, 1, sizeof(xm_smp_t), f);
-			if (ret != sizeof(xm_smp_t)) {
+			rc = fread(&smp, 1, sizeof(xm_smp_t), f);
+			if (rc != sizeof(xm_smp_t)) {
 				rc = EIO;
 				goto error;
@@ -422,5 +420,5 @@
  *                or if any error is found in the format of the file.
  */
-errno_t trackmod_xm_load(char *fname, trackmod_module_t **rmodule)
+int trackmod_xm_load(char *fname, trackmod_module_t **rmodule)
 {
 	FILE *f = NULL;
@@ -429,5 +427,5 @@
 	size_t nread;
 	size_t hdr_size;
-	errno_t rc;
+	int rc;
 
 	f = fopen(fname, "rb");
Index: uspace/lib/trackmod/xm.h
===================================================================
--- uspace/lib/trackmod/xm.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/trackmod/xm.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include "types/trackmod.h"
 
-extern errno_t trackmod_xm_load(char *, trackmod_module_t **);
+extern int trackmod_xm_load(char *, trackmod_module_t **);
 
 #endif
Index: uspace/lib/uri/ctype.h
===================================================================
--- uspace/lib/uri/ctype.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
+++ uspace/lib/uri/ctype.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2013 Martin Sucha
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup uri
+ * @{
+ */
+/**
+ * @file
+ */
+
+#ifndef URI_CTYPE_H_
+#define URI_CTYPE_H_
+
+static inline bool is_unreserved(char c)
+{
+	return isalpha(c) || isdigit(c) ||
+	    c == '-' || c == '.' || c == '_' || c == '~';
+}
+
+static inline bool is_hexdig(char c)
+{
+	return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
+	    (c >= 'A' && c <= 'F');
+}
+
+static inline bool is_subdelim(char c)
+{
+	switch (c) {
+	case '!':
+	case '$':
+	case '&':
+	case '\'':
+	case '(':
+	case ')':
+	case '*':
+	case '+':
+	case ',':
+	case ';':
+	case '=':
+		return true;
+	default:
+		return false;
+	}
+}
+
+static inline bool is_gendelim(char c)
+{
+	switch (c) {
+	case ':':
+	case '/':
+	case '?':
+	case '#':
+	case '[':
+	case ']':
+	case '@':
+		return true;
+	default:
+		return false;
+	}
+}
+
+static inline bool is_reserved(char c)
+{
+	return is_gendelim(c) || is_subdelim(c);
+}
+
+#endif
+
+/** @}
+ */
Index: pace/lib/uri/internal/ctype.h
===================================================================
--- uspace/lib/uri/internal/ctype.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uri
- * @{
- */
-/**
- * @file
- */
-
-#ifndef URI_CTYPE_H_
-#define URI_CTYPE_H_
-
-static inline bool is_unreserved(char c)
-{
-	return isalpha(c) || isdigit(c) ||
-	    c == '-' || c == '.' || c == '_' || c == '~';
-}
-
-static inline bool is_hexdig(char c)
-{
-	return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
-	    (c >= 'A' && c <= 'F');
-}
-
-static inline bool is_subdelim(char c)
-{
-	switch (c) {
-	case '!':
-	case '$':
-	case '&':
-	case '\'':
-	case '(':
-	case ')':
-	case '*':
-	case '+':
-	case ',':
-	case ';':
-	case '=':
-		return true;
-	default:
-		return false;
-	}
-}
-
-static inline bool is_gendelim(char c)
-{
-	switch (c) {
-	case ':':
-	case '/':
-	case '?':
-	case '#':
-	case '[':
-	case ']':
-	case '@':
-		return true;
-	default:
-		return false;
-	}
-}
-
-static inline bool is_reserved(char c)
-{
-	return is_gendelim(c) || is_subdelim(c);
-}
-
-#endif
-
-/** @}
- */
Index: uspace/lib/uri/uri.c
===================================================================
--- uspace/lib/uri/uri.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/uri/uri.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 
 #include "uri.h"
-#include "internal/ctype.h"
+#include "ctype.h"
 
 static char *cut_str(const char *start, const char *end)
@@ -143,5 +143,5 @@
  * @return EOK on success
  */
-errno_t uri_scheme_parse(const char *str, const char **endptr)
+int uri_scheme_parse(const char *str, const char **endptr)
 {
 	if (*str == 0) {
@@ -175,5 +175,5 @@
 }
 
-errno_t uri_percent_parse(const char *str, const char **endptr,
+int uri_percent_parse(const char *str, const char **endptr,
     uint8_t *decoded)
 {
@@ -186,5 +186,5 @@
 	
 	if (decoded != NULL) {
-		errno_t rc = str_uint8_t(str + 1, NULL, 16, true, decoded);
+		int rc = str_uint8_t(str + 1, NULL, 16, true, decoded);
 		if (rc != EOK)
 			return rc;
@@ -195,5 +195,5 @@
 }
 
-errno_t uri_user_info_parse(const char *str, const char **endptr)
+int uri_user_info_parse(const char *str, const char **endptr)
 {
 	while (*str != 0) {
@@ -201,5 +201,5 @@
 		if (*str == 0)
 			break;
-		errno_t rc = uri_percent_parse(str, &str, NULL);
+		int rc = uri_percent_parse(str, &str, NULL);
 		if (rc != EOK) {
 			*endptr = str;
@@ -220,5 +220,5 @@
 }
 
-errno_t uri_port_parse(const char *str, const char **endptr)
+int uri_port_parse(const char *str, const char **endptr)
 {
 	if (*str == 0)
Index: uspace/lib/uri/uri.h
===================================================================
--- uspace/lib/uri/uri.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/uri/uri.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,10 +49,10 @@
 
 extern uri_t *uri_parse(const char *);
-extern errno_t uri_scheme_parse(const char *, const char **);
+extern int uri_scheme_parse(const char *, const char **);
 extern bool uri_scheme_validate(const char *);
-extern errno_t uri_percent_parse(const char *, const char **, uint8_t *);
-extern errno_t uri_user_info_parse(const char *, const char **);
+extern int uri_percent_parse(const char *, const char **, uint8_t *);
+extern int uri_user_info_parse(const char *, const char **);
 extern bool uri_user_info_validate(const char *);
-extern errno_t uri_port_parse(const char *, const char **);
+extern int uri_port_parse(const char *, const char **);
 extern bool uri_port_validate(const char *);
 extern bool uri_validate(uri_t *);
Index: uspace/lib/usb/include/usb/dev.h
===================================================================
--- uspace/lib/usb/include/usb/dev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usb/include/usb/dev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include <devman.h>
 
-extern errno_t usb_resolve_device_handle(const char *, devman_handle_t *);
+extern int usb_resolve_device_handle(const char *, devman_handle_t *);
 
 #endif
Index: uspace/lib/usb/src/debug.c
===================================================================
--- uspace/lib/usb/src/debug.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usb/src/debug.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <ddf/log.h>
 #include <usb/debug.h>
-#include <str.h>
 
 #define REMAINDER_STR_FMT " (%zu)..."
Index: uspace/lib/usb/src/dev.c
===================================================================
--- uspace/lib/usb/src/dev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usb/src/dev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,5 +53,5 @@
  * @return Error code.
  */
-errno_t usb_resolve_device_handle(const char *dev_path, devman_handle_t *dev_handle)
+int usb_resolve_device_handle(const char *dev_path, devman_handle_t *dev_handle)
 {
 	if (dev_path == NULL || dev_handle == NULL) {
@@ -60,5 +60,5 @@
 
 	/* First, try to get the device handle. */
-	errno_t rc = devman_fun_get_handle(dev_path, dev_handle, 0);
+	int rc = devman_fun_get_handle(dev_path, dev_handle, 0);
 
 	/* Next, try parsing dev_handle from the provided string */
Index: uspace/lib/usbdev/include/usb/dev/alternate_ifaces.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/alternate_ifaces.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/include/usb/dev/alternate_ifaces.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,4 @@
 #define LIBUSBDEV_ALTERNATE_IFACES_H_
 
-#include <errno.h>
 #include <usb/descriptor.h>
 #include <stddef.h>
@@ -59,5 +58,5 @@
 typedef struct {
 	/** Array of alternate interfaces descriptions. */
-	usb_alternate_interface_descriptors_t *alternatives;
+	const usb_alternate_interface_descriptors_t *alternatives;
 	/** Size of @c alternatives array. */
 	size_t alternative_count;
@@ -67,5 +66,5 @@
 
 size_t usb_interface_count_alternates(const uint8_t *, size_t, uint8_t);
-errno_t usb_alternate_interfaces_init(usb_alternate_interfaces_t *,
+int usb_alternate_interfaces_init(usb_alternate_interfaces_t *,
     const uint8_t *, size_t, int);
 void usb_alternate_interfaces_deinit(usb_alternate_interfaces_t *);
Index: uspace/lib/usbdev/include/usb/dev/device.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/device.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/include/usb/dev/device.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
 	usb_standard_device_descriptor_t device;
 	/** Full configuration descriptor of current configuration. */
-	void *full_config;
+	const void *full_config;
 	size_t full_config_size;
 } usb_device_descriptors_t;
@@ -58,5 +58,5 @@
 
 /* DDF parts */
-errno_t usb_device_create_ddf(ddf_dev_t *, const usb_endpoint_description_t **, const char **);
+int usb_device_create_ddf(ddf_dev_t *, const usb_endpoint_description_t **, const char **);
 void usb_device_destroy_ddf(ddf_dev_t *);
 
@@ -76,8 +76,8 @@
 void usb_device_bus_exchange_end(async_exch_t *);
 
-errno_t usb_device_select_interface(usb_device_t *, uint8_t,
+int usb_device_select_interface(usb_device_t *, uint8_t,
     const usb_endpoint_description_t **);
 
-errno_t usb_device_create_pipes(usb_device_t *usb_dev,
+int usb_device_create_pipes(usb_device_t *usb_dev,
     const usb_endpoint_description_t **endpoints);
 void usb_device_destroy_pipes(usb_device_t *);
Index: uspace/lib/usbdev/include/usb/dev/driver.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/driver.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/include/usb/dev/driver.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,9 +43,9 @@
 typedef struct {
 	/** Callback when a new device was added to the system. */
-	errno_t (*device_add)(usb_device_t *);
+	int (*device_add)(usb_device_t *);
 	/** Callback when a device is about to be removed from the system. */
-	errno_t (*device_rem)(usb_device_t *);
+	int (*device_rem)(usb_device_t *);
 	/** Callback when a device was removed from the system. */
-	errno_t (*device_gone)(usb_device_t *);
+	int (*device_gone)(usb_device_t *);
 } usb_driver_ops_t;
 
Index: uspace/lib/usbdev/include/usb/dev/pipes.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/pipes.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/include/usb/dev/pipes.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -109,21 +109,21 @@
 } usb_endpoint_mapping_t;
 
-errno_t usb_pipe_initialize(usb_pipe_t *, usb_endpoint_t, usb_transfer_type_t,
+int usb_pipe_initialize(usb_pipe_t *, usb_endpoint_t, usb_transfer_type_t,
     size_t, usb_direction_t, unsigned, usb_dev_session_t *);
-errno_t usb_pipe_initialize_default_control(usb_pipe_t *, usb_dev_session_t *);
+int usb_pipe_initialize_default_control(usb_pipe_t *, usb_dev_session_t *);
 
-errno_t usb_pipe_probe_default_control(usb_pipe_t *);
-errno_t usb_pipe_initialize_from_configuration(usb_endpoint_mapping_t *,
+int usb_pipe_probe_default_control(usb_pipe_t *);
+int usb_pipe_initialize_from_configuration(usb_endpoint_mapping_t *,
     size_t, const uint8_t *, size_t, usb_dev_session_t *);
 
-errno_t usb_pipe_register(usb_pipe_t *, unsigned);
-errno_t usb_pipe_unregister(usb_pipe_t *);
+int usb_pipe_register(usb_pipe_t *, unsigned);
+int usb_pipe_unregister(usb_pipe_t *);
 
-errno_t usb_pipe_read(usb_pipe_t *, void *, size_t, size_t *);
-errno_t usb_pipe_write(usb_pipe_t *, const void *, size_t);
+int usb_pipe_read(usb_pipe_t *, void *, size_t, size_t *);
+int usb_pipe_write(usb_pipe_t *, const void *, size_t);
 
-errno_t usb_pipe_control_read(usb_pipe_t *, const void *, size_t,
+int usb_pipe_control_read(usb_pipe_t *, const void *, size_t,
     void *, size_t, size_t *);
-errno_t usb_pipe_control_write(usb_pipe_t *, const void *, size_t,
+int usb_pipe_control_write(usb_pipe_t *, const void *, size_t,
     const void *, size_t);
 
Index: uspace/lib/usbdev/include/usb/dev/poll.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/poll.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/include/usb/dev/poll.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -87,5 +87,5 @@
 	 * @return Whether to continue in polling.
 	 */
-	bool (*on_error)(usb_device_t *dev, errno_t err_code, void *arg);
+	bool (*on_error)(usb_device_t *dev, int err_code, void *arg);
 	/** Argument to pass to callbacks. */
 	void *arg;
@@ -95,15 +95,15 @@
 typedef void (*usb_polling_terminted_callback_t)(usb_device_t *, bool, void *);
 
-extern errno_t usb_device_auto_polling(usb_device_t *, usb_endpoint_t,
+extern int usb_device_auto_polling(usb_device_t *, usb_endpoint_t,
     const usb_device_auto_polling_t *, size_t);
 
-extern errno_t usb_device_auto_poll(usb_device_t *, usb_endpoint_t,
+extern int usb_device_auto_poll(usb_device_t *, usb_endpoint_t,
     usb_polling_callback_t, size_t, int, usb_polling_terminted_callback_t, void *);
 
-extern errno_t usb_device_auto_polling_desc(usb_device_t *,
+extern int usb_device_auto_polling_desc(usb_device_t *,
     const usb_endpoint_description_t *, const usb_device_auto_polling_t *,
     size_t);
 
-extern errno_t usb_device_auto_poll_desc(usb_device_t *,
+extern int usb_device_auto_poll_desc(usb_device_t *,
     const usb_endpoint_description_t *, usb_polling_callback_t, size_t, int,
     usb_polling_terminted_callback_t, void *);
Index: uspace/lib/usbdev/include/usb/dev/recognise.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/recognise.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/include/usb/dev/recognise.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,12 +42,12 @@
 #include <devman.h>
 
-extern errno_t usb_device_create_match_ids_from_device_descriptor(
+extern int usb_device_create_match_ids_from_device_descriptor(
     const usb_standard_device_descriptor_t *, match_id_list_t *);
 
-extern errno_t usb_device_create_match_ids_from_interface(
+extern int usb_device_create_match_ids_from_interface(
     const usb_standard_device_descriptor_t *,
     const usb_standard_interface_descriptor_t *, match_id_list_t *);
 
-extern errno_t usb_device_create_match_ids(usb_pipe_t *, match_id_list_t *);
+extern int usb_device_create_match_ids(usb_pipe_t *, match_id_list_t *);
 
 #endif
Index: uspace/lib/usbdev/include/usb/dev/request.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/request.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/include/usb/dev/request.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,48 +44,48 @@
 #include <usb/request.h>
 
-errno_t usb_control_request_set(usb_pipe_t *,
+int usb_control_request_set(usb_pipe_t *,
     usb_request_type_t, usb_request_recipient_t, uint8_t,
     uint16_t, uint16_t, const void *, size_t);
 
-errno_t usb_control_request_get(usb_pipe_t *,
+int usb_control_request_get(usb_pipe_t *,
     usb_request_type_t, usb_request_recipient_t, uint8_t,
     uint16_t, uint16_t, void *, size_t, size_t *);
 
-errno_t usb_request_get_status(usb_pipe_t *, usb_request_recipient_t,
+int usb_request_get_status(usb_pipe_t *, usb_request_recipient_t,
     uint16_t, uint16_t *);
-errno_t usb_request_clear_feature(usb_pipe_t *, usb_request_type_t,
+int usb_request_clear_feature(usb_pipe_t *, usb_request_type_t,
     usb_request_recipient_t, uint16_t, uint16_t);
-errno_t usb_request_set_feature(usb_pipe_t *, usb_request_type_t,
+int usb_request_set_feature(usb_pipe_t *, usb_request_type_t,
     usb_request_recipient_t, uint16_t, uint16_t);
-errno_t usb_request_get_descriptor(usb_pipe_t *, usb_request_type_t,
+int usb_request_get_descriptor(usb_pipe_t *, usb_request_type_t,
     usb_request_recipient_t, uint8_t, uint8_t, uint16_t, void *, size_t,
     size_t *);
-errno_t usb_request_get_descriptor_alloc(usb_pipe_t *, usb_request_type_t,
+int usb_request_get_descriptor_alloc(usb_pipe_t *, usb_request_type_t,
     usb_request_recipient_t, uint8_t, uint8_t, uint16_t, void **, size_t *);
-errno_t usb_request_get_device_descriptor(usb_pipe_t *,
+int usb_request_get_device_descriptor(usb_pipe_t *,
     usb_standard_device_descriptor_t *);
-errno_t usb_request_get_bare_configuration_descriptor(usb_pipe_t *, int,
+int usb_request_get_bare_configuration_descriptor(usb_pipe_t *, int,
     usb_standard_configuration_descriptor_t *);
-errno_t usb_request_get_full_configuration_descriptor(usb_pipe_t *, int,
+int usb_request_get_full_configuration_descriptor(usb_pipe_t *, int,
     void *, size_t, size_t *);
-errno_t usb_request_get_full_configuration_descriptor_alloc(usb_pipe_t *,
-    int, void **, size_t *);
-errno_t usb_request_set_descriptor(usb_pipe_t *, usb_request_type_t,
+int usb_request_get_full_configuration_descriptor_alloc(usb_pipe_t *,
+    int, const void **, size_t *);
+int usb_request_set_descriptor(usb_pipe_t *, usb_request_type_t,
     usb_request_recipient_t, uint8_t, uint8_t, uint16_t, const void *, size_t);
 
-errno_t usb_request_get_configuration(usb_pipe_t *, uint8_t *);
-errno_t usb_request_set_configuration(usb_pipe_t *, uint8_t);
+int usb_request_get_configuration(usb_pipe_t *, uint8_t *);
+int usb_request_set_configuration(usb_pipe_t *, uint8_t);
 
-errno_t usb_request_get_interface(usb_pipe_t *, uint8_t, uint8_t *);
-errno_t usb_request_set_interface(usb_pipe_t *, uint8_t, uint8_t);
+int usb_request_get_interface(usb_pipe_t *, uint8_t, uint8_t *);
+int usb_request_set_interface(usb_pipe_t *, uint8_t, uint8_t);
 
-errno_t usb_request_get_supported_languages(usb_pipe_t *,
+int usb_request_get_supported_languages(usb_pipe_t *,
     l18_win_locales_t **, size_t *);
-errno_t usb_request_get_string(usb_pipe_t *, size_t, l18_win_locales_t,
+int usb_request_get_string(usb_pipe_t *, size_t, l18_win_locales_t,
     char **);
 
-errno_t usb_request_clear_endpoint_halt(usb_pipe_t *, uint16_t);
-errno_t usb_pipe_clear_halt(usb_pipe_t *, usb_pipe_t *);
-errno_t usb_request_get_endpoint_status(usb_pipe_t *, usb_pipe_t *, uint16_t *);
+int usb_request_clear_endpoint_halt(usb_pipe_t *, uint16_t);
+int usb_pipe_clear_halt(usb_pipe_t *, usb_pipe_t *);
+int usb_request_get_endpoint_status(usb_pipe_t *, usb_pipe_t *, uint16_t *);
 
 #endif
Index: uspace/lib/usbdev/src/altiface.c
===================================================================
--- uspace/lib/usbdev/src/altiface.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/src/altiface.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -88,5 +88,5 @@
  * @return Error code.
  */
-errno_t usb_alternate_interfaces_init(usb_alternate_interfaces_t *alternates,
+int usb_alternate_interfaces_init(usb_alternate_interfaces_t *alternates,
     const uint8_t *config_descr, size_t config_descr_size, int interface_number)
 {
Index: uspace/lib/usbdev/src/devdrv.c
===================================================================
--- uspace/lib/usbdev/src/devdrv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/src/devdrv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -131,5 +131,5 @@
  * @return Error code.
  */
-errno_t usb_device_select_interface(usb_device_t *usb_dev,
+int usb_device_select_interface(usb_device_t *usb_dev,
     uint8_t alternate_setting, const usb_endpoint_description_t **endpoints)
 {
@@ -141,5 +141,5 @@
 
 	/* Change the interface itself. */
-	errno_t rc = usb_request_set_interface(&usb_dev->ctrl_pipe,
+	int rc = usb_request_set_interface(&usb_dev->ctrl_pipe,
 	    usb_dev->interface_no, alternate_setting);
 	if (rc != EOK) {
@@ -165,5 +165,5 @@
  * @return Error code.
  */
-static errno_t usb_device_retrieve_descriptors(usb_device_t *usb_dev)
+static int usb_device_retrieve_descriptors(usb_device_t *usb_dev)
 {
 	assert(usb_dev);
@@ -171,5 +171,5 @@
 
 	/* Get the device descriptor. */
-	errno_t rc = usb_request_get_device_descriptor(&usb_dev->ctrl_pipe,
+	int rc = usb_request_get_device_descriptor(&usb_dev->ctrl_pipe,
 	    &usb_dev->descriptors.device);
 	if (rc != EOK) {
@@ -217,5 +217,5 @@
  * @return Error code.
  */
-errno_t usb_device_create_pipes(usb_device_t *usb_dev,
+int usb_device_create_pipes(usb_device_t *usb_dev,
     const usb_endpoint_description_t **endpoints)
 {
@@ -245,5 +245,5 @@
 
 	/* Find the mapping from configuration descriptor. */
-	errno_t rc = usb_pipe_initialize_from_configuration(pipes, pipe_count,
+	int rc = usb_pipe_initialize_from_configuration(pipes, pipe_count,
 	    usb_dev->descriptors.full_config,
 	    usb_dev->descriptors.full_config_size,
@@ -393,5 +393,5 @@
  * @return Error code.
  */
-static errno_t usb_device_init(usb_device_t *usb_dev, ddf_dev_t *ddf_dev,
+static int usb_device_init(usb_device_t *usb_dev, ddf_dev_t *ddf_dev,
     const usb_endpoint_description_t **endpoints, const char **errstr_ptr,
     devman_handle_t handle, int interface_no)
@@ -420,5 +420,5 @@
 	/* This pipe was registered by the hub driver,
 	 * during device initialization. */
-	errno_t rc = usb_pipe_initialize_default_control(
+	int rc = usb_pipe_initialize_default_control(
 	    &usb_dev->ctrl_pipe, usb_dev->bus_session);
 	if (rc != EOK) {
@@ -457,5 +457,5 @@
 }
 
-static errno_t usb_device_get_info(async_sess_t *sess, devman_handle_t *handle,
+static int usb_device_get_info(async_sess_t *sess, devman_handle_t *handle,
 	int *iface_no)
 {
@@ -467,5 +467,5 @@
 		return EPARTY;
 	
-	errno_t ret = usb_get_my_device_handle(exch, handle);
+	int ret = usb_get_my_device_handle(exch, handle);
 	if (ret == EOK) {
 		ret = usb_get_my_interface(exch, iface_no);
@@ -480,5 +480,5 @@
 }
 
-errno_t usb_device_create_ddf(ddf_dev_t *ddf_dev,
+int usb_device_create_ddf(ddf_dev_t *ddf_dev,
     const usb_endpoint_description_t **desc, const char **err)
 {
@@ -492,5 +492,5 @@
 	if (sess == NULL)
 		return ENOMEM;
-	const errno_t ret = usb_device_get_info(sess, &h, &iface_no);
+	const int ret = usb_device_get_info(sess, &h, &iface_no);
 	if (ret != EOK)
 		return ret;
@@ -521,5 +521,5 @@
 
 	async_sess_t *sess = devman_device_connect(handle, IPC_FLAG_BLOCKING);
-	errno_t ret = usb_device_get_info(sess, &h, &iface_no);
+	int ret = usb_device_get_info(sess, &h, &iface_no);
 	if (sess)
 		async_hangup(sess);
Index: uspace/lib/usbdev/src/devpoll.c
===================================================================
--- uspace/lib/usbdev/src/devpoll.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/src/devpoll.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -77,8 +77,8 @@
  * @return Always EOK.
  */
-static errno_t polling_fibril(void *arg)
+static int polling_fibril(void *arg)
 {
 	assert(arg);
-	polling_data_t *data = arg;
+	const polling_data_t *data = arg;
 	/* Helper to reduce typing. */
 	const usb_device_auto_polling_t *params = &data->auto_polling;
@@ -102,5 +102,5 @@
 	while (failed_attempts <= params->max_failures) {
 		size_t actual_size;
-		const errno_t rc = usb_pipe_read(pipe, data->buffer,
+		const int rc = usb_pipe_read(pipe, data->buffer,
 		    data->request_size, &actual_size);
 
@@ -206,5 +206,5 @@
  * @retval EOK New fibril polling the device was already started.
  */
-static errno_t usb_device_auto_polling_internal(usb_device_t *dev,
+static int usb_device_auto_polling_internal(usb_device_t *dev,
     usb_endpoint_mapping_t *epm, const usb_device_auto_polling_t *polling,
     size_t request_size)
@@ -275,5 +275,5 @@
  * @retval EOK New fibril polling the device was already started.
  */
-errno_t usb_device_auto_polling(usb_device_t *usb_dev, usb_endpoint_t ep,
+int usb_device_auto_polling(usb_device_t *usb_dev, usb_endpoint_t ep,
     const usb_device_auto_polling_t *polling, size_t req_size)
 {
@@ -301,5 +301,5 @@
  * @retval EOK New fibril polling the device was already started.
  */
-errno_t usb_device_auto_poll(usb_device_t *dev, usb_endpoint_t ep,
+int usb_device_auto_poll(usb_device_t *dev, usb_endpoint_t ep,
     usb_polling_callback_t callback, size_t request_size, int delay,
     usb_polling_terminted_callback_t terminated_callback, void *arg)
@@ -321,5 +321,5 @@
 }
 
-errno_t usb_device_auto_polling_desc(usb_device_t *usb_dev,
+int usb_device_auto_polling_desc(usb_device_t *usb_dev,
     const usb_endpoint_description_t *desc,
     const usb_device_auto_polling_t *polling, size_t req_size)
@@ -330,5 +330,5 @@
 }
 
-errno_t usb_device_auto_poll_desc(usb_device_t * usb_dev,
+int usb_device_auto_poll_desc(usb_device_t * usb_dev,
     const usb_endpoint_description_t *desc, usb_polling_callback_t callback,
     size_t req_size, int delay,
Index: uspace/lib/usbdev/src/driver.c
===================================================================
--- uspace/lib/usbdev/src/driver.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/src/driver.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,5 @@
  * @return Error code.
  */
-static errno_t generic_device_add(ddf_dev_t *gen_dev)
+static int generic_device_add(ddf_dev_t *gen_dev)
 {
 	assert(driver);
@@ -60,5 +60,5 @@
 	/* Initialize generic USB driver data. */
 	const char *err_msg = NULL;
-	errno_t rc = usb_device_create_ddf(gen_dev, driver->endpoints, &err_msg);
+	int rc = usb_device_create_ddf(gen_dev, driver->endpoints, &err_msg);
 	if (rc != EOK) {
 		usb_log_error("USB device `%s' init failed (%s): %s.\n",
@@ -81,5 +81,5 @@
  * @return Error code.
  */
-static errno_t generic_device_remove(ddf_dev_t *gen_dev)
+static int generic_device_remove(ddf_dev_t *gen_dev)
 {
 	assert(driver);
@@ -89,5 +89,5 @@
 	/* Just tell the driver to stop whatever it is doing */
 	usb_device_t *usb_dev = ddf_dev_data_get(gen_dev);
-	const errno_t ret = driver->ops->device_rem(usb_dev);
+	const int ret = driver->ops->device_rem(usb_dev);
 	if (ret != EOK)
 		return ret;
@@ -103,5 +103,5 @@
  * @return Error code.
  */
-static errno_t generic_device_gone(ddf_dev_t *gen_dev)
+static int generic_device_gone(ddf_dev_t *gen_dev)
 {
 	assert(driver);
@@ -110,5 +110,5 @@
 		return ENOTSUP;
 	usb_device_t *usb_dev = ddf_dev_data_get(gen_dev);
-	const errno_t ret = driver->ops->device_gone(usb_dev);
+	const int ret = driver->ops->device_gone(usb_dev);
 	if (ret == EOK)
 		usb_device_destroy_ddf(gen_dev);
Index: uspace/lib/usbdev/src/pipes.c
===================================================================
--- uspace/lib/usbdev/src/pipes.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/src/pipes.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -74,5 +74,5 @@
  * @return Error code.
  */
-errno_t usb_pipe_control_read(usb_pipe_t *pipe,
+int usb_pipe_control_read(usb_pipe_t *pipe,
     const void *setup_buffer, size_t setup_buffer_size,
     void *buffer, size_t buffer_size, size_t *transfered_size)
@@ -98,5 +98,5 @@
 	async_exch_t *exch = async_exchange_begin(pipe->bus_session);
 	size_t act_size = 0;
-	const errno_t rc = usb_read(exch, pipe->endpoint_no, setup_packet, buffer,
+	const int rc = usb_read(exch, pipe->endpoint_no, setup_packet, buffer,
 	    buffer_size, &act_size);
 	async_exchange_end(exch);
@@ -124,5 +124,5 @@
  * @return Error code.
  */
-errno_t usb_pipe_control_write(usb_pipe_t *pipe,
+int usb_pipe_control_write(usb_pipe_t *pipe,
     const void *setup_buffer, size_t setup_buffer_size,
     const void *buffer, size_t buffer_size)
@@ -151,5 +151,5 @@
 
 	async_exch_t *exch = async_exchange_begin(pipe->bus_session);
-	const errno_t rc = usb_write(exch,
+	const int rc = usb_write(exch,
 	    pipe->endpoint_no, setup_packet, buffer, buffer_size);
 	async_exchange_end(exch);
@@ -170,5 +170,5 @@
  * @return Error code.
  */
-errno_t usb_pipe_read(usb_pipe_t *pipe,
+int usb_pipe_read(usb_pipe_t *pipe,
     void *buffer, size_t size, size_t *size_transfered)
 {
@@ -198,5 +198,5 @@
 	async_exch_t *exch = async_exchange_begin(pipe->bus_session);
 	size_t act_size = 0;
-	const errno_t rc =
+	const int rc =
 	    usb_read(exch, pipe->endpoint_no, 0, buffer, size, &act_size);
 	async_exchange_end(exch);
@@ -216,5 +216,5 @@
  * @return Error code.
  */
-errno_t usb_pipe_write(usb_pipe_t *pipe, const void *buffer, size_t size)
+int usb_pipe_write(usb_pipe_t *pipe, const void *buffer, size_t size)
 {
 	assert(pipe);
@@ -238,5 +238,5 @@
 
 	async_exch_t *exch = async_exchange_begin(pipe->bus_session);
-	const errno_t rc = usb_write(exch, pipe->endpoint_no, 0, buffer, size);
+	const int rc = usb_write(exch, pipe->endpoint_no, 0, buffer, size);
 	async_exchange_end(exch);
 	return rc;
@@ -252,5 +252,5 @@
  * @return Error code.
  */
-errno_t usb_pipe_initialize(usb_pipe_t *pipe, usb_endpoint_t endpoint_no,
+int usb_pipe_initialize(usb_pipe_t *pipe, usb_endpoint_t endpoint_no,
     usb_transfer_type_t transfer_type, size_t max_packet_size,
     usb_direction_t direction, unsigned packets, usb_dev_session_t *bus_session)
@@ -274,10 +274,10 @@
  * @return Error code.
  */
-errno_t usb_pipe_initialize_default_control(usb_pipe_t *pipe,
+int usb_pipe_initialize_default_control(usb_pipe_t *pipe,
     usb_dev_session_t *bus_session)
 {
 	assert(pipe);
 
-	const errno_t rc = usb_pipe_initialize(pipe, 0, USB_TRANSFER_CONTROL,
+	const int rc = usb_pipe_initialize(pipe, 0, USB_TRANSFER_CONTROL,
 	    CTRL_PIPE_MIN_PACKET_SIZE, USB_DIRECTION_BOTH, 1, bus_session);
 
@@ -293,5 +293,5 @@
  * @return Error code.
  */
-errno_t usb_pipe_register(usb_pipe_t *pipe, unsigned interval)
+int usb_pipe_register(usb_pipe_t *pipe, unsigned interval)
 {
 	assert(pipe);
@@ -300,5 +300,5 @@
 	if (!exch)
 		return ENOMEM;
-	const errno_t ret = usb_register_endpoint(exch, pipe->endpoint_no,
+	const int ret = usb_register_endpoint(exch, pipe->endpoint_no,
 	    pipe->transfer_type, pipe->direction, pipe->max_packet_size,
 	    pipe->packets, interval);
@@ -312,5 +312,5 @@
  * @return Error code.
  */
-errno_t usb_pipe_unregister(usb_pipe_t *pipe)
+int usb_pipe_unregister(usb_pipe_t *pipe)
 {
 	assert(pipe);
@@ -319,5 +319,5 @@
 	if (!exch)
 		return ENOMEM;
-	const errno_t ret = usb_unregister_endpoint(exch, pipe->endpoint_no,
+	const int ret = usb_unregister_endpoint(exch, pipe->endpoint_no,
 	    pipe->direction);
 	async_exchange_end(exch);
Index: uspace/lib/usbdev/src/pipesinit.c
===================================================================
--- uspace/lib/usbdev/src/pipesinit.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/src/pipesinit.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -152,5 +152,5 @@
  * @return Error code.
  */
-static errno_t process_endpoint(
+static int process_endpoint(
     usb_endpoint_mapping_t *mapping, size_t mapping_count,
     usb_standard_interface_descriptor_t *interface,
@@ -194,5 +194,5 @@
 	}
 
-	errno_t rc = usb_pipe_initialize(&ep_mapping->pipe,
+	int rc = usb_pipe_initialize(&ep_mapping->pipe,
 	    ep_no, description.transfer_type,
 	    ED_MPS_PACKET_SIZE_GET(
@@ -221,5 +221,5 @@
  * @return Error code.
  */
-static errno_t process_interface(
+static int process_interface(
     usb_endpoint_mapping_t *mapping, size_t mapping_count,
     const usb_dp_parser_t *parser, const usb_dp_parser_data_t *parser_data,
@@ -281,5 +281,5 @@
  * @return Error code.
  */
-errno_t usb_pipe_initialize_from_configuration(
+int usb_pipe_initialize_from_configuration(
     usb_endpoint_mapping_t *mapping, size_t mapping_count,
     const uint8_t *config_descriptor, size_t config_descriptor_size,
@@ -338,5 +338,5 @@
  * @return Error code.
  */
-errno_t usb_pipe_probe_default_control(usb_pipe_t *pipe)
+int usb_pipe_probe_default_control(usb_pipe_t *pipe)
 {
 	assert(pipe);
@@ -351,5 +351,5 @@
 	uint8_t dev_descr_start[CTRL_PIPE_MIN_PACKET_SIZE];
 	size_t transferred_size;
-	errno_t rc;
+	int rc;
 	for (size_t attempt_var = 0; attempt_var < 3; ++attempt_var) {
 		rc = usb_request_get_descriptor(pipe, USB_REQUEST_TYPE_STANDARD,
Index: uspace/lib/usbdev/src/recognise.c
===================================================================
--- uspace/lib/usbdev/src/recognise.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/src/recognise.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,6 +60,6 @@
  * @return Error code.
  */
-static errno_t usb_add_match_id(match_id_list_t *matches, int score,
-    char *match_str)
+static int usb_add_match_id(match_id_list_t *matches, int score,
+    const char *match_str)
 {
 	assert(matches);
@@ -88,12 +88,10 @@
 		char *str = NULL; \
 		int __rc = asprintf(&str, format, ##__VA_ARGS__); \
-		if (__rc >= 0) { \
-			errno_t __rc = usb_add_match_id((match_ids), (score), str); \
-			if (__rc != EOK) { \
-				free(str); \
-				return __rc; \
-			} \
-		} else { \
-			return ENOMEM; \
+		if (__rc > 0) { \
+			__rc = usb_add_match_id((match_ids), (score), str); \
+		} \
+		if (__rc != EOK) { \
+			free(str); \
+			return __rc; \
 		} \
 	} while (0)
@@ -108,5 +106,5 @@
  * @retval ENOENT Device class is not "use interface".
  */
-errno_t usb_device_create_match_ids_from_interface(
+int usb_device_create_match_ids_from_interface(
     const usb_standard_device_descriptor_t *desc_device,
     const usb_standard_interface_descriptor_t *desc_interface,
@@ -220,5 +218,5 @@
  * @return Error code.
  */
-errno_t usb_device_create_match_ids_from_device_descriptor(
+int usb_device_create_match_ids_from_device_descriptor(
     const usb_standard_device_descriptor_t *device_descriptor,
     match_id_list_t *matches)
@@ -264,9 +262,9 @@
  * @return Error code.
  */
-errno_t usb_device_create_match_ids(usb_pipe_t *ctrl_pipe,
+int usb_device_create_match_ids(usb_pipe_t *ctrl_pipe,
     match_id_list_t *matches)
 {
 	assert(ctrl_pipe);
-	errno_t rc;
+	int rc;
 	/*
 	 * Retrieve device descriptor and add matches from it.
Index: uspace/lib/usbdev/src/request.c
===================================================================
--- uspace/lib/usbdev/src/request.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbdev/src/request.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -68,5 +68,5 @@
  *
  */
-errno_t usb_control_request_set(usb_pipe_t *pipe,
+int usb_control_request_set(usb_pipe_t *pipe,
     usb_request_type_t request_type, usb_request_recipient_t recipient,
     uint8_t request, uint16_t value, uint16_t index,
@@ -127,5 +127,5 @@
  *
  */
-errno_t usb_control_request_get(usb_pipe_t *pipe,
+int usb_control_request_get(usb_pipe_t *pipe,
     usb_request_type_t request_type, usb_request_recipient_t recipient,
     uint8_t request, uint16_t value, uint16_t index,
@@ -170,5 +170,5 @@
  * @return Error code.
  */
-errno_t usb_request_get_status(usb_pipe_t *pipe,
+int usb_request_get_status(usb_pipe_t *pipe,
     usb_request_recipient_t recipient, uint16_t index,
     uint16_t *status)
@@ -184,5 +184,5 @@
 	uint16_t status_usb_endianess;
 	size_t data_transfered_size;
-	errno_t rc = usb_control_request_get(pipe, USB_REQUEST_TYPE_STANDARD,
+	int rc = usb_control_request_get(pipe, USB_REQUEST_TYPE_STANDARD,
 	    recipient, USB_DEVREQ_GET_STATUS, 0, uint16_host2usb(index),
 	    &status_usb_endianess, 2, &data_transfered_size);
@@ -208,5 +208,5 @@
  * @return Error code.
  */
-errno_t usb_request_clear_feature(usb_pipe_t *pipe,
+int usb_request_clear_feature(usb_pipe_t *pipe,
     usb_request_type_t request_type, usb_request_recipient_t recipient,
     uint16_t feature_selector, uint16_t index)
@@ -232,5 +232,5 @@
  * @return Error code.
  */
-errno_t usb_request_set_feature(usb_pipe_t *pipe,
+int usb_request_set_feature(usb_pipe_t *pipe,
     usb_request_type_t request_type, usb_request_recipient_t recipient,
     uint16_t feature_selector, uint16_t index)
@@ -260,5 +260,5 @@
  * @return Error code.
  */
-errno_t usb_request_get_descriptor(usb_pipe_t *pipe,
+int usb_request_get_descriptor(usb_pipe_t *pipe,
     usb_request_type_t request_type, usb_request_recipient_t recipient,
     uint8_t descriptor_type, uint8_t descriptor_index,
@@ -298,5 +298,5 @@
  * @return
  */
-errno_t usb_request_get_descriptor_alloc(usb_pipe_t * pipe,
+int usb_request_get_descriptor_alloc(usb_pipe_t * pipe,
     usb_request_type_t request_type, usb_request_recipient_t recipient,
     uint8_t descriptor_type, uint8_t descriptor_index,
@@ -308,5 +308,5 @@
 	}
 
-	errno_t rc;
+	int rc;
 
 	/*
@@ -364,5 +364,5 @@
  * @return Error code.
  */
-errno_t usb_request_get_device_descriptor(usb_pipe_t *pipe,
+int usb_request_get_device_descriptor(usb_pipe_t *pipe,
     usb_standard_device_descriptor_t *descriptor)
 {
@@ -373,5 +373,5 @@
 	size_t actually_transferred = 0;
 	usb_standard_device_descriptor_t descriptor_tmp;
-	errno_t rc = usb_request_get_descriptor(pipe,
+	int rc = usb_request_get_descriptor(pipe,
 	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
 	    USB_DESCTYPE_DEVICE, 0, 0, &descriptor_tmp, sizeof(descriptor_tmp),
@@ -404,5 +404,5 @@
  * @return Error code.
  */
-errno_t usb_request_get_bare_configuration_descriptor(usb_pipe_t *pipe,
+int usb_request_get_bare_configuration_descriptor(usb_pipe_t *pipe,
     int index, usb_standard_configuration_descriptor_t *descriptor)
 {
@@ -417,5 +417,5 @@
 	size_t actually_transferred = 0;
 	usb_standard_configuration_descriptor_t descriptor_tmp;
-	const errno_t rc = usb_request_get_descriptor(pipe,
+	const int rc = usb_request_get_descriptor(pipe,
 	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
 	    USB_DESCTYPE_CONFIGURATION, index, 0,
@@ -448,5 +448,5 @@
  * @return Error code.
  */
-errno_t usb_request_get_full_configuration_descriptor(usb_pipe_t *pipe,
+int usb_request_get_full_configuration_descriptor(usb_pipe_t *pipe,
     int index, void *descriptor, size_t descriptor_size, size_t *actual_size)
 {
@@ -473,9 +473,9 @@
  * @return Error code.
  */
-errno_t usb_request_get_full_configuration_descriptor_alloc(
+int usb_request_get_full_configuration_descriptor_alloc(
     usb_pipe_t *pipe, int index,
-    void **descriptor_ptr, size_t *descriptor_size)
-{
-	errno_t rc;
+    const void **descriptor_ptr, size_t *descriptor_size)
+{
+	int rc;
 
 	if (descriptor_ptr == NULL) {
@@ -539,5 +539,5 @@
  * @return Error code.
  */
-errno_t usb_request_set_descriptor(usb_pipe_t *pipe,
+int usb_request_set_descriptor(usb_pipe_t *pipe,
     usb_request_type_t request_type, usb_request_recipient_t recipient,
     uint8_t descriptor_type, uint8_t descriptor_index,
@@ -565,5 +565,5 @@
  * @return Error code.
  */
-errno_t usb_request_get_configuration(usb_pipe_t *pipe,
+int usb_request_get_configuration(usb_pipe_t *pipe,
     uint8_t *configuration_value)
 {
@@ -571,5 +571,5 @@
 	size_t actual_size;
 
-	const errno_t rc = usb_control_request_get(pipe,
+	const int rc = usb_control_request_get(pipe,
 	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
 	    USB_DEVREQ_GET_CONFIGURATION, 0, 0, &value, 1, &actual_size);
@@ -595,5 +595,5 @@
  * @return Error code.
  */
-errno_t usb_request_set_configuration(usb_pipe_t *pipe,
+int usb_request_set_configuration(usb_pipe_t *pipe,
     uint8_t configuration_value)
 {
@@ -614,5 +614,5 @@
  * @return Error code.
  */
-errno_t usb_request_get_interface(usb_pipe_t *pipe,
+int usb_request_get_interface(usb_pipe_t *pipe,
     uint8_t interface_index, uint8_t *alternate_setting)
 {
@@ -620,5 +620,5 @@
 	size_t actual_size;
 
-	const errno_t rc = usb_control_request_get(pipe,
+	const int rc = usb_control_request_get(pipe,
 	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE,
 	    USB_DEVREQ_GET_INTERFACE,
@@ -647,5 +647,5 @@
  * @return Error code.
  */
-errno_t usb_request_set_interface(usb_pipe_t *pipe,
+int usb_request_set_interface(usb_pipe_t *pipe,
     uint8_t interface_index, uint8_t alternate_setting)
 {
@@ -666,5 +666,5 @@
  * @return Error code.
  */
-errno_t usb_request_get_supported_languages(usb_pipe_t *pipe,
+int usb_request_get_supported_languages(usb_pipe_t *pipe,
     l18_win_locales_t **languages_ptr, size_t *languages_count)
 {
@@ -675,5 +675,5 @@
 	uint8_t *string_descriptor = NULL;
 	size_t string_descriptor_size = 0;
-	const errno_t rc = usb_request_get_descriptor_alloc(pipe,
+	const int rc = usb_request_get_descriptor_alloc(pipe,
 	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
 	    USB_DESCTYPE_STRING, 0, 0,
@@ -733,5 +733,5 @@
  * @return Error code.
  */
-errno_t usb_request_get_string(usb_pipe_t *pipe,
+int usb_request_get_string(usb_pipe_t *pipe,
     size_t index, l18_win_locales_t lang, char **string_ptr)
 {
@@ -751,5 +751,5 @@
 	}
 
-	errno_t rc;
+	int rc;
 
 	/* Prepare dynamically allocated variables. */
@@ -824,5 +824,5 @@
  * @return Error code.
  */
-errno_t usb_request_clear_endpoint_halt(usb_pipe_t *pipe, uint16_t ep_index)
+int usb_request_clear_endpoint_halt(usb_pipe_t *pipe, uint16_t ep_index)
 {
 	return usb_request_clear_feature(pipe,
@@ -838,5 +838,5 @@
  * @return Error code.
  */
-errno_t usb_pipe_clear_halt(usb_pipe_t *ctrl_pipe, usb_pipe_t *target_pipe)
+int usb_pipe_clear_halt(usb_pipe_t *ctrl_pipe, usb_pipe_t *target_pipe)
 {
 	if ((ctrl_pipe == NULL) || (target_pipe == NULL)) {
@@ -854,10 +854,10 @@
  * @return Error code.
  */
-errno_t usb_request_get_endpoint_status(usb_pipe_t *ctrl_pipe, usb_pipe_t *pipe,
+int usb_request_get_endpoint_status(usb_pipe_t *ctrl_pipe, usb_pipe_t *pipe,
     uint16_t *status)
 {
 	uint16_t status_tmp;
 	uint16_t pipe_index = (uint16_t) pipe->endpoint_no;
-	errno_t rc = usb_request_get_status(ctrl_pipe,
+	int rc = usb_request_get_status(ctrl_pipe,
 	    USB_REQUEST_RECIPIENT_ENDPOINT, uint16_host2usb(pipe_index),
 	    &status_tmp);
Index: uspace/lib/usbhid/include/usb/hid/hiddescriptor.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/hiddescriptor.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhid/include/usb/hid/hiddescriptor.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #define LIBUSB_HIDDESCRIPTOR_H_
 
-#include <errno.h>
 #include <stdint.h>
 #include <adt/list.h>
@@ -43,35 +42,35 @@
 #include <usb/hid/hidtypes.h>
 
-errno_t usb_hid_parse_report_descriptor(usb_hid_report_t *report,
-    const uint8_t *data, size_t size);
+int usb_hid_parse_report_descriptor(usb_hid_report_t *report,
+		const uint8_t *data, size_t size);
 
 void usb_hid_descriptor_print(usb_hid_report_t *report);
 
-errno_t usb_hid_report_init(usb_hid_report_t *report);
+int usb_hid_report_init(usb_hid_report_t *report);
 
 void usb_hid_report_deinit(usb_hid_report_t *report);
 
-errno_t usb_hid_report_append_fields(usb_hid_report_t *report,
-    usb_hid_report_item_t *report_item);
+int usb_hid_report_append_fields(usb_hid_report_t *report,
+		usb_hid_report_item_t *report_item);
 
-usb_hid_report_description_t *usb_hid_report_find_description(
-    const usb_hid_report_t *report, uint8_t report_id,
-    usb_hid_report_type_t type);
+usb_hid_report_description_t * usb_hid_report_find_description(
+		const usb_hid_report_t *report, uint8_t report_id,
+		usb_hid_report_type_t type);
 
 int usb_hid_report_parse_tag(uint8_t tag, uint8_t class, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path);
+		size_t item_size, usb_hid_report_item_t *report_item,
+		usb_hid_report_path_t *usage_path);
 
-int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path);
+int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data, 
+		size_t item_size, usb_hid_report_item_t *report_item,
+		usb_hid_report_path_t *usage_path);
 
-int usb_hid_report_parse_global_tag(uint8_t tag, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path);
+int usb_hid_report_parse_global_tag(uint8_t tag, const uint8_t *data, 
+		size_t item_size, usb_hid_report_item_t *report_item,
+		usb_hid_report_path_t *usage_path);
 
-int usb_hid_report_parse_local_tag(uint8_t tag, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path);
+int usb_hid_report_parse_local_tag(uint8_t tag, const uint8_t *data, 
+		size_t item_size, usb_hid_report_item_t *report_item,
+		usb_hid_report_path_t *usage_path);
 
 void usb_hid_descriptor_print_list(list_t *list);
@@ -80,10 +79,10 @@
 
 usb_hid_report_item_t *usb_hid_report_item_clone(
-    const usb_hid_report_item_t *item);
+		const usb_hid_report_item_t *item);
 
 uint32_t usb_hid_report_tag_data_uint32(const uint8_t *data, size_t size);
 
-usb_hid_report_path_t *usb_hid_report_path_try_insert(usb_hid_report_t *report,
-    usb_hid_report_path_t *cmp_path);
+usb_hid_report_path_t *usb_hid_report_path_try_insert(usb_hid_report_t*report,
+		usb_hid_report_path_t *cmp_path);
 
 
Index: uspace/lib/usbhid/include/usb/hid/hidparser.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/hidparser.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhid/include/usb/hid/hidparser.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,24 +47,24 @@
  * Input report parser functions
  */
-errno_t usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data,
-    size_t size, uint8_t *report_id);
+int usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data,
+		size_t size, uint8_t *report_id);
 
 /*
  * Output report parser functions
  */
-uint8_t *usb_hid_report_output(usb_hid_report_t *report, size_t *size,
-    uint8_t report_id);
+uint8_t *usb_hid_report_output(usb_hid_report_t *report, size_t *size, 
+		uint8_t report_id);
 
 void usb_hid_report_output_free(uint8_t *output);
 
 size_t usb_hid_report_size(usb_hid_report_t *report, uint8_t report_id,
-    usb_hid_report_type_t type);
+		usb_hid_report_type_t type);
 
 size_t usb_hid_report_byte_size(usb_hid_report_t *report, uint8_t report_id,
-    usb_hid_report_type_t type);
+		usb_hid_report_type_t type);
 
 
-errno_t usb_hid_report_output_translate(usb_hid_report_t *report,
-    uint8_t report_id, uint8_t *buffer, size_t size);
+int usb_hid_report_output_translate(usb_hid_report_t *report, 
+		uint8_t report_id, uint8_t *buffer, size_t size);
 
 
@@ -73,9 +73,9 @@
  */
 usb_hid_report_field_t *usb_hid_report_get_sibling(usb_hid_report_t *report,
-    usb_hid_report_field_t *field, usb_hid_report_path_t *path,
-    int flags, usb_hid_report_type_t type);
+		usb_hid_report_field_t *field, usb_hid_report_path_t *path,
+		int flags, usb_hid_report_type_t type);
 
-uint8_t usb_hid_get_next_report_id(usb_hid_report_t *report,
-    uint8_t report_id, usb_hid_report_type_t type);
+uint8_t usb_hid_get_next_report_id(usb_hid_report_t *report, 
+		uint8_t report_id, usb_hid_report_type_t type);
 
 #endif
Index: uspace/lib/usbhid/include/usb/hid/hidpath.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/hidpath.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhid/include/usb/hid/hidpath.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #define LIBUSB_HIDPATH_H_
 
-#include <errno.h>
 #include <usb/hid/hidparser.h>
 #include <stdint.h>
@@ -83,5 +82,5 @@
 	/** Usage page of report item. Zero when usage page can be changed. */
 	uint32_t usage_page;
-	/** Usage of report item. Zero when usage can be changed. */
+	/** Usage of report item. Zero when usage can be changed. */	
 	uint32_t usage;
 
@@ -118,9 +117,9 @@
 void usb_hid_report_path_free(usb_hid_report_path_t *path);
 
-errno_t usb_hid_report_path_set_report_id(usb_hid_report_path_t *usage_path,
-    uint8_t report_id);
+int usb_hid_report_path_set_report_id(usb_hid_report_path_t *usage_path,
+		uint8_t report_id);
 
-errno_t usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path,
-    int32_t usage_page, int32_t usage);
+int usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path, 
+		int32_t usage_page, int32_t usage);
 
 void usb_hid_report_remove_last_item(usb_hid_report_path_t *usage_path);
@@ -128,12 +127,12 @@
 void usb_hid_report_null_last_item(usb_hid_report_path_t *usage_path);
 
-void usb_hid_report_set_last_item(usb_hid_report_path_t *usage_path,
-    int32_t tag, int32_t data);
+void usb_hid_report_set_last_item(usb_hid_report_path_t *usage_path, 
+		int32_t tag, int32_t data);
 
 int usb_hid_report_compare_usage_path(usb_hid_report_path_t *report_path,
-    usb_hid_report_path_t *path, int flags);
+		usb_hid_report_path_t *path, int flags);
 
 usb_hid_report_path_t *usb_hid_report_path_clone(
-    usb_hid_report_path_t *usage_path);
+		usb_hid_report_path_t *usage_path);
 
 void usb_hid_print_usage_path(usb_hid_report_path_t *path);
Index: uspace/lib/usbhid/include/usb/hid/hidreport.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/hidreport.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhid/include/usb/hid/hidreport.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,5 +58,5 @@
  *         usb_pipe_end_session() or usb_request_get_descriptor().
  */
-errno_t usb_hid_process_report_descriptor(usb_device_t *dev,
+int usb_hid_process_report_descriptor(usb_device_t *dev, 
     usb_hid_report_t *report, uint8_t **report_desc, size_t *report_size);
 
Index: uspace/lib/usbhid/include/usb/hid/request.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/request.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhid/include/usb/hid/request.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,20 +44,20 @@
 
 
-errno_t usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no,
+int usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no,
     usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size);
 
-errno_t usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no,
+int usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no, 
     usb_hid_protocol_t protocol);
 
-errno_t usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration);
+int usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration);
 
-errno_t usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no,
-    usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size,
+int usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no, 
+    usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size, 
     size_t *actual_size);
 
-errno_t usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no,
+int usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no, 
     usb_hid_protocol_t *protocol);
 
-errno_t usbhid_req_get_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t *duration);
+int usbhid_req_get_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t *duration);
 
 
Index: uspace/lib/usbhid/src/hiddescriptor.c
===================================================================
--- uspace/lib/usbhid/src/hiddescriptor.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhid/src/hiddescriptor.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -75,5 +75,4 @@
 #define USB_HID_RESET_OFFSET	3
 
-#define USB_HID_INVALID                 -98
 /** Unknown tag was founded in report descriptor data*/
 #define USB_HID_UNKNOWN_TAG		-99
@@ -104,5 +103,5 @@
 		
 		if(usb_hid_report_compare_usage_path(path, cmp_path,
-					USB_HID_PATH_COMPARE_STRICT) == 0){
+					USB_HID_PATH_COMPARE_STRICT) == EOK){
 			break;
 		}
@@ -134,5 +133,5 @@
  * @retval EOK If report structure was successfully initialized
  */
-errno_t usb_hid_report_init(usb_hid_report_t *report)
+int usb_hid_report_init(usb_hid_report_t *report)
 {
 	if (report == NULL) {
@@ -162,5 +161,5 @@
  *
  */
-errno_t usb_hid_report_append_fields(usb_hid_report_t *report,
+int usb_hid_report_append_fields(usb_hid_report_t *report,
 		usb_hid_report_item_t *report_item) {
 
@@ -356,5 +355,5 @@
  * @retval EOK If report descriptor is successfully parsed
  */
-errno_t usb_hid_parse_report_descriptor(usb_hid_report_t *report, 
+int usb_hid_parse_report_descriptor(usb_hid_report_t *report, 
     const uint8_t *data, size_t size)
 {
@@ -554,5 +553,5 @@
 
 		if((ret=usb_hid_report_parse_main_tag(tag, data, item_size,
-			report_item, usage_path)) == 0) {
+			report_item, usage_path)) == EOK) {
 
 			return USB_HID_NEW_REPORT_ITEM;
@@ -585,5 +584,5 @@
  * @param Length of data buffer
  * @param Current state table
- * @return 0 or USB_HID_ code
+ * @return Error code
  */
 
@@ -600,5 +599,5 @@
 	case USB_HID_REPORT_TAG_FEATURE:
 		report_item->item_flags = *data;			
-		return 0;			
+		return EOK;			
 		break;
 			
@@ -640,5 +639,5 @@
 	}
 
-	return 0;
+	return EOK;
 }
 
@@ -650,5 +649,5 @@
  * @param Length of data buffer
  * @param Current state table
- * @return 0 or USB_HID_ code
+ * @return Error code
  */
 int usb_hid_report_parse_global_tag(uint8_t tag, const uint8_t *data, 
@@ -726,5 +725,5 @@
 	}
 
-	return 0;
+	return EOK;
 }
 
@@ -736,5 +735,5 @@
  * @param Length of data buffer
  * @param Current state table
- * @return 0 or USB_HID_ code
+ * @return Error code
  */
 int usb_hid_report_parse_local_tag(uint8_t tag, const uint8_t *data,
@@ -792,5 +791,5 @@
 			    USB_HID_EXTENDED_USAGE_PAGE(
 			    usb_hid_report_tag_data_uint32(data, item_size))) {
-				return USB_HID_INVALID;
+				return EINVAL;
 			}
 			
@@ -863,5 +862,5 @@
 	}
 	
-	return 0;
+	return EOK;
 }
 
Index: uspace/lib/usbhid/src/hidparser.c
===================================================================
--- uspace/lib/usbhid/src/hidparser.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhid/src/hidparser.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -127,5 +127,5 @@
  * @return Error code.
  */ 
-errno_t usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data, 
+int usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data, 
     size_t size, uint8_t *report_id)
 {
@@ -334,5 +334,5 @@
  * @return Error code
  */
-errno_t usb_hid_report_output_translate(usb_hid_report_t *report, 
+int usb_hid_report_output_translate(usb_hid_report_t *report, 
     uint8_t report_id, uint8_t *buffer, size_t size)
 {
@@ -531,5 +531,5 @@
 
 			if (usb_hid_report_compare_usage_path(
-			    field->collection_path, path, flags) == 0) {
+			    field->collection_path, path, flags) == EOK) {
 				usb_hid_report_remove_last_item(
 				    field->collection_path);
Index: uspace/lib/usbhid/src/hidpath.c
===================================================================
--- uspace/lib/usbhid/src/hidpath.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhid/src/hidpath.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -73,5 +73,5 @@
  * @return Error code
  */
-errno_t usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path, 
+int usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path, 
                                     int32_t usage_page, int32_t usage)
 {	
@@ -191,5 +191,5 @@
  * @param flags       Flags determining the mode of comparison
  *
- * @return 0 if both paths are identical, non zero number otherwise
+ * @return EOK if both paths are identical, non zero number otherwise
  *
  */
@@ -213,5 +213,5 @@
 	// Empty path match all others
 	if (path->depth == 0) {
-		return 0;
+		return EOK;
 	}
 	
@@ -239,7 +239,7 @@
 					if (USB_HID_SAME_USAGE(report_item->usage,
 					    path_item->usage))
-						return 0;
+						return EOK;
 				} else {
-					return 0;
+					return EOK;
 				}
 			}
@@ -285,5 +285,5 @@
 		    ((report_link == &report_path->items.head) &&
 		    (path_link == &path->items.head))) {
-			return 0;
+			return EOK;
 		} else {
 			return 1;
@@ -297,5 +297,5 @@
 		
 		if (list_empty(&path->items)) {
-			return 0;
+			return EOK;
 		}
 		
@@ -320,5 +320,5 @@
 		
 		if (path_link == &path->items.head) {
-			return 0;
+			return EOK;
 		} else {
 			return 1;
@@ -327,5 +327,5 @@
 	
 	default:
-		return -1;
+		return EINVAL;
 	}
 }
@@ -423,5 +423,5 @@
  * @return Error code
  */
-errno_t usb_hid_report_path_set_report_id(usb_hid_report_path_t *path, 
+int usb_hid_report_path_set_report_id(usb_hid_report_path_t *path, 
 	uint8_t report_id)
 {
Index: uspace/lib/usbhid/src/hidreport.c
===================================================================
--- uspace/lib/usbhid/src/hidreport.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhid/src/hidreport.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
 #include <usb/hid/hidreport.h>
 
-static errno_t usb_hid_get_report_descriptor(usb_device_t *dev,
+static int usb_hid_get_report_descriptor(usb_device_t *dev,
     uint8_t **report_desc, size_t *size)
 {
@@ -135,5 +135,5 @@
 	 * Get the descriptor from the device.
 	 */
-	errno_t rc = usb_request_get_descriptor(usb_device_get_default_pipe(dev),
+	int rc = usb_request_get_descriptor(usb_device_get_default_pipe(dev),
 	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE,
 	    USB_DESCTYPE_HID_REPORT, 0, usb_device_get_iface_number(dev),
@@ -163,5 +163,5 @@
 
 
-errno_t usb_hid_process_report_descriptor(usb_device_t *dev, 
+int usb_hid_process_report_descriptor(usb_device_t *dev, 
     usb_hid_report_t *report, uint8_t **report_desc, size_t *report_size)
 {
@@ -175,5 +175,5 @@
 //	size_t report_size;
 	
-	errno_t rc = usb_hid_get_report_descriptor(dev, report_desc, report_size);
+	int rc = usb_hid_get_report_descriptor(dev, report_desc, report_size);
 	
 	if (rc != EOK) {
Index: uspace/lib/usbhid/src/hidreq.c
===================================================================
--- uspace/lib/usbhid/src/hidreq.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhid/src/hidreq.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,5 +58,5 @@
  * @return Other value inherited from function usb_control_request_set().
  */
-errno_t usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no,
+int usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no,
     usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size)
 {
@@ -77,5 +77,5 @@
 	 */
 	
-	errno_t rc;
+	int rc;
 	
 	uint16_t value = 0;
@@ -108,5 +108,5 @@
  * @return Other value inherited from function usb_control_request_set().
  */
-errno_t usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no,
+int usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no,
     usb_hid_protocol_t protocol)
 {
@@ -127,5 +127,5 @@
 	 */
 	
-	errno_t rc;
+	int rc;
 
 	usb_log_debug("Sending Set Protocol request to the device ("
@@ -157,23 +157,23 @@
  * @return Other value inherited from function usb_control_request_set().
  */
-errno_t usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration)
-{
-	if (ctrl_pipe == NULL) {
-		usb_log_warning("usbhid_req_set_report(): no pipe given.\n");
-		return EINVAL;
-	}
-	
-	if (iface_no < 0) {
-		usb_log_warning("usbhid_req_set_report(): no interface given."
-		    "\n");
-		return EINVAL;
-	}
-	
-	/*
-	 * No need for checking other parameters, as they are checked in
-	 * the called function (usb_control_request_set()).
-	 */
-	
-	errno_t rc;
+int usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration)
+{
+	if (ctrl_pipe == NULL) {
+		usb_log_warning("usbhid_req_set_report(): no pipe given.\n");
+		return EINVAL;
+	}
+	
+	if (iface_no < 0) {
+		usb_log_warning("usbhid_req_set_report(): no interface given."
+		    "\n");
+		return EINVAL;
+	}
+	
+	/*
+	 * No need for checking other parameters, as they are checked in
+	 * the called function (usb_control_request_set()).
+	 */
+	
+	int rc;
 
 	usb_log_debug("Sending Set Idle request to the device ("
@@ -210,5 +210,5 @@
  * @return Other value inherited from function usb_control_request_set().
  */
-errno_t usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no, 
+int usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no, 
     usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size, 
     size_t *actual_size)
@@ -230,5 +230,5 @@
 	 */
 	
-	errno_t rc;
+	int rc;
 
 	uint16_t value = 0;
@@ -262,5 +262,5 @@
  * @return Other value inherited from function usb_control_request_set().
  */
-errno_t usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no, 
+int usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no, 
     usb_hid_protocol_t *protocol)
 {
@@ -281,5 +281,5 @@
 	 */
 	
-	errno_t rc;	
+	int rc;	
 
 	usb_log_debug("Sending Get Protocol request to the device ("
@@ -324,23 +324,23 @@
  *         usb_control_request_set().
  */
-errno_t usbhid_req_get_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t *duration)
-{
-	if (ctrl_pipe == NULL) {
-		usb_log_warning("usbhid_req_set_report(): no pipe given.\n");
-		return EINVAL;
-	}
-	
-	if (iface_no < 0) {
-		usb_log_warning("usbhid_req_set_report(): no interface given."
-		    "\n");
-		return EINVAL;
-	}
-	
-	/*
-	 * No need for checking other parameters, as they are checked in
-	 * the called function (usb_control_request_set()).
-	 */
-	
-	errno_t rc;
+int usbhid_req_get_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t *duration)
+{
+	if (ctrl_pipe == NULL) {
+		usb_log_warning("usbhid_req_set_report(): no pipe given.\n");
+		return EINVAL;
+	}
+	
+	if (iface_no < 0) {
+		usb_log_warning("usbhid_req_set_report(): no interface given."
+		    "\n");
+		return EINVAL;
+	}
+	
+	/*
+	 * No need for checking other parameters, as they are checked in
+	 * the called function (usb_control_request_set()).
+	 */
+	
+	int rc;
 
 	usb_log_debug("Sending Get Idle request to the device ("
Index: uspace/lib/usbhost/include/usb/host/ddf_helpers.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/ddf_helpers.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhost/include/usb/host/ddf_helpers.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,8 +45,8 @@
 #include <device/hw_res_parsed.h>
 
-typedef errno_t (*driver_init_t)(hcd_t *, const hw_res_list_parsed_t *, bool);
+typedef int (*driver_init_t)(hcd_t *, const hw_res_list_parsed_t *, bool);
 typedef void (*driver_fini_t)(hcd_t *);
-typedef errno_t (*claim_t)(ddf_dev_t *);
-typedef errno_t (*irq_code_gen_t)(irq_code_t *, const hw_res_list_parsed_t *, int *);
+typedef int (*claim_t)(ddf_dev_t *);
+typedef int (*irq_code_gen_t)(irq_code_t *, const hw_res_list_parsed_t *);
 
 typedef struct {
@@ -61,20 +61,19 @@
 } ddf_hc_driver_t;
 
-errno_t hcd_ddf_add_hc(ddf_dev_t *device, const ddf_hc_driver_t *driver);
+int hcd_ddf_add_hc(ddf_dev_t *device, const ddf_hc_driver_t *driver);
 
-errno_t hcd_ddf_setup_hc(ddf_dev_t *device, usb_speed_t max_speed,
+int hcd_ddf_setup_hc(ddf_dev_t *device, usb_speed_t max_speed,
     size_t bw, bw_count_func_t bw_count);
 void hcd_ddf_clean_hc(ddf_dev_t *device);
-errno_t hcd_ddf_setup_root_hub(ddf_dev_t *device);
+int hcd_ddf_setup_root_hub(ddf_dev_t *device);
 
 hcd_t *dev_to_hcd(ddf_dev_t *dev);
 
-errno_t hcd_ddf_enable_interrupt(ddf_dev_t *device, int);
-errno_t hcd_ddf_get_registers(ddf_dev_t *device, hw_res_list_parsed_t *hw_res);
-errno_t hcd_ddf_setup_interrupts(ddf_dev_t *device,
+int hcd_ddf_enable_interrupt(ddf_dev_t *device, int);
+int hcd_ddf_get_registers(ddf_dev_t *device, hw_res_list_parsed_t *hw_res);
+int hcd_ddf_setup_interrupts(ddf_dev_t *device,
     const hw_res_list_parsed_t *hw_res,
     interrupt_handler_t handler,
-    errno_t (*gen_irq_code)(irq_code_t *, const hw_res_list_parsed_t *, int *),
-    cap_handle_t *handle);
+    int (*gen_irq_code)(irq_code_t *, const hw_res_list_parsed_t *));
 void ddf_hcd_gen_irq_handler(ipc_call_t *call, ddf_dev_t *dev);
 
Index: uspace/lib/usbhost/include/usb/host/hcd.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/hcd.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhost/include/usb/host/hcd.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,9 +49,9 @@
 typedef struct hcd hcd_t;
 
-typedef errno_t (*schedule_hook_t)(hcd_t *, usb_transfer_batch_t *);
-typedef errno_t (*ep_add_hook_t)(hcd_t *, endpoint_t *);
+typedef int (*schedule_hook_t)(hcd_t *, usb_transfer_batch_t *);
+typedef int (*ep_add_hook_t)(hcd_t *, endpoint_t *);
 typedef void (*ep_remove_hook_t)(hcd_t *, endpoint_t *);
 typedef void (*interrupt_hook_t)(hcd_t *, uint32_t);
-typedef errno_t (*status_hook_t)(hcd_t *, uint32_t *);
+typedef int (*status_hook_t)(hcd_t *, uint32_t *);
 
 typedef struct {
@@ -102,27 +102,27 @@
 }
 
-extern errno_t hcd_request_address(hcd_t *, usb_speed_t, usb_address_t *);
+extern usb_address_t hcd_request_address(hcd_t *, usb_speed_t);
 
-extern errno_t hcd_release_address(hcd_t *, usb_address_t);
+extern int hcd_release_address(hcd_t *, usb_address_t);
 
-extern errno_t hcd_reserve_default_address(hcd_t *, usb_speed_t);
+extern int hcd_reserve_default_address(hcd_t *, usb_speed_t);
 
-static inline errno_t hcd_release_default_address(hcd_t *hcd)
+static inline int hcd_release_default_address(hcd_t *hcd)
 {
 	return hcd_release_address(hcd, USB_ADDRESS_DEFAULT);
 }
 
-extern errno_t hcd_add_ep(hcd_t *, usb_target_t, usb_direction_t,
+extern int hcd_add_ep(hcd_t *, usb_target_t, usb_direction_t,
     usb_transfer_type_t, size_t, unsigned int, size_t, usb_address_t,
     unsigned int);
 
-extern errno_t hcd_remove_ep(hcd_t *, usb_target_t, usb_direction_t);
+extern int hcd_remove_ep(hcd_t *, usb_target_t, usb_direction_t);
 
-extern errno_t hcd_send_batch(hcd_t *, usb_target_t, usb_direction_t, void *,
+extern int hcd_send_batch(hcd_t *, usb_target_t, usb_direction_t, void *,
     size_t, uint64_t, usbhc_iface_transfer_in_callback_t,
     usbhc_iface_transfer_out_callback_t, void *, const char *);
 
-extern errno_t hcd_send_batch_sync(hcd_t *, usb_target_t, usb_direction_t,
-    void *, size_t, uint64_t, const char *, size_t *);
+extern ssize_t hcd_send_batch_sync(hcd_t *, usb_target_t, usb_direction_t,
+    void *, size_t, uint64_t, const char *);
 
 #endif
Index: uspace/lib/usbhost/include/usb/host/usb_bus.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/usb_bus.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhost/include/usb/host/usb_bus.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,5 +58,5 @@
 typedef size_t (*bw_count_func_t)(usb_speed_t, usb_transfer_type_t, size_t, size_t);
 typedef void (*ep_remove_callback_t)(endpoint_t *, void *);
-typedef errno_t (*ep_add_callback_t)(endpoint_t *, void *);
+typedef int (*ep_add_callback_t)(endpoint_t *, void *);
 
 /** Endpoint management structure */
@@ -85,15 +85,15 @@
     size_t size, size_t max_packet_size);
 
-errno_t usb_bus_init(usb_bus_t *instance,
+int usb_bus_init(usb_bus_t *instance,
     size_t available_bandwidth, bw_count_func_t bw_count, usb_speed_t max_speed);
 
-errno_t usb_bus_register_ep(usb_bus_t *instance, endpoint_t *ep, size_t data_size);
+int usb_bus_register_ep(usb_bus_t *instance, endpoint_t *ep, size_t data_size);
 
-errno_t usb_bus_unregister_ep(usb_bus_t *instance, endpoint_t *ep);
+int usb_bus_unregister_ep(usb_bus_t *instance, endpoint_t *ep);
 
-endpoint_t *usb_bus_find_ep(usb_bus_t *instance,
+endpoint_t * usb_bus_find_ep(usb_bus_t *instance,
     usb_address_t address, usb_endpoint_t ep, usb_direction_t direction);
 
-errno_t usb_bus_add_ep(usb_bus_t *instance,
+int usb_bus_add_ep(usb_bus_t *instance,
     usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
     usb_transfer_type_t type, size_t max_packet_size, unsigned packets,
@@ -101,17 +101,17 @@
     usb_address_t tt_address, unsigned tt_port);
 
-errno_t usb_bus_remove_ep(usb_bus_t *instance,
+int usb_bus_remove_ep(usb_bus_t *instance,
     usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
     ep_remove_callback_t callback, void *arg);
 
-errno_t usb_bus_reset_toggle(usb_bus_t *instance, usb_target_t target, bool all);
+int usb_bus_reset_toggle(usb_bus_t *instance, usb_target_t target, bool all);
 
-errno_t usb_bus_remove_address(usb_bus_t *instance,
+int usb_bus_remove_address(usb_bus_t *instance,
     usb_address_t address, ep_remove_callback_t callback, void *arg);
 
-errno_t usb_bus_request_address(usb_bus_t *instance,
+int usb_bus_request_address(usb_bus_t *instance,
     usb_address_t *address, bool strict, usb_speed_t speed);
 
-errno_t usb_bus_get_speed(usb_bus_t *instance,
+int usb_bus_get_speed(usb_bus_t *instance,
     usb_address_t address, usb_speed_t *speed);
 #endif
Index: uspace/lib/usbhost/include/usb/host/usb_transfer_batch.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/usb_transfer_batch.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhost/include/usb/host/usb_transfer_batch.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -79,5 +79,5 @@
 	 * with the exception of usb_transfer_batch_finish. For external use.
 	 */
-	errno_t error;
+	int error;
 } usb_transfer_batch_t;
 
@@ -105,8 +105,8 @@
     void *arg
 );
-void usb_transfer_batch_destroy(usb_transfer_batch_t *instance);
+void usb_transfer_batch_destroy(const usb_transfer_batch_t *instance);
 
 void usb_transfer_batch_finish_error(const usb_transfer_batch_t *instance,
-    const void* data, size_t size, errno_t error);
+    const void* data, size_t size, int error);
 
 /** Finish batch using stored error value and transferred size.
Index: uspace/lib/usbhost/include/usb/host/utils/malloc32.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/utils/malloc32.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhost/include/usb/host/utils/malloc32.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,5 +59,5 @@
 {
 	uintptr_t result;
-	errno_t ret = as_get_physical_mapping(addr, &result);
+	int ret = as_get_physical_mapping(addr, &result);
 	
 	if (ret != EOK)
@@ -78,5 +78,5 @@
 	size_t real_size = ALIGN_UP(size, PAGE_SIZE);
 
-	const errno_t ret = dmamem_map_anonymous(real_size,
+	const int ret = dmamem_map_anonymous(real_size,
 	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
 	    &address);
Index: uspace/lib/usbhost/src/ddf_helpers.c
===================================================================
--- uspace/lib/usbhost/src/ddf_helpers.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhost/src/ddf_helpers.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -91,6 +91,6 @@
 
 
-static errno_t hcd_ddf_new_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port);
-static errno_t hcd_ddf_remove_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port);
+static int hcd_ddf_new_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port);
+static int hcd_ddf_remove_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port);
 
 
@@ -107,5 +107,5 @@
  * @return Error code.
  */
-static errno_t register_endpoint(
+static int register_endpoint(
     ddf_fun_t *fun, usb_endpoint_t endpoint,
     usb_transfer_type_t transfer_type, usb_direction_t direction,
@@ -136,5 +136,5 @@
  * @return Error code.
  */
-static errno_t unregister_endpoint(
+static int unregister_endpoint(
     ddf_fun_t *fun, usb_endpoint_t endpoint, usb_direction_t direction)
 {
@@ -151,5 +151,5 @@
 }
 
-static errno_t reserve_default_address(ddf_fun_t *fun, usb_speed_t speed)
+static int reserve_default_address(ddf_fun_t *fun, usb_speed_t speed)
 {
 	assert(fun);
@@ -164,5 +164,5 @@
 }
 
-static errno_t release_default_address(ddf_fun_t *fun)
+static int release_default_address(ddf_fun_t *fun)
 {
 	assert(fun);
@@ -176,5 +176,5 @@
 }
 
-static errno_t device_enumerate(ddf_fun_t *fun, unsigned port)
+static int device_enumerate(ddf_fun_t *fun, unsigned port)
 {
 	assert(fun);
@@ -188,5 +188,5 @@
 }
 
-static errno_t device_remove(ddf_fun_t *fun, unsigned port)
+static int device_remove(ddf_fun_t *fun, unsigned port)
 {
 	assert(fun);
@@ -206,5 +206,5 @@
  * @return Error code.
  */
-static errno_t get_my_device_handle(ddf_fun_t *fun, devman_handle_t *handle)
+static int get_my_device_handle(ddf_fun_t *fun, devman_handle_t *handle)
 {
 	assert(fun);
@@ -224,5 +224,5 @@
  * @return Error code.
  */
-static errno_t dev_read(ddf_fun_t *fun, usb_endpoint_t endpoint,
+static int dev_read(ddf_fun_t *fun, usb_endpoint_t endpoint,
     uint64_t setup_data, uint8_t *data, size_t size,
     usbhc_iface_transfer_in_callback_t callback, void *arg)
@@ -250,5 +250,5 @@
  * @return Error code.
  */
-static errno_t dev_write(ddf_fun_t *fun, usb_endpoint_t endpoint,
+static int dev_write(ddf_fun_t *fun, usb_endpoint_t endpoint,
     uint64_t setup_data, const uint8_t *data, size_t size,
     usbhc_iface_transfer_out_callback_t callback, void *arg)
@@ -313,5 +313,5 @@
 };
 
-static errno_t hcd_ddf_add_device(ddf_dev_t *parent, usb_dev_t *hub_dev,
+static int hcd_ddf_add_device(ddf_dev_t *parent, usb_dev_t *hub_dev,
     unsigned port, usb_address_t address, usb_speed_t speed, const char *name,
     const match_id_list_t *mids)
@@ -351,5 +351,5 @@
 	}
 
-	errno_t ret = ddf_fun_bind(fun);
+	int ret = ddf_fun_bind(fun);
 	if (ret != EOK) {
 		ddf_fun_destroy(fun);
@@ -389,5 +389,5 @@
 
 /* This is a copy of lib/usbdev/src/recognise.c */
-static errno_t create_match_ids(match_id_list_t *l,
+static int create_match_ids(match_id_list_t *l,
     usb_standard_device_descriptor_t *d)
 {
@@ -418,5 +418,5 @@
 }
 
-static errno_t hcd_ddf_remove_device(ddf_dev_t *device, usb_dev_t *hub,
+static int hcd_ddf_remove_device(ddf_dev_t *device, usb_dev_t *hub,
     unsigned port)
 {
@@ -443,5 +443,5 @@
 		list_remove(&victim->link);
 		fibril_mutex_unlock(&hub->guard);
-		const errno_t ret = ddf_fun_unbind(victim->fun);
+		const int ret = ddf_fun_unbind(victim->fun);
 		if (ret == EOK) {
 			usb_address_t address = victim->address;
@@ -458,5 +458,5 @@
 }
 
-static errno_t hcd_ddf_new_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port)
+static int hcd_ddf_new_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port)
 {
 	assert(device);
@@ -468,5 +468,5 @@
 
 	/* This checks whether the default address is reserved and gets speed */
-	errno_t ret = usb_bus_get_speed(&hcd->bus, USB_ADDRESS_DEFAULT, &speed);
+	int ret = usb_bus_get_speed(&hcd->bus, USB_ADDRESS_DEFAULT, &speed);
 	if (ret != EOK) {
 		usb_log_error("Failed to verify speed: %s.", str_error(ret));
@@ -481,10 +481,9 @@
 	}};
 
-	usb_address_t address;
-	ret = hcd_request_address(hcd, speed, &address);
-	if (ret != EOK) {
+	const usb_address_t address = hcd_request_address(hcd, speed);
+	if (address < 0) {
 		usb_log_error("Failed to reserve new address: %s.",
-		    str_error(ret));
-		return ret;
+		    str_error(address));
+		return address;
 	}
 
@@ -519,14 +518,10 @@
 	usb_log_debug("Device(%d): Requesting first 8B of device descriptor.",
 	    address);
-	size_t got;
-	ret = hcd_send_batch_sync(hcd, default_target, USB_DIRECTION_IN,
+	ssize_t got = hcd_send_batch_sync(hcd, default_target, USB_DIRECTION_IN,
 	    &desc, CTRL_PIPE_MIN_PACKET_SIZE, *(uint64_t *)&get_device_desc_8,
-	    "read first 8 bytes of dev descriptor", &got);
-
-	if (ret == EOK && got != CTRL_PIPE_MIN_PACKET_SIZE) {
-		ret = EOVERFLOW;
-	}
-
-	if (ret != EOK) {
+	    "read first 8 bytes of dev descriptor");
+
+	if (got != CTRL_PIPE_MIN_PACKET_SIZE) {
+		ret = got < 0 ? got : EOVERFLOW;
 		usb_log_error("Device(%d): Failed to get 8B of dev descr: %s.",
 		    address, str_error(ret));
@@ -557,16 +552,16 @@
 
 	usb_log_debug("Device(%d): Setting USB address.", address);
-	ret = hcd_send_batch_sync(hcd, default_target, USB_DIRECTION_OUT,
-	    NULL, 0, *(uint64_t *)&set_address, "set address", &got);
+	got = hcd_send_batch_sync(hcd, default_target, USB_DIRECTION_OUT,
+	    NULL, 0, *(uint64_t *)&set_address, "set address");
 
 	usb_log_debug("Device(%d): Removing default (0:0) EP.", address);
 	hcd_remove_ep(hcd, default_target, USB_DIRECTION_BOTH);
 
-	if (ret != EOK) {
+	if (got != 0) {
 		usb_log_error("Device(%d): Failed to set new address: %s.",
-		    address, str_error(ret));
+		    address, str_error(got));
 		hcd_remove_ep(hcd, target, USB_DIRECTION_BOTH);
 		hcd_release_address(hcd, address);
-		return ret;
+		return got;
 	}
 
@@ -577,7 +572,7 @@
 	usb_log_debug("Device(%d): Requesting full device descriptor.",
 	    address);
-	ret = hcd_send_batch_sync(hcd, target, USB_DIRECTION_IN,
+	got = hcd_send_batch_sync(hcd, target, USB_DIRECTION_IN,
 	    &desc, sizeof(desc), *(uint64_t *)&get_device_desc,
-	    "read device descriptor", &got);
+	    "read device descriptor");
 	if (ret != EOK) {
 		usb_log_error("Device(%d): Failed to set get dev descriptor: %s",
@@ -621,5 +616,5 @@
  * @return Error code
  */
-errno_t hcd_ddf_setup_root_hub(ddf_dev_t *device)
+int hcd_ddf_setup_root_hub(ddf_dev_t *device)
 {
 	assert(device);
@@ -628,5 +623,5 @@
 
 	hcd_reserve_default_address(hcd, hcd->bus.max_speed);
-	const errno_t ret = hcd_ddf_new_device(device, NULL, 0);
+	const int ret = hcd_ddf_new_device(device, NULL, 0);
 	hcd_release_default_address(hcd);
 	return ret;
@@ -643,5 +638,5 @@
  * This function does all the ddf work for hc driver.
  */
-errno_t hcd_ddf_setup_hc(ddf_dev_t *device, usb_speed_t max_speed,
+int hcd_ddf_setup_hc(ddf_dev_t *device, usb_speed_t max_speed,
     size_t bw, bw_count_func_t bw_count)
 {
@@ -656,5 +651,5 @@
 	hcd_init(&instance->hcd, max_speed, bw, bw_count);
 
-	errno_t ret = ENOMEM;
+	int ret = ENOMEM;
 	instance->ctl_fun = ddf_fun_create(device, fun_exposed, "ctl");
 	if (!instance->ctl_fun) {
@@ -691,5 +686,5 @@
 	hc_dev_t *hc = dev_to_hc_dev(device);
 	assert(hc);
-	const errno_t ret = ddf_fun_unbind(hc->ctl_fun);
+	const int ret = ddf_fun_unbind(hc->ctl_fun);
 	if (ret == EOK)
 		ddf_fun_destroy(hc->ctl_fun);
@@ -703,5 +698,5 @@
  * @return Error code.
  */
-errno_t hcd_ddf_enable_interrupt(ddf_dev_t *device, int inum)
+int hcd_ddf_enable_interrupt(ddf_dev_t *device, int inum)
 {
 	async_sess_t *parent_sess = ddf_dev_parent_sess_get(device);
@@ -713,5 +708,5 @@
 
 //TODO: Cache parent session in HCD
-errno_t hcd_ddf_get_registers(ddf_dev_t *device, hw_res_list_parsed_t *hw_res)
+int hcd_ddf_get_registers(ddf_dev_t *device, hw_res_list_parsed_t *hw_res)
 {
 	async_sess_t *parent_sess = ddf_dev_parent_sess_get(device);
@@ -720,5 +715,5 @@
 
 	hw_res_list_parsed_init(hw_res);
-	const errno_t ret = hw_res_get_list_parsed(parent_sess, hw_res, 0);
+	const int ret = hw_res_get_list_parsed(parent_sess, hw_res, 0);
 	if (ret != EOK)
 		hw_res_list_parsed_clean(hw_res);
@@ -747,13 +742,11 @@
  * @param[in] gen_irq_code IRQ code generator.
  *
- * @param[out] handle  IRQ capability handle on success.
- *
- * @return Error code.
- */
-errno_t hcd_ddf_setup_interrupts(ddf_dev_t *device,
+ * @return IRQ capability handle on success.
+ * @return Negative error code.
+ */
+int hcd_ddf_setup_interrupts(ddf_dev_t *device,
     const hw_res_list_parsed_t *hw_res,
     interrupt_handler_t handler,
-    errno_t (*gen_irq_code)(irq_code_t *, const hw_res_list_parsed_t *, int *),
-    cap_handle_t *handle)
+    int (*gen_irq_code)(irq_code_t *, const hw_res_list_parsed_t *hw_res))
 {
 
@@ -764,30 +757,30 @@
 	irq_code_t irq_code = {0};
 
-	int irq;
-	errno_t ret = gen_irq_code(&irq_code, hw_res, &irq);
-	if (ret != EOK) {
+	const int irq = gen_irq_code(&irq_code, hw_res);
+	if (irq < 0) {
 		usb_log_error("Failed to generate IRQ code: %s.\n",
-		    str_error(ret));
-		return ret;
+		    str_error(irq));
+		return irq;
 	}
 
 	/* Register handler to avoid interrupt lockup */
-	ret = register_interrupt_handler(device, irq, handler,
-	    &irq_code, handle);
+	const int irq_cap = register_interrupt_handler(device, irq, handler,
+	    &irq_code);
 	irq_code_clean(&irq_code);
+	if (irq_cap < 0) {
+		usb_log_error("Failed to register interrupt handler: %s.\n",
+		    str_error(irq_cap));
+		return irq_cap;
+	}
+
+	/* Enable interrupts */
+	int ret = hcd_ddf_enable_interrupt(device, irq);
 	if (ret != EOK) {
 		usb_log_error("Failed to register interrupt handler: %s.\n",
 		    str_error(ret));
-		return ret;
-	}
-
-	/* Enable interrupts */
-	ret = hcd_ddf_enable_interrupt(device, irq);
-	if (ret != EOK) {
-		usb_log_error("Failed to register interrupt handler: %s.\n",
-		    str_error(ret));
-		unregister_interrupt_handler(device, *handle);
-	}
-	return ret;
+		unregister_interrupt_handler(device, irq_cap);
+		return ret;
+	}
+	return irq_cap;
 }
 
@@ -809,5 +802,5 @@
 }
 
-static errno_t interrupt_polling(void *arg)
+static int interrupt_polling(void *arg)
 {
 	hcd_t *hcd = arg;
@@ -847,5 +840,5 @@
  *  - registers root hub
  */
-errno_t hcd_ddf_add_hc(ddf_dev_t *device, const ddf_hc_driver_t *driver)
+int hcd_ddf_add_hc(ddf_dev_t *device, const ddf_hc_driver_t *driver)
 {
 	assert(driver);
@@ -857,5 +850,5 @@
 	};
 
-	errno_t ret = EOK;
+	int ret = EOK;
 	const usb_speed_t speed = driver->hc_speed;
 	if (speed >= ARRAY_SIZE(bw) || bw[speed].bw == 0) {
@@ -883,19 +876,17 @@
 	interrupt_handler_t *irq_handler =
 	    driver->irq_handler ? driver->irq_handler : ddf_hcd_gen_irq_handler;
-	int irq_cap;
-	errno_t irq_ret = hcd_ddf_setup_interrupts(device, &hw_res,
-	    irq_handler, driver->irq_code_gen, &irq_cap);
-	bool irqs_enabled = (irq_ret == EOK);
+	const int irq_cap = hcd_ddf_setup_interrupts(device, &hw_res,
+	    irq_handler, driver->irq_code_gen);
+	bool irqs_enabled = !(irq_cap < 0);
 	if (irqs_enabled) {
 		usb_log_debug("Hw interrupts enabled.\n");
 	}
 
-	if (driver->claim) {
+	if (driver->claim)
 		ret = driver->claim(device);
-		if (ret != EOK) {
-			usb_log_error("Failed to claim `%s' for driver `%s'",
-			    ddf_dev_get_name(device), driver->name);
-			return ret;
-		}
+	if (ret != EOK) {
+		usb_log_error("Failed to claim `%s' for driver `%s'",
+		    ddf_dev_get_name(device), driver->name);
+		return ret;
 	}
 
@@ -920,5 +911,5 @@
 		fibril_add_ready(hcd->polling_fibril);
 		usb_log_warning("Failed to enable interrupts: %s."
-		    " Falling back to polling.\n", str_error(irq_ret));
+		    " Falling back to polling.\n", str_error(irq_cap));
 	}
 
Index: uspace/lib/usbhost/src/hcd.c
===================================================================
--- uspace/lib/usbhost/src/hcd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhost/src/hcd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
  * @return Error code.
  */
-static errno_t register_helper(endpoint_t *ep, void *arg)
+static int register_helper(endpoint_t *ep, void *arg)
 {
 	hcd_t *hcd = arg;
@@ -102,11 +102,16 @@
 }
 
-errno_t hcd_request_address(hcd_t *hcd, usb_speed_t speed, usb_address_t *address)
-{
-	assert(hcd);
-	return usb_bus_request_address(&hcd->bus, address, false, speed);
-}
-
-errno_t hcd_release_address(hcd_t *hcd, usb_address_t address)
+usb_address_t hcd_request_address(hcd_t *hcd, usb_speed_t speed)
+{
+	assert(hcd);
+	usb_address_t address = 0;
+	const int ret = usb_bus_request_address(
+	    &hcd->bus, &address, false, speed);
+	if (ret != EOK)
+		return ret;
+	return address;
+}
+
+int hcd_release_address(hcd_t *hcd, usb_address_t address)
 {
 	assert(hcd);
@@ -115,5 +120,5 @@
 }
 
-errno_t hcd_reserve_default_address(hcd_t *hcd, usb_speed_t speed)
+int hcd_reserve_default_address(hcd_t *hcd, usb_speed_t speed)
 {
 	assert(hcd);
@@ -122,5 +127,5 @@
 }
 
-errno_t hcd_add_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir,
+int hcd_add_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir,
     usb_transfer_type_t type, size_t max_packet_size, unsigned packets,
     size_t size, usb_address_t tt_address, unsigned tt_port)
@@ -132,5 +137,5 @@
 }
 
-errno_t hcd_remove_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir)
+int hcd_remove_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir)
 {
 	assert(hcd);
@@ -147,5 +152,5 @@
 } toggle_t;
 
-static void toggle_reset_callback(errno_t retval, void *arg)
+static void toggle_reset_callback(int retval, void *arg)
 {
 	assert(arg);
@@ -172,5 +177,5 @@
  * @return Error code.
  */
-errno_t hcd_send_batch(
+int hcd_send_batch(
     hcd_t *hcd, usb_target_t target, usb_direction_t direction,
     void *data, size_t size, uint64_t setup_data,
@@ -232,5 +237,5 @@
 	}
 
-	const errno_t ret = hcd->ops.schedule(hcd, batch);
+	const int ret = hcd->ops.schedule(hcd, batch);
 	if (ret != EOK)
 		usb_transfer_batch_destroy(batch);
@@ -244,9 +249,9 @@
 typedef struct {
 	volatile unsigned done;
-	errno_t ret;
+	int ret;
 	size_t size;
 } sync_data_t;
 
-static void transfer_in_cb(errno_t ret, size_t size, void* data)
+static void transfer_in_cb(int ret, size_t size, void* data)
 {
 	sync_data_t *d = data;
@@ -257,5 +262,5 @@
 }
 
-static void transfer_out_cb(errno_t ret, void* data)
+static void transfer_out_cb(int ret, void* data)
 {
 	sync_data_t *d = data;
@@ -266,12 +271,12 @@
 
 /** this is really ugly version of sync usb communication */
-errno_t hcd_send_batch_sync(
+ssize_t hcd_send_batch_sync(
     hcd_t *hcd, usb_target_t target, usb_direction_t dir,
-    void *data, size_t size, uint64_t setup_data, const char* name, size_t *out_size)
+    void *data, size_t size, uint64_t setup_data, const char* name)
 {
 	assert(hcd);
 	sync_data_t sd = { .done = 0, .ret = EBUSY, .size = size };
 
-	const errno_t ret = hcd_send_batch(hcd, target, dir, data, size, setup_data,
+	const int ret = hcd_send_batch(hcd, target, dir, data, size, setup_data,
 	    dir == USB_DIRECTION_IN ? transfer_in_cb : NULL,
 	    dir == USB_DIRECTION_OUT ? transfer_out_cb : NULL, &sd, name);
@@ -284,5 +289,5 @@
 
 	if (sd.ret == EOK)
-		*out_size = sd.size;
+		return sd.size;
 	return sd.ret;
 }
Index: uspace/lib/usbhost/src/usb_bus.c
===================================================================
--- uspace/lib/usbhost/src/usb_bus.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhost/src/usb_bus.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -102,8 +102,7 @@
  *
  * @param[in] instance Device manager structure to use.
- * @param[out] address Free address.
- * @return Error code.
- */
-static errno_t usb_bus_get_free_address(usb_bus_t *instance, usb_address_t *address)
+ * @return Free address, or error code.
+ */
+static usb_address_t usb_bus_get_free_address(usb_bus_t *instance)
 {
 
@@ -120,6 +119,5 @@
 	instance->last_address = new_address;
 
-	*address = new_address;
-	return EOK;
+	return new_address;
 }
 
@@ -200,5 +198,5 @@
  * @return Error code.
  */
-errno_t usb_bus_init(usb_bus_t *instance,
+int usb_bus_init(usb_bus_t *instance,
     size_t available_bandwidth, bw_count_func_t bw_count, usb_speed_t max_speed)
 {
@@ -224,5 +222,5 @@
  * @return Error code.
  */
-errno_t usb_bus_register_ep(usb_bus_t *instance, endpoint_t *ep, size_t data_size)
+int usb_bus_register_ep(usb_bus_t *instance, endpoint_t *ep, size_t data_size)
 {
 	assert(instance);
@@ -262,5 +260,5 @@
  * @return Error code.
  */
-errno_t usb_bus_unregister_ep(usb_bus_t *instance, endpoint_t *ep)
+int usb_bus_unregister_ep(usb_bus_t *instance, endpoint_t *ep)
 {
 	assert(instance);
@@ -316,5 +314,5 @@
  * @return Error code.
  */
-errno_t usb_bus_add_ep(usb_bus_t *instance,
+int usb_bus_add_ep(usb_bus_t *instance,
     usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
     usb_transfer_type_t type, size_t max_packet_size, unsigned packets,
@@ -364,5 +362,5 @@
 
 	if (callback) {
-		const errno_t ret = callback(ep, arg);
+		const int ret = callback(ep, arg);
 		if (ret != EOK) {
 			fibril_mutex_unlock(&instance->guard);
@@ -394,5 +392,5 @@
  * @return Error code.
  */
-errno_t usb_bus_remove_ep(usb_bus_t *instance,
+int usb_bus_remove_ep(usb_bus_t *instance,
     usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
     ep_remove_callback_t callback, void *arg)
@@ -417,5 +415,5 @@
 }
 
-errno_t usb_bus_reset_toggle(usb_bus_t *instance, usb_target_t target, bool all)
+int usb_bus_reset_toggle(usb_bus_t *instance, usb_target_t target, bool all)
 {
 	assert(instance);
@@ -423,5 +421,5 @@
 		return EINVAL;
 
-	errno_t ret = ENOENT;
+	int ret = ENOENT;
 
 	fibril_mutex_lock(&instance->guard);
@@ -446,5 +444,5 @@
  * @return Error code.
  */
-errno_t usb_bus_remove_address(usb_bus_t *instance,
+int usb_bus_remove_address(usb_bus_t *instance,
     usb_address_t address, ep_remove_callback_t callback, void *arg)
 {
@@ -455,5 +453,5 @@
 	fibril_mutex_lock(&instance->guard);
 
-	const errno_t ret = instance->devices[address].occupied ? EOK : ENOENT;
+	const int ret = instance->devices[address].occupied ? EOK : ENOENT;
 	instance->devices[address].occupied = false;
 
@@ -476,10 +474,10 @@
 /** Request USB address.
  * @param instance usb_device_manager
- * @param[inout] address Pointer to requested address value, place to store new address
+ * @param address Pointer to requested address value, place to store new address
  * @parma strict Fail if the requested address is not available.
  * @return Error code.
  * @note Default address is only available in strict mode.
  */
-errno_t usb_bus_request_address(usb_bus_t *instance,
+int usb_bus_request_address(usb_bus_t *instance,
     usb_address_t *address, bool strict, usb_speed_t speed)
 {
@@ -493,14 +491,9 @@
 
 	usb_address_t addr = *address;
-	errno_t rc;
 
 	fibril_mutex_lock(&instance->guard);
 	/* Only grant default address to strict requests */
 	if ((addr == USB_ADDRESS_DEFAULT) && !strict) {
-		rc = usb_bus_get_free_address(instance, &addr);
-		if (rc != EOK) {
-			fibril_mutex_unlock(&instance->guard);
-			return rc;
-		}
+		addr = usb_bus_get_free_address(instance);
 	}
 
@@ -510,9 +503,5 @@
 			return ENOENT;
 		}
-		rc = usb_bus_get_free_address(instance, &addr);
-		if (rc != EOK) {
-			fibril_mutex_unlock(&instance->guard);
-			return rc;
-		}
+		addr = usb_bus_get_free_address(instance);
 	}
 	if (usb_address_is_valid(addr)) {
@@ -527,7 +516,5 @@
 
 	fibril_mutex_unlock(&instance->guard);
-
-	*address = addr;
-	return EOK;
+	return addr;
 }
 
@@ -539,5 +526,5 @@
  * @return Error code.
  */
-errno_t usb_bus_get_speed(usb_bus_t *instance, usb_address_t address,
+int usb_bus_get_speed(usb_bus_t *instance, usb_address_t address,
     usb_speed_t *speed)
 {
@@ -549,5 +536,5 @@
 	fibril_mutex_lock(&instance->guard);
 
-	const errno_t ret = instance->devices[address].occupied ? EOK : ENOENT;
+	const int ret = instance->devices[address].occupied ? EOK : ENOENT;
 	if (speed && instance->devices[address].occupied) {
 		*speed = instance->devices[address].speed;
Index: uspace/lib/usbhost/src/usb_transfer_batch.c
===================================================================
--- uspace/lib/usbhost/src/usb_transfer_batch.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbhost/src/usb_transfer_batch.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -94,5 +94,5 @@
  * @param[in] instance Batch structure to use.
  */
-void usb_transfer_batch_destroy(usb_transfer_batch_t *instance)
+void usb_transfer_batch_destroy(const usb_transfer_batch_t *instance)
 {
 	if (!instance)
@@ -114,5 +114,5 @@
  */
 void usb_transfer_batch_finish_error(const usb_transfer_batch_t *instance,
-    const void *data, size_t size, errno_t error)
+    const void *data, size_t size, int error)
 {
 	assert(instance);
Index: uspace/lib/usbvirt/include/usbvirt/device.h
===================================================================
--- uspace/lib/usbvirt/include/usbvirt/device.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbvirt/include/usbvirt/device.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
  * @return Error code.
  */
-typedef errno_t (*usbvirt_on_data_to_device_t)(usbvirt_device_t *dev,
+typedef int (*usbvirt_on_data_to_device_t)(usbvirt_device_t *dev,
     usb_endpoint_t endpoint, usb_transfer_type_t transfer_type,
     const void *buffer, size_t buffer_size);
@@ -70,5 +70,5 @@
  * @return Error code.
  */
-typedef errno_t (*usbvirt_on_data_from_device_t)(usbvirt_device_t *dev,
+typedef int (*usbvirt_on_data_from_device_t)(usbvirt_device_t *dev,
     usb_endpoint_t endpoint, usb_transfer_type_t transfer_type,
     void *buffer, size_t buffer_size, size_t *act_buffer_size);
@@ -85,5 +85,5 @@
  * @return Error code.
  */
-typedef errno_t (*usbvirt_on_control_t)(usbvirt_device_t *dev,
+typedef int (*usbvirt_on_control_t)(usbvirt_device_t *dev,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_data_size);
@@ -154,5 +154,5 @@
 	usb_standard_configuration_descriptor_t *descriptor;
 	/** Array of extra data. */
-	usbvirt_device_configuration_extras_t *extra;
+	const usbvirt_device_configuration_extras_t *extra;
 	/** Length of @c extra array. */
 	size_t extra_count;
@@ -239,9 +239,9 @@
 };
 
-extern errno_t req_nop(usbvirt_device_t *device,
+extern int req_nop(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size);
 
-extern errno_t usbvirt_device_plug(usbvirt_device_t *, const char *);
+extern int usbvirt_device_plug(usbvirt_device_t *, const char *);
 extern void usbvirt_device_unplug(usbvirt_device_t *);
 
@@ -250,11 +250,11 @@
     const void *, size_t);
 
-extern errno_t usbvirt_control_write(usbvirt_device_t *, const void *, size_t,
+extern int usbvirt_control_write(usbvirt_device_t *, const void *, size_t,
     void *, size_t);
-extern errno_t usbvirt_control_read(usbvirt_device_t *, const void *, size_t,
+extern int usbvirt_control_read(usbvirt_device_t *, const void *, size_t,
     void *, size_t, size_t *);
-extern errno_t usbvirt_data_out(usbvirt_device_t *, usb_transfer_type_t,
+extern int usbvirt_data_out(usbvirt_device_t *, usb_transfer_type_t,
     usb_endpoint_t, const void *, size_t);
-extern errno_t usbvirt_data_in(usbvirt_device_t *, usb_transfer_type_t,
+extern int usbvirt_data_in(usbvirt_device_t *, usb_transfer_type_t,
     usb_endpoint_t, void *, size_t, size_t *);
 
Index: uspace/lib/usbvirt/include/usbvirt/ipc.h
===================================================================
--- uspace/lib/usbvirt/include/usbvirt/ipc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbvirt/include/usbvirt/ipc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,11 +54,11 @@
 } usbvirt_hc_to_device_method_t;
 
-extern errno_t usbvirt_ipc_send_control_read(async_sess_t *, void *, size_t,
+extern int usbvirt_ipc_send_control_read(async_sess_t *, void *, size_t,
     void *, size_t, size_t *);
-extern errno_t usbvirt_ipc_send_control_write(async_sess_t *, void *, size_t,
+extern int usbvirt_ipc_send_control_write(async_sess_t *, void *, size_t,
     void *, size_t);
-extern errno_t usbvirt_ipc_send_data_in(async_sess_t *, usb_endpoint_t,
+extern int usbvirt_ipc_send_data_in(async_sess_t *, usb_endpoint_t,
     usb_transfer_type_t, void *, size_t, size_t *);
-extern errno_t usbvirt_ipc_send_data_out(async_sess_t *, usb_endpoint_t,
+extern int usbvirt_ipc_send_data_out(async_sess_t *, usb_endpoint_t,
     usb_transfer_type_t, void *, size_t);
 
Index: uspace/lib/usbvirt/include/usbvirt/virthub_base.h
===================================================================
--- uspace/lib/usbvirt/include/usbvirt/virthub_base.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbvirt/include/usbvirt/virthub_base.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
 void *virthub_get_data(usbvirt_device_t *dev);
 
-errno_t virthub_base_init(virthub_base_t *instance,
+int virthub_base_init(virthub_base_t *instance,
     const char *name, usbvirt_device_ops_t *ops, void *data,
     const usb_standard_device_descriptor_t *device_desc,
@@ -63,12 +63,12 @@
 usb_address_t virthub_base_get_address(virthub_base_t *instance);
 
-errno_t virthub_base_request(virthub_base_t *instance, usb_target_t target,
+int virthub_base_request(virthub_base_t *instance, usb_target_t target,
     usb_direction_t dir, const usb_device_request_setup_packet_t *setup,
     void *buffer, size_t buffer_size, size_t *real_size);
 
-errno_t virthub_base_get_hub_descriptor(usbvirt_device_t *dev,
+int virthub_base_get_hub_descriptor(usbvirt_device_t *dev,
     const usb_device_request_setup_packet_t *request, uint8_t *data,
     size_t *act_size);
-errno_t virthub_base_get_null_status(usbvirt_device_t *dev,
+int virthub_base_get_null_status(usbvirt_device_t *dev,
     const usb_device_request_setup_packet_t *request, uint8_t *data,
     size_t *act_size);
Index: uspace/lib/usbvirt/src/ctrltransfer.c
===================================================================
--- uspace/lib/usbvirt/src/ctrltransfer.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbvirt/src/ctrltransfer.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
  * @retval EFORWARD No suitable handler found.
  */
-errno_t process_control_transfer(usbvirt_device_t *dev,
+int process_control_transfer(usbvirt_device_t *dev,
     const usbvirt_control_request_handler_t *control_handlers,
     const usb_device_request_setup_packet_t *setup,
@@ -70,5 +70,5 @@
 		usb_log_debug("Control transfer: %s(%s)\n", handler->name,
 		    usb_debug_str_buffer((uint8_t*) setup, sizeof(*setup), 0));
-		errno_t rc = handler->callback(dev, setup, data, data_sent_size);
+		int rc = handler->callback(dev, setup, data, data_sent_size);
 		if (rc != EFORWARD) {
 			return rc;
Index: uspace/lib/usbvirt/src/device.c
===================================================================
--- uspace/lib/usbvirt/src/device.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbvirt/src/device.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -82,5 +82,5 @@
  * @return Error code.
  */
-errno_t usbvirt_device_plug(usbvirt_device_t *dev, const char *vhc_path)
+int usbvirt_device_plug(usbvirt_device_t *dev, const char *vhc_path)
 {
 	if (DEV != NULL)
@@ -88,5 +88,5 @@
 	
 	devman_handle_t handle;
-	errno_t rc = devman_fun_get_handle(vhc_path, &handle, 0);
+	int rc = devman_fun_get_handle(vhc_path, &handle, 0);
 	if (rc != EOK)
 		return rc;
Index: uspace/lib/usbvirt/src/ipc_dev.c
===================================================================
--- uspace/lib/usbvirt/src/ipc_dev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbvirt/src/ipc_dev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -81,5 +81,5 @@
     ipc_callid_t iid, ipc_call_t *icall)
 {
-	errno_t rc;
+	int rc;
 
 	void *setup_packet = NULL;
@@ -137,5 +137,5 @@
 {
 	size_t data_buffer_len = IPC_GET_ARG1(*icall);
-	errno_t rc;
+	int rc;
 
 	void *setup_packet = NULL;
@@ -183,5 +183,5 @@
 	usb_endpoint_t endpoint = IPC_GET_ARG1(*icall);
 
-	errno_t rc;
+	int rc;
 
 	size_t data_len = 0;
@@ -230,5 +230,5 @@
 	size_t data_buffer_size = 0;
 
-	errno_t rc = async_data_write_accept(&data_buffer, false,
+	int rc = async_data_write_accept(&data_buffer, false,
 	    1, 0, 0, &data_buffer_size);
 	if (rc != EOK) {
Index: uspace/lib/usbvirt/src/ipc_hc.c
===================================================================
--- uspace/lib/usbvirt/src/ipc_hc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbvirt/src/ipc_hc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,5 +55,5 @@
  *
  */
-errno_t usbvirt_ipc_send_control_read(async_sess_t *sess, void *setup_buffer,
+int usbvirt_ipc_send_control_read(async_sess_t *sess, void *setup_buffer,
     size_t setup_buffer_size, void *data_buffer, size_t data_buffer_size,
     size_t *data_transfered_size)
@@ -77,5 +77,5 @@
 	}
 	
-	errno_t rc = async_data_write_start(exch, setup_buffer, setup_buffer_size);
+	int rc = async_data_write_start(exch, setup_buffer, setup_buffer_size);
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -95,6 +95,6 @@
 	}
 	
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
+	sysarg_t data_request_rc;
+	sysarg_t opening_request_rc;
 	async_wait_for(data_request, &data_request_rc);
 	async_wait_for(opening_request, &opening_request_rc);
@@ -103,11 +103,11 @@
 		/* Prefer the return code of the opening request. */
 		if (opening_request_rc != EOK)
-			return (errno_t) opening_request_rc;
+			return (int) opening_request_rc;
 		else
-			return (errno_t) data_request_rc;
+			return (int) data_request_rc;
 	}
 	
 	if (opening_request_rc != EOK)
-		return (errno_t) opening_request_rc;
+		return (int) opening_request_rc;
 	
 	if (data_transfered_size != NULL)
@@ -129,5 +129,5 @@
  *
  */
-errno_t usbvirt_ipc_send_control_write(async_sess_t *sess, void *setup_buffer,
+int usbvirt_ipc_send_control_write(async_sess_t *sess, void *setup_buffer,
     size_t setup_buffer_size, void *data_buffer, size_t data_buffer_size)
 {
@@ -150,5 +150,5 @@
 	}
 	
-	errno_t rc = async_data_write_start(exch, setup_buffer, setup_buffer_size);
+	int rc = async_data_write_start(exch, setup_buffer, setup_buffer_size);
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -168,8 +168,8 @@
 	async_exchange_end(exch);
 	
-	errno_t opening_request_rc;
+	sysarg_t opening_request_rc;
 	async_wait_for(opening_request, &opening_request_rc);
 	
-	return (errno_t) opening_request_rc;
+	return (int) opening_request_rc;
 }
 
@@ -186,5 +186,5 @@
  *
  */
-errno_t usbvirt_ipc_send_data_in(async_sess_t *sess, usb_endpoint_t ep,
+int usbvirt_ipc_send_data_in(async_sess_t *sess, usb_endpoint_t ep,
     usb_transfer_type_t tr_type, void *data, size_t data_size, size_t *act_size)
 {
@@ -230,6 +230,6 @@
 	}
 	
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
+	sysarg_t data_request_rc;
+	sysarg_t opening_request_rc;
 	async_wait_for(data_request, &data_request_rc);
 	async_wait_for(opening_request, &opening_request_rc);
@@ -238,11 +238,11 @@
 		/* Prefer the return code of the opening request. */
 		if (opening_request_rc != EOK)
-			return (errno_t) opening_request_rc;
+			return (int) opening_request_rc;
 		else
-			return (errno_t) data_request_rc;
+			return (int) data_request_rc;
 	}
 	
 	if (opening_request_rc != EOK)
-		return (errno_t) opening_request_rc;
+		return (int) opening_request_rc;
 	
 	if (act_size != NULL)
@@ -263,5 +263,5 @@
  *
  */
-errno_t usbvirt_ipc_send_data_out(async_sess_t *sess, usb_endpoint_t ep,
+int usbvirt_ipc_send_data_out(async_sess_t *sess, usb_endpoint_t ep,
     usb_transfer_type_t tr_type, void *data, size_t data_size)
 {
@@ -296,5 +296,5 @@
 	}
 	
-	errno_t rc = async_data_write_start(exch, data, data_size);
+	int rc = async_data_write_start(exch, data, data_size);
 	
 	async_exchange_end(exch);
@@ -305,8 +305,8 @@
 	}
 	
-	errno_t opening_request_rc;
+	sysarg_t opening_request_rc;
 	async_wait_for(opening_request, &opening_request_rc);
 	
-	return (errno_t) opening_request_rc;
+	return (int) opening_request_rc;
 }
 
Index: uspace/lib/usbvirt/src/private.h
===================================================================
--- uspace/lib/usbvirt/src/private.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbvirt/src/private.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include <usbvirt/device.h>
 
-errno_t process_control_transfer(usbvirt_device_t *,
+int process_control_transfer(usbvirt_device_t *,
     const usbvirt_control_request_handler_t *,
     const usb_device_request_setup_packet_t *,
Index: uspace/lib/usbvirt/src/stdreq.c
===================================================================
--- uspace/lib/usbvirt/src/stdreq.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbvirt/src/stdreq.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -66,5 +66,5 @@
 
 /** NOP handler */
-errno_t req_nop(usbvirt_device_t *device,
+int req_nop(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
     uint8_t *data, size_t *act_size)
@@ -74,5 +74,5 @@
 
 /** GET_DESCRIPTOR handler. */
-static errno_t req_get_descriptor(usbvirt_device_t *device,
+static int req_get_descriptor(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet, uint8_t *data, size_t *act_size)
 {
@@ -135,5 +135,5 @@
 }
 
-static errno_t req_set_address(usbvirt_device_t *device,
+static int req_set_address(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet, uint8_t *data, size_t *act_size)
 {
@@ -155,5 +155,5 @@
 }
 
-static errno_t req_set_configuration(usbvirt_device_t *device,
+static int req_set_configuration(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet, uint8_t *data, size_t *act_size)
 {
@@ -197,5 +197,5 @@
 }
 
-static errno_t req_get_dev_status(usbvirt_device_t *device,
+static int req_get_dev_status(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet, uint8_t *data, size_t *act_size)
 {
@@ -207,5 +207,5 @@
 	return EOK;
 }
-static errno_t req_get_iface_ep_status(usbvirt_device_t *device,
+static int req_get_iface_ep_status(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet, uint8_t *data, size_t *act_size)
 {
Index: uspace/lib/usbvirt/src/transfer.c
===================================================================
--- uspace/lib/usbvirt/src/transfer.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbvirt/src/transfer.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
  * @return Error code.
  */
-static errno_t usbvirt_control_transfer(usbvirt_device_t *dev,
+static int usbvirt_control_transfer(usbvirt_device_t *dev,
     const void *setup, size_t setup_size,
     void *data, size_t data_size, size_t *data_size_sent)
@@ -65,5 +65,5 @@
 	}
 
-	errno_t rc;
+	int rc;
 
 	/* Run user handler first. */
@@ -100,5 +100,5 @@
  * @return Error code.
  */
-errno_t usbvirt_control_write(usbvirt_device_t *dev, const void *setup,
+int usbvirt_control_write(usbvirt_device_t *dev, const void *setup,
     size_t setup_size, void *data, size_t data_size)
 {
@@ -119,5 +119,5 @@
  * @return Error code.
  */
-errno_t usbvirt_control_read(usbvirt_device_t *dev, const void *setup, size_t setup_size,
+int usbvirt_control_read(usbvirt_device_t *dev, const void *setup, size_t setup_size,
     void *data, size_t data_size, size_t *data_size_sent)
 {
@@ -135,5 +135,5 @@
  * @return Error code.
  */
-errno_t usbvirt_data_out(usbvirt_device_t *dev, usb_transfer_type_t transf_type,
+int usbvirt_data_out(usbvirt_device_t *dev, usb_transfer_type_t transf_type,
     usb_endpoint_t endpoint, const void *data, size_t data_size)
 {
@@ -145,5 +145,5 @@
 	}
 
-	errno_t rc = dev->ops->data_out[endpoint](dev, endpoint, transf_type,
+	int rc = dev->ops->data_out[endpoint](dev, endpoint, transf_type,
 	    data, data_size);
 
@@ -161,5 +161,5 @@
  * @return Error code.
  */
-errno_t usbvirt_data_in(usbvirt_device_t *dev, usb_transfer_type_t transf_type,
+int usbvirt_data_in(usbvirt_device_t *dev, usb_transfer_type_t transf_type,
     usb_endpoint_t endpoint, void *data, size_t data_size, size_t *data_size_sent)
 {
@@ -172,5 +172,5 @@
 
 	size_t data_size_sent_tmp;
-	errno_t rc = dev->ops->data_in[endpoint](dev, endpoint, transf_type,
+	int rc = dev->ops->data_in[endpoint](dev, endpoint, transf_type,
 	    data, data_size, &data_size_sent_tmp);
 
Index: uspace/lib/usbvirt/src/virthub_base.c
===================================================================
--- uspace/lib/usbvirt/src/virthub_base.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/lib/usbvirt/src/virthub_base.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,5 +54,5 @@
 }
 
-errno_t virthub_base_init(virthub_base_t *instance, const char *name,
+int virthub_base_init(virthub_base_t *instance, const char *name,
     usbvirt_device_ops_t *ops, void *data,
     const usb_standard_device_descriptor_t *device_desc,
@@ -109,5 +109,5 @@
 }
 
-errno_t virthub_base_request(virthub_base_t *instance, usb_target_t target,
+int virthub_base_request(virthub_base_t *instance, usb_target_t target,
     usb_direction_t dir, const usb_device_request_setup_packet_t *setup,
     void *buffer, size_t buffer_size, size_t *real_size)
@@ -143,5 +143,5 @@
 }
 
-errno_t virthub_base_get_hub_descriptor(usbvirt_device_t *dev,
+int virthub_base_get_hub_descriptor(usbvirt_device_t *dev,
     const usb_device_request_setup_packet_t *request, uint8_t *data,
     size_t *act_size)
@@ -159,5 +159,5 @@
 }
 
-errno_t virthub_base_get_null_status(usbvirt_device_t *dev,
+int virthub_base_get_null_status(usbvirt_device_t *dev,
     const usb_device_request_setup_packet_t *request, uint8_t *data,
     size_t *act_size)
Index: uspace/srv/audio/hound/audio_data.c
===================================================================
--- uspace/srv/audio/hound/audio_data.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/audio_data.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <macros.h>
 #include <stdlib.h>
-#include <str.h>
 
 #include "audio_data.h"
@@ -51,5 +50,5 @@
     pcm_format_t format)
 {
-	audio_data_t *adata = malloc(sizeof(audio_data_t) + size);
+	audio_data_t *adata = malloc(sizeof(audio_data_t));
 	if (adata) {
 		unsigned overflow = size % pcm_format_frame_size(&format);
@@ -57,6 +56,6 @@
 			log_warning("Data not a multiple of frame size, "
 			    "clipping.");
-		uint8_t *d = ((uint8_t *)adata) + offsetof(audio_data_t, data);
-		memcpy(d, data, size);
+
+		adata->data = data;
 		adata->size = size - overflow;
 		adata->format = format;
@@ -87,4 +86,5 @@
 	atomic_count_t refc = atomic_predec(&adata->refcount);
 	if (refc == 0) {
+		free(adata->data);
 		free(adata);
 	}
@@ -213,5 +213,5 @@
  * @return Error code.
  */
-errno_t audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data)
+int audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data)
 {
 	assert(pipe);
@@ -260,7 +260,7 @@
  * @param size Target buffer size.
  * @param format Target data format.
- * @return Size of the target buffer used.
- */
-size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data,
+ * @return Size of the target buffer used, Error code on failure.
+ */
+ssize_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data,
     size_t size, const pcm_format_t *f)
 {
Index: uspace/srv/audio/hound/audio_data.h
===================================================================
--- uspace/srv/audio/hound/audio_data.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/audio_data.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,4 +45,6 @@
 /** Reference counted audio buffer */
 typedef struct {
+	/** Audio data */
+	const void *data;
 	/** Size of the buffer pointer to by data */
 	size_t size;
@@ -51,6 +53,4 @@
 	/** Reference counter */
 	atomic_t refcount;
-	/** Audio data */
-	const uint8_t data[];
 } audio_data_t;
 
@@ -75,8 +75,8 @@
 void audio_pipe_fini(audio_pipe_t *pipe);
 
-errno_t audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data);
+int audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data);
 audio_data_t *audio_pipe_pop(audio_pipe_t *pipe);
 
-size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *buffer, size_t size,
+ssize_t audio_pipe_mix_data(audio_pipe_t *pipe, void *buffer, size_t size,
     const pcm_format_t *f);
 
@@ -113,10 +113,10 @@
  * Reference counted buffer is created automatically.
  */
-static inline errno_t audio_pipe_push_data(audio_pipe_t *pipe,
+static inline int audio_pipe_push_data(audio_pipe_t *pipe,
     const void *data, size_t size, pcm_format_t f)
 {
 	audio_data_t *adata = audio_data_create(data, size, f);
 	if (adata) {
-		const errno_t ret = audio_pipe_push(pipe, adata);
+		const int ret = audio_pipe_push(pipe, adata);
 		audio_data_unref(adata);
 		return ret;
Index: uspace/srv/audio/hound/audio_device.c
===================================================================
--- uspace/srv/audio/hound/audio_device.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/audio_device.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,10 +51,10 @@
 #define BUFFER_PARTS   16
 
-static errno_t device_sink_connection_callback(audio_sink_t *sink, bool new);
-static errno_t device_source_connection_callback(audio_source_t *source, bool new);
+static int device_sink_connection_callback(audio_sink_t *sink, bool new);
+static int device_source_connection_callback(audio_source_t *source, bool new);
 static void device_event_callback(ipc_callid_t iid, ipc_call_t *icall, void *arg);
-static errno_t device_check_format(audio_sink_t* sink);
-static errno_t get_buffer(audio_device_t *dev);
-static errno_t release_buffer(audio_device_t *dev);
+static int device_check_format(audio_sink_t* sink);
+static int get_buffer(audio_device_t *dev);
+static int release_buffer(audio_device_t *dev);
 static void advance_buffer(audio_device_t *dev, size_t size);
 static inline bool is_running(audio_device_t *dev)
@@ -62,5 +62,5 @@
 	assert(dev);
 	/* we release buffer on stop so this should be enough */
-	return dev->buffer.base != NULL;
+	return (bool)dev->buffer.base;
 }
 
@@ -72,5 +72,5 @@
  * @return Error code.
  */
-errno_t audio_device_init(audio_device_t *dev, service_id_t id, const char *name)
+int audio_device_init(audio_device_t *dev, service_id_t id, const char *name)
 {
 	assert(dev);
@@ -121,7 +121,5 @@
 {
 	assert(dev);
-	sysarg_t val;
-	errno_t rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_CAPTURE, &val);
-	if (rc == EOK && val)
+	if (audio_pcm_query_cap(dev->sess, AUDIO_CAP_CAPTURE))
 		return &dev->source;
 	return NULL;
@@ -137,7 +135,5 @@
 {
 	assert(dev);
-	sysarg_t val;
-	errno_t rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_PLAYBACK, &val);
-	if (rc == EOK && val)
+	if (audio_pcm_query_cap(dev->sess, AUDIO_CAP_PLAYBACK))
 		return &dev->sink;
 	return NULL;
@@ -153,5 +149,5 @@
  * connections.
  */
-static errno_t device_sink_connection_callback(audio_sink_t* sink, bool new)
+static int device_sink_connection_callback(audio_sink_t* sink, bool new)
 {
 	assert(sink);
@@ -160,5 +156,5 @@
 		log_verbose("First connection on device sink '%s'", sink->name);
 
-		errno_t ret = get_buffer(dev);
+		int ret = get_buffer(dev);
 		if (ret != EOK) {
 			log_error("Failed to get device buffer: %s",
@@ -196,5 +192,5 @@
 		log_verbose("Removed last connection on device sink '%s'",
 		    sink->name);
-		errno_t ret = audio_pcm_stop_playback(dev->sess);
+		int ret = audio_pcm_stop_playback(dev->sess);
 		if (ret != EOK) {
 			log_error("Failed to stop playback: %s",
@@ -215,10 +211,10 @@
  * connections.
  */
-static errno_t device_source_connection_callback(audio_source_t *source, bool new)
+static int device_source_connection_callback(audio_source_t *source, bool new)
 {
 	assert(source);
 	audio_device_t *dev = source->private_data;
 	if (new && list_count(&source->connections) == 1) {
-		errno_t ret = get_buffer(dev);
+		int ret = get_buffer(dev);
 		if (ret != EOK) {
 			log_error("Failed to get device buffer: %s",
@@ -244,5 +240,5 @@
 	if (list_count(&source->connections) == 0) { /* Disconnected */
 		assert(!new);
-		errno_t ret = audio_pcm_stop_capture_immediate(dev->sess);
+		int ret = audio_pcm_stop_capture_immediate(dev->sess);
 		if (ret != EOK) {
 			log_error("Failed to start recording: %s",
@@ -289,5 +285,5 @@
 			log_verbose("Capture terminated");
 			dev->source.format = AUDIO_FORMAT_ANY;
-			const errno_t ret = release_buffer(dev);
+			const int ret = release_buffer(dev);
 			if (ret != EOK) {
 				log_error("Failed to release buffer: %s",
@@ -300,5 +296,5 @@
 			log_verbose("Playback Terminated");
 			dev->sink.format = AUDIO_FORMAT_ANY;
-			const errno_t ret = release_buffer(dev);
+			const int ret = release_buffer(dev);
 			if (ret != EOK) {
 				log_error("Failed to release buffer: %s",
@@ -309,5 +305,5 @@
 		}
 		case PCM_EVENT_FRAMES_CAPTURED: {
-			const errno_t ret = audio_source_push_data(&dev->source,
+			const int ret = audio_source_push_data(&dev->source,
 			    dev->buffer.position, dev->buffer.fragment_size);
 			advance_buffer(dev, dev->buffer.fragment_size);
@@ -329,5 +325,5 @@
  * @return Error code.
  */
-static errno_t device_check_format(audio_sink_t* sink)
+static int device_check_format(audio_sink_t* sink)
 {
 	assert(sink);
@@ -347,5 +343,5 @@
  * @return Error code.
  */
-static errno_t get_buffer(audio_device_t *dev)
+static int get_buffer(audio_device_t *dev)
 {
 	assert(dev);
@@ -362,5 +358,5 @@
 	size_t preferred_size = 0;
 
-	const errno_t ret = audio_pcm_get_buffer(dev->sess, &dev->buffer.base,
+	const int ret = audio_pcm_get_buffer(dev->sess, &dev->buffer.base,
 	    &preferred_size);
 	if (ret == EOK) {
@@ -378,10 +374,10 @@
  * @return Error code.
  */
-static errno_t release_buffer(audio_device_t *dev)
+static int release_buffer(audio_device_t *dev)
 {
 	assert(dev);
 	assert(dev->buffer.base);
 
-	const errno_t ret = audio_pcm_release_buffer(dev->sess);
+	const int ret = audio_pcm_release_buffer(dev->sess);
 	if (ret == EOK) {
 		as_area_destroy(dev->buffer.base);
Index: uspace/srv/audio/hound/audio_device.h
===================================================================
--- uspace/srv/audio/hound/audio_device.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/audio_device.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -76,10 +76,10 @@
 };
 
-errno_t audio_device_init(audio_device_t *dev, service_id_t id, const char *name);
+int audio_device_init(audio_device_t *dev, service_id_t id, const char *name);
 void audio_device_fini(audio_device_t *dev);
 audio_source_t * audio_device_get_source(audio_device_t *dev);
 audio_sink_t * audio_device_get_sink(audio_device_t *dev);
-errno_t audio_device_recorded_data(audio_device_t *dev, void **base, size_t *size);
-errno_t audio_device_available_buffer(audio_device_t *dev, void **base, size_t *size);
+int audio_device_recorded_data(audio_device_t *dev, void **base, size_t *size);
+int audio_device_available_buffer(audio_device_t *dev, void **base, size_t *size);
 
 #endif
Index: uspace/srv/audio/hound/audio_sink.c
===================================================================
--- uspace/srv/audio/hound/audio_sink.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/audio_sink.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,7 +56,7 @@
  * @return Error code.
  */
-errno_t audio_sink_init(audio_sink_t *sink, const char *name, void *private_data,
-    errno_t (*connection_change)(audio_sink_t *, bool),
-    errno_t (*check_format)(audio_sink_t *), errno_t (*data_available)(audio_sink_t *),
+int audio_sink_init(audio_sink_t *sink, const char *name, void *private_data,
+    int (*connection_change)(audio_sink_t *, bool),
+    int (*check_format)(audio_sink_t *), int (*data_available)(audio_sink_t *),
     const pcm_format_t *f)
 {
@@ -97,5 +97,5 @@
  * @return Error code.
  */
-errno_t audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format)
+int audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format)
 {
 	assert(sink);
@@ -114,5 +114,5 @@
 	}
 	if (sink->check_format) {
-		const errno_t ret = sink->check_format(sink);
+		const int ret = sink->check_format(sink);
 		if (ret != EOK && ret != ELIMIT) {
 			log_debug("Format check failed on sink %s", sink->name);
@@ -141,5 +141,5 @@
 	pcm_format_silence(dest, size, &sink->format);
 	list_foreach(sink->connections, sink_link, connection_t, conn) {
-		const errno_t ret = connection_add_source_data(
+		const int ret = connection_add_source_data(
 		    conn, dest, size, sink->format);
 		if (ret != EOK) {
Index: uspace/srv/audio/hound/audio_sink.h
===================================================================
--- uspace/srv/audio/hound/audio_sink.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/audio_sink.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,5 +54,5 @@
 	list_t connections;
 	/** Sink's name */
-	char *name;
+	const char *name;
 	/** Consumes data in this format */
 	pcm_format_t format;
@@ -60,9 +60,9 @@
 	void *private_data;
 	/** Connect/disconnect callback */
-	errno_t (*connection_change)(audio_sink_t *, bool);
+	int (*connection_change)(audio_sink_t *, bool);
 	/** Backend callback to check data */
-	errno_t (*check_format)(audio_sink_t *);
+	int (*check_format)(audio_sink_t *);
 	/** new data notifier */
-	errno_t (*data_available)(audio_sink_t *);
+	int (*data_available)(audio_sink_t *);
 };
 
@@ -77,11 +77,11 @@
 }
 
-errno_t audio_sink_init(audio_sink_t *sink, const char *name, void *private_data,
-    errno_t (*connection_change)(audio_sink_t *, bool),
-    errno_t (*check_format)(audio_sink_t *), errno_t (*data_available)(audio_sink_t *),
+int audio_sink_init(audio_sink_t *sink, const char *name, void *private_data,
+    int (*connection_change)(audio_sink_t *, bool),
+    int (*check_format)(audio_sink_t *), int (*data_available)(audio_sink_t *),
     const pcm_format_t *f);
 
 void audio_sink_fini(audio_sink_t *sink);
-errno_t audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format);
+int audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format);
 void audio_sink_mix_inputs(audio_sink_t *sink, void* dest, size_t size);
 
Index: uspace/srv/audio/hound/audio_source.c
===================================================================
--- uspace/srv/audio/hound/audio_source.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/audio_source.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,7 +56,7 @@
  * @return Error code.
  */
-errno_t audio_source_init(audio_source_t *source, const char *name, void *data,
-    errno_t (*connection_change)(audio_source_t *, bool new),
-    errno_t (*update_available_data)(audio_source_t *, size_t),
+int audio_source_init(audio_source_t *source, const char *name, void *data,
+    int (*connection_change)(audio_source_t *, bool new),
+    int (*update_available_data)(audio_source_t *, size_t),
     const pcm_format_t *f)
 {
@@ -96,5 +96,5 @@
  * @return Error code.
  */
-errno_t audio_source_push_data(audio_source_t *source, void *data,
+int audio_source_push_data(audio_source_t *source, const void *data,
     size_t size)
 {
@@ -107,5 +107,5 @@
 
 	list_foreach(source->connections, source_link, connection_t, conn) {
-		const errno_t ret = connection_push_data(conn, adata);
+		const int ret = connection_push_data(conn, adata);
 		if (ret != EOK) {
 			log_warning("Failed push data to %s: %s",
Index: uspace/srv/audio/hound/audio_source.h
===================================================================
--- uspace/srv/audio/hound/audio_source.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/audio_source.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
 	list_t connections;
 	/** String identifier */
-	char *name;
+	const char *name;
 	/** audio data format */
 	pcm_format_t format;
@@ -55,7 +55,7 @@
 	void *private_data;
 	/** Callback for connection and disconnection */
-	errno_t (*connection_change)(audio_source_t *source, bool added);
+	int (*connection_change)(audio_source_t *source, bool added);
 	/** Ask backend for more data */
-	errno_t (*update_available_data)(audio_source_t *source, size_t size);
+	int (*update_available_data)(audio_source_t *source, size_t size);
 };
 
@@ -70,10 +70,10 @@
 }
 
-errno_t audio_source_init(audio_source_t *source, const char *name, void *data,
-    errno_t (*connection_change)(audio_source_t *, bool),
-    errno_t (*update_available_data)(audio_source_t *, size_t),
+int audio_source_init(audio_source_t *source, const char *name, void *data,
+    int (*connection_change)(audio_source_t *, bool),
+    int (*update_available_data)(audio_source_t *, size_t),
     const pcm_format_t *f);
 void audio_source_fini(audio_source_t *source);
-errno_t audio_source_push_data(audio_source_t *source, void *data,
+int audio_source_push_data(audio_source_t *source, const void *data,
     size_t size);
 static inline const pcm_format_t *audio_source_format(const audio_source_t *s)
Index: uspace/srv/audio/hound/connection.c
===================================================================
--- uspace/srv/audio/hound/connection.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/connection.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -101,5 +101,5 @@
  * @param format format of the destination audio buffer.
  */
-errno_t connection_add_source_data(connection_t *connection, void *data,
+ssize_t connection_add_source_data(connection_t *connection, void *data,
     size_t size, pcm_format_t format)
 {
@@ -116,10 +116,10 @@
 	log_verbose("Data available after update: %zu",
 	    audio_pipe_bytes(&connection->fifo));
-	size_t ret =
+	ssize_t ret =
 	    audio_pipe_mix_data(&connection->fifo, data, size, &format);
-	if (ret != size)
+	if (ret != (ssize_t)size)
 		log_warning("Connection failed to provide enough data %zd/%zu",
 		    ret, size);
-	return EOK;
+	return ret > 0 ? EOK : ret;
 }
 /**
@@ -129,10 +129,10 @@
  * @return Error code.
  */
-errno_t connection_push_data(connection_t *connection,
+int connection_push_data(connection_t *connection,
     audio_data_t *adata)
 {
 	assert(connection);
 	assert(adata);
-	const errno_t ret = audio_pipe_push(&connection->fifo, adata);
+	const int ret = audio_pipe_push(&connection->fifo, adata);
 	if (ret == EOK && connection->sink->data_available)
 		connection->sink->data_available(connection->sink);
Index: uspace/srv/audio/hound/connection.h
===================================================================
--- uspace/srv/audio/hound/connection.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/connection.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -84,8 +84,8 @@
 void connection_destroy(connection_t *connection);
 
-errno_t connection_add_source_data(connection_t *connection, void *data,
+ssize_t connection_add_source_data(connection_t *connection, void *data,
     size_t size, pcm_format_t format);
 
-errno_t connection_push_data(connection_t *connection, audio_data_t *adata);
+int connection_push_data(connection_t *connection, audio_data_t *adata);
 
 /**
Index: uspace/srv/audio/hound/hound.c
===================================================================
--- uspace/srv/audio/hound/hound.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/hound.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <assert.h>
 #include <stdlib.h>
-#include <str.h>
 
 #include "hound.h"
@@ -111,5 +110,5 @@
 }
 
-static errno_t hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name);
+static int hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name);
 
 /**
@@ -163,5 +162,5 @@
  * @return Error code.
  */
-errno_t hound_init(hound_t *hound)
+int hound_init(hound_t *hound)
 {
 	assert(hound);
@@ -181,5 +180,5 @@
  * @return Error code.
  */
-errno_t hound_add_ctx(hound_t *hound, hound_ctx_t *ctx)
+int hound_add_ctx(hound_t *hound, hound_ctx_t *ctx)
 {
 	log_info("Trying to add context %p", ctx);
@@ -190,5 +189,5 @@
 	list_append(&ctx->link, &hound->contexts);
 	fibril_mutex_unlock(&hound->list_guard);
-	errno_t ret = EOK;
+	int ret = EOK;
 	if (ret == EOK && ctx->source)
 		ret = hound_add_source(hound, ctx->source);
@@ -209,5 +208,5 @@
  * @return Error code.
  */
-errno_t hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx)
+int hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx)
 {
 	assert(hound);
@@ -255,5 +254,5 @@
  * @return Error code.
  */
-errno_t hound_add_device(hound_t *hound, service_id_t id, const char *name)
+int hound_add_device(hound_t *hound, service_id_t id, const char *name)
 {
 	log_verbose("Adding device \"%s\", service: %zu", name, id);
@@ -284,5 +283,5 @@
 	}
 
-	const errno_t ret = audio_device_init(dev, id, name);
+	const int ret = audio_device_init(dev, id, name);
 	if (ret != EOK) {
 		log_debug("Failed to initialize new audio device: %s",
@@ -297,5 +296,5 @@
 	audio_source_t *source = audio_device_get_source(dev);
 	if (source) {
-		const errno_t ret = hound_add_source(hound, source);
+		const int ret = hound_add_source(hound, source);
 		if (ret != EOK) {
 			log_debug("Failed to add device source: %s",
@@ -309,5 +308,5 @@
 	audio_sink_t *sink = audio_device_get_sink(dev);
 	if (sink) {
-		const errno_t ret = hound_add_sink(hound, sink);
+		const int ret = hound_add_sink(hound, sink);
 		if (ret != EOK) {
 			log_debug("Failed to add device sink: %s",
@@ -331,5 +330,5 @@
  * @return Error code.
  */
-errno_t hound_add_source(hound_t *hound, audio_source_t *source)
+int hound_add_source(hound_t *hound, audio_source_t *source)
 {
 	assert(hound);
@@ -355,5 +354,5 @@
  * @return Error code.
  */
-errno_t hound_add_sink(hound_t *hound, audio_sink_t *sink)
+int hound_add_sink(hound_t *hound, audio_sink_t *sink)
 {
 	assert(hound);
@@ -379,5 +378,5 @@
  * @return Error code.
  */
-errno_t hound_remove_source(hound_t *hound, audio_source_t *source)
+int hound_remove_source(hound_t *hound, audio_source_t *source)
 {
 	assert(hound);
@@ -396,5 +395,5 @@
  * @return Error code.
  */
-errno_t hound_remove_sink(hound_t *hound, audio_sink_t *sink)
+int hound_remove_sink(hound_t *hound, audio_sink_t *sink)
 {
 	assert(hound);
@@ -414,5 +413,5 @@
  * @return Error code.
  */
-errno_t hound_list_sources(hound_t *hound, char ***list, size_t *size)
+int hound_list_sources(hound_t *hound, const char ***list, size_t *size)
 {
 	assert(hound);
@@ -428,6 +427,6 @@
 		return EOK;
 	}
-	char **names = calloc(count, sizeof(char *));
-	errno_t ret = names ? EOK : ENOMEM;
+	const char **names = calloc(count, sizeof(char *));
+	int ret = names ? EOK : ENOMEM;
 	for (unsigned long i = 0; i < count && ret == EOK; ++i) {
 		link_t *slink = list_nth(&hound->sources, i);
@@ -456,5 +455,5 @@
  * @return Error code.
  */
-errno_t hound_list_sinks(hound_t *hound, char ***list, size_t *size)
+int hound_list_sinks(hound_t *hound, const char ***list, size_t *size)
 {
 	assert(hound);
@@ -470,6 +469,6 @@
 		return EOK;
 	}
-	char **names = calloc(count, sizeof(char *));
-	errno_t ret = names ? EOK : ENOMEM;
+	const char **names = calloc(count, sizeof(char *));
+	int ret = names ? EOK : ENOMEM;
 	for (size_t i = 0; i < count && ret == EOK; ++i) {
 		link_t *slink = list_nth(&hound->sinks, i);
@@ -502,5 +501,5 @@
  * identifiers with the same index are connected.
  */
-errno_t hound_list_connections(hound_t *hound, const char ***sources,
+int hound_list_connections(hound_t *hound, const char ***sources,
     const char ***sinks, size_t *size)
 {
@@ -517,5 +516,5 @@
  * @return Error code.
  */
-errno_t hound_connect(hound_t *hound, const char* source_name, const char* sink_name)
+int hound_connect(hound_t *hound, const char* source_name, const char* sink_name)
 {
 	assert(hound);
@@ -556,9 +555,9 @@
  * @return Error code.
  */
-errno_t hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name)
-{
-	assert(hound);
-	fibril_mutex_lock(&hound->list_guard);
-	const errno_t ret = hound_disconnect_internal(hound, source_name, sink_name);
+int hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name)
+{
+	assert(hound);
+	fibril_mutex_lock(&hound->list_guard);
+	const int ret = hound_disconnect_internal(hound, source_name, sink_name);
 	fibril_mutex_unlock(&hound->list_guard);
 	return ret;
@@ -574,5 +573,5 @@
  * This function has to be called with the list_guard lock held.
  */
-static errno_t hound_disconnect_internal(hound_t *hound, const char* source_name,
+static int hound_disconnect_internal(hound_t *hound, const char* source_name,
     const char* sink_name)
 {
Index: uspace/srv/audio/hound/hound.h
===================================================================
--- uspace/srv/audio/hound/hound.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/hound.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -65,20 +65,20 @@
 } hound_t;
 
-errno_t hound_init(hound_t *hound);
-errno_t hound_add_ctx(hound_t *hound, hound_ctx_t *ctx);
-errno_t hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx);
+int hound_init(hound_t *hound);
+int hound_add_ctx(hound_t *hound, hound_ctx_t *ctx);
+int hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx);
 hound_ctx_t *hound_get_ctx_by_id(hound_t *hound, hound_context_id_t id);
 
-errno_t hound_add_device(hound_t *hound, service_id_t id, const char *name);
-errno_t hound_add_source(hound_t *hound, audio_source_t *source);
-errno_t hound_add_sink(hound_t *hound, audio_sink_t *sink);
-errno_t hound_list_sources(hound_t *hound, char ***list, size_t *size);
-errno_t hound_list_sinks(hound_t *hound, char ***list, size_t *size);
-errno_t hound_list_connections(hound_t *hound, const char ***sources,
+int hound_add_device(hound_t *hound, service_id_t id, const char* name);
+int hound_add_source(hound_t *hound, audio_source_t *source);
+int hound_add_sink(hound_t *hound, audio_sink_t *sink);
+int hound_list_sources(hound_t *hound, const char ***list, size_t *size);
+int hound_list_sinks(hound_t *hound, const char ***list, size_t *size);
+int hound_list_connections(hound_t *hound, const char ***sources,
     const char ***sinks, size_t *size);
-errno_t hound_remove_source(hound_t *hound, audio_source_t *source);
-errno_t hound_remove_sink(hound_t *hound, audio_sink_t *sink);
-errno_t hound_connect(hound_t *hound, const char *source_name, const char *sink_name);
-errno_t hound_disconnect(hound_t *hound, const char *source_name, const char *sink_name);
+int hound_remove_source(hound_t *hound, audio_source_t *source);
+int hound_remove_sink(hound_t *hound, audio_sink_t *sink);
+int hound_connect(hound_t *hound, const char* source_name, const char* sink_name);
+int hound_disconnect(hound_t *hound, const char* source_name, const char* sink_name);
 
 #endif
Index: uspace/srv/audio/hound/hound_ctx.c
===================================================================
--- uspace/srv/audio/hound/hound_ctx.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/hound_ctx.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,6 +45,6 @@
 #include "log.h"
 
-static errno_t update_data(audio_source_t *source, size_t size);
-static errno_t new_data(audio_sink_t *sink);
+static int update_data(audio_source_t *source, size_t size);
+static int new_data(audio_sink_t *sink);
 
 /**
@@ -68,5 +68,5 @@
 			return NULL;
 		}
-		const errno_t ret = audio_sink_init(ctx->sink, name, ctx, NULL,
+		const int ret = audio_sink_init(ctx->sink, name, ctx, NULL,
 		    NULL, new_data, &AUDIO_FORMAT_DEFAULT);
 		if (ret != EOK) {
@@ -99,5 +99,5 @@
 			return NULL;
 		}
-		const errno_t ret = audio_source_init(ctx->source, name, ctx, NULL,
+		const int ret = audio_source_init(ctx->source, name, ctx, NULL,
 		    update_data, &AUDIO_FORMAT_DEFAULT);
 		if (ret != EOK) {
@@ -199,5 +199,5 @@
  * @return Error code.
  */
-static errno_t stream_push_data(hound_ctx_stream_t *stream, audio_data_t *adata)
+static int stream_push_data(hound_ctx_stream_t *stream, audio_data_t *adata)
 {
 	assert(stream);
@@ -216,5 +216,5 @@
 	}
 
-	const errno_t ret = audio_pipe_push(&stream->fifo, adata);
+	const int ret = audio_pipe_push(&stream->fifo, adata);
 	fibril_mutex_unlock(&stream->guard);
 	if (ret == EOK)
@@ -297,5 +297,5 @@
  * @return Error code.
  */
-errno_t hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *data,
+int hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *data,
     size_t size)
 {
@@ -312,5 +312,5 @@
 	}
 
-	const errno_t ret =
+	const int ret =
 	    audio_pipe_push_data(&stream->fifo, data, size, stream->format);
 	fibril_mutex_unlock(&stream->guard);
@@ -327,5 +327,5 @@
  * @return Error code.
  */
-errno_t hound_ctx_stream_read(hound_ctx_stream_t *stream, void *data, size_t size)
+int hound_ctx_stream_read(hound_ctx_stream_t *stream, void *data, size_t size)
 {
 	assert(stream);
@@ -340,12 +340,10 @@
 
 	pcm_format_silence(data, size, &stream->format);
-	const size_t ret =
+	const int ret =
 	    audio_pipe_mix_data(&stream->fifo, data, size, &stream->format);
 	fibril_mutex_unlock(&stream->guard);
-	if (ret > 0) {
+	if (ret == EOK)
 		fibril_condvar_signal(&stream->change);
-		return EOK;
-	}
-	return EEMPTY;
+	return ret;
 }
 
@@ -356,12 +354,13 @@
  * @param size Size of the @p data buffer.
  * @param format Destination data format.
- * @return Size of the destination buffer touch with stream's data.
- */
-size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
+ * @return Size of the destination buffer touch with stream's data,
+ *         error code on failure.
+ */
+ssize_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
     size_t size, const pcm_format_t *f)
 {
 	assert(stream);
 	fibril_mutex_lock(&stream->guard);
-	const size_t ret = audio_pipe_mix_data(&stream->fifo, data, size, f);
+	const int ret = audio_pipe_mix_data(&stream->fifo, data, size, f);
 	fibril_condvar_signal(&stream->change);
 	fibril_mutex_unlock(&stream->guard);
@@ -391,5 +390,5 @@
  * Mixes data from all streams and pushes it to all connections.
  */
-errno_t update_data(audio_source_t *source, size_t size)
+int update_data(audio_source_t *source, size_t size)
 {
 	assert(source);
@@ -425,5 +424,5 @@
 }
 
-errno_t new_data(audio_sink_t *sink)
+int new_data(audio_sink_t *sink)
 {
 	assert(sink);
@@ -458,10 +457,13 @@
 	list_foreach(sink->connections, source_link, connection_t, conn) {
 		/* This should not trigger data update on the source */
-		connection_add_source_data(
+		const size_t copied = connection_add_source_data(
 		    conn, buffer, bsize, sink->format);
+		if (copied != bsize)
+			log_error("Copied less than advertised data, "
+			    "something is wrong");
 	}
 	/* push to all streams */
 	list_foreach(ctx->streams, link, hound_ctx_stream_t, stream) {
-		const errno_t ret = stream_push_data(stream, adata);
+		const int ret = stream_push_data(stream, adata);
 		if (ret != EOK)
 			log_error("Failed to push data to stream: %s",
Index: uspace/srv/audio/hound/hound_ctx.h
===================================================================
--- uspace/srv/audio/hound/hound_ctx.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/hound_ctx.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -69,11 +69,11 @@
 
 hound_ctx_stream_t *hound_ctx_create_stream(hound_ctx_t *ctx, int flags,
-    pcm_format_t format, size_t buffer_size);
+	pcm_format_t format, size_t buffer_size);
 void hound_ctx_destroy_stream(hound_ctx_stream_t *stream);
 
-errno_t hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *buffer,
+int hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *buffer,
     size_t size);
-errno_t hound_ctx_stream_read(hound_ctx_stream_t *stream, void *buffer, size_t size);
-size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
+int hound_ctx_stream_read(hound_ctx_stream_t *stream, void *buffer, size_t size);
+ssize_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
     size_t size, const pcm_format_t *f);
 void hound_ctx_stream_drain(hound_ctx_stream_t *stream);
Index: uspace/srv/audio/hound/iface.c
===================================================================
--- uspace/srv/audio/hound/iface.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/iface.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 #include "log.h"
 
-static errno_t iface_add_context(void *server, hound_context_id_t *id,
+static int iface_add_context(void *server, hound_context_id_t *id,
     const char *name, bool record)
 {
@@ -55,5 +55,5 @@
 		return ENOMEM;
 
-	const errno_t ret = hound_add_ctx(server, ctx);
+	const int ret = hound_add_ctx(server, ctx);
 	if (ret != EOK)
 		hound_ctx_destroy(ctx);
@@ -63,5 +63,5 @@
 }
 
-static errno_t iface_rem_context(void *server, hound_context_id_t id)
+static int iface_rem_context(void *server, hound_context_id_t id)
 {
 	assert(server);
@@ -69,5 +69,5 @@
 	if (!ctx)
 		return EINVAL;
-	const errno_t ret = hound_remove_ctx(server, ctx);
+	const int ret = hound_remove_ctx(server, ctx);
 	if (ret == EOK) {
 		hound_ctx_destroy(ctx);
@@ -86,5 +86,5 @@
 }
 
-static errno_t iface_get_list(void *server, char ***list, size_t *size,
+static int iface_get_list(void *server, const char ***list, size_t *size,
     const char *connection, int flags)
 {
@@ -98,5 +98,5 @@
 }
 
-static errno_t iface_connect(void *server, const char *source, const char *sink)
+static int iface_connect(void *server, const char *source, const char *sink)
 {
 	log_info("%s: %p, %s -> %s", __FUNCTION__, server, source, sink);
@@ -104,5 +104,5 @@
 }
 
-static errno_t iface_disconnect(void *server, const char *source, const char *sink)
+static int iface_disconnect(void *server, const char *source, const char *sink)
 {
 	log_info("%s: %p, %s -> %s", __FUNCTION__, server, source, sink);
@@ -110,5 +110,5 @@
 }
 
-static errno_t iface_add_stream(void *server, hound_context_id_t id, int flags,
+static int iface_add_stream(void *server, hound_context_id_t id, int flags,
     pcm_format_t format, size_t size, void **data)
 {
@@ -130,5 +130,5 @@
 }
 
-static errno_t iface_rem_stream(void *server, void *stream)
+static int iface_rem_stream(void *server, void *stream)
 {
 	hound_ctx_destroy_stream(stream);
@@ -136,5 +136,5 @@
 }
 
-static errno_t iface_drain_stream(void *stream)
+static int iface_drain_stream(void *stream)
 {
 	hound_ctx_stream_drain(stream);
@@ -142,10 +142,10 @@
 }
 
-static errno_t iface_stream_data_read(void *stream, void *buffer, size_t size)
+static int iface_stream_data_read(void *stream, void *buffer, size_t size)
 {
 	return hound_ctx_stream_read(stream, buffer, size);
 }
 
-static errno_t iface_stream_data_write(void *stream, const void *buffer, size_t size)
+static int iface_stream_data_write(void *stream, const void *buffer, size_t size)
 {
 	return hound_ctx_stream_write(stream, buffer, size);
Index: uspace/srv/audio/hound/main.c
===================================================================
--- uspace/srv/audio/hound/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/audio/hound/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -57,5 +57,5 @@
 static hound_t hound;
 
-static errno_t device_callback(service_id_t id, const char *name)
+static int device_callback(service_id_t id, const char *name)
 {
 	return hound_add_device(&hound, id, name);
@@ -76,5 +76,5 @@
 	}
 
-	errno_t ret = hound_init(&hound);
+	int ret = hound_init(&hound);
 	if (ret != EOK) {
 		log_fatal("Failed to initialize hound structure: %s",
Index: uspace/srv/bd/file_bd/file_bd.c
===================================================================
--- uspace/srv/bd/file_bd/file_bd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/bd/file_bd/file_bd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,9 +48,7 @@
 #include <stdint.h>
 #include <errno.h>
-#include <str_error.h>
 #include <stdbool.h>
 #include <task.h>
 #include <macros.h>
-#include <str.h>
 
 #define NAME "file_bd"
@@ -67,13 +65,13 @@
 
 static void print_usage(void);
-static errno_t file_bd_init(const char *fname);
+static int file_bd_init(const char *fname);
 static void file_bd_connection(ipc_callid_t iid, ipc_call_t *icall, void *);
 
-static errno_t file_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t file_bd_close(bd_srv_t *);
-static errno_t file_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t file_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
-static errno_t file_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t file_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
+static int file_bd_open(bd_srvs_t *, bd_srv_t *);
+static int file_bd_close(bd_srv_t *);
+static int file_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
+static int file_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
+static int file_bd_get_block_size(bd_srv_t *, size_t *);
+static int file_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
 
 static bd_ops_t file_bd_ops = {
@@ -88,5 +86,5 @@
 int main(int argc, char **argv)
 {
-	errno_t rc;
+	int rc;
 	char *image_name;
 	char *device_name;
@@ -136,6 +134,6 @@
 	rc = loc_service_register(device_name, &service_id);
 	if (rc != EOK) {
-		printf("%s: Unable to register device '%s': %s.\n",
-		    NAME, device_name, str_error(rc));
+		printf("%s: Unable to register device '%s'.\n",
+		    NAME, device_name);
 		return rc;
 	}
@@ -143,5 +141,5 @@
 	rc = loc_category_get_id("disk", &disk_cat, IPC_FLAG_BLOCKING);
 	if (rc != EOK) {
-		printf("%s: Failed resolving category 'disk': %s\n", NAME, str_error(rc));
+		printf("%s: Failed resolving category 'disk'.\n", NAME);
 		return rc;
 	}
@@ -149,6 +147,6 @@
 	rc = loc_service_add_to_cat(service_id, disk_cat);
 	if (rc != EOK) {
-		printf("%s: Failed adding %s to category: %s",
-		    NAME, device_name, str_error(rc));
+		printf("%s: Failed adding %s to category.",
+		    NAME, device_name);
 		return rc;
 	}
@@ -167,5 +165,5 @@
 }
 
-static errno_t file_bd_init(const char *fname)
+static int file_bd_init(const char *fname)
 {
 	bd_srvs_init(&bd_srvs);
@@ -173,5 +171,5 @@
 	
 	async_set_fallback_port_handler(file_bd_connection, NULL);
-	errno_t rc = loc_server_register(NAME);
+	int rc = loc_server_register(NAME);
 	if (rc != EOK) {
 		printf("%s: Unable to register driver.\n", NAME);
@@ -207,5 +205,5 @@
 
 /** Open device. */
-static errno_t file_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
+static int file_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
 {
 	return EOK;
@@ -213,5 +211,5 @@
 
 /** Close device. */
-static errno_t file_bd_close(bd_srv_t *bd)
+static int file_bd_close(bd_srv_t *bd)
 {
 	return EOK;
@@ -219,8 +217,9 @@
 
 /** Read blocks from the device. */
-static errno_t file_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, void *buf,
+static int file_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, void *buf,
     size_t size)
 {
 	size_t n_rd;
+	int rc;
 
 	if (size < cnt * block_size)
@@ -238,5 +237,6 @@
 
 	clearerr(img);
-	if (fseek(img, ba * block_size, SEEK_SET) < 0) {
+	rc = fseek(img, ba * block_size, SEEK_SET);
+	if (rc < 0) {
 		fibril_mutex_unlock(&dev_lock);
 		return EIO;
@@ -259,8 +259,9 @@
 
 /** Write blocks to the device. */
-static errno_t file_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
+static int file_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
     const void *buf, size_t size)
 {
 	size_t n_wr;
+	int rc;
 
 	if (size < cnt * block_size)
@@ -278,5 +279,6 @@
 
 	clearerr(img);
-	if (fseek(img, ba * block_size, SEEK_SET) < 0) {
+	rc = fseek(img, ba * block_size, SEEK_SET);
+	if (rc < 0) {
 		fibril_mutex_unlock(&dev_lock);
 		return EIO;
@@ -301,5 +303,5 @@
 
 /** Get device block size. */
-static errno_t file_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
+static int file_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
 {
 	*rsize = block_size;
@@ -308,5 +310,5 @@
 
 /** Get number of blocks on device. */
-static errno_t file_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
+static int file_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
 {
 	*rnb = num_blocks;
Index: uspace/srv/bd/rd/rd.c
===================================================================
--- uspace/srv/bd/rd/rd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/bd/rd/rd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,5 +48,4 @@
 #include <stdbool.h>
 #include <errno.h>
-#include <str_error.h>
 #include <async.h>
 #include <fibril_synch.h>
@@ -67,10 +66,10 @@
 static const size_t block_size = 512;
 
-static errno_t rd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t rd_close(bd_srv_t *);
-static errno_t rd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t rd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
-static errno_t rd_get_block_size(bd_srv_t *, size_t *);
-static errno_t rd_get_num_blocks(bd_srv_t *, aoff64_t *);
+static int rd_open(bd_srvs_t *, bd_srv_t *);
+static int rd_close(bd_srv_t *);
+static int rd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
+static int rd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
+static int rd_get_block_size(bd_srv_t *, size_t *);
+static int rd_get_num_blocks(bd_srv_t *, aoff64_t *);
 
 /** This rwlock protects the ramdisk's data.
@@ -100,5 +99,5 @@
 
 /** Open device. */
-static errno_t rd_open(bd_srvs_t *bds, bd_srv_t *bd)
+static int rd_open(bd_srvs_t *bds, bd_srv_t *bd)
 {
 	return EOK;
@@ -106,5 +105,5 @@
 
 /** Close device. */
-static errno_t rd_close(bd_srv_t *bd)
+static int rd_close(bd_srv_t *bd)
 {
 	return EOK;
@@ -112,5 +111,5 @@
 
 /** Read blocks from the device. */
-static errno_t rd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
+static int rd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
     size_t size)
 {
@@ -128,5 +127,5 @@
 
 /** Write blocks to the device. */
-static errno_t rd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
+static int rd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
     const void *buf, size_t size)
 {
@@ -147,5 +146,5 @@
 {
 	sysarg_t size;
-	errno_t ret = sysinfo_get_value("rd.size", &size);
+	int ret = sysinfo_get_value("rd.size", &size);
 	if ((ret != EOK) || (size == 0)) {
 		printf("%s: No RAM disk found\n", NAME);
@@ -180,5 +179,5 @@
 	ret = loc_server_register(NAME);
 	if (ret != EOK) {
-		printf("%s: Unable to register driver: %s\n", NAME, str_error(ret));
+		printf("%s: Unable to register driver (%d)\n", NAME, ret);
 		return false;
 	}
@@ -197,5 +196,5 @@
 
 /** Get device block size. */
-static errno_t rd_get_block_size(bd_srv_t *bd, size_t *rsize)
+static int rd_get_block_size(bd_srv_t *bd, size_t *rsize)
 {
 	*rsize = block_size;
@@ -204,5 +203,5 @@
 
 /** Get number of blocks on device. */
-static errno_t rd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
+static int rd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
 {
 	*rnb = rd_size / block_size;
Index: uspace/srv/bd/sata_bd/sata_bd.c
===================================================================
--- uspace/srv/bd/sata_bd/sata_bd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/bd/sata_bd/sata_bd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,4 @@
 #include <devman.h>
 #include <errno.h>
-#include <str_error.h>
 #include <stdio.h>
 #include <str.h>
@@ -60,10 +59,10 @@
 static int disk_count;
 
-static errno_t sata_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t sata_bd_close(bd_srv_t *);
-static errno_t sata_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t sata_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
-static errno_t sata_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t sata_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
+static int sata_bd_open(bd_srvs_t *, bd_srv_t *);
+static int sata_bd_close(bd_srv_t *);
+static int sata_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
+static int sata_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
+static int sata_bd_get_block_size(bd_srv_t *, size_t *);
+static int sata_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
 
 static bd_ops_t sata_bd_ops = {
@@ -88,10 +87,10 @@
  *
  */
-static errno_t scan_device_tree(devman_handle_t funh)
+static int scan_device_tree(devman_handle_t funh)
 {
 	devman_handle_t devh;
 	devman_handle_t *cfuns;
 	size_t count, i;
-	errno_t rc;
+	int rc;
 		
 	/* If device is SATA, add device to the disk array. */
@@ -148,8 +147,8 @@
  *
  */
-static errno_t get_sata_disks(void)
+static int get_sata_disks(void)
 {
 	devman_handle_t root_fun;
-	errno_t rc;
+	int rc;
 	
 	disk_count = 0;
@@ -190,5 +189,5 @@
 
 /** Open device. */
-static errno_t sata_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
+static int sata_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
 {
 	return EOK;
@@ -196,5 +195,5 @@
 
 /** Close device. */
-static errno_t sata_bd_close(bd_srv_t *bd)
+static int sata_bd_close(bd_srv_t *bd)
 {
 	return EOK;
@@ -202,5 +201,5 @@
 
 /** Read blocks from partition. */
-static errno_t sata_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
+static int sata_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
     size_t size)
 {
@@ -214,5 +213,5 @@
 
 /** Write blocks to partition. */
-static errno_t sata_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
+static int sata_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
     const void *buf, size_t size)
 {
@@ -226,5 +225,5 @@
 
 /** Get device block size. */
-static errno_t sata_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
+static int sata_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
 {
 	sata_bd_dev_t *sbd = bd_srv_sata(bd);
@@ -235,5 +234,5 @@
 
 /** Get number of blocks on device. */
-static errno_t sata_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
+static int sata_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
 {
 	sata_bd_dev_t *sbd = bd_srv_sata(bd);
@@ -246,11 +245,11 @@
 int main(int argc, char **argv)
 {
-	errno_t rc;
+	int rc;
 	category_id_t disk_cat;
 	
 	async_set_fallback_port_handler(sata_bd_connection, NULL);
 	rc = loc_server_register(NAME);
-	if (rc != EOK) {
-		printf(NAME ": Unable to register driver: %s.\n", str_error(rc));
+	if (rc < 0) {
+		printf(NAME ": Unable to register driver.\n");
 		return rc;
 	}
@@ -258,5 +257,4 @@
 	rc = get_sata_disks();
 	if (rc != EOK) {
-		// TODO: log the error
 		return rc;
 	}
@@ -264,5 +262,5 @@
 	rc = loc_category_get_id("disk", &disk_cat, IPC_FLAG_BLOCKING);
 	if (rc != EOK) {
-		printf("%s: Failed resolving category 'disk': %s.\n", NAME, str_error(rc));
+		printf("%s: Failed resolving category 'disk'.\n", NAME);
 		return rc;
 	}
@@ -273,5 +271,5 @@
 		rc = loc_service_register(name, &disk[i].service_id);
 		if (rc != EOK) {
-			printf(NAME ": Unable to register device %s: %s\n", name, str_error(rc));
+			printf(NAME ": Unable to register device %s.\n", name);
 			return rc;
 		}
@@ -279,6 +277,6 @@
 		rc = loc_service_add_to_cat(disk[i].service_id, disk_cat);
 		if (rc != EOK) {
-			printf("%s: Failed adding %s to category: %s.",
-			    NAME, disk[i].dev_name, str_error(rc));
+			printf("%s: Failed adding %s to category.",
+			    NAME, disk[i].dev_name);
 			return rc;
 		}
Index: uspace/srv/bd/vbd/disk.c
===================================================================
--- uspace/srv/bd/vbd/disk.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/bd/vbd/disk.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,4 @@
 #include <block.h>
 #include <errno.h>
-#include <str_error.h>
 #include <io/log.h>
 #include <label/empty.h>
@@ -58,28 +57,28 @@
 static category_id_t part_cid;
 
-static errno_t vbds_disk_parts_add(vbds_disk_t *, label_t *);
-static errno_t vbds_disk_parts_remove(vbds_disk_t *, vbds_rem_flag_t);
-
-static errno_t vbds_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t vbds_bd_close(bd_srv_t *);
-static errno_t vbds_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t vbds_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
-static errno_t vbds_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *,
+static int vbds_disk_parts_add(vbds_disk_t *, label_t *);
+static int vbds_disk_parts_remove(vbds_disk_t *, vbds_rem_flag_t);
+
+static int vbds_bd_open(bd_srvs_t *, bd_srv_t *);
+static int vbds_bd_close(bd_srv_t *);
+static int vbds_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
+static int vbds_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
+static int vbds_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *,
     size_t);
-static errno_t vbds_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t vbds_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
-
-static errno_t vbds_bsa_translate(vbds_part_t *, aoff64_t, size_t, aoff64_t *);
-
-static errno_t vbds_part_svc_register(vbds_part_t *);
-static errno_t vbds_part_svc_unregister(vbds_part_t *);
-static errno_t vbds_part_indices_update(vbds_disk_t *);
+static int vbds_bd_get_block_size(bd_srv_t *, size_t *);
+static int vbds_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
+
+static int vbds_bsa_translate(vbds_part_t *, aoff64_t, size_t, aoff64_t *);
+
+static int vbds_part_svc_register(vbds_part_t *);
+static int vbds_part_svc_unregister(vbds_part_t *);
+static int vbds_part_indices_update(vbds_disk_t *);
 
 static vbd_part_id_t vbds_part_id = 1;
 
-static errno_t vbds_label_get_bsize(void *, size_t *);
-static errno_t vbds_label_get_nblocks(void *, aoff64_t *);
-static errno_t vbds_label_read(void *, aoff64_t, size_t, void *);
-static errno_t vbds_label_write(void *, aoff64_t, size_t, const void *);
+static int vbds_label_get_bsize(void *, size_t *);
+static int vbds_label_get_nblocks(void *, aoff64_t *);
+static int vbds_label_read(void *, aoff64_t, size_t, void *);
+static int vbds_label_write(void *, aoff64_t, size_t, const void *);
 
 /** Block device operations provided by VBD */
@@ -132,7 +131,7 @@
 }
 
-errno_t vbds_disks_init(void)
-{
-	errno_t rc;
+int vbds_disks_init(void)
+{
+	int rc;
 
 	fibril_mutex_initialize(&vbds_disks_lock);
@@ -152,5 +151,5 @@
 
 /** Check for new/removed disk devices */
-static errno_t vbds_disks_check_new(void)
+static int vbds_disks_check_new(void)
 {
 	bool already_known;
@@ -159,5 +158,5 @@
 	size_t count, i;
 	vbds_disk_t *cur, *next;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disks_check_new()");
@@ -229,5 +228,5 @@
 
 
-static errno_t vbds_disk_by_svcid(service_id_t sid, vbds_disk_t **rdisk)
+static int vbds_disk_by_svcid(service_id_t sid, vbds_disk_t **rdisk)
 {
 	list_foreach(vbds_disks, ldisks, vbds_disk_t, disk) {
@@ -256,5 +255,5 @@
 }
 
-static errno_t vbds_part_by_pid(vbds_part_id_t partid, vbds_part_t **rpart)
+static int vbds_part_by_pid(vbds_part_id_t partid, vbds_part_t **rpart)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_by_pid(%zu)", partid);
@@ -278,5 +277,5 @@
 }
 
-static errno_t vbds_part_by_svcid(service_id_t svcid, vbds_part_t **rpart)
+static int vbds_part_by_svcid(service_id_t svcid, vbds_part_t **rpart)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_by_svcid(%zu)", svcid);
@@ -301,5 +300,5 @@
 
 /** Add partition to our inventory based on liblabel partition structure */
-static errno_t vbds_part_add(vbds_disk_t *disk, label_part_t *lpart,
+static int vbds_part_add(vbds_disk_t *disk, label_part_t *lpart,
     vbds_part_t **rpart)
 {
@@ -307,5 +306,5 @@
 	service_id_t psid = 0;
 	label_part_info_t lpinfo;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_add(%s, %p)",
@@ -362,9 +361,9 @@
  *
  */
-static errno_t vbds_part_remove(vbds_part_t *part, vbds_rem_flag_t flag,
+static int vbds_part_remove(vbds_part_t *part, vbds_rem_flag_t flag,
     label_part_t **rlpart)
 {
 	label_part_t *lpart;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_remove(%p)", part);
@@ -404,8 +403,8 @@
 /** Remove all disk partitions from our inventory leaving only the underlying
  * liblabel partition structures. */
-static errno_t vbds_disk_parts_add(vbds_disk_t *disk, label_t *label)
+static int vbds_disk_parts_add(vbds_disk_t *disk, label_t *label)
 {
 	label_part_t *part;
-	errno_t rc;
+	int rc;
 
 	part = label_part_first(label);
@@ -426,9 +425,9 @@
 /** Remove all disk partitions from our inventory leaving only the underlying
  * liblabel partition structures. */
-static errno_t vbds_disk_parts_remove(vbds_disk_t *disk, vbds_rem_flag_t flag)
+static int vbds_disk_parts_remove(vbds_disk_t *disk, vbds_rem_flag_t flag)
 {
 	link_t *link;
 	vbds_part_t *part;
-	errno_t rc;
+	int rc;
 
 	link = list_first(&disk->parts);
@@ -450,12 +449,12 @@
 }
 
-errno_t vbds_disk_discovery_start(void)
-{
-	errno_t rc;
+int vbds_disk_discovery_start(void)
+{
+	int rc;
 
 	rc = loc_register_cat_change_cb(vbds_disk_cat_change_cb);
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback "
-		    "for disk discovery: %s.", str_error(rc));
+		    "for disk discovery (%d).", rc);
 		return rc;
 	}
@@ -464,5 +463,5 @@
 }
 
-errno_t vbds_disk_add(service_id_t sid)
+int vbds_disk_add(service_id_t sid)
 {
 	label_t *label = NULL;
@@ -472,5 +471,5 @@
 	size_t block_size;
 	aoff64_t nblocks;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_add(%zu)", sid);
@@ -557,8 +556,8 @@
 }
 
-errno_t vbds_disk_remove(service_id_t sid)
+int vbds_disk_remove(service_id_t sid)
 {
 	vbds_disk_t *disk;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_remove(%zu)", sid);
@@ -583,5 +582,5 @@
 
 /** Get list of disks as array of service IDs. */
-errno_t vbds_disk_get_ids(service_id_t *id_buf, size_t buf_size, size_t *act_size)
+int vbds_disk_get_ids(service_id_t *id_buf, size_t buf_size, size_t *act_size)
 {
 	size_t act_cnt;
@@ -611,9 +610,9 @@
 }
 
-errno_t vbds_disk_info(service_id_t sid, vbd_disk_info_t *info)
+int vbds_disk_info(service_id_t sid, vbd_disk_info_t *info)
 {
 	vbds_disk_t *disk;
 	label_info_t linfo;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_info(%zu)", sid);
@@ -638,5 +637,5 @@
 }
 
-errno_t vbds_get_parts(service_id_t sid, service_id_t *id_buf, size_t buf_size,
+int vbds_get_parts(service_id_t sid, service_id_t *id_buf, size_t buf_size,
     size_t *act_size)
 {
@@ -644,5 +643,5 @@
 	size_t act_cnt;
 	size_t buf_cnt;
-	errno_t rc;
+	int rc;
 
 	rc = vbds_disk_by_svcid(sid, &disk);
@@ -668,5 +667,5 @@
 }
 
-errno_t vbds_label_create(service_id_t sid, label_type_t ltype)
+int vbds_label_create(service_id_t sid, label_type_t ltype)
 {
 	label_t *label;
@@ -674,5 +673,5 @@
 	label_info_t linfo;
 	vbds_disk_t *disk;
-	errno_t rc, rc2;
+	int rc, rc2;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_create(%zu)", sid);
@@ -739,10 +738,10 @@
 }
 
-errno_t vbds_label_delete(service_id_t sid)
+int vbds_label_delete(service_id_t sid)
 {
 	vbds_disk_t *disk;
 	label_t *label;
 	label_bd_t lbd;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_delete(%zu)", sid);
@@ -781,9 +780,9 @@
 }
 
-errno_t vbds_part_get_info(vbds_part_id_t partid, vbd_part_info_t *pinfo)
+int vbds_part_get_info(vbds_part_id_t partid, vbd_part_info_t *pinfo)
 {
 	vbds_part_t *part;
 	label_part_info_t lpinfo;
-	errno_t rc;
+	int rc;
 
 	rc = vbds_part_by_pid(partid, &part);
@@ -810,5 +809,5 @@
 }
 
-errno_t vbds_part_create(service_id_t sid, vbd_part_spec_t *pspec,
+int vbds_part_create(service_id_t sid, vbd_part_spec_t *pspec,
     vbds_part_id_t *rpart)
 {
@@ -817,5 +816,5 @@
 	label_part_spec_t lpspec;
 	label_part_t *lpart;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_create(%zu)", sid);
@@ -879,10 +878,10 @@
 }
 
-errno_t vbds_part_delete(vbds_part_id_t partid)
+int vbds_part_delete(vbds_part_id_t partid)
 {
 	vbds_part_t *part;
 	vbds_disk_t *disk;
 	label_part_t *lpart;
-	errno_t rc;
+	int rc;
 
 	rc = vbds_part_by_pid(partid, &part);
@@ -918,9 +917,9 @@
 }
 
-errno_t vbds_suggest_ptype(service_id_t sid, label_pcnt_t pcnt,
+int vbds_suggest_ptype(service_id_t sid, label_pcnt_t pcnt,
     label_ptype_t *ptype)
 {
 	vbds_disk_t *disk;
-	errno_t rc;
+	int rc;
 
 	rc = vbds_disk_by_svcid(sid, &disk);
@@ -942,5 +941,5 @@
 }
 
-static errno_t vbds_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
+static int vbds_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
 {
 	vbds_part_t *part = bd_srv_part(bd);
@@ -953,5 +952,5 @@
 }
 
-static errno_t vbds_bd_close(bd_srv_t *bd)
+static int vbds_bd_close(bd_srv_t *bd)
 {
 	vbds_part_t *part = bd_srv_part(bd);
@@ -967,10 +966,10 @@
 }
 
-static errno_t vbds_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
+static int vbds_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
     void *buf, size_t size)
 {
 	vbds_part_t *part = bd_srv_part(bd);
 	aoff64_t gba;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_read_blocks()");
@@ -993,9 +992,9 @@
 }
 
-static errno_t vbds_bd_sync_cache(bd_srv_t *bd, aoff64_t ba, size_t cnt)
+static int vbds_bd_sync_cache(bd_srv_t *bd, aoff64_t ba, size_t cnt)
 {
 	vbds_part_t *part = bd_srv_part(bd);
 	aoff64_t gba;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_sync_cache()");
@@ -1017,10 +1016,10 @@
 }
 
-static errno_t vbds_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
+static int vbds_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
     const void *buf, size_t size)
 {
 	vbds_part_t *part = bd_srv_part(bd);
 	aoff64_t gba;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_write_blocks()");
@@ -1042,5 +1041,5 @@
 }
 
-static errno_t vbds_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
+static int vbds_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
 {
 	vbds_part_t *part = bd_srv_part(bd);
@@ -1055,5 +1054,5 @@
 }
 
-static errno_t vbds_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
+static int vbds_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
 {
 	vbds_part_t *part = bd_srv_part(bd);
@@ -1071,5 +1070,5 @@
 {
 	vbds_part_t *part;
-	errno_t rc;
+	int rc;
 	service_id_t svcid;
 
@@ -1094,5 +1093,5 @@
 
 /** Translate block segment address with range checking. */
-static errno_t vbds_bsa_translate(vbds_part_t *part, aoff64_t ba, size_t cnt,
+static int vbds_bsa_translate(vbds_part_t *part, aoff64_t ba, size_t cnt,
     aoff64_t *gba)
 {
@@ -1105,14 +1104,15 @@
 
 /** Register service for partition */
-static errno_t vbds_part_svc_register(vbds_part_t *part)
+static int vbds_part_svc_register(vbds_part_t *part)
 {
 	char *name;
 	service_id_t psid;
 	int idx;
-	errno_t rc;
+	int rc;
 
 	idx = part->lpart->index;
 
-	if (asprintf(&name, "%sp%u", part->disk->svc_name, idx) < 0) {
+	rc = asprintf(&name, "%sp%u", part->disk->svc_name, idx);
+	if (rc < 0) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Out of memory.");
 		return ENOMEM;
@@ -1124,5 +1124,5 @@
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering "
-		    "service %s: %s.", name, str_error(rc));
+		    "service %s (%d).", name, rc);
 		free(name);
 		free(part);
@@ -1152,7 +1152,7 @@
 
 /** Unregister service for partition */
-static errno_t vbds_part_svc_unregister(vbds_part_t *part)
-{
-	errno_t rc;
+static int vbds_part_svc_unregister(vbds_part_t *part)
+{
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_svc_unregister("
@@ -1169,8 +1169,8 @@
 
 /** Update service names for any partition whose index has changed. */
-static errno_t vbds_part_indices_update(vbds_disk_t *disk)
+static int vbds_part_indices_update(vbds_disk_t *disk)
 {
 	label_part_info_t lpinfo;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_indices_update()");
@@ -1219,5 +1219,5 @@
 
 /** Get block size wrapper for liblabel */
-static errno_t vbds_label_get_bsize(void *arg, size_t *bsize)
+static int vbds_label_get_bsize(void *arg, size_t *bsize)
 {
 	vbds_disk_t *disk = (vbds_disk_t *)arg;
@@ -1226,5 +1226,5 @@
 
 /** Get number of blocks wrapper for liblabel */
-static errno_t vbds_label_get_nblocks(void *arg, aoff64_t *nblocks)
+static int vbds_label_get_nblocks(void *arg, aoff64_t *nblocks)
 {
 	vbds_disk_t *disk = (vbds_disk_t *)arg;
@@ -1233,5 +1233,5 @@
 
 /** Read blocks wrapper for liblabel */
-static errno_t vbds_label_read(void *arg, aoff64_t ba, size_t cnt, void *buf)
+static int vbds_label_read(void *arg, aoff64_t ba, size_t cnt, void *buf)
 {
 	vbds_disk_t *disk = (vbds_disk_t *)arg;
@@ -1240,5 +1240,5 @@
 
 /** Write blocks wrapper for liblabel */
-static errno_t vbds_label_write(void *arg, aoff64_t ba, size_t cnt, const void *data)
+static int vbds_label_write(void *arg, aoff64_t ba, size_t cnt, const void *data)
 {
 	vbds_disk_t *disk = (vbds_disk_t *)arg;
Index: uspace/srv/bd/vbd/disk.h
===================================================================
--- uspace/srv/bd/vbd/disk.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/bd/vbd/disk.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,17 +42,17 @@
 #include <vbd.h>
 
-extern errno_t vbds_disks_init(void);
-extern errno_t vbds_disk_discovery_start(void);
-extern errno_t vbds_disk_add(service_id_t);
-extern errno_t vbds_disk_remove(service_id_t);
-extern errno_t vbds_disk_get_ids(service_id_t *, size_t, size_t *);
-extern errno_t vbds_disk_info(service_id_t, vbd_disk_info_t *);
-extern errno_t vbds_get_parts(service_id_t, service_id_t *, size_t, size_t *);
-extern errno_t vbds_label_create(service_id_t, label_type_t);
-extern errno_t vbds_label_delete(service_id_t);
-extern errno_t vbds_part_get_info(vbds_part_id_t, vbd_part_info_t *);
-extern errno_t vbds_part_create(service_id_t, vbd_part_spec_t *, vbds_part_id_t *);
-extern errno_t vbds_part_delete(vbds_part_id_t);
-extern errno_t vbds_suggest_ptype(service_id_t, label_pcnt_t, label_ptype_t *);
+extern int vbds_disks_init(void);
+extern int vbds_disk_discovery_start(void);
+extern int vbds_disk_add(service_id_t);
+extern int vbds_disk_remove(service_id_t);
+extern int vbds_disk_get_ids(service_id_t *, size_t, size_t *);
+extern int vbds_disk_info(service_id_t, vbd_disk_info_t *);
+extern int vbds_get_parts(service_id_t, service_id_t *, size_t, size_t *);
+extern int vbds_label_create(service_id_t, label_type_t);
+extern int vbds_label_delete(service_id_t);
+extern int vbds_part_get_info(vbds_part_id_t, vbd_part_info_t *);
+extern int vbds_part_create(service_id_t, vbd_part_spec_t *,vbds_part_id_t *);
+extern int vbds_part_delete(vbds_part_id_t);
+extern int vbds_suggest_ptype(service_id_t, label_pcnt_t, label_ptype_t *);
 extern void vbds_bd_conn(ipc_callid_t, ipc_call_t *, void *);
 
Index: uspace/srv/bd/vbd/vbd.c
===================================================================
--- uspace/srv/bd/vbd/vbd.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/bd/vbd/vbd.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <io/log.h>
 #include <ipc/services.h>
@@ -57,7 +56,7 @@
 static service_id_t ctl_sid;
 
-static errno_t vbds_init(void)
-{
-	errno_t rc;
+static int vbds_init(void)
+{
+	int rc;
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_init()");
 
@@ -70,5 +69,5 @@
 	rc = loc_server_register(NAME);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server (%d).", rc);
 		return EEXIST;
 	}
@@ -76,5 +75,5 @@
 	rc = loc_service_register(SERVICE_NAME_VBD, &ctl_sid);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
 		return EEXIST;
 	}
@@ -92,5 +91,5 @@
 	size_t size;
 	size_t act_size;
-	errno_t rc;
+	int rc;
 
 	if (!async_data_read_receive(&callid, &size)) {
@@ -115,5 +114,5 @@
 	}
 
-	errno_t retval = async_data_read_finalize(callid, id_buf, size);
+	sysarg_t retval = async_data_read_finalize(callid, id_buf, size);
 	free(id_buf);
 
@@ -125,5 +124,5 @@
 	service_id_t disk_sid;
 	vbd_disk_info_t dinfo;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_info_srv()");
@@ -165,5 +164,5 @@
 	service_id_t disk_sid;
 	label_type_t ltype;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_create_srv()");
@@ -172,5 +171,5 @@
 	ltype = IPC_GET_ARG2(*icall);
 	rc = vbds_label_create(disk_sid, ltype);
-	async_answer_0(iid, rc);
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -178,5 +177,5 @@
 {
 	service_id_t disk_sid;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_delete_srv()");
@@ -184,5 +183,5 @@
 	disk_sid = IPC_GET_ARG1(*icall);
 	rc = vbds_label_delete(disk_sid);
-	async_answer_0(iid, rc);
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -193,5 +192,5 @@
 	size_t act_size;
 	service_id_t sid;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_get_parts_srv()");
@@ -219,5 +218,5 @@
 	}
 
-	errno_t retval = async_data_read_finalize(callid, id_buf, size);
+	sysarg_t retval = async_data_read_finalize(callid, id_buf, size);
 	free(id_buf);
 
@@ -229,5 +228,5 @@
 	vbds_part_id_t part;
 	vbd_part_info_t pinfo;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_get_info_srv()");
@@ -270,5 +269,5 @@
 	vbd_part_spec_t pspec;
 	vbds_part_id_t part;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_create_srv()");
@@ -303,5 +302,5 @@
 	}
 
-	async_answer_1(iid, rc, (sysarg_t)part);
+	async_answer_1(iid, (sysarg_t)rc, (sysarg_t)part);
 }
 
@@ -309,5 +308,5 @@
 {
 	vbds_part_id_t part;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_delete_srv()");
@@ -315,5 +314,5 @@
 	part = IPC_GET_ARG1(*icall);
 	rc = vbds_part_delete(part);
-	async_answer_0(iid, rc);
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -323,5 +322,5 @@
 	label_ptype_t ptype;
 	label_pcnt_t pcnt;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_suggest_ptype_srv()");
@@ -428,5 +427,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf("%s: Virtual Block Device service\n", NAME);
Index: uspace/srv/clipboard/clipboard.c
===================================================================
--- uspace/srv/clipboard/clipboard.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/clipboard/clipboard.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -29,5 +29,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <fibril_synch.h>
 #include <ipc/services.h>
@@ -50,5 +49,5 @@
 {
 	char *data;
-	errno_t rc;
+	int rc;
 	size_t size;
 	
@@ -121,5 +120,5 @@
 		}
 		
-		errno_t retval = async_data_read_finalize(callid, clip_data, size);
+		sysarg_t retval = async_data_read_finalize(callid, clip_data, size);
 		if (retval != EOK) {
 			async_answer_0(rid, retval);
@@ -182,5 +181,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 	
 	printf("%s: HelenOS clipboard service\n", NAME);
@@ -189,5 +188,5 @@
 	rc = loc_server_register(NAME);
 	if (rc != EOK) {
-		printf("%s: Failed registering server: %s\n", NAME, str_error(rc));
+		printf("%s: Failed registering server. (%d)\n", NAME, rc);
 		return rc;
 	}
@@ -195,5 +194,5 @@
 	rc = loc_service_register(SERVICE_NAME_CLIPBOARD, &svc_id);
 	if (rc != EOK) {
-		printf("%s: Failed registering service : %s\n", NAME, str_error(rc));
+		printf("%s: Failed registering service. (%d)\n", NAME, rc);
 		return rc;
 	}
Index: uspace/srv/devman/client_conn.c
===================================================================
--- uspace/srv/devman/client_conn.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/client_conn.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -66,5 +66,5 @@
 	devman_handle_t handle;
 	
-	errno_t rc = async_data_write_accept((void **) &pathname, true, 0, 0, 0, 0);
+	int rc = async_data_write_accept((void **) &pathname, true, 0, 0, 0, 0);
 	if (rc != EOK) {
 		async_answer_0(iid, rc);
@@ -363,5 +363,5 @@
 	size_t size;
 	size_t act_size;
-	errno_t rc;
+	int rc;
 	
 	if (!async_data_read_receive(&callid, &size)) {
@@ -400,5 +400,5 @@
 	fibril_rwlock_read_unlock(&device_tree.rwlock);
 	
-	errno_t retval = async_data_read_finalize(callid, hdl_buf, size);
+	sysarg_t retval = async_data_read_finalize(callid, hdl_buf, size);
 	free(hdl_buf);
 	
@@ -440,5 +440,5 @@
 {
 	fun_node_t *fun;
-	errno_t rc;
+	int rc;
 
 	fun = find_fun_node(&device_tree, IPC_GET_ARG1(*icall));
@@ -451,5 +451,5 @@
 	fun_del_ref(fun);
 	
-	async_answer_0(iid, rc);
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -465,5 +465,5 @@
 {
 	fun_node_t *fun;
-	errno_t rc;
+	int rc;
 
 	fun = find_fun_node(&device_tree, IPC_GET_ARG1(*icall));
@@ -476,5 +476,5 @@
 	fun_del_ref(fun);
 	
-	async_answer_0(iid, rc);
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -511,5 +511,5 @@
 	size_t size;
 	size_t act_size;
-	errno_t rc;
+	int rc;
 	
 	if (!async_data_read_receive(&callid, &size)) {
@@ -532,5 +532,5 @@
 	}
 	
-	errno_t retval = async_data_read_finalize(callid, hdl_buf, size);
+	sysarg_t retval = async_data_read_finalize(callid, hdl_buf, size);
 	free(hdl_buf);
 	
@@ -543,5 +543,5 @@
 	size_t size;
 	size_t act_size;
-	errno_t rc;
+	int rc;
 	
 	if (!async_data_read_receive(&callid, &size)) {
@@ -572,5 +572,5 @@
 	}
 	
-	errno_t retval = async_data_read_finalize(callid, hdl_buf, size);
+	sysarg_t retval = async_data_read_finalize(callid, hdl_buf, size);
 	free(hdl_buf);
 	
@@ -584,5 +584,5 @@
 	char *drvname;
 	
-	errno_t rc = async_data_write_accept((void **) &drvname, true, 0, 0, 0, 0);
+	int rc = async_data_write_accept((void **) &drvname, true, 0, 0, 0, 0);
 	if (rc != EOK) {
 		async_answer_0(iid, rc);
@@ -711,5 +711,5 @@
 {
 	driver_t *drv;
-	errno_t rc;
+	int rc;
 	
 	drv = driver_find(&drivers_list, IPC_GET_ARG1(*icall));
@@ -730,5 +730,5 @@
 {
 	driver_t *drv;
-	errno_t rc;
+	int rc;
 	
 	drv = driver_find(&drivers_list, IPC_GET_ARG1(*icall));
Index: uspace/srv/devman/dev.c
===================================================================
--- uspace/srv/devman/dev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/dev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -127,5 +127,5 @@
 
 /** Get list of device functions. */
-errno_t dev_get_functions(dev_tree_t *tree, dev_node_t *dev,
+int dev_get_functions(dev_tree_t *tree, dev_node_t *dev,
     devman_handle_t *hdl_buf, size_t buf_size, size_t *act_size)
 {
Index: uspace/srv/devman/dev.h
===================================================================
--- uspace/srv/devman/dev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/dev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,5 @@
     devman_handle_t handle);
 extern dev_node_t *find_dev_node(dev_tree_t *tree, devman_handle_t handle);
-extern errno_t dev_get_functions(dev_tree_t *tree, dev_node_t *, devman_handle_t *,
+extern int dev_get_functions(dev_tree_t *tree, dev_node_t *, devman_handle_t *,
     size_t, size_t *);
 
Index: uspace/srv/devman/devman.h
===================================================================
--- uspace/srv/devman/devman.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/devman.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -80,5 +80,5 @@
 	char *name;
 	/** Path to the driver's binary. */
-	char *binary_path;
+	const char *binary_path;
 	/** List of device ids for device-to-driver matching. */
 	match_id_list_t match_ids;
Index: uspace/srv/devman/devtree.c
===================================================================
--- uspace/srv/devman/devtree.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/devtree.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -198,5 +198,5 @@
 	dev_node_t *rdev = tree->root_node->child;
 	dev_add_ref(rdev);
-	bool rc = assign_driver(rdev, drivers_list, tree);
+	int rc = assign_driver(rdev, drivers_list, tree);
 	dev_del_ref(rdev);
 	
Index: uspace/srv/devman/driver.c
===================================================================
--- uspace/srv/devman/driver.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/driver.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -140,5 +140,5 @@
 	
 	/* Check whether the driver's binary exists. */
-	vfs_stat_t s;
+	struct stat s;
 	if (vfs_stat_path(drv->binary_path, &s) != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Driver not found at path `%s'.",
@@ -283,5 +283,5 @@
 bool start_driver(driver_t *drv)
 {
-	errno_t rc;
+	int rc;
 
 	assert(fibril_mutex_is_locked(&drv->driver_mutex));
@@ -306,8 +306,8 @@
  *			otherwise.
  */
-errno_t stop_driver(driver_t *drv)
+int stop_driver(driver_t *drv)
 {
 	async_exch_t *exch;
-	errno_t retval;
+	sysarg_t retval;
 	
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "stop_driver(drv=\"%s\")", drv->name);
@@ -591,5 +591,5 @@
 	
 	/* Send the device name to the driver. */
-	errno_t rc = async_data_write_start(exch, dev->pfun->name,
+	sysarg_t rc = async_data_write_start(exch, dev->pfun->name,
 	    str_size(dev->pfun->name) + 1);
 	
@@ -618,8 +618,8 @@
 }
 
-errno_t driver_dev_remove(dev_tree_t *tree, dev_node_t *dev)
+int driver_dev_remove(dev_tree_t *tree, dev_node_t *dev)
 {
 	async_exch_t *exch;
-	errno_t retval;
+	sysarg_t retval;
 	driver_t *drv;
 	devman_handle_t handle;
@@ -641,8 +641,8 @@
 }
 
-errno_t driver_dev_gone(dev_tree_t *tree, dev_node_t *dev)
+int driver_dev_gone(dev_tree_t *tree, dev_node_t *dev)
 {
 	async_exch_t *exch;
-	errno_t retval;
+	sysarg_t retval;
 	driver_t *drv;
 	devman_handle_t handle;
@@ -664,8 +664,8 @@
 }
 
-errno_t driver_fun_online(dev_tree_t *tree, fun_node_t *fun)
+int driver_fun_online(dev_tree_t *tree, fun_node_t *fun)
 {
 	async_exch_t *exch;
-	errno_t retval;
+	sysarg_t retval;
 	driver_t *drv;
 	devman_handle_t handle;
@@ -692,8 +692,8 @@
 }
 
-errno_t driver_fun_offline(dev_tree_t *tree, fun_node_t *fun)
+int driver_fun_offline(dev_tree_t *tree, fun_node_t *fun)
 {
 	async_exch_t *exch;
-	errno_t retval;
+	sysarg_t retval;
 	driver_t *drv;
 	devman_handle_t handle;
@@ -721,5 +721,5 @@
 
 /** Get list of registered drivers. */
-errno_t driver_get_list(driver_list_t *driver_list, devman_handle_t *hdl_buf,
+int driver_get_list(driver_list_t *driver_list, devman_handle_t *hdl_buf,
     size_t buf_size, size_t *act_size)
 {
@@ -753,5 +753,5 @@
 
 /** Get list of device functions. */
-errno_t driver_get_devices(driver_t *driver, devman_handle_t *hdl_buf,
+int driver_get_devices(driver_t *driver, devman_handle_t *hdl_buf,
     size_t buf_size, size_t *act_size)
 {
Index: uspace/srv/devman/driver.h
===================================================================
--- uspace/srv/devman/driver.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/driver.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,10 +50,10 @@
 extern void detach_driver(dev_tree_t *, dev_node_t *);
 extern bool start_driver(driver_t *);
-extern errno_t stop_driver(driver_t *);
+extern int stop_driver(driver_t *);
 extern void add_device(driver_t *, dev_node_t *, dev_tree_t *);
-extern errno_t driver_dev_remove(dev_tree_t *, dev_node_t *);
-extern errno_t driver_dev_gone(dev_tree_t *, dev_node_t *);
-extern errno_t driver_fun_online(dev_tree_t *, fun_node_t *);
-extern errno_t driver_fun_offline(dev_tree_t *, fun_node_t *);
+extern int driver_dev_remove(dev_tree_t *, dev_node_t *);
+extern int driver_dev_gone(dev_tree_t *, dev_node_t *);
+extern int driver_fun_online(dev_tree_t *, fun_node_t *);
+extern int driver_fun_offline(dev_tree_t *, fun_node_t *);
 
 extern driver_t *driver_find(driver_list_t *, devman_handle_t);
@@ -64,6 +64,6 @@
 extern void clean_driver(driver_t *);
 extern void delete_driver(driver_t *);
-extern errno_t driver_get_list(driver_list_t *, devman_handle_t *, size_t, size_t *);
-extern errno_t driver_get_devices(driver_t *, devman_handle_t *, size_t, size_t *);
+extern int driver_get_list(driver_list_t *, devman_handle_t *, size_t, size_t *);
+extern int driver_get_devices(driver_t *, devman_handle_t *, size_t, size_t *);
 
 #endif
Index: uspace/srv/devman/drv_conn.c
===================================================================
--- uspace/srv/devman/drv_conn.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/drv_conn.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,5 +61,5 @@
 #include "main.h"
 
-static errno_t init_running_drv(void *drv);
+static int init_running_drv(void *drv);
 
 /** Register running driver. */
@@ -72,5 +72,5 @@
 	
 	/* Get driver name. */
-	errno_t rc = async_data_write_accept((void **) &drv_name, true, 0, 0, 0, 0);
+	int rc = async_data_write_accept((void **) &drv_name, true, 0, 0, 0, 0);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
@@ -161,12 +161,12 @@
  *
  * @param match_ids	The list of the device's match ids.
- * @return		Zero on success, error code otherwise.
- */
-static errno_t devman_receive_match_id(match_id_list_t *match_ids)
+ * @return		Zero on success, negative error code otherwise.
+ */
+static int devman_receive_match_id(match_id_list_t *match_ids)
 {
 	match_id_t *match_id = create_match_id();
 	ipc_callid_t callid;
 	ipc_call_t call;
-	errno_t rc = 0;
+	int rc = 0;
 	
 	callid = async_get_call(&call);
@@ -211,10 +211,10 @@
  * @param match_count	The number of device's match ids to be received.
  * @param match_ids	The list of the device's match ids.
- * @return		Zero on success, error code otherwise.
- */
-static errno_t devman_receive_match_ids(sysarg_t match_count,
+ * @return		Zero on success, negative error code otherwise.
+ */
+static int devman_receive_match_ids(sysarg_t match_count,
     match_id_list_t *match_ids)
 {
-	errno_t ret = EOK;
+	int ret = EOK;
 	size_t i;
 	
@@ -255,5 +255,5 @@
 	
 	char *fun_name = NULL;
-	errno_t rc = async_data_write_accept((void **)&fun_name, true, 0, 0, 0, 0);
+	int rc = async_data_write_accept((void **)&fun_name, true, 0, 0, 0, 0);
 	if (rc != EOK) {
 		dev_del_ref(pdev);
@@ -332,5 +332,5 @@
 	devman_handle_t handle = IPC_GET_ARG1(*call);
 	category_id_t cat_id;
-	errno_t rc;
+	int rc;
 	
 	/* Get category name. */
@@ -381,5 +381,5 @@
 {
 	fun_node_t *fun;
-	errno_t rc;
+	int rc;
 	
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_drv_fun_online()");
@@ -407,5 +407,5 @@
 		fun_busy_unlock(fun);
 		fun_del_ref(fun);
-		async_answer_0(iid, rc);
+		async_answer_0(iid, (sysarg_t) rc);
 		return;
 	}
@@ -414,5 +414,5 @@
 	fun_del_ref(fun);
 	
-	async_answer_0(iid, EOK);
+	async_answer_0(iid, (sysarg_t) EOK);
 }
 
@@ -425,5 +425,5 @@
 {
 	fun_node_t *fun;
-	errno_t rc;
+	int rc;
 
 	fun = find_fun_node(&device_tree, IPC_GET_ARG1(*icall));
@@ -448,5 +448,5 @@
 		fun_busy_unlock(fun);
 		fun_del_ref(fun);
-		async_answer_0(iid, rc);
+		async_answer_0(iid, (sysarg_t) rc);
 		return;
 	}
@@ -454,5 +454,5 @@
 	fun_busy_unlock(fun);
 	fun_del_ref(fun);
-	async_answer_0(iid, EOK);
+	async_answer_0(iid, (sysarg_t) EOK);
 }
 
@@ -462,5 +462,5 @@
 	devman_handle_t fun_handle = IPC_GET_ARG1(*call);
 	dev_tree_t *tree = &device_tree;
-	errno_t rc;
+	int rc;
 	
 	fun_node_t *fun = find_fun_node(&device_tree, fun_handle);
@@ -490,5 +490,5 @@
 			dev_node_t *dev = fun->child;
 			device_state_t dev_state;
-			errno_t gone_rc;
+			int gone_rc;
 			
 			dev_add_ref(dev);
@@ -575,5 +575,5 @@
  * driver needed to be served by devman during the driver's initialization).
  */
-static errno_t init_running_drv(void *drv)
+static int init_running_drv(void *drv)
 {
 	driver_t *driver = (driver_t *) drv;
Index: uspace/srv/devman/fun.c
===================================================================
--- uspace/srv/devman/fun.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/fun.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -286,5 +286,5 @@
 }
 
-static errno_t assign_driver_fibril(void *arg)
+static int assign_driver_fibril(void *arg)
 {
 	dev_node_t *dev_node = (dev_node_t *) arg;
@@ -296,5 +296,5 @@
 }
 
-errno_t fun_online(fun_node_t *fun)
+int fun_online(fun_node_t *fun)
 {
 	dev_node_t *dev;
@@ -354,7 +354,7 @@
 }
 
-errno_t fun_offline(fun_node_t *fun)
-{
-	errno_t rc;
+int fun_offline(fun_node_t *fun)
+{
+	int rc;
 	
 	fibril_rwlock_write_lock(&device_tree.rwlock);
Index: uspace/srv/devman/fun.h
===================================================================
--- uspace/srv/devman/fun.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/fun.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,6 +49,6 @@
     const char *);
 extern bool set_fun_path(dev_tree_t *, fun_node_t *, fun_node_t *);
-extern errno_t fun_online(fun_node_t *);
-extern errno_t fun_offline(fun_node_t *);
+extern int fun_online(fun_node_t *);
+extern int fun_offline(fun_node_t *);
 
 #endif
Index: uspace/srv/devman/loc.c
===================================================================
--- uspace/srv/devman/loc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/loc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -67,7 +67,7 @@
 }
 
-errno_t loc_unregister_tree_function(fun_node_t *fun, dev_tree_t *tree)
+int loc_unregister_tree_function(fun_node_t *fun, dev_tree_t *tree)
 {
-	errno_t rc = loc_service_unregister(fun->service_id);
+	int rc = loc_service_unregister(fun->service_id);
 	tree_rem_loc_function(tree, fun);
 	return rc;
Index: uspace/srv/devman/loc.h
===================================================================
--- uspace/srv/devman/loc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/loc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 
 extern void loc_register_tree_function(fun_node_t *, dev_tree_t *);
-extern errno_t loc_unregister_tree_function(fun_node_t *, dev_tree_t *);
+extern int loc_unregister_tree_function(fun_node_t *, dev_tree_t *);
 extern fun_node_t *find_loc_tree_function(dev_tree_t *, service_id_t);
 extern void tree_add_loc_function(dev_tree_t *, fun_node_t *);
Index: uspace/srv/devman/main.c
===================================================================
--- uspace/srv/devman/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,4 @@
 #include <stdio.h>
 #include <errno.h>
-#include <str_error.h>
 #include <stdbool.h>
 #include <fibril_synch.h>
@@ -317,7 +316,7 @@
 	printf("%s: HelenOS Device Manager\n", NAME);
 	
-	errno_t rc = log_init(NAME);
+	int rc = log_init(NAME);
 	if (rc != EOK) {
-		printf("%s: Error initializing logging subsystem: %s\n", NAME, str_error(rc));
+		printf("%s: Error initializing logging subsystem.\n", NAME);
 		return rc;
 	}
@@ -330,29 +329,21 @@
 	rc = async_create_port(INTERFACE_DDF_DRIVER,
 	    devman_connection_driver, NULL, &port);
-	if (rc != EOK) {
-		printf("%s: Error creating DDF driver port: %s\n", NAME, str_error(rc));
-		return rc;
-	}
+	if (rc != EOK)
+		return rc;
 	
 	rc = async_create_port(INTERFACE_DDF_CLIENT,
 	    devman_connection_client, NULL, &port);
-	if (rc != EOK) {
-		printf("%s: Error creating DDF client port: %s\n", NAME, str_error(rc));
-		return rc;
-	}
+	if (rc != EOK)
+		return rc;
 	
 	rc = async_create_port(INTERFACE_DEVMAN_DEVICE,
 	    devman_connection_device, NULL, &port);
-	if (rc != EOK) {
-		printf("%s: Error creating devman device port: %s\n", NAME, str_error(rc));
-		return rc;
-	}
+	if (rc != EOK)
+		return rc;
 	
 	rc = async_create_port(INTERFACE_DEVMAN_PARENT,
 	    devman_connection_parent, NULL, &port);
-	if (rc != EOK) {
-		printf("%s: Error creating devman parent port: %s\n", NAME, str_error(rc));
-		return rc;
-	}
+	if (rc != EOK)
+		return rc;
 	
 	async_set_fallback_port_handler(devman_forward, NULL);
@@ -366,5 +357,5 @@
 	rc = service_register(SERVICE_DEVMAN);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering as a service: %s", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering as a service.");
 		return rc;
 	}
Index: uspace/srv/devman/match.c
===================================================================
--- uspace/srv/devman/match.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/devman/match.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -200,18 +200,17 @@
 	int fd;
 	size_t len = 0;
-	vfs_stat_t st;
-	
-	errno_t rc = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK) {
+	struct stat st;
+	
+	fd = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ);
+	if (fd < 0) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to open `%s' for reading: %s.",
-		    conf_path, str_error(rc));
+		    conf_path, str_error(errno));
 		goto cleanup;
 	}
 	opened = true;
 	
-	rc = vfs_stat(fd, &st);
-	if (rc != EOK) {
+	if (vfs_stat(fd, &st) != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to fstat %d: %s.", fd,
-		    str_error(rc));
+		    str_error(errno));
 		goto cleanup;
 	}
@@ -231,8 +230,8 @@
 	
 	size_t read_bytes;
-	rc = vfs_read(fd, (aoff64_t []) {0}, buf, len, &read_bytes);
+	int rc = vfs_read(fd, (aoff64_t []) {0}, buf, len, &read_bytes);
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to read file '%s': %s.", conf_path,
-		    str_error(rc));
+		    str_error(errno));
 		goto cleanup;
 	}
Index: uspace/srv/fs/cdfs/cdfs.c
===================================================================
--- uspace/srv/fs/cdfs/cdfs.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/cdfs/cdfs.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,8 +41,6 @@
 #include <ns.h>
 #include <errno.h>
-#include <str_error.h>
 #include <stdio.h>
 #include <libfs.h>
-#include <str.h>
 #include "cdfs.h"
 #include "cdfs_ops.h"
@@ -82,8 +80,8 @@
 	}
 	
-	errno_t rc = fs_register(vfs_sess, &cdfs_vfs_info, &cdfs_ops,
+	int rc = fs_register(vfs_sess, &cdfs_vfs_info, &cdfs_ops,
 	    &cdfs_libfs_ops);
 	if (rc != EOK) {
-		printf("%s: Failed to register file system: %s\n", NAME, str_error(rc));
+		printf("%s: Failed to register file system (%d)\n", NAME, rc);
 		return rc;
 	}
Index: uspace/srv/fs/cdfs/cdfs_ops.c
===================================================================
--- uspace/srv/fs/cdfs/cdfs_ops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/cdfs/cdfs_ops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -331,5 +331,5 @@
 };
 
-static errno_t cdfs_node_get(fs_node_t **rfn, service_id_t service_id,
+static int cdfs_node_get(fs_node_t **rfn, service_id_t service_id,
     fs_index_t index)
 {
@@ -351,5 +351,5 @@
 }
 
-static errno_t cdfs_root_get(fs_node_t **rfn, service_id_t service_id)
+static int cdfs_root_get(fs_node_t **rfn, service_id_t service_id)
 {
 	return cdfs_node_get(rfn, service_id, CDFS_SOME_ROOT);
@@ -371,5 +371,5 @@
 }
 
-static errno_t create_node(fs_node_t **rfn, cdfs_t *fs, int lflag,
+static int create_node(fs_node_t **rfn, cdfs_t *fs, int lflag,
     fs_index_t index)
 {
@@ -392,5 +392,5 @@
 	
 	fs_node_t *rootfn;
-	errno_t rc = cdfs_root_get(&rootfn, fs->service_id);
+	int rc = cdfs_root_get(&rootfn, fs->service_id);
 	
 	assert(rc == EOK);
@@ -417,5 +417,5 @@
 }
 
-static errno_t link_node(fs_node_t *pfn, fs_node_t *fn, const char *name)
+static int link_node(fs_node_t *pfn, fs_node_t *fn, const char *name)
 {
 	cdfs_node_t *parent = CDFS_NODE(pfn);
@@ -460,5 +460,5 @@
 static char *cdfs_decode_str(void *data, size_t dsize, cdfs_enc_t enc)
 {
-	errno_t rc;
+	int rc;
 	char *str;
 	uint16_t *buf;
@@ -566,5 +566,5 @@
 }
 
-static errno_t cdfs_readdir(cdfs_t *fs, fs_node_t *fs_node)
+static bool cdfs_readdir(cdfs_t *fs, fs_node_t *fs_node)
 {
 	cdfs_node_t *node = CDFS_NODE(fs_node);
@@ -572,5 +572,5 @@
 	
 	if (node->processed)
-		return EOK;
+		return true;
 	
 	uint32_t blocks = node->size / BLOCK_SIZE;
@@ -580,7 +580,7 @@
 	for (uint32_t i = 0; i < blocks; i++) {
 		block_t *block;
-		errno_t rc = block_get(&block, fs->service_id, node->lba + i, BLOCK_FLAGS_NONE);
+		int rc = block_get(&block, fs->service_id, node->lba + i, BLOCK_FLAGS_NONE);
 		if (rc != EOK)
-			return rc;
+			return false;
 		
 		cdfs_dir_t *dir;
@@ -614,10 +614,8 @@
 			
 			fs_node_t *fn;
-			errno_t rc = create_node(&fn, fs, dentry_type,
+			int rc = create_node(&fn, fs, dentry_type,
 			    (node->lba + i) * BLOCK_SIZE + offset);
-			if (rc != EOK)
-				return rc;
-
-			assert(fn != NULL);
+			if ((rc != EOK) || (fn == NULL))
+				return false;
 			
 			cdfs_node_t *cur = CDFS_NODE(fn);
@@ -628,5 +626,5 @@
 			    dir->name_length, node->fs->enc, dentry_type);
 			if (name == NULL)
-				return EIO;
+				return false;
 			
 			// FIXME: check return value
@@ -643,5 +641,5 @@
 	
 	node->processed = true;
-	return EOK;
+	return true;
 }
 
@@ -652,5 +650,5 @@
 	
 	block_t *block;
-	errno_t rc = block_get(&block, fs->service_id, lba, BLOCK_FLAGS_NONE);
+	int rc = block_get(&block, fs->service_id, lba, BLOCK_FLAGS_NONE);
 	if (rc != EOK)
 		return NULL;
@@ -698,10 +696,10 @@
 }
 
-static errno_t cdfs_match(fs_node_t **fn, fs_node_t *pfn, const char *component)
+static int cdfs_match(fs_node_t **fn, fs_node_t *pfn, const char *component)
 {
 	cdfs_node_t *parent = CDFS_NODE(pfn);
 	
 	if (!parent->processed) {
-		errno_t rc = cdfs_readdir(parent->fs, pfn);
+		int rc = cdfs_readdir(parent->fs, pfn);
 		if (rc != EOK)
 			return rc;
@@ -719,5 +717,5 @@
 }
 
-static errno_t cdfs_node_open(fs_node_t *fn)
+static int cdfs_node_open(fs_node_t *fn)
 {
 	cdfs_node_t *node = CDFS_NODE(fn);
@@ -730,5 +728,5 @@
 }
 
-static errno_t cdfs_node_put(fs_node_t *fn)
+static int cdfs_node_put(fs_node_t *fn)
 {
 	/* Nothing to do */
@@ -736,5 +734,5 @@
 }
 
-static errno_t cdfs_create_node(fs_node_t **fn, service_id_t service_id, int lflag)
+static int cdfs_create_node(fs_node_t **fn, service_id_t service_id, int lflag)
 {
 	/* Read-only */
@@ -742,5 +740,5 @@
 }
 
-static errno_t cdfs_destroy_node(fs_node_t *fn)
+static int cdfs_destroy_node(fs_node_t *fn)
 {
 	/* Read-only */
@@ -748,5 +746,5 @@
 }
 
-static errno_t cdfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)
+static int cdfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)
 {
 	/* Read-only */
@@ -754,5 +752,5 @@
 }
 
-static errno_t cdfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)
+static int cdfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)
 {
 	/* Read-only */
@@ -760,5 +758,5 @@
 }
 
-static errno_t cdfs_has_children(bool *has_children, fs_node_t *fn)
+static int cdfs_has_children(bool *has_children, fs_node_t *fn)
 {
 	cdfs_node_t *node = CDFS_NODE(fn);
@@ -806,5 +804,5 @@
 }
 
-static errno_t cdfs_size_block(service_id_t service_id, uint32_t *size)
+static int cdfs_size_block(service_id_t service_id, uint32_t *size)
 {
 	*size = BLOCK_SIZE;
@@ -813,5 +811,5 @@
 }
 
-static errno_t cdfs_total_block_count(service_id_t service_id, uint64_t *count)
+static int cdfs_total_block_count(service_id_t service_id, uint64_t *count)
 {
 	*count = 0;
@@ -820,5 +818,5 @@
 }
 
-static errno_t cdfs_free_block_count(service_id_t service_id, uint64_t *count)
+static int cdfs_free_block_count(service_id_t service_id, uint64_t *count)
 {
 	*count = 0;
@@ -851,5 +849,5 @@
 /** Verify that escape sequence corresonds to one of the allowed encoding
  * escape sequences allowed for Joliet. */
-static errno_t cdfs_verify_joliet_esc_seq(uint8_t *seq)
+static int cdfs_verify_joliet_esc_seq(uint8_t *seq)
 {
 	size_t i, j, k;
@@ -895,5 +893,5 @@
  * @return 		EOK if found, ENOENT if not
  */
-static errno_t cdfs_find_joliet_svd(service_id_t sid, cdfs_lba_t altroot,
+static int cdfs_find_joliet_svd(service_id_t sid, cdfs_lba_t altroot,
     uint32_t *rlba, uint32_t *rsize, char **vol_ident)
 {
@@ -902,5 +900,5 @@
 	for (bi = altroot + 17; ; bi++) {
 		block_t *block;
-		errno_t rc = block_get(&block, sid, bi, BLOCK_FLAGS_NONE);
+		int rc = block_get(&block, sid, bi, BLOCK_FLAGS_NONE);
 		if (rc != EOK)
 			break;
@@ -963,12 +961,12 @@
 
 /** Read the volume descriptors. */
-static errno_t iso_read_vol_desc(service_id_t sid, cdfs_lba_t altroot,
+static bool iso_read_vol_desc(service_id_t sid, cdfs_lba_t altroot,
     uint32_t *rlba, uint32_t *rsize, cdfs_enc_t *enc, char **vol_ident)
 {
 	/* First 16 blocks of isofs are empty */
 	block_t *block;
-	errno_t rc = block_get(&block, sid, altroot + 16, BLOCK_FLAGS_NONE);
+	int rc = block_get(&block, sid, altroot + 16, BLOCK_FLAGS_NONE);
 	if (rc != EOK)
-		return rc;
+		return false;
 	
 	cdfs_vol_desc_t *vol_desc = (cdfs_vol_desc_t *) block->data;
@@ -982,5 +980,5 @@
 	    (vol_desc->version != 1)) {
 		block_put(block);
-		return ENOTSUP;
+		return false;
 	}
 	
@@ -1002,5 +1000,5 @@
 		 */
 		block_put(block);
-		return ENOTSUP;
+		return false;
 	}
 	
@@ -1008,5 +1006,5 @@
 	if (block_size != BLOCK_SIZE) {
 		block_put(block);
-		return ENOTSUP;
+		return false;
 	}
 	
@@ -1033,16 +1031,15 @@
 	
 	block_put(block);
-	return EOK;
-}
-
-static errno_t iso_readfs(cdfs_t *fs, fs_node_t *rfn,
+	return true;
+}
+
+static bool iso_readfs(cdfs_t *fs, fs_node_t *rfn,
     cdfs_lba_t altroot)
 {
 	cdfs_node_t *node = CDFS_NODE(rfn);
 	
-	errno_t rc = iso_read_vol_desc(fs->service_id, altroot, &node->lba,
-	    &node->size, &fs->enc, &fs->vol_ident);
-	if (rc != EOK)
-		return rc;
+	if (!iso_read_vol_desc(fs->service_id, altroot, &node->lba,
+	    &node->size, &fs->enc, &fs->vol_ident))
+		return false;
 	
 	return cdfs_readdir(fs, rfn);
@@ -1064,5 +1061,5 @@
 	
 	/* Create root node */
-	errno_t rc = create_node(&rfn, fs, L_DIRECTORY, cdfs_index++);
+	int rc = create_node(&rfn, fs, L_DIRECTORY, cdfs_index++);
 	
 	if ((rc != EOK) || (!rfn))
@@ -1075,5 +1072,5 @@
 	
 	/* Check if there is cdfs in given session */
-	if (iso_readfs(fs, rfn, altroot) != EOK)
+	if (!iso_readfs(fs, rfn, altroot))
 		goto error;
 	
@@ -1086,10 +1083,10 @@
 }
 
-static errno_t cdfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
+static int cdfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
 {
 	char *vol_ident;
 
 	/* Initialize the block layer */
-	errno_t rc = block_init(service_id, BLOCK_SIZE);
+	int rc = block_init(service_id, BLOCK_SIZE);
 	if (rc != EOK)
 		return rc;
@@ -1128,10 +1125,9 @@
 	uint32_t rsize;
 	cdfs_enc_t enc;
-	rc = iso_read_vol_desc(service_id, altroot, &rlba, &rsize, &enc,
-	    &vol_ident);
-	if (rc != EOK) {
+	if (!iso_read_vol_desc(service_id, altroot, &rlba, &rsize, &enc,
+	    &vol_ident)) {
 		block_cache_fini(service_id);
 		block_fini(service_id);
-		return rc;
+		return EIO;
 	}
 	
@@ -1144,9 +1140,9 @@
 }
 
-static errno_t cdfs_mounted(service_id_t service_id, const char *opts,
+static int cdfs_mounted(service_id_t service_id, const char *opts,
     fs_index_t *index, aoff64_t *size)
 {
 	/* Initialize the block layer */
-	errno_t rc = block_init(service_id, BLOCK_SIZE);
+	int rc = block_init(service_id, BLOCK_SIZE);
 	if (rc != EOK)
 		return rc;
@@ -1238,5 +1234,5 @@
 }
 
-static errno_t cdfs_unmounted(service_id_t service_id)
+static int cdfs_unmounted(service_id_t service_id)
 {
 	cdfs_t *fs;
@@ -1250,5 +1246,5 @@
 }
 
-static errno_t cdfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
+static int cdfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *rbytes)
 {
@@ -1266,5 +1262,5 @@
 	
 	if (!node->processed) {
-		errno_t rc = cdfs_readdir(node->fs, FS_NODE(node));
+		int rc = cdfs_readdir(node->fs, FS_NODE(node));
 		if (rc != EOK)
 			return rc;
@@ -1290,5 +1286,5 @@
 			
 			block_t *block;
-			errno_t rc = block_get(&block, service_id, node->lba + lba,
+			int rc = block_get(&block, service_id, node->lba + lba,
 			    BLOCK_FLAGS_NONE);
 			if (rc != EOK) {
@@ -1321,5 +1317,5 @@
 }
 
-static errno_t cdfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
+static int cdfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *wbytes, aoff64_t *nsize)
 {
@@ -1332,5 +1328,5 @@
 }
 
-static errno_t cdfs_truncate(service_id_t service_id, fs_index_t index,
+static int cdfs_truncate(service_id_t service_id, fs_index_t index,
     aoff64_t size)
 {
@@ -1373,5 +1369,5 @@
 }
 
-static errno_t cdfs_close(service_id_t service_id, fs_index_t index)
+static int cdfs_close(service_id_t service_id, fs_index_t index)
 {
 	/* Root node is always in memory */
@@ -1399,5 +1395,5 @@
 }
 
-static errno_t cdfs_destroy(service_id_t service_id, fs_index_t index)
+static int cdfs_destroy(service_id_t service_id, fs_index_t index)
 {
 	/*
@@ -1409,5 +1405,5 @@
 }
 
-static errno_t cdfs_sync(service_id_t service_id, fs_index_t index)
+static int cdfs_sync(service_id_t service_id, fs_index_t index)
 {
 	/*
Index: uspace/srv/fs/exfat/exfat.c
===================================================================
--- uspace/srv/fs/exfat/exfat.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/exfat/exfat.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,9 +43,7 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <task.h>
 #include <stdio.h>
 #include <libfs.h>
-#include <str.h>
 #include "../../vfs/vfs.h"
 
@@ -72,5 +70,5 @@
 	}
 
-	errno_t rc = exfat_idx_init();
+	int rc = exfat_idx_init();
 	if (rc != EOK)
 		goto err;
@@ -97,5 +95,5 @@
 
 err:
-	printf(NAME ": Failed to register file system: %s\n", str_error(rc));
+	printf(NAME ": Failed to register file system (%d)\n", rc);
 	return rc;
 }
Index: uspace/srv/fs/exfat/exfat.h
===================================================================
--- uspace/srv/fs/exfat/exfat.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/exfat/exfat.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -169,5 +169,5 @@
 extern libfs_ops_t exfat_libfs_ops;
 
-extern errno_t exfat_idx_get_new(exfat_idx_t **, service_id_t);
+extern int exfat_idx_get_new(exfat_idx_t **, service_id_t);
 extern exfat_idx_t *exfat_idx_get_by_pos(service_id_t, exfat_cluster_t, unsigned);
 extern exfat_idx_t *exfat_idx_get_by_index(service_id_t, fs_index_t);
@@ -176,13 +176,13 @@
 extern void exfat_idx_hashout(exfat_idx_t *);
 
-extern errno_t exfat_idx_init(void);
+extern int exfat_idx_init(void);
 extern void exfat_idx_fini(void);
-extern errno_t exfat_idx_init_by_service_id(service_id_t);
+extern int exfat_idx_init_by_service_id(service_id_t);
 extern void exfat_idx_fini_by_service_id(service_id_t);
 
-extern errno_t exfat_node_expand(service_id_t, exfat_node_t *, exfat_cluster_t);
-extern errno_t exfat_node_put(fs_node_t *);
-extern errno_t exfat_bitmap_get(fs_node_t **, service_id_t);
-extern errno_t exfat_uctable_get(fs_node_t **, service_id_t);
+extern int exfat_node_expand(service_id_t, exfat_node_t *, exfat_cluster_t);
+extern int exfat_node_put(fs_node_t *);
+extern int exfat_bitmap_get(fs_node_t **, service_id_t);
+extern int exfat_uctable_get(fs_node_t **, service_id_t);
 
 
Index: uspace/srv/fs/exfat/exfat_bitmap.c
===================================================================
--- uspace/srv/fs/exfat/exfat_bitmap.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/exfat/exfat_bitmap.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,5 +48,5 @@
 
 
-errno_t exfat_bitmap_is_free(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_is_free(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t clst)
 {
@@ -55,5 +55,5 @@
 	exfat_node_t *bitmapp;
 	uint8_t *bitmap;
-	errno_t rc;
+	int rc;
 	bool alloc;
 
@@ -89,5 +89,5 @@
 }
 
-errno_t exfat_bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t clst)
 {
@@ -96,5 +96,5 @@
 	exfat_node_t *bitmapp;
 	uint8_t *bitmap;
-	errno_t rc;
+	int rc;
 
 	clst -= EXFAT_CLST_FIRST;
@@ -124,5 +124,5 @@
 }
 
-errno_t exfat_bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t clst)
 {
@@ -131,5 +131,5 @@
 	exfat_node_t *bitmapp;
 	uint8_t *bitmap;
-	errno_t rc;
+	int rc;
 
 	clst -= EXFAT_CLST_FIRST;
@@ -160,8 +160,8 @@
 }
 
-errno_t exfat_bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t firstc, exfat_cluster_t count)
 {
-	errno_t rc;
+	int rc;
 	exfat_cluster_t clst;
 	clst = firstc;
@@ -180,8 +180,8 @@
 }
 
-errno_t exfat_bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t firstc, exfat_cluster_t count)
 {
-	errno_t rc;
+	int rc;
 	exfat_cluster_t clst;
 	clst = firstc;
@@ -196,5 +196,5 @@
 }
 
-errno_t exfat_bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id, 
+int exfat_bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t *firstc, exfat_cluster_t count)
 {
@@ -217,5 +217,5 @@
 
 
-errno_t exfat_bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 
+int exfat_bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 
     exfat_cluster_t count)
 {
@@ -240,5 +240,5 @@
 
 
-errno_t exfat_bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 
+int exfat_bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 
     exfat_cluster_t count)
 {
@@ -251,7 +251,7 @@
 
 
-errno_t exfat_bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep)
-{
-	errno_t rc;
+int exfat_bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep)
+{
+	int rc;
 	exfat_cluster_t lastc, clst;
 	service_id_t service_id = nodep->idx->service_id;
Index: uspace/srv/fs/exfat/exfat_bitmap.h
===================================================================
--- uspace/srv/fs/exfat/exfat_bitmap.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/exfat/exfat_bitmap.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,20 +42,20 @@
 struct exfat_bs;
 
-extern errno_t exfat_bitmap_alloc_clusters(struct exfat_bs *, service_id_t,
+extern int exfat_bitmap_alloc_clusters(struct exfat_bs *, service_id_t, 
     exfat_cluster_t *, exfat_cluster_t);
-extern errno_t exfat_bitmap_append_clusters(struct exfat_bs *, struct exfat_node *,
+extern int exfat_bitmap_append_clusters(struct exfat_bs *, struct exfat_node *, 
     exfat_cluster_t);
-extern errno_t exfat_bitmap_free_clusters(struct exfat_bs *, struct exfat_node *,
+extern int exfat_bitmap_free_clusters(struct exfat_bs *, struct exfat_node *, 
     exfat_cluster_t);
-extern errno_t exfat_bitmap_replicate_clusters(struct exfat_bs *, struct exfat_node *);
+extern int exfat_bitmap_replicate_clusters(struct exfat_bs *, struct exfat_node *); 
 
-extern errno_t exfat_bitmap_is_free(struct exfat_bs *, service_id_t, exfat_cluster_t);
-extern errno_t exfat_bitmap_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
-extern errno_t exfat_bitmap_clear_cluster(struct exfat_bs *, service_id_t,
+extern int exfat_bitmap_is_free(struct exfat_bs *, service_id_t, exfat_cluster_t);
+extern int exfat_bitmap_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
+extern int exfat_bitmap_clear_cluster(struct exfat_bs *, service_id_t, 
     exfat_cluster_t);
 
-extern errno_t exfat_bitmap_set_clusters(struct exfat_bs *, service_id_t,
+extern int exfat_bitmap_set_clusters(struct exfat_bs *, service_id_t, 
     exfat_cluster_t, exfat_cluster_t);
-extern errno_t exfat_bitmap_clear_clusters(struct exfat_bs *, service_id_t,
+extern int exfat_bitmap_clear_clusters(struct exfat_bs *, service_id_t, 
     exfat_cluster_t, exfat_cluster_t);
 
Index: uspace/srv/fs/exfat/exfat_directory.c
===================================================================
--- uspace/srv/fs/exfat/exfat_directory.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/exfat/exfat_directory.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,5 +60,5 @@
 }
 
-errno_t exfat_directory_open(exfat_node_t *nodep, exfat_directory_t *di)
+int exfat_directory_open(exfat_node_t *nodep, exfat_directory_t *di)
 {
 	exfat_directory_init(di);
@@ -76,5 +76,5 @@
 }
 
-errno_t exfat_directory_open_parent(exfat_directory_t *di, 
+int exfat_directory_open_parent(exfat_directory_t *di, 
     service_id_t service_id, exfat_cluster_t firstc, bool fragmented)
 {
@@ -88,7 +88,7 @@
 }
 
-errno_t exfat_directory_close(exfat_directory_t *di)
-{
-	errno_t rc = EOK;
+int exfat_directory_close(exfat_directory_t *di)
+{
+	int rc = EOK;
 	
 	if (di->b) {
@@ -100,8 +100,8 @@
 }
 
-static errno_t exfat_directory_block_load(exfat_directory_t *di)
+static int exfat_directory_block_load(exfat_directory_t *di)
 {
 	uint32_t i;
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	i = (di->pos * sizeof(exfat_dentry_t)) / BPS(di->bs);
@@ -133,7 +133,7 @@
 }
 
-errno_t exfat_directory_next(exfat_directory_t *di)
-{
-	errno_t rc;
+int exfat_directory_next(exfat_directory_t *di)
+{
+	int rc;
 
 	di->pos += 1;
@@ -145,7 +145,7 @@
 }
 
-errno_t exfat_directory_prev(exfat_directory_t *di)
-{
-	errno_t rc = EOK;
+int exfat_directory_prev(exfat_directory_t *di)
+{
+	int rc = EOK;
 	
 	if (di->pos > 0) {
@@ -161,8 +161,8 @@
 }
 
-errno_t exfat_directory_seek(exfat_directory_t *di, aoff64_t pos)
+int exfat_directory_seek(exfat_directory_t *di, aoff64_t pos)
 {
 	aoff64_t _pos = di->pos;
-	errno_t rc;
+	int rc;
 
 	di->pos = pos;
@@ -174,7 +174,7 @@
 }
 
-errno_t exfat_directory_get(exfat_directory_t *di, exfat_dentry_t **d)
-{
-	errno_t rc;
+int exfat_directory_get(exfat_directory_t *di, exfat_dentry_t **d)
+{
+	int rc;
 	
 	rc = exfat_directory_block_load(di);
@@ -187,5 +187,5 @@
 }
 
-errno_t exfat_directory_find(exfat_directory_t *di, exfat_dentry_clsf_t type,
+int exfat_directory_find(exfat_directory_t *di, exfat_dentry_clsf_t type,
     exfat_dentry_t **d)
 {
@@ -201,9 +201,9 @@
 }
 
-errno_t
+int
 exfat_directory_find_continue(exfat_directory_t *di, exfat_dentry_clsf_t type,
     exfat_dentry_t **d)
 {
-	errno_t rc;
+	int rc;
 	rc = exfat_directory_next(di);
 	if (rc != EOK)
@@ -213,11 +213,10 @@
 
 
-errno_t exfat_directory_read_file(exfat_directory_t *di, char *name, size_t size, 
+int exfat_directory_read_file(exfat_directory_t *di, char *name, size_t size, 
     exfat_file_dentry_t *df, exfat_stream_dentry_t *ds)
 {
 	uint16_t wname[EXFAT_FILENAME_LEN + 1];
 	exfat_dentry_t *d = NULL;
-	errno_t rc;
-	int i;
+	int rc, i;
 	size_t offset = 0;
 	aoff64_t start_pos = 0;
@@ -261,10 +260,10 @@
 }
 
-errno_t exfat_directory_read_vollabel(exfat_directory_t *di, char *label,
+int exfat_directory_read_vollabel(exfat_directory_t *di, char *label,
     size_t size)
 {
 	uint16_t wlabel[EXFAT_VOLLABEL_LEN + 1];
 	exfat_dentry_t *d = NULL;
-	errno_t rc;
+	int rc;
 	aoff64_t start_pos = 0;
 
@@ -303,9 +302,8 @@
 }
 
-errno_t exfat_directory_sync_file(exfat_directory_t *di, exfat_file_dentry_t *df, 
+int exfat_directory_sync_file(exfat_directory_t *di, exfat_file_dentry_t *df, 
     exfat_stream_dentry_t *ds)
 {
-	errno_t rc;
-	int i, count;
+	int rc, i, count;
 	exfat_dentry_t *array = NULL, *de;
 	aoff64_t pos = di->pos;
@@ -367,5 +365,5 @@
 }
 
-errno_t exfat_directory_write_file(exfat_directory_t *di, const char *name)
+int exfat_directory_write_file(exfat_directory_t *di, const char *name)
 {
 	fs_node_t *fn;
@@ -374,6 +372,5 @@
 	exfat_dentry_t df, ds, *de;
 	uint16_t wname[EXFAT_FILENAME_LEN + 1];
-	errno_t rc;
-	int i;
+	int rc, i;
 	size_t uctable_chars, j;
 	aoff64_t pos;
@@ -474,8 +471,7 @@
 }
 
-errno_t exfat_directory_erase_file(exfat_directory_t *di, aoff64_t pos)
-{
-	errno_t rc;
-	int count;
+int exfat_directory_erase_file(exfat_directory_t *di, aoff64_t pos)
+{
+	int rc, count;
 	exfat_dentry_t *de;
 
@@ -502,7 +498,7 @@
 }
 
-errno_t exfat_directory_expand(exfat_directory_t *di)
-{
-	errno_t rc;
+int exfat_directory_expand(exfat_directory_t *di)
+{
+	int rc;
 
 	if (!di->nodep)
@@ -521,7 +517,7 @@
 }
 
-errno_t exfat_directory_lookup_free(exfat_directory_t *di, size_t count)
-{
-	errno_t rc;
+int exfat_directory_lookup_free(exfat_directory_t *di, size_t count)
+{
+	int rc;
 	exfat_dentry_t *d;
 	size_t found;
Index: uspace/srv/fs/exfat/exfat_directory.h
===================================================================
--- uspace/srv/fs/exfat/exfat_directory.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/exfat/exfat_directory.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -29,5 +29,5 @@
 /** @addtogroup fs
  * @{
- */
+ */ 
 
 #ifndef EXFAT_EXFAT_DIRECTORY_H_
@@ -55,30 +55,30 @@
 
 extern void exfat_directory_init(exfat_directory_t *);
-extern errno_t exfat_directory_open(exfat_node_t *, exfat_directory_t *);
-extern errno_t exfat_directory_open_parent(exfat_directory_t *, service_id_t,
+extern int exfat_directory_open(exfat_node_t *, exfat_directory_t *);
+extern int exfat_directory_open_parent(exfat_directory_t *, service_id_t,
     exfat_cluster_t, bool);
-extern errno_t exfat_directory_close(exfat_directory_t *);
+extern int exfat_directory_close(exfat_directory_t *);
 
-extern errno_t exfat_directory_next(exfat_directory_t *);
-extern errno_t exfat_directory_prev(exfat_directory_t *);
-extern errno_t exfat_directory_seek(exfat_directory_t *, aoff64_t);
-extern errno_t exfat_directory_get(exfat_directory_t *, exfat_dentry_t **);
-extern errno_t exfat_directory_find(exfat_directory_t *, exfat_dentry_clsf_t,
+extern int exfat_directory_next(exfat_directory_t *);
+extern int exfat_directory_prev(exfat_directory_t *);
+extern int exfat_directory_seek(exfat_directory_t *, aoff64_t);
+extern int exfat_directory_get(exfat_directory_t *, exfat_dentry_t **);
+extern int exfat_directory_find(exfat_directory_t *, exfat_dentry_clsf_t,
     exfat_dentry_t **);
-extern errno_t exfat_directory_find_continue(exfat_directory_t *,
+extern int exfat_directory_find_continue(exfat_directory_t *, 
     exfat_dentry_clsf_t, exfat_dentry_t **);
 
-extern errno_t exfat_directory_read_file(exfat_directory_t *, char *, size_t,
+extern int exfat_directory_read_file(exfat_directory_t *, char *, size_t,
     exfat_file_dentry_t *, exfat_stream_dentry_t *);
-extern errno_t exfat_directory_read_vollabel(exfat_directory_t *, char *, size_t);
-extern errno_t exfat_directory_sync_file(exfat_directory_t *, exfat_file_dentry_t *,
+extern int exfat_directory_read_vollabel(exfat_directory_t *, char *, size_t);
+extern int exfat_directory_sync_file(exfat_directory_t *, exfat_file_dentry_t *,
     exfat_stream_dentry_t *);
-extern errno_t exfat_directory_write_file(exfat_directory_t *, const char *);
-extern errno_t exfat_directory_erase_file(exfat_directory_t *, aoff64_t);
+extern int exfat_directory_write_file(exfat_directory_t *, const char *);
+extern int exfat_directory_erase_file(exfat_directory_t *, aoff64_t);
 
 
-extern errno_t exfat_directory_expand(exfat_directory_t *);
-extern errno_t exfat_directory_lookup_free(exfat_directory_t *, size_t);
-extern errno_t exfat_directory_print(exfat_directory_t *);
+extern int exfat_directory_expand(exfat_directory_t *);
+extern int exfat_directory_lookup_free(exfat_directory_t *, size_t);
+extern int exfat_directory_print(exfat_directory_t *);
 
 
Index: uspace/srv/fs/exfat/exfat_fat.c
===================================================================
--- uspace/srv/fs/exfat/exfat_fat.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/exfat/exfat_fat.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -71,7 +71,7 @@
  * @param max_clusters	Maximum number of clusters to visit.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 exfat_cluster_walk(exfat_bs_t *bs, service_id_t service_id, 
     exfat_cluster_t firstc, exfat_cluster_t *lastc, uint32_t *numc,
@@ -80,5 +80,5 @@
 	uint32_t clusters = 0;
 	exfat_cluster_t clst = firstc;
-	errno_t rc;
+	int rc;
 
 	if (firstc < EXFAT_CLST_FIRST) {
@@ -120,7 +120,7 @@
  * @param flags		Flags passed to libblock.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 exfat_block_get(block_t **block, exfat_bs_t *bs, exfat_node_t *nodep,
     aoff64_t bn, int flags)
@@ -129,5 +129,5 @@
 	exfat_cluster_t currc = 0;
 	aoff64_t relbn = bn;
-	errno_t rc;
+	int rc;
 
 	if (!nodep->size)
@@ -184,7 +184,7 @@
  * @param flags		Flags passed to libblock.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 exfat_block_get_by_clst(block_t **block, exfat_bs_t *bs, 
     service_id_t service_id, bool fragmented, exfat_cluster_t fcl,
@@ -194,5 +194,5 @@
 	uint32_t max_clusters;
 	exfat_cluster_t c = EXFAT_CLST_FIRST;
-	errno_t rc;
+	int rc;
 
 	if (fcl < EXFAT_CLST_FIRST || fcl > DATA_CNT(bs) + 2)
@@ -227,7 +227,7 @@
  * @param value		Output argument holding the value of the cluster.
  *
- * @return		EOK or an error code.
- */
-errno_t
+ * @return		EOK or a negative error code.
+ */
+int
 exfat_get_cluster(exfat_bs_t *bs, service_id_t service_id,
     exfat_cluster_t clst, exfat_cluster_t *value)
@@ -235,5 +235,5 @@
 	block_t *b;
 	aoff64_t offset;
-	errno_t rc;
+	int rc;
 
 	offset = clst * sizeof(exfat_cluster_t);
@@ -257,7 +257,7 @@
  * @param value		Value to set the cluster with.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 exfat_set_cluster(exfat_bs_t *bs, service_id_t service_id,
     exfat_cluster_t clst, exfat_cluster_t value)
@@ -265,5 +265,5 @@
 	block_t *b;
 	aoff64_t offset;
-	errno_t rc;
+	int rc;
 
 	offset = clst * sizeof(exfat_cluster_t);
@@ -295,7 +295,7 @@
  *			will be returned.
  *
- * @return		EOK on success, an error code otherwise.
- */
-errno_t
+ * @return		EOK on success, a negative error code otherwise.
+ */
+int
 exfat_alloc_clusters(exfat_bs_t *bs, service_id_t service_id, unsigned nclsts,
     exfat_cluster_t *mcl, exfat_cluster_t *lcl)
@@ -304,5 +304,5 @@
 	unsigned found = 0;     /* top of the free cluster number stack */
 	exfat_cluster_t clst;
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	lifo = (exfat_cluster_t *) malloc(nclsts * sizeof(exfat_cluster_t));
@@ -361,11 +361,11 @@
  * @param firstc	First cluster in the chain which is to be freed.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative return code.
+ */
+int
 exfat_free_clusters(exfat_bs_t *bs, service_id_t service_id, exfat_cluster_t firstc)
 {
 	exfat_cluster_t nextc;
-	errno_t rc;
+	int rc;
 
 	/* Mark all clusters in the chain as free */
@@ -394,7 +394,7 @@
  * @param lcl		Last cluster of the cluster chain to append.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 exfat_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep, exfat_cluster_t mcl,
     exfat_cluster_t lcl)
@@ -402,5 +402,5 @@
 	service_id_t service_id = nodep->idx->service_id;
 	exfat_cluster_t lastc = 0;
-	errno_t rc;
+	int rc;
 
 	if (nodep->firstc == 0) {
@@ -438,9 +438,9 @@
  *			be chopped off.
  *
- * @return		EOK on success or an error code.
- */
-errno_t exfat_chop_clusters(exfat_bs_t *bs, exfat_node_t *nodep, exfat_cluster_t lcl)
-{
-	errno_t rc;
+ * @return		EOK on success or a negative return code.
+ */
+int exfat_chop_clusters(exfat_bs_t *bs, exfat_node_t *nodep, exfat_cluster_t lcl)
+{
+	int rc;
 	service_id_t service_id = nodep->idx->service_id;
 
@@ -486,10 +486,10 @@
 }
 
-errno_t
+int
 exfat_zero_cluster(exfat_bs_t *bs, service_id_t service_id, exfat_cluster_t c)
 {
 	size_t i;
 	block_t *b;
-	errno_t rc;
+	int rc;
 
 	for (i = 0; i < SPC(bs); i++) {
@@ -508,10 +508,10 @@
 }
 
-errno_t
+int
 exfat_read_uctable(exfat_bs_t *bs, exfat_node_t *nodep, uint8_t *uctable)
 {
 	size_t i, blocks, count;
 	block_t *b;
-	errno_t rc;
+	int rc;
 	blocks = ROUND_UP(nodep->size, BPS(bs))/BPS(bs);
 	count = BPS(bs);
@@ -540,5 +540,5 @@
  * does not contain a exfat file system.
  */
-errno_t exfat_sanity_check(exfat_bs_t *bs)
+int exfat_sanity_check(exfat_bs_t *bs)
 {
 	if (str_cmp((char const *)bs->oem_name, "EXFAT   "))
Index: uspace/srv/fs/exfat/exfat_fat.h
===================================================================
--- uspace/srv/fs/exfat/exfat_fat.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/exfat/exfat_fat.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -61,27 +61,27 @@
     exfat_cluster_walk((bs), (sid), (fc), NULL, (numc), (uint32_t) -1)
 
-extern errno_t exfat_cluster_walk(struct exfat_bs *, service_id_t,
+extern int exfat_cluster_walk(struct exfat_bs *, service_id_t, 
     exfat_cluster_t, exfat_cluster_t *, uint32_t *, uint32_t);
-extern errno_t exfat_block_get(block_t **, struct exfat_bs *, struct exfat_node *,
+extern int exfat_block_get(block_t **, struct exfat_bs *, struct exfat_node *,
     aoff64_t, int);
-extern errno_t exfat_block_get_by_clst(block_t **, struct exfat_bs *, service_id_t,
+extern int exfat_block_get_by_clst(block_t **, struct exfat_bs *, service_id_t,
     bool, exfat_cluster_t, exfat_cluster_t *, aoff64_t, int);
 
-extern errno_t exfat_get_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t,
+extern int exfat_get_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t,
     exfat_cluster_t *);
-extern errno_t exfat_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t,
+extern int exfat_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t,
     exfat_cluster_t);
-extern errno_t exfat_sanity_check(struct exfat_bs *);
+extern int exfat_sanity_check(struct exfat_bs *);
 
-extern errno_t exfat_append_clusters(struct exfat_bs *, struct exfat_node *,
+extern int exfat_append_clusters(struct exfat_bs *, struct exfat_node *,
     exfat_cluster_t, exfat_cluster_t);
-extern errno_t exfat_chop_clusters(struct exfat_bs *, struct exfat_node *,
+extern int exfat_chop_clusters(struct exfat_bs *, struct exfat_node *,
     exfat_cluster_t);
-extern errno_t exfat_alloc_clusters(struct exfat_bs *, service_id_t, unsigned,
+extern int exfat_alloc_clusters(struct exfat_bs *, service_id_t, unsigned,
     exfat_cluster_t *, exfat_cluster_t *);
-extern errno_t exfat_free_clusters(struct exfat_bs *, service_id_t, exfat_cluster_t);
-extern errno_t exfat_zero_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
+extern int exfat_free_clusters(struct exfat_bs *, service_id_t, exfat_cluster_t);
+extern int exfat_zero_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
 
-extern errno_t exfat_read_uctable(struct exfat_bs *, struct exfat_node *,
+extern int exfat_read_uctable(struct exfat_bs *, struct exfat_node *,
     uint8_t *);
 
Index: uspace/srv/fs/exfat/exfat_idx.c
===================================================================
--- uspace/srv/fs/exfat/exfat_idx.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/exfat/exfat_idx.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -328,5 +328,5 @@
 }
 
-static errno_t exfat_idx_create(exfat_idx_t **fidxp, service_id_t service_id)
+static int exfat_idx_create(exfat_idx_t **fidxp, service_id_t service_id)
 {
 	exfat_idx_t *fidx;
@@ -350,8 +350,8 @@
 }
 
-errno_t exfat_idx_get_new(exfat_idx_t **fidxp, service_id_t service_id)
+int exfat_idx_get_new(exfat_idx_t **fidxp, service_id_t service_id)
 {
 	exfat_idx_t *fidx;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&used_lock);
@@ -386,5 +386,5 @@
 		fidx = hash_table_get_inst(l, exfat_idx_t, uph_link);
 	} else {
-		errno_t rc;
+		int rc;
 
 		rc = exfat_idx_create(&fidx, service_id);
@@ -468,5 +468,5 @@
 }
 
-errno_t exfat_idx_init(void)
+int exfat_idx_init(void)
 {
 	if (!hash_table_create(&up_hash, 0, 0, &uph_ops)) 
@@ -487,8 +487,8 @@
 }
 
-errno_t exfat_idx_init_by_service_id(service_id_t service_id)
+int exfat_idx_init_by_service_id(service_id_t service_id)
 {
 	unused_t *u;
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	u = (unused_t *) malloc(sizeof(unused_t));
Index: uspace/srv/fs/exfat/exfat_ops.c
===================================================================
--- uspace/srv/fs/exfat/exfat_ops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/exfat/exfat_ops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -72,14 +72,14 @@
  */
 
-static errno_t exfat_root_get(fs_node_t **, service_id_t);
-static errno_t exfat_match(fs_node_t **, fs_node_t *, const char *);
-static errno_t exfat_node_get(fs_node_t **, service_id_t, fs_index_t);
-static errno_t exfat_node_open(fs_node_t *);
-/* static errno_t exfat_node_put(fs_node_t *); */
-static errno_t exfat_create_node(fs_node_t **, service_id_t, int);
-static errno_t exfat_destroy_node(fs_node_t *);
-static errno_t exfat_link(fs_node_t *, fs_node_t *, const char *);
-static errno_t exfat_unlink(fs_node_t *, fs_node_t *, const char *);
-static errno_t exfat_has_children(bool *, fs_node_t *);
+static int exfat_root_get(fs_node_t **, service_id_t);
+static int exfat_match(fs_node_t **, fs_node_t *, const char *);
+static int exfat_node_get(fs_node_t **, service_id_t, fs_index_t);
+static int exfat_node_open(fs_node_t *);
+/* static int exfat_node_put(fs_node_t *); */
+static int exfat_create_node(fs_node_t **, service_id_t, int);
+static int exfat_destroy_node(fs_node_t *);
+static int exfat_link(fs_node_t *, fs_node_t *, const char *);
+static int exfat_unlink(fs_node_t *, fs_node_t *, const char *);
+static int exfat_has_children(bool *, fs_node_t *);
 static fs_index_t exfat_index_get(fs_node_t *);
 static aoff64_t exfat_size_get(fs_node_t *);
@@ -88,7 +88,7 @@
 static bool exfat_is_file(fs_node_t *node);
 static service_id_t exfat_service_get(fs_node_t *node);
-static errno_t exfat_size_block(service_id_t, uint32_t *);
-static errno_t exfat_total_block_count(service_id_t, uint64_t *);
-static errno_t exfat_free_block_count(service_id_t, uint64_t *);
+static int exfat_size_block(service_id_t, uint32_t *);
+static int exfat_total_block_count(service_id_t, uint64_t *);
+static int exfat_free_block_count(service_id_t, uint64_t *);
 
 /*
@@ -114,7 +114,7 @@
 }
 
-static errno_t exfat_node_sync(exfat_node_t *node)
-{
-	errno_t rc;
+static int exfat_node_sync(exfat_node_t *node)
+{
+	int rc;
 	exfat_directory_t di;
 	exfat_file_dentry_t df;
@@ -155,7 +155,7 @@
 }
 
-static errno_t exfat_node_fini_by_service_id(service_id_t service_id)
-{
-	errno_t rc;
+static int exfat_node_fini_by_service_id(service_id_t service_id)
+{
+	int rc;
 
 	/*
@@ -211,9 +211,9 @@
 }
 
-static errno_t exfat_node_get_new(exfat_node_t **nodepp)
+static int exfat_node_get_new(exfat_node_t **nodepp)
 {
 	fs_node_t *fn;
 	exfat_node_t *nodep;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&ffn_mutex);
@@ -269,5 +269,5 @@
 }
 
-static errno_t exfat_node_get_new_by_pos(exfat_node_t **nodepp, 
+static int exfat_node_get_new_by_pos(exfat_node_t **nodepp, 
     service_id_t service_id, exfat_cluster_t pfc, unsigned pdi)
 {
@@ -287,10 +287,10 @@
  * @param idxp		Locked index structure.
  */
-static errno_t exfat_node_get_core(exfat_node_t **nodepp, exfat_idx_t *idxp)
+static int exfat_node_get_core(exfat_node_t **nodepp, exfat_idx_t *idxp)
 {
 	exfat_dentry_t *d;
 	exfat_node_t *nodep = NULL;
 	exfat_directory_t di;
-	errno_t rc;
+	int rc;
 
 	if (idxp->nodep) {
@@ -398,9 +398,9 @@
 }
 
-errno_t exfat_node_expand(service_id_t service_id, exfat_node_t *nodep,
+int exfat_node_expand(service_id_t service_id, exfat_node_t *nodep,
     exfat_cluster_t clusters)
 {
 	exfat_bs_t *bs;
-	errno_t rc;
+	int rc;
 	bs = block_bb_get(service_id);
 
@@ -443,9 +443,9 @@
 }
 
-static errno_t exfat_node_shrink(service_id_t service_id, exfat_node_t *nodep,
+static int exfat_node_shrink(service_id_t service_id, exfat_node_t *nodep,
     aoff64_t size)
 {
 	exfat_bs_t *bs;
-	errno_t rc;
+	int rc;
 	bs = block_bb_get(service_id);
 
@@ -491,15 +491,15 @@
  */
 
-errno_t exfat_root_get(fs_node_t **rfn, service_id_t service_id)
+int exfat_root_get(fs_node_t **rfn, service_id_t service_id)
 {
 	return exfat_node_get(rfn, service_id, EXFAT_ROOT_IDX);
 }
 
-errno_t exfat_bitmap_get(fs_node_t **rfn, service_id_t service_id)
+int exfat_bitmap_get(fs_node_t **rfn, service_id_t service_id)
 {
 	return exfat_node_get(rfn, service_id, EXFAT_BITMAP_IDX);
 }
 
-errno_t exfat_uctable_get(fs_node_t **rfn, service_id_t service_id)
+int exfat_uctable_get(fs_node_t **rfn, service_id_t service_id)
 {
 	return exfat_node_get(rfn, service_id, EXFAT_UCTABLE_IDX);
@@ -507,5 +507,5 @@
 
 
-errno_t exfat_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
+int exfat_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
 {
 	exfat_node_t *parentp = EXFAT_NODE(pfn);
@@ -514,5 +514,5 @@
 	exfat_stream_dentry_t ds;
 	service_id_t service_id;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&parentp->idx->lock);
@@ -565,9 +565,9 @@
 
 /** Instantiate a exFAT in-core node. */
-errno_t exfat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
+int exfat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
 {
 	exfat_node_t *nodep;
 	exfat_idx_t *idxp;
-	errno_t rc;
+	int rc;
 
 	idxp = exfat_idx_get_by_index(service_id, index);
@@ -584,5 +584,5 @@
 }
 
-errno_t exfat_node_open(fs_node_t *fn)
+int exfat_node_open(fs_node_t *fn)
 {
 	/*
@@ -593,5 +593,5 @@
 }
 
-errno_t exfat_node_put(fs_node_t *fn)
+int exfat_node_put(fs_node_t *fn)
 {
 	if (fn == NULL)
@@ -625,10 +625,10 @@
 }
 
-errno_t exfat_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
+int exfat_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
 {
 	exfat_idx_t *idxp;
 	exfat_node_t *nodep;
 	exfat_bs_t *bs;
-	errno_t rc;
+	int rc;
 
 	bs = block_bb_get(service_id);
@@ -677,10 +677,10 @@
 }
 
-errno_t exfat_destroy_node(fs_node_t *fn)
+int exfat_destroy_node(fs_node_t *fn)
 {
 	exfat_node_t *nodep = EXFAT_NODE(fn);
 	exfat_bs_t *bs;
 	bool has_children;
-	errno_t rc;
+	int rc;
 
 	/*
@@ -718,10 +718,10 @@
 }
 
-errno_t exfat_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
+int exfat_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
 {
 	exfat_node_t *parentp = EXFAT_NODE(pfn);
 	exfat_node_t *childp = EXFAT_NODE(cfn);
 	exfat_directory_t di;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&childp->lock);
@@ -783,10 +783,10 @@
 }
 
-errno_t exfat_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
+int exfat_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
 {
 	exfat_node_t *parentp = EXFAT_NODE(pfn);
 	exfat_node_t *childp = EXFAT_NODE(cfn);
 	bool has_children;
-	errno_t rc;
+	int rc;
 
 	if (!parentp)
@@ -838,10 +838,10 @@
 }
 
-errno_t exfat_has_children(bool *has_children, fs_node_t *fn)
+int exfat_has_children(bool *has_children, fs_node_t *fn)
 {
 	exfat_directory_t di;
 	exfat_dentry_t *d;
 	exfat_node_t *nodep = EXFAT_NODE(fn);
-	errno_t rc;
+	int rc;
 
 	*has_children = false;
@@ -915,5 +915,5 @@
 }
 
-errno_t exfat_size_block(service_id_t service_id, uint32_t *size)
+int exfat_size_block(service_id_t service_id, uint32_t *size)
 {
 	exfat_bs_t *bs;
@@ -924,5 +924,5 @@
 }
 
-errno_t exfat_total_block_count(service_id_t service_id, uint64_t *count)
+int exfat_total_block_count(service_id_t service_id, uint64_t *count)
 {
 	exfat_bs_t *bs;
@@ -933,5 +933,5 @@
 }
 
-errno_t exfat_free_block_count(service_id_t service_id, uint64_t *count)
+int exfat_free_block_count(service_id_t service_id, uint64_t *count)
 {
 	fs_node_t *node = NULL;
@@ -941,5 +941,5 @@
 	uint64_t block_count;
 	unsigned sector;
-	errno_t rc;
+	int rc;
 
 	rc = exfat_total_block_count(service_id, &block_count);
@@ -1015,8 +1015,8 @@
 };
 
-static errno_t exfat_fs_open(service_id_t service_id, enum cache_mode cmode,
+static int exfat_fs_open(service_id_t service_id, enum cache_mode cmode,
     fs_node_t **rrfn, exfat_idx_t **rridxp, vfs_fs_probe_info_t *info)
 {
-	errno_t rc;
+	int rc;
 	exfat_node_t *rootp = NULL, *bitmapp = NULL, *uctablep = NULL;
 	exfat_bs_t *bs;
@@ -1267,7 +1267,7 @@
 */
 
-static errno_t exfat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
-{
-	errno_t rc;
+static int exfat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
+{
+	int rc;
 	exfat_idx_t *ridxp;
 	fs_node_t *rfn;
@@ -1281,9 +1281,9 @@
 }
 
-static errno_t
+static int
 exfat_mounted(service_id_t service_id, const char *opts, fs_index_t *index,
     aoff64_t *size)
 {
-	errno_t rc;
+	int rc;
 	enum cache_mode cmode;
 	exfat_idx_t *ridxp;
@@ -1306,8 +1306,8 @@
 }
 
-static errno_t exfat_unmounted(service_id_t service_id)
+static int exfat_unmounted(service_id_t service_id)
 {
 	fs_node_t *rfn;
-	errno_t rc;
+	int rc;
 
 	rc = exfat_root_get(&rfn, service_id);
@@ -1319,5 +1319,5 @@
 }
 
-static errno_t
+static int
 exfat_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *rbytes)
@@ -1328,5 +1328,5 @@
 	size_t bytes = 0;
 	block_t *b;
-	errno_t rc;
+	int rc;
 
 	rc = exfat_node_get(&fn, service_id, index);
@@ -1438,13 +1438,13 @@
 }
 
-static errno_t exfat_close(service_id_t service_id, fs_index_t index)
-{
-	return EOK;
-}
-
-static errno_t exfat_sync(service_id_t service_id, fs_index_t index)
+static int exfat_close(service_id_t service_id, fs_index_t index)
+{
+	return EOK;
+}
+
+static int exfat_sync(service_id_t service_id, fs_index_t index)
 {
 	fs_node_t *fn;
-	errno_t rc = exfat_node_get(&fn, service_id, index);
+	int rc = exfat_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
@@ -1461,5 +1461,5 @@
 }
 
-static errno_t
+static int
 exfat_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *wbytes, aoff64_t *nsize)
@@ -1472,5 +1472,5 @@
 	aoff64_t boundary;
 	int flags = BLOCK_FLAGS_NONE;
-	errno_t rc;
+	int rc;
 
 	rc = exfat_node_get(&fn, service_id, index);
@@ -1548,5 +1548,5 @@
 }
 
-static errno_t
+static int
 exfat_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
 {
@@ -1554,5 +1554,5 @@
 	exfat_node_t *nodep;
 	exfat_bs_t *bs;
-	errno_t rc;
+	int rc;
 
 	rc = exfat_node_get(&fn, service_id, index);
@@ -1584,5 +1584,5 @@
 	}
 
-	errno_t rc2 = exfat_node_put(fn);
+	int rc2 = exfat_node_put(fn);
 	if (rc == EOK && rc2 != EOK)
 		rc = rc2;
@@ -1591,9 +1591,9 @@
 }
 
-static errno_t exfat_destroy(service_id_t service_id, fs_index_t index)
+static int exfat_destroy(service_id_t service_id, fs_index_t index)
 {
 	fs_node_t *fn;
 	exfat_node_t *nodep;
-	errno_t rc;
+	int rc;
 
 	rc = exfat_node_get(&fn, service_id, index);
Index: uspace/srv/fs/ext4fs/ext4fs.c
===================================================================
--- uspace/srv/fs/ext4fs/ext4fs.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/ext4fs/ext4fs.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,4 @@
 #include <task.h>
 #include <ipc/services.h>
-#include <str.h>
 #include "ext4/ops.h"
 #include "../../vfs/vfs.h"
@@ -73,5 +72,5 @@
 	}
 	
-	errno_t rc = ext4_global_init();
+	int rc = ext4_global_init();
 	if (rc != EOK) {
 		printf("%s: Global initialization failed\n", NAME);
Index: uspace/srv/fs/fat/fat.c
===================================================================
--- uspace/srv/fs/fat/fat.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/fat/fat.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,9 +43,7 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <task.h>
 #include <stdio.h>
 #include <libfs.h>
-#include <str.h>
 #include "../../vfs/vfs.h"
 
@@ -72,5 +70,5 @@
 	}
 
-	errno_t rc = fat_idx_init();
+	int rc = fat_idx_init();
 	if (rc != EOK)
 		goto err;
@@ -97,5 +95,5 @@
 	
 err:
-	printf(NAME ": Failed to register file system: %s\n", str_error(rc));
+	printf(NAME ": Failed to register file system (%d)\n", rc);
 	return rc;
 }
Index: uspace/srv/fs/fat/fat.h
===================================================================
--- uspace/srv/fs/fat/fat.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/fat/fat.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -250,5 +250,5 @@
 extern libfs_ops_t fat_libfs_ops;
 
-extern errno_t fat_idx_get_new(fat_idx_t **, service_id_t);
+extern int fat_idx_get_new(fat_idx_t **, service_id_t);
 extern fat_idx_t *fat_idx_get_by_pos(service_id_t, fat_cluster_t, unsigned);
 extern fat_idx_t *fat_idx_get_by_index(service_id_t, fs_index_t);
@@ -257,7 +257,7 @@
 extern void fat_idx_hashout(fat_idx_t *);
 
-extern errno_t fat_idx_init(void);
+extern int fat_idx_init(void);
 extern void fat_idx_fini(void);
-extern errno_t fat_idx_init_by_service_id(service_id_t);
+extern int fat_idx_init_by_service_id(service_id_t);
 extern void fat_idx_fini_by_service_id(service_id_t);
 
Index: uspace/srv/fs/fat/fat_directory.c
===================================================================
--- uspace/srv/fs/fat/fat_directory.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/fat/fat_directory.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
 #include <stdio.h>
 
-errno_t fat_directory_open(fat_node_t *nodep, fat_directory_t *di)
+int fat_directory_open(fat_node_t *nodep, fat_directory_t *di)
 {
 	di->b = NULL;
@@ -62,7 +62,7 @@
 }
 
-errno_t fat_directory_close(fat_directory_t *di)
-{
-	errno_t rc = EOK;
+int fat_directory_close(fat_directory_t *di)
+{
+	int rc = EOK;
 	
 	if (di->b)
@@ -72,8 +72,8 @@
 }
 
-static errno_t fat_directory_block_load(fat_directory_t *di)
+static int fat_directory_block_load(fat_directory_t *di)
 {
 	uint32_t i;
-	errno_t rc;
+	int rc;
 
 	i = (di->pos * sizeof(fat_dentry_t)) / BPS(di->bs);
@@ -98,7 +98,7 @@
 }
 
-errno_t fat_directory_next(fat_directory_t *di)
-{
-	errno_t rc;
+int fat_directory_next(fat_directory_t *di)
+{
+	int rc;
 
 	di->pos += 1;
@@ -110,7 +110,7 @@
 }
 
-errno_t fat_directory_prev(fat_directory_t *di)
-{
-	errno_t rc = EOK;
+int fat_directory_prev(fat_directory_t *di)
+{
+	int rc = EOK;
 	
 	if (di->pos > 0) {
@@ -126,8 +126,8 @@
 }
 
-errno_t fat_directory_seek(fat_directory_t *di, aoff64_t pos)
+int fat_directory_seek(fat_directory_t *di, aoff64_t pos)
 {
 	aoff64_t _pos = di->pos;
-	errno_t rc;
+	int rc;
 
 	di->pos = pos;
@@ -139,7 +139,7 @@
 }
 
-errno_t fat_directory_get(fat_directory_t *di, fat_dentry_t **d)
-{
-	errno_t rc;
+int fat_directory_get(fat_directory_t *di, fat_dentry_t **d)
+{
+	int rc;
 	
 	rc = fat_directory_block_load(di);
@@ -152,5 +152,5 @@
 }
 
-errno_t fat_directory_read(fat_directory_t *di, char *name, fat_dentry_t **de)
+int fat_directory_read(fat_directory_t *di, char *name, fat_dentry_t **de)
 {
 	fat_dentry_t *d = NULL;
@@ -160,5 +160,5 @@
 	int long_entry_count = 0;
 	uint8_t checksum = 0;
-	errno_t rc;
+	int rc;
 
 	void *data;
@@ -236,7 +236,7 @@
 }
 
-errno_t fat_directory_erase(fat_directory_t *di)
-{
-	errno_t rc;
+int fat_directory_erase(fat_directory_t *di)
+{
+	int rc;
 	fat_dentry_t *d;
 	bool flag = false;
@@ -267,7 +267,7 @@
 }
 
-errno_t fat_directory_write(fat_directory_t *di, const char *name, fat_dentry_t *de)
-{
-	errno_t rc;
+int fat_directory_write(fat_directory_t *di, const char *name, fat_dentry_t *de)
+{
+	int rc;
 	void *data;
 	fat_instance_t *instance;
@@ -348,5 +348,5 @@
 }
 
-errno_t fat_directory_create_sfn(fat_directory_t *di, fat_dentry_t *de,
+int fat_directory_create_sfn(fat_directory_t *di, fat_dentry_t *de,
     const char *lname)
 {
@@ -398,8 +398,8 @@
 }
 
-errno_t fat_directory_write_dentry(fat_directory_t *di, fat_dentry_t *de)
+int fat_directory_write_dentry(fat_directory_t *di, fat_dentry_t *de)
 {
 	fat_dentry_t *d;
-	errno_t rc;
+	int rc;
 
 	rc = fat_directory_get(di, &d);
@@ -412,7 +412,7 @@
 }
 
-errno_t fat_directory_expand(fat_directory_t *di)
-{
-	errno_t rc;
+int fat_directory_expand(fat_directory_t *di)
+{
+	int rc;
 	fat_cluster_t mcl, lcl;
 
@@ -444,10 +444,10 @@
 }
 
-errno_t fat_directory_lookup_free(fat_directory_t *di, size_t count)
+int fat_directory_lookup_free(fat_directory_t *di, size_t count)
 {
 	fat_dentry_t *d;
 	size_t found;
 	aoff64_t pos;
-	errno_t rc;
+	int rc;
 	
 	do {
@@ -485,5 +485,5 @@
 }
 
-errno_t fat_directory_lookup_name(fat_directory_t *di, const char *name,
+int fat_directory_lookup_name(fat_directory_t *di, const char *name,
     fat_dentry_t **de)
 {
@@ -506,5 +506,5 @@
 {
 	fat_dentry_t *d;
-	errno_t rc;
+	int rc;
 
 	fat_directory_seek(di, 0);
@@ -538,8 +538,8 @@
  * @return EOK on success, ENOENT if not found, EIO on I/O error
  */
-errno_t fat_directory_vollabel_get(fat_directory_t *di, char *label)
+int fat_directory_vollabel_get(fat_directory_t *di, char *label)
 {
 	fat_dentry_t *d;
-	errno_t rc;
+	int rc;
 
 	fat_directory_seek(di, 0);
Index: uspace/srv/fs/fat/fat_directory.h
===================================================================
--- uspace/srv/fs/fat/fat_directory.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/fat/fat_directory.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -29,5 +29,5 @@
 /** @addtogroup fs
  * @{
- */
+ */ 
 
 #ifndef FAT_FAT_DIRECTORY_H_
@@ -52,25 +52,25 @@
 
 
-extern errno_t fat_directory_open(fat_node_t *, fat_directory_t *);
-extern errno_t fat_directory_close(fat_directory_t *);
+extern int fat_directory_open(fat_node_t *, fat_directory_t *);
+extern int fat_directory_close(fat_directory_t *);
 
-extern errno_t fat_directory_next(fat_directory_t *);
-extern errno_t fat_directory_prev(fat_directory_t *);
-extern errno_t fat_directory_seek(fat_directory_t *, aoff64_t);
-extern errno_t fat_directory_get(fat_directory_t *, fat_dentry_t **);
+extern int fat_directory_next(fat_directory_t *);
+extern int fat_directory_prev(fat_directory_t *);
+extern int fat_directory_seek(fat_directory_t *, aoff64_t);
+extern int fat_directory_get(fat_directory_t *, fat_dentry_t **);
 
-extern errno_t fat_directory_read(fat_directory_t *, char *, fat_dentry_t **);
-extern errno_t fat_directory_write(fat_directory_t *, const char *, fat_dentry_t *);
-extern errno_t fat_directory_erase(fat_directory_t *);
-extern errno_t fat_directory_lookup_name(fat_directory_t *, const char *,
+extern int fat_directory_read(fat_directory_t *, char *, fat_dentry_t **);
+extern int fat_directory_write(fat_directory_t *, const char *, fat_dentry_t *);
+extern int fat_directory_erase(fat_directory_t *);
+extern int fat_directory_lookup_name(fat_directory_t *, const char *,
     fat_dentry_t **);
 extern bool fat_directory_is_sfn_exist(fat_directory_t *, fat_dentry_t *);
 
-extern errno_t fat_directory_lookup_free(fat_directory_t *, size_t);
-extern errno_t fat_directory_write_dentry(fat_directory_t *, fat_dentry_t *);
-extern errno_t fat_directory_create_sfn(fat_directory_t *, fat_dentry_t *,
+extern int fat_directory_lookup_free(fat_directory_t *, size_t);
+extern int fat_directory_write_dentry(fat_directory_t *, fat_dentry_t *);
+extern int fat_directory_create_sfn(fat_directory_t *, fat_dentry_t *,
     const char *);
-extern errno_t fat_directory_expand(fat_directory_t *);
-extern errno_t fat_directory_vollabel_get(fat_directory_t *, char *);
+extern int fat_directory_expand(fat_directory_t *);
+extern int fat_directory_vollabel_get(fat_directory_t *, char *);
 
 #endif
Index: uspace/srv/fs/fat/fat_fat.c
===================================================================
--- uspace/srv/fs/fat/fat_fat.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/fat/fat_fat.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -71,7 +71,7 @@
  * @param max_clusters	Maximum number of clusters to visit.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 fat_cluster_walk(fat_bs_t *bs, service_id_t service_id, fat_cluster_t firstc,
     fat_cluster_t *lastc, uint32_t *numc, uint32_t max_clusters)
@@ -80,5 +80,5 @@
 	fat_cluster_t clst = firstc, clst_last1 = FAT_CLST_LAST1(bs);
 	fat_cluster_t clst_bad = FAT_CLST_BAD(bs);
-	errno_t rc;
+	int rc;
 
 	if (firstc == FAT_CLST_RES0) {
@@ -121,7 +121,7 @@
  * @param flags		Flags passed to libblock.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 fat_block_get(block_t **block, struct fat_bs *bs, fat_node_t *nodep,
     aoff64_t bn, int flags)
@@ -130,5 +130,5 @@
 	fat_cluster_t currc = 0;
 	aoff64_t relbn = bn;
-	errno_t rc;
+	int rc;
 
 	if (!nodep->size)
@@ -186,7 +186,7 @@
  * @param flags		Flags passed to libblock.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 _fat_block_get(block_t **block, fat_bs_t *bs, service_id_t service_id,
     fat_cluster_t fcl, fat_cluster_t *clp, aoff64_t bn, int flags)
@@ -195,5 +195,5 @@
 	uint32_t max_clusters;
 	fat_cluster_t c = 0;
-	errno_t rc;
+	int rc;
 
 	/*
@@ -235,12 +235,12 @@
  * @param pos		Position in the last node block.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 fat_fill_gap(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl, aoff64_t pos)
 {
 	block_t *b;
 	aoff64_t o, boundary;
-	errno_t rc;
+	int rc;
 
 	boundary = ROUND_UP(nodep->size, BPS(bs) * SPC(bs));
@@ -287,7 +287,7 @@
  * @param value		Output argument holding the value of the cluster.
  *
- * @return		EOK or an error code.
- */
-static errno_t
+ * @return		EOK or a negative error code.
+ */
+static int
 fat_get_cluster_fat12(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
     fat_cluster_t clst, fat_cluster_t *value)
@@ -296,5 +296,5 @@
 	uint16_t byte1, byte2;
 	aoff64_t offset;
-	errno_t rc;
+	int rc;
 
 	offset = (clst + clst / 2);
@@ -357,7 +357,7 @@
  * @param value		Output argument holding the value of the cluster.
  *
- * @return		EOK or an error code.
- */
-static errno_t
+ * @return		EOK or a negative error code.
+ */
+static int
 fat_get_cluster_fat16(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
     fat_cluster_t clst, fat_cluster_t *value)
@@ -365,5 +365,5 @@
 	block_t *b;
 	aoff64_t offset;
-	errno_t rc;
+	int rc;
 
 	offset = (clst * FAT16_CLST_SIZE);
@@ -388,7 +388,7 @@
  * @param value		Output argument holding the value of the cluster.
  *
- * @return		EOK or an error code.
- */
-static errno_t
+ * @return		EOK or a negative error code.
+ */
+static int
 fat_get_cluster_fat32(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
     fat_cluster_t clst, fat_cluster_t *value)
@@ -396,5 +396,5 @@
 	block_t *b;
 	aoff64_t offset;
-	errno_t rc;
+	int rc;
 
 	offset = (clst * FAT32_CLST_SIZE);
@@ -421,11 +421,11 @@
  * @param value		Output argument holding the value of the cluster.
  *
- * @return		EOK or an error code.
- */
-errno_t
+ * @return		EOK or a negative error code.
+ */
+int
 fat_get_cluster(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
     fat_cluster_t clst, fat_cluster_t *value)
 {
-	errno_t rc;
+	int rc;
 
 	assert(fatno < FATCNT(bs));
@@ -449,7 +449,7 @@
  * @param value		Value to set the cluster with.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t
+ * @return		EOK on success or a negative error code.
+ */
+static int
 fat_set_cluster_fat12(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
     fat_cluster_t clst, fat_cluster_t value)
@@ -458,5 +458,5 @@
 	aoff64_t offset;
 	uint16_t byte1, byte2;
-	errno_t rc;
+	int rc;
 
 	offset = (clst + clst / 2);
@@ -537,7 +537,7 @@
  * @param value		Value to set the cluster with.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t
+ * @return		EOK on success or a negative error code.
+ */
+static int
 fat_set_cluster_fat16(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
     fat_cluster_t clst, fat_cluster_t value)
@@ -545,5 +545,5 @@
 	block_t *b;
 	aoff64_t offset;
-	errno_t rc;
+	int rc;
 
 	offset = (clst * FAT16_CLST_SIZE);
@@ -570,7 +570,7 @@
  * @param value		Value to set the cluster with.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t
+ * @return		EOK on success or a negative error code.
+ */
+static int
 fat_set_cluster_fat32(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
     fat_cluster_t clst, fat_cluster_t value)
@@ -578,5 +578,5 @@
 	block_t *b;
 	aoff64_t offset;
-	errno_t rc;
+	int rc;
 	fat_cluster_t temp;
 
@@ -607,11 +607,11 @@
  * @param value		Value to set the cluster with.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 fat_set_cluster(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
     fat_cluster_t clst, fat_cluster_t value)
 {
-	errno_t rc;
+	int rc;
 
 	assert(fatno < FATCNT(bs));
@@ -634,7 +634,7 @@
  * @param nclsts	Number of clusters in the lifo chain.
  *
- * @return		EOK on success or an error code.
- */
-errno_t fat_alloc_shadow_clusters(fat_bs_t *bs, service_id_t service_id,
+ * @return		EOK on success or a negative error code.
+ */
+int fat_alloc_shadow_clusters(fat_bs_t *bs, service_id_t service_id,
     fat_cluster_t *lifo, unsigned nclsts)
 {
@@ -642,5 +642,5 @@
 	unsigned c;
 	fat_cluster_t clst_last1 = FAT_CLST_LAST1(bs);
-	errno_t rc;
+	int rc;
 
 	for (fatno = FAT1 + 1; fatno < FATCNT(bs); fatno++) {
@@ -671,7 +671,7 @@
  *			will be returned.
  *
- * @return		EOK on success, an error code otherwise.
- */
-errno_t
+ * @return		EOK on success, a negative error code otherwise.
+ */
+int
 fat_alloc_clusters(fat_bs_t *bs, service_id_t service_id, unsigned nclsts,
     fat_cluster_t *mcl, fat_cluster_t *lcl)
@@ -682,5 +682,5 @@
 	fat_cluster_t value = 0;
 	fat_cluster_t clst_last1 = FAT_CLST_LAST1(bs);
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	lifo = (fat_cluster_t *) malloc(nclsts * sizeof(fat_cluster_t));
@@ -742,7 +742,7 @@
  * @param firstc	First cluster in the chain which is to be freed.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative return code.
+ */
+int
 fat_free_clusters(fat_bs_t *bs, service_id_t service_id, fat_cluster_t firstc)
 {
@@ -750,5 +750,5 @@
 	fat_cluster_t nextc = 0;
 	fat_cluster_t clst_bad = FAT_CLST_BAD(bs);
-	errno_t rc;
+	int rc;
 
 	/* Mark all clusters in the chain as free in all copies of FAT. */
@@ -780,7 +780,7 @@
  * @param lcl		Last cluster of the cluster chain to append.
  *
- * @return		EOK on success or an error code.
- */
-errno_t fat_append_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl,
+ * @return		EOK on success or a negative error code.
+ */
+int fat_append_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl,
     fat_cluster_t lcl)
 {
@@ -788,5 +788,5 @@
 	fat_cluster_t lastc = 0;
 	uint8_t fatno;
-	errno_t rc;
+	int rc;
 
 	if (nodep->firstc == FAT_CLST_RES0) {
@@ -827,10 +827,10 @@
  *			be chopped off.
  *
- * @return		EOK on success or an error code.
- */
-errno_t fat_chop_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t lcl)
+ * @return		EOK on success or a negative return code.
+ */
+int fat_chop_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t lcl)
 {
 	fat_cluster_t clst_last1 = FAT_CLST_LAST1(bs);
-	errno_t rc;
+	int rc;
 	service_id_t service_id = nodep->idx->service_id;
 
@@ -880,10 +880,10 @@
 }
 
-errno_t
+int
 fat_zero_cluster(struct fat_bs *bs, service_id_t service_id, fat_cluster_t c)
 {
 	int i;
 	block_t *b;
-	errno_t rc;
+	int rc;
 
 	for (i = 0; i < SPC(bs); i++) {
@@ -908,10 +908,10 @@
  * does not contain a fat file system.
  */
-errno_t fat_sanity_check(fat_bs_t *bs, service_id_t service_id)
+int fat_sanity_check(fat_bs_t *bs, service_id_t service_id)
 {
 	fat_cluster_t e0 = 0;
 	fat_cluster_t e1 = 0;
 	unsigned fat_no;
-	errno_t rc;
+	int rc;
 
 	/* Check number of FATs. */
Index: uspace/srv/fs/fat/fat_fat.h
===================================================================
--- uspace/srv/fs/fat/fat_fat.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/fat/fat_fat.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -108,29 +108,29 @@
 #define fat_clusters_get(numc, bs, sid, fc) \
     fat_cluster_walk((bs), (sid), (fc), NULL, (numc), (uint32_t) -1)
-extern errno_t fat_cluster_walk(struct fat_bs *, service_id_t, fat_cluster_t,
+extern int fat_cluster_walk(struct fat_bs *, service_id_t, fat_cluster_t,
     fat_cluster_t *, uint32_t *, uint32_t);
 
-extern errno_t fat_block_get(block_t **, struct fat_bs *, struct fat_node *,
+extern int fat_block_get(block_t **, struct fat_bs *, struct fat_node *,
     aoff64_t, int);
-extern errno_t _fat_block_get(block_t **, struct fat_bs *, service_id_t,
+extern int _fat_block_get(block_t **, struct fat_bs *, service_id_t,
     fat_cluster_t, fat_cluster_t *, aoff64_t, int);
 
-extern errno_t fat_append_clusters(struct fat_bs *, struct fat_node *,
+extern int fat_append_clusters(struct fat_bs *, struct fat_node *,
     fat_cluster_t, fat_cluster_t);
-extern errno_t fat_chop_clusters(struct fat_bs *, struct fat_node *,
+extern int fat_chop_clusters(struct fat_bs *, struct fat_node *,
     fat_cluster_t);
-extern errno_t fat_alloc_clusters(struct fat_bs *, service_id_t, unsigned,
+extern int fat_alloc_clusters(struct fat_bs *, service_id_t, unsigned,
     fat_cluster_t *, fat_cluster_t *);
-extern errno_t fat_free_clusters(struct fat_bs *, service_id_t, fat_cluster_t);
-extern errno_t fat_alloc_shadow_clusters(struct fat_bs *, service_id_t,
+extern int fat_free_clusters(struct fat_bs *, service_id_t, fat_cluster_t);
+extern int fat_alloc_shadow_clusters(struct fat_bs *, service_id_t,
     fat_cluster_t *, unsigned);
-extern errno_t fat_get_cluster(struct fat_bs *, service_id_t, unsigned,
+extern int fat_get_cluster(struct fat_bs *, service_id_t, unsigned,
     fat_cluster_t, fat_cluster_t *);
-extern errno_t fat_set_cluster(struct fat_bs *, service_id_t, unsigned,
+extern int fat_set_cluster(struct fat_bs *, service_id_t, unsigned,
     fat_cluster_t, fat_cluster_t);
-extern errno_t fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t,
+extern int fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t,
     aoff64_t);
-extern errno_t fat_zero_cluster(struct fat_bs *, service_id_t, fat_cluster_t);
-extern errno_t fat_sanity_check(struct fat_bs *, service_id_t);
+extern int fat_zero_cluster(struct fat_bs *, service_id_t, fat_cluster_t);
+extern int fat_sanity_check(struct fat_bs *, service_id_t);
 
 #endif
Index: uspace/srv/fs/fat/fat_idx.c
===================================================================
--- uspace/srv/fs/fat/fat_idx.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/fat/fat_idx.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -328,5 +328,5 @@
 }
 
-static errno_t fat_idx_create(fat_idx_t **fidxp, service_id_t service_id)
+static int fat_idx_create(fat_idx_t **fidxp, service_id_t service_id)
 {
 	fat_idx_t *fidx;
@@ -350,8 +350,8 @@
 }
 
-errno_t fat_idx_get_new(fat_idx_t **fidxp, service_id_t service_id)
+int fat_idx_get_new(fat_idx_t **fidxp, service_id_t service_id)
 {
 	fat_idx_t *fidx;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&used_lock);
@@ -386,5 +386,5 @@
 		fidx = hash_table_get_inst(l, fat_idx_t, uph_link);
 	} else {
-		errno_t rc;
+		int rc;
 
 		rc = fat_idx_create(&fidx, service_id);
@@ -467,5 +467,5 @@
 }
 
-errno_t fat_idx_init(void)
+int fat_idx_init(void)
 {
 	if (!hash_table_create(&up_hash, 0, 0, &uph_ops)) 
@@ -486,8 +486,8 @@
 }
 
-errno_t fat_idx_init_by_service_id(service_id_t service_id)
+int fat_idx_init_by_service_id(service_id_t service_id)
 {
 	unused_t *u;
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	u = (unused_t *) malloc(sizeof(unused_t));
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/fat/fat_ops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -73,14 +73,14 @@
  * Forward declarations of FAT libfs operations.
  */
-static errno_t fat_root_get(fs_node_t **, service_id_t);
-static errno_t fat_match(fs_node_t **, fs_node_t *, const char *);
-static errno_t fat_node_get(fs_node_t **, service_id_t, fs_index_t);
-static errno_t fat_node_open(fs_node_t *);
-static errno_t fat_node_put(fs_node_t *);
-static errno_t fat_create_node(fs_node_t **, service_id_t, int);
-static errno_t fat_destroy_node(fs_node_t *);
-static errno_t fat_link(fs_node_t *, fs_node_t *, const char *);
-static errno_t fat_unlink(fs_node_t *, fs_node_t *, const char *);
-static errno_t fat_has_children(bool *, fs_node_t *);
+static int fat_root_get(fs_node_t **, service_id_t);
+static int fat_match(fs_node_t **, fs_node_t *, const char *);
+static int fat_node_get(fs_node_t **, service_id_t, fs_index_t);
+static int fat_node_open(fs_node_t *);
+static int fat_node_put(fs_node_t *);
+static int fat_create_node(fs_node_t **, service_id_t, int);
+static int fat_destroy_node(fs_node_t *);
+static int fat_link(fs_node_t *, fs_node_t *, const char *);
+static int fat_unlink(fs_node_t *, fs_node_t *, const char *);
+static int fat_has_children(bool *, fs_node_t *);
 static fs_index_t fat_index_get(fs_node_t *);
 static aoff64_t fat_size_get(fs_node_t *);
@@ -89,7 +89,7 @@
 static bool fat_is_file(fs_node_t *node);
 static service_id_t fat_service_get(fs_node_t *node);
-static errno_t fat_size_block(service_id_t, uint32_t *);
-static errno_t fat_total_block_count(service_id_t, uint64_t *);
-static errno_t fat_free_block_count(service_id_t, uint64_t *);
+static int fat_size_block(service_id_t, uint32_t *);
+static int fat_total_block_count(service_id_t, uint64_t *);
+static int fat_free_block_count(service_id_t, uint64_t *);
 
 /*
@@ -114,10 +114,10 @@
 }
 
-static errno_t fat_node_sync(fat_node_t *node)
+static int fat_node_sync(fat_node_t *node)
 {
 	block_t *b;
 	fat_bs_t *bs;
 	fat_dentry_t *d;
-	errno_t rc;
+	int rc;
 
 	assert(node->dirty);
@@ -148,7 +148,7 @@
 }
 
-static errno_t fat_node_fini_by_service_id(service_id_t service_id)
-{
-	errno_t rc;
+static int fat_node_fini_by_service_id(service_id_t service_id)
+{
+	int rc;
 
 	/*
@@ -204,9 +204,9 @@
 }
 
-static errno_t fat_node_get_new(fat_node_t **nodepp)
+static int fat_node_get_new(fat_node_t **nodepp)
 {
 	fs_node_t *fn;
 	fat_node_t *nodep;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&ffn_mutex);
@@ -266,5 +266,5 @@
  * @param idxp		Locked index structure.
  */
-static errno_t fat_node_get_core(fat_node_t **nodepp, fat_idx_t *idxp)
+static int fat_node_get_core(fat_node_t **nodepp, fat_idx_t *idxp)
 {
 	block_t *b;
@@ -272,5 +272,5 @@
 	fat_dentry_t *d;
 	fat_node_t *nodep = NULL;
-	errno_t rc;
+	int rc;
 
 	if (idxp->nodep) {
@@ -365,10 +365,10 @@
  */
 
-errno_t fat_root_get(fs_node_t **rfn, service_id_t service_id)
+int fat_root_get(fs_node_t **rfn, service_id_t service_id)
 {
 	return fat_node_get(rfn, service_id, 0);
 }
 
-errno_t fat_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
+int fat_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
 {
 	fat_node_t *parentp = FAT_NODE(pfn);
@@ -376,5 +376,5 @@
 	fat_dentry_t *d;
 	service_id_t service_id;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&parentp->idx->lock);
@@ -426,9 +426,9 @@
 
 /** Instantiate a FAT in-core node. */
-errno_t fat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
+int fat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
 {
 	fat_node_t *nodep;
 	fat_idx_t *idxp;
-	errno_t rc;
+	int rc;
 
 	idxp = fat_idx_get_by_index(service_id, index);
@@ -445,5 +445,5 @@
 }
 
-errno_t fat_node_open(fs_node_t *fn)
+int fat_node_open(fs_node_t *fn)
 {
 	/*
@@ -454,5 +454,5 @@
 }
 
-errno_t fat_node_put(fs_node_t *fn)
+int fat_node_put(fs_node_t *fn)
 {
 	fat_node_t *nodep = FAT_NODE(fn);
@@ -483,5 +483,5 @@
 }
 
-errno_t fat_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
+int fat_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
 {
 	fat_idx_t *idxp;
@@ -489,5 +489,5 @@
 	fat_bs_t *bs;
 	fat_cluster_t mcl, lcl;
-	errno_t rc;
+	int rc;
 
 	bs = block_bb_get(service_id);
@@ -538,10 +538,10 @@
 }
 
-errno_t fat_destroy_node(fs_node_t *fn)
+int fat_destroy_node(fs_node_t *fn)
 {
 	fat_node_t *nodep = FAT_NODE(fn);
 	fat_bs_t *bs;
 	bool has_children;
-	errno_t rc;
+	int rc;
 
 	/*
@@ -575,5 +575,5 @@
 }
 
-errno_t fat_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
+int fat_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
 {
 	fat_node_t *parentp = FAT_NODE(pfn);
@@ -584,5 +584,5 @@
 	fat_directory_t di;
 	fat_dentry_t de;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&childp->lock);
@@ -696,10 +696,10 @@
 }
 
-errno_t fat_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
+int fat_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
 {
 	fat_node_t *parentp = FAT_NODE(pfn);
 	fat_node_t *childp = FAT_NODE(cfn);
 	bool has_children;
-	errno_t rc;
+	int rc;
 
 	if (!parentp)
@@ -753,5 +753,5 @@
 }
 
-errno_t fat_has_children(bool *has_children, fs_node_t *fn)
+int fat_has_children(bool *has_children, fs_node_t *fn)
 {
 	fat_bs_t *bs;
@@ -760,5 +760,5 @@
 	block_t *b;
 	unsigned i, j;
-	errno_t rc;
+	int rc;
 
 	if (nodep->type != FAT_DIRECTORY) {
@@ -843,5 +843,5 @@
 }
 
-errno_t fat_size_block(service_id_t service_id, uint32_t *size)
+int fat_size_block(service_id_t service_id, uint32_t *size)
 {
 	fat_bs_t *bs;
@@ -853,5 +853,5 @@
 }
 
-errno_t fat_total_block_count(service_id_t service_id, uint64_t *count)
+int fat_total_block_count(service_id_t service_id, uint64_t *count)
 {
 	fat_bs_t *bs;
@@ -863,10 +863,10 @@
 }
 
-errno_t fat_free_block_count(service_id_t service_id, uint64_t *count)
+int fat_free_block_count(service_id_t service_id, uint64_t *count)
 {
 	fat_bs_t *bs;
 	fat_cluster_t e0;
 	uint64_t block_count;
-	errno_t rc;
+	int rc;
 	uint32_t cluster_no, clusters;
 
@@ -910,9 +910,9 @@
 };
 
-static errno_t fat_fs_open(service_id_t service_id, enum cache_mode cmode,
+static int fat_fs_open(service_id_t service_id, enum cache_mode cmode,
     fs_node_t **rrfn, fat_idx_t **rridxp)
 {
 	fat_bs_t *bs;
-	errno_t rc;
+	int rc;
 
 	/* initialize libblock */
@@ -1037,5 +1037,5 @@
  */
 
-static errno_t fat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
+static int fat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
 {
 	fat_idx_t *ridxp;
@@ -1044,5 +1044,5 @@
 	fat_directory_t di;
 	char label[FAT_VOLLABEL_LEN + 1];
-	errno_t rc;
+	int rc;
 
 	rc = fat_fs_open(service_id, CACHE_MODE_WT, &rfn, &ridxp);
@@ -1076,5 +1076,5 @@
 }
 
-static errno_t
+static int
 fat_mounted(service_id_t service_id, const char *opts, fs_index_t *index,
     aoff64_t *size)
@@ -1084,5 +1084,5 @@
 	fat_idx_t *ridxp;
 	fs_node_t *rfn;
-	errno_t rc;
+	int rc;
 
 	instance = malloc(sizeof(fat_instance_t));
@@ -1125,10 +1125,10 @@
 }
 
-static errno_t fat_update_fat32_fsinfo(service_id_t service_id)
+static int fat_update_fat32_fsinfo(service_id_t service_id)
 {
 	fat_bs_t *bs;
 	fat32_fsinfo_t *info;
 	block_t *b;
-	errno_t rc;
+	int rc;
 
 	bs = block_bb_get(service_id);
@@ -1156,10 +1156,10 @@
 }
 
-static errno_t fat_unmounted(service_id_t service_id)
+static int fat_unmounted(service_id_t service_id)
 {
 	fs_node_t *fn;
 	fat_node_t *nodep;
 	fat_bs_t *bs;
-	errno_t rc;
+	int rc;
 
 	bs = block_bb_get(service_id);
@@ -1208,5 +1208,5 @@
 }
 
-static errno_t
+static int
 fat_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *rbytes)
@@ -1217,5 +1217,5 @@
 	size_t bytes;
 	block_t *b;
-	errno_t rc;
+	int rc;
 
 	rc = fat_node_get(&fn, service_id, index);
@@ -1318,5 +1318,5 @@
 }
 
-static errno_t
+static int
 fat_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *wbytes, aoff64_t *nsize)
@@ -1329,5 +1329,5 @@
 	aoff64_t boundary;
 	int flags = BLOCK_FLAGS_NONE;
-	errno_t rc;
+	int rc;
 	
 	rc = fat_node_get(&fn, service_id, index);
@@ -1455,5 +1455,5 @@
 }
 
-static errno_t
+static int
 fat_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
 {
@@ -1461,5 +1461,5 @@
 	fat_node_t *nodep;
 	fat_bs_t *bs;
-	errno_t rc;
+	int rc;
 
 	rc = fat_node_get(&fn, service_id, index);
@@ -1514,14 +1514,14 @@
 }
 
-static errno_t fat_close(service_id_t service_id, fs_index_t index)
-{
-	return EOK;
-}
-
-static errno_t fat_destroy(service_id_t service_id, fs_index_t index)
+static int fat_close(service_id_t service_id, fs_index_t index)
+{
+	return EOK;
+}
+
+static int fat_destroy(service_id_t service_id, fs_index_t index)
 {
 	fs_node_t *fn;
 	fat_node_t *nodep;
-	errno_t rc;
+	int rc;
 
 	rc = fat_node_get(&fn, service_id, index);
@@ -1542,8 +1542,8 @@
 }
 
-static errno_t fat_sync(service_id_t service_id, fs_index_t index)
+static int fat_sync(service_id_t service_id, fs_index_t index)
 {
 	fs_node_t *fn;
-	errno_t rc = fat_node_get(&fn, service_id, index);
+	int rc = fat_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
Index: uspace/srv/fs/locfs/locfs.c
===================================================================
--- uspace/srv/fs/locfs/locfs.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/locfs/locfs.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,8 +44,6 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <task.h>
 #include <libfs.h>
-#include <str.h>
 #include "locfs.h"
 #include "locfs_ops.h"
@@ -86,8 +84,8 @@
 	}
 	
-	errno_t rc = fs_register(vfs_sess, &locfs_vfs_info, &locfs_ops,
+	int rc = fs_register(vfs_sess, &locfs_vfs_info, &locfs_ops,
 	    &locfs_libfs_ops);
 	if (rc != EOK) {
-		printf("%s: Failed to register file system: %s\n", NAME, str_error(rc));
+		printf("%s: Failed to register file system (%d)\n", NAME, rc);
 		return rc;
 	}
Index: uspace/srv/fs/locfs/locfs.h
===================================================================
--- uspace/srv/fs/locfs/locfs.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/locfs/locfs.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -29,5 +29,5 @@
 /** @addtogroup fs
  * @{
- */
+ */ 
 
 #ifndef LOCFS_LOCFS_H_
Index: uspace/srv/fs/locfs/locfs_ops.c
===================================================================
--- uspace/srv/fs/locfs/locfs_ops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/locfs/locfs_ops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -101,5 +101,5 @@
 };
 
-static errno_t locfs_node_get_internal(fs_node_t **rfn, loc_object_type_t type,
+static int locfs_node_get_internal(fs_node_t **rfn, loc_object_type_t type,
     service_id_t service_id)
 {
@@ -125,13 +125,13 @@
 }
 
-static errno_t locfs_root_get(fs_node_t **rfn, service_id_t service_id)
+static int locfs_root_get(fs_node_t **rfn, service_id_t service_id)
 {
 	return locfs_node_get_internal(rfn, LOC_OBJECT_NONE, 0);
 }
 
-static errno_t locfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
+static int locfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
 {
 	locfs_node_t *node = (locfs_node_t *) pfn->data;
-	errno_t ret;
+	int ret;
 	
 	if (node->service_id == 0) {
@@ -208,10 +208,10 @@
 }
 
-static errno_t locfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
+static int locfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
 {
 	return locfs_node_get_internal(rfn, loc_id_probe(index), index);
 }
 
-static errno_t locfs_node_open(fs_node_t *fn)
+static int locfs_node_open(fs_node_t *fn)
 {
 	locfs_node_t *node = (locfs_node_t *) fn->data;
@@ -312,5 +312,5 @@
 }
 
-static errno_t locfs_node_put(fs_node_t *fn)
+static int locfs_node_put(fs_node_t *fn)
 {
 	free(fn->data);
@@ -319,5 +319,5 @@
 }
 
-static errno_t locfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag)
+static int locfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag)
 {
 	assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY));
@@ -327,20 +327,20 @@
 }
 
-static errno_t locfs_destroy_node(fs_node_t *fn)
+static int locfs_destroy_node(fs_node_t *fn)
 {
 	return ENOTSUP;
 }
 
-static errno_t locfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
+static int locfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
 {
 	return ENOTSUP;
 }
 
-static errno_t locfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
+static int locfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
 {
 	return ENOTSUP;
 }
 
-static errno_t locfs_has_children(bool *has_children, fs_node_t *fn)
+static int locfs_has_children(bool *has_children, fs_node_t *fn)
 {
 	locfs_node_t *node = (locfs_node_t *) fn->data;
@@ -455,10 +455,10 @@
 }
 
-static errno_t locfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
+static int locfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
 {
 	return ENOTSUP;
 }
 
-static errno_t locfs_mounted(service_id_t service_id, const char *opts,
+static int locfs_mounted(service_id_t service_id, const char *opts,
     fs_index_t *index, aoff64_t *size)
 {
@@ -468,10 +468,10 @@
 }
 
-static errno_t locfs_unmounted(service_id_t service_id)
+static int locfs_unmounted(service_id_t service_id)
 {
 	return ENOTSUP;
 }
 
-static errno_t
+static int
 locfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *rbytes)
@@ -590,9 +590,9 @@
 		
 		/* Wait for reply from the driver. */
-		errno_t rc;
+		sysarg_t rc;
 		async_wait_for(msg, &rc);
 
 		/* Do not propagate EHANGUP back to VFS. */
-		if ((errno_t) rc == EHANGUP)
+		if ((int) rc == EHANGUP)
 			rc = ENOTSUP;
 		
@@ -604,5 +604,5 @@
 }
 
-static errno_t
+static int
 locfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *wbytes, aoff64_t *nsize)
@@ -654,9 +654,9 @@
 		
 		/* Wait for reply from the driver. */
-		errno_t rc;
+		sysarg_t rc;
 		async_wait_for(msg, &rc);
 
 		/* Do not propagate EHANGUP back to VFS. */
-		if ((errno_t) rc == EHANGUP)
+		if ((int) rc == EHANGUP)
 			rc = ENOTSUP;
 		
@@ -669,5 +669,5 @@
 }
 
-static errno_t
+static int
 locfs_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
 {
@@ -675,5 +675,5 @@
 }
 
-static errno_t locfs_close(service_id_t service_id, fs_index_t index)
+static int locfs_close(service_id_t service_id, fs_index_t index)
 {
 	if (index == 0)
@@ -715,5 +715,5 @@
 }
 
-static errno_t locfs_sync(service_id_t service_id, fs_index_t index)
+static int locfs_sync(service_id_t service_id, fs_index_t index)
 {
 	if (index == 0)
@@ -752,5 +752,5 @@
 		
 		/* Wait for reply from the driver */
-		errno_t rc;
+		sysarg_t rc;
 		async_wait_for(msg, &rc);
 		
@@ -761,5 +761,5 @@
 }
 
-static errno_t locfs_destroy(service_id_t service_id, fs_index_t index)
+static int locfs_destroy(service_id_t service_id, fs_index_t index)
 {
 	return ENOTSUP;
Index: uspace/srv/fs/mfs/mfs.c
===================================================================
--- uspace/srv/fs/mfs/mfs.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/mfs/mfs.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <task.h>
 #include <stdio.h>
@@ -59,5 +58,5 @@
 int main(int argc, char **argv)
 {
-	errno_t rc;
+	int rc;
 
 	printf(NAME ": HelenOS Minix file system server\n");
@@ -68,5 +67,5 @@
 		else {
 			printf(NAME " Unrecognized parameters");
-			rc = EINVAL;
+			rc = -1;
 			goto err;
 		}
@@ -78,6 +77,5 @@
 	if (!vfs_sess) {
 		printf(NAME ": failed to connect to VFS\n");
-		rc = errno;
-		goto err;
+		return -1;
 	}
 
@@ -99,5 +97,5 @@
 
 err:
-	printf(NAME ": Failed to register file system: %s\n", str_error(rc));
+	printf(NAME ": Failed to register file system (%d)\n", rc);
 	return rc;
 }
Index: uspace/srv/fs/mfs/mfs.h
===================================================================
--- uspace/srv/fs/mfs/mfs.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/mfs/mfs.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -169,60 +169,60 @@
 extern libfs_ops_t mfs_libfs_ops;
 
-extern errno_t
+extern int
 mfs_global_init(void);
 
 /* mfs_inode.c */
-extern errno_t
+extern int
 mfs_get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i,
     fs_index_t index);
 
-extern errno_t
+extern int
 mfs_put_inode(struct mfs_node *mnode);
 
-extern errno_t
+extern int
 mfs_inode_shrink(struct mfs_node *mnode, size_t size_shrink);
 
 /* mfs_rw.c */
-extern errno_t
+extern int
 mfs_read_map(uint32_t *b, const struct mfs_node *mnode, const uint32_t pos);
 
-extern errno_t
+extern int
 mfs_write_map(struct mfs_node *mnode, uint32_t pos, uint32_t new_zone,
     uint32_t *old_zone);
 
-extern errno_t
+extern int
 mfs_prune_ind_zones(struct mfs_node *mnode, size_t new_size);
 
 /* mfs_dentry.c */
-extern errno_t
+extern int
 mfs_read_dentry(struct mfs_node *mnode,
     struct mfs_dentry_info *d_info, unsigned index);
 
-extern errno_t
+extern int
 mfs_write_dentry(struct mfs_dentry_info *d_info);
 
-extern errno_t
+extern int
 mfs_remove_dentry(struct mfs_node *mnode, const char *d_name);
 
-extern errno_t
+extern int
 mfs_insert_dentry(struct mfs_node *mnode, const char *d_name, fs_index_t d_inum);
 
 /* mfs_balloc.c */
-extern errno_t
+extern int
 mfs_alloc_inode(struct mfs_instance *inst, uint32_t *inum);
 
-extern errno_t
+extern int
 mfs_free_inode(struct mfs_instance *inst, uint32_t inum);
 
-extern errno_t
+extern int
 mfs_alloc_zone(struct mfs_instance *inst, uint32_t *zone);
 
-extern errno_t
+extern int
 mfs_free_zone(struct mfs_instance *inst, uint32_t zone);
 
-extern errno_t
+extern int
 mfs_count_free_zones(struct mfs_instance *inst, uint32_t *zones);
 
-extern errno_t
+extern int
 mfs_count_free_inodes(struct mfs_instance *inst, uint32_t *inodes);
 
Index: uspace/srv/fs/mfs/mfs_balloc.c
===================================================================
--- uspace/srv/fs/mfs/mfs_balloc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/mfs/mfs_balloc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,11 +38,11 @@
     const bool native, unsigned start_bit);
 
-static errno_t
+static int
 mfs_free_bit(struct mfs_instance *inst, uint32_t idx, bmap_id_t bid);
 
-static errno_t
+static int
 mfs_alloc_bit(struct mfs_instance *inst, uint32_t *idx, bmap_id_t bid);
 
-static errno_t
+static int
 mfs_count_free_bits(struct mfs_instance *inst, bmap_id_t bid, uint32_t *free);
 
@@ -54,10 +54,10 @@
  * 			the new inode will be saved.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 mfs_alloc_inode(struct mfs_instance *inst, uint32_t *inum)
 {
-	errno_t r = mfs_alloc_bit(inst, inum, BMAP_INODE);
+	int r = mfs_alloc_bit(inst, inum, BMAP_INODE);
 	return r;
 }
@@ -68,7 +68,7 @@
  * @param inum		Number of the inode to free.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 mfs_free_inode(struct mfs_instance *inst, uint32_t inum)
 {
@@ -82,10 +82,10 @@
  * 			of the zone will be saved.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 mfs_alloc_zone(struct mfs_instance *inst, uint32_t *zone)
 {
-	errno_t r = mfs_alloc_bit(inst, zone, BMAP_ZONE);
+	int r = mfs_alloc_bit(inst, zone, BMAP_ZONE);
 	if (r != EOK)
 		return r;
@@ -105,10 +105,10 @@
  * @param zone		Index of the zone to free.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 mfs_free_zone(struct mfs_instance *inst, uint32_t zone)
 {
-	errno_t r;
+	int r;
 
 	zone -= inst->sbi->firstdatazone - 1;
@@ -132,7 +132,7 @@
  *                      will be stored.
  *
- * @return              EOK on success or an error code.
- */
-errno_t
+ * @return              EOK on success or a negative error code.
+ */
+int
 mfs_count_free_zones(struct mfs_instance *inst, uint32_t *zones)
 {
@@ -146,8 +146,8 @@
  *                      will be stored.
  *
- * @return              EOK on success or an error code.
- */
-
-errno_t
+ * @return              EOK on success or a negative error code.
+ */
+
+int
 mfs_count_free_inodes(struct mfs_instance *inst, uint32_t *inodes)
 {
@@ -162,10 +162,10 @@
  *                      will be stores.
  *
- * @return              EOK on success or an error code.
- */
-static errno_t
+ * @return              EOK on success or a negative error code.
+ */
+static int
 mfs_count_free_bits(struct mfs_instance *inst, bmap_id_t bid, uint32_t *free)
 {
-	errno_t r;
+	int r;
 	unsigned start_block;
 	unsigned long nblocks;
@@ -226,11 +226,11 @@
  * 			BMAP_INODE if operating on the inode's bitmap.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t
+ * @return		EOK on success or a negative error code.
+ */
+static int
 mfs_free_bit(struct mfs_instance *inst, uint32_t idx, bmap_id_t bid)
 {
 	struct mfs_sb_info *sbi;
-	errno_t r;
+	int r;
 	unsigned start_block;
 	unsigned *search;
@@ -246,5 +246,5 @@
 			printf(NAME ": Error! Trying to free beyond the "
 			    "bitmap max size\n");
-			return EIO;
+			return -1;
 		}
 	} else {
@@ -254,5 +254,5 @@
 			printf(NAME ": Error! Trying to free beyond the "
 			    "bitmap max size\n");
-			return EIO;
+			return -1;
 		}
 	}
@@ -293,7 +293,7 @@
  * 			BMAP_INODE if operating on the inode's bitmap.
  *
- * @return		EOK on success or an error code.
- */
-static errno_t
+ * @return		EOK on success or a negative error code.
+ */
+static int
 mfs_alloc_bit(struct mfs_instance *inst, uint32_t *idx, bmap_id_t bid)
 {
@@ -303,6 +303,5 @@
 	unsigned *search, i, start_block;
 	unsigned bits_per_block;
-	errno_t r;
-	int freebit;
+	int r, freebit;
 
 	sbi = inst->sbi;
Index: uspace/srv/fs/mfs/mfs_dentry.c
===================================================================
--- uspace/srv/fs/mfs/mfs_dentry.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/mfs/mfs_dentry.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -31,5 +31,4 @@
  */
 
-#include <str.h>
 #include "mfs.h"
 
@@ -41,7 +40,7 @@
  * @param index		index of the dentry in the list.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 mfs_read_dentry(struct mfs_node *mnode,
     struct mfs_dentry_info *d_info, unsigned index)
@@ -53,5 +52,5 @@
 	block_t *b;
 
-	errno_t r = mfs_read_map(&block, mnode, index * sbi->dirsize);
+	int r = mfs_read_map(&block, mnode, index * sbi->dirsize);
 	if (r != EOK)
 		goto out_err;
@@ -104,7 +103,7 @@
  * @param d_info The directory entry to write to disk.
  *
- * @return	 EOK on success or an error code.
- */
-errno_t
+ * @return	 EOK on success or a negative error code.
+ */
+int
 mfs_write_dentry(struct mfs_dentry_info *d_info)
 {
@@ -115,5 +114,5 @@
 	block_t *b;
 	uint32_t block;
-	errno_t r;
+	int r;
 
 	r = mfs_read_map(&block, mnode, d_off_bytes);
@@ -155,12 +154,12 @@
  * @param d_name	Name of the directory entry to delete.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 mfs_remove_dentry(struct mfs_node *mnode, const char *d_name)
 {
 	struct mfs_sb_info *sbi = mnode->instance->sbi;
 	struct mfs_dentry_info d_info;
-	errno_t r;
+	int r;
 
 	const size_t name_len = str_size(d_name);
@@ -196,11 +195,11 @@
  * @param d_inum	index of the inode that will be pointed by the new dentry.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 mfs_insert_dentry(struct mfs_node *mnode, const char *d_name,
     fs_index_t d_inum)
 {
-	errno_t r;
+	int r;
 	struct mfs_sb_info *sbi = mnode->instance->sbi;
 	struct mfs_dentry_info d_info;
Index: uspace/srv/fs/mfs/mfs_inode.c
===================================================================
--- uspace/srv/fs/mfs/mfs_inode.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/mfs/mfs_inode.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,15 +34,15 @@
 #include "mfs.h"
 
-static errno_t
+static int
 mfs_write_inode_raw(struct mfs_node *mnode);
 
-static errno_t
+static int
 mfs2_write_inode_raw(struct mfs_node *mnode);
 
-static errno_t
+static int
 mfs_read_inode_raw(const struct mfs_instance *instance,
     struct mfs_ino_info **ino_ptr, uint16_t inum);
 
-static errno_t
+static int
 mfs2_read_inode_raw(const struct mfs_instance *instance,
     struct mfs_ino_info **ino_ptr, uint32_t inum);
@@ -55,12 +55,12 @@
  * @param index		index of the inode to read.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 mfs_get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i,
     fs_index_t index)
 {
 	struct mfs_sb_info *sbi = inst->sbi;
-	errno_t r;
+	int r;
 
 	if (sbi->fs_version == MFS_VERSION_V1) {
@@ -75,5 +75,5 @@
 }
 
-static errno_t
+static int
 mfs_read_inode_raw(const struct mfs_instance *instance,
     struct mfs_ino_info **ino_ptr, uint16_t inum)
@@ -83,6 +83,5 @@
 	struct mfs_sb_info *sbi;
 	block_t *b;
-	int i;
-	errno_t r;
+	int i, r;
 
 	sbi = instance->sbi;
@@ -135,5 +134,5 @@
 }
 
-static errno_t
+static int
 mfs2_read_inode_raw(const struct mfs_instance *instance,
     struct mfs_ino_info **ino_ptr, uint32_t inum)
@@ -143,6 +142,5 @@
 	struct mfs_sb_info *sbi;
 	block_t *b;
-	int i;
-	errno_t r;
+	int i, r;
 
 	ino_i = malloc(sizeof(*ino_i));
@@ -201,10 +199,10 @@
  * @param mnode		Pointer to the generic MINIX inode in memory.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 mfs_put_inode(struct mfs_node *mnode)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 
 	if (!mnode->ino_i->dirty)
@@ -223,9 +221,8 @@
 }
 
-static errno_t
+static int
 mfs_write_inode_raw(struct mfs_node *mnode)
 {
-	int i;
-	errno_t r;
+	int i, r;
 	block_t *b;
 	struct mfs_ino_info *ino_i = mnode->ino_i;
@@ -267,5 +264,5 @@
 }
 
-static errno_t
+static int
 mfs2_write_inode_raw(struct mfs_node *mnode)
 {
@@ -273,6 +270,5 @@
 	struct mfs_sb_info *sbi = mnode->instance->sbi;
 	block_t *b;
-	int i;
-	errno_t r;
+	int i, r;
 
 	const uint32_t inum = ino_i->index - 1;
@@ -319,7 +315,7 @@
  * @param size_shrink	Number of bytes that will be subtracted to the inode.
  *
- * @return		EOK on success or an error code.
- */
-errno_t
+ * @return		EOK on success or a negative error code.
+ */
+int
 mfs_inode_shrink(struct mfs_node *mnode, size_t size_shrink)
 {
@@ -327,5 +323,5 @@
 	struct mfs_ino_info *ino_i = mnode->ino_i;
 	const size_t bs = sbi->block_size;
-	errno_t r;
+	int r;
 
 	if (size_shrink == 0) {
Index: uspace/srv/fs/mfs/mfs_ops.c
===================================================================
--- uspace/srv/fs/mfs/mfs_ops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/mfs/mfs_ops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <adt/hash_table.h>
 #include <adt/hash.h>
-#include <str.h>
 #include "mfs.h"
 
@@ -42,30 +41,30 @@
 static bool check_magic_number(uint16_t magic, bool *native,
     mfs_version_t *version, bool *longfilenames);
-static errno_t mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst,
+static int mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst,
     fs_index_t index);
-static errno_t mfs_node_put(fs_node_t *fsnode);
-static errno_t mfs_node_open(fs_node_t *fsnode);
+static int mfs_node_put(fs_node_t *fsnode);
+static int mfs_node_open(fs_node_t *fsnode);
 static fs_index_t mfs_index_get(fs_node_t *fsnode);
 static unsigned mfs_lnkcnt_get(fs_node_t *fsnode);
 static bool mfs_is_directory(fs_node_t *fsnode);
 static bool mfs_is_file(fs_node_t *fsnode);
-static errno_t mfs_has_children(bool *has_children, fs_node_t *fsnode);
-static errno_t mfs_root_get(fs_node_t **rfn, service_id_t service_id);
+static int mfs_has_children(bool *has_children, fs_node_t *fsnode);
+static int mfs_root_get(fs_node_t **rfn, service_id_t service_id);
 static service_id_t mfs_service_get(fs_node_t *fsnode);
 static aoff64_t mfs_size_get(fs_node_t *node);
-static errno_t mfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component);
-static errno_t mfs_create_node(fs_node_t **rfn, service_id_t service_id, int flags);
-static errno_t mfs_link(fs_node_t *pfn, fs_node_t *cfn, const char *name);
-static errno_t mfs_unlink(fs_node_t *, fs_node_t *, const char *name);
-static errno_t mfs_destroy_node(fs_node_t *fn);
-static errno_t mfs_node_get(fs_node_t **rfn, service_id_t service_id,
+static int mfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component);
+static int mfs_create_node(fs_node_t **rfn, service_id_t service_id, int flags);
+static int mfs_link(fs_node_t *pfn, fs_node_t *cfn, const char *name);
+static int mfs_unlink(fs_node_t *, fs_node_t *, const char *name);
+static int mfs_destroy_node(fs_node_t *fn);
+static int mfs_node_get(fs_node_t **rfn, service_id_t service_id,
     fs_index_t index);
-static errno_t mfs_instance_get(service_id_t service_id,
+static int mfs_instance_get(service_id_t service_id,
     struct mfs_instance **instance);
-static errno_t mfs_check_sanity(struct mfs_sb_info *sbi);
+static int mfs_check_sanity(struct mfs_sb_info *sbi);
 static bool is_power_of_two(uint32_t n);
-static errno_t mfs_size_block(service_id_t service_id, uint32_t *size);
-static errno_t mfs_total_block_count(service_id_t service_id, uint64_t *count);
-static errno_t mfs_free_block_count(service_id_t service_id, uint64_t *count);
+static int mfs_size_block(service_id_t service_id, uint32_t *size);
+static int mfs_total_block_count(service_id_t service_id, uint64_t *count);
+static int mfs_free_block_count(service_id_t service_id, uint64_t *count);
 
 static hash_table_t open_nodes;
@@ -132,5 +131,5 @@
 };
 
-errno_t
+int
 mfs_global_init(void)
 {
@@ -143,5 +142,5 @@
 /** Read the superblock.
  */
-static errno_t mfs_read_sb(service_id_t service_id, struct mfs_sb_info **rsbi)
+static int mfs_read_sb(service_id_t service_id, struct mfs_sb_info **rsbi)
 {
 	struct mfs_superblock *sb = NULL;
@@ -152,5 +151,5 @@
 	mfs_version_t version;
 	uint16_t magic;
-	errno_t rc;
+	int rc;
 
 	/* Allocate space for generic MFS superblock */
@@ -278,8 +277,8 @@
 
 
-static errno_t mfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
+static int mfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
 {
 	struct mfs_sb_info *sbi = NULL;
-	errno_t rc;
+	int rc;
 
 	/* Initialize libblock */
@@ -295,5 +294,5 @@
 }
 
-static errno_t
+static int
 mfs_mounted(service_id_t service_id, const char *opts, fs_index_t *index,
     aoff64_t *size)
@@ -302,5 +301,5 @@
 	struct mfs_sb_info *sbi = NULL;
 	struct mfs_instance *instance = NULL;
-	errno_t rc;
+	int rc;
 
 	/* Check for option enabling write through. */
@@ -366,5 +365,5 @@
 }
 
-static errno_t
+static int
 mfs_unmounted(service_id_t service_id)
 {
@@ -373,5 +372,5 @@
 	mfsdebug("%s()\n", __FUNCTION__);
 
-	errno_t r = mfs_instance_get(service_id, &inst);
+	int r = mfs_instance_get(service_id, &inst);
 	if (r != EOK)
 		return r;
@@ -397,8 +396,8 @@
 }
 
-static errno_t
+static int
 mfs_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
 {
-	errno_t r;
+	int r;
 	struct mfs_instance *inst;
 	struct mfs_node *mnode;
@@ -484,5 +483,5 @@
 }
 
-static errno_t
+static int
 mfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
 {
@@ -490,5 +489,5 @@
 	struct mfs_ino_info *ino_i = mnode->ino_i;
 	struct mfs_dentry_info d_info;
-	errno_t r;
+	int r;
 
 	if (!S_ISDIR(ino_i->i_mode))
@@ -531,9 +530,9 @@
 }
 
-static errno_t
+static int
 mfs_node_get(fs_node_t **rfn, service_id_t service_id,
     fs_index_t index)
 {
-	errno_t rc;
+	int rc;
 	struct mfs_instance *instance;
 
@@ -545,8 +544,8 @@
 }
 
-static errno_t
+static int
 mfs_node_put(fs_node_t *fsnode)
 {
-	errno_t rc = EOK;
+	int rc = EOK;
 	struct mfs_node *mnode = fsnode->data;
 
@@ -569,5 +568,5 @@
 }
 
-static errno_t
+static int
 mfs_node_open(fs_node_t *fsnode)
 {
@@ -602,5 +601,5 @@
 }
 
-static errno_t
+static int
 mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst,
     fs_index_t index)
@@ -608,5 +607,5 @@
 	fs_node_t *node = NULL;
 	struct mfs_node *mnode = NULL;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&open_nodes_lock);
@@ -689,12 +688,12 @@
 }
 
-static errno_t
+static int
 mfs_root_get(fs_node_t **rfn, service_id_t service_id)
 {
-	errno_t rc = mfs_node_get(rfn, service_id, MFS_ROOT_INO);
+	int rc = mfs_node_get(rfn, service_id, MFS_ROOT_INO);
 	return rc;
 }
 
-static errno_t
+static int
 mfs_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
 {
@@ -707,5 +706,5 @@
 		return ENAMETOOLONG;
 
-	errno_t r = mfs_insert_dentry(parent, name, child->ino_i->index);
+	int r = mfs_insert_dentry(parent, name, child->ino_i->index);
 	if (r != EOK)
 		return r;
@@ -737,5 +736,5 @@
 exit:
 	if (destroy_dentry) {
-		errno_t r2 = mfs_remove_dentry(parent, name);
+		int r2 = mfs_remove_dentry(parent, name);
 		if (r2 != EOK)
 			r = r2;
@@ -747,5 +746,5 @@
 }
 
-static errno_t
+static int
 mfs_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *name)
 {
@@ -753,5 +752,5 @@
 	struct mfs_node *child = cfn->data;
 	bool has_children;
-	errno_t r;
+	int r;
 
 	if (!parent)
@@ -788,10 +787,10 @@
 }
 
-static errno_t
+static int
 mfs_has_children(bool *has_children, fs_node_t *fsnode)
 {
 	struct mfs_node *mnode = fsnode->data;
 	struct mfs_sb_info *sbi = mnode->instance->sbi;
-	errno_t r;
+	int r;
 
 	*has_children = false;
@@ -820,9 +819,9 @@
 }
 
-static errno_t
+static int
 mfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *rbytes)
 {
-	errno_t rc;
+	int rc;
 	fs_node_t *fn = NULL;
 
@@ -927,15 +926,15 @@
 out_error:
 	;
-	errno_t tmp = mfs_node_put(fn);
+	int tmp = mfs_node_put(fn);
 	async_answer_0(callid, tmp != EOK ? tmp : rc);
 	return tmp != EOK ? tmp : rc;
 }
 
-static errno_t
+static int
 mfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *wbytes, aoff64_t *nsize)
 {
 	fs_node_t *fn;
-	errno_t r;
+	int r;
 	int flags = BLOCK_FLAGS_NONE;
 
@@ -1016,9 +1015,9 @@
 }
 
-static errno_t
+static int
 mfs_destroy(service_id_t service_id, fs_index_t index)
 {
 	fs_node_t *fn = NULL;
-	errno_t r;
+	int r;
 
 	r = mfs_node_get(&fn, service_id, index);
@@ -1032,10 +1031,10 @@
 }
 
-static errno_t
+static int
 mfs_destroy_node(fs_node_t *fn)
 {
 	struct mfs_node *mnode = fn->data;
 	bool has_children;
-	errno_t r;
+	int r;
 
 	mfsdebug("mfs_destroy_node %d\n", mnode->ino_i->index);
@@ -1060,9 +1059,9 @@
 }
 
-static errno_t
+static int
 mfs_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
 {
 	fs_node_t *fn;
-	errno_t r;
+	int r;
 
 	r = mfs_node_get(&fn, service_id, index);
@@ -1084,9 +1083,9 @@
 }
 
-static errno_t
+static int
 mfs_instance_get(service_id_t service_id, struct mfs_instance **instance)
 {
 	void *data;
-	errno_t rc;
+	int rc;
 
 	rc = fs_instance_get(service_id, &data);
@@ -1136,5 +1135,5 @@
  * @return EOK on success, ENOTSUP otherwise.
  */
-static errno_t
+static int
 mfs_check_sanity(struct mfs_sb_info *sbi)
 {
@@ -1153,5 +1152,5 @@
 }
 
-static errno_t
+static int
 mfs_close(service_id_t service_id, fs_index_t index)
 {
@@ -1159,9 +1158,9 @@
 }
 
-static errno_t
+static int
 mfs_sync(service_id_t service_id, fs_index_t index)
 {
 	fs_node_t *fn = NULL;
-	errno_t rc = mfs_node_get(&fn, service_id, index);
+	int rc = mfs_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
@@ -1190,9 +1189,9 @@
 }
 
-static errno_t
+static int
 mfs_size_block(service_id_t service_id, uint32_t *size)
 {
 	struct mfs_instance *inst;
-	errno_t rc;
+	int rc;
 
 	rc = mfs_instance_get(service_id, &inst);
@@ -1208,9 +1207,9 @@
 }
 
-static errno_t
+static int
 mfs_total_block_count(service_id_t service_id, uint64_t *count)
 {
 	struct mfs_instance *inst;
-	errno_t rc;
+	int rc;
 	
 	rc = mfs_instance_get(service_id, &inst);
@@ -1226,5 +1225,5 @@
 }
 
-static errno_t
+static int
 mfs_free_block_count(service_id_t service_id, uint64_t *count)
 {
@@ -1232,5 +1231,5 @@
 	
 	struct mfs_instance *inst;
-	errno_t rc = mfs_instance_get(service_id, &inst);
+	int rc = mfs_instance_get(service_id, &inst);
 	if (rc != EOK)
 		return rc;
Index: uspace/srv/fs/mfs/mfs_rw.c
===================================================================
--- uspace/srv/fs/mfs/mfs_rw.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/mfs/mfs_rw.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -34,18 +34,18 @@
 #include "mfs.h"
 
-static errno_t
+static int
 rw_map_ondisk(uint32_t *b, const struct mfs_node *mnode, int rblock,
     bool write_mode, uint32_t w_block);
 
-static errno_t
+static int
 reset_zone_content(struct mfs_instance *inst, uint32_t zone);
 
-static errno_t
+static int
 alloc_zone_and_clear(struct mfs_instance *inst, uint32_t *zone);
 
-static errno_t
+static int
 read_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t **ind_zone);
 
-static errno_t
+static int
 write_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t *ind_zone);
 
@@ -59,10 +59,10 @@
  * @param pos	Position in file.
  *
- * @return	EOK on success or an error code.
+ * @return	EOK on success or a negative error code.
  */
-errno_t
+int
 mfs_read_map(uint32_t *b, const struct mfs_node *mnode, uint32_t pos)
 {
-	errno_t r;
+	int r;
 	const struct mfs_sb_info *sbi = mnode->instance->sbi;
 	const int block_size = sbi->block_size;
@@ -83,5 +83,5 @@
 }
 
-errno_t
+int
 mfs_write_map(struct mfs_node *mnode, const uint32_t pos, uint32_t new_zone,
     uint32_t *old_zone)
@@ -100,5 +100,5 @@
 }
 
-static errno_t
+static int
 rw_map_ondisk(uint32_t *b, const struct mfs_node *mnode, int rblock,
     bool write_mode, uint32_t w_block)
@@ -107,5 +107,5 @@
 	int ptrs_per_block;
 	uint32_t *ind_zone = NULL, *ind2_zone = NULL;
-	errno_t r = EOK;
+	int r = EOK;
 
 	struct mfs_ino_info *ino_i = mnode->ino_i;
@@ -236,7 +236,7 @@
  * @param new_size	The new size of the inode.
  *
- * @return		EOK on success or an error code.
+ * @return		EOK on success or a negative error code.
  */
-errno_t
+int
 mfs_prune_ind_zones(struct mfs_node *mnode, size_t new_size)
 {
@@ -244,6 +244,5 @@
 	struct mfs_sb_info *sbi = inst->sbi;
 	struct mfs_ino_info *ino_i = mnode->ino_i;
-	int nr_direct, ptrs_per_block, rblock;
-	errno_t r;
+	int nr_direct, ptrs_per_block, rblock, r;
 	int i;
 
@@ -312,9 +311,9 @@
 }
 
-static errno_t
+static int
 reset_zone_content(struct mfs_instance *inst, uint32_t zone)
 {
 	block_t *b;
-	errno_t r;
+	int r;
 
 	r = block_get(&b, inst->service_id, zone, BLOCK_FLAGS_NOREAD);
@@ -328,8 +327,8 @@
 }
 
-static errno_t
+static int
 alloc_zone_and_clear(struct mfs_instance *inst, uint32_t *zone)
 {
-	errno_t r;
+	int r;
 
 	r = mfs_alloc_zone(inst, zone);
@@ -341,9 +340,9 @@
 }
 
-static errno_t
+static int
 read_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t **ind_zone)
 {
 	struct mfs_sb_info *sbi = inst->sbi;
-	errno_t r;
+	int r;
 	unsigned i;
 	block_t *b;
@@ -376,9 +375,9 @@
 }
 
-static errno_t
+static int
 write_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t *ind_zone)
 {
 	struct mfs_sb_info *sbi = inst->sbi;
-	errno_t r;
+	int r;
 	unsigned i;
 	block_t *b;
Index: uspace/srv/fs/tmpfs/tmpfs.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/tmpfs/tmpfs.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,9 +46,7 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <stdio.h>
 #include <task.h>
 #include <libfs.h>
-#include <str.h>
 #include "../../vfs/vfs.h"
 
@@ -88,8 +86,8 @@
 	}
 	
-	errno_t rc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops,
+	int rc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops,
 	    &tmpfs_libfs_ops);
 	if (rc != EOK) {
-		printf(NAME ": Failed to register file system: %s\n", str_error(rc));
+		printf(NAME ": Failed to register file system (%d)\n", rc);
 		return rc;
 	}
Index: uspace/srv/fs/tmpfs/tmpfs_dump.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs_dump.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/tmpfs/tmpfs_dump.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -63,5 +63,5 @@
 	struct rdentry entry;
 	libfs_ops_t *ops = &tmpfs_libfs_ops;
-	errno_t rc;
+	int rc;
 	
 	do {
@@ -168,5 +168,5 @@
 	libfs_ops_t *ops = &tmpfs_libfs_ops;
 	fs_node_t *fn;
-	errno_t rc;
+	int rc;
 
 	rc = block_init(dsid, TMPFS_COMM_SIZE);
Index: uspace/srv/fs/tmpfs/tmpfs_ops.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -64,20 +64,20 @@
 
 /* Forward declarations of static functions. */
-static errno_t tmpfs_match(fs_node_t **, fs_node_t *, const char *);
-static errno_t tmpfs_node_get(fs_node_t **, service_id_t, fs_index_t);
-static errno_t tmpfs_node_open(fs_node_t *);
-static errno_t tmpfs_node_put(fs_node_t *);
-static errno_t tmpfs_create_node(fs_node_t **, service_id_t, int);
-static errno_t tmpfs_destroy_node(fs_node_t *);
-static errno_t tmpfs_link_node(fs_node_t *, fs_node_t *, const char *);
-static errno_t tmpfs_unlink_node(fs_node_t *, fs_node_t *, const char *);
+static int tmpfs_match(fs_node_t **, fs_node_t *, const char *);
+static int tmpfs_node_get(fs_node_t **, service_id_t, fs_index_t);
+static int tmpfs_node_open(fs_node_t *);
+static int tmpfs_node_put(fs_node_t *);
+static int tmpfs_create_node(fs_node_t **, service_id_t, int);
+static int tmpfs_destroy_node(fs_node_t *);
+static int tmpfs_link_node(fs_node_t *, fs_node_t *, const char *);
+static int tmpfs_unlink_node(fs_node_t *, fs_node_t *, const char *);
 
 /* Implementation of helper functions. */
-static errno_t tmpfs_root_get(fs_node_t **rfn, service_id_t service_id)
+static int tmpfs_root_get(fs_node_t **rfn, service_id_t service_id)
 {
 	return tmpfs_node_get(rfn, service_id, TMPFS_SOME_ROOT); 
 }
 
-static errno_t tmpfs_has_children(bool *has_children, fs_node_t *fn)
+static int tmpfs_has_children(bool *has_children, fs_node_t *fn)
 {
 	*has_children = !list_empty(&TMPFS_NODE(fn)->cs_list);
@@ -227,5 +227,5 @@
 {
 	fs_node_t *rfn;
-	errno_t rc;
+	int rc;
 	
 	rc = tmpfs_create_node(&rfn, service_id, L_DIRECTORY);
@@ -252,5 +252,5 @@
 }
 
-errno_t tmpfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
+int tmpfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
 {
 	tmpfs_node_t *parentp = TMPFS_NODE(pfn);
@@ -267,5 +267,5 @@
 }
 
-errno_t tmpfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
+int tmpfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
 {
 	node_key_t key = {
@@ -286,5 +286,5 @@
 }
 
-errno_t tmpfs_node_open(fs_node_t *fn)
+int tmpfs_node_open(fs_node_t *fn)
 {
 	/* nothing to do */
@@ -292,5 +292,5 @@
 }
 
-errno_t tmpfs_node_put(fs_node_t *fn)
+int tmpfs_node_put(fs_node_t *fn)
 {
 	/* nothing to do */
@@ -298,8 +298,8 @@
 }
 
-errno_t tmpfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag)
+int tmpfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag)
 {
 	fs_node_t *rootfn;
-	errno_t rc;
+	int rc;
 
 	assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY));
@@ -335,5 +335,5 @@
 }
 
-errno_t tmpfs_destroy_node(fs_node_t *fn)
+int tmpfs_destroy_node(fs_node_t *fn)
 {
 	tmpfs_node_t *nodep = TMPFS_NODE(fn);
@@ -351,5 +351,5 @@
 }
 
-errno_t tmpfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
+int tmpfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
 {
 	tmpfs_node_t *parentp = TMPFS_NODE(pfn);
@@ -386,5 +386,5 @@
 }
 
-errno_t tmpfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
+int tmpfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
 {
 	tmpfs_node_t *parentp = TMPFS_NODE(pfn);
@@ -421,15 +421,15 @@
  */
 
-static errno_t tmpfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
+static int tmpfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
 {
 	return ENOTSUP;
 }
 
-static errno_t
+static int
 tmpfs_mounted(service_id_t service_id, const char *opts, fs_index_t *index,
     aoff64_t *size)
 {
 	fs_node_t *rootfn;
-	errno_t rc;
+	int rc;
 	
 	/* Check if this device is not already mounted. */
@@ -458,5 +458,5 @@
 }
 
-static errno_t tmpfs_unmounted(service_id_t service_id)
+static int tmpfs_unmounted(service_id_t service_id)
 {
 	tmpfs_instance_done(service_id);
@@ -464,5 +464,5 @@
 }
 
-static errno_t tmpfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
+static int tmpfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *rbytes)
 {
@@ -525,5 +525,5 @@
 }
 
-static errno_t
+static int
 tmpfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *wbytes, aoff64_t *nsize)
@@ -589,5 +589,5 @@
 }
 
-static errno_t tmpfs_truncate(service_id_t service_id, fs_index_t index,
+static int tmpfs_truncate(service_id_t service_id, fs_index_t index,
     aoff64_t size)
 {
@@ -626,10 +626,10 @@
 }
 
-static errno_t tmpfs_close(service_id_t service_id, fs_index_t index)
-{
-	return EOK;
-}
-
-static errno_t tmpfs_destroy(service_id_t service_id, fs_index_t index)
+static int tmpfs_close(service_id_t service_id, fs_index_t index)
+{
+	return EOK;
+}
+
+static int tmpfs_destroy(service_id_t service_id, fs_index_t index)
 {
 	node_key_t key = {
@@ -646,5 +646,5 @@
 }
 
-static errno_t tmpfs_sync(service_id_t service_id, fs_index_t index)
+static int tmpfs_sync(service_id_t service_id, fs_index_t index)
 {
 	/*
Index: uspace/srv/fs/udf/udf.c
===================================================================
--- uspace/srv/fs/udf/udf.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/udf/udf.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <task.h>
 #include <libfs.h>
@@ -80,5 +79,5 @@
 	}
 	
-	errno_t rc = fs_register(vfs_sess, &udf_vfs_info, &udf_ops,
+	int rc = fs_register(vfs_sess, &udf_vfs_info, &udf_ops,
 	    &udf_libfs_ops);
 	if (rc != EOK)
@@ -97,5 +96,5 @@
 	
 err:
-	log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to register file system: %s", str_error(rc));
+	log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to register file system (%d)", rc);
 	return rc;
 }
Index: uspace/srv/fs/udf/udf_file.c
===================================================================
--- uspace/srv/fs/udf/udf_file.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/udf/udf_file.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,12 +54,12 @@
  * @param pos      Position with which we read
  *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_read_extended_allocator(udf_node_t *node, uint16_t icb_flag,
+ * @return EOK on success or a negative error code.
+ *
+ */
+static int udf_read_extended_allocator(udf_node_t *node, uint16_t icb_flag,
     uint32_t pos)
 {
 	block_t *block = NULL;
-	errno_t rc = block_get(&block, node->instance->service_id, pos,
+	int rc = block_get(&block, node->instance->service_id, pos,
 	    BLOCK_FLAGS_NONE);
 	if (rc != EOK)
@@ -90,8 +90,8 @@
  * @param len         Length of sequence
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_read_allocation_sequence(udf_node_t *node, uint8_t *af,
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_read_allocation_sequence(udf_node_t *node, uint8_t *af,
     uint16_t icb_flag, uint32_t start_alloc, uint32_t len)
 {
@@ -231,7 +231,7 @@
  * @param node    UDF node
  *
- * @return    EOK on success or an error code.
- */
-errno_t udf_read_icb(udf_node_t *node)
+ * @return    EOK on success or a negative error code.
+ */
+int udf_read_icb(udf_node_t *node)
 {
 	while (true) {
@@ -239,5 +239,5 @@
 		
 		block_t *block = NULL;
-		errno_t rc = block_get(&block, node->instance->service_id, pos,
+		int rc = block_get(&block, node->instance->service_id, pos,
 		    BLOCK_FLAGS_NONE);
 		if (rc != EOK)
@@ -300,8 +300,8 @@
  * @param node UDF node
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_node_get_core(udf_node_t *node)
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_node_get_core(udf_node_t *node)
 {
 	node->link_cnt = 1;
@@ -315,8 +315,8 @@
  * @param pos  Number of FID which we need to find
  *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_get_fid_in_data(udf_file_identifier_descriptor_t **fid,
+ * @return EOK on success or a negative error code.
+ *
+ */
+static int udf_get_fid_in_data(udf_file_identifier_descriptor_t **fid,
     udf_node_t *node, aoff64_t pos)
 {
@@ -366,8 +366,8 @@
  * @param pos   Number of FID which we need to find
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_get_fid(udf_file_identifier_descriptor_t **fid, block_t **block,
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_get_fid(udf_file_identifier_descriptor_t **fid, block_t **block,
     udf_node_t *node, aoff64_t pos)
 {
@@ -385,8 +385,8 @@
  * @param pos   Number of FID which we need to find
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_get_fid_in_allocator(udf_file_identifier_descriptor_t **fid,
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_get_fid_in_allocator(udf_file_identifier_descriptor_t **fid,
     block_t **block, udf_node_t *node, aoff64_t pos)
 {
@@ -402,5 +402,5 @@
 		size_t i = 0;
 		while (i * node->instance->sector_size < node->allocators[j].length) {
-			errno_t rc = block_get(block, node->instance->service_id,
+			int rc = block_get(block, node->instance->service_id,
 			    node->allocators[j].position + i, BLOCK_FLAGS_NONE);
 			if (rc != EOK) {
@@ -466,8 +466,8 @@
  * @param len   Length of buf
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_get_fid_in_sector(udf_file_identifier_descriptor_t **fid,
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_get_fid_in_sector(udf_file_identifier_descriptor_t **fid,
     block_t **block, udf_node_t *node, aoff64_t pos, size_t *n, void **buf,
     size_t *len)
@@ -573,8 +573,8 @@
  * @param len      Length of data for reading
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_read_file(size_t *read_len, ipc_callid_t callid, udf_node_t *node,
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_read_file(size_t *read_len, ipc_callid_t callid, udf_node_t *node,
     aoff64_t pos, size_t len)
 {
@@ -594,5 +594,5 @@
 	
 	block_t *block = NULL;
-	errno_t rc = block_get(&block, node->instance->service_id,
+	int rc = block_get(&block, node->instance->service_id,
 	    node->allocators[i].position + (sector_num - sector_cnt),
 	    BLOCK_FLAGS_NONE);
Index: uspace/srv/fs/udf/udf_file.h
===================================================================
--- uspace/srv/fs/udf/udf_file.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/udf/udf_file.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -194,15 +194,15 @@
 }__attribute__((packed)) udf_space_bitmap_descriptor_t;
 
-extern errno_t udf_node_get_core(udf_node_t *);
-extern errno_t udf_read_icb(udf_node_t *);
-extern errno_t udf_read_allocation_sequence(udf_node_t *, uint8_t *, uint16_t,
+extern int udf_node_get_core(udf_node_t *);
+extern int udf_read_icb(udf_node_t *);
+extern int udf_read_allocation_sequence(udf_node_t *, uint8_t *, uint16_t,
     uint32_t, uint32_t);
-extern errno_t udf_read_file(size_t *, ipc_callid_t, udf_node_t *, aoff64_t,
+extern int udf_read_file(size_t *, ipc_callid_t, udf_node_t *, aoff64_t,
     size_t);
-extern errno_t udf_get_fid(udf_file_identifier_descriptor_t **, block_t **,
+extern int udf_get_fid(udf_file_identifier_descriptor_t **, block_t **,
     udf_node_t *, aoff64_t);
-extern errno_t udf_get_fid_in_allocator(udf_file_identifier_descriptor_t **,
+extern int udf_get_fid_in_allocator(udf_file_identifier_descriptor_t **,
     block_t **, udf_node_t *, aoff64_t);
-extern errno_t udf_get_fid_in_sector(udf_file_identifier_descriptor_t **,
+extern int udf_get_fid_in_sector(udf_file_identifier_descriptor_t **,
     block_t **, udf_node_t *, aoff64_t, size_t *, void **, size_t *);
 
Index: uspace/srv/fs/udf/udf_idx.c
===================================================================
--- uspace/srv/fs/udf/udf_idx.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/udf/udf_idx.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -88,8 +88,8 @@
 /** Initialization of hash table
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_idx_init(void)
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_idx_init(void)
 {
 	if (!hash_table_create(&udf_idx, 0, 0, &udf_idx_ops))
@@ -101,8 +101,8 @@
 /** Delete hash table
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_idx_fini(void)
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_idx_fini(void)
 {
 	hash_table_destroy(&udf_idx);
@@ -116,8 +116,8 @@
  * @param index    Absolute position of ICB (sector)
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_idx_get(udf_node_t **udfn, udf_instance_t *instance, fs_index_t index)
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_idx_get(udf_node_t **udfn, udf_instance_t *instance, fs_index_t index)
 {
 	fibril_mutex_lock(&udf_idx_lock);
@@ -150,8 +150,8 @@
  * @param index    Absolute position of ICB (sector)
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_idx_add(udf_node_t **udfn, udf_instance_t *instance, fs_index_t index)
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_idx_add(udf_node_t **udfn, udf_instance_t *instance, fs_index_t index)
 {
 	fibril_mutex_lock(&udf_idx_lock);
@@ -196,8 +196,8 @@
  * @param node UDF node
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_idx_del(udf_node_t *node)
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_idx_del(udf_node_t *node)
 {
 	assert(node->ref_cnt == 0);
Index: uspace/srv/fs/udf/udf_idx.h
===================================================================
--- uspace/srv/fs/udf/udf_idx.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/udf/udf_idx.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,9 +36,9 @@
 #include "udf.h"
 
-extern errno_t udf_idx_init(void);
-extern errno_t udf_idx_fini(void);
-extern errno_t udf_idx_get(udf_node_t **, udf_instance_t *, fs_index_t);
-extern errno_t udf_idx_add(udf_node_t **, udf_instance_t *, fs_index_t);
-extern errno_t udf_idx_del(udf_node_t *);
+extern int udf_idx_init(void);
+extern int udf_idx_fini(void);
+extern int udf_idx_get(udf_node_t **, udf_instance_t *, fs_index_t);
+extern int udf_idx_add(udf_node_t **, udf_instance_t *, fs_index_t);
+extern int udf_idx_del(udf_node_t *);
 
 #endif /* UDF_IDX_H_ */
Index: uspace/srv/fs/udf/udf_ops.c
===================================================================
--- uspace/srv/fs/udf/udf_ops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/udf/udf_ops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -68,9 +68,9 @@
 static LIST_INITIALIZE(ffn_list);
 
-static errno_t udf_node_get(fs_node_t **rfn, service_id_t service_id,
+static int udf_node_get(fs_node_t **rfn, service_id_t service_id,
     fs_index_t index)
 {
 	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
+	int rc = fs_instance_get(service_id, (void **) &instance);
 	if (rc != EOK)
 		return rc;
@@ -94,8 +94,8 @@
 }
 
-static errno_t udf_root_get(fs_node_t **rfn, service_id_t service_id)
+static int udf_root_get(fs_node_t **rfn, service_id_t service_id)
 {
 	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
+	int rc = fs_instance_get(service_id, (void **) &instance);
 	if (rc != EOK)
 		return rc;
@@ -114,5 +114,5 @@
 }
 
-static errno_t udf_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
+static int udf_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
 {
 	char *name = malloc(MAX_FILE_NAME_LEN + 1);
@@ -132,5 +132,5 @@
 		
 		if (str_casecmp(name, component) == 0) {
-			errno_t rc = udf_node_get(rfn, udf_service_get(pfn),
+			int rc = udf_node_get(rfn, udf_service_get(pfn),
 			    udf_long_ad_to_pos(UDF_NODE(pfn)->instance, &long_ad));
 			
@@ -143,5 +143,5 @@
 		
 		if (block != NULL) {
-			errno_t rc = block_put(block);
+			int rc = block_put(block);
 			if (rc != EOK)
 				return rc;
@@ -155,10 +155,10 @@
 }
 
-static errno_t udf_node_open(fs_node_t *fn)
-{
-	return EOK;
-}
-
-static errno_t udf_node_put(fs_node_t *fn)
+static int udf_node_open(fs_node_t *fn)
+{
+	return EOK;
+}
+
+static int udf_node_put(fs_node_t *fn)
 {
 	udf_node_t *node = UDF_NODE(fn);
@@ -177,25 +177,25 @@
 }
 
-static errno_t udf_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_destroy_node(fs_node_t *fn)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_has_children(bool *has_children, fs_node_t *fn)
+static int udf_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
+{
+	return ENOTSUP;
+}
+
+static int udf_destroy_node(fs_node_t *fn)
+{
+	return ENOTSUP;
+}
+
+static int udf_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
+{
+	return ENOTSUP;
+}
+
+static int udf_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
+{
+	return ENOTSUP;
+}
+
+static int udf_has_children(bool *has_children, fs_node_t *fn)
 {
 	*has_children = true;
@@ -248,8 +248,8 @@
 }
 
-static errno_t udf_size_block(service_id_t service_id, uint32_t *size)
+static int udf_size_block(service_id_t service_id, uint32_t *size)
 {
 	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
+	int rc = fs_instance_get(service_id, (void **) &instance);
 	if (rc != EOK)
 		return rc;
@@ -263,5 +263,5 @@
 }
 
-static errno_t udf_total_block_count(service_id_t service_id, uint64_t *count)
+static int udf_total_block_count(service_id_t service_id, uint64_t *count)
 {
 	*count = 0;
@@ -270,5 +270,5 @@
 }
 
-static errno_t udf_free_block_count(service_id_t service_id, uint64_t *count)
+static int udf_free_block_count(service_id_t service_id, uint64_t *count)
 {
 	*count = 0;
@@ -299,10 +299,10 @@
 };
 
-static errno_t udf_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_mounted(service_id_t service_id, const char *opts,
+static int udf_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
+{
+	return ENOTSUP;
+}
+
+static int udf_mounted(service_id_t service_id, const char *opts,
     fs_index_t *index, aoff64_t *size)
 {
@@ -330,5 +330,5 @@
 	
 	/* initialize block cache */
-	errno_t rc = block_init(service_id, MAX_SIZE);
+	int rc = block_init(service_id, MAX_SIZE);
 	if (rc != EOK)
 		return rc;
@@ -415,8 +415,8 @@
 }
 
-static errno_t udf_unmounted(service_id_t service_id)
+static int udf_unmounted(service_id_t service_id)
 {
 	fs_node_t *fn;
-	errno_t rc = udf_root_get(&fn, service_id);
+	int rc = udf_root_get(&fn, service_id);
 	if (rc != EOK)
 		return rc;
@@ -449,9 +449,9 @@
 }
 
-static errno_t udf_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
+static int udf_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *rbytes)
 {
 	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
+	int rc = fs_instance_get(service_id, (void **) &instance);
 	if (rc != EOK)
 		return rc;
@@ -523,15 +523,15 @@
 }
 
-static errno_t udf_close(service_id_t service_id, fs_index_t index)
-{
-	return EOK;
-}
-
-static errno_t udf_sync(service_id_t service_id, fs_index_t index)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
+static int udf_close(service_id_t service_id, fs_index_t index)
+{
+	return EOK;
+}
+
+static int udf_sync(service_id_t service_id, fs_index_t index)
+{
+	return ENOTSUP;
+}
+
+static int udf_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *wbytes, aoff64_t *nsize)
 {
@@ -539,5 +539,5 @@
 }
 
-static errno_t udf_truncate(service_id_t service_id, fs_index_t index,
+static int udf_truncate(service_id_t service_id, fs_index_t index,
     aoff64_t size)
 {
@@ -545,5 +545,5 @@
 }
 
-static errno_t udf_destroy(service_id_t service_id, fs_index_t index)
+static int udf_destroy(service_id_t service_id, fs_index_t index)
 {
 	return ENOTSUP;
Index: uspace/srv/fs/udf/udf_volume.c
===================================================================
--- uspace/srv/fs/udf/udf_volume.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/udf/udf_volume.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -81,8 +81,8 @@
  * @param vd         Returned value - Volume Descriptor.
  *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_volume_recongnition_structure_test(service_id_t service_id,
+ * @return EOK on success or a negative error code.
+ *
+ */
+static int udf_volume_recongnition_structure_test(service_id_t service_id,
     aoff64_t addr, udf_vrs_descriptor_t *vd)
 {
@@ -98,7 +98,7 @@
  * @param service_id
  *
- * @return    EOK on success or an error code.
- */
-errno_t udf_volume_recongnition(service_id_t service_id) 
+ * @return    EOK on success or a negative error code.
+ */
+int udf_volume_recongnition(service_id_t service_id) 
 {
 	aoff64_t addr = VRS_ADDR;
@@ -109,5 +109,5 @@
 		return ENOMEM;
 	
-	errno_t rc = udf_volume_recongnition_structure_test(service_id, addr, vd);
+	int rc = udf_volume_recongnition_structure_test(service_id, addr, vd);
 	if (rc != EOK) {
 		free(vd);
@@ -167,11 +167,11 @@
  * @param sector_size Expected sector size
  *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_get_anchor_volume_descriptor_by_ssize(service_id_t service_id,
+ * @return EOK on success or a negative error code.
+ *
+ */
+static int udf_get_anchor_volume_descriptor_by_ssize(service_id_t service_id,
     udf_anchor_volume_descriptor_t *avd, uint32_t sector_size)
 {
-	errno_t rc = block_read_bytes_direct(service_id,
+	int rc = block_read_bytes_direct(service_id,
 	    UDF_AVDP_SECTOR * sector_size,
 	    sizeof(udf_anchor_volume_descriptor_t), avd);
@@ -204,8 +204,8 @@
  * @param avd        Returned value - Anchor Volume Descriptor
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_get_anchor_volume_descriptor(service_id_t service_id,
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_get_anchor_volume_descriptor(service_id_t service_id,
     udf_anchor_volume_descriptor_t *avd)
 {
@@ -213,5 +213,5 @@
 	
 	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
+	int rc = fs_instance_get(service_id, (void **) &instance);
 	if (rc != EOK)
 		return rc;
@@ -357,12 +357,12 @@
  * @param id       Index of partition in instance::partitions array
  *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_read_virtual_partition(udf_instance_t *instance, uint32_t pos,
+ * @return EOK on success or a negative error code.
+ *
+ */
+static int udf_read_virtual_partition(udf_instance_t *instance, uint32_t pos,
     uint32_t id)
 {
 	block_t *block = NULL;
-	errno_t rc = block_get(&block, instance->service_id, pos,
+	int rc = block_get(&block, instance->service_id, pos,
 	    BLOCK_FLAGS_NONE);
 	if (rc != EOK)
@@ -438,8 +438,8 @@
  * @param instance UDF instance
  *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_fill_volume_info(udf_logical_volume_descriptor_t *lvd,
+ * @return EOK on success or a negative error code.
+ *
+ */
+static int udf_fill_volume_info(udf_logical_volume_descriptor_t *lvd,
     size_t lvd_cnt, udf_partition_descriptor_t *pd, size_t pd_cnt,
     udf_instance_t *instance)
@@ -553,5 +553,5 @@
 				instance->partitions[j].number =
 				    FLE16(metadata->partition_number);
-				errno_t rc = udf_read_virtual_partition(instance,
+				int rc = udf_read_virtual_partition(instance,
 				    FLE32(metadata->metadata_fileloc) +
 				    FLE32(pd[pd_num].starting_location), j);
@@ -598,12 +598,12 @@
  * @param addr       UDF extent descriptor (ECMA 167 3/7.1)
  *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_read_volume_descriptor_sequence(service_id_t service_id,
+ * @return EOK on success or a negative error code.
+ *
+ */
+int udf_read_volume_descriptor_sequence(service_id_t service_id,
     udf_extent_t addr)
 {
 	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
+	int rc = fs_instance_get(service_id, (void **) &instance);
 	if (rc != EOK)
 		return rc;
Index: uspace/srv/fs/udf/udf_volume.h
===================================================================
--- uspace/srv/fs/udf/udf_volume.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/fs/udf/udf_volume.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -212,8 +212,8 @@
 } __attribute__((packed)) udf_partition_header_descriptor_t;
 
-extern errno_t udf_volume_recongnition(service_id_t);
-extern errno_t udf_get_anchor_volume_descriptor(service_id_t,
+extern int udf_volume_recongnition(service_id_t);
+extern int udf_get_anchor_volume_descriptor(service_id_t,
     udf_anchor_volume_descriptor_t *);
-extern errno_t udf_read_volume_descriptor_sequence(service_id_t, udf_extent_t);
+extern int udf_read_volume_descriptor_sequence(service_id_t, udf_extent_t);
 extern fs_index_t udf_long_ad_to_pos(udf_instance_t *, udf_long_ad_t *);
 
Index: uspace/srv/hid/compositor/compositor.c
===================================================================
--- uspace/srv/hid/compositor/compositor.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/compositor/compositor.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -151,10 +151,10 @@
 static bool active = false;
 
-static errno_t comp_active(input_t *);
-static errno_t comp_deactive(input_t *);
-static errno_t comp_key_press(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
-static errno_t comp_mouse_move(input_t *, int, int);
-static errno_t comp_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
-static errno_t comp_mouse_button(input_t *, int, int);
+static int comp_active(input_t *);
+static int comp_deactive(input_t *);
+static int comp_key_press(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
+static int comp_mouse_move(input_t *, int, int);
+static int comp_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
+static int comp_mouse_button(input_t *, int, int);
 
 static input_ev_ops_t input_ev_ops = {
@@ -602,5 +602,5 @@
 	}
 	
-	errno_t rc = async_data_read_finalize(callid, event, len);
+	int rc = async_data_read_finalize(callid, event, len);
 	if (rc != EOK) {
 		async_answer_0(iid, ENOMEM);
@@ -706,5 +706,5 @@
 	
 	void *new_cell_storage;
-	errno_t rc = async_share_out_finalize(callid, &new_cell_storage);
+	int rc = async_share_out_finalize(callid, &new_cell_storage);
 	if ((rc != EOK) || (new_cell_storage == AS_MAP_FAILED)) {
 		async_answer_0(iid, ENOMEM);
@@ -1049,5 +1049,5 @@
 	/* Retrieve the mode that shall be set. */
 	vslmode_t new_mode;
-	errno_t rc = visualizer_get_mode(vp->sess, &new_mode, mode_idx);
+	int rc = visualizer_get_mode(vp->sess, &new_mode, mode_idx);
 	if (rc != EOK) {
 		fibril_mutex_unlock(&viewport_list_mtx);
@@ -1177,5 +1177,5 @@
 static async_sess_t *vsl_connect(service_id_t sid, const char *svc)
 {
-	errno_t rc;
+	int rc;
 	async_sess_t *sess;
 
@@ -1206,5 +1206,5 @@
 static viewport_t *viewport_create(service_id_t sid)
 {
-	errno_t rc;
+	int rc;
 	char *vsl_name = NULL;
 	viewport_t *vp = NULL;
@@ -1477,5 +1477,5 @@
 #endif
 
-static errno_t comp_abs_move(input_t *input, unsigned x , unsigned y,
+static int comp_abs_move(input_t *input, unsigned x , unsigned y,
     unsigned max_x, unsigned max_y)
 {
@@ -1512,5 +1512,5 @@
 }
 
-static errno_t comp_mouse_move(input_t *input, int dx, int dy)
+static int comp_mouse_move(input_t *input, int dx, int dy)
 {
 	pointer_t *pointer = input_pointer(input);
@@ -1624,5 +1624,5 @@
 }
 
-static errno_t comp_mouse_button(input_t *input, int bnum, int bpress)
+static int comp_mouse_button(input_t *input, int bnum, int bpress)
 {
 	pointer_t *pointer = input_pointer(input);
@@ -1809,5 +1809,5 @@
 }
 
-static errno_t comp_active(input_t *input)
+static int comp_active(input_t *input)
 {
 	active = true;
@@ -1817,5 +1817,5 @@
 }
 
-static errno_t comp_deactive(input_t *input)
+static int comp_deactive(input_t *input)
 {
 	active = false;
@@ -1823,5 +1823,5 @@
 }
 
-static errno_t comp_key_press(input_t *input, kbd_event_type_t type, keycode_t key,
+static int comp_key_press(input_t *input, kbd_event_type_t type, keycode_t key,
     keymod_t mods, wchar_t c)
 {
@@ -2143,10 +2143,10 @@
 }
 
-static errno_t input_connect(const char *svc)
+static int input_connect(const char *svc)
 {
 	async_sess_t *sess;
 	service_id_t dsid;
 
-	errno_t rc = loc_service_get_id(svc, &dsid, 0);
+	int rc = loc_service_get_id(svc, &dsid, 0);
 	if (rc != EOK) {
 		printf("%s: Input service %s not found\n", NAME, svc);
@@ -2199,5 +2199,5 @@
 	/* Create viewports and connect them to visualizers. */
 	category_id_t cat_id;
-	errno_t rc = loc_category_get_id("visualizer", &cat_id, IPC_FLAG_BLOCKING);
+	int rc = loc_category_get_id("visualizer", &cat_id, IPC_FLAG_BLOCKING);
 	if (rc != EOK)
 		goto ret;
@@ -2240,5 +2240,5 @@
 }
 
-static errno_t compositor_srv_init(char *input_svc, char *name)
+static int compositor_srv_init(char *input_svc, char *name)
 {
 	/* Coordinates of the central pixel. */
@@ -2251,5 +2251,5 @@
 	async_set_fallback_port_handler(client_connection, NULL);
 	
-	errno_t rc = loc_server_register(NAME);
+	int rc = loc_server_register(NAME);
 	if (rc != EOK) {
 		printf("%s: Unable to register server (%s)\n", NAME, str_error(rc));
@@ -2313,5 +2313,5 @@
 	printf("%s: HelenOS Compositor server\n", NAME);
 	
-	errno_t rc = compositor_srv_init(argv[1], argv[2]);
+	int rc = compositor_srv_init(argv[1], argv[2]);
 	if (rc != EOK)
 		return rc;
Index: uspace/srv/hid/console/console.c
===================================================================
--- uspace/srv/hid/console/console.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/console/console.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,4 @@
 #include <fibril_synch.h>
 #include <stdlib.h>
-#include <str.h>
 #include "console.h"
 
@@ -102,10 +101,10 @@
 static console_t *active_console = &consoles[0];
 
-static errno_t input_ev_active(input_t *);
-static errno_t input_ev_deactive(input_t *);
-static errno_t input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
-static errno_t input_ev_move(input_t *, int, int);
-static errno_t input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
-static errno_t input_ev_button(input_t *, int, int);
+static int input_ev_active(input_t *);
+static int input_ev_deactive(input_t *);
+static int input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
+static int input_ev_move(input_t *, int, int);
+static int input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
+static int input_ev_button(input_t *, int, int);
 
 static input_ev_ops_t input_ev_ops = {
@@ -118,14 +117,14 @@
 };
 
-static errno_t cons_open(con_srvs_t *, con_srv_t *);
-static errno_t cons_close(con_srv_t *);
-static errno_t cons_read(con_srv_t *, void *, size_t, size_t *);
-static errno_t cons_write(con_srv_t *, void *, size_t, size_t *);
+static int cons_open(con_srvs_t *, con_srv_t *);
+static int cons_close(con_srv_t *);
+static int cons_read(con_srv_t *, void *, size_t);
+static int cons_write(con_srv_t *, void *, size_t);
 static void cons_sync(con_srv_t *);
 static void cons_clear(con_srv_t *);
 static void cons_set_pos(con_srv_t *, sysarg_t col, sysarg_t row);
-static errno_t cons_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t cons_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t cons_get_color_cap(con_srv_t *, console_caps_t *);
+static int cons_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
+static int cons_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
+static int cons_get_color_cap(con_srv_t *, console_caps_t *);
 static void cons_set_style(con_srv_t *, console_style_t);
 static void cons_set_color(con_srv_t *, console_color_t, console_color_t,
@@ -133,5 +132,5 @@
 static void cons_set_rgb_color(con_srv_t *, pixel_t, pixel_t);
 static void cons_set_cursor_visibility(con_srv_t *, bool);
-static errno_t cons_get_event(con_srv_t *, cons_event_t *);
+static int cons_get_event(con_srv_t *, cons_event_t *);
 
 static con_ops_t con_ops = {
@@ -231,5 +230,5 @@
 }
 
-static errno_t input_ev_active(input_t *input)
+static int input_ev_active(input_t *input)
 {
 	active = true;
@@ -240,5 +239,5 @@
 }
 
-static errno_t input_ev_deactive(input_t *input)
+static int input_ev_deactive(input_t *input)
 {
 	active = false;
@@ -248,5 +247,5 @@
 }
 
-static errno_t input_ev_key(input_t *input, kbd_event_type_t type, keycode_t key,
+static int input_ev_key(input_t *input, kbd_event_type_t type, keycode_t key,
     keymod_t mods, wchar_t c)
 {
@@ -275,10 +274,10 @@
 }
 
-static errno_t input_ev_move(input_t *input, int dx, int dy)
-{
-	return EOK;
-}
-
-static errno_t input_ev_abs_move(input_t *input, unsigned x , unsigned y,
+static int input_ev_move(input_t *input, int dx, int dy)
+{
+	return EOK;
+}
+
+static int input_ev_abs_move(input_t *input, unsigned x , unsigned y,
     unsigned max_x, unsigned max_y)
 {
@@ -286,5 +285,5 @@
 }
 
-static errno_t input_ev_button(input_t *input, int bnum, int bpress)
+static int input_ev_button(input_t *input, int bnum, int bpress)
 {
 	return EOK;
@@ -329,15 +328,15 @@
 }
 
-static errno_t cons_open(con_srvs_t *srvs, con_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t cons_close(con_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t cons_read(con_srv_t *srv, void *buf, size_t size, size_t *nread)
+static int cons_open(con_srvs_t *srvs, con_srv_t *srv)
+{
+	return EOK;
+}
+
+static int cons_close(con_srv_t *srv)
+{
+	return EOK;
+}
+
+static int cons_read(con_srv_t *srv, void *buf, size_t size)
 {
 	uint8_t *bbuf = buf;
@@ -379,9 +378,8 @@
 	}
 	
-	*nread = size;
-	return EOK;
-}
-
-static errno_t cons_write(con_srv_t *srv, void *data, size_t size, size_t *nwritten)
+	return size;
+}
+
+static int cons_write(con_srv_t *srv, void *data, size_t size)
 {
 	console_t *cons = srv_to_console(srv);
@@ -391,6 +389,5 @@
 		cons_write_char(cons, str_decode(data, &off, size));
 	
-	*nwritten = size;
-	return EOK;
+	return size;
 }
 
@@ -424,5 +421,5 @@
 }
 
-static errno_t cons_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
+static int cons_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
 {
 	console_t *cons = srv_to_console(srv);
@@ -435,5 +432,5 @@
 }
 
-static errno_t cons_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
+static int cons_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
 {
 	console_t *cons = srv_to_console(srv);
@@ -447,5 +444,5 @@
 }
 
-static errno_t cons_get_color_cap(con_srv_t *srv, console_caps_t *ccaps)
+static int cons_get_color_cap(con_srv_t *srv, console_caps_t *ccaps)
 {
 	console_t *cons = srv_to_console(srv);
@@ -494,5 +491,5 @@
 }
 
-static errno_t cons_get_event(con_srv_t *srv, cons_event_t *event)
+static int cons_get_event(con_srv_t *srv, cons_event_t *event)
 {
 	console_t *cons = srv_to_console(srv);
@@ -529,10 +526,10 @@
 }
 
-static errno_t input_connect(const char *svc)
+static int input_connect(const char *svc)
 {
 	async_sess_t *sess;
 	service_id_t dsid;
 	
-	errno_t rc = loc_service_get_id(svc, &dsid, 0);
+	int rc = loc_service_get_id(svc, &dsid, 0);
 	if (rc != EOK) {
 		printf("%s: Input service %s not found\n", NAME, svc);
@@ -563,5 +560,5 @@
 	service_id_t dsid;
 	
-	errno_t rc = loc_service_get_id(svc, &dsid, 0);
+	int rc = loc_service_get_id(svc, &dsid, 0);
 	if (rc == EOK) {
 		sess = loc_service_connect(dsid, INTERFACE_OUTPUT, 0);
@@ -580,5 +577,5 @@
 {
 	/* Connect to input service */
-	errno_t rc = input_connect(input_svc);
+	int rc = input_connect(input_svc);
 	if (rc != EOK)
 		return false;
Index: uspace/srv/hid/input/ctl/kbdev.c
===================================================================
--- uspace/srv/hid/input/ctl/kbdev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/ctl/kbdev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
 #include "../kbd_port.h"
 
-static errno_t kbdev_ctl_init(kbd_dev_t *);
+static int kbdev_ctl_init(kbd_dev_t *);
 static void kbdev_ctl_set_ind(kbd_dev_t *, unsigned int);
 
@@ -90,5 +90,5 @@
 }
 
-static errno_t kbdev_ctl_init(kbd_dev_t *kdev)
+static int kbdev_ctl_init(kbd_dev_t *kdev)
 {
 	async_sess_t *sess = loc_service_connect(kdev->svc_id,
@@ -119,5 +119,5 @@
 	
 	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_KBD_CB, 0, 0,
+	int rc = async_create_callback_port(exch, INTERFACE_KBD_CB, 0, 0,
 	    kbdev_callback_conn, kbdev, &port);
 	
@@ -150,5 +150,5 @@
 {
 	kbdev_t *kbdev;
-	errno_t retval;
+	int retval;
 	int type, key;
 
Index: uspace/srv/hid/input/ctl/stty.c
===================================================================
--- uspace/srv/hid/input/ctl/stty.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/ctl/stty.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
 
 static void stty_ctl_parse(sysarg_t);
-static errno_t stty_ctl_init(kbd_dev_t *);
+static int stty_ctl_init(kbd_dev_t *);
 static void stty_ctl_set_ind(kbd_dev_t *, unsigned int);
 
@@ -237,5 +237,5 @@
 };
 
-static errno_t stty_ctl_init(kbd_dev_t *kdev)
+static int stty_ctl_init(kbd_dev_t *kdev)
 {
 	kbd_dev = kdev;
@@ -243,8 +243,5 @@
 
 	gsp_init(&sp);
-	if (gsp_insert_defs(&sp, seq_defs) < 0) {
-		return EINVAL;
-	}
-	return EOK;
+	return gsp_insert_defs(&sp, seq_defs);
 }
 
Index: uspace/srv/hid/input/ctl/sun.c
===================================================================
--- uspace/srv/hid/input/ctl/sun.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/ctl/sun.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,5 @@
 
 static void sun_ctl_parse(sysarg_t);
-static errno_t sun_ctl_init(kbd_dev_t *);
+static int sun_ctl_init(kbd_dev_t *);
 static void sun_ctl_set_ind(kbd_dev_t *, unsigned int);
 
@@ -60,5 +60,5 @@
 static int scanmap_simple[];
 
-static errno_t sun_ctl_init(kbd_dev_t *kdev)
+static int sun_ctl_init(kbd_dev_t *kdev)
 {
 	kbd_dev = kdev;
Index: uspace/srv/hid/input/input.c
===================================================================
--- uspace/srv/hid/input/input.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/input.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -54,5 +54,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 #include <str_error.h>
 
@@ -474,5 +473,5 @@
 	kdev->ctl_ops = &kbdev_ctl;
 	
-	errno_t rc = loc_service_get_name(service_id, &kdev->svc_name);
+	int rc = loc_service_get_name(service_id, &kdev->svc_name);
 	if (rc != EOK) {
 		kdev->svc_name = NULL;
@@ -487,5 +486,5 @@
 	list_append(&kdev->link, &kbd_devs);
 	*kdevp = kdev;
-	return 0;
+	return EOK;
 	
 fail:
@@ -511,5 +510,5 @@
 	mdev->proto_ops = &mousedev_proto;
 	
-	errno_t rc = loc_service_get_name(service_id, &mdev->svc_name);
+	int rc = loc_service_get_name(service_id, &mdev->svc_name);
 	if (rc != EOK) {
 		mdev->svc_name = NULL;
@@ -524,5 +523,5 @@
 	list_append(&mdev->link, &mouse_devs);
 	*mdevp = mdev;
-	return 0;
+	return EOK;
 	
 fail:
@@ -531,5 +530,5 @@
 }
 
-static errno_t serial_consumer(void *arg)
+static int serial_consumer(void *arg)
 {
 	serial_dev_t *sdev = (serial_dev_t *) arg;
@@ -555,5 +554,5 @@
 {
 	bool match = false;
-	errno_t rc;
+	int rc;
 
 	serial_dev_t *sdev = serial_dev_new();
@@ -600,5 +599,5 @@
 	
 	*sdevp = sdev;
-	return 0;
+	return EOK;
 	
 fail:
@@ -634,5 +633,5 @@
 }
 
-static errno_t dev_check_new_kbdevs(void)
+static int dev_check_new_kbdevs(void)
 {
 	category_id_t keyboard_cat;
@@ -640,5 +639,5 @@
 	size_t count, i;
 	bool already_known;
-	errno_t rc;
+	int rc;
 	
 	rc = loc_category_get_id("keyboard", &keyboard_cat, IPC_FLAG_BLOCKING);
@@ -671,5 +670,5 @@
 		if (!already_known) {
 			kbd_dev_t *kdev;
-			if (kbd_add_kbdev(svcs[i], &kdev) == 0) {
+			if (kbd_add_kbdev(svcs[i], &kdev) == EOK) {
 				printf("%s: Connected keyboard device '%s'\n",
 				    NAME, kdev->svc_name);
@@ -685,5 +684,5 @@
 }
 
-static errno_t dev_check_new_mousedevs(void)
+static int dev_check_new_mousedevs(void)
 {
 	category_id_t mouse_cat;
@@ -691,5 +690,5 @@
 	size_t count, i;
 	bool already_known;
-	errno_t rc;
+	int rc;
 	
 	rc = loc_category_get_id("mouse", &mouse_cat, IPC_FLAG_BLOCKING);
@@ -722,5 +721,5 @@
 		if (!already_known) {
 			mouse_dev_t *mdev;
-			if (mouse_add_mousedev(svcs[i], &mdev) == 0) {
+			if (mouse_add_mousedev(svcs[i], &mdev) == EOK) {
 				printf("%s: Connected mouse device '%s'\n",
 				    NAME, mdev->svc_name);
@@ -736,5 +735,5 @@
 }
 
-static errno_t dev_check_new_serialdevs(void)
+static int dev_check_new_serialdevs(void)
 {
 	category_id_t serial_cat;
@@ -742,5 +741,5 @@
 	size_t count, i;
 	bool already_known;
-	errno_t rc;
+	int rc;
 	
 	rc = loc_category_get_id("serial", &serial_cat, IPC_FLAG_BLOCKING);
@@ -773,5 +772,5 @@
 		if (!already_known) {
 			serial_dev_t *sdev;
-			if (serial_add_srldev(svcs[i], &sdev) == 0) {
+			if (serial_add_srldev(svcs[i], &sdev) == EOK) {
 				printf("%s: Connected serial device '%s'\n",
 				    NAME, sdev->kdev->svc_name);
@@ -787,7 +786,7 @@
 }
 
-static errno_t dev_check_new(void)
-{
-	errno_t rc;
+static int dev_check_new(void)
+{
+	int rc;
 	
 	fibril_mutex_lock(&discovery_lock);
@@ -824,10 +823,10 @@
 
 /** Start listening for new devices. */
-static errno_t input_start_dev_discovery(void)
-{
-	errno_t rc = loc_register_cat_change_cb(cat_change_cb);
-	if (rc != EOK) {
-		printf("%s: Failed registering callback for device discovery: "
-		    "%s\n", NAME, str_error(rc));
+static int input_start_dev_discovery(void)
+{
+	int rc = loc_register_cat_change_cb(cat_change_cb);
+	if (rc != EOK) {
+		printf("%s: Failed registering callback for device discovery. "
+		    "(%d)\n", NAME, rc);
 		return rc;
 	}
@@ -843,5 +842,5 @@
 int main(int argc, char **argv)
 {
-	errno_t rc;
+	int rc;
 
 	if (argc < 2) {
Index: uspace/srv/hid/input/kbd_ctl.h
===================================================================
--- uspace/srv/hid/input/kbd_ctl.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/kbd_ctl.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,5 @@
 typedef struct kbd_ctl_ops {
 	void (*parse)(sysarg_t);
-	errno_t (*init)(struct kbd_dev *);
+	int (*init)(struct kbd_dev *);
 	void (*set_ind)(struct kbd_dev *, unsigned int);
 } kbd_ctl_ops_t;
Index: uspace/srv/hid/input/kbd_port.h
===================================================================
--- uspace/srv/hid/input/kbd_port.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/kbd_port.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 
 typedef struct kbd_port_ops {
-	errno_t (*init)(struct kbd_dev *);
+	int (*init)(struct kbd_dev *);
 	void (*write)(uint8_t);
 } kbd_port_ops_t;
Index: uspace/srv/hid/input/layout.h
===================================================================
--- uspace/srv/hid/input/layout.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/layout.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,5 +51,5 @@
 /** Layout ops */
 typedef struct layout_ops {
-	errno_t (*create)(layout_t *);
+	int (*create)(layout_t *);
 	void (*destroy)(layout_t *);
 	wchar_t (*parse_ev)(layout_t *, kbd_event_t *);
Index: uspace/srv/hid/input/layout/ar.c
===================================================================
--- uspace/srv/hid/input/layout/ar.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/layout/ar.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1,5 +1,5 @@
 /*
  * Copyright (c) 2011 Jiri Svoboda
- * Copyright (c) 2012 Mohammed Q. Hussain
+ * Copyright (c) 2012 Mohammed Q. Hussain (For Arabic Keyboard)
  * All rights reserved.
  *
@@ -39,5 +39,5 @@
 #include "../kbd.h"
 
-static errno_t ar_create(layout_t *);
+static int ar_create(layout_t *);
 static void ar_destroy(layout_t *);
 static wchar_t ar_parse_ev(layout_t *, kbd_event_t *ev);
@@ -200,5 +200,5 @@
 }
 
-static errno_t ar_create(layout_t *state)
+static int ar_create(layout_t *state)
 {
 	return EOK;
Index: uspace/srv/hid/input/layout/cz.c
===================================================================
--- uspace/srv/hid/input/layout/cz.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/layout/cz.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include "../layout.h"
 
-static errno_t cz_create(layout_t *);
+static int cz_create(layout_t *);
 static void cz_destroy(layout_t *);
 static wchar_t cz_parse_ev(layout_t *, kbd_event_t *ev);
@@ -385,5 +385,5 @@
 }
 
-static errno_t cz_create(layout_t *state)
+static int cz_create(layout_t *state)
 {
 	layout_cz_t *cz_state;
Index: uspace/srv/hid/input/layout/us_dvorak.c
===================================================================
--- uspace/srv/hid/input/layout/us_dvorak.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/layout/us_dvorak.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include "../kbd.h"
 
-static errno_t us_dvorak_create(layout_t *);
+static int us_dvorak_create(layout_t *);
 static void us_dvorak_destroy(layout_t *);
 static wchar_t us_dvorak_parse_ev(layout_t *, kbd_event_t *ev);
@@ -209,5 +209,5 @@
 }
 
-static errno_t us_dvorak_create(layout_t *state)
+static int us_dvorak_create(layout_t *state)
 {
 	return EOK;
Index: uspace/srv/hid/input/layout/us_qwerty.c
===================================================================
--- uspace/srv/hid/input/layout/us_qwerty.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/layout/us_qwerty.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include "../kbd.h"
 
-static errno_t us_qwerty_create(layout_t *);
+static int us_qwerty_create(layout_t *);
 static void us_qwerty_destroy(layout_t *);
 static wchar_t us_qwerty_parse_ev(layout_t *, kbd_event_t *ev);
@@ -203,5 +203,5 @@
 }
 
-static errno_t us_qwerty_create(layout_t *state)
+static int us_qwerty_create(layout_t *state)
 {
 	return EOK;
Index: uspace/srv/hid/input/mouse_port.h
===================================================================
--- uspace/srv/hid/input/mouse_port.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/mouse_port.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 
 typedef struct mouse_port_ops {
-	errno_t (*init)(struct mouse_dev *);
+	int (*init)(struct mouse_dev *);
 	void (*write)(uint8_t);
 } mouse_port_ops_t;
Index: uspace/srv/hid/input/mouse_proto.h
===================================================================
--- uspace/srv/hid/input/mouse_proto.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/mouse_proto.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,5 @@
 typedef struct mouse_proto_ops {
 	void (*parse)(sysarg_t);
-	errno_t (*init)(struct mouse_dev *);
+	int (*init)(struct mouse_dev *);
 } mouse_proto_ops_t;
 
Index: uspace/srv/hid/input/port/chardev.c
===================================================================
--- uspace/srv/hid/input/port/chardev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/port/chardev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,7 +45,7 @@
 #include "../kbd.h"
 
-static errno_t kbd_port_fibril(void *);
+static int kbd_port_fibril(void *);
 
-static errno_t chardev_port_init(kbd_dev_t *);
+static int chardev_port_init(kbd_dev_t *);
 static void chardev_port_write(uint8_t);
 
@@ -69,10 +69,10 @@
 static const unsigned int num_devs = sizeof(in_devs) / sizeof(in_devs[0]);
 
-static errno_t chardev_port_init(kbd_dev_t *kdev)
+static int chardev_port_init(kbd_dev_t *kdev)
 {
 	service_id_t service_id;
 	unsigned int i;
 	fid_t fid;
-	errno_t rc;
+	int rc;
 	
 	kbd_dev = kdev;
@@ -121,5 +121,5 @@
 static void chardev_port_write(uint8_t data)
 {
-	errno_t rc;
+	int rc;
 	size_t nwr;
 
@@ -131,7 +131,7 @@
 }
 
-static errno_t kbd_port_fibril(void *arg)
+static int kbd_port_fibril(void *arg)
 {
-	errno_t rc;
+	int rc;
 	size_t nread;
 	uint8_t b;
Index: uspace/srv/hid/input/proto/mousedev.c
===================================================================
--- uspace/srv/hid/input/proto/mousedev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/input/proto/mousedev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -85,5 +85,5 @@
 		}
 		
-		errno_t retval;
+		int retval;
 		
 		switch (IPC_GET_IMETHOD(call)) {
@@ -114,5 +114,5 @@
 }
 
-static errno_t mousedev_proto_init(mouse_dev_t *mdev)
+static int mousedev_proto_init(mouse_dev_t *mdev)
 {
 	async_sess_t *sess = loc_service_connect(mdev->svc_id, INTERFACE_DDF, 0);
@@ -141,5 +141,5 @@
 	
 	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_MOUSE_CB, 0, 0,
+	int rc = async_create_callback_port(exch, INTERFACE_MOUSE_CB, 0, 0,
 	    mousedev_callback_conn, mousedev, &port);
 	
Index: uspace/srv/hid/isdv4_tablet/isdv4.c
===================================================================
--- uspace/srv/hid/isdv4_tablet/isdv4.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/isdv4_tablet/isdv4.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -294,10 +294,10 @@
 }
 
-static errno_t read_packets(isdv4_state_t *state, packet_consumer_fn consumer)
+static int read_packets(isdv4_state_t *state, packet_consumer_fn consumer)
 {
 	bool reading = true;
 	while (reading) {
 		size_t nread;
-		errno_t rc;
+		int rc;
 
 		rc = chardev_read(state->chardev, state->buf + state->buf_end,
@@ -363,5 +363,5 @@
 static bool write_command(chardev_t *chardev, uint8_t command)
 {
-	errno_t rc;
+	int rc;
 	size_t nwr;
 
@@ -370,9 +370,9 @@
 }
 
-errno_t isdv4_init(isdv4_state_t *state, async_sess_t *sess,
+int isdv4_init(isdv4_state_t *state, async_sess_t *sess,
     isdv4_event_fn event_fn)
 {
 	chardev_t *chardev;
-	errno_t rc;
+	int rc;
 
 	rc = chardev_open(sess, &chardev);
@@ -396,5 +396,5 @@
 }
 
-errno_t isdv4_init_tablet(isdv4_state_t *state)
+int isdv4_init_tablet(isdv4_state_t *state)
 {
 	if (!write_command(state->chardev, CMD_STOP))
@@ -407,5 +407,5 @@
 		return EIO;
 
-	errno_t rc = read_packets(state, parse_response_stylus);
+	int rc = read_packets(state, parse_response_stylus);
 	if (rc != EOK)
 		return rc;
@@ -424,5 +424,5 @@
 }
 
-errno_t isdv4_read_events(isdv4_state_t *state)
+int isdv4_read_events(isdv4_state_t *state)
 {
 	return read_packets(state, parse_event);
Index: uspace/srv/hid/isdv4_tablet/isdv4.h
===================================================================
--- uspace/srv/hid/isdv4_tablet/isdv4.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/isdv4_tablet/isdv4.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -74,16 +74,9 @@
 
 typedef enum {
-	UNKNOWN,
-	PRESS,
-	RELEASE,
-	PROXIMITY_IN,
-	PROXIMITY_OUT,
-	MOVE
+	UNKNOWN, PRESS, RELEASE, PROXIMITY_IN, PROXIMITY_OUT, MOVE
 } isdv4_event_type_t;
 
 typedef enum {
-	STYLUS_TIP,
-	STYLUS_ERASER,
-	TOUCH
+	STYLUS_TIP, STYLUS_ERASER, TOUCH
 } isdv4_source_type_t;
 
@@ -97,7 +90,7 @@
 };
 
-extern errno_t isdv4_init(isdv4_state_t *, async_sess_t *, isdv4_event_fn);
-extern errno_t isdv4_init_tablet(isdv4_state_t *);
-extern errno_t isdv4_read_events(isdv4_state_t *state);
+extern int isdv4_init(isdv4_state_t *, async_sess_t *, isdv4_event_fn);
+extern int isdv4_init_tablet(isdv4_state_t *);
+extern int isdv4_read_events(isdv4_state_t *state);
 extern void isdv4_fini(isdv4_state_t *);
 
Index: uspace/srv/hid/isdv4_tablet/main.c
===================================================================
--- uspace/srv/hid/isdv4_tablet/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/isdv4_tablet/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,5 +35,4 @@
 #include <stddef.h>
 #include <stdio.h>
-#include <str.h>
 #include <task.h>
 
@@ -51,7 +50,7 @@
 }
 
-static errno_t read_fibril(void *unused)
-{
-	errno_t rc = isdv4_read_events(&state);
+static int read_fibril(void *unused)
+{
+	int rc = isdv4_read_events(&state);
 	if (rc != EOK) {
 		fprintf(stderr, "Failed reading events");
@@ -183,5 +182,5 @@
 
 	int arg = 1;
-	errno_t rc;
+	int rc;
 
 	isdv4_event_fn event_fn = emit_event;
Index: uspace/srv/hid/output/ctl/serial.c
===================================================================
--- uspace/srv/hid/output/ctl/serial.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/ctl/serial.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,5 +60,5 @@
 }
 
-static errno_t serial_yield(outdev_t *dev)
+static int serial_yield(outdev_t *dev)
 {
 	vt100_state_t *state = (vt100_state_t *) dev->data;
@@ -67,5 +67,5 @@
 }
 
-static errno_t serial_claim(outdev_t *dev)
+static int serial_claim(outdev_t *dev)
 {
 	vt100_state_t *state = (vt100_state_t *) dev->data;
@@ -122,5 +122,5 @@
 };
 
-errno_t serial_init(vt100_putchar_t putchar_fn,
+int serial_init(vt100_putchar_t putchar_fn,
     vt100_control_puts_t control_puts_fn, vt100_flush_t flush_fn)
 {
Index: uspace/srv/hid/output/ctl/serial.h
===================================================================
--- uspace/srv/hid/output/ctl/serial.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/ctl/serial.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,5 @@
 #include "../proto/vt100.h"
 
-extern errno_t serial_init(vt100_putchar_t, vt100_control_puts_t, vt100_flush_t);
+extern int serial_init(vt100_putchar_t, vt100_control_puts_t, vt100_flush_t);
 
 #endif
Index: uspace/srv/hid/output/output.c
===================================================================
--- uspace/srv/hid/output/output.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/output.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -80,10 +80,10 @@
 static void srv_yield(ipc_callid_t iid, ipc_call_t *icall)
 {
-	errno_t ret = EOK;
+	int ret = EOK;
 	
 	list_foreach(outdevs, link, outdev_t, dev) {
 		assert(dev->ops.yield);
 		
-		errno_t rc = dev->ops.yield(dev);
+		int rc = dev->ops.yield(dev);
 		if (rc != EOK)
 			ret = rc;
@@ -95,10 +95,10 @@
 static void srv_claim(ipc_callid_t iid, ipc_call_t *icall)
 {
-	errno_t ret = EOK;
+	int ret = EOK;
 	
 	list_foreach(outdevs, link, outdev_t, dev) {
 		assert(dev->ops.claim);
 		
-		errno_t rc = dev->ops.claim(dev);
+		int rc = dev->ops.claim(dev);
 		if (rc != EOK)
 			ret = rc;
@@ -170,5 +170,5 @@
 	}
 	
-	errno_t rc = async_share_out_finalize(callid, &frontbuf->data);
+	int rc = async_share_out_finalize(callid, &frontbuf->data);
 	if ((rc != EOK) || (frontbuf->data == AS_MAP_FAILED)) {
 		free(frontbuf);
@@ -467,5 +467,5 @@
 	/* Register server */
 	async_set_fallback_port_handler(client_connection, NULL);
-	errno_t rc = loc_server_register(NAME);
+	int rc = loc_server_register(NAME);
 	if (rc != EOK) {
 		printf("%s: Unable to register driver\n", NAME);
Index: uspace/srv/hid/output/output.h
===================================================================
--- uspace/srv/hid/output/output.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/output.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,15 +42,15 @@
 
 typedef struct {
-	errno_t (*yield)(struct outdev *dev);
-	errno_t (*claim)(struct outdev *dev);
+	int (* yield)(struct outdev *dev);
+	int (* claim)(struct outdev *dev);
 	
-	void (*get_dimensions)(struct outdev *dev, sysarg_t *cols,
+	void (* get_dimensions)(struct outdev *dev, sysarg_t *cols,
 	    sysarg_t *rows);
-	console_caps_t (*get_caps)(struct outdev *dev);
+	console_caps_t (* get_caps)(struct outdev *dev);
 	
-	void (*cursor_update)(struct outdev *dev, sysarg_t prev_col,
+	void (* cursor_update)(struct outdev *dev, sysarg_t prev_col,
 	    sysarg_t prev_row, sysarg_t col, sysarg_t row, bool visible);
-	void (*char_update)(struct outdev *dev, sysarg_t col, sysarg_t row);
-	void (*flush)(struct outdev *dev);
+	void (* char_update)(struct outdev *dev, sysarg_t col, sysarg_t row);
+	void (* flush)(struct outdev *dev);
 } outdev_ops_t;
 
Index: uspace/srv/hid/output/port/chardev.c
===================================================================
--- uspace/srv/hid/output/port/chardev.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/port/chardev.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -99,5 +99,5 @@
 	service_id_t *svc;
 	size_t svcs;
-	errno_t rc;
+	int rc;
 
 	rc = loc_category_get_svcs(serial_cat_id, &svc, &svcs);
@@ -157,5 +157,5 @@
 static void check_for_dev(void)
 {
-	errno_t rc;
+	int rc;
 	bool found;
 	service_id_t sid;
@@ -205,5 +205,5 @@
 }
 
-errno_t chardev_init(void)
+int chardev_init(void)
 {
 	if (!config_key_exists("console")) {
@@ -224,5 +224,5 @@
 	}
 
-	errno_t rc = loc_category_get_id("serial", &serial_cat_id, IPC_FLAG_BLOCKING);
+	int rc = loc_category_get_id("serial", &serial_cat_id, IPC_FLAG_BLOCKING);
 	if (rc != EOK) {
 		printf("%s: Failed to get \"serial\" category ID.\n", NAME);
Index: uspace/srv/hid/output/port/chardev.h
===================================================================
--- uspace/srv/hid/output/port/chardev.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/port/chardev.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -33,5 +33,5 @@
 #define OUTPUT_PORT_CHARDEV_H_
 
-extern errno_t chardev_init(void);
+extern int chardev_init(void);
 
 #endif
Index: uspace/srv/hid/output/port/ega.c
===================================================================
--- uspace/srv/hid/output/port/ega.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/port/ega.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -117,10 +117,10 @@
 }
 
-static errno_t ega_yield(outdev_t *dev)
+static int ega_yield(outdev_t *dev)
 {
 	return EOK;
 }
 
-static errno_t ega_claim(outdev_t *dev)
+static int ega_claim(outdev_t *dev)
 {
 	return EOK;
@@ -183,8 +183,8 @@
 };
 
-errno_t ega_init(void)
+int ega_init(void)
 {
 	sysarg_t present;
-	errno_t rc = sysinfo_get_value("fb", &present);
+	int rc = sysinfo_get_value("fb", &present);
 	if (rc != EOK)
 		present = false;
Index: uspace/srv/hid/output/port/ega.h
===================================================================
--- uspace/srv/hid/output/port/ega.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/port/ega.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -33,5 +33,5 @@
 #define OUTPUT_PORT_EGA_H_
 
-extern errno_t ega_init(void);
+extern int ega_init(void);
 
 #endif
Index: uspace/srv/hid/output/port/kfb.c
===================================================================
--- uspace/srv/hid/output/port/kfb.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/port/kfb.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -419,5 +419,5 @@
 }
 
-static errno_t kfb_yield(fbdev_t *dev)
+static int kfb_yield(fbdev_t *dev)
 {
 	if (kfb.backbuf == NULL) {
@@ -435,5 +435,5 @@
 }
 
-static errno_t kfb_claim(fbdev_t *dev)
+static int kfb_claim(fbdev_t *dev)
 {
 	if (kfb.backbuf == NULL)
@@ -460,5 +460,5 @@
 }
 
-static errno_t kfb_get_resolution(fbdev_t *dev, sysarg_t *width, sysarg_t *height)
+static int kfb_get_resolution(fbdev_t *dev, sysarg_t *width, sysarg_t *height)
 {
 	*width = kfb.width;
@@ -474,5 +474,5 @@
 }
 
-static errno_t kfb_vp_create(fbdev_t *dev, fbvp_t *vp)
+static int kfb_vp_create(fbdev_t *dev, fbvp_t *vp)
 {
 	kfb_vp_t *kfb_vp = malloc(sizeof(kfb_vp_t));
@@ -620,8 +620,8 @@
 }
 
-errno_t kfb_init(void)
+int kfb_init(void)
 {
 	sysarg_t present;
-	errno_t rc = sysinfo_get_value("fb", &present);
+	int rc = sysinfo_get_value("fb", &present);
 	if (rc != EOK)
 		present = false;
Index: uspace/srv/hid/output/port/kfb.h
===================================================================
--- uspace/srv/hid/output/port/kfb.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/port/kfb.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,5 @@
 #define FB_PORT_KFB_H_
 
-extern errno_t kfb_init(void);
+extern int kfb_init(void);
 
 #endif
Index: uspace/srv/hid/output/proto/vt100.c
===================================================================
--- uspace/srv/hid/output/proto/vt100.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/proto/vt100.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -181,10 +181,10 @@
 }
 
-errno_t vt100_yield(vt100_state_t *state)
+int vt100_yield(vt100_state_t *state)
 {
 	return EOK;
 }
 
-errno_t vt100_claim(vt100_state_t *state)
+int vt100_claim(vt100_state_t *state)
 {
 	return EOK;
Index: uspace/srv/hid/output/proto/vt100.h
===================================================================
--- uspace/srv/hid/output/proto/vt100.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/output/proto/vt100.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,7 +35,7 @@
 #include <io/charfield.h>
 
-typedef void (*vt100_putchar_t)(wchar_t ch);
-typedef void (*vt100_control_puts_t)(const char *str);
-typedef void (*vt100_flush_t)(void);
+typedef void (* vt100_putchar_t)(wchar_t ch);
+typedef void (* vt100_control_puts_t)(const char *str);
+typedef void (* vt100_flush_t)(void);
 
 typedef struct {
@@ -56,6 +56,6 @@
 extern void vt100_state_destroy(vt100_state_t *);
 
-extern errno_t vt100_yield(vt100_state_t *);
-extern errno_t vt100_claim(vt100_state_t *);
+extern int vt100_yield(vt100_state_t *);
+extern int vt100_claim(vt100_state_t *);
 extern void vt100_get_dimensions(vt100_state_t *, sysarg_t *, sysarg_t *);
 
Index: uspace/srv/hid/remcons/remcons.c
===================================================================
--- uspace/srv/hid/remcons/remcons.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/remcons/remcons.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,4 @@
 #include <io/console.h>
 #include <inttypes.h>
-#include <str.h>
 #include "telnet.h"
 #include "user.h"
@@ -71,14 +70,14 @@
     sizeof(telnet_force_character_mode_command) / sizeof(telnet_cmd_t);
 
-static errno_t remcons_open(con_srvs_t *, con_srv_t *);
-static errno_t remcons_close(con_srv_t *);
-static errno_t remcons_write(con_srv_t *, void *, size_t, size_t *);
+static int remcons_open(con_srvs_t *, con_srv_t *);
+static int remcons_close(con_srv_t *);
+static int remcons_write(con_srv_t *, void *, size_t);
 static void remcons_sync(con_srv_t *);
 static void remcons_clear(con_srv_t *);
 static void remcons_set_pos(con_srv_t *, sysarg_t col, sysarg_t row);
-static errno_t remcons_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t remcons_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t remcons_get_color_cap(con_srv_t *, console_caps_t *);
-static errno_t remcons_get_event(con_srv_t *, cons_event_t *);
+static int remcons_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
+static int remcons_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
+static int remcons_get_color_cap(con_srv_t *, console_caps_t *);
+static int remcons_get_event(con_srv_t *, cons_event_t *);
 
 static con_ops_t con_ops = {
@@ -115,5 +114,5 @@
 }
 
-static errno_t remcons_open(con_srvs_t *srvs, con_srv_t *srv)
+static int remcons_open(con_srvs_t *srvs, con_srv_t *srv)
 {
 	telnet_user_t *user = srv_to_user(srv);
@@ -128,5 +127,5 @@
 }
 
-static errno_t remcons_close(con_srv_t *srv)
+static int remcons_close(con_srv_t *srv)
 {
 	telnet_user_t *user = srv_to_user(srv);
@@ -138,8 +137,8 @@
 }
 
-static errno_t remcons_write(con_srv_t *srv, void *data, size_t size, size_t *nwritten)
-{
-	telnet_user_t *user = srv_to_user(srv);
-	errno_t rc;
+static int remcons_write(con_srv_t *srv, void *data, size_t size)
+{
+	telnet_user_t *user = srv_to_user(srv);
+	int rc;
 
 	rc = telnet_user_send_data(user, data, size);
@@ -147,6 +146,5 @@
 		return rc;
 
-	*nwritten = size;
-	return EOK;
+	return size;
 }
 
@@ -168,5 +166,5 @@
 }
 
-static errno_t remcons_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
+static int remcons_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
 {
 	telnet_user_t *user = srv_to_user(srv);
@@ -178,5 +176,5 @@
 }
 
-static errno_t remcons_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
+static int remcons_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
 {
 	(void) srv;
@@ -188,5 +186,5 @@
 }
 
-static errno_t remcons_get_color_cap(con_srv_t *srv, console_caps_t *ccaps)
+static int remcons_get_color_cap(con_srv_t *srv, console_caps_t *ccaps)
 {
 	(void) srv;
@@ -196,9 +194,9 @@
 }
 
-static errno_t remcons_get_event(con_srv_t *srv, cons_event_t *event)
+static int remcons_get_event(con_srv_t *srv, cons_event_t *event)
 {
 	telnet_user_t *user = srv_to_user(srv);
 	kbd_event_t kevent;
-	errno_t rc;
+	int rc;
 
 	rc = telnet_user_get_next_keyboard_event(user, &kevent);
@@ -233,5 +231,5 @@
  * @param arg Corresponding @c telnet_user_t structure.
  */
-static errno_t spawn_task_fibril(void *arg)
+static int spawn_task_fibril(void *arg)
 {
 	telnet_user_t *user = arg;
@@ -239,5 +237,5 @@
 	task_id_t task;
 	task_wait_t wait;
-	errno_t rc = task_spawnl(&task, &wait, APP_GETTERM, APP_GETTERM, user->service_name,
+	int rc = task_spawnl(&task, &wait, APP_GETTERM, APP_GETTERM, user->service_name,
 	    "/loc", "--msg", "--", APP_SHELL, NULL);
 	if (rc != EOK) {
@@ -301,5 +299,5 @@
 	telnet_user_add(user);
 
-	errno_t rc = loc_service_register(user->service_name, &user->service_id);
+	int rc = loc_service_register(user->service_name, &user->service_id);
 	if (rc != EOK) {
 		telnet_user_error(user, "Unable to register %s with loc: %s.",
@@ -345,5 +343,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 	tcp_listener_t *lst;
 	tcp_t *tcp;
Index: uspace/srv/hid/remcons/user.c
===================================================================
--- uspace/srv/hid/remcons/user.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/remcons/user.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -187,9 +187,9 @@
  * might be negative.
  */
-static errno_t telnet_user_recv_next_byte_no_lock(telnet_user_t *user, char *byte)
+static int telnet_user_recv_next_byte_no_lock(telnet_user_t *user, char *byte)
 {
 	/* No more buffered data? */
 	if (user->socket_buffer_len <= user->socket_buffer_pos) {
-		errno_t rc;
+		int rc;
 		size_t recv_length;
 
@@ -272,5 +272,5 @@
  * @return Error code.
  */
-errno_t telnet_user_get_next_keyboard_event(telnet_user_t *user, kbd_event_t *event)
+int telnet_user_get_next_keyboard_event(telnet_user_t *user, kbd_event_t *event)
 {
 	fibril_mutex_lock(&user->guard);
@@ -283,5 +283,5 @@
 		/* Skip zeros, bail-out on error. */
 		while (next_byte == 0) {
-			errno_t rc = telnet_user_recv_next_byte_no_lock(user, &next_byte);
+			int rc = telnet_user_recv_next_byte_no_lock(user, &next_byte);
 			if (rc != EOK) {
 				fibril_mutex_unlock(&user->guard);
@@ -339,5 +339,5 @@
  * @param size Size of @p data buffer in bytes.
  */
-static errno_t telnet_user_send_data_no_lock(telnet_user_t *user, uint8_t *data, size_t size)
+static int telnet_user_send_data_no_lock(telnet_user_t *user, uint8_t *data, size_t size)
 {
 	uint8_t *converted = malloc(3 * size + 1);
@@ -362,5 +362,5 @@
 
 
-	errno_t rc = tcp_conn_send(user->conn, converted, converted_size);
+	int rc = tcp_conn_send(user->conn, converted, converted_size);
 	free(converted);
 
@@ -374,9 +374,9 @@
  * @param size Size of @p data buffer in bytes.
  */
-errno_t telnet_user_send_data(telnet_user_t *user, uint8_t *data, size_t size)
+int telnet_user_send_data(telnet_user_t *user, uint8_t *data, size_t size)
 {
 	fibril_mutex_lock(&user->guard);
 
-	errno_t rc = telnet_user_send_data_no_lock(user, data, size);
+	int rc = telnet_user_send_data_no_lock(user, data, size);
 
 	fibril_mutex_unlock(&user->guard);
Index: uspace/srv/hid/remcons/user.h
===================================================================
--- uspace/srv/hid/remcons/user.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/remcons/user.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -87,6 +87,6 @@
 extern bool telnet_user_is_zombie(telnet_user_t *);
 extern void telnet_user_notify_client_disconnected(telnet_user_t *);
-extern errno_t telnet_user_get_next_keyboard_event(telnet_user_t *, kbd_event_t *);
-extern errno_t telnet_user_send_data(telnet_user_t *, uint8_t *, size_t);
+extern int telnet_user_get_next_keyboard_event(telnet_user_t *, kbd_event_t *);
+extern int telnet_user_send_data(telnet_user_t *, uint8_t *, size_t);
 extern void telnet_user_update_cursor_x(telnet_user_t *, int);
 
Index: uspace/srv/hid/rfb/main.c
===================================================================
--- uspace/srv/hid/rfb/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/rfb/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -35,5 +35,4 @@
 #include <inttypes.h>
 #include <io/log.h>
-#include <str.h>
 #include <task.h>
 
@@ -53,25 +52,25 @@
 static rfb_t rfb;
 
-static errno_t rfb_claim(visualizer_t *vs)
-{
-	return EOK;
-}
-
-static errno_t rfb_yield(visualizer_t *vs)
-{
-	return EOK;
-}
-
-static errno_t rfb_suspend(visualizer_t *vs)
-{
-	return EOK;
-}
-
-static errno_t rfb_wakeup(visualizer_t *vs)
-{
-	return EOK;
-}
-
-static errno_t rfb_handle_damage_pixels(visualizer_t *vs,
+static int rfb_claim(visualizer_t *vs)
+{
+	return EOK;
+}
+
+static int rfb_yield(visualizer_t *vs)
+{
+	return EOK;
+}
+
+static int rfb_suspend(visualizer_t *vs)
+{
+	return EOK;
+}
+
+static int rfb_wakeup(visualizer_t *vs)
+{
+	return EOK;
+}
+
+static int rfb_handle_damage_pixels(visualizer_t *vs,
     sysarg_t x0, sysarg_t y0, sysarg_t width, sysarg_t height,
     sysarg_t x_offset, sysarg_t y_offset)
@@ -127,5 +126,5 @@
 }
 
-static errno_t rfb_change_mode(visualizer_t *vs, vslmode_t new_mode)
+static int rfb_change_mode(visualizer_t *vs, vslmode_t new_mode)
 {
 	return EOK;
@@ -218,5 +217,5 @@
 	async_set_fallback_port_handler(client_connection, NULL);
 
-	errno_t rc = loc_server_register(NAME);
+	int rc = loc_server_register(NAME);
 	if (rc != EOK) {
 		printf("%s: Unable to register server.\n", NAME);
Index: uspace/srv/hid/rfb/rfb.c
===================================================================
--- uspace/srv/hid/rfb/rfb.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/rfb/rfb.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -62,8 +62,8 @@
 
 /** Receive one character (with buffering) */
-static errno_t recv_char(tcp_conn_t *conn, char *c)
+static int recv_char(tcp_conn_t *conn, char *c)
 {
 	size_t nrecv;
-	errno_t rc;
+	int rc;
 
 	if (rbuf_out == rbuf_in) {
@@ -83,8 +83,8 @@
 
 /** Receive count characters (with buffering) */
-static errno_t recv_chars(tcp_conn_t *conn, char *c, size_t count)
+static int recv_chars(tcp_conn_t *conn, char *c, size_t count)
 {
 	for (size_t i = 0; i < count; i++) {
-		errno_t rc = recv_char(conn, c);
+		int rc = recv_char(conn, c);
 		if (rc != EOK)
 			return rc;
@@ -94,9 +94,9 @@
 }
 
-static errno_t recv_skip_chars(tcp_conn_t *conn, size_t count)
+static int recv_skip_chars(tcp_conn_t *conn, size_t count)
 {
 	for (size_t i = 0; i < count; i++) {
 		char c;
-		errno_t rc = recv_char(conn, &c);
+		int rc = recv_char(conn, &c);
 		if (rc != EOK)
 			return rc;
@@ -173,5 +173,5 @@
 }
 
-errno_t rfb_init(rfb_t *rfb, uint16_t width, uint16_t height, const char *name)
+int rfb_init(rfb_t *rfb, uint16_t width, uint16_t height, const char *name)
 {
 	memset(rfb, 0, sizeof(rfb_t));
@@ -196,5 +196,5 @@
 }
 
-errno_t rfb_set_size(rfb_t *rfb, uint16_t width, uint16_t height)
+int rfb_set_size(rfb_t *rfb, uint16_t width, uint16_t height)
 {
 	size_t new_size = width * height * sizeof(pixel_t);
@@ -216,5 +216,5 @@
 }
 
-static errno_t recv_message(tcp_conn_t *conn, char type, void *buf, size_t size)
+static int recv_message(tcp_conn_t *conn, char type, void *buf, size_t size)
 {
 	memcpy(buf, &type, 1);
@@ -435,5 +435,5 @@
 }
 
-static errno_t rfb_tile_encode_solid(rfb_t *rfb, cpixel_ctx_t *cpixel,
+static size_t rfb_tile_encode_solid(rfb_t *rfb, cpixel_ctx_t *cpixel,
     rfb_rectangle_t *tile, void *buf, size_t *size)
 {
@@ -476,5 +476,5 @@
 			uint8_t tile_enctype = RFB_TILE_ENCODING_SOLID;
 			size_t tile_size;
-			errno_t rc = rfb_tile_encode_solid(rfb, &cpixel, &tile, buf,
+			int rc = rfb_tile_encode_solid(rfb, &cpixel, &tile, buf,
 			    &tile_size);
 			if (rc != EOK) {
@@ -492,5 +492,5 @@
 }
 
-static errno_t rfb_send_framebuffer_update(rfb_t *rfb, tcp_conn_t *conn,
+static int rfb_send_framebuffer_update(rfb_t *rfb, tcp_conn_t *conn,
     bool incremental)
 {
@@ -556,5 +556,5 @@
 	
 	if (!rfb->pixel_format.true_color) {
-		errno_t rc = tcp_conn_send(conn, send_palette, send_palette_size);
+		int rc = tcp_conn_send(conn, send_palette, send_palette_size);
 		if (rc != EOK) {
 			free(buf);
@@ -563,5 +563,5 @@
 	}
 	
-	errno_t rc = tcp_conn_send(conn, buf, buf_size);
+	int rc = tcp_conn_send(conn, buf, buf_size);
 	free(buf);
 	
@@ -569,5 +569,5 @@
 }
 
-static errno_t rfb_set_pixel_format(rfb_t *rfb, rfb_pixel_format_t *pixel_format)
+static int rfb_set_pixel_format(rfb_t *rfb, rfb_pixel_format_t *pixel_format)
 {
 	rfb->pixel_format = *pixel_format;
@@ -599,8 +599,7 @@
 {
 	/* Version handshake */
-	errno_t rc = tcp_conn_send(conn, "RFB 003.008\n", 12);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending server version: %s",
-		    str_error(rc));
+	int rc = tcp_conn_send(conn, "RFB 003.008\n", 12);
+	if (rc != EOK) {
+		log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending server version %d", rc);
 		return;
 	}
@@ -609,6 +608,5 @@
 	rc = recv_chars(conn, client_version, 12);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving client version: %s",
-		    str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving client version: %d", rc);
 		return;
 	}
@@ -628,5 +626,5 @@
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_WARN,
-		    "Failed sending security handshake: %s", str_error(rc));
+		    "Failed sending security handshake: %d", rc);
 		return;
 	}
@@ -635,6 +633,5 @@
 	rc = recv_char(conn, &selected_sec_type);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving security type: %s",
-		    str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving security type: %d", rc);
 		return;
 	}
@@ -647,6 +644,5 @@
 	rc = tcp_conn_send(conn, &security_result, sizeof(uint32_t));
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending security result: %s",
-		    str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending security result: %d", rc);
 		return;
 	}
@@ -656,6 +652,5 @@
 	rc = recv_char(conn, &shared_flag);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving client init: %s",
-		    str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving client init: %d", rc);
 		return;
 	}
@@ -680,6 +675,5 @@
 	rc = tcp_conn_send(conn, server_init, msg_length);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending server init: %s",
-		    str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending server init: %d", rc);
 		return;
 	}
@@ -759,10 +753,10 @@
 }
 
-errno_t rfb_listen(rfb_t *rfb, uint16_t port)
+int rfb_listen(rfb_t *rfb, uint16_t port)
 {
 	tcp_t *tcp = NULL;
 	tcp_listener_t *lst = NULL;
 	inet_ep_t ep;
-	errno_t rc;
+	int rc;
 	
 	rc = tcp_create(&tcp);
Index: uspace/srv/hid/rfb/rfb.h
===================================================================
--- uspace/srv/hid/rfb/rfb.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/rfb/rfb.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -164,7 +164,7 @@
 
 
-extern errno_t rfb_init(rfb_t *, uint16_t, uint16_t, const char *);
-extern errno_t rfb_set_size(rfb_t *, uint16_t, uint16_t);
-extern errno_t rfb_listen(rfb_t *, uint16_t);
+extern int rfb_init(rfb_t *, uint16_t, uint16_t, const char *);
+extern int rfb_set_size(rfb_t *, uint16_t, uint16_t);
+extern int rfb_listen(rfb_t *, uint16_t);
 
 #endif
Index: uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c
===================================================================
--- uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -85,5 +85,5 @@
 	
 	async_set_fallback_port_handler(s3c24xx_ts_connection, NULL);
-	errno_t rc = loc_server_register(NAME);
+	int rc = loc_server_register(NAME);
 	if (rc != EOK) {
 		printf("%s: Unable to register driver.\n", NAME);
@@ -137,5 +137,5 @@
 	    (void *) ts->paddr, inr);
 
-	async_irq_subscribe(inr, s3c24xx_ts_irq_handler, NULL, &ts_irq_code, NULL);
+	async_irq_subscribe(inr, s3c24xx_ts_irq_handler, NULL, &ts_irq_code);
 
 	s3c24xx_ts_wait_for_int_mode(ts, updn_down);
Index: uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c
===================================================================
--- uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -69,6 +69,6 @@
 static void s3c24xx_uart_sendb(s3c24xx_uart_t *, uint8_t);
 
-static errno_t s3c24xx_uart_read(chardev_srv_t *, void *, size_t, size_t *);
-static errno_t s3c24xx_uart_write(chardev_srv_t *, const void *, size_t, size_t *);
+static int s3c24xx_uart_read(chardev_srv_t *, void *, size_t, size_t *);
+static int s3c24xx_uart_write(chardev_srv_t *, const void *, size_t, size_t *);
 
 static chardev_ops_t s3c24xx_uart_chardev_ops = {
@@ -82,5 +82,5 @@
 	
 	async_set_fallback_port_handler(s3c24xx_uart_connection, uart);
-	errno_t rc = loc_server_register(NAME);
+	int rc = loc_server_register(NAME);
 	if (rc != EOK) {
 		printf("%s: Unable to register server.\n", NAME);
@@ -124,5 +124,5 @@
 static void s3c24xx_uart_irq_handler(ipc_call_t *call, void *arg)
 {
-	errno_t rc;
+	int rc;
 
 	(void) call;
@@ -173,5 +173,5 @@
 	    (void *) uart->paddr, inr);
 
-	async_irq_subscribe(inr, s3c24xx_uart_irq_handler, NULL, &uart_irq_code, NULL);
+	async_irq_subscribe(inr, s3c24xx_uart_irq_handler, NULL, &uart_irq_code);
 
 	/* Enable FIFO, Tx trigger level: empty, Rx trigger level: 1 byte. */
@@ -200,5 +200,5 @@
 }
 
-static errno_t s3c24xx_uart_read(chardev_srv_t *srv, void *buf, size_t size,
+static int s3c24xx_uart_read(chardev_srv_t *srv, void *buf, size_t size,
     size_t *nread)
 {
@@ -206,5 +206,5 @@
 	size_t p;
 	uint8_t *bp = (uint8_t *) buf;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&uart->buf_lock);
@@ -227,5 +227,5 @@
 }
 
-static errno_t s3c24xx_uart_write(chardev_srv_t *srv, const void *data, size_t size,
+static int s3c24xx_uart_write(chardev_srv_t *srv, const void *data, size_t size,
     size_t *nwr)
 {
Index: uspace/srv/klog/klog.c
===================================================================
--- uspace/srv/klog/klog.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/klog/klog.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -100,12 +100,13 @@
 static void producer(void)
 {
-	size_t len = 0;
-	errno_t rc = klog_read(buffer, BUFFER_SIZE, &len);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "klog_read failed, rc = %s",
-		    str_error_name(rc));
+	int read = klog_read(buffer, BUFFER_SIZE);
+	
+	if (read < 0) {
+		log_msg(LOG_DEFAULT, LVL_ERROR, "klog_read failed, rc = %d",
+		    read);
 		return;
 	}
 	
+	size_t len = read;
 	size_t offset = 0;
 	while (offset < len) {
@@ -146,5 +147,5 @@
  *
  */
-static errno_t consumer(void *data)
+static int consumer(void *data)
 {
 	
@@ -210,5 +211,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc = log_init(NAME);
+	int rc = log_init(NAME);
 	if (rc != EOK) {
 		fprintf(stderr, "%s: Unable to initialize log\n", NAME);
Index: uspace/srv/loader/main.c
===================================================================
--- uspace/srv/loader/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/loader/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -119,5 +119,5 @@
 {
 	char *buf;
-	errno_t rc = async_data_write_accept((void **) &buf, true, 0, 0, 0, NULL);
+	int rc = async_data_write_accept((void **) &buf, true, 0, 0, 0, NULL);
 	
 	if (rc == EOK) {
@@ -146,5 +146,5 @@
 
 	char* name = malloc(namesize);
-	errno_t rc = async_data_write_finalize(writeid, name, namesize);
+	int rc = async_data_write_finalize(writeid, name, namesize);
 	if (rc != EOK) {
 		async_answer_0(rid, EINVAL);
@@ -152,7 +152,6 @@
 	}
 
-	int file;
-	rc = vfs_receive_handle(true, &file);
-	if (rc != EOK) {
+	int file = vfs_receive_handle(true);
+	if (file < 0) {
 		async_answer_0(rid, EINVAL);
 		return;
@@ -173,5 +172,5 @@
 	char *buf;
 	size_t buf_size;
-	errno_t rc = async_data_write_accept((void **) &buf, true, 0, 0, 0, &buf_size);
+	int rc = async_data_write_accept((void **) &buf, true, 0, 0, 0, &buf_size);
 	
 	if (rc == EOK) {
@@ -249,5 +248,5 @@
 
 	char* name = malloc(namesize);
-	errno_t rc = async_data_write_finalize(writeid, name, namesize);
+	int rc = async_data_write_finalize(writeid, name, namesize);
 	if (rc != EOK) {
 		async_answer_0(rid, EINVAL);
@@ -255,7 +254,6 @@
 	}
 
-	int file;
-	rc = vfs_receive_handle(true, &file);
-	if (rc != EOK) {
+	int file = vfs_receive_handle(true);
+	if (file < 0) {
 		async_answer_0(rid, EINVAL);
 		return;
@@ -300,5 +298,5 @@
 	pcb.inbox_entries = inbox_entries;
 	
-	async_answer_0(rid, EOK);
+	async_answer_0(rid, rc);
 	return 0;
 }
@@ -349,5 +347,5 @@
 	
 	while (true) {
-		errno_t retval;
+		int retval;
 		ipc_call_t call;
 		ipc_callid_t callid = async_get_call(&call);
@@ -395,5 +393,5 @@
 	/* Introduce this task to the NS (give it our task ID). */
 	task_id_t id = task_get_id();
-	errno_t rc = ns_intro(id);
+	int rc = ns_intro(id);
 	if (rc != EOK)
 		return rc;
Index: uspace/srv/locsrv/category.c
===================================================================
--- uspace/srv/locsrv/category.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/locsrv/category.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
 
 /** Get list of categories. */
-errno_t categ_dir_get_categories(categ_dir_t *cdir, category_id_t *id_buf,
+int categ_dir_get_categories(categ_dir_t *cdir, category_id_t *id_buf,
     size_t buf_size, size_t *act_size)
 {
@@ -107,5 +107,5 @@
 
 /** Add service to category. */
-errno_t category_add_service(category_t *cat, loc_service_t *svc)
+int category_add_service(category_t *cat, loc_service_t *svc)
 {
 	assert(fibril_mutex_is_locked(&cat->mutex));
@@ -171,5 +171,5 @@
 
 /** Get list of services in category. */
-errno_t category_get_services(category_t *cat, service_id_t *id_buf,
+int category_get_services(category_t *cat, service_id_t *id_buf,
     size_t buf_size, size_t *act_size)
 {
Index: uspace/srv/locsrv/category.h
===================================================================
--- uspace/srv/locsrv/category.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/locsrv/category.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -82,12 +82,12 @@
 extern void categ_dir_init(categ_dir_t *);
 extern void categ_dir_add_cat(categ_dir_t *, category_t *);
-extern errno_t categ_dir_get_categories(categ_dir_t *, service_id_t *, size_t,
+extern int categ_dir_get_categories(categ_dir_t *, service_id_t *, size_t,
     size_t *);
 extern category_t *category_new(const char *);
-extern errno_t category_add_service(category_t *, loc_service_t *);
+extern int category_add_service(category_t *, loc_service_t *);
 extern void category_remove_service(svc_categ_t *);
 extern category_t *category_get(categ_dir_t *, catid_t);
 extern category_t *category_find_by_name(categ_dir_t *, const char *);
-extern errno_t category_get_services(category_t *, service_id_t *, size_t,
+extern int category_get_services(category_t *, service_id_t *, size_t,
     size_t *);
 
Index: uspace/srv/locsrv/locsrv.c
===================================================================
--- uspace/srv/locsrv/locsrv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/locsrv/locsrv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,4 @@
 #include <stdlib.h>
 #include <str.h>
-#include <str_error.h>
 #include <ipc/loc.h>
 #include <assert.h>
@@ -356,5 +355,5 @@
 	 * Get server name
 	 */
-	errno_t rc = async_data_write_accept((void **) &server->name, true, 0,
+	int rc = async_data_write_accept((void **) &server->name, true, 0,
 	    LOC_NAME_MAXLEN, 0, NULL);
 	if (rc != EOK) {
@@ -410,5 +409,5 @@
  *
  */
-static errno_t loc_server_unregister(loc_server_t *server)
+static int loc_server_unregister(loc_server_t *server)
 {
 	if (server == NULL)
@@ -471,5 +470,5 @@
 	/* Get fqsn */
 	char *fqsn;
-	errno_t rc = async_data_write_accept((void **) &fqsn, true, 0,
+	int rc = async_data_write_accept((void **) &fqsn, true, 0,
 	    LOC_NAME_MAXLEN, 0, NULL);
 	if (rc != EOK) {
@@ -599,5 +598,5 @@
 	}
 	
-	errno_t retval = async_data_read_finalize(callid, cat->name,
+	sysarg_t retval = async_data_read_finalize(callid, cat->name,
 	    min(size, act_size));
 	
@@ -647,5 +646,5 @@
 	}
 	
-	errno_t retval = async_data_read_finalize(callid, fqn,
+	sysarg_t retval = async_data_read_finalize(callid, fqn,
 	    min(size, act_size));
 	free(fqn);
@@ -694,5 +693,5 @@
 	}
 	
-	errno_t retval = async_data_read_finalize(callid, svc->server->name,
+	sysarg_t retval = async_data_read_finalize(callid, svc->server->name,
 	    min(size, act_size));
 	
@@ -743,5 +742,5 @@
 	
 	/* Get fqsn */
-	errno_t rc = async_data_write_accept((void **) &fqsn, true, 0,
+	int rc = async_data_write_accept((void **) &fqsn, true, 0,
 	    LOC_NAME_MAXLEN, 0, NULL);
 	if (rc != EOK) {
@@ -806,5 +805,5 @@
 	
 	/* Get service name */
-	errno_t rc = async_data_write_accept((void **) &name, true, 0,
+	int rc = async_data_write_accept((void **) &name, true, 0,
 	    LOC_NAME_MAXLEN, 0, NULL);
 	if (rc != EOK) {
@@ -851,5 +850,5 @@
  * events.
  *
- * On success, answer will contain EOK errno_t retval.
+ * On success, answer will contain EOK int retval.
  * On failure, error code will be sent in retval.
  *
@@ -895,5 +894,5 @@
 /** Find ID for category specified by name.
  *
- * On success, answer will contain EOK errno_t retval and service ID in arg1.
+ * On success, answer will contain EOK int retval and service ID in arg1.
  * On failure, error code will be sent in retval.
  *
@@ -905,5 +904,5 @@
 	
 	/* Get service name */
-	errno_t rc = async_data_write_accept((void **) &name, true, 0,
+	int rc = async_data_write_accept((void **) &name, true, 0,
 	    LOC_NAME_MAXLEN, 0, NULL);
 	if (rc != EOK) {
@@ -972,5 +971,5 @@
 	size_t size;
 	size_t act_size;
-	errno_t rc;
+	int rc;
 	
 	if (!async_data_read_receive(&callid, &size)) {
@@ -1000,5 +999,5 @@
 	fibril_mutex_unlock(&cdir.mutex);
 	
-	errno_t retval = async_data_read_finalize(callid, id_buf, size);
+	sysarg_t retval = async_data_read_finalize(callid, id_buf, size);
 	free(id_buf);
 	
@@ -1047,5 +1046,5 @@
 	}
 	
-	errno_t retval = async_data_read_finalize(callid, desc, size);
+	sysarg_t retval = async_data_read_finalize(callid, desc, size);
 	
 	free(desc);
@@ -1110,5 +1109,5 @@
 	}
 	
-	errno_t retval = async_data_read_finalize(callid, desc, size);
+	sysarg_t retval = async_data_read_finalize(callid, desc, size);
 	
 	free(desc);
@@ -1123,5 +1122,5 @@
 	size_t size;
 	size_t act_size;
-	errno_t rc;
+	int rc;
 	
 	if (!async_data_read_receive(&callid, &size)) {
@@ -1163,5 +1162,5 @@
 	fibril_mutex_unlock(&cdir.mutex);
 	
-	errno_t retval = async_data_read_finalize(callid, id_buf, size);
+	sysarg_t retval = async_data_read_finalize(callid, id_buf, size);
 	free(id_buf);
 	
@@ -1278,5 +1277,5 @@
 	catid_t cat_id;
 	service_id_t svc_id;
-	errno_t retval;
+	sysarg_t retval;
 	
 	svc_id = IPC_GET_ARG1(*icall);
@@ -1528,17 +1527,13 @@
 	
 	port_id_t port;
-	errno_t rc = async_create_port(INTERFACE_LOC_SUPPLIER,
+	int rc = async_create_port(INTERFACE_LOC_SUPPLIER,
 	    loc_connection_supplier, NULL, &port);
-	if (rc != EOK) {
-		printf("%s: Error while creating supplier port: %s\n", NAME, str_error(rc));
+	if (rc != EOK)
 		return rc;
-	}
 	
 	rc = async_create_port(INTERFACE_LOC_CONSUMER,
 	    loc_connection_consumer, NULL, &port);
-	if (rc != EOK) {
-		printf("%s: Error while creating consumer port: %s\n", NAME, str_error(rc));
+	if (rc != EOK)
 		return rc;
-	}
 	
 	/* Set a handler of incomming connections */
@@ -1547,8 +1542,6 @@
 	/* Register location service at naming service */
 	rc = service_register(SERVICE_LOC);
-	if (rc != EOK) {
-		printf("%s: Error while registering service: %s\n", NAME, str_error(rc));
+	if (rc != EOK)
 		return rc;
-	}
 	
 	printf("%s: Accepting connections\n", NAME);
Index: uspace/srv/logger/ctl.c
===================================================================
--- uspace/srv/logger/ctl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/logger/ctl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,8 +43,8 @@
 #include "logger.h"
 
-static errno_t handle_log_level_change(sysarg_t new_level)
+static int handle_log_level_change(sysarg_t new_level)
 {
 	void *full_name;
-	errno_t rc = async_data_write_accept(&full_name, true, 0, 0, 0, NULL);
+	int rc = async_data_write_accept(&full_name, true, 0, 0, 0, NULL);
 	if (rc != EOK) {
 		return rc;
@@ -77,21 +77,17 @@
 		switch (IPC_GET_IMETHOD(call)) {
 		case LOGGER_CONTROL_SET_DEFAULT_LEVEL: {
-			errno_t rc = set_default_logging_level(IPC_GET_ARG1(call));
+			int rc = set_default_logging_level(IPC_GET_ARG1(call));
 			async_answer_0(callid, rc);
 			break;
 		}
 		case LOGGER_CONTROL_SET_LOG_LEVEL: {
-			errno_t rc = handle_log_level_change(IPC_GET_ARG1(call));
+			int rc = handle_log_level_change(IPC_GET_ARG1(call));
 			async_answer_0(callid, rc);
 			break;
 		}
 		case LOGGER_CONTROL_SET_ROOT: {
-			int fd;
-			errno_t rc = vfs_receive_handle(true, &fd);
-			if (rc == EOK) {
-				rc = vfs_root_set(fd);
-				vfs_put(fd);
-			}
-			async_answer_0(callid, rc);
+			int fd = vfs_receive_handle(true);
+			vfs_root_set(fd);
+			async_answer_0(callid, fd >= 0 ? EOK : fd);
 			break;
 		}
Index: uspace/srv/logger/initlvl.c
===================================================================
--- uspace/srv/logger/initlvl.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/logger/initlvl.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
 	if (value == NULL) {
 		log_level_t level;
-		errno_t rc = log_level_from_str(key, &level);
+		int rc = log_level_from_str(key, &level);
 		if (rc != EOK)
 			return;
@@ -59,5 +59,5 @@
 
 	log_level_t level;
-	errno_t rc = log_level_from_str(value, &level);
+	int rc = log_level_from_str(value, &level);
 	if (rc != EOK)
 		return;
Index: uspace/srv/logger/level.c
===================================================================
--- uspace/srv/logger/level.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/logger/level.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,5 +49,5 @@
 }
 
-errno_t set_default_logging_level(log_level_t new_level)
+int set_default_logging_level(log_level_t new_level)
 {
 	if (new_level >= LVL_LIMIT)
Index: uspace/srv/logger/logger.h
===================================================================
--- uspace/srv/logger/logger.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/logger/logger.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -95,5 +95,5 @@
 
 log_level_t get_default_logging_level(void);
-errno_t set_default_logging_level(log_level_t);
+int set_default_logging_level(log_level_t);
 
 
Index: uspace/srv/logger/logs.c
===================================================================
--- uspace/srv/logger/logs.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/logger/logs.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,10 +52,11 @@
 }
 
-static errno_t create_dest(const char *name, logger_dest_t **dest)
+static int create_dest(const char *name, logger_dest_t **dest)
 {
 	logger_dest_t *result = malloc(sizeof(logger_dest_t));
 	if (result == NULL)
 		return ENOMEM;
-	if (asprintf(&result->filename, "/log/%s", name) < 0) {
+	int rc = asprintf(&result->filename, "/log/%s", name);
+	if (rc < 0) {
 		free(result);
 		return ENOMEM;
@@ -86,10 +87,11 @@
 		if (result->full_name == NULL)
 			goto error;
-		errno_t rc = create_dest(name, &result->dest);
+		int rc = create_dest(name, &result->dest);
 		if (rc != EOK)
 			goto error;
 	} else {
-		if (asprintf(&result->full_name, "%s/%s",
-		    parent->full_name, name) < 0)
+		int rc = asprintf(&result->full_name, "%s/%s",
+		    parent->full_name, name);
+		if (rc < 0)
 			goto error;
 		result->dest = parent->dest;
Index: uspace/srv/logger/main.c
===================================================================
--- uspace/srv/logger/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/logger/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -70,17 +70,13 @@
 	
 	port_id_t port;
-	errno_t rc = async_create_port(INTERFACE_LOGGER_CONTROL,
+	int rc = async_create_port(INTERFACE_LOGGER_CONTROL,
 	    connection_handler_control, NULL, &port);
-	if (rc != EOK) {
-		printf("%s: Error while creating control port: %s\n", NAME, str_error(rc));
+	if (rc != EOK)
 		return rc;
-	}
 	
 	rc = async_create_port(INTERFACE_LOGGER_WRITER,
 	    connection_handler_writer, NULL, &port);
-	if (rc != EOK) {
-		printf("%s: Error while creating writer port: %s\n", NAME, str_error(rc));
+	if (rc != EOK)
 		return rc;
-	}
 	
 	rc = service_register(SERVICE_LOGGER);
Index: uspace/srv/logger/writer.c
===================================================================
--- uspace/srv/logger/writer.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/logger/writer.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,5 +53,5 @@
 {
 	void *name;
-	errno_t rc = async_data_write_accept(&name, true, 1, 0, 0, NULL);
+	int rc = async_data_write_accept(&name, true, 1, 0, 0, NULL);
 	if (rc != EOK)
 		return NULL;
@@ -64,5 +64,5 @@
 }
 
-static errno_t handle_receive_message(sysarg_t log_id, sysarg_t level)
+static int handle_receive_message(sysarg_t log_id, sysarg_t level)
 {
 	logger_log_t *log = find_log_by_id_and_lock(log_id);
@@ -71,5 +71,5 @@
 
 	void *message = NULL;
-	errno_t rc = async_data_write_accept(&message, true, 1, 0, 0, NULL);
+	int rc = async_data_write_accept(&message, true, 1, 0, 0, NULL);
 	if (rc != EOK)
 		goto leave;
@@ -80,5 +80,5 @@
 	}
 
-	KLOG_PRINTF(level, "[%s] %s: %s",
+	KLOG_PRINTF(level, "[%s] %s: %s\n",
 	    log->full_name, log_level_str(level),
 	    (const char *) message);
@@ -128,5 +128,5 @@
 		}
 		case LOGGER_WRITER_MESSAGE: {
-			errno_t rc = handle_receive_message(IPC_GET_ARG1(call),
+			int rc = handle_receive_message(IPC_GET_ARG1(call),
 			    IPC_GET_ARG2(call));
 			async_answer_0(callid, rc);
Index: uspace/srv/net/dhcp/dhcp.c
===================================================================
--- uspace/srv/net/dhcp/dhcp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dhcp/dhcp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,4 @@
 #include <byteorder.h>
 #include <errno.h>
-#include <str_error.h>
 #include <fibril_synch.h>
 #include <inet/addr.h>
@@ -48,5 +47,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 
 #include "dhcp.h"
@@ -118,5 +116,5 @@
 
 /** Decode subnet mask into subnet prefix length. */
-static errno_t subnet_mask_decode(uint32_t mask, int *bits)
+static int subnet_mask_decode(uint32_t mask, int *bits)
 {
 	int zbits;
@@ -149,5 +147,5 @@
 }
 
-static errno_t dhcp_send_discover(dhcp_link_t *dlink)
+static int dhcp_send_discover(dhcp_link_t *dlink)
 {
 	dhcp_hdr_t *hdr = (dhcp_hdr_t *)msgbuf;
@@ -172,5 +170,5 @@
 }
 
-static errno_t dhcp_send_request(dhcp_link_t *dlink, dhcp_offer_t *offer)
+static int dhcp_send_request(dhcp_link_t *dlink, dhcp_offer_t *offer)
 {
 	dhcp_hdr_t *hdr = (dhcp_hdr_t *)msgbuf;
@@ -213,5 +211,5 @@
 }
 
-static errno_t dhcp_parse_reply(void *msg, size_t size, dhcp_offer_t *offer)
+static int dhcp_parse_reply(void *msg, size_t size, dhcp_offer_t *offer)
 {
 	dhcp_hdr_t *hdr = (dhcp_hdr_t *)msg;
@@ -226,5 +224,5 @@
 	uint8_t opt_type, opt_len;
 	uint8_t *msgb;
-	errno_t rc;
+	int rc;
 	size_t i;
 
@@ -361,7 +359,7 @@
 }
 
-static errno_t dhcp_cfg_create(service_id_t iplink, dhcp_offer_t *offer)
-{
-	errno_t rc;
+static int dhcp_cfg_create(service_id_t iplink, dhcp_offer_t *offer)
+{
+	int rc;
 	service_id_t addr_id;
 	service_id_t sroute_id;
@@ -372,5 +370,5 @@
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error creating IP address %s: %s", "dhcp4a", str_error(rc));
+		    "Error creating IP address %s (%d)", "dhcp4a", rc);
 		return rc;
 	}
@@ -382,5 +380,5 @@
 		if (rc != EOK) {
 			log_msg(LOG_DEFAULT, LVL_ERROR, "Error creating "
-			    "default route %s: %s.", "dhcpdef", str_error(rc));
+			    "default route %s (%d).", "dhcpdef", rc);
 			return rc;
 		}
@@ -391,5 +389,5 @@
 		if (rc != EOK) {
 			log_msg(LOG_DEFAULT, LVL_ERROR, "Error setting "
-			    "nameserver address: %s)", str_error(rc));
+			    "nameserver address (%d))", rc);
 			return rc;
 		}
@@ -421,9 +419,9 @@
 }
 
-static errno_t dhcp_discover_proc(dhcp_link_t *dlink)
+static int dhcp_discover_proc(dhcp_link_t *dlink)
 {
 	dlink->state = ds_selecting;
 
-	errno_t rc = dhcp_send_discover(dlink);
+	int rc = dhcp_send_discover(dlink);
 	if (rc != EOK)
 		return EIO;
@@ -439,8 +437,8 @@
 }
 
-errno_t dhcpsrv_link_add(service_id_t link_id)
+int dhcpsrv_link_add(service_id_t link_id)
 {
 	dhcp_link_t *dlink;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcpsrv_link_add(%zu)", link_id);
@@ -499,10 +497,10 @@
 }
 
-errno_t dhcpsrv_link_remove(service_id_t link_id)
+int dhcpsrv_link_remove(service_id_t link_id)
 {
 	return ENOTSUP;
 }
 
-errno_t dhcpsrv_discover(service_id_t link_id)
+int dhcpsrv_discover(service_id_t link_id)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcpsrv_link_add(%zu)", link_id);
@@ -521,5 +519,5 @@
 static void dhcpsrv_recv_offer(dhcp_link_t *dlink, dhcp_offer_t *offer)
 {
-	errno_t rc;
+	int rc;
 
 	if (dlink->state != ds_selecting) {
@@ -547,5 +545,5 @@
 static void dhcpsrv_recv_ack(dhcp_link_t *dlink, dhcp_offer_t *offer)
 {
-	errno_t rc;
+	int rc;
 
 	if (dlink->state != ds_requesting) {
@@ -573,5 +571,5 @@
 	dhcp_link_t *dlink = (dhcp_link_t *)arg;
 	dhcp_offer_t offer;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: dhcpsrv_recv() %zu bytes",
@@ -601,5 +599,5 @@
 {
 	dhcp_link_t *dlink = (dhcp_link_t *)arg;
-	errno_t rc;
+	int rc;
 
 	assert(dlink->state == ds_selecting);
@@ -629,5 +627,5 @@
 {
 	dhcp_link_t *dlink = (dhcp_link_t *)arg;
-	errno_t rc;
+	int rc;
 
 	assert(dlink->state == ds_requesting);
Index: uspace/srv/net/dhcp/dhcp.h
===================================================================
--- uspace/srv/net/dhcp/dhcp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dhcp/dhcp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,7 +41,7 @@
 
 extern void dhcpsrv_links_init(void);
-extern errno_t dhcpsrv_link_add(service_id_t);
-extern errno_t dhcpsrv_link_remove(service_id_t);
-extern errno_t dhcpsrv_discover(service_id_t);
+extern int dhcpsrv_link_add(service_id_t);
+extern int dhcpsrv_link_remove(service_id_t);
+extern int dhcpsrv_discover(service_id_t);
 
 #endif
Index: uspace/srv/net/dhcp/main.c
===================================================================
--- uspace/srv/net/dhcp/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dhcp/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <io/log.h>
 #include <inet/inetcfg.h>
@@ -52,7 +51,7 @@
 static void dhcp_client_conn(ipc_callid_t, ipc_call_t *, void *);
 
-static errno_t dhcp_init(void)
+static int dhcp_init(void)
 {
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_init()");
@@ -70,5 +69,5 @@
 	rc = loc_server_register(NAME);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server (%d).", rc);
 		return EEXIST;
 	}
@@ -77,5 +76,5 @@
 	rc = loc_service_register(SERVICE_NAME_DHCP, &sid);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
 		return EEXIST;
 	}
@@ -87,5 +86,5 @@
 {
 	sysarg_t link_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_link_add_srv()");
@@ -100,5 +99,5 @@
 {
 	sysarg_t link_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_link_remove_srv()");
@@ -113,5 +112,5 @@
 {
 	sysarg_t link_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_discover_srv()");
@@ -159,5 +158,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf("%s: DHCP Service\n", NAME);
Index: uspace/srv/net/dhcp/transport.c
===================================================================
--- uspace/srv/net/dhcp/transport.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dhcp/transport.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -75,8 +75,8 @@
 };
 
-errno_t dhcp_send(dhcp_transport_t *dt, void *msg, size_t size)
+int dhcp_send(dhcp_transport_t *dt, void *msg, size_t size)
 {
 	inet_ep_t ep;
-	errno_t rc;
+	int rc;
 
 	inet_ep_init(&ep);
@@ -97,5 +97,5 @@
 	dhcp_transport_t *dt;
 	size_t s;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_NOTE, "dhcp_recv_msg()");
@@ -126,5 +126,5 @@
 }
 
-errno_t dhcp_transport_init(dhcp_transport_t *dt, service_id_t link_id,
+int dhcp_transport_init(dhcp_transport_t *dt, service_id_t link_id,
     dhcp_recv_cb_t recv_cb, void *arg)
 {
@@ -132,5 +132,5 @@
 	udp_assoc_t *assoc = NULL;
 	inet_ep2_t epp;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_transport_init()");
Index: uspace/srv/net/dhcp/transport.h
===================================================================
--- uspace/srv/net/dhcp/transport.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dhcp/transport.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,8 +58,8 @@
 };
 
-extern errno_t dhcp_transport_init(dhcp_transport_t *, service_id_t,
+extern int dhcp_transport_init(dhcp_transport_t *, service_id_t,
     dhcp_recv_cb_t, void *);
 extern void dhcp_transport_fini(dhcp_transport_t *);
-extern errno_t dhcp_send(dhcp_transport_t *dt, void *msg, size_t size);
+extern int dhcp_send(dhcp_transport_t *dt, void *msg, size_t size);
 
 #endif
Index: uspace/srv/net/dnsrsrv/dns_msg.c
===================================================================
--- uspace/srv/net/dnsrsrv/dns_msg.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dnsrsrv/dns_msg.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
  * fit in and append @a suff.
  */
-static errno_t dns_dstr_ext(char **dstr, const char *suff)
+static int dns_dstr_ext(char **dstr, const char *suff)
 {
 	size_t s1, s2;
@@ -93,5 +93,5 @@
  * @param act_size	Place to store actual encoded size
  */
-static errno_t dns_name_encode(char *name, uint8_t *buf, size_t buf_size,
+static int dns_name_encode(char *name, uint8_t *buf, size_t buf_size,
     size_t *act_size)
 {
@@ -158,5 +158,5 @@
  * @param eoff	Place to store end offset (offset after last decoded byte)
  */
-errno_t dns_name_decode(dns_pdu_t *pdu, size_t boff, char **rname,
+int dns_name_decode(dns_pdu_t *pdu, size_t boff, char **rname,
     size_t *eoff)
 {
@@ -169,5 +169,5 @@
 	char *name;
 	char dbuf[2];
-	errno_t rc;
+	int rc;
 	bool first;
 
@@ -325,10 +325,10 @@
  * @param act_size	Place to store actual encoded size
  */
-static errno_t dns_question_encode(dns_question_t *question, uint8_t *buf,
+static int dns_question_encode(dns_question_t *question, uint8_t *buf,
     size_t buf_size, size_t *act_size)
 {
 	size_t name_size;
 	size_t di;
-	errno_t rc;
+	int rc;
 
 	rc = dns_name_encode(question->qname, buf, buf_size, &name_size);
@@ -358,10 +358,10 @@
  * @param eoff		Place to store end offset (offset after last decoded byte)
  */
-static errno_t dns_question_decode(dns_pdu_t *pdu, size_t boff,
+static int dns_question_decode(dns_pdu_t *pdu, size_t boff,
     dns_question_t **rquestion, size_t *eoff)
 {
 	dns_question_t *question;
 	size_t name_eoff;
-	errno_t rc;
+	int rc;
 
 	question = calloc(1, sizeof (dns_question_t));
@@ -398,5 +398,5 @@
  * @param eoff		Place to store end offset (offset after last decoded byte)
  */
-static errno_t dns_rr_decode(dns_pdu_t *pdu, size_t boff, dns_rr_t **retrr,
+static int dns_rr_decode(dns_pdu_t *pdu, size_t boff, dns_rr_t **retrr,
     size_t *eoff)
 {
@@ -406,5 +406,5 @@
 	size_t bsz;
 	size_t rdlength;
-	errno_t rc;
+	int rc;
 
 	rr = calloc(1, sizeof(dns_rr_t));
@@ -492,5 +492,5 @@
  *		ENOMEM if out of memory
  */
-errno_t dns_message_encode(dns_message_t *msg, void **rdata, size_t *rsize)
+int dns_message_encode(dns_message_t *msg, void **rdata, size_t *rsize)
 {
 	uint8_t *data;
@@ -499,5 +499,5 @@
 	size_t q_size = 0;
 	size_t di;
-	errno_t rc;
+	int rc;
 
 	hdr.id = host2uint16_t_be(msg->id);
@@ -564,5 +564,5 @@
  * 		ENOMEM if out of memory
  */
-errno_t dns_message_decode(void *data, size_t size, dns_message_t **rmsg)
+int dns_message_decode(void *data, size_t size, dns_message_t **rmsg)
 {
 	dns_message_t *msg;
@@ -575,5 +575,5 @@
 	size_t an_count;
 	size_t i;
-	errno_t rc;
+	int rc;
 
 	msg = dns_message_new();
Index: uspace/srv/net/dnsrsrv/dns_msg.h
===================================================================
--- uspace/srv/net/dnsrsrv/dns_msg.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dnsrsrv/dns_msg.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,9 +44,9 @@
 #include "dns_type.h"
 
-extern errno_t dns_message_encode(dns_message_t *, void **, size_t *);
-extern errno_t dns_message_decode(void *, size_t, dns_message_t **);
+extern int dns_message_encode(dns_message_t *, void **, size_t *);
+extern int dns_message_decode(void *, size_t, dns_message_t **);
 extern dns_message_t *dns_message_new(void);
 extern void dns_message_destroy(dns_message_t *);
-extern errno_t dns_name_decode(dns_pdu_t *, size_t, char **, size_t *);
+extern int dns_name_decode(dns_pdu_t *, size_t, char **, size_t *);
 extern uint32_t dns_uint32_t_decode(uint8_t *, size_t);
 extern void dns_addr128_t_decode(uint8_t *, size_t, addr128_t);
Index: uspace/srv/net/dnsrsrv/dnsrsrv.c
===================================================================
--- uspace/srv/net/dnsrsrv/dnsrsrv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dnsrsrv/dnsrsrv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <io/log.h>
 #include <ipc/dnsr.h>
@@ -43,5 +42,4 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 #include <task.h>
 
@@ -55,7 +53,7 @@
 static void dnsr_client_conn(ipc_callid_t, ipc_call_t *, void *);
 
-static errno_t dnsr_init(void)
-{
-	errno_t rc;
+static int dnsr_init(void)
+{
+	int rc;
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "dnsr_init()");
 
@@ -70,5 +68,5 @@
 	rc = loc_server_register(NAME);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server (%d).", rc);
 		transport_fini();
 		return EEXIST;
@@ -78,5 +76,5 @@
 	rc = loc_service_register(SERVICE_NAME_DNSR, &sid);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
 		transport_fini();
 		return EEXIST;
@@ -94,5 +92,5 @@
 	
 	char *name;
-	errno_t rc = async_data_write_accept((void **) &name, true, 0,
+	int rc = async_data_write_accept((void **) &name, true, 0,
 	    DNS_NAME_MAX_SIZE, 0, NULL);
 	if (rc != EOK) {
@@ -146,5 +144,5 @@
 		async_answer_0(callid, rc);
 	
-	async_answer_0(iid, rc);
+	async_answer_0(iid, (sysarg_t) rc);
 	
 	dns_hostinfo_destroy(hinfo);
@@ -172,5 +170,5 @@
 	// FIXME locking
 	
-	errno_t rc = async_data_read_finalize(callid, &dns_server_addr, size);
+	int rc = async_data_read_finalize(callid, &dns_server_addr, size);
 	if (rc != EOK)
 		async_answer_0(callid, rc);
@@ -200,11 +198,11 @@
 	// FIXME locking
 	
-	errno_t rc = async_data_write_finalize(callid, &dns_server_addr, size);
-	if (rc != EOK) {
-		async_answer_0(callid, rc);
-		async_answer_0(iid, rc);
-	}
-	
-	async_answer_0(iid, rc);
+	int rc = async_data_write_finalize(callid, &dns_server_addr, size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		async_answer_0(iid, rc);
+	}
+	
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -247,5 +245,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf("%s: DNS Resolution Service\n", NAME);
Index: uspace/srv/net/dnsrsrv/query.c
===================================================================
--- uspace/srv/net/dnsrsrv/query.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dnsrsrv/query.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 static uint16_t msg_id;
 
-static errno_t dns_name_query(const char *name, dns_qtype_t qtype,
+static int dns_name_query(const char *name, dns_qtype_t qtype,
     dns_host_info_t *info)
 {
@@ -92,5 +92,5 @@
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_name_query: send DNS request");
 	dns_message_t *amsg;
-	errno_t rc = dns_request(msg, &amsg);
+	int rc = dns_request(msg, &amsg);
 	if (rc != EOK) {
 		dns_message_destroy(msg);
@@ -190,5 +190,5 @@
 }
 
-errno_t dns_name2host(const char *name, dns_host_info_t **rinfo, ip_ver_t ver)
+int dns_name2host(const char *name, dns_host_info_t **rinfo, ip_ver_t ver)
 {
 	dns_host_info_t *info = calloc(1, sizeof(dns_host_info_t));
@@ -196,5 +196,5 @@
 		return ENOMEM;
 	
-	errno_t rc;
+	int rc;
 	
 	switch (ver) {
Index: uspace/srv/net/dnsrsrv/query.h
===================================================================
--- uspace/srv/net/dnsrsrv/query.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dnsrsrv/query.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include "dns_type.h"
 
-extern errno_t dns_name2host(const char *, dns_host_info_t **, ip_ver_t);
+extern int dns_name2host(const char *, dns_host_info_t **, ip_ver_t);
 extern void dns_hostinfo_destroy(dns_host_info_t *);
 
Index: uspace/srv/net/dnsrsrv/transport.c
===================================================================
--- uspace/srv/net/dnsrsrv/transport.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dnsrsrv/transport.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <adt/list.h>
 #include <errno.h>
-#include <str_error.h>
 #include <fibril_synch.h>
 #include <inet/addr.h>
@@ -69,5 +68,5 @@
 	fibril_mutex_t done_lock;
 
-	errno_t status;
+	int status;
 } trans_req_t;
 
@@ -90,8 +89,8 @@
 };
 
-errno_t transport_init(void)
+int transport_init(void)
 {
 	inet_ep2_t epp;
-	errno_t rc;
+	int rc;
 
 	inet_ep2_init(&epp);
@@ -177,5 +176,5 @@
 }
 
-errno_t dns_request(dns_message_t *req, dns_message_t **rresp)
+int dns_request(dns_message_t *req, dns_message_t **rresp)
 {
 	trans_req_t *treq = NULL;
@@ -185,5 +184,5 @@
 	size_t req_size;
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_request: Encode dns message");
-	errno_t rc = dns_message_encode(req, &req_data, &req_size);
+	int rc = dns_message_encode(req, &req_data, &req_size);
 	if (rc != EOK)
 		goto error;
@@ -200,5 +199,5 @@
 		    req_size);
 		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Error sending message: %s", str_error(rc));
+			log_msg(LOG_DEFAULT, LVL_DEBUG, "Error %d sending message", rc);
 			goto error;
 		}
@@ -255,5 +254,5 @@
 	size_t size;
 	inet_ep_t remote_ep;
-	errno_t rc;
+	int rc;
 
 	size = udp_rmsg_size(rmsg);
Index: uspace/srv/net/dnsrsrv/transport.h
===================================================================
--- uspace/srv/net/dnsrsrv/transport.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/dnsrsrv/transport.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,7 +42,7 @@
 extern inet_addr_t dns_server_addr;
 
-extern errno_t transport_init(void);
+extern int transport_init(void);
 extern void transport_fini(void);
-extern errno_t dns_request(dns_message_t *, dns_message_t **);
+extern int dns_request(dns_message_t *, dns_message_t **);
 
 #endif
Index: uspace/srv/net/ethip/arp.c
===================================================================
--- uspace/srv/net/ethip/arp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/ethip/arp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
 #define ARP_REQUEST_TIMEOUT (3 * 1000 * 1000)
 
-static errno_t arp_send_packet(ethip_nic_t *nic, arp_eth_packet_t *packet);
+static int arp_send_packet(ethip_nic_t *nic, arp_eth_packet_t *packet);
 
 void arp_received(ethip_nic_t *nic, eth_frame_t *frame)
@@ -57,5 +57,5 @@
 	
 	arp_eth_packet_t packet;
-	errno_t rc = arp_pdu_decode(frame->data, frame->size, &packet);
+	int rc = arp_pdu_decode(frame->data, frame->size, &packet);
 	if (rc != EOK)
 		return;
@@ -94,5 +94,5 @@
 }
 
-errno_t arp_translate(ethip_nic_t *nic, addr32_t src_addr, addr32_t ip_addr,
+int arp_translate(ethip_nic_t *nic, addr32_t src_addr, addr32_t ip_addr,
     addr48_t mac_addr)
 {
@@ -103,5 +103,5 @@
 	}
 
-	errno_t rc = atrans_lookup(ip_addr, mac_addr);
+	int rc = atrans_lookup(ip_addr, mac_addr);
 	if (rc == EOK)
 		return EOK;
@@ -122,7 +122,7 @@
 }
 
-static errno_t arp_send_packet(ethip_nic_t *nic, arp_eth_packet_t *packet)
+static int arp_send_packet(ethip_nic_t *nic, arp_eth_packet_t *packet)
 {
-	errno_t rc;
+	int rc;
 	void *pdata;
 	size_t psize;
Index: uspace/srv/net/ethip/arp.h
===================================================================
--- uspace/srv/net/ethip/arp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/ethip/arp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,5 +43,5 @@
 
 extern void arp_received(ethip_nic_t *, eth_frame_t *);
-extern errno_t arp_translate(ethip_nic_t *, addr32_t, addr32_t, addr48_t);
+extern int arp_translate(ethip_nic_t *, addr32_t, addr32_t, addr48_t);
 
 #endif
Index: uspace/srv/net/ethip/atrans.c
===================================================================
--- uspace/srv/net/ethip/atrans.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/ethip/atrans.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,5 +59,5 @@
 }
 
-errno_t atrans_add(addr32_t ip_addr, addr48_t mac_addr)
+int atrans_add(addr32_t ip_addr, addr48_t mac_addr)
 {
 	ethip_atrans_t *atrans;
@@ -85,5 +85,5 @@
 }
 
-errno_t atrans_remove(addr32_t ip_addr)
+int atrans_remove(addr32_t ip_addr)
 {
 	ethip_atrans_t *atrans;
@@ -103,5 +103,5 @@
 }
 
-static errno_t atrans_lookup_locked(addr32_t ip_addr, addr48_t mac_addr)
+static int atrans_lookup_locked(addr32_t ip_addr, addr48_t mac_addr)
 {
 	ethip_atrans_t *atrans = atrans_find(ip_addr);
@@ -113,7 +113,7 @@
 }
 
-errno_t atrans_lookup(addr32_t ip_addr, addr48_t mac_addr)
+int atrans_lookup(addr32_t ip_addr, addr48_t mac_addr)
 {
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&atrans_list_lock);
@@ -134,10 +134,10 @@
 }
 
-errno_t atrans_lookup_timeout(addr32_t ip_addr, suseconds_t timeout,
+int atrans_lookup_timeout(addr32_t ip_addr, suseconds_t timeout,
     addr48_t mac_addr)
 {
 	fibril_timer_t *t;
 	bool timedout;
-	errno_t rc;
+	int rc;
 
 	t = fibril_timer_create(NULL);
Index: uspace/srv/net/ethip/atrans.h
===================================================================
--- uspace/srv/net/ethip/atrans.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/ethip/atrans.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,8 +42,8 @@
 #include "ethip.h"
 
-extern errno_t atrans_add(addr32_t, addr48_t);
-extern errno_t atrans_remove(addr32_t);
-extern errno_t atrans_lookup(addr32_t, addr48_t);
-extern errno_t atrans_lookup_timeout(addr32_t, suseconds_t, addr48_t);
+extern int atrans_add(addr32_t, addr48_t);
+extern int atrans_remove(addr32_t);
+extern int atrans_lookup(addr32_t, addr48_t);
+extern int atrans_lookup_timeout(addr32_t, suseconds_t, addr48_t);
 
 #endif
Index: uspace/srv/net/ethip/ethip.c
===================================================================
--- uspace/srv/net/ethip/ethip.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/ethip/ethip.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,13 +53,13 @@
 #define NAME "ethip"
 
-static errno_t ethip_open(iplink_srv_t *srv);
-static errno_t ethip_close(iplink_srv_t *srv);
-static errno_t ethip_send(iplink_srv_t *srv, iplink_sdu_t *sdu);
-static errno_t ethip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu);
-static errno_t ethip_get_mtu(iplink_srv_t *srv, size_t *mtu);
-static errno_t ethip_get_mac48(iplink_srv_t *srv, addr48_t *mac);
-static errno_t ethip_set_mac48(iplink_srv_t *srv, addr48_t *mac);
-static errno_t ethip_addr_add(iplink_srv_t *srv, inet_addr_t *addr);
-static errno_t ethip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr);
+static int ethip_open(iplink_srv_t *srv);
+static int ethip_close(iplink_srv_t *srv);
+static int ethip_send(iplink_srv_t *srv, iplink_sdu_t *sdu);
+static int ethip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu);
+static int ethip_get_mtu(iplink_srv_t *srv, size_t *mtu);
+static int ethip_get_mac48(iplink_srv_t *srv, addr48_t *mac);
+static int ethip_set_mac48(iplink_srv_t *srv, addr48_t *mac);
+static int ethip_addr_add(iplink_srv_t *srv, inet_addr_t *addr);
+static int ethip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr);
 
 static void ethip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
@@ -77,9 +77,9 @@
 };
 
-static errno_t ethip_init(void)
+static int ethip_init(void)
 {
 	async_set_fallback_port_handler(ethip_client_conn, NULL);
 	
-	errno_t rc = loc_server_register(NAME);
+	int rc = loc_server_register(NAME);
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server.");
@@ -94,7 +94,7 @@
 }
 
-errno_t ethip_iplink_init(ethip_nic_t *nic)
-{
-	errno_t rc;
+int ethip_iplink_init(ethip_nic_t *nic)
+{
+	int rc;
 	service_id_t sid;
 	category_id_t iplink_cat;
@@ -108,7 +108,7 @@
 	nic->iplink.arg = nic;
 
-	if (asprintf(&svc_name, "net/eth%u", ++link_num) < 0) {
+	rc = asprintf(&svc_name, "net/eth%u", ++link_num);
+	if (rc < 0) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Out of memory.");
-		rc = ENOMEM;
 		goto error;
 	}
@@ -158,5 +158,5 @@
 }
 
-static errno_t ethip_open(iplink_srv_t *srv)
+static int ethip_open(iplink_srv_t *srv)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_open()");
@@ -164,5 +164,5 @@
 }
 
-static errno_t ethip_close(iplink_srv_t *srv)
+static int ethip_close(iplink_srv_t *srv)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_close()");
@@ -170,5 +170,5 @@
 }
 
-static errno_t ethip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)
+static int ethip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_send()");
@@ -177,5 +177,5 @@
 	eth_frame_t frame;
 	
-	errno_t rc = arp_translate(nic, sdu->src, sdu->dest, frame.dest);
+	int rc = arp_translate(nic, sdu->src, sdu->dest, frame.dest);
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_WARN, "Failed to look up IPv4 address 0x%"
@@ -201,5 +201,5 @@
 }
 
-static errno_t ethip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)
+static int ethip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_send6()");
@@ -216,5 +216,5 @@
 	void *data;
 	size_t size;
-	errno_t rc = eth_pdu_encode(&frame, &data, &size);
+	int rc = eth_pdu_encode(&frame, &data, &size);
 	if (rc != EOK)
 		return rc;
@@ -226,5 +226,5 @@
 }
 
-errno_t ethip_received(iplink_srv_t *srv, void *data, size_t size)
+int ethip_received(iplink_srv_t *srv, void *data, size_t size)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_received(): srv=%p", srv);
@@ -234,5 +234,5 @@
 	
 	eth_frame_t frame;
-	errno_t rc = eth_pdu_decode(data, size, &frame);
+	int rc = eth_pdu_decode(data, size, &frame);
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_DEBUG, " - eth_pdu_decode failed");
@@ -269,5 +269,5 @@
 }
 
-static errno_t ethip_get_mtu(iplink_srv_t *srv, size_t *mtu)
+static int ethip_get_mtu(iplink_srv_t *srv, size_t *mtu)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_get_mtu()");
@@ -276,5 +276,5 @@
 }
 
-static errno_t ethip_get_mac48(iplink_srv_t *srv, addr48_t *mac)
+static int ethip_get_mac48(iplink_srv_t *srv, addr48_t *mac)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_get_mac48()");
@@ -286,5 +286,5 @@
 }
 
-static errno_t ethip_set_mac48(iplink_srv_t *srv, addr48_t *mac)
+static int ethip_set_mac48(iplink_srv_t *srv, addr48_t *mac)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_set_mac48()");
@@ -296,5 +296,5 @@
 }
 
-static errno_t ethip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)
+static int ethip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)
 {
 	ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
@@ -303,5 +303,5 @@
 }
 
-static errno_t ethip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)
+static int ethip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)
 {
 	ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
@@ -312,5 +312,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf(NAME ": HelenOS IP over Ethernet service\n");
Index: uspace/srv/net/ethip/ethip.h
===================================================================
--- uspace/srv/net/ethip/ethip.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/ethip/ethip.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -116,6 +116,6 @@
 } ethip_atrans_t;
 
-extern errno_t ethip_iplink_init(ethip_nic_t *);
-extern errno_t ethip_received(iplink_srv_t *, void *, size_t);
+extern int ethip_iplink_init(ethip_nic_t *);
+extern int ethip_received(iplink_srv_t *, void *, size_t);
 
 #endif
Index: uspace/srv/net/ethip/ethip_nic.c
===================================================================
--- uspace/srv/net/ethip/ethip_nic.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/ethip/ethip_nic.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,4 @@
 #include <stdbool.h>
 #include <errno.h>
-#include <str_error.h>
 #include <fibril_synch.h>
 #include <inet/iplink_srv.h>
@@ -51,5 +50,5 @@
 #include "pdu.h"
 
-static errno_t ethip_nic_open(service_id_t sid);
+static int ethip_nic_open(service_id_t sid);
 static void ethip_nic_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
 
@@ -57,5 +56,5 @@
 static FIBRIL_MUTEX_INITIALIZE(ethip_discovery_lock);
 
-static errno_t ethip_nic_check_new(void)
+static int ethip_nic_check_new(void)
 {
 	bool already_known;
@@ -63,5 +62,5 @@
 	service_id_t *svcs;
 	size_t count, i;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&ethip_discovery_lock);
@@ -147,5 +146,5 @@
 }
 
-static errno_t ethip_nic_open(service_id_t sid)
+static int ethip_nic_open(service_id_t sid)
 {
 	bool in_list = false;
@@ -157,5 +156,5 @@
 		return ENOMEM;
 	
-	errno_t rc = loc_service_get_name(sid, &nic->svc_name);
+	int rc = loc_service_get_name(sid, &nic->svc_name);
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting service name.");
@@ -234,5 +233,5 @@
 	uint8_t *addr;
 	size_t size;
-	errno_t rc;
+	int rc;
 
 	rc = async_data_write_accept((void **)&addr, false, 0, 0, 0, &size);
@@ -261,5 +260,5 @@
     ipc_call_t *call)
 {
-	errno_t rc;
+	int rc;
 	void *data;
 	size_t size;
@@ -281,5 +280,5 @@
 	free(data);
 
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_received() done, rc=%s", str_error_name(rc));
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_received() done, rc=%d", rc);
 	async_answer_0(callid, rc);
 }
@@ -324,10 +323,10 @@
 }
 
-errno_t ethip_nic_discovery_start(void)
-{
-	errno_t rc = loc_register_cat_change_cb(ethip_nic_cat_change_cb);
+int ethip_nic_discovery_start(void)
+{
+	int rc = loc_register_cat_change_cb(ethip_nic_cat_change_cb);
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback for NIC "
-		    "discovery: %s.", str_error(rc));
+		    "discovery (%d).", rc);
 		return rc;
 	}
@@ -353,10 +352,10 @@
 }
 
-errno_t ethip_nic_send(ethip_nic_t *nic, void *data, size_t size)
-{
-	errno_t rc;
+int ethip_nic_send(ethip_nic_t *nic, void *data, size_t size)
+{
+	int rc;
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_send(size=%zu)", size);
 	rc = nic_send_frame(nic->sess, data, size);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "nic_send_frame -> %s", str_error_name(rc));
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "nic_send_frame -> %d", rc);
 	return rc;
 }
@@ -368,5 +367,5 @@
  *
  */
-static errno_t ethip_nic_setup_multicast(ethip_nic_t *nic)
+static int ethip_nic_setup_multicast(ethip_nic_t *nic)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_setup_multicast()");
@@ -425,5 +424,5 @@
 	/* Setup the multicast MAC list */
 	
-	errno_t rc = nic_multicast_set_mode(nic->sess, NIC_MULTICAST_LIST,
+	int rc = nic_multicast_set_mode(nic->sess, NIC_MULTICAST_LIST,
 	    mac_list, count);
 	
@@ -432,5 +431,5 @@
 }
 
-errno_t ethip_nic_addr_add(ethip_nic_t *nic, inet_addr_t *addr)
+int ethip_nic_addr_add(ethip_nic_t *nic, inet_addr_t *addr)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_add()");
@@ -445,5 +444,5 @@
 }
 
-errno_t ethip_nic_addr_remove(ethip_nic_t *nic, inet_addr_t *addr)
+int ethip_nic_addr_remove(ethip_nic_t *nic, inet_addr_t *addr)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_remove()");
Index: uspace/srv/net/ethip/ethip_nic.h
===================================================================
--- uspace/srv/net/ethip/ethip_nic.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/ethip/ethip_nic.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,9 +42,9 @@
 #include "ethip.h"
 
-extern errno_t ethip_nic_discovery_start(void);
+extern int ethip_nic_discovery_start(void);
 extern ethip_nic_t *ethip_nic_find_by_iplink_sid(service_id_t);
-extern errno_t ethip_nic_send(ethip_nic_t *, void *, size_t);
-extern errno_t ethip_nic_addr_add(ethip_nic_t *, inet_addr_t *);
-extern errno_t ethip_nic_addr_remove(ethip_nic_t *, inet_addr_t *);
+extern int ethip_nic_send(ethip_nic_t *, void *, size_t);
+extern int ethip_nic_addr_add(ethip_nic_t *, inet_addr_t *);
+extern int ethip_nic_addr_remove(ethip_nic_t *, inet_addr_t *);
 extern ethip_link_addr_t *ethip_nic_addr_find(ethip_nic_t *, inet_addr_t *);
 
Index: uspace/srv/net/ethip/pdu.c
===================================================================
--- uspace/srv/net/ethip/pdu.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/ethip/pdu.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 
 /** Encode Ethernet PDU. */
-errno_t eth_pdu_encode(eth_frame_t *frame, void **rdata, size_t *rsize)
+int eth_pdu_encode(eth_frame_t *frame, void **rdata, size_t *rsize)
 {
 	void *data;
@@ -75,5 +75,5 @@
 
 /** Decode Ethernet PDU. */
-errno_t eth_pdu_decode(void *data, size_t size, eth_frame_t *frame)
+int eth_pdu_decode(void *data, size_t size, eth_frame_t *frame)
 {
 	eth_header_t *hdr;
@@ -106,5 +106,5 @@
 
 /** Encode ARP PDU. */
-errno_t arp_pdu_encode(arp_eth_packet_t *packet, void **rdata, size_t *rsize)
+int arp_pdu_encode(arp_eth_packet_t *packet, void **rdata, size_t *rsize)
 {
 	void *data;
@@ -149,5 +149,5 @@
 
 /** Decode ARP PDU. */
-errno_t arp_pdu_decode(void *data, size_t size, arp_eth_packet_t *packet)
+int arp_pdu_decode(void *data, size_t size, arp_eth_packet_t *packet)
 {
 	arp_eth_packet_fmt_t *pfmt;
Index: uspace/srv/net/ethip/pdu.h
===================================================================
--- uspace/srv/net/ethip/pdu.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/ethip/pdu.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,8 +40,8 @@
 #include "ethip.h"
 
-extern errno_t eth_pdu_encode(eth_frame_t *, void **, size_t *);
-extern errno_t eth_pdu_decode(void *, size_t, eth_frame_t *);
-extern errno_t arp_pdu_encode(arp_eth_packet_t *, void **, size_t *);
-extern errno_t arp_pdu_decode(void *, size_t, arp_eth_packet_t *);
+extern int eth_pdu_encode(eth_frame_t *, void **, size_t *);
+extern int eth_pdu_decode(void *, size_t, eth_frame_t *);
+extern int arp_pdu_encode(arp_eth_packet_t *, void **, size_t *);
+extern int arp_pdu_decode(void *, size_t, arp_eth_packet_t *);
 
 #endif
Index: uspace/srv/net/inetsrv/addrobj.c
===================================================================
--- uspace/srv/net/inetsrv/addrobj.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/addrobj.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -78,5 +78,5 @@
 }
 
-errno_t inet_addrobj_add(inet_addrobj_t *addr)
+int inet_addrobj_add(inet_addrobj_t *addr)
 {
 	inet_addrobj_t *aobj;
@@ -212,5 +212,5 @@
 
 /** Send datagram from address object */
-errno_t inet_addrobj_send_dgram(inet_addrobj_t *addr, inet_addr_t *ldest,
+int inet_addrobj_send_dgram(inet_addrobj_t *addr, inet_addr_t *ldest,
     inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df)
 {
@@ -229,5 +229,5 @@
 		return EINVAL;
 
-	errno_t rc;
+	int rc;
 	addr48_t ldest_mac;
 
@@ -255,5 +255,5 @@
 
 /** Get IDs of all address objects. */
-errno_t inet_addrobj_get_id_list(sysarg_t **rid_list, size_t *rcount)
+int inet_addrobj_get_id_list(sysarg_t **rid_list, size_t *rcount)
 {
 	sysarg_t *id_list;
Index: uspace/srv/net/inetsrv/addrobj.h
===================================================================
--- uspace/srv/net/inetsrv/addrobj.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/addrobj.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -51,12 +51,12 @@
 extern inet_addrobj_t *inet_addrobj_new(void);
 extern void inet_addrobj_delete(inet_addrobj_t *);
-extern errno_t inet_addrobj_add(inet_addrobj_t *);
+extern int inet_addrobj_add(inet_addrobj_t *);
 extern void inet_addrobj_remove(inet_addrobj_t *);
 extern inet_addrobj_t *inet_addrobj_find(inet_addr_t *, inet_addrobj_find_t);
 extern inet_addrobj_t *inet_addrobj_find_by_name(const char *, inet_link_t *);
 extern inet_addrobj_t *inet_addrobj_get_by_id(sysarg_t);
-extern errno_t inet_addrobj_send_dgram(inet_addrobj_t *, inet_addr_t *,
+extern int inet_addrobj_send_dgram(inet_addrobj_t *, inet_addr_t *,
     inet_dgram_t *, uint8_t, uint8_t, int);
-extern errno_t inet_addrobj_get_id_list(sysarg_t **, size_t *);
+extern int inet_addrobj_get_id_list(sysarg_t **, size_t *);
 
 #endif
Index: uspace/srv/net/inetsrv/icmp.c
===================================================================
--- uspace/srv/net/inetsrv/icmp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/icmp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,8 +50,8 @@
 #define INET_TTL_MAX 255
 
-static errno_t icmp_recv_echo_request(inet_dgram_t *);
-static errno_t icmp_recv_echo_reply(inet_dgram_t *);
+static int icmp_recv_echo_request(inet_dgram_t *);
+static int icmp_recv_echo_reply(inet_dgram_t *);
 
-errno_t icmp_recv(inet_dgram_t *dgram)
+int icmp_recv(inet_dgram_t *dgram)
 {
 	uint8_t type;
@@ -76,5 +76,5 @@
 }
 
-static errno_t icmp_recv_echo_request(inet_dgram_t *dgram)
+static int icmp_recv_echo_request(inet_dgram_t *dgram)
 {
 	icmp_echo_t *request, *reply;
@@ -82,5 +82,5 @@
 	size_t size;
 	inet_dgram_t rdgram;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmp_recv_echo_request()");
@@ -119,5 +119,5 @@
 }
 
-static errno_t icmp_recv_echo_reply(inet_dgram_t *dgram)
+static int icmp_recv_echo_reply(inet_dgram_t *dgram)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmp_recv_echo_reply()");
@@ -141,5 +141,5 @@
 }
 
-errno_t icmp_ping_send(uint16_t ident, inetping_sdu_t *sdu)
+int icmp_ping_send(uint16_t ident, inetping_sdu_t *sdu)
 {
 	size_t rsize = sizeof(icmp_echo_t) + sdu->size;
@@ -170,5 +170,5 @@
 	dgram.size = rsize;
 
-	errno_t rc = inet_route_packet(&dgram, IP_PROTO_ICMP, INET_TTL_MAX, 0);
+	int rc = inet_route_packet(&dgram, IP_PROTO_ICMP, INET_TTL_MAX, 0);
 
 	free(rdata);
Index: uspace/srv/net/inetsrv/icmp.h
===================================================================
--- uspace/srv/net/inetsrv/icmp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/icmp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,6 +41,6 @@
 #include "inetsrv.h"
 
-extern errno_t icmp_recv(inet_dgram_t *);
-extern errno_t icmp_ping_send(uint16_t, inetping_sdu_t *);
+extern int icmp_recv(inet_dgram_t *);
+extern int icmp_ping_send(uint16_t, inetping_sdu_t *);
 
 #endif
Index: uspace/srv/net/inetsrv/icmpv6.c
===================================================================
--- uspace/srv/net/inetsrv/icmpv6.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/icmpv6.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 #include "pdu.h"
 
-static errno_t icmpv6_recv_echo_request(inet_dgram_t *dgram)
+static int icmpv6_recv_echo_request(inet_dgram_t *dgram)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmpv6_recv_echo_request()");
@@ -101,5 +101,5 @@
 	reply->checksum = host2uint16_t_be(cs_all);
 	
-	errno_t rc = inet_route_packet(&rdgram, IP_PROTO_ICMPV6,
+	int rc = inet_route_packet(&rdgram, IP_PROTO_ICMPV6,
 	    INET6_HOP_LIMIT_MAX, 0);
 	
@@ -109,5 +109,5 @@
 }
 
-static errno_t icmpv6_recv_echo_reply(inet_dgram_t *dgram)
+static int icmpv6_recv_echo_reply(inet_dgram_t *dgram)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmpv6_recv_echo_reply()");
@@ -132,5 +132,5 @@
 }
 
-errno_t icmpv6_recv(inet_dgram_t *dgram)
+int icmpv6_recv(inet_dgram_t *dgram)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmpv6_recv()");
@@ -157,5 +157,5 @@
 }
 
-errno_t icmpv6_ping_send(uint16_t ident, inetping_sdu_t *sdu)
+int icmpv6_ping_send(uint16_t ident, inetping_sdu_t *sdu)
 {
 	size_t rsize = sizeof(icmpv6_message_t) + sdu->size;
@@ -202,5 +202,5 @@
 	request->checksum = host2uint16_t_be(cs_all);
 	
-	errno_t rc = inet_route_packet(&dgram, IP_PROTO_ICMPV6,
+	int rc = inet_route_packet(&dgram, IP_PROTO_ICMPV6,
 	    INET6_HOP_LIMIT_MAX, 0);
 	
Index: uspace/srv/net/inetsrv/icmpv6.h
===================================================================
--- uspace/srv/net/inetsrv/icmpv6.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/icmpv6.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,6 +41,6 @@
 #include "inetsrv.h"
 
-extern errno_t icmpv6_recv(inet_dgram_t *);
-extern errno_t icmpv6_ping_send(uint16_t, inetping_sdu_t *);
+extern int icmpv6_recv(inet_dgram_t *);
+extern int icmpv6_ping_send(uint16_t, inetping_sdu_t *);
 
 #endif
Index: uspace/srv/net/inetsrv/inet_link.c
===================================================================
--- uspace/srv/net/inetsrv/inet_link.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/inet_link.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <stdbool.h>
 #include <errno.h>
-#include <str_error.h>
 #include <fibril_synch.h>
 #include <inet/iplink.h>
@@ -55,6 +54,6 @@
 static uint16_t ip_ident = 0;
 
-static errno_t inet_iplink_recv(iplink_t *, iplink_recv_sdu_t *, ip_ver_t);
-static errno_t inet_iplink_change_addr(iplink_t *, addr48_t);
+static int inet_iplink_recv(iplink_t *, iplink_recv_sdu_t *, ip_ver_t);
+static int inet_iplink_change_addr(iplink_t *, addr48_t);
 static inet_link_t *inet_link_get_by_id_locked(sysarg_t);
 
@@ -83,9 +82,9 @@
 }
 
-static errno_t inet_iplink_recv(iplink_t *iplink, iplink_recv_sdu_t *sdu, ip_ver_t ver)
+static int inet_iplink_recv(iplink_t *iplink, iplink_recv_sdu_t *sdu, ip_ver_t ver)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_iplink_recv()");
 
-	errno_t rc;
+	int rc;
 	inet_packet_t packet;
 	inet_link_t *ilink;
@@ -115,5 +114,5 @@
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "call inet_recv_packet()");
 	rc = inet_recv_packet(&packet);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "call inet_recv_packet -> %s", str_error_name(rc));
+	log_msg(LOG_DEFAULT, LVL_DEBUG, "call inet_recv_packet -> %d", rc);
 	free(packet.data);
 
@@ -121,5 +120,5 @@
 }
 
-static errno_t inet_iplink_change_addr(iplink_t *iplink, addr48_t mac)
+static int inet_iplink_change_addr(iplink_t *iplink, addr48_t mac)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_iplink_change_addr(): "
@@ -158,9 +157,9 @@
 }
 
-errno_t inet_link_open(service_id_t sid)
+int inet_link_open(service_id_t sid)
 {
 	inet_link_t *ilink;
 	inet_addr_t iaddr;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_link_open()");
@@ -312,5 +311,5 @@
  *
  */
-errno_t inet_link_send_dgram(inet_link_t *ilink, addr32_t lsrc, addr32_t ldest,
+int inet_link_send_dgram(inet_link_t *ilink, addr32_t lsrc, addr32_t ldest,
     inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df)
 {
@@ -352,5 +351,5 @@
 	packet.size = dgram->size;
 	
-	errno_t rc;
+	int rc;
 	size_t offs = 0;
 	
@@ -387,5 +386,5 @@
  *
  */
-errno_t inet_link_send_dgram6(inet_link_t *ilink, addr48_t ldest,
+int inet_link_send_dgram6(inet_link_t *ilink, addr48_t ldest,
     inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df)
 {
@@ -425,5 +424,5 @@
 	packet.size = dgram->size;
 	
-	errno_t rc;
+	int rc;
 	size_t offs = 0;
 	
@@ -471,5 +470,5 @@
 
 /** Get IDs of all links. */
-errno_t inet_link_get_id_list(sysarg_t **rid_list, size_t *rcount)
+int inet_link_get_id_list(sysarg_t **rid_list, size_t *rcount)
 {
 	sysarg_t *id_list;
Index: uspace/srv/net/inetsrv/inet_link.h
===================================================================
--- uspace/srv/net/inetsrv/inet_link.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/inet_link.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,11 +42,11 @@
 #include "inetsrv.h"
 
-extern errno_t inet_link_open(service_id_t);
-extern errno_t inet_link_send_dgram(inet_link_t *, addr32_t,
+extern int inet_link_open(service_id_t);
+extern int inet_link_send_dgram(inet_link_t *, addr32_t,
     addr32_t, inet_dgram_t *, uint8_t, uint8_t, int);
-extern errno_t inet_link_send_dgram6(inet_link_t *, addr48_t, inet_dgram_t *,
+extern int inet_link_send_dgram6(inet_link_t *, addr48_t, inet_dgram_t *,
     uint8_t, uint8_t, int);
 extern inet_link_t *inet_link_get_by_id(sysarg_t);
-extern errno_t inet_link_get_id_list(sysarg_t **, size_t *);
+extern int inet_link_get_id_list(sysarg_t **, size_t *);
 
 #endif
Index: uspace/srv/net/inetsrv/inetcfg.c
===================================================================
--- uspace/srv/net/inetsrv/inetcfg.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/inetcfg.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,5 @@
 #include "sroute.h"
 
-static errno_t inetcfg_addr_create_static(char *name, inet_naddr_t *naddr,
+static int inetcfg_addr_create_static(char *name, inet_naddr_t *naddr,
     sysarg_t link_id, sysarg_t *addr_id)
 {
@@ -58,5 +58,5 @@
 	inet_addrobj_t *addr;
 	inet_addr_t iaddr;
-	errno_t rc;
+	int rc;
 
 	ilink = inet_link_get_by_id(link_id);
@@ -95,5 +95,5 @@
 }
 
-static errno_t inetcfg_addr_delete(sysarg_t addr_id)
+static int inetcfg_addr_delete(sysarg_t addr_id)
 {
 	inet_addrobj_t *addr;
@@ -109,5 +109,5 @@
 }
 
-static errno_t inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo)
+static int inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo)
 {
 	inet_addrobj_t *addr;
@@ -124,5 +124,5 @@
 }
 
-static errno_t inetcfg_addr_get_id(char *name, sysarg_t link_id, sysarg_t *addr_id)
+static int inetcfg_addr_get_id(char *name, sysarg_t link_id, sysarg_t *addr_id)
 {
 	inet_link_t *ilink;
@@ -145,25 +145,25 @@
 }
 
-static errno_t inetcfg_get_addr_list(sysarg_t **addrs, size_t *count)
+static int inetcfg_get_addr_list(sysarg_t **addrs, size_t *count)
 {
 	return inet_addrobj_get_id_list(addrs, count);
 }
 
-static errno_t inetcfg_get_link_list(sysarg_t **addrs, size_t *count)
+static int inetcfg_get_link_list(sysarg_t **addrs, size_t *count)
 {
 	return inet_link_get_id_list(addrs, count);
 }
 
-static errno_t inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count)
+static int inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count)
 {
 	return inet_sroute_get_id_list(sroutes, count);
 }
 
-static errno_t inetcfg_link_add(sysarg_t link_id)
+static int inetcfg_link_add(sysarg_t link_id)
 {
 	return inet_link_open(link_id);
 }
 
-static errno_t inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo)
+static int inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo)
 {
 	inet_link_t *ilink;
@@ -185,10 +185,10 @@
 }
 
-static errno_t inetcfg_link_remove(sysarg_t link_id)
+static int inetcfg_link_remove(sysarg_t link_id)
 {
 	return ENOTSUP;
 }
 
-static errno_t inetcfg_sroute_create(char *name, inet_naddr_t *dest,
+static int inetcfg_sroute_create(char *name, inet_naddr_t *dest,
     inet_addr_t *router, sysarg_t *sroute_id)
 {
@@ -210,5 +210,5 @@
 }
 
-static errno_t inetcfg_sroute_delete(sysarg_t sroute_id)
+static int inetcfg_sroute_delete(sysarg_t sroute_id)
 {
 	inet_sroute_t *sroute;
@@ -224,5 +224,5 @@
 }
 
-static errno_t inetcfg_sroute_get(sysarg_t sroute_id, inet_sroute_info_t *srinfo)
+static int inetcfg_sroute_get(sysarg_t sroute_id, inet_sroute_info_t *srinfo)
 {
 	inet_sroute_t *sroute;
@@ -239,5 +239,5 @@
 }
 
-static errno_t inetcfg_sroute_get_id(char *name, sysarg_t *sroute_id)
+static int inetcfg_sroute_get_id(char *name, sysarg_t *sroute_id)
 {
 	inet_sroute_t *sroute;
@@ -275,5 +275,5 @@
 	
 	inet_naddr_t naddr;
-	errno_t rc = async_data_write_finalize(callid, &naddr, size);
+	int rc = async_data_write_finalize(callid, &naddr, size);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
@@ -299,5 +299,5 @@
 {
 	sysarg_t addr_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_delete_srv()");
@@ -321,5 +321,5 @@
 	ainfo.name = NULL;
 	
-	errno_t rc = inetcfg_addr_get(addr_id, &ainfo);
+	int rc = inetcfg_addr_get(addr_id, &ainfo);
 	if (rc != EOK) {
 		async_answer_0(iid, rc);
@@ -364,5 +364,5 @@
 	}
 	
-	async_answer_1(iid, rc, ainfo.ilink);
+	async_answer_1(iid, (sysarg_t) rc, ainfo.ilink);
 }
 
@@ -372,5 +372,5 @@
 	sysarg_t link_id;
 	sysarg_t addr_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_get_id_srv()");
@@ -399,5 +399,5 @@
 	size_t size;
 	sysarg_t *id_buf;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_get_addr_list_srv()");
@@ -419,5 +419,5 @@
 	size = min(act_size, max_size);
 
-	errno_t retval = async_data_read_finalize(rcallid, id_buf, size);
+	sysarg_t retval = async_data_read_finalize(rcallid, id_buf, size);
 	free(id_buf);
 
@@ -433,5 +433,5 @@
 	size_t size;
 	sysarg_t *id_buf;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_get_addr_list_srv()");
@@ -453,5 +453,5 @@
 	size = min(act_size, max_size);
 
-	errno_t retval = async_data_read_finalize(rcallid, id_buf, size);
+	sysarg_t retval = async_data_read_finalize(rcallid, id_buf, size);
 	free(id_buf);
 
@@ -467,5 +467,5 @@
 	size_t size;
 	sysarg_t *id_buf;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_get_sroute_list_srv()");
@@ -487,5 +487,5 @@
 	size = min(act_size, max_size);
 
-	errno_t retval = async_data_read_finalize(rcallid, id_buf, size);
+	sysarg_t retval = async_data_read_finalize(rcallid, id_buf, size);
 	free(id_buf);
 
@@ -496,5 +496,5 @@
 {
 	sysarg_t link_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_link_add_srv()");
@@ -515,5 +515,5 @@
 	sysarg_t link_id;
 	inet_link_info_t linfo;
-	errno_t rc;
+	int rc;
 
 	link_id = IPC_GET_ARG1(*call);
@@ -542,5 +542,5 @@
 	}
 
-	errno_t retval = async_data_read_finalize(name_callid, linfo.name,
+	sysarg_t retval = async_data_read_finalize(name_callid, linfo.name,
 	    min(name_max_size, str_size(linfo.name)));
 	if (retval != EOK) {
@@ -562,5 +562,5 @@
 {
 	sysarg_t link_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_link_remove_srv()");
@@ -592,5 +592,5 @@
 	
 	inet_naddr_t dest;
-	errno_t rc = async_data_write_finalize(callid, &dest, size);
+	int rc = async_data_write_finalize(callid, &dest, size);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
@@ -636,5 +636,5 @@
 {
 	sysarg_t sroute_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_delete_srv()");
@@ -658,5 +658,5 @@
 	srinfo.name = NULL;
 	
-	errno_t rc = inetcfg_sroute_get(sroute_id, &srinfo);
+	int rc = inetcfg_sroute_get(sroute_id, &srinfo);
 	if (rc != EOK) {
 		async_answer_0(iid, rc);
@@ -714,5 +714,5 @@
 	free(srinfo.name);
 	
-	async_answer_0(iid, rc);
+	async_answer_0(iid, (sysarg_t) rc);
 }
 
@@ -721,5 +721,5 @@
 	char *name;
 	sysarg_t sroute_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_id_srv()");
Index: uspace/srv/net/inetsrv/inetping.c
===================================================================
--- uspace/srv/net/inetsrv/inetping.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/inetping.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -58,5 +58,5 @@
 static uint16_t inetping_ident = 0;
 
-static errno_t inetping_send(inetping_client_t *client, inetping_sdu_t *sdu)
+static int inetping_send(inetping_client_t *client, inetping_sdu_t *sdu)
 {
 	if (sdu->src.version != sdu->dest.version)
@@ -73,5 +73,5 @@
 }
 
-static errno_t inetping_get_srcaddr(inetping_client_t *client,
+static int inetping_get_srcaddr(inetping_client_t *client,
     inet_addr_t *remote, inet_addr_t *local)
 {
@@ -94,5 +94,5 @@
 }
 
-errno_t inetping_recv(uint16_t ident, inetping_sdu_t *sdu)
+int inetping_recv(uint16_t ident, inetping_sdu_t *sdu)
 {
 	inetping_client_t *client = inetping_client_find(ident);
@@ -107,5 +107,5 @@
 	aid_t req = async_send_1(exch, INETPING_EV_RECV, sdu->seq_no, &answer);
 
-	errno_t rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src));
+	int rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src));
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -130,8 +130,8 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
-	return retval;
+	return (int) retval;
 }
 
@@ -142,5 +142,5 @@
 
 	inetping_sdu_t sdu;
-	errno_t rc;
+	int rc;
 
 	sdu.seq_no = IPC_GET_ARG1(*icall);
@@ -222,5 +222,5 @@
 	}
 
-	errno_t rc = async_data_write_finalize(callid, &remote, size);
+	int rc = async_data_write_finalize(callid, &remote, size);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
@@ -254,5 +254,5 @@
 }
 
-static errno_t inetping_client_init(inetping_client_t *client)
+static int inetping_client_init(inetping_client_t *client)
 {
 	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
@@ -289,5 +289,5 @@
 
 	inetping_client_t client;
-	errno_t rc = inetping_client_init(&client);
+	int rc = inetping_client_init(&client);
 	if (rc != EOK)
 		return;
Index: uspace/srv/net/inetsrv/inetping.h
===================================================================
--- uspace/srv/net/inetsrv/inetping.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/inetping.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,5 +42,5 @@
 
 extern void inetping_conn(ipc_callid_t, ipc_call_t *, void *);
-extern errno_t inetping_recv(uint16_t, inetping_sdu_t *);
+extern int inetping_recv(uint16_t, inetping_sdu_t *);
 
 #endif
Index: uspace/srv/net/inetsrv/inetsrv.c
===================================================================
--- uspace/srv/net/inetsrv/inetsrv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/inetsrv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <fibril_synch.h>
 #include <io/log.h>
@@ -84,10 +83,10 @@
 static void inet_default_conn(ipc_callid_t, ipc_call_t *, void *);
 
-static errno_t inet_init(void)
+static int inet_init(void)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_init()");
 	
 	port_id_t port;
-	errno_t rc = async_create_port(INTERFACE_INET,
+	int rc = async_create_port(INTERFACE_INET,
 	    inet_default_conn, NULL, &port);
 	if (rc != EOK)
@@ -106,5 +105,5 @@
 	rc = loc_server_register(NAME);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server (%d).", rc);
 		return EEXIST;
 	}
@@ -113,5 +112,5 @@
 	rc = loc_service_register(SERVICE_NAME_INET, &sid);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
 		return EEXIST;
 	}
@@ -135,5 +134,5 @@
 }
 
-static errno_t inet_find_dir(inet_addr_t *src, inet_addr_t *dest, uint8_t tos,
+static int inet_find_dir(inet_addr_t *src, inet_addr_t *dest, uint8_t tos,
     inet_dir_t *dir)
 {
@@ -165,10 +164,10 @@
 }
 
-errno_t inet_route_packet(inet_dgram_t *dgram, uint8_t proto, uint8_t ttl,
+int inet_route_packet(inet_dgram_t *dgram, uint8_t proto, uint8_t ttl,
     int df)
 {
 	inet_dir_t dir;
 	inet_link_t *ilink;
-	errno_t rc;
+	int rc;
 
 	if (dgram->iplink != 0) {
@@ -201,5 +200,5 @@
 }
 
-static errno_t inet_send(inet_client_t *client, inet_dgram_t *dgram,
+static int inet_send(inet_client_t *client, inet_dgram_t *dgram,
     uint8_t proto, uint8_t ttl, int df)
 {
@@ -207,8 +206,8 @@
 }
 
-errno_t inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
+int inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
 {
 	inet_dir_t dir;
-	errno_t rc;
+	int rc;
 
 	rc = inet_find_dir(NULL, remote, tos, &dir);
@@ -252,5 +251,5 @@
 	
 	inet_addr_t remote;
-	errno_t rc = async_data_write_finalize(callid, &remote, size);
+	int rc = async_data_write_finalize(callid, &remote, size);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
@@ -314,5 +313,5 @@
 	}
 	
-	errno_t rc = async_data_write_finalize(callid, &dgram.src, size);
+	int rc = async_data_write_finalize(callid, &dgram.src, size);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
@@ -445,5 +444,5 @@
 }
 
-errno_t inet_ev_recv(inet_client_t *client, inet_dgram_t *dgram)
+int inet_ev_recv(inet_client_t *client, inet_dgram_t *dgram)
 {
 	async_exch_t *exch = async_exchange_begin(client->sess);
@@ -457,5 +456,5 @@
 	    dgram->iplink, &answer);
 
-	errno_t rc = async_data_write_start(exch, &dgram->src, sizeof(inet_addr_t));
+	int rc = async_data_write_start(exch, &dgram->src, sizeof(inet_addr_t));
 	if (rc != EOK) {
 		async_exchange_end(exch);
@@ -480,11 +479,11 @@
 	}
 
-	errno_t retval;
+	sysarg_t retval;
 	async_wait_for(req, &retval);
 
-	return retval;
-}
-
-errno_t inet_recv_dgram_local(inet_dgram_t *dgram, uint8_t proto)
+	return (int) retval;
+}
+
+int inet_recv_dgram_local(inet_dgram_t *dgram, uint8_t proto)
 {
 	inet_client_t *client;
@@ -509,5 +508,5 @@
 }
 
-errno_t inet_recv_packet(inet_packet_t *packet)
+int inet_recv_packet(inet_packet_t *packet)
 {
 	inet_addrobj_t *addr;
@@ -543,5 +542,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf(NAME ": HelenOS Internet Protocol service\n");
Index: uspace/srv/net/inetsrv/inetsrv.h
===================================================================
--- uspace/srv/net/inetsrv/inetsrv.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/inetsrv.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -151,9 +151,9 @@
 } inet_dir_t;
 
-extern errno_t inet_ev_recv(inet_client_t *, inet_dgram_t *);
-extern errno_t inet_recv_packet(inet_packet_t *);
-extern errno_t inet_route_packet(inet_dgram_t *, uint8_t, uint8_t, int);
-extern errno_t inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
-extern errno_t inet_recv_dgram_local(inet_dgram_t *, uint8_t);
+extern int inet_ev_recv(inet_client_t *, inet_dgram_t *);
+extern int inet_recv_packet(inet_packet_t *);
+extern int inet_route_packet(inet_dgram_t *, uint8_t, uint8_t, int);
+extern int inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
+extern int inet_recv_dgram_local(inet_dgram_t *, uint8_t);
 
 #endif
Index: uspace/srv/net/inetsrv/ndp.c
===================================================================
--- uspace/srv/net/inetsrv/ndp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/ndp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -64,5 +64,5 @@
 }
 
-static errno_t ndp_send_packet(inet_link_t *link, ndp_packet_t *packet)
+static int ndp_send_packet(inet_link_t *link, ndp_packet_t *packet)
 {
 	inet_dgram_t dgram;
@@ -77,5 +77,5 @@
 }
 
-static errno_t ndp_router_advertisement(inet_dgram_t *dgram, inet_addr_t *router)
+static int ndp_router_advertisement(inet_dgram_t *dgram, inet_addr_t *router)
 {
 	// FIXME TODO
@@ -83,10 +83,10 @@
 }
 
-errno_t ndp_received(inet_dgram_t *dgram)
+int ndp_received(inet_dgram_t *dgram)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ndp_received()");
 	
 	ndp_packet_t packet;
-	errno_t rc = ndp_pdu_decode(dgram, &packet);
+	int rc = ndp_pdu_decode(dgram, &packet);
 	if (rc != EOK)
 		return rc;
@@ -151,5 +151,5 @@
  *
  */
-errno_t ndp_translate(addr128_t src_addr, addr128_t ip_addr, addr48_t mac_addr,
+int ndp_translate(addr128_t src_addr, addr128_t ip_addr, addr48_t mac_addr,
     inet_link_t *ilink)
 {
@@ -160,5 +160,5 @@
 	}
 	
-	errno_t rc = ntrans_lookup(ip_addr, mac_addr);
+	int rc = ntrans_lookup(ip_addr, mac_addr);
 	if (rc == EOK)
 		return EOK;
Index: uspace/srv/net/inetsrv/ndp.h
===================================================================
--- uspace/srv/net/inetsrv/ndp.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/ndp.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -63,6 +63,6 @@
 } ndp_packet_t;
 
-extern errno_t ndp_received(inet_dgram_t *);
-extern errno_t ndp_translate(addr128_t, addr128_t, addr48_t, inet_link_t *);
+extern int ndp_received(inet_dgram_t *);
+extern int ndp_translate(addr128_t, addr128_t, addr48_t, inet_link_t *);
 
 #endif
Index: uspace/srv/net/inetsrv/ntrans.c
===================================================================
--- uspace/srv/net/inetsrv/ntrans.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/ntrans.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -73,5 +73,5 @@
  *
  */
-errno_t ntrans_add(addr128_t ip_addr, addr48_t mac_addr)
+int ntrans_add(addr128_t ip_addr, addr48_t mac_addr)
 {
 	inet_ntrans_t *ntrans;
@@ -107,5 +107,5 @@
  *
  */
-errno_t ntrans_remove(addr128_t ip_addr)
+int ntrans_remove(addr128_t ip_addr)
 {
 	inet_ntrans_t *ntrans;
@@ -134,5 +134,5 @@
  *
  */
-errno_t ntrans_lookup(addr128_t ip_addr, addr48_t mac_addr)
+int ntrans_lookup(addr128_t ip_addr, addr48_t mac_addr)
 {
 	fibril_mutex_lock(&ntrans_list_lock);
@@ -153,11 +153,11 @@
  *
  * @return EOK if woken up by another fibril
- * @return ETIMEOUT if timed out
+ * @return ETIMEDOUT if timed out
  *
  */
-errno_t ntrans_wait_timeout(suseconds_t timeout)
+int ntrans_wait_timeout(suseconds_t timeout)
 {
 	fibril_mutex_lock(&ntrans_list_lock);
-	errno_t rc = fibril_condvar_wait_timeout(&ntrans_cv, &ntrans_list_lock,
+	int rc = fibril_condvar_wait_timeout(&ntrans_cv, &ntrans_list_lock,
 	    timeout);
 	fibril_mutex_unlock(&ntrans_list_lock);
Index: uspace/srv/net/inetsrv/ntrans.h
===================================================================
--- uspace/srv/net/inetsrv/ntrans.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/ntrans.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,8 +48,8 @@
 } inet_ntrans_t;
 
-extern errno_t ntrans_add(addr128_t, addr48_t);
-extern errno_t ntrans_remove(addr128_t);
-extern errno_t ntrans_lookup(addr128_t, addr48_t);
-extern errno_t ntrans_wait_timeout(suseconds_t);
+extern int ntrans_add(addr128_t, addr48_t);
+extern int ntrans_remove(addr128_t);
+extern int ntrans_lookup(addr128_t, addr48_t);
+extern int ntrans_wait_timeout(suseconds_t);
 
 #endif
Index: uspace/srv/net/inetsrv/pdu.c
===================================================================
--- uspace/srv/net/inetsrv/pdu.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/pdu.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -102,5 +102,5 @@
  *
  */
-errno_t inet_pdu_encode(inet_packet_t *packet, addr32_t src, addr32_t dest,
+int inet_pdu_encode(inet_packet_t *packet, addr32_t src, addr32_t dest,
     size_t offs, size_t mtu, void **rdata, size_t *rsize, size_t *roffs)
 {
@@ -194,5 +194,5 @@
  *
  */
-errno_t inet_pdu_encode6(inet_packet_t *packet, addr128_t src, addr128_t dest,
+int inet_pdu_encode6(inet_packet_t *packet, addr128_t src, addr128_t dest,
     size_t offs, size_t mtu, void **rdata, size_t *rsize, size_t *roffs)
 {
@@ -308,5 +308,5 @@
  *
  */
-errno_t inet_pdu_decode(void *data, size_t size, service_id_t link_id,
+int inet_pdu_decode(void *data, size_t size, service_id_t link_id,
     inet_packet_t *packet)
 {
@@ -385,5 +385,5 @@
  *
  */
-errno_t inet_pdu_decode6(void *data, size_t size, service_id_t link_id,
+int inet_pdu_decode6(void *data, size_t size, service_id_t link_id,
     inet_packet_t *packet)
 {
@@ -474,5 +474,5 @@
  *
  */
-errno_t ndp_pdu_encode(ndp_packet_t *ndp, inet_dgram_t *dgram)
+int ndp_pdu_encode(ndp_packet_t *ndp, inet_dgram_t *dgram)
 {
 	inet_addr_set6(ndp->sender_proto_addr, &dgram->src);
@@ -535,5 +535,5 @@
  *
  */
-errno_t ndp_pdu_decode(inet_dgram_t *dgram, ndp_packet_t *ndp)
+int ndp_pdu_decode(inet_dgram_t *dgram, ndp_packet_t *ndp)
 {
 	ip_ver_t src_ver = inet_addr_get(&dgram->src, NULL,
Index: uspace/srv/net/inetsrv/pdu.h
===================================================================
--- uspace/srv/net/inetsrv/pdu.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/pdu.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,13 +48,13 @@
 extern uint16_t inet_checksum_calc(uint16_t, void *, size_t);
 
-extern errno_t inet_pdu_encode(inet_packet_t *, addr32_t, addr32_t, size_t, size_t,
+extern int inet_pdu_encode(inet_packet_t *, addr32_t, addr32_t, size_t, size_t,
     void **, size_t *, size_t *);
-extern errno_t inet_pdu_encode6(inet_packet_t *, addr128_t, addr128_t, size_t,
+extern int inet_pdu_encode6(inet_packet_t *, addr128_t, addr128_t, size_t,
     size_t, void **, size_t *, size_t *);
-extern errno_t inet_pdu_decode(void *, size_t, service_id_t, inet_packet_t *);
-extern errno_t inet_pdu_decode6(void *, size_t, service_id_t, inet_packet_t *);
+extern int inet_pdu_decode(void *, size_t, service_id_t, inet_packet_t *);
+extern int inet_pdu_decode6(void *, size_t, service_id_t, inet_packet_t *);
 
-extern errno_t ndp_pdu_decode(inet_dgram_t *, ndp_packet_t *);
-extern errno_t ndp_pdu_encode(ndp_packet_t *, inet_dgram_t *);
+extern int ndp_pdu_decode(inet_dgram_t *, ndp_packet_t *);
+extern int ndp_pdu_encode(ndp_packet_t *, inet_dgram_t *);
 
 #endif
Index: uspace/srv/net/inetsrv/reass.c
===================================================================
--- uspace/srv/net/inetsrv/reass.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/reass.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -70,8 +70,8 @@
 static reass_dgram_t *reass_dgram_new(void);
 static reass_dgram_t *reass_dgram_get(inet_packet_t *);
-static errno_t reass_dgram_insert_frag(reass_dgram_t *, inet_packet_t *);
+static int reass_dgram_insert_frag(reass_dgram_t *, inet_packet_t *);
 static bool reass_dgram_complete(reass_dgram_t *);
 static void reass_dgram_remove(reass_dgram_t *);
-static errno_t reass_dgram_deliver(reass_dgram_t *);
+static int reass_dgram_deliver(reass_dgram_t *);
 static void reass_dgram_destroy(reass_dgram_t *);
 
@@ -81,8 +81,8 @@
  * @return		EOK on success or ENOMEM.
  */
-errno_t inet_reass_queue_packet(inet_packet_t *packet)
+int inet_reass_queue_packet(inet_packet_t *packet)
 {
 	reass_dgram_t *rdg;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_reass_queue_packet()");
@@ -180,5 +180,5 @@
 }
 
-static errno_t reass_dgram_insert_frag(reass_dgram_t *rdg, inet_packet_t *packet)
+static int reass_dgram_insert_frag(reass_dgram_t *rdg, inet_packet_t *packet)
 {
 	reass_frag_t *frag;
@@ -290,5 +290,5 @@
  * @param rdg		Datagram reassembly structure.
  */
-static errno_t reass_dgram_deliver(reass_dgram_t *rdg)
+static int reass_dgram_deliver(reass_dgram_t *rdg)
 {
 	size_t dgram_size;
@@ -297,5 +297,5 @@
 	uint8_t proto;
 	reass_frag_t *frag;
-	errno_t rc;
+	int rc;
 
 	/*
Index: uspace/srv/net/inetsrv/reass.h
===================================================================
--- uspace/srv/net/inetsrv/reass.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/reass.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include "inetsrv.h"
 
-extern errno_t inet_reass_queue_packet(inet_packet_t *);
+extern int inet_reass_queue_packet(inet_packet_t *);
 
 #endif
Index: uspace/srv/net/inetsrv/sroute.c
===================================================================
--- uspace/srv/net/inetsrv/sroute.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/sroute.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -183,5 +183,5 @@
 
 /** Get IDs of all static routes. */
-errno_t inet_sroute_get_id_list(sysarg_t **rid_list, size_t *rcount)
+int inet_sroute_get_id_list(sysarg_t **rid_list, size_t *rcount)
 {
 	sysarg_t *id_list;
Index: uspace/srv/net/inetsrv/sroute.h
===================================================================
--- uspace/srv/net/inetsrv/sroute.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/inetsrv/sroute.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -49,7 +49,7 @@
 extern inet_sroute_t *inet_sroute_find_by_name(const char *);
 extern inet_sroute_t *inet_sroute_get_by_id(sysarg_t);
-extern errno_t inet_sroute_send_dgram(inet_sroute_t *, inet_addr_t *,
+extern int inet_sroute_send_dgram(inet_sroute_t *, inet_addr_t *,
     inet_dgram_t *, uint8_t, uint8_t, int);
-extern errno_t inet_sroute_get_id_list(sysarg_t **, size_t *);
+extern int inet_sroute_get_id_list(sysarg_t **, size_t *);
 
 
Index: uspace/srv/net/loopip/loopip.c
===================================================================
--- uspace/srv/net/loopip/loopip.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/loopip/loopip.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <inet/iplink_srv.h>
 #include <inet/addr.h>
@@ -45,17 +44,16 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <str.h>
 #include <task.h>
 
 #define NAME  "loopip"
 
-static errno_t loopip_open(iplink_srv_t *srv);
-static errno_t loopip_close(iplink_srv_t *srv);
-static errno_t loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu);
-static errno_t loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu);
-static errno_t loopip_get_mtu(iplink_srv_t *srv, size_t *mtu);
-static errno_t loopip_get_mac48(iplink_srv_t *srv, addr48_t *mac);
-static errno_t loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr);
-static errno_t loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr);
+static int loopip_open(iplink_srv_t *srv);
+static int loopip_close(iplink_srv_t *srv);
+static int loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu);
+static int loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu);
+static int loopip_get_mtu(iplink_srv_t *srv, size_t *mtu);
+static int loopip_get_mac48(iplink_srv_t *srv, addr48_t *mac);
+static int loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr);
+static int loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr);
 
 static void loopip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
@@ -83,5 +81,5 @@
 } rqueue_entry_t;
 
-static errno_t loopip_recv_fibril(void *arg)
+static int loopip_recv_fibril(void *arg)
 {
 	while (true) {
@@ -100,9 +98,9 @@
 }
 
-static errno_t loopip_init(void)
+static int loopip_init(void)
 {
 	async_set_fallback_port_handler(loopip_client_conn, NULL);
 	
-	errno_t rc = loc_server_register(NAME);
+	int rc = loc_server_register(NAME);
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server.");
@@ -154,5 +152,5 @@
 }
 
-static errno_t loopip_open(iplink_srv_t *srv)
+static int loopip_open(iplink_srv_t *srv)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_open()");
@@ -160,5 +158,5 @@
 }
 
-static errno_t loopip_close(iplink_srv_t *srv)
+static int loopip_close(iplink_srv_t *srv)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_close()");
@@ -166,5 +164,5 @@
 }
 
-static errno_t loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)
+static int loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_send()");
@@ -195,5 +193,5 @@
 }
 
-static errno_t loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)
+static int loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip6_send()");
@@ -224,5 +222,5 @@
 }
 
-static errno_t loopip_get_mtu(iplink_srv_t *srv, size_t *mtu)
+static int loopip_get_mtu(iplink_srv_t *srv, size_t *mtu)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_get_mtu()");
@@ -231,5 +229,5 @@
 }
 
-static errno_t loopip_get_mac48(iplink_srv_t *src, addr48_t *mac)
+static int loopip_get_mac48(iplink_srv_t *src, addr48_t *mac)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_get_mac48()");
@@ -237,10 +235,10 @@
 }
 
-static errno_t loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)
-{
-	return EOK;
-}
-
-static errno_t loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)
+static int loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)
+{
+	return EOK;
+}
+
+static int loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)
 {
 	return EOK;
@@ -251,15 +249,13 @@
 	printf("%s: HelenOS loopback IP link provider\n", NAME);
 	
-	errno_t rc = log_init(NAME);
-	if (rc != EOK) {
-		printf("%s: Failed to initialize logging: %s.\n", NAME, str_error(rc));
+	int rc = log_init(NAME);
+	if (rc != EOK) {
+		printf("%s: Failed to initialize logging.\n", NAME);
 		return rc;
 	}
 	
 	rc = loopip_init();
-	if (rc != EOK) {
-		printf("%s: Failed to initialize loopip: %s.\n", NAME, str_error(rc));
-		return rc;
-	}
+	if (rc != EOK)
+		return rc;
 	
 	printf("%s: Accepting connections.\n", NAME);
Index: uspace/srv/net/nconfsrv/iplink.c
===================================================================
--- uspace/srv/net/nconfsrv/iplink.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/nconfsrv/iplink.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <stdbool.h>
 #include <errno.h>
-#include <str_error.h>
 #include <fibril_synch.h>
 #include <inet/dhcp.h>
@@ -49,10 +48,10 @@
 #include "nconfsrv.h"
 
-static errno_t ncs_link_add(service_id_t);
+static int ncs_link_add(service_id_t);
 
 static LIST_INITIALIZE(ncs_links);
 static FIBRIL_MUTEX_INITIALIZE(ncs_links_lock);
 
-static errno_t ncs_link_check_new(void)
+static int ncs_link_check_new(void)
 {
 	bool already_known;
@@ -60,5 +59,5 @@
 	service_id_t *svcs;
 	size_t count, i;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&ncs_links_lock);
@@ -124,8 +123,8 @@
 }
 
-static errno_t ncs_link_add(service_id_t sid)
+static int ncs_link_add(service_id_t sid)
 {
 	ncs_link_t *nlink;
-	errno_t rc;
+	int rc;
 
 	assert(fibril_mutex_is_locked(&ncs_links_lock));
@@ -175,12 +174,12 @@
 }
 
-errno_t ncs_link_discovery_start(void)
-{
-	errno_t rc;
+int ncs_link_discovery_start(void)
+{
+	int rc;
 
 	rc = loc_register_cat_change_cb(ncs_link_cat_change_cb);
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback for IP link "
-		    "discovery: %s.", str_error(rc));
+		    "discovery (%d).", rc);
 		return rc;
 	}
@@ -205,5 +204,5 @@
 
 /** Get IDs of all links. */
-errno_t ncs_link_get_id_list(sysarg_t **rid_list, size_t *rcount)
+int ncs_link_get_id_list(sysarg_t **rid_list, size_t *rcount)
 {
 	sysarg_t *id_list;
Index: uspace/srv/net/nconfsrv/iplink.h
===================================================================
--- uspace/srv/net/nconfsrv/iplink.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/nconfsrv/iplink.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,7 +41,7 @@
 #include "nconfsrv.h"
 
-extern errno_t ncs_link_discovery_start(void);
+extern int ncs_link_discovery_start(void);
 extern ncs_link_t *ncs_link_get_by_id(sysarg_t);
-extern errno_t ncs_link_get_id_list(sysarg_t **, size_t *);
+extern int ncs_link_get_id_list(sysarg_t **, size_t *);
 
 #endif
Index: uspace/srv/net/nconfsrv/nconfsrv.c
===================================================================
--- uspace/srv/net/nconfsrv/nconfsrv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/nconfsrv/nconfsrv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <fibril_synch.h>
 #include <inet/dhcp.h>
@@ -56,8 +55,8 @@
 static void ncs_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
 
-static errno_t ncs_init(void)
+static int ncs_init(void)
 {
 	service_id_t sid;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "ncs_init()");
@@ -81,5 +80,5 @@
 	rc = loc_server_register(NAME);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server (%d).", rc);
 		return EEXIST;
 	}
@@ -87,5 +86,5 @@
 	rc = loc_service_register(SERVICE_NAME_NETCONF, &sid);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
 		return EEXIST;
 	}
@@ -105,5 +104,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf(NAME ": HelenOS Network configuration service\n");
Index: uspace/srv/net/slip/slip.c
===================================================================
--- uspace/srv/net/slip/slip.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/slip/slip.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <stdio.h>
 #include <stdint.h>
-#include <stdlib.h>
 #include <loc.h>
 #include <inet/addr.h>
@@ -44,5 +43,4 @@
 #include <io/log.h>
 #include <errno.h>
-#include <str_error.h>
 #include <task.h>
 
@@ -57,12 +55,12 @@
 #define SLIP_ESC_ESC	0335
 
-static errno_t slip_open(iplink_srv_t *);
-static errno_t slip_close(iplink_srv_t *);
-static errno_t slip_send(iplink_srv_t *, iplink_sdu_t *);
-static errno_t slip_send6(iplink_srv_t *, iplink_sdu6_t *);
-static errno_t slip_get_mtu(iplink_srv_t *, size_t *);
-static errno_t slip_get_mac48(iplink_srv_t *, addr48_t *);
-static errno_t slip_addr_add(iplink_srv_t *, inet_addr_t *);
-static errno_t slip_addr_remove(iplink_srv_t *, inet_addr_t *);
+static int slip_open(iplink_srv_t *);
+static int slip_close(iplink_srv_t *);
+static int slip_send(iplink_srv_t *, iplink_sdu_t *);
+static int slip_send6(iplink_srv_t *, iplink_sdu6_t *);
+static int slip_get_mtu(iplink_srv_t *, size_t *);
+static int slip_get_mac48(iplink_srv_t *, addr48_t *);
+static int slip_addr_add(iplink_srv_t *, inet_addr_t *);
+static int slip_addr_remove(iplink_srv_t *, inet_addr_t *);
 
 static iplink_srv_t slip_iplink;
@@ -86,5 +84,5 @@
 static size_t slip_recv_read;
 
-errno_t slip_open(iplink_srv_t *srv)
+int slip_open(iplink_srv_t *srv)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_open()");
@@ -92,5 +90,5 @@
 }
 
-errno_t slip_close(iplink_srv_t *srv)
+int slip_close(iplink_srv_t *srv)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_close()");
@@ -103,5 +101,5 @@
 
 	while (slip_send_pending > 0) {
-		errno_t rc;
+		int rc;
 		size_t nwr;
 
@@ -110,5 +108,5 @@
 		if (rc != EOK) {
 			log_msg(LOG_DEFAULT, LVL_ERROR,
-			    "chardev_write() -> %s", str_error_name(rc));
+			    "chardev_write() returned %d", rc);
 			slip_send_pending = 0;
 			break;
@@ -126,5 +124,5 @@
 }
 
-errno_t slip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)
+int slip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_send()");
@@ -162,5 +160,5 @@
 }
 
-errno_t slip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)
+int slip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_send6()");
@@ -169,5 +167,5 @@
 }
 
-errno_t slip_get_mtu(iplink_srv_t *srv, size_t *mtu)
+int slip_get_mtu(iplink_srv_t *srv, size_t *mtu)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_get_mtu()");
@@ -176,5 +174,5 @@
 }
 
-errno_t slip_get_mac48(iplink_srv_t *src, addr48_t *mac)
+int slip_get_mac48(iplink_srv_t *src, addr48_t *mac)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_get_mac48()");
@@ -182,5 +180,5 @@
 }
 
-errno_t slip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)
+int slip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_addr_add()");
@@ -188,5 +186,5 @@
 }
 
-errno_t slip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)
+int slip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_addr_remove()");
@@ -208,5 +206,5 @@
 {
 	while (slip_recv_pending == 0) {
-		errno_t rc;
+		int rc;
 		size_t nread;
 
@@ -215,5 +213,5 @@
 		if (rc != EOK) {
 			log_msg(LOG_DEFAULT, LVL_ERROR,
-			    "char_dev_read() -> %s", str_error_name(rc));
+			    "char_dev_read() returned %d", rc);
 		}
 
@@ -228,5 +226,5 @@
 }
 
-static errno_t slip_recv_fibril(void *arg)
+static int slip_recv_fibril(void *arg)
 {
 	chardev_t *chardev = (chardev_t *) arg;
@@ -234,5 +232,5 @@
 	iplink_recv_sdu_t sdu;
 	uint8_t ch;
-	errno_t rc;
+	int rc;
 
 	sdu.data = recv_final;
@@ -287,5 +285,5 @@
 		if (rc != EOK) {
 			log_msg(LOG_DEFAULT, LVL_ERROR,
-			    "iplink_ev_recv() -> %s", str_error_name(rc));
+			    "iplink_ev_recv() returned %d", rc);
 		}
 	}
@@ -294,5 +292,5 @@
 }
 
-static errno_t slip_init(const char *svcstr, const char *linkstr)
+static int slip_init(const char *svcstr, const char *linkstr)
 {
 	service_id_t svcid;
@@ -304,5 +302,5 @@
 	chardev_t *chardev_out = NULL;
 	fid_t fid;
-	errno_t rc;
+	int rc;
 
 	iplink_srv_init(&slip_iplink);
@@ -415,5 +413,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf(NAME ": IP over serial line service\n");
Index: uspace/srv/net/tcp/conn.c
===================================================================
--- uspace/srv/net/tcp/conn.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/conn.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -84,7 +84,7 @@
 
 /** Initialize connections. */
-errno_t tcp_conns_init(void)
-{
-	errno_t rc;
+int tcp_conns_init(void)
+{
+	int rc;
 
 	rc = amap_create(&amap);
@@ -303,8 +303,8 @@
  * Add connection to the connection map.
  */
-errno_t tcp_conn_add(tcp_conn_t *conn)
+int tcp_conn_add(tcp_conn_t *conn)
 {
 	inet_ep2_t aepp;
-	errno_t rc;
+	int rc;
 
 	tcp_conn_addref(conn);
@@ -425,5 +425,5 @@
 tcp_conn_t *tcp_conn_find_ref(inet_ep2_t *epp)
 {
-	errno_t rc;
+	int rc;
 	void *arg;
 	tcp_conn_t *conn;
@@ -1242,5 +1242,5 @@
 	inet_ep2_t aepp;
 	inet_ep2_t oldepp;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_segment_arrived(%p)",
Index: uspace/srv/net/tcp/conn.h
===================================================================
--- uspace/srv/net/tcp/conn.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/conn.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,9 +40,9 @@
 #include "tcp_type.h"
 
-extern errno_t tcp_conns_init(void);
+extern int tcp_conns_init(void);
 extern void tcp_conns_fini(void);
 extern tcp_conn_t *tcp_conn_new(inet_ep2_t *);
 extern void tcp_conn_delete(tcp_conn_t *);
-extern errno_t tcp_conn_add(tcp_conn_t *);
+extern int tcp_conn_add(tcp_conn_t *);
 extern void tcp_conn_reset(tcp_conn_t *conn);
 extern void tcp_conn_sync(tcp_conn_t *);
Index: uspace/srv/net/tcp/inet.c
===================================================================
--- uspace/srv/net/tcp/inet.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/inet.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -50,5 +50,5 @@
 #define NAME       "tcp"
 
-static errno_t tcp_inet_ev_recv(inet_dgram_t *dgram);
+static int tcp_inet_ev_recv(inet_dgram_t *dgram);
 static void tcp_received_pdu(tcp_pdu_t *pdu);
 
@@ -58,5 +58,5 @@
 
 /** Received datagram callback */
-static errno_t tcp_inet_ev_recv(inet_dgram_t *dgram)
+static int tcp_inet_ev_recv(inet_dgram_t *dgram)
 {
 	uint8_t *pdu_raw;
@@ -121,5 +121,5 @@
 void tcp_transmit_pdu(tcp_pdu_t *pdu)
 {
-	errno_t rc;
+	int rc;
 	uint8_t *pdu_raw;
 	size_t pdu_raw_size;
@@ -169,7 +169,7 @@
 
 /** Initialize TCP inet interface. */
-errno_t tcp_inet_init(void)
+int tcp_inet_init(void)
 {
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_inet_init()");
Index: uspace/srv/net/tcp/inet.h
===================================================================
--- uspace/srv/net/tcp/inet.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/inet.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,5 +38,5 @@
 #include "tcp_type.h"
 
-extern errno_t tcp_inet_init(void);
+extern int tcp_inet_init(void);
 extern void tcp_transmit_pdu(tcp_pdu_t *);
 
Index: uspace/srv/net/tcp/iqueue.c
===================================================================
--- uspace/srv/net/tcp/iqueue.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/iqueue.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -137,5 +137,5 @@
  * @return		EOK on success, ENOENT if no segment is ready
  */
-errno_t tcp_iqueue_get_ready_seg(tcp_iqueue_t *iqueue, tcp_segment_t **seg)
+int tcp_iqueue_get_ready_seg(tcp_iqueue_t *iqueue, tcp_segment_t **seg)
 {
 	tcp_iqueue_entry_t *iqe;
Index: uspace/srv/net/tcp/iqueue.h
===================================================================
--- uspace/srv/net/tcp/iqueue.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/iqueue.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 extern void tcp_iqueue_insert_seg(tcp_iqueue_t *, tcp_segment_t *);
 extern void tcp_iqueue_remove_seg(tcp_iqueue_t *, tcp_segment_t *);
-extern errno_t tcp_iqueue_get_ready_seg(tcp_iqueue_t *, tcp_segment_t **);
+extern int tcp_iqueue_get_ready_seg(tcp_iqueue_t *, tcp_segment_t **);
 
 #endif
Index: uspace/srv/net/tcp/ncsim.c
===================================================================
--- uspace/srv/net/tcp/ncsim.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/ncsim.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -81,5 +81,5 @@
 	return;
 
-	if (0 /*rand() % 4 == 3*/) {
+	if (0 /*random() % 4 == 3*/) {
 		/* Drop segment */
 		log_msg(LOG_DEFAULT, LVL_ERROR, "NCSim dropping segment");
@@ -94,5 +94,5 @@
 	}
 
-	sqe->delay = rand() % (1000 * 1000);
+	sqe->delay = random() % (1000 * 1000);
 	sqe->epp = *epp;
 	sqe->seg = seg;
@@ -123,10 +123,10 @@
 
 /** Network condition simulator handler fibril. */
-static errno_t tcp_ncsim_fibril(void *arg)
+static int tcp_ncsim_fibril(void *arg)
 {
 	link_t *link;
 	tcp_squeue_entry_t *sqe;
 	inet_ep2_t rident;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_ncsim_fibril()");
Index: uspace/srv/net/tcp/pdu.c
===================================================================
--- uspace/srv/net/tcp/pdu.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/pdu.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -191,5 +191,5 @@
 }
 
-static errno_t tcp_header_encode(inet_ep2_t *epp, tcp_segment_t *seg,
+static int tcp_header_encode(inet_ep2_t *epp, tcp_segment_t *seg,
     void **header, size_t *size)
 {
@@ -295,5 +295,5 @@
 
 /** Decode incoming PDU */
-errno_t tcp_pdu_decode(tcp_pdu_t *pdu, inet_ep2_t *epp, tcp_segment_t **seg)
+int tcp_pdu_decode(tcp_pdu_t *pdu, inet_ep2_t *epp, tcp_segment_t **seg)
 {
 	tcp_segment_t *nseg;
@@ -319,10 +319,10 @@
 
 /** Encode outgoing PDU */
-errno_t tcp_pdu_encode(inet_ep2_t *epp, tcp_segment_t *seg, tcp_pdu_t **pdu)
+int tcp_pdu_encode(inet_ep2_t *epp, tcp_segment_t *seg, tcp_pdu_t **pdu)
 {
 	tcp_pdu_t *npdu;
 	size_t text_size;
 	uint16_t checksum;
-	errno_t rc;
+	int rc;
 
 	npdu = tcp_pdu_new();
Index: uspace/srv/net/tcp/pdu.h
===================================================================
--- uspace/srv/net/tcp/pdu.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/pdu.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,6 +43,6 @@
 extern tcp_pdu_t *tcp_pdu_create(void *, size_t, void *, size_t);
 extern void tcp_pdu_delete(tcp_pdu_t *);
-extern errno_t tcp_pdu_decode(tcp_pdu_t *, inet_ep2_t *, tcp_segment_t **);
-extern errno_t tcp_pdu_encode(inet_ep2_t *, tcp_segment_t *, tcp_pdu_t **);
+extern int tcp_pdu_decode(tcp_pdu_t *, inet_ep2_t *, tcp_segment_t **);
+extern int tcp_pdu_encode(inet_ep2_t *, tcp_segment_t *, tcp_pdu_t **);
 
 #endif
Index: uspace/srv/net/tcp/rqueue.c
===================================================================
--- uspace/srv/net/tcp/rqueue.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/rqueue.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -105,5 +105,5 @@
 
 /** Receive queue handler fibril. */
-static errno_t tcp_rqueue_fibril(void *arg)
+static int tcp_rqueue_fibril(void *arg)
 {
 	link_t *link;
Index: uspace/srv/net/tcp/service.c
===================================================================
--- uspace/srv/net/tcp/service.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/service.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <inet/endpoint.h>
 #include <inet/inet.h>
@@ -68,5 +67,5 @@
 static void tcp_service_lst_cstate_change(tcp_conn_t *, void *, tcp_cstate_t);
 
-static errno_t tcp_cconn_create(tcp_client_t *, tcp_conn_t *, tcp_cconn_t **);
+static int tcp_cconn_create(tcp_client_t *, tcp_conn_t *, tcp_cconn_t **);
 
 /** Connection callbacks to tie us to lower layer */
@@ -132,5 +131,5 @@
 	tcp_cconn_t *cconn;
 	inet_ep2_t epp;
-	errno_t rc;
+	int rc;
 	tcp_error_t trc;
 
@@ -298,5 +297,5 @@
  * @return EOK on success or ENOMEM if out of memory
  */
-static errno_t tcp_cconn_create(tcp_client_t *client, tcp_conn_t *conn,
+static int tcp_cconn_create(tcp_client_t *client, tcp_conn_t *conn,
     tcp_cconn_t **rcconn)
 {
@@ -345,5 +344,5 @@
  * @return EOK on success or ENOMEM if out of memory
  */
-static errno_t tcp_clistener_create(tcp_client_t *client, tcp_conn_t *conn,
+static int tcp_clistener_create(tcp_client_t *client, tcp_conn_t *conn,
     tcp_clst_t **rclst)
 {
@@ -390,5 +389,5 @@
  *         is found.
  */
-static errno_t tcp_cconn_get(tcp_client_t *client, sysarg_t id,
+static int tcp_cconn_get(tcp_client_t *client, sysarg_t id,
     tcp_cconn_t **rcconn)
 {
@@ -412,5 +411,5 @@
  *         is found.
  */
-static errno_t tcp_clistener_get(tcp_client_t *client, sysarg_t id,
+static int tcp_clistener_get(tcp_client_t *client, sysarg_t id,
     tcp_clst_t **rclst)
 {
@@ -433,12 +432,12 @@
  * @param rconn_id Place to store ID of new connection
  *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_create_impl(tcp_client_t *client, inet_ep2_t *epp,
+ * @return EOK on success or negative error code
+ */
+static int tcp_conn_create_impl(tcp_client_t *client, inet_ep2_t *epp,
     sysarg_t *rconn_id)
 {
 	tcp_conn_t *conn;
 	tcp_cconn_t *cconn;
-	errno_t rc;
+	int rc;
 	tcp_error_t trc;
 	char *slocal;
@@ -482,8 +481,8 @@
  * @return EOK on success, ENOENT if no such connection is found
  */
-static errno_t tcp_conn_destroy_impl(tcp_client_t *client, sysarg_t conn_id)
+static int tcp_conn_destroy_impl(tcp_client_t *client, sysarg_t conn_id)
 {
 	tcp_cconn_t *cconn;
-	errno_t rc;
+	int rc;
 
 	rc = tcp_cconn_get(client, conn_id, &cconn);
@@ -507,7 +506,7 @@
  * @param rlst_id Place to store ID of new listener
  *
- * @return EOK on success or an error code
+ * @return EOK on success or negative error code
 */
-static errno_t tcp_listener_create_impl(tcp_client_t *client, inet_ep_t *ep,
+static int tcp_listener_create_impl(tcp_client_t *client, inet_ep_t *ep,
     sysarg_t *rlst_id)
 {
@@ -515,5 +514,5 @@
 	tcp_clst_t *clst;
 	inet_ep2_t epp;
-	errno_t rc;
+	int rc;
 	tcp_error_t trc;
 
@@ -555,8 +554,8 @@
  * @return EOK on success, ENOENT if no such listener is found
  */
-static errno_t tcp_listener_destroy_impl(tcp_client_t *client, sysarg_t lst_id)
+static int tcp_listener_destroy_impl(tcp_client_t *client, sysarg_t lst_id)
 {
 	tcp_clst_t *clst;
-	errno_t rc;
+	int rc;
 
 	rc = tcp_clistener_get(client, lst_id, &clst);
@@ -578,10 +577,10 @@
  * @param conn_id Connection ID
  *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_send_fin_impl(tcp_client_t *client, sysarg_t conn_id)
+ * @return EOK on success or negative error code
+ */
+static int tcp_conn_send_fin_impl(tcp_client_t *client, sysarg_t conn_id)
 {
 	tcp_cconn_t *cconn;
-	errno_t rc;
+	int rc;
 
 	rc = tcp_cconn_get(client, conn_id, &cconn);
@@ -603,10 +602,10 @@
  * @param conn_id Connection ID
  *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_push_impl(tcp_client_t *client, sysarg_t conn_id)
+ * @return EOK on success or negative error code
+ */
+static int tcp_conn_push_impl(tcp_client_t *client, sysarg_t conn_id)
 {
 	tcp_cconn_t *cconn;
-	errno_t rc;
+	int rc;
 
 	rc = tcp_cconn_get(client, conn_id, &cconn);
@@ -628,10 +627,10 @@
  * @param conn_id Connection ID
  *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_reset_impl(tcp_client_t *client, sysarg_t conn_id)
+ * @return EOK on success or negative error code
+ */
+static int tcp_conn_reset_impl(tcp_client_t *client, sysarg_t conn_id)
 {
 	tcp_cconn_t *cconn;
-	errno_t rc;
+	int rc;
 
 	rc = tcp_cconn_get(client, conn_id, &cconn);
@@ -654,12 +653,11 @@
  * @param size    Data size in bytes
  *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_send_impl(tcp_client_t *client, sysarg_t conn_id,
+ * @return EOK on success or negative error code
+ */
+static int tcp_conn_send_impl(tcp_client_t *client, sysarg_t conn_id,
     void *data, size_t size)
 {
 	tcp_cconn_t *cconn;
-	errno_t rc;
-	tcp_error_t trc;
+	int rc;
 
 	rc = tcp_cconn_get(client, conn_id, &cconn);
@@ -667,7 +665,7 @@
 		return rc;
 
-	trc = tcp_uc_send(cconn->conn, data, size, 0);
-	if (trc != TCP_EOK)
-		return EIO;
+	rc = tcp_uc_send(cconn->conn, data, size, 0);
+	if (rc != EOK)
+		return rc;
 
 	return EOK;
@@ -684,13 +682,12 @@
  * @param nrecv   Place to store actual number of bytes received
  *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_recv_impl(tcp_client_t *client, sysarg_t conn_id,
+ * @return EOK on success or negative error code
+ */
+static int tcp_conn_recv_impl(tcp_client_t *client, sysarg_t conn_id,
     void *data, size_t size, size_t *nrecv)
 {
 	tcp_cconn_t *cconn;
 	xflags_t xflags;
-	errno_t rc;
-	tcp_error_t trc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl()");
@@ -702,7 +699,7 @@
 	}
 
-	trc = tcp_uc_receive(cconn->conn, data, size, nrecv, &xflags);
-	if (trc != TCP_EOK) {
-		switch (trc) {
+	rc = tcp_uc_receive(cconn->conn, data, size, nrecv, &xflags);
+	if (rc != EOK) {
+		switch (rc) {
 		case TCP_EAGAIN:
 			log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl() - EAGAIN");
@@ -712,5 +709,5 @@
 			return EOK;
 		default:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl() - trc=%d", trc);
+			log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl() - trc=%d", rc);
 			return EIO;
 		}
@@ -758,5 +755,5 @@
 	inet_ep2_t epp;
 	sysarg_t conn_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_create_srv()");
@@ -802,5 +799,5 @@
 {
 	sysarg_t conn_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_destroy_srv()");
@@ -826,5 +823,5 @@
 	inet_ep_t ep;
 	sysarg_t lst_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_listener_create_srv()");
@@ -870,5 +867,5 @@
 {
 	sysarg_t lst_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_listener_destroy_srv()");
@@ -891,5 +888,5 @@
 {
 	sysarg_t conn_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_send_fin_srv()");
@@ -912,5 +909,5 @@
 {
 	sysarg_t conn_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_push_srv()");
@@ -933,5 +930,5 @@
 {
 	sysarg_t conn_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_reset_srv()");
@@ -957,5 +954,5 @@
 	sysarg_t conn_id;
 	void *data;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_send_srv())");
@@ -1018,5 +1015,5 @@
 	size_t size, rsize;
 	void *data;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_srv()");
@@ -1074,5 +1071,5 @@
 	size_t size, rsize;
 	void *data;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv()");
@@ -1098,5 +1095,5 @@
 	rc = tcp_conn_recv_impl(client, conn_id, data, size, &rsize);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv - recv_impl failed rc=%s", str_error_name(rc));
+		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv - recv_impl failed rc=%d", rc);
 		async_answer_0(callid, rc);
 		async_answer_0(iid, rc);
@@ -1244,9 +1241,9 @@
 /** Initialize TCP service.
  *
- * @return EOK on success or an error code.
- */
-errno_t tcp_service_init(void)
-{
-	errno_t rc;
+ * @return EOK on success or negative error code.
+ */
+int tcp_service_init(void)
+{
+	int rc;
 	service_id_t sid;
 
Index: uspace/srv/net/tcp/service.h
===================================================================
--- uspace/srv/net/tcp/service.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/service.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,5 @@
 #define SERVICE_H
 
-extern errno_t tcp_service_init(void);
+extern int tcp_service_init(void);
 
 #endif
Index: uspace/srv/net/tcp/tcp.c
===================================================================
--- uspace/srv/net/tcp/tcp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/tcp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,7 +55,7 @@
 };
 
-static errno_t tcp_init(void)
+static int tcp_init(void)
 {
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_init()");
@@ -91,5 +91,5 @@
 int main(int argc, char **argv)
 {
-	errno_t rc;
+	int rc;
 
 	printf(NAME ": TCP (Transmission Control Protocol) network module\n");
Index: uspace/srv/net/tcp/test.c
===================================================================
--- uspace/srv/net/tcp/test.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/test.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 #define RCV_BUF_SIZE 64
 
-static errno_t test_srv(void *arg)
+static int test_srv(void *arg)
 {
 	tcp_conn_t *conn;
@@ -91,5 +91,5 @@
 }
 
-static errno_t test_cli(void *arg)
+static int test_cli(void *arg)
 {
 	tcp_conn_t *conn;
Index: uspace/srv/net/tcp/test/conn.c
===================================================================
--- uspace/srv/net/tcp/test/conn.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/test/conn.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -46,5 +46,5 @@
 PCUT_TEST_BEFORE
 {
-	errno_t rc;
+	int rc;
 
 	/* We will be calling functions that perform logging */
@@ -89,5 +89,5 @@
 	tcp_conn_t *conn, *cfound;
 	inet_ep2_t epp;
-	errno_t rc;
+	int rc;
 
 	inet_ep2_init(&epp);
@@ -119,5 +119,5 @@
 	tcp_conn_t *conn;
 	inet_ep2_t epp;
-	errno_t rc;
+	int rc;
 
 	inet_ep2_init(&epp);
@@ -152,5 +152,5 @@
 	tcp_conn_t *cconn, *sconn;
 	inet_ep2_t cepp, sepp;
-	errno_t rc;
+	int rc;
 
 	/* Client EPP */
Index: uspace/srv/net/tcp/test/iqueue.c
===================================================================
--- uspace/srv/net/tcp/test/iqueue.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/test/iqueue.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,5 @@
 	inet_ep2_t epp;
 	tcp_segment_t *rseg;
-	errno_t rc;
+	int rc;
 
 	inet_ep2_init(&epp);
@@ -71,5 +71,5 @@
 	void *data;
 	size_t dsize;
-	errno_t rc;
+	int rc;
 
 	inet_ep2_init(&epp);
@@ -117,5 +117,5 @@
 	void *data;
 	size_t dsize;
-	errno_t rc;
+	int rc;
 
 	inet_ep2_init(&epp);
Index: uspace/srv/net/tcp/test/main.c
===================================================================
--- uspace/srv/net/tcp/test/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/test/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2017 Jiri Svoboda
+ * Copyright (c) 2017 Jiri Svobda
  * All rights reserved.
  *
Index: uspace/srv/net/tcp/test/pdu.c
===================================================================
--- uspace/srv/net/tcp/test/pdu.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/test/pdu.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 	tcp_pdu_t *pdu;
 	inet_ep2_t epp, depp;
-	errno_t rc;
+	int rc;
 
 	inet_ep2_init(&epp);
@@ -78,5 +78,5 @@
 	uint8_t *data;
 	size_t i, dsize;
-	errno_t rc;
+	int rc;
 
 	inet_ep2_init(&epp);
Index: uspace/srv/net/tcp/test/rqueue.c
===================================================================
--- uspace/srv/net/tcp/test/rqueue.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/test/rqueue.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -59,9 +59,9 @@
 PCUT_TEST_BEFORE
 {
-	errno_t rc;
+	int rc;
 
 	/* We will be calling functions that perform logging */
 	rc = log_init("test-tcp");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_INT_EQUALS(EOK, rc);
 }
 
Index: uspace/srv/net/tcp/test/tqueue.c
===================================================================
--- uspace/srv/net/tcp/test/tqueue.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/test/tqueue.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,5 +53,5 @@
 PCUT_TEST_BEFORE
 {
-	errno_t rc;
+	int rc;
 
 	/* We will be calling functions that perform logging */
Index: uspace/srv/net/tcp/test/ucall.c
===================================================================
--- uspace/srv/net/tcp/test/ucall.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/test/ucall.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -60,5 +60,5 @@
 PCUT_TEST_BEFORE
 {
-	errno_t rc;
+	int rc;
 
 	/* We will be calling functions that perform logging */
Index: uspace/srv/net/tcp/tqueue.c
===================================================================
--- uspace/srv/net/tcp/tqueue.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/tqueue.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -63,5 +63,5 @@
 static void tcp_tqueue_send_immed(tcp_conn_t *, tcp_segment_t *);
 
-errno_t tcp_tqueue_init(tcp_tqueue_t *tqueue, tcp_conn_t *conn,
+int tcp_tqueue_init(tcp_tqueue_t *tqueue, tcp_conn_t *conn,
     tcp_tqueue_cb_t *cb)
 {
Index: uspace/srv/net/tcp/tqueue.h
===================================================================
--- uspace/srv/net/tcp/tqueue.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/tqueue.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,5 +40,5 @@
 #include "tcp_type.h"
 
-extern errno_t tcp_tqueue_init(tcp_tqueue_t *, tcp_conn_t *,
+extern int tcp_tqueue_init(tcp_tqueue_t *, tcp_conn_t *,
     tcp_tqueue_cb_t *);
 extern void tcp_tqueue_clear(tcp_tqueue_t *);
Index: uspace/srv/net/tcp/ucall.c
===================================================================
--- uspace/srv/net/tcp/ucall.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/tcp/ucall.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -69,5 +69,5 @@
 {
 	tcp_conn_t *nconn;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open(%p, %s, %s, %p)",
Index: uspace/srv/net/udp/assoc.c
===================================================================
--- uspace/srv/net/udp/assoc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/udp/assoc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,10 +56,10 @@
 
 static udp_assoc_t *udp_assoc_find_ref(inet_ep2_t *);
-static errno_t udp_assoc_queue_msg(udp_assoc_t *, inet_ep2_t *, udp_msg_t *);
+static int udp_assoc_queue_msg(udp_assoc_t *, inet_ep2_t *, udp_msg_t *);
 
 /** Initialize associations. */
-errno_t udp_assocs_init(void)
-{
-	errno_t rc;
+int udp_assocs_init(void)
+{
+	int rc;
 
 	rc = amap_create(&amap);
@@ -182,8 +182,8 @@
  * Add association to the association map.
  */
-errno_t udp_assoc_add(udp_assoc_t *assoc)
+int udp_assoc_add(udp_assoc_t *assoc)
 {
 	inet_ep2_t aepp;
-	errno_t rc;
+	int rc;
 
 	udp_assoc_addref(assoc);
@@ -242,9 +242,9 @@
  *			EIO if no route to destination exists
  */
-errno_t udp_assoc_send(udp_assoc_t *assoc, inet_ep_t *remote, udp_msg_t *msg)
+int udp_assoc_send(udp_assoc_t *assoc, inet_ep_t *remote, udp_msg_t *msg)
 {
 	udp_pdu_t *pdu;
 	inet_ep2_t epp;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send(%p, %p, %p)",
@@ -302,5 +302,5 @@
  * Pull one message from the association's receive queue.
  */
-errno_t udp_assoc_recv(udp_assoc_t *assoc, udp_msg_t **msg, inet_ep_t *remote)
+int udp_assoc_recv(udp_assoc_t *assoc, udp_msg_t **msg, inet_ep_t *remote)
 {
 	link_t *link;
@@ -341,5 +341,5 @@
 {
 	udp_assoc_t *assoc;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_received(%p, %p)", repp, msg);
@@ -380,5 +380,5 @@
 }
 
-static errno_t udp_assoc_queue_msg(udp_assoc_t *assoc, inet_ep2_t *epp,
+static int udp_assoc_queue_msg(udp_assoc_t *assoc, inet_ep2_t *epp,
     udp_msg_t *msg)
 {
@@ -416,5 +416,5 @@
 static udp_assoc_t *udp_assoc_find_ref(inet_ep2_t *epp)
 {
-	errno_t rc;
+	int rc;
 	void *arg;
 	udp_assoc_t *assoc;
Index: uspace/srv/net/udp/assoc.h
===================================================================
--- uspace/srv/net/udp/assoc.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/udp/assoc.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,14 +40,14 @@
 #include "udp_type.h"
 
-extern errno_t udp_assocs_init(void);
+extern int udp_assocs_init(void);
 extern udp_assoc_t *udp_assoc_new(inet_ep2_t *, udp_assoc_cb_t *, void *);
 extern void udp_assoc_delete(udp_assoc_t *);
-extern errno_t udp_assoc_add(udp_assoc_t *);
+extern int udp_assoc_add(udp_assoc_t *);
 extern void udp_assoc_remove(udp_assoc_t *);
 extern void udp_assoc_addref(udp_assoc_t *);
 extern void udp_assoc_delref(udp_assoc_t *);
 extern void udp_assoc_set_iplink(udp_assoc_t *, service_id_t);
-extern errno_t udp_assoc_send(udp_assoc_t *, inet_ep_t *, udp_msg_t *);
-extern errno_t udp_assoc_recv(udp_assoc_t *, udp_msg_t **, inet_ep_t *);
+extern int udp_assoc_send(udp_assoc_t *, inet_ep_t *, udp_msg_t *);
+extern int udp_assoc_recv(udp_assoc_t *, udp_msg_t **, inet_ep_t *);
 extern void udp_assoc_received(inet_ep2_t *, udp_msg_t *);
 extern void udp_assoc_reset(udp_assoc_t *);
Index: uspace/srv/net/udp/pdu.c
===================================================================
--- uspace/srv/net/udp/pdu.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/udp/pdu.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -162,5 +162,5 @@
 
 /** Decode incoming PDU */
-errno_t udp_pdu_decode(udp_pdu_t *pdu, inet_ep2_t *epp, udp_msg_t **msg)
+int udp_pdu_decode(udp_pdu_t *pdu, inet_ep2_t *epp, udp_msg_t **msg)
 {
 	udp_msg_t *nmsg;
@@ -209,5 +209,5 @@
 
 /** Encode outgoing PDU */
-errno_t udp_pdu_encode(inet_ep2_t *epp, udp_msg_t *msg, udp_pdu_t **pdu)
+int udp_pdu_encode(inet_ep2_t *epp, udp_msg_t *msg, udp_pdu_t **pdu)
 {
 	udp_pdu_t *npdu;
Index: uspace/srv/net/udp/pdu.h
===================================================================
--- uspace/srv/net/udp/pdu.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/udp/pdu.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -42,6 +42,6 @@
 extern udp_pdu_t *udp_pdu_new(void);
 extern void udp_pdu_delete(udp_pdu_t *);
-extern errno_t udp_pdu_decode(udp_pdu_t *, inet_ep2_t *, udp_msg_t **);
-extern errno_t udp_pdu_encode(inet_ep2_t *, udp_msg_t *, udp_pdu_t **);
+extern int udp_pdu_decode(udp_pdu_t *, inet_ep2_t *, udp_msg_t **);
+extern int udp_pdu_encode(inet_ep2_t *, udp_msg_t *, udp_pdu_t **);
 
 #endif
Index: uspace/srv/net/udp/service.c
===================================================================
--- uspace/srv/net/udp/service.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/udp/service.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -70,5 +70,5 @@
  * @return EOK on success, ENOMEM if out of memory
  */
-static errno_t udp_cassoc_queue_msg(udp_cassoc_t *cassoc, inet_ep2_t *epp,
+static int udp_cassoc_queue_msg(udp_cassoc_t *cassoc, inet_ep2_t *epp,
     udp_msg_t *msg)
 {
@@ -123,5 +123,5 @@
  * @return EOK on soccess, ENOMEM if out of memory
  */
-static errno_t udp_cassoc_create(udp_client_t *client, udp_assoc_t *assoc,
+static int udp_cassoc_create(udp_client_t *client, udp_assoc_t *assoc,
     udp_cassoc_t **rcassoc)
 {
@@ -168,5 +168,5 @@
  *         is found.
  */
-static errno_t udp_cassoc_get(udp_client_t *client, sysarg_t id,
+static int udp_cassoc_get(udp_client_t *client, sysarg_t id,
     udp_cassoc_t **rcassoc)
 {
@@ -205,12 +205,12 @@
  * @param rassoc_id Place to store ID of new association
  *
- * @return EOK on success or an error code
- */
-static errno_t udp_assoc_create_impl(udp_client_t *client, inet_ep2_t *epp,
+ * @return EOK on success or negative error code
+ */
+static int udp_assoc_create_impl(udp_client_t *client, inet_ep2_t *epp,
     sysarg_t *rassoc_id)
 {
 	udp_assoc_t *assoc;
 	udp_cassoc_t *cassoc;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_create_impl");
@@ -252,8 +252,8 @@
  * @return EOK on success, ENOENT if no such association is found
  */
-static errno_t udp_assoc_destroy_impl(udp_client_t *client, sysarg_t assoc_id)
+static int udp_assoc_destroy_impl(udp_client_t *client, sysarg_t assoc_id)
 {
 	udp_cassoc_t *cassoc;
-	errno_t rc;
+	int rc;
 
 	rc = udp_cassoc_get(client, assoc_id, &cassoc);
@@ -278,8 +278,8 @@
  * @return EOK on success, ENOENT if no such association is found
  */
-static errno_t udp_assoc_set_nolocal_impl(udp_client_t *client, sysarg_t assoc_id)
+static int udp_assoc_set_nolocal_impl(udp_client_t *client, sysarg_t assoc_id)
 {
 	udp_cassoc_t *cassoc;
-	errno_t rc;
+	int rc;
 
 	rc = udp_cassoc_get(client, assoc_id, &cassoc);
@@ -305,12 +305,12 @@
  * @param size     Message size
  *
- * @return EOK on success or an error code
- */
-static errno_t udp_assoc_send_msg_impl(udp_client_t *client, sysarg_t assoc_id,
+ * @return EOK on success or negative error code
+ */
+static int udp_assoc_send_msg_impl(udp_client_t *client, sysarg_t assoc_id,
     inet_ep_t *dest, void *data, size_t size)
 {
 	udp_msg_t msg;
 	udp_cassoc_t *cassoc;
-	errno_t rc;
+	int rc;
 
 	rc = udp_cassoc_get(client, assoc_id, &cassoc);
@@ -365,5 +365,5 @@
 	inet_ep2_t epp;
 	sysarg_t assoc_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_create_srv()");
@@ -409,5 +409,5 @@
 {
 	sysarg_t assoc_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_destroy_srv()");
@@ -430,5 +430,5 @@
 {
 	sysarg_t assoc_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_NOTE, "udp_assoc_set_nolocal_srv()");
@@ -455,5 +455,5 @@
 	sysarg_t assoc_id;
 	void *data;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send_msg_srv()");
@@ -552,5 +552,5 @@
 	udp_crcv_queue_entry_t *enext;
 	sysarg_t assoc_id;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_rmsg_info_srv()");
@@ -601,5 +601,5 @@
 	size_t size;
 	size_t off;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_rmsg_read_srv()");
@@ -750,9 +750,9 @@
 /** Initialize UDP service.
  *
- * @return EOK on success or an error code.
- */
-errno_t udp_service_init(void)
-{
-	errno_t rc;
+ * @return EOK on success or negative error code.
+ */
+int udp_service_init(void)
+{
+	int rc;
 	service_id_t sid;
 
Index: uspace/srv/net/udp/service.h
===================================================================
--- uspace/srv/net/udp/service.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/udp/service.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,5 @@
 #define SERVICE_H
 
-extern errno_t udp_service_init(void);
+extern int udp_service_init(void);
 
 #endif
Index: uspace/srv/net/udp/udp.c
===================================================================
--- uspace/srv/net/udp/udp.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/udp/udp.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,7 +47,7 @@
 #define NAME       "udp"
 
-static errno_t udp_init(void)
+static int udp_init(void)
 {
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_init()");
@@ -76,5 +76,5 @@
 int main(int argc, char **argv)
 {
-	errno_t rc;
+	int rc;
 
 	printf(NAME ": UDP (User Datagram Protocol) service\n");
Index: uspace/srv/net/udp/udp_inet.c
===================================================================
--- uspace/srv/net/udp/udp_inet.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/udp/udp_inet.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -45,5 +45,5 @@
 #include "udp_type.h"
 
-static errno_t udp_inet_ev_recv(inet_dgram_t *dgram);
+static int udp_inet_ev_recv(inet_dgram_t *dgram);
 static void udp_received_pdu(udp_pdu_t *pdu);
 
@@ -53,5 +53,5 @@
 
 /** Received datagram callback */
-static errno_t udp_inet_ev_recv(inet_dgram_t *dgram)
+static int udp_inet_ev_recv(inet_dgram_t *dgram)
 {
 	udp_pdu_t *pdu;
@@ -77,7 +77,7 @@
 
 /** Transmit PDU over network layer. */
-errno_t udp_transmit_pdu(udp_pdu_t *pdu)
+int udp_transmit_pdu(udp_pdu_t *pdu)
 {
-	errno_t rc;
+	int rc;
 	inet_dgram_t dgram;
 
@@ -119,7 +119,7 @@
 }
 
-errno_t udp_inet_init(void)
+int udp_inet_init(void)
 {
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_inet_init()");
Index: uspace/srv/net/udp/udp_inet.h
===================================================================
--- uspace/srv/net/udp/udp_inet.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/net/udp/udp_inet.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,6 +38,6 @@
 #include "udp_type.h"
 
-extern errno_t udp_inet_init(void);
-extern errno_t udp_transmit_pdu(udp_pdu_t *);
+extern int udp_inet_init(void);
+extern int udp_transmit_pdu(udp_pdu_t *);
 
 #endif
Index: uspace/srv/ns/clonable.c
===================================================================
--- uspace/srv/ns/clonable.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/ns/clonable.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -55,5 +55,5 @@
 static list_t cs_req;
 
-errno_t clonable_init(void)
+int clonable_init(void)
 {
 	list_initialize(&cs_req);
@@ -128,7 +128,7 @@
 	
 	/* Spawn a loader. */
-	errno_t rc = loader_spawn("loader");
+	int rc = loader_spawn("loader");
 	
-	if (rc != EOK) {
+	if (rc < 0) {
 		free(csr);
 		async_answer_0(callid, rc);
Index: uspace/srv/ns/clonable.h
===================================================================
--- uspace/srv/ns/clonable.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/ns/clonable.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -39,5 +39,5 @@
 #include <stdbool.h>
 
-extern errno_t clonable_init(void);
+extern int clonable_init(void);
 
 extern bool service_clonable(service_t);
Index: uspace/srv/ns/ns.c
===================================================================
--- uspace/srv/ns/ns.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/ns/ns.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -80,5 +80,5 @@
 		
 		task_id_t id;
-		errno_t retval;
+		sysarg_t retval;
 		
 		service_t service;
@@ -131,5 +131,5 @@
 	printf("%s: HelenOS IPC Naming Service\n", NAME);
 	
-	errno_t rc = service_init();
+	int rc = service_init();
 	if (rc != EOK)
 		return rc;
Index: uspace/srv/ns/service.c
===================================================================
--- uspace/srv/ns/service.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/ns/service.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -95,5 +95,5 @@
 static list_t pending_conn;
 
-errno_t service_init(void)
+int service_init(void)
 {
 	if (!hash_table_create(&service_hash_table, 0, 0,
@@ -139,5 +139,5 @@
  *
  */
-errno_t register_service(service_t service, sysarg_t phone, ipc_call_t *call)
+int register_service(service_t service, sysarg_t phone, ipc_call_t *call)
 {
 	if (hash_table_find(&service_hash_table, &service))
@@ -173,5 +173,5 @@
 	sysarg_t arg3 = IPC_GET_ARG3(*call);
 	sysarg_t flags = IPC_GET_ARG4(*call);
-	errno_t retval;
+	sysarg_t retval;
 	
 	ht_link_t *link = hash_table_find(&service_hash_table, &service);
Index: uspace/srv/ns/service.h
===================================================================
--- uspace/srv/ns/service.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/ns/service.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -38,8 +38,8 @@
 #include <abi/ipc/interfaces.h>
 
-extern errno_t service_init(void);
+extern int service_init(void);
 extern void process_pending_conn(void);
 
-extern errno_t register_service(service_t, sysarg_t, ipc_call_t *);
+extern int register_service(service_t, sysarg_t, ipc_call_t *);
 extern void connect_to_service(service_t, iface_t, ipc_call_t *, ipc_callid_t);
 
Index: uspace/srv/ns/task.c
===================================================================
--- uspace/srv/ns/task.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/ns/task.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -151,5 +151,5 @@
 static list_t pending_wait;
 
-errno_t task_init(void)
+int task_init(void)
 {
 	if (!hash_table_create(&task_hash_table, 0, 0, &task_hash_table_ops)) {
@@ -225,5 +225,5 @@
 }
 
-errno_t ns_task_id_intro(ipc_call_t *call)
+int ns_task_id_intro(ipc_call_t *call)
 {
 	task_id_t id = MERGE_LOUP32(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call));
@@ -264,5 +264,5 @@
 }
 
-static errno_t get_id_by_phone(sysarg_t phone_hash, task_id_t *id)
+static int get_id_by_phone(sysarg_t phone_hash, task_id_t *id)
 {
 	ht_link_t *link = hash_table_find(&phone_to_id, &phone_hash);
@@ -276,5 +276,5 @@
 }
 
-errno_t ns_task_retval(ipc_call_t *call)
+int ns_task_retval(ipc_call_t *call)
 {
 	task_id_t id = call->in_task_id;
@@ -296,8 +296,8 @@
 }
 
-errno_t ns_task_disconnect(ipc_call_t *call)
+int ns_task_disconnect(ipc_call_t *call)
 {
 	task_id_t id;
-	errno_t rc = get_id_by_phone(call->in_phone_hash, &id);
+	int rc = get_id_by_phone(call->in_phone_hash, &id);
 	if (rc != EOK)
 		return rc;
Index: uspace/srv/ns/task.h
===================================================================
--- uspace/srv/ns/task.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/ns/task.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,12 +37,12 @@
 #include <abi/proc/task.h>
 
-extern errno_t task_init(void);
+extern int task_init(void);
 extern void process_pending_wait(void);
 
 extern void wait_for_task(task_id_t, ipc_call_t *, ipc_callid_t);
 
-extern errno_t ns_task_id_intro(ipc_call_t *);
-extern errno_t ns_task_disconnect(ipc_call_t *);
-extern errno_t ns_task_retval(ipc_call_t *);
+extern int ns_task_id_intro(ipc_call_t *);
+extern int ns_task_disconnect(ipc_call_t *);
+extern int ns_task_retval(ipc_call_t *);
 
 
Index: uspace/srv/taskmon/taskmon.c
===================================================================
--- uspace/srv/taskmon/taskmon.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/taskmon/taskmon.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -56,5 +56,5 @@
 	char *s_taskid;
 	char *dump_fname;
-	errno_t rc;
+	int rc;
 
 	task_id_t taskid;
@@ -148,8 +148,8 @@
 	async_set_fallback_port_handler(corecfg_client_conn, NULL);
 	
-	errno_t rc = loc_server_register(NAME);
+	int rc = loc_server_register(NAME);
 	if (rc != EOK) {
-		printf("%s: Failed registering server: %s.\n",
-		    NAME, str_error(rc));
+		printf("%s: Failed registering server (%d).\n",
+		    NAME, rc);
 		return -1;
 	}
@@ -158,6 +158,6 @@
 	rc = loc_service_register(SERVICE_NAME_CORECFG, &sid);
 	if (rc != EOK) {
-		printf("%s: Failed registering service: %s.\n",
-		    NAME, str_error(rc));
+		printf("%s: Failed registering service (%d).\n",
+		    NAME, rc);
 		return -1;
 	}
Index: uspace/srv/test/chardev-test/main.c
===================================================================
--- uspace/srv/test/chardev-test/main.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/test/chardev-test/main.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -29,5 +29,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <io/chardev_srv.h>
 #include <ipc/services.h>
@@ -39,18 +38,18 @@
 #define NAME  "chardev-test"
 
-static errno_t smallx_open(chardev_srvs_t *, chardev_srv_t *);
-static errno_t smallx_close(chardev_srv_t *);
-static errno_t smallx_write(chardev_srv_t *, const void *, size_t, size_t *);
-static errno_t smallx_read(chardev_srv_t *, void *, size_t, size_t *);
-
-static errno_t largex_open(chardev_srvs_t *, chardev_srv_t *);
-static errno_t largex_close(chardev_srv_t *);
-static errno_t largex_write(chardev_srv_t *, const void *, size_t, size_t *);
-static errno_t largex_read(chardev_srv_t *, void *, size_t, size_t *);
-
-static errno_t partialx_open(chardev_srvs_t *, chardev_srv_t *);
-static errno_t partialx_close(chardev_srv_t *);
-static errno_t partialx_write(chardev_srv_t *, const void *, size_t, size_t *);
-static errno_t partialx_read(chardev_srv_t *, void *, size_t, size_t *);
+static int smallx_open(chardev_srvs_t *, chardev_srv_t *);
+static int smallx_close(chardev_srv_t *);
+static int smallx_write(chardev_srv_t *, const void *, size_t, size_t *);
+static int smallx_read(chardev_srv_t *, void *, size_t, size_t *);
+
+static int largex_open(chardev_srvs_t *, chardev_srv_t *);
+static int largex_close(chardev_srv_t *);
+static int largex_write(chardev_srv_t *, const void *, size_t, size_t *);
+static int largex_read(chardev_srv_t *, void *, size_t, size_t *);
+
+static int partialx_open(chardev_srvs_t *, chardev_srv_t *);
+static int partialx_close(chardev_srv_t *);
+static int partialx_write(chardev_srv_t *, const void *, size_t, size_t *);
+static int partialx_read(chardev_srv_t *, void *, size_t, size_t *);
 
 static service_id_t smallx_svc_id;
@@ -106,5 +105,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf("%s: Character device test service\n", NAME);
@@ -113,5 +112,5 @@
 	rc = loc_server_register(NAME);
 	if (rc != EOK) {
-		printf("%s: Failed registering server.: %s\n", NAME, str_error(rc));
+		printf("%s: Failed registering server. (%d)\n", NAME, rc);
 		return rc;
 	}
@@ -131,5 +130,5 @@
 	rc = loc_service_register(SERVICE_NAME_CHARDEV_TEST_SMALLX, &smallx_svc_id);
 	if (rc != EOK) {
-		printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
+		printf("%s: Failed registering service. (%d)\n", NAME, rc);
 		return rc;
 	}
@@ -137,5 +136,5 @@
 	rc = loc_service_register(SERVICE_NAME_CHARDEV_TEST_LARGEX, &largex_svc_id);
 	if (rc != EOK) {
-		printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
+		printf("%s: Failed registering service. (%d)\n", NAME, rc);
 		return rc;
 	}
@@ -143,5 +142,5 @@
 	rc = loc_service_register(SERVICE_NAME_CHARDEV_TEST_PARTIALX, &partialx_svc_id);
 	if (rc != EOK) {
-		printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
+		printf("%s: Failed registering service. (%d)\n", NAME, rc);
 		return rc;
 	}
@@ -156,15 +155,15 @@
 }
 
-static errno_t smallx_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t smallx_close(chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t smallx_write(chardev_srv_t *srv, const void *data, size_t size,
+static int smallx_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
+{
+	return EOK;
+}
+
+static int smallx_close(chardev_srv_t *srv)
+{
+	return EOK;
+}
+
+static int smallx_write(chardev_srv_t *srv, const void *data, size_t size,
     size_t *nwritten)
 {
@@ -178,5 +177,5 @@
 }
 
-static errno_t smallx_read(chardev_srv_t *srv, void *buf, size_t size,
+static int smallx_read(chardev_srv_t *srv, void *buf, size_t size,
     size_t *nread)
 {
@@ -191,15 +190,15 @@
 }
 
-static errno_t largex_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t largex_close(chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t largex_write(chardev_srv_t *srv, const void *data, size_t size,
+static int largex_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
+{
+	return EOK;
+}
+
+static int largex_close(chardev_srv_t *srv)
+{
+	return EOK;
+}
+
+static int largex_write(chardev_srv_t *srv, const void *data, size_t size,
     size_t *nwritten)
 {
@@ -213,5 +212,5 @@
 }
 
-static errno_t largex_read(chardev_srv_t *srv, void *buf, size_t size,
+static int largex_read(chardev_srv_t *srv, void *buf, size_t size,
     size_t *nread)
 {
@@ -226,15 +225,15 @@
 }
 
-static errno_t partialx_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t partialx_close(chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t partialx_write(chardev_srv_t *srv, const void *data, size_t size,
+static int partialx_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
+{
+	return EOK;
+}
+
+static int partialx_close(chardev_srv_t *srv)
+{
+	return EOK;
+}
+
+static int partialx_write(chardev_srv_t *srv, const void *data, size_t size,
     size_t *nwritten)
 {
@@ -248,5 +247,5 @@
 }
 
-static errno_t partialx_read(chardev_srv_t *srv, void *buf, size_t size,
+static int partialx_read(chardev_srv_t *srv, void *buf, size_t size,
     size_t *nread)
 {
Index: uspace/srv/vfs/vfs.c
===================================================================
--- uspace/srv/vfs/vfs.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/vfs/vfs.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,5 +44,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <stdio.h>
 #include <stdbool.h>
@@ -88,5 +87,5 @@
 int main(int argc, char **argv)
 {
-	errno_t rc;
+	int rc;
 
 	printf("%s: HelenOS VFS server\n", NAME);
@@ -123,9 +122,7 @@
 	port_id_t port;
 	rc = async_create_port(INTERFACE_PAGER, vfs_pager, NULL, &port);
-	if (rc != EOK) {
-		printf("%s: Cannot create pager port: %s\n", NAME, str_error(rc));
+	if (rc != EOK)
 		return rc;
-	}
-
+		
 	/*
 	 * Set a connection handling function/fibril.
@@ -144,5 +141,5 @@
 	rc = service_register(SERVICE_VFS);
 	if (rc != EOK) {
-		printf("%s: Cannot register VFS service: %s\n", NAME, str_error(rc));
+		printf("%s: Cannot register VFS service\n", NAME);
 		return rc;
 	}
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/vfs/vfs.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -176,8 +176,8 @@
 extern fs_handle_t fs_name_to_handle(unsigned int instance, const char *, bool);
 extern vfs_info_t *fs_handle_to_info(fs_handle_t);
-extern errno_t vfs_get_fstypes(vfs_fstypes_t *);
-
-extern errno_t vfs_lookup_internal(vfs_node_t *, char *, int, vfs_lookup_res_t *);
-extern errno_t vfs_link_internal(vfs_node_t *, char *, vfs_triplet_t *);
+extern int vfs_get_fstypes(vfs_fstypes_t *);
+
+extern int vfs_lookup_internal(vfs_node_t *, char *, int, vfs_lookup_res_t *);
+extern int vfs_link_internal(vfs_node_t *, char *, vfs_triplet_t *);
 
 extern bool vfs_nodes_init(void);
@@ -194,33 +194,33 @@
 
 extern void vfs_op_pass_handle(task_id_t, task_id_t, int);
-extern errno_t vfs_wait_handle_internal(bool, int *);
+extern int vfs_wait_handle_internal(bool);
 
 extern vfs_file_t *vfs_file_get(int);
 extern void vfs_file_put(vfs_file_t *);
-extern errno_t vfs_fd_assign(vfs_file_t *, int);
-extern errno_t vfs_fd_alloc(vfs_file_t **file, bool desc, int *);
-extern errno_t vfs_fd_free(int);
+extern int vfs_fd_assign(vfs_file_t *, int);
+extern int vfs_fd_alloc(vfs_file_t **file, bool desc);
+extern int vfs_fd_free(int);
 
 extern void vfs_node_addref(vfs_node_t *);
 extern void vfs_node_delref(vfs_node_t *);
-extern errno_t vfs_open_node_remote(vfs_node_t *);
-
-extern errno_t vfs_op_clone(int oldfd, int newfd, bool desc, int *);
-extern errno_t vfs_op_fsprobe(const char *, service_id_t, vfs_fs_probe_info_t *);
-extern errno_t vfs_op_mount(int mpfd, unsigned servid, unsigned flags, unsigned instance, const char *opts, const char *fsname, int *outfd);
-extern errno_t vfs_op_mtab_get(void);
-extern errno_t vfs_op_open(int fd, int flags);
-extern errno_t vfs_op_put(int fd);
-extern errno_t vfs_op_read(int fd, aoff64_t, size_t *out_bytes);
-extern errno_t vfs_op_rename(int basefd, char *old, char *new);
-extern errno_t vfs_op_resize(int fd, int64_t size);
-extern errno_t vfs_op_stat(int fd);
-extern errno_t vfs_op_statfs(int fd);
-extern errno_t vfs_op_sync(int fd);
-extern errno_t vfs_op_unlink(int parentfd, int expectfd, char *path);
-extern errno_t vfs_op_unmount(int mpfd);
-extern errno_t vfs_op_wait_handle(bool high_fd, int *out_fd);
-extern errno_t vfs_op_walk(int parentfd, int flags, char *path, int *out_fd);
-extern errno_t vfs_op_write(int fd, aoff64_t, size_t *out_bytes);
+extern int vfs_open_node_remote(vfs_node_t *);
+
+extern int vfs_op_clone(int oldfd, int newfd, bool desc);
+extern int vfs_op_fsprobe(const char *, service_id_t, vfs_fs_probe_info_t *);
+extern int vfs_op_mount(int mpfd, unsigned servid, unsigned flags, unsigned instance, const char *opts, const char *fsname, int *outfd);
+extern int vfs_op_mtab_get(void);
+extern int vfs_op_open(int fd, int flags);
+extern int vfs_op_put(int fd);
+extern int vfs_op_read(int fd, aoff64_t, size_t *out_bytes);
+extern int vfs_op_rename(int basefd, char *old, char *new);
+extern int vfs_op_resize(int fd, int64_t size);
+extern int vfs_op_stat(int fd);
+extern int vfs_op_statfs(int fd);
+extern int vfs_op_sync(int fd);
+extern int vfs_op_unlink(int parentfd, int expectfd, char *path);
+extern int vfs_op_unmount(int mpfd);
+extern int vfs_op_wait_handle(bool high_fd);
+extern int vfs_op_walk(int parentfd, int flags, char *path, int *out_fd);
+extern int vfs_op_write(int fd, aoff64_t, size_t *out_bytes);
 
 extern void vfs_register(ipc_callid_t, ipc_call_t *);
@@ -233,5 +233,5 @@
 } rdwr_io_chunk_t;
 
-extern errno_t vfs_rdwr_internal(int, aoff64_t, bool, rdwr_io_chunk_t *);
+extern int vfs_rdwr_internal(int, aoff64_t, bool, rdwr_io_chunk_t *);
 
 extern void vfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg);
Index: uspace/srv/vfs/vfs_file.c
===================================================================
--- uspace/srv/vfs/vfs_file.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/vfs/vfs_file.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -64,5 +64,5 @@
 } vfs_boxed_handle_t;
 
-static errno_t _vfs_fd_free(vfs_client_data_t *, int);
+static int _vfs_fd_free(vfs_client_data_t *, int);
 
 /** Initialize the table of open files. */
@@ -133,5 +133,5 @@
 
 /** Close the file in the endpoint FS server. */
-static errno_t vfs_file_close_remote(vfs_file_t *file)
+static int vfs_file_close_remote(vfs_file_t *file)
 {
 	assert(!file->refcnt);
@@ -145,8 +145,8 @@
 	vfs_exchange_release(exch);
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(msg, &rc);
 	
-	return IPC_GET_RETVAL(answer);
+	return IPC_GET_ARG1(answer);
 }
 
@@ -168,7 +168,7 @@
  *			decremented.
  */
-static errno_t vfs_file_delref(vfs_client_data_t *vfs_data, vfs_file_t *file)
-{
-	errno_t rc = EOK;
+static int vfs_file_delref(vfs_client_data_t *vfs_data, vfs_file_t *file)
+{
+	int rc = EOK;
 
 	assert(fibril_mutex_is_locked(&vfs_data->lock));
@@ -192,5 +192,5 @@
 }
 
-static errno_t _vfs_fd_alloc(vfs_client_data_t *vfs_data, vfs_file_t **file, bool desc, int *out_fd)
+static int _vfs_fd_alloc(vfs_client_data_t *vfs_data, vfs_file_t **file, bool desc)
 {
 	if (!vfs_files_init(vfs_data))
@@ -223,6 +223,5 @@
 			
 			fibril_mutex_unlock(&vfs_data->lock);
-			*out_fd = (int) i;
-			return EOK;
+			return (int) i;
 		}
 		
@@ -250,14 +249,13 @@
  *             in a descending order.
  *
- * @param[out] out_fd  First available file descriptor
- *
- * @return Error code.
- */
-errno_t vfs_fd_alloc(vfs_file_t **file, bool desc, int *out_fd)
-{
-	return _vfs_fd_alloc(VFS_DATA, file, desc, out_fd);
-}
-
-static errno_t _vfs_fd_free_locked(vfs_client_data_t *vfs_data, int fd)
+ * @return First available file descriptor or a negative error
+ *         code.
+ */
+int vfs_fd_alloc(vfs_file_t **file, bool desc)
+{
+	return _vfs_fd_alloc(VFS_DATA, file, desc);
+}
+
+static int _vfs_fd_free_locked(vfs_client_data_t *vfs_data, int fd)
 {
 	if ((fd < 0) || (fd >= MAX_OPEN_FILES) || !vfs_data->files[fd]) {
@@ -265,12 +263,12 @@
 	}
 
-	errno_t rc = vfs_file_delref(vfs_data, vfs_data->files[fd]);
+	int rc = vfs_file_delref(vfs_data, vfs_data->files[fd]);
 	vfs_data->files[fd] = NULL;
 	return rc;
 }
 
-static errno_t _vfs_fd_free(vfs_client_data_t *vfs_data, int fd)
-{
-	errno_t rc;
+static int _vfs_fd_free(vfs_client_data_t *vfs_data, int fd)
+{
+	int rc;
 
 	if (!vfs_files_init(vfs_data))
@@ -291,5 +289,5 @@
  *			descriptor.
  */
-errno_t vfs_fd_free(int fd)
+int vfs_fd_free(int fd)
 {
 	return _vfs_fd_free(VFS_DATA, fd);
@@ -305,5 +303,5 @@
  *
  */
-errno_t vfs_fd_assign(vfs_file_t *file, int fd)
+int vfs_fd_assign(vfs_file_t *file, int fd)
 {
 	if (!vfs_files_init(VFS_DATA))
@@ -429,5 +427,5 @@
 }
 
-errno_t vfs_wait_handle_internal(bool high_fd, int *out_fd)
+int vfs_wait_handle_internal(bool high_fd)
 {
 	vfs_client_data_t *vfs_data = VFS_DATA;	
@@ -443,9 +441,9 @@
 
 	vfs_file_t *file;
-	errno_t rc = _vfs_fd_alloc(vfs_data, &file, high_fd, out_fd);
-	if (rc != EOK) {
+	int fd = _vfs_fd_alloc(vfs_data, &file, high_fd);
+	if (fd < 0) {
 		vfs_node_delref(bh->node);
 		free(bh);
-		return rc;
+		return fd;
 	}
 	
@@ -454,5 +452,5 @@
 	vfs_file_put(file);
 	free(bh);
-	return EOK;
+	return fd;
 }
 
Index: uspace/srv/vfs/vfs_ipc.c
===================================================================
--- uspace/srv/vfs/vfs_ipc.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/vfs/vfs_ipc.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,7 +41,6 @@
 	bool desc = IPC_GET_ARG3(*request);
 	
-	int outfd = -1;
-	errno_t rc = vfs_op_clone(oldfd, newfd, desc, &outfd);
-	async_answer_1(rid, rc, outfd);
+	int ret = vfs_op_clone(oldfd, newfd, desc);
+	async_answer_0(rid, ret);
 }
 
@@ -53,5 +52,5 @@
 	vfs_fs_probe_info_t info;
 	size_t len;
-	errno_t rc;
+	int rc;
 	
 	/*
@@ -88,5 +87,5 @@
 	size_t len;
 	vfs_fstypes_t fstypes;
-	errno_t rc;
+	int rc;
 
 	rc = vfs_get_fstypes(&fstypes);
@@ -129,5 +128,5 @@
 	
 	/* Now we expect to receive the mount options. */
-	errno_t rc = async_data_write_accept((void **) &opts, true, 0,
+	int rc = async_data_write_accept((void **) &opts, true, 0,
 	    MAX_MNTOPTS_LEN, 0, NULL);
 	if (rc != EOK) {
@@ -161,5 +160,5 @@
 	int mode = IPC_GET_ARG2(*request);
 
-	errno_t rc = vfs_op_open(fd, mode);
+	int rc = vfs_op_open(fd, mode);
 	async_answer_0(rid, rc);
 }
@@ -168,5 +167,5 @@
 {
 	int fd = IPC_GET_ARG1(*request);
-	errno_t rc = vfs_op_put(fd);
+	int rc = vfs_op_put(fd);
 	async_answer_0(rid, rc);
 }
@@ -179,5 +178,5 @@
 
 	size_t bytes = 0;
-	errno_t rc = vfs_op_read(fd, pos, &bytes);
+	int rc = vfs_op_read(fd, pos, &bytes);
 	async_answer_1(rid, rc, bytes);
 }
@@ -189,5 +188,5 @@
 	char *old = NULL;
 	char *new = NULL;
-	errno_t rc;
+	int rc;
 	
 	basefd = IPC_GET_ARG1(*request);
@@ -231,5 +230,5 @@
 	int fd = IPC_GET_ARG1(*request);
 	int64_t size = MERGE_LOUP32(IPC_GET_ARG2(*request), IPC_GET_ARG3(*request));
-	errno_t rc = vfs_op_resize(fd, size);
+	int rc = vfs_op_resize(fd, size);
 	async_answer_0(rid, rc);
 }
@@ -238,5 +237,5 @@
 {
 	int fd = IPC_GET_ARG1(*request);
-	errno_t rc = vfs_op_stat(fd);
+	int rc = vfs_op_stat(fd);
 	async_answer_0(rid, rc);
 }
@@ -246,5 +245,5 @@
 	int fd = (int) IPC_GET_ARG1(*request);
 	
-	errno_t rc = vfs_op_statfs(fd);
+	int rc = vfs_op_statfs(fd);
 	async_answer_0(rid, rc);
 }
@@ -253,5 +252,5 @@
 {
 	int fd = IPC_GET_ARG1(*request);
-	errno_t rc = vfs_op_sync(fd);
+	int rc = vfs_op_sync(fd);
 	async_answer_0(rid, rc);
 }
@@ -263,5 +262,5 @@
 	
 	char *path;
-	errno_t rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);
+	int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);
 	if (rc == EOK)
 		rc = vfs_op_unlink(parentfd, expectfd, path);
@@ -273,5 +272,5 @@
 {
 	int mpfd = IPC_GET_ARG1(*request);
-	errno_t rc = vfs_op_unmount(mpfd);
+	int rc = vfs_op_unmount(mpfd);
 	async_answer_0(rid, rc);
 }
@@ -280,7 +279,6 @@
 {
 	bool high_fd = IPC_GET_ARG1(*request);
-	int fd = -1;
-	errno_t rc = vfs_op_wait_handle(high_fd, &fd);
-	async_answer_1(rid, rc, fd);
+	int fd = vfs_op_wait_handle(high_fd);
+	async_answer_1(rid, EOK, fd);
 }
 
@@ -296,5 +294,5 @@
 	int fd = 0;
 	char *path;
-	errno_t rc = async_data_write_accept((void **)&path, true, 0, 0, 0, NULL);
+	int rc = async_data_write_accept((void **)&path, true, 0, 0, 0, NULL);
 	if (rc == EOK) {
 		rc = vfs_op_walk(parentfd, flags, path, &fd);
@@ -311,5 +309,5 @@
 
 	size_t bytes = 0;
-	errno_t rc = vfs_op_write(fd, pos, &bytes);
+	int rc = vfs_op_write(fd, pos, &bytes);
 	async_answer_1(rid, rc, bytes);
 }
Index: uspace/srv/vfs/vfs_lookup.c
===================================================================
--- uspace/srv/vfs/vfs_lookup.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/vfs/vfs_lookup.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -53,5 +53,5 @@
 uint8_t *plb = NULL;
 
-static errno_t plb_insert_entry(plb_entry_t *entry, char *path, size_t *start,
+static int plb_insert_entry(plb_entry_t *entry, char *path, size_t *start,
     size_t len)
 {
@@ -138,5 +138,5 @@
 }
 
-errno_t vfs_link_internal(vfs_node_t *base, char *path, vfs_triplet_t *child)
+int vfs_link_internal(vfs_node_t *base, char *path, vfs_triplet_t *child)
 {
 	assert(base != NULL);
@@ -148,5 +148,5 @@
 	vfs_lookup_res_t res;
 	char component[NAME_MAX + 1];
-	errno_t rc;
+	int rc;
 	
 	size_t len;
@@ -197,5 +197,5 @@
 	
 	rc = async_data_write_start(exch, component, str_size(component) + 1);
-	errno_t orig_rc;
+	sysarg_t orig_rc;
 	async_wait_for(req, &orig_rc);
 	vfs_exchange_release(exch);
@@ -207,5 +207,5 @@
 }
 
-static errno_t out_lookup(vfs_triplet_t *base, size_t *pfirst, size_t *plen,
+static int out_lookup(vfs_triplet_t *base, size_t *pfirst, size_t *plen,
     int lflag, vfs_lookup_res_t *result)
 {
@@ -213,5 +213,5 @@
 	assert(result);
 	
-	errno_t rc;
+	sysarg_t rc;
 	ipc_call_t answer;
 	async_exch_t *exch = vfs_exchange_grab(base->fs_handle);
@@ -222,6 +222,6 @@
 	vfs_exchange_release(exch);
 	
-	if (rc != EOK)
-		return rc;
+	if ((int) rc < 0)
+		return (int) rc;
 	
 	unsigned last = *pfirst + *plen;
@@ -229,6 +229,6 @@
 	*plen = last - *pfirst;
 	
-	result->triplet.fs_handle = (fs_handle_t) IPC_GET_ARG1(answer);
-	result->triplet.service_id = base->service_id;
+	result->triplet.fs_handle = (fs_handle_t) rc;
+	result->triplet.service_id = (service_id_t) IPC_GET_ARG1(answer);
 	result->triplet.index = (fs_index_t) IPC_GET_ARG2(answer);
 	result->size = MERGE_LOUP32(IPC_GET_ARG4(answer), IPC_GET_ARG5(answer));
@@ -238,9 +238,9 @@
 }
 
-static errno_t _vfs_lookup_internal(vfs_node_t *base, char *path, int lflag,
+static int _vfs_lookup_internal(vfs_node_t *base, char *path, int lflag,
     vfs_lookup_res_t *result, size_t len)
 {
 	size_t first;
-	errno_t rc;
+	int rc;
 
 	plb_entry_t entry;
@@ -334,5 +334,5 @@
  *
  */
-errno_t vfs_lookup_internal(vfs_node_t *base, char *path, int lflag,
+int vfs_lookup_internal(vfs_node_t *base, char *path, int lflag,
     vfs_lookup_res_t *result)
 {
@@ -341,5 +341,5 @@
 	
 	size_t len;
-	errno_t rc;
+	int rc;
 	char *npath = canonify(path, &len);
 	if (!npath) {
Index: uspace/srv/vfs/vfs_node.c
===================================================================
--- uspace/srv/vfs/vfs_node.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/vfs/vfs_node.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -265,5 +265,5 @@
  *
  */
-errno_t vfs_open_node_remote(vfs_node_t *node)
+int vfs_open_node_remote(vfs_node_t *node)
 {
 	async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
@@ -275,5 +275,5 @@
 	vfs_exchange_release(exch);
 
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(req, &rc);
 	
@@ -318,5 +318,5 @@
 {
 	async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
-	errno_t rc = async_req_2_0(exch, VFS_OUT_IS_EMPTY, node->service_id,
+	int rc = async_req_2_0(exch, VFS_OUT_IS_EMPTY, node->service_id,
 	    node->index);
 	vfs_exchange_release(exch);
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/vfs/vfs_ops.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -52,5 +52,5 @@
 
 /* Forward declarations of static functions. */
-static errno_t vfs_truncate_internal(fs_handle_t, service_id_t, fs_index_t,
+static int vfs_truncate_internal(fs_handle_t, service_id_t, fs_index_t,
     aoff64_t);
 
@@ -86,7 +86,7 @@
 }
 
-errno_t vfs_op_clone(int oldfd, int newfd, bool desc, int *out_fd)
-{
-	errno_t rc;
+int vfs_op_clone(int oldfd, int newfd, bool desc)
+{
+	int rc;
 
 	/* If the file descriptors are the same, do nothing. */
@@ -104,9 +104,8 @@
 		/* Assign the old file to newfd. */
 		rc = vfs_fd_assign(oldfile, newfd);
-		*out_fd = newfd;
 	} else {
 		vfs_file_t *newfile;
-		rc = vfs_fd_alloc(&newfile, desc, out_fd);
-		if (rc == EOK) {
+		int newfd = vfs_fd_alloc(&newfile, desc);
+		if (newfd >= 0) {
 			newfile->node = oldfile->node;
 			newfile->permissions = oldfile->permissions;
@@ -115,4 +114,5 @@
 			vfs_file_put(newfile);
 		}
+		rc = newfd;
 	}
 	vfs_file_put(oldfile);
@@ -121,10 +121,10 @@
 }
 
-errno_t vfs_op_put(int fd)
+int vfs_op_put(int fd)
 {
 	return vfs_fd_free(fd);
 }
 
-static errno_t vfs_connect_internal(service_id_t service_id, unsigned flags,
+static int vfs_connect_internal(service_id_t service_id, unsigned flags,
     unsigned instance, const char *options, const char *fsname,
     vfs_node_t **root)
@@ -152,5 +152,5 @@
 	    &answer);
 	/* Send the mount options */
-	errno_t rc = async_data_write_start(exch, options, str_size(options));
+	sysarg_t rc = async_data_write_start(exch, options, str_size(options));
 	if (rc != EOK) {
 		async_forget(msg);
@@ -188,10 +188,10 @@
 }
 
-errno_t vfs_op_fsprobe(const char *fs_name, service_id_t sid,
+int vfs_op_fsprobe(const char *fs_name, service_id_t sid,
     vfs_fs_probe_info_t *info)
 {
 	fs_handle_t fs_handle = 0;
-	errno_t rc;
-	errno_t retval;
+	sysarg_t rc;
+	int retval;
 	
 	fibril_mutex_lock(&fs_list_lock);
@@ -222,11 +222,11 @@
 }
 
-errno_t vfs_op_mount(int mpfd, unsigned service_id, unsigned flags,
-    unsigned instance, const char *opts, const char *fs_name, int *out_fd)
-{
-	errno_t rc;
+int vfs_op_mount(int mpfd, unsigned service_id, unsigned flags,
+    unsigned instance, const char *opts, const char *fs_name, int *outfd)
+{
+	int rc;
 	vfs_file_t *mp = NULL;
 	vfs_file_t *file = NULL;
-	*out_fd = -1;
+	int fd = -1;
 	
 	if (!(flags & VFS_MOUNT_CONNECT_ONLY)) {
@@ -254,6 +254,7 @@
 	
 	if (!(flags & VFS_MOUNT_NO_REF)) {
-		rc = vfs_fd_alloc(&file, false, out_fd);
-		if (rc != EOK) {
+		fd = vfs_fd_alloc(&file, false);
+		if (fd < 0) {
+			rc = fd;
 			goto out;
 		}
@@ -294,13 +295,14 @@
 		vfs_file_put(file);
 
-	if (rc != EOK && *out_fd >= 0) {
-		vfs_fd_free(*out_fd);
-		*out_fd = -1;
-	}
-	
+	if (rc != EOK && fd >= 0) {
+		vfs_fd_free(fd);
+		fd = 0;
+	}
+	
+	*outfd = fd;
 	return rc;
 }
 
-errno_t vfs_op_open(int fd, int mode)
+int vfs_op_open(int fd, int mode)
 {
 	if (mode == 0)
@@ -336,5 +338,5 @@
 	}
 	
-	errno_t rc = vfs_open_node_remote(file->node);
+	int rc = vfs_open_node_remote(file->node);
 	if (rc != EOK) {
 		file->open_read = file->open_write = false;
@@ -347,12 +349,12 @@
 }
 
-typedef errno_t (* rdwr_ipc_cb_t)(async_exch_t *, vfs_file_t *, aoff64_t,
+typedef int (* rdwr_ipc_cb_t)(async_exch_t *, vfs_file_t *, aoff64_t,
     ipc_call_t *, bool, void *);
 
-static errno_t rdwr_ipc_client(async_exch_t *exch, vfs_file_t *file, aoff64_t pos,
+static int rdwr_ipc_client(async_exch_t *exch, vfs_file_t *file, aoff64_t pos,
     ipc_call_t *answer, bool read, void *data)
 {
 	size_t *bytes = (size_t *) data;
-	errno_t rc;
+	int rc;
 
 	/*
@@ -378,5 +380,5 @@
 }
 
-static errno_t rdwr_ipc_internal(async_exch_t *exch, vfs_file_t *file, aoff64_t pos,
+static int rdwr_ipc_internal(async_exch_t *exch, vfs_file_t *file, aoff64_t pos,
     ipc_call_t *answer, bool read, void *data)
 {
@@ -392,5 +394,5 @@
 		return EINVAL;
 
-	errno_t retval = async_data_read_start(exch, chunk->buffer, chunk->size);
+	int retval = async_data_read_start(exch, chunk->buffer, chunk->size);
 	if (retval != EOK) {
 		async_forget(msg);
@@ -398,13 +400,13 @@
 	}
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(msg, &rc);
 	
 	chunk->size = IPC_GET_ARG1(*answer); 
 
-	return (errno_t) rc;
-}
-
-static errno_t vfs_rdwr(int fd, aoff64_t pos, bool read, rdwr_ipc_cb_t ipc_cb,
+	return (int) rc;
+}
+
+static int vfs_rdwr(int fd, aoff64_t pos, bool read, rdwr_ipc_cb_t ipc_cb,
     void *ipc_cb_data)
 {
@@ -475,5 +477,5 @@
 	 */
 	ipc_call_t answer;
-	errno_t rc = ipc_cb(fs_exch, file, pos, &answer, read, ipc_cb_data);
+	int rc = ipc_cb(fs_exch, file, pos, &answer, read, ipc_cb_data);
 	
 	vfs_exchange_release(fs_exch);
@@ -499,15 +501,15 @@
 }
 
-errno_t vfs_rdwr_internal(int fd, aoff64_t pos, bool read, rdwr_io_chunk_t *chunk)
+int vfs_rdwr_internal(int fd, aoff64_t pos, bool read, rdwr_io_chunk_t *chunk)
 {
 	return vfs_rdwr(fd, pos, read, rdwr_ipc_internal, chunk);
 }
 
-errno_t vfs_op_read(int fd, aoff64_t pos, size_t *out_bytes)
+int vfs_op_read(int fd, aoff64_t pos, size_t *out_bytes)
 {
 	return vfs_rdwr(fd, pos, true, rdwr_ipc_client, out_bytes);
 }
 
-errno_t vfs_op_rename(int basefd, char *old, char *new)
+int vfs_op_rename(int basefd, char *old, char *new)
 {
 	vfs_file_t *base_file = vfs_file_get(basefd);
@@ -524,5 +526,5 @@
 	bool orig_unlinked = false;
 	
-	errno_t rc;
+	int rc;
 	
 	size_t shared = shared_path(old, new);
@@ -610,5 +612,5 @@
 }
 
-errno_t vfs_op_resize(int fd, int64_t size)
+int vfs_op_resize(int fd, int64_t size)
 {
 	vfs_file_t *file = vfs_file_get(fd);
@@ -618,5 +620,5 @@
 	fibril_rwlock_write_lock(&file->node->contents_rwlock);
 	
-	errno_t rc = vfs_truncate_internal(file->node->fs_handle,
+	int rc = vfs_truncate_internal(file->node->fs_handle,
 	    file->node->service_id, file->node->index, size);
 	if (rc == EOK)
@@ -628,5 +630,5 @@
 }
 
-errno_t vfs_op_stat(int fd)
+int vfs_op_stat(int fd)
 {
 	vfs_file_t *file = vfs_file_get(fd);
@@ -637,5 +639,5 @@
 
 	async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
-	errno_t rc = async_data_read_forward_fast(exch, VFS_OUT_STAT,
+	int rc = async_data_read_forward_fast(exch, VFS_OUT_STAT,
 	    node->service_id, node->index, true, 0, NULL);
 	vfs_exchange_release(exch);
@@ -645,5 +647,5 @@
 }
 
-errno_t vfs_op_statfs(int fd)
+int vfs_op_statfs(int fd)
 {
 	vfs_file_t *file = vfs_file_get(fd);
@@ -654,5 +656,5 @@
 
 	async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
-	errno_t rc = async_data_read_forward_fast(exch, VFS_OUT_STATFS,
+	int rc = async_data_read_forward_fast(exch, VFS_OUT_STATFS,
 	    node->service_id, node->index, false, 0, NULL);
 	vfs_exchange_release(exch);
@@ -662,5 +664,5 @@
 }
 
-errno_t vfs_op_sync(int fd)
+int vfs_op_sync(int fd)
 {
 	vfs_file_t *file = vfs_file_get(fd);
@@ -677,5 +679,5 @@
 	vfs_exchange_release(fs_exch);
 	
-	errno_t rc;
+	sysarg_t rc;
 	async_wait_for(msg, &rc);
 	
@@ -685,19 +687,19 @@
 }
 
-static errno_t vfs_truncate_internal(fs_handle_t fs_handle, service_id_t service_id,
+static int vfs_truncate_internal(fs_handle_t fs_handle, service_id_t service_id,
     fs_index_t index, aoff64_t size)
 {
 	async_exch_t *exch = vfs_exchange_grab(fs_handle);
-	errno_t rc = async_req_4_0(exch, VFS_OUT_TRUNCATE,
+	sysarg_t rc = async_req_4_0(exch, VFS_OUT_TRUNCATE,
 	    (sysarg_t) service_id, (sysarg_t) index, LOWER32(size),
 	    UPPER32(size));
 	vfs_exchange_release(exch);
 	
-	return (errno_t) rc;
-}
-
-errno_t vfs_op_unlink(int parentfd, int expectfd, char *path)
-{
-	errno_t rc = EOK;
+	return (int) rc;
+}
+
+int vfs_op_unlink(int parentfd, int expectfd, char *path)
+{
+	int rc = EOK;
 	vfs_file_t *parent = NULL;
 	vfs_file_t *expect = NULL;
@@ -778,5 +780,5 @@
 }
 
-errno_t vfs_op_unmount(int mpfd)
+int vfs_op_unmount(int mpfd)
 {
 	vfs_file_t *mp = vfs_file_get(mpfd);
@@ -806,5 +808,5 @@
 	
 	async_exch_t *exch = vfs_exchange_grab(mp->node->mount->fs_handle);
-	errno_t rc = async_req_1_0(exch, VFS_OUT_UNMOUNTED,
+	int rc = async_req_1_0(exch, VFS_OUT_UNMOUNTED,
 	    mp->node->mount->service_id);
 	vfs_exchange_release(exch);
@@ -826,7 +828,7 @@
 }
 
-errno_t vfs_op_wait_handle(bool high_fd, int *out_fd)
-{
-	return vfs_wait_handle_internal(high_fd, out_fd);
+int vfs_op_wait_handle(bool high_fd)
+{
+	return vfs_wait_handle_internal(high_fd);
 }
 
@@ -862,5 +864,5 @@
 }
 
-errno_t vfs_op_walk(int parentfd, int flags, char *path, int *out_fd)
+int vfs_op_walk(int parentfd, int flags, char *path, int *out_fd)
 {
 	if (!walk_flags_valid(flags))
@@ -874,5 +876,5 @@
 	
 	vfs_lookup_res_t lr;
-	errno_t rc = vfs_lookup_internal(parent->node, path,
+	int rc = vfs_lookup_internal(parent->node, path,
 	    walk_lookup_flags(flags), &lr);
 	if (rc != EOK) {
@@ -890,9 +892,9 @@
 	
 	vfs_file_t *file;
-	rc = vfs_fd_alloc(&file, false, out_fd);
-	if (rc != EOK) {
+	int fd = vfs_fd_alloc(&file, false);
+	if (fd < 0) {
 		vfs_node_put(node);
 		vfs_file_put(parent);
-		return rc;
+		return fd;
 	}
 	assert(file != NULL);
@@ -908,8 +910,9 @@
 	fibril_rwlock_read_unlock(&namespace_rwlock);
 
+	*out_fd = fd;
 	return EOK;
 }
 
-errno_t vfs_op_write(int fd, aoff64_t pos, size_t *out_bytes)
+int vfs_op_write(int fd, aoff64_t pos, size_t *out_bytes)
 {
 	return vfs_rdwr(fd, pos, false, rdwr_ipc_client, out_bytes);
Index: uspace/srv/vfs/vfs_pager.c
===================================================================
--- uspace/srv/vfs/vfs_pager.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/vfs/vfs_pager.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -48,5 +48,5 @@
 	int fd = IPC_GET_ARG3(*request);
 	void *page;
-	errno_t rc;
+	int rc;
 
 	page = as_area_create(AS_AREA_ANY, page_size,
Index: uspace/srv/vfs/vfs_register.c
===================================================================
--- uspace/srv/vfs/vfs_register.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/vfs/vfs_register.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -118,5 +118,5 @@
 	
 	vfs_info_t *vfs_info;
-	errno_t rc = async_data_write_accept((void **) &vfs_info, false,
+	int rc = async_data_write_accept((void **) &vfs_info, false,
 	    sizeof(vfs_info_t), sizeof(vfs_info_t), 0, NULL);
 	
@@ -346,7 +346,7 @@
  *                vfs_fstypes_free().
  *
- * @return EOK on success or an error code
- */
-errno_t vfs_get_fstypes(vfs_fstypes_t *fstypes)
+ * @return EOK on success or negative error code
+ */
+int vfs_get_fstypes(vfs_fstypes_t *fstypes)
 {
 	size_t size;
Index: uspace/srv/volsrv/empty.c
===================================================================
--- uspace/srv/volsrv/empty.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/volsrv/empty.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -44,8 +44,8 @@
 #include "empty.h"
 
-static errno_t empty_get_bsize(void *, size_t *);
-static errno_t empty_get_nblocks(void *, aoff64_t *);
-static errno_t empty_read(void *, aoff64_t, size_t, void *);
-static errno_t empty_write(void *, aoff64_t, size_t, const void *);
+static int empty_get_bsize(void *, size_t *);
+static int empty_get_nblocks(void *, aoff64_t *);
+static int empty_read(void *, aoff64_t, size_t, void *);
+static int empty_write(void *, aoff64_t, size_t, const void *);
 
 /** Provide disk access to liblabel */
@@ -57,7 +57,7 @@
 };
 
-errno_t volsrv_part_is_empty(service_id_t sid, bool *rempty)
+int volsrv_part_is_empty(service_id_t sid, bool *rempty)
 {
-	errno_t rc;
+	int rc;
 	label_bd_t lbd;
 
@@ -78,7 +78,7 @@
 }
 
-errno_t volsrv_part_empty(service_id_t sid)
+int volsrv_part_empty(service_id_t sid)
 {
-	errno_t rc;
+	int rc;
 	label_bd_t lbd;
 
@@ -100,5 +100,5 @@
 
 /** Get block size wrapper for liblabel */
-static errno_t empty_get_bsize(void *arg, size_t *bsize)
+static int empty_get_bsize(void *arg, size_t *bsize)
 {
 	service_id_t svc_id = *(service_id_t *)arg;
@@ -107,5 +107,5 @@
 
 /** Get number of blocks wrapper for liblabel */
-static errno_t empty_get_nblocks(void *arg, aoff64_t *nblocks)
+static int empty_get_nblocks(void *arg, aoff64_t *nblocks)
 {
 	service_id_t svc_id = *(service_id_t *)arg;
@@ -114,5 +114,5 @@
 
 /** Read blocks wrapper for liblabel */
-static errno_t empty_read(void *arg, aoff64_t ba, size_t cnt, void *buf)
+static int empty_read(void *arg, aoff64_t ba, size_t cnt, void *buf)
 {
 	service_id_t svc_id = *(service_id_t *)arg;
@@ -121,5 +121,5 @@
 
 /** Write blocks wrapper for liblabel */
-static errno_t empty_write(void *arg, aoff64_t ba, size_t cnt, const void *data)
+static int empty_write(void *arg, aoff64_t ba, size_t cnt, const void *data)
 {
 	service_id_t svc_id = *(service_id_t *)arg;
Index: uspace/srv/volsrv/empty.h
===================================================================
--- uspace/srv/volsrv/empty.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/volsrv/empty.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -40,6 +40,6 @@
 #include <loc.h>
 
-extern errno_t volsrv_part_is_empty(service_id_t, bool *);
-extern errno_t volsrv_part_empty(service_id_t);
+extern int volsrv_part_is_empty(service_id_t, bool *);
+extern int volsrv_part_empty(service_id_t);
 
 #endif
Index: uspace/srv/volsrv/mkfs.c
===================================================================
--- uspace/srv/volsrv/mkfs.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/volsrv/mkfs.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -47,5 +47,5 @@
 #include "mkfs.h"
 
-static errno_t cmd_runl(const char *path, ...)
+static int cmd_runl(const char *path, ...)
 {
 	va_list ap;
@@ -63,5 +63,5 @@
 	task_id_t id;
 	task_wait_t wait;
-	errno_t rc = task_spawn(&id, &wait, path, cnt, ap);
+	int rc = task_spawn(&id, &wait, path, cnt, ap);
 	va_end(ap);
 
@@ -98,13 +98,13 @@
 	}
 
-	return retval == 0 ? EOK : EPARTY;
+	return retval;
 }
 
 
-errno_t volsrv_part_mkfs(service_id_t sid, vol_fstype_t fstype, const char *label)
+int volsrv_part_mkfs(service_id_t sid, vol_fstype_t fstype, const char *label)
 {
 	const char *cmd;
 	char *svc_name;
-	errno_t rc;
+	int rc;
 
 	cmd = NULL;
Index: uspace/srv/volsrv/mkfs.h
===================================================================
--- uspace/srv/volsrv/mkfs.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/volsrv/mkfs.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -41,5 +41,5 @@
 #include <types/vol.h>
 
-extern errno_t volsrv_part_mkfs(service_id_t, vol_fstype_t, const char *);
+extern int volsrv_part_mkfs(service_id_t, vol_fstype_t, const char *);
 extern void volsrv_part_get_lsupp(vol_fstype_t, vol_label_supp_t *);
 
Index: uspace/srv/volsrv/part.c
===================================================================
--- uspace/srv/volsrv/part.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/volsrv/part.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -37,5 +37,4 @@
 #include <stdbool.h>
 #include <errno.h>
-#include <str_error.h>
 #include <fibril_synch.h>
 #include <io/log.h>
@@ -50,5 +49,5 @@
 #include "types/part.h"
 
-static errno_t vol_part_add_locked(service_id_t);
+static int vol_part_add_locked(service_id_t);
 static LIST_INITIALIZE(vol_parts); /* of vol_part_t */
 static FIBRIL_MUTEX_INITIALIZE(vol_parts_lock);
@@ -69,5 +68,5 @@
 
 /** Check for new partitions */
-static errno_t vol_part_check_new(void)
+static int vol_part_check_new(void)
 {
 	bool already_known;
@@ -75,5 +74,5 @@
 	service_id_t *svcs;
 	size_t count, i;
-	errno_t rc;
+	int rc;
 
 	fibril_mutex_lock(&vol_parts_lock);
@@ -144,5 +143,5 @@
 }
 
-static errno_t vol_part_probe(vol_part_t *part)
+static int vol_part_probe(vol_part_t *part)
 {
 	bool empty;
@@ -150,5 +149,5 @@
 	struct fsname_type *fst;
 	char *label;
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_NOTE, "Probe partition %s", part->svc_name);
@@ -204,8 +203,8 @@
 }
 
-static errno_t vol_part_add_locked(service_id_t sid)
+static int vol_part_add_locked(service_id_t sid)
 {
 	vol_part_t *part;
-	errno_t rc;
+	int rc;
 
 	assert(fibril_mutex_is_locked(&vol_parts_lock));
@@ -244,7 +243,7 @@
 }
 
-errno_t vol_part_add(service_id_t sid)
-{
-	errno_t rc;
+int vol_part_add(service_id_t sid)
+{
+	int rc;
 
 	fibril_mutex_lock(&vol_parts_lock);
@@ -260,17 +259,17 @@
 }
 
-errno_t vol_part_init(void)
-{
-	return EOK;
-}
-
-errno_t vol_part_discovery_start(void)
-{
-	errno_t rc;
+int vol_part_init(void)
+{
+	return EOK;
+}
+
+int vol_part_discovery_start(void)
+{
+	int rc;
 
 	rc = loc_register_cat_change_cb(vol_part_cat_change_cb);
 	if (rc != EOK) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback "
-		    "for partition discovery: %s.", str_error(rc));
+		    "for partition discovery (%d).", rc);
 		return rc;
 	}
@@ -280,5 +279,5 @@
 
 /** Get list of partitions as array of service IDs. */
-errno_t vol_part_get_ids(service_id_t *id_buf, size_t buf_size, size_t *act_size)
+int vol_part_get_ids(service_id_t *id_buf, size_t buf_size, size_t *act_size)
 {
 	size_t act_cnt;
@@ -308,5 +307,5 @@
 }
 
-errno_t vol_part_find_by_id(service_id_t sid, vol_part_t **rpart)
+int vol_part_find_by_id(service_id_t sid, vol_part_t **rpart)
 {
 	list_foreach(vol_parts, lparts, vol_part_t, part) {
@@ -321,7 +320,7 @@
 }
 
-errno_t vol_part_empty_part(vol_part_t *part)
-{
-	errno_t rc;
+int vol_part_empty_part(vol_part_t *part)
+{
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_empty_part()");
@@ -329,6 +328,6 @@
 	rc = volsrv_part_empty(part->svc_id);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_empty_part() - failed %s",
-		    str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_empty_part() - failed %d",
+		    rc);
 		return rc;
 	}
@@ -338,8 +337,8 @@
 }
 
-errno_t vol_part_mkfs_part(vol_part_t *part, vol_fstype_t fstype,
+int vol_part_mkfs_part(vol_part_t *part, vol_fstype_t fstype,
     const char *label)
 {
-	errno_t rc;
+	int rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_part()");
@@ -349,6 +348,6 @@
 	rc = volsrv_part_mkfs(part->svc_id, fstype, label);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_part() - failed %s",
-		    str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_part() - failed %d",
+		    rc);
 		fibril_mutex_unlock(&vol_parts_lock);
 		return rc;
@@ -370,5 +369,5 @@
 }
 
-errno_t vol_part_get_info(vol_part_t *part, vol_part_info_t *pinfo)
+int vol_part_get_info(vol_part_t *part, vol_part_info_t *pinfo)
 {
 	pinfo->pcnt = part->pcnt;
Index: uspace/srv/volsrv/part.h
===================================================================
--- uspace/srv/volsrv/part.h	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/volsrv/part.h	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -43,12 +43,12 @@
 #include "types/part.h"
 
-extern errno_t vol_part_init(void);
-extern errno_t vol_part_discovery_start(void);
-extern errno_t vol_part_add(service_id_t);
-extern errno_t vol_part_get_ids(service_id_t *, size_t, size_t *);
-extern errno_t vol_part_find_by_id(service_id_t, vol_part_t **);
-extern errno_t vol_part_empty_part(vol_part_t *);
-extern errno_t vol_part_mkfs_part(vol_part_t *, vol_fstype_t, const char *);
-extern errno_t vol_part_get_info(vol_part_t *, vol_part_info_t *);
+extern int vol_part_init(void);
+extern int vol_part_discovery_start(void);
+extern int vol_part_add(service_id_t);
+extern int vol_part_get_ids(service_id_t *, size_t, size_t *);
+extern int vol_part_find_by_id(service_id_t, vol_part_t **);
+extern int vol_part_empty_part(vol_part_t *);
+extern int vol_part_mkfs_part(vol_part_t *, vol_fstype_t, const char *);
+extern int vol_part_get_info(vol_part_t *, vol_part_info_t *);
 
 #endif
Index: uspace/srv/volsrv/volsrv.c
===================================================================
--- uspace/srv/volsrv/volsrv.c	(revision a912afff2183b03ff0125b2f2bfcbf5235fc78c7)
+++ uspace/srv/volsrv/volsrv.c	(revision 220adfa40192f4969d92a5de29826f012343ae2a)
@@ -36,5 +36,4 @@
 #include <async.h>
 #include <errno.h>
-#include <str_error.h>
 #include <io/log.h>
 #include <ipc/services.h>
@@ -54,7 +53,7 @@
 static void vol_client_conn(ipc_callid_t, ipc_call_t *, void *);
 
-static errno_t vol_init(void)
-{
-	errno_t rc;
+static int vol_init(void)
+{
+	int rc;
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_init()");
 
@@ -71,5 +70,5 @@
 	rc = loc_server_register(NAME);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server (%d).", rc);
 		return EEXIST;
 	}
@@ -78,5 +77,5 @@
 	rc = loc_service_register(SERVICE_NAME_VOLSRV, &sid);
 	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
+		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
 		return EEXIST;
 	}
@@ -90,5 +89,5 @@
 	size_t size;
 	size_t act_size;
-	errno_t rc;
+	int rc;
 
 	if (!async_data_read_receive(&callid, &size)) {
@@ -112,5 +111,5 @@
 	}
 
-	errno_t retval = async_data_read_finalize(callid, id_buf, size);
+	sysarg_t retval = async_data_read_finalize(callid, id_buf, size);
 	free(id_buf);
 
@@ -121,5 +120,5 @@
 {
 	service_id_t sid;
-	errno_t rc;
+	int rc;
 
 	sid = IPC_GET_ARG1(*icall);
@@ -139,5 +138,5 @@
 	vol_part_t *part;
 	vol_part_info_t pinfo;
-	errno_t rc;
+	int rc;
 
 	sid = IPC_GET_ARG1(*icall);
@@ -185,5 +184,5 @@
 	service_id_t sid;
 	vol_part_t *part;
-	errno_t rc;
+	int rc;
 
 	sid = IPC_GET_ARG1(*icall);
@@ -209,5 +208,5 @@
 	vol_fstype_t fstype;
 	vol_label_supp_t vlsupp;
-	errno_t rc;
+	int rc;
 
 	fstype = IPC_GET_ARG1(*icall);
@@ -249,5 +248,5 @@
 	vol_fstype_t fstype;
 	char *label;
-	errno_t rc;
+	int rc;
 
 	sid = IPC_GET_ARG1(*icall);
@@ -327,5 +326,5 @@
 int main(int argc, char *argv[])
 {
-	errno_t rc;
+	int rc;
 
 	printf("%s: Volume service\n", NAME);
