Rizin
unix-like reverse engineering framework and cli tools
|
#include "platform.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <utime.h>
#include <time.h>
#include <limits.h>
#include <errno.h>
Go to the source code of this file.
Macros | |
#define | UTIL_fseek fseek |
#define | SET_REALTIME_PRIORITY /* disabled */ |
#define | UTIL_sleep(s) /* disabled */ |
#define | UTIL_sleepMilli(milli) /* disabled */ |
#define | UTIL_TYPE_stat stat |
#define | UTIL_stat stat |
#define | UTIL_fstat fstat |
#define | UTIL_STAT_MODE_ISREG(st_mode) (S_ISREG(st_mode)) |
#define | UTIL_fileno fileno |
#define | LIST_SIZE_INCREASE (8*1024) |
#define | UTIL_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ |
Typedefs | |
typedef unsigned char | BYTE |
typedef unsigned short | U16 |
typedef signed short | S16 |
typedef unsigned int | U32 |
typedef signed int | S32 |
typedef unsigned long long | U64 |
typedef signed long long | S64 |
typedef clock_t | UTIL_time_t |
typedef struct stat | stat_t |
#define UTIL_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ |
typedef clock_t UTIL_time_t |
UTIL_STATIC U64 UTIL_clockSpanMicro | ( | UTIL_time_t | clockStart | ) |
Definition at line 284 of file util.h.
References UTIL_getSpanTimeMicro(), and UTIL_getTime().
Referenced by BMK_benchMem().
UTIL_STATIC U64 UTIL_clockSpanNano | ( | UTIL_time_t | clockStart | ) |
Definition at line 291 of file util.h.
References UTIL_getSpanTimeNano(), and UTIL_getTime().
Referenced by BMK_benchMem(), and LZ4IO_compressFilename().
UTIL_STATIC const char** UTIL_createFileList | ( | const char ** | inputNames, |
unsigned | inputNamesNb, | ||
char ** | allocatedBuffer, | ||
unsigned * | allocatedNamesNb | ||
) |
Definition at line 584 of file util.h.
References assert(), free(), i, len, LIST_SIZE_INCREASE, malloc(), memcpy(), NULL, pos, unsigned, UTIL_isDirectory(), UTIL_prepareFileList(), and UTIL_realloc().
Referenced by main().
UTIL_STATIC void UTIL_freeFileList | ( | const char ** | filenameTable, |
char * | allocatedBuffer | ||
) |
UTIL_STATIC U64 UTIL_getFileSize | ( | const char * | infilename | ) |
Definition at line 407 of file util.h.
References r, UTIL_stat, UTIL_STAT_MODE_ISREG, and UTIL_TYPE_stat.
Referenced by BMK_benchFiles(), BMK_loadFiles(), fullSpeedBench(), and UTIL_getTotalFileSize().
UTIL_STATIC int UTIL_getFileStat | ( | const char * | infilename, |
stat_t * | statbuf | ||
) |
Definition at line 354 of file util.h.
References r, S_ISREG, and stat.
Referenced by LZ4IO_compressFilename_extRess(), LZ4IO_decompressDstFile(), and UTIL_isRegFile().
UTIL_STATIC U64 UTIL_getOpenFileSize | ( | FILE * | file | ) |
Definition at line 390 of file util.h.
References test-lz4-list::exit, fd, r, UTIL_fileno, UTIL_fstat, UTIL_STAT_MODE_ISREG, and UTIL_TYPE_stat.
Referenced by LZ4IO_compressFilename_extRess(), and LZ4IO_getCompressedFileInfo().
UTIL_STATIC U64 UTIL_getSpanTimeMicro | ( | UTIL_time_t | clockStart, |
UTIL_time_t | clockEnd | ||
) |
Definition at line 278 of file util.h.
Referenced by UTIL_clockSpanMicro().
UTIL_STATIC U64 UTIL_getSpanTimeNano | ( | UTIL_time_t | clockStart, |
UTIL_time_t | clockEnd | ||
) |
Definition at line 279 of file util.h.
Referenced by UTIL_clockSpanNano().
UTIL_STATIC UTIL_time_t UTIL_getTime | ( | void | ) |
Definition at line 277 of file util.h.
Referenced by BMK_benchMem(), LZ4IO_compressFilename(), UTIL_clockSpanMicro(), and UTIL_clockSpanNano().
UTIL_STATIC U64 UTIL_getTotalFileSize | ( | const char ** | fileNamesTable, |
unsigned | nbFiles | ||
) |
Definition at line 418 of file util.h.
References n, and UTIL_getFileSize().
Referenced by BMK_benchFileTable().
UTIL_STATIC U32 UTIL_isDirectory | ( | const char * | infilename | ) |
Definition at line 375 of file util.h.
References r, S_ISDIR, and stat.
Referenced by BMK_loadFiles(), and UTIL_createFileList().
UTIL_STATIC int UTIL_isRegFile | ( | const char * | infilename | ) |
Definition at line 368 of file util.h.
References UTIL_getFileStat().
Referenced by LZ4IO_displayCompressedFilesInfo(), main(), and UTIL_setFileStat().
UTIL_STATIC int UTIL_prepareFileList | ( | const char * | dirName, |
char ** | bufStart, | ||
size_t * | pos, | ||
char ** | bufEnd | ||
) |
Definition at line 568 of file util.h.
References pos.
Referenced by UTIL_createFileList().
UTIL_STATIC void* UTIL_realloc | ( | void * | ptr, |
size_t | size | ||
) |
UTIL_STATIC int UTIL_setFileStat | ( | const char * | filename, |
stat_t * | statbuf | ||
) |
Definition at line 322 of file util.h.
References chmod, chown, NULL, time, UTIL_isRegFile(), and utime.
Referenced by LZ4IO_compressFilename_extRess(), and LZ4IO_decompressDstFile().
UTIL_STATIC void UTIL_waitForNextTick | ( | void | ) |