Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
darshan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
72
Issues
72
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
darshan
darshan
Commits
e025a97f
Commit
e025a97f
authored
May 23, 2016
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
freopen wrapper
parent
9930d72a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
10 deletions
+31
-10
darshan-runtime/lib/darshan-stdio.c
darshan-runtime/lib/darshan-stdio.c
+30
-10
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
+1
-0
No files found.
darshan-runtime/lib/darshan-stdio.c
View file @
e025a97f
...
...
@@ -24,7 +24,7 @@
* --------------
* FILE *fdopen(int, const char *); DONE
* FILE *fopen(const char *, const char *); DONE
* FILE *freopen(const char *, const char *, FILE *);
* FILE *freopen(const char *, const char *, FILE *);
DONE
*
* functions for closing streams
* --------------
...
...
@@ -94,6 +94,7 @@
DARSHAN_FORWARD_DECL
(
fopen
,
FILE
*
,
(
const
char
*
path
,
const
char
*
mode
));
DARSHAN_FORWARD_DECL
(
fopen64
,
FILE
*
,
(
const
char
*
path
,
const
char
*
mode
));
DARSHAN_FORWARD_DECL
(
fdopen
,
FILE
*
,
(
int
fd
,
const
char
*
mode
));
DARSHAN_FORWARD_DECL
(
freopen
,
FILE
*
,
(
const
char
*
path
,
const
char
*
mode
,
FILE
*
stream
));
DARSHAN_FORWARD_DECL
(
fclose
,
int
,
(
FILE
*
fp
));
DARSHAN_FORWARD_DECL
(
fwrite
,
size_t
,
(
const
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
FILE
*
stream
));
DARSHAN_FORWARD_DECL
(
fread
,
size_t
,
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
FILE
*
stream
));
...
...
@@ -255,26 +256,26 @@ static void stdio_shutdown(void);
DARSHAN_TIMER_INC_NO_OVERLAP(file->file_record->fcounters[STDIO_F_WRITE_TIME], __tm1, __tm2, file->last_write_end); \
} while(0)
FILE
*
DARSHAN_DECL
(
f
dopen
)(
int
fd
,
const
char
*
mode
)
FILE
*
DARSHAN_DECL
(
f
open
)(
const
char
*
path
,
const
char
*
mode
)
{
FILE
*
ret
;
double
tm1
,
tm2
;
MAP_OR_FAIL
(
f
d
open
);
MAP_OR_FAIL
(
fopen
);
tm1
=
darshan_core_wtime
();
ret
=
__real_f
dopen
(
fd
,
mode
);
ret
=
__real_f
open
(
path
,
mode
);
tm2
=
darshan_core_wtime
();
STDIO_LOCK
();
stdio_runtime_initialize
();
STDIO_RECORD_OPEN
(
ret
,
"UNKNOWN-FDOPEN"
,
tm1
,
tm2
);
STDIO_RECORD_OPEN
(
ret
,
path
,
tm1
,
tm2
);
STDIO_UNLOCK
();
return
(
ret
);
}
FILE
*
DARSHAN_DECL
(
fopen
)(
const
char
*
path
,
const
char
*
mode
)
FILE
*
DARSHAN_DECL
(
fopen
64
)(
const
char
*
path
,
const
char
*
mode
)
{
FILE
*
ret
;
double
tm1
,
tm2
;
...
...
@@ -282,7 +283,7 @@ FILE* DARSHAN_DECL(fopen)(const char *path, const char *mode)
MAP_OR_FAIL
(
fopen
);
tm1
=
darshan_core_wtime
();
ret
=
__real_fopen
(
path
,
mode
);
ret
=
__real_fopen
64
(
path
,
mode
);
tm2
=
darshan_core_wtime
();
STDIO_LOCK
();
...
...
@@ -293,15 +294,34 @@ FILE* DARSHAN_DECL(fopen)(const char *path, const char *mode)
return
(
ret
);
}
FILE
*
DARSHAN_DECL
(
f
open64
)(
const
char
*
path
,
const
char
*
mode
)
FILE
*
DARSHAN_DECL
(
f
dopen
)(
int
fd
,
const
char
*
mode
)
{
FILE
*
ret
;
double
tm1
,
tm2
;
MAP_OR_FAIL
(
fopen
);
MAP_OR_FAIL
(
f
d
open
);
tm1
=
darshan_core_wtime
();
ret
=
__real_fopen64
(
path
,
mode
);
ret
=
__real_fdopen
(
fd
,
mode
);
tm2
=
darshan_core_wtime
();
STDIO_LOCK
();
stdio_runtime_initialize
();
STDIO_RECORD_OPEN
(
ret
,
"UNKNOWN-FDOPEN"
,
tm1
,
tm2
);
STDIO_UNLOCK
();
return
(
ret
);
}
FILE
*
DARSHAN_DECL
(
freopen
)(
const
char
*
path
,
const
char
*
mode
,
FILE
*
stream
)
{
FILE
*
ret
;
double
tm1
,
tm2
;
MAP_OR_FAIL
(
freopen
);
tm1
=
darshan_core_wtime
();
ret
=
__real_freopen
(
path
,
mode
,
stream
);
tm2
=
darshan_core_wtime
();
STDIO_LOCK
();
...
...
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
View file @
e025a97f
...
...
@@ -2,6 +2,7 @@
--wrap=fopen
--wrap=fopen64
--wrap=fdopen
--wrap=freopen
--wrap=fclose
--wrap=fwrite
--wrap=fread
...
...
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