libroot_debug: Merge guarded heap into libroot_debug.
[haiku.git] / src / system / runtime_loader / images.h
blob7a309bb6c8d4a848f098b0e4a6c0004336d0dd69
1 /*
2 * Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2003-2011, Axel Dörfler, axeld@pinc-software.de.
4 * Distributed under the terms of the MIT License.
6 * Copyright 2002, Manuel J. Petit. All rights reserved.
7 * Copyright 2001, Travis Geiselbrecht. All rights reserved.
8 * Distributed under the terms of the NewOS License.
9 */
10 #ifndef IMAGES_H
11 #define IMAGES_H
13 #include <runtime_loader.h>
16 enum {
17 // the lower two bits are reserved for RTLD_NOW and RTLD_GLOBAL
19 RFLAG_RW = 0x0010,
20 RFLAG_ANON = 0x0020,
22 RFLAG_TERMINATED = 0x0200,
23 RFLAG_INITIALIZED = 0x0400,
24 RFLAG_SYMBOLIC = 0x0800,
25 RFLAG_RELOCATED = 0x1000,
26 RFLAG_PROTECTED = 0x2000,
27 RFLAG_DEPENDENCIES_LOADED = 0x4000,
28 RFLAG_REMAPPED = 0x8000,
30 RFLAG_VISITED = 0x10000,
31 RFLAG_USE_FOR_RESOLVING = 0x20000
32 // temporarily set in the symbol resolution code
36 #define IMAGE_TYPE_TO_MASK(type) (1 << ((type) - 1))
37 #define ALL_IMAGE_TYPES (IMAGE_TYPE_TO_MASK(B_APP_IMAGE) \
38 | IMAGE_TYPE_TO_MASK(B_LIBRARY_IMAGE) \
39 | IMAGE_TYPE_TO_MASK(B_ADD_ON_IMAGE) \
40 | IMAGE_TYPE_TO_MASK(B_SYSTEM_IMAGE))
41 #define APP_OR_LIBRARY_TYPE (IMAGE_TYPE_TO_MASK(B_APP_IMAGE) \
42 | IMAGE_TYPE_TO_MASK(B_LIBRARY_IMAGE))
45 extern bool gInvalidImageIDs;
48 image_t* create_image(const char* name, const char* path, int regionCount);
49 void delete_image_struct(image_t* image);
50 void delete_image(image_t* image);
51 void put_image(image_t* image);
53 status_t map_image(int fd, char const* path, image_t* image);
54 void unmap_image(image_t* image);
55 void remap_images();
57 void register_image(image_t* image, int fd, const char* path);
58 status_t update_image_ids();
60 image_queue_t& get_loaded_images();
61 image_queue_t& get_disposable_images();
62 uint32 count_loaded_images();
63 void enqueue_loaded_image(image_t* image);
64 void dequeue_loaded_image(image_t* image);
65 void dequeue_disposable_image(image_t* image);
67 image_t* find_loaded_image_by_name(char const* name, uint32 typeMask);
68 image_t* find_loaded_image_by_id(image_id id, bool ignoreDisposable);
69 image_t* find_loaded_image_by_address(addr_t address);
71 void set_image_flags_recursively(image_t* image, uint32 flags);
72 void clear_image_flags_recursively(image_t* image, uint32 flags);
73 ssize_t get_sorted_image_list(image_t* image, image_t*** _list,
74 uint32 sortFlag);
77 #endif // IMAGES_H