source: box/trunk/lib/intercept/intercept.h @ 2351

Revision 2351, 1.7 KB checked in by chris, 4 years ago (diff)

Ensure that _FILE_OFFSET_BITS is defined before testing its value.

Move definition of DEFINE_ONLY_OPEN64 into intercept.cpp which is
the only place that should use it.

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    intercept.h
5//              Purpose: Syscall interception code for unit tests
6//              Created: 2006/11/29
7//
8// --------------------------------------------------------------------------
9
10#ifndef INTERCEPT_H
11#define INTERCEPT_H
12#ifndef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
13
14#include <dirent.h>
15
16#include <sys/types.h>
17#include <sys/stat.h>
18
19extern "C"
20{
21        typedef DIR           *(opendir_t) (const char *name);
22        typedef struct dirent *(readdir_t) (DIR *dir);
23        typedef struct dirent *(readdir_t) (DIR *dir);
24        typedef int            (closedir_t)(DIR *dir);
25#if defined __GNUC__ && __GNUC__ >= 2
26        #define LINUX_WEIRD_LSTAT
27        #define STAT_STRUCT struct stat /* should be stat64 */
28                typedef int    (lstat_t)   (int ver, const char *file_name, 
29                                            STAT_STRUCT *buf);
30#else
31        #define STAT_STRUCT struct stat
32                typedef int    (lstat_t)   (const char *file_name, 
33                                            STAT_STRUCT *buf);
34#endif
35}
36
37typedef int (lstat_post_hook_t) (int old_ret, const char *file_name,
38        struct stat *buf);
39
40void intercept_setup_error(const char *filename, unsigned int errorafter, 
41        int errortoreturn, int syscalltoerror);
42void intercept_setup_delay(const char *filename, unsigned int delay_after,
43        int delay_ms, int syscall_to_delay, int num_delays);
44bool intercept_triggered();
45
46void intercept_setup_readdir_hook(const char *dirname,  readdir_t hookfn);
47void intercept_setup_lstat_hook  (const char *filename, lstat_t   hookfn);
48void intercept_setup_lstat_post_hook(lstat_post_hook_t hookfn);
49void intercept_setup_stat_post_hook (lstat_post_hook_t hookfn);
50
51void intercept_clear_setup();
52
53#endif // !PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
54#endif // !INTERCEPT_H
Note: See TracBrowser for help on using the repository browser.