comparison src/unexhp9k3.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 c42ec1d1cded
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 <signal.h> 44 #include <signal.h>
44 #ifdef __hp9000s300 45 #ifdef __hp9000s300
45 # include </usr/include/debug.h> 46 # include </usr/include/debug.h>
46 #endif 47 #endif
47 #include <a.out.h> 48 #include <a.out.h>
69 70
70 #define MASK_DOWN(x,p_of_two) (((unsigned long) (x)) & (~((p_of_two) - 1))) 71 #define MASK_DOWN(x,p_of_two) (((unsigned long) (x)) & (~((p_of_two) - 1)))
71 72
72 /********************** Function Prototypes/Declarations ***********/ 73 /********************** Function Prototypes/Declarations ***********/
73 74
74 static void unexec_error (CONST char *fmt, int use_errno, ...); 75 static void unexec_error (const char *fmt, int use_errno, ...);
75 static int unexec_open (char *filename, int flag, int mode); 76 static int unexec_open (char *filename, int flag, int mode);
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);
79 static void unexec_copy (int new_fd, int old_fd, long old_pos, long new_pos, 80 static void unexec_copy (int new_fd, int old_fd, long old_pos, long new_pos,
85 86
86 /********************** Variables **********************************/ 87 /********************** Variables **********************************/
87 88
88 /* for reporting error messages from system calls */ 89 /* for reporting error messages from system calls */
89 extern int sys_nerr; 90 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);