Move stdout specific functions into their own source file

This commit is contained in:
jsteube
2016-09-08 16:01:24 +02:00
parent a8e5172f16
commit 18534fcdeb
8 changed files with 413 additions and 250 deletions

18
include/filenames.h Normal file
View File

@@ -0,0 +1,18 @@
/**
* Author......: Jens Steube <jens.steube@gmail.com>
* License.....: MIT
*/
#ifndef _FILENAMES_H
#define _FILENAMES_H
#include <stdio.h>
void generate_source_kernel_filename (const uint attack_exec, const uint attack_kern, const uint kern_type, char *shared_dir, char *source_file);
void generate_cached_kernel_filename (const uint attack_exec, const uint attack_kern, const uint kern_type, char *profile_dir, const char *device_name_chksum, char *cached_file);
void generate_source_kernel_mp_filename (const uint opti_type, const uint opts_type, char *shared_dir, char *source_file);
void generate_cached_kernel_mp_filename (const uint opti_type, const uint opts_type, char *profile_dir, const char *device_name_chksum, char *cached_file);
void generate_source_kernel_amp_filename (const uint attack_kern, char *shared_dir, char *source_file);
void generate_cached_kernel_amp_filename (const uint attack_kern, char *profile_dir, const char *device_name_chksum, char *cached_file);
#endif // _FILENAMES_H

View File

@@ -226,3 +226,4 @@ void writeProgramBin (char *dst, u8 *binary, size_t binary_size);
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
int gidd_to_pw_t (hc_device_param_t *device_param, const u64 gidd, pw_t *pw);

36
include/stdout.h Normal file
View File

@@ -0,0 +1,36 @@
/**
* Author......: Jens Steube <jens.steube@gmail.com>
* License.....: MIT
*/
#ifndef _STDOUT_H
#define _STDOUT_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <search.h>
#include <getopt.h>
#include <inttypes.h>
#include <signal.h>
#if defined (_POSIX)
#include <pthread.h>
#include <pwd.h>
#endif // _POSIX
#define STDOUT_FLAG 0
typedef struct
{
FILE *fp;
char buf[BUFSIZ];
int len;
} out_t;
void process_stdout (hc_device_param_t *device_param, const uint pws_cnt);
#endif // _STDOUT_H