Index: uspace/lib/c/generic/io/io.c
===================================================================
--- uspace/lib/c/generic/io/io.c	(revision 5e6b76d1ba700e44a86813ab3a573920a45bc548)
+++ uspace/lib/c/generic/io/io.c	(revision ef84413529b8e88f0e34e6823b1f70331a1d72f4)
@@ -911,6 +911,8 @@
 
 	/* The native position is too large for the C99-ish interface. */
-	if (off > LONG_MAX)
-		return EOF;
+	if (off > LONG_MAX) {
+		errno = EOVERFLOW;
+		return -1;
+	}
 
 	return off;
Index: uspace/lib/posix/include/posix/stdio.h
===================================================================
--- uspace/lib/posix/include/posix/stdio.h	(revision 5e6b76d1ba700e44a86813ab3a573920a45bc548)
+++ uspace/lib/posix/include/posix/stdio.h	(revision ef84413529b8e88f0e34e6823b1f70331a1d72f4)
@@ -61,6 +61,23 @@
     FILE *__restrict__ stream);
 
+#ifdef _LARGEFILE64_SOURCE
+extern int fseeko64(FILE *stream, off64_t offset, int whence);
+extern off64_t ftello64(FILE *stream);
+#endif
+
+#if _FILE_OFFSET_BITS == 64 && LONG_MAX == INT_MAX
+#ifdef __GNUC__
+extern int fseeko(FILE *stream, off_t offset, int whence) __asm__("fseeko64");
+extern off_t ftello(FILE *stream) __asm__("ftello64");
+#else
+extern int fseeko64(FILE *stream, off_t offset, int whence);
+extern off_t ftello64(FILE *stream);
+#define fseeko fseeko64
+#define ftello ftello64
+#endif
+#else
 extern int fseeko(FILE *stream, off_t offset, int whence);
 extern off_t ftello(FILE *stream);
+#endif
 
 /* Formatted Output */
Index: uspace/lib/posix/include/posix/unistd.h
===================================================================
--- uspace/lib/posix/include/posix/unistd.h	(revision 5e6b76d1ba700e44a86813ab3a573920a45bc548)
+++ uspace/lib/posix/include/posix/unistd.h	(revision ef84413529b8e88f0e34e6823b1f70331a1d72f4)
@@ -81,5 +81,4 @@
 extern ssize_t write(int fildes, const void *buf, size_t nbyte);
 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);
@@ -89,18 +88,20 @@
 #ifdef _LARGEFILE64_SOURCE
 extern off64_t lseek64(int fildes, off64_t offset, int whence);
+extern int ftruncate64(int fildes, off64_t length);
 #endif
 
-#if _FILE_OFFSET_BITS == 64
-static inline off_t lseek(int fildes, off_t offset, int whence)
-{
-	/* Declarations visible in this function body only. */
-	typedef int64_t off64_t;
-	extern off64_t lseek64(int fildes, off64_t offset, int whence);
-
-	/* With _FILE_OFFSET_BITS == 64, lseek is actually lseek64. */
-	return lseek64(fildes, offset, whence);
-}
+#if _FILE_OFFSET_BITS == 64 && LONG_MAX == INT_MAX
+#ifdef __GNUC__
+extern off_t lseek(int fildes, off_t offset, int whence) __asm__("lseek64");
+extern int ftruncate(int fildes, off_t length) __asm__("ftruncate64");
+#else
+extern off_t lseek64(int fildes, off_t offset, int whence);
+extern int ftruncate64(int fildes, off_t length);
+#define lseek lseek64
+#define ftruncate ftruncate64
+#endif
 #else
 extern off_t lseek(int fildes, off_t offset, int whence);
+extern int ftruncate(int fildes, off_t length);
 #endif
 
Index: uspace/lib/posix/src/stdio.c
===================================================================
--- uspace/lib/posix/src/stdio.c	(revision 5e6b76d1ba700e44a86813ab3a573920a45bc548)
+++ uspace/lib/posix/src/stdio.c	(revision ef84413529b8e88f0e34e6823b1f70331a1d72f4)
@@ -34,4 +34,7 @@
 /** @file Standard buffered input/output.
  */
+
+#define _LARGEFILE64_SOURCE
+#undef _FILE_OFFSET_BITS
 
 #include "internal/common.h"
@@ -181,5 +184,5 @@
 int fseeko(FILE *stream, off_t offset, int whence)
 {
-	return fseek64(stream, offset, whence);
+	return fseek(stream, offset, whence);
 }
 
@@ -191,4 +194,14 @@
  */
 off_t ftello(FILE *stream)
+{
+	return ftell(stream);
+}
+
+int fseeko64(FILE *stream, off64_t offset, int whence)
+{
+	return fseek64(stream, offset, whence);
+}
+
+off64_t ftello64(FILE *stream)
 {
 	return ftell64(stream);
Index: uspace/lib/posix/src/unistd.c
===================================================================
--- uspace/lib/posix/src/unistd.c	(revision 5e6b76d1ba700e44a86813ab3a573920a45bc548)
+++ uspace/lib/posix/src/unistd.c	(revision ef84413529b8e88f0e34e6823b1f70331a1d72f4)
@@ -302,8 +302,8 @@
 off_t lseek(int fildes, off_t offset, int whence)
 {
-#if LONG_MAX == INT64_MAX
+#if LONG_MAX == INT_MAX
+	return _lseek(fildes, offset, LONG_MAX, whence);
+#else
 	return _lseek64(fildes, offset, whence);
-#else
-	return _lseek(fildes, offset, LONG_MAX, whence);
 #endif
 }
@@ -331,4 +331,9 @@
  */
 int ftruncate(int fildes, off_t length)
+{
+	return ftruncate64(fildes, length);
+}
+
+int ftruncate64(int fildes, off64_t length)
 {
 	if (failed(vfs_resize(fildes, (aoff64_t) length)))
