#include <sys/stat.h>
#include <sys/mman.h>
#include <stdio.h>
+#include <errno.h>
#include <varargs.h>
#include <filehdr.h>
#include <aouthdr.h>
if (lseek (_fd, _position, L_SET) != _position) \
fatal_unexec (_error_message, _error_arg);
-extern int errno;
-extern char *strerror ();
-
-void *sbrk();
-
#define EEOF -1
static struct scnhdr *text_section;
};
-
/* Define name of label for entry point for the dumped executable. */
#ifndef DEFAULT_ENTRY_ADDRESS
#define DEFAULT_ENTRY_ADDRESS __start
#endif
+EXTERN_C int DEFAULT_ENTRY_ADDRESS (void);
+
\f
-unexec (new_name, a_name, data_start, bss_start, entry_address)
- char *new_name, *a_name;
- unsigned long data_start, bss_start, entry_address;
+int
+unexec (char *new_name, char *a_name,
+ unsigned long data_start,
+ unsigned long bss_start,
+ unsigned long entry_address)
{
int new, old;
char * oldptr;
struct stat stat;
long pagesize, brk;
long newsyms, symrel;
- int nread;
int i;
long vaddr, scnptr;
#define BUFSIZE 8192
nhdr.aout.bsize = 0;
if (entry_address == 0)
{
- extern DEFAULT_ENTRY_ADDRESS ();
nhdr.aout.entry = (unsigned long)DEFAULT_ENTRY_ADDRESS;
}
else
*/
-
-update_dynamic_symbols (old, new_name, new, newsyms, nsyms, symoff, stroff)
- char *old; /* Pointer to old executable */
- char *new_name; /* Name of new executable */
- int new; /* File descriptor for new executable */
- long newsyms; /* Offset of Symbol table in new executable */
- int nsyms; /* Number of symbol table entries */
- long symoff; /* Offset of External Symbols in old file */
- long stroff; /* Offset of string table in old file */
+int
+update_dynamic_symbols (
+ char *old, /* Pointer to old executable */
+ char *new_name, /* Name of new executable */
+ int new, /* File descriptor for new executable */
+ long newsyms, /* Offset of Symbol table in new executable */
+ int nsyms, /* Number of symbol table entries */
+ long symoff, /* Offset of External Symbols in old file */
+ long stroff) /* Offset of string table in old file */
{
long i;
int found = 0;