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
9e6663d9
Commit
9e6663d9
authored
May 23, 2016
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fscanf and vfscanf wrappers
- needs testing
parent
da08451f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
1 deletion
+60
-1
darshan-runtime/lib/darshan-stdio.c
darshan-runtime/lib/darshan-stdio.c
+58
-1
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
+2
-0
No files found.
darshan-runtime/lib/darshan-stdio.c
View file @
9e6663d9
...
...
@@ -16,6 +16,7 @@
* - POSIX_FWRITES
* - POSIX_FSEEKS
* - add regression test cases for all functions captured here
* - especially the scanf and printf variants
*/
/* catalog of stdio functions instrumented by this module
...
...
@@ -39,7 +40,8 @@
* int fgetc(FILE *); DONE
* char *fgets(char *, int, FILE *); DONE
* size_t fread(void *, size_t, size_t, FILE *); DONE
* int fscanf(FILE *, const char *, ...);
* int fscanf(FILE *, const char *, ...); DONE
* int vfscanf(FILE *, const char *, va_list); DONE
* int getc(FILE *);
* int getc_unlocked(FILE *);
* int getw(FILE *);
...
...
@@ -100,6 +102,8 @@ DARSHAN_FORWARD_DECL(fflush, 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
));
DARSHAN_FORWARD_DECL
(
fgetc
,
int
,
(
FILE
*
stream
));
DARSHAN_FORWARD_DECL
(
fscanf
,
int
,
(
FILE
*
stream
,
const
char
*
format
,
...));
DARSHAN_FORWARD_DECL
(
vfscanf
,
int
,
(
FILE
*
stream
,
const
char
*
format
,
va_list
ap
));
DARSHAN_FORWARD_DECL
(
fgets
,
char
*
,
(
char
*
s
,
int
size
,
FILE
*
stream
));
DARSHAN_FORWARD_DECL
(
fseek
,
int
,
(
FILE
*
stream
,
long
offset
,
int
whence
));
...
...
@@ -449,6 +453,59 @@ size_t DARSHAN_DECL(fgetc)(FILE *stream)
return
(
ret
);
}
int
DARSHAN_DECL
(
fscanf
)(
FILE
*
stream
,
const
char
*
format
,
...)
{
int
ret
;
double
tm1
,
tm2
;
va_list
ap
;
long
start_off
,
end_off
;
MAP_OR_FAIL
(
vfscanf
);
tm1
=
darshan_core_wtime
();
/* NOTE: we intentionally switch to vfscanf here to handle the variable
* length arguments.
*/
start_off
=
ftell
(
stream
);
va_start
(
ap
,
format
);
ret
=
__real_vfscanf
(
stream
,
format
,
ap
);
va_end
(
ap
);
end_off
=
ftell
(
stream
);
tm2
=
darshan_core_wtime
();
STDIO_LOCK
();
stdio_runtime_initialize
();
if
(
ret
!=
0
)
STDIO_RECORD_READ
(
stream
,
end_off
-
start_off
,
tm1
,
tm2
);
STDIO_UNLOCK
();
return
(
ret
);
}
int
DARSHAN_DECL
(
vfscanf
)(
FILE
*
stream
,
const
char
*
format
,
va_list
ap
)
{
int
ret
;
double
tm1
,
tm2
;
long
start_off
,
end_off
;
MAP_OR_FAIL
(
vfscanf
);
tm1
=
darshan_core_wtime
();
start_off
=
ftell
(
stream
);
ret
=
__real_vfscanf
(
stream
,
format
,
ap
);
end_off
=
ftell
(
stream
);
tm2
=
darshan_core_wtime
();
STDIO_LOCK
();
stdio_runtime_initialize
();
if
(
ret
!=
0
)
STDIO_RECORD_READ
(
stream
,
end_off
-
start_off
,
tm1
,
tm2
);
STDIO_UNLOCK
();
return
(
ret
);
}
char
*
DARSHAN_DECL
(
fgets
)(
char
*
s
,
int
size
,
FILE
*
stream
)
{
char
*
ret
;
...
...
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
View file @
9e6663d9
...
...
@@ -8,5 +8,7 @@
--wrap=fwrite
--wrap=fread
--wrap=fgetc
--wrap=fscanf
--wrap=vfscanf
--wrap=fgets
--wrap=fseek
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