Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:09:51

0001 /*
0002  * BinReloc - a library for creating relocatable executables
0003  * Written by: Hongli Lai <h.lai@chello.nl>
0004  * http://autopackage.org/
0005  *
0006  * This source code is public domain. You can relicense this code
0007  * under whatever license you want.
0008  *
0009  * See http://autopackage.org/docs/binreloc/ for
0010  * more information and how to use this.
0011  */
0012 
0013 #ifndef __BINRELOC_H__
0014 #define __BINRELOC_H__
0015 
0016 #ifdef __cplusplus
0017 extern "C" {
0018 #endif /* __cplusplus */
0019 
0020 
0021 /** These error codes can be returned by br_init(), br_init_lib(), gbr_init() or gbr_init_lib(). */
0022 typedef enum {
0023     /** Cannot allocate memory. */
0024     BR_INIT_ERROR_NOMEM,
0025     /** Unable to open /proc/self/maps; see errno for details. */
0026     BR_INIT_ERROR_OPEN_MAPS,
0027     /** Unable to read from /proc/self/maps; see errno for details. */
0028     BR_INIT_ERROR_READ_MAPS,
0029     /** The file format of /proc/self/maps is invalid; kernel bug? */
0030     BR_INIT_ERROR_INVALID_MAPS,
0031     /** BinReloc is disabled (the ENABLE_BINRELOC macro is not defined). */
0032     BR_INIT_ERROR_DISABLED
0033 } BrInitError;
0034 
0035 
0036 #ifndef BINRELOC_RUNNING_DOXYGEN
0037     /* Mangle symbol names to avoid symbol
0038      * collisions with other ELF objects.
0039      */
0040     #define br_init             gGPK65545986512468_br_init
0041     #define br_init_lib         gGPK65545986512468_br_init_lib
0042     #define br_find_exe         gGPK65545986512468_br_find_exe
0043     #define br_find_exe_dir     gGPK65545986512468_br_find_exe_dir
0044     #define br_find_prefix      gGPK65545986512468_br_find_prefix
0045     #define br_find_bin_dir     gGPK65545986512468_br_find_bin_dir
0046     #define br_find_sbin_dir    gGPK65545986512468_br_find_sbin_dir
0047     #define br_find_data_dir    gGPK65545986512468_br_find_data_dir
0048     #define br_find_locale_dir  gGPK65545986512468_br_find_locale_dir
0049     #define br_find_lib_dir     gGPK65545986512468_br_find_lib_dir
0050     #define br_find_libexec_dir gGPK65545986512468_br_find_libexec_dir
0051     #define br_find_etc_dir     gGPK65545986512468_br_find_etc_dir
0052     #define br_strcat           gGPK65545986512468_br_strcat
0053     #define br_build_path       gGPK65545986512468_br_build_path
0054     #define br_dirname          gGPK65545986512468_br_dirname
0055 #endif
0056 
0057 int   br_init             (BrInitError *error);
0058 int   br_init_lib         (BrInitError *error);
0059 
0060 char *br_find_exe         (const char *default_exe);
0061 char *br_find_exe_dir     (const char *default_dir);
0062 char *br_find_prefix      (const char *default_prefix);
0063 char *br_find_bin_dir     (const char *default_bin_dir);
0064 char *br_find_sbin_dir    (const char *default_sbin_dir);
0065 char *br_find_data_dir    (const char *default_data_dir);
0066 char *br_find_locale_dir  (const char *default_locale_dir);
0067 char *br_find_lib_dir     (const char *default_lib_dir);
0068 char *br_find_libexec_dir (const char *default_libexec_dir);
0069 char *br_find_etc_dir     (const char *default_etc_dir);
0070 
0071 /* Utility functions */
0072 char *br_strcat  (const char *str1, const char *str2);
0073 char *br_build_path (const char *dir, const char *file);
0074 char *br_dirname (const char *path);
0075 
0076 
0077 #ifdef __cplusplus
0078 }
0079 #endif /* __cplusplus */
0080 
0081 #endif /* __BINRELOC_H__ */