58 lines
1022 B
C
58 lines
1022 B
C
#ifndef _FT_NM_H
|
|
# define _FT_NM_H
|
|
|
|
# include <unistd.h>
|
|
# include <sys/mman.h>
|
|
# include <fcntl.h>
|
|
# include <stdio.h>
|
|
# include <elf.h>
|
|
# include <sys/stat.h>
|
|
# include <stdbool.h>
|
|
# include <stdarg.h>
|
|
|
|
# include "libft.h"
|
|
|
|
# define FT_NM_SUCCESS 0
|
|
# define FT_NM_FAILURE -1
|
|
|
|
typedef enum e_verbosity {
|
|
DEFAULT_VERBOSITY,
|
|
ALL,
|
|
GLOBAL,
|
|
UNDEFINED
|
|
} t_verbosity;
|
|
|
|
typedef enum e_ordering {
|
|
DEFAULT_ORDERING,
|
|
REVERSE,
|
|
NOSORT
|
|
} t_ordering;
|
|
|
|
typedef struct s_env {
|
|
char *bin_name;
|
|
t_verbosity verbosity;
|
|
t_ordering ordering;
|
|
t_list *list;
|
|
int list_len;
|
|
bool has_multiple_files;
|
|
} t_env;
|
|
|
|
typedef struct s_mapped_file {
|
|
void *ptr;
|
|
off_t size;
|
|
} t_mapped_file;
|
|
|
|
void ft_printf(const char *format, ...);
|
|
void ft_nm_error(const char *path);
|
|
|
|
int check_ident(unsigned char ident[EI_NIDENT]);
|
|
void *fetch(t_mapped_file mapped_file, size_t offset, size_t fetch_size);
|
|
|
|
int nm32(t_mapped_file mapped_file);
|
|
|
|
int nm64(t_mapped_file mapped_file);
|
|
int get_header64(t_mapped_file mapped_file, Elf64_Ehdr *header);
|
|
|
|
#endif
|
|
|