summaryrefslogtreecommitdiff
path: root/src/unexsunos4.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-01-12 21:02:30 +0000
committerRichard M. Stallman <rms@gnu.org>1995-01-12 21:02:30 +0000
commit0c97bd6a43547764cf38583a88203cc8a5f2d545 (patch)
treeed70f1b48eac15292f5bb30d55a505ac1425deb7 /src/unexsunos4.c
parent4ff1aed96c12060742dce8cb13ddd151aa3beafe (diff)
downloademacs-0c97bd6a43547764cf38583a88203cc8a5f2d545.tar.gz
(unexec): Cast value of sbrk.
(run_time_remap): Cast arg to brk. (brk_value): Renamed from Brk. (is_it): Cast 1st arg of mmap.
Diffstat (limited to 'src/unexsunos4.c')
-rw-r--r--src/unexsunos4.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/unexsunos4.c b/src/unexsunos4.c
index c591fb07bdc..e36ddeed9e8 100644
--- a/src/unexsunos4.c
+++ b/src/unexsunos4.c
@@ -92,7 +92,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#endif
extern char *getenv ();
-static unsigned Brk;
+static unsigned brk_value;
static struct exec nhdr;
static int rd_only_len;
static long cookie;
@@ -145,7 +145,8 @@ unexec (new_name, a_name, bndry, bss_start, entry)
*/
cookie = time (0);
- Brk = sbrk (0); /* Save the break, it is reset to &_end (by ld.so?) */
+ /* Save the break, it is reset to &_end (by ld.so?). */
+ brk_value = (unsigned) sbrk (0);
/*
* Round up data start to a page boundary (Lose if not a 2 power!)
@@ -163,15 +164,13 @@ unexec (new_name, a_name, bndry, bss_start, entry)
initialized = 1;
#endif
- /*
- * Handle new data and bss sizes and optional new entry point.
- * No one actually uses bss_start and entry, but tradition compels
- * one to support them.
- * Could complain if bss_start > Brk, but the caller is *supposed* to know
- * what she is doing.
- */
- nhdr.a_data = (bss_start ? bss_start : Brk) - N_DATADDR (nhdr);
- nhdr.a_bss = bss_start ? Brk - bss_start : 0;
+ /* Handle new data and bss sizes and optional new entry point.
+ No one actually uses bss_start and entry, but tradition compels
+ one to support them.
+ Could complain if bss_start > brk_value,
+ but the caller is *supposed* to know what she is doing. */
+ nhdr.a_data = (bss_start ? bss_start : brk_value) - N_DATADDR (nhdr);
+ nhdr.a_bss = bss_start ? brk_value - bss_start : 0;
if (entry)
nhdr.a_entry = entry;
@@ -279,7 +278,7 @@ run_time_remap (progname)
return;
/* Restore the break */
- brk (Brk);
+ brk ((char *) brk_value);
/* If nothing to remap: we are done! */
if (rd_only_len == 0)
@@ -358,7 +357,7 @@ is_it (filename)
* should the shared library decide to indirect through
* addresses in the data segment not part of __DYNAMIC
*/
- mmap (data_start, rd_only_len, PROT_READ | PROT_EXEC,
+ mmap ((char *) data_start, rd_only_len, PROT_READ | PROT_EXEC,
MAP_FILE | MAP_SHARED | MAP_FIXED, fd,
N_DATOFF (hdr) + data_start - N_DATADDR (hdr));
close (fd);