Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nocache
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Danil Mikhailov
nocache
Commits
8e6e56b0
Commit
8e6e56b0
authored
Feb 06, 2012
by
Julius Plenz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tar-quirks'
* tar-quirks: Add an alias __openat_2() for openat() intercept creat()
parents
eee311d0
36ee5ac3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
nocache.c
nocache.c
+17
-0
No files found.
nocache.c
View file @
8e6e56b0
...
@@ -10,11 +10,16 @@
...
@@ -10,11 +10,16 @@
#include <pthread.h>
#include <pthread.h>
int
(
*
_original_open
)(
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
int
(
*
_original_open
)(
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
int
(
*
_original_creat
)(
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
int
(
*
_original_openat
)(
int
dirfd
,
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
int
(
*
_original_openat
)(
int
dirfd
,
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
int
(
*
_original_close
)(
int
fd
);
int
(
*
_original_close
)(
int
fd
);
void
init
(
void
)
__attribute__
((
constructor
));
void
init
(
void
)
__attribute__
((
constructor
));
int
open
(
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
int
open
(
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
int
creat
(
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
int
openat
(
int
dirfd
,
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
int
__openat_2
(
int
dirfd
,
const
char
*
pathname
,
int
flags
,
mode_t
mode
)
__attribute__
((
alias
(
"openat"
)));
int
close
(
int
fd
);
int
close
(
int
fd
);
static
void
store_pageinfo
(
int
fd
);
static
void
store_pageinfo
(
int
fd
);
...
@@ -40,6 +45,8 @@ void init(void)
...
@@ -40,6 +45,8 @@ void init(void)
int
i
;
int
i
;
_original_open
=
(
int
(
*
)(
const
char
*
,
int
,
mode_t
))
_original_open
=
(
int
(
*
)(
const
char
*
,
int
,
mode_t
))
dlsym
(
RTLD_NEXT
,
"open"
);
dlsym
(
RTLD_NEXT
,
"open"
);
_original_creat
=
(
int
(
*
)(
const
char
*
,
int
,
mode_t
))
dlsym
(
RTLD_NEXT
,
"creat"
);
_original_openat
=
(
int
(
*
)(
int
,
const
char
*
,
int
,
mode_t
))
_original_openat
=
(
int
(
*
)(
int
,
const
char
*
,
int
,
mode_t
))
dlsym
(
RTLD_NEXT
,
"openat"
);
dlsym
(
RTLD_NEXT
,
"openat"
);
_original_close
=
(
int
(
*
)(
int
))
dlsym
(
RTLD_NEXT
,
"close"
);
_original_close
=
(
int
(
*
)(
int
))
dlsym
(
RTLD_NEXT
,
"close"
);
...
@@ -59,6 +66,16 @@ int open(const char *pathname, int flags, mode_t mode)
...
@@ -59,6 +66,16 @@ int open(const char *pathname, int flags, mode_t mode)
return
fd
;
return
fd
;
}
}
int
creat
(
const
char
*
pathname
,
int
flags
,
mode_t
mode
)
{
int
fd
;
if
((
fd
=
_original_creat
(
pathname
,
flags
,
mode
))
!=
-
1
)
{
store_pageinfo
(
fd
);
fadv_noreuse
(
fd
,
0
,
0
);
}
return
fd
;
}
int
openat
(
int
dirfd
,
const
char
*
pathname
,
int
flags
,
mode_t
mode
)
int
openat
(
int
dirfd
,
const
char
*
pathname
,
int
flags
,
mode_t
mode
)
{
{
int
fd
;
int
fd
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment