Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
addnote.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

Go to the source code of this file.

Macros

#define N_DESCR   6
 
#define N_RPA_DESCR   8
 
#define ROUNDUP(len)   (((len) + 3) & ~3)
 
#define GET_16BE(off)   ((buf[off] << 8) + (buf[(off)+1]))
 
#define GET_32BE(off)   ((GET_16BE(off) << 16) + GET_16BE((off)+2))
 
#define PUT_16BE(off, v)
 
#define PUT_32BE(off, v)
 
#define E_IDENT   0 /* ELF header */
 
#define E_PHOFF   28
 
#define E_PHENTSIZE   42
 
#define E_PHNUM   44
 
#define E_HSIZE   52 /* size of ELF header */
 
#define EI_MAGIC   0 /* offsets in E_IDENT area */
 
#define EI_CLASS   4
 
#define EI_DATA   5
 
#define PH_TYPE   0 /* ELF program header */
 
#define PH_OFFSET   4
 
#define PH_FILESZ   16
 
#define PH_HSIZE   32 /* size of program header */
 
#define PT_NOTE   4 /* Program header type = note */
 
#define ELFCLASS32   1
 
#define ELFDATA2MSB   2
 

Functions

int main (int ac, char **av)
 

Variables

unsigned int descr [N_DESCR]
 
unsigned int rpanote [N_RPA_DESCR]
 
unsigned char buf [512]
 
unsigned char elf_magic [4] = { 0x7f, 'E', 'L', 'F' }
 

Macro Definition Documentation

#define E_HSIZE   52 /* size of ELF header */

Definition at line 73 of file addnote.c.

#define E_IDENT   0 /* ELF header */

Definition at line 69 of file addnote.c.

#define E_PHENTSIZE   42

Definition at line 71 of file addnote.c.

#define E_PHNUM   44

Definition at line 72 of file addnote.c.

#define E_PHOFF   28

Definition at line 70 of file addnote.c.

#define EI_CLASS   4

Definition at line 76 of file addnote.c.

#define EI_DATA   5

Definition at line 77 of file addnote.c.

#define EI_MAGIC   0 /* offsets in E_IDENT area */

Definition at line 75 of file addnote.c.

#define ELFCLASS32   1

Definition at line 86 of file addnote.c.

#define ELFDATA2MSB   2

Definition at line 87 of file addnote.c.

#define GET_16BE (   off)    ((buf[off] << 8) + (buf[(off)+1]))

Definition at line 60 of file addnote.c.

#define GET_32BE (   off)    ((GET_16BE(off) << 16) + GET_16BE((off)+2))

Definition at line 61 of file addnote.c.

#define N_DESCR   6

Definition at line 25 of file addnote.c.

#define N_RPA_DESCR   8

Definition at line 44 of file addnote.c.

#define PH_FILESZ   16

Definition at line 81 of file addnote.c.

#define PH_HSIZE   32 /* size of program header */

Definition at line 82 of file addnote.c.

#define PH_OFFSET   4

Definition at line 80 of file addnote.c.

#define PH_TYPE   0 /* ELF program header */

Definition at line 79 of file addnote.c.

#define PT_NOTE   4 /* Program header type = note */

Definition at line 84 of file addnote.c.

#define PUT_16BE (   off,
  v 
)
Value:
(buf[off] = ((v) >> 8) & 0xff, \
buf[(off) + 1] = (v) & 0xff)

Definition at line 63 of file addnote.c.

#define PUT_32BE (   off,
  v 
)
Value:
(PUT_16BE((off), (v) >> 16), \
PUT_16BE((off) + 2, (v)))

Definition at line 65 of file addnote.c.

#define ROUNDUP (   len)    (((len) + 3) & ~3)

Definition at line 56 of file addnote.c.

Function Documentation

int main ( int  ac,
char **  av 
)

Definition at line 92 of file addnote.c.

Variable Documentation

unsigned char buf[512]

Definition at line 58 of file addnote.c.

unsigned int descr[N_DESCR]
Initial value:
= {
0xffffffff,
0x02000000,
0xffffffff,
0xffffffff,
0xffffffff,
0x4000,
}

Definition at line 26 of file addnote.c.

unsigned char elf_magic[4] = { 0x7f, 'E', 'L', 'F' }

Definition at line 89 of file addnote.c.

unsigned int rpanote[N_RPA_DESCR]
Initial value:
= {
0,
64,
0,
40,
1,
-1,
0,
1,
}

Definition at line 45 of file addnote.c.