comparison src/unexhp9k3.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 <signal.h> 43 #include <signal.h>
45 #ifdef __hp9000s300 44 #ifdef __hp9000s300
46 # include </usr/include/debug.h> 45 # include </usr/include/debug.h>
47 #endif 46 #endif
48 #include <a.out.h> 47 #include <a.out.h>
70 69
71 #define MASK_DOWN(x,p_of_two) (((unsigned long) (x)) & (~((p_of_two) - 1))) 70 #define MASK_DOWN(x,p_of_two) (((unsigned long) (x)) & (~((p_of_two) - 1)))
72 71
73 /********************** Function Prototypes/Declarations ***********/ 72 /********************** Function Prototypes/Declarations ***********/
74 73
75 static void unexec_error (const char *fmt, int use_errno, ...); 74 static void unexec_error (CONST char *fmt, int use_errno, ...);
76 static int unexec_open (char *filename, int flag, int mode); 75 static int unexec_open (char *filename, int flag, int mode);
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);
80 static void unexec_copy (int new_fd, int old_fd, long old_pos, long new_pos, 79 static void unexec_copy (int new_fd, int old_fd, long old_pos, long new_pos,
86 85
87 /********************** Variables **********************************/ 86 /********************** Variables **********************************/
88 87
89 /* for reporting error messages from system calls */ 88 /* for reporting error messages from system calls */
90 extern int sys_nerr; 89 extern int sys_nerr;
90 extern int errno;
91 extern int _DYNAMIC; 91 extern int _DYNAMIC;
92 extern char **environ; 92 extern char **environ;
93 93
94 static unsigned long sbrk_of_0_at_unexec; 94 static unsigned long sbrk_of_0_at_unexec;
95 95
96 /*******************************************************************/ 96 /*******************************************************************/
97 97
98 static void 98 static void
99 unexec_error (const char *fmt, int use_errno, ...) 99 unexec_error (CONST char *fmt, int use_errno, ...)
100 { 100 {
101 const char *err_msg = SYS_ERR; 101 CONST char *err_msg = SYS_ERR;
102 va_list args; 102 va_list args;
103 103
104 fprintf (stderr, "unexec - "); 104 fprintf (stderr, "unexec - ");
105 va_start (args, use_errno); 105 va_start (args, use_errno);
106 vfprintf (stderr, fmt, args); 106 vfprintf (stderr, fmt, args);