Index: uspace/app/bdsh/cmds/modules/cat/cat.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 38d150e6238ab44c861f6486e46454e07caeb0f0)
+++ uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 82d515e917f3eeeff253e4aa30e493f5f632c950)
@@ -180,10 +180,12 @@
     off64_t head, off64_t tail, bool tail_first)
 {
-	int fd, bytes = 0, count = 0, reads = 0;
+	int fd, count = 0, reads = 0;
+	size_t bytes;
 	char *buff = NULL;
-	int i;
+	size_t i;
 	size_t offset = 0, copied_bytes = 0;
 	off64_t file_size = 0, length = 0;
 	aoff64_t pos = 0;
+	int rc;
 
 	bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0);
@@ -250,8 +252,9 @@
 		}
 		
-		bytes = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read);
+		rc = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read,
+		    &bytes);
 		copied_bytes = 0;
 
-		if (bytes > 0) {
+		if (rc == EOK && bytes > 0) {
 			buff[bytes] = '\0';
 			offset = 0;
@@ -284,8 +287,8 @@
 		if (reading_stdin)
 			fflush(stdout);
-	} while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));
+	} while (rc == EOK && bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));
 
 	vfs_put(fd);
-	if (bytes == -1) {
+	if (rc != EOK) {
 		printf("Error reading %s\n", fname);
 		free(buff);
Index: uspace/app/bdsh/cmds/modules/cmp/cmp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cmp/cmp.c	(revision 38d150e6238ab44c861f6486e46454e07caeb0f0)
+++ uspace/app/bdsh/cmds/modules/cmp/cmp.c	(revision 82d515e917f3eeeff253e4aa30e493f5f632c950)
@@ -72,9 +72,9 @@
 static int cmp_files(const char *fn0, const char *fn1)
 {
-	int rc = 0;
+	int rc = EOK;
 	const char *fn[2] = {fn0, fn1};
 	int fd[2] = {-1, -1};
 	char buffer[2][CMP_BUFLEN];
-	ssize_t offset[2];
+	size_t offset[2];
 	aoff64_t pos[2] = {};
 
@@ -90,22 +90,16 @@
 	do {
 		for (int i = 0; i < 2; i++) {
-			offset[i] = 0;
-			ssize_t size;
-			do {
-				size = vfs_read(fd[i], &pos[i],
-				    buffer[i] + offset[i],
-				    CMP_BUFLEN - offset[i]);
-				if (size < 0) {
-					rc = size;
-					printf("Error reading from %s\n",
-					    fn[i]);
-					goto end;
-				}
-				offset[i] += size;
-			} while (size && offset[i] < CMP_BUFLEN);
+			rc = vfs_read(fd[i], &pos[i], buffer[i], CMP_BUFLEN,
+			    &offset[i]);
+			if (rc != EOK) {
+				printf("Error reading from %s\n",
+				    fn[i]);
+				goto end;
+			}
 		}
 
 		if (offset[0] != offset[1] ||
 		    memcmp(buffer[0], buffer[1], offset[0]) != 0) {
+			printf("Return 1\n");
 			rc = 1;
 			goto end;
@@ -149,5 +143,5 @@
 
 	rc = cmp_files(argv[optind], argv[optind + 1]);
-	if (rc)
+	if (rc != EOK)
 		return CMD_FAILURE;
 	else
Index: uspace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 38d150e6238ab44c861f6486e46454e07caeb0f0)
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 82d515e917f3eeeff253e4aa30e493f5f632c950)
@@ -66,5 +66,5 @@
 } dentry_type_t;
 
-static int64_t copy_file(const char *src, const char *dest,
+static int copy_file(const char *src, const char *dest,
     size_t blen, int vb);
 
@@ -175,8 +175,8 @@
 }
 
-static int64_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)
 {
-	int r = -1;
+	int rc = EOK;
 	char dest_path[PATH_MAX];
 	char src_path[PATH_MAX];
@@ -217,4 +217,5 @@
 				printf("The dest directory %s does not exists",
 				    dest_path);
+				rc = ENOENT;
 				goto exit;
 			}
@@ -224,4 +225,5 @@
 			printf("Cannot overwrite existing directory %s\n",
 			    dest_path);
+			rc = EEXIST;
 			goto exit;
 		} else if (dest_type == TYPE_FILE) {
@@ -233,5 +235,6 @@
 			 */
 			if (force && !interactive) {
-				if (vfs_unlink_path(dest_path) != EOK) {
+				rc = vfs_unlink_path(dest_path);
+				if (rc != EOK) {
 					printf("Unable to remove %s\n",
 					    dest_path);
@@ -244,5 +247,6 @@
 				if (overwrite) {
 					printf("Overwriting file: %s\n", dest_path);
-					if (vfs_unlink_path(dest_path) != EOK) {
+					rc = vfs_unlink_path(dest_path);
+					if (rc != EOK) {
 						printf("Unable to remove %s\n", dest_path);
 						goto exit;
@@ -250,9 +254,10 @@
 				} else {
 					printf("Not overwriting file: %s\n", dest_path);
-					r = 0;
+					rc = EOK;
 					goto exit;
 				}
 			} else {
 				printf("File already exists: %s\n", dest_path);
+				rc = EEXIST;
 				goto exit;
 			}
@@ -260,5 +265,5 @@
 
 		/* call copy_file and exit */
-		r = (copy_file(src, dest_path, blen, vb) < 0);
+		rc = (copy_file(src, dest_path, blen, vb) < 0);
 
 	} else if (src_type == TYPE_DIR) {
@@ -268,7 +273,9 @@
 			printf("Cannot copy the %s directory without the "
 			    "-r option\n", src);
+			rc = EINVAL;
 			goto exit;
 		} else if (dest_type == TYPE_FILE) {
 			printf("Cannot overwrite a file with a directory\n");
+			rc = EEXIST;
 			goto exit;
 		}
@@ -293,6 +300,7 @@
 				merge_paths(dest_path, PATH_MAX, src_dirname);
 
-				if (vfs_link_path(dest_path, KIND_DIRECTORY,
-				    NULL) != EOK) {
+				rc = vfs_link_path(dest_path, KIND_DIRECTORY,
+				    NULL);
+				if (rc != EOK) {
 					printf("Unable to create "
 					    "dest directory %s\n", dest_path);
@@ -308,6 +316,6 @@
 			 * e.g. cp -r /src /data/new_dir_src
 			 */
-			if (vfs_link_path(dest_path, KIND_DIRECTORY,
-			    NULL) != EOK) {
+			rc = vfs_link_path(dest_path, KIND_DIRECTORY, NULL);
+			if (rc != EOK) {
 				printf("Unable to create "
 				    "dest directory %s\n", dest_path);
@@ -321,4 +329,5 @@
 			/* Something strange is happening... */
 			printf("Unable to open src %s directory\n", src);
+			rc = ENOENT;
 			goto exit;
 		}
@@ -348,4 +357,5 @@
 				printf("Cannot copy a directory "
 				    "into itself\n");
+				rc = EEXIST;
 				goto exit;
 			}
@@ -355,7 +365,7 @@
 
 			/* Recursively call do_copy() */
-			r = do_copy(src_dent, dest_dent, blen, vb, recursive,
+			rc = do_copy(src_dent, dest_dent, blen, vb, recursive,
 			    force, interactive);
-			if (r)
+			if (rc != EOK)
 				goto exit;
 
@@ -367,13 +377,14 @@
 	if (dir)
 		closedir(dir);
-	return r;
-}
-
-static int64_t copy_file(const char *src, const char *dest,
+	return rc;
+}
+
+static int copy_file(const char *src, const char *dest,
 	size_t blen, int vb)
 {
-	int fd1, fd2, bytes;
+	int fd1, fd2;
+	size_t rbytes, wbytes;
+	int rc;
 	off64_t total;
-	int64_t copied = 0;
 	char *buff = NULL;
 	aoff64_t posr = 0, posw = 0;
@@ -410,17 +421,17 @@
 		printf("Unable to allocate enough memory to read %s\n",
 		    src);
-		copied = -1;
+		rc = ENOMEM;
 		goto out;
 	}
 
-	while ((bytes = vfs_read(fd1, &posr, buff, blen)) > 0) {
-		if ((bytes = vfs_write(fd2, &posw, buff, bytes)) < 0)
-			break;
-		copied += bytes;
-	}
-
-	if (bytes < 0) {
-		printf("\nError copying %s, (%d)\n", src, bytes);
-		copied = bytes;
+	while ((rc = vfs_read(fd1, &posr, buff, blen, &rbytes)) == EOK &&
+	    rbytes > 0) {
+		if ((rc = vfs_write(fd2, &posw, buff, rbytes, &wbytes)) != EOK)
+			break;
+	}
+
+	if (rc != EOK) {
+		printf("\nError copying %s, (%d)\n", src, rc);
+		return rc;
 	}
 
@@ -430,5 +441,5 @@
 	if (buff)
 		free(buff);
-	return copied;
+	return rc;
 }
 
Index: uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mkfile/mkfile.c	(revision 38d150e6238ab44c861f6486e46454e07caeb0f0)
+++ uspace/app/bdsh/cmds/modules/mkfile/mkfile.c	(revision 82d515e917f3eeeff253e4aa30e493f5f632c950)
@@ -85,17 +85,20 @@
  *
  * @param str	String containing the size specification.
- * @return	Non-negative size in bytes on success, -1 on failure.
+ * @param rsize	Place to store size in bytes
+ * @return	EOK on success or error code
  */
-static ssize_t read_size(const char *str)
+static int read_size(const char *str, size_t *rsize)
 {
-	ssize_t number, unit;
+	size_t number, unit;
 	char *ep;
 
 	number = strtol(str, &ep, 10);
-	if (ep[0] == '\0')
-		return number;
+	if (ep[0] == '\0') {
+		*rsize = number;
+		return EOK;
+	}
 
 	if (ep[1] != '\0')
-		    return -1;
+		    return EINVAL;
 
 	switch (tolower(ep[0])) {
@@ -103,8 +106,9 @@
 	case 'm': unit = 1024*1024; break;
 	case 'g': unit = 1024*1024*1024; break;
-	default: return -1;
-	}
-
-	return number * unit;
+	default: return EINVAL;
+	}
+
+	*rsize = number * unit;
+	return EOK;
 }
 
@@ -114,7 +118,9 @@
 	int c, opt_ind;
 	int fd;
-	ssize_t file_size;
-	ssize_t total_written;
-	ssize_t to_write, rc, rc2 = 0;
+	size_t file_size;
+	size_t total_written;
+	size_t to_write;
+	size_t nwritten;
+	int rc;
 	char *file_name;
 	void *buffer;
@@ -136,6 +142,6 @@
 			break;
 		case 's':
-			file_size = read_size(optarg);
-			if (file_size < 0) {
+			rc = read_size(optarg, &file_size);
+			if (rc != EOK) {
 				printf("%s: Invalid file size specification.\n",
 				    cmdname);
@@ -166,6 +172,6 @@
 		
 		pos = file_size - 1;
-		rc2 = vfs_write(fd, &pos, &byte, sizeof(char));
-		if (rc2 < 0) {
+		rc = vfs_write(fd, &pos, &byte, sizeof(char), &nwritten);
+		if (rc != EOK) {
 			vfs_put(fd);
 			goto error;
@@ -183,6 +189,6 @@
 	while (total_written < file_size) {
 		to_write = min(file_size - total_written, BUFFER_SIZE);
-		rc = vfs_write(fd, &pos, buffer, to_write);
-		if (rc <= 0) {
+		rc = vfs_write(fd, &pos, buffer, to_write, &nwritten);
+		if (rc != EOK) {
 			printf("%s: Error writing file (%d).\n", cmdname, errno);
 			vfs_put(fd);
@@ -190,5 +196,5 @@
 			return CMD_FAILURE;
 		}
-		total_written += rc;
+		total_written += nwritten;
 	}
 
