Index: uspace/lib/c/generic/async.c
===================================================================
--- uspace/lib/c/generic/async.c	(revision cde999aca79219e8751af76502001a86d411d176)
+++ uspace/lib/c/generic/async.c	(revision a53ed3a8097360ccf174e8d94fb407db919eb66a)
@@ -205,5 +205,5 @@
 	ipc_call_t *dataptr;
 	
-	int retval;
+	errno_t retval;
 } amsg_t;
 
@@ -511,5 +511,5 @@
 static FIBRIL_CONDVAR_INITIALIZE(avail_phone_cv);
 
-int async_create_port(iface_t iface, async_port_handler_t handler,
+errno_t async_create_port(iface_t iface, async_port_handler_t handler,
     void *data, port_id_t *port_id)
 {
@@ -698,5 +698,5 @@
  *
  */
-static int connection_fibril(void *arg)
+static errno_t connection_fibril(void *arg)
 {
 	assert(arg);
@@ -847,5 +847,5 @@
  *
  */
-int async_create_callback_port(async_exch_t *exch, iface_t iface, sysarg_t arg1,
+errno_t 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);
 	
-	int ret;
+	errno_t ret;
 	async_wait_for(req, &ret);
 	if (ret != EOK)
-		return (int) ret;
+		return (errno_t) ret;
 	
 	sysarg_t phone_hash = IPC_GET_ARG5(answer);
@@ -1056,5 +1056,5 @@
  *
  */
-int async_irq_subscribe(int inr, async_notification_handler_t handler,
+errno_t async_irq_subscribe(int inr, async_notification_handler_t handler,
     void *data, const irq_code_t *ucode, cap_handle_t *handle)
 {
@@ -1078,5 +1078,5 @@
 	
 	cap_handle_t cap;
-	int rc = ipc_irq_subscribe(inr, imethod, ucode, &cap);
+	errno_t rc = ipc_irq_subscribe(inr, imethod, ucode, &cap);
 	if (rc == EOK && handle != NULL) {
 		*handle = cap;
@@ -1092,5 +1092,5 @@
  *
  */
-int async_irq_unsubscribe(int cap)
+errno_t async_irq_unsubscribe(int cap)
 {
 	// TODO: Remove entry from hash table
@@ -1109,5 +1109,5 @@
  *
  */
-int async_event_subscribe(event_type_t evno,
+errno_t async_event_subscribe(event_type_t evno,
     async_notification_handler_t handler, void *data)
 {
@@ -1142,5 +1142,5 @@
  *
  */
-int async_event_task_subscribe(event_task_type_t evno,
+errno_t async_event_task_subscribe(event_task_type_t evno,
     async_notification_handler_t handler, void *data)
 {
@@ -1173,5 +1173,5 @@
  *
  */
-int async_event_unmask(event_type_t evno)
+errno_t async_event_unmask(event_type_t evno)
 {
 	return ipc_event_unmask(evno);
@@ -1185,5 +1185,5 @@
  *
  */
-int async_event_task_unmask(event_task_type_t evno)
+errno_t async_event_task_unmask(event_task_type_t evno)
 {
 	return ipc_event_task_unmask(evno);
@@ -1437,5 +1437,5 @@
  *
  */
-static int async_manager_worker(void)
+static errno_t async_manager_worker(void)
 {
 	while (true) {
@@ -1489,5 +1489,5 @@
 		
 		ipc_call_t call;
-		int rc = ipc_wait_cycle(&call, timeout, flags);
+		errno_t rc = ipc_wait_cycle(&call, timeout, flags);
 		
 		atomic_dec(&threads_in_ipc_wait);
@@ -1521,5 +1521,5 @@
  *
  */
-static int async_manager_fibril(void *arg)
+static errno_t async_manager_fibril(void *arg)
 {
 	futex_up(&async_futex);
@@ -1597,5 +1597,5 @@
  *
  */
-void reply_received(void *arg, int retval, ipc_call_t *data)
+void reply_received(void *arg, errno_t retval, ipc_call_t *data)
 {
 	assert(arg);
@@ -1709,5 +1709,5 @@
  *
  */
-void async_wait_for(aid_t amsgid, int *retval)
+void async_wait_for(aid_t amsgid, errno_t *retval)
 {
 	assert(amsgid);
@@ -1755,5 +1755,5 @@
  *
  */
-int async_wait_timeout(aid_t amsgid, int *retval, suseconds_t timeout)
+errno_t async_wait_timeout(aid_t amsgid, errno_t *retval, suseconds_t timeout)
 {
 	assert(amsgid);
@@ -1918,5 +1918,5 @@
  *
  */
-int async_req_fast(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
+errno_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)
@@ -1929,5 +1929,5 @@
 	    &result);
 	
-	int rc;
+	errno_t rc;
 	async_wait_for(aid, &rc);
 	
@@ -1970,5 +1970,5 @@
  *
  */
-int async_req_slow(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
+errno_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)
@@ -1981,5 +1981,5 @@
 	    &result);
 	
-	int rc;
+	errno_t rc;
 	async_wait_for(aid, &rc);
 	
@@ -2045,15 +2045,15 @@
 }
 
-int async_answer_0(cap_handle_t chandle, int retval)
+errno_t async_answer_0(cap_handle_t chandle, errno_t retval)
 {
 	return ipc_answer_0(chandle, retval);
 }
 
-int async_answer_1(cap_handle_t chandle, int retval, sysarg_t arg1)
+errno_t async_answer_1(cap_handle_t chandle, errno_t retval, sysarg_t arg1)
 {
 	return ipc_answer_1(chandle, retval, arg1);
 }
 
-int async_answer_2(cap_handle_t chandle, int retval, sysarg_t arg1,
+errno_t async_answer_2(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
     sysarg_t arg2)
 {
@@ -2061,5 +2061,5 @@
 }
 
-int async_answer_3(cap_handle_t chandle, int retval, sysarg_t arg1,
+errno_t async_answer_3(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
     sysarg_t arg2, sysarg_t arg3)
 {
@@ -2067,5 +2067,5 @@
 }
 
-int async_answer_4(cap_handle_t chandle, int retval, sysarg_t arg1,
+errno_t async_answer_4(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
 {
@@ -2073,5 +2073,5 @@
 }
 
-int async_answer_5(cap_handle_t chandle, int retval, sysarg_t arg1,
+errno_t async_answer_5(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
 {
@@ -2079,5 +2079,5 @@
 }
 
-int async_forward_fast(cap_handle_t chandle, async_exch_t *exch,
+errno_t async_forward_fast(cap_handle_t chandle, async_exch_t *exch,
     sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
 {
@@ -2088,5 +2088,5 @@
 }
 
-int async_forward_slow(cap_handle_t chandle, async_exch_t *exch,
+errno_t 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)
@@ -2111,5 +2111,5 @@
  *
  */
-int async_connect_to_me(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
+errno_t async_connect_to_me(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
     sysarg_t arg3)
 {
@@ -2121,13 +2121,13 @@
 	    &answer);
 	
-	int rc;
+	errno_t rc;
 	async_wait_for(req, &rc);
 	if (rc != EOK)
-		return (int) rc;
+		return (errno_t) rc;
 	
 	return EOK;
 }
 
-static int async_connect_me_to_internal(int phone, sysarg_t arg1, sysarg_t arg2,
+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)
 {
@@ -2148,5 +2148,5 @@
 	    msg, reply_received);
 	
-	int rc;
+	errno_t rc;
 	async_wait_for((aid_t) msg, &rc);
 	
@@ -2186,5 +2186,5 @@
 	
 	int phone;
-	int rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,
+	errno_t rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,
 	    0, &phone);
 	if (rc != EOK) {
@@ -2239,5 +2239,5 @@
 	
 	int phone;
-	int rc = async_connect_me_to_internal(exch->phone, iface, arg2,
+	errno_t rc = async_connect_me_to_internal(exch->phone, iface, arg2,
 	    arg3, 0, &phone);
 	if (rc != EOK) {
@@ -2310,5 +2310,5 @@
 	
 	int phone;
-	int rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,
+	errno_t rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,
 	    IPC_FLAG_BLOCKING, &phone);
 	
@@ -2364,5 +2364,5 @@
 	
 	int phone;
-	int rc = async_connect_me_to_internal(exch->phone, iface, arg2,
+	errno_t rc = async_connect_me_to_internal(exch->phone, iface, arg2,
 	    arg3, IPC_FLAG_BLOCKING, &phone);
 	if (rc != EOK) {
@@ -2400,5 +2400,5 @@
 	
 	cap_handle_t phone;
-	int rc = ipc_connect_kbox(id, &phone);
+	errno_t rc = ipc_connect_kbox(id, &phone);
 	if (rc != EOK) {
 		errno = rc;
@@ -2424,5 +2424,5 @@
 }
 
-static int async_hangup_internal(int phone)
+static errno_t async_hangup_internal(int phone)
 {
 	return ipc_hangup(phone);
@@ -2436,5 +2436,5 @@
  *
  */
-int async_hangup(async_sess_t *sess)
+errno_t async_hangup(async_sess_t *sess)
 {
 	async_exch_t *exch;
@@ -2447,5 +2447,5 @@
 	fibril_mutex_lock(&async_sess_mutex);
 	
-	int rc = async_hangup_internal(sess->phone);
+	errno_t rc = async_hangup_internal(sess->phone);
 	
 	while (!list_empty(&sess->exch_list)) {
@@ -2519,5 +2519,5 @@
 		} else if (mgmt == EXCHANGE_PARALLEL) {
 			int phone;
-			int rc;
+			errno_t rc;
 			
 		retry:
@@ -2616,5 +2616,5 @@
  *
  */
-int async_share_in_start(async_exch_t *exch, size_t size, sysarg_t arg,
+errno_t async_share_in_start(async_exch_t *exch, size_t size, sysarg_t arg,
     unsigned int *flags, void **dst)
 {
@@ -2624,5 +2624,5 @@
 	sysarg_t _flags = 0;
 	sysarg_t _dst = (sysarg_t) -1;
-	int res = async_req_2_4(exch, IPC_M_SHARE_IN, (sysarg_t) size,
+	errno_t res = async_req_2_4(exch, IPC_M_SHARE_IN, (sysarg_t) size,
 	    arg, NULL, &_flags, NULL, &_dst);
 	
@@ -2676,5 +2676,5 @@
  *
  */
-int async_share_in_finalize(cap_handle_t chandle, void *src, unsigned int flags)
+errno_t 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,
@@ -2691,5 +2691,5 @@
  *
  */
-int async_share_out_start(async_exch_t *exch, void *src, unsigned int flags)
+errno_t async_share_out_start(async_exch_t *exch, void *src, unsigned int flags)
 {
 	if (exch == NULL)
@@ -2746,5 +2746,5 @@
  *
  */
-int async_share_out_finalize(cap_handle_t chandle, void **dst)
+errno_t async_share_out_finalize(cap_handle_t chandle, void **dst)
 {
 	return ipc_answer_2(chandle, EOK, (sysarg_t) __entry, (sysarg_t) dst);
@@ -2777,5 +2777,5 @@
  *
  */
-int async_data_read_start(async_exch_t *exch, void *dst, size_t size)
+errno_t async_data_read_start(async_exch_t *exch, void *dst, size_t size)
 {
 	if (exch == NULL)
@@ -2851,5 +2851,5 @@
  *
  */
-int async_data_read_finalize(cap_handle_t chandle, const void *src, size_t size)
+errno_t 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);
@@ -2859,5 +2859,5 @@
  *
  */
-int async_data_read_forward_fast(async_exch_t *exch, sysarg_t imethod,
+errno_t 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)
@@ -2879,5 +2879,5 @@
 	}
 	
-	int retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,
+	errno_t retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,
 	    IPC_FF_ROUTE_FROM_ME);
 	if (retval != EOK) {
@@ -2887,8 +2887,8 @@
 	}
 	
-	int rc;
+	errno_t rc;
 	async_wait_for(msg, &rc);
 	
-	return (int) rc;
+	return (errno_t) rc;
 }
 
@@ -2902,5 +2902,5 @@
  *
  */
-int async_data_write_start(async_exch_t *exch, const void *src, size_t size)
+errno_t async_data_write_start(async_exch_t *exch, const void *src, size_t size)
 {
 	if (exch == NULL)
@@ -2976,5 +2976,5 @@
  *
  */
-int async_data_write_finalize(cap_handle_t chandle, void *dst, size_t size)
+errno_t 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);
@@ -3002,5 +3002,5 @@
  *
  */
-int async_data_write_accept(void **data, const bool nullterm,
+errno_t 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)
@@ -3042,5 +3042,5 @@
 	}
 	
-	int rc = async_data_write_finalize(chandle, arg_data, size);
+	errno_t rc = async_data_write_finalize(chandle, arg_data, size);
 	if (rc != EOK) {
 		free(arg_data);
@@ -3065,5 +3065,5 @@
  *
  */
-void async_data_write_void(int retval)
+void async_data_write_void(errno_t retval)
 {
 	cap_handle_t chandle;
@@ -3075,5 +3075,5 @@
  *
  */
-int async_data_write_forward_fast(async_exch_t *exch, sysarg_t imethod,
+errno_t 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)
@@ -3095,5 +3095,5 @@
 	}
 	
-	int retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,
+	errno_t retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,
 	    IPC_FF_ROUTE_FROM_ME);
 	if (retval != EOK) {
@@ -3103,8 +3103,8 @@
 	}
 	
-	int rc;
+	errno_t rc;
 	async_wait_for(msg, &rc);
 	
-	return (int) rc;
+	return (errno_t) rc;
 }
 
@@ -3200,5 +3200,5 @@
 }
 
-int async_state_change_start(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
+errno_t async_state_change_start(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
     sysarg_t arg3, async_exch_t *other_exch)
 {
@@ -3228,5 +3228,5 @@
 }
 
-int async_state_change_finalize(cap_handle_t chandle, async_exch_t *other_exch)
+errno_t async_state_change_finalize(cap_handle_t chandle, async_exch_t *other_exch)
 {
 	return ipc_answer_1(chandle, EOK, other_exch->phone);
