Index: uspace/app/mkfat/mkfat.c
===================================================================
--- uspace/app/mkfat/mkfat.c	(revision fb6f1a5becf4ed481c7d009a226723cae1c82b9d)
+++ uspace/app/mkfat/mkfat.c	(revision 1ccafee9eb7706ba2c3ce30593949116d3e0cce2)
@@ -45,4 +45,5 @@
 #include <byteorder.h>
 #include <sys/types.h>
+#include <sys/typefmt.h>
 #include <inttypes.h>
 #include <errno.h>
@@ -159,6 +160,6 @@
 		printf(NAME ": Warning, failed to obtain block device size.\n");
 	} else {
-		printf(NAME ": Block device has %" PRIu64 " blocks.\n",
-		    (uint64_t) dev_nblocks);
+		printf(NAME ": Block device has %" PRIuBN " blocks.\n",
+		    dev_nblocks);
 		cfg.total_sectors = dev_nblocks;
 	}
Index: uspace/app/taskdump/taskdump.c
===================================================================
--- uspace/app/taskdump/taskdump.c	(revision fb6f1a5becf4ed481c7d009a226723cae1c82b9d)
+++ uspace/app/taskdump/taskdump.c	(revision 1ccafee9eb7706ba2c3ce30593949116d3e0cce2)
@@ -41,4 +41,6 @@
 #include <task.h>
 #include <kernel/mm/as.h>
+#include <sys/types.h>
+#include <sys/typefmt.h>
 #include <libarch/istate.h>
 #include <macros.h>
@@ -93,5 +95,5 @@
 	rc = connect_task(task_id);
 	if (rc < 0) {
-		printf("Failed connecting to task %lld.\n", task_id);
+		printf("Failed connecting to task %" PRIdTASKID ".\n", task_id);
 		return 1;
 	}
@@ -100,5 +102,5 @@
 	app_symtab = NULL;
 
-	printf("Dumping task '%s' (task ID %lld).\n", app_name, task_id);
+	printf("Dumping task '%s' (task ID %" PRIdTASKID ").\n", app_name, task_id);
 	autoload_syms();
 	putchar('\n');
@@ -134,5 +136,5 @@
 	if (rc < 0) {
 		printf("Error connecting\n");
-		printf("ipc_connect_task(%lld) -> %d ", task_id, rc);
+		printf("ipc_connect_task(%" PRIdTASKID ") -> %d ", task_id, rc);
 		return rc;
 	}
Index: uspace/app/trace/ipcp.c
===================================================================
--- uspace/app/trace/ipcp.c	(revision fb6f1a5becf4ed481c7d009a226723cae1c82b9d)
+++ uspace/app/trace/ipcp.c	(revision 1ccafee9eb7706ba2c3ce30593949116d3e0cce2)
@@ -36,4 +36,5 @@
 #include <stdlib.h>
 #include <adt/hash_table.h>
+#include <sys/typefmt.h>
 
 #include "ipc_desc.h"
@@ -200,8 +201,9 @@
 
 	if ((display_mask & DM_IPC) != 0) {
-		printf("Call ID: 0x%lx, phone: %d, proto: %s, method: ", hash,
+		printf("Call ID: %p, phone: %d, proto: %s, method: ", hash,
 			phone, (proto ? proto->name : "n/a"));
 		ipc_m_print(proto, IPC_GET_METHOD(*call));
-		printf(" args: (%lu, %lu, %lu, %lu, %lu)\n", args[1], args[2],
+		printf(" args: (%" PRIuIPCARG ", %" PRIuIPCARG ", %" PRIuIPCARG
+		    ", %" PRIuIPCARG ", %" PRIuIPCARG ")\n", args[1], args[2],
 		    args[3], args[4], args[5]);
 	}
@@ -279,8 +281,10 @@
 
 	if ((display_mask & DM_IPC) != 0) {
-		printf("Response to %p: retval=%ld, args = (%lu, %lu, %lu, %lu, %lu)\n",
-			hash, retval, IPC_GET_ARG1(*answer),
-			IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer),
-			IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
+		printf("Response to %p: retval=%ld, args = (%" PRIuIPCARG
+		    ", %" PRIuIPCARG ", %" PRIuIPCARG ", %" PRIuIPCARG
+		    ", %" PRIuIPCARG ")\n",
+		    hash, retval, IPC_GET_ARG1(*answer),
+		    IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer),
+		    IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
 	}
 
Index: uspace/app/trace/trace.c
===================================================================
--- uspace/app/trace/trace.c	(revision fb6f1a5becf4ed481c7d009a226723cae1c82b9d)
+++ uspace/app/trace/trace.c	(revision 1ccafee9eb7706ba2c3ce30593949116d3e0cce2)
@@ -49,4 +49,6 @@
 #include <io/keycode.h>
 #include <fibril_synch.h>
+#include <sys/types.h>
+#include <sys/typefmt.h>
 
 #include <libc.h>
@@ -159,5 +161,5 @@
 	if (rc < 0) {
 		printf("Error connecting\n");
-		printf("ipc_connect_task(%lld) -> %d ", task_id, rc);
+		printf("ipc_connect_task(%" PRIdTASKID ") -> %d ", task_id, rc);
 		return rc;
 	}
@@ -275,7 +277,7 @@
 
 	putchar('(');
-	if (n > 0) printf("%ld", sc_args[0]);
+	if (n > 0) printf("%" PRIdSYSARG, sc_args[0]);
 	for (i = 1; i < n; i++) {
-		printf(", %ld", sc_args[i]);
+		printf(", %" PRIdSYSARG, sc_args[i]);
 	}
 	putchar(')');
@@ -972,9 +974,9 @@
 	rc = connect_task(task_id);
 	if (rc < 0) {
-		printf("Failed connecting to task %lld.\n", task_id);
+		printf("Failed connecting to task %" PRIdTASKID ".\n", task_id);
 		return 1;
 	}
 
-	printf("Connected to task %lld.\n", task_id);
+	printf("Connected to task %" PRIdTASKID ".\n", task_id);
 
 	if (task_ldr != NULL)
Index: uspace/lib/libc/include/sys/typefmt.h
===================================================================
--- uspace/lib/libc/include/sys/typefmt.h	(revision 1ccafee9eb7706ba2c3ce30593949116d3e0cce2)
+++ uspace/lib/libc/include/sys/typefmt.h	(revision 1ccafee9eb7706ba2c3ce30593949116d3e0cce2)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * 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 libc
+ * @{
+ */
+/** @file Formatting macros for types from sys/types.h and some other
+ * system types.
+ */
+
+#ifndef LIBC_SYS_TYPEFMT_H_
+#define LIBC_SYS_TYPEFMT_H_
+
+#include <inttypes.h>
+
+/* off_t */
+#define PRIdOFF "ld"
+#define PRIuOFF "lu"
+#define PRIxOFF "lx"
+#define PRIXOFF "lX"
+
+/* bn_t */
+#define PRIdBN PRId64
+#define PRIuBN PRIu64
+#define PRIxBN PRIx64
+#define PRIXBN PRIX64
+
+/* (s)size_t */
+#define PRIdSIZE PRIdPTR
+#define PRIuSIZE PRIuPTR
+#define PRIxSIZE PRIxPTR
+#define PRIXSIZE PRIXPTR
+
+/* sysarg_t */
+#define PRIdSYSARG PRIdPTR
+#define PRIuSYSARG PRIuPTR
+#define PRIxSYSARG PRIxPTR
+#define PRIXSYSARG PRIxPTR
+
+/* ipcarg_t */
+#define PRIdIPCARG PRIdPTR
+#define PRIuIPCARG PRIuPTR
+#define PRIxIPCARG PRIxPTR
+#define PRIXIPCARG PRIXPTR
+
+/* taskid_t */
+#define PRIdTASKID PRId64
+#define PRIuTASKID PRIu64
+#define PRIxTASKID PRIx64
+#define PRIXTASKID PRIx64
+
+#endif
+
+/** @}
+ */
Index: uspace/srv/bd/part/guid_part/guid_part.c
===================================================================
--- uspace/srv/bd/part/guid_part/guid_part.c	(revision fb6f1a5becf4ed481c7d009a226723cae1c82b9d)
+++ uspace/srv/bd/part/guid_part/guid_part.c	(revision 1ccafee9eb7706ba2c3ce30593949116d3e0cce2)
@@ -54,4 +54,5 @@
 #include <devmap.h>
 #include <sys/types.h>
+#include <sys/typefmt.h>
 #include <inttypes.h>
 #include <libblock.h>
@@ -198,5 +199,5 @@
 		    / (1024 * 1024);
 		printf(NAME ": Registered device %s: %" PRIu64 " blocks "
-		    "%" PRIu64 " MB.\n", name, (uint64_t) part->length, size_mb);
+		    "%" PRIuBN " MB.\n", name, part->length, size_mb);
 
 		part->dev = dev;
Index: uspace/srv/bd/part/mbr_part/mbr_part.c
===================================================================
--- uspace/srv/bd/part/mbr_part/mbr_part.c	(revision fb6f1a5becf4ed481c7d009a226723cae1c82b9d)
+++ uspace/srv/bd/part/mbr_part/mbr_part.c	(revision 1ccafee9eb7706ba2c3ce30593949116d3e0cce2)
@@ -64,4 +64,5 @@
 #include <devmap.h>
 #include <sys/types.h>
+#include <sys/typefmt.h>
 #include <inttypes.h>
 #include <libblock.h>
@@ -248,7 +249,6 @@
 		size_mb = (part->length * block_size + 1024 * 1024 - 1)
 		    / (1024 * 1024);
-		printf(NAME ": Registered device %s: %" PRIu64 " blocks "
-		    "%" PRIu64 " MB.\n",
-		    name, (uint64_t) part->length, size_mb);
+		printf(NAME ": Registered device %s: %" PRIuBN " blocks "
+		    "%" PRIu64 " MB.\n", name, part->length, size_mb);
 
 		part->dev = dev;
@@ -336,5 +336,6 @@
 		rc = block_read_direct(indev_handle, ba, 1, brb);
 		if (rc != EOK) {
-			printf(NAME ": Failed reading EBR block at %u.\n", ba);
+			printf(NAME ": Failed reading EBR block at %"
+			    PRIu32 ".\n", ba);
 			return rc;
 		}
Index: uspace/srv/taskmon/taskmon.c
===================================================================
--- uspace/srv/taskmon/taskmon.c	(revision fb6f1a5becf4ed481c7d009a226723cae1c82b9d)
+++ uspace/srv/taskmon/taskmon.c	(revision 1ccafee9eb7706ba2c3ce30593949116d3e0cce2)
@@ -39,4 +39,5 @@
 #include <async.h>
 #include <ipc/services.h>
+#include <sys/typefmt.h>
 #include <task.h>
 #include <event.h>
@@ -60,15 +61,15 @@
 	thread = IPC_GET_ARG3(*call);
 
-	if (asprintf(&s_taskid, "%lld", taskid) < 0) {
+	if (asprintf(&s_taskid, "%" PRIuTASKID, taskid) < 0) {
 		printf("Memory allocation failed.\n");
 		return;
 	}
 
-	if (asprintf(&dump_fname, "/scratch/d%lld.txt", taskid) < 0) {
+	if (asprintf(&dump_fname, "/scratch/d" PRIuTASKID ".txt", taskid) < 0) {
 		printf("Memory allocation failed.\n");
 		return;
 	}
 
-	printf(NAME ": Task %lld fault in thread %p.\n", taskid, thread);
+	printf(NAME ": Task %" PRIuTASKID " fault in thread %p.\n", taskid, thread);
 
 #ifdef CONFIG_VERBOSE_DUMPS
