comparison src/unexfreebsd.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 74fd4e045ea6
children
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
38 #include <sys/file.h> 38 #include <sys/file.h>
39 #include <sys/stat.h> 39 #include <sys/stat.h>
40 #include <sys/types.h> 40 #include <sys/types.h>
41 #include <string.h> 41 #include <string.h>
42 #include <stdio.h> 42 #include <stdio.h>
43 #include <errno.h>
44 #include <a.out.h> 43 #include <a.out.h>
45 #include <unistd.h> 44 #include <unistd.h>
46 #include <ctype.h> 45 #include <ctype.h>
47 #include <stab.h> 46 #include <stab.h>
48 #include <sys/dir.h> 47 #include <sys/dir.h>
69 long endaddr; 68 long endaddr;
70 }; 69 };
71 70
72 /********************** Function Prototypes/Declarations ***********/ 71 /********************** Function Prototypes/Declarations ***********/
73 72
74 static void unexec_error (const char *m, int use_errno, ...); 73 static void unexec_error (CONST char *m, int use_errno, ...);
75 static int unexec_open (char *filename, int flag, int mode); 74 static int unexec_open (char *filename, int flag, int mode);
76 static caddr_t unexec_mmap (int fd, size_t len, int prot, int flags); 75 static caddr_t unexec_mmap (int fd, size_t len, int prot, int flags);
77 static long unexec_seek (int fd, long position); 76 static long unexec_seek (int fd, long position);
78 static void unexec_read (int fd, long position, char *buf, int bytes); 77 static void unexec_read (int fd, long position, char *buf, int bytes);
79 static void unexec_write (int fd, long position, char *buf, int bytes); 78 static void unexec_write (int fd, long position, char *buf, int bytes);
94 int run_time_remap (char *dummy); 93 int run_time_remap (char *dummy);
95 94
96 /********************** Variables **********************************/ 95 /********************** Variables **********************************/
97 96
98 /* for reporting error messages from system calls */ 97 /* for reporting error messages from system calls */
98 extern int errno;
99 extern int _DYNAMIC; 99 extern int _DYNAMIC;
100 extern char **environ; 100 extern char **environ;
101 101
102 static unsigned long sbrk_of_0_at_unexec; 102 static unsigned long sbrk_of_0_at_unexec;
103 103
104 /*******************************************************************/ 104 /*******************************************************************/
105 105
106 static void 106 static void
107 unexec_error (const char *fmt, int use_errno, ...) 107 unexec_error (CONST char *fmt, int use_errno, ...)
108 { 108 {
109 const char *err_msg = SYS_ERR; 109 CONST char *err_msg = SYS_ERR;
110 va_list args; 110 va_list args;
111 111
112 fprintf (stderr, "unexec - "); 112 fprintf (stderr, "unexec - ");
113 va_start (args, use_errno); 113 va_start (args, use_errno);
114 vfprintf (stderr, fmt, args); 114 vfprintf (stderr, fmt, args);