Index: uspace/app/taskdump/elf_core.c
===================================================================
--- uspace/app/taskdump/elf_core.c	(revision 6afc9d780e775e54c1cfb5d3c57fb749979b18d2)
+++ uspace/app/taskdump/elf_core.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -67,6 +67,5 @@
 
 static off64_t align_foff_up(off64_t, uintptr_t, size_t);
-static int align_pos(int, size_t);
-static int write_mem_area(int, as_area_info_t *, async_sess_t *);
+static int write_mem_area(int, aoff64_t *, as_area_info_t *, async_sess_t *);
 
 #define BUFFER_SIZE 0x1000
@@ -97,4 +96,5 @@
 	elf_note_t note;
 	size_t word_size;
+	aoff64_t pos = 0;
 
 	int fd;
@@ -207,5 +207,5 @@
 	}
 
-	rc = write(fd, &elf_hdr, sizeof(elf_hdr));
+	rc = write(fd, &pos, &elf_hdr, sizeof(elf_hdr));
 	if (rc != sizeof(elf_hdr)) {
 		printf("Failed writing ELF header.\n");
@@ -215,5 +215,5 @@
 
 	for (i = 0; i < n_ph; ++i) {
-		rc = write(fd, &p_hdr[i], sizeof(p_hdr[i]));
+		rc = write(fd, &pos, &p_hdr[i], sizeof(p_hdr[i]));
 		if (rc != sizeof(p_hdr[i])) {
 			printf("Failed writing program header.\n");
@@ -223,9 +223,5 @@
 	}
 
-	if (lseek(fd, p_hdr[0].p_offset, SEEK_SET) == (off64_t) -1) {
-		printf("Failed writing memory data.\n");
-		free(p_hdr);
-		return EIO;
-	}
+	pos = p_hdr[0].p_offset;
 
 	/*
@@ -236,5 +232,5 @@
 	note.type = NT_PRSTATUS;
 
-	rc = write(fd, &note, sizeof(elf_note_t));
+	rc = write(fd, &pos, &note, sizeof(elf_note_t));
 	if (rc != sizeof(elf_note_t)) {
 		printf("Failed writing note header.\n");
@@ -243,5 +239,5 @@
 	}
 
-	rc = write(fd, "CORE", note.namesz);
+	rc = write(fd, &pos, "CORE", note.namesz);
 	if (rc != (ssize_t) note.namesz) {
 		printf("Failed writing note header.\n");
@@ -250,12 +246,7 @@
 	}
 
-	rc = align_pos(fd, word_size);
-	if (rc != EOK) {
-		printf("Failed writing note header.\n");
-		free(p_hdr);
-		return EIO;
-	}
-
-	rc = write(fd, &pr_status, sizeof(elf_prstatus_t));
+	pos = ALIGN_UP(pos, word_size);
+
+	rc = write(fd, &pos, &pr_status, sizeof(elf_prstatus_t));
 	if (rc != sizeof(elf_prstatus_t)) {
 		printf("Failed writing register data.\n");
@@ -265,10 +256,6 @@
 
 	for (i = 1; i < n_ph; ++i) {
-		if (lseek(fd, p_hdr[i].p_offset, SEEK_SET) == (off64_t) -1) {
-			printf("Failed writing memory data.\n");
-			free(p_hdr);
-			return EIO;
-		}
-		if (write_mem_area(fd, &ainfo[i - 1], sess) != EOK) {
+		pos = p_hdr[i].p_offset;
+		if (write_mem_area(fd, &pos, &ainfo[i - 1], sess) != EOK) {
 			printf("Failed writing memory data.\n");
 			free(p_hdr);
@@ -297,4 +284,5 @@
  *
  * @param fd   File to write to.
+ * @param pos  Pointer to the position to write to.
  * @param area Memory area info structure.
  * @param sess Debugging session.
@@ -303,5 +291,6 @@
  *
  */
-static int write_mem_area(int fd, as_area_info_t *area, async_sess_t *sess)
+static int write_mem_area(int fd, aoff64_t *pos, as_area_info_t *area,
+    async_sess_t *sess)
 {
 	size_t to_copy;
@@ -321,5 +310,5 @@
 		}
 
-		rc = write(fd, buffer, to_copy);
+		rc = write(fd, pos, buffer, to_copy);
 		if (rc != (ssize_t) to_copy) {
 			printf("Failed writing memory contents.\n");
@@ -334,23 +323,4 @@
 }
 
-static int align_pos(int fd, size_t align)
-{
-	off64_t cur_pos;
-	size_t rem, adv;
-
-	cur_pos = lseek(fd, 0, SEEK_CUR);
-	if (cur_pos < 0)
-		return -1;
-
-	rem = cur_pos % align;
-	adv = align - rem;
-
-	cur_pos = lseek(fd, adv, SEEK_CUR);
-	if (cur_pos < 0)
-		return -1;
-
-	return EOK;
-}
-
 /** @}
  */
Index: uspace/app/taskdump/symtab.c
===================================================================
--- uspace/app/taskdump/symtab.c	(revision 6afc9d780e775e54c1cfb5d3c57fb749979b18d2)
+++ uspace/app/taskdump/symtab.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -68,4 +68,5 @@
 	char *shstrt, *sec_name;
 	void *data;
+	aoff64_t pos = 0;
 
 	int fd;
@@ -88,5 +89,5 @@
 	}
 
-	rc = read(fd, &elf_hdr, sizeof(elf_header_t));
+	rc = read(fd, &pos, &elf_hdr, sizeof(elf_header_t));
 	if (rc != sizeof(elf_header_t)) {
 		printf("failed reading elf header\n");
@@ -304,11 +305,7 @@
 {
 	int rc;
-
-	rc = lseek(fd, elf_hdr->e_shoff + idx * sizeof(elf_section_header_t),
-	    SEEK_SET);
-	if (rc == (off64_t) -1)
-		return EIO;
-
-	rc = read(fd, sec_hdr, sizeof(elf_section_header_t));
+	aoff64_t pos = elf_hdr->e_shoff + idx * sizeof(elf_section_header_t);
+
+	rc = read(fd, &pos, sec_hdr, sizeof(elf_section_header_t));
 	if (rc != sizeof(elf_section_header_t))
 		return EIO;
@@ -331,12 +328,5 @@
 {
 	ssize_t rc;
-	off64_t offs;
-
-	offs = lseek(fd, start, SEEK_SET);
-	if (offs == (off64_t) -1) {
-		printf("failed seeking chunk\n");
-		*ptr = NULL;
-		return EIO;
-	}
+	aoff64_t pos = start;
 
 	*ptr = malloc(size);
@@ -346,5 +336,5 @@
 	}
 
-	rc = read(fd, *ptr, size);
+	rc = read(fd, &pos, *ptr, size);
 	if (rc != (ssize_t) size) {
 		printf("failed reading chunk\n");
