[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 2/3] Move elf_map_image out of line
From: |
Zachary T Welch |
Subject: |
[Libunwind-devel] [PATCH 2/3] Move elf_map_image out of line |
Date: |
Mon, 29 Nov 2010 20:10:08 -0800 |
The compiler was ignoring the inline directive anyway.
Signed-off-by: Zachary T Welch <address@hidden>
diff --git a/src/elfxx.c b/src/elfxx.c
index 7ed44ba..c1bfb52 100644
--- a/src/elfxx.c
+++ b/src/elfxx.c
@@ -41,6 +41,30 @@ elf_w (valid_object) (struct elf_image *ei)
&& ((uint8_t *) ei->image)[EI_VERSION] <= EV_CURRENT);
}
+HIDDEN int
+elf_map_image (struct elf_image *ei, const char *path)
+{
+ struct stat stat;
+ int fd;
+
+ fd = open (path, O_RDONLY);
+ if (fd < 0)
+ return -1;
+
+ if (fstat (fd, &stat) < 0)
+ {
+ close (fd);
+ return -1;
+ }
+
+ ei->size = stat.st_size;
+ ei->image = mmap (NULL, ei->size, PROT_READ, MAP_PRIVATE, fd, 0);
+ close (fd);
+ if (ei->image == MAP_FAILED)
+ return -1;
+
+ return 0;
+}
static int
elf_w (lookup_symbol) (unw_addr_space_t as,
diff --git a/src/elfxx.h b/src/elfxx.h
index 7742806..4b78d4a 100644
--- a/src/elfxx.h
+++ b/src/elfxx.h
@@ -43,31 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */
# define elf_w(x) _Uelf64_##x
#endif
-static inline int
-elf_map_image (struct elf_image *ei, const char *path)
-{
- struct stat stat;
- int fd;
-
- fd = open (path, O_RDONLY);
- if (fd < 0)
- return -1;
-
- if (fstat (fd, &stat) < 0)
- {
- close (fd);
- return -1;
- }
-
- ei->size = stat.st_size;
- ei->image = mmap (NULL, ei->size, PROT_READ, MAP_PRIVATE, fd, 0);
- close (fd);
- if (ei->image == MAP_FAILED)
- return -1;
-
- return 0;
-}
-
+extern int elf_map_image (struct elf_image *ei, const char *path);
extern int elf_w (valid_object) (struct elf_image *ei);
extern int elf_w (get_proc_name) (unw_addr_space_t as,
pid_t pid, unw_word_t ip,
--
1.7.2.2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Libunwind-devel] [PATCH 2/3] Move elf_map_image out of line,
Zachary T Welch <=