7624b27409
--HG-- branch : develop
90 lines
3.3 KiB
C
90 lines
3.3 KiB
C
/*
|
|
* BinReloc - a library for creating relocatable executables
|
|
*
|
|
* Originally written by: Hongli Lai <h.lai@chello.nl>
|
|
* http://autopackage.org/ (defunct)
|
|
*
|
|
* Maintained by: Wolfgang 'datenwolf' Draxinger <coding@datenwolf.net>
|
|
*
|
|
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
* Version 2, December 2004
|
|
*
|
|
* Everyone is permitted to copy and distribute verbatim or modified
|
|
* copies of this license document, and changing it is allowed as long
|
|
* as the name is changed.
|
|
*
|
|
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
*
|
|
* 0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
*/
|
|
|
|
#ifndef __BINRELOC_H__
|
|
#define __BINRELOC_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
/** These error codes can be returned by br_init(), br_init_lib(), gbr_init() or gbr_init_lib(). */
|
|
typedef enum {
|
|
/** Cannot allocate memory. */
|
|
BR_INIT_ERROR_NOMEM,
|
|
/** Unable to open /proc/self/maps; see errno for details. */
|
|
BR_INIT_ERROR_OPEN_MAPS,
|
|
/** Unable to read from /proc/self/maps; see errno for details. */
|
|
BR_INIT_ERROR_READ_MAPS,
|
|
/** The file format of /proc/self/maps is invalid; kernel bug? */
|
|
BR_INIT_ERROR_INVALID_MAPS,
|
|
/** BinReloc is disabled (the ENABLE_BINRELOC macro is not defined). */
|
|
BR_INIT_ERROR_DISABLED
|
|
} BrInitError;
|
|
|
|
|
|
#ifndef BINRELOC_RUNNING_DOXYGEN
|
|
/* Mangle symbol names to avoid symbol collisions with other ELF objects. */
|
|
#define br_init SbCJ22537442193159_br_init
|
|
#define br_init_lib SbCJ22537442193159_br_init_lib
|
|
#define br_find_exe SbCJ22537442193159_br_find_exe
|
|
#define br_find_exe_dir SbCJ22537442193159_br_find_exe_dir
|
|
#define br_find_prefix SbCJ22537442193159_br_find_prefix
|
|
#define br_find_bin_dir SbCJ22537442193159_br_find_bin_dir
|
|
#define br_find_sbin_dir SbCJ22537442193159_br_find_sbin_dir
|
|
#define br_find_data_dir SbCJ22537442193159_br_find_data_dir
|
|
#define br_find_locale_dir SbCJ22537442193159_br_find_locale_dir
|
|
#define br_find_lib_dir SbCJ22537442193159_br_find_lib_dir
|
|
#define br_find_libexec_dir SbCJ22537442193159_br_find_libexec_dir
|
|
#define br_find_etc_dir SbCJ22537442193159_br_find_etc_dir
|
|
#define br_strcat SbCJ22537442193159_br_strcat
|
|
#define br_build_path SbCJ22537442193159_br_build_path
|
|
#define br_dirname SbCJ22537442193159_br_dirname
|
|
|
|
|
|
#endif
|
|
int br_init (BrInitError *error);
|
|
int br_init_lib (BrInitError *error);
|
|
|
|
char *br_find_exe (const char *default_exe);
|
|
char *br_find_exe_dir (const char *default_dir);
|
|
char *br_find_prefix (const char *default_prefix);
|
|
char *br_find_bin_dir (const char *default_bin_dir);
|
|
char *br_find_sbin_dir (const char *default_sbin_dir);
|
|
char *br_find_data_dir (const char *default_data_dir);
|
|
char *br_find_locale_dir (const char *default_locale_dir);
|
|
char *br_find_lib_dir (const char *default_lib_dir);
|
|
char *br_find_libexec_dir (const char *default_libexec_dir);
|
|
char *br_find_etc_dir (const char *default_etc_dir);
|
|
|
|
/* Utility functions */
|
|
char *br_strcat (const char *str1, const char *str2);
|
|
char *br_build_path (const char *dir, const char *file);
|
|
char *br_dirname (const char *path);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* __BINRELOC_H__ */
|