Fabcoin Core
0.16.2
P2P Digital Currency
|
#include "io.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <libgen.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pwd.h>
Go to the source code of this file.
Functions | |
FILE * | ethash_fopen (char const *file_name, char const *mode) |
An fopen wrapper for no-warnings crossplatform fopen. More... | |
char * | ethash_strncat (char *dest, size_t dest_size, char const *src, size_t count) |
An strncat wrapper for no-warnings crossplatform strncat. More... | |
bool | ethash_mkdir (char const *dirname) |
A cross-platform mkdir wrapper to create a directory or assert it's there. More... | |
int | ethash_fileno (FILE *f) |
Get a file descriptor number from a FILE stream. More... | |
char * | ethash_io_create_filename (char const *dirname, char const *filename, size_t filename_length) |
Create the filename for the DAG. More... | |
bool | ethash_file_size (FILE *f, size_t *ret_size) |
Get a file's size. More... | |
bool | ethash_get_default_dirname (char *strbuf, size_t buffsize) |
Gets the default directory name for the DAG depending on the system. More... | |
Definition in file io_posix.c.
bool ethash_file_size | ( | FILE * | f, |
size_t * | ret_size | ||
) |
Get a file's size.
[in] | f | The open file stream whose size to get |
[out] | size | Pass a size_t by reference to contain the file size |
Definition at line 78 of file io_posix.c.
int ethash_fileno | ( | FILE * | f | ) |
Get a file descriptor number from a FILE stream.
f | The file stream whose fd to get |
Definition at line 48 of file io_posix.c.
FILE* ethash_fopen | ( | char const * | file_name, |
char const * | mode | ||
) |
An fopen wrapper for no-warnings crossplatform fopen.
Msvc compiler considers fopen to be insecure and suggests to use their alternative. This is a wrapper for this alternative. Another way is to #define _CRT_SECURE_NO_WARNINGS, but disabling all security warnings does not sound like a good idea.
file_name | The path to the file to open |
mode | Opening mode. Check fopen() |
Definition at line 32 of file io_posix.c.
bool ethash_get_default_dirname | ( | char * | strbuf, |
size_t | buffsize | ||
) |
Gets the default directory name for the DAG depending on the system.
The spec defining this directory is here: https://github.com/ethereum/wiki/wiki/Ethash-DAG
[out] | strbuf | A string buffer of sufficient size to keep the null termninated string of the directory name |
[in] | buffsize | Size of strbuf in bytes |
Definition at line 89 of file io_posix.c.
char* ethash_io_create_filename | ( | char const * | dirname, |
char const * | filename, | ||
size_t | filename_length | ||
) |
Create the filename for the DAG.
dirname | The directory name in which the DAG file should reside If it does not end with a directory separator it is appended. |
filename | The actual name of the file |
filename_length | The length of the filename in bytes |
Definition at line 53 of file io_posix.c.
bool ethash_mkdir | ( | char const * | dirname | ) |
A cross-platform mkdir wrapper to create a directory or assert it's there.
dirname | The full path of the directory to create |
Definition at line 42 of file io_posix.c.
char* ethash_strncat | ( | char * | dest, |
size_t | dest_size, | ||
char const * | src, | ||
size_t | count | ||
) |
An strncat wrapper for no-warnings crossplatform strncat.
Msvc compiler considers strncat to be insecure and suggests to use their alternative. This is a wrapper for this alternative. Another way is to #define _CRT_SECURE_NO_WARNINGS, but disabling all security warnings does not sound like a good idea.
des | Destination buffer |
dest_size | Maximum size of the destination buffer. This is the extra argument for the MSVC secure strncat |
src | Souce buffer |
count | Number of bytes to copy from source |
Definition at line 37 of file io_posix.c.