Index: uspace/lib/posix/string.c
===================================================================
--- uspace/lib/posix/string.c	(revision 0d33863d705067aed57e3fc251c1ecc113725b7f)
+++ uspace/lib/posix/string.c	(revision 1b55da67c103f3bbbc927e619fb140a5ba708ac8)
@@ -553,9 +553,89 @@
 char *posix_strerror(int errnum)
 {
-	/* Uses function from libc, we just have to negate errno
-	 * (POSIX uses positive errorcodes, HelenOS has negative).
-	 */
-	// FIXME: not all POSIX error codes are in libc
-	return (char *) str_error(-posix_abs(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)];
 }
 
@@ -573,8 +653,7 @@
 	
 	char *errstr = posix_strerror(errnum);
-	/* HelenOS str_error can't fail */
 	
 	if (posix_strlen(errstr) + 1 > bufsz) {
-		return -ERANGE;
+		return ERANGE;
 	} else {
 		posix_strcpy(buf, errstr);
