Skip to content

Commit 9643b15

Browse files
committed
Documented the ELF dlMapper
1 parent 5cb1d0b commit 9643b15

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/dlMapper/elf/dlMapper.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static inline char* dlMapper_platform_loadExecutableName(void) {
5757
if (buffer == NULL) {
5858
return NULL;
5959
}
60-
ssize_t count = readlink("/proc/self/exe", buffer, PATH_MAX - 1);
60+
const ssize_t count = readlink("/proc/self/exe", buffer, PATH_MAX - 1);
6161
if (count == -1) {
6262
free(buffer);
6363
return NULL;
@@ -66,6 +66,11 @@ static inline char* dlMapper_platform_loadExecutableName(void) {
6666
return buffer;
6767
}
6868

69+
/**
70+
* Generates an implementation for loading the ELF program header number.
71+
*
72+
* @param bits the amount of bits the implementation shall handle
73+
*/
6974
#define dlMapper_platform_loadEPHNum(bits) \
7075
static inline uint32_t dlMapper_platform_loadEPHNum##bits(const Elf##bits##_Ehdr* header, bool littleEndian) { \
7176
const uint16_t e_phnum = ELF_TO_HOST(16, header->e_phnum, littleEndian); \
@@ -80,6 +85,11 @@ static inline uint32_t dlMapper_platform_loadEPHNum##bits(const Elf##bits##_Ehdr
8085
dlMapper_platform_loadEPHNum(32)
8186
dlMapper_platform_loadEPHNum(64)
8287

88+
/**
89+
* Generates an implementation for loading a given ELF file.
90+
*
91+
* @param bits the amount of bits the implementation shall handle
92+
*/
8393
#define dlMapper_platform_loadELF_impl(bits) \
8494
static inline pair_address_t dlMapper_platform_loadELF##bits(const void* base, bool littleEndian) { \
8595
const Elf##bits##_Ehdr* header = base; \
@@ -134,14 +144,14 @@ static inline void* dlMapper_platform_loadELFLoadedAddress(struct dl_phdr_info*
134144

135145
/**
136146
* Creates a loaded library information from the given info and stores it in
137-
* the passed payload.
147+
* the given payload.
138148
*
139149
* @param info the system info
140150
* @param size the size of the passed info structure
141151
* @param d the payload
142152
* @return whether to continue iterating
143153
*/
144-
static inline int dlMapper_platform_iterateCallback(struct dl_phdr_info* info, size_t size, void* d) {
154+
static inline int dlMapper_platform_iterateCallback(struct dl_phdr_info* info, const size_t size, void* d) {
145155
(void) size;
146156

147157
struct dlMapper_platform_data* data = d;

0 commit comments

Comments
 (0)