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
b947ea15
Commit
b947ea15
authored
Feb 06, 2012
by
Julius Plenz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-init mutex after possible fork
parent
cff43372
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
nocache.c
nocache.c
+11
-1
No files found.
nocache.c
View file @
b947ea15
...
...
@@ -15,6 +15,8 @@ int (*_original_openat)(int dirfd, const char *pathname, int flags, mode_t mode)
int
(
*
_original_close
)(
int
fd
);
void
init
(
void
)
__attribute__
((
constructor
));
void
init_mutex
(
void
);
int
open
(
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
int
open64
(
const
char
*
pathname
,
int
flags
,
mode_t
mode
)
__attribute__
((
alias
(
"open"
)));
...
...
@@ -30,6 +32,7 @@ int close(int fd);
static
void
store_pageinfo
(
int
fd
);
static
void
free_unclaimed_pages
(
int
fd
);
extern
int
fadv_dontneed
(
int
fd
,
off_t
offset
,
off_t
len
);
extern
int
fadv_noreuse
(
int
fd
,
off_t
offset
,
off_t
len
);
extern
void
sync_if_writable
(
int
fd
);
...
...
@@ -56,10 +59,17 @@ void init(void)
_original_openat
=
(
int
(
*
)(
int
,
const
char
*
,
int
,
mode_t
))
dlsym
(
RTLD_NEXT
,
"openat"
);
_original_close
=
(
int
(
*
)(
int
))
dlsym
(
RTLD_NEXT
,
"close"
);
pthread_mutex_init
(
&
lock
,
NULL
);
PAGESIZE
=
getpagesize
();
for
(
i
=
0
;
i
<
_MAX_FDS
;
i
++
)
fds
[
i
].
fd
=
-
1
;
init_mutex
();
}
void
init_mutex
(
void
)
{
pthread_mutex_init
(
&
lock
,
NULL
);
/* make sure to re-initialize mutex if forked */
pthread_atfork
(
NULL
,
NULL
,
init_mutex
);
}
int
open
(
const
char
*
pathname
,
int
flags
,
mode_t
mode
)
...
...
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