11#ifndef __FILE_UTIL_H__
12#define __FILE_UTIL_H__
16#include "ws_symbol_export.h"
38#define IO_BUF_SIZE (64 * 1024)
47#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
50#define S_IFIFO _S_IFIFO
53#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
56#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
64#define ws_statb64 struct _stat64
81WS_DLL_PUBLIC
int ws_stdio_open (
const char *filename,
int flags,
int mode);
82WS_DLL_PUBLIC
int ws_stdio_rename (
const char *oldfilename,
const char *newfilename);
83WS_DLL_PUBLIC
int ws_stdio_mkdir (
const char *filename,
int mode);
84WS_DLL_PUBLIC
int ws_stdio_stat64 (
const char *filename, ws_statb64 *buf);
85WS_DLL_PUBLIC
int ws_stdio_unlink (
const char *filename);
86WS_DLL_PUBLIC
int ws_stdio_remove (
const char *filename);
88WS_DLL_PUBLIC FILE * ws_stdio_fopen (
const char *filename,
const char *mode);
89WS_DLL_PUBLIC FILE * ws_stdio_freopen (
const char *filename,
const char *mode, FILE *
stream);
91#define ws_open ws_stdio_open
92#define ws_rename ws_stdio_rename
93#define ws_mkdir ws_stdio_mkdir
94#define ws_stat64 ws_stdio_stat64
95#define ws_unlink ws_stdio_unlink
96#define ws_remove ws_stdio_remove
97#define ws_fopen ws_stdio_fopen
98#define ws_freopen ws_stdio_freopen
105typedef unsigned int ws_file_size_t;
106typedef signed int ws_file_ssize_t;
109#define ws_write _write
110#define ws_close _close
112#define ws_fseek64 _fseeki64
113#define ws_fstat64 _fstati64
114#define ws_ftell64 _ftelli64
115#define ws_lseek64 _lseeki64
116#define ws_fdopen _fdopen
117#define ws_fileno _fileno
118#define ws_isatty _isatty
119#define ws_getc_unlocked _fgetc_nolock
125#define ws_getpid _getpid
126#define ws_umask _umask
136bool ws_init_dll_search_path(
void);
146void *ws_load_library(
const char *library_name);
154GModule *load_wpcap_module(
void);
160WS_DLL_PUBLIC
void create_app_running_mutex(
void);
164WS_DLL_PUBLIC
void close_app_running_mutex(
void);
168WS_DLL_PUBLIC
int ws_close_if_possible(
int fd);
175#define ws_statb64 struct stat
179#define ws_rename rename
180#define ws_mkdir(dir,mode) mkdir(dir,mode)
181#define ws_stat64 stat
182#define ws_unlink unlink
183#define ws_remove remove
184#define ws_fopen fopen
185#define ws_freopen freopen
187typedef size_t ws_file_size_t;
188typedef ssize_t ws_file_ssize_t;
191#define ws_write write
196#define ws_close ::close
198#define ws_close close
201#define ws_close_if_possible ws_close
205#define ws_fseek64 fseeko
206#define ws_ftell64 ftello
208#define ws_fseek64(fh,offset,whence) fseek(fh,(long)(offset),whence)
209#define ws_ftell64 ftell
211#define ws_fstat64 fstat
212#define ws_lseek64 lseek
213#define ws_fdopen fdopen
214#define ws_fileno fileno
215#define ws_isatty isatty
216#define ws_getc_unlocked getc_unlocked
220#define ws_getpid getpid
221#define ws_umask umask
227#define WS_DIRENT const char
228#define ws_dir_open g_dir_open
229#define ws_dir_read_name g_dir_read_name
230#define ws_dir_get_name(dirent) dirent
231#define ws_dir_rewind g_dir_rewind
232#define ws_dir_close g_dir_close