Index: abi/include/_bits/errno.h
===================================================================
--- abi/include/_bits/errno.h	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
+++ abi/include/_bits/errno.h	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
@@ -0,0 +1,75 @@
+/*
+ * 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: abi/include/_bits/opaque_handle.h
===================================================================
--- abi/include/_bits/opaque_handle.h	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
+++ abi/include/_bits/opaque_handle.h	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
@@ -0,0 +1,45 @@
+/*
+ * 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/cap.h
===================================================================
--- abi/include/abi/cap.h	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
+++ abi/include/abi/cap.h	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+/** @addtogroup generic
+ * @{
+ */
+/** @file
+ */
+
+#ifndef ABI_CAP_H_
+#define ABI_CAP_H_
+
+#define CAP_NIL		0
+
+typedef int cap_handle_t;
+
+#endif
+
+/** @}
+ */
Index: abi/include/abi/errno.h
===================================================================
--- abi/include/abi/errno.h	(revision db51a6a671d00feb477a7c35b072e80c77fe4a6f)
+++ abi/include/abi/errno.h	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
@@ -1,77 +1,117 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
+/* 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)
+
+/* libhttp error codes. Defining them here is a temporary hack. */
+
+#define HTTP_EMULTIPLE_HEADERS  __errno_t(  50)
+#define HTTP_EMISSING_HEADER    __errno_t(  51)
+#define HTTP_EPARSE             __errno_t(  52)
+
+/* libext4 error codes. Same as above. */
+
+#define EXT4_ERR_BAD_DX_DIR     __errno_t(  60)
+
+
+/* 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.
  *
- * 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.
+ * If you decide to use one of these in native HelenOS code,
+ * move it up to the first group.
  */
 
-/** @addtogroup generic
- * @{
- */
-/** @file
- */
+/* COMPAT_START -- do not remove or edit this comment */
 
-#ifndef ABI_ERRNO_H_
-#define ABI_ERRNO_H_
-
-/**
- * Values in the range [-1, -255] are kernel error codes,
- * values in the range [-256, -512] are user error codes.
- */
-
-#define EOK             0   /* No error */
-#define ENOENT         -1   /* No such entry */
-#define ENOMEM         -2   /* Not enough memory */
-#define ELIMIT         -3   /* Limit exceeded */
-#define EREFUSED       -4   /* Connection refused */
-#define EFORWARD       -5   /* Forward error */
-#define EPERM          -6   /* Permission denied */
-
-/*
- * Answerbox closed connection, call
- * sys_ipc_hangup() to close the connection.
- * Used by answerbox to close the connection.
- */
-#define EHANGUP        -7
-
-/*
- * The other party encountered an error when
- * receiving the call.
- */
-#define EPARTY         -8
-
-#define EEXIST         -9   /* Entry already exists */
-#define EBADMEM        -10  /* Bad memory pointer */
-#define ENOTSUP        -11  /* Not supported */
-#define EADDRNOTAVAIL  -12  /* Address not available. */
-#define ETIMEOUT       -13  /* Timeout expired */
-#define EINVAL         -14  /* Invalid value */
-#define EBUSY          -15  /* Resource is busy */
-#define EOVERFLOW      -16  /* The result does not fit its size. */
-#define EINTR          -17  /* Operation was interrupted. */
-
-#endif
-
-/** @}
- */
+#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: abi/include/abi/errno.in
===================================================================
--- abi/include/abi/errno.in	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
+++ abi/include/abi/errno.in	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
@@ -0,0 +1,116 @@
+__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 db51a6a671d00feb477a7c35b072e80c77fe4a6f)
+++ abi/include/abi/ipc/ipc.h	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
@@ -38,5 +38,5 @@
 /** Length of data being transferred with IPC call
  *
- * The uspace may not be able to utilize full length
+ * The uspace may not be able to utilize the full length
  *
  */
@@ -49,5 +49,5 @@
 
 /** This is answer to a call */
-#define IPC_CALL_ANSWERED  (1 << 0)
+#define IPC_CALL_ANSWERED        (1 << 0)
 
 /** Answer will not be passed to userspace, will be discarded */
@@ -55,8 +55,11 @@
 
 /** Call was forwarded */
-#define IPC_CALL_FORWARDED  (1 << 2)
+#define IPC_CALL_FORWARDED       (1 << 2)
 
 /** Interrupt notification */
-#define IPC_CALL_NOTIF  (1 << 3)
+#define IPC_CALL_NOTIF           (1 << 3)
+
+/** The call was automatically answered by the kernel due to error */
+#define IPC_CALL_AUTO_REPLY      (1 << 4)
 
 /**
@@ -66,23 +69,6 @@
 #define DATA_XFER_LIMIT  (64 * 1024)
 
-
-/** Bits used in call hashes.
- *
- * The addresses are aligned at least to 4 that is why we can use the 2 least
- * significant bits of the call address.
- *
- */
-
-/** Type of this call is 'answer' */
-#define IPC_CALLID_ANSWERED  1
-
-/** Type of this call is 'notification' */
-#define IPC_CALLID_NOTIFICATION  2
-
-/* Return values from sys_ipc_call_async(). */
-#define IPC_CALLRET_FATAL      -1
-
 /* Macros for manipulating calling data */
-#define IPC_SET_RETVAL(data, retval)  ((data).args[0] = (retval))
+#define IPC_SET_RETVAL(data, retval)  ((data).args[0] = (sysarg_t) (retval))
 #define IPC_SET_IMETHOD(data, val)    ((data).args[0] = (val))
 #define IPC_SET_ARG1(data, val)       ((data).args[1] = (val))
@@ -93,5 +79,5 @@
 
 #define IPC_GET_IMETHOD(data)  ((data).args[0])
-#define IPC_GET_RETVAL(data)   ((data).args[0])
+#define IPC_GET_RETVAL(data)   ((errno_t) (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 db51a6a671d00feb477a7c35b072e80c77fe4a6f)
+++ abi/include/abi/ipc/methods.h	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
@@ -36,6 +36,8 @@
 #define ABI_IPC_METHODS_H_
 
+#include <abi/cap.h>
+
 /* Well known phone descriptors */
-#define PHONE_NS  0
+#define PHONE_NS  (CAP_NIL + 1)
 
 /** Kernel IPC interfaces
Index: abi/include/abi/synch.h
===================================================================
--- abi/include/abi/synch.h	(revision db51a6a671d00feb477a7c35b072e80c77fe4a6f)
+++ abi/include/abi/synch.h	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
@@ -46,21 +46,4 @@
 #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
 
