annotate src/unexsol2.c @ 242:fc816b73a05f

Added tag r20-5b19 for changeset f955c73f5258
author cvs
date Mon, 13 Aug 2007 10:16:17 +0200
parents 92f8ad5d0d3f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Unexec function for Solaris 2.x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
205
92f8ad5d0d3f Import from CVS: tag r20-4b1
cvs
parents: 203
diff changeset
23 /* #pragma ident "@(#) $Id: unexsol2.c,v 1.3 1997/10/13 03:35:33 steve Exp $" */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #include <stdlib.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #include <stdio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 #include <dlfcn.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #define DYNODUMP_SO "../dynodump/dynodump.so"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #define DYNODUMP_SYM "dynodump"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
32 int unexec (char *new_name, char *old_name, unsigned int data_start,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
33 unsigned int bss_start, unsigned int entry_address);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 unexec(char *new_name, char *old_name, unsigned int data_start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 unsigned int bss_start, unsigned int entry_address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 void *handle;
205
92f8ad5d0d3f Import from CVS: tag r20-4b1
cvs
parents: 203
diff changeset
39 void (*func)(const char *file);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 if ((handle = dlopen (DYNODUMP_SO, RTLD_LAZY)) == NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 fprintf (stderr, "unexec(): dlopen(%s): %s\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (char *) DYNODUMP_SO, dlerror());
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
205
92f8ad5d0d3f Import from CVS: tag r20-4b1
cvs
parents: 203
diff changeset
48 if ((func = (void (*)(const char *)) dlsym (handle, DYNODUMP_SYM)) == NULL)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 fprintf (stderr, "unexec(): dlsym(%s): %s \n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (char *) DYNODUMP_SYM, dlerror());
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (*func)(new_name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 dlclose (handle);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 }