[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111248: Improve AIX port.
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111248: Improve AIX port. |
Date: |
Mon, 11 Feb 2013 12:32:54 -0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111248
fixes bug: http://debbugs.gnu.org/13650
committer: Paul Eggert <address@hidden>
branch nick: emacs-24
timestamp: Mon 2013-02-11 12:32:54 -0800
message:
Improve AIX port.
This doesn't fix the bug, but it makes progress: Emacs builds now.
* unexaix.c: Include inttypes.h, stdarg.h.
(report_error, report_error_1): Mark as _Noreturn.
(report_error): Don't report the wrong errno.
(report_error_1): Now varargs. All callers changed.
(make_hdr): Use uintptr_t, not unsigned, when converting pointers
to unsigned. Don't use ADDR_CORRECT, as it no longer exists.
(write_ptr): Use %p to print address rather than %lx and a cast
to unsigned long. Grow buffer a bit, to be safer.
modified:
src/ChangeLog
src/unexaix.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-02-11 17:27:48 +0000
+++ b/src/ChangeLog 2013-02-11 20:32:54 +0000
@@ -1,3 +1,16 @@
+2013-02-11 Paul Eggert <address@hidden>
+
+ Improve AIX port (Bug#13650).
+ This doesn't fix the bug, but it makes progress: Emacs builds now.
+ * unexaix.c: Include inttypes.h, stdarg.h.
+ (report_error, report_error_1): Mark as _Noreturn.
+ (report_error): Don't report the wrong errno.
+ (report_error_1): Now varargs. All callers changed.
+ (make_hdr): Use uintptr_t, not unsigned, when converting pointers
+ to unsigned. Don't use ADDR_CORRECT, as it no longer exists.
+ (write_ptr): Use %p to print address rather than %lx and a cast
+ to unsigned long. Grow buffer a bit, to be safer.
+
2013-02-11 Eli Zaretskii <address@hidden>
* bidi.c (bidi_resolve_neutral): After finding the next
=== modified file 'src/unexaix.c'
--- a/src/unexaix.c 2013-01-01 09:11:05 +0000
+++ b/src/unexaix.c 2013-02-11 20:32:54 +0000
@@ -51,6 +51,8 @@
#include "getpagesize.h"
#include <sys/types.h>
+#include <inttypes.h>
+#include <stdarg.h>
#include <stdio.h>
#include <sys/stat.h>
#include <errno.h>
@@ -92,23 +94,30 @@
#include "lisp.h"
-static void
+static _Noreturn void
report_error (const char *file, int fd)
{
if (fd)
- close (fd);
+ {
+ int failed_errno = errno;
+ close (fd);
+ errno = failed_errno;
+ }
report_file_error ("Cannot unexec", Fcons (build_string (file), Qnil));
}
-#define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1
-#define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1
-#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1
+#define ERROR0(msg) report_error_1 (new, msg)
+#define ERROR1(msg,x) report_error_1 (new, msg, x)
+#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y)
-static void
-report_error_1 (int fd, const char *msg, int a1, int a2)
+static _Noreturn void ATTRIBUTE_FORMAT_PRINTF (2, 3)
+report_error_1 (int fd, const char *msg, ...)
{
+ va_list ap;
close (fd);
- error (msg, a1, a2);
+ va_start (ap, msg);
+ verror (msg, ap);
+ va_end (ap);
}
static int make_hdr (int, int, const char *, const char *);
@@ -163,8 +172,8 @@
const char *a_name, const char *new_name)
{
int scns;
- unsigned int bss_start;
- unsigned int data_start;
+ uintptr_t bss_start;
+ uintptr_t data_start;
struct scnhdr section[MAX_SECTIONS];
struct scnhdr * f_thdr; /* Text section header */
@@ -179,17 +188,17 @@
pagemask = getpagesize () - 1;
/* Adjust text/data boundary. */
- data_start = (long) start_of_data ();
- data_start = ADDR_CORRECT (data_start);
+ data_start = (uintptr_t) start_of_data ();
data_start = data_start & ~pagemask; /* (Down) to page boundary. */
- bss_start = ADDR_CORRECT (sbrk (0)) + pagemask;
+ bss_start = (uintptr_t) sbrk (0) + pagemask;
bss_start &= ~ pagemask;
if (data_start > bss_start) /* Can't have negative data size. */
{
- ERROR2 ("unexec: data_start (%u) can't be greater than bss_start (%u)",
+ ERROR2 (("unexec: data_start (0x%"PRIxPTR
+ ") can't be greater than bss_start (0x%"PRIxPTR")"),
data_start, bss_start);
}
@@ -393,7 +402,6 @@
write_segment (int new, char *ptr, char *end)
{
int i, nwrite, ret;
- char buf[80];
char zeros[UnexBlockSz];
for (i = 0; ptr < end;)
@@ -414,9 +422,13 @@
}
else if (nwrite != ret)
{
+ int write_errno = errno;
+ char buf[1000];
+ void *addr = ptr;
sprintf (buf,
- "unexec write failure: addr 0x%lx, fileno %d, size 0x%x,
wrote 0x%x, errno %d",
- (unsigned long)ptr, new, nwrite, ret, errno);
+ "unexec write failure: addr %p, fileno %d, size 0x%x, wrote
0x%x, errno %d",
+ addr, new, nwrite, ret, errno);
+ errno = write_errno;
PERROR (buf);
}
i += nwrite;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111248: Improve AIX port.,
Paul Eggert <=