/[gentoo-projects]/pax-utils/paxmacho.h
Gentoo

Contents of /pax-utils/paxmacho.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download) (as text)
Tue Apr 16 16:26:28 2013 UTC (16 months, 1 week ago) by vapier
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +2 -2 lines
File MIME type: text/x-chdr
scanmacho: fix up signed warnings with newer gcc

1 /*
2 * Copyright 2005-2012 Gentoo Foundation
3 * Distributed under the terms of the GNU General Public License v2
4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxmacho.h,v 1.7 2012/11/04 07:26:24 vapier Exp $
5 *
6 * Copyright 2005-2012 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2005-2012 Mike Frysinger - <vapier@gentoo.org>
8 * 2008-2012 Fabian Groffen - <grobian@gentoo.org>
9 *
10 * Make sure all of the common mach-o stuff is setup as we expect
11 */
12
13 #ifndef _PAX_MACHO_H
14 #define _PAX_MACHO_H
15
16 #include "macho.h"
17
18 #define MGET(swapped, value) (swapped ? (typeof(value))bswap_32(value) : value)
19 #define MOBJGET(obj, member) MGET((obj)->swapped, (obj)->member)
20
21 typedef struct _fatobj {
22 void *data; /* mmapped image of the whole file */
23 size_t len; /* length of data (file length) */
24 int fd; /* open filedescriptor to the file */
25 const char *filename; /* full filename */
26 const char *base_filename; /* basename of filename (don't free) */
27 char swapped; /* whether values need to be swapped */
28 char ismach64; /* whether mach_header_64 is in use */
29 char isbigendian; /* whether the byte order is big-endian */
30 union {
31 struct mach_header *hdr32; /* pointer to arch Mach-O header */
32 struct mach_header_64 *hdr64; /* 64-bits variant */
33 } mhdr;
34 char *mhdata; /* pointer to the image of the mach_header */
35 struct _fatobj *next; /* pointer to the next arch */
36 } fatobj;
37
38 typedef struct {
39 void *data; /* pointer to the current command header */
40 struct load_command* lcmd; /* the load command */
41 uint32_t cleft; /* load commands left */
42 uint32_t align; /* alignment size in bytes */
43 char swapped; /* whether values need to be swapped */
44 } loadcmd;
45
46 const char *get_machomhtype(fatobj *fobj);
47 void get_machomhflags(fatobj *fobj, char **ret, size_t *ret_len);
48 const char *get_machocputype(fatobj *fobj);
49 const char *get_machosubcputype(fatobj *fobj);
50 fatobj *readmacho(const char *filename);
51 fatobj *readmacho_fd(const char *filename, int fd, size_t len);
52 fatobj *readmacho_buffer(const char *filename, char *buffer, size_t buffer_len);
53 void unreadmacho(fatobj *macho);
54 loadcmd *firstloadcmd(fatobj *fobj);
55 int nextloadcmd(loadcmd* lcmd);
56 const char *get_machoendian(fatobj *fobj);
57 const char *get_machomtype(fatobj *fobj);
58
59 #endif /* _PAX_MACHO_H */

  ViewVC Help
Powered by ViewVC 1.1.20