Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Shane Snyder
darshan
Commits
489977f7
Commit
489977f7
authored
Dec 12, 2016
by
Cristian Simarro
Browse files
get exe and args from /proc/self/cmdline
parent
55960ccf
Changes
1
Hide whitespace changes
Inline
Side-by-side
darshan-runtime/lib/darshan-core.c
View file @
489977f7
...
@@ -1063,9 +1063,31 @@ static void darshan_get_exe_and_mounts(struct darshan_core_runtime *core,
...
@@ -1063,9 +1063,31 @@ static void darshan_get_exe_and_mounts(struct darshan_core_runtime *core,
*/
*/
if
(
argc
==
0
)
if
(
argc
==
0
)
{
{
strncat
(
core
->
log_exemnt_p
,
__progname_full
,
space_left
);
/* get the name of the executable and the arguments from
space_left
=
DARSHAN_EXE_LEN
-
strlen
(
core
->
log_exemnt_p
);
/proc/self/cmdline */
strncat
(
core
->
log_exemnt_p
,
" <unknown args>"
,
space_left
);
FILE
*
fh
;
int
i
,
ii
;
char
cmdl
[
DARSHAN_EXE_LEN
];
cmdl
[
0
]
=
'\0'
;
fh
=
fopen
(
"/proc/self/cmdline"
,
"r"
);
if
(
fh
)
{
ii
=
0
;
fgets
(
cmdl
,
DARSHAN_EXE_LEN
,
fh
);
for
(
i
=
1
;
i
<
DARSHAN_EXE_LEN
;
i
++
)
{
if
(
cmdl
[
i
]
==
0
&&
ii
==
0
)
{
cmdl
[
i
]
=
' '
;
ii
=
1
;
}
else
if
(
cmdl
[
i
]
==
0
&&
ii
==
1
)
{
break
;
}
else
{
ii
=
0
;
}
}
}
else
{
sprintf
(
cmdl
,
" <unknown args>"
);
}
fclose
(
fh
);
strncat
(
core
->
log_exemnt_p
,
cmdl
,
space_left
);
space_left
=
DARSHAN_EXE_LEN
-
strlen
(
core
->
log_exemnt_p
);
space_left
=
DARSHAN_EXE_LEN
-
strlen
(
core
->
log_exemnt_p
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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