home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / local / include / mach-o / redo_prebinding.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-14  |  3.4 KB  |  87 lines

  1. /*
  2.  * For all APIs in this file the parameters program_name and error_message
  3.  * are used the same.  For unrecoverable resource errors like being unable to
  4.  * allocate memory each API prints a message to stderr precede with program_name
  5.  * then calls exit(2) with the value EXIT_FAILURE.  If an API is unsuccessful
  6.  * and if error_message pass to it is not NULL it is set to a malloc(3)'ed
  7.  * buffer with a NULL terminated string with the error message.  For all APIs 
  8.  * when they return they release all resources (memory, open file descriptors,
  9.  * etc). 
  10.  * 
  11.  * The file_name parameter for these APIs may be of the form "foo(bar)" which is
  12.  * NOT interpreted as an archive name and a member name in that archive.  As
  13.  * these API deal with prebinding and prebound binaries ready for execution
  14.  * can't be in archives.
  15.  * 
  16.  * If the executable_path parameter for these APIs is not NULL it is used for
  17.  * any dependent library has a path that starts with "@executable_path". Then
  18.  * "@executable_path" is replaced with executable_path. 
  19.  * 
  20.  * If the root_dir parameter is not NULL it is prepended to all the rooted
  21.  * dependent library paths. 
  22.  */
  23.  
  24. /*
  25.  * dependent_libs() takes a file_name of a binary and returns a malloc(3)'ed
  26.  * array of pointers (NULL terminated) to names (also malloc(3)'ed and '\0'
  27.  * terminated names) of all the dependent libraries for that binary (not
  28.  * recursive) for all of the architectures of that binary.  If successful
  29.  * dependent_libs() returns a non NULL value (at minimum a pointer to one NULL
  30.  * pointer). If unsuccessful dependent_libs() returns NULL.
  31.  */ 
  32. extern
  33. char **
  34. dependent_libs(
  35. const char *file_name,
  36. const char *program_name,
  37. char **error_message);
  38.  
  39. /*
  40.  * redo_prebinding() takes a file_name of a binary and redoes the prebinding on
  41.  * it.  If output_file is not NULL the update file is written to output_file,
  42.  * if not it is written to file_name.  If redo_prebinding() is successful it
  43.  * returns 0 otherwise it returns 1.  If not all architectures can be updated
  44.  * it is not successful and nothing is done.
  45.  *
  46.  * The not yet supported slide_to_address parameter should be passed a value of
  47.  * zero. When supported a non-zero value will be the address a dynamic library
  48.  * is to be relocated to as its preferred address.
  49.  */
  50. extern 
  51. int
  52. redo_prebinding(
  53. const char *file_name,
  54. const char *executable_path,
  55. const char *root_dir,
  56. const char *output_file,
  57. const char *program_name,
  58. char **error_message,
  59. unsigned long slide_to_address /* not yet supported parameter */ );
  60.  
  61.  
  62. /* return values for needs_redo_prebinding() */
  63. enum needs_redo_prebinding_retval {
  64.     PREBINDING_UPTODATE,  /* a binary who's prebinding is up todate */
  65.     PREBINDING_OUTOFDATE, /* a binary who's prebinding is out of date */
  66.     NOT_PREBOUND,      /* a binary, but not built prebound */
  67.     NOT_PREBINDABLE,      /* not a binary, prebinding does not apply */
  68.     PREBINDING_UNKNOWN      /* a binary who's prebinding can't be determined
  69.                  because it is malformed, a library it depends
  70.                  on is missing, etc. */
  71. };
  72.  
  73. /*
  74.  * needs_redo_prebinding() takes a file_name and determines if it is a binary
  75.  * and if its prebinding is uptodate.  It returns one of the return values
  76.  * above depending on the state of the binary and libraries.  The value returned
  77.  * is based on the first architecture for fat files.
  78.  */
  79. extern
  80. enum needs_redo_prebinding_retval
  81. needs_redo_prebinding(
  82. const char *file_name,
  83. const char *executable_path,
  84. const char *root_dir,
  85. const char *program_name,
  86. char **error_message);
  87.