Exemple #1
0
/* Call 'claim file' hook for all plugins.  */
static int
plugin_call_claim_file (const struct ld_plugin_input_file *file, int *claimed)
{
    plugin_t *curplug = plugins_list;
    *claimed = FALSE;
    while (curplug && !*claimed)
    {
        if (curplug->claim_file_handler)
        {
            off_t cur_offset;
            enum ld_plugin_status rv;

            called_plugin = curplug;
            cur_offset = lseek (file->fd, 0, SEEK_CUR);
            rv = (*curplug->claim_file_handler) (file, claimed);
            if (!*claimed)
                lseek (file->fd, cur_offset, SEEK_SET);
            called_plugin = NULL;
            if (rv != LDPS_OK)
                set_plugin_error (curplug->name);
        }
        curplug = curplug->next;
    }
    return plugin_error_p () ? -1 : 0;
}
Exemple #2
0
/* Call 'claim file' hook for all plugins.  */
static int
plugin_call_claim_file (const struct ld_plugin_input_file *file, int *claimed)
{
  plugin_t *curplug = plugins_list;
  *claimed = FALSE;
  while (curplug && !*claimed)
    {
      if (curplug->claim_file_handler)
	{
	  enum ld_plugin_status rv;
	  called_plugin = curplug;
	  rv = (*curplug->claim_file_handler) (file, claimed);
	  called_plugin = NULL;
	  if (rv != LDPS_OK)
	    set_plugin_error (curplug->name);
	}
      curplug = curplug->next;
    }
  return plugin_error_p () ? -1 : 0;
}
/* Call 'cleanup' hook for all plugins at exit.  */
void
plugin_call_cleanup (void)
{
  plugin_t *curplug = plugins_list;
  while (curplug)
    {
      if (curplug->cleanup_handler && !curplug->cleanup_done)
	{
	  enum ld_plugin_status rv;
	  curplug->cleanup_done = TRUE;
	  called_plugin = curplug;
	  rv = (*curplug->cleanup_handler) ();
	  called_plugin = NULL;
	  if (rv != LDPS_OK)
	    set_plugin_error (curplug->name);
	  dlclose (curplug->dlhandle);
	}
      curplug = curplug->next;
    }
  if (plugin_error_p ())
    info_msg (_("%P: %s: error in plugin cleanup (ignored)\n"),
	      plugin_error_plugin ());
}
/* Call 'all symbols read' hook for all plugins.  */
int
plugin_call_all_symbols_read (void)
{
  plugin_t *curplug = plugins_list;

  /* Disable any further file-claiming.  */
  no_more_claiming = TRUE;

  while (curplug)
    {
      if (curplug->all_symbols_read_handler)
	{
	  enum ld_plugin_status rv;
	  called_plugin = curplug;
	  rv = (*curplug->all_symbols_read_handler) ();
	  called_plugin = NULL;
	  if (rv != LDPS_OK)
	    set_plugin_error (curplug->name);
	}
      curplug = curplug->next;
    }
  return plugin_error_p () ? -1 : 0;
}