Back to index

glibc  2.9
Defines | Functions
check-localplt.c File Reference
#include <byteswap.h>
#include <elf.h>
#include <endian.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "check-localplt.c"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define BITS   32
#define BITS   64

Functions

static int handle_file (const char *fname)
int main (int argc, char *argv[])

Define Documentation

#define BITS   32

Definition at line 245 of file check-localplt.c.

#define BITS   64

Definition at line 245 of file check-localplt.c.


Function Documentation

static int handle_file ( const char *  fname) [static]

Definition at line 250 of file check-localplt.c.

{
  int fd = open (fname, O_RDONLY);
  if (fd == -1)
    {
      printf ("cannot open %s: %m\n", fname);
      return 1;
    }

  /* Read was is supposed to be the ELF header.  Read the initial
     bytes to determine whether this is a 32 or 64 bit file.  */
  char ident[EI_NIDENT];
  if (read (fd, ident, EI_NIDENT) != EI_NIDENT)
    {
      printf ("%s: read error: %m\n", fname);
      close (fd);
      return 1;
    }

  if (memcmp (&ident[EI_MAG0], ELFMAG, SELFMAG) != 0)
    {
      printf ("%s: not an ELF file\n", fname);
      close (fd);
      return 1;
    }

  int result;
  if (ident[EI_CLASS] == ELFCLASS64)
    result = handle_file64 (fname, fd);
  else
    result = handle_file32 (fname, fd);

  close (fd);

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 289 of file check-localplt.c.

{
  int cnt;
  int result = 0;

  for (cnt = 1; cnt < argc; ++cnt)
    result |= handle_file (argv[cnt]);

  return result;
}

Here is the call graph for this function: