comparison src/unexfreebsd.c @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents ca9a9ec9c1c1
children 697ef44129c6
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
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>
43 #include <a.out.h> 44 #include <a.out.h>
44 #include <unistd.h> 45 #include <unistd.h>
45 #include <ctype.h> 46 #include <ctype.h>
46 #include <stab.h> 47 #include <stab.h>
47 #include <sys/dir.h> 48 #include <sys/dir.h>
68 long endaddr; 69 long endaddr;
69 }; 70 };
70 71
71 /********************** Function Prototypes/Declarations ***********/ 72 /********************** Function Prototypes/Declarations ***********/
72 73
73 static void unexec_error (CONST char *m, int use_errno, ...); 74 static void unexec_error (const char *m, int use_errno, ...);
74 static int unexec_open (char *filename, int flag, int mode); 75 static int unexec_open (char *filename, int flag, int mode);
75 static caddr_t unexec_mmap (int fd, size_t len, int prot, int flags); 76 static caddr_t unexec_mmap (int fd, size_t len, int prot, int flags);
76 static long unexec_seek (int fd, long position); 77 static long unexec_seek (int fd, long position);
77 static void unexec_read (int fd, long position, char *buf, int bytes); 78 static void unexec_read (int fd, long position, char *buf, int bytes);
78 static void unexec_write (int fd, long position, char *buf, int bytes); 79 static void unexec_write (int fd, long position, char *buf, int bytes);
93 int run_time_remap (char *dummy); 94 int run_time_remap (char *dummy);
94 95
95 /********************** Variables **********************************/ 96 /********************** Variables **********************************/
96 97
97 /* for reporting error messages from system calls */ 98 /* 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);